[Scummvm-cvs-logs] SF.net SVN: scummvm:[43513] scummvm/trunk
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Tue Aug 18 17:32:28 CEST 2009
Revision: 43513
http://scummvm.svn.sourceforge.net/scummvm/?rev=43513&view=rev
Author: lordhoto
Date: 2009-08-18 15:32:26 +0000 (Tue, 18 Aug 2009)
Log Message:
-----------
- Destory AudioCDManager singleton after user quits a game, this saves a few bytes memory
- Added FIXME to audiocd.h, concering why destroying the AudioCDManager can not quit CD playback right now
Modified Paths:
--------------
scummvm/trunk/base/main.cpp
scummvm/trunk/sound/audiocd.h
Modified: scummvm/trunk/base/main.cpp
===================================================================
--- scummvm/trunk/base/main.cpp 2009-08-18 15:31:26 UTC (rev 43512)
+++ scummvm/trunk/base/main.cpp 2009-08-18 15:32:26 UTC (rev 43513)
@@ -45,9 +45,12 @@
#include "common/file.h"
#include "common/fs.h"
#include "common/system.h"
+
#include "gui/GuiManager.h"
#include "gui/message.h"
+#include "sound/audiocd.h"
+
#include "backends/keymapper/keymapper.h"
#if defined(_WIN32_WCE)
@@ -416,6 +419,15 @@
warning("Could not find any engine capable of running the selected game");
}
+ // We will destory the AudioCDManager singleton here to save some memory.
+ // This will not make the CD audio stop, one would have to enable this:
+ //AudioCD.stop();
+ // but the engine is responsible for stopping CD playback anyway and
+ // this way we catch engines not doing it properly. For some more
+ // information about why AudioCDManager::destroy does not stop the CD
+ // playback read the FIXME in sound/audiocd.h
+ Audio::AudioCDManager::destroy();
+
// reset the graphics to default
setupGraphics(system);
launcherDialog();
Modified: scummvm/trunk/sound/audiocd.h
===================================================================
--- scummvm/trunk/sound/audiocd.h 2009-08-18 15:31:26 UTC (rev 43512)
+++ scummvm/trunk/sound/audiocd.h 2009-08-18 15:32:26 UTC (rev 43513)
@@ -67,6 +67,14 @@
friend class Common::Singleton<SingletonBaseType>;
AudioCDManager();
+ // FIXME: It might make sense to stop CD playback, when the AudioCDManager singleton
+ // is destroyed. Currently we can not do this, since in worst case the OSystem and
+ // along wiht it the Mixer will be destroyed before the AudioCDManager, thus
+ // leading to invalid memory access. If we can fix up the code to destroy the
+ // AudioCDManager before OSystem in *all* cases, that is including calling
+ // OSystem::quit, we might be able to implement it via a simple "stop()"
+ // call in a custom destructor of AudioCDManager.
+
/* used for emulated CD music */
SoundHandle _handle;
bool _emulating;
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