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

TSE3::Ins::Destination Class Reference

MIDI destination information utility. More...

#include <Destination.h>

Inheritance diagram for TSE3::Ins::Destination:

Inheritance graph
[legend]
Collaboration diagram for TSE3::Ins::Destination:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Destination ()
 ~Destination ()
InstrumentdefaultInstrument () const
void setDefaultInstrument (Instrument *instrument)
bool allChannels (int port)
Instrumentport (int port)
void setPort (int port, Instrument *instrument)
Instrumentchannel (int channel, int port)
void setChannel (int channel, int port, Instrument *instrument)
size_t numInstruments () const
Instrumentinstrument (size_t index)
Instrumentinstrument (const std::string &title)
void addInstrument (Instrument *instrument)
void removeInstrument (Instrument *instrument)

Detailed Description

MIDI destination information utility.

The Destination class is a simple utility class that can be used to associate Instrument definitions with MIDI outputs (channel/port pairs).

An application can use this to remember what sort of instrument definition to use for which output; to present the correct program change information to the user, for example.

For each port, you may choose one Instrument for every channel, or may select a number of different Instrument objects for the different individual channels.

You may also leave a particular definition unspecified (as zero).

The Destination class has a secondary purpose of keeping track of all the currently used Instrument objects, keeping the list of desinations up to date if any Instrument is removed.

Since this class operates independantly of a TSE3::MidiScheduler it cannot track what port numbers are currently valid, and which are not.

Author:
Pete Goodliffe
Version:
3.00
See also:
Instrument


Constructor & Destructor Documentation

TSE3::Ins::Destination::Destination  ) 
 

Creates a Destination object.

Initially no destinations are specified.

TSE3::Ins::Destination::~Destination  ) 
 


Member Function Documentation

Instrument* TSE3::Ins::Destination::defaultInstrument  )  const
 

Returns the default Instrument.

This is the instrument definition that is returned if no other mapping has been made.

By default, this is set to zero.

Returns:
The default instrument definition
See also:
setDefaultInstrument

void TSE3::Ins::Destination::setDefaultInstrument Instrument instrument  ) 
 

Sets the default Instrument.

Parameters:
instrument The default definition
See also:
defaultInstrument

bool TSE3::Ins::Destination::allChannels int  port  ) 
 

Returns whether there is one Instrument selected for every channel on this port (true) or whether each channel is been assigned separately (false).

Parameters:
port Port number to enquire about
Returns:
Whether there is one Instrument for every channel on this port
See also:
setPort

setChannel

Instrument* TSE3::Ins::Destination::port int  port  ) 
 

Returns the Instrument selected for this entire port. This instrument is used for every channel on this port.

If no instrument has been specified for this port, then port() returns the defaultInstrument.

If allChannels is false for this port then zero is returned (you have called this in error).

Parameters:
port Port number to enquire about
Returns:
The Instrument selected for this port, or 0 if no Instrument is specified
See also:
setPort

channel

void TSE3::Ins::Destination::setPort int  port,
Instrument instrument
 

Sets which instrument is used by this port. This will have the side effect of making allChannels return true.

You may specify an instrument of zero to unspecify an Instrument definition.

Parameters:
port Port number to set Instrument for
instrument Instrument to specify. Whilst it's not essential that this has been added with addInstrument, it is advised to do so.
See also:
setChannel

Instrument* TSE3::Ins::Destination::channel int  channel,
int  port
 

Returns the Instrument selected for this channel/port destination.

If no instrument has been specified for this port/channel, then port returns defaultInstrument.

If allChannels is true for this port then the channel value is ignored.

Parameters:
port Port number to enquire about
channel Channel number to enquire about
Returns:
The Instrument selected for this port, or 0 if no Instrument is specified
See also:
setChannel

port

void TSE3::Ins::Destination::setChannel int  channel,
int  port,
Instrument instrument
 

Sets which instrument is used by this channel/port pair. This will have the side effect of making allChannels return false.

You may specify an instrument of zero to unspecify an Instrument definition.

Parameters:
port Port number to set Instrument for
channel Channel number to set Instrument for
instrument Instrument to specify. Whilst it's not essential that this has been added with addInstrument, it is advised to do so.
See also:
setChannel

size_t TSE3::Ins::Destination::numInstruments  )  const
 

Returns the number of Instrument objects currently managed by the Destination object.

Instrument* TSE3::Ins::Destination::instrument size_t  index  ) 
 

Returns the Instrument at the given index. The list of Instrument object is ordered alphabetically.

Parameters:
index Index into Instrument list (between 0 and ()).
Returns:
Instrument object at index
See also:
noInstruments

Instrument* TSE3::Ins::Destination::instrument const std::string &  title  ) 
 

Returns the Instrument with the given title, or zero if there is no such Instrument.

Parameters:
title Instrument title to search for
Returns:
Instrument object or 0

void TSE3::Ins::Destination::addInstrument Instrument instrument  ) 
 

Adds the specified Instrument to the list of Instrument objects. You can only insert a given Instrument once. The instrument is inserted into the list in alphabetical order of title.

The Instrument object is considered to be 'owned' by the Destination class, and will be deleted when the Destination is.

Parameters:
instrument New Instrument object to insert
See also:
removeInstrument

void TSE3::Ins::Destination::removeInstrument Instrument instrument  ) 
 

Removed the specified Instrument from the list of Instrument objects. If instrument is being used as a destination, then the destination link is removed.

Once removed it is your responsibility to delete the Instrument.

Parameters:
instrument Instrument object to remove
See also:
addInstrument


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