[Scummvm-cvs-logs] SF.net SVN: scummvm:[52569] scummvm/trunk/engines/sci/sound/music.cpp

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun Sep 5 21:34:28 CEST 2010


Revision: 52569
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52569&view=rev
Author:   m_kiewitz
Date:     2010-09-05 19:34:26 +0000 (Sun, 05 Sep 2010)

Log Message:
-----------
SCI: ignore kDoSound volume changes on samples

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sound/music.cpp

Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp	2010-09-05 19:25:08 UTC (rev 52568)
+++ scummvm/trunk/engines/sci/sound/music.cpp	2010-09-05 19:34:26 UTC (rev 52569)
@@ -352,24 +352,25 @@
 		}
 	}
 
-	if (pSnd->pStreamAud && !_pMixer->isSoundHandleActive(pSnd->hCurrentAud)) {
-		// Sierra SCI ignores volume set when playing samples via kDoSound
-		//  At least freddy pharkas/CD has a script bug that sets volume to 0
-		//  when playing the "score" sample
-		pSnd->volume = 0x7f;
-		if (pSnd->loop > 1) {
-			pSnd->pLoopStream = new Audio::LoopingAudioStream(pSnd->pStreamAud,
-			                                                  pSnd->loop, DisposeAfterUse::NO);
-			_pMixer->playStream(pSnd->soundType, &pSnd->hCurrentAud,
-			                         pSnd->pLoopStream, -1, pSnd->volume, 0,
-			                         DisposeAfterUse::NO);
-		} else {
-			// Rewind in case we play the same sample multiple times
-			// (non-looped) like in pharkas right at the start
-			pSnd->pStreamAud->rewind();
-			_pMixer->playStream(pSnd->soundType, &pSnd->hCurrentAud,
-			                         pSnd->pStreamAud, -1, pSnd->volume, 0,
-			                         DisposeAfterUse::NO);
+	if (pSnd->pStreamAud) {
+		if (!_pMixer->isSoundHandleActive(pSnd->hCurrentAud)) {
+			// Sierra SCI ignores volume set when playing samples via kDoSound
+			//  At least freddy pharkas/CD has a script bug that sets volume to 0
+			//  when playing the "score" sample
+			if (pSnd->loop > 1) {
+				pSnd->pLoopStream = new Audio::LoopingAudioStream(pSnd->pStreamAud,
+																pSnd->loop, DisposeAfterUse::NO);
+				_pMixer->playStream(pSnd->soundType, &pSnd->hCurrentAud,
+										pSnd->pLoopStream, -1, _pMixer->kMaxChannelVolume, 0,
+										DisposeAfterUse::NO);
+			} else {
+				// Rewind in case we play the same sample multiple times
+				// (non-looped) like in pharkas right at the start
+				pSnd->pStreamAud->rewind();
+				_pMixer->playStream(pSnd->soundType, &pSnd->hCurrentAud,
+										pSnd->pStreamAud, -1, _pMixer->kMaxChannelVolume, 0,
+										DisposeAfterUse::NO);
+			}
 		}
 	} else {
 		if (pSnd->pMidiParser) {
@@ -419,7 +420,8 @@
 void SciMusic::soundSetVolume(MusicEntry *pSnd, byte volume) {
 	assert(volume <= MUSIC_VOLUME_MAX);
 	if (pSnd->pStreamAud) {
-		_pMixer->setChannelVolume(pSnd->hCurrentAud, volume * 2); // Mixer is 0-255, SCI is 0-127
+		// we simply ignore volume changes for samples, because sierra sci also
+		//  doesn't support volume for samples via kDoSound
 	} else if (pSnd->pMidiParser) {
 		_mutex.lock();
 		pSnd->pMidiParser->mainThreadBegin();


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