summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2013-06-02 22:37:48 -0700
committerMike Pavone <pavone@retrodev.com>2013-06-02 22:37:48 -0700
commit46b12a3e87fbe5608da7e4766114b9ccbc3c2f1c (patch)
tree338b226eaaec2dadde16379cdb60ea6548880ace
parent4806efd5e25d976f9f2fa32ae2bed43c82a1c14b (diff)
Make shift value of operator output to modulation input a define
-rw-r--r--ym2612.c17
1 files changed, 9 insertions, 8 deletions
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;