ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Abstract MIDI Driver Class. More...

#include <mididrv.h>

Inheritance diagram for MidiDriver:
Collaboration diagram for MidiDriver:

List of all members.

Public Types

enum  DeviceStringType { kDriverName, kDriverId, kDeviceName, kDeviceId }
enum  { MERR_CANNOT_CONNECT = 1, MERR_DEVICE_NOT_AVAILABLE = 3, MERR_ALREADY_OPEN = 4 }
 

Error codes returned by open.

More...
enum  { PROP_OLD_ADLIB = 2, PROP_CHANNEL_MASK = 3, PROP_SCUMM_OPL3 = 4 }
typedef uint32 DeviceHandle
 The device handle.

Public Member Functions

virtual ~MidiDriver ()
virtual int open ()=0
 Open the midi driver.
virtual bool isOpen () const =0
 Check whether the midi driver has already been opened.
virtual void close ()=0
 Close the midi driver.
virtual uint32 property (int prop, uint32 param)
 Get or set a property.
virtual void setPitchBendRange (byte channel, uint range)
void sendMT32Reset ()
 Send a Roland MT-32 reset sysEx to the midi device.
void sendGMReset ()
 Send a General MIDI reset sysEx to the midi device.
virtual void sysEx_customInstrument (byte channel, uint32 type, const byte *instr)
virtual void setTimerCallback (void *timer_param, Common::TimerManager::TimerProc timer_proc)=0
virtual uint32 getBaseTempo ()=0
 The time in microseconds between invocations of the timer callback.
virtual MidiChannelallocateChannel ()=0
virtual MidiChannelgetPercussionChannel ()=0

Static Public Member Functions

static Common::String musicType2GUIO (uint32 musicType)
static MidiDrivercreateMidi (DeviceHandle handle)
 Create music driver matching the given device handle, or NULL if there is no match.
static DeviceHandle detectDevice (int flags)
 Returns device handle based on the present devices and the flags parameter.
static DeviceHandle getDeviceHandle (const Common::String &identifier)
 Find the music driver matching the given driver name/description.
static bool checkDevice (DeviceHandle handle)
 Check whether the device with the given handle is available.
static MusicType getMusicType (DeviceHandle handle)
 Get the music type matching the given device handle, or MT_AUTO if there is no match.
static Common::String getDeviceString (DeviceHandle handle, DeviceStringType type)
 Get the device description string matching the given device handle and the given type.
static const char * getErrorName (int error_code)
 Retrieve a string representation of an error code.

Static Public Attributes

static const byte _mt32ToGm [128]
static const byte _gmToMt32 [128]

Static Private Attributes

static bool _forceTypeMT32 = false

Detailed Description

Abstract MIDI Driver Class.

Todo:
Rename MidiDriver to MusicDriver

Definition at line 131 of file mididrv.h.


Member Typedef Documentation

The device handle.

The value 0 is reserved for an invalid device for now. TODO: Maybe we should use -1 (i.e. 0xFFFFFFFF) as invalid device?

Definition at line 140 of file mididrv.h.


Member Enumeration Documentation

anonymous enum

Error codes returned by open.

Can be converted to a string with getErrorName().

Enumerator:
MERR_CANNOT_CONNECT 
MERR_DEVICE_NOT_AVAILABLE 
MERR_ALREADY_OPEN 

Definition at line 187 of file mididrv.h.

anonymous enum
Enumerator:
PROP_OLD_ADLIB 
PROP_CHANNEL_MASK 
PROP_SCUMM_OPL3 

Definition at line 194 of file mididrv.h.

Enumerator:
kDriverName 
kDriverId 
kDeviceName 
kDeviceId 

Definition at line 142 of file mididrv.h.


Constructor & Destructor Documentation

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

Definition at line 178 of file mididrv.h.


Member Function Documentation

virtual MidiChannel* MidiDriver::allocateChannel (  )  [pure virtual]

Implemented in MidiDriver_ADLIB, and MidiDriver_MPU401.

bool MidiDriver::checkDevice ( MidiDriver::DeviceHandle  handle  )  [static]

Check whether the device with the given handle is available.

Definition at line 378 of file mididrv.cpp.

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

Close the midi driver.

Implemented in MidiDriver_ALSA, MidiDriver_ADLIB, and MidiDriver_MPU401.

MidiDriver * MidiDriver::createMidi ( MidiDriver::DeviceHandle  handle  )  [static]

Create music driver matching the given device handle, or NULL if there is no match.

Definition at line 366 of file mididrv.cpp.

MidiDriver::DeviceHandle MidiDriver::detectDevice ( int  flags  )  [static]

Returns device handle based on the present devices and the flags parameter.

Definition at line 133 of file mididrv.cpp.

virtual uint32 MidiDriver::getBaseTempo (  )  [pure virtual]

The time in microseconds between invocations of the timer callback.

Implemented in MidiDriver_ADLIB, MidiDriver_MPU401, and MidiDriver_Emulated.

MidiDriver::DeviceHandle MidiDriver::getDeviceHandle ( const Common::String identifier  )  [static]

Find the music driver matching the given driver name/description.

Definition at line 389 of file mididrv.cpp.

Common::String MidiDriver::getDeviceString ( DeviceHandle  handle,
DeviceStringType  type 
) [static]

Get the device description string matching the given device handle and the given type.

Definition at line 108 of file mididrv.cpp.

const char * MidiDriver::getErrorName ( int  error_code  )  [static]

Retrieve a string representation of an error code.

Definition at line 79 of file mpu401.cpp.

MusicType MidiDriver::getMusicType ( MidiDriver::DeviceHandle  handle  )  [static]

Get the music type matching the given device handle, or MT_AUTO if there is no match.

Definition at line 90 of file mididrv.cpp.

virtual MidiChannel* MidiDriver::getPercussionChannel (  )  [pure virtual]

Implemented in MidiDriver_ADLIB, and MidiDriver_MPU401.

virtual bool MidiDriver::isOpen (  )  const [pure virtual]

Check whether the midi driver has already been opened.

Implemented in MidiDriver_ALSA, MidiDriver_ADLIB, MidiDriver_NULL, and MidiDriver_Emulated.

Common::String MidiDriver::musicType2GUIO ( uint32  musicType  )  [static]

Definition at line 77 of file mididrv.cpp.

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

Open the midi driver.

Returns:
0 if successful, otherwise an error code.

Implemented in MidiDriver_ALSA, MidiDriver_ADLIB, MidiDriver_NULL, and MidiDriver_Emulated.

virtual uint32 MidiDriver::property ( int  prop,
uint32  param 
) [inline, virtual]

Get or set a property.

Reimplemented in MidiDriver_ADLIB, and MidiDriver_MPU401.

Definition at line 217 of file mididrv.h.

void MidiDriver::sendGMReset (  ) 

Send a General MIDI reset sysEx to the midi device.

Definition at line 416 of file mididrv.cpp.

void MidiDriver::sendMT32Reset (  ) 

Send a Roland MT-32 reset sysEx to the midi device.

Definition at line 410 of file mididrv.cpp.

virtual void MidiDriver::setPitchBendRange ( byte  channel,
uint  range 
) [inline, virtual]

Reimplemented in MidiDriver_ADLIB.

Definition at line 223 of file mididrv.h.

virtual void MidiDriver::setTimerCallback ( void *  timer_param,
Common::TimerManager::TimerProc  timer_proc 
) [pure virtual]
virtual void MidiDriver::sysEx_customInstrument ( byte  channel,
uint32  type,
const byte instr 
) [inline, virtual]

Reimplemented in MidiDriver_ADLIB.

Definition at line 242 of file mididrv.h.


Member Data Documentation

bool MidiDriver::_forceTypeMT32 = false [static, private]

Definition at line 175 of file mididrv.h.

const byte MidiDriver::_gmToMt32 [static]
Initial value:
 {

      5,   1,   2,   7,   3,   5,  16,  21,  22, 101, 101,  97, 104, 103, 102,  20, 
      8,   9,  11,  12,  14,  15,  87,  15,  59,  60,  61,  62,  67,  44,  79,  23, 
     64,  67,  66,  70,  68,  69,  28,  31,  52,  54,  55,  56,  49,  51,  57, 112, 
     48,  50,  45,  26,  34,  35,  45, 122,  89,  90,  94,  81,  92,  95,  24,  25, 
     80,  78,  79,  78,  84,  85,  86,  82,  74,  72,  76,  77, 110, 107, 108,  76, 
     47,  44, 111,  45,  44,  34,  44,  30,  32,  33,  88,  34,  35,  35,  38,  33, 
     41,  36, 100,  37,  40,  34,  43,  40,  63,  21,  99, 105, 103,  86,  55,  84, 
    101, 103, 100, 120, 117, 113,  99, 128, 128, 128, 128, 124, 123, 128, 128, 128, 
}

Definition at line 181 of file mididrv.h.

const byte MidiDriver::_mt32ToGm [static]
Initial value:
 {

      0,   1,   0,   2,   4,   4,   5,   3,  16,  17,  18,  16,  16,  19,  20,  21, 
      6,   6,   6,   7,   7,   7,   8, 112,  62,  62,  63,  63,  38,  38,  39,  39, 
     88,  95,  52,  98,  97,  99,  14,  54, 102,  96,  53, 102,  81, 100,  14,  80, 
     48,  48,  49,  45,  41,  40,  42,  42,  43,  46,  45,  24,  25,  28,  27, 104, 
     32,  32,  34,  33,  36,  37,  35,  35,  79,  73,  72,  72,  74,  75,  64,  65, 
     66,  67,  71,  71,  68,  69,  70,  22,  56,  59,  57,  57,  60,  60,  58,  61, 
     61,  11,  11,  98,  14,   9,  14,  13,  12, 107, 107,  77,  78,  78,  76,  76, 
     47, 117, 127, 118, 118, 116, 115, 119, 115, 112,  55, 124, 123,   0,  14, 117  
}

Definition at line 180 of file mididrv.h.


The documentation for this class was generated from the following files:


Generated on Sat May 18 2019 05:04:54 for ResidualVM by doxygen 1.7.1
curved edge   curved edge