aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-12-23 19:18:20 +0000
committerMax Horn2003-12-23 19:18:20 +0000
commit3f77642948a824e6e198c93a455fbf3fbab7e507 (patch)
treef36217b85bc0533320a7ff44d485714d25407beb /scumm
parent43875b42fcefae5e0f009acd87407e8d545623c6 (diff)
downloadscummvm-rg350-3f77642948a824e6e198c93a455fbf3fbab7e507.tar.gz
scummvm-rg350-3f77642948a824e6e198c93a455fbf3fbab7e507.tar.bz2
scummvm-rg350-3f77642948a824e6e198c93a455fbf3fbab7e507.zip
Replace the DOTT/SAM hack (which ensures that only one SFX is being played at a time for them) with proper code: instead of hacking the sound handle, we assign a fake sound ID to the SFX, thus ensuring only one is playing at a time
svn-id: r11880
Diffstat (limited to 'scumm')
-rw-r--r--scumm/sound.cpp23
-rw-r--r--scumm/sound.h2
2 files changed, 10 insertions, 15 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index 789b3964a9..4f241dd340 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -432,9 +432,7 @@ void Sound::processSfxQueues() {
if (act != 0 && (uint) act < 0x80 && !_scumm->_string[0].no_talk_anim) {
a = _scumm->derefActor(act, "processSfxQueues");
if (a->isInCurrentRoom() && (finished || !_endOfMouthSync)) {
- b = true;
- if (!finished)
- b = isMouthSyncOff(_curSoundPos);
+ b = finished || isMouthSyncOff(_curSoundPos);
if (_mouthSyncMode != b) {
_mouthSyncMode = b;
if (_talk_sound_frame != -1) {
@@ -466,6 +464,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle
int num = 0, i;
int size;
byte *sound;
+ int id = -1;
if ((_scumm->_gameId == GID_DIG) && (_scumm->_features & GF_DEMO)) {
char filename[30];
@@ -534,14 +533,10 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle
// HACK: Checking for script 99 in Sam & Max is to keep Conroy's song
// from being interrupted.
- int talkChannel = (_talkChannelHandle - 1); // EVIL HACK!!!
if (mode == 1 && (_scumm->_gameId == GID_TENTACLE
|| (_scumm->_gameId == GID_SAMNMAX && !_scumm->isScriptRunning(99)))) {
- for (i = 0; i < SoundMixer::NUM_CHANNELS; i++) {
- if (i != talkChannel) {
- _scumm->_mixer->stopHandle(i+1); // EVIL HACK!!!!
- }
- }
+ id = 777777;
+ _scumm->_mixer->stopID(id);
}
if (b > 8) {
@@ -582,7 +577,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle
_curSoundPos = 0;
_mouthSyncMode = true;
- startSfxSound(_sfxFile, size, handle);
+ startSfxSound(_sfxFile, size, handle, id);
}
void Sound::stopTalkSound() {
@@ -825,7 +820,7 @@ void Sound::pauseSounds(bool pause) {
}
}
-void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle) {
+void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id) {
char ident[8];
uint size = 0;
int rate, comp;
@@ -837,11 +832,11 @@ void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle)
if (file_size > 0) {
if (_vorbis_mode) {
#ifdef USE_VORBIS
- _scumm->_mixer->playVorbis(handle, file, file_size);
+ _scumm->_mixer->playVorbis(handle, file, file_size, 255, 0, id);
#endif
} else {
#ifdef USE_MAD
- _scumm->_mixer->playMP3(handle, file, file_size);
+ _scumm->_mixer->playMP3(handle, file, file_size, 255, 0, id);
#endif
}
return;
@@ -887,7 +882,7 @@ void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle)
error("startSfxSound: cannot read %d bytes", size);
}
- _scumm->_mixer->playRaw(handle, data, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED);
+ _scumm->_mixer->playRaw(handle, data, size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, id);
}
File *Sound::openSfxFile() {
diff --git a/scumm/sound.h b/scumm/sound.h
index 1ac2d2c219..d41fc44a81 100644
--- a/scumm/sound.h
+++ b/scumm/sound.h
@@ -91,7 +91,7 @@ public:
protected:
File *openSfxFile();
- void startSfxSound(File *file, int file_size, PlayingSoundHandle *handle);
+ void startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id = -1);
bool isSfxFinished() const;
};