[Scummvm-cvs-logs] SF.net SVN: scummvm: [20952] scummvm/trunk/sound
Jamieson630 at users.sourceforge.net
Jamieson630 at users.sourceforge.net
Sun Feb 26 18:00:04 CET 2006
Revision: 20952
Author: Jamieson630
Date: 2006-02-26 17:59:07 -0800 (Sun, 26 Feb 2006)
ViewCVS: http://svn.sourceforge.net/scummvm?rev=20952&view=rev
Log Message:
-----------
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.
Modified Paths:
--------------
scummvm/trunk/backends/midi/alsa.cpp
scummvm/trunk/backends/midi/coreaudio.cpp
scummvm/trunk/backends/midi/coremidi.cpp
scummvm/trunk/backends/midi/seq.cpp
scummvm/trunk/backends/midi/windows.cpp
scummvm/trunk/backends/midi/zodiac.cpp
scummvm/trunk/engines/scumm/imuse/imuse_internal.h
scummvm/trunk/engines/scumm/imuse/imuse_player.cpp
scummvm/trunk/engines/scumm/imuse/instrument.cpp
scummvm/trunk/engines/scumm/imuse/instrument.h
scummvm/trunk/sound/mididrv.h
scummvm/trunk/sound/mpu401.cpp
scummvm/trunk/sound/mpu401.h
scummvm/trunk/sound/softsynth/adlib.cpp
scummvm/trunk/sound/softsynth/mt32.cpp
scummvm/trunk/sound/softsynth/ym2612.cpp
Modified: scummvm/trunk/backends/midi/alsa.cpp
===================================================================
--- scummvm/trunk/backends/midi/alsa.cpp 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/backends/midi/alsa.cpp 2006-02-27 01:59:07 UTC (rev 20952)
@@ -61,7 +61,7 @@
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::sysEx(byte *msg, uint16 length) {
+void MidiDriver_ALSA::sysEx(const byte *msg, uint16 length) {
unsigned char buf[1024];
if (length > 254) {
Modified: scummvm/trunk/backends/midi/coreaudio.cpp
===================================================================
--- scummvm/trunk/backends/midi/coreaudio.cpp 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/backends/midi/coreaudio.cpp 2006-02-27 01:59:07 UTC (rev 20952)
@@ -56,7 +56,7 @@
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 @@
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
Modified: scummvm/trunk/backends/midi/coremidi.cpp
===================================================================
--- scummvm/trunk/backends/midi/coremidi.cpp 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/backends/midi/coremidi.cpp 2006-02-27 01:59:07 UTC (rev 20952)
@@ -50,7 +50,7 @@
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 @@
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);
Modified: scummvm/trunk/backends/midi/seq.cpp
===================================================================
--- scummvm/trunk/backends/midi/seq.cpp 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/backends/midi/seq.cpp 2006-02-27 01:59:07 UTC (rev 20952)
@@ -46,7 +46,7 @@
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 @@
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;
Modified: scummvm/trunk/backends/midi/windows.cpp
===================================================================
--- scummvm/trunk/backends/midi/windows.cpp 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/backends/midi/windows.cpp 2006-02-27 01:59:07 UTC (rev 20952)
@@ -46,7 +46,7 @@
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 @@
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;
Modified: scummvm/trunk/backends/midi/zodiac.cpp
===================================================================
--- scummvm/trunk/backends/midi/zodiac.cpp 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/backends/midi/zodiac.cpp 2006-02-27 01:59:07 UTC (rev 20952)
@@ -35,7 +35,7 @@
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::sysEx(byte *msg, uint16 length) {
+void MidiDriver_Zodiac::sysEx(const byte *msg, uint16 length) {
TwMidiSysEx(_midiHandle, 0, msg, length);
}
Modified: scummvm/trunk/engines/scumm/imuse/imuse_internal.h
===================================================================
--- scummvm/trunk/engines/scumm/imuse/imuse_internal.h 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/engines/scumm/imuse/imuse_internal.h 2006-02-27 01:59:07 UTC (rev 20952)
@@ -265,7 +265,7 @@
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();
Modified: scummvm/trunk/engines/scumm/imuse/imuse_player.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse/imuse_player.cpp 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/engines/scumm/imuse/imuse_player.cpp 2006-02-27 01:59:07 UTC (rev 20952)
@@ -343,7 +343,7 @@
return;
}
-void Player::sysEx(byte *p, uint16 len) {
+void Player::sysEx(const byte *p, uint16 len) {
byte code;
byte a;
uint b;
Modified: scummvm/trunk/engines/scumm/imuse/instrument.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse/instrument.cpp 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/engines/scumm/imuse/instrument.cpp 2006-02-27 01:59:07 UTC (rev 20952)
@@ -164,7 +164,7 @@
} _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 @@
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 @@
_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 @@
_instrument = new Instrument_Adlib (instrument);
}
-void Instrument::roland (byte *instrument) {
+void Instrument::roland (const byte *instrument) {
clear();
if (!instrument)
return;
@@ -361,7 +361,7 @@
//
////////////////////////////////////////
-Instrument_Adlib::Instrument_Adlib (byte *data) {
+Instrument_Adlib::Instrument_Adlib (const byte *data) {
memcpy (&_instrument, data, sizeof (_instrument));
}
@@ -389,7 +389,7 @@
//
////////////////////////////////////////
-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';
Modified: scummvm/trunk/engines/scumm/imuse/instrument.h
===================================================================
--- scummvm/trunk/engines/scumm/imuse/instrument.h 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/engines/scumm/imuse/instrument.h 2006-02-27 01:59:07 UTC (rev 20952)
@@ -65,8 +65,8 @@
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); }
Modified: scummvm/trunk/sound/mididrv.h
===================================================================
--- scummvm/trunk/sound/mididrv.h 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/sound/mididrv.h 2006-02-27 01:59:07 UTC (rev 20952)
@@ -185,9 +185,9 @@
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 @@
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;
};
Modified: scummvm/trunk/sound/mpu401.cpp
===================================================================
--- scummvm/trunk/sound/mpu401.cpp 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/sound/mpu401.cpp 2006-02-27 01:59:07 UTC (rev 20952)
@@ -68,7 +68,7 @@
_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);
}
Modified: scummvm/trunk/sound/mpu401.h
===================================================================
--- scummvm/trunk/sound/mpu401.h 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/sound/mpu401.h 2006-02-27 01:59:07 UTC (rev 20952)
@@ -59,7 +59,7 @@
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);
Modified: scummvm/trunk/sound/softsynth/adlib.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/adlib.cpp 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/sound/softsynth/adlib.cpp 2006-02-27 01:59:07 UTC (rev 20952)
@@ -124,7 +124,7 @@
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 @@
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 @@
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 @@
_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::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);
}
Modified: scummvm/trunk/sound/softsynth/mt32.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/mt32.cpp 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/sound/softsynth/mt32.cpp 2006-02-27 01:59:07 UTC (rev 20952)
@@ -64,7 +64,7 @@
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 @@
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 @@
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 @@
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);
}
Modified: scummvm/trunk/sound/softsynth/ym2612.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/ym2612.cpp 2006-02-27 00:01:29 UTC (rev 20951)
+++ scummvm/trunk/sound/softsynth/ym2612.cpp 2006-02-27 01:59:07 UTC (rev 20952)
@@ -150,7 +150,7 @@
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 @@
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::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::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]);
More information about the Scummvm-git-logs
mailing list