The bundle is kept on the client until the last possible moment, and then actually sent to the server in a time stamped bundle, just before it is due to be executed.
Bundles can be scheduled for precise execution using relative seconds, relative beats, absolute seconds or absolute beats. Bundles can be scheduled on multiple servers, with exact simultaneous execution times.
Bundles can be easily cancelled up until the time they are sent to the server. They are sent to the server just before execution.
The Tempo class is used to specify what the tempo is, and is used for all beat <-> second calculations. A default global Tempo object is used, or you can create a specific Tempo instance.
There is a default global OSCSched that can be addressed through class methods. It uses the SystemClock and the default global Tempo. You may also create individual instances that maintain their own scheduling queues, tempii, and time epochs.
The default clock used is the SystemClock, but you may also specify to use the AppClock.
An optional clientSideFunction can also be supplied that will be evaluated on the client at the exact time as the OSC bundle is scheduled to happen. This could be used to show a change in the gui or to update some setting on a client side object.
All of these methods exist as both
class (the default global scheduler) OSCSched.tsched(seconds,server,bundle,clientSideFunction)
and instance methods (a specific scheduler). oscSched = OSCSched.new; oscSched.tsched(seconds,server,bundle,clientSideFunction)
All of the x-methods establish a block such that a subsequent schedule using another x-method will cause the previous one to be cancelled. This is particularily useful when you are controlling something from a gui or process, and change your mind before the event you have triggered comes due. Another example is a pattern that returns delta beat values, repeatedly scheduling its next note at the time of playing the current one. To switch the pattern with another or abruptly start it over, simply do so: if you used xsched, then the previously scheduled event will be cancelled. In most cases, you will wish to create a private instance of OSCSched when using this technique.
time based scheduling delta specified in seconds
seconds | |
server | |
bundle | |
onArrival |
exclusive time based schedule any previous bundles scheduled using xtsched, xsched or xqsched will be cancelled. this is incredibly useful in situations where several bundles might be sent and you only want the last one to be used as the final answer. example: a monkey is hitting many buttons, changing his mind about which sound to play next. this would result in many bundles being stacked up all at the same time, and the server would choke trying to execute them all. so this forces a kind of monophony of bundles. another example: a sequence plays successive notes, scheduling each one when it plays the previous one. you then switch to a different sequence. you don't want the note that was scheduled from the previous sequence to happen. using one of the x-methods, you don't have to worry about it, it will just be cancelled.
seconds | |
server | |
bundle | |
onArrival |
delta specified in beats
beats | |
server | |
bundle | |
onArrival |
exclusive beat based scheduling
beats | |
server | |
bundle | |
onArrival |
will happen at the next even division ( 4.0 means on the downbeat of a 4/4 bar ), or immediately if you happen to be exactly on a division.
quantize | |
server | |
bundle | |
onArrival |
exclusive quantized beat based scheduling
quantize | |
server | |
bundle | |
onArrival |
will happen at the time specified in seconds
time | |
server | |
bundle | |
onArrival |
will happen at the beat specified. this uses TempoClock for scheduling
beat | |
server | |
bundle | |
onArrival |
seconds | |
server | |
bundle | |
onArrival |
seconds | |
server | |
bundle | |
onArrival |
seconds | |
function |
beats | |
server | |
bundle | |
onArrival | |
onSend |
beats | |
server | |
bundle | |
onArrival |
quantize | |
server | |
bundle | |
onArrival |
quantize | |
server | |
bundle | |
onArrival |
time | |
server | |
bundle | |
onArrival |
beat | |
server | |
bundle | |
onArrival |
execute the function at this absolute beat
beat | |
func |
atTime |
see atTime |
server | |
bundle |
atTime |
see atTime |
server | |
bundle |
beatDelta | |
server | |
bundle |
continuing with the scheduler and defs created above
scheduling a function