[Scummvm-cvs-logs] CVS: scummvm/simon sound.cpp,1.50,1.51
Max Horn
fingolfin at users.sourceforge.net
Sat Nov 29 03:57:02 CET 2003
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.337,1.338
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sound audiocd.cpp,NONE,1.1 audiocd.h,NONE,1.1 mp3.cpp,NONE,1.1 mp3.h,NONE,1.1 vorbis.cpp,NONE,1.1 vorbis.h,NONE,1.1 module.mk,1.14,1.15
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv4563
Modified Files:
sound.cpp
Log Message:
cleanup; fix some memory leaks; more memory leaks remaining
Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/sound.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- sound.cpp 8 Nov 2003 20:54:31 -0000 1.50
+++ sound.cpp 29 Nov 2003 11:56:24 -0000 1.51
@@ -256,14 +256,17 @@
#ifdef USE_MAD
file->open(gss->mp3_filename, gameDataPath);
- if (file->isOpen() == false) {
+ if (file->isOpen()) {
+ _voice_file = true;
+ _voice = new MP3Sound(_mixer, file);
+ }
#endif
+ if (!file->isOpen()) {
// for simon2 mac/amiga, only read index file
if (_game == GAME_SIMON2MAC) {
file->open("voices.idx", gameDataPath);
if (file->isOpen() == false) {
warning("Can't open voice index file 'voices.idx'");
- delete file;
} else {
file->seek(0, SEEK_END);
int end = file->pos();
@@ -277,11 +280,13 @@
}
_voice_file = true;
}
+ delete file;
} else if (_game & GF_WIN) {
s = gss->wav_filename;
file->open(s, gameDataPath);
if (file->isOpen() == false) {
warning("Can't open voice file %s", s);
+ delete file;
} else {
_voice_file = true;
_voice = new WavSound(_mixer, file);
@@ -294,24 +299,23 @@
file->open(s, gameDataPath);
if (file->isOpen() == false) {
warning("Can't open voice file %s", s);
+ delete file;
} else {
_voice_file = true;
_voice = new VocSound(_mixer, file);
}
}
-#ifdef USE_MAD
- } else {
- _voice_file = true;
- _voice = new MP3Sound(_mixer, file);
}
-#endif
if (_game == GAME_SIMON1ACORN || _game == GAME_SIMON1TALKIE) {
file = new File();
#ifdef USE_MAD
file->open(gss->mp3_effects_filename, gameDataPath);
- if (file->isOpen() == false) {
+ if (file->isOpen()) {
+ _effects = new MP3Sound(_mixer, file);
+ }
#endif
+ if (!file->isOpen()) {
s = gss->voc_effects_filename;
file->open(s, gameDataPath);
if (file->isOpen() == false) {
@@ -319,11 +323,7 @@
} else {
_effects = new VocSound(_mixer, file);
}
-#ifdef USE_MAD
- } else {
- _effects = new MP3Sound(_mixer, file);
}
-#endif
}
}
@@ -408,6 +408,7 @@
}
// FIXME freeing voice at this point causes frequent game crashes
// Maybe related to sound effects and speech using same sound format ?
+ // In any case, this means we currently leak.
// delete _voice;
_voice = new WavSound(_mixer, file, _offsets);
}
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/simon simon.cpp,1.337,1.338
- Next message: [Scummvm-cvs-logs] CVS: scummvm/sound audiocd.cpp,NONE,1.1 audiocd.h,NONE,1.1 mp3.cpp,NONE,1.1 mp3.h,NONE,1.1 vorbis.cpp,NONE,1.1 vorbis.h,NONE,1.1 module.mk,1.14,1.15
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list