Re: [LAD] LV2: Communicate from the DSP to the UI

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linux Audio Developers <linux-audio-dev@...>, <devel@...>
Date: Sunday, October 27, 2013 - 8:38 pm

--047d7b86f356f453c304e9bef6f6
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Sun, Oct 27, 2013 at 3:18 PM, Michael Fisher wrote=
:

>

rote:

Sorry, I prematurely pressed 'send' on the last message.

continuing on... after forging a frame_time, just write a normal float (no
blank object needed)

m_forge->write_float (1604);

And that should be it. From a technical standpoint, whenever writing to a
sequence you MUST write the time stamp (forge->frame_time
(a_timestamp_value)) before adding the 'next' event.

Your ttl file has atom:Float as the buffer type. I've never used
anything besides atom:Sequence. I imagine this buffer type doesn't need a
sequence head forged first. Maybe David will jump in on how atom:Float
bufferType'd ports are supposed to forged into and out of.

I recommend, if you want to use LVTK to do atom forging, that you subclass
lvtk::AtomForge and add appropriate methods to it...

Here's a snippet that shows how to write patch get/set messages with a
subclassed AtomForge. It also shows how to write raw midi.

http://pastebin.com/C1LYtXpv -- the code in there uses small uses the
nullptr macro. just change those to "0" if you're not using c++11

... and that should be it Plugin-Side.

>

--047d7b86f356f453c304e9bef6f6
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On Sun, Oct 27, 2013 at 3:18 PM, Michael Fisher <mfish=
er31@gmail.com
> wrote:

On Sun, Oct 27, 2013 at 2:25 PM, Aur=E9lien Leblond <bl=
ablack@gmail.com
> wrote:
Hi everyone,

In my lv2 plugin, I need to communicate information from the DSP to
the UI, but I don't want to break the DSP/UI separation principle (no
Instance or Data access). On top of that, I'm using LVTK.

The type of data I'm trying to move is a Vector of Float (buffer type
Sound in the ttl) - but even basic information on how to transfer a
Float from the DSP to the UI would be valuable.he, he, yeah it can get a little confusing... maybe this wil=
l help.=A0=A0 =A0 // you're sending things in an =
atom sequence so get the size information

=A0 =A0 // from the port buffer=A0 =A0 LV2_A=
tom_Sequence* aseq =3D (LV2_Atom_Sequence*) p (p_notify);=A0 =A0=
m_forge->set_buffer ((uint8_t*) aseq, aseq->atom.size);=A0 =A0 m_forge->sequence_head (m_notify_frame, 0);

=A0 =A0 // sequences need a timestamp for each event added=
=A0 =A0 m_forge->frame_time (0);<=
/blockquote>Sorry, I prematurely pressed=
'send' on the last message.
continuing on... =A0after forging a frame_time, just wr=
ite a normal float (no blank object needed)m_forg=
e->write_float (1604);And that should be i=
t. =A0From a technical standpoint, whenever writing to a sequence you MUST =
write the time stamp =A0(forge->frame_time (a_timestamp_value)) before a=
dding the 'next' event.
Your ttl file has =A0atom:Float =A0as the buffer type. =
=A0I've never used anything besides atom:Sequence. =A0I imagine this bu=
ffer type doesn't need a sequence head forged first. =A0Maybe David wil=
l jump in on how atom:Float =A0bufferType'd =A0ports are supposed to fo=
rged into and out of.
I recommend, if you want to use LVTK to do atom forging=
, that you subclass =A0lvtk::AtomForge and add appropriate methods to it...=
=A0=A0Here's a snippet that shows how to wri=
te =A0patch get/set messages with a subclassed AtomForge. =A0It also shows =
how to write raw midi.
http://pastebi=
n.com/C1LYtXpv
=A0-- =A0the code in there uses small uses the nullptr m=
acro. =A0just change those to "0" =A0if you're not using c++1=
1
... and that should be it Plugin-Side.=A0
=A0 =A0=A0
In my UI, I just want to see if I receive this dataIn the port_even=
t method, at the moment the only thing I'm doing is:=A0 =A0 std::co=
ut << port << " - " << format << std::end=
l;

The port is defined in the TTL as follows:=A0 =A0 a lv2:Out=
putPort, atom:AtomPort ;=A0 =A0 atom:bufferType atom:Float ;=A0 =A0=
atom:supports <http://lv2plug.in/ns/ext/patch#Message> ;

=A0 =A0 lv2:index 1 ;=A0 =A0 lv2:symbol "notify" ;=A0 =A0=
lv2:name "Notify" ;=

What I have do so far in the DSP (run method)
=A0 =A0 m_forge->set_buffer((uint8_t*)p(p_notify), sizeof(float));
//p_notify being the atom port
=A0 =A0 m_forge->sequence_head(m_notify_frame, 0);

=A0 =A0 ForgeFrame p_frame;
=A0 =A0 Atom p_msg =3D m_forge->write_blank(p_frame, 1, urids.atom_Float=
);
=A0 =A0 m_forge->property_head(urids.atom_value, 0);
=A0 =A0 m_forge->write_float(1604); //test data i'm trying to move
=A0 =A0 m_forge->pop(p_frame);

In my UI, I just want to see if I receive this data
In the port_event method, at the moment the only thing I'm doing is:
=A0 =A0 std::cout << port << " - " << format &l=
t;< std::endl;

The port is defined in the TTL as follows:
=A0 =A0 a lv2:OutputPort, atom:AtomPort ;
=A0 =A0 atom:bufferType atom:Float ;
=A0 =A0 atom:supports <http://lv2plug.in/ns/ext/patch#Message> ;
=A0 =A0 lv2:index 1 ;
=A0 =A0 lv2:symbol "notify" ;
=A0 =A0 lv2:name "Notify" ;

At the moment, the code compiles and runs without crashing (yeah!),
but nothing happens (boo!).
Would you guys have any ideas?

Thanks in advance,
Aur=E9lien

--047d7b86f356f453c304e9bef6f6--

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAD] LV2: Communicate from the DSP to the UI, Aurélien Leblond, (Sun Oct 27, 7:25 pm)
Re: [LAD] LV2: Communicate from the DSP to the UI, David Robillard, (Wed Oct 30, 2:56 pm)
Re: [LAD] LV2: Communicate from the DSP to the UI, Michael Fisher, (Sun Oct 27, 8:18 pm)
Re: [LAD] LV2: Communicate from the DSP to the UI, Michael Fisher, (Sun Oct 27, 8:38 pm)