[Scummvm-cvs-logs] SF.net SVN: scummvm:[49548] scummvm/branches/gsoc2010-opengl

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Wed Jun 9 22:09:58 CEST 2010


Revision: 49548
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49548&view=rev
Author:   vgvgf
Date:     2010-06-09 20:09:57 +0000 (Wed, 09 Jun 2010)

Log Message:
-----------
- Revised abstract AudioCDManager.
- Removed AudioCDManager Singleton, and changed code for using AudioCDManager in OSystem.
- Added initialization code for new AudioCDManager in BaseBackend and OSystem_SDL.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/backends/audiocd/abstract-audiocd.h
    scummvm/branches/gsoc2010-opengl/backends/audiocd/default/default-audiocd.h
    scummvm/branches/gsoc2010-opengl/backends/base-backend.cpp
    scummvm/branches/gsoc2010-opengl/backends/base-backend.h
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h
    scummvm/branches/gsoc2010-opengl/base/main.cpp
    scummvm/branches/gsoc2010-opengl/common/system.cpp
    scummvm/branches/gsoc2010-opengl/common/system.h
    scummvm/branches/gsoc2010-opengl/engines/agos/agos.cpp
    scummvm/branches/gsoc2010-opengl/engines/agos/event.cpp
    scummvm/branches/gsoc2010-opengl/engines/agos/res_snd.cpp
    scummvm/branches/gsoc2010-opengl/engines/drascula/drascula.cpp
    scummvm/branches/gsoc2010-opengl/engines/drascula/sound.cpp
    scummvm/branches/gsoc2010-opengl/engines/gob/gob.cpp
    scummvm/branches/gsoc2010-opengl/engines/gob/sound/cdrom.cpp
    scummvm/branches/gsoc2010-opengl/engines/groovie/groovie.cpp
    scummvm/branches/gsoc2010-opengl/engines/groovie/music.cpp
    scummvm/branches/gsoc2010-opengl/engines/kyra/sound_towns.cpp
    scummvm/branches/gsoc2010-opengl/engines/made/made.cpp
    scummvm/branches/gsoc2010-opengl/engines/made/made.h
    scummvm/branches/gsoc2010-opengl/engines/made/scriptfuncs.cpp
    scummvm/branches/gsoc2010-opengl/engines/saga/music.h
    scummvm/branches/gsoc2010-opengl/engines/sci/sound/audio.cpp
    scummvm/branches/gsoc2010-opengl/engines/scumm/he/sound_he.cpp
    scummvm/branches/gsoc2010-opengl/engines/scumm/saveload.cpp
    scummvm/branches/gsoc2010-opengl/engines/scumm/scumm.cpp
    scummvm/branches/gsoc2010-opengl/engines/scumm/sound.cpp
    scummvm/branches/gsoc2010-opengl/engines/teenagent/teenagent.cpp
    scummvm/branches/gsoc2010-opengl/engines/tinsel/music.cpp
    scummvm/branches/gsoc2010-opengl/engines/tinsel/tinsel.cpp
    scummvm/branches/gsoc2010-opengl/sound/decoders/flac.cpp
    scummvm/branches/gsoc2010-opengl/sound/decoders/mp3.cpp
    scummvm/branches/gsoc2010-opengl/sound/decoders/vorbis.cpp

Removed Paths:
-------------
    scummvm/branches/gsoc2010-opengl/sound/audiocd.cpp
    scummvm/branches/gsoc2010-opengl/sound/audiocd.h

Modified: scummvm/branches/gsoc2010-opengl/backends/audiocd/abstract-audiocd.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/audiocd/abstract-audiocd.h	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/backends/audiocd/abstract-audiocd.h	2010-06-09 20:09:57 UTC (rev 49548)
@@ -40,11 +40,19 @@
 		int numLoops;
 	};
 
+	// Emulated CD functions, engines should call these functions
 	virtual void play(int track, int numLoops, int startFrame, int duration, bool only_emulate = false) = 0;
 	virtual void stop() = 0;
 	virtual bool isPlaying() const = 0;
 	virtual void update() = 0;
 	virtual Status getStatus() const = 0;
+
+	// Real CD functions. Let Subclasses implement the real code
+	virtual bool openCD(int drive) { return false; }
+	virtual void updateCD() {}
+	virtual bool pollCD() const { return false; }
+	virtual void playCD(int track, int num_loops, int start_frame, int duration) {}
+	virtual void stopCD() {}
 };
 
 #endif

Modified: scummvm/branches/gsoc2010-opengl/backends/audiocd/default/default-audiocd.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/audiocd/default/default-audiocd.h	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/backends/audiocd/default/default-audiocd.h	2010-06-09 20:09:57 UTC (rev 49548)
@@ -34,22 +34,19 @@
 	DefaultAudioCDManager();
 	virtual ~DefaultAudioCDManager() {}
 
-	// Emulated CD functions, engines should call this functions
 	void play(int track, int numLoops, int startFrame, int duration, bool only_emulate = false);
 	void stop();
 	bool isPlaying() const;
 	void update();
 	virtual Status getStatus() const; // Subclasses should override for better status results
 
-protected:
-
-	// Real CD functions. Let Subclasses implement the real code
 	virtual bool openCD(int drive) { return false; }
 	virtual void updateCD() {}
 	virtual bool pollCD() const { return false; }
 	virtual void playCD(int track, int num_loops, int start_frame, int duration) {}
 	virtual void stopCD() {}
 
+protected:
 	Audio::SoundHandle _handle;
 	bool _emulating;
 

Modified: scummvm/branches/gsoc2010-opengl/backends/base-backend.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/base-backend.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/backends/base-backend.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -84,3 +84,11 @@
 	return file.createWriteStream();
 #endif
 }
+
+static DefaultAudioCDManager *s_audiocdManager = 0;
+
+AudioCDManager *BaseBackend::getAudioCD() {
+	if (!s_audiocdManager)
+		s_audiocdManager = new DefaultAudioCDManager();
+	return (AudioCDManager *)s_audiocdManager;
+}

Modified: scummvm/branches/gsoc2010-opengl/backends/base-backend.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/base-backend.h	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/backends/base-backend.h	2010-06-09 20:09:57 UTC (rev 49548)
@@ -28,6 +28,7 @@
 
 #include "common/system.h"
 #include "backends/events/default/default-events.h"
+#include "backends/audiocd/default/default-audiocd.h"
 
 class BaseBackend : public OSystem, Common::EventSource {
 public:
@@ -37,6 +38,8 @@
 
 	virtual Common::SeekableReadStream *createConfigReadStream();
 	virtual Common::WriteStream *createConfigWriteStream();
+
+	virtual AudioCDManager *getAudioCD();
 };
 
 

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -157,6 +157,10 @@
 		_graphicsManager = new SdlGraphicsManager();
 	}
 
+	if (_audiocdManager == 0) {
+		_audiocdManager = new SdlAudioCDManager();
+	}
+
 #if !defined(MACOSX) && !defined(__SYMBIAN32__)
 	// Setup a custom program icon.
 	// Don't set icon on OS X, as we use a nicer external icon there.
@@ -172,7 +176,6 @@
 
 OSystem_SDL::OSystem_SDL()
 	:
-	_cdrom(0),
 	_scrollLock(false),
 	_joystick(0),
 #if MIXER_DOUBLE_BUFFERING
@@ -184,7 +187,8 @@
 	_mixer(0),
 	_timer(0),
 	_mutexManager(0),
-	_graphicsManager(0) {
+	_graphicsManager(0),
+	_audiocdManager(0) {
 
 	// reset mouse state
 	memset(&_km, 0, sizeof(_km));
@@ -384,11 +388,6 @@
 }
 
 void OSystem_SDL::deinit() {
-	if (_cdrom) {
-		SDL_CDStop(_cdrom);
-		SDL_CDClose(_cdrom);
-	}
-
 	if (_joystick)
 		SDL_JoystickClose(_joystick);
 
@@ -669,96 +668,6 @@
 }
 
 #pragma mark -
-#pragma mark --- CD Audio ---
-#pragma mark -
-
-bool OSystem_SDL::openCD(int drive) {
-	if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1)
-		_cdrom = NULL;
-	else {
-		_cdrom = SDL_CDOpen(drive);
-		// Did it open? Check if _cdrom is NULL
-		if (!_cdrom) {
-			warning("Couldn't open drive: %s", SDL_GetError());
-		} else {
-			_cdNumLoops = 0;
-			_cdStopTime = 0;
-			_cdEndTime = 0;
-		}
-	}
-
-	return (_cdrom != NULL);
-}
-
-void OSystem_SDL::stopCD() {	/* Stop CD Audio in 1/10th of a second */
-	_cdStopTime = SDL_GetTicks() + 100;
-	_cdNumLoops = 0;
-}
-
-void OSystem_SDL::playCD(int track, int num_loops, int start_frame, int duration) {
-	if (!num_loops && !start_frame)
-		return;
-
-	if (!_cdrom)
-		return;
-
-	if (duration > 0)
-		duration += 5;
-
-	_cdTrack = track;
-	_cdNumLoops = num_loops;
-	_cdStartFrame = start_frame;
-
-	SDL_CDStatus(_cdrom);
-	if (start_frame == 0 && duration == 0)
-		SDL_CDPlayTracks(_cdrom, track, 0, 1, 0);
-	else
-		SDL_CDPlayTracks(_cdrom, track, start_frame, 0, duration);
-	_cdDuration = duration;
-	_cdStopTime = 0;
-	_cdEndTime = SDL_GetTicks() + _cdrom->track[track].length * 1000 / CD_FPS;
-}
-
-bool OSystem_SDL::pollCD() {
-	if (!_cdrom)
-		return false;
-
-	return (_cdNumLoops != 0 && (SDL_GetTicks() < _cdEndTime || SDL_CDStatus(_cdrom) == CD_PLAYING));
-}
-
-void OSystem_SDL::updateCD() {
-	if (!_cdrom)
-		return;
-
-	if (_cdStopTime != 0 && SDL_GetTicks() >= _cdStopTime) {
-		SDL_CDStop(_cdrom);
-		_cdNumLoops = 0;
-		_cdStopTime = 0;
-		return;
-	}
-
-	if (_cdNumLoops == 0 || SDL_GetTicks() < _cdEndTime)
-		return;
-
-	if (_cdNumLoops != 1 && SDL_CDStatus(_cdrom) != CD_STOPPED) {
-		// Wait another second for it to be done
-		_cdEndTime += 1000;
-		return;
-	}
-
-	if (_cdNumLoops > 0)
-		_cdNumLoops--;
-
-	if (_cdNumLoops != 0) {
-		if (_cdStartFrame == 0 && _cdDuration == 0)
-			SDL_CDPlayTracks(_cdrom, _cdTrack, 0, 1, 0);
-		else
-			SDL_CDPlayTracks(_cdrom, _cdTrack, _cdStartFrame, 0, _cdDuration);
-		_cdEndTime = SDL_GetTicks() + _cdrom->track[_cdTrack].length * 1000 / CD_FPS;
-	}
-}
-
-#pragma mark -
 #pragma mark --- Graphics ---
 #pragma mark -
 
@@ -900,4 +809,13 @@
 void OSystem_SDL::displayMessageOnOSD(const char *msg) {
 	_graphicsManager->displayMessageOnOSD(msg);
 }
+
+#pragma mark -
+#pragma mark --- AudioCD ---
+#pragma mark -
+
+AudioCDManager *OSystem_SDL::getAudioCD() {
+	return (AudioCDManager *)_audiocdManager;
+}
+
 #endif

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h	2010-06-09 20:09:57 UTC (rev 49548)
@@ -36,6 +36,7 @@
 
 #include "backends/mutex/sdl/sdl-mutex.h"
 #include "backends/graphics/sdl/sdl-graphics.h"
+#include "backends/audiocd/sdl/sdl-audiocd.h"
 
 #include "graphics/scaler.h"
 
@@ -69,6 +70,7 @@
 protected:
 	SdlMutexManager *_mutexManager;
 	SdlGraphicsManager *_graphicsManager;
+	SdlAudioCDManager *_audiocdManager;
 
 public:
 	void beginGFXTransaction();
@@ -164,19 +166,6 @@
 
 	virtual Audio::Mixer *getMixer();
 
-	// Poll CD status
-	// Returns true if cd audio is playing
-	bool pollCD();
-
-	// Play CD audio track
-	void playCD(int track, int num_loops, int start_frame, int duration);
-
-	// Stop CD audio track
-	void stopCD();
-
-	// Update CD audio status
-	void updateCD();
-
 	// Quit
 	virtual void quit(); // overloaded by CE backend
 
@@ -210,7 +199,6 @@
 	virtual int getGraphicsMode() const;
 
 	virtual void setWindowCaption(const char *caption);
-	virtual bool openCD(int drive);
 
 	virtual bool hasFeature(Feature f);
 	virtual void setFeatureState(Feature f, bool enable);
@@ -228,15 +216,12 @@
 	virtual Common::SeekableReadStream *createConfigReadStream();
 	virtual Common::WriteStream *createConfigWriteStream();
 
+	virtual AudioCDManager *getAudioCD();
+
 protected:
 	bool _inited;
 	SDL_AudioSpec _obtainedRate;
 
-	// CD Audio
-	SDL_CD *_cdrom;
-	int _cdTrack, _cdNumLoops, _cdStartFrame, _cdDuration;
-	uint32 _cdEndTime, _cdStopTime;
-
 	// Keyboard mouse emulation.  Disabled by fingolfin 2004-12-18.
 	// I am keeping the rest of the code in for now, since the joystick
 	// code (or rather, "hack") uses it, too.
@@ -277,7 +262,6 @@
 	SDL_TimerID _timerID;
 	Common::TimerManager *_timer;
 
-protected:
 	virtual void fillMouseEvent(Common::Event &event, int x, int y); // overloaded by CE backend
 	void toggleMouseGrab();
 

Modified: scummvm/branches/gsoc2010-opengl/base/main.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/base/main.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/base/main.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -52,8 +52,6 @@
 #include "gui/message.h"
 #include "gui/error.h"
 
-#include "sound/audiocd.h"
-
 #include "backends/keymapper/keymapper.h"
 
 #if defined(_WIN32_WCE)
@@ -417,15 +415,6 @@
 			GUI::displayErrorDialog("Could not find any engine capable of running the selected game");
 		}
 
-		// We will destroy 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/branches/gsoc2010-opengl/common/system.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/common/system.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/common/system.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -53,11 +53,3 @@
 
 	return false;
 }
-
-bool OSystem::openCD(int drive) {
-	return false;
-}
-
-bool OSystem::pollCD() {
-	return false;
-}

Modified: scummvm/branches/gsoc2010-opengl/common/system.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/common/system.h	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/common/system.h	2010-06-09 20:09:57 UTC (rev 49548)
@@ -33,6 +33,8 @@
 
 #include "graphics/pixelformat.h"
 
+#include "backends/audiocd/abstract-audiocd.h"
+
 namespace Audio {
 	class Mixer;
 }
@@ -926,47 +928,15 @@
 
 
 
-	/**
-	 * @name Audio CD
-	 * The methods in this group deal with Audio CD playback.
-	 * The default implementation simply does nothing.
-	 * This is the lower level implementation as provided by the
-	 * backends. The engines should use the Audio::AudioCDManager
-	 * class instead of using it directly.
-	 */
+	/** @name Audio CD */
 	//@{
 
 	/**
-	 * Initialise the specified CD drive for audio playback.
-	 * @return true if the CD drive was inited succesfully
+	 * Return the audio cd manager. For more information, refer to the
+	 * AudioCDManager documentation.
 	 */
-	virtual bool openCD(int drive);
+	virtual AudioCDManager *getAudioCD() = 0;
 
-	/**
-	 * Poll CD status.
-	 * @return true if CD audio is playing
-	 */
-	virtual bool pollCD();
-
-	/**
-	 * Start audio CD playback.
-	 * @param track			the track to play.
-	 * @param num_loops		how often playback should be repeated (-1 = infinitely often).
-	 * @param start_frame	the frame at which playback should start (75 frames = 1 second).
-	 * @param duration		the number of frames to play.
-	 */
-	virtual void playCD(int track, int num_loops, int start_frame, int duration) {}
-
-	/**
-	 * Stop audio CD playback.
-	 */
-	virtual void stopCD() {}
-
-	/**
-	 * Update cdrom audio status.
-	 */
-	virtual void updateCD() {}
-
 	//@}
 
 

Modified: scummvm/branches/gsoc2010-opengl/engines/agos/agos.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/agos/agos.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/agos/agos.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -41,7 +41,6 @@
 
 #include "sound/mididrv.h"
 #include "sound/mods/protracker.h"
-#include "sound/audiocd.h"
 
 using Common::File;
 
@@ -901,7 +900,7 @@
 	_midi.close();
 	delete _driver;
 
-	AudioCD.stop();
+	_system->getAudioCD()->stop();
 
 	for (uint i = 0; i < _itemHeap.size(); i++) {
 		delete[] _itemHeap[i];

Modified: scummvm/branches/gsoc2010-opengl/engines/agos/event.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/agos/event.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/agos/event.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -36,8 +36,6 @@
 
 #include "graphics/surface.h"
 
-#include "sound/audiocd.h"
-
 namespace AGOS {
 
 void AGOSEngine::addTimeEvent(uint16 timeout, uint16 subroutine_id) {
@@ -429,7 +427,7 @@
 	uint32 cur = start;
 	uint this_delay, vgaPeriod;
 
-	AudioCD.updateCD();
+	_system->getAudioCD()->updateCD();
 
 	if (_debugger->isAttached())
 		_debugger->onFrame();
@@ -535,7 +533,7 @@
 		if (_leftButton == 1)
 			_leftButtonCount++;
 
-		AudioCD.updateCD();
+		_system->getAudioCD()->updateCD();
 
 		_system->updateScreen();
 

Modified: scummvm/branches/gsoc2010-opengl/engines/agos/res_snd.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/agos/res_snd.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/agos/res_snd.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -30,7 +30,6 @@
 #include "agos/agos.h"
 #include "agos/vga.h"
 
-#include "sound/audiocd.h"
 #include "sound/audiostream.h"
 #include "sound/mididrv.h"
 #include "sound/mods/protracker.h"
@@ -228,9 +227,9 @@
 	stopMusic();
 
 	// Support for compressed music from the ScummVM Music Enhancement Project
-	AudioCD.stop();
-	AudioCD.play(music + 1, -1, 0, 0);
-	if (AudioCD.isPlaying())
+	_system->getAudioCD()->stop();
+	_system->getAudioCD()->play(music + 1, -1, 0, 0);
+	if (_system->getAudioCD()->isPlaying())
 		return;
 
 	if (getPlatform() == Common::kPlatformAmiga) {

Modified: scummvm/branches/gsoc2010-opengl/engines/drascula/drascula.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/drascula/drascula.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/drascula/drascula.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -100,7 +100,7 @@
 
 	int cd_num = ConfMan.getInt("cdrom");
 	if (cd_num >= 0)
-		_system->openCD(cd_num);
+		_system->getAudioCD()->openCD(cd_num);
 
 	_lang = kEnglish;
 

Modified: scummvm/branches/gsoc2010-opengl/engines/drascula/sound.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/drascula/sound.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/drascula/sound.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -23,7 +23,6 @@
  *
  */
 
-#include "sound/audiocd.h"
 #include "sound/audiostream.h"
 #include "sound/mixer.h"
 #include "sound/decoders/raw.h"
@@ -123,20 +122,20 @@
 }
 
 void DrasculaEngine::playMusic(int p) {
-	AudioCD.stop();
-	AudioCD.play(p - 1, 1, 0, 0);
+	_system->getAudioCD()->stop();
+	_system->getAudioCD()->play(p - 1, 1, 0, 0);
 }
 
 void DrasculaEngine::stopMusic() {
-	AudioCD.stop();
+	_system->getAudioCD()->stop();
 }
 
 void DrasculaEngine::updateMusic() {
-	AudioCD.updateCD();
+	_system->getAudioCD()->updateCD();
 }
 
 int DrasculaEngine::musicStatus() {
-	return AudioCD.isPlaying();
+	return _system->getAudioCD()->isPlaying();
 }
 
 void DrasculaEngine::stopSound() {
@@ -157,7 +156,7 @@
 		_system->updateScreen();
 		_system->delayMillis(50);
 	}
-	AudioCD.stop();
+	_system->getAudioCD()->stop();
 	_system->delayMillis(100);
 	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, org_vol);
 }

Modified: scummvm/branches/gsoc2010-opengl/engines/gob/gob.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/gob/gob.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/gob/gob.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -243,7 +243,7 @@
 
 	int cd_num = ConfMan.getInt("cdrom");
 	if (cd_num >= 0)
-		_system->openCD(cd_num);
+		_system->getAudioCD()->openCD(cd_num);
 
 	_global->_debugFlag = 1;
 	_video->_doRangeClamp = true;

Modified: scummvm/branches/gsoc2010-opengl/engines/gob/sound/cdrom.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/gob/sound/cdrom.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/gob/sound/cdrom.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -25,7 +25,6 @@
 
 #include "common/endian.h"
 #include "common/util.h"
-#include "sound/audiocd.h"
 
 #include "gob/gob.h"
 #include "gob/sound/cdrom.h"
@@ -116,7 +115,7 @@
 	// HSG encodes frame information into a double word:
 	// minute multiplied by 4500, plus second multiplied by 75,
 	// plus frame, minus 150
-	AudioCD.play(1, 1, from, to - from + 1);
+	g_system->getAudioCD()->play(1, 1, from, to - from + 1);
 	_cdPlaying = true;
 }
 
@@ -161,7 +160,7 @@
 
 void CDROM::stop() {
 	_curTrackBuffer = 0;
-	AudioCD.stop();
+	g_system->getAudioCD()->stop();
 	_cdPlaying = false;
 }
 

Modified: scummvm/branches/gsoc2010-opengl/engines/groovie/groovie.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/groovie/groovie.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/groovie/groovie.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -217,7 +217,7 @@
 	// Initialize the CD
 	int cd_num = ConfMan.getInt("cdrom");
 	if (cd_num >= 0)
-		_system->openCD(cd_num);
+		_system->getAudioCD()->openCD(cd_num);
 
 	while (!shouldQuit()) {
 		// Show the debugger if required

Modified: scummvm/branches/gsoc2010-opengl/engines/groovie/music.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/groovie/music.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/groovie/music.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -29,7 +29,6 @@
 
 #include "common/config-manager.h"
 #include "common/macresman.h"
-#include "sound/audiocd.h"
 #include "sound/midiparser.h"
 
 namespace Groovie {
@@ -42,7 +41,7 @@
 }
 
 MusicPlayer::~MusicPlayer() {
-	AudioCD.stop();
+	g_system->getAudioCD()->stop();
 }
 
 void MusicPlayer::playSong(uint32 fileref) {
@@ -90,7 +89,7 @@
 		// the song number (it's track 2 on the 2nd CD)
 	} else if ((track == 98) && (_prevCDtrack == 3)) {
 		// Track 98 is used as a hack to stop the credits song
-		AudioCD.stop();
+		g_system->getAudioCD()->stop();
 		return;
 	}
 
@@ -101,16 +100,16 @@
 	// It was in the original interpreter, but it introduces a big delay
 	// in the middle of the introduction, so it's disabled right now
 	/*
-	AudioCD.updateCD();
-	while (AudioCD.isPlaying()) {
+	g_system->getAudioCD()->updateCD();
+	while (g_system->getAudioCD()->isPlaying()) {
 		// Wait a bit and try again
 		_vm->_system->delayMillis(100);
-		AudioCD.updateCD();
+		g_system->getAudioCD()->updateCD();
 	}
 	*/
 
 	// Play the track starting at the requested offset (1000ms = 75 frames)
-	AudioCD.play(track - 1, 1, startms * 75 / 1000, 0);
+	g_system->getAudioCD()->play(track - 1, 1, startms * 75 / 1000, 0);
 }
 
 void MusicPlayer::startBackground() {

Modified: scummvm/branches/gsoc2010-opengl/engines/kyra/sound_towns.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/kyra/sound_towns.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/kyra/sound_towns.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -28,7 +28,6 @@
 #include "kyra/sound_intern.h"
 #include "kyra/screen.h"
 
-#include "sound/audiocd.h"
 #include "sound/audiostream.h"
 #include "sound/decoders/raw.h"
 
@@ -3775,7 +3774,7 @@
 }
 
 SoundTowns::~SoundTowns() {
-	AudioCD.stop();
+	g_system->getAudioCD()->stop();
 	haltTrack();
 	delete[] _sfxFileData;
 
@@ -3796,7 +3795,7 @@
 }
 
 void SoundTowns::process() {
-	AudioCD.updateCD();
+	g_system->getAudioCD()->updateCD();
 }
 
 void SoundTowns::playTrack(uint8 track) {
@@ -3816,8 +3815,8 @@
 	beginFadeOut();
 
 	if (_musicEnabled == 2 && trackNum != -1) {
-		AudioCD.play(trackNum+1, loop ? -1 : 1, 0, 0);
-		AudioCD.updateCD();
+		g_system->getAudioCD()->play(trackNum+1, loop ? -1 : 1, 0, 0);
+		g_system->getAudioCD()->updateCD();
 	} else if (_musicEnabled) {
 		playEuphonyTrack(READ_LE_UINT32(&tTable[tTableIndex]), loop);
 	}
@@ -3827,8 +3826,8 @@
 
 void SoundTowns::haltTrack() {
 	_lastTrack = -1;
-	AudioCD.stop();
-	AudioCD.updateCD();
+	g_system->getAudioCD()->stop();
+	g_system->getAudioCD()->updateCD();
 	if (_parser) {
 		Common::StackLock lock(_mutex);
 		_parser->setTrack(0);
@@ -3936,8 +3935,8 @@
 	_driver->fading();
 
 	// TODO: this should fade out too
-	AudioCD.stop();
-	AudioCD.updateCD();
+	g_system->getAudioCD()->stop();
+	g_system->getAudioCD()->updateCD();
 }
 
 int SoundTowns::open() {
@@ -4099,8 +4098,8 @@
 
 void SoundPC98::haltTrack() {
 	_lastTrack = -1;
-	AudioCD.stop();
-	AudioCD.updateCD();
+	g_system->getAudioCD()->stop();
+	g_system->getAudioCD()->updateCD();
 	_driver->reset();
 }
 
@@ -4169,7 +4168,7 @@
 }
 
 void SoundTownsPC98_v2::process() {
-	AudioCD.updateCD();
+	g_system->getAudioCD()->updateCD();
 }
 
 void SoundTownsPC98_v2::playTrack(uint8 track) {
@@ -4206,8 +4205,8 @@
 	_driver->loadMusicData(_musicTrackData, true);
 
 	if (_musicEnabled == 2 && trackNum != -1) {
-		AudioCD.play(trackNum+1, _driver->looping() ? -1 : 1, 0, 0);
-		AudioCD.updateCD();
+		g_system->getAudioCD()->play(trackNum+1, _driver->looping() ? -1 : 1, 0, 0);
+		g_system->getAudioCD()->updateCD();
 	} else if (_musicEnabled) {
 		_driver->cont();
 	}
@@ -4217,8 +4216,8 @@
 
 void SoundTownsPC98_v2::haltTrack() {
 	_lastTrack = -1;
-	AudioCD.stop();
-	AudioCD.updateCD();
+	g_system->getAudioCD()->stop();
+	g_system->getAudioCD()->updateCD();
 	_driver->reset();
 }
 

Modified: scummvm/branches/gsoc2010-opengl/engines/made/made.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/made/made.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/made/made.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -38,7 +38,6 @@
 #include "base/plugins.h"
 #include "base/version.h"
 
-#include "sound/audiocd.h"
 #include "sound/mixer.h"
 
 #include "made/made.h"
@@ -81,7 +80,7 @@
 
 	int cd_num = ConfMan.getInt("cdrom");
 	if (cd_num >= 0)
-		_system->openCD(cd_num);
+		_system->getAudioCD()->openCD(cd_num);
 
 	_pmvPlayer = new PmvPlayer(this, _mixer);
 	_res = new ResourceReader();
@@ -129,7 +128,7 @@
 }
 
 MadeEngine::~MadeEngine() {
-	AudioCD.stop();
+	_system->getAudioCD()->stop();
 
 	delete _rnd;
 	delete _pmvPlayer;
@@ -241,7 +240,7 @@
 		}
 	}
 
-	AudioCD.updateCD();
+	_system->getAudioCD()->updateCD();
 
 }
 

Modified: scummvm/branches/gsoc2010-opengl/engines/made/made.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/made/made.h	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/made/made.h	2010-06-09 20:09:57 UTC (rev 49548)
@@ -42,7 +42,6 @@
 #include "sound/audiostream.h"
 #include "sound/mixer.h"
 #include "sound/decoders/voc.h"
-#include "sound/audiocd.h"
 
 #include "engines/engine.h"
 

Modified: scummvm/branches/gsoc2010-opengl/engines/made/scriptfuncs.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/made/scriptfuncs.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/made/scriptfuncs.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -27,7 +27,6 @@
 #include "common/util.h"
 #include "common/events.h"
 #include "graphics/cursorman.h"
-#include "sound/audiocd.h"
 
 #include "made/made.h"
 #include "made/resource.h"
@@ -595,9 +594,9 @@
 }
 
 int16 ScriptFunctions::sfPlayCd(int16 argc, int16 *argv) {
-	AudioCD.play(argv[0] - 1, 1, 0, 0);
+	g_system->getAudioCD()->play(argv[0] - 1, 1, 0, 0);
 	_vm->_cdTimeStart = _vm->_system->getMillis();
-	if (AudioCD.isPlaying()) {
+	if (g_system->getAudioCD()->isPlaying()) {
 		return 1;
 	} else {
 		return 0;
@@ -605,8 +604,8 @@
 }
 
 int16 ScriptFunctions::sfStopCd(int16 argc, int16 *argv) {
-	if (AudioCD.isPlaying()) {
-		AudioCD.stop();
+	if (g_system->getAudioCD()->isPlaying()) {
+		g_system->getAudioCD()->stop();
 		return 1;
 	} else {
 		return 0;
@@ -614,11 +613,11 @@
 }
 
 int16 ScriptFunctions::sfGetCdStatus(int16 argc, int16 *argv) {
-	return AudioCD.isPlaying() ? 1 : 0;
+	return g_system->getAudioCD()->isPlaying() ? 1 : 0;
 }
 
 int16 ScriptFunctions::sfGetCdTime(int16 argc, int16 *argv) {
-	if (AudioCD.isPlaying()) {
+	if (g_system->getAudioCD()->isPlaying()) {
 		uint32 deltaTime = _vm->_system->getMillis() - _vm->_cdTimeStart;
 		// This basically converts the time from milliseconds to MSF format to MADE's format
 		return (deltaTime / 1000 * 30) + (deltaTime % 1000 / 75 * 30 / 75);

Modified: scummvm/branches/gsoc2010-opengl/engines/saga/music.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/saga/music.h	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/saga/music.h	2010-06-09 20:09:57 UTC (rev 49548)
@@ -28,7 +28,7 @@
 #ifndef SAGA_MUSIC_H
 #define SAGA_MUSIC_H
 
-#include "sound/audiocd.h"
+#include "sound/mixer.h"
 #include "sound/mididrv.h"
 #include "sound/midiparser.h"
 #include "sound/decoders/mp3.h"

Modified: scummvm/branches/gsoc2010-opengl/engines/sci/sound/audio.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/sci/sound/audio.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/sci/sound/audio.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -33,7 +33,6 @@
 #include "common/file.h"
 
 #include "sound/audiostream.h"
-#include "sound/audiocd.h"
 #include "sound/decoders/raw.h"
 #include "sound/decoders/wave.h"
 #include "sound/decoders/flac.h"
@@ -375,7 +374,7 @@
 
 		// Subtract one from track. KQ6 starts at track 1, while ScummVM
 		// ignores the data track and considers track 2 to be track 1.
-		AudioCD.play(track - 1, 1, start, duration);
+		g_system->getAudioCD()->play(track - 1, 1, start, duration);
 		return 1;
 	} else {
 		// Jones in the Fast Lane CD Audio format
@@ -398,7 +397,7 @@
 
 			// Jones uses the track as the resource value in the map
 			if (res == track) {
-				AudioCD.play(1, 1, startFrame, length);
+				g_system->getAudioCD()->play(1, 1, startFrame, length);
 				_audioCdStart = g_system->getMillis();
 				break;
 			}
@@ -412,16 +411,16 @@
 
 void AudioPlayer::audioCdStop() {
 	_audioCdStart = 0;
-	AudioCD.stop();
+	g_system->getAudioCD()->stop();
 }
 
 void AudioPlayer::audioCdUpdate() {
-	AudioCD.updateCD();
+	g_system->getAudioCD()->update();
 }
 
 int AudioPlayer::audioCdPosition() {
 	// Return -1 if the sample is done playing. Converting to frames to compare.
-	if (((g_system->getMillis() - _audioCdStart) * 75 / 1000) >= (uint32)AudioCD.getStatus().duration)
+	if (((g_system->getMillis() - _audioCdStart) * 75 / 1000) >= (uint32)g_system->getAudioCD()->getStatus().duration)
 		return -1;
 
 	// Return the position otherwise (in ticks).

Modified: scummvm/branches/gsoc2010-opengl/engines/scumm/he/sound_he.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/scumm/he/sound_he.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/scumm/he/sound_he.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -36,7 +36,6 @@
 #include "common/util.h"
 
 #include "sound/decoders/adpcm.h"
-#include "sound/audiocd.h"
 #include "sound/decoders/flac.h"
 #include "sound/mididrv.h"
 #include "sound/mixer.h"

Modified: scummvm/branches/gsoc2010-opengl/engines/scumm/saveload.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/scumm/saveload.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/scumm/saveload.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -42,7 +42,6 @@
 #include "scumm/he/sprite_he.h"
 #include "scumm/verbs.h"
 
-#include "sound/audiocd.h"
 #include "sound/mixer.h"
 
 #include "graphics/thumbnail.h"
@@ -1099,7 +1098,7 @@
 	// as AudioCDManager::Status::playing, and MSVC6 has
 	// a fit with that. This typedef simplifies the notation
 	// to something MSVC6 can grasp.
-	typedef Audio::AudioCDManager::Status AudioCDManager_Status;
+	typedef AudioCDManager::Status AudioCDManager_Status;
 	const SaveLoadEntry audioCDEntries[] = {
 		MKLINE(AudioCDManager_Status, playing, sleUint32, VER(24)),
 		MKLINE(AudioCDManager_Status, track, sleInt32, VER(24)),
@@ -1371,15 +1370,15 @@
 	// Save/load the Audio CD status
 	//
 	if (s->getVersion() >= VER(24)) {
-		Audio::AudioCDManager::Status info;
+		AudioCDManager::Status info;
 		if (s->isSaving())
-			info = AudioCD.getStatus();
+			info = _system->getAudioCD()->getStatus();
 		s->saveLoadArrayOf(&info, 1, sizeof(info), audioCDEntries);
 		// If we are loading, and the music being loaded was supposed to loop
 		// forever, then resume playing it. This helps a lot when the audio CD
 		// is used to provide ambient music (see bug #788195).
 		if (s->isLoading() && info.playing && info.numLoops < 0)
-			AudioCD.play(info.track, info.numLoops, info.start, info.duration);
+			_system->getAudioCD()->play(info.track, info.numLoops, info.start, info.duration);
 	}
 
 

Modified: scummvm/branches/gsoc2010-opengl/engines/scumm/scumm.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/scumm/scumm.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/scumm/scumm.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -1149,7 +1149,7 @@
 
 		int cd_num = ConfMan.getInt("cdrom");
 		if (cd_num >= 0)
-			_system->openCD(cd_num);
+			_system->getAudioCD()->openCD(cd_num);
 	}
 
 	// Create the sound manager

Modified: scummvm/branches/gsoc2010-opengl/engines/scumm/sound.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/scumm/sound.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/scumm/sound.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -36,7 +36,6 @@
 #include "scumm/util.h"
 
 #include "sound/decoders/adpcm.h"
-#include "sound/audiocd.h"
 #include "sound/decoders/flac.h"
 #include "sound/mididrv.h"
 #include "sound/mixer.h"
@@ -87,7 +86,7 @@
 
 Sound::~Sound() {
 	stopCDTimer();
-	AudioCD.stop();
+	g_system->getAudioCD()->stop();
 	delete _sfxFile;
 }
 
@@ -1069,7 +1068,7 @@
 
 	// Play it
 	if (!_soundsPaused)
-		AudioCD.play(track, numLoops, startFrame, duration);
+		g_system->getAudioCD()->play(track, numLoops, startFrame, duration);
 
 	// Start the timer after starting the track. Starting an MP3 track is
 	// almost instantaneous, but a CD player may take some time. Hopefully
@@ -1078,15 +1077,15 @@
 }
 
 void Sound::stopCD() {
-	AudioCD.stop();
+	g_system->getAudioCD()->stop();
 }
 
 int Sound::pollCD() const {
-	return AudioCD.isPlaying();
+	return g_system->getAudioCD()->isPlaying();
 }
 
 void Sound::updateCD() {
-	AudioCD.updateCD();
+	g_system->getAudioCD()->updateCD();
 }
 
 void Sound::saveLoadWithSerializer(Serializer *ser) {

Modified: scummvm/branches/gsoc2010-opengl/engines/teenagent/teenagent.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/teenagent/teenagent.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/teenagent/teenagent.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -31,7 +31,6 @@
 #include "engines/advancedDetector.h"
 #include "engines/util.h"
 
-#include "sound/audiocd.h"
 #include "sound/mixer.h"
 #include "sound/decoders/raw.h"
 
@@ -985,7 +984,7 @@
 		}
 		byte track = track2cd[id - 1];
 		debug(0, "playing cd track %u", track);
-		Audio::AudioCDManager::instance().play(track, -1, 0, 0);
+		_system->getAudioCD()->play(track, -1, 0, 0);
 	} else if (music->load(id))
 		music->start();
 }

Modified: scummvm/branches/gsoc2010-opengl/engines/tinsel/music.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/tinsel/music.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/tinsel/music.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -30,7 +30,6 @@
 #include "sound/audiostream.h"
 #include "sound/mididrv.h"
 #include "sound/midiparser.h"
-#include "sound/audiocd.h"
 #include "sound/decoders/adpcm.h"
 #include "common/config-manager.h"
 #include "common/file.h"
@@ -212,11 +211,11 @@
 				currentLoop = bLoop;
 
 				// try to play track, but don't fall back to a true CD
-				AudioCD.play(track, bLoop ? -1 : 1, 0, 0, true);
+				g_system->getAudioCD()->play(track, bLoop ? -1 : 1, 0, 0, true);
 
 				// Check if an enhanced audio track is being played.
 				// If it is, stop here and don't load a MIDI track
-				if (AudioCD.isPlaying()) {
+				if (g_system->getAudioCD()->isPlaying()) {
 					return true;
 				}
 			}
@@ -291,7 +290,7 @@
  */
 bool MidiPlaying() {
 	if (_vm->getFeatures() & GF_ENHANCED_AUDIO_SUPPORT) {
-		if (AudioCD.isPlaying())
+		if (g_system->getAudioCD()->isPlaying())
 			return true;
 	}
 	return _vm->_midiMusic->isPlaying();
@@ -305,7 +304,7 @@
 	currentLoop = false;
 
 	if (_vm->getFeatures() & GF_ENHANCED_AUDIO_SUPPORT) {
-		AudioCD.stop();
+		g_system->getAudioCD()->stop();
 	}
 
 	_vm->_midiMusic->stop();

Modified: scummvm/branches/gsoc2010-opengl/engines/tinsel/tinsel.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/tinsel/tinsel.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/engines/tinsel/tinsel.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -45,7 +45,6 @@
 
 #include "sound/mididrv.h"
 #include "sound/mixer.h"
-#include "sound/audiocd.h"
 
 #include "tinsel/actors.h"
 #include "tinsel/background.h"
@@ -854,7 +853,7 @@
 
 	int cd_num = ConfMan.getInt("cdrom");
 	if (cd_num >= 0)
-		_system->openCD(cd_num);
+		_system->getAudioCD()->openCD(cd_num);
 
 	MidiDriverType midiDriver = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MIDI);
 	bool native_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
@@ -885,7 +884,7 @@
 	if (_bmv->MoviePlaying())
 		_bmv->FinishBMV();
 
-	AudioCD.stop();
+	_system->getAudioCD()->stop();
 	delete _bmv;
 	delete _sound;
 	delete _midiMusic;
@@ -1007,7 +1006,7 @@
 		// Check for time to do next game cycle
 		if ((g_system->getMillis() > timerVal + GAME_FRAME_DELAY)) {
 			timerVal = g_system->getMillis();
-			AudioCD.updateCD();
+			_system->getAudioCD()->updateCD();
 			NextGameCycle();
 		}
 

Deleted: scummvm/branches/gsoc2010-opengl/sound/audiocd.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/sound/audiocd.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/sound/audiocd.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -1,136 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "sound/audiocd.h"
-#include "sound/audiostream.h"
-#include "sound/decoders/mp3.h"
-#include "sound/decoders/vorbis.h"
-#include "sound/decoders/flac.h"
-#include "engines/engine.h"
-#include "common/util.h"
-#include "common/system.h"
-
-DECLARE_SINGLETON(Audio::AudioCDManager)
-
-namespace Audio {
-
-AudioCDManager::AudioCDManager() {
-	_cd.playing = false;
-	_cd.track = 0;
-	_cd.start = 0;
-	_cd.duration = 0;
-	_cd.numLoops = 0;
-	_mixer = g_system->getMixer();
-	_emulating = false;
-	assert(_mixer);
-}
-
-void AudioCDManager::play(int track, int numLoops, int startFrame, int duration, bool only_emulate) {
-	if (numLoops != 0 || startFrame != 0) {
-		_cd.track = track;
-		_cd.numLoops = numLoops;
-		_cd.start = startFrame;
-		_cd.duration = duration;
-
-		// Try to load the track from a compressed data file, and if found, use
-		// that. If not found, attempt to start regular Audio CD playback of
-		// the requested track.
-		char trackName[2][16];
-		sprintf(trackName[0], "track%d", track);
-		sprintf(trackName[1], "track%02d", track);
-		Audio::SeekableAudioStream *stream = 0;
-
-		for (int i = 0; !stream && i < 2; ++i)
-			stream = SeekableAudioStream::openStreamFile(trackName[i]);
-
-		// Stop any currently playing emulated track
-		_mixer->stopHandle(_handle);
-
-		if (stream != 0) {
-			Timestamp start = Timestamp(0, startFrame, 75);
-			Timestamp end = duration ? Timestamp(0, startFrame + duration, 75) : stream->getLength();
-
-			/*
-			FIXME: Seems numLoops == 0 and numLoops == 1 both indicate a single repetition,
-			while all other positive numbers indicate precisely the number of desired
-			repetitions. Finally, -1 means infinitely many
-			*/
-			_emulating = true;
-			_mixer->playStream(Mixer::kMusicSoundType, &_handle,
-			                        makeLoopingAudioStream(stream, start, end, (numLoops < 1) ? numLoops + 1 : numLoops));
-		} else {
-			_emulating = false;
-			if (!only_emulate)
-				g_system->playCD(track, numLoops, startFrame, duration);
-		}
-	}
-}
-
-void AudioCDManager::stop() {
-	if (_emulating) {
-		// Audio CD emulation
-		_mixer->stopHandle(_handle);
-		_emulating = false;
-	} else {
-		// Real Audio CD
-		g_system->stopCD();
-	}
-}
-
-bool AudioCDManager::isPlaying() const {
-	if (_emulating) {
-		// Audio CD emulation
-		return _mixer->isSoundHandleActive(_handle);
-	} else {
-		// Real Audio CD
-		return g_system->pollCD();
-	}
-}
-
-void AudioCDManager::updateCD() {
-	if (_emulating) {
-		// Check whether the audio track stopped playback
-		if (!_mixer->isSoundHandleActive(_handle)) {
-			// FIXME: We do not update the numLoops parameter here (and in fact,
-			// currently can't do that). Luckily, only one engine ever checks
-			// this part of the AudioCD status, namely the SCUMM engine; and it
-			// only checks whether the track is currently set to infinite looping
-			// or not.
-			_emulating = false;
-		}
-	} else {
-		g_system->updateCD();
-	}
-}
-
-AudioCDManager::Status AudioCDManager::getStatus() const {
-	// TODO: This could be improved for "real" CD playback.
-	// But to do that, we would have to extend the OSystem interface.
-	Status info = _cd;
-	info.playing = isPlaying();
-	return info;
-}
-
-} // End of namespace Audio

Deleted: scummvm/branches/gsoc2010-opengl/sound/audiocd.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/sound/audiocd.h	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/sound/audiocd.h	2010-06-09 20:09:57 UTC (rev 49548)
@@ -1,91 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#ifndef SOUND_AUDIOCD_H
-#define SOUND_AUDIOCD_H
-
-#include "common/scummsys.h"
-#include "common/singleton.h"
-#include "sound/mixer.h"
-
-
-namespace Audio {
-
-
-class AudioCDManager : public Common::Singleton<AudioCDManager> {
-public:
-	struct Status {
-		bool playing;
-		int track;
-		int start;
-		int duration;
-		int numLoops;
-	};
-
-	/**
-	 * Start playback of the specified "CD" track. This method mimics
-	 * the interface of OSystem::playCD (which it in fact may call, if an Audio CD is
-	 * present), but also can play digital audio tracks in various formats.
-	 *
-	 * @param track			the track to play.
-	 * @param num_loops		how often playback should be repeated (-1 = infinitely often).
-	 * @param start_frame	the frame at which playback should start (75 frames = 1 second).
-	 * @param duration		the number of frames to play (0: play until end)
-	 * @param only_emulate  if true, don't try to play from a real CD
-	 */
-	void play(int track, int numLoops, int startFrame, int duration, bool only_emulate = false);
-	void stop();
-	bool isPlaying() const;
-
-	void updateCD();
-
-	Status getStatus() const;
-
-private:
-	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 with 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;
-
-	Status _cd;
-	Mixer	*_mixer;
-};
-
-/** Shortcut for accessing the audio CD manager. */
-#define AudioCD		Audio::AudioCDManager::instance()
-
-} // End of namespace Audio
-
-#endif

Modified: scummvm/branches/gsoc2010-opengl/sound/decoders/flac.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/sound/decoders/flac.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/sound/decoders/flac.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -32,7 +32,6 @@
 #include "common/util.h"
 
 #include "sound/audiostream.h"
-#include "sound/audiocd.h"
 
 #define FLAC__NO_DLL // that MS-magic gave me headaches - just link the library you like
 #include <FLAC/export.h>

Modified: scummvm/branches/gsoc2010-opengl/sound/decoders/mp3.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/sound/decoders/mp3.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/sound/decoders/mp3.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -31,7 +31,6 @@
 #include "common/stream.h"
 #include "common/util.h"
 
-#include "sound/audiocd.h"
 #include "sound/audiostream.h"
 
 #include <mad.h>

Modified: scummvm/branches/gsoc2010-opengl/sound/decoders/vorbis.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/sound/decoders/vorbis.cpp	2010-06-09 18:51:55 UTC (rev 49547)
+++ scummvm/branches/gsoc2010-opengl/sound/decoders/vorbis.cpp	2010-06-09 20:09:57 UTC (rev 49548)
@@ -32,7 +32,6 @@
 #include "common/util.h"
 
 #include "sound/audiostream.h"
-#include "sound/audiocd.h"
 
 #ifdef USE_TREMOR
 #if defined(ANDROID) || defined(__GP32__) // custom libtremor locations


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