aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/fmopl.cpp10
-rw-r--r--sound/fmopl.h3
2 files changed, 6 insertions, 7 deletions
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 ---------- */