diff options
Diffstat (limited to 'engines/cruise')
-rw-r--r-- | engines/cruise/cruise_main.cpp | 2 | ||||
-rw-r--r-- | engines/cruise/sound.cpp | 88 |
2 files changed, 45 insertions, 45 deletions
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 2fb242a145..f61d8f023a 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -364,7 +364,7 @@ int loadFileSub1(uint8 **ptr, const char *name, uint8 *ptr2) { * strcat(buffer, ".H32"); *} * else - * if (useAdlib) + * if (useAdLib) * { */ strcat(buffer,".ADL"); /* } diff --git a/engines/cruise/sound.cpp b/engines/cruise/sound.cpp index 3a40e35ed3..6288c41474 100644 --- a/engines/cruise/sound.cpp +++ b/engines/cruise/sound.cpp @@ -82,7 +82,7 @@ const int PCSoundDriver::_noteTable[] = { const int PCSoundDriver::_noteTableCount = ARRAYSIZE(_noteTable); -struct AdlibRegisterSoundInstrument { +struct AdLibRegisterSoundInstrument { uint8 vibrato; uint8 attackDecay; uint8 sustainRelease; @@ -92,11 +92,11 @@ struct AdlibRegisterSoundInstrument { uint8 freqMod; }; -struct AdlibSoundInstrument { +struct AdLibSoundInstrument { byte mode; byte channel; - AdlibRegisterSoundInstrument regMod; - AdlibRegisterSoundInstrument regCar; + AdLibRegisterSoundInstrument regMod; + AdLibRegisterSoundInstrument regCar; byte waveSelectMod; byte waveSelectCar; byte amDepth; @@ -107,10 +107,10 @@ struct VolumeEntry { int adjusted; }; -class AdlibSoundDriver : public PCSoundDriver, Audio::AudioStream { +class AdLibSoundDriver : public PCSoundDriver, Audio::AudioStream { public: - AdlibSoundDriver(Audio::Mixer *mixer); - virtual ~AdlibSoundDriver(); + AdLibSoundDriver(Audio::Mixer *mixer); + virtual ~AdLibSoundDriver(); // PCSoundDriver interface virtual void setupChannel(int channel, const byte *data, int instrument, int volume); @@ -126,9 +126,9 @@ public: void initCard(); void update(int16 *buf, int len); void setupInstrument(const byte *data, int channel); - void setupInstrument(const AdlibSoundInstrument *ins, int channel); - void loadRegisterInstrument(const byte *data, AdlibRegisterSoundInstrument *reg); - virtual void loadInstrument(const byte *data, AdlibSoundInstrument *asi) = 0; + void setupInstrument(const AdLibSoundInstrument *ins, int channel); + void loadRegisterInstrument(const byte *data, AdLibRegisterSoundInstrument *reg); + virtual void loadInstrument(const byte *data, AdLibSoundInstrument *asi) = 0; virtual void syncSounds(); void adjustVolume(int channel, int volume); @@ -141,7 +141,7 @@ protected: byte _vibrato; VolumeEntry _channelsVolumeTable[5]; - AdlibSoundInstrument _instrumentsTable[5]; + AdLibSoundInstrument _instrumentsTable[5]; static const int _freqTable[]; static const int _freqTableCount; @@ -151,30 +151,30 @@ protected: static const int _voiceOperatorsTableCount; }; -const int AdlibSoundDriver::_freqTable[] = { +const int AdLibSoundDriver::_freqTable[] = { 0x157, 0x16C, 0x181, 0x198, 0x1B1, 0x1CB, 0x1E6, 0x203, 0x222, 0x243, 0x266, 0x28A }; -const int AdlibSoundDriver::_freqTableCount = ARRAYSIZE(_freqTable); +const int AdLibSoundDriver::_freqTableCount = ARRAYSIZE(_freqTable); -const int AdlibSoundDriver::_operatorsTable[] = { +const int AdLibSoundDriver::_operatorsTable[] = { 0, 1, 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 16, 17, 18, 19, 20, 21 }; -const int AdlibSoundDriver::_operatorsTableCount = ARRAYSIZE(_operatorsTable); +const int AdLibSoundDriver::_operatorsTableCount = ARRAYSIZE(_operatorsTable); -const int AdlibSoundDriver::_voiceOperatorsTable[] = { +const int AdLibSoundDriver::_voiceOperatorsTable[] = { 0, 3, 1, 4, 2, 5, 6, 9, 7, 10, 8, 11, 12, 15, 16, 16, 14, 14, 17, 17, 13, 13 }; -const int AdlibSoundDriver::_voiceOperatorsTableCount = ARRAYSIZE(_voiceOperatorsTable); +const int AdLibSoundDriver::_voiceOperatorsTableCount = ARRAYSIZE(_voiceOperatorsTable); -class AdlibSoundDriverADL : public AdlibSoundDriver { +class AdLibSoundDriverADL : public AdLibSoundDriver { public: - AdlibSoundDriverADL(Audio::Mixer *mixer) : AdlibSoundDriver(mixer) {} + AdLibSoundDriverADL(Audio::Mixer *mixer) : AdLibSoundDriver(mixer) {} virtual const char *getInstrumentExtension() const { return ".ADL"; } - virtual void loadInstrument(const byte *data, AdlibSoundInstrument *asi); + virtual void loadInstrument(const byte *data, AdLibSoundInstrument *asi); virtual void setChannelFrequency(int channel, int frequency); virtual void playSample(const byte *data, int size, int channel, int volume); }; @@ -287,10 +287,10 @@ void PCSoundDriver::syncSounds() { _sfxVolume = ConfMan.getBool("sfx_mute") ? 0 : MIN(255, ConfMan.getInt("sfx_volume")); } -AdlibSoundDriver::AdlibSoundDriver(Audio::Mixer *mixer) +AdLibSoundDriver::AdLibSoundDriver(Audio::Mixer *mixer) : _mixer(mixer) { _sampleRate = _mixer->getOutputRate(); - _opl = makeAdlibOPL(_sampleRate); + _opl = makeAdLibOPL(_sampleRate); for (int i = 0; i < 5; ++i) { _channelsVolumeTable[i].original = 0; @@ -304,23 +304,23 @@ AdlibSoundDriver::AdlibSoundDriver(Audio::Mixer *mixer) _sfxVolume = ConfMan.getBool("sfx_mute") ? 0 : MIN(255, ConfMan.getInt("sfx_volume")); } -AdlibSoundDriver::~AdlibSoundDriver() { +AdLibSoundDriver::~AdLibSoundDriver() { _mixer->stopHandle(_soundHandle); OPLDestroy(_opl); } -void AdlibSoundDriver::syncSounds() { +void AdLibSoundDriver::syncSounds() { PCSoundDriver::syncSounds(); // Force all instruments to reload on the next playing point for (int i = 0; i < 5; ++i) { adjustVolume(i, _channelsVolumeTable[i].original); - AdlibSoundInstrument *ins = &_instrumentsTable[i]; + AdLibSoundInstrument *ins = &_instrumentsTable[i]; setupInstrument(ins, i); } } -void AdlibSoundDriver::adjustVolume(int channel, int volume) { +void AdLibSoundDriver::adjustVolume(int channel, int volume) { _channelsVolumeTable[channel].original = volume; if (volume > 80) { @@ -342,7 +342,7 @@ void AdlibSoundDriver::adjustVolume(int channel, int volume) { _channelsVolumeTable[channel].adjusted = volume; } -void AdlibSoundDriver::setupChannel(int channel, const byte *data, int instrument, int volume) { +void AdLibSoundDriver::setupChannel(int channel, const byte *data, int instrument, int volume) { assert(channel < 5); if (data) { adjustVolume(channel, volume); @@ -350,9 +350,9 @@ void AdlibSoundDriver::setupChannel(int channel, const byte *data, int instrumen } } -void AdlibSoundDriver::stopChannel(int channel) { +void AdLibSoundDriver::stopChannel(int channel) { assert(channel < 5); - AdlibSoundInstrument *ins = &_instrumentsTable[channel]; + AdLibSoundInstrument *ins = &_instrumentsTable[channel]; if (ins->mode != 0 && ins->channel == 6) { channel = 6; } @@ -365,7 +365,7 @@ void AdlibSoundDriver::stopChannel(int channel) { } } -void AdlibSoundDriver::stopAll() { +void AdLibSoundDriver::stopAll() { int i; for (i = 0; i < 18; ++i) { OPLWriteReg(_opl, 0x40 | _operatorsTable[i], 63); @@ -376,12 +376,12 @@ void AdlibSoundDriver::stopAll() { OPLWriteReg(_opl, 0xBD, 0); } -int AdlibSoundDriver::readBuffer(int16 *buffer, const int numSamples) { +int AdLibSoundDriver::readBuffer(int16 *buffer, const int numSamples) { update(buffer, numSamples); return numSamples; } -void AdlibSoundDriver::initCard() { +void AdLibSoundDriver::initCard() { _vibrato = 0x20; OPLWriteReg(_opl, 0xBD, _vibrato); OPLWriteReg(_opl, 0x08, 0x40); @@ -405,7 +405,7 @@ void AdlibSoundDriver::initCard() { OPLWriteReg(_opl, 1, 0); } -void AdlibSoundDriver::update(int16 *buf, int len) { +void AdLibSoundDriver::update(int16 *buf, int len) { static int samplesLeft = 0; while (len != 0) { int count = samplesLeft; @@ -425,17 +425,17 @@ void AdlibSoundDriver::update(int16 *buf, int len) { } } -void AdlibSoundDriver::setupInstrument(const byte *data, int channel) { +void AdLibSoundDriver::setupInstrument(const byte *data, int channel) { assert(channel < 5); - AdlibSoundInstrument *ins = &_instrumentsTable[channel]; + AdLibSoundInstrument *ins = &_instrumentsTable[channel]; loadInstrument(data, ins); setupInstrument(ins, channel); } -void AdlibSoundDriver::setupInstrument(const AdlibSoundInstrument *ins, int channel) { +void AdLibSoundDriver::setupInstrument(const AdLibSoundInstrument *ins, int channel) { int mod, car, tmp; - const AdlibRegisterSoundInstrument *reg; + const AdLibRegisterSoundInstrument *reg; if (ins->mode != 0) { mod = _operatorsTable[_voiceOperatorsTable[2 * ins->channel + 0]]; @@ -475,7 +475,7 @@ void AdlibSoundDriver::setupInstrument(const AdlibSoundInstrument *ins, int chan OPLWriteReg(_opl, 0xE0 | car, ins->waveSelectCar); } -void AdlibSoundDriver::loadRegisterInstrument(const byte *data, AdlibRegisterSoundInstrument *reg) { +void AdLibSoundDriver::loadRegisterInstrument(const byte *data, AdLibRegisterSoundInstrument *reg) { reg->vibrato = 0; if (READ_LE_UINT16(data + 18)) { // amplitude vibrato reg->vibrato |= 0x80; @@ -507,7 +507,7 @@ void AdlibSoundDriver::loadRegisterInstrument(const byte *data, AdlibRegisterSou reg->freqMod = READ_LE_UINT16(data + 24); } -void AdlibSoundDriverADL::loadInstrument(const byte *data, AdlibSoundInstrument *asi) { +void AdLibSoundDriverADL::loadInstrument(const byte *data, AdLibSoundInstrument *asi) { asi->mode = *data++; asi->channel = *data++; asi->waveSelectMod = *data++ & 3; @@ -518,9 +518,9 @@ void AdlibSoundDriverADL::loadInstrument(const byte *data, AdlibSoundInstrument loadRegisterInstrument(data, &asi->regCar); data += 26; } -void AdlibSoundDriverADL::setChannelFrequency(int channel, int frequency) { +void AdLibSoundDriverADL::setChannelFrequency(int channel, int frequency) { assert(channel < 5); - AdlibSoundInstrument *ins = &_instrumentsTable[channel]; + AdLibSoundInstrument *ins = &_instrumentsTable[channel]; if (ins->mode != 0) { channel = ins->channel; if (channel == 9) { @@ -553,12 +553,12 @@ void AdlibSoundDriverADL::setChannelFrequency(int channel, int frequency) { } } -void AdlibSoundDriverADL::playSample(const byte *data, int size, int channel, int volume) { +void AdLibSoundDriverADL::playSample(const byte *data, int size, int channel, int volume) { assert(channel < 5); adjustVolume(channel, 127); setupInstrument(data, channel); - AdlibSoundInstrument *ins = &_instrumentsTable[channel]; + AdLibSoundInstrument *ins = &_instrumentsTable[channel]; if (ins->mode != 0 && ins->channel == 6) { OPLWriteReg(_opl, 0xB0 | channel, 0); } @@ -780,7 +780,7 @@ void PCSoundFxPlayer::doSync(Common::Serializer &s) { PCSound::PCSound(Audio::Mixer *mixer, CruiseEngine *vm) { _vm = vm; _mixer = mixer; - _soundDriver = new AdlibSoundDriverADL(_mixer); + _soundDriver = new AdLibSoundDriverADL(_mixer); _player = new PCSoundFxPlayer(_soundDriver); } |