Thread: Midi <-> OSC
View Single Post
Old 11-18-2017, 02:40 PM   #91
fundorin
Banned
 
Join Date: Feb 2014
Location: Moscow, Russia
Posts: 554
Default

Quote:
Originally Posted by mschnell View Post
Nope. If all slSlider... variables contain the same value, multiple messages will be sent (or none).

I would do

msg2 == slSlider1 ? (
send_soft_fader(1);
) : msg2 == slSlider2 ? (
...
Current code:
Code:
		// VOLUME SLIDERS
		slSlider1<=msg2<=slSlider8 ? (
			ccValue = msg2 - 15;
			send_soft_fader(ccValue);
		);

Code:
        slSlider1<=msg2<=slSlider8 ? (
This line checks if any of the faders were triggered by user, with the number that is within range of 16-23. Those numbers are transmitted by faders.

Code:
            ccValue = msg2 - 15;
This one takes CC value of the triggered fader and deducts a number, so that the resulting number would be 1-8, depending on which controller was moved.

Code:
            send_soft_fader(ccValue);
        );
Now, we initiate a function, which sends OSC action "f/action/%d/cc/soft" with a number 1-8 in place of %d, depending on which fader was moved.

I don't see any flaws in this code.



P.S. Thanks, Justin. It seems like memsets will still be needed for my script. Ok. That's fine with me.
I wish, though, that there wouldn't be any need of declaring the offset.

Does this method also means that one should use "mem_get_values(slSlider[1]" to read value instead of simple "slSlider[1]", for example?

Last edited by fundorin; 11-18-2017 at 02:50 PM.
fundorin is offline   Reply With Quote