Devices ON OFF in a reaction

218 viewsCSS Questionsdevice reaction Reactions
0

Hi All,

I have 4 buttons that control 4 devices.

I want only 1 button to be on at a time, meaning that one device is ON and the 3 others are OFF.

To do that, I tried using a Reaction on the Move button to send a 0 on all the other Buttons.

but the device does not react.

So my question is, how to set ON/OFF a device in a reaction action

Thanks

Eric francois Garcia Answered question December 21, 2024
0

Am I getting this right about your setup and what you want to have happen:

  • In the current selected track you have 4 devices.
    • Or are the buttons linked to devices over multiple tracks?
    • Are the buttons linked to 4 specific devices, or always the first 4 devices in the track?
  • Each device’s on/off switch is linked to its own button on your MIDI controller
  • Whenever you press one of those buttons, that button turns its respective device ON + it lights up the button, while all other devices and buttons are turned OFF.

I’m going to give my off-the-top-of-my-head description of how I would tackle the Reaction, based on the black bullets in the list above. However, if you’re trying to manipulate devices over multiple tracks or they’re not the first 4 devices in a Track, then you’ll need to make adjustments.

LISTENERS

Make a Listener for each of the 4 buttons. Make sure button 1 is at the top, then 2, then 3, …

ACTION BLOCK 0

If your buttons send out Momentary CC signals, then this Action Block should be used to exit the Reaction whenever a button sends out a MIDI value of 0. This way you turn a momentary signal into a toggle.

If all your buttons send out Toggle CC signals, then you may disregard this Action Block

Conditions: For each Listener, check if it sends out a value of 0 (thus you’ll need to make 4 separate conditions)

Action: “script” >> “Exit the Reaction”

ACTION BLOCK 1

This Action Block should deactivate the first 4 devices in the selected track

Loop: all DEVICES in the current SELECTED TRACK

– Use the path menu to set the path to the SELECTED TRACK (is the same method as explained below, in the Actions section)

Condition: loop number < 4 (because the loop number starts at 0, meaning the 4th device will have loop number 3)

Action:

  • Select “Live Object Model” >> “Device Parameter” >> “Set Value”
    • Enter 0 as the value you want to send

Using the path menu (which is accessible through the gray upwards pointing hand, see pictures below) make sure the path is set as follows:

  • Track = SELECTED TRACK
  • Device number = “script” >> “Loop” >> “Loop – Iteration number”
  • Parameter number may stay at 0 because the first parameter of a device is always the On/Off button of the device.

ACTION BLOCK 2

This Action Block should deactivate all LED’s on the 4 buttons.

Action: You’ll need to repeat the following for each button (meaning you’ll have 4 actions)

  • Select “MIDI Controller” >> “Send MIDI velocity value to input”
    • “Controller input”: enter the button you want to manipulate
    • “Velocity Value”: 0

ACTION BLOCKS 3 to 6

Each Action Block will only react to one of the Listeners. If you’re pressing Listener 1, then Action Block 3 will play out. If you’re pressing Listener 2, then Action Block 4 will play out. Etc.

You can make one Action Block, then duplicate it 3 times and modify accordingly.

Listener Numbers start counting at 1 (contrary to loop or device numbers that start counting at 0)

Condition: “Script” >> “Listener Number” IS EQUAL TO [enter the number of the listener as value]

Action 1: send LED value to the pressed button

  • Select “MIDI Controller” >> “Send MIDI velocity value to input”
    • “Controller input”: enter the respective button
    • “Velocity Value”: 127

Action 2: turn the respective device on

  • Select “Live Object Model” >> “Device Parameter” >> “Set Value”
    • Enter 127 as the value you want to send
  • In the Path Menu:
    • Track = SELECTED TRACK
    • Device number = [Enter the respective device’s number]
      device number starts counting from 0; meaning the first device has device number 0, the second device has device number 1, and so on…
    • Parameter number may stay at 0 because the first parameter of a device is always the On/Off button of the device.

Action 3 (optional): exit the reaction after finishing the previous actions. Optional because it’s not needed (the other Action Blocks won’t fire anyway because their Listener Number hasn’t come up) but I think it’s good practice not to let the code run if its not going to do anything anyway.

  • “script” >> “Exit the Reaction”

Hope this will help you figure things out.

Like mentioned, it’s off-the-top-of-my-head, meaning untested, and it might have some design flaw.

Glenn Verhaeghe Answered question December 20, 2024
1

Thanks a lot, Glenn. It works well.

Eric francois Garcia Answered question December 21, 2024