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

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Fri Jan 1 22:04:21 CET 2010


Revision: 46850
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46850&view=rev
Author:   m_kiewitz
Date:     2010-01-01 21:04:20 +0000 (Fri, 01 Jan 2010)

Log Message:
-----------
SCI/newmusic: now clips volume against MUSIC_VOLUME_MAX (127) instead of the mixer max volume (which would be wrong of course), adjusts volume when setting sample channel volume

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/sfx/music.cpp
    scummvm/trunk/engines/sci/sfx/music.h
    scummvm/trunk/engines/sci/sfx/soundcmd.cpp

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2010-01-01 20:49:56 UTC (rev 46849)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2010-01-01 21:04:20 UTC (rev 46850)
@@ -120,7 +120,7 @@
 		s.syncAsSint32LE(hold);
 		// volume and dataInc will be synced from the sound objects
 		// when the sound list is reconstructed in gamestate_restore()
-		volume = MUSIC_VOLUME_FOR_SCI0;
+		volume = MUSIC_VOLUME_MAX;
 		dataInc = 0;
 		// No fading info
 		fadeTo = 0;

Modified: scummvm/trunk/engines/sci/sfx/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.cpp	2010-01-01 20:49:56 UTC (rev 46849)
+++ scummvm/trunk/engines/sci/sfx/music.cpp	2010-01-01 21:04:20 UTC (rev 46850)
@@ -411,8 +411,9 @@
 }
 
 void SciMusic::soundSetVolume(MusicEntry *pSnd, byte volume) {
+	assert(volume <= MUSIC_VOLUME_MAX);
 	if (pSnd->pStreamAud) {
-		_pMixer->setChannelVolume(pSnd->hCurrentAud, volume);
+		_pMixer->setChannelVolume(pSnd->hCurrentAud, volume * 2); // Mixer is 0-255, SCI is 0-127
 	} else if (pSnd->pMidiParser) {
 		_mutex.lock();
 		pSnd->pMidiParser->setVolume(volume);

Modified: scummvm/trunk/engines/sci/sfx/music.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.h	2010-01-01 20:49:56 UTC (rev 46849)
+++ scummvm/trunk/engines/sci/sfx/music.h	2010-01-01 21:04:20 UTC (rev 46850)
@@ -57,6 +57,7 @@
 };
 
 #define MUSIC_VOLUME_FOR_SCI0 127
+#define MUSIC_VOLUME_MAX 127
 
 class MidiParser_SCI;
 class SegManager;

Modified: scummvm/trunk/engines/sci/sfx/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/soundcmd.cpp	2010-01-01 20:49:56 UTC (rev 46849)
+++ scummvm/trunk/engines/sci/sfx/soundcmd.cpp	2010-01-01 21:04:20 UTC (rev 46850)
@@ -280,7 +280,7 @@
 	newSound->soundObj = obj;
 	newSound->loop = GET_SEL32V(_segMan, obj, loop);
 	newSound->prio = GET_SEL32V(_segMan, obj, pri) & 0xFF;
-	newSound->volume = CLIP<int>(GET_SEL32V(_segMan, obj, vol), 0, Audio::Mixer::kMaxChannelVolume);
+	newSound->volume = CLIP<int>(GET_SEL32V(_segMan, obj, vol), 0, MUSIC_VOLUME_MAX);
 
 	// Check if a track with the same sound object is already playing
 	MusicEntry *oldSound = _music->getSlot(obj);
@@ -895,7 +895,7 @@
 
 	debugC(2, kDebugLevelSound, "cmdSetHandleVolume: %d", value);
 
-	value = CLIP<int>(value, 0, Audio::Mixer::kMaxChannelVolume);
+	value = CLIP<int>(value, 0, MUSIC_VOLUME_MAX);
 
 	if (musicSlot->volume != value) {
 		musicSlot->volume = value;


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