#include <Transport.h>
Inheritance diagram for TSE3::Transport:
This object handles the playback/record mechanism. It is the central control for musical input and output.
It usually plays a Song, but isn't restricted to since it uses the abstract Playable interface as the music source.
When using this class it is important to call the poll method as often as possible: it does most of the work. It would be a good idea to do this polling in a background thread (see Impl::Mutex for information on threading issues).
Facilities provided by the Transport class include:
|
Transport status definitions for the current mode, as returned by the status method. |
|
The Transport object starts up in resting mode. It is presumed that neither the metronome or scheduler objects will be deleted whilst the Transport object exists.
|
|
|
|
Register a callback object.
|
|
Detach a callback object.
|
|
Returns the MidiScheduler that this Transport object is using.
|
|
MidiFilter that affects how all are sent from the Transport object. You can use this to set global overrides for some Song setup; for example to for every MidiEvent to a specific port.
|
|
The Panic object used to send reset data at transport start.
|
|
The Panic object used to send reset data at transport end.
|
|
This MidiMapper object used to alter output destination.
|
|
Returns the MidiEcho object used to provide soft MIDI Thru.
|
|
Set the FlagTrack. You can specify the value 0 for no FlagTrack. The FlagTrack should be set if your playable object is a Song. If it is not, it's best to reset the FlagTrack value to 0. This is used when transport is resting and stop is called to snap the stop position to a Flag position.
|
|
Returns the current synchro mode. When enabled, transport will not start immediately when play/record is called: it will only start when MIDI input is recieved from the scheduler.
|
|
Set the synchro status.
|
|
Returns the currrent punch-in record status. This effects how the recording is handled. When disabled, record will mute the record channel. When enabled, muting only occurs when the first MIDI input is recieved.
|
|
Set the punch-in record status.
|
|
Returns the currrent auto stop status. When enabled playback will automatically stop at the end of the Playable object. This will not occur in recording mode.
|
|
Set the auto stop status.
|
|
Returns the playback lead in, the number of PPQN before Song playback begins.
|
|
Sets the value of the playback lead in.
|
|
Returns the record lead in, the number of PPQN before Song recording begins.
|
|
Sets the value of the record lead in.
|
|
Call this to start playback. If the request is successful, an event will be returned to all .
|
|
Call this to start recording. Whilst you are recording, a Playable can be played back (this will normally be the Song you are working on. You can optionally mute a Track (well, it will normally be a Track) by specifying it's MidiFilter. (The 'setStatus' method is used to perform the muting - it will be reset correctly afterwards). If course, you do not have to perform a mute, or do any playback at all if you so wish. You would want to specify a mute Track to silence the Track that the user thinks recording is taking place on (when at the moment the Song is not being altered by the Transport's recording process at all). If the record request is successful, an event will be returned to all . Record may not do anything (for example, you cannot enter Recording mode from Playing mode). If punch-in mode is enabled, the Track the user thinks recording is being performed on (when it's in fact going into a PhraseEdit object) will be muted when MIDI input is first recieved. This muting is achieved by setting the Track's MidiFilter status to false. It will be restored when stop is called. If punch-in mode is disabled, then the filter will be muted immediately, and restored when stop is called. If 0 is passed in filter then no muting will occur.
|
|
Stop playback. If the request is successful, an event will be returned to all . If in Resting mode, then the 'resting clock' will be moved to time zero. |
|
Fast forward. Makes the playback position jump forwards by Clock::PPQN.
|
|
Fast forward to next flag position, if there is one. |
|
Rewind. Makes the playback position jump backwards by Clock::PPQN.
|
|
Rewind to previous flag position, or the start if there is none. |
|
The Transport object activity poll interface. This must be called often and rapidly (say every 10 usecs) if you want to handle MIDI input properly. This includes recording and MIDI echo. If you're only doing playback (and have disabled the MIDI echo facility) then you can afford to call this only as often as you need to (this is dependant on the lookAhead()). This will give your processor quite a rest. The poll method schedules an amount of musical data for playback via the MidiScheduler. The size of this 'window' of data that is scheduled ahead of time is set by lookAhead(). |
|
Returns the current state of the Transport object
|
|
If status is not Resting, then this will return a pointer to the current Playable object. When resting, this returns zero.
|
|
Returns the look ahead value. This is the amount of data that the Transport object will schedule ahead of time to ensure smooth and unbroken playback.
|
|
Sets the look ahead value.
|
|
Returns the minimum value lookAhead can be set to. (There has to be some kind of limit, setting it to zero is just asking for trouble.)
|
|
Returns whether the 'adaptive look ahead' facility is active. Adaptive look ahead causes the poll method to calculate the best value for lookAhead. The calculation is based on the frequency of calls to poll and aims to reduce the look ahead as much as possible (in order to increase system responsivity) whilst ensuring that it is not so low as to cause playback break-up.
|
|
Set the value of the adaptive look ahead feature.
|
|
Returns the number of times playback has 'broken up' during the current run of the Transport object. If this returns true you may wish to increase the value of lookAhead.
|
|
Injects a MidiCommand into the Transport object. This is a facility used by components such as an on-screen keyboard. The Transport object acts as if this MidiCommand was recieved from the MidiScheduler object, recording/echoing it. The side effect of calling this member function is that a call to poll will be made (to process the injected MidiCommand. Take care: if you inject a MidiCommand_NoteOn you must ballance it with a MidiCommand_NoteOff later on or you will experience 'hanging notes'.
|
|
Reimplemented from TSE3::MidiSchedulerListener. |
|
Reimplemented from TSE3::MidiSchedulerListener. |
|
Reimplemented from TSE3::MidiSchedulerListener. |
|
|
|
|
|
|
|
|
|
|