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

From: Aurélien Leblond <blablack@email-addr-hidden>
Date: Mon Nov 04 2013 - 14:52:16 EET

Hi Michael,

So I have made some progress in my quest to create a LV2 Visual Oscilloscope.
My aim now is to move not a unique float, but a vector of floats (or
audio sample) from the DSP the the UI:
The design I have in mind is as follows:
- During each run() in the DSP side, an array of float is created a
filled with the data from the Audio Input
- At the end of the run(), the vector is writtn into the notify atom port
- This array is caught on the UI side and used to feed the
Osciolloscope GTK widget

What I think I should be doing is using Blank Atom to transfer the
data from DSP to UI, right?
- guiext:notifyType atom:Blank ;
- atom:supports atom:Audio ;
- on the DSP side, use the AtomForge write_raw method to write the
array of floats

Is that the right way to go or is there anything else I should consider?

As the the lv2 scope plugin has 2 inputs that need to be represented
in the GUI, I was wondering if I can pass the 2 arrays of floats in
one go through only one Atom.
From the LV2 documentation, it looks like lv2 is loose enoigh that i
can pass my own object, but I'm not sure how to approach that via LVTK
(or via LV2 itself for that matter).

Once again thanks in advance for your help,

Aurélien

On Mon, Oct 28, 2013 at 8:30 PM, Michael Fisher <mfisher31@email-addr-hidden> wrote:
> On Mon, Oct 28, 2013 at 11:58 AM, Michael Fisher <mfisher31@email-addr-hidden>
> wrote:
>>
>> On Mon, Oct 28, 2013 at 10:24 AM, Aurélien Leblond <blablack@email-addr-hidden>
>> wrote:
>>>
>>> > 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.
>>> >
>>> > That looks right for creating a forge, AtomForge's ctor will call
>>> > lv2_atom_forge_init
>>> > when the map is passed in (just like you do above)
>>> >
>>> >>
>>> >> void Scope::run(uint32_t nframes)
>>> >> {
>>> >> // you're sending things in an atom sequence so get the size
>>> >> information
>>> >> // from the port buffer
>>> >>
>>> >> LV2_Atom_Sequence* aseq = (LV2_Atom_Sequence*) p (p_notify);
>>> >> m_forge->set_buffer ((uint8_t*) aseq, aseq->atom.size);
>>> >>
>>> >> m_forge->sequence_head(m_notify_frame, 0);
>>> >>
>>> >> // sequences need a timestamp for each event added
>>> >> m_forge->frame_time(0);
>>> >>
>>> >> m_forge->write_float(1604);
>>> >> }
>>> >>
>>> >
>>> > 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.
>>> >
>>> > Forging atoms (in a way that actually works) isn't by any means a
>>> > straight
>>> > forward process.
>>>
>>> Thanks for checking, I really have the feeling I'm missing something
>>> small here :)
>>
>>
>> Yep, missing something small seems to happen to me frequently. I'm
>> jumping over to my Linux machine and will give it a go.
>>
>>>
>>>
>>> The SVN is here:
>>> svn checkout svn://svn.code.sf.net/p/avwlv2/code/trunk avw.lv2
>>>
>>> (Ingen is the host I use to test them)
>>
>>
>
> First things first. Your plugin, after modifying ttl files, works fine in
> Jalv. For ingen support, your best bet might be to add a Trac ticket on
> drobilla.net.
>
> Ok, so I figured out the problem... the GUI ttl file should look something
> like this (with a portNotification setting)
>
> <http://avwlv2.sourceforge.net/plugins/avw/scope/gui>
>
> a guiext:GtkUI ;
>
> guiext:binary <scope_gui.so> ;
>
> guiext:portNotification [
>
> guiext:plugin <http://avwlv2.sourceforge.net/plugins/avw/scope>
> ;
>
> lv2:symbol "notify" ;
>
> guiext:notifyType atom:Float
>
> ] .
>
>
>
> the Port definition in the plugin's turtle :
>
> ... [
>
> a lv2:OutputPort, atom:AtomPort ;
>
> atom:bufferType atom:Sequence ;
>
> atom:supports atom:Float ; # <<<<<< NEED THIS (i think)
>
> lv2:index 1 ;
>
> lv2:symbol "notify" ;
>
> lv2:name "Notify" ;
>
> ] .
>
>
>
> I also added more debug output to the GUI... all relevant changes were
> committed in a git mirror on Github (its just easier for me to do that) The
> only files I modified were scope*.* files
>
>
> You'll want to look at the GUI code, because I also show you how to
> 'un-package' the atom in the port_event method.
>
>
> https://github.com/axetota/avwlv2/tree/devel
>
>
>
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Mon, 4 Nov 2013 12:52:16 +0000

This archive was generated by hypermail 2.1.8 : Mon Nov 04 2013 - 16:15:02 EET