[Scummvm-cvs-logs] SF.net SVN: scummvm:[36029] scummvm/trunk/sound

wjpalenstijn at users.sourceforge.net wjpalenstijn at users.sourceforge.net
Sat Jan 24 02:23:05 CET 2009


Revision: 36029
          http://scummvm.svn.sourceforge.net/scummvm/?rev=36029&view=rev
Author:   wjpalenstijn
Date:     2009-01-24 01:23:04 +0000 (Sat, 24 Jan 2009)

Log Message:
-----------
remove 'HACK': don't use _cd.playing to indicate emulation

Modified Paths:
--------------
    scummvm/trunk/sound/audiocd.cpp
    scummvm/trunk/sound/audiocd.h

Modified: scummvm/trunk/sound/audiocd.cpp
===================================================================
--- scummvm/trunk/sound/audiocd.cpp	2009-01-24 01:03:06 UTC (rev 36028)
+++ scummvm/trunk/sound/audiocd.cpp	2009-01-24 01:23:04 UTC (rev 36029)
@@ -43,6 +43,7 @@
 	_cd.duration = 0;
 	_cd.numLoops = 0;
 	_mixer = g_system->getMixer();
+	_emulating = false;
 	assert(_mixer);
 }
 
@@ -72,24 +73,23 @@
 		}
 
 		// Stop any currently playing emulated track
-		_mixer->stopHandle(_cd.handle);
+		_mixer->stopHandle(_handle);
 
-		// HACK: We abuse _cd.playing to store whether we are playing a real or an emulated track.
 		if (stream != 0) {
-			_cd.playing = true;
-			_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_cd.handle, stream);
+			_emulating = true;
+			_mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_handle, stream);
 		} else {
-			_cd.playing = false;
+			_emulating = false;
 			g_system->playCD(track, numLoops, startFrame, duration);
 		}
 	}
 }
 
 void AudioCDManager::stop() {
-	if (_cd.playing) {
+	if (_emulating) {
 		// Audio CD emulation
-		_mixer->stopHandle(_cd.handle);
-		_cd.playing = false;
+		_mixer->stopHandle(_handle);
+		_emulating = false;
 	} else {
 		// Real Audio CD
 		g_system->stopCD();
@@ -97,9 +97,9 @@
 }
 
 bool AudioCDManager::isPlaying() const {
-	if (_cd.playing) {
+	if (_emulating) {
 		// Audio CD emulation
-		return _mixer->isSoundHandleActive(_cd.handle);
+		return _mixer->isSoundHandleActive(_handle);
 	} else {
 		// Real Audio CD
 		return g_system->pollCD();
@@ -107,15 +107,15 @@
 }
 
 void AudioCDManager::updateCD() {
-	if (_cd.playing) {
+	if (_emulating) {
 		// Check whether the audio track stopped playback
-		if (!_mixer->isSoundHandleActive(_cd.handle)) {
+		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.
-			_cd.playing = false;
+			_emulating = false;
 		}
 	} else {
 		g_system->updateCD();

Modified: scummvm/trunk/sound/audiocd.h
===================================================================
--- scummvm/trunk/sound/audiocd.h	2009-01-24 01:03:06 UTC (rev 36028)
+++ scummvm/trunk/sound/audiocd.h	2009-01-24 01:23:04 UTC (rev 36029)
@@ -67,11 +67,10 @@
 	AudioCDManager();
 
 	/* used for emulated CD music */
-	struct ExtStatus : Status {
-		SoundHandle handle;
-	};
-	ExtStatus _cd;
+	SoundHandle _handle;
+	bool _emulating;
 
+	Status _cd;
 	Mixer	*_mixer;
 };
 


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