Hey guys!
I have a fader here and I'm currently switching it so that I can use one fader to control multiple things.
here's my code:
if(@{CSSCloseSwitch} == 1){
console.log("1");
send("/control", 1, 60, value);
}
if(@{CSSCloseSwitch} == 2){
console.log("2");
send("/control", 2, 61, value);
}
if(@{CSSCloseSwitch} == 3){
console.log("2");
send("/control", 3, 62, value);
}
if(@{CSSCloseSwitch} == 4){
console.log("2");
send("/control", 4, 63, value);
}
if(@{CSSCloseSwitch} == 5){
console.log("2");
send("/control", 1, 65, value);
}
if(@{CSSCloseSwitch} == 6){
console.log("2");
send("/control", 1, 60, value);
send("/control", 2, 61, value);
send("/control", 3, 62, value);
send("/control", 4, 63, value);
send("/control", 5, 65, value);
send("/control", 6, 61, value);
send("/control", 7, 61, value);
}
The 1~5 value represent from Violin to Bass
And the 6 value is a overall control(sending to all channels and CCs)
The problem is, my fader wouldn't "store/read" any value in this case, it's just sending values.
But I want the value of the fader to stay the same as set before once I switch it back.
For instance, I set VLN II's value to 50, and then I switch it to VLN I, and change the value to 100. Then when I switch it back to VLN II, the value should jump to 50 as set before.
My first approach is : store the values to a custom variable like: I'll add "var vln2 = [the sent value]" to the if statement of if(@{CSSCloseSwitch} == 2) and so on.
But I don't know how excatly can I store the currently sent value to a variable.
So my second thought is : I can store the returning value(using "midi send" in Cubase can loop the midi message sent by OSC back) in a variable and then set the currently value to the variable value.
But I still don't know how to read a received value in OSC. And I fear there might be a "feedback" problem:
read&store the received value(best if I can store only the "value" part) to var vln2
if(@{CSSCloseSwitch} == 2){
set value to var vln2
console.log("2");
send("/control", 2, 61, value);
So that's basically it!
In short, I just want a fader switching between different "modes" and would never lose the value of every "mode".
Does anyone have the solution for this?
Thanks in advance