Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/BambooTracker/chips/nuked/ym3438.c b/BambooTracker/chips/nuked/ym3438.c
index 6f4d427..6739c44 100644
--- a/BambooTracker/chips/nuked/ym3438.c
+++ b/BambooTracker/chips/nuked/ym3438.c
@@ -474,7 +474,11 @@ void OPN2_DoRegWrite(ym3438_t *chip)
for (i = 0; i < 6; ++i)
{
if (chip->write_data & (1 << i))
+ {
chip->rhythm_key[i] = 0;
+ chip->rhythml[i] = 0;
+ chip->rhythmr[i] = 0;
+ }
}
}
break;
@@ -1282,8 +1286,8 @@ void OPNmod_RhythmGenerate(ym3438_t *chip)
out = ((chip->rhythm_adpcm_acc[channel] * chip->rhythm_vol_mul[channel]) >> chip->rhythm_vol_shift[channel]);
end:
- chip->rhythml = panl ? (out >> 7) : 0;
- chip->rhythmr = panr ? (out >> 7) : 0;
+ chip->rhythml[channel] = panl ? (out >> 7) : 0;
+ chip->rhythmr[channel] = panr ? (out >> 7) : 0;
}
}
}
@@ -1446,6 +1450,8 @@ void OPN2_SetChipType(Bit32u type)
void OPN2_Clock(ym3438_t *chip, Bit16s *buffer)
{
Bit32u slot = chip->cycles;
+ Bit16s *rhythml = &chip->rhythml[chip->channel];
+ Bit16s *rhythmr = &chip->rhythmr[chip->channel];
chip->lfo_inc = chip->mode_test_21[1];
chip->pg_read >>= 1;
chip->eg_read[1] >>= 1;
@@ -1577,9 +1583,9 @@ void OPN2_Clock(ym3438_t *chip, Bit16s *buffer)
buffer[0] = chip->mol;
buffer[1] = chip->mor;
- /*OPNMOD: Rhythm output*/
- buffer[2] = chip->rhythml;
- buffer[3] = chip->rhythmr;
+ /*OPN-MOD: Rhythm output*/
+ buffer[2] = *rhythml;
+ buffer[3] = *rhythmr;
if (chip->status_time)
chip->status_time--;
diff --git a/BambooTracker/chips/nuked/ym3438.h b/BambooTracker/chips/nuked/ym3438.h
index 5eae82b..d5d956d 100644
--- a/BambooTracker/chips/nuked/ym3438.h
+++ b/BambooTracker/chips/nuked/ym3438.h
@@ -77,8 +77,9 @@ typedef struct
Bit32u cycles;
Bit32u channel;
Bit16s mol, mor;
- /*OPNMOD: Rhythm output*/
- Bit16s rhythml, rhythmr;
+ /*OPN-MOD: Rhythm channel outputs*/
+ Bit16s rhythml[6];
+ Bit16s rhythmr[6];
/* IO */
Bit16u write_data;
Bit8u write_a;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.