From a2eef830e8de968d206f9b54202c15e36088b5ca Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Wed, 10 Feb 2016 20:05:39 -0800 Subject: Change where decay to sustain transition happens to match hardware when decay rate is slow or 0 --- ym2612.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ym2612.c') diff --git a/ym2612.c b/ym2612.c index 1d08697..ea08c05 100644 --- a/ym2612.c +++ b/ym2612.c @@ -298,6 +298,10 @@ void ym_run(ym2612_context * context, uint32_t to_cycle) ym_operator * operator = context->operators + op; ym_channel * channel = context->channels + op/4; uint8_t rate; + if (operator->env_phase == PHASE_DECAY && operator->envelope >= operator->sustain_level) { + //operator->envelope = operator->sustain_level; + operator->env_phase = PHASE_SUSTAIN; + } for(;;) { rate = operator->rates[operator->env_phase]; if (rate) { @@ -348,10 +352,6 @@ void ym_run(ym2612_context * context, uint32_t to_cycle) if (operator->envelope > MAX_ENVELOPE) { operator->envelope = MAX_ENVELOPE; } - if (operator->env_phase == PHASE_DECAY && operator->envelope >= operator->sustain_level) { - //operator->envelope = operator->sustain_level; - operator->env_phase = PHASE_SUSTAIN; - } } } context->current_env_op++; -- cgit v1.2.3