[Scummvm-cvs-logs] SF.net SVN: scummvm:[42274] scummvm/branches/gsoc2009-mods/sound/mods

nolange at users.sourceforge.net nolange at users.sourceforge.net
Thu Jul 9 02:02:12 CEST 2009


Revision: 42274
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42274&view=rev
Author:   nolange
Date:     2009-07-09 00:02:12 +0000 (Thu, 09 Jul 2009)

Log Message:
-----------
fixed (and inlined) the "Antilog" function

Modified Paths:
--------------
    scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp
    scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h

Modified: scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp	2009-07-08 22:59:50 UTC (rev 42273)
+++ scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.cpp	2009-07-09 00:02:12 UTC (rev 42274)
@@ -165,13 +165,6 @@
 
 }
 
-int32 MaxTrax::omgItsAntiLog(uint32 val) {
-	// some really weird exponential function, and some also very nonstandard "standard format" floats
-	// format is 16? bit exponent, 16 bit mantissa. and we need to scale with log(2)
-	const float v = ldexp((float)((val & 0xFFFF) + 0x10000) * (float)(0.69314718055994530942 / 65536), val >> 16);
-	return (uint32)exp(v);
-}
-
 void MaxTrax::stopMusic() {
 }
 
@@ -249,7 +242,8 @@
 		tone -= voice.periodOffset;
 	}
 	if (tone < PERIOD_LIMIT)
-		voice.lastPeriod = (uint16)omgItsAntiLog((float)tone);
+		// we need to scale with log(2)
+		voice.lastPeriod = (uint16)exp((float)tone * (float)(0.69314718055994530942 / 65536));
 
 	return octave;
 }

Modified: scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h
===================================================================
--- scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h	2009-07-08 22:59:50 UTC (rev 42273)
+++ scummvm/branches/gsoc2009-mods/sound/mods/maxtrax.h	2009-07-09 00:02:12 UTC (rev 42274)
@@ -205,7 +205,6 @@
 	void freePatches();
 	void freeScores();
 
-	static int32 omgItsAntiLog(uint32 val);
 	int calcNote(VoiceContext &voice);
 	int8 noteOn(ChannelContext &channel, byte note, uint16 volume, uint16 pri);
 	void noteOff(ChannelContext &channel, byte note);


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