Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

TSE3::Transport Class Reference

Manager of transport facilities. More...

#include <Transport.h>

Inheritance diagram for TSE3::Transport:

Inheritance graph
[legend]
Collaboration diagram for TSE3::Transport:

Collaboration graph
[legend]
List of all members.

Public Types

enum  TransportMode {
  Resting, Playing, Recording, SynchroPlaying,
  SynchroRecording
}

Public Member Functions

 Transport (Metronome *metronome, MidiScheduler *scheduler)
virtual ~Transport ()
void attachCallback (TransportCallback *c)
void detachCallback (TransportCallback *c)
MidiSchedulerscheduler () const
MidiFilterfilter ()
PanicstartPanic ()
PanicendPanic ()
MidiMappermidiMapper ()
MidiEchomidiEcho ()
void setFlagTrack (FlagTrack *f)
bool synchro () const
void setSynchro (bool s)
bool punchIn () const
void setPunchIn (bool p)
bool autoStop () const
void setAutoStop (bool s)
Clock playLeadIn () const
void setPlayLeadIn (Clock c)
Clock recordLeadIn () const
void setRecordLeadIn (Clock c)
void play (Playable *p, Clock startTime)
void record (Playable *p, Clock startTime, PhraseEdit *pe, MidiFilter *filter=0)
void stop ()
void ff (bool strong)
void ffFlag ()
void rew (bool strong)
void rewFlag ()
void poll ()
int status () const
Playableplayable () const
Clock lookAhead () const
void setLookAhead (Clock c)
Clock minimumLookAhead () const
bool adaptiveLookAhead () const
void setAdaptiveLookAhead (bool ala)
int breakUps () const
void inject (MidiCommand c)
virtual void MidiScheduler_Started (MidiScheduler *)
virtual void MidiScheduler_Stopped (MidiScheduler *)
virtual void MidiScheduler_Moved (MidiScheduler *)
virtual void Notifier_Deleted (FlagTrack *)
virtual void Notifier_Deleted (Metronome *)
virtual void Notifier_Deleted (MidiScheduler *)
virtual void Notifier_Deleted (PhraseEdit *)
virtual void Notifier_Deleted (Playable *)

Detailed Description

Manager of transport facilities.

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:

Author:
Pete Goodliffe
Version:
3.00
See also:
Song

Playable

TransportCallback


Member Enumeration Documentation

enum TSE3::Transport::TransportMode
 

Transport status definitions for the current mode, as returned by the status method.

Enumeration values:
Resting 
Playing 
Recording 
SynchroPlaying 
SynchroRecording 


Constructor & Destructor Documentation

TSE3::Transport::Transport Metronome metronome,
MidiScheduler scheduler
 

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.

Parameters:
metronome Metronome object to use
scheduler MidiScheduler object to use
See also:
status

virtual TSE3::Transport::~Transport  )  [virtual]
 


Member Function Documentation

void TSE3::Transport::attachCallback TransportCallback c  ) 
 

Register a callback object.

Parameters:
c TransportCallback object to attach

void TSE3::Transport::detachCallback TransportCallback c  ) 
 

Detach a callback object.

Parameters:
c TransportCallback object to detach

MidiScheduler* TSE3::Transport::scheduler  )  const [inline]
 

Returns the MidiScheduler that this Transport object is using.

Returns:
MidiScheduler in use

MidiFilter* TSE3::Transport::filter  )  [inline]
 

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.

Returns:
The Part's MidiFilter object

Panic* TSE3::Transport::startPanic  )  [inline]
 

The Panic object used to send reset data at transport start.

Returns:
Transport's start Panic object

Panic* TSE3::Transport::endPanic  )  [inline]
 

The Panic object used to send reset data at transport end.

Returns:
Transport's end Panic object

MidiMapper* TSE3::Transport::midiMapper  )  [inline]
 

This MidiMapper object used to alter output destination.

Returns:
Transport's MidiMapper object

MidiEcho* TSE3::Transport::midiEcho  )  [inline]
 

Returns the MidiEcho object used to provide soft MIDI Thru.

Returns:
Transport's MidiEcho object

void TSE3::Transport::setFlagTrack FlagTrack f  )  [inline]
 

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.

Parameters:
f FlagTrack to use - it should tally with the current Song

bool TSE3::Transport::synchro  )  const [inline]
 

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.

Returns:
Synchro mode status
See also:
setSynchro

void TSE3::Transport::setSynchro bool  s  ) 
 

Set the synchro status.

Parameters:
s New synchro mode status
See also:
synchro

bool TSE3::Transport::punchIn  )  const [inline]
 

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.

Returns:
Punch in status
See also:
setPunchIn

void TSE3::Transport::setPunchIn bool  p  ) 
 

Set the punch-in record status.

Parameters:
p New punch in status
See also:
punchIn

bool TSE3::Transport::autoStop  )  const [inline]
 

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.

Returns:
Auto stop mode status
See also:
setAutoStop

void TSE3::Transport::setAutoStop bool  s  ) 
 

Set the auto stop status.

Parameters:
s New auto stop mode status
See also:
setAutoStop

Clock TSE3::Transport::playLeadIn  )  const [inline]
 

Returns the playback lead in, the number of PPQN before Song playback begins.

Returns:
The playback lead in
See also:
setPlaybackLeadIn

void TSE3::Transport::setPlayLeadIn Clock  c  ) 
 

Sets the value of the playback lead in.

Parameters:
c New playback lead in
See also:
playbackLeadIn

Clock TSE3::Transport::recordLeadIn  )  const [inline]
 

Returns the record lead in, the number of PPQN before Song recording begins.

Returns:
The record lead in
See also:
setRecordLeadIn

void TSE3::Transport::setRecordLeadIn Clock  c  ) 
 

Sets the value of the record lead in.

Parameters:
c New record lead in
See also:
recordLeadIn

void TSE3::Transport::play Playable p,
Clock  startTime
 

Call this to start playback.

If the request is successful, an event will be returned to all .

Parameters:
p The object to play.
startTime The time to start playback from.

void TSE3::Transport::record Playable p,
Clock  startTime,
PhraseEdit pe,
MidiFilter filter = 0
 

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.

Parameters:
p The object to play.
startTime The time to start recording from.
pe The PhraseEdit to record into.
filter The filter for punch-in track (or 0).

void TSE3::Transport::stop  ) 
 

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.

void TSE3::Transport::ff bool  strong  ) 
 

Fast forward.

Makes the playback position jump forwards by Clock::PPQN.

Parameters:
strong If true, fast forwards four times faster.

void TSE3::Transport::ffFlag  ) 
 

Fast forward to next flag position, if there is one.

void TSE3::Transport::rew bool  strong  ) 
 

Rewind.

Makes the playback position jump backwards by Clock::PPQN.

Parameters:
strong If true, rewinds four times faster.

void TSE3::Transport::rewFlag  ) 
 

Rewind to previous flag position, or the start if there is none.

void TSE3::Transport::poll  ) 
 

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().

int TSE3::Transport::status  )  const [inline]
 

Returns the current state of the Transport object

Returns:
Current Transport state

Playable* TSE3::Transport::playable  )  const [inline]
 

If status is not Resting, then this will return a pointer to the current Playable object.

When resting, this returns zero.

Returns:
Current playable
See also:
play

record

Clock TSE3::Transport::lookAhead  )  const [inline]
 

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.

Returns:
Look ahead value
See also:
setLookAhead

minimumLookAhead

adaptiveLookAhead

void TSE3::Transport::setLookAhead Clock  c  ) 
 

Sets the look ahead value.

Parameters:
c New look ahead value
See also:
lookAhead

Clock TSE3::Transport::minimumLookAhead  )  const [inline]
 

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:
Minimum look ahead value
See also:
lookAhead

setLookAhead

bool TSE3::Transport::adaptiveLookAhead  )  const [inline]
 

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.

Returns:
Adaptive look ahead status
See also:
setAdaptiveLookAhead

lookAhead

setLookAhead

void TSE3::Transport::setAdaptiveLookAhead bool  ala  ) 
 

Set the value of the adaptive look ahead feature.

Parameters:
ala New adaptive look ahead status
See also:
adaptiveLookAhead

int TSE3::Transport::breakUps  )  const [inline]
 

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.

Returns:
The number of time playback has 'broken up'
See also:
lookAhead

setLookAhead

void TSE3::Transport::inject MidiCommand  c  ) 
 

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'.

Parameters:
c The MidiCommand to inject

virtual void TSE3::Transport::MidiScheduler_Started MidiScheduler  )  [virtual]
 

Reimplemented from TSE3::MidiSchedulerListener.

virtual void TSE3::Transport::MidiScheduler_Stopped MidiScheduler  )  [virtual]
 

Reimplemented from TSE3::MidiSchedulerListener.

virtual void TSE3::Transport::MidiScheduler_Moved MidiScheduler  )  [virtual]
 

Reimplemented from TSE3::MidiSchedulerListener.

virtual void TSE3::Transport::Notifier_Deleted FlagTrack  )  [virtual]
 

virtual void TSE3::Transport::Notifier_Deleted Metronome  )  [virtual]
 

virtual void TSE3::Transport::Notifier_Deleted MidiScheduler  )  [virtual]
 

virtual void TSE3::Transport::Notifier_Deleted PhraseEdit  )  [virtual]
 

virtual void TSE3::Transport::Notifier_Deleted Playable  )  [virtual]
 


The documentation for this class was generated from the following file:
Generated on Wed May 25 14:47:09 2005 for TSE3 by doxygen 1.3.2