<div dir="ltr">On Sun, Oct 27, 2013 at 3:18 PM, Michael Fisher <span dir="ltr"><<a href="mailto:mfisher31@gmail.com" target="_blank">mfisher31@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">
<div class="im">On Sun, Oct 27, 2013 at 2:25 PM, Aurélien Leblond <span dir="ltr"><<a href="mailto:blablack@gmail.com" target="_blank">blablack@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi everyone,<br>
<br>
In my lv2 plugin, I need to communicate information from the DSP to<br>
the UI, but I don't want to break the DSP/UI separation principle (no<br>
Instance or Data access). On top of that, I'm using LVTK.<br>
<br>
The type of data I'm trying to move is a Vector of Float (buffer type<br>
Sound in the ttl) - but even basic information on how to transfer a<br>
Float from the DSP to the UI would be valuable.<br></blockquote><div><br></div></div><div>he, he, yeah it can get a little confusing... maybe this will help.</div><div> </div><div>    // you're sending things in an atom sequence so get the size information</div>

<div>    // from the port buffer</div><div><br></div><div>    LV2_Atom_Sequence* aseq = (LV2_Atom_Sequence*) p (p_notify);</div><div>    m_forge->set_buffer ((uint8_t*) aseq, aseq->atom.size);</div><div><br>    m_forge->sequence_head (m_notify_frame, 0);<br>

<br>    // sequences need a timestamp for each event added</div><div>    m_forge->frame_time (0);</div><div><br></div></div></div></div></blockquote><div><br></div><div><br></div><div>Sorry, I prematurely pressed 'send' on the last message.</div>
<div><br></div><div>continuing on...  after forging a frame_time, just write a normal float (no blank object needed)</div><div><br></div><div>m_forge->write_float (1604);<br></div><div><br></div><div>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.</div>
<div><br></div><div>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.</div>
<div><br></div><div>I recommend, if you want to use LVTK to do atom forging, that you subclass  lvtk::AtomForge and add appropriate methods to it...   </div><div><br></div><div>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.</div>
<div><br></div><div><a href="http://pastebin.com/C1LYtXpv">http://pastebin.com/C1LYtXpv</a>  --  the code in there uses small uses the nullptr macro.  just change those to "0"  if you're not using c++11<br></div>
<div><br></div><div><br></div><div>... and that should be it Plugin-Side.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div><br></div><div>    <div><div class="h5"><br><br><br>
<br>In my UI, I just want to see if I receive this data<br>In the port_event method, at the moment the only thing I'm doing is:<br>    std::cout << port << " - " << format << std::endl;<br>

<br><br><br>The port is defined in the TTL as follows:<br>    a lv2:OutputPort, atom:AtomPort ;<br>    atom:bufferType atom:Float ;<br>    atom:supports <<a href="http://lv2plug.in/ns/ext/patch#Message" target="_blank">http://lv2plug.in/ns/ext/patch#Message</a>> ;<br>

    lv2:index 1 ;<br>    lv2:symbol "notify" ;<br>    lv2:name "Notify" ;<br></div></div></div><div><div class="h5"><div><br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<br>
What I have do so far in the DSP (run method)<br>
    m_forge->set_buffer((uint8_t*)p(p_notify), sizeof(float));<br>
//p_notify being the atom port<br>
    m_forge->sequence_head(m_notify_frame, 0);<br>
<br>
    ForgeFrame p_frame;<br>
    Atom p_msg = m_forge->write_blank(p_frame, 1, urids.atom_Float);<br>
    m_forge->property_head(urids.atom_value, 0);<br>
    m_forge->write_float(1604); //test data i'm trying to move<br>
    m_forge->pop(p_frame);<br>
<br>
<br>
<br>
In my UI, I just want to see if I receive this data<br>
In the port_event method, at the moment the only thing I'm doing is:<br>
    std::cout << port << " - " << format << std::endl;<br>
<br>
<br>
<br>
The port is defined in the TTL as follows:<br>
    a lv2:OutputPort, atom:AtomPort ;<br>
    atom:bufferType atom:Float ;<br>
    atom:supports <<a href="http://lv2plug.in/ns/ext/patch#Message" target="_blank">http://lv2plug.in/ns/ext/patch#Message</a>> ;<br>
    lv2:index 1 ;<br>
    lv2:symbol "notify" ;<br>
    lv2:name "Notify" ;<br>
<br>
<br>
<br>
At the moment, the code compiles and runs without crashing (yeah!),<br>
but nothing happens (boo!).<br>
Would you guys have any ideas?<br>
<br>
Thanks in advance,<br>
Aurélien<br>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>