~nasser/8fl

1ed1439f19c3c698d609e3f68b60d06ff9994469 — Ramsey Nasser 1 year, 20 days ago f3dc966
Do not start 8fl by default

Add start stop functions
1 files changed, 26 insertions(+), 20 deletions(-)

M main.lua
M main.lua => main.lua +26 -20
@@ 330,27 330,33 @@ renoise.tool().tool_will_unload_observable:add_notifier(function ()
end)

-- watch playback and invoke scheduled function (if any) when pattern loops
function start_app_idle_observable()    
    renoise.tool().app_idle_observable:add_notifier(function ()
        local song = renoise.song()
        -- ensure enough blank patterns
        while #song.patterns < cycleSize do
            song.sequencer:insert_new_pattern_at(#song.patterns + 1)
function _8fl_idle()
    local song = renoise.song()
    -- ensure enough blank patterns
    while #song.patterns < cycleSize do
        song.sequencer:insert_new_pattern_at(#song.patterns + 1)
    end
    
    if song.transport.playing and _new_pattern_func then
        -- if pattern has not changed, bail out
        local currentPatternNumber = song.transport.playback_pos.sequence
        if lastPatternNumber == currentPatternNumber then
            return
        end
        
        if song.transport.playing and _new_pattern_func then
            -- if pattern has not changed, bail out
            local currentPatternNumber = song.transport.playback_pos.sequence
            if lastPatternNumber == currentPatternNumber then
                return
            end
            lastPatternNumber = currentPatternNumber
        lastPatternNumber = currentPatternNumber

            -- pattern has changed, render scheduled pattern into next pattern in sequence
            local nextPatternNumber = (currentPatternNumber % cycleSize) + 1
            renderPattern(nextPatternNumber)
        end
    end)
        -- pattern has changed, render scheduled pattern into next pattern in sequence
        local nextPatternNumber = (currentPatternNumber % cycleSize) + 1
        renderPattern(nextPatternNumber)
    end
end

-- TODO better function names
function start()
    renoise.tool().app_idle_observable:add_notifier(_8fl_idle)
end

start_app_idle_observable()
\ No newline at end of file
-- TODO better function names
function stop()
    renoise.tool().app_idle_observable:remove_notifier(_8fl_idle)
end
\ No newline at end of file