Updating synth params using value tree vs slider::listener etc


#1

I have a quick question regarding the best way to update params for the Synthesiser class.

At the moment I’m using the Audioprocessorvaluetreestate functionality to update new values from my ui components, by using getRawParameterValue() then passing these values onto my SynthVoice class.

I’m wondering if this is the best way to handle this, or if I should pass these values on via listeners, passing them directly to the SynthVoice class via sliderValueChanged().

I was just thinking now that maybe I should update the second way, as the value would only relay when there is a change. By updating the params in my audiocallback, I’m continually updating at audio rate unnecessarily.

Was wondering if anyone has thoughts on this one way or the other?
Thanks for any help


#2

If im not mistaken, when you add this functionality with a listener, it only works the one way, meaning, you change the parameter within your daw and your synth is updated, but when you change it within your synth your daw would see that. I mean its not necessarily a bad thing, but with an attachment it would work in both ways.

edit: now that I reread your post I’m not quit sure if I got you right: Do you use the Audioprocessorvaluetreestate to communicate with your DAW?


#3

Hey thanks for your reply. Yes so I’m using the AudioProcessorValueTreeState to communicate to the DAW and as far as I can see the communication is working both ways. I don’t actually have anything implemented in my sliderValueChanged or comboBoxChanged functions, which makes me wonder if I even need the listeners in the first place? Does that sound right to you?


#4

I have to admit that I am not a pro user. So the way I understood: If you use an attachment, the parameter and the component are hooked to each other, no need to do anything else, you hook them and they change each other. the SliderValueChanged or comboboxchanged is the callback for the listener. so if you don’t use the listener you then don’t need the callback of course. And this works the other way around, if you use the listener, you don’t have to attach the component to a parameter (correct me if I am wrong here). I think the listener would come in handy if you had more then one Slider that should listen to a parameter change. in most cases you would not want everything to change the same way, so you could modify the incoming value with the callback. another use case for the listener could be if you wanted to do something really “complicated” like your own ramping, which is not just done by hooking.


#5

Great thanks for your clarification!