VRC6: 14 to 13

This commit is contained in:
tildearrow 2023-02-11 22:49:07 -05:00
parent 3eba7721a4
commit 50431b08b0
2 changed files with 6 additions and 6 deletions

View file

@ -88,7 +88,7 @@ bool vrcvi_core::pulse_t::tick()
m_cycle = (m_cycle+1)&15; m_cycle = (m_cycle+1)&15;
} }
return m_control.mode() ? true : ((m_cycle > m_control.duty()) ? true : false); return m_control.m_mode ? true : ((m_cycle > m_control.m_duty) ? true : false);
} }
bool vrcvi_core::sawtooth_t::tick() bool vrcvi_core::sawtooth_t::tick()
@ -100,7 +100,7 @@ bool vrcvi_core::sawtooth_t::tick()
if (vrcvi_core::alu_t::tick()) if (vrcvi_core::alu_t::tick())
{ {
if (bitfield(m_cycle++, 0)) if ((m_cycle++)&1)
{ // Even step only { // Even step only
m_accum += m_rate; m_accum += m_rate;
} }
@ -110,20 +110,20 @@ bool vrcvi_core::sawtooth_t::tick()
m_cycle = 0; m_cycle = 0;
} }
} }
return (m_accum == 0) ? false : true; return (m_accum != 0);
} }
s8 vrcvi_core::pulse_t::get_output() s8 vrcvi_core::pulse_t::get_output()
{ {
// add 4 bit pulse output // add 4 bit pulse output
m_out = tick() ? m_control.volume() : 0; m_out = tick() ? m_control.m_volume : 0;
return m_out; return m_out;
} }
s8 vrcvi_core::sawtooth_t::get_output() s8 vrcvi_core::sawtooth_t::get_output()
{ {
// add 5 bit sawtooth output // add 5 bit sawtooth output
m_out = tick() ? bitfield(m_accum, 3, 5) : 0; m_out = tick() ? ((m_accum>>3)&31) : 0;
return m_out; return m_out;
} }

View file

@ -141,7 +141,7 @@ class vrcvi_core : public vgsound_emu_core
inline u8 volume() { return m_volume; } inline u8 volume() { return m_volume; }
private: public:
u8 m_mode : 1; // duty toggle flag u8 m_mode : 1; // duty toggle flag
u8 m_duty : 3; // 3 bit duty cycle u8 m_duty : 3; // 3 bit duty cycle
u8 m_volume : 4; // 4 bit volume u8 m_volume : 4; // 4 bit volume