diff options
author | Jamieson Christian | 2003-06-01 04:05:13 +0000 |
---|---|---|
committer | Jamieson Christian | 2003-06-01 04:05:13 +0000 |
commit | 452735e320894939283b9e10ae8ffb11a2811d93 (patch) | |
tree | 20bc685c14790a82d1f6f854cfc1fc4b013beafc | |
parent | fa481d90e5735c079b12df1b3a8b17a8081ce644 (diff) | |
download | scummvm-rg350-452735e320894939283b9e10ae8ffb11a2811d93.tar.gz scummvm-rg350-452735e320894939283b9e10ae8ffb11a2811d93.tar.bz2 scummvm-rg350-452735e320894939283b9e10ae8ffb11a2811d93.zip |
Some last SysEx cleanup.
svn-id: r8223
-rw-r--r-- | scumm/imuse.cpp | 33 | ||||
-rw-r--r-- | scumm/imuse_internal.h | 1 | ||||
-rw-r--r-- | scumm/instrument.cpp | 6 | ||||
-rw-r--r-- | sound/mpu401.cpp | 11 | ||||
-rw-r--r-- | sound/mpu401.h | 2 |
5 files changed, 26 insertions, 27 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index 9befbfb88d..2ddc031a44 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -1117,22 +1117,33 @@ void IMuseInternal::initMidiDriver (MidiDriver *midi) { if (result) error("IMuse initialization - ", MidiDriver::getErrorName(result)); - // Display a welcome message on MT-32 displays. - byte welcome[] = { - 0x41, 0x10, 0x16, 0x12, 0x20, 0x00, 0x00, - ' ','W','e','l','c','o','m','e',' ','t','o',' ','S','c','u','m','m','V','M',' ', - 0 - }; - byte checksum = 0; - for (int i = 4; i < ARRAYSIZE(welcome) - 1; ++i) - checksum -= welcome[i]; - welcome[ARRAYSIZE(welcome)-1] = checksum & 0x7F; - midi->sysEx (welcome, ARRAYSIZE(welcome)); + // In case we have an MT-32 attached. + initMT32 (midi); // Connect to the driver's timer midi->setTimerCallback (midi, &IMuseInternal::midiTimerCallback); } +void IMuseInternal::initMT32 (MidiDriver *midi) { + byte buffer[32] = "\x41\x10\x16\x12\x00\x00\x00 "; + + // Reset the MT-32 + memcpy (&buffer[4], "\x7f\x00\x00\x01\x00", 5); + midi->sysEx (buffer, 9); + + // Display a welcome message on MT-32 displays. + memcpy (&buffer[4], "\x20\x00\x00", 3); + memcpy (&buffer[7], " ", 20); + memcpy (&buffer + 7 + (20 - strlen ("ScummVM " SCUMMVM_VERSION)) / 2, + "ScummVM " SCUMMVM_VERSION, + strlen ("ScummVM " SCUMMVM_VERSION)); + byte checksum = 0; + for (int i = 4; i < 27; ++i) + checksum -= buffer[i]; + buffer[27] = checksum; + midi->sysEx (buffer, 28); +} + void IMuseInternal::init_queue() { _queue_adding = false; _queue_pos = 0; diff --git a/scumm/imuse_internal.h b/scumm/imuse_internal.h index 922a99315b..2dc6941ec0 100644 --- a/scumm/imuse_internal.h +++ b/scumm/imuse_internal.h @@ -396,6 +396,7 @@ private: void handle_marker(uint id, byte data); int get_channel_volume(uint a); void initMidiDriver (MidiDriver *midi); + void initMT32 (MidiDriver *midi); void init_players(); void init_parts(); void init_queue(); diff --git a/scumm/instrument.cpp b/scumm/instrument.cpp index 1540461ef7..f334a2fd0b 100644 --- a/scumm/instrument.cpp +++ b/scumm/instrument.cpp @@ -419,17 +419,17 @@ void Instrument_Roland::saveOrLoad (Serializer *s) { void Instrument_Roland::send (MidiChannel *mc) { if (_native_mt32) { + if (mc->getNumber() > 7) + return; _instrument.device_id = mc->getNumber(); -// _instrument.device_id = 0x10; // Remap instrument to appropriate address space. -// int address = 0x010000 + mc->getNumber() * 246; int address = 0x008000; _instrument.address[0] = (address >> 14) & 0x7F; _instrument.address[1] = (address >> 7) & 0x7F; _instrument.address[2] = (address ) & 0x7F; - // Recompute checksum. + // Recompute the checksum. byte checksum = 0; byte *ptr = (byte *) &_instrument + 4; int i; diff --git a/sound/mpu401.cpp b/sound/mpu401.cpp index 0a2e0c42ca..cd435d5d95 100644 --- a/sound/mpu401.cpp +++ b/sound/mpu401.cpp @@ -88,17 +88,6 @@ MidiDriver_MPU401::MidiDriver_MPU401() : MidiDriver() { } } -void MidiDriver_MPU401::sysEx_customInstrument (byte channel, uint32 type, byte *instr) { - if (type != 'ROL ') - return; - - // The SysEx stream for a Roland MT-32 instrument definition starts with - // the Roland manufacturer ID. So we just need to substitute the appropriate - // device # (i.e. channel), and go. - instr[1] = channel; - sysEx (instr, 253); -} - MidiChannel *MidiDriver_MPU401::allocateChannel() { MidiChannel_MPU401 *chan; uint i; diff --git a/sound/mpu401.h b/sound/mpu401.h index cd495b5040..ecf8cd0919 100644 --- a/sound/mpu401.h +++ b/sound/mpu401.h @@ -90,8 +90,6 @@ public: void setTimerCallback(void *timer_param, void (*timer_proc) (void *)); uint32 getBaseTempo(void) { return 10000; } // 0x4A0000; } // Now referenced in microseconds between callbacks - virtual void sysEx_customInstrument (byte channel, uint32 type, byte *instr); - MidiChannel *allocateChannel(); MidiChannel *getPercussionChannel() { return &_midi_channels [9]; } }; |