[Scummvm-cvs-logs] SF.net SVN: scummvm: [26894] scummvm/trunk/engines/parallaction/sound.cpp
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Sun May 20 21:59:16 CEST 2007
Revision: 26894
http://scummvm.svn.sourceforge.net/scummvm/?rev=26894&view=rev
Author: peres001
Date: 2007-05-20 12:59:15 -0700 (Sun, 20 May 2007)
Log Message:
-----------
Added guard code to prevent crashes when stopping sound effects.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/sound.cpp
Modified: scummvm/trunk/engines/parallaction/sound.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/sound.cpp 2007-05-20 17:17:48 UTC (rev 26893)
+++ scummvm/trunk/engines/parallaction/sound.cpp 2007-05-20 19:59:15 UTC (rev 26894)
@@ -305,10 +305,18 @@
AmigaSoundMan::AmigaSoundMan(Parallaction *vm) : SoundMan(vm) {
_musicStream = 0;
+ _channels[0].data = 0;
+ _channels[1].data = 0;
+ _channels[2].data = 0;
+ _channels[3].data = 0;
}
AmigaSoundMan::~AmigaSoundMan() {
stopMusic();
+ stopSfx(0);
+ stopSfx(1);
+ stopSfx(2);
+ stopSfx(3);
}
void AmigaSoundMan::playSfx(const char *filename, uint channel, bool looping, int volume, int rate) {
@@ -355,11 +363,12 @@
return;
}
- debugC(1, kDebugAudio, "AmigaSoundMan::stopSfx(%i)", channel);
-
- _mixer->stopHandle(_channels[channel].handle);
- free(_channels[channel].data);
- _channels[channel].data = 0;
+ if (_channels[channel].data) {
+ debugC(1, kDebugAudio, "AmigaSoundMan::stopSfx(%i)", channel);
+ _mixer->stopHandle(_channels[channel].handle);
+ free(_channels[channel].data);
+ _channels[channel].data = 0;
+ }
}
void AmigaSoundMan::playMusic() {
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