How to create a reaction for a button in mode toggle ?

1.47K viewsCSS Community ScriptsButton toggle
0

Hello everyone
I’m trying to create a reaction for a button in toggle mode like for the “track mute” function. Example :
– Button 1 was pressed = set loop is ON
– Button 1 was pressed again = set loop is OFF
With a feedback LED on button 1.
Should I put button 1 on my controller and on the CSS in Momentary mode or Toggle mode?
Thanks in advance

Fabrice Planquette Answered question
0

This first one from Glenn is very clever and simple, just add an exit reaction to the first block when applying to a modifier.

You could also do this using this method : https://community.remotify.io/questions/question/cycle-through-values-with-1-button/

And for the LED feedback you could simply send this value scaled to 0-127 to the corresponding controller.

ie if i range is 0-1, self.midi_cc_ch_0_val_2.send_value(i*127) (for controller CC2 ch1).

gwen971 Posted new comment

Thank for your answer. I work today I will check this tonight. Have a good day

Hi
Thanks for the set loop that’s OK !!
I’m trying to transpose the function to set mute.
Led = 60 = mute off
Led = 15 = mute on
Led = 12 = track M1 doesn’t exist.
I managed to add the return led = 12 when we delete track M1. But I can’t make the LED = 60 when I create a new m1 track. I have to click button 9 (set mute) twice for the LED to come back on. If you have a solution, I thank you in advance. Here is the code below.

Listener :
– script is initialized
– button 9 was pressed
– m1 modifier was updated
– self.song().tracks[self.get_modifier_value(“m1”)].add_name_listener

Action block 1 :
conditions : self.song().tracks[self.get_modifier_value(“m1”)].mute == False
action :
self.song().tracks[self.get_modifier_value(“m1”)].mute = True
self.midi_cc_ch_6_val_50.send_value(15)
return

Action block 2
condition : self.song().tracks[self.get_modifier_value(“m1”)].mute == True
actions :
self.song().tracks[self.get_modifier_value(“m1”)].mute = False
self.midi_cc_ch_6_val_50.send_value(60)

action 3
condition : self.get_modifier_value(“m1”) == -1
self.midi_cc_ch_6_val_50.send_value(12)

if you have a solution thanks

It is because when you create a new track, the condition to have LED at 60 is only “is it muted? = yes”.
Maybe you should add an OR condition for m1 == -1

Thanks I found the solution. I removed the led feedback from the reaction st Mute and I created a specific reaction for the led feedback set mute using the script that you previously sent me. Everything works, it’s perfect. Thanks again

You are viewing 1 out of 2 answers, click here to view all answers.