diff options
author | athrxx | 2012-11-10 15:46:02 +0100 |
---|---|---|
committer | athrxx | 2012-11-11 19:14:28 +0100 |
commit | e016e7dfc2b1e3cdb39c01d81c5a34eee66a277b (patch) | |
tree | 841d055b9a2d0c64eae59473ff78ec70800ef65b /engines/kyra/sound_towns.cpp | |
parent | 8789087be9749f7a13fbfdd72a2c984c0bc9e158 (diff) | |
download | scummvm-rg350-e016e7dfc2b1e3cdb39c01d81c5a34eee66a277b.tar.gz scummvm-rg350-e016e7dfc2b1e3cdb39c01d81c5a34eee66a277b.tar.bz2 scummvm-rg350-e016e7dfc2b1e3cdb39c01d81c5a34eee66a277b.zip |
KYRA: implement LOL sfx priority handling
Diffstat (limited to 'engines/kyra/sound_towns.cpp')
-rw-r--r-- | engines/kyra/sound_towns.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index 4b25db33f2..01624d510b 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -569,15 +569,24 @@ void SoundTownsPC98_v2::beginFadeOut() { haltTrack(); } -int32 SoundTownsPC98_v2::voicePlay(const char *file, Audio::SoundHandle *handle, uint8, bool) { +int32 SoundTownsPC98_v2::voicePlay(const char *file, Audio::SoundHandle *handle, uint8 volume, uint8 priority, bool) { static const uint16 rates[] = { 0x10E1, 0x0CA9, 0x0870, 0x0654, 0x0438, 0x032A, 0x021C, 0x0194 }; static const char patternHOF[] = "%s.PCM"; static const char patternLOL[] = "%s.VOC"; int h = 0; if (_currentSFX) { - while (h < kNumChannelHandles && _mixer->isSoundHandleActive(_soundChannels[h])) + while (h < kNumChannelHandles && _mixer->isSoundHandleActive(_soundChannels[h].handle)) h++; + + if (h >= kNumChannelHandles) { + h = 0; + while (h < kNumChannelHandles && _soundChannels[h].priority > priority) + ++h; + if (h < kNumChannelHandles) + voiceStop(&_soundChannels[h].handle); + } + if (h >= kNumChannelHandles) return 0; } @@ -630,9 +639,10 @@ int32 SoundTownsPC98_v2::voicePlay(const char *file, Audio::SoundHandle *handle, } _currentSFX = Audio::makeRawStream(sfx, outsize, sfxRate * 10, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN); - _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundChannels[h], _currentSFX); + _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundChannels[h].handle, _currentSFX, -1, volume); + _soundChannels[h].priority = priority; if (handle) - *handle = _soundChannels[h]; + *handle = _soundChannels[h].handle; delete[] data; return 1; |