diff options
| -rw-r--r-- | backends/midi/windows.cpp | 1 | ||||
| -rw-r--r-- | scumm/imuse_player.cpp | 2 | ||||
| -rw-r--r-- | scumm/scummvm.cpp | 5 | ||||
| -rw-r--r-- | sound/mididrv.h | 3 | ||||
| -rw-r--r-- | sound/mpu401.cpp | 15 | ||||
| -rw-r--r-- | sound/mpu401.h | 2 |
6 files changed, 23 insertions, 5 deletions
diff --git a/backends/midi/windows.cpp b/backends/midi/windows.cpp index 138952529d..58fcedabc6 100644 --- a/backends/midi/windows.cpp +++ b/backends/midi/windows.cpp @@ -39,7 +39,6 @@ private: bool _isOpen; void check_error(MMRESULT result); - uint32 property(int prop, uint32 param) { return 0; } public: MidiDriver_WIN() : _isOpen (false) { } diff --git a/scumm/imuse_player.cpp b/scumm/imuse_player.cpp index 784b92bb0e..d3bb913f0f 100644 --- a/scumm/imuse_player.cpp +++ b/scumm/imuse_player.cpp @@ -374,6 +374,7 @@ void Player::sysEx(byte *p, uint16 len) { // as follows: // BYTE 00: Channel # // BYTE 02: BIT 01(0x01): Part on?(1 = yes) + // BYTE 04: Priority adjustment [guessing] // BYTE 05: Volume(upper 4 bits) [guessing] // BYTE 06: Volume(lower 4 bits) [guessing] // BYTE 09: BIT 04(0x08): Percussion?(1 = yes) @@ -382,6 +383,7 @@ void Player::sysEx(byte *p, uint16 len) { part = getPart(p[0] & 0x0F); if (part) { part->set_onoff(p[2] & 0x01); + part->set_pri (p[4]); part->setVolume((p[5] & 0x0F) << 4 |(p[6] & 0x0F)); part->_percussion = _isGM ?((p[9] & 0x08) > 0) : false; if (part->_percussion) { diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index dda7c58246..17786a9351 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -738,7 +738,10 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst) } else if (((_midiDriver == MD_PCJR) || (_midiDriver == MD_PCSPK)) && ((_version > 2) && (_version < 5))) { _musicEngine = _playerV2 = new Player_V2(this); } else if (_version > 2) { - _musicEngine = _imuse = IMuse::create(syst, _mixer, detector->createMidi()); + MidiDriver *driver = detector->createMidi(); + if (driver && detector->_native_mt32) + driver->property (MidiDriver::PROP_CHANNEL_MASK, 0x03FE); + _musicEngine = _imuse = IMuse::create(syst, _mixer, driver); if (_imuse) { if (detector->_gameTempo != 0) _imuse->property(IMuse::PROP_TEMPO_BASE, detector->_gameTempo); diff --git a/sound/mididrv.h b/sound/mididrv.h index ff8583b0f5..f9164cb3fb 100644 --- a/sound/mididrv.h +++ b/sound/mididrv.h @@ -44,7 +44,8 @@ public: enum { // PROP_TIMEDIV = 1, - PROP_OLD_ADLIB = 2 + PROP_OLD_ADLIB = 2, + PROP_CHANNEL_MASK = 3 }; // Open the midi driver. diff --git a/sound/mpu401.cpp b/sound/mpu401.cpp index 5277844426..78845f99a8 100644 --- a/sound/mpu401.cpp +++ b/sound/mpu401.cpp @@ -85,7 +85,8 @@ MidiDriver_MPU401::MidiDriver_MPU401() : _started_thread (false), _mutex (0), _timer_proc (0), - _timer_param (0) + _timer_param (0), + _channel_mask (0xFFFF) // Permit all 16 channels by default { uint i; @@ -106,12 +107,22 @@ void MidiDriver_MPU401::close() { send (0x7B << 8 | 0xB0 | i); } +uint32 MidiDriver_MPU401::property (int prop, uint32 param) { + switch (prop) { + case PROP_CHANNEL_MASK: + _channel_mask = param & 0xFFFF; + return 1; + } + + return 0; +} + MidiChannel *MidiDriver_MPU401::allocateChannel() { MidiChannel_MPU401 *chan; uint i; for (i = 0; i < ARRAYSIZE(_midi_channels); ++i) { - if (i == 9) + if (i == 9 || !(_channel_mask & (1 << i))) continue; chan = &_midi_channels[i]; if (!chan->_allocated) { diff --git a/sound/mpu401.h b/sound/mpu401.h index 2a7daaea6f..5551fdf48c 100644 --- a/sound/mpu401.h +++ b/sound/mpu401.h @@ -85,6 +85,7 @@ private: OSystem::MutexRef _mutex; // Concurrent shutdown barrier volatile TimerCallback _timer_proc; void *_timer_param; + uint16 _channel_mask; static int midi_driver_thread (void *param); @@ -94,6 +95,7 @@ public: virtual void close(); void setTimerCallback(void *timer_param, TimerCallback timer_proc); uint32 getBaseTempo(void) { return 10000; } + uint32 property(int prop, uint32 param); MidiChannel *allocateChannel(); MidiChannel *getPercussionChannel() { return &_midi_channels [9]; } |
