Some last SysEx cleanup.
svn-id: r8223
This commit is contained in:
parent
fa481d90e5
commit
452735e320
5 changed files with 26 additions and 27 deletions
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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]; }
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue