From 81f812b2160063ce40f54571c8dd69c0c0f85914 Mon Sep 17 00:00:00 2001 From: cam900 Date: Sat, 17 Sep 2022 13:56:09 +0900 Subject: [PATCH] Sync with master --- .../vgsound_emu/src/es550x/es5505.cpp | 9 ++++----- .../vgsound_emu/src/es550x/es5505.hpp | 20 +++++++------------ .../vgsound_emu/src/es550x/es5506.cpp | 10 +++++----- .../vgsound_emu/src/es550x/es5506.hpp | 20 +++++++------------ 4 files changed, 23 insertions(+), 36 deletions(-) diff --git a/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5505.cpp b/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5505.cpp index 6b271224..6172a866 100644 --- a/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5505.cpp +++ b/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5505.cpp @@ -45,12 +45,11 @@ void es5505_core::tick() for (int i = 0; i < 4; i++) { // copy output - m_output[i] = m_output_temp[i]; - m_output_latch[i] = m_ch[i]; - m_output_temp[i].reset(); + m_output[i].copy_output(m_output_temp[i]); // clamp to 16 bit (upper 5 bits are overflow // guard bits) - m_output_latch[i].clamp16(); + m_output_latch[i].clamp16(m_ch[i]); + m_output_temp[i].reset(); // set signed if (m_output_latch[i].left() < 0) { @@ -155,7 +154,7 @@ void es5505_core::tick_perf() // output for (int c = 0; c < 4; c++) { - m_output[c] = m_ch[c]; + m_output[c].clamp16(m_ch[c]); } // update diff --git a/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5505.hpp b/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5505.hpp index 4cbd2581..52a3b5f3 100644 --- a/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5505.hpp +++ b/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5505.hpp @@ -31,7 +31,13 @@ class es5505_core : public es550x_shared_core { m_left = 0; m_right = 0; - }; + } + + inline void copy_output(output_t &src) + { + m_left = src.left(); + m_right = src.right(); + } inline s32 clamp16(s32 in) { return clamp(in, -0x8000, 0x7fff); } @@ -76,18 +82,6 @@ class es5505_core : public es550x_shared_core return *this; } - output_t &operator=(output_t &src) - { - clamp16(src); - return *this; - } - - output_t &operator=(s32 val) - { - m_left = m_right = clamp16(val); - return *this; - } - output_t &operator>>(s32 shift) { m_left >>= shift; diff --git a/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5506.cpp b/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5506.cpp index b0f887da..83e43cac 100644 --- a/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5506.cpp +++ b/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5506.cpp @@ -63,11 +63,11 @@ void es5506_core::tick() for (int i = 0; i < 6; i++) { // copy output - m_output[i] = m_output_temp[i]; - m_output_latch[i] = m_ch[i]; - m_output_temp[i].reset(); + m_output[i].copy_output(m_output_temp[i]); // clamp to 20 bit (upper 3 bits are // overflow guard bits) + m_output_latch[i].clamp20(m_ch[i]); + m_output_temp[i].reset(); m_output_latch[i].clamp20(); // set signed if (m_output_latch[i].left() < 0) @@ -202,7 +202,7 @@ void es5506_core::tick_perf() { for (int c = 0; c < 6; c++) { - m_output[c] = m_ch[c] >> output_bits; + m_output[c].clamp20(m_ch[c] >> output_bits); } } } @@ -210,7 +210,7 @@ void es5506_core::tick_perf() { for (int c = 0; c < 6; c++) { - m_output[c] = 0; + m_output[c].reset(); } } diff --git a/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5506.hpp b/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5506.hpp index f54a03c3..b59a96dc 100644 --- a/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5506.hpp +++ b/extern/vgsound_emu-modified/vgsound_emu/src/es550x/es5506.hpp @@ -31,7 +31,13 @@ class es5506_core : public es550x_shared_core { m_left = 0; m_right = 0; - }; + } + + inline void copy_output(output_t &src) + { + m_left = src.left(); + m_right = src.right(); + } inline s32 clamp20(s32 in) { return clamp(in, -0x80000, 0x7ffff); } @@ -76,18 +82,6 @@ class es5506_core : public es550x_shared_core return *this; } - output_t &operator=(output_t &src) - { - clamp20(src); - return *this; - } - - output_t &operator=(s32 val) - { - m_left = m_right = clamp20(val); - return *this; - } - output_t &operator>>(s32 shift) { m_left >>= shift;