aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/sound_towns.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra/sound_towns.cpp')
-rw-r--r--engines/kyra/sound_towns.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp
index ae9f3a7915..e3102d747b 100644
--- a/engines/kyra/sound_towns.cpp
+++ b/engines/kyra/sound_towns.cpp
@@ -1435,6 +1435,14 @@ void SoundTowns_v2::haltTrack() {
void SoundTowns_v2::voicePlay(const char *file) {
static const uint16 rates[] = { 0x10E1, 0x0CA9, 0x0870, 0x0654, 0x0438, 0x032A, 0x021C, 0x0194 };
+ int h = 0;
+ if (_currentSFX) {
+ while (_mixer->isSoundHandleActive(_sfxHandles[h]))
+ h++;
+ if (h >= kNumVocHandles)
+ return;
+ }
+
uint8 * data = _vm->resource()->fileData(file, 0);
uint8 * src = data;
@@ -1482,7 +1490,7 @@ void SoundTowns_v2::voicePlay(const char *file) {
_currentSFX = Audio::makeLinearInputStream(sfx, outsize, outputRate,
Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_LITTLE_ENDIAN | Audio::Mixer::FLAG_AUTOFREE, 0, 0);
- _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _currentSFX);
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandles[h], _currentSFX);
delete [] data;
}