diff options
author | Michael Pavone <pavone@retrodev.com> | 2016-02-10 20:05:39 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2016-02-10 20:05:39 -0800 |
commit | a2eef830e8de968d206f9b54202c15e36088b5ca (patch) | |
tree | 71e196127a57f3929c91831e0d598f4565518dec /ym2612.c | |
parent | ffec9ebd8765c0248426d605f68f6f5ebac4de5b (diff) |
Change where decay to sustain transition happens to match hardware when decay rate is slow or 0
Diffstat (limited to 'ym2612.c')
-rw-r--r-- | ym2612.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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++; |