parameterUpdate is same thread as process

Discussion about the Bidule SDK, post your questions, feature request and plugins here.

Moderators: davidv, seb@plogue

dts350z
Posts: 1495
Joined: Thu Jan 15, 2009 1:18 pm

parameterUpdate is same thread as process

Postby dts350z » Fri Feb 12, 2016 2:49 pm

Is it safe to empty and repopulate a vector, used in process, in parameterUpdate?

Code: Select all

   if(id == 12) {
      getParameterValue(12, _dWindowsSizeSeconds);
      _iWindowSizeSamples = (int)_dspInfo.sampleRate * _dWindowsSizeSeconds;
      _vWindow.clear();
      _vWindow.push_back (_iWindowSizeSamples);
      std::fill  (_vWindow.begin(),_vWindow.end(),0.0f); 

   }


I guess I'm asking if the two functions run in the same thread?

I'm working on measuring RMS Peak and Crest Factor of audio samples in a rolling window (say 10ms), but I want the window size to be a user adjustable parameter.

seb@plogue
Site Admin
Posts: 9420
Joined: Tue Mar 02, 2004 7:23 pm
Location: Montreal
Contact:

Re: parameterUpdate is same thread as process

Postby seb@plogue » Fri Feb 12, 2016 2:58 pm

I guess I'm asking if the two functions run in the same thread?


There's no guarantee on which thread parameterUpdate might be called so what you're doing might be dangerous.

dts350z
Posts: 1495
Joined: Thu Jan 15, 2009 1:18 pm

Re: parameterUpdate is same thread as process

Postby dts350z » Fri Feb 12, 2016 3:15 pm

Is there a flag that tells me if processing is on or off?

Or should I just do this vector resizing in the start function?

i.e. you could change the parameter anytime, but it wouldn't take affect until processing was stopped and started. That would be OK with me.

seb@plogue
Site Admin
Posts: 9420
Joined: Tue Mar 02, 2004 7:23 pm
Location: Montreal
Contact:

Re: parameterUpdate is same thread as process

Postby seb@plogue » Mon Feb 15, 2016 10:09 am

You could do it on start, so you'll be sure that process is not happening.

Otherwise you could also do it in idle but you'll need to mutex the access because
it could happen at the same time as process.

Lastly depending on the sizes used and if this doesn't happen very often, you _might_ be able
to get away with doing it in process.


Return to “Bidule SDK”

Who is online

Users browsing this forum: No registered users and 1 guest