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

TSE3::Ins::Instrument Class Reference

MIDI Instrument definition. More...

#include <Instrument.h>

Collaboration diagram for TSE3::Ins::Instrument:

Collaboration graph
[legend]
List of all members.

Public Types

enum  BankSelMethod { BankSelMethod_Normal = 0, BankSelMethod_MSB = 1, BankSelMethod_LSB = 2, BankSelMethod_Patch = 3 }

Public Member Functions

 Instrument (const std::string &title, const std::string &filename, TSE3::Progress *progess=0)
const std::string & title () const
const std::string & filename () const
void setTitle (const std::string &title)
int bankSelMethod () const
void setBankSelMethod (int b)
bool useNotesAsController () const
void setUseNotesAsControllers (bool u)
size_t numBanks () const
int bank (int index) const
int bank (const Voice &voice) const
int bankLSB (int index) const
int bankMSB (int index) const
PatchDatapatch (int index) const
PatchDatapatchForBank (int bank) const
PatchDatapatchForBank (int bankLSB, int bankMSB) const
size_t numKeys () const
NoteDatakey (size_t index) const
NoteDatakeyForVoice (const Voice &voice) const
size_t numDrums () const
Voice drum (size_t index) const
bool isDrum (const Voice &voice) const
ControlDatacontrol () const
RpnDatarpn () const
NrpnDatanrpn () const
void write (std::ostream &out)

Detailed Description

MIDI Instrument definition.

The Instrument class holds information about a specific MIDI instrument. This includes the voices it provides, control commands it understands, drum note names and so on.

The Instrument class is based on the instrument definitions supplied in Cakewalk .ins instrument definition files.

Author:
Pete Goodliffe
Version:
3.00


Member Enumeration Documentation

enum TSE3::Ins::Instrument::BankSelMethod
 

An enum type defining the Instrument's bank select method. It has the following values

  • BankSelMethod_Normal For normal instruments: uses LSB, MSB and patch.
  • BankSelMethod_MSB For instruments that only use MSB and patch.
  • BankSelMethod_LSB For instruments that only use LSB and patch.
  • BankSelMethod_Patch For instruments that only use patch.
Enumeration values:
BankSelMethod_Normal 
BankSelMethod_MSB 
BankSelMethod_LSB 
BankSelMethod_Patch 


Constructor & Destructor Documentation

TSE3::Ins::Instrument::Instrument const std::string &  title,
const std::string &  filename,
TSE3::Progress progess = 0
 

Creates an instrument with the given name from information contained in the given file. This file will be a Cakewalk .ins file.

Whilst the file is being loaded, the progess can be reported via the interface.

Parameters:
title The title of this instrument
file The file to take input from
progess TSE3::Progress callback, or zero for no callback


Member Function Documentation

const std::string& TSE3::Ins::Instrument::title  )  const [inline]
 

Returns the title of this instrument.

Returns:
Title of this instrument

const std::string& TSE3::Ins::Instrument::filename  )  const [inline]
 

Returns the filename of the source of the instrument definition.

Returns:
Filename of this instrument's definition

void TSE3::Ins::Instrument::setTitle const std::string &  title  ) 
 

Sets the title.

Parameters:
title New instrument title

int TSE3::Ins::Instrument::bankSelMethod  )  const [inline]
 

Returns the BankSelMethod, the values for this are defined as the BankSelMethod_XXX constants.

Returns:
Bank select method

void TSE3::Ins::Instrument::setBankSelMethod int  b  ) 
 

Sets the BankSelMethod.

Parameters:
b New bank select method

bool TSE3::Ins::Instrument::useNotesAsController  )  const [inline]
 

Returns the UseNotesAsControllers value.

Returns:
Whenther to use notes as controllers

void TSE3::Ins::Instrument::setUseNotesAsControllers bool  u  ) 
 

Sets the UseNotesAsControllers value.

Parameters:
u New use notes as controllers value

size_t TSE3::Ins::Instrument::numBanks  )  const [inline]
 

Returns the number of banks of patch data defined by this instrument.

Returns:
Number of banks of patches

int TSE3::Ins::Instrument::bank int  index  )  const [inline]
 

Returns the bank number in the form:

bankLSB + (bankMSB<<7)
for the bank with index index.

If you call this method with an invalid parameter, the result is undefined.

Returns:
Bank change values for bank with given index

int TSE3::Ins::Instrument::bank const Voice voice  )  const
 

Returns the bank number in the form:

bankLSB + (bankMSB<<7)
for the bank for Voice voice. If there is no such Voice defined, then -2 will be returned.

Returns:
Bank change values for bank with given index

int TSE3::Ins::Instrument::bankLSB int  index  )  const
 

Returns the bank LSB for the set of patches with index index.

If you call this method with an invalid parameter, the result is undefined.

Returns:
Bank LSB value for bank with given index
See also:
bankMSB

int TSE3::Ins::Instrument::bankMSB int  index  )  const
 

Returns the bank MSB for the set of patches with index index.

If you call this method with an invalid parameter, the result is undefined.

Returns:
Bank MSB value for bank with given index
See also:
bankLSB

PatchData* TSE3::Ins::Instrument::patch int  index  )  const [inline]
 

Returns the PatchData object for the given bank.

Parameters:
index Bank index
Returns:
Pointer to PatchData for bank, or 0

PatchData* TSE3::Ins::Instrument::patchForBank int  bank  )  const
 

Returns the PatchData object for the given bank, or 0 if there is none.

Note that this function takes the bank change number (as read from bank()), not the bank index.

If there is no PatchData for this bank, then zero is returned.

You can specify bank as -1 to find the 'catch all' bank, and if your bank number is undefined, but there is a ctach all patch set, that will be returned.

Parameters:
bank Bank number
Returns:
Pointer to PatchData for bank, or 0

PatchData* TSE3::Ins::Instrument::patchForBank int  bankLSB,
int  bankMSB
const
 

Like the patchForBank(int) above, but takes the LSB and MSB parameters separately. This function actually fowards responsibility onto the other version. It is provided as a convenience.

If either of the LSB or MSB parameters are -1, then the overal bank value passed on is -1.

Parameters:
bankLSB Bank number LSB
bankMSB Bank number MSB
Returns:
Pointer to PatchData for bank, or 0

size_t TSE3::Ins::Instrument::numKeys  )  const [inline]
 

Returns the number of sets of NoteData defined by this instrument.

Returns:
Number of patches NoteData objects

NoteData* TSE3::Ins::Instrument::key size_t  index  )  const [inline]
 

Returns the NoteData with the given index.

If you call this method with an invalid parameter, the result is undefined.

Returns:
NoteData for index

NoteData* TSE3::Ins::Instrument::keyForVoice const Voice voice  )  const
 

Returns the NoteData for the given Voice.

If there is no such Voice, then zero is returned.

Returns:
NoteData for index

size_t TSE3::Ins::Instrument::numDrums  )  const [inline]
 

Returns the number of drum statuses defined by this instrument.

Returns:
Number of drum statuses

Voice TSE3::Ins::Instrument::drum size_t  index  )  const [inline]
 

Returns the drum Voice with the given index.

If you call this method with an invalid parameter, the result is undefined.

Returns:
Voice for index

bool TSE3::Ins::Instrument::isDrum const Voice voice  )  const
 

Returns whether the specified voice is defined to be a drum sound or not (this implies that note data should be opened in a "drum" editor).

Returns:
Whether voice is a drum sound

ControlData* TSE3::Ins::Instrument::control  )  const [inline]
 

Returns the ControlData for this Instrument, if there is any defined, or zero if there is none.

Returns:
ControlData for this instrument

RpnData* TSE3::Ins::Instrument::rpn  )  const [inline]
 

Returns the RpnData for this Instrument, if there is any defined, or zero if there is none.

Returns:
RpnData for this instrument

NrpnData* TSE3::Ins::Instrument::nrpn  )  const [inline]
 

Returns the NrpnData for this Instrument, if there is any defined, or zero if there is none.

Returns:
NrpnData for this instrument

void TSE3::Ins::Instrument::write std::ostream &  out  ) 
 

Write the minimal .ins file for this instrument.

Parameters:
out ostream to write output to


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