I have a global counter named counterUp that increments when it receives CC 23 using a Trigger.
I would like to be able to reset the counter to zero when sending a different CC (i.e CC 25).
I have a global named resetAll whose source is set to CC 25.
When I trigger CC25 (CC25 button is 0 when up and 127 when down), I see the resetAll variable value change 127, and when i release the button it goes back to zero.
I can't figure out an expression that will reset the counterUp variable to zero though. I can get it to change to zero when I press the CC25 button, but then it goes back to its current counter value when I release the CC25 button.
I currently have:
if(resetAll==1, 0, x:=x+1)
Thanks in advance!
reset a global var from a CC message
Re: reset a global var from a CC message
The only way I can think of to do this is to not use globals and put a Reset node after the node that is triggering the count. A reset modifier for all parameter modifiers including in globals would certainly be handy.
Re: reset a global var from a CC message
Thanks for this, but I don't think it will work in this case.
A little more about my setup, because there's probably a better way to do this:
I'm playing live and running magic. I have a single laptop running gigperformer and magic. I can pass a ctrl+E to magic to reset everything, but unfortunately gigperformer is always running in the foreground and I have to switch to magic to do that.
I have a midi captain 6 button that I'm using to control magic.
I use two buttons to increment or decrement a global counter. I use that counter on an input selector to progress through some changes for each scene. This counter is what I want to reset when a new scene loads.
Two other buttons are set to latching to turn things on and off.
The last two buttons are set to increment or decrement the magic playlist.
I'm using CC commands for everything.
Because it's all on the same laptop, I load gigperformer first and it grabs all the midi devices. I then use loopMIDI to pass the midi captain commands to magic from gigperformer. One downside to this is I can't pass HID commands from the midi captain. A Ctrl+E on the scene change buttons would work perfect for me but the HID commands get lost in gigperformer and not passed through the loopMIDI port. Another computer would solve the problem but introduce other challenges as a lot of my scenes are reacting to MIDI being playing on keyboards.
Is there a better way to do what I'm doing?
A little more about my setup, because there's probably a better way to do this:
I'm playing live and running magic. I have a single laptop running gigperformer and magic. I can pass a ctrl+E to magic to reset everything, but unfortunately gigperformer is always running in the foreground and I have to switch to magic to do that.
I have a midi captain 6 button that I'm using to control magic.
I use two buttons to increment or decrement a global counter. I use that counter on an input selector to progress through some changes for each scene. This counter is what I want to reset when a new scene loads.
Two other buttons are set to latching to turn things on and off.
The last two buttons are set to increment or decrement the magic playlist.
I'm using CC commands for everything.
Because it's all on the same laptop, I load gigperformer first and it grabs all the midi devices. I then use loopMIDI to pass the midi captain commands to magic from gigperformer. One downside to this is I can't pass HID commands from the midi captain. A Ctrl+E on the scene change buttons would work perfect for me but the HID commands get lost in gigperformer and not passed through the loopMIDI port. Another computer would solve the problem but introduce other challenges as a lot of my scenes are reacting to MIDI being playing on keyboards.
Is there a better way to do what I'm doing?
Re: reset a global var from a CC message
My suggestion works for me. You can still have your MIDI trigger and reset as globals as I've done here but it works either way.
Re: reset a global var from a CC message
Sadler's solution might work for your situation, if I understand it correctly.
But as he also said, I think your problem would be solved (or at least simplified) by not using a Global.
To elaborate, Globals are specifically designed not to reset when the scene changes. That's why they are "Globals".
You've said that you want your counter to reset when a new scene loads. This happens by default when using the Trigger modifier in a module in your scene. This is different than how a Trigger modifier behaves in a Global -- it doesn't reset there.
Perhaps the confusion is that you want every scene to respond to CC 23 for triggering the InputSelector. That doesn't mean you need to use a Global Trigger. Just set up every InputSelector to have its own Trigger modifier locally, like what is shown in Sadler's screenshot. When you send a CC 23 to the Trigger, it only affects that Trigger.
Does that make sense?
But as he also said, I think your problem would be solved (or at least simplified) by not using a Global.
To elaborate, Globals are specifically designed not to reset when the scene changes. That's why they are "Globals".
You've said that you want your counter to reset when a new scene loads. This happens by default when using the Trigger modifier in a module in your scene. This is different than how a Trigger modifier behaves in a Global -- it doesn't reset there.
Perhaps the confusion is that you want every scene to respond to CC 23 for triggering the InputSelector. That doesn't mean you need to use a Global Trigger. Just set up every InputSelector to have its own Trigger modifier locally, like what is shown in Sadler's screenshot. When you send a CC 23 to the Trigger, it only affects that Trigger.
Does that make sense?
Re: reset a global var from a CC message
I got both solutions working, thank you both so much for the help!!!
Not using Globals for this as you both suggested makes the most sense - I was using globals to maintain a counter, but I don't really need to be doing that for this.
Not using Globals for this as you both suggested makes the most sense - I was using globals to maintain a counter, but I don't really need to be doing that for this.