VRC6: optimize

This commit is contained in:
tildearrow 2023-02-11 22:33:54 -05:00
parent 989743152a
commit d1245624ef
2 changed files with 5 additions and 10 deletions

View file

@ -14,10 +14,8 @@ void vrcvi_core::tick()
if (!m_control.halt()) // Halt flag if (!m_control.halt()) // Halt flag
{ {
// tick per each clock // tick per each clock
for (auto &elem : m_pulse) m_out += m_pulse[0].get_output(); // add 4 bit pulse output
{ m_out += m_pulse[1].get_output();
m_out += elem.get_output(); // add 4 bit pulse output
}
m_out += m_sawtooth.get_output(); // add 5 bit sawtooth output m_out += m_sawtooth.get_output(); // add 5 bit sawtooth output
} }
if (m_timer.tick()) if (m_timer.tick())
@ -28,11 +26,8 @@ void vrcvi_core::tick()
void vrcvi_core::reset() void vrcvi_core::reset()
{ {
for (auto &elem : m_pulse) m_pulse[0].reset();
{ m_pulse[1].reset();
elem.reset();
}
m_sawtooth.reset(); m_sawtooth.reset();
m_timer.reset(); m_timer.reset();
m_control.reset(); m_control.reset();

View file

@ -398,7 +398,7 @@ class vrcvi_core : public vgsound_emu_core
private: private:
vrcvi_intf &m_intf; vrcvi_intf &m_intf;
std::array<pulse_t, 2> m_pulse; // 2 pulse channels pulse_t m_pulse[2]; // 2 pulse channels
sawtooth_t m_sawtooth; // sawtooth channel sawtooth_t m_sawtooth; // sawtooth channel
timer_t m_timer; // internal timer timer_t m_timer; // internal timer
global_control_t m_control; // control global_control_t m_control; // control