From a7220a5647adc1a59d172df7391314a9c58e61d5 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sun, 1 Nov 2015 20:44:12 -0800 Subject: Fix mapping of key on/off reg bits to operators --- ym2612.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ym2612.c') diff --git a/ym2612.c b/ym2612.c index 864081c..7fb5b91 100644 --- a/ym2612.c +++ b/ym2612.c @@ -691,8 +691,9 @@ void ym_data_write(ym2612_context * context, uint8_t value) if (channel > 2) { channel--; } - for (uint8_t op = channel * 4, bit = 0x10; op < (channel + 1) * 4; op++, bit <<= 1) { - if (value & bit) { + uint8_t bits[] = {0x10, 0x40, 0x20, 0x80}; + for (uint8_t op = channel * 4, bit = 0; op < (channel + 1) * 4; op++, bit++) { + if (value & bits[bit]) { if (context->operators[op].env_phase == PHASE_RELEASE) { first_key_on = 1; -- cgit v1.2.3