aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJamieson Christian2003-09-25 22:32:05 +0000
committerJamieson Christian2003-09-25 22:32:05 +0000
commita30eb131bb746efc3134e34db8870c5889deeb1a (patch)
tree850d43a482cd9d32c99371248a626bd5f06a77c3 /sound
parentf5d8300043fb36b72313707948d803e5e9674bf7 (diff)
downloadscummvm-rg350-a30eb131bb746efc3134e34db8870c5889deeb1a.tar.gz
scummvm-rg350-a30eb131bb746efc3134e34db8870c5889deeb1a.tar.bz2
scummvm-rg350-a30eb131bb746efc3134e34db8870c5889deeb1a.zip
Fix for Bug [810564] ALL: missing instruments with native MT-32
As defined in Patch [811623] MT-32 patch for Bug 810564 Added a channel mask to MPU-401 devices so that --native-mt32 may force the device to use only the subset of MIDI channels actually supported by the MT-32. Also added a best-guess interpretation of iMuse Part priority in the SysEx 0x00 msg, since part priorities become more of an issue when the channel count is cramped. svn-id: r10409
Diffstat (limited to 'sound')
-rw-r--r--sound/mididrv.h3
-rw-r--r--sound/mpu401.cpp15
-rw-r--r--sound/mpu401.h2
3 files changed, 17 insertions, 3 deletions
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]; }