OPZ: fix EGShift emulation

1. the TX81Z has operators in reverse order
2. don't early out if EGShift is not 0
This commit is contained in:
tildearrow 2022-05-05 23:50:15 -05:00
parent 6e19f5d719
commit 5974e8c045
2 changed files with 3 additions and 4 deletions

View File

@ -480,7 +480,7 @@ if (m_choffs == 0)
#endif
// early out if the envelope is effectively off
if (m_env_attenuation > EG_QUIET)
if (m_env_attenuation > EG_QUIET && m_cache.eg_shift == 0)
return 0;
// get the absolute value of the sin, as attenuation, as a 4.8 fixed point value

View File

@ -472,9 +472,8 @@ void opz_registers::cache_operator_data(uint32_t choffs, uint32_t opoffs, opdata
if (reverb != 0)
cache.eg_rate[EG_REVERB] = std::min<uint32_t>(effective_rate(reverb * 4 + 2, ksrval), cache.eg_rate[EG_REVERB]);
// set the envelope shift; TX81Z manual says operator 1 shift is fixed at "off"
// TODO: change 0 to 3? operators are in reverse order in TX81Z
cache.eg_shift = ((opoffs & 0x18) == 0) ? 0 : op_eg_shift(opoffs);
// set the envelope shift; TX81Z manual says operator 1 (actually operator 4) shift is fixed at "off"
cache.eg_shift = ((opoffs & 0x18) == 0x18) ? 0 : op_eg_shift(opoffs);
}