[Scummvm-cvs-logs] SF.net SVN: scummvm:[52492] scummvm/trunk/sound/softsynth/fmtowns_pc98/ towns_audio.cpp

Bluddy at users.sourceforge.net Bluddy at users.sourceforge.net
Thu Sep 2 12:41:28 CEST 2010


Revision: 52492
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52492&view=rev
Author:   Bluddy
Date:     2010-09-02 10:41:26 +0000 (Thu, 02 Sep 2010)

Log Message:
-----------
FMTOWNS AUDIO: fixed divide by zero exception from commit 52013

Also removed 1 or 2 float operations.

Modified Paths:
--------------
    scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_audio.cpp

Modified: scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_audio.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_audio.cpp	2010-09-02 10:21:20 UTC (rev 52491)
+++ scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_audio.cpp	2010-09-02 10:41:26 UTC (rev 52492)
@@ -1404,8 +1404,11 @@
 	// balance values for our -128 to 127 volume range
 	
 	// CD-AUDIO
-	int volume = (int)(((float)MAX(_outputLevel[12], _outputLevel[13]) * 255.0f) / 63.0f);
-	int balance = (int)((float)((_outputLevel[13] - _outputLevel[12]) * 127.0f) / (float)MAX(_outputLevel[12], _outputLevel[13]));
+	uint32 maxVol = MAX(_outputLevel[12], _outputLevel[13]);
+	
+	int volume = (int)(maxVol * (255.0f / 63.0f));
+	int balance = maxVol ? (int)( ( ((int)_outputLevel[13] - _outputLevel[12]) * 127) / (float)maxVol) : 0;
+	
 	AudioCD.setVolume(volume);
 	AudioCD.setBalance(balance);
 }


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