Merge startSfxSound into startTalkSound

svn-id: r16338
This commit is contained in:
Max Horn 2004-12-27 16:24:49 +00:00
parent 1d44b0873f
commit bc3b3517b2
2 changed files with 38 additions and 43 deletions

View File

@ -732,8 +732,44 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, PlayingSoundHandle
_mouthSyncMode = true;
}
if (!_soundsPaused && _vm->_mixer->isReady())
startSfxSound(_sfxFile, size, handle, id);
if (!_soundsPaused && _vm->_mixer->isReady()) {
AudioStream *input = NULL;
switch (_soundMode) {
case kMP3Mode:
#ifdef USE_MAD
assert(size > 0);
input = makeMP3Stream(_sfxFile, size);
#endif
break;
case kVorbisMode:
#ifdef USE_VORBIS
assert(size > 0);
input = makeVorbisStream(_sfxFile, size);
#endif
break;
case kFlacMode:
#ifdef USE_FLAC
assert(size > 0);
input = makeFlacStream(_sfxFile, size);
#endif
break;
default:
input = makeVOCStream(*_sfxFile);
}
if (!input) {
warning("startSfxSound failed to load sound");
return;
}
if (_vm->_imuseDigital) {
//_vm->_imuseDigital->stopSound(kTalkSoundID);
_vm->_imuseDigital->startVoice(kTalkSoundID, input);
} else {
_vm->_mixer->playInputStream(SoundMixer::kSFXAudioDataType, handle, input, id);
}
}
}
void Sound::stopTalkSound() {
@ -993,46 +1029,6 @@ void Sound::pauseSounds(bool pause) {
}
}
void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id) {
AudioStream *input = NULL;
switch (_soundMode) {
case kMP3Mode:
#ifdef USE_MAD
assert(file_size > 0);
input = makeMP3Stream(file, file_size);
#endif
break;
case kVorbisMode:
#ifdef USE_VORBIS
assert(file_size > 0);
input = makeVorbisStream(file, file_size);
#endif
break;
case kFlacMode:
#ifdef USE_FLAC
assert(file_size > 0);
input = makeFlacStream(file, file_size);
#endif
break;
default:
input = makeVOCStream(*_sfxFile);
}
if (!input) {
warning("startSfxSound failed to load sound");
return;
}
if (_vm->_imuseDigital) {
//_vm->_imuseDigital->stopSound(kTalkSoundID);
_vm->_imuseDigital->startVoice(kTalkSoundID, input);
} else {
_vm->_mixer->playInputStream(SoundMixer::kSFXAudioDataType, handle, input, id);
}
}
ScummFile *Sound::openSfxFile() {
struct SoundFileExtensions {
const char *ext;

View File

@ -123,7 +123,6 @@ public:
protected:
ScummFile *openSfxFile();
void startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, int id = -1);
bool isSfxFinished() const;
void processSfxQueues();