Mercurial > repos > blastem
diff ym2612.c @ 527:7df7f493b3b6
Fix operator 1 self-feedback
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 12 Feb 2014 22:14:11 -0800 |
parents | 6a14c5a95648 |
children | 666210adf87b |
line wrap: on
line diff
--- a/ym2612.c Tue Feb 11 23:19:29 2014 -0800 +++ b/ym2612.c Wed Feb 12 22:14:11 2014 -0800 @@ -374,7 +374,7 @@ { case 0://Operator 1 if (chan->feedback) { - mod = operator->output >> (9-chan->feedback); + mod = (chan->op1_old + operator->output) >> (10-chan->feedback); } break; case 1://Operator 3 @@ -431,12 +431,17 @@ if (first_key_on) { dfprintf(debug_file, "op %d, base phase: %d, mod: %d, sine: %d, out: %d\n", op, phase, mod, sine_table[(phase+mod) & 0x1FF], pow_table[sine_table[phase & 0x1FF] + env]); } - phase += mod; + //if ((channel != 0 && channel != 4) || chan->algorithm != 5) { + phase += mod; + //} int16_t output = pow_table[sine_table[phase & 0x1FF] + env]; if (phase & 0x200) { output = -output; } + if (op % 4 == 0) { + chan->op1_old = operator->output; + } operator->output = output; //Update the channel output if we've updated all operators if (op % 4 == 3) { @@ -784,6 +789,7 @@ case REG_ALG_FEEDBACK: context->channels[channel].algorithm = value & 0x7; context->channels[channel].feedback = value >> 3 & 0x7; + //printf("Algorithm %d, feedback %d for channel %d\n", value & 0x7, value >> 3 & 0x7, channel); break; case REG_LR_AMS_PMS: context->channels[channel].pms = (value & 0x7) * 32;