[Scummvm-cvs-logs] SF.net SVN: scummvm: [20902] scummvm/trunk/engines/gob
wjpalenstijn at users.sourceforge.net
wjpalenstijn at users.sourceforge.net
Sat Feb 25 17:26:17 CET 2006
Revision: 20902
Author: wjpalenstijn
Date: 2006-02-25 17:25:27 -0800 (Sat, 25 Feb 2006)
ViewCVS: http://svn.sourceforge.net/scummvm?rev=20902&view=rev
Log Message:
-----------
stop playing a sample before deleting the sample data
Modified Paths:
--------------
scummvm/trunk/engines/gob/game.cpp
scummvm/trunk/engines/gob/goblin.cpp
scummvm/trunk/engines/gob/sound.cpp
scummvm/trunk/engines/gob/sound.h
Modified: scummvm/trunk/engines/gob/game.cpp
===================================================================
--- scummvm/trunk/engines/gob/game.cpp 2006-02-26 00:32:10 UTC (rev 20901)
+++ scummvm/trunk/engines/gob/game.cpp 2006-02-26 01:25:27 UTC (rev 20902)
@@ -413,13 +413,16 @@
if (_soundSamples[slot] == 0)
return;
+ char* data = _soundSamples[slot]->data;
+
+ _vm->_snd->freeSoundDesc(_soundSamples[slot], false);
+ _soundSamples[slot] = 0;
+
if (_soundFromExt[slot] == 1) {
- delete[] (_soundSamples[slot]->data - 6);
+ delete[] (data - 6);
_soundFromExt[slot] = 0;
}
- delete _soundSamples[slot];
- _soundSamples[slot] = 0;
}
int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY, int16 *pButtons, char handleMouse) {
Modified: scummvm/trunk/engines/gob/goblin.cpp
===================================================================
--- scummvm/trunk/engines/gob/goblin.cpp 2006-02-26 00:32:10 UTC (rev 20901)
+++ scummvm/trunk/engines/gob/goblin.cpp 2006-02-26 01:25:27 UTC (rev 20902)
@@ -1825,7 +1825,7 @@
if (_soundData[i] == 0)
continue;
- _vm->_snd->freeSoundData(_soundData[i]);
+ _vm->_snd->freeSoundDesc(_soundData[i]);
_soundData[i] = 0;
}
Modified: scummvm/trunk/engines/gob/sound.cpp
===================================================================
--- scummvm/trunk/engines/gob/sound.cpp 2006-02-26 00:32:10 UTC (rev 20901)
+++ scummvm/trunk/engines/gob/sound.cpp 2006-02-26 01:25:27 UTC (rev 20902)
@@ -127,7 +127,7 @@
return sndDesc;
}
-void Snd::freeSoundData(Snd::SoundDesc *sndDesc) {
+void Snd::freeSoundDesc(Snd::SoundDesc *sndDesc, bool freedata) {
_vm->_mixer->stopHandle(sndDesc->handle);
for (int i = 0; i < ARRAYSIZE(_loopingSounds); i++) {
@@ -135,7 +135,9 @@
_loopingSounds[i] = NULL;
}
- delete[] sndDesc->data;
+ if (freedata) {
+ delete[] sndDesc->data;
+ }
delete sndDesc;
}
Modified: scummvm/trunk/engines/gob/sound.h
===================================================================
--- scummvm/trunk/engines/gob/sound.h 2006-02-26 00:32:10 UTC (rev 20901)
+++ scummvm/trunk/engines/gob/sound.h 2006-02-26 01:25:27 UTC (rev 20902)
@@ -58,8 +58,11 @@
void playSample(SoundDesc *sndDesc, int16 repCount, int16 frequency);
void playComposition(Snd::SoundDesc ** samples, int16 *composit, int16 freqVal) {;}
void waitEndPlay(void) {;}
- void freeSoundData(SoundDesc *sndDesc);
+ // This deletes sndDesc and stops playing the sample.
+ // If freedata is set, it also delete[]s the sample data.
+ void freeSoundDesc(SoundDesc *sndDesc, bool freedata=true);
+
protected:
// TODO: This is a very primitive square wave generator. The only thing is
// has in common with the PC speaker is that it sounds terrible.
More information about the Scummvm-git-logs
mailing list