aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamieson Christian2006-02-27 01:59:07 +0000
committerJamieson Christian2006-02-27 01:59:07 +0000
commit2469e00248423b7d0a8595d0870818c6ebfb40cf (patch)
tree3400500ba27325ba74215e27fc11a92f3b6b334c
parent2d2258f5965e0987f61b7667ab248965e770ac93 (diff)
downloadscummvm-rg350-2469e00248423b7d0a8595d0870818c6ebfb40cf.tar.gz
scummvm-rg350-2469e00248423b7d0a8595d0870818c6ebfb40cf.tar.bz2
scummvm-rg350-2469e00248423b7d0a8595d0870818c6ebfb40cf.zip
SysEx data now passed around with const pointers. Permits simplification of some SysEx client code.
Testing on Windows. Developers on other platforms, please verify integrity of music handling in your respective MidiDrivers. svn-id: r20952
-rw-r--r--backends/midi/alsa.cpp4
-rw-r--r--backends/midi/coreaudio.cpp4
-rw-r--r--backends/midi/coremidi.cpp4
-rw-r--r--backends/midi/seq.cpp4
-rw-r--r--backends/midi/windows.cpp4
-rw-r--r--backends/midi/zodiac.cpp4
-rw-r--r--engines/scumm/imuse/imuse_internal.h2
-rw-r--r--engines/scumm/imuse/imuse_player.cpp2
-rw-r--r--engines/scumm/imuse/instrument.cpp12
-rw-r--r--engines/scumm/imuse/instrument.h4
-rw-r--r--sound/mididrv.h8
-rw-r--r--sound/mpu401.cpp2
-rw-r--r--sound/mpu401.h2
-rw-r--r--sound/softsynth/adlib.cpp10
-rw-r--r--sound/softsynth/mt32.cpp8
-rw-r--r--sound/softsynth/ym2612.cpp8
16 files changed, 41 insertions, 41 deletions
diff --git a/backends/midi/alsa.cpp b/backends/midi/alsa.cpp
index 406e52243b..5a109148a4 100644
--- a/backends/midi/alsa.cpp
+++ b/backends/midi/alsa.cpp
@@ -61,7 +61,7 @@ public:
int open();
void close();
void send(uint32 b);
- void sysEx(byte *msg, uint16 length);
+ void sysEx(const byte *msg, uint16 length);
private:
void send_event(int do_flush);
@@ -192,7 +192,7 @@ void MidiDriver_ALSA::send(uint32 b) {
}
}
-void MidiDriver_ALSA::sysEx(byte *msg, uint16 length) {
+void MidiDriver_ALSA::sysEx(const byte *msg, uint16 length) {
unsigned char buf[1024];
if (length > 254) {
diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp
index b6c4c0c9da..81b72387dd 100644
--- a/backends/midi/coreaudio.cpp
+++ b/backends/midi/coreaudio.cpp
@@ -56,7 +56,7 @@ public:
int open();
void close();
void send(uint32 b);
- void sysEx(byte *msg, uint16 length);
+ void sysEx(const byte *msg, uint16 length);
private:
AUGraph _auGraph;
@@ -177,7 +177,7 @@ void MidiDriver_CORE::send(uint32 b) {
MusicDeviceMIDIEvent(_synth, status_byte, first_byte, second_byte, 0);
}
-void MidiDriver_CORE::sysEx(byte *msg, uint16 length) {
+void MidiDriver_CORE::sysEx(const byte *msg, uint16 length) {
assert(_auGraph != NULL);
// Add SysEx frame if missing
diff --git a/backends/midi/coremidi.cpp b/backends/midi/coremidi.cpp
index 598aaaba3f..d92f775a2d 100644
--- a/backends/midi/coremidi.cpp
+++ b/backends/midi/coremidi.cpp
@@ -50,7 +50,7 @@ public:
int open();
void close();
void send(uint32 b);
- void sysEx(byte *msg, uint16 length);
+ void sysEx(const byte *msg, uint16 length);
private:
MIDIClientRef mClient;
@@ -149,7 +149,7 @@ void MidiDriver_CoreMIDI::send(uint32 b) {
MIDISend(mOutPort, mDest, &packetList);
}
-void MidiDriver_CoreMIDI::sysEx(byte *msg, uint16 length) {
+void MidiDriver_CoreMIDI::sysEx(const byte *msg, uint16 length) {
assert(mOutPort != NULL);
assert(mDest != NULL);
diff --git a/backends/midi/seq.cpp b/backends/midi/seq.cpp
index 9a0bf6b837..0a1458afd4 100644
--- a/backends/midi/seq.cpp
+++ b/backends/midi/seq.cpp
@@ -46,7 +46,7 @@ public:
int open();
void close();
void send(uint32 b);
- void sysEx(byte *msg, uint16 length);
+ void sysEx(const byte *msg, uint16 length);
private:
bool _isOpen;
@@ -140,7 +140,7 @@ void MidiDriver_SEQ::send(uint32 b) {
write(device, buf, position);
}
-void MidiDriver_SEQ::sysEx (byte *msg, uint16 length) {
+void MidiDriver_SEQ::sysEx (const byte *msg, uint16 length) {
if (length > 254) {
warning ("Cannot send SysEx block - data too large");
return;
diff --git a/backends/midi/windows.cpp b/backends/midi/windows.cpp
index 2164f2a0c5..f03716f0eb 100644
--- a/backends/midi/windows.cpp
+++ b/backends/midi/windows.cpp
@@ -46,7 +46,7 @@ public:
int open();
void close();
void send(uint32 b);
- void sysEx (byte *msg, uint16 length);
+ void sysEx (const byte *msg, uint16 length);
};
int MidiDriver_WIN::open() {
@@ -89,7 +89,7 @@ void MidiDriver_WIN::send(uint32 b) {
check_error(midiOutShortMsg(_mo, u.dwData));
}
-void MidiDriver_WIN::sysEx(byte *msg, uint16 length) {
+void MidiDriver_WIN::sysEx(const byte *msg, uint16 length) {
if (!_isOpen)
return;
diff --git a/backends/midi/zodiac.cpp b/backends/midi/zodiac.cpp
index 3ad4d88e50..1aa65139b5 100644
--- a/backends/midi/zodiac.cpp
+++ b/backends/midi/zodiac.cpp
@@ -35,7 +35,7 @@ public:
int open();
void close();
void send(uint32 b);
- void sysEx(byte *msg, uint16 length);
+ void sysEx(const byte *msg, uint16 length);
private:
TwMidiHandle _midiHandle;
@@ -109,7 +109,7 @@ void MidiDriver_Zodiac::send(uint32 b) {
}
}
-void MidiDriver_Zodiac::sysEx(byte *msg, uint16 length) {
+void MidiDriver_Zodiac::sysEx(const byte *msg, uint16 length) {
TwMidiSysEx(_midiHandle, 0, msg, length);
}
diff --git a/engines/scumm/imuse/imuse_internal.h b/engines/scumm/imuse/imuse_internal.h
index 3640cafa64..45e1b89a4a 100644
--- a/engines/scumm/imuse/imuse_internal.h
+++ b/engines/scumm/imuse/imuse_internal.h
@@ -265,7 +265,7 @@ public:
void close() { }
void send(uint32 b);
const char *getErrorName(int error_code) { return "Unknown"; }
- void sysEx(byte *msg, uint16 length);
+ void sysEx(const byte *msg, uint16 length);
void metaEvent(byte type, byte *data, uint16 length);
void setTimerCallback(void *timer_param, void(*timer_proc)(void *)) { }
uint32 getBaseTempo();
diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp
index b73eb2a3bf..540be1a2f9 100644
--- a/engines/scumm/imuse/imuse_player.cpp
+++ b/engines/scumm/imuse/imuse_player.cpp
@@ -343,7 +343,7 @@ void Player::send(uint32 b) {
return;
}
-void Player::sysEx(byte *p, uint16 len) {
+void Player::sysEx(const byte *p, uint16 len) {
byte code;
byte a;
uint b;
diff --git a/engines/scumm/imuse/instrument.cpp b/engines/scumm/imuse/instrument.cpp
index 16d89c5ed2..4af3ef096b 100644
--- a/engines/scumm/imuse/instrument.cpp
+++ b/engines/scumm/imuse/instrument.cpp
@@ -164,7 +164,7 @@ private:
} _instrument;
public:
- Instrument_Adlib (byte *data);
+ Instrument_Adlib (const byte *data);
Instrument_Adlib (Serializer *s);
void saveOrLoad (Serializer *s);
void send (MidiChannel *mc);
@@ -239,7 +239,7 @@ private:
uint8 getEquivalentGM();
public:
- Instrument_Roland (byte *data);
+ Instrument_Roland (const byte *data);
Instrument_Roland (Serializer *s);
void saveOrLoad (Serializer *s);
void send (MidiChannel *mc);
@@ -272,7 +272,7 @@ void Instrument::program (byte prog, bool mt32) {
_instrument = new Instrument_Program (prog, mt32);
}
-void Instrument::adlib (byte *instrument) {
+void Instrument::adlib (const byte *instrument) {
clear();
if (!instrument)
return;
@@ -280,7 +280,7 @@ void Instrument::adlib (byte *instrument) {
_instrument = new Instrument_Adlib (instrument);
}
-void Instrument::roland (byte *instrument) {
+void Instrument::roland (const byte *instrument) {
clear();
if (!instrument)
return;
@@ -361,7 +361,7 @@ void Instrument_Program::send (MidiChannel *mc) {
//
////////////////////////////////////////
-Instrument_Adlib::Instrument_Adlib (byte *data) {
+Instrument_Adlib::Instrument_Adlib (const byte *data) {
memcpy (&_instrument, data, sizeof (_instrument));
}
@@ -389,7 +389,7 @@ void Instrument_Adlib::send (MidiChannel *mc) {
//
////////////////////////////////////////
-Instrument_Roland::Instrument_Roland (byte *data) {
+Instrument_Roland::Instrument_Roland (const byte *data) {
memcpy (&_instrument, data, sizeof (_instrument));
memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name));
_instrument_name[10] = '\0';
diff --git a/engines/scumm/imuse/instrument.h b/engines/scumm/imuse/instrument.h
index eb1a30a1d1..49d8b00880 100644
--- a/engines/scumm/imuse/instrument.h
+++ b/engines/scumm/imuse/instrument.h
@@ -65,8 +65,8 @@ public:
void copy_to (Instrument *dest) { if (_instrument) _instrument->copy_to (dest); else dest->clear(); }
void program (byte program, bool mt32);
- void adlib (byte *instrument);
- void roland (byte *instrument);
+ void adlib (const byte *instrument);
+ void roland (const byte *instrument);
byte getType() { return _type; }
bool isValid() { return (_instrument ? _instrument->is_valid() : false); }
diff --git a/sound/mididrv.h b/sound/mididrv.h
index 99fea4309a..9a1d426b4d 100644
--- a/sound/mididrv.h
+++ b/sound/mididrv.h
@@ -185,9 +185,9 @@ public:
send(( 127 << 16) | (100 << 8) | (0xB0 | channel));
}
- virtual void sysEx(byte *msg, uint16 length) { }
- virtual void sysEx_customInstrument(byte channel, uint32 type, byte *instr) { }
- virtual void metaEvent(byte type, byte*data, uint16 length) { }
+ virtual void sysEx(const byte *msg, uint16 length) { }
+ virtual void sysEx_customInstrument(byte channel, uint32 type, const byte *instr) { }
+ virtual void metaEvent(byte type, byte *data, uint16 length) { }
// Timing functions - MidiDriver now operates timers
virtual void setTimerCallback(void *timer_param, Common::Timer::TimerProc timer_proc) = 0;
@@ -230,7 +230,7 @@ public:
virtual void allNotesOff() { controlChange (123, 0); }
// SysEx messages
- virtual void sysEx_customInstrument(uint32 type, byte *instr) = 0;
+ virtual void sysEx_customInstrument(uint32 type, const byte *instr) = 0;
};
diff --git a/sound/mpu401.cpp b/sound/mpu401.cpp
index 3b0c9c17b4..d797c96fc6 100644
--- a/sound/mpu401.cpp
+++ b/sound/mpu401.cpp
@@ -68,7 +68,7 @@ void MidiChannel_MPU401::pitchBendFactor(byte value) {
_owner->setPitchBendRange(_channel, value);
}
-void MidiChannel_MPU401::sysEx_customInstrument(uint32 type, byte *instr) {
+void MidiChannel_MPU401::sysEx_customInstrument(uint32 type, const byte *instr) {
_owner->sysEx_customInstrument(_channel, type, instr);
}
diff --git a/sound/mpu401.h b/sound/mpu401.h
index e82b49ad23..719e5653cd 100644
--- a/sound/mpu401.h
+++ b/sound/mpu401.h
@@ -59,7 +59,7 @@ public:
void pitchBendFactor (byte value);
// SysEx messages
- void sysEx_customInstrument (uint32 type, byte *instr);
+ void sysEx_customInstrument (uint32 type, const byte *instr);
// Only to be called by the owner
void init (MidiDriver *owner, byte channel);
diff --git a/sound/softsynth/adlib.cpp b/sound/softsynth/adlib.cpp
index 84cb7d3c7e..4c584eb4d6 100644
--- a/sound/softsynth/adlib.cpp
+++ b/sound/softsynth/adlib.cpp
@@ -124,7 +124,7 @@ public:
void allNotesOff();
// SysEx messages
- void sysEx_customInstrument(uint32 type, byte *instr);
+ void sysEx_customInstrument(uint32 type, const byte *instr);
};
// FYI (Jamieson630)
@@ -153,7 +153,7 @@ public:
void sustain(bool value) { }
// SysEx messages
- void sysEx_customInstrument(uint32 type, byte *instr) { }
+ void sysEx_customInstrument(uint32 type, const byte *instr) { }
};
struct Struct10 {
@@ -553,7 +553,7 @@ public:
uint32 property(int prop, uint32 param);
void setPitchBendRange(byte channel, uint range);
- void sysEx_customInstrument(byte channel, uint32 type, byte *instr);
+ void sysEx_customInstrument(byte channel, uint32 type, const byte *instr);
MidiChannel *allocateChannel();
MidiChannel *getPercussionChannel() { return &_percussion; } // Percussion partially supported
@@ -758,7 +758,7 @@ void AdlibPart::allNotesOff() {
_owner->mc_off(_voice);
}
-void AdlibPart::sysEx_customInstrument(uint32 type, byte *instr) {
+void AdlibPart::sysEx_customInstrument(uint32 type, const byte *instr) {
if (type == 'ADL ') {
AdlibInstrument *i = &_part_instr;
memcpy(i, instr, sizeof(AdlibInstrument));
@@ -945,7 +945,7 @@ void MidiDriver_ADLIB::setPitchBendRange(byte channel, uint range) {
}
}
-void MidiDriver_ADLIB::sysEx_customInstrument(byte channel, uint32 type, byte *instr) {
+void MidiDriver_ADLIB::sysEx_customInstrument(byte channel, uint32 type, const byte *instr) {
_parts[channel].sysEx_customInstrument(type, instr);
}
diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp
index 0e840b2b44..0b3b6dffe3 100644
--- a/sound/softsynth/mt32.cpp
+++ b/sound/softsynth/mt32.cpp
@@ -64,7 +64,7 @@ public:
void close();
void send(uint32 b);
void setPitchBendRange (byte channel, uint range);
- void sysEx(byte *msg, uint16 length);
+ void sysEx(const byte *msg, uint16 length);
uint32 property(int prop, uint32 param);
MidiChannel *allocateChannel();
@@ -305,7 +305,7 @@ void MidiDriver_MT32::setPitchBendRange(byte channel, uint range) {
sysEx(benderRangeSysex, 9);
}
-void MidiDriver_MT32::sysEx(byte *msg, uint16 length) {
+void MidiDriver_MT32::sysEx(const byte *msg, uint16 length) {
if (msg[0] == 0xf0) {
_synth->playSysex(msg, length);
} else {
@@ -398,7 +398,7 @@ private:
protected:
void send(uint32 b);
- void sysEx(byte *msg, uint16 length);
+ void sysEx(const byte *msg, uint16 length);
public:
MidiDriver_ThreadedMT32(Audio::Mixer *mixer);
@@ -457,7 +457,7 @@ void MidiDriver_ThreadedMT32::send(uint32 b) {
pushMidiEvent(event);
}
-void MidiDriver_ThreadedMT32::sysEx(byte *msg, uint16 length) {
+void MidiDriver_ThreadedMT32::sysEx(const byte *msg, uint16 length) {
MidiEvent_MT32 *event = new MidiEvent_MT32(0xFFFFFFFF, msg, length);
pushMidiEvent(event);
}
diff --git a/sound/softsynth/ym2612.cpp b/sound/softsynth/ym2612.cpp
index ae50e3011e..49f63abd63 100644
--- a/sound/softsynth/ym2612.cpp
+++ b/sound/softsynth/ym2612.cpp
@@ -150,7 +150,7 @@ public:
void pitchBend(int16 value);
void controlChange(byte control, byte value);
void pitchBendFactor(byte value) { }
- void sysEx_customInstrument(uint32 type, byte *instr);
+ void sysEx_customInstrument(uint32 type, const byte *instr);
};
class MidiDriver_YM2612 : public MidiDriver_Emulated {
@@ -179,7 +179,7 @@ public:
uint32 property(int prop, uint32 param) { return 0; }
void setPitchBendRange(byte channel, uint range) { }
- void sysEx(byte *msg, uint16 length);
+ void sysEx(const byte *msg, uint16 length);
MidiChannel *allocateChannel() { return 0; }
MidiChannel *getPercussionChannel() { return 0; }
@@ -675,7 +675,7 @@ void MidiChannel_YM2612::controlChange(byte control, byte value) {
}
}
-void MidiChannel_YM2612::sysEx_customInstrument(uint32 type, byte *fmInst) {
+void MidiChannel_YM2612::sysEx_customInstrument(uint32 type, const byte *fmInst) {
if (type != 'EUP ')
return;
Voice2612 *voice = new Voice2612;
@@ -798,7 +798,7 @@ void MidiDriver_YM2612::send(byte chan, uint32 b) {
}
}
-void MidiDriver_YM2612::sysEx(byte *msg, uint16 length) {
+void MidiDriver_YM2612::sysEx(const byte *msg, uint16 length) {
if (msg[0] != 0x7C || msg[1] >= ARRAYSIZE(_channel))
return;
_channel[msg[1]]->sysEx_customInstrument('EUP ', &msg[2]);