[Scummvm-cvs-logs] SF.net SVN: scummvm: [29741] scummvm/trunk

cyx at users.sourceforge.net cyx at users.sourceforge.net
Thu Dec 6 22:11:26 CET 2007


Revision: 29741
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29741&view=rev
Author:   cyx
Date:     2007-12-06 13:11:26 -0800 (Thu, 06 Dec 2007)

Log Message:
-----------
reverted commit #29736 with a proper fix (I think) to fmopl code

Modified Paths:
--------------
    scummvm/trunk/common/util.cpp
    scummvm/trunk/sound/fmopl.cpp
    scummvm/trunk/sound/fmopl.h

Modified: scummvm/trunk/common/util.cpp
===================================================================
--- scummvm/trunk/common/util.cpp	2007-12-06 21:01:54 UTC (rev 29740)
+++ scummvm/trunk/common/util.cpp	2007-12-06 21:11:26 UTC (rev 29741)
@@ -154,11 +154,8 @@
 RandomSource::RandomSource() {
 	// Use system time as RNG seed. Normally not a good idea, if you are using
 	// a RNG for security purposes, but good enough for our purposes.
-#if defined (__SYMBIAN32__) && defined (__WINS__)
-	uint32 seed = 0; // Symbian produces RT crash on time(0)
-#else
-	uint32 seed = time(0);
-#endif
+	assert(g_system);
+	uint32 seed = g_system->getMillis();
 	setSeed(seed);
 }
 

Modified: scummvm/trunk/sound/fmopl.cpp
===================================================================
--- scummvm/trunk/sound/fmopl.cpp	2007-12-06 21:01:54 UTC (rev 29740)
+++ scummvm/trunk/sound/fmopl.cpp	2007-12-06 21:11:26 UTC (rev 29741)
@@ -33,14 +33,10 @@
 
 #include "sound/fmopl.h"
 
-#include "common/util.h"
-
 #if defined (_WIN32_WCE) || defined (__SYMBIAN32__) || defined(PALMOS_MODE) || defined(__GP32__) || defined(GP2X) || defined (__MAEMO__) || defined(__DS__)
 #include "common/config-manager.h"
 #endif
 
-static Common::RandomSource oplRnd;			/* OPL random number generator */
-
 /* -------------------- preliminary define section --------------------- */
 /* attack/decay rate time rate */
 #define OPL_ARRATE     141280  /* RATE 4 =  2826.24ms @ 3.6MHz */
@@ -511,9 +507,9 @@
 
 /* ---------- calcrate rythm block ---------- */
 #define WHITE_NOISE_db 6.0
-inline void OPL_CALC_RH(OPL_CH *CH) {
+inline void OPL_CALC_RH(FM_OPL *OPL, OPL_CH *CH) {
 	uint env_tam, env_sd, env_top, env_hh;
-	int whitenoise = int(oplRnd.getRandomNumber(1) * (WHITE_NOISE_db / EG_STEP));
+	int whitenoise = int(OPL->rnd.getRandomNumber(1) * (WHITE_NOISE_db / EG_STEP));
 
 	int tone8;
 
@@ -1018,7 +1014,7 @@
 			OPL_CALC_CH(CH);
 		/* Rythn part */
 		if(rythm)
-			OPL_CALC_RH(S_CH);
+			OPL_CALC_RH(OPL, S_CH);
 		/* limit check */
 		data = Limit(outd[0], OPL_MAXOUT, OPL_MINOUT);
 		/* store to sound buffer */

Modified: scummvm/trunk/sound/fmopl.h
===================================================================
--- scummvm/trunk/sound/fmopl.h	2007-12-06 21:01:54 UTC (rev 29740)
+++ scummvm/trunk/sound/fmopl.h	2007-12-06 21:11:26 UTC (rev 29741)
@@ -30,6 +30,7 @@
 #define SOUND_FMOPL_H
 
 #include "common/scummsys.h"
+#include "common/util.h"
 
 enum {
 	FMOPL_ENV_BITS_HQ = 16,
@@ -143,6 +144,8 @@
 	int IRQParam;						/* IRQ parameter  */
 	OPL_UPDATEHANDLER UpdateHandler;	/* stream update handler   */
 	int UpdateParam;					/* stream update parameter */
+
+	Common::RandomSource rnd;
 } FM_OPL;
 
 /* ---------- Generic interface section ---------- */


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