A simple sequencer
The Sequencer actor stores a time-stamped list of messages to be sent to (other) actors. Any message that a client can send to an actor can be added to a SequenceActor and then played back later.
To use the Sequencer implementation, load seq.so and create an actor
of type SeqActor.
(Note: if you misspell SeqActor as
"SequenceActor" or "SequencerActor" (the way you probably pronounce it),
it'll still work. You'll get a SeqActor. No warning is issued for this.
Normally if you misspell an actor's name,
you get error messages about undefined actors and DSO's not loaded;
this case is an exception.)
SeqActor messages
In addition to the messages understood by all generator actors, the SeqActor understands the following messages:
- SetTempo hActor x
- Set the tempo of this sequence to x beats per minute (default is 60).
- SetBeatLength hActor x
- Set the tempo of this sequence to x seconds per beat (default is 1, obviously, from above).
- AddMessage hActor beat message...
- Add an event to the list at time beat, in beats from the start of the sequence. message... is the message to be sent.
- SetNumLoops hActor numloops
- Set the number of times to execute the body of the sequence.
Defaults to -1, which means to loop forever.
0 means don't do it at all (i.e., don't play anything);
1 means do it once;
2 means twice, and so on.
- SetLoopStart hActor beat
- Set the loop start point to beat (default 0).
- SetLoopEnd hActor beat
- Set the loop end point to beat (default 1 million).
- JumpTo hActor beat
- Change the position of playback to beat.
- Rewind hActor beat
- Change the position of playback, backwards, to beat. If beat is omitted, it defaults to zero.
- SkipEvents hActor count
- Fast-forward, skipping the next count events. (Skipping backwards doesn't work as of this writing.)
- Active hActor activeStatus
- Play or pause the sequence (activeStatus is 1 or 0 respectively).