<div dir="ltr">On Mon, Nov 4, 2013 at 6:52 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Michael,<br>
<br><br>
What I think I should be doing is using Blank Atom to transfer the<br>
data from DSP to UI, right?<br></blockquote><div><br></div><div style>It sounds logical to me, yeah.  Doing it this way could be done by forging the Blank atom and then writing the float array as raw.   You would need to map a few uris specifically for this to use inside of the blank object.</div>
<div> </div><div style>seems like peak proptocol etc etc.. would could also be used here.  I don't think there's a single host that supports any of those kinds of features though....</div><div><br></div><div style>
some fake code doing it with an atom object and a raw buffer, I didn't try to compile any of this let alone try it in a real plugin.</div><div style><br></div><div style><br></div><div style>float buffer [bufsize];</div>
<div style>uint32_t object_type = this->map ("<a href="http://myuri#object">http://myuri#object</a>");</div><div style>uint32_t prop_type   = this->map ("<a href="http://myuri#prop">http://myuri#prop</a>");<br>
</div><div style><br></div><div style>...</div><div style><br></div><div style><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">ForgeFrame frame;</span></div>
<div style><br></div><div style>AtomObject obj (forge.write_blank (frame, 0, object_type));</div><div style>forge.property_head (prop_type, 0);</div><div style>forge.write_raw (buffer, sizeof (float) * bufsize);</div><div style>
<br></div><div>forge.pop (frame);<br></div><div style><br></div><div style><br></div><div style>and then on the GUI side use an AtomObject::iterator if you want it to look more like c++.  </div><div style><br></div><div style>
AtomObject obj (data_from_port_event);</div><div style>AtomObject::iterator prop = obj.begin();</div><div style><br></div><div style>float* buffer = 0;</div><div style>while (prop != obj.end())</div><div style>{</div><div style>
   if (prop->key == prop_type) {</div><div style>      buffer = LV2_ATOM_BODY (&prop->value);</div><div style>      break;</div><div style>   }</div><div style><br></div><div style>  ++prop;</div><div style>}</div>
<div style><br></div><div style>if (buffer)</div><div style>    do_something_with (buffer);</div><div style><br></div><div style><br></div><div style>regular object getting and querying obviously would also work on the GUI end.</div>
<div style><br></div><div style><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">
- guiext:notifyType atom:Blank ;<br>
- atom:supports atom:Audio ;<br>
- on the DSP side, use the AtomForge write_raw method to write the<br>
array of floats<br>
<br>
Is that the right way to go or is there anything else I should consider?<br>
<br>
<br>
As the the lv2 scope plugin has 2 inputs that need to be represented<br>
in the GUI, I was wondering if I can pass the 2 arrays of floats in<br>
one go through only one Atom.<br>
>From the LV2 documentation, it looks like lv2 is loose enoigh that i<br>
can pass my own object, but I'm not sure how to approach that via LVTK<br>
(or via LV2 itself for that matter).<br>
<br>
<br>
Once again thanks in advance for your help,<br>
<br>
Aurélien<br>
<div class=""><div class="h5"><br>
<br>
On Mon, Oct 28, 2013 at 8:30 PM, Michael Fisher <<a href="mailto:mfisher31@gmail.com">mfisher31@gmail.com</a>> wrote:<br>
> On Mon, Oct 28, 2013 at 11:58 AM, Michael Fisher <<a href="mailto:mfisher31@gmail.com">mfisher31@gmail.com</a>><br>
> wrote:<br>
>><br>
>> On Mon, Oct 28, 2013 at 10:24 AM, Aurélien Leblond <<a href="mailto:blablack@gmail.com">blablack@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> > The map object is 'just there' for when you need it, like creating new<br>
>>> > forges ;)  I've always wondered if it made more sense  to provide a<br>
>>> > accessor<br>
>>> > method to it for clarity   Plugin::get_urid_map() const   or something<br>
>>> > like<br>
>>> > that.<br>
>>> ><br>
>>> > That looks right for creating a forge, AtomForge's  ctor will call<br>
>>> > lv2_atom_forge_init<br>
>>> > when the map is passed in (just like you do above)<br>
>>> ><br>
>>> >><br>
>>> >>    void Scope::run(uint32_t nframes)<br>
>>> >>    {<br>
>>> >>        // you're sending things in an atom sequence so get the size<br>
>>> >> 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>
>>> ><br>
>>> > Still nothing happening on the GUI end ay?  Could I just have a link to<br>
>>> > the<br>
>>> > full source code?  I'm better debugging hands on.  Sorry, I can't<br>
>>> > recall the<br>
>>> > git address to your plugin set.<br>
>>> ><br>
>>> > Forging atoms (in a way that actually works) isn't by any means a<br>
>>> > straight<br>
>>> > forward process.<br>
>>><br>
>>> Thanks for checking, I really have the feeling I'm missing something<br>
>>> small here :)<br>
>><br>
>><br>
>> Yep, missing something small seems to happen to me frequently.  I'm<br>
>> jumping over to my Linux machine and will give it a go.<br>
>><br>
>>><br>
>>><br>
>>> The SVN is here:<br>
>>> svn checkout svn://<a href="http://svn.code.sf.net/p/avwlv2/code/trunk" target="_blank">svn.code.sf.net/p/avwlv2/code/trunk</a> avw.lv2<br>
>>><br>
>>> (Ingen is the host I use to test them)<br>
>><br>
>><br>
><br>
> First things first.  Your plugin, after modifying ttl files, works fine in<br>
> Jalv.   For ingen support, your best bet might be to add a Trac ticket on<br>
> <a href="http://drobilla.net" target="_blank">drobilla.net</a>.<br>
><br>
> Ok, so I figured out the problem...   the GUI ttl file should look something<br>
> like this (with a portNotification setting)<br>
><br>
> <<a href="http://avwlv2.sourceforge.net/plugins/avw/scope/gui" target="_blank">http://avwlv2.sourceforge.net/plugins/avw/scope/gui</a>><br>
><br>
>         a guiext:GtkUI ;<br>
><br>
>         guiext:binary <scope_gui.so> ;<br>
><br>
>         guiext:portNotification [<br>
><br>
>             guiext:plugin <<a href="http://avwlv2.sourceforge.net/plugins/avw/scope" target="_blank">http://avwlv2.sourceforge.net/plugins/avw/scope</a>><br>
> ;<br>
><br>
>             lv2:symbol "notify" ;<br>
><br>
>             guiext:notifyType atom:Float<br>
><br>
>         ] .<br>
><br>
><br>
><br>
> the Port definition in the plugin's turtle :<br>
><br>
>           ... [<br>
><br>
>                 a lv2:OutputPort, atom:AtomPort ;<br>
><br>
> atom:bufferType atom:Sequence ;<br>
><br>
>                 atom:supports atom:Float ;   # <<<<<< NEED THIS (i think)<br>
><br>
> lv2:index 1 ;<br>
><br>
> lv2:symbol "notify" ;<br>
><br>
> lv2:name "Notify" ;<br>
><br>
>               ] .<br>
><br>
><br>
><br>
> I also added more debug output to the GUI...  all relevant changes were<br>
> committed in a git mirror on Github (its just easier for me to do that)  The<br>
> only files I modified were  scope*.*  files<br>
><br>
><br>
> You'll want to look at the GUI code, because I also show you how to<br>
> 'un-package' the atom in the port_event method.<br>
><br>
><br>
> <a href="https://github.com/axetota/avwlv2/tree/devel" target="_blank">https://github.com/axetota/avwlv2/tree/devel</a><br>
><br>
><br>
><br>
</div></div></blockquote></div><br></div></div>