diff options
author | Neil Millstone | 2009-08-13 21:46:41 +0000 |
---|---|---|
committer | Neil Millstone | 2009-08-13 21:46:41 +0000 |
commit | a135a7f9385b59b91d5a7f23fd8792ff36afb353 (patch) | |
tree | f1512bebeb41858db45580f666d42d0177178417 /engines | |
parent | 83216b1d17ff12104a917314a9888001c12fc3ee (diff) | |
download | scummvm-rg350-a135a7f9385b59b91d5a7f23fd8792ff36afb353.tar.gz scummvm-rg350-a135a7f9385b59b91d5a7f23fd8792ff36afb353.tar.bz2 scummvm-rg350-a135a7f9385b59b91d5a7f23fd8792ff36afb353.zip |
Allow VOCs to stream from disk. Disabled by default, use symbol STREAM_AUDIO_FROM_DISK to enable. See patch #2834001.
svn-id: r43357
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agos/sound.cpp | 17 | ||||
-rw-r--r-- | engines/kyra/sound.cpp | 5 |
2 files changed, 15 insertions, 7 deletions
diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp index d20c07a8c8..cdf28e98eb 100644 --- a/engines/agos/sound.cpp +++ b/engines/agos/sound.cpp @@ -133,8 +133,10 @@ public: }; class VocSound : public BaseSound { + byte _flags; public: - VocSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigEndian = false) : BaseSound(mixer, file, base, bigEndian) {} + VocSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigEndian = false) : BaseSound(mixer, file, base, bigEndian), _flags(0) {} + Audio::AudioStream *makeAudioStream(uint sound); void playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol = 0); }; @@ -255,14 +257,15 @@ void WavSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType typ _mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), -1, vol); } -void VocSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) { - if (_offsets == NULL) - return; - +Audio::AudioStream *VocSound::makeAudioStream(uint sound) { _file->seek(_offsets[sound], SEEK_SET); + return Audio::makeVOCStream(*_file, _flags); +} - Audio::AudioStream *stream = Audio::makeVOCStream(*_file, flags); - _mixer->playInputStream(type, handle, stream); +void VocSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) { + convertVolume(vol); + _flags = flags; + _mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), -1, vol); } void RawSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) { diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp index 4d42b1efb7..91945d91ee 100644 --- a/engines/kyra/sound.cpp +++ b/engines/kyra/sound.cpp @@ -235,10 +235,15 @@ namespace { // A simple wrapper to create VOC streams the way like creating MP3, OGG/Vorbis and FLAC streams. // Possible TODO: Think of making this complete and moving it to sound/voc.cpp ? Audio::AudioStream *makeVOCStream(Common::SeekableReadStream *stream, bool disposeAfterUse, uint32 startTime, uint32 duration, uint numLoops) { + +#ifdef STREAM_AUDIO_FROM_DISK + Audio::AudioStream *as = Audio::makeVOCStream(*stream, Audio::Mixer::FLAG_UNSIGNED, 0, 0, disposeAfterUse); +#else Audio::AudioStream *as = Audio::makeVOCStream(*stream, Audio::Mixer::FLAG_UNSIGNED); if (disposeAfterUse) delete stream; +#endif return as; } |