aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJamieson Christian2002-12-18 07:13:42 +0000
committerJamieson Christian2002-12-18 07:13:42 +0000
commitb327bd178b8d7b61c084b4d4e1032d95678b04de (patch)
tree3e50733056786cacf62b5d6ac00adb81b59e179b /sound
parent5233fbc7bda3097a687af0a5a23f30b8894023be (diff)
downloadscummvm-rg350-b327bd178b8d7b61c084b4d4e1032d95678b04de.tar.gz
scummvm-rg350-b327bd178b8d7b61c084b4d4e1032d95678b04de.tar.bz2
scummvm-rg350-b327bd178b8d7b61c084b4d4e1032d95678b04de.zip
Initial framework for SysEx output support.
svn-id: r6010
Diffstat (limited to 'sound')
-rw-r--r--sound/mididrv.h27
-rw-r--r--sound/mpu401.cpp1
-rw-r--r--sound/mpu401.h1
3 files changed, 15 insertions, 14 deletions
diff --git a/sound/mididrv.h b/sound/mididrv.h
index e503aef0cd..0f4c01a436 100644
--- a/sound/mididrv.h
+++ b/sound/mididrv.h
@@ -36,17 +36,15 @@ struct MidiEvent {
class MidiDriver {
public:
- /* Special events that can be inserted in a MidiEvent.
- * event = (ME_xxx<<24) | <24-bit data associated with event>
- */
+ // Special events that can be inserted in a MidiEvent.
+ // event = (ME_xxx<<24) | <24-bit data associated with event>
enum {
ME_NONE = 0,
ME_TEMPO = 1,
};
- /* error codes returned by open.
- * can be converted to a string with getErrorName()
- */
+ // Error codes returned by open.
+ // Can be converted to a string with getErrorName()
enum {
MERR_CANNOT_CONNECT = 1,
// MERR_STREAMING_NOT_AVAILABLE = 2,
@@ -60,20 +58,20 @@ public:
};
- // open the midi driver.
- // returns 0 if successful, otherwise an error code.
+ // Open the midi driver.
+ // Returns 0 if successful, otherwise an error code.
virtual int open() = 0;
- // close the midi driver
+ // Close the midi driver
virtual void close() = 0;
- // output a packed midi command to the midi stream
+ // Output a packed midi command to the midi stream
virtual void send(uint32 b) = 0;
- /* Get or set a property */
+ // Get or set a property
virtual uint32 property(int prop, uint32 param);
- /* retrieve a string representation of an error code */
+ // Retrieve a string representation of an error code
static const char *getErrorName(int error_code);
// HIGH-LEVEL SEMANTIC METHODS
@@ -85,6 +83,7 @@ public:
send(( 0 << 16) | ( 38 << 8) | (0xB0 | channel));
}
+ virtual void sysEx (byte *msg, uint16 length) { }
virtual void sysEx_customInstrument (byte channel, uint32 type, byte *instr) { }
// Timing functions - MidiDriver now operates timers
@@ -100,6 +99,7 @@ public:
class MidiChannel {
public:
+ virtual MidiDriver *device() = 0;
virtual void release() = 0;
// Regular messages
@@ -143,8 +143,7 @@ enum {
};
-/* Factory functions => no need to include the specific classes
- * in this header => faster compile */
+// Factory functions, for faster compile
extern MidiDriver *MidiDriver_NULL_create();
extern MidiDriver *MidiDriver_ADLIB_create();
extern MidiDriver *MidiDriver_WIN_create();
diff --git a/sound/mpu401.cpp b/sound/mpu401.cpp
index f2e2ca5e9e..c3c7d1a2b9 100644
--- a/sound/mpu401.cpp
+++ b/sound/mpu401.cpp
@@ -31,6 +31,7 @@ void MidiChannel_MPU401::init (MidiDriver_MPU401 *owner, byte channel)
_allocated = false;
}
+MidiDriver *MidiChannel_MPU401::device() { return _owner; }
void MidiChannel_MPU401::noteOff (byte note) { _owner->send(note << 8 | 0x80 | _channel); }
void MidiChannel_MPU401::noteOn (byte note, byte velocity) { _owner->send (velocity << 16 | note << 8 | 0x90 | _channel); }
void MidiChannel_MPU401::programChange (byte program) { _owner->send(program << 8 | 0xC0 | _channel); }
diff --git a/sound/mpu401.h b/sound/mpu401.h
index 4de50b6418..ce9035a310 100644
--- a/sound/mpu401.h
+++ b/sound/mpu401.h
@@ -46,6 +46,7 @@ private:
void allocate() { _allocated = true; }
public:
+ MidiDriver *device();
void release() { _allocated = false; }
// Regular messages