[LAD] Fwd: Re: How can an LV2 plugin UI get the value of a control port from the plugin?

hermann meyer brummer- at web.de
Mon Oct 20 14:35:46 UTC 2014


Am 20.10.2014 13:26, schrieb Philippe Coatmeur:
> Hello Harry;
>
> On 20/10/14 09:07, Harry van Haaren wrote:
>>
>> Most NTK widgets that have a "value" like a slider or a dial, derive 
>> from a base class that implements value() and value( float );
>>
>> What this means for a widget, is that in order to change the value of 
>> a widget called "wid", we do this:
>> wid->value( 0.0f ); // sets widget value to 0
> Oh, I get that, believe me. The info I need is around that ; I wish 
> your sentence had started earlier, like so "in port_event(), given 
> /this/ class declared like /this/ and an objet wid instantiated like 
> /this/, we do this (...)"
>
> From my port_event() I point to my UI object via the LV2UIHandle. this 
> object is a NTK widget (or so I hope, read on). So if I get a:
>
> error: 'class KisWidget' has no member named 'value' (it's pretty 
> explicit)
>
> It means the class KisWidget has no member named "value" I guess we 
> can agree on that ;)
>
> It must be that I did not declare my Widget class as a proper NTK 
> widget. The declaration is at line 25 in this file 
> <https://bitbucket.org/xaccrocheur/kis/src/8c3a85a9899f117d2fa273b6c7948402d780fb46/widget.h?at=master>. 
> The instantiation of the widgets (a FL_Dial and 5 FL_Slider) is at 
> line 96 in this file 
> <https://bitbucket.org/xaccrocheur/kis/src/8c3a85a9899f117d2fa273b6c7948402d780fb46/widget.cpp?at=master>.
>
> Now for the direct questions:
>
>   * Is it a proper NTK widget class declaration, that would expose a
>     value() method?
>   * Are those proper NTK widget class instances?
>
> Thanks for your patience
>
> --Phil
I never use FLTK, but I guess that is something essential.
You need to declare your control widgets in the class KisWidget, not in 
the constructor of the class.

in class KisWidget write

Fl_Slider* ReleaseButton;

in the constructor Widget::Widget(void* parentXwindow) write

ReleaseButton = new Fl_Slider( 220,5,35,100,"Rel");

Then you could access the widget pointers in kis_gui.cpp like that

static  void  port_event(

self->widget->ReleaseButton->value(value);

ReleasButton is a NTK widget, not yourclass KisWidget.

(Just pseudo code here, it isn't exact syntax)

Still, I never use FLTK, I just wonder if you didn't need a 
deconstructor to delete the widgets instances which have created with 
"new" ( Like you need to do in GTKmm)?
Did FLTK manage the memory?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxaudio.org/pipermail/linux-audio-dev/attachments/20141020/68d12cb7/attachment.html>


More information about the Linux-audio-dev mailing list