# HG changeset patch # User Michael Pavone # Date 1455163539 28800 # Node ID 0ee8cfcc06d131a7dd0084781a951a6ce8b957b5 # Parent 8bd82aead0879e77faa984c80f6aa86c58917e88 Change where decay to sustain transition happens to match hardware when decay rate is slow or 0 diff -r 8bd82aead087 -r 0ee8cfcc06d1 ym2612.c --- a/ym2612.c Wed Feb 10 20:04:51 2016 -0800 +++ b/ym2612.c Wed Feb 10 20:05:39 2016 -0800 @@ -298,6 +298,10 @@ 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 @@ 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++;