[Scummvm-cvs-logs] SF.net SVN: scummvm:[45654] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Nov 4 10:49:29 CET 2009


Revision: 45654
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45654&view=rev
Author:   thebluegr
Date:     2009-11-04 09:49:28 +0000 (Wed, 04 Nov 2009)

Log Message:
-----------
Moved sound sync related variables inside the AudioPlayer class and fixed compilation

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/ksound.cpp
    scummvm/trunk/engines/sci/sfx/audio.cpp
    scummvm/trunk/engines/sci/sfx/audio.h
    scummvm/trunk/engines/sci/sfx/core.cpp
    scummvm/trunk/engines/sci/sfx/core.h

Modified: scummvm/trunk/engines/sci/engine/ksound.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/ksound.cpp	2009-11-04 09:36:18 UTC (rev 45653)
+++ scummvm/trunk/engines/sci/engine/ksound.cpp	2009-11-04 09:49:28 UTC (rev 45654)
@@ -1189,9 +1189,9 @@
 	case kSciAudioSyncStart: {
 		ResourceId id;
 
-		if (s->_sound._syncResource) {
-			s->resMan->unlockResource(s->_sound._syncResource);
-			s->_sound._syncResource = NULL;
+		if (s->_audio->_syncResource) {
+			s->resMan->unlockResource(s->_audio->_syncResource);
+			s->_audio->_syncResource = NULL;
 		}
 
 		// Load sound sync resource and lock it
@@ -1205,11 +1205,11 @@
 			return s->r_acc;
 		}
 
-		s->_sound._syncResource = s->resMan->findResource(id, 1);
+		s->_audio->_syncResource = s->resMan->findResource(id, 1);
 
-		if (s->_sound._syncResource) {
+		if (s->_audio->_syncResource) {
 			PUT_SEL32V(segMan, argv[1], syncCue, 0);
-			s->_sound._syncOffset = 0;
+			s->_audio->_syncOffset = 0;
 		} else {
 			warning("DoSync: failed to find resource %s", id.toString().c_str());
 			// Notify the scripts to stop sound sync
@@ -1218,16 +1218,16 @@
 		break;
 	}
 	case kSciAudioSyncNext: {
-		Resource *res = s->_sound._syncResource;
-		if (res && (s->_sound._syncOffset < res->size - 1)) {
+		Resource *res = s->_audio->_syncResource;
+		if (res && (s->_audio->_syncOffset < res->size - 1)) {
 			int16 syncCue = -1;
-			int16 syncTime = (int16)READ_LE_UINT16(res->data + s->_sound._syncOffset);
+			int16 syncTime = (int16)READ_LE_UINT16(res->data + s->_audio->_syncOffset);
 
-			s->_sound._syncOffset += 2;
+			s->_audio->_syncOffset += 2;
 
-			if ((syncTime != -1) && (s->_sound._syncOffset < res->size - 1)) {
-				syncCue = (int16)READ_LE_UINT16(res->data + s->_sound._syncOffset);
-				s->_sound._syncOffset += 2;
+			if ((syncTime != -1) && (s->_audio->_syncOffset < res->size - 1)) {
+				syncCue = (int16)READ_LE_UINT16(res->data + s->_audio->_syncOffset);
+				s->_audio->_syncOffset += 2;
 			}
 
 			PUT_SEL32V(segMan, argv[1], syncTime, syncTime);
@@ -1236,9 +1236,9 @@
 		break;
 	}
 	case kSciAudioSyncStop:
-		if (s->_sound._syncResource) {
-			s->resMan->unlockResource(s->_sound._syncResource);
-			s->_sound._syncResource = NULL;
+		if (s->_audio->_syncResource) {
+			s->resMan->unlockResource(s->_audio->_syncResource);
+			s->_audio->_syncResource = NULL;
 		}
 		break;
 	default:

Modified: scummvm/trunk/engines/sci/sfx/audio.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/audio.cpp	2009-11-04 09:36:18 UTC (rev 45653)
+++ scummvm/trunk/engines/sci/sfx/audio.cpp	2009-11-04 09:49:28 UTC (rev 45654)
@@ -33,6 +33,17 @@
 
 namespace Sci {
 
+AudioPlayer::AudioPlayer(ResourceManager *resMan) : _resMan(resMan), _audioRate(11025),
+		_syncResource(NULL), _syncOffset(0) {
+}
+
+AudioPlayer::~AudioPlayer() {
+	stopAudio();
+
+	if (_syncResource)
+		_resMan->unlockResource(_syncResource);
+}
+
 int AudioPlayer::startAudio(uint16 module, uint32 number) {
 	int sampleLen;
 	Audio::AudioStream *audioStream = getAudioStream(number, module, &sampleLen);

Modified: scummvm/trunk/engines/sci/sfx/audio.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/audio.h	2009-11-04 09:36:18 UTC (rev 45653)
+++ scummvm/trunk/engines/sci/sfx/audio.h	2009-11-04 09:49:28 UTC (rev 45654)
@@ -33,8 +33,8 @@
 
 class AudioPlayer {
 public:
-	AudioPlayer(ResourceManager *resMan) : _resMan(resMan), _audioRate(11025) { }
-	AudioPlayer::~AudioPlayer() { stopAudio(); }
+	AudioPlayer(ResourceManager *resMan);
+	~AudioPlayer();
 		
 	void setAudioRate(uint16 rate) { _audioRate = rate; }
 	Audio::SoundHandle* getAudioHandle() { return &_audioHandle; }
@@ -44,6 +44,9 @@
 	void pauseAudio() { g_system->getMixer()->pauseHandle(_audioHandle, true); }
 	void resumeAudio() { g_system->getMixer()->pauseHandle(_audioHandle, false); }
 
+	Resource *_syncResource; /**< Used by kDoSync for speech syncing in CD talkie games */
+	uint _syncOffset;
+
 private:
 	ResourceManager *_resMan;
 	uint16 _audioRate;

Modified: scummvm/trunk/engines/sci/sfx/core.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/core.cpp	2009-11-04 09:36:18 UTC (rev 45653)
+++ scummvm/trunk/engines/sci/sfx/core.cpp	2009-11-04 09:49:28 UTC (rev 45654)
@@ -357,12 +357,9 @@
 	_flags = 0;
 	_song = NULL;
 	_suspended = 0;
-	_syncResource = NULL;
 }
 
 SfxState::~SfxState() {
-	if (_syncResource)
-		_resMan->unlockResource(_syncResource);
 }
 
 
@@ -653,8 +650,6 @@
 	_songlib._lib = 0;
 	_song = NULL;
 	_flags = flags;
-	_syncResource = NULL;
-	_syncOffset = 0;
 
 	_player = NULL;
 

Modified: scummvm/trunk/engines/sci/sfx/core.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/core.h	2009-11-04 09:36:18 UTC (rev 45653)
+++ scummvm/trunk/engines/sci/sfx/core.h	2009-11-04 09:49:28 UTC (rev 45654)
@@ -54,8 +54,6 @@
 	SongLibrary _songlib; /**< Song library */
 	Song *_song; /**< Active song, or start of active song chain */
 	bool _suspended; /**< Whether we are suspended */
-	Resource *_syncResource; /**< Used by kDoSync for speech syncing in CD talkie games */
-	uint _syncOffset;
 	ResourceManager *_resMan;
 
 public:


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