<div dir="ltr">On Mon, Oct 28, 2013 at 9:00 AM, Aurélien Leblond <span dir="ltr"><<a href="mailto:blablack@gmail.com" target="_blank">blablack@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">>> 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>
> he, he, yeah it can get a little confusing... maybe this will help.<br>
>    // you're sending things in an atom sequence so get the size information<br>
>    // from the port buffer<br>
><br>
>    LV2_Atom_Sequence* aseq = (LV2_Atom_Sequence*) p (p_notify);<br>
>    m_forge->set_buffer ((uint8_t*) aseq, aseq->atom.size);<br>
><br>
>    m_forge->sequence_head (m_notify_frame, 0);<br>
><br>
>    // sequences need a timestamp for each event added<br>
>    m_forge->frame_time (0);<br>
><br>
>    // after forging a frame_time, just write a normal float (no blank object needed)<br>
><br>
>    m_forge->write_float (1604);<br>
<br>
> Your ttl file has  atom:Float  as the buffer type.  I've never used<br>
> anything besides atom:Sequence.  I imagine this buffer type doesn't need a<br>
> sequence head forged first.  Maybe David will jump in on how atom:Float<br>
>  bufferType'd  ports are supposed to forged into and out of.<br>
<br>
Ok, so I changed my code the way you proposed (with switching in the<br>
ttl to Sequence), but still don't manage to make it work.<br>
I'm wondering if there isn't something wrong with the way I setup the<br>
Forge in the first place. I'm a bit confused with the way to interact<br>
wiith the map object in LVTK.<br>
<br>
   Scope::Scope(double rate) : Plugin<Scope, URID<true>,<br>
Options<true>>(p_n_ports)<br>
   {<br>
       m_forge = new AtomForge(p_map);<br>
   }<br>
<br></blockquote><div><br></div><div>The map object is 'just there' for when you need it, like creating new forges ;)  I've always wondered if it made more sense  to provide a accessor method to it for clarity   Plugin::get_urid_map() const   or something like that.</div>
<div><br></div><div>That looks right for creating a forge, AtomForge's  ctor will call lv2_atom_forge_init</div><div>when the map is passed in (just like you do above)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

   void Scope::run(uint32_t nframes)<br>
   {<br>
       // you're sending things in an atom sequence so get the size information<br>
       // from the port buffer<br>
<br>
      LV2_Atom_Sequence* aseq = (LV2_Atom_Sequence*) p (p_notify);<br>
      m_forge->set_buffer ((uint8_t*) aseq, aseq->atom.size);<br>
<br>
       m_forge->sequence_head(m_notify_frame, 0);<br>
<br>
       // sequences need a timestamp for each event added<br>
       m_forge->frame_time(0);<br>
<br>
       m_forge->write_float(1604);<br>
   }<br>
<br></blockquote><div><br></div><div>Still nothing happening on the GUI end ay?  Could I just have a link to the full source code?  I'm better debugging hands on.  Sorry, I can't recall the git address to your plugin set.</div>
<div><br></div><div>Forging atoms (in a way that actually works) isn't by any means a straight forward process.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
> I recommend, if you want to use LVTK to do atom forging, that you subclass<br>
> lvtk::AtomForge and add appropriate methods to it...<br>
><br>
> Here's a snippet that shows how to write  patch get/set messages with a<br>
> subclassed AtomForge.  It also shows how to write raw midi.<br>
><br>
> <a href="http://pastebin.com/C1LYtXpv" target="_blank">http://pastebin.com/C1LYtXpv</a>  --  the code in there uses small uses the<br>
> nullptr macro.  just change those to "0"  if you're not using c++11<br>
<br>
Could you tell me the advantages of doing that?<br></blockquote><div><br></div><div>1)  AtomForge inherits LV2_Atom_Forge directly.  This makes it possible to use this class as if it were a regular c-typed forge..    e.g ...</div>
<div>   </div><div>    AtomForge* forge = new AtomForge (this->p_map);</div><div>    lv2_atom_forge_float (forge, 45.0f);</div><div><br></div><div>.... would work.  It makes it possible to do custom forging using the normal LV2 Atom API if wanted</div>
<div><br></div><div>2)  By inheriting and adding to it keeps all of your forge'ing related code organized into one place.  Its a nice thing to do if you're not into writing the same lines of code over and over again.</div>
<div><br></div><div>So I suppose its a personal preference kind of thing.  Personally, once I discover how to write a particular atom type correctly, I like to save it and not have to figure it all out again.</div><div><br>
</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
But I had a look at the code, I still need to understand how to work<br>
with LV2_URID_Map in LVTK (I cannot find any examples using it).<br>
</blockquote></div><br></div></div>