Clifford Dunn
2014-10-20 00:08:00 UTC
I'm having a hell of a time with this. I want to push a momentary
push-button pedal that is sending MIDI to SC and have that alternate
between adding a number or subtracting a number. Basically I have
this:
if(num == 40, {~switch = ~switch +1});
And then if I hit it again I want a - 1 instead. Using %2 won't work
because I have other buttons that change the value of ~switch as well.
What I imagine would work is something like if(~switch == 0, {~switch
= ~switch +1}) if (~switch == 1, {~switch = ~switch - 1}). Which I
would then expand to all my values of switch. However, putting these
lines together won't work because when the pedal is hit, first it will
add and then immediately it will subtract. What sort of has success is
something like this: if(~switch ==0, {~switch = ~switch +1}, {~switch
= ~switch -1}). But I had some odd results. I feel like there must be
some operation or method I'm missing in order to alternate between +1
and -1.
Thanks!
Clifford Dunn
Flutist/Composer
http://www.ckdmusic.blogspot.com
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
push-button pedal that is sending MIDI to SC and have that alternate
between adding a number or subtracting a number. Basically I have
this:
if(num == 40, {~switch = ~switch +1});
And then if I hit it again I want a - 1 instead. Using %2 won't work
because I have other buttons that change the value of ~switch as well.
What I imagine would work is something like if(~switch == 0, {~switch
= ~switch +1}) if (~switch == 1, {~switch = ~switch - 1}). Which I
would then expand to all my values of switch. However, putting these
lines together won't work because when the pedal is hit, first it will
add and then immediately it will subtract. What sort of has success is
something like this: if(~switch ==0, {~switch = ~switch +1}, {~switch
= ~switch -1}). But I had some odd results. I feel like there must be
some operation or method I'm missing in order to alternate between +1
and -1.
Thanks!
Clifford Dunn
Flutist/Composer
http://www.ckdmusic.blogspot.com
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/