mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-03 15:21:40 +00:00
AUDIO: Remove unused makeVOCStream interface.
This commit is contained in:
parent
90a11586e2
commit
221434a83f
@ -300,26 +300,6 @@ int parseVOCFormat(Common::SeekableReadStream& stream, RawStreamBlock* block, in
|
|||||||
return currentBlock;
|
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) {
|
SeekableAudioStream *makeVOCDiskStreamNoLoop(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse) {
|
||||||
const int MAX_AUDIO_BLOCKS = 256;
|
const int MAX_AUDIO_BLOCKS = 256;
|
||||||
|
|
||||||
@ -342,47 +322,6 @@ SeekableAudioStream *makeVOCDiskStreamNoLoop(Common::SeekableReadStream *stream,
|
|||||||
|
|
||||||
#endif
|
#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) {
|
SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse) {
|
||||||
#ifdef STREAM_AUDIO_FROM_DISK
|
#ifdef STREAM_AUDIO_FROM_DISK
|
||||||
return makeVOCDiskStreamNoLoop(stream, flags, disposeAfterUse);
|
return makeVOCDiskStreamNoLoop(stream, flags, disposeAfterUse);
|
||||||
|
@ -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
|
* 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
|
* 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!
|
* This does not use any of the looping features of VOC files!
|
||||||
*/
|
*/
|
||||||
SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse);
|
SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse);
|
||||||
|
@ -255,7 +255,7 @@ public:
|
|||||||
Audio::AudioStream *VocSound::makeAudioStream(uint sound) {
|
Audio::AudioStream *VocSound::makeAudioStream(uint sound) {
|
||||||
assert(_offsets);
|
assert(_offsets);
|
||||||
_file->seek(_offsets[sound], SEEK_SET);
|
_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) {
|
void VocSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, bool loop, int vol) {
|
||||||
|
@ -628,7 +628,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
input = Audio::makeVOCStream(_sfxFile, Audio::FLAG_UNSIGNED);
|
input = Audio::makeVOCStream(_sfxFile, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ void ToucheEngine::res_loadSound(int priority, int num) {
|
|||||||
uint32 size;
|
uint32 size;
|
||||||
const uint32 offs = res_getDataOffset(kResourceTypeSound, num, &size);
|
const uint32 offs = res_getDataOffset(kResourceTypeSound, num, &size);
|
||||||
_fData.seek(offs);
|
_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) {
|
if (stream) {
|
||||||
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, stream);
|
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, stream);
|
||||||
}
|
}
|
||||||
@ -649,7 +649,7 @@ void ToucheEngine::res_loadSpeechSegment(int num) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_fSpeech[i].seek(offs);
|
_fSpeech[i].seek(offs);
|
||||||
stream = Audio::makeVOCStream(&_fSpeech[i], Audio::FLAG_UNSIGNED);
|
stream = Audio::makeVOCStream(&_fSpeech[i], Audio::FLAG_UNSIGNED, DisposeAfterUse::NO);
|
||||||
} else {
|
} else {
|
||||||
if (num >= 750) {
|
if (num >= 750) {
|
||||||
num -= 750;
|
num -= 750;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user