-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making use of ofParameters #8
Comments
I'd rather keep the base class clean and simple as it is. There's no need to add a ofParameterGroup to the base class, as it will be useless without subclassing. In the case that you want to have all your ofxSoundObjects as pointers in an array and from there call the parameter group I'd recommend you to make a new subclass with the ofParameterGroup and anything else you might consider necessary. Also any parameter change is a very possible thread problem, as the audio runs on a different thread. adding a mutex will not solve this as you'll need to add a callback to make use of it. if you happen to add parameters to your own subclass, add the corresponding call back for the parameters and flag an update so the next time the audio is processed the parameters are updated. It might sound crazy but is the only way to keep it thread safe. If you have a different idea just let me know :) |
Hey Roy, thanks for the explanation. Sounds trickier than i thought. I will think about it. |
I added an ofParameterGroup to my custom base class and the very first step in my processBlock function is to get the values from the parameters and store them in a variable. While iterating the buffer i use the value from the variable instead of the parameter which might have already changed again. |
Hey thomas, right that's a possible solution. |
Just a little note on this, the current solution is not thread safe either. |
Hi, you're right! I guess that using another local variable should work, as you described. Although I'm not completely sure if in the particular case of the delay feedback it would be a problem to have it's value changed during processing. Think of the delay as a real analog delay. Whenever you changed any knob it´s effect is inmediate -there's no need to wait for the next chunk of data to be able to use the new value of the parameter. Hence, maybe it's enough just to have a mutex whithin the setFeedback function. I think that this should be analyzed for each particular case in order to determine the best solution. |
Yes, I also think that this can be ignored in most cases. |
Can we make use of ofParameter?
I would like to add ofParameterGroup and a getter to ofxSoundObject base class.
This would allow us to create GUIs in a very fast way.
Any cons?
The text was updated successfully, but these errors were encountered: