diff --git a/src/hardware/gameblaster.cpp b/src/hardware/gameblaster.cpp index 267ada733..dffda0d0a 100644 --- a/src/hardware/gameblaster.cpp +++ b/src/hardware/gameblaster.cpp @@ -32,6 +32,8 @@ #define RIGHT 0x01 #define CMS_BUFFER_SIZE 128 #define CMS_RATE 22050 +/*#define MASTER_CLOCK 14318180/2 */ +#define MASTER_CLOCK 7159090 typedef Bit8u UINT8; @@ -205,9 +207,9 @@ static void saa1099_update(int chip, INT16 **buffer, int length) { switch (saa->noise_params[ch]) { - case 0: saa->noise[ch].freq = 31250.0 * 2; break; - case 1: saa->noise[ch].freq = 15625.0 * 2; break; - case 2: saa->noise[ch].freq = 7812.5 * 2; break; + case 0: saa->noise[ch].freq = MASTER_CLOCK/256 * 2; break; + case 1: saa->noise[ch].freq = MASTER_CLOCK/512 * 2; break; + case 2: saa->noise[ch].freq = MASTER_CLOCK/1024 * 2; break; case 3: saa->noise[ch].freq = saa->channels[ch * 3].freq; break; } } @@ -221,7 +223,7 @@ static void saa1099_update(int chip, INT16 **buffer, int length) for (ch = 0; ch < 6; ch++) { if (saa->channels[ch].freq == 0.0) - saa->channels[ch].freq = (double)((2 * 15625) << saa->channels[ch].octave) / + saa->channels[ch].freq = (double)((2 * MASTER_CLOCK/512) << saa->channels[ch].octave) / (511.0 - (double)saa->channels[ch].frequency); /* check the actual position in the square wave */ @@ -229,7 +231,7 @@ static void saa1099_update(int chip, INT16 **buffer, int length) while (saa->channels[ch].counter < 0) { /* calculate new frequency now after the half wave is updated */ - saa->channels[ch].freq = (double)((2 * 15625) << saa->channels[ch].octave) / + saa->channels[ch].freq = (double)((2 * MASTER_CLOCK/512) << saa->channels[ch].octave) / (511.0 - (double)saa->channels[ch].frequency); saa->channels[ch].counter += sample_rate;