From 50431b08b0c0b958ce8771557039d92c5bde3897 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 11 Feb 2023 22:49:07 -0500 Subject: [PATCH] VRC6: 14 to 13 --- .../vgsound_emu/src/vrcvi/vrcvi.cpp | 10 +++++----- .../vgsound_emu/src/vrcvi/vrcvi.hpp | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/extern/vgsound_emu-modified/vgsound_emu/src/vrcvi/vrcvi.cpp b/extern/vgsound_emu-modified/vgsound_emu/src/vrcvi/vrcvi.cpp index 927df9f5..9787540c 100644 --- a/extern/vgsound_emu-modified/vgsound_emu/src/vrcvi/vrcvi.cpp +++ b/extern/vgsound_emu-modified/vgsound_emu/src/vrcvi/vrcvi.cpp @@ -88,7 +88,7 @@ bool vrcvi_core::pulse_t::tick() 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() @@ -100,7 +100,7 @@ bool vrcvi_core::sawtooth_t::tick() if (vrcvi_core::alu_t::tick()) { - if (bitfield(m_cycle++, 0)) + if ((m_cycle++)&1) { // Even step only m_accum += m_rate; } @@ -110,20 +110,20 @@ bool vrcvi_core::sawtooth_t::tick() m_cycle = 0; } } - return (m_accum == 0) ? false : true; + return (m_accum != 0); } s8 vrcvi_core::pulse_t::get_output() { // add 4 bit pulse output - m_out = tick() ? m_control.volume() : 0; + m_out = tick() ? m_control.m_volume : 0; return m_out; } s8 vrcvi_core::sawtooth_t::get_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; } diff --git a/extern/vgsound_emu-modified/vgsound_emu/src/vrcvi/vrcvi.hpp b/extern/vgsound_emu-modified/vgsound_emu/src/vrcvi/vrcvi.hpp index 01217115..71dacd5a 100644 --- a/extern/vgsound_emu-modified/vgsound_emu/src/vrcvi/vrcvi.hpp +++ b/extern/vgsound_emu-modified/vgsound_emu/src/vrcvi/vrcvi.hpp @@ -141,7 +141,7 @@ class vrcvi_core : public vgsound_emu_core inline u8 volume() { return m_volume; } - private: + public: u8 m_mode : 1; // duty toggle flag u8 m_duty : 3; // 3 bit duty cycle u8 m_volume : 4; // 4 bit volume