aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJamieson Christian2003-08-08 11:54:24 +0000
committerJamieson Christian2003-08-08 11:54:24 +0000
commit154e872d5aa02845baf1615a86dee50636c1b92a (patch)
tree555a6d9eedfce2bad2a2dda8ab53c69ecfe72fbc /sound
parentf1a3253fa2785901171407a0b192b7c18cf5c5b5 (diff)
downloadscummvm-rg350-154e872d5aa02845baf1615a86dee50636c1b92a.tar.gz
scummvm-rg350-154e872d5aa02845baf1615a86dee50636c1b92a.tar.bz2
scummvm-rg350-154e872d5aa02845baf1615a86dee50636c1b92a.zip
Added generic send() option to MidiChannel.
This circumvents problems doing generic send() calls to MidiDrivers that support more than 16 MIDI channels (i.e. Adlib). Because of the way it interacts with MidiDriver, Simon could have run into a problem if it tried to allocate more than 15 Adlib music channels (though this would only happen in very, VERY rare circumstances). Also fixed a problem with the channel numbering scheme used by MidiDriver_Adlib, in particular the percussion channel number. svn-id: r9604
Diffstat (limited to 'sound')
-rw-r--r--sound/mididrv.h2
-rw-r--r--sound/mpu401.cpp4
-rw-r--r--sound/mpu401.h2
3 files changed, 8 insertions, 0 deletions
diff --git a/sound/mididrv.h b/sound/mididrv.h
index 1e9c95de03..49d532e530 100644
--- a/sound/mididrv.h
+++ b/sound/mididrv.h
@@ -91,6 +91,8 @@ public:
virtual byte getNumber() = 0;
virtual void release() = 0;
+ virtual void send (uint32 b) = 0; // 4-bit channel portion is ignored
+
// Regular messages
virtual void noteOff (byte note) = 0;
virtual void noteOn (byte note, byte velocity) = 0;
diff --git a/sound/mpu401.cpp b/sound/mpu401.cpp
index 303c42b6e4..b3b09cde86 100644
--- a/sound/mpu401.cpp
+++ b/sound/mpu401.cpp
@@ -34,6 +34,10 @@ MidiDriver *MidiChannel_MPU401::device() {
return _owner;
}
+void MidiChannel_MPU401::send (uint32 b) {
+ _owner->send (b & 0xFFFFFFF0 | (_channel & 0xF));
+}
+
void MidiChannel_MPU401::noteOff (byte note) {
_owner->send(note << 8 | 0x80 | _channel);
}
diff --git a/sound/mpu401.h b/sound/mpu401.h
index f1d7dc8d2a..2a7daaea6f 100644
--- a/sound/mpu401.h
+++ b/sound/mpu401.h
@@ -49,6 +49,8 @@ public:
byte getNumber() { return _channel; }
void release() { _allocated = false; }
+ void send (uint32 b);
+
// Regular messages
void noteOff (byte note);
void noteOn (byte note, byte velocity);