Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cfillion/0c61a834a883f538f6476d797788749e to your computer and use it in GitHub Desktop.
Save cfillion/0c61a834a883f538f6476d797788749e to your computer and use it in GitHub Desktop.
-- https://forum.cockos.com/showthread.php?t=200086
function solo(trackIndex)
local track = reaper.GetTrack(0, trackIndex)
if not track then return false end
reaper.PreventUIRefresh(1)
reaper.SoloAllTracks(0)
reaper.SetMediaTrackInfo_Value(track, 'I_SOLO', 1)
reaper.CSurf_GoStart()
reaper.OnPlayButton()
reaper.PreventUIRefresh(-1)
return true
end
function wait(delay, callback)
local start = reaper.time_precise()
gfx.init("", 300, 40, 0, 0, 0)
gfx.r, gfx.g, gfx.b = 5/255, 46/255, 109/255
gfx.clear = 0xffffff
function loop()
if gfx.getchar() < 0 then
return
end
local elapsed = reaper.time_precise() - start
local remaining = math.ceil(delay - elapsed)
local progress = elapsed / delay
local unit = 'second'
if remaining ~= 1 then unit = 'seconds' end
gfx.init(string.format("Waiting %d %s...", remaining, unit))
gfx.rect(10, 10, (gfx.w - 20) * progress, gfx.h - 20)
gfx.update()
if elapsed < delay then
reaper.defer(loop)
else
gfx.quit()
callback()
end
end
loop()
end
solo(0)
wait(20, function() solo(1) end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment