[LV2] Usual way for UI to access sample rate

Johannes Mueller github at johannes-mueller.org
Fri Jul 28 02:02:48 PDT 2017


Filipe Coelho wrote:
> On 28.07.2017 10:15, Hermann Meyer wrote:
> > Usually all hosts I know do it right.
> > Samplerate is given in init.
> 
> Only for plugins, not the UI.
> Do you know a host which passes the samplerate to the UIs?
> (I do it in Carla, but I think I might be doing it the wrong way...)
> 
> > You could set the value then on a outputport and read it in the UI.
> 
> Seems like a workaround for something that is rather important.
> We want separation of DSP and UI objects, so the UI needs to know the
> sample rate.
> Using an output port means waiting for the value, delaying full UI creation.

I could use a simple lv2:OutputPort , lv2:ControlPort and shout out the sample 
rate all the time, so that the UI hears it, when it's alive every once in a 
while.

Or I could use Atom messages so that the UI signals to DSP that it has been 
instantiated. Then DSP checks in every run() if the UI is up and then sends 
the sample rate in a LV2_Atom_Double message. A little bit cumbersome at least 
if you don't have any other Atom communication between UI and DSP.

I don't like about both solutions, that DSP has additional work in every run() 
just to tell UI something that is constant anyways and actually something 
that's up to the host.

Thanks

Johannes

-- 
https://github.com/johannes-mueller/


More information about the Devel mailing list