diff options
author | Gregory Montoir | 2007-05-13 02:11:38 +0000 |
---|---|---|
committer | Gregory Montoir | 2007-05-13 02:11:38 +0000 |
commit | a05d455ae8b3fde50b7cc4b8340bad83301acc31 (patch) | |
tree | 2ac75fdc39c0de8af0d670761d326faba66947b4 /engines | |
parent | 0a37086d316a76d51831447ee64d2129ac7d39ee (diff) | |
download | scummvm-rg350-a05d455ae8b3fde50b7cc4b8340bad83301acc31.tar.gz scummvm-rg350-a05d455ae8b3fde50b7cc4b8340bad83301acc31.tar.bz2 scummvm-rg350-a05d455ae8b3fde50b7cc4b8340bad83301acc31.zip |
minor fixes to the adlib sound code, this should help bug #1599270
svn-id: r26820
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cine/sfx_player.cpp | 14 | ||||
-rw-r--r-- | engines/cine/sound_driver.cpp | 33 |
2 files changed, 24 insertions, 23 deletions
diff --git a/engines/cine/sfx_player.cpp b/engines/cine/sfx_player.cpp index 59b9c61041..fa97fe2891 100644 --- a/engines/cine/sfx_player.cpp +++ b/engines/cine/sfx_player.cpp @@ -111,13 +111,15 @@ void SfxPlayer::play() { } void SfxPlayer::stop() { - _fadeOutCounter = 0; - _playing = false; - for (int i = 0; i < NUM_CHANNELS; ++i) { - _driver->stopChannel(i); + if (_playing || _fadeOutCounter != 0) { + _fadeOutCounter = 0; + _playing = false; + for (int i = 0; i < NUM_CHANNELS; ++i) { + _driver->stopChannel(i); + } + _driver->stopSound(); + unload(); } - _driver->stopSound(); - unload(); } void SfxPlayer::fadeOut() { diff --git a/engines/cine/sound_driver.cpp b/engines/cine/sound_driver.cpp index 0bc7c8c33f..5d1c71cef8 100644 --- a/engines/cine/sound_driver.cpp +++ b/engines/cine/sound_driver.cpp @@ -87,17 +87,15 @@ void AdlibSoundDriver::setupChannel(int channel, const byte *data, int instrumen void AdlibSoundDriver::stopChannel(int channel) { assert(channel < 4); AdlibSoundInstrument *ins = &_instrumentsTable[channel]; - if (ins) { - if (ins->mode != 0 && ins->channel == 6) { - channel = 6; - } - if (ins->mode == 0 || ins->channel == 6) { - OPLWriteReg(_opl, 0xB0 | channel, 0); - } - if (ins->mode != 0) { - _vibrato &= (1 << (10 - ins->channel)) ^ 0xFF; - OPLWriteReg(_opl, 0xBD, _vibrato); - } + if (ins->mode != 0 && ins->channel == 6) { + channel = 6; + } + if (ins->mode == 0 || channel == 6) { + OPLWriteReg(_opl, 0xB0 | channel, 0); + } + if (ins->mode != 0) { + _vibrato &= ~(1 << (10 - ins->channel)); + OPLWriteReg(_opl, 0xBD, _vibrato); } } @@ -295,16 +293,17 @@ void AdlibSoundDriverINS::playSound(const byte *data, int channel, int volume) { channel = 6; } if (ins->mode == 0 || channel == 6) { - int freq = _freqTable[0]; + uint16 note = 12; + int freq = _freqTable[note % 12]; OPLWriteReg(_opl, 0xA0 | channel, freq); - freq = 4 | ((freq & 0x300) >> 8); + freq = ((note / 12) << 2) | ((freq & 0x300) >> 8); if (ins->mode == 0) { freq |= 0x20; } OPLWriteReg(_opl, 0xB0 | channel, freq); } if (ins->mode != 0) { - _vibrato = 1 << (10 - ins->channel); + _vibrato |= 1 << (10 - ins->channel); OPLWriteReg(_opl, 0xBD, _vibrato); } } @@ -351,7 +350,7 @@ void AdlibSoundDriverADL::setChannelFrequency(int channel, int frequency) { } OPLWriteReg(_opl, 0xB0 | channel, freq); if (ins->mode != 0) { - _vibrato = 1 << (10 - channel); + _vibrato |= 1 << (10 - channel); OPLWriteReg(_opl, 0xBD, _vibrato); } } @@ -366,7 +365,7 @@ void AdlibSoundDriverADL::playSound(const byte *data, int channel, int volume) { OPLWriteReg(_opl, 0xB0 | channel, 0); } if (ins->mode != 0) { - _vibrato = (1 << (10 - ins->channel)) ^ 0xFF; + _vibrato &= ~(1 << (10 - ins->channel)); OPLWriteReg(_opl, 0xBD, _vibrato); } if (ins->mode != 0) { @@ -389,7 +388,7 @@ void AdlibSoundDriverADL::playSound(const byte *data, int channel, int volume) { } OPLWriteReg(_opl, 0xB0 | channel, freq); if (ins->mode != 0) { - _vibrato = 1 << (10 - channel); + _vibrato |= 1 << (10 - channel); OPLWriteReg(_opl, 0xBD, _vibrato); } } |