[Scummvm-cvs-logs] SF.net SVN: scummvm:[53019] scummvm/branches/branch-1-2-0/engines/queen/ sound.cpp
agent-q at users.sourceforge.net
agent-q at users.sourceforge.net
Tue Oct 5 00:36:46 CEST 2010
Revision: 53019
http://scummvm.svn.sourceforge.net/scummvm/?rev=53019&view=rev
Author: agent-q
Date: 2010-10-04 22:36:44 +0000 (Mon, 04 Oct 2010)
Log Message:
-----------
FOTAQ: Fixed a possible memory leak, destructor was not virtual.
Modified Paths:
--------------
scummvm/branches/branch-1-2-0/engines/queen/sound.cpp
Modified: scummvm/branches/branch-1-2-0/engines/queen/sound.cpp
===================================================================
--- scummvm/branches/branch-1-2-0/engines/queen/sound.cpp 2010-10-04 22:20:08 UTC (rev 53018)
+++ scummvm/branches/branch-1-2-0/engines/queen/sound.cpp 2010-10-04 22:36:44 UTC (rev 53019)
@@ -77,7 +77,7 @@
else
_rate = rate;
}
- ~AudioStreamWrapper() {
+ virtual ~AudioStreamWrapper() {
delete _stream;
}
int readBuffer(int16 *buffer, const int numSamples) {
@@ -119,6 +119,7 @@
MP3Sound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
protected:
void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
+ consolePrintf("Mp3 sound\n");
Common::MemoryReadStream *tmp = f->readStream(size);
assert(tmp);
_mixer->playStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeMP3Stream(tmp, DisposeAfterUse::YES)));
@@ -132,6 +133,7 @@
OGGSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
protected:
void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
+ consolePrintf("Ogg sound\n");
Common::MemoryReadStream *tmp = f->readStream(size);
assert(tmp);
_mixer->playStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeVorbisStream(tmp, DisposeAfterUse::YES)));
@@ -145,6 +147,7 @@
FLACSound(Audio::Mixer *mixer, QueenEngine *vm) : PCSound(mixer, vm) {}
protected:
void playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *soundHandle) {
+ consolePrintf("Flac sound\n");
Common::MemoryReadStream *tmp = f->readStream(size);
assert(tmp);
_mixer->playStream(Audio::Mixer::kSFXSoundType, soundHandle, new AudioStreamWrapper(Audio::makeFLACStream(tmp, DisposeAfterUse::YES)));
@@ -269,6 +272,7 @@
}
void PCSound::playSpeech(const char *base) {
+ consolePrintf("Playing speech\n");
if (speechOn()) {
playSound(base, true);
}
@@ -289,15 +293,18 @@
}
strcat(name, ".SB");
if (isSpeech) {
+ consolePrintf("Another speech saple...\n");
while (_mixer->isSoundHandleActive(_speechHandle)) {
_vm->input()->delay(10);
}
} else {
+ consolePrintf("Stopping sfx\n");
_mixer->stopHandle(_sfxHandle);
}
uint32 size;
Common::File *f = _vm->resource()->findSound(name, &size);
if (f) {
+ consolePrintf("Playing sound %d\n", size);
playSoundData(f, size, isSpeech ? &_speechHandle : &_sfxHandle);
_speechSfxExists = isSpeech;
} else {
@@ -329,6 +336,7 @@
if (sound) {
f->read(sound, size);
Audio::Mixer::SoundType type = (soundHandle == &_speechHandle) ? Audio::Mixer::kSpeechSoundType : Audio::Mixer::kSFXSoundType;
+ consolePrintf("Playing sound data %d\n", size);
Audio::AudioStream *stream = Audio::makeRawStream(sound, size, 11840, Audio::FLAG_UNSIGNED);
_mixer->playStream(type, soundHandle, stream);
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