How to assign use input value in defining a variable?
Closed this issue · 1 comments
silver-rain-dev commented
I was hoping to use a knob to adjust the delay time, but when I try the code below I get
error: Expected a value int delayInSample = delayMs1 * 48000;
What is the correct way to use an input value/stream/event to create a variable?
graph DelayTest [[ main ]]
{
input stream float audioIn;
output stream float audioOut;
input delay.wet wet1 [[ name: "Wet1 Level", min: 0, max: 1, init: 0.5, unit: "", step: 0.1 ]];
input delay.dry dry1 [[ name: "Dry1 Level", min: 0, max: 1, init: 0.5, unit: "", step: 0.1 ]];
input value int delayMs1 [[ name: "Delay1 ms", min: 0, max: 5000, init: 0, unit: "", step: 50 ]];
//==============================================================================
int delayInSample = delayMs1 * 48000;
node delay = AudioDelay(float, 48000, delayInSample);
connection
{
audioIn->delay.in;
delay.out->audioOut;
}
}
julianstorer commented
Sorry that this issue was never looked at - I'm just going through some old ones now...!
Yes, any variables that you define in a graph must be compile-time constants, so you can't use a dynamic expression there. The error message is a bit rubbish though, so I'll have a look at improving that!