From 221434a83f3bcddb7b1cff884027eaef1941bd99 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 9 Oct 2011 20:51:41 +0200 Subject: [PATCH] AUDIO: Remove unused makeVOCStream interface. --- audio/decoders/voc.cpp | 61 ------------------------------------- audio/decoders/voc.h | 7 +---- engines/agos/sound.cpp | 2 +- engines/scumm/sound.cpp | 2 +- engines/touche/resource.cpp | 4 +-- 5 files changed, 5 insertions(+), 71 deletions(-) diff --git a/audio/decoders/voc.cpp b/audio/decoders/voc.cpp index be53f945acb..c5023f8be6c 100644 --- a/audio/decoders/voc.cpp +++ b/audio/decoders/voc.cpp @@ -300,26 +300,6 @@ int parseVOCFormat(Common::SeekableReadStream& stream, RawStreamBlock* block, in return currentBlock; } -AudioStream *makeVOCDiskStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse) { - const int MAX_AUDIO_BLOCKS = 256; - - RawStreamBlock *block = new RawStreamBlock[MAX_AUDIO_BLOCKS]; - int rate, loops, begin_loop, end_loop; - - int numBlocks = parseVOCFormat(*stream, block, rate, loops, begin_loop, end_loop); - - AudioStream *audioStream = 0; - - // Create an audiostream from the data. Note the numBlocks may be 0, - // e.g. when invalid data is encountered. See bug #2890038. - if (numBlocks) - audioStream = makeRawDiskStream_OLD(stream, block, numBlocks, rate, flags, disposeAfterUse/*, begin_loop, end_loop*/); - - delete[] block; - - return audioStream; -} - SeekableAudioStream *makeVOCDiskStreamNoLoop(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse) { const int MAX_AUDIO_BLOCKS = 256; @@ -342,47 +322,6 @@ SeekableAudioStream *makeVOCDiskStreamNoLoop(Common::SeekableReadStream *stream, #endif - -AudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, uint loopStart, uint loopEnd, DisposeAfterUse::Flag disposeAfterUse) { -#ifdef STREAM_AUDIO_FROM_DISK - return makeVOCDiskStream(stream, flags, disposeAfterUse); -#else - int size, rate; - - byte *data = loadVOCFromStream(*stream, size, rate); - - if (!data) { - if (disposeAfterUse == DisposeAfterUse::YES) - delete stream; - return 0; - } - - SeekableAudioStream *s = Audio::makeRawStream(data, size, rate, flags); - - if (loopStart != loopEnd) { - const bool isStereo = (flags & Audio::FLAG_STEREO) != 0; - const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0; - - if (loopEnd == 0) - loopEnd = size; - assert(loopStart <= loopEnd); - assert(loopEnd <= (uint)size); - - // Verify the buffer sizes are sane - if (is16Bit && isStereo) - assert((loopStart & 3) == 0 && (loopEnd & 3) == 0); - else if (is16Bit || isStereo) - assert((loopStart & 1) == 0 && (loopEnd & 1) == 0); - - const uint32 extRate = s->getRate() * (is16Bit ? 2 : 1) * (isStereo ? 2 : 1); - - return new SubLoopingAudioStream(s, 0, Timestamp(0, loopStart, extRate), Timestamp(0, loopEnd, extRate)); - } else { - return s; - } -#endif -} - SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse) { #ifdef STREAM_AUDIO_FROM_DISK return makeVOCDiskStreamNoLoop(stream, flags, disposeAfterUse); diff --git a/audio/decoders/voc.h b/audio/decoders/voc.h index 8bc6dcf46f3..335a66e76dc 100644 --- a/audio/decoders/voc.h +++ b/audio/decoders/voc.h @@ -90,13 +90,8 @@ extern byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate) /** * Try to load a VOC from the given seekable stream and create an AudioStream * from that data. Currently this function only supports uncompressed raw PCM - * data. Optionally supports (infinite) looping of a portion of the data. + * data. * - * This function uses loadVOCFromStream() internally. - */ -AudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags = 0, uint loopStart = 0, uint loopEnd = 0, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::NO); - -/** * This does not use any of the looping features of VOC files! */ SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse); diff --git a/engines/agos/sound.cpp b/engines/agos/sound.cpp index 11a1cd792e7..91456887103 100644 --- a/engines/agos/sound.cpp +++ b/engines/agos/sound.cpp @@ -255,7 +255,7 @@ public: Audio::AudioStream *VocSound::makeAudioStream(uint sound) { assert(_offsets); _file->seek(_offsets[sound], SEEK_SET); - return Audio::makeVOCStream(_file.get(), _flags); + return Audio::makeVOCStream(_file.get(), _flags, DisposeAfterUse::NO); } void VocSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol) { diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index ba8c6e22770..1700e682f70 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -628,7 +628,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle #endif break; default: - input = Audio::makeVOCStream(_sfxFile, Audio::FLAG_UNSIGNED); + input = Audio::makeVOCStream(_sfxFile, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); break; } diff --git a/engines/touche/resource.cpp b/engines/touche/resource.cpp index 6df6fc0e5f1..d87f80157f0 100644 --- a/engines/touche/resource.cpp +++ b/engines/touche/resource.cpp @@ -591,7 +591,7 @@ void ToucheEngine::res_loadSound(int priority, int num) { uint32 size; const uint32 offs = res_getDataOffset(kResourceTypeSound, num, &size); _fData.seek(offs); - Audio::AudioStream *stream = Audio::makeVOCStream(&_fData, Audio::FLAG_UNSIGNED); + Audio::AudioStream *stream = Audio::makeVOCStream(&_fData, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); if (stream) { _mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, stream); } @@ -649,7 +649,7 @@ void ToucheEngine::res_loadSpeechSegment(int num) { return; } _fSpeech[i].seek(offs); - stream = Audio::makeVOCStream(&_fSpeech[i], Audio::FLAG_UNSIGNED); + stream = Audio::makeVOCStream(&_fSpeech[i], Audio::FLAG_UNSIGNED, DisposeAfterUse::NO); } else { if (num >= 750) { num -= 750;