|
|
This class provides help using the Transport object's record facilities. When using the Transport record API, you need to create a PhraseEdit and keep track of when you started and stopped recording.
After recording you will need to supply a name for the new Phrase and then have it inserted into the Song.
The job of this helper class is to aid this process. The lifetime of the objects involved are managed, and the actions needed are encapsulated in these methods.
It is assumed that neither the Transport object or the MidiScheduler object will be deleted from under the Recording object's feet.
See also: TSE3
Record (TSE3::Transport *transport)
| Record |
Creates a new recording helper object.
The initial values of start() and end() default, and there is no PhraseEdit created (see phraseEdit()).
~Record ()
| ~Record |
Any allocated object will be deallocated.
void start (TSE3::Song *p, TSE3::Track *t)
| start |
Start recording at the current MidiScheduler time. This will create a new PhraseEdit object.
You must pass a Song and Track parameter. These are used to pass a Playable and SimpleMidiEventFilter parameter to the TSE3::Transport::record() method.
It is also used later on to insert a Part into the Track.
If you call start a second time, whilst recording is taking place, then it is equivalent to calling stop().
You don't have to call Record::stop(), you can just use TSE3::Transport::stop(). However, read the documentation for this object's stop method for information on the callback generated.
See also: stop
void stop ()
| stop |
Stops recording at the current MidiScheduler time. Sends a notification to any TSE3::Listener objects.
You do not have to call this to stop recording: any call to TSE3::Transport::stop() will cause the Record object to notice, and notify any listeners.
The RecordingListener::Record_RecordingEnded notification is only sent if there was something recorded into the PhraseEdit object.
If you handle the RecordingListener::Record_RecordingEnded callback you must take care to check the TSE3::Song and TSE3::Track parameters. If there are two or more objects that use the Record utility, they will both receive the notification and will have to check whether it was a recording that they started or not.
TSE3::Clock startTime ()
| startTime |
[const]
Returns the time recording was last started at, or -1 if recording has never been started.
TSE3::Clock endTime ()
| endTime |
[const]
Returns the time recording was last ended at, or -1 if recording has never been ended.
TSE3::PhraseEdit * phraseEdit ()
| phraseEdit |
[const]
Returns a pointer to the current PhraseEdit object, or zero if no PhraseEdit has been created.
void insertPhrase (const std::string &title,
bool replacePhrase,
bool insertPart,
int insertAction,
TSE3::Cmd::CommandHistory *history = 0)
| insertPhrase |
Inserts the recorded Phrase into the Song. You specify a name for the new Phrase.
This method may propagate the PhraseList exception if the Phrase name already exists.
After the action has been carried out, the internally allocated PhraseEdit object is deallocated.
This operation will be performed using TSE3::Command objects, and the object will be placed on the TSE3::Cmd::CommandHistory object specified.
Parameters:
title | New Phrase title (must be unique) |
replacePhrase | If the Phrase name already exists, setting this to true will replace it. |
insertAction | A TSE3::Cmd::Part_Move::PartInsertAction value. |
history | TSE3::Cmd::CommandHistory object to place undoable commands onto. Specify zero will not store any commands. |
void reset ()
| reset |
Ensures that all objects are deallocated, in case the recording has ended but the user doesn't want to save the recording into the Song.
It's not strictly necessary to call this if you are not going to call insertPhrase(). Without calling this the next call to start() will handle object reallocation successfully. However, by calling this you will free up resources that aren't currently needed.
void Transport_Status (TSE3::Transport *, int status)
| Transport_Status |
TSE3::Transport * _transport | _transport |
[protected]
TSE3::PhraseEdit * _phraseEdit | _phraseEdit |
[protected]
TSE3::Song * _song | _song |
[protected]
TSE3::Track * _track | _track |
[protected]
TSE3::Clock _startTime | _startTime |
[protected]
TSE3::Clock _endTime | _endTime |
[protected]
bool recording | recording |
[protected]