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

void midiDriverCommonSend (uint32 b)
 Common operations to be done by all drivers on start of send.
void midiDriverCommonSysEx (const byte *msg, uint16 length)
 Common operations to be done by all drivers on start of sysEx.
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 const uint8 _gsDrumkitFallbackMap [128]

Static Private Attributes

static bool _forceTypeMT32 = false

Detailed Description

Abstract MIDI Driver Class.

Todo:
Rename MidiDriver to MusicDriver

Definition at line 166 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 175 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 231 of file mididrv.h.

anonymous enum
Enumerator:
PROP_OLD_ADLIB 
PROP_CHANNEL_MASK 
PROP_SCUMM_OPL3 

Definition at line 238 of file mididrv.h.

Enumerator:
kDriverName 
kDriverId 
kDeviceName 
kDeviceId 

Definition at line 177 of file mididrv.h.


Constructor & Destructor Documentation

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

Definition at line 220 of file mididrv.h.


Member Function Documentation

virtual MidiChannel* MidiDriver::allocateChannel (  )  [pure virtual]
bool MidiDriver::checkDevice ( MidiDriver::DeviceHandle  handle  )  [static]

Check whether the device with the given handle is available.

Definition at line 402 of file mididrv.cpp.

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

Close the midi driver.

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 390 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 157 of file mididrv.cpp.

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

The time in microseconds between invocations of the timer callback.

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

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

Definition at line 413 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 132 of file mididrv.cpp.

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

Retrieve a string representation of an error code.

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 114 of file mididrv.cpp.

virtual MidiChannel* MidiDriver::getPercussionChannel (  )  [pure virtual]
virtual bool MidiDriver::isOpen (  )  const [pure virtual]

Check whether the midi driver has already been opened.

void MidiDriver::midiDriverCommonSend ( uint32  b  ) 

Common operations to be done by all drivers on start of send.

Definition at line 485 of file mididrv.cpp.

void MidiDriver::midiDriverCommonSysEx ( const byte msg,
uint16  length 
)

Common operations to be done by all drivers on start of sysEx.

Definition at line 489 of file mididrv.cpp.

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

Definition at line 101 of file mididrv.cpp.

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

Open the midi driver.

Returns:
0 if successful, otherwise an error code.
virtual uint32 MidiDriver::property ( int  prop,
uint32  param 
) [inline, virtual]

Get or set a property.

Definition at line 261 of file mididrv.h.

void MidiDriver::sendGMReset (  ) 

Send a General MIDI reset sysEx to the midi device.

Definition at line 440 of file mididrv.cpp.

void MidiDriver::sendMT32Reset (  ) 

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

Definition at line 434 of file mididrv.cpp.

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

Definition at line 267 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]

Definition at line 286 of file mididrv.h.


Member Data Documentation

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

Definition at line 217 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 223 of file mididrv.h.

Initial value:
 {
     0,  0,  0,  0,  0,  0,  0,  0, 
     8,  8,  8,  8,  8,  8,  8,  8, 
    16, 16, 16, 16, 16, 16, 16, 16, 
    24, 25, 24, 24, 24, 24, 24, 24, 
    32, 32, 32, 32, 32, 32, 32, 32, 
    40, 40, 40, 40, 40, 40, 40, 40, 
    48, 48, 48, 48, 48, 48, 48, 48, 
    56, 56, 56, 56, 56, 56, 56, 56, 
     0,  0,  0,  0,  0,  0,  0,  0, 
     0,  0,  0,  0,  0,  0,  0,  0, 
     0,  0,  0,  0,  0,  0,  0,  0, 
     0,  0,  0,  0,  0,  0,  0,  0, 
     0,  0,  0,  0,  0,  0,  0,  0, 
     0,  0,  0,  0,  0,  0,  0,  0, 
     0,  0,  0,  0,  0,  0,  0,  0, 
     0,  0,  0,  0,  0,  0,  0, 127 
}

Definition at line 225 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 222 of file mididrv.h.


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


Generated on Sat May 23 2020 05:01:49 for ResidualVM by doxygen 1.7.1
curved edge   curved edge