diff options
author | Gregory Montoir | 2007-12-06 21:11:26 +0000 |
---|---|---|
committer | Gregory Montoir | 2007-12-06 21:11:26 +0000 |
commit | 65779599de285edb707c4a5fa4e8506385bfc54a (patch) | |
tree | aee9b1dd719e44c26a52fbd2cd3fd437ad2579b6 | |
parent | 4806a5f673648b29c36b9a1f4f985bd7666da102 (diff) | |
download | scummvm-rg350-65779599de285edb707c4a5fa4e8506385bfc54a.tar.gz scummvm-rg350-65779599de285edb707c4a5fa4e8506385bfc54a.tar.bz2 scummvm-rg350-65779599de285edb707c4a5fa4e8506385bfc54a.zip |
reverted commit #29736 with a proper fix (I think) to fmopl code
svn-id: r29741
-rw-r--r-- | common/util.cpp | 7 | ||||
-rw-r--r-- | sound/fmopl.cpp | 10 | ||||
-rw-r--r-- | sound/fmopl.h | 3 |
3 files changed, 8 insertions, 12 deletions
diff --git a/common/util.cpp b/common/util.cpp index 41f35a8a0e..46b5acf502 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -154,11 +154,8 @@ void hexdump(const byte * data, int len, int bytesPerLine) { 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); } diff --git a/sound/fmopl.cpp b/sound/fmopl.cpp index 15d235c577..b2e1ee3aee 100644 --- a/sound/fmopl.cpp +++ b/sound/fmopl.cpp @@ -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 @@ inline void OPL_CALC_CH(OPL_CH *CH) { /* ---------- 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 @@ void YM3812UpdateOne(FM_OPL *OPL, int16 *buffer, int length) { 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 */ diff --git a/sound/fmopl.h b/sound/fmopl.h index 9b3ff0518f..cc2f967f25 100644 --- a/sound/fmopl.h +++ b/sound/fmopl.h @@ -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 @@ typedef struct fm_opl_f { int IRQParam; /* IRQ parameter */ OPL_UPDATEHANDLER UpdateHandler; /* stream update handler */ int UpdateParam; /* stream update parameter */ + + Common::RandomSource rnd; } FM_OPL; /* ---------- Generic interface section ---------- */ |