diff options
-rw-r--r-- | backends/midi/adlib.cpp | 18 | ||||
-rw-r--r-- | simon/midi.cpp | 2 | ||||
-rw-r--r-- | sound/mididrv.h | 2 | ||||
-rw-r--r-- | sound/mpu401.cpp | 4 | ||||
-rw-r--r-- | sound/mpu401.h | 2 |
5 files changed, 23 insertions, 5 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) diff --git a/simon/midi.cpp b/simon/midi.cpp index d4ee8ddf49..f910a8b146 100644 --- a/simon/midi.cpp +++ b/simon/midi.cpp @@ -124,7 +124,7 @@ void MidiPlayer::send (uint32 b) { if (!_current->channel [channel]) _current->channel[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel(); if (_current->channel [channel]) - _driver->send ((b & 0xFFFFFFF0) | _current->channel[channel]->getNumber()); + _current->channel[channel]->send (b); } void MidiPlayer::metaEvent (byte type, byte *data, uint16 length) { 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); |