aboutsummaryrefslogtreecommitdiff
path: root/queen/sound.cpp
diff options
context:
space:
mode:
authorJoost Peters2004-01-25 22:10:23 +0000
committerJoost Peters2004-01-25 22:10:23 +0000
commit0d974b9daa4df60a87255cc6f477c9696034c24f (patch)
tree762999f9d9b24e66d075660937a97276643b870c /queen/sound.cpp
parentb106eb1e43e8f5a3c3fd78e547b2f7945969375b (diff)
downloadscummvm-rg350-0d974b9daa4df60a87255cc6f477c9696034c24f.tar.gz
scummvm-rg350-0d974b9daa4df60a87255cc6f477c9696034c24f.tar.bz2
scummvm-rg350-0d974b9daa4df60a87255cc6f477c9696034c24f.zip
Seperate SFX and Speech.
this fixes the 'pauses' in the car-chase scene and other scene which use speech and sfx simultaneously. svn-id: r12599
Diffstat (limited to 'queen/sound.cpp')
-rw-r--r--queen/sound.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/queen/sound.cpp b/queen/sound.cpp
index 7dbcff7a66..ccfcf23a5d 100644
--- a/queen/sound.cpp
+++ b/queen/sound.cpp
@@ -67,21 +67,26 @@ Sound *Sound::giveSound(SoundMixer *mixer, QueenEngine *vm, uint8 compression) {
}
}
-void Sound::waitSfxFinished() {
- while(_sfxHandle.isActive())
- _vm->input()->delay(10);
+void Sound::waitFinished(bool isSpeech) {
+ if (isSpeech)
+ while(_speechHandle.isActive())
+ _vm->input()->delay(10);
+ else
+ while(_sfxHandle.isActive())
+ _vm->input()->delay(10);
}
-void Sound::playSfx(uint16 sfx) {
+void Sound::playSfx(uint16 sfx, bool isSpeech) {
if (sfx != 0) {
char name[13];
strcpy(name, _sfxName[sfx - 1]);
strcat(name, ".SB");
- sfxPlay(name);
+ waitFinished(isSpeech);
+ sfxPlay(name, isSpeech);
}
}
-void Sound::playSfx(const char *base) {
+void Sound::playSfx(const char *base, bool isSpeech) {
char name[13];
strcpy(name, base);
// alter filename to add zeros and append ".SB"
@@ -90,7 +95,8 @@ void Sound::playSfx(const char *base) {
name[i] = '0';
}
strcat(name, ".SB");
- sfxPlay(name);
+ waitFinished(isSpeech);
+ sfxPlay(name, isSpeech);
}
void Sound::playSong(int16 songNum) {
@@ -112,7 +118,7 @@ void Sound::playSong(int16 songNum) {
if (_tune[newTune].sfx[0]) {
if (sfxOn())
- playSfx(_tune[newTune].sfx[0]);
+ playSfx(_tune[newTune].sfx[0], false);
return;
}
@@ -148,30 +154,27 @@ void Sound::loadState(uint32 ver, byte *&ptr) {
}
-void SBSound::playSound(byte *sound, uint32 size) {
+void SBSound::playSound(byte *sound, uint32 size, bool isSpeech) {
byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE;
- _mixer->playRaw(&_sfxHandle, sound, size, 11025, flags);
+ _mixer->playRaw(isSpeech ? &_speechHandle : &_sfxHandle, sound, size, 11025, flags);
}
-void SBSound::sfxPlay(const char *name) {
- waitSfxFinished();
+void SBSound::sfxPlay(const char *name, bool isSpeech) {
if (_vm->resource()->fileExists(name))
- playSound(_vm->resource()->loadFileMalloc(name, SB_HEADER_SIZE), _vm->resource()->fileSize(name) - SB_HEADER_SIZE);
+ playSound(_vm->resource()->loadFileMalloc(name, SB_HEADER_SIZE), _vm->resource()->fileSize(name) - SB_HEADER_SIZE, isSpeech);
}
#ifdef USE_MAD
-void MP3Sound::sfxPlay(const char *name) {
- waitSfxFinished();
+void MP3Sound::sfxPlay(const char *name, bool isSpeech) {
if (_vm->resource()->fileExists(name))
- _mixer->playMP3(&_sfxHandle, _vm->resource()->giveCompressedSound(name), _vm->resource()->fileSize(name));
+ _mixer->playMP3(isSpeech ? &_speechHandle : &_sfxHandle, _vm->resource()->giveCompressedSound(name), _vm->resource()->fileSize(name));
}
#endif
#ifdef USE_VORBIS
-void OGGSound::sfxPlay(const char *name) {
- waitSfxFinished();
+void OGGSound::sfxPlay(const char *name, bool isSpeech) {
if (_vm->resource()->fileExists(name))
- _mixer->playVorbis(&_sfxHandle, _vm->resource()->giveCompressedSound(name), _vm->resource()->fileSize(name));
+ _mixer->playVorbis(isSpeech ? &_speechHandle : &_sfxHandle, _vm->resource()->giveCompressedSound(name), _vm->resource()->fileSize(name));
}
#endif