Page 1 of 1

Button to turn Fader on and off

Posted: 22 Feb 2013 09:51
by Kaatza_Music
Pretty simple question. I want an on/off switch for my Fader which turns it off as if it doesn't exist, not set it to 0.

So what is the easiest approach, have the switch turn the MIDI output from it's assigned value to MIDI disabled? What is the value for MIDI disabled for a Fader? I assume the script would be in the Switches object and that it would reference the Fader it is linked to. So how do I switch it from MIDI 0 to Disabled in the Fader?

Thanks,

Re: Button to turn Fader on and off

Posted: 22 Feb 2013 12:08
by Softcore
You cannot switch midi mapping on-off. You CAN however create a custom expression that will only operate (change values) if a condition statement is true in a script.

for example
Create a switch.
create in fader expression c, leave it blank.

create in fader script, on expression x, any

Code: Select all

If (Switch_name.x==1) c=x;

Re: Button to turn Fader on and off

Posted: 23 Feb 2013 09:13
by Kaatza_Music
Softcore,

I entered it just like you said, but it doesn't seem to be working. Whether the switches is on or off, the MIDI data is still be transmitted by the Fader.

I thought I did everything right. Both the expression and the script go in the Fader correct? Nothing goes in the Switches?

I created an expression in the Fader called "c" and left everything else blank.

I created a script in the Fader:

act()
On expression
x
any

if (Switches_name.x==1) x=c;

The script went black like there were no errors, but it just doesn't work.
Any idea what I did wrong? Thanks!

Re: Button to turn Fader on and off

Posted: 23 Feb 2013 09:38
by Softcore
oooopssssss....sorry for that....

I should have written:

Code: Select all

if (Switches_name.x==1) c=x;
EDIT: I HAD written c=x; you just typed it wrong (x=c)

Re: Button to turn Fader on and off

Posted: 23 Feb 2013 09:44
by Softcore
Looks to be working...here's my testing project....

Of course, needless to say, you will have to Midi/OSC map the "c" expression, not the default x

;)
fader_on-off.jzml
(4.6 KiB) Downloaded 114 times

Re: Button to turn Fader on and off

Posted: 23 Feb 2013 10:47
by Kaatza_Music
I think I understand what you are doing now. I will try it out. Thanks once again for the help.

Re: Button to turn Fader on and off

Posted: 23 Feb 2013 12:04
by Softcore
Had plenty of time to fool around with it....

So....when you disable the fader (switch is off) we start to have unequal values for c,x. This means, that upon re-enabling the fader and moving it, the transmitted value (c) "jumps" to current fader position (x).

The improved "didnt know what to do with my time this morning" version features a handy display to show that x!=c and by clicking on it you manually re-sync them!
The feature can also be used for fast "jumps" between the current fader position and the position just before that (by tapping on the "arrow" buttons)

have fun! ;)
fader_on-off-reset.jzml
(8 KiB) Downloaded 109 times

Re: Button to turn Fader on and off

Posted: 23 Feb 2013 12:08
by Softcore
Ok lol - another idea lol

Hitting the left arrow resets c to fader, hitting the right arrow reset fader to c....

better try it to see the difference....lol....Im out for today!
fader_on-off-reset-2options.jzml
(8 KiB) Downloaded 99 times
BTW in both the two last versions I ve made extra steps in the scripts jsut to make sure moving around the fader or resizing doesnt "break" the functionality...the "moving" of the arrows is always relative to the size and position of the fader.

Re: Button to turn Fader on and off

Posted: 25 Feb 2013 01:07
by Kaatza_Music
Hey, Softcore,

I ended up using your original version and it is working perfectly for what I wanted. Thanks once again for the help.

Re: Button to turn Fader on and off

Posted: 25 Feb 2013 09:26
by Softcore
Still dont like the fact that in the first version you are gonna have a value jump which is unpredictable.

here's a more elegant solution: whne the fader is disabled (switch is off) the fader is LOCKED to its position - even if you move it it returns to its initial value untill you enable it again.

I think now we have covered all the posible usage scenarios for future members ;)
fader_on-off-lock.jzml
(5.25 KiB) Downloaded 114 times
EDIT: This last one can also be used as a fader with "auto-reset" and "learn" function by mapping x instead of c. You engage the switch and move the fader to the desired "reset" value. After disengaging the switch you can move tha fader and it will always return to that "reset" value previously entered.