diff options
author | Martin Kiewitz | 2015-06-21 03:23:01 +0200 |
---|---|---|
committer | Martin Kiewitz | 2015-06-21 03:23:01 +0200 |
commit | 3f9c44c743c9d8dd703677d3c4ca006618ba33ed (patch) | |
tree | 0c171253cc5a91db4a79ddd70d19fa55f53aab97 | |
parent | c7276d118ff7afb37d6f3e2aeeee21c5cc7caca1 (diff) | |
download | scummvm-rg350-3f9c44c743c9d8dd703677d3c4ca006618ba33ed.tar.gz scummvm-rg350-3f9c44c743c9d8dd703677d3c4ca006618ba33ed.tar.bz2 scummvm-rg350-3f9c44c743c9d8dd703677d3c4ca006618ba33ed.zip |
AGOS: Accolade AdLib/MT32 driver naming cleanup
-rw-r--r-- | engines/agos/drivers/accolade/adlib.cpp | 121 | ||||
-rw-r--r-- | engines/agos/drivers/accolade/mididriver.h | 6 | ||||
-rw-r--r-- | engines/agos/drivers/accolade/mt32.cpp | 38 | ||||
-rw-r--r-- | engines/agos/midi.cpp | 48 | ||||
-rw-r--r-- | engines/agos/midi.h | 2 |
5 files changed, 102 insertions, 113 deletions
diff --git a/engines/agos/drivers/accolade/adlib.cpp b/engines/agos/drivers/accolade/adlib.cpp index c2f6934248..36a5f3e54e 100644 --- a/engines/agos/drivers/accolade/adlib.cpp +++ b/engines/agos/drivers/accolade/adlib.cpp @@ -43,11 +43,11 @@ namespace AGOS { // used by the MUSIC.DRV variant for percussion instruments #define AGOS_ADLIB_EXTRA_INSTRUMENT_COUNT 5 -const byte adlib_Operator1Register[AGOS_ADLIB_VOICES_COUNT] = { +const byte operator1Register[AGOS_ADLIB_VOICES_COUNT] = { 0x00, 0x01, 0x02, 0x08, 0x09, 0x0A, 0x10, 0x14, 0x12, 0x15, 0x11 }; -const byte adlib_Operator2Register[AGOS_ADLIB_VOICES_COUNT] = { +const byte operator2Register[AGOS_ADLIB_VOICES_COUNT] = { 0x03, 0x04, 0x05, 0x0B, 0x0C, 0x0D, 0x13, 0xFF, 0xFF, 0xFF, 0xFF }; @@ -57,20 +57,20 @@ const byte adlib_Operator2Register[AGOS_ADLIB_VOICES_COUNT] = { // voice 8 - tom tom // voice 9 - cymbal // voice 10 - hi hat -const byte adlib_percussionBits[AGOS_ADLIB_VOICES_PERCUSSION_COUNT] = { +const byte percussionBits[AGOS_ADLIB_VOICES_PERCUSSION_COUNT] = { 0x10, 0x08, 0x04, 0x02, 0x01 }; // hardcoded, dumped from Accolade music system // same for INSTR.DAT + MUSIC.DRV, except that MUSIC.DRV does the lookup differently -const byte adlib_percussionKeyNoteChannelTable[] = { +const byte percussionKeyNoteChannelTable[] = { 0x06, 0x07, 0x07, 0x07, 0x07, 0x08, 0x0A, 0x08, 0x0A, 0x08, 0x0A, 0x08, 0x08, 0x09, 0x08, 0x09, 0x0F, 0x0F, 0x0A, 0x0F, 0x0A, 0x0F, 0x0F, 0x0F, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0A, 0x0F, 0x0F, 0x08, 0x0F, 0x08 }; -struct adlib_InstrumentEntry { +struct InstrumentEntry { byte reg20op1; // Amplitude Modulation / Vibrato / Envelope Generator Type / Keyboard Scaling Rate / Modulator Frequency Multiple byte reg40op1; // Level Key Scaling / Total Level byte reg60op1; // Attack Rate / Decay Rate @@ -83,13 +83,13 @@ struct adlib_InstrumentEntry { }; // hardcoded, dumped from Accolade music system (INSTR.DAT variant) -const uint16 adlib_FrequencyLookUpTable[12] = { +const uint16 frequencyLookUpTable[12] = { 0x02B2, 0x02DB, 0x0306, 0x0334, 0x0365, 0x0399, 0x03CF, 0xFE05, 0xFE23, 0xFE44, 0xFE67, 0xFE8B }; // hardcoded, dumped from Accolade music system (MUSIC.DRV variant) -const uint16 adlib_FrequencyLookUpTableMusicDrv[12] = { +const uint16 frequencyLookUpTableMusicDrv[12] = { 0x0205, 0x0223, 0x0244, 0x0267, 0x028B, 0x02B2, 0x02DB, 0x0306, 0x0334, 0x0365, 0x0399, 0x03CF }; @@ -142,27 +142,27 @@ private: bool _musicDrvMode; // from INSTR.DAT/MUSIC.DRV - simple mapping between MIDI channel and MT32 channel - byte _MIDIchannelMapping[AGOS_MIDI_CHANNEL_COUNT]; + byte _channelMapping[AGOS_MIDI_CHANNEL_COUNT]; // from INSTR.DAT/MUSIC.DRV - simple mapping between MIDI instruments and MT32 instruments - byte _MIDIinstrumentMapping[AGOS_MIDI_INSTRUMENT_COUNT]; + byte _instrumentMapping[AGOS_MIDI_INSTRUMENT_COUNT]; // from INSTR.DAT/MUSIC.DRV - volume adjustment per instrument - signed char _MIDIinstrumentVolumeAdjust[AGOS_MIDI_INSTRUMENT_COUNT]; + signed char _instrumentVolumeAdjust[AGOS_MIDI_INSTRUMENT_COUNT]; // simple mapping between MIDI key notes and MT32 key notes - byte _MIDIpercussionKeyNoteMapping[AGOS_MIDI_KEYNOTE_COUNT]; + byte _percussionKeyNoteMapping[AGOS_MIDI_KEYNOTE_COUNT]; // from INSTR.DAT/MUSIC.DRV - adlib instrument data - adlib_InstrumentEntry *_instrumentTable; - byte _instrumentCount; + InstrumentEntry *_instrumentTable; + byte _instrumentCount; - struct adlib_ChannelEntry { - const adlib_InstrumentEntry *currentInstrumentPtr; + struct ChannelEntry { + const InstrumentEntry *currentInstrumentPtr; byte currentNote; byte currentA0hReg; byte currentB0hReg; int16 volumeAdjust; - adlib_ChannelEntry() : currentInstrumentPtr(NULL), currentNote(0), - currentA0hReg(0), currentB0hReg(0), volumeAdjust(0) { } + ChannelEntry() : currentInstrumentPtr(NULL), currentNote(0), + currentA0hReg(0), currentB0hReg(0), volumeAdjust(0) { } }; byte _percussionReg; @@ -174,7 +174,7 @@ private: byte _voiceChannelMapping[AGOS_ADLIB_VOICES_COUNT]; // stores information about all FM voice channels - adlib_ChannelEntry _channels[AGOS_ADLIB_VOICES_COUNT]; + ChannelEntry _channels[AGOS_ADLIB_VOICES_COUNT]; protected: void onTimer(); @@ -194,10 +194,10 @@ private: MidiDriver_Accolade_AdLib::MidiDriver_Accolade_AdLib(Audio::Mixer *mixer) : MidiDriver_Emulated(mixer), _masterVolume(15), _opl(0) { - memset(_MIDIchannelMapping, 0, sizeof(_MIDIchannelMapping)); - memset(_MIDIinstrumentMapping, 0, sizeof(_MIDIinstrumentMapping)); - memset(_MIDIinstrumentVolumeAdjust, 0, sizeof(_MIDIinstrumentVolumeAdjust)); - memset(_MIDIpercussionKeyNoteMapping, 0, sizeof(_MIDIpercussionKeyNoteMapping)); + memset(_channelMapping, 0, sizeof(_channelMapping)); + memset(_instrumentMapping, 0, sizeof(_instrumentMapping)); + memset(_instrumentVolumeAdjust, 0, sizeof(_instrumentVolumeAdjust)); + memset(_percussionKeyNoteMapping, 0, sizeof(_percussionKeyNoteMapping)); _instrumentTable = NULL; _instrumentCount = 0; @@ -328,7 +328,7 @@ void MidiDriver_Accolade_AdLib::send(uint32 b) { byte op1 = (b >> 8) & 0xff; byte op2 = (b >> 16) & 0xff; - byte mappedChannel = _MIDIchannelMapping[channel]; + byte mappedChannel = _channelMapping[channel]; byte mappedInstrument = 0; // Ignore everything that is outside of our channel range @@ -350,7 +350,7 @@ void MidiDriver_Accolade_AdLib::send(uint32 b) { // Doesn't seem to be implemented break; case 0xc0: // Program Change - mappedInstrument = _MIDIinstrumentMapping[op1]; + mappedInstrument = _instrumentMapping[op1]; programChange(mappedChannel, mappedInstrument, op1); break; case 0xa0: // Polyphonic key pressure (aftertouch) @@ -421,12 +421,12 @@ void MidiDriver_Accolade_AdLib::noteOn(byte FMvoiceChannel, byte note, byte velo return; } - byte percussionChannel = adlib_percussionKeyNoteChannelTable[adjustedNote]; + byte percussionChannel = percussionKeyNoteChannelTable[adjustedNote]; if (percussionChannel >= AGOS_ADLIB_VOICES_COUNT) return; // INSTR.DAT variant checked for ">" instead of ">=", which seems to have been a bug // Map the keynote accordingly - adjustedNote = _MIDIpercussionKeyNoteMapping[adjustedNote]; + adjustedNote = _percussionKeyNoteMapping[adjustedNote]; // Now overwrite the FM voice channel FMvoiceChannel = percussionChannel; } @@ -460,7 +460,7 @@ void MidiDriver_Accolade_AdLib::noteOn(byte FMvoiceChannel, byte note, byte velo // Enable bit of the requested percussion type assert(percussionIdx < AGOS_ADLIB_VOICES_PERCUSSION_COUNT); - _percussionReg |= adlib_percussionBits[percussionIdx]; + _percussionReg |= percussionBits[percussionIdx]; setRegister(0xBD, _percussionReg); } @@ -478,7 +478,7 @@ void MidiDriver_Accolade_AdLib::noteOn(byte FMvoiceChannel, byte note, byte velo adlibOctave = (adlibNote / 12) - 1; adlibFrequencyIdx = adlibNote % 12; - adlibFrequency = adlib_FrequencyLookUpTable[adlibFrequencyIdx]; + adlibFrequency = frequencyLookUpTable[adlibFrequencyIdx]; if (adlibFrequency & 0x8000) adlibOctave++; @@ -496,7 +496,7 @@ void MidiDriver_Accolade_AdLib::noteOn(byte FMvoiceChannel, byte note, byte velo adlibFrequencyIdx = adlibNote % 12; // additional code, that will lookup octave and do a multiplication with it // noteOn however calls the frequency calculation in a way that it multiplies with 0 - adlibFrequency = adlib_FrequencyLookUpTableMusicDrv[adlibFrequencyIdx]; + adlibFrequency = frequencyLookUpTableMusicDrv[adlibFrequencyIdx]; } regValueA0h = adlibFrequency & 0xFF; @@ -525,7 +525,7 @@ void MidiDriver_Accolade_AdLib::noteOn(byte FMvoiceChannel, byte note, byte velo void MidiDriver_Accolade_AdLib::noteOnSetVolume(byte FMvoiceChannel, byte operatorNr, byte adjustedVelocity) { byte operatorReg = 0; byte regValue40h = 0; - const adlib_InstrumentEntry *curInstrument = NULL; + const InstrumentEntry *curInstrument = NULL; regValue40h = (63 - adjustedVelocity) & 0x3F; @@ -563,9 +563,9 @@ void MidiDriver_Accolade_AdLib::noteOnSetVolume(byte FMvoiceChannel, byte operat } if (operatorNr == 1) { - operatorReg = adlib_Operator1Register[FMvoiceChannel]; + operatorReg = operator1Register[FMvoiceChannel]; } else { - operatorReg = adlib_Operator2Register[FMvoiceChannel]; + operatorReg = operator2Register[FMvoiceChannel]; } assert(operatorReg != 0xFF); // Security check setRegister(0x40 + operatorReg, regValue40h); @@ -602,7 +602,7 @@ void MidiDriver_Accolade_AdLib::noteOff(byte FMvoiceChannel, byte note, bool don return; } - byte percussionChannel = adlib_percussionKeyNoteChannelTable[adjustedNote]; + byte percussionChannel = percussionKeyNoteChannelTable[adjustedNote]; if (percussionChannel > AGOS_ADLIB_VOICES_COUNT) return; @@ -610,14 +610,14 @@ void MidiDriver_Accolade_AdLib::noteOff(byte FMvoiceChannel, byte note, bool don // Disable bit of the requested percussion type assert(percussionIdx < AGOS_ADLIB_VOICES_PERCUSSION_COUNT); - _percussionReg &= ~adlib_percussionBits[percussionIdx]; + _percussionReg &= ~percussionBits[percussionIdx]; setRegister(0xBD, _percussionReg); } } void MidiDriver_Accolade_AdLib::programChange(byte FMvoiceChannel, byte mappedInstrumentNr, byte MIDIinstrumentNr) { if (mappedInstrumentNr >= _instrumentCount) { - warning("ADLIB: tried to set non-existant instrument"); + warning("ADLIB: tried to set non-existent instrument"); return; // out of range } @@ -632,7 +632,7 @@ void MidiDriver_Accolade_AdLib::programChange(byte FMvoiceChannel, byte mappedIn // Percussion // set default instrument (again) byte percussionInstrumentNr = 0; - const adlib_InstrumentEntry *instrumentPtr; + const InstrumentEntry *instrumentPtr; if (!_musicDrvMode) { // INSTR.DAT: percussion default instruments start at instrument 1 @@ -642,22 +642,22 @@ void MidiDriver_Accolade_AdLib::programChange(byte FMvoiceChannel, byte mappedIn percussionInstrumentNr = FMvoiceChannel - AGOS_ADLIB_VOICES_PERCUSSION_START + 0x80; } if (percussionInstrumentNr >= _instrumentCount) { - warning("ADLIB: tried to set non-existant instrument"); + warning("ADLIB: tried to set non-existent instrument"); return; } instrumentPtr = &_instrumentTable[percussionInstrumentNr]; _channels[FMvoiceChannel].currentInstrumentPtr = instrumentPtr; - _channels[FMvoiceChannel].volumeAdjust = _MIDIinstrumentVolumeAdjust[percussionInstrumentNr]; + _channels[FMvoiceChannel].volumeAdjust = _instrumentVolumeAdjust[percussionInstrumentNr]; } } void MidiDriver_Accolade_AdLib::programChangeSetInstrument(byte FMvoiceChannel, byte mappedInstrumentNr, byte MIDIinstrumentNr) { - const adlib_InstrumentEntry *instrumentPtr; + const InstrumentEntry *instrumentPtr; byte op1Reg = 0; byte op2Reg = 0; if (mappedInstrumentNr >= _instrumentCount) { - warning("ADLIB: tried to set non-existant instrument"); + warning("ADLIB: tried to set non-existent instrument"); return; // out of range } @@ -665,8 +665,8 @@ void MidiDriver_Accolade_AdLib::programChangeSetInstrument(byte FMvoiceChannel, instrumentPtr = &_instrumentTable[mappedInstrumentNr]; //warning("set instrument for FM voice channel %d, instrument id %d", FMvoiceChannel, mappedInstrumentNr); - op1Reg = adlib_Operator1Register[FMvoiceChannel]; - op2Reg = adlib_Operator2Register[FMvoiceChannel]; + op1Reg = operator1Register[FMvoiceChannel]; + op2Reg = operator2Register[FMvoiceChannel]; setRegister(0x20 + op1Reg, instrumentPtr->reg20op1); setRegister(0x40 + op1Reg, instrumentPtr->reg40op1); @@ -693,12 +693,11 @@ void MidiDriver_Accolade_AdLib::programChangeSetInstrument(byte FMvoiceChannel, // Remember instrument _channels[FMvoiceChannel].currentInstrumentPtr = instrumentPtr; - _channels[FMvoiceChannel].volumeAdjust = _MIDIinstrumentVolumeAdjust[MIDIinstrumentNr]; + _channels[FMvoiceChannel].volumeAdjust = _instrumentVolumeAdjust[MIDIinstrumentNr]; } void MidiDriver_Accolade_AdLib::setRegister(int reg, int value) { - _opl->write(0x220, reg); - _opl->write(0x221, value); + _opl->writeReg(reg, value); //warning("OPL %x %x (%d)", reg, value, value); } @@ -787,42 +786,42 @@ bool MidiDriver_Accolade_AdLib::setupInstruments(byte *driverData, uint16 driver // Channel mapping if (channelMappingSize) { // Get these 16 bytes for MIDI channel mapping - if (channelMappingSize != sizeof(_MIDIchannelMapping)) + if (channelMappingSize != sizeof(_channelMapping)) return false; - memcpy(_MIDIchannelMapping, driverData + channelMappingOffset, sizeof(_MIDIchannelMapping)); + memcpy(_channelMapping, driverData + channelMappingOffset, sizeof(_channelMapping)); } else { // Set up straight mapping - for (uint16 channelNr = 0; channelNr < sizeof(_MIDIchannelMapping); channelNr++) { - _MIDIchannelMapping[channelNr] = channelNr; + for (uint16 channelNr = 0; channelNr < sizeof(_channelMapping); channelNr++) { + _channelMapping[channelNr] = channelNr; } } if (instrumentMappingSize) { // And these for instrument mapping - if (instrumentMappingSize > sizeof(_MIDIinstrumentMapping)) + if (instrumentMappingSize > sizeof(_instrumentMapping)) return false; - memcpy(_MIDIinstrumentMapping, driverData + instrumentMappingOffset, instrumentMappingSize); + memcpy(_instrumentMapping, driverData + instrumentMappingOffset, instrumentMappingSize); } // Set up straight mapping for the remaining data - for (uint16 instrumentNr = instrumentMappingSize; instrumentNr < sizeof(_MIDIinstrumentMapping); instrumentNr++) { - _MIDIinstrumentMapping[instrumentNr] = instrumentNr; + for (uint16 instrumentNr = instrumentMappingSize; instrumentNr < sizeof(_instrumentMapping); instrumentNr++) { + _instrumentMapping[instrumentNr] = instrumentNr; } if (instrumentVolumeAdjustSize) { - if (instrumentVolumeAdjustSize != sizeof(_MIDIinstrumentVolumeAdjust)) + if (instrumentVolumeAdjustSize != sizeof(_instrumentVolumeAdjust)) return false; - memcpy(_MIDIinstrumentVolumeAdjust, driverData + instrumentVolumeAdjustOffset, instrumentVolumeAdjustSize); + memcpy(_instrumentVolumeAdjust, driverData + instrumentVolumeAdjustOffset, instrumentVolumeAdjustSize); } // Get key note mapping, if available if (keyNoteMappingSize) { - if (keyNoteMappingSize != sizeof(_MIDIpercussionKeyNoteMapping)) + if (keyNoteMappingSize != sizeof(_percussionKeyNoteMapping)) return false; - memcpy(_MIDIpercussionKeyNoteMapping, driverData + keyNoteMappingOffset, keyNoteMappingSize); + memcpy(_percussionKeyNoteMapping, driverData + keyNoteMappingOffset, keyNoteMappingSize); } // Check, if there are enough bytes left to hold all instrument data @@ -833,14 +832,14 @@ bool MidiDriver_Accolade_AdLib::setupInstruments(byte *driverData, uint16 driver if (_instrumentTable) delete[] _instrumentTable; - _instrumentTable = new adlib_InstrumentEntry[instrumentCount]; + _instrumentTable = new InstrumentEntry[instrumentCount]; _instrumentCount = instrumentCount; - byte *instrDATReadPtr = driverData + instrumentDataOffset; - adlib_InstrumentEntry *instrumentWritePtr = _instrumentTable; + byte *instrDATReadPtr = driverData + instrumentDataOffset; + InstrumentEntry *instrumentWritePtr = _instrumentTable; for (uint16 instrumentNr = 0; instrumentNr < _instrumentCount; instrumentNr++) { - memcpy(instrumentWritePtr, instrDATReadPtr, sizeof(adlib_InstrumentEntry)); + memcpy(instrumentWritePtr, instrDATReadPtr, sizeof(InstrumentEntry)); instrDATReadPtr += instrumentEntrySize; instrumentWritePtr++; } diff --git a/engines/agos/drivers/accolade/mididriver.h b/engines/agos/drivers/accolade/mididriver.h index 81064ec652..96637ed1f2 100644 --- a/engines/agos/drivers/accolade/mididriver.h +++ b/engines/agos/drivers/accolade/mididriver.h @@ -20,8 +20,8 @@ * */ -#ifndef AGOS_SOFTSEQ_MIDIDRIVER_H -#define AGOS_SOFTSEQ_MIDIDRIVER_H +#ifndef AGOS_DRIVERS_ACCOLADE_MIDIDRIVER_H +#define AGOS_DRIVERS_ACCOLADE_MIDIDRIVER_H #include "agos/agos.h" #include "audio/mididrv.h" @@ -42,4 +42,4 @@ extern bool MidiDriver_Accolade_MT32_setupInstruments(MidiDriver *driver, byte * } // End of namespace AGOS -#endif // AGOS_SOFTSEQ_MIDIDRIVER_H +#endif // AGOS_DRIVERS_ACCOLADE_MIDIDRIVER_H diff --git a/engines/agos/drivers/accolade/mt32.cpp b/engines/agos/drivers/accolade/mt32.cpp index 6567d1d9ef..630198fc86 100644 --- a/engines/agos/drivers/accolade/mt32.cpp +++ b/engines/agos/drivers/accolade/mt32.cpp @@ -70,33 +70,28 @@ protected: Common::Mutex _mutex; MidiDriver *_driver; bool _MT32; - bool _nativeMT32; bool _isOpen; int _baseFreq; private: // simple mapping between MIDI channel and MT32 channel - byte _MIDIchannelMapping[AGOS_MIDI_CHANNEL_COUNT]; + byte _channelMapping[AGOS_MIDI_CHANNEL_COUNT]; // simple mapping between MIDI instruments and MT32 instruments - byte _MIDIinstrumentMapping[AGOS_MIDI_INSTRUMENT_COUNT]; + byte _instrumentMapping[AGOS_MIDI_INSTRUMENT_COUNT]; public: bool setupInstruments(byte *instrumentData, uint16 instrumentDataSize, bool useMusicDrvFile); - - void MT32SysEx(const byte *&dataPtr, int32 &bytesLeft); }; MidiDriver_Accolade_MT32::MidiDriver_Accolade_MT32() { _driver = NULL; _isOpen = false; _MT32 = false; - _nativeMT32 = false; _baseFreq = 250; - memset(_MIDIchannelMapping, 0, sizeof(_MIDIchannelMapping)); - memset(_MIDIinstrumentMapping, 0, sizeof(_MIDIinstrumentMapping)); - //memset(_MIDIkeyNoteMapping, 0, sizeof(_MIDIkeyNoteMapping)); + memset(_channelMapping, 0, sizeof(_channelMapping)); + memset(_instrumentMapping, 0, sizeof(_instrumentMapping)); } MidiDriver_Accolade_MT32::~MidiDriver_Accolade_MT32() { @@ -121,12 +116,10 @@ int MidiDriver_Accolade_MT32::open() { switch (musicType) { case MT_MT32: _MT32 = true; - _nativeMT32 = false; break; case MT_GM: if (ConfMan.getBool("native_mt32")) { _MT32 = true; - _nativeMT32 = true; } break; default: @@ -137,9 +130,6 @@ int MidiDriver_Accolade_MT32::open() { if (!_driver) return 255; - if (_nativeMT32) - _driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE); - int ret = _driver->open(); if (ret) return ret; @@ -170,7 +160,7 @@ void MidiDriver_Accolade_MT32::send(uint32 b) { return; } - byte mappedChannel = _MIDIchannelMapping[channel]; + byte mappedChannel = _channelMapping[channel]; if (mappedChannel < AGOS_MIDI_CHANNEL_COUNT) { // channel mapped to an actual MIDI channel, so use that one @@ -179,7 +169,7 @@ void MidiDriver_Accolade_MT32::send(uint32 b) { // Program change // Figure out the requested instrument byte midiInstrument = (b >> 8) & 0xFF; - byte mappedInstrument = _MIDIinstrumentMapping[midiInstrument]; + byte mappedInstrument = _instrumentMapping[midiInstrument]; // And replace it b = (b & 0xFFFF00FF) | (mappedInstrument << 8); } @@ -231,27 +221,27 @@ bool MidiDriver_Accolade_MT32::setupInstruments(byte *driverData, uint16 driverD // Channel mapping if (channelMappingSize) { // Get these 16 bytes for MIDI channel mapping - if (channelMappingSize != sizeof(_MIDIchannelMapping)) + if (channelMappingSize != sizeof(_channelMapping)) return false; - memcpy(_MIDIchannelMapping, driverData + channelMappingOffset, sizeof(_MIDIchannelMapping)); + memcpy(_channelMapping, driverData + channelMappingOffset, sizeof(_channelMapping)); } else { // Set up straight mapping - for (uint16 channelNr = 0; channelNr < sizeof(_MIDIchannelMapping); channelNr++) { - _MIDIchannelMapping[channelNr] = channelNr; + for (uint16 channelNr = 0; channelNr < sizeof(_channelMapping); channelNr++) { + _channelMapping[channelNr] = channelNr; } } if (instrumentMappingSize) { // And these for instrument mapping - if (instrumentMappingSize > sizeof(_MIDIinstrumentMapping)) + if (instrumentMappingSize > sizeof(_instrumentMapping)) return false; - memcpy(_MIDIinstrumentMapping, driverData + instrumentMappingOffset, instrumentMappingSize); + memcpy(_instrumentMapping, driverData + instrumentMappingOffset, instrumentMappingSize); } // Set up straight mapping for the remaining data - for (uint16 instrumentNr = instrumentMappingSize; instrumentNr < sizeof(_MIDIinstrumentMapping); instrumentNr++) { - _MIDIinstrumentMapping[instrumentNr] = instrumentNr; + for (uint16 instrumentNr = instrumentMappingSize; instrumentNr < sizeof(_instrumentMapping); instrumentNr++) { + _instrumentMapping[instrumentNr] = instrumentNr; } return true; } diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp index 36ba003796..83c15fee45 100644 --- a/engines/agos/midi.cpp +++ b/engines/agos/midi.cpp @@ -60,7 +60,7 @@ MidiPlayer::MidiPlayer() { _queuedTrack = 255; _loopQueuedTrack = 0; - _accolade_mode = false; + _accoladeMode = false; } MidiPlayer::~MidiPlayer() { @@ -81,55 +81,55 @@ int MidiPlayer::open(int gameType, bool isDemo) { // Don't call open() twice! assert(!_driver); - bool accolade_useMusicDrvFile = false; - MusicType accolade_musicType = MT_INVALID; + bool accoladeUseMusicDrvFile = false; + MusicType accoladeMusicType = MT_INVALID; switch (gameType) { case GType_ELVIRA1: - _accolade_mode = true; + _accoladeMode = true; break; case GType_ELVIRA2: case GType_WW: // Attention: Elvira 2 shipped with INSTR.DAT and MUSIC.DRV // MUSIC.DRV is the correct one. INSTR.DAT seems to be a left-over - _accolade_mode = true; - accolade_useMusicDrvFile = true; + _accoladeMode = true; + accoladeUseMusicDrvFile = true; break; case GType_SIMON1: if (isDemo) { - _accolade_mode = true; - accolade_useMusicDrvFile = true; + _accoladeMode = true; + accoladeUseMusicDrvFile = true; } break; default: break; } - if (_accolade_mode) { + if (_accoladeMode) { MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MT32); - accolade_musicType = MidiDriver::getMusicType(dev); + accoladeMusicType = MidiDriver::getMusicType(dev); - switch (accolade_musicType) { + switch (accoladeMusicType) { case MT_ADLIB: case MT_MT32: break; case MT_GM: if (ConfMan.getBool("native_mt32")) { // Real MT32 - accolade_musicType = MT_MT32; + accoladeMusicType = MT_MT32; } else { - _accolade_mode = false; + _accoladeMode = false; } break; default: - _accolade_mode = false; + _accoladeMode = false; break; } } - if (_accolade_mode) { + if (_accoladeMode) { // Setup midi driver - switch (accolade_musicType) { + switch (accoladeMusicType) { case MT_ADLIB: _driver = MidiDriver_Accolade_AdLib_create(); break; @@ -146,7 +146,7 @@ int MidiPlayer::open(int gameType, bool isDemo) { byte *instrumentData = NULL; uint16 instrumentDataSize = 0; - if (!accolade_useMusicDrvFile) { + if (!accoladeUseMusicDrvFile) { // Elvira 1 / Elvira 2: read INSTR.DAT Common::File *instrDatStream = new Common::File(); @@ -159,7 +159,7 @@ int MidiPlayer::open(int gameType, bool isDemo) { uint16 skipChunks = 0; // 1 for MT32, 0 for AdLib uint16 chunkSize = 0; - switch (accolade_musicType) { + switch (accoladeMusicType) { case MT_ADLIB: skipChunks = 0; break; @@ -222,7 +222,7 @@ int MidiPlayer::open(int gameType, bool isDemo) { uint32 streamLeft = streamSize; uint16 getChunk = 0; // 4 for MT32, 2 for AdLib - switch (accolade_musicType) { + switch (accoladeMusicType) { case MT_ADLIB: getChunk = 2; break; @@ -286,12 +286,12 @@ int MidiPlayer::open(int gameType, bool isDemo) { // Pass the instrument data to the driver bool instrumentSuccess = false; - switch (accolade_musicType) { + switch (accoladeMusicType) { case MT_ADLIB: - instrumentSuccess = MidiDriver_Accolade_AdLib_setupInstruments(_driver, instrumentData, instrumentDataSize, accolade_useMusicDrvFile); + instrumentSuccess = MidiDriver_Accolade_AdLib_setupInstruments(_driver, instrumentData, instrumentDataSize, accoladeUseMusicDrvFile); break; case MT_MT32: - instrumentSuccess = MidiDriver_Accolade_MT32_setupInstruments(_driver, instrumentData, instrumentDataSize, accolade_useMusicDrvFile); + instrumentSuccess = MidiDriver_Accolade_MT32_setupInstruments(_driver, instrumentData, instrumentDataSize, accoladeUseMusicDrvFile); break; default: assert(0); @@ -301,7 +301,7 @@ int MidiPlayer::open(int gameType, bool isDemo) { if (!instrumentSuccess) { // driver did not like the contents - if (!accolade_useMusicDrvFile) + if (!accoladeUseMusicDrvFile) error("INSTR.DAT: contents not acceptable"); else error("MUSIC.DRV: contents not acceptable"); @@ -352,7 +352,7 @@ void MidiPlayer::send(uint32 b) { if (!_current) return; - if (_accolade_mode) { + if (_accoladeMode) { // Send directly to Accolade driver _driver->send(b); return; diff --git a/engines/agos/midi.h b/engines/agos/midi.h index e7fcadc6ee..de0c239719 100644 --- a/engines/agos/midi.h +++ b/engines/agos/midi.h @@ -120,7 +120,7 @@ public: virtual void metaEvent(byte type, byte *data, uint16 length); private: - bool _accolade_mode; + bool _accoladeMode; }; } // End of namespace AGOS |