summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2016-02-10 20:05:39 -0800
committerMichael Pavone <pavone@retrodev.com>2016-02-10 20:05:39 -0800
commita2eef830e8de968d206f9b54202c15e36088b5ca (patch)
tree71e196127a57f3929c91831e0d598f4565518dec
parentffec9ebd8765c0248426d605f68f6f5ebac4de5b (diff)
Change where decay to sustain transition happens to match hardware when decay rate is slow or 0
-rw-r--r--ym2612.c8
1 files changed, 4 insertions, 4 deletions
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++;