Files
AV-Live/touchosc/gen/lua/melody_faders.lua
T
L'électron rare 67fd253de5
CI build oscope-of / build-check (push) Has been cancelled
fix: pad armed receive on group, lua guards
Move /armed/<name> receive msg from arm BUTTON to parent GROUP so
pad.lua onReceiveOSC fires on the node that owns the message (FIX 1).
Remove feedback.lua from master RMS fader; native receive already
drives the VU, onFrame decay was pure downside (FIX 3).
Add Lua 5.1/LuaJIT compat shim for table.unpack in melody_faders
(FIX 2). Document deferred sequencer playhead in README (FIX 4).
Regression test: 16 pad GROUPs carry /armed/* receive; 21 tests pass.
Rebuild dist/av-live-control.tosc.
2026-06-28 13:49:00 +02:00

18 lines
612 B
Lua

-- Melody step faders: map 0..1 -> integer degree -7..14.
-- On value change: read all 8 step faders (m0..m7) -> /seq/melody/set.
-- API verified on GrosMac at fidelity gate.
local LO, HI = -7, 14
local unpack = table.unpack or unpack -- Lua 5.1 / LuaJIT compat
function onValueChanged(key)
if key ~= "x" then return end
local parent = self.parent
local degs = {}
for i = 1, 8 do
local f = parent and parent:findByName("m" .. (i - 1), true)
local fx = (f and f.values and f.values.x) or 0
degs[i] = math.floor(LO + (HI - LO) * fx + 0.5)
end
sendOSC("/seq/melody/set", unpack(degs))
end