Hi! I'm making a script to make the LEDs on my controller react to events in mobius. I've almost got it working, but there are some oddities. When I press the rec button (CC#18), the LED lights up. Then, when I press the stop button (CC#23), the CC#18 LED turns off and the CC#23 LED turns on. However, when I press the CC#18 button again (in play mode), the stop button doesn't turn off, and the CC#18 LED doesn't light up. I attach the code for the AllLEDs.msl script:
`#name AllLEDs
static var lastRec = -1
static var lastStop = -1
// --- Rec LED (CC18) ---
// Turn on at the start of any active mode or at the Play event
if (($1 == "PlayStart" or $1 == "RecordStart" or $1 == "OverdubStart" or $1 == "Play") and lastRec != 1) {
MidiOut("control", 0, 18, 127)
lastRec = 1
}
// Additionally, we enable it at ModeStart (for the first recording, etc.)
if ($1 == "ModeStart" and ($3 == "record" or $3 == "play" or $3 == "overdub") and lastRec != 1) {
MidiOut("control", 0, 18, 127)
lastRec = 1
}
// Turn off when the active mode ends, when the device stops, or when it is reset
if (($1 == "ModeEnd" or $1 == "MuteEnd" or $1 == "Reset") and lastRec != 0) {
MidiOut("control", 0, 18, 0)
lastRec = 0
}
// --- Stop LED (CC23) ---
// Включаем при остановке (MuteEnd), если луп не пуст
if ($1 == "MuteEnd" and loopFrames > 0 and lastStop != 1) {
MidiOut("control", 0, 23, 127)
lastStop = 1
}
// Turn off at the start of any active mode, at the Play event, or at reset
if (($1 == "PlayStart" or $1 == "RecordStart" or $1 == "OverdubStart" or $1 == "Play" or $1 == "Reset") and lastStop != 0) {
MidiOut("control", 0, 23, 0)
lastStop = 0
}
// Optional: If Reset, explicitly turn off
if ($1 == "Reset" and lastStop != 0) {
MidiOut("control", 0, 23, 0)
lastStop = 0
}`
And here is my SmartRecPlayOverdub.msl script:
`#name SmartRecPlayOverdub
if mode == "Reset" {
Record
} else if mode == "Record" {
Play
} else if mode == "Play" {
Overdub
} else if mode == "Overdub" {
Play
} else {
Play
}`