From a4d3865394a0b59724108a07f5c46eec3c9d995b Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 21 Apr 2020 19:58:40 -0400 Subject: [PATCH] Decreases sustain level attenuation; disables key-level scaling for now. The latter was definitely wrong, I also think I don't need the big four tables. --- Components/OPL2/Implementation/Operator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Components/OPL2/Implementation/Operator.cpp b/Components/OPL2/Implementation/Operator.cpp index 53c693dcf..da2fd19e5 100644 --- a/Components/OPL2/Implementation/Operator.cpp +++ b/Components/OPL2/Implementation/Operator.cpp @@ -158,8 +158,8 @@ void Operator::update(OperatorState &state, bool key_on, int channel_period, int state.adsr_attenuation_ = std::min(state.adsr_attenuation_, 511); // Check for the decay exit condition. - if(state.adsr_phase_ == OperatorState::ADSRPhase::Decay && state.adsr_attenuation_ >= (sustain_level_ << 5)) { - state.adsr_attenuation_ = sustain_level_ << 5; + if(state.adsr_phase_ == OperatorState::ADSRPhase::Decay && state.adsr_attenuation_ >= (sustain_level_ << 3)) { + state.adsr_attenuation_ = sustain_level_ << 3; state.adsr_phase_ = ((overrides && overrides->use_sustain_level) || use_sustain_level_) ? OperatorState::ADSRPhase::Sustain : OperatorState::ADSRPhase::Release; } } break; @@ -177,7 +177,7 @@ void Operator::update(OperatorState &state, bool key_on, int channel_period, int // Calculate key-level scaling. Table is as per p14 of the YM3812 application manual, // converted into a fixed-point scheme. Compare with https://www.smspower.org/Development/RE12 // and apologies for the highly ad hoc indentation. - constexpr int key_level_scales[4][8][16] = { +/* constexpr int key_level_scales[4][8][16] = { #define _ 0 { {_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _}, @@ -221,7 +221,7 @@ void Operator::update(OperatorState &state, bool key_on, int channel_period, int }, #undef _ }; - state.attenuation.log += key_level_scales[key_level_scaling_][channel_octave][channel_period >> 6] << 7; + state.attenuation.log += key_level_scales[key_level_scaling_][channel_octave][channel_period >> 6] << 7;*/ // Combine the ADSR attenuation and overall channel attenuation. if(overrides) {