Revert "ymfm: Latch the multi-frequency state at key on. Fixes sor2 punch sound on megadriv."

This reverts commit 90d6b1b29e.
This commit is contained in:
Aaron Giles 2021-04-05 00:15:01 -07:00
parent 90d6b1b29e
commit 02dab0460f
2 changed files with 5 additions and 19 deletions

View File

@ -1054,8 +1054,7 @@ void ymopm_registers::log_keyon(u32 choffs, u32 opoffs)
template<bool IsOpnA>
ymopn_registers_base<IsOpnA>::ymopn_registers_base() :
m_lfo_counter(0),
m_lfo_am(0),
m_multi_freq(0)
m_lfo_am(0)
{
// create the waveforms
for (int index = 0; index < WAVEFORM_LENGTH; index++)
@ -1074,7 +1073,6 @@ void ymopn_registers_base<IsOpnA>::save(device_t &device)
{
device.save_item(YMFM_NAME(m_lfo_counter));
device.save_item(YMFM_NAME(m_lfo_am));
device.save_item(YMFM_NAME(m_multi_freq));
}
device.save_item(YMFM_NAME(m_regdata));
}
@ -1179,22 +1177,11 @@ bool ymopn_registers_base<IsOpnA>::write(u16 index, u8 data, u32 &channel, u32 &
// handle writes to the key on index
if (index == 0x28)
{
// channel in low 2 bits; channel 3 is not valid
channel = BIT(data, 0, 2);
if (channel == 3)
return false;
// upper channels for OPNA
if (IsOpnA)
channel += BIT(data, 2, 1) * 3;
// when channel 2 key on hits, latch the multifrequency state
// megadriv sor2 flips the multi_freq bit on and off during playback
// of its sounds, specifically the punch sound
if (channel == 2)
m_multi_freq = multi_freq();
// operator mask is the top 4 bits
opmask = BIT(data, 4, 4);
return true;
}
@ -1289,7 +1276,7 @@ void ymopn_registers_base<IsOpnA>::cache_operator_data(u32 choffs, u32 opoffs, y
// if multi-frequency mode is enabled and this is channel 2,
// fetch one of the special frequencies
if (m_multi_freq && choffs == 2)
if (multi_freq() && choffs == 2)
{
if (opoffs == 2)
block_freq = cache.block_freq = multi_block_freq(1);
@ -1401,7 +1388,7 @@ void ymopn_registers_base<IsOpnA>::log_keyon(u32 choffs, u32 opoffs)
u32 opnum = (opoffs & 15) - ((opoffs & 15) / 4) + 12 * BIT(opoffs, 8);
u32 block_freq = ch_block_freq(choffs);
if (m_multi_freq && choffs == 2)
if (multi_freq() && choffs == 2)
{
if (opoffs == 2)
block_freq = multi_block_freq(1);
@ -1440,7 +1427,7 @@ void ymopn_registers_base<IsOpnA>::log_keyon(u32 choffs, u32 opoffs)
LOG(" pm=%d", ch_lfo_pm_sens(choffs));
if (am || pm)
LOG(" lfo=%02X", lfo_rate());
if (m_multi_freq && choffs == 2)
if (multi_freq() && choffs == 2)
LOG(" multi=1");
}

View File

@ -577,7 +577,7 @@ public:
u32 lfo_rate() const { return IsOpnA ? byte(0x22, 0, 3) : 0; }
u32 timer_a_value() const { return word(0x24, 0, 8, 0x25, 0, 2); }
u32 timer_b_value() const { return byte(0x26, 0, 8); }
u32 csm() const { return byte(0x27, 7, 1); }
u32 csm() const { return (byte(0x27, 6, 2) == 2); }
u32 multi_freq() const { return (byte(0x27, 6, 2) != 0); }
u32 reset_timer_b() const { return byte(0x27, 5, 1); }
u32 reset_timer_a() const { return byte(0x27, 4, 1); }
@ -629,7 +629,6 @@ protected:
// internal state
u32 m_lfo_counter; // LFO counter
u8 m_lfo_am; // current LFO AM value
u8 m_multi_freq; // channel 2 is currently multi-frequency
u8 m_regdata[REGISTERS]; // register data
u16 m_waveform[WAVEFORMS][WAVEFORM_LENGTH]; // waveforms
};