I would like to know how can I generate periodical command to OSC tablet interface for blinking led representing “alive” connection. It would be nice if blinking could be similar to the tempo (0.2 second “bip” flash on every beat), but if it’s impossible, constant time blinking will enough.
Target: if the led blinking on the tablet, sure we have relay connection to the computer. When it stops blinking, something wrong happened in the Matrix.
Update: sorry, the exact problem what I want to solve is a periodical or tempo synced command in Renoise. What I findig is an event or something which can attach to internal clock or something. Sending message to my tablet with OSC is clear.
A simple approach would be to implement this in the idle notifier of your tool
In this example, I am using the clock to update the blinking state approx. once per second.
Doing the same on beats instead of os.clock could be a question of swapping the call to os.clock with a call to playback_pos_beats.
local blink_state = false
renoise.tool().app_idle_observable:add_notifier(function()
local blink = (math.floor(os.clock()%2) == 0) and true or false
if (blink ~= blink_state) then
-- do something when the state has changed
-- but don't forget to update the state...
blink_state = blink
end
end)
on the path of your example, my solution realized in this code:
---------------------------------------------------------------------------------
-- BLINKING
---------------------------------------------------------------------------------
local function Blinking()
dbug("Blinking")
if(BlinkState == false) then
SendMessageOSC("/LiveControl/BPMLed", 1, "i")
BlinkState = true
else
SendMessageOSC("/LiveControl/BPMLed", 0, "i")
BlinkState = false
end
end
local function BlinkStarter()
dbug("BlinkStarter")
if(renoise.tool():has_timer(Blinking)) then
renoise.tool():remove_timer(Blinking)
end
renoise.tool():add_timer(Blinking, 500)
end