From ea42fe638a802c47ecc0203129ee897fb4eed5d4 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 5 May 2020 23:41:15 -0400 Subject: [PATCH] Corrects channel attenuation and carrier sustain level settings. --- Components/OPL2/OPLL.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Components/OPL2/OPLL.cpp b/Components/OPL2/OPLL.cpp index a81c37f2f..f2e1dcf13 100644 --- a/Components/OPL2/OPLL.cpp +++ b/Components/OPL2/OPLL.cpp @@ -113,7 +113,7 @@ void OPLL::write_register(uint8_t address, uint8_t value) { // from the stored instrument values. case 0x30: channels_[index].instrument = value >> 4; - channels_[index].attenuation = value >> 4; + channels_[index].attenuation = value & 0xf; if(index < 6 || !rhythm_mode_enabled_) { install_instrument(index); @@ -211,7 +211,7 @@ void OPLL::install_instrument(int channel) { modulator_envelope.set_release_rate(instrument[6] & 0xf); modulator_envelope.set_sustain_level(instrument[6] >> 4); carrier_envelope.set_release_rate(instrument[7] & 0xf); - carrier_envelope.set_release_rate(instrument[7] >> 4); + carrier_envelope.set_sustain_level(instrument[7] >> 4); } void OPLL::set_use_sustain(int channel) {