Further fix

This commit is contained in:
cam900 2022-03-28 12:31:42 +09:00
parent 79d6433006
commit 7bd39603a9

View file

@ -145,10 +145,7 @@ bool vrcvi_core::alu_t::tick()
bool vrcvi_core::pulse_t::tick() bool vrcvi_core::pulse_t::tick()
{ {
if (!m_divider.m_enable) if (!m_divider.m_enable)
{
m_cycle = 0;
return false; return false;
}
if (vrcvi_core::alu_t::tick()) if (vrcvi_core::alu_t::tick())
m_cycle = bitfield(m_cycle + 1, 0, 4); m_cycle = bitfield(m_cycle + 1, 0, 4);
@ -159,10 +156,7 @@ bool vrcvi_core::pulse_t::tick()
bool vrcvi_core::sawtooth_t::tick() bool vrcvi_core::sawtooth_t::tick()
{ {
if (!m_divider.m_enable) if (!m_divider.m_enable)
{
m_accum = 0;
return false; return false;
}
if (vrcvi_core::alu_t::tick()) if (vrcvi_core::alu_t::tick())
{ {
@ -260,6 +254,8 @@ void vrcvi_core::pulse_w(u8 voice, u8 address, u8 data)
break; break;
case 0x02: // Pitch MSB, Enable/Disable - 0x9002/0x9001 (Pulse 1), 0xa002/0xa001 (Pulse 2) case 0x02: // Pitch MSB, Enable/Disable - 0x9002/0x9001 (Pulse 1), 0xa002/0xa001 (Pulse 2)
v.m_divider.write(true, data); v.m_divider.write(true, data);
if (!v.m_divider.m_enable) // Reset duty cycle
v.m_cycle = 0;
break; break;
} }
} }
@ -276,6 +272,8 @@ void vrcvi_core::saw_w(u8 address, u8 data)
break; break;
case 0x02: // Pitch MSB, Enable/Disable - 0xb002/0xb001 (Sawtooth) case 0x02: // Pitch MSB, Enable/Disable - 0xb002/0xb001 (Sawtooth)
m_sawtooth.m_divider.write(true, data); m_sawtooth.m_divider.write(true, data);
if (!m_sawtooth.m_divider.m_enable) // Reset accumulator
m_sawtooth.m_accum = 0;
break; break;
} }
} }