diff options
author | Max Horn | 2007-07-15 19:24:00 +0000 |
---|---|---|
committer | Max Horn | 2007-07-15 19:24:00 +0000 |
commit | f4c0b853cc8453acac0c9e6f6901c0056a2288fa (patch) | |
tree | ce3b9d4a1a040fa14a19d90da2bf6d87ad459c68 | |
parent | 11b2806741da02dde2e2e4c1d5fa8ebb26d64233 (diff) | |
download | scummvm-rg350-f4c0b853cc8453acac0c9e6f6901c0056a2288fa.tar.gz scummvm-rg350-f4c0b853cc8453acac0c9e6f6901c0056a2288fa.tar.bz2 scummvm-rg350-f4c0b853cc8453acac0c9e6f6901c0056a2288fa.zip |
Fixed sound factory messup caused by my previous commit
svn-id: r28111
-rw-r--r-- | engines/agos/sound.cpp | 12 | ||||
-rw-r--r-- | engines/queen/sound.cpp | 12 | ||||
-rw-r--r-- | engines/saga/sound.cpp | 13 | ||||
-rw-r--r-- | engines/scumm/imuse_digi/dimuse_sndmgr.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/smush/smush_player.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/sound.cpp | 13 | ||||
-rw-r--r-- | engines/sword1/sound.cpp | 12 | ||||
-rw-r--r-- | engines/sword2/music.cpp | 14 |
8 files changed, 64 insertions, 22 deletions
diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp index 7165e3cbff..a735f54c29 100644 --- a/engines/agos/sound.cpp +++ b/engines/agos/sound.cpp @@ -292,7 +292,9 @@ Audio::AudioStream *MP3Sound::makeAudioStream(uint sound) { uint32 size = _offsets[sound + i] - _offsets[sound]; - return Audio::makeMP3Stream(_file, size); + Common::MemoryReadStream *tmp = _file->readStream(size); + assert(tmp); + return Audio::makeMP3Stream(tmp, true); } void MP3Sound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) { @@ -321,7 +323,9 @@ Audio::AudioStream *VorbisSound::makeAudioStream(uint sound) { uint32 size = _offsets[sound + i] - _offsets[sound]; - return Audio::makeVorbisStream(_file, size); + Common::MemoryReadStream *tmp = _file->readStream(size); + assert(tmp); + return Audio::makeVorbisStream(tmp, true); } void VorbisSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) { @@ -350,7 +354,9 @@ Audio::AudioStream *FlacSound::makeAudioStream(uint sound) { uint32 size = _offsets[sound + i] - _offsets[sound]; - return Audio::makeFlacStream(_file, size); + Common::MemoryReadStream *tmp = _file->readStream(size); + assert(tmp); + return Audio::makeFlacStream(tmp, true); } void FlacSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) { diff --git a/engines/queen/sound.cpp b/engines/queen/sound.cpp index 6184060132..a4cac2417e 100644 --- a/engines/queen/sound.cpp +++ b/engines/queen/sound.cpp @@ -67,7 +67,9 @@ public: MP3Sound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {} protected: void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) { - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(f, size)); + Common::MemoryReadStream *tmp = f->readStream(size); + assert(tmp); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(tmp, true)); } }; #endif @@ -78,7 +80,9 @@ public: OGGSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {} protected: void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) { - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(f, size)); + Common::MemoryReadStream *tmp = f->readStream(size); + assert(tmp); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(tmp, true)); } }; #endif @@ -89,7 +93,9 @@ public: FLACSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {} protected: void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) { - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(f, size)); + Common::MemoryReadStream *tmp = f->readStream(size); + assert(tmp); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(tmp, true)); } }; #endif // #ifdef USE_FLAC diff --git a/engines/saga/sound.cpp b/engines/saga/sound.cpp index 95b8c24a2f..621b3ed310 100644 --- a/engines/saga/sound.cpp +++ b/engines/saga/sound.cpp @@ -84,27 +84,34 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); } else { Audio::AudioStream *stream = NULL; + Common::MemoryReadStream *tmp = NULL; switch (buffer.soundType) { #ifdef USE_MAD case kSoundMP3: debug(1, "Playing MP3 compressed sound"); buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET); - stream = Audio::makeMP3Stream(buffer.soundFile, buffer.size); + tmp = buffer.soundFile->readStream(buffer.size); + assert(tmp); + stream = Audio::makeMP3Stream(tmp, true); break; #endif #ifdef USE_VORBIS case kSoundOGG: debug(1, "Playing OGG compressed sound"); buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET); - stream = Audio::makeVorbisStream(buffer.soundFile, buffer.size); + tmp = buffer.soundFile->readStream(buffer.size); + assert(tmp); + stream = Audio::makeVorbisStream(tmp, true); break; #endif #ifdef USE_FLAC case kSoundFLAC: debug(1, "Playing FLAC compressed sound"); buffer.soundFile->seek((long)buffer.fileOffset, SEEK_SET); - stream = Audio::makeFlacStream(buffer.soundFile, buffer.size); + tmp = buffer.soundFile->readStream(buffer.size); + assert(tmp); + stream = Audio::makeFlacStream(tmp, true); break; #endif default: diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index ce963eaeea..8340af3eb5 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -615,13 +615,15 @@ int32 ImuseDigiSndMgr::getDataFromRegion(soundStruct *soundHandle, int region, b oggMode = true; } if (!soundHandle->compressedStream) { + Common::MemoryReadStream *tmp = cmpFile->readStream(len); + assert(tmp); #ifdef USE_VORBIS if (oggMode) - soundHandle->compressedStream = Audio::makeVorbisStream(cmpFile, len); + soundHandle->compressedStream = Audio::makeVorbisStream(tmp, true); #endif #ifdef USE_MAD if (!oggMode) - soundHandle->compressedStream = Audio::makeMP3Stream(cmpFile, len); + soundHandle->compressedStream = Audio::makeMP3Stream(tmp, true); #endif assert(soundHandle->compressedStream); } diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index 2c744a16e2..e7663c61c1 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -1183,7 +1183,7 @@ void SmushPlayer::tryCmpFile(const char *filename) { strcpy(fname + (i - filename), ".ogg"); if (file->open(fname)) { _compressedFileMode = true; - _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeVorbisStream(file, true, 0, 0)); + _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeVorbisStream(file, true)); return; } #endif @@ -1192,7 +1192,7 @@ void SmushPlayer::tryCmpFile(const char *filename) { strcpy(fname + (i - filename), ".mp3"); if (file->open(fname)) { _compressedFileMode = true; - _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeMP3Stream(file, true, 0, 0)); + _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeMP3Stream(file, true)); return; } #endif diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index e5720a013f..c42d9adf45 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -607,24 +607,31 @@ 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); - input = Audio::makeMP3Stream(_sfxFile, size); + tmp = _sfxFile->readStream(size); + assert(tmp); + input = Audio::makeMP3Stream(tmp, true); #endif break; case kVorbisMode: #ifdef USE_VORBIS assert(size > 0); - input = Audio::makeVorbisStream(_sfxFile, size); + tmp = _sfxFile->readStream(size); + assert(tmp); + input = Audio::makeVorbisStream(tmp, true); #endif break; case kFlacMode: #ifdef USE_FLAC assert(size > 0); - input = Audio::makeFlacStream(_sfxFile, size); + tmp = _sfxFile->readStream(size); + assert(tmp); + input = Audio::makeFlacStream(tmp, true); #endif break; default: diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index 492672fad8..2594aaf8f4 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -201,7 +201,9 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { #ifdef USE_FLAC else if (_cowMode == CowFlac) { _cowFile.seek(index); - _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeFlacStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan); + Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize); + assert(tmp); + _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeFlacStream(tmp, true), SOUND_SPEECH_ID, speechVol, speechPan); // with compressed audio, we can't calculate the wave volume. // so default to talking. for (int cnt = 0; cnt < 480; cnt++) @@ -212,7 +214,9 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { #ifdef USE_VORBIS else if (_cowMode == CowVorbis) { _cowFile.seek(index); - _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeVorbisStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan); + Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize); + assert(tmp); + _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeVorbisStream(tmp, true), SOUND_SPEECH_ID, speechVol, speechPan); // with compressed audio, we can't calculate the wave volume. // so default to talking. for (int cnt = 0; cnt < 480; cnt++) @@ -223,7 +227,9 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { #ifdef USE_MAD else if (_cowMode == CowMp3) { _cowFile.seek(index); - _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan); + Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize); + assert(tmp); + _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(tmp, true), SOUND_SPEECH_ID, speechVol, speechPan); // with compressed audio, we can't calculate the wave volume. // so default to talking. for (int cnt = 0; cnt < 480; cnt++) diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp index 28427e5d1b..b442b6194f 100644 --- a/engines/sword2/music.cpp +++ b/engines/sword2/music.cpp @@ -139,21 +139,29 @@ static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, } fh->file.seek(pos, SEEK_SET); + + Common::MemoryReadStream *tmp = 0; switch (fh->fileType) { case kCLUMode: return makeCLUStream(&fh->file, enc_len); #ifdef USE_MAD case kMP3Mode: - return Audio::makeMP3Stream(&fh->file, enc_len); + tmp = fh->file.readStream(enc_len); + assert(tmp); + return Audio::makeMP3Stream(tmp, true); #endif #ifdef USE_VORBIS case kVorbisMode: - return Audio::makeVorbisStream(&fh->file, enc_len); + tmp = fh->file.readStream(enc_len); + assert(tmp); + return Audio::makeVorbisStream(tmp, true); #endif #ifdef USE_FLAC case kFlacMode: - return Audio::makeFlacStream(&fh->file, enc_len); + tmp = fh->file.readStream(enc_len); + assert(tmp); + return Audio::makeFlacStream(tmp, true); #endif default: return NULL; |