diff options
author | Gregory Montoir | 2004-08-06 17:01:58 +0000 |
---|---|---|
committer | Gregory Montoir | 2004-08-06 17:01:58 +0000 |
commit | 8b0e9502ec706cc82b05c216801ac0fd0a46d7fd (patch) | |
tree | 201a203c69f6285e8e91d4e00f3790721d5986ee /queen/sound.cpp | |
parent | a7b610b25b5035962e5ee27610e49c1a5d2e5172 (diff) | |
download | scummvm-rg350-8b0e9502ec706cc82b05c216801ac0fd0a46d7fd.tar.gz scummvm-rg350-8b0e9502ec706cc82b05c216801ac0fd0a46d7fd.tar.bz2 scummvm-rg350-8b0e9502ec706cc82b05c216801ac0fd0a46d7fd.zip |
cleanup and simplify Resource class a bit more
svn-id: r14488
Diffstat (limited to 'queen/sound.cpp')
-rw-r--r-- | queen/sound.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/queen/sound.cpp b/queen/sound.cpp index f560573045..602b03927f 100644 --- a/queen/sound.cpp +++ b/queen/sound.cpp @@ -176,28 +176,40 @@ void SBSound::playSound(byte *sound, uint32 size, bool isSpeech) { } 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, isSpeech); + if (_vm->resource()->fileExists(name)) { + uint32 size; + uint8 *buf = _vm->resource()->loadFile(name, SB_HEADER_SIZE, &size, true); + playSound(buf, size, isSpeech); + } } #ifdef USE_MAD void MP3Sound::sfxPlay(const char *name, bool isSpeech) { - if (_vm->resource()->fileExists(name)) - _mixer->playMP3(isSpeech ? &_speechHandle : &_sfxHandle, _vm->resource()->giveCompressedSound(name), _vm->resource()->fileSize(name)); + if (_vm->resource()->fileExists(name)) { + uint32 size; + File *f = _vm->resource()->giveCompressedSound(name, &size); + _mixer->playMP3(isSpeech ? &_speechHandle : &_sfxHandle, f, size); + } } #endif #ifdef USE_VORBIS void OGGSound::sfxPlay(const char *name, bool isSpeech) { - if (_vm->resource()->fileExists(name)) - _mixer->playVorbis(isSpeech ? &_speechHandle : &_sfxHandle, _vm->resource()->giveCompressedSound(name), _vm->resource()->fileSize(name)); + if (_vm->resource()->fileExists(name)) { + uint32 size; + File *f = _vm->resource()->giveCompressedSound(name, &size); + _mixer->playVorbis(isSpeech ? &_speechHandle : &_sfxHandle, f, size); + } } #endif #ifdef USE_FLAC void FLACSound::sfxPlay(const char *name, bool isSpeech) { - if (_vm->resource()->fileExists(name)) - _mixer->playFlac(isSpeech ? &_speechHandle : &_sfxHandle, _vm->resource()->giveCompressedSound(name), _vm->resource()->fileSize(name)); + if (_vm->resource()->fileExists(name)) { + uint32 size; + File *f = _vm->resource()->giveCompressedSound(name, &size); + _mixer->playFlac(isSpeech ? &_speechHandle : &_sfxHandle, f, size); + } } #endif |