Skip to content

Instantly share code, notes, and snippets.

@jpcima
Last active February 17, 2021 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpcima/a9b83848cdbf273209a39743db7cbdd5 to your computer and use it in GitHub Desktop.
Save jpcima/a9b83848cdbf273209a39743db7cbdd5 to your computer and use it in GitHub Desktop.
diff --git a/BambooTracker/chip/nuked/ym3438.c b/BambooTracker/chip/nuked/ym3438.c
index d1507ca..cd3d87c 100644
--- a/BambooTracker/chip/nuked/ym3438.c
+++ b/BambooTracker/chip/nuked/ym3438.c
@@ -39,7 +39,7 @@
#include "ym3438.h"
/*OPN-MOD: define the quantization in bits at which channels clip*/
-static const unsigned channel_clipbits = 11; /*YM2612 has 9 bits*/
+static const unsigned channel_clipbits = 13; /*YM2612 has 9 bits*/
enum {
eg_num_attack = 0,
@@ -1100,7 +1100,7 @@ void OPN2_ChGenerate(ym3438_t *chip)
}
if (fm_algorithm[op][5][chip->connect[channel]] && !test_dac)
{
- add += chip->fm_out[slot] >> 5;
+ add += chip->fm_out[slot] >> 1;
}
sum = acc + add;
/* Clamp */
@@ -1892,8 +1892,8 @@ void OPN2_Generate(ym3438_t *chip, sample *samples)
{
OPN2_Clock(chip, buffer);
- samples[0] += buffer[0] * 11;
- samples[1] += buffer[1] * 11;
+ samples[0] += (buffer[0] * 11) >> 4;
+ samples[1] += (buffer[1] * 11) >> 4;
/*OPN-MOD: mix rhythm samples*/
samples[0] += buffer[2];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment