[Scummvm-cvs-logs] SF.net SVN: scummvm:[47334] scummvm/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Jan 16 22:36:08 CET 2010
Revision: 47334
http://scummvm.svn.sourceforge.net/scummvm/?rev=47334&view=rev
Author: fingolfin
Date: 2010-01-16 21:36:08 +0000 (Sat, 16 Jan 2010)
Log Message:
-----------
Switch most AudioStream factories to use DisposeAfterUse::Flag
Modified Paths:
--------------
scummvm/trunk/engines/agos/animation.cpp
scummvm/trunk/engines/agos/sound.cpp
scummvm/trunk/engines/kyra/sound.cpp
scummvm/trunk/engines/kyra/sound.h
scummvm/trunk/engines/kyra/sound_digital.cpp
scummvm/trunk/engines/mohawk/sound.cpp
scummvm/trunk/engines/queen/sound.cpp
scummvm/trunk/engines/saga/music.cpp
scummvm/trunk/engines/saga/sound.cpp
scummvm/trunk/engines/sci/sound/audio.cpp
scummvm/trunk/engines/sci/sound/music.cpp
scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
scummvm/trunk/engines/scumm/smush/smush_player.cpp
scummvm/trunk/engines/scumm/sound.cpp
scummvm/trunk/engines/sword1/music.cpp
scummvm/trunk/engines/sword1/sound.cpp
scummvm/trunk/engines/sword2/music.cpp
scummvm/trunk/engines/sword2/sound.cpp
scummvm/trunk/engines/tinsel/sound.cpp
scummvm/trunk/engines/touche/resource.cpp
scummvm/trunk/engines/tucker/resource.cpp
scummvm/trunk/engines/tucker/sequences.cpp
scummvm/trunk/sound/audiostream.cpp
scummvm/trunk/sound/audiostream.h
scummvm/trunk/sound/flac.cpp
scummvm/trunk/sound/flac.h
scummvm/trunk/sound/mp3.cpp
scummvm/trunk/sound/mp3.h
scummvm/trunk/sound/voc.cpp
scummvm/trunk/sound/voc.h
scummvm/trunk/sound/vorbis.cpp
scummvm/trunk/sound/vorbis.h
scummvm/trunk/sound/wave.cpp
scummvm/trunk/sound/wave.h
Modified: scummvm/trunk/engines/agos/animation.cpp
===================================================================
--- scummvm/trunk/engines/agos/animation.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/agos/animation.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -302,10 +302,10 @@
size = in.readUint32LE();
in.seek(offset, SEEK_SET);
- _bgSoundStream = Audio::makeWAVStream(in.readStream(size), true);
+ _bgSoundStream = Audio::makeWAVStream(in.readStream(size), DisposeAfterUse::YES);
in.close();
} else {
- _bgSoundStream = Audio::makeWAVStream(_fileStream->readStream(size), true);
+ _bgSoundStream = Audio::makeWAVStream(_fileStream->readStream(size), DisposeAfterUse::YES);
}
} else {
_bgSoundStream = Audio::SeekableAudioStream::openStreamFile(baseName);
Modified: scummvm/trunk/engines/agos/sound.cpp
===================================================================
--- scummvm/trunk/engines/agos/sound.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/agos/sound.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -248,7 +248,7 @@
return NULL;
_file->seek(_offsets[sound], SEEK_SET);
- return Audio::makeWAVStream(_file, false);
+ return Audio::makeWAVStream(_file, DisposeAfterUse::NO);
}
void WavSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
@@ -302,7 +302,7 @@
Common::MemoryReadStream *tmp = _file->readStream(size);
assert(tmp);
- return Audio::makeMP3Stream(tmp, true);
+ return Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
}
void MP3Sound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
@@ -333,7 +333,7 @@
Common::MemoryReadStream *tmp = _file->readStream(size);
assert(tmp);
- return Audio::makeVorbisStream(tmp, true);
+ return Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
}
void VorbisSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
@@ -364,7 +364,7 @@
Common::MemoryReadStream *tmp = _file->readStream(size);
assert(tmp);
- return Audio::makeFlacStream(tmp, true);
+ return Audio::makeFlacStream(tmp, DisposeAfterUse::YES);
}
void FlacSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
@@ -783,7 +783,7 @@
void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint sound, int pan, int vol, bool loop) {
int size = READ_LE_UINT32(soundData + 4);
Common::MemoryReadStream *stream = new Common::MemoryReadStream(soundData, size);
- Audio::RewindableAudioStream *sndStream = Audio::makeWAVStream(stream, true);
+ Audio::RewindableAudioStream *sndStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
convertVolume(vol);
convertPan(pan);
Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/kyra/sound.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -97,7 +97,7 @@
if (!stream)
continue;
- audioStream = _supportedCodecs[i].streamFunc(stream, true);
+ audioStream = _supportedCodecs[i].streamFunc(stream, DisposeAfterUse::YES);
break;
}
@@ -241,12 +241,12 @@
// 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::SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, bool disposeAfterUse) {
+Audio::SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
#ifdef STREAM_AUDIO_FROM_DISK
Audio::SeekableAudioStream *as = Audio::makeVOCStream(*stream, Audio::Mixer::FLAG_UNSIGNED, disposeAfterUse);
#else
- Audio::SeekableAudioStream *as = Audio::makeVOCStream(*stream, Audio::Mixer::FLAG_UNSIGNED, false);
+ Audio::SeekableAudioStream *as = Audio::makeVOCStream(*stream, Audio::Mixer::FLAG_UNSIGNED, DisposeAfterUse::NO);
if (disposeAfterUse)
delete stream;
Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/kyra/sound.h 2010-01-16 21:36:08 UTC (rev 47334)
@@ -243,7 +243,7 @@
const char *fileext;
Audio::SeekableAudioStream *(*streamFunc)(
Common::SeekableReadStream *stream,
- bool disposeAfterUse);
+ DisposeAfterUse::Flag disposeAfterUse);
};
static const SpeechCodecs _supportedCodecs[];
@@ -358,7 +358,7 @@
const char *fileext;
Audio::SeekableAudioStream *(*streamFunc)(
Common::SeekableReadStream *stream,
- bool disposeAfterUse);
+ DisposeAfterUse::Flag disposeAfterUse);
};
static const AudioCodecs _supportedCodecs[];
Modified: scummvm/trunk/engines/kyra/sound_digital.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_digital.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/kyra/sound_digital.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -460,7 +460,7 @@
strncpy(use->filename, filename, sizeof(use->filename));
use->priority = priority;
- Audio::SeekableAudioStream *audioStream = _supportedCodecs[usedCodec].streamFunc(stream, true);
+ Audio::SeekableAudioStream *audioStream = _supportedCodecs[usedCodec].streamFunc(stream, DisposeAfterUse::YES);
if (!audioStream) {
warning("Couldn't create audio stream for file '%s'", filename);
return -1;
@@ -522,7 +522,7 @@
namespace {
-Audio::SeekableAudioStream *makeAUDStream(Common::SeekableReadStream *stream, bool disposeAfterUse) {
+Audio::SeekableAudioStream *makeAUDStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
return new AUDStream(stream);
}
Modified: scummvm/trunk/engines/mohawk/sound.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/sound.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/mohawk/sound.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -108,7 +108,7 @@
delete mjmpStream;
}
- audStream = Audio::makeWAVStream(_vm->getRawData(ID_MSND, id), true);
+ audStream = Audio::makeWAVStream(_vm->getRawData(ID_MSND, id), DisposeAfterUse::YES);
} else
audStream = makeMohawkWaveStream(_vm->getRawData(ID_MSND, id));
break;
@@ -448,7 +448,7 @@
} else if (data_chunk.encoding == kCodecMPEG2) {
#ifdef USE_MAD
Common::MemoryReadStream *dataStream = new Common::MemoryReadStream(data_chunk.audio_data, data_chunk.size, DisposeAfterUse::YES);
- return Audio::makeLoopingAudioStream(Audio::makeMP3Stream(dataStream, true), loop ? 0 : 1);
+ return Audio::makeLoopingAudioStream(Audio::makeMP3Stream(dataStream, DisposeAfterUse::YES), loop ? 0 : 1);
#else
warning ("MAD library not included - unable to play MP2 audio");
#endif
Modified: scummvm/trunk/engines/queen/sound.cpp
===================================================================
--- scummvm/trunk/engines/queen/sound.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/queen/sound.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -120,7 +120,7 @@
void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
Common::MemoryReadStream *tmp = f->readStream(size);
assert(tmp);
- _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeMP3Stream(tmp, true)));
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeMP3Stream(tmp, DisposeAfterUse::YES)));
}
};
#endif
@@ -133,7 +133,7 @@
void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
Common::MemoryReadStream *tmp = f->readStream(size);
assert(tmp);
- _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeVorbisStream(tmp, true)));
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeVorbisStream(tmp, DisposeAfterUse::YES)));
}
};
#endif
@@ -146,7 +146,7 @@
void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
Common::MemoryReadStream *tmp = f->readStream(size);
assert(tmp);
- _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeFlacStream(tmp, true)));
+ _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeFlacStream(tmp, DisposeAfterUse::YES)));
}
};
#endif // #ifdef USE_FLAC
Modified: scummvm/trunk/engines/saga/music.cpp
===================================================================
--- scummvm/trunk/engines/saga/music.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/saga/music.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -308,7 +308,7 @@
Audio::LinearDiskStreamAudioBlock audioBlocks[1];
audioBlocks[0].pos = 0;
audioBlocks[0].len = resData->size / 2; // 16-bit sound
- audioStream = Audio::makeLinearDiskStream(musicStream, audioBlocks, 1, 11025, musicFlags, true);
+ audioStream = Audio::makeLinearDiskStream(musicStream, audioBlocks, 1, 11025, musicFlags, DisposeAfterUse::YES);
} else {
// Read compressed header to determine compression type
musicFile->seek((uint32)resData->offset, SEEK_SET);
@@ -316,15 +316,15 @@
if (identifier == 0) { // MP3
#ifdef USE_MAD
- audioStream = Audio::makeMP3Stream(musicStream, true);
+ audioStream = Audio::makeMP3Stream(musicStream, DisposeAfterUse::YES);
#endif
} else if (identifier == 1) { // OGG
#ifdef USE_VORBIS
- audioStream = Audio::makeVorbisStream(musicStream, true);
+ audioStream = Audio::makeVorbisStream(musicStream, DisposeAfterUse::YES);
#endif
} else if (identifier == 2) { // FLAC
#ifdef USE_FLAC
- audioStream = Audio::makeFlacStream(musicStream, true);
+ audioStream = Audio::makeFlacStream(musicStream, DisposeAfterUse::YES);
#endif
}
}
Modified: scummvm/trunk/engines/saga/sound.cpp
===================================================================
--- scummvm/trunk/engines/saga/sound.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/saga/sound.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -83,17 +83,17 @@
switch (buffer.soundType) {
#ifdef USE_MAD
case kSoundMP3:
- stream = Audio::makeMP3Stream(new Common::MemoryReadStream(buffer.buffer, buffer.size, DisposeAfterUse::YES), true);
+ stream = Audio::makeMP3Stream(new Common::MemoryReadStream(buffer.buffer, buffer.size, DisposeAfterUse::YES), DisposeAfterUse::YES);
break;
#endif
#ifdef USE_VORBIS
case kSoundOGG:
- stream = Audio::makeVorbisStream(new Common::MemoryReadStream(buffer.buffer, buffer.size, DisposeAfterUse::YES), true);
+ stream = Audio::makeVorbisStream(new Common::MemoryReadStream(buffer.buffer, buffer.size, DisposeAfterUse::YES), DisposeAfterUse::YES);
break;
#endif
#ifdef USE_FLAC
case kSoundFLAC:
- stream = Audio::makeFlacStream(new Common::MemoryReadStream(buffer.buffer, buffer.size, DisposeAfterUse::YES), true);
+ stream = Audio::makeFlacStream(new Common::MemoryReadStream(buffer.buffer, buffer.size, DisposeAfterUse::YES), DisposeAfterUse::YES);
break;
#endif
default:
Modified: scummvm/trunk/engines/sci/sound/audio.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/audio.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/sci/sound/audio.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -230,7 +230,7 @@
if (memcmp(audioRes->data, "RIFF", 4) == 0) {
// WAVE detected
Common::MemoryReadStream *waveStream = new Common::MemoryReadStream(audioRes->data, audioRes->size, DisposeAfterUse::NO);
- audioStream = Audio::makeWAVStream(waveStream, true);
+ audioStream = Audio::makeWAVStream(waveStream, DisposeAfterUse::YES);
}
}
if (!audioStream) {
Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/sci/sound/music.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -228,7 +228,7 @@
if (pSnd->pStreamAud && !_pMixer->isSoundHandleActive(pSnd->hCurrentAud)) {
if (pSnd->loop > 1) {
pSnd->pLoopStream = new Audio::LoopingAudioStream(pSnd->pStreamAud,
- pSnd->loop, false
+ pSnd->loop, DisposeAfterUse::NO
);
_pMixer->playInputStream(pSnd->soundType, &pSnd->hCurrentAud,
pSnd->pLoopStream, -1, pSnd->volume, 0,
Modified: scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp
===================================================================
--- scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/scumm/imuse_digi/dimuse_sndmgr.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -704,15 +704,15 @@
assert(tmp);
#ifdef USE_FLAC
if (soundMode == 3)
- soundDesc->compressedStream = Audio::makeFlacStream(tmp, true);
+ soundDesc->compressedStream = Audio::makeFlacStream(tmp, DisposeAfterUse::YES);
#endif
#ifdef USE_VORBIS
if (soundMode == 2)
- soundDesc->compressedStream = Audio::makeVorbisStream(tmp, true);
+ soundDesc->compressedStream = Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
#endif
#ifdef USE_MAD
if (soundMode == 1)
- soundDesc->compressedStream = Audio::makeMP3Stream(tmp, true);
+ soundDesc->compressedStream = Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
#endif
assert(soundDesc->compressedStream);
soundDesc->compressedStream->seek(offsetMs);
Modified: scummvm/trunk/engines/scumm/smush/smush_player.cpp
===================================================================
--- scummvm/trunk/engines/scumm/smush/smush_player.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/scumm/smush/smush_player.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -1110,7 +1110,7 @@
strcpy(fname + (i - filename), ".ogg");
if (file->open(fname)) {
_compressedFileMode = true;
- _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeVorbisStream(file, true));
+ _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeVorbisStream(file, DisposeAfterUse::YES));
return;
}
#endif
@@ -1119,7 +1119,7 @@
strcpy(fname + (i - filename), ".mp3");
if (file->open(fname)) {
_compressedFileMode = true;
- _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeMP3Stream(file, true));
+ _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeMP3Stream(file, DisposeAfterUse::YES));
return;
}
#endif
Modified: scummvm/trunk/engines/scumm/sound.cpp
===================================================================
--- scummvm/trunk/engines/scumm/sound.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/scumm/sound.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -632,7 +632,7 @@
assert(size > 0);
tmp = _sfxFile->readStream(size);
assert(tmp);
- input = Audio::makeMP3Stream(tmp, true);
+ input = Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
#endif
break;
case kVorbisMode:
@@ -640,7 +640,7 @@
assert(size > 0);
tmp = _sfxFile->readStream(size);
assert(tmp);
- input = Audio::makeVorbisStream(tmp, true);
+ input = Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
#endif
break;
case kFlacMode:
@@ -648,7 +648,7 @@
assert(size > 0);
tmp = _sfxFile->readStream(size);
assert(tmp);
- input = Audio::makeFlacStream(tmp, true);
+ input = Audio::makeFlacStream(tmp, DisposeAfterUse::YES);
#endif
break;
default:
Modified: scummvm/trunk/engines/sword1/music.cpp
===================================================================
--- scummvm/trunk/engines/sword1/music.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/sword1/music.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -62,7 +62,7 @@
if (!_audioSource) {
sprintf(fileName, "%s.flac", fileBase);
if (_file.open(fileName)) {
- _audioSource = Audio::makeLoopingAudioStream(Audio::makeFlacStream(&_file, false), loop ? 0 : 1);
+ _audioSource = Audio::makeLoopingAudioStream(Audio::makeFlacStream(&_file, DisposeAfterUse::NO), loop ? 0 : 1);
if (!_audioSource)
_file.close();
}
@@ -71,7 +71,7 @@
if (!_audioSource) {
sprintf(fileName, "%s.fla", fileBase);
if (_file.open(fileName)) {
- _audioSource = Audio::makeLoopingAudioStream(Audio::makeFlacStream(&_file, false), loop ? 0 : 1);
+ _audioSource = Audio::makeLoopingAudioStream(Audio::makeFlacStream(&_file, DisposeAfterUse::NO), loop ? 0 : 1);
if (!_audioSource)
_file.close();
}
@@ -81,7 +81,7 @@
if (!_audioSource) {
sprintf(fileName, "%s.ogg", fileBase);
if (_file.open(fileName)) {
- _audioSource = Audio::makeLoopingAudioStream(Audio::makeVorbisStream(&_file, false), loop ? 0 : 1);
+ _audioSource = Audio::makeLoopingAudioStream(Audio::makeVorbisStream(&_file, DisposeAfterUse::NO), loop ? 0 : 1);
if (!_audioSource)
_file.close();
}
@@ -91,7 +91,7 @@
if (!_audioSource) {
sprintf(fileName, "%s.mp3", fileBase);
if (_file.open(fileName)) {
- _audioSource = Audio::makeLoopingAudioStream(Audio::makeMP3Stream(&_file, false), loop ? 0 : 1);
+ _audioSource = Audio::makeLoopingAudioStream(Audio::makeMP3Stream(&_file, DisposeAfterUse::NO), loop ? 0 : 1);
if (!_audioSource)
_file.close();
}
@@ -100,7 +100,7 @@
if (!_audioSource) {
sprintf(fileName, "%s.wav", fileBase);
if (_file.open(fileName))
- _audioSource = Audio::makeLoopingAudioStream(Audio::makeWAVStream(&_file, false), loop ? 0 : 1);
+ _audioSource = Audio::makeLoopingAudioStream(Audio::makeWAVStream(&_file, DisposeAfterUse::NO), loop ? 0 : 1);
}
if (!_audioSource) {
Modified: scummvm/trunk/engines/sword1/sound.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sound.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/sword1/sound.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -371,7 +371,7 @@
_cowFile.seek(index);
Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
assert(tmp);
- _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeFlacStream(tmp, true), SOUND_SPEECH_ID, speechVol, speechPan);
+ _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeFlacStream(tmp, DisposeAfterUse::YES), 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++)
@@ -384,7 +384,7 @@
_cowFile.seek(index);
Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
assert(tmp);
- _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeVorbisStream(tmp, true), SOUND_SPEECH_ID, speechVol, speechPan);
+ _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeVorbisStream(tmp, DisposeAfterUse::YES), 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++)
@@ -397,7 +397,7 @@
_cowFile.seek(index);
Common::MemoryReadStream *tmp = _cowFile.readStream(sampleSize);
assert(tmp);
- _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(tmp, true), SOUND_SPEECH_ID, speechVol, speechPan);
+ _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, Audio::makeMP3Stream(tmp, DisposeAfterUse::YES), 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++)
Modified: scummvm/trunk/engines/sword2/music.cpp
===================================================================
--- scummvm/trunk/engines/sword2/music.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/sword2/music.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -199,17 +199,17 @@
#ifdef USE_MAD
case kMP3Mode:
tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len);
- return Audio::makeMP3Stream(tmp, true);
+ return Audio::makeMP3Stream(tmp, DisposeAfterUse::YES);
#endif
#ifdef USE_VORBIS
case kVorbisMode:
tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len);
- return Audio::makeVorbisStream(tmp, true);
+ return Audio::makeVorbisStream(tmp, DisposeAfterUse::YES);
#endif
#ifdef USE_FLAC
case kFlacMode:
tmp = new SafeSubReadStream(&fh->file, pos, pos + enc_len);
- return Audio::makeFlacStream(tmp, true);
+ return Audio::makeFlacStream(tmp, DisposeAfterUse::YES);
#endif
default:
return NULL;
Modified: scummvm/trunk/engines/sword2/sound.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sound.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/sword2/sound.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -336,7 +336,7 @@
if (Sword2Engine::isPsx())
input = new Audio::VagStream(stream);
else
- input = Audio::makeWAVStream(stream, true);
+ input = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
assert(input);
Modified: scummvm/trunk/engines/tinsel/sound.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/sound.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/tinsel/sound.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -139,17 +139,17 @@
switch (_soundMode) {
case kMP3Mode:
#ifdef USE_MAD
- sampleStream = Audio::makeMP3Stream(compressedStream, true);
+ sampleStream = Audio::makeMP3Stream(compressedStream, DisposeAfterUse::YES);
#endif
break;
case kVorbisMode:
#ifdef USE_VORBIS
- sampleStream = Audio::makeVorbisStream(compressedStream, true);
+ sampleStream = Audio::makeVorbisStream(compressedStream, DisposeAfterUse::YES);
#endif
break;
case kFlacMode:
#ifdef USE_FLAC
- sampleStream = Audio::makeFlacStream(compressedStream, true);
+ sampleStream = Audio::makeFlacStream(compressedStream, DisposeAfterUse::YES);
#endif
break;
default:
@@ -289,21 +289,21 @@
switch (_soundMode) {
case kMP3Mode:
#ifdef USE_MAD
- sampleStream = Audio::makeMP3Stream(compressedStream, true);
+ sampleStream = Audio::makeMP3Stream(compressedStream, DisposeAfterUse::YES);
#endif
break;
case kVorbisMode:
#ifdef USE_VORBIS
- sampleStream = Audio::makeVorbisStream(compressedStream, true);
+ sampleStream = Audio::makeVorbisStream(compressedStream, DisposeAfterUse::YES);
#endif
break;
case kFlacMode:
#ifdef USE_FLAC
- sampleStream = Audio::makeFlacStream(compressedStream, true);
+ sampleStream = Audio::makeFlacStream(compressedStream, DisposeAfterUse::YES);
#endif
break;
default:
- sampleStream = Audio::makeADPCMStream(compressedStream, true, sampleLen, Audio::kADPCMTinsel6, 22050, 1, 24);
+ sampleStream = Audio::makeADPCMStream(compressedStream, DisposeAfterUse::YES, sampleLen, Audio::kADPCMTinsel6, 22050, 1, 24);
break;
}
Modified: scummvm/trunk/engines/touche/resource.cpp
===================================================================
--- scummvm/trunk/engines/touche/resource.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/touche/resource.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -47,7 +47,7 @@
const char *filename;
Audio::SeekableAudioStream *(*makeStream)(
Common::SeekableReadStream *stream,
- bool disposeAfterUse);
+ DisposeAfterUse::Flag disposeAfterUse);
};
static const CompressedSpeechFile compressedSpeechFilesTable[] = {
@@ -667,7 +667,7 @@
_fSpeech[0].seek(offs);
Common::MemoryReadStream *tmp = _fSpeech[0].readStream(size);
if (tmp)
- stream = (compressedSpeechFilesTable[_compressedSpeechData].makeStream)(tmp, true);
+ stream = (compressedSpeechFilesTable[_compressedSpeechData].makeStream)(tmp, DisposeAfterUse::YES);
}
if (stream) {
_speechPlaying = true;
Modified: scummvm/trunk/engines/tucker/resource.cpp
===================================================================
--- scummvm/trunk/engines/tucker/resource.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/tucker/resource.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -43,7 +43,7 @@
struct CompressedSoundFile {
const char *filename;
- Audio::SeekableAudioStream *(*makeStream)(Common::SeekableReadStream *stream, bool disposeAfterUse);
+ Audio::SeekableAudioStream *(*makeStream)(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse);
};
static const CompressedSoundFile compressedSoundFilesTable[] = {
@@ -270,7 +270,7 @@
_fCompressedSound.seek(dirOffset + dirSize * 8 + soundOffset);
Common::MemoryReadStream *tmp = _fCompressedSound.readStream(soundSize);
if (tmp) {
- stream = (compressedSoundFilesTable[_compressedSoundType].makeStream)(tmp, true);
+ stream = (compressedSoundFilesTable[_compressedSoundType].makeStream)(tmp, DisposeAfterUse::YES);
}
}
}
@@ -946,7 +946,7 @@
snprintf(fileName, sizeof(fileName), fmt, num);
Common::File *f = new Common::File;
if (f->open(fileName)) {
- stream = Audio::makeWAVStream(f, true);
+ stream = Audio::makeWAVStream(f, DisposeAfterUse::YES);
} else {
delete f;
}
Modified: scummvm/trunk/engines/tucker/sequences.cpp
===================================================================
--- scummvm/trunk/engines/tucker/sequences.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/engines/tucker/sequences.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -603,7 +603,7 @@
}
break;
case kAnimationSoundTypeWAV:
- stream = Audio::makeWAVStream(&f, false);
+ stream = Audio::makeWAVStream(&f, DisposeAfterUse::NO);
break;
}
Modified: scummvm/trunk/sound/audiostream.cpp
===================================================================
--- scummvm/trunk/sound/audiostream.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/sound/audiostream.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -55,7 +55,7 @@
* Pointer to a function which tries to open a file of type StreamFormat.
* Return NULL in case of an error (invalid/nonexisting file).
*/
- SeekableAudioStream *(*openStreamFile)(Common::SeekableReadStream *stream, bool disposeAfterUse);
+ SeekableAudioStream *(*openStreamFile)(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse);
};
static const StreamFileFormat STREAM_FILEFORMATS[] = {
@@ -83,7 +83,7 @@
fileHandle->open(filename);
if (fileHandle->isOpen()) {
// Create the stream object
- stream = STREAM_FILEFORMATS[i].openStreamFile(fileHandle, true);
+ stream = STREAM_FILEFORMATS[i].openStreamFile(fileHandle, DisposeAfterUse::YES);
fileHandle = 0;
break;
}
@@ -102,12 +102,12 @@
#pragma mark --- LoopingAudioStream ---
#pragma mark -
-LoopingAudioStream::LoopingAudioStream(RewindableAudioStream *stream, uint loops, bool disposeAfterUse)
+LoopingAudioStream::LoopingAudioStream(RewindableAudioStream *stream, uint loops, DisposeAfterUse::Flag disposeAfterUse)
: _parent(stream), _disposeAfterUse(disposeAfterUse), _loops(loops), _completeIterations(0) {
}
LoopingAudioStream::~LoopingAudioStream() {
- if (_disposeAfterUse)
+ if (_disposeAfterUse == DisposeAfterUse::YES)
delete _parent;
}
@@ -169,7 +169,7 @@
uint loops,
const Timestamp loopStart,
const Timestamp loopEnd,
- bool disposeAfterUse)
+ DisposeAfterUse::Flag disposeAfterUse)
: _parent(stream), _disposeAfterUse(disposeAfterUse), _loops(loops),
_pos(0, getRate() * (isStereo() ? 2 : 1)),
_loopStart(loopStart.convertToFramerate(getRate() * (isStereo() ? 2 : 1))),
@@ -180,7 +180,7 @@
}
SubLoopingAudioStream::~SubLoopingAudioStream() {
- if (_disposeAfterUse)
+ if (_disposeAfterUse == DisposeAfterUse::YES)
delete _parent;
}
@@ -218,7 +218,7 @@
#pragma mark --- SubSeekableAudioStream ---
#pragma mark -
-SubSeekableAudioStream::SubSeekableAudioStream(SeekableAudioStream *parent, const Timestamp start, const Timestamp end, bool disposeAfterUse)
+SubSeekableAudioStream::SubSeekableAudioStream(SeekableAudioStream *parent, const Timestamp start, const Timestamp end, DisposeAfterUse::Flag disposeAfterUse)
: _parent(parent), _disposeAfterUse(disposeAfterUse),
_start(start.convertToFramerate(getRate())),
_pos(0, getRate() * (isStereo() ? 2 : 1)),
@@ -279,18 +279,18 @@
const byte *_end;
const int _rate;
const byte *_origPtr;
- const bool _disposeAfterUse;
+ const DisposeAfterUse::Flag _disposeAfterUse;
const Timestamp _playtime;
public:
- LinearMemoryStream(int rate, const byte *ptr, uint len, bool autoFreeMemory)
+ LinearMemoryStream(int rate, const byte *ptr, uint len, DisposeAfterUse::Flag autoFreeMemory)
: _ptr(ptr), _end(ptr+len), _rate(rate), _origPtr(ptr),
_disposeAfterUse(autoFreeMemory),
_playtime(0, len / (is16Bit ? 2 : 1) / (stereo ? 2 : 1), rate) {
}
virtual ~LinearMemoryStream() {
- if (_disposeAfterUse)
+ if (_disposeAfterUse == DisposeAfterUse::YES)
free(const_cast<byte *>(_origPtr));
}
@@ -364,13 +364,13 @@
int32 _filePos; ///< Current position in stream
int32 _diskLeft; ///< Samples left in stream in current block not yet read to buffer
int32 _bufferLeft; ///< Samples left in buffer in current block
- bool _disposeAfterUse; ///< If true, delete stream object when LinearDiskStream is destructed
+ const DisposeAfterUse::Flag _disposeAfterUse; ///< Indicates whether the stream object should be deleted when this LinearDiskStream is destructed
LinearDiskStreamAudioBlock *_audioBlock; ///< Audio block list
- int _audioBlockCount; ///< Number of blocks in _audioBlock
+ const int _audioBlockCount; ///< Number of blocks in _audioBlock
int _currentBlock; ///< Current audio block number
public:
- LinearDiskStream(int rate, bool disposeStream, Common::SeekableReadStream *stream, LinearDiskStreamAudioBlock *block, uint numBlocks)
+ LinearDiskStream(int rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream, LinearDiskStreamAudioBlock *block, uint numBlocks)
: _rate(rate), _playtime(0, rate), _stream(stream), _disposeAfterUse(disposeStream),
_audioBlockCount(numBlocks) {
@@ -407,7 +407,7 @@
virtual ~LinearDiskStream() {
- if (_disposeAfterUse) {
+ if (_disposeAfterUse == DisposeAfterUse::YES) {
delete _stream;
}
@@ -543,7 +543,7 @@
const bool is16Bit = (flags & Mixer::FLAG_16BITS) != 0;
const bool isUnsigned = (flags & Mixer::FLAG_UNSIGNED) != 0;
const bool isLE = (flags & Mixer::FLAG_LITTLE_ENDIAN) != 0;
- const bool autoFree = (flags & Mixer::FLAG_AUTOFREE) != 0;
+ const DisposeAfterUse::Flag autoFree = (flags & Mixer::FLAG_AUTOFREE) != 0 ? DisposeAfterUse::YES : DisposeAfterUse::NO;
// Verify the buffer sizes are sane
if (is16Bit && isStereo) {
@@ -605,14 +605,15 @@
#define MAKE_LINEAR_DISK(STEREO, UNSIGNED) \
if (is16Bit) { \
if (isLE) \
- return new LinearDiskStream<STEREO, true, UNSIGNED, true>(rate, takeOwnership, stream, block, numBlocks); \
+ return new LinearDiskStream<STEREO, true, UNSIGNED, true>(rate, disposeStream, stream, block, numBlocks); \
else \
- return new LinearDiskStream<STEREO, true, UNSIGNED, false>(rate, takeOwnership, stream, block, numBlocks); \
+ return new LinearDiskStream<STEREO, true, UNSIGNED, false>(rate, disposeStream, stream, block, numBlocks); \
} else \
- return new LinearDiskStream<STEREO, false, UNSIGNED, false>(rate, takeOwnership, stream, block, numBlocks)
+ return new LinearDiskStream<STEREO, false, UNSIGNED, false>(rate, disposeStream, stream, block, numBlocks)
-SeekableAudioStream *makeLinearDiskStream(Common::SeekableReadStream *stream, LinearDiskStreamAudioBlock *block, int numBlocks, int rate, byte flags, bool takeOwnership) {
+SeekableAudioStream *makeLinearDiskStream(Common::SeekableReadStream *stream, LinearDiskStreamAudioBlock *block, int numBlocks,
+ int rate, byte flags, DisposeAfterUse::Flag disposeStream) {
const bool isStereo = (flags & Mixer::FLAG_STEREO) != 0;
const bool is16Bit = (flags & Mixer::FLAG_16BITS) != 0;
const bool isUnsigned = (flags & Mixer::FLAG_UNSIGNED) != 0;
@@ -634,7 +635,7 @@
}
AudioStream *makeLinearDiskStream(Common::SeekableReadStream *stream, LinearDiskStreamAudioBlock *block,
- int numBlocks, int rate, byte flags, bool disposeStream, uint loopStart, uint loopEnd) {
+ int numBlocks, int rate, byte flags, DisposeAfterUse::Flag disposeStream, uint loopStart, uint loopEnd) {
SeekableAudioStream *s = makeLinearDiskStream(stream, block, numBlocks, rate, flags, disposeStream);
const bool isStereo = (flags & Mixer::FLAG_STEREO) != 0;
@@ -683,8 +684,8 @@
*/
struct StreamHolder {
AudioStream *_stream;
- bool _disposeAfterUse;
- StreamHolder(AudioStream *stream, bool disposeAfterUse)
+ DisposeAfterUse::Flag _disposeAfterUse;
+ StreamHolder(AudioStream *stream, DisposeAfterUse::Flag disposeAfterUse)
: _stream(stream),
_disposeAfterUse(disposeAfterUse) {}
};
@@ -731,7 +732,7 @@
virtual bool endOfStream() const { return _finished && _queue.empty(); }
// Implement the QueuingAudioStream API
- virtual void queueAudioStream(AudioStream *stream, bool disposeAfterUse);
+ virtual void queueAudioStream(AudioStream *stream, DisposeAfterUse::Flag disposeAfterUse);
virtual void finish() { _finished = true; }
uint32 numQueuedStreams() const {
@@ -743,12 +744,12 @@
QueuingAudioStreamImpl::~QueuingAudioStreamImpl() {
while (!_queue.empty()) {
StreamHolder tmp = _queue.pop();
- if (tmp._disposeAfterUse)
+ if (tmp._disposeAfterUse == DisposeAfterUse::YES)
delete tmp._stream;
}
}
-void QueuingAudioStreamImpl::queueAudioStream(AudioStream *stream, bool disposeAfterUse) {
+void QueuingAudioStreamImpl::queueAudioStream(AudioStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
if ((stream->getRate() != getRate()) || (stream->isStereo() != isStereo()))
error("QueuingAudioStreamImpl::queueAudioStream: stream has mismatched parameters");
@@ -766,7 +767,7 @@
if (stream->endOfData() ) {
StreamHolder tmp = _queue.pop();
- if (tmp._disposeAfterUse)
+ if (tmp._disposeAfterUse == DisposeAfterUse::YES)
delete stream;
}
}
Modified: scummvm/trunk/sound/audiostream.h
===================================================================
--- scummvm/trunk/sound/audiostream.h 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/sound/audiostream.h 2010-01-16 21:36:08 UTC (rev 47334)
@@ -29,6 +29,7 @@
#include "common/util.h"
#include "common/scummsys.h"
#include "common/stream.h"
+#include "common/types.h"
#include "sound/timestamp.h"
@@ -115,7 +116,7 @@
* @param loops How often to loop (0 = infinite)
* @param disposeAfteruse Destroy the stream after the LoopingAudioStream has finished playback.
*/
- LoopingAudioStream(RewindableAudioStream *stream, uint loops, bool disposeAfterUse = true);
+ LoopingAudioStream(RewindableAudioStream *stream, uint loops, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
~LoopingAudioStream();
int readBuffer(int16 *buffer, const int numSamples);
@@ -131,7 +132,7 @@
uint getCompleteIterations() const { return _completeIterations; }
private:
RewindableAudioStream *_parent;
- bool _disposeAfterUse;
+ DisposeAfterUse::Flag _disposeAfterUse;
uint _loops;
uint _completeIterations;
@@ -232,7 +233,7 @@
SubLoopingAudioStream(SeekableAudioStream *stream, uint loops,
const Timestamp loopStart,
const Timestamp loopEnd,
- bool disposeAfterUse = true);
+ DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
~SubLoopingAudioStream();
int readBuffer(int16 *buffer, const int numSamples);
@@ -242,7 +243,7 @@
int getRate() const { return _parent->getRate(); }
private:
SeekableAudioStream *_parent;
- bool _disposeAfterUse;
+ DisposeAfterUse::Flag _disposeAfterUse;
uint _loops;
Timestamp _pos;
@@ -271,9 +272,9 @@
* @param parent parent stream object.
* @param start Start time.
* @param end End time.
- * @param disposeAfterUse Whether the parent stream object should be destroied on desctruction of the SubSeekableAudioStream.
+ * @param disposeAfterUse Whether the parent stream object should be destroyed on destruction of the SubSeekableAudioStream.
*/
- SubSeekableAudioStream(SeekableAudioStream *parent, const Timestamp start, const Timestamp end, bool disposeAfterUse = true);
+ SubSeekableAudioStream(SeekableAudioStream *parent, const Timestamp start, const Timestamp end, DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
~SubSeekableAudioStream();
int readBuffer(int16 *buffer, const int numSamples);
@@ -289,7 +290,7 @@
Timestamp getLength() const { return _length; }
private:
SeekableAudioStream *_parent;
- bool _disposeAfterUse;
+ DisposeAfterUse::Flag _disposeAfterUse;
const Timestamp _start;
const Timestamp _length;
@@ -342,11 +343,11 @@
* @param len Length of the data (in bytes!)
* @param flags Flags combination.
* @see Mixer::RawFlags
- * @param disposeStream Wheter the "stream" object should be destroyed after playback.
+ * @param disposeStream Whether the "stream" object should be destroyed after playback.
* @return The new SeekableAudioStream (or 0 on failure).
*/
SeekableAudioStream *makeLinearDiskStream(Common::SeekableReadStream *stream, LinearDiskStreamAudioBlock *block,
- int numBlocks, int rate, byte flags, bool disposeStream);
+ int numBlocks, int rate, byte flags, DisposeAfterUse::Flag disposeStream);
/**
* NOTE:
@@ -358,7 +359,7 @@
* each block of uncompressed audio in the stream.
*/
AudioStream *makeLinearDiskStream(Common::SeekableReadStream *stream, LinearDiskStreamAudioBlock *block,
- int numBlocks, int rate, byte flags, bool disposeStream, uint loopStart, uint loopEnd);
+ int numBlocks, int rate, byte flags, DisposeAfterUse::Flag disposeStream, uint loopStart, uint loopEnd);
class QueuingAudioStream : public Audio::AudioStream {
public:
@@ -370,7 +371,7 @@
* deleted after all data contained in it has been played.
*/
virtual void queueAudioStream(Audio::AudioStream *audStream,
- bool disposeAfterUse = true) = 0;
+ DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES) = 0;
/**
* Queue a block of raw audio data for playback. This stream
@@ -381,7 +382,7 @@
*/
void queueBuffer(byte *data, uint32 size, byte flags) {
AudioStream *stream = makeLinearInputStream(data, size, getRate(), flags, 0, 0);
- queueAudioStream(stream, true);
+ queueAudioStream(stream, DisposeAfterUse::YES);
}
/**
Modified: scummvm/trunk/sound/flac.cpp
===================================================================
--- scummvm/trunk/sound/flac.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/sound/flac.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -726,7 +726,7 @@
SeekableAudioStream *makeFlacStream(
Common::SeekableReadStream *stream,
- bool disposeAfterUse) {
+ DisposeAfterUse::Flag disposeAfterUse) {
return new FlacInputStream(stream, disposeAfterUse);
}
Modified: scummvm/trunk/sound/flac.h
===================================================================
--- scummvm/trunk/sound/flac.h 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/sound/flac.h 2010-01-16 21:36:08 UTC (rev 47334)
@@ -41,6 +41,7 @@
#ifndef SOUND_FLAC_H
#define SOUND_FLAC_H
+#include "common/types.h"
#include "common/scummsys.h"
#ifdef USE_FLAC
@@ -64,7 +65,7 @@
*/
SeekableAudioStream *makeFlacStream(
Common::SeekableReadStream *stream,
- bool disposeAfterUse);
+ DisposeAfterUse::Flag disposeAfterUse);
} // End of namespace Audio
Modified: scummvm/trunk/sound/mp3.cpp
===================================================================
--- scummvm/trunk/sound/mp3.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/sound/mp3.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -54,7 +54,7 @@
};
Common::SeekableReadStream *_inStream;
- bool _disposeAfterUse;
+ DisposeAfterUse::Flag _disposeAfterUse;
uint _posInFrame;
State _state;
@@ -75,7 +75,7 @@
public:
MP3InputStream(Common::SeekableReadStream *inStream,
- bool dispose);
+ DisposeAfterUse::Flag dispose);
~MP3InputStream();
int readBuffer(int16 *buffer, const int numSamples);
@@ -95,7 +95,7 @@
void deinitStream();
};
-MP3InputStream::MP3InputStream(Common::SeekableReadStream *inStream, bool dispose) :
+MP3InputStream::MP3InputStream(Common::SeekableReadStream *inStream, DisposeAfterUse::Flag dispose) :
_inStream(inStream),
_disposeAfterUse(dispose),
_posInFrame(0),
@@ -129,7 +129,7 @@
MP3InputStream::~MP3InputStream() {
deinitStream();
- if (_disposeAfterUse)
+ if (_disposeAfterUse == DisposeAfterUse::YES)
delete _inStream;
}
@@ -340,7 +340,7 @@
SeekableAudioStream *makeMP3Stream(
Common::SeekableReadStream *stream,
- bool disposeAfterUse) {
+ DisposeAfterUse::Flag disposeAfterUse) {
return new MP3InputStream(stream, disposeAfterUse);
}
Modified: scummvm/trunk/sound/mp3.h
===================================================================
--- scummvm/trunk/sound/mp3.h 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/sound/mp3.h 2010-01-16 21:36:08 UTC (rev 47334)
@@ -41,6 +41,7 @@
#ifndef SOUND_MP3_H
#define SOUND_MP3_H
+#include "common/types.h"
#include "common/scummsys.h"
#ifdef USE_MAD
@@ -64,7 +65,7 @@
*/
SeekableAudioStream *makeMP3Stream(
Common::SeekableReadStream *stream,
- bool disposeAfterUse);
+ DisposeAfterUse::Flag disposeAfterUse);
} // End of namespace Audio
Modified: scummvm/trunk/sound/voc.cpp
===================================================================
--- scummvm/trunk/sound/voc.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/sound/voc.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -298,7 +298,7 @@
return currentBlock;
}
-AudioStream *makeVOCDiskStream(Common::SeekableReadStream &stream, byte flags, bool takeOwnership) {
+AudioStream *makeVOCDiskStream(Common::SeekableReadStream &stream, byte flags, DisposeAfterUse::Flag takeOwnership) {
const int MAX_AUDIO_BLOCKS = 256;
LinearDiskStreamAudioBlock *block = new LinearDiskStreamAudioBlock[MAX_AUDIO_BLOCKS];
@@ -318,7 +318,7 @@
return audioStream;
}
-SeekableAudioStream *makeVOCDiskStreamNoLoop(Common::SeekableReadStream &stream, byte flags, bool takeOwnership) {
+SeekableAudioStream *makeVOCDiskStreamNoLoop(Common::SeekableReadStream &stream, byte flags, DisposeAfterUse::Flag takeOwnership) {
const int MAX_AUDIO_BLOCKS = 256;
LinearDiskStreamAudioBlock *block = new LinearDiskStreamAudioBlock[MAX_AUDIO_BLOCKS];
@@ -341,7 +341,7 @@
#endif
-AudioStream *makeVOCStream(Common::SeekableReadStream &stream, byte flags, uint loopStart, uint loopEnd, bool takeOwnershipOfStream) {
+AudioStream *makeVOCStream(Common::SeekableReadStream &stream, byte flags, uint loopStart, uint loopEnd, DisposeAfterUse::Flag takeOwnershipOfStream) {
#ifdef STREAM_AUDIO_FROM_DISK
return makeVOCDiskStream(stream, flags, takeOwnershipOfStream);
#else
@@ -356,7 +356,7 @@
#endif
}
-SeekableAudioStream *makeVOCStream(Common::SeekableReadStream &stream, byte flags, bool takeOwnershipOfStream) {
+SeekableAudioStream *makeVOCStream(Common::SeekableReadStream &stream, byte flags, DisposeAfterUse::Flag takeOwnershipOfStream) {
#ifdef STREAM_AUDIO_FROM_DISK
return makeVOCDiskStreamNoLoop(stream, flags, takeOwnershipOfStream);
#else
Modified: scummvm/trunk/sound/voc.h
===================================================================
--- scummvm/trunk/sound/voc.h 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/sound/voc.h 2010-01-16 21:36:08 UTC (rev 47334)
@@ -38,6 +38,7 @@
#ifndef SOUND_VOC_H
#define SOUND_VOC_H
+#include "common/types.h"
#include "common/scummsys.h"
namespace Common { class ReadStream; }
@@ -94,12 +95,12 @@
*
* This function uses loadVOCFromStream() internally.
*/
-AudioStream *makeVOCStream(Common::SeekableReadStream &stream, byte flags = 0, uint loopStart = 0, uint loopEnd = 0, bool takeOwnershipOfStream = false);
+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, bool takeOwnershipOfStream);
+SeekableAudioStream *makeVOCStream(Common::SeekableReadStream &stream, byte flags, DisposeAfterUse::Flag disposeAfterUse);
} // End of namespace Audio
Modified: scummvm/trunk/sound/vorbis.cpp
===================================================================
--- scummvm/trunk/sound/vorbis.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/sound/vorbis.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -88,7 +88,7 @@
class VorbisInputStream : public SeekableAudioStream {
protected:
Common::SeekableReadStream *_inStream;
- bool _disposeAfterUse;
+ DisposeAfterUse::Flag _disposeAfterUse;
bool _isStereo;
int _rate;
@@ -103,7 +103,7 @@
public:
// startTime / duration are in milliseconds
- VorbisInputStream(Common::SeekableReadStream *inStream, bool dispose);
+ VorbisInputStream(Common::SeekableReadStream *inStream, DisposeAfterUse::Flag dispose);
~VorbisInputStream();
int readBuffer(int16 *buffer, const int numSamples);
@@ -118,7 +118,7 @@
bool refill();
};
-VorbisInputStream::VorbisInputStream(Common::SeekableReadStream *inStream, bool dispose) :
+VorbisInputStream::VorbisInputStream(Common::SeekableReadStream *inStream, DisposeAfterUse::Flag dispose) :
_inStream(inStream),
_disposeAfterUse(dispose),
_length(0, 1000),
@@ -148,7 +148,7 @@
VorbisInputStream::~VorbisInputStream() {
ov_clear(&_ovFile);
- if (_disposeAfterUse)
+ if (_disposeAfterUse == DisposeAfterUse::YES)
delete _inStream;
}
@@ -241,7 +241,7 @@
SeekableAudioStream *makeVorbisStream(
Common::SeekableReadStream *stream,
- bool disposeAfterUse) {
+ DisposeAfterUse::Flag disposeAfterUse) {
return new VorbisInputStream(stream, disposeAfterUse);
}
Modified: scummvm/trunk/sound/vorbis.h
===================================================================
--- scummvm/trunk/sound/vorbis.h 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/sound/vorbis.h 2010-01-16 21:36:08 UTC (rev 47334)
@@ -41,6 +41,7 @@
#ifndef SOUND_VORBIS_H
#define SOUND_VORBIS_H
+#include "common/types.h"
#include "common/scummsys.h"
#ifdef USE_VORBIS
@@ -64,7 +65,7 @@
*/
SeekableAudioStream *makeVorbisStream(
Common::SeekableReadStream *stream,
- bool disposeAfterUse);
+ DisposeAfterUse::Flag disposeAfterUse);
} // End of namespace Audio
Modified: scummvm/trunk/sound/wave.cpp
===================================================================
--- scummvm/trunk/sound/wave.cpp 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/sound/wave.cpp 2010-01-16 21:36:08 UTC (rev 47334)
@@ -161,14 +161,14 @@
return true;
}
-RewindableAudioStream *makeWAVStream(Common::SeekableReadStream *stream, bool disposeAfterUse) {
+RewindableAudioStream *makeWAVStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
int size, rate;
byte flags;
uint16 type;
int blockAlign;
if (!loadWAVFromStream(*stream, size, rate, flags, &type, &blockAlign)) {
- if (disposeAfterUse)
+ if (disposeAfterUse == DisposeAfterUse::YES)
delete stream;
return 0;
}
@@ -184,7 +184,7 @@
assert(data);
stream->read(data, size);
- if (disposeAfterUse)
+ if (disposeAfterUse == DisposeAfterUse::YES)
delete stream;
// Since we allocated our own buffer for the data, we must set the autofree flag.
Modified: scummvm/trunk/sound/wave.h
===================================================================
--- scummvm/trunk/sound/wave.h 2010-01-16 21:34:36 UTC (rev 47333)
+++ scummvm/trunk/sound/wave.h 2010-01-16 21:36:08 UTC (rev 47334)
@@ -38,6 +38,7 @@
#ifndef SOUND_WAVE_H
#define SOUND_WAVE_H
+#include "common/types.h"
#include "common/scummsys.h"
namespace Common { class SeekableReadStream; }
@@ -74,7 +75,7 @@
*/
RewindableAudioStream *makeWAVStream(
Common::SeekableReadStream *stream,
- bool disposeAfterUse = false);
+ DisposeAfterUse::Flag disposeAfterUse);
} // End of namespace Audio
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list