-- run all fade cues up to currently selected cue for running audio cue
-- put this on a hotkey (or OSC/MIDI) trigger
-- may break if more than 1 audio cue running
tell application id "com.figure53.QLab.5" to tell front workspace
set LevelDetails to 0 -- maximum number of audio col levels to report, set to 0 for only "main" fade levelÂ
-- get the cue Id of the currently selected cue
set selCue to last item of (selected as list)
-- if group selected get the first fade cue inside
if q type of selCue is "Group" then
set currentFade to first cue whose q type is "Fade" and parent is selCue
else
set currentFade to last item of (selected as list)
end if
-- sanity that we actually got a fade cue!
if q type of currentFade is not "Fade" then
display dialog "you did not select a Fade cue!"
return
end if
-- keep this for later
set selFadeName to (q number of currentFade) & space & (q display name of currentFade) as string
-- get the cue Id for the selected fade cue; this is how we know when to stop
set ccId to uniqueID of currentFade -- last item of (selected as list)
-- find running audio cue
try
set audiocue to first cue whose (running is true or paused is true) and q type is "Audio"
on error errMesg
display dialog errMesg with title "No running audio cue"
return
end try
-- get a list of the fade cues which target this audio cue
set fadeCues to every cue whose cue target is audiocue
set AppleScript's text item delimiters to space
set results to {}
repeat with fadeCue in fadeCues
if uniqueID of fadeCue is equal to ccId then
-- we have reached the selected fade so we're done
exit repeat
else
-- run the fade and wait for it to finish
start fadeCue
-- comment the delay if you don't mind the auditing fades overlapping (may not be what is wanted)
delay (duration of fadeCue)
-- rest of this is getting about info about fades to give to the user
if LevelDetails is greater than 0 then
set newLevels to {}
-- this is possible too much information!
repeat with col from 0 to LevelDetails
set newLevel to (getLevel fadeCue row 0 column col) as integer
if newLevel > -60 then -- don't include non-set levels which have default of -60
-- set end of newLevels to col & "=" & ((getLevel fadeCue row 0 column col) as integer) as string
set end of newLevels to col & "=" & newLevel as string
end if
end repeat
-- joint all the level details together
set AppleScript's text item delimiters to ", "
set newLevelsInfo to (newLevels as text)
set AppleScript's text item delimiters to space
set end of results to (audio fade mode of fadeCue) & " fade " & (q number of fadeCue) & space & (q display name of fadeCue) & linefeed & tab & newLevelsInfo as string
else
set AppleScript's text item delimiters to space
set newLevelsInfo to ((getLevel fadeCue row 0 column 0) as integer) as string
set end of results to (audio fade mode of fadeCue as string) & " fade " & space & ((getLevel fadeCue row 0 column 0) as integer) & space & (q number of fadeCue) & space & (q display name of fadeCue) as string
end if
end if
end repeat
set AppleScript's text item delimiters to linefeed
display dialog "now ready to run " & (q display name of fadeCue) & linefeed & "Previous fades" & linefeed & (results as text) as string with title (q display name of audiocue as string)
end tell