aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-11-12 02:24:25 +0000
committerTorbjörn Andersson2006-11-12 02:24:25 +0000
commitc5fca7b9ce82086772a56876212ca70650090446 (patch)
treefabc8c46e47ae365f7b8b7d5fe6679f1e8995ba7 /engines
parent84660f620bc06c79f88ceabc3000a9168513e5a1 (diff)
downloadscummvm-rg350-c5fca7b9ce82086772a56876212ca70650090446.tar.gz
scummvm-rg350-c5fca7b9ce82086772a56876212ca70650090446.tar.bz2
scummvm-rg350-c5fca7b9ce82086772a56876212ca70650090446.zip
Whitespace
svn-id: r24680
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/imuse/imuse.cpp52
-rw-r--r--engines/scumm/imuse/imuse_internal.h28
-rw-r--r--engines/scumm/imuse/imuse_player.cpp4
-rw-r--r--engines/scumm/imuse/instrument.cpp128
-rw-r--r--engines/scumm/imuse/instrument.h28
-rw-r--r--engines/scumm/imuse/sysex.h4
-rw-r--r--engines/scumm/imuse/sysex_samnmax.cpp6
-rw-r--r--engines/scumm/imuse/sysex_scumm.cpp13
8 files changed, 136 insertions, 127 deletions
diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp
index 3645144a0a..796e46902d 100644
--- a/engines/scumm/imuse/imuse.cpp
+++ b/engines/scumm/imuse/imuse.cpp
@@ -149,7 +149,7 @@ bool IMuseInternal::isMT32(int sound) {
if (ptr[8] == 'S' && ptr[9] == 'O')
return false;
- error("Unknown music type: '%c%c%c%c'", (char)tag>>24, (char)tag>>16, (char)tag>>8, (char)tag);
+ error("Unknown music type: '%c%c%c%c'", (char)tag >> 24, (char)tag >> 16, (char)tag >> 8, (char)tag);
return false;
}
@@ -191,7 +191,7 @@ bool IMuseInternal::isMIDI(int sound) {
if (ptr[8] == 'S' && ptr[9] == 'O')
return true;
- error("Unknown music type: '%c%c%c%c'", (char)tag>>24, (char)tag>>16, (char)tag>>8, (char)tag);
+ error("Unknown music type: '%c%c%c%c'", (char)tag >> 24, (char)tag >> 16, (char)tag >> 8, (char)tag);
return false;
}
@@ -387,12 +387,12 @@ int IMuseInternal::save_or_load(Serializer *ser, ScummEngine *scumm) {
bool IMuseInternal::get_sound_active(int sound) const {
Common::StackLock lock(_mutex, "IMuseInternal::get_sound_active()");
- return getSoundStatus_internal (sound, false) != 0;
+ return getSoundStatus_internal(sound, false) != 0;
}
int32 IMuseInternal::doCommand(int numargs, int a[]) {
Common::StackLock lock(_mutex, "IMuseInternal::doCommand()");
- return doCommand_internal (numargs, a);
+ return doCommand_internal(numargs, a);
}
void IMuseInternal::setBase(byte **base) {
@@ -452,7 +452,7 @@ uint32 IMuseInternal::property(int prop, uint32 value) {
return 0;
}
-void IMuseInternal::addSysexHandler (byte mfgID, sysexfunc handler) {
+void IMuseInternal::addSysexHandler(byte mfgID, sysexfunc handler) {
// TODO: Eventually support multiple sysEx handlers and pay
// attention to the client-supplied manufacturer ID.
Common::StackLock lock(_mutex, "IMuseInternal::property()");
@@ -467,7 +467,7 @@ void IMuseInternal::addSysexHandler (byte mfgID, sysexfunc handler) {
//
////////////////////////////////////////
-void IMuseInternal::setMusicVolume (int vol) {
+void IMuseInternal::setMusicVolume(int vol) {
Common::StackLock lock(_mutex, "IMuseInternal::setMusicVolume()");
if (vol > 255)
vol = 255;
@@ -484,12 +484,12 @@ void IMuseInternal::setMusicVolume (int vol) {
void IMuseInternal::startSound(int sound) {
Common::StackLock lock(_mutex, "IMuseInternal::startSound()");
- startSound_internal (sound);
+ startSound_internal(sound);
}
void IMuseInternal::stopSound(int sound) {
Common::StackLock lock(_mutex, "IMuseInternal::stopSound()");
- stopSound_internal (sound);
+ stopSound_internal(sound);
}
void IMuseInternal::stopAllSounds() {
@@ -497,7 +497,7 @@ void IMuseInternal::stopAllSounds() {
stopAllSounds_internal();
}
-int IMuseInternal::getSoundStatus (int sound) const {
+int IMuseInternal::getSoundStatus(int sound) const {
Common::StackLock lock(_mutex, "IMuseInternal::getSoundStatus()");
return getSoundStatus_internal (sound, true);
}
@@ -557,7 +557,7 @@ void IMuseInternal::terminate() {
//
////////////////////////////////////////
-bool IMuseInternal::startSound_internal (int sound) {
+bool IMuseInternal::startSound_internal(int sound) {
// Do not start a sound if it is already set to start on an ImTrigger
// event. This fixes carnival music problems where a sound has been set
// to trigger at the right time, but then is started up immediately
@@ -633,7 +633,7 @@ bool IMuseInternal::startSound_internal (int sound) {
return player->startSound(sound, driver, _direct_passthrough);
}
-int IMuseInternal::stopSound_internal (int sound) {
+int IMuseInternal::stopSound_internal(int sound) {
int r = -1;
Player *player = findActivePlayer(sound);
if (player) {
@@ -652,7 +652,7 @@ int IMuseInternal::stopAllSounds_internal() {
return 0;
}
-int IMuseInternal::getSoundStatus_internal (int sound, bool ignoreFadeouts) const {
+int IMuseInternal::getSoundStatus_internal(int sound, bool ignoreFadeouts) const {
const Player *player = _players;
for (int i = ARRAYSIZE(_players); i; i--, player++) {
if (player->isActive() && (!ignoreFadeouts || !player->isFadingOut())) {
@@ -713,9 +713,9 @@ int32 IMuseInternal::doCommand_internal (int numargs, int a[]) {
debug(0, "IMuse doCommand(7) - getMasterVolume (%d)", a[1]);
return _master_volume / 2; // Convert from 0-255 to 0-127
case 8:
- return startSound_internal (a[1]) ? 0 : -1;
+ return startSound_internal(a[1]) ? 0 : -1;
case 9:
- return stopSound_internal (a[1]);
+ return stopSound_internal(a[1]);
case 10: // FIXME: Sam and Max - Not sure if this is correct
return stopAllSounds_internal();
case 11:
@@ -968,7 +968,7 @@ void IMuseInternal::handle_marker(uint id, byte data) {
break;
_queue_end = pos;
- doCommand_internal (p[0], p[1], p[2], p[3], p[4], p[5], p[6], 0);
+ doCommand_internal(p[0], p[1], p[2], p[3], p[4], p[5], p[6], 0);
if (_queue_cleared)
return;
@@ -1231,8 +1231,8 @@ int32 IMuseInternal::ImSetTrigger(int sound, int id, int a, int b, int c, int d,
// NOTE: We ONLY do this if the sound that will trigger the command is actually
// playing. Otherwise, there's a problem when exiting and re-entering the
// Bumpusville mansion. Ref Bug #780918.
- if (trig->command[0] == 8 && getSoundStatus_internal (trig->command[1],true) && getSoundStatus_internal (sound,true))
- stopSound_internal (trig->command[1]);
+ if (trig->command[0] == 8 && getSoundStatus_internal(trig->command[1],true) && getSoundStatus_internal(sound,true))
+ stopSound_internal(trig->command[1]);
return 0;
}
@@ -1257,7 +1257,7 @@ int32 IMuseInternal::ImFireAllTriggers(int sound) {
for (i = 0; i < ARRAYSIZE(_snm_triggers); ++i) {
if (_snm_triggers[i].sound == sound) {
_snm_triggers[i].sound = _snm_triggers[i].id = 0;
- doCommand_internal (8, _snm_triggers[i].command);
+ doCommand_internal(8, _snm_triggers[i].command);
++count;
}
}
@@ -1384,12 +1384,12 @@ int IMuseInternal::initialize(OSystem *syst, MidiDriver *native_midi, MidiDriver
if (native_midi != NULL) {
_timer_info_native.imuse = this;
_timer_info_native.driver = native_midi;
- initMidiDriver (&_timer_info_native);
+ initMidiDriver(&_timer_info_native);
}
if (adlib_midi != NULL) {
_timer_info_adlib.imuse = this;
_timer_info_adlib.driver = adlib_midi;
- initMidiDriver (&_timer_info_adlib);
+ initMidiDriver(&_timer_info_adlib);
}
if (!_tempoFactor)
@@ -1408,14 +1408,14 @@ int IMuseInternal::initialize(OSystem *syst, MidiDriver *native_midi, MidiDriver
return 0;
}
-void IMuseInternal::initMidiDriver (TimerCallbackInfo *info) {
+void IMuseInternal::initMidiDriver(TimerCallbackInfo *info) {
// Open MIDI driver
int result = info->driver->open();
if (result)
error("IMuse initialization - %s", MidiDriver::getErrorName(result));
// Connect to the driver's timer
- info->driver->setTimerCallback (info, &IMuseInternal::midiTimerCallback);
+ info->driver->setTimerCallback(info, &IMuseInternal::midiTimerCallback);
}
void IMuseInternal::initMT32(MidiDriver *midi) {
@@ -1612,7 +1612,7 @@ void IMuseInternal::handleDeferredCommands(MidiDriver *midi) {
if (!ptr->time_left)
continue;
if (ptr->time_left <= advance) {
- doCommand_internal (ptr->a, ptr->b, ptr->c, ptr->d, ptr->e, ptr->f, 0, 0);
+ doCommand_internal(ptr->a, ptr->b, ptr->c, ptr->d, ptr->e, ptr->f, 0, 0);
ptr->time_left = advance;
}
ptr->time_left -= advance;
@@ -1671,9 +1671,9 @@ void IMuseInternal::fix_players_after_load(ScummEngine *scumm) {
//
////////////////////////////////////////
-void IMuseInternal::midiTimerCallback (void *data) {
- TimerCallbackInfo *info = (TimerCallbackInfo *) data;
- info->imuse->on_timer (info->driver);
+void IMuseInternal::midiTimerCallback(void *data) {
+ TimerCallbackInfo *info = (TimerCallbackInfo *)data;
+ info->imuse->on_timer(info->driver);
}
void IMuseInternal::reallocateMidiChannels(MidiDriver *midi) {
diff --git a/engines/scumm/imuse/imuse_internal.h b/engines/scumm/imuse/imuse_internal.h
index e19e72cd23..40035fb053 100644
--- a/engines/scumm/imuse/imuse_internal.h
+++ b/engines/scumm/imuse/imuse_internal.h
@@ -161,7 +161,7 @@ class Player : public MidiDriver {
* #define SYSEX_CALLBACK_FUNCTION nameOfHandlerFunction
*/
#ifdef SYSEX_CALLBACK_FUNCTION
- friend void SYSEX_CALLBACK_FUNCTION (Player *, const byte *, uint16);
+ friend void SYSEX_CALLBACK_FUNCTION(Player *, const byte *, uint16);
#endif
protected:
@@ -240,7 +240,7 @@ public:
Player();
virtual ~Player();
- int addParameterFader(int param, int target, int time);
+ int addParameterFader(int param, int target, int time);
void clear();
void clearLoop();
void fixAfterLoad();
@@ -384,7 +384,7 @@ class IMuseInternal : public IMuse {
* #define SYSEX_CALLBACK_FUNCTION nameOfHandlerFunction
*/
#ifdef SYSEX_CALLBACK_FUNCTION
- friend void SYSEX_CALLBACK_FUNCTION (Player *, const byte *, uint16);
+ friend void SYSEX_CALLBACK_FUNCTION(Player *, const byte *, uint16);
#endif
protected:
@@ -445,8 +445,8 @@ protected:
IMuseInternal();
int initialize(OSystem *syst, MidiDriver *nativeMidiDriver, MidiDriver *adlibMidiDriver);
- static void midiTimerCallback (void *data);
- void on_timer (MidiDriver *midi);
+ static void midiTimerCallback(void *data);
+ void on_timer(MidiDriver *midi);
byte *findStartOfSound(int sound);
bool isMT32(int sound);
@@ -454,7 +454,7 @@ protected:
int get_queue_sound_status(int sound) const;
void handle_marker(uint id, byte data);
int get_channel_volume(uint a);
- void initMidiDriver (TimerCallbackInfo *info);
+ void initMidiDriver(TimerCallbackInfo *info);
void initGM(MidiDriver *midi);
void initMT32(MidiDriver *midi);
void init_players();
@@ -499,22 +499,22 @@ protected:
protected:
// Internal mutex-free versions of the IMuse and MusicEngine methods.
- bool startSound_internal (int sound);
- int stopSound_internal (int sound);
+ bool startSound_internal(int sound);
+ int stopSound_internal(int sound);
int stopAllSounds_internal();
- int getSoundStatus_internal (int sound, bool ignoreFadeouts) const;
- int32 doCommand_internal (int a, int b, int c, int d, int e, int f, int g, int h);
- int32 doCommand_internal (int numargs, int args[]);
+ int getSoundStatus_internal(int sound, bool ignoreFadeouts) const;
+ int32 doCommand_internal(int a, int b, int c, int d, int e, int f, int g, int h);
+ int32 doCommand_internal(int numargs, int args[]);
public:
// IMuse interface
void pause(bool paused);
int save_or_load(Serializer *ser, ScummEngine *scumm);
bool get_sound_active(int sound) const;
- int32 doCommand (int numargs, int args[]);
+ int32 doCommand(int numargs, int args[]);
void setBase(byte **base);
uint32 property(int prop, uint32 value);
- virtual void addSysexHandler (byte mfgID, sysexfunc handler);
+ virtual void addSysexHandler(byte mfgID, sysexfunc handler);
public:
// MusicEngine interface
@@ -522,7 +522,7 @@ public:
void startSound(int sound);
void stopSound(int sound);
void stopAllSounds();
- int getSoundStatus (int sound) const;
+ int getSoundStatus(int sound) const;
int getMusicTimer() const;
void terminate();
diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp
index c8a7e7365f..e5066ed216 100644
--- a/engines/scumm/imuse/imuse_player.cpp
+++ b/engines/scumm/imuse/imuse_player.cpp
@@ -402,7 +402,7 @@ void Player::sysEx(const byte *p, uint16 len) {
void Player::decode_sysex_bytes(const byte *src, byte *dst, int len) {
while (len >= 0) {
- *dst++ = ((src[0] << 4)&0xFF) | (src[1] & 0xF);
+ *dst++ = ((src[0] << 4) & 0xFF) | (src[1] & 0xF);
src += 2;
len -= 2;
}
@@ -885,7 +885,7 @@ int Player::addParameterFader(int param, int target, int time) {
break;
default:
- debug(0, "Player::addParameterFader (%d, %d, %d): Unknown parameter", param, target, time);
+ debug(0, "Player::addParameterFader(%d, %d, %d): Unknown parameter", param, target, time);
return 0; // Should be -1, but we'll let the script think it worked.
}
diff --git a/engines/scumm/imuse/instrument.cpp b/engines/scumm/imuse/instrument.cpp
index 4af3ef096b..90d734f00d 100644
--- a/engines/scumm/imuse/instrument.cpp
+++ b/engines/scumm/imuse/instrument.cpp
@@ -35,7 +35,7 @@ static struct {
byte program;
}
-roland_to_gm_map [] = {
+roland_to_gm_map[] = {
// Monkey Island 2 instruments
// TODO: Complete
{ "badspit ", 62 },
@@ -130,11 +130,11 @@ private:
bool _mt32;
public:
- Instrument_Program (byte program, bool mt32);
- Instrument_Program (Serializer *s);
- void saveOrLoad (Serializer *s);
- void send (MidiChannel *mc);
- void copy_to (Instrument *dest) { dest->program (_program, _mt32); }
+ Instrument_Program(byte program, bool mt32);
+ Instrument_Program(Serializer *s);
+ void saveOrLoad(Serializer *s);
+ void send(MidiChannel *mc);
+ void copy_to(Instrument *dest) { dest->program(_program, _mt32); }
bool is_valid() {
return (_program < 128) &&
((_native_mt32 == _mt32) || _native_mt32
@@ -164,11 +164,11 @@ private:
} _instrument;
public:
- Instrument_Adlib (const byte *data);
- Instrument_Adlib (Serializer *s);
- void saveOrLoad (Serializer *s);
- void send (MidiChannel *mc);
- void copy_to (Instrument *dest) { dest->adlib ((byte *) &_instrument); }
+ Instrument_Adlib(const byte *data);
+ Instrument_Adlib(Serializer *s);
+ void saveOrLoad(Serializer *s);
+ void send(MidiChannel *mc);
+ void copy_to(Instrument *dest) { dest->adlib((byte *)&_instrument); }
bool is_valid() { return true; }
};
@@ -239,11 +239,11 @@ private:
uint8 getEquivalentGM();
public:
- Instrument_Roland (const byte *data);
- Instrument_Roland (Serializer *s);
- void saveOrLoad (Serializer *s);
- void send (MidiChannel *mc);
- void copy_to (Instrument *dest) { dest->roland ((byte *) &_instrument); }
+ Instrument_Roland(const byte *data);
+ Instrument_Roland(Serializer *s);
+ void saveOrLoad(Serializer *s);
+ void send(MidiChannel *mc);
+ void copy_to(Instrument *dest) { dest->roland((byte *)&_instrument); }
bool is_valid() { return (_native_mt32 ? true : (_instrument_name[0] != '\0')); }
};
@@ -253,7 +253,7 @@ public:
//
////////////////////////////////////////
-void Instrument::nativeMT32 (bool native) {
+void Instrument::nativeMT32(bool native) {
_native_mt32 = native;
}
@@ -264,35 +264,35 @@ void Instrument::clear() {
_type = itNone;
}
-void Instrument::program (byte prog, bool mt32) {
+void Instrument::program(byte prog, bool mt32) {
clear();
if (prog > 127)
return;
_type = itProgram;
- _instrument = new Instrument_Program (prog, mt32);
+ _instrument = new Instrument_Program(prog, mt32);
}
-void Instrument::adlib (const byte *instrument) {
+void Instrument::adlib(const byte *instrument) {
clear();
if (!instrument)
return;
_type = itAdlib;
- _instrument = new Instrument_Adlib (instrument);
+ _instrument = new Instrument_Adlib(instrument);
}
-void Instrument::roland (const byte *instrument) {
+void Instrument::roland(const byte *instrument) {
clear();
if (!instrument)
return;
_type = itRoland;
- _instrument = new Instrument_Roland (instrument);
+ _instrument = new Instrument_Roland(instrument);
}
void Instrument::saveOrLoad (Serializer *s) {
if (s->isSaving()) {
- s->saveByte (_type);
+ s->saveByte(_type);
if (_instrument)
- _instrument->saveOrLoad (s);
+ _instrument->saveOrLoad(s);
} else {
clear();
_type = s->loadByte();
@@ -300,16 +300,16 @@ void Instrument::saveOrLoad (Serializer *s) {
case itNone:
break;
case itProgram:
- _instrument = new Instrument_Program (s);
+ _instrument = new Instrument_Program(s);
break;
case itAdlib:
- _instrument = new Instrument_Adlib (s);
+ _instrument = new Instrument_Adlib(s);
break;
case itRoland:
- _instrument = new Instrument_Roland (s);
+ _instrument = new Instrument_Roland(s);
break;
default:
- warning ("No known instrument classification #%d", (int) _type);
+ warning("No known instrument classification #%d", (int)_type);
_type = itNone;
}
}
@@ -321,38 +321,38 @@ void Instrument::saveOrLoad (Serializer *s) {
//
////////////////////////////////////////
-Instrument_Program::Instrument_Program (byte program, bool mt32) :
+Instrument_Program::Instrument_Program(byte program, bool mt32) :
_program (program),
_mt32 (mt32) {
if (program > 127)
_program = 255;
}
-Instrument_Program::Instrument_Program (Serializer *s) {
+Instrument_Program::Instrument_Program(Serializer *s) {
_program = 255;
if (!s->isSaving())
- saveOrLoad (s);
+ saveOrLoad(s);
}
-void Instrument_Program::saveOrLoad (Serializer *s) {
+void Instrument_Program::saveOrLoad(Serializer *s) {
if (s->isSaving()) {
- s->saveByte (_program);
- s->saveByte (_mt32 ? 1 : 0);
+ s->saveByte(_program);
+ s->saveByte(_mt32 ? 1 : 0);
} else {
_program = s->loadByte();
_mt32 = (s->loadByte() > 0);
}
}
-void Instrument_Program::send (MidiChannel *mc) {
+void Instrument_Program::send(MidiChannel *mc) {
if (_program > 127)
return;
byte program = _program;
if (_native_mt32 != _mt32)
- program = _native_mt32 ? MidiDriver::_gmToMt32 [program] : MidiDriver::_mt32ToGm [program];
+ program = _native_mt32 ? MidiDriver::_gmToMt32[program] : MidiDriver::_mt32ToGm[program];
if (program < 128)
- mc->programChange (program);
+ mc->programChange(program);
}
////////////////////////////////////////
@@ -361,26 +361,26 @@ void Instrument_Program::send (MidiChannel *mc) {
//
////////////////////////////////////////
-Instrument_Adlib::Instrument_Adlib (const byte *data) {
- memcpy (&_instrument, data, sizeof (_instrument));
+Instrument_Adlib::Instrument_Adlib(const byte *data) {
+ memcpy(&_instrument, data, sizeof(_instrument));
}
-Instrument_Adlib::Instrument_Adlib (Serializer *s) {
+Instrument_Adlib::Instrument_Adlib(Serializer *s) {
if (!s->isSaving())
- saveOrLoad (s);
+ saveOrLoad(s);
else
- memset (&_instrument, 0, sizeof (_instrument));
+ memset(&_instrument, 0, sizeof(_instrument));
}
-void Instrument_Adlib::saveOrLoad (Serializer *s) {
+void Instrument_Adlib::saveOrLoad(Serializer *s) {
if (s->isSaving())
- s->saveBytes (&_instrument, sizeof (_instrument));
+ s->saveBytes(&_instrument, sizeof(_instrument));
else
- s->loadBytes (&_instrument, sizeof (_instrument));
+ s->loadBytes(&_instrument, sizeof(_instrument));
}
-void Instrument_Adlib::send (MidiChannel *mc) {
- mc->sysEx_customInstrument ('ADL ', (byte *) &_instrument);
+void Instrument_Adlib::send(MidiChannel *mc) {
+ mc->sysEx_customInstrument('ADL ', (byte *)&_instrument);
}
////////////////////////////////////////
@@ -389,39 +389,39 @@ void Instrument_Adlib::send (MidiChannel *mc) {
//
////////////////////////////////////////
-Instrument_Roland::Instrument_Roland (const byte *data) {
- memcpy (&_instrument, data, sizeof (_instrument));
- memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name));
+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';
if (!_native_mt32 && getEquivalentGM() >= 128) {
- debug (0, "MT-32 instrument \"%s\" not supported yet", _instrument_name);
+ debug(0, "MT-32 instrument \"%s\" not supported yet", _instrument_name);
_instrument_name[0] = '\0';
}
}
-Instrument_Roland::Instrument_Roland (Serializer *s) {
+Instrument_Roland::Instrument_Roland(Serializer *s) {
_instrument_name[0] = '\0';
if (!s->isSaving())
saveOrLoad (s);
else
- memset (&_instrument, 0, sizeof (_instrument));
+ memset(&_instrument, 0, sizeof(_instrument));
}
void Instrument_Roland::saveOrLoad (Serializer *s) {
if (s->isSaving()) {
- s->saveBytes (&_instrument, sizeof (_instrument));
+ s->saveBytes (&_instrument, sizeof(_instrument));
} else {
- s->loadBytes (&_instrument, sizeof (_instrument));
- memcpy (&_instrument_name, &_instrument.common.name, sizeof (_instrument.common.name));
+ s->loadBytes (&_instrument, sizeof(_instrument));
+ memcpy(&_instrument_name, &_instrument.common.name, sizeof(_instrument.common.name));
_instrument_name[10] = '\0';
if (!_native_mt32 && getEquivalentGM() >= 128) {
- debug (2, "MT-32 custom instrument \"%s\" not supported", _instrument_name);
+ debug(2, "MT-32 custom instrument \"%s\" not supported", _instrument_name);
_instrument_name[0] = '\0';
}
} // end if
}
-void Instrument_Roland::send (MidiChannel *mc) {
+void Instrument_Roland::send(MidiChannel *mc) {
if (_native_mt32) {
if (mc->getNumber() > 8)
return;
@@ -435,25 +435,25 @@ void Instrument_Roland::send (MidiChannel *mc) {
// Recompute the checksum.
byte checksum = 0;
- byte *ptr = (byte *) &_instrument + 4;
+ byte *ptr = (byte *)&_instrument + 4;
int i;
- for (i = 4; i < (int)sizeof (_instrument) - 1; ++i)
+ for (i = 4; i < (int)sizeof(_instrument) - 1; ++i)
checksum -= *ptr++;
_instrument.checksum = checksum & 0x7F;
- mc->device()->sysEx ((byte *) &_instrument, sizeof (_instrument));
+ mc->device()->sysEx((byte *)&_instrument, sizeof(_instrument));
} else {
// Convert to a GM program change.
byte program = getEquivalentGM();
if (program < 128)
- mc->programChange (program);
+ mc->programChange(program);
}
}
uint8 Instrument_Roland::getEquivalentGM() {
byte i;
for (i = 0; i != ARRAYSIZE(roland_to_gm_map); ++i) {
- if (!memcmp (roland_to_gm_map[i].name, _instrument.common.name, 10))
+ if (!memcmp(roland_to_gm_map[i].name, _instrument.common.name, 10))
return roland_to_gm_map[i].program;
}
return 255;
diff --git a/engines/scumm/imuse/instrument.h b/engines/scumm/imuse/instrument.h
index 49d8b00880..960c887534 100644
--- a/engines/scumm/imuse/instrument.h
+++ b/engines/scumm/imuse/instrument.h
@@ -36,9 +36,9 @@ class Instrument;
class InstrumentInternal {
public:
virtual ~InstrumentInternal() {}
- virtual void saveOrLoad (Serializer *s) = 0;
- virtual void send (MidiChannel *mc) = 0;
- virtual void copy_to (Instrument *dest) = 0;
+ virtual void saveOrLoad(Serializer *s) = 0;
+ virtual void send(MidiChannel *mc) = 0;
+ virtual void copy_to(Instrument *dest) = 0;
virtual bool is_valid() = 0;
virtual operator int() { return 255; }
};
@@ -58,20 +58,28 @@ public:
Instrument() : _type (0), _instrument (0) { }
~Instrument() { delete _instrument; }
- static void nativeMT32 (bool native);
+ static void nativeMT32(bool native);
static const byte _gmRhythmMap[35];
void clear();
- void copy_to (Instrument *dest) { if (_instrument) _instrument->copy_to (dest); else dest->clear(); }
+ void copy_to(Instrument *dest) {
+ if (_instrument)
+ _instrument->copy_to(dest);
+ else
+ dest->clear();
+ }
- void program (byte program, bool mt32);
- void adlib (const byte *instrument);
- void roland (const byte *instrument);
+ void program(byte program, bool mt32);
+ void adlib(const byte *instrument);
+ void roland(const byte *instrument);
byte getType() { return _type; }
bool isValid() { return (_instrument ? _instrument->is_valid() : false); }
- void saveOrLoad (Serializer *s);
- void send (MidiChannel *mc) { if (_instrument) _instrument->send (mc); }
+ void saveOrLoad(Serializer *s);
+ void send(MidiChannel *mc) {
+ if (_instrument)
+ _instrument->send(mc);
+ }
};
} // End of namespace Scumm
diff --git a/engines/scumm/imuse/sysex.h b/engines/scumm/imuse/sysex.h
index 7e33295b62..ba16282a2c 100644
--- a/engines/scumm/imuse/sysex.h
+++ b/engines/scumm/imuse/sysex.h
@@ -30,8 +30,8 @@ namespace Scumm {
class Player;
-extern void sysexHandler_Scumm (Player *, const byte *, uint16);
-extern void sysexHandler_SamNMax (Player *, const byte *, uint16);
+extern void sysexHandler_Scumm(Player *, const byte *, uint16);
+extern void sysexHandler_SamNMax(Player *, const byte *, uint16);
} // End of namespace Scumm
diff --git a/engines/scumm/imuse/sysex_samnmax.cpp b/engines/scumm/imuse/sysex_samnmax.cpp
index 9cf1ec32a4..02295e7b84 100644
--- a/engines/scumm/imuse/sysex_samnmax.cpp
+++ b/engines/scumm/imuse/sysex_samnmax.cpp
@@ -37,9 +37,9 @@
namespace Scumm {
-extern void sysexHandler_Scumm (Player *, const byte *, uint16);
+extern void sysexHandler_Scumm(Player *, const byte *, uint16);
-void sysexHandler_SamNMax (Player *player, const byte *msg, uint16 len) {
+void sysexHandler_SamNMax(Player *player, const byte *msg, uint16 len) {
byte a;
IMuseInternal *se = player->_se;
@@ -71,7 +71,7 @@ void sysexHandler_SamNMax (Player *player, const byte *msg, uint16 len) {
break;
default:
- sysexHandler_Scumm (player, msg, len);
+ sysexHandler_Scumm(player, msg, len);
}
}
diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp
index 902b834e2c..7d1aca6d4e 100644
--- a/engines/scumm/imuse/sysex_scumm.cpp
+++ b/engines/scumm/imuse/sysex_scumm.cpp
@@ -37,7 +37,7 @@
namespace Scumm {
-void sysexHandler_Scumm (Player *player, const byte *msg, uint16 len) {
+void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) {
Part *part;
byte a;
byte buf[128];
@@ -67,12 +67,12 @@ void sysexHandler_Scumm (Player *player, const byte *msg, uint16 len) {
part = player->getPart(p[0] & 0x0F);
if (part) {
part->set_onoff(p[2] & 0x01);
- part->effectLevel ((p[2] & 0x02) ? 127 : 0);
+ part->effectLevel((p[2] & 0x02) ? 127 : 0);
part->set_pri(p[4]);
part->volume((p[5] & 0x0F) << 4 |(p[6] & 0x0F));
part->set_pan((p[7] & 0x0F) << 4 | (p[8] & 0x0F));
part->_percussion = player->_isMIDI ? ((p[9] & 0x08) > 0) : false;
- part->pitchBendFactor ((p[13] & 0x0F) << 4 | (p[14] & 0x0F));
+ part->pitchBendFactor((p[13] & 0x0F) << 4 | (p[14] & 0x0F));
if (part->_percussion) {
if (part->_mc) {
part->off();
@@ -93,8 +93,9 @@ void sysexHandler_Scumm (Player *player, const byte *msg, uint16 len) {
case 1:
// Shut down a part. [Bug 1088045, comments]
- part = player->getPart (p[0]);
- if (part != NULL) part->uninit();
+ part = player->getPart(p[0]);
+ if (part != NULL)
+ part->uninit();
break;
case 2: // Start of song. Ignore for now.
@@ -189,7 +190,7 @@ void sysexHandler_Scumm (Player *player, const byte *msg, uint16 len) {
case 96: // Set instrument
part = player->getPart(p[0] & 0x0F);
- a = (p[1] & 0x0F) << 12 |(p[2] & 0x0F) << 8 |(p[3] & 0x0F) << 4 |(p[4] & 0x0F);
+ a = (p[1] & 0x0F) << 12 | (p[2] & 0x0F) << 8 | (p[3] & 0x0F) << 4 | (p[4] & 0x0F);
if (part)
part->set_instrument(a);
break;