Recorder
A Recorder is an object which can record MIDI events. It can either
just record events which are specifically fed to it, or it can
automatically record all events which Rogus sends out.
class Recorder {
public:
typedef UtilPtr<Filedata> FiledataPtr;
Recorder();
~Recorder();
void insert(const MIDI_msg*);
void setAutoRecord(bool);
bool getAutoRecord();
FiledataPtr capture();
};
Recorder()
- This constructor creates a new Recorder which starts out empty and
which initially has AutoRecord set to false.
~Recorder()
- This destroys the Recorder. The recorded data is lost unless you
first extract it using
capture()
.
void insert(const MIDI_msg* m)
- This inserts the MIDI message m into the recording. It will be
placed in a track with the same name as its output node. The time
field of the MIDI message determines where in the recording it will be
placed; although the events will be automatically put in chronological
order, note that inserting an event anywhere other than at the end of
the recording may be highly inefficient. Note that it is okay to call
insert at interrupt time, but it is not okay to call any of the other
methods of Recorder (except getAutoRecord) at interrupt time.
void setAutoRecord(bool b)
- Giving this function a 1 causes the Recorder to automatically
record any MIDI event which is played with
oap->write()
or with a higher-level interface such as
the scheduler or score player. It is possible to have multiple
Recorders recording Rogus output at once. Giving this function a 0
causes the Recorder to stop auto-recording.
bool getAutoRecord()
- This returns the current state of AutoRecord.
FiledataPtr capture()
- This returns a pointer to a newly created Filedata object which
contains all of the MIDI messages which have been recorded by this
Recorder so far. The times of the MIDI messages are adjusted so that
the first message is at time zero. Note that capture may be called as
many times as desired, and does not clear the Recorder or prevent it
from continuing to record. However, the new recording does not affect
any of the Filedata objects which have already been returned by
capture
.
Modified 4 November 1995 pepellet@mit.edu