MidiDriver Class Reference

The Basic High Level Pentagram Midi Driver interface. More...

#include <MidiDriver.h>

Inheritance diagram for MidiDriver:

LowLevelMidiDriver ALSAMidiDriver CoreAudioMidiDriver FluidSynthMidiDriver FMOplMidiDriver TimidityMidiDriver UnixSeqMidiDriver WindowsMidiDriver List of all members.

Public Types

 TIMBRE_LIBRARY_U7VOICE_AD = 0
 TIMBRE_LIBRARY_U7VOICE_MT = 1
 TIMBRE_LIBRARY_XMIDI_AD = 2
 TIMBRE_LIBRARY_XMIDI_MT = 3
 TIMBRE_LIBRARY_SYX_FILE = 4
 TIMBRE_LIBRARY_XMIDI_FILE = 5
 TIMBRE_LIBRARY_FMOPL_SETGM = 6
enum  TimbreLibraryType {
  TIMBRE_LIBRARY_U7VOICE_AD = 0, TIMBRE_LIBRARY_U7VOICE_MT = 1, TIMBRE_LIBRARY_XMIDI_AD = 2, TIMBRE_LIBRARY_XMIDI_MT = 3,
  TIMBRE_LIBRARY_SYX_FILE = 4, TIMBRE_LIBRARY_XMIDI_FILE = 5, TIMBRE_LIBRARY_FMOPL_SETGM = 6
}

Public Member Functions

virtual int initMidiDriver (uint32 sample_rate, bool stereo)=0
virtual void destroyMidiDriver ()=0
bool isInitialized ()
virtual int maxSequences ()=0
virtual void setGlobalVolume (int vol)=0
virtual void startSequence (int seq_num, XMidiEventList *list, bool repeat, int vol, int branch=-1)=0
virtual void finishSequence (int seq_num)=0
virtual void pauseSequence (int seq_num)=0
virtual void unpauseSequence (int seq_num)=0
virtual void setSequenceVolume (int seq_num, int vol)=0
virtual void setSequenceSpeed (int seq_num, int speed)=0
virtual bool isSequencePlaying (int seq_num)=0
virtual uint32 getSequenceCallbackData (int seq_num)
virtual bool isSampleProducer ()
virtual void produceSamples (sint16 *samples, uint32 bytes)
virtual bool isFMSynth ()
virtual bool isMT32 ()
virtual bool noTimbreSupport ()
virtual void loadTimbreLibrary (IDataSource *, TimbreLibraryType type)
virtual ~MidiDriver ()

Static Public Member Functions

static int getDriverCount ()
static std::string getDriverName (uint32 index)
static MidiDrivercreateInstance (std::string driverName, uint32 sample_rate, bool stereo)

Protected Member Functions

 MidiDriver ()
std::string getConfigSetting (std::string name, std::string defaultval)

Protected Attributes

bool initialized

Classes

struct  MidiDriverDesc
 Midi driver desription. More...

Detailed Description

The Basic High Level Pentagram Midi Driver interface.

Definition at line 26 of file MidiDriver.h.


Member Enumeration Documentation

enum MidiDriver::TimbreLibraryType

Enumerator:
TIMBRE_LIBRARY_U7VOICE_AD 
TIMBRE_LIBRARY_U7VOICE_MT 
TIMBRE_LIBRARY_XMIDI_AD 
TIMBRE_LIBRARY_XMIDI_MT 
TIMBRE_LIBRARY_SYX_FILE 
TIMBRE_LIBRARY_XMIDI_FILE 
TIMBRE_LIBRARY_FMOPL_SETGM 

Definition at line 41 of file MidiDriver.h.


Constructor & Destructor Documentation

MidiDriver::MidiDriver (  )  [inline, protected]

Definition at line 30 of file MidiDriver.h.

virtual MidiDriver::~MidiDriver (  )  [inline, virtual]

Destructor.

Definition at line 130 of file MidiDriver.h.


Member Function Documentation

MidiDriver * MidiDriver::createInstance ( std::string  driverName,
uint32  sample_rate,
bool  stereo 
) [static]

Create an Instance of a MidiDriver

Parameters:
driverName Name of the prefered driver to create
Returns:
The created MidiDriver instance

Definition at line 125 of file MidiDriver.cpp.

References createInstance(), initMidiDriver(), InitMidiDriverVector(), midi_drivers, pout, and Pentagram::strcasecmp().

Referenced by createInstance(), and Pentagram::AudioMixer::openMidiOutput().

virtual void MidiDriver::destroyMidiDriver (  )  [pure virtual]

Destroy the driver.

Implemented in LowLevelMidiDriver.

Referenced by Pentagram::AudioMixer::closeMidiOutput().

virtual void MidiDriver::finishSequence ( int  seq_num  )  [pure virtual]

Finish playing a sequence, and free the data

Parameters:
seq_num The Sequence number to stop

Implemented in LowLevelMidiDriver.

Referenced by MusicProcess::playMusic_internal(), Pentagram::AudioMixer::reset(), and MusicProcess::run().

std::string MidiDriver::getConfigSetting ( std::string  name,
std::string  defaultval 
) [protected]

Get a configuration setting for the midi driver.

Definition at line 199 of file MidiDriver.cpp.

Referenced by WindowsMidiDriver::open(), FluidSynthMidiDriver::open(), ALSAMidiDriver::open(), and UnixSeqMidiDriver::UnixSeqMidiDriver().

int MidiDriver::getDriverCount (  )  [static]

Get the number of devices.

Definition at line 108 of file MidiDriver.cpp.

References InitMidiDriverVector(), and midi_drivers.

std::string MidiDriver::getDriverName ( uint32  index  )  [static]

Get the name of a driver

Parameters:
index Driver number

Definition at line 115 of file MidiDriver.cpp.

References InitMidiDriverVector(), and midi_drivers.

virtual uint32 MidiDriver::getSequenceCallbackData ( int  seq_num  )  [inline, virtual]

Get the callback data for a specified sequence

Parameters:
seq_num The Sequence to get callback data from

Reimplemented in LowLevelMidiDriver.

Definition at line 107 of file MidiDriver.h.

Referenced by MusicProcess::playMusic_internal().

virtual int MidiDriver::initMidiDriver ( uint32  sample_rate,
bool  stereo 
) [pure virtual]

Initialize the driver

Parameters:
sample_rate The sample rate for software synths
stereo Specifies if a software synth must produce stero sound
Returns:
Non zero on failure

Implemented in LowLevelMidiDriver.

Referenced by createInstance().

virtual bool MidiDriver::isFMSynth (  )  [inline, virtual]

Is this a FM Synth and should use the Adlib Tracks?

Reimplemented in FMOplMidiDriver.

Definition at line 118 of file MidiDriver.h.

Referenced by MusicProcess::playMusic_internal(), and MusicProcess::run().

bool MidiDriver::isInitialized (  )  [inline]

Definition at line 60 of file MidiDriver.h.

References initialized.

virtual bool MidiDriver::isMT32 (  )  [inline, virtual]

Is this a MT32 and supports MT32 SysEx?

Definition at line 121 of file MidiDriver.h.

virtual bool MidiDriver::isSampleProducer (  )  [inline, virtual]

Is this a Software Synth/Sample producer.

Reimplemented in FluidSynthMidiDriver, FMOplMidiDriver, and TimidityMidiDriver.

Definition at line 110 of file MidiDriver.h.

Referenced by LowLevelMidiDriver::destroyMidiDriver(), LowLevelMidiDriver::initMidiDriver(), and Pentagram::AudioMixer::MixAudio().

virtual bool MidiDriver::isSequencePlaying ( int  seq_num  )  [pure virtual]

Check to see if a sequence is playing (doesn't check for pause state)

Parameters:
seq_num The Sequence number to check
Returns:
true is sequence is playing, false if not playing

Implemented in LowLevelMidiDriver.

Referenced by MusicProcess::playMusic_internal(), and MusicProcess::run().

virtual void MidiDriver::loadTimbreLibrary ( IDataSource ,
TimbreLibraryType  type 
) [inline, virtual]

Load the Timbre Library.

Definition at line 127 of file MidiDriver.h.

virtual int MidiDriver::maxSequences (  )  [pure virtual]

Get the maximum number of playing sequences supported by this this driver

Returns:
The maximum number of playing sequences

Implemented in LowLevelMidiDriver.

Referenced by Pentagram::AudioMixer::reset().

virtual bool MidiDriver::noTimbreSupport (  )  [inline, virtual]

Is this a devices that does not Timbres?

Reimplemented in FluidSynthMidiDriver, and TimidityMidiDriver.

Definition at line 124 of file MidiDriver.h.

virtual void MidiDriver::pauseSequence ( int  seq_num  )  [pure virtual]

Pause the playback of a sequence

Parameters:
seq_num The Sequence number to pause

Implemented in LowLevelMidiDriver.

Referenced by MusicProcess::run().

virtual void MidiDriver::produceSamples ( sint16 samples,
uint32  bytes 
) [inline, virtual]

Produce Samples when doing Software Synthesizing

Parameters:
samples The buffer to fill with samples
bytes The number of bytes of music to produce

Reimplemented in LowLevelMidiDriver.

Definition at line 115 of file MidiDriver.h.

Referenced by Pentagram::AudioMixer::MixAudio().

virtual void MidiDriver::setGlobalVolume ( int  vol  )  [pure virtual]

Set the global volume level

Parameters:
vol The new global volume level (0-255)

Implemented in LowLevelMidiDriver.

Referenced by Pentagram::AudioMixer::openMidiOutput().

virtual void MidiDriver::setSequenceSpeed ( int  seq_num,
int  speed 
) [pure virtual]

Set the speed of a sequence

Parameters:
seq_num The Sequence number to change it's speed
speed The new speed for the sequence (percentage)

Implemented in LowLevelMidiDriver.

Referenced by MusicProcess::playMusic_internal().

virtual void MidiDriver::setSequenceVolume ( int  seq_num,
int  vol 
) [pure virtual]

Set the volume of a sequence

Parameters:
seq_num The Sequence number to set the volume for
vol The new volume level for the sequence (0-255)

Implemented in LowLevelMidiDriver.

virtual void MidiDriver::startSequence ( int  seq_num,
XMidiEventList list,
bool  repeat,
int  vol,
int  branch = -1 
) [pure virtual]

Start playing a sequence

Parameters:
seq_num The Sequence number to use.
list The XMidiEventList to play
repeat If true, endlessly repeat the track
activate If true, set the sequence as active
vol The volume level to start playing the sequence at (0-255)

Implemented in LowLevelMidiDriver.

Referenced by MusicProcess::playMusic_internal(), and MusicProcess::run().

virtual void MidiDriver::unpauseSequence ( int  seq_num  )  [pure virtual]

Unpause the playback of a sequence

Parameters:
seq_num The Sequence number to unpause

Implemented in LowLevelMidiDriver.


Member Data Documentation

bool MidiDriver::initialized [protected]

Definition at line 29 of file MidiDriver.h.

Referenced by LowLevelMidiDriver::destroyMidiDriver(), LowLevelMidiDriver::finishSequence(), LowLevelMidiDriver::initMidiDriver(), isInitialized(), LowLevelMidiDriver::pauseSequence(), LowLevelMidiDriver::produceSamples(), LowLevelMidiDriver::setGlobalVolume(), LowLevelMidiDriver::setSequenceSpeed(), LowLevelMidiDriver::setSequenceVolume(), LowLevelMidiDriver::startSequence(), LowLevelMidiDriver::threadMain(), LowLevelMidiDriver::unpauseSequence(), and LowLevelMidiDriver::~LowLevelMidiDriver().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:29:36 2007 for pentagram by  doxygen 1.4.7