aboutsummaryrefslogtreecommitdiff
path: root/backends/midi/adlib.cpp
diff options
context:
space:
mode:
authorJamieson Christian2003-08-08 11:54:24 +0000
committerJamieson Christian2003-08-08 11:54:24 +0000
commit154e872d5aa02845baf1615a86dee50636c1b92a (patch)
tree555a6d9eedfce2bad2a2dda8ab53c69ecfe72fbc /backends/midi/adlib.cpp
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 'backends/midi/adlib.cpp')
-rw-r--r--backends/midi/adlib.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/backends/midi/adlib.cpp b/backends/midi/adlib.cpp
index a95fa8da38..960ad0cd82 100644
--- a/backends/midi/adlib.cpp
+++ b/backends/midi/adlib.cpp
@@ -102,6 +102,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);
@@ -559,6 +561,7 @@ public:
int open();
void close();
void send(uint32 b);
+ void send (byte channel, uint32 b); // Supports higher than channel 15
uint32 property(int prop, uint32 param);
void setPitchBendRange(byte channel, uint range);
@@ -646,6 +649,10 @@ MidiDriver *AdlibPart::device() {
return _owner;
}
+void AdlibPart::send (uint32 b) {
+ _owner->send (_channel, b);
+}
+
void AdlibPart::noteOff(byte note) {
_owner->part_key_off(this, note);
}
@@ -830,9 +837,9 @@ MidiDriver_ADLIB::MidiDriver_ADLIB(SoundMixer *mixer)
}
for (i = 0; i < ARRAYSIZE(_parts); ++i) {
- _parts[i].init(this, i);
+ _parts[i].init(this, i + ((i >= 9) ? 1 : 0));
}
- _percussion.init(this, 0);
+ _percussion.init(this, 9);
}
int MidiDriver_ADLIB::open() {
@@ -888,12 +895,15 @@ void MidiDriver_ADLIB::close() {
_isOpen = false;
}
-void MidiDriver_ADLIB::send(uint32 b) {
+void MidiDriver_ADLIB::send (uint32 b) {
+ send (b & 0xF, b & 0xFFFFFFF0);
+}
+
+void MidiDriver_ADLIB::send (byte chan, uint32 b) {
//byte param3 = (byte) ((b >> 24) & 0xFF);
byte param2 = (byte) ((b >> 16) & 0xFF);
byte param1 = (byte) ((b >> 8) & 0xFF);
byte cmd = (byte) (b & 0xF0);
- byte chan = (byte) (b & 0x0F);
AdlibPart *part;
if (chan == 9)