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DONDO9P3wA3wGMdb.db.d7d3If3If3IFBOA.OwnwS.vS.vSzCOIDOIDO4P3IA3IGMdR.dR.dMm684I+FDGHRIF
var
L1QUEUED, L2QUEUED, L3QUEUED, L4QUEUED : Widget
L1PLAY, L2PLAY, L3PLAY, L4PLAY : Widget
L1PLAYING, L2PLAYING, L3PLAYING, L4PLAYING : Widget
L1PLAYBGON, L2PLAYBGON, L3PLAYBGON, L4PLAYBGON : Widget
L1PLAYBGOFF, L2PLAYBGOFF, L3PLAYBGOFF, L4PLAYBGOFF : Widget
L1PLAYBGQON, L2PLAYBGQON, L3PLAYBGQON, L4PLAYBGQON : Widget
BEAT, QUANTIZE, APSTOP : Widget
SYNCPLAYHEAD, RESTARTONTRIGGER : Widget
AUDIOPLAYER : PluginBlock
play_quantize : Integer
l1queued, l2queued, l3queued, l4queued : Boolean
startUpDelay : Ramp
startUpComplete, syncWithPlayhead, restartOnTrigger : Boolean
initialization
play_quantize = 4 // Change this to the desired play quantize beat number.
if GetWidgetValue(SYNCPLAYHEAD) == 1.0 then syncWithPlayhead = true else syncWithPlayhead = false end
if GetWidgetValue(RESTARTONTRIGGER) == 1.0 then restartOnTrigger = true else restartOnTrigger = false end
l1queued = false
l2queued = false
l3queued = false
l4queued = false
SetWidgetLabel(QUANTIZE, "Q"+play_quantize)
SetGeneratorOneShot(startUpDelay, true) // Use a Generator as a delay to prevent issues when the gig first opens.
startUpDelay.SetGeneratorLength(2000); // Two second delay on startup.
startUpDelay.EnableGenerator(True)
SetTimersRunning(true)
startUpComplete = false
end
function AllReset()
SetParameter(AUDIOPLAYER, 0, 0.0)
//EnablePlayhead(false)
SetWidgetValue(L1PLAYBGON, 0.0)
SetWidgetValue(L1PLAYBGOFF, 1.0)
SetWidgetValue(L1PLAYBGQON, 0.0)
SetWidgetValue(L2PLAYBGON, 0.0)
SetWidgetValue(L2PLAYBGOFF, 1.0)
SetWidgetValue(L2PLAYBGQON, 0.0)
SetWidgetValue(L3PLAYBGON, 0.0)
SetWidgetValue(L3PLAYBGOFF, 1.0)
SetWidgetValue(L3PLAYBGQON, 0.0)
SetWidgetValue(L4PLAYBGON, 0.0)
SetWidgetValue(L4PLAYBGOFF, 1.0)
SetWidgetValue(L4PLAYBGQON, 0.0)
end
function QueueLane1()
l1queued = true
l2queued = false
l3queued = false
l4queued = false
SetWidgetValue(L1PLAYBGQON, 1.0)
SetWidgetValue(L1PLAYBGON, 0.0)
SetWidgetValue(L1PLAYBGOFF, 0.0)
SetWidgetValue(L2PLAYBGQON, 0.0)
SetWidgetValue(L3PLAYBGQON, 0.0)
SetWidgetValue(L4PLAYBGQON, 0.0)
SetWidgetValue(L2QUEUED, 0.0)
SetWidgetValue(L3QUEUED, 0.0)
SetWidgetValue(L4QUEUED, 0.0)
end
function QueueLane2()
l1queued = false
l2queued = true
l3queued = false
l4queued = false
SetWidgetValue(L2PLAYBGQON, 1.0)
SetWidgetValue(L2PLAYBGON, 0.0)
SetWidgetValue(L2PLAYBGOFF, 0.0)
SetWidgetValue(L1PLAYBGQON, 0.0)
SetWidgetValue(L3PLAYBGQON, 0.0)
SetWidgetValue(L4PLAYBGQON, 0.0)
SetWidgetValue(L1QUEUED, 0.0)
SetWidgetValue(L3QUEUED, 0.0)
SetWidgetValue(L4QUEUED, 0.0)
end
function QueueLane3()
l1queued = false
l2queued = false
l3queued = true
l4queued = false
SetWidgetValue(L3PLAYBGQON, 1.0)
SetWidgetValue(L3PLAYBGON, 0.0)
SetWidgetValue(L3PLAYBGOFF, 0.0)
SetWidgetValue(L1PLAYBGQON, 0.0)
SetWidgetValue(L2PLAYBGQON, 0.0)
SetWidgetValue(L4PLAYBGQON, 0.0)
SetWidgetValue(L1QUEUED, 0.0)
SetWidgetValue(L2QUEUED, 0.0)
SetWidgetValue(L4QUEUED, 0.0)
end
function QueueLane4()
l1queued = false
l2queued = false
l3queued = false
l4queued = true
SetWidgetValue(L4PLAYBGQON, 1.0)
SetWidgetValue(L4PLAYBGON, 0.0)
SetWidgetValue(L4PLAYBGOFF, 0.0)
SetWidgetValue(L1PLAYBGQON, 0.0)
SetWidgetValue(L2PLAYBGQON, 0.0)
SetWidgetValue(L3PLAYBGQON, 0.0)
SetWidgetValue(L1QUEUED, 0.0)
SetWidgetValue(L2QUEUED, 0.0)
SetWidgetValue(L3QUEUED, 0.0)
end
function CheckAndEnablePlayhead()
if syncWithPlayhead and IsPlayheadEnabled () == false then
EnablePlayhead(true)
end
end
function TriggerTrack()
if restartOnTrigger or GetParameter(AUDIOPLAYER, 0) == 0.0 then
SetParameter(AUDIOPLAYER, 1, 1.0)
end
end
on BeatChanged (bar:integer, beat:integer, subbeat:integer)
SetWidgetLabel(BEAT, ""+((beat)/4+1) +":"+(beat % 4 +1))
SetWidgetLabel(QUANTIZE, "Q"+play_quantize)
if beat % play_quantize + 1 == 1 then
if GetWidgetValue(L1QUEUED) == 1.0 then
SetWidgetValue(L1PLAYING, 1.0)
TriggerTrack()
SetWidgetValue(L1QUEUED, 0.0)
SetWidgetValue(L1PLAYBGON, 1.0)
SetWidgetValue(L1PLAYBGQON, 0.0)
SetWidgetValue(L1PLAYBGOFF, 0.0)
SetWidgetValue(L1PLAYBGQON, 0.0)
SetWidgetValue(L2PLAYBGON, 0.0)
SetWidgetValue(L2PLAYBGOFF, 1.0)
SetWidgetValue(L3PLAYBGON, 0.0)
SetWidgetValue(L3PLAYBGOFF, 1.0)
SetWidgetValue(L4PLAYBGON, 0.0)
SetWidgetValue(L4PLAYBGOFF, 1.0)
l1queued = false
elsif
GetWidgetValue(L2QUEUED) == 1.0 then
SetWidgetValue(L2PLAYING, 1.0)
TriggerTrack()
SetWidgetValue(L2QUEUED, 0.0)
SetWidgetValue(L1PLAYBGON, 0.0)
SetWidgetValue(L1PLAYBGOFF, 1.0)
SetWidgetValue(L2PLAYBGON, 1.0)
SetWidgetValue(L2PLAYBGOFF, 0.0)
SetWidgetValue(L2PLAYBGQON, 0.0)
SetWidgetValue(L3PLAYBGON, 0.0)
SetWidgetValue(L3PLAYBGOFF, 1.0)
SetWidgetValue(L4PLAYBGON, 0.0)
SetWidgetValue(L4PLAYBGOFF, 1.0)
l2queued = false
elsif
GetWidgetValue(L3QUEUED) == 1.0 then
SetWidgetValue(L3PLAYING, 1.0)
TriggerTrack()
SetWidgetValue(L3QUEUED, 0.0)
SetWidgetValue(L1PLAYBGON, 0.0)
SetWidgetValue(L1PLAYBGOFF, 1.0)
SetWidgetValue(L2PLAYBGON, 0.0)
SetWidgetValue(L2PLAYBGOFF, 1.0)
SetWidgetValue(L3PLAYBGON, 1.0)
SetWidgetValue(L3PLAYBGOFF, 0.0)
SetWidgetValue(L3PLAYBGQON, 0.0)
SetWidgetValue(L4PLAYBGON, 0.0)
SetWidgetValue(L4PLAYBGOFF, 1.0)
l3queued = false
elsif
GetWidgetValue(L4QUEUED) == 1.0 then
SetWidgetValue(L4PLAYING, 1.0)
TriggerTrack()
SetWidgetValue(L4QUEUED, 0.0)
SetWidgetValue(L1PLAYBGON, 0.0)
SetWidgetValue(L1PLAYBGOFF, 1.0)
SetWidgetValue(L2PLAYBGON, 0.0)
SetWidgetValue(L2PLAYBGOFF, 1.0)
SetWidgetValue(L3PLAYBGON, 0.0)
SetWidgetValue(L3PLAYBGOFF, 1.0)
SetWidgetValue(L4PLAYBGON, 1.0)
SetWidgetValue(L4PLAYBGOFF, 0.0)
SetWidgetValue(L4PLAYBGQON, 0.0)
l4queued = false
end
end
end
on WidgetValueChanged(newValue : double) from L1QUEUED
if newValue == 1.0 then
CheckAndEnablePlayhead()
QueueLane1()
end
end
on WidgetValueChanged(newValue : double) from L2QUEUED
if newValue == 1.0 then
CheckAndEnablePlayhead()
QueueLane2()
end
end
on WidgetValueChanged(newValue : double) from L3QUEUED
if newValue == 1.0 then
CheckAndEnablePlayhead()
QueueLane3()
end
end
on WidgetValueChanged(newValue : double) from L4QUEUED
if newValue == 1.0 then
CheckAndEnablePlayhead()
QueueLane4()
end
end
on WidgetValueChanged(newValue : double) from APSTOP
if startUpComplete then
AllReset()
end
if syncWithPlayhead then
EnablePlayhead(false)
end
if GetParameter(AUDIOPLAYER, 1) == 1.0 then
SetParameter(AUDIOPLAYER, 1, 0.0)
end
end
on WidgetValueChanged(newValue : double) from L1PLAY
if startUpComplete then
if newValue == 1.0 then
SetWidgetValue(L1QUEUED, 1.0)
QueueLane1()
else
SetWidgetValue(L1PLAY, 1.0)
end
end
end
on WidgetValueChanged(newValue : double) from L2PLAY
if startUpComplete then
if newValue == 1.0 then
SetWidgetValue(L2QUEUED, 1.0)
QueueLane2()
else
SetWidgetValue(L2PLAY, 1.0)
end
end
end
on WidgetValueChanged(newValue : double) from L3PLAY
if startUpComplete then
if newValue == 1.0 then
SetWidgetValue(L3QUEUED, 1.0)
QueueLane3()
else
SetWidgetValue(L3PLAY, 1.0)
end
end
end
on WidgetValueChanged(newValue : double) from L4PLAY
if startUpComplete then
if newValue == 1.0 then
SetWidgetValue(L4QUEUED, 1.0)
QueueLane4()
else
SetWidgetValue(L4PLAY, 1.0)
end
end
end
on WidgetValueChanged(newValue : double) from SYNCPLAYHEAD
if newValue == 1.0 then
syncWithPlayhead = true
if l1queued or l2queued or l3queued or l4queued then
CheckAndEnablePlayhead()
end
else
syncWithPlayhead = false
end
end
on WidgetValueChanged(newValue : double) from RESTARTONTRIGGER
if newValue == 1.0 then
restartOnTrigger = true
else
restartOnTrigger = false
end
end
on TimePassing(time : integer, progress : double) from startUpDelay
if progress > 0.99 and startUpComplete == false then
startUpComplete = true
AllReset()
end
end