From 750be17b561acb4c09cc8b9414c50b3cba8e8724 Mon Sep 17 00:00:00 2001 From: Vesa Date: Mon, 26 May 2014 05:46:53 +0300 Subject: [PATCH] Nes: fix sweep --- plugins/nes/Nes.cpp | 23 +++++++++++++++++------ plugins/nes/Nes.h | 4 ++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/plugins/nes/Nes.cpp b/plugins/nes/Nes.cpp index b26ab0983..a4de6d99d 100644 --- a/plugins/nes/Nes.cpp +++ b/plugins/nes/Nes.cpp @@ -155,12 +155,23 @@ void NesObject::renderOutput( sampleFrame * buf, fpp_t frames ) int ch2Sweep = static_cast( m_parent->m_ch2SweepAmt.value() * -1.0 ); // the amounts are inverted so we correct them here - ch1Sweep = ch1Sweep > 0 - ? 7 - ch1Sweep - : -7 - ch1Sweep; - ch2Sweep = ch2Sweep > 0 - ? 7 - ch2Sweep - : -7 - ch2Sweep; + if( ch1Sweep > 0 ) + { + ch1Sweep = 8 - ch1Sweep; + } + if( ch1Sweep < 0 ) + { + ch1Sweep = -8 - ch1Sweep; + } + + if( ch2Sweep > 0 ) + { + ch2Sweep = 8 - ch2Sweep; + } + if( ch2Sweep < 0 ) + { + ch2Sweep = -8 - ch2Sweep; + } // start framebuffer loop diff --git a/plugins/nes/Nes.h b/plugins/nes/Nes.h index 7a58ead18..19a669e19 100644 --- a/plugins/nes/Nes.h +++ b/plugins/nes/Nes.h @@ -63,7 +63,7 @@ const float NOISE_FREQS[16] = const uint16_t LFSR_INIT = 1; const float DUTY_CYCLE[4] = { 0.125, 0.25, 0.5, 0.75 }; const float DITHER_AMP = 1.0 / 60.0; -const float MIN_FREQ = 20.0; +const float MIN_FREQ = 10.0; const int TRIANGLE_WAVETABLE[32] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }; @@ -194,7 +194,7 @@ public: virtual f_cnt_t desiredReleaseFrames() const { - return( 64 ); + return( 8 ); } virtual PluginView * instantiateView( QWidget * parent );