RedTrk a sort of timeline - slave track
RedTrk is controlled by the master (RedMst). each track must have a name, an item to play and an array specifying when to play (sections when active).
see also [RedMst] [RedSeq] [RedTrk2]
*new(key, item, sections)
create a new track. it automatically adds itself to RedMst and gets removed with RedMst.clear.
key - a unique name for this track (Symbol).
item - some object that responds to play and stop (eg Pbind, Tdef, Routine).
sections - indices for which sections this track is active (Array).
can also be inf and then this track is always active.
<key
name of track (Symbol).
<>item
object to be controlled (eg Pbind, Tdef, Routine).
<>sections
which sections this track is active (Array).
<player
object returned by item after .play (eg Synth, EventStreamPlayer).
<isPlaying
boolean
add functions to the following if you have special classes that can not be controlled with .play/.stop,
or classes that have argument keywords that does not match 'clock' and 'quant' (eg clk for clock),
or classes that need to free resources on clear (eg free buffers).
<>*playDict
dictionary of custom play functions. if class not found here then defaults to the .play message.
<>*stopDict
dictionary of custom stop functions. if class not found here then defaults to the .stop message.
<>*clearDict
dictionary of custom clear functions. if class not found here then defaults to the .free message.
the following methods are used by RedMst. not very useful on their own.
play
stop
clear
//--
RedMst.clear
RedTrk(\t1, Pbind(\dur, 0.8), [0]) //create a track
RedTrk(\t1).item
RedTrk(\t1).sections //when to be active
s.boot
RedMst.play //controller starts track on next quant beat
RedTrk(\t2, Pbind(\freq, 880, \dur, 0.5), [0]) //add another track while playing
RedMst.goto(0) //have to restart section to activate new track
RedMst.tracks //current tracks
RedTrk(\t1, Pbind(\freq, 660), [0]) //overwrite first track while playing
RedMst.goto(0) //have to restart section to hear the change
RedMst.stop //stop all tracks on next quant beat
RedMst.clear //remove tracks from master
//see RedMst helpfile for more examples