From 46b12a3e87fbe5608da7e4766114b9ccbc3c2f1c Mon Sep 17 00:00:00 2001 From: Mike Pavone Date: Sun, 2 Jun 2013 22:37:48 -0700 Subject: Make shift value of operator output to modulation input a define --- ym2612.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'ym2612.c') diff --git a/ym2612.c b/ym2612.c index 59048fc..26b5279 100644 --- a/ym2612.c +++ b/ym2612.c @@ -156,6 +156,7 @@ void ym_init(ym2612_context * context, uint32_t sample_rate, uint32_t clock_rate } #define YM_VOLUME_DIVIDER 2 +#define YM_MOD_SHIFT 4 void ym_run(ym2612_context * context, uint32_t to_cycle) { @@ -277,21 +278,21 @@ void ym_run(ym2612_context * context, uint32_t to_cycle) case 0: case 2: //modulate by operator 2 - mod = context->operators[op+1].output >> 4; + mod = context->operators[op+1].output >> YM_MOD_SHIFT; break; case 1: //modulate by operator 1+2 - mod = (context->operators[op-1].output + context->operators[op+1].output) >> 4; + mod = (context->operators[op-1].output + context->operators[op+1].output) >> YM_MOD_SHIFT; break; case 5: //modulate by operator 1 - mod = context->operators[op-1].output >> 4; + mod = context->operators[op-1].output >> YM_MOD_SHIFT; } break; case 2://Operator 2 if (chan->algorithm != 1 && chan->algorithm != 2 || chan->algorithm != 7) { //modulate by Operator 1 - mod = context->operators[op-2].output >> 4; + mod = context->operators[op-2].output >> YM_MOD_SHIFT; } break; case 3://Operator 4 @@ -301,19 +302,19 @@ void ym_run(ym2612_context * context, uint32_t to_cycle) case 1: case 4: //modulate by operator 3 - mod = context->operators[op-2].output >> 4; + mod = context->operators[op-2].output >> YM_MOD_SHIFT; break; case 2: //modulate by operator 1+3 - mod = (context->operators[op-3].output + context->operators[op-2].output) >> 4; + mod = (context->operators[op-3].output + context->operators[op-2].output) >> YM_MOD_SHIFT; break; case 3: //modulate by operator 2+3 - mod = (context->operators[op-1].output + context->operators[op-2].output) >> 4; + mod = (context->operators[op-1].output + context->operators[op-2].output) >> YM_MOD_SHIFT; break; case 5: //modulate by operator 1 - mod = context->operators[op-3].output >> 4; + mod = context->operators[op-3].output >> YM_MOD_SHIFT; break; } break; -- cgit v1.2.3