diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/scumm/sound.cpp | 13 | ||||
-rw-r--r-- | engines/sword2/music.cpp | 17 | ||||
-rw-r--r-- | engines/tinsel/sound.cpp | 14 |
3 files changed, 30 insertions, 14 deletions
diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index 85e8636e48..65c50aff14 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -634,31 +634,36 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle if (!_soundsPaused && _mixer->isReady()) { Audio::AudioStream *input = NULL; - Common::MemoryReadStream *tmp = NULL; switch (_soundMode) { case kMP3Mode: #ifdef USE_MAD + { assert(size > 0); - tmp = _sfxFile->readStream(size); + Common::MemoryReadStream *tmp = _sfxFile->readStream(size); assert(tmp); input = Audio::makeMP3Stream(tmp, DisposeAfterUse::YES); + } #endif break; case kVorbisMode: #ifdef USE_VORBIS + { assert(size > 0); - tmp = _sfxFile->readStream(size); + Common::MemoryReadStream *tmp = _sfxFile->readStream(size); assert(tmp); input = Audio::makeVorbisStream(tmp, DisposeAfterUse::YES); + } #endif break; case kFLACMode: #ifdef USE_FLAC + { assert(size > 0); - tmp = _sfxFile->readStream(size); + Common::MemoryReadStream *tmp = _sfxFile->readStream(size); assert(tmp); input = Audio::makeFLACStream(tmp, DisposeAfterUse::YES); + } #endif break; default: diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp index 72971e2876..a68baed097 100644 --- a/engines/sword2/music.cpp +++ b/engines/sword2/music.cpp @@ -188,8 +188,6 @@ static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, fh->file.seek(pos, SEEK_SET); - SafeSubReadStream *tmp = 0; - switch (fh->fileType) { case kCLUMode: if (Sword2Engine::isPsx()) @@ -197,19 +195,22 @@ static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, else return makeCLUStream(&fh->file, enc_len); #ifdef USE_MAD - case kMP3Mode: - tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len); + case kMP3Mode: { + SafeSubReadStream *tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len); return Audio::makeMP3Stream(tmp, DisposeAfterUse::YES); + } #endif #ifdef USE_VORBIS - case kVorbisMode: - tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len); + case kVorbisMode: { + SafeSubReadStream *tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len); return Audio::makeVorbisStream(tmp, DisposeAfterUse::YES); + } #endif #ifdef USE_FLAC - case kFLACMode: - tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len); + case kFLACMode: { + SafeSubReadStream *tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len); return Audio::makeFLACStream(tmp, DisposeAfterUse::YES); + } #endif default: return NULL; diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index bb0e251b52..ce2ed51d09 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -132,25 +132,35 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound //_vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic); _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, _vm->_config->_voiceVolume); - Common::MemoryReadStream *compressedStream = - new Common::MemoryReadStream(sampleBuf, sampleLen, DisposeAfterUse::YES); Audio::AudioStream *sampleStream = 0; // play it switch (_soundMode) { case kMP3Mode: #ifdef USE_MAD + { + Common::MemoryReadStream *compressedStream = + new Common::MemoryReadStream(sampleBuf, sampleLen, DisposeAfterUse::YES); sampleStream = Audio::makeMP3Stream(compressedStream, DisposeAfterUse::YES); + } #endif break; case kVorbisMode: #ifdef USE_VORBIS + { + Common::MemoryReadStream *compressedStream = + new Common::MemoryReadStream(sampleBuf, sampleLen, DisposeAfterUse::YES); sampleStream = Audio::makeVorbisStream(compressedStream, DisposeAfterUse::YES); + } #endif break; case kFLACMode: #ifdef USE_FLAC + { + Common::MemoryReadStream *compressedStream = + new Common::MemoryReadStream(sampleBuf, sampleLen, DisposeAfterUse::YES); sampleStream = Audio::makeFLACStream(compressedStream, DisposeAfterUse::YES); + } #endif break; default: |