Not sure how to properly word this since English isn’t my native language. What I’d like to achieve is use one regular key button as on/off for a certain MIDI message. For the ‘on’ state the device accepts one MIDI message, for the ‘off’ state it will be a different one. So I’d like to press the same key once - it turns on stuff, second press will turn the stuff off. So I guess some trickery should be involved. While sending ‘on’ in no problem, pressing the button again will send the same ‘on’ message as well. Knowing the current device state is not an option, so I’d just like to send different messages on each key press. Any help would be appreciated!
Please find the attached. In this case I use a timer to carry out all of the actions. That way if I want to change the incoming trigger, I simply need to modify the first translator incoming trigger to the desired MIDI message to monitor for all of the actions. The first action has the incoming trigger and triggers the one-shot timer ‘Next’.
The other 4 translators look at the value of ga and only triggers an outgoing action if it matches that target value. In this case, I have different MIDI messages for each iteration.
In the last translator, I increment the value of ga to handle the next trigger. If the value goes over 3 then I reset the value of ga back to 0. I only do this in the last translator.
// get global variable int local variable
// increment for next iteration
// don't go beyond 3
if ga>3 then ga=0
if pp!=3 then exit rules, skip Outgoing Action
I have my aliases set up as follows:
You can learn more about aliases from this tutorial.
One-trigger-Multiple-Actions.bmtp (2.2 KB)
Bome Customer Care
Also available for paid consulting services: email@example.com
Works beautifully, thank you so much again, Steve!
On a side note, I just realized the mentioned MIDI messages requiring switching differ in just one number - 80 36 7F and 80 37 7F so I guess replacing them with a variable and doing some rules on it would potentially simplify things by a lot with just one translator. Still above my current knowledge unfortunately Anyway, works great as per your example, thank you!!
Yes, this required only one translator with 2 rules. I added another rule sending a message to the Log window.
// Set base note 36 hex = 54 decimal
// Toggle the value of ga between 0 and 1
Log "Log Note-off note %pp% decimal or %2x pp% Hex"
One-trigger-Multiple-Actions-a.bmtp (2.7 KB)