# HG changeset patch # User Michael Pavone # Date 1392272051 28800 # Node ID 7df7f493b3b6d813b0a7ebb41e3c40e147a63be3 # Parent 6fe73296938a3caf0ede336d81bb25994c13cb16 Fix operator 1 self-feedback diff -r 6fe73296938a -r 7df7f493b3b6 ym2612.c --- 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; diff -r 6fe73296938a -r 7df7f493b3b6 ym2612.h --- a/ym2612.h Tue Feb 11 23:19:29 2014 -0800 +++ b/ym2612.h Wed Feb 12 22:14:11 2014 -0800 @@ -33,6 +33,7 @@ FILE * logfile; uint16_t fnum; int16_t output; + int16_t op1_old; uint8_t block_fnum_latch; uint8_t block; uint8_t keycode;