diff --git a/data/presets/Watsyn/Epic_lead.xpf b/data/presets/Watsyn/Epic_lead.xpf new file mode 100644 index 000000000..6fd4682a9 --- /dev/null +++ b/data/presets/Watsyn/Epic_lead.xpf @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/presets/Watsyn/Phase_bass.xpf b/data/presets/Watsyn/Phase_bass.xpf new file mode 100644 index 000000000..a6d3f0475 --- /dev/null +++ b/data/presets/Watsyn/Phase_bass.xpf @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/watsyn/Watsyn.cpp b/plugins/watsyn/Watsyn.cpp index 747141304..3b7c93265 100644 --- a/plugins/watsyn/Watsyn.cpp +++ b/plugins/watsyn/Watsyn.cpp @@ -115,37 +115,41 @@ void WatsynObject::renderOutput( fpp_t _frames ) ///////////// A-series ///////////////// // A2 - sample_t A2_L = interpolate( m_A2wave[ static_cast( m_lphase[A2_OSC] ) % WAVELEN ], + sample_t A2_L = m_A2wave[ static_cast( m_lphase[A2_OSC] ) ] * m_parent->m_lvol[A2_OSC]; + /*interpolate( m_A2wave[ static_cast( m_lphase[A2_OSC] ) % WAVELEN ], m_A2wave[ static_cast( m_lphase[A2_OSC] + 1 ) % WAVELEN ], - fraction( m_lphase[A2_OSC] ) ) * m_parent->m_lvol[A2_OSC]; - sample_t A2_R = interpolate( m_A2wave[ static_cast( m_rphase[A2_OSC] ) % WAVELEN ], + fraction( m_lphase[A2_OSC] ) ) * m_parent->m_lvol[A2_OSC];*/ + sample_t A2_R = m_A2wave[ static_cast( m_rphase[A2_OSC] ) ] * m_parent->m_rvol[A2_OSC]; + /*interpolate( m_A2wave[ static_cast( m_rphase[A2_OSC] ) % WAVELEN ], m_A2wave[ static_cast( m_rphase[A2_OSC] + 1 ) % WAVELEN ], - fraction( m_rphase[A2_OSC] ) ) * m_parent->m_rvol[A2_OSC]; + fraction( m_rphase[A2_OSC] ) ) * m_parent->m_rvol[A2_OSC];*/ // if phase mod, add to phases if( m_amod == MOD_PM ) { A1_lphase = fmodf( A1_lphase + A2_L * PMOD_AMT, WAVELEN ); - while( A1_lphase < 0 ) A1_lphase += WAVELEN; + if( A1_lphase < 0 ) A1_lphase += WAVELEN; A1_rphase = fmodf( A1_rphase + A2_R * PMOD_AMT, WAVELEN ); - while( A1_rphase < 0 ) A1_rphase += WAVELEN; + if( A1_rphase < 0 ) A1_rphase += WAVELEN; } // A1 - sample_t A1_L = interpolate( m_A1wave[ static_cast( A1_lphase ) % WAVELEN ], + sample_t A1_L = interpolate( m_A1wave[ static_cast( A1_lphase ) ], m_A1wave[ static_cast( A1_lphase + 1 ) % WAVELEN ], fraction( A1_lphase ) ) * m_parent->m_lvol[A1_OSC]; - sample_t A1_R = interpolate( m_A1wave[ static_cast( A1_rphase ) % WAVELEN ], + sample_t A1_R = interpolate( m_A1wave[ static_cast( A1_rphase ) ], m_A1wave[ static_cast( A1_rphase + 1 ) % WAVELEN ], fraction( A1_rphase ) ) * m_parent->m_rvol[A1_OSC]; ///////////// B-series ///////////////// // B2 - sample_t B2_L = interpolate( m_B2wave[ static_cast( m_lphase[B2_OSC] ) % WAVELEN ], + sample_t B2_L = m_B2wave[ static_cast( m_lphase[B2_OSC] ) ] * m_parent->m_lvol[B2_OSC]; + /*interpolate( m_B2wave[ static_cast( m_lphase[B2_OSC] ) % WAVELEN ], m_B2wave[ static_cast( m_lphase[B2_OSC] + 1 ) % WAVELEN ], - fraction( m_lphase[B2_OSC] ) ) * m_parent->m_lvol[B2_OSC]; - sample_t B2_R = interpolate( m_B2wave[ static_cast( m_rphase[B2_OSC] ) % WAVELEN ], + fraction( m_lphase[B2_OSC] ) ) * m_parent->m_lvol[B2_OSC];*/ + sample_t B2_R = m_B2wave[ static_cast( m_rphase[B2_OSC] ) ] * m_parent->m_rvol[B2_OSC]; + /*interpolate( m_B2wave[ static_cast( m_rphase[B2_OSC] ) % WAVELEN ], m_B2wave[ static_cast( m_rphase[B2_OSC] + 1 ) % WAVELEN ], - fraction( m_rphase[B2_OSC] ) ) * m_parent->m_rvol[B2_OSC]; + fraction( m_rphase[B2_OSC] ) ) * m_parent->m_rvol[B2_OSC];*/ // if crosstalk active, add a1 const float xt = m_parent->m_xtalk.value(); @@ -159,9 +163,9 @@ void WatsynObject::renderOutput( fpp_t _frames ) if( m_bmod == MOD_PM ) { B1_lphase = fmodf( B1_lphase + B2_L * PMOD_AMT, WAVELEN ); - while( B1_lphase < 0 ) B1_lphase += WAVELEN; + if( B1_lphase < 0 ) B1_lphase += WAVELEN; B1_rphase = fmodf( B1_rphase + B2_R * PMOD_AMT, WAVELEN ); - while( B1_rphase < 0 ) B1_rphase += WAVELEN; + if( B1_rphase < 0 ) B1_rphase += WAVELEN; } // B1 sample_t B1_L = interpolate( m_B1wave[ static_cast( B1_lphase ) % WAVELEN ], diff --git a/plugins/watsyn/Watsyn.h b/plugins/watsyn/Watsyn.h index 5b4072202..66a2b4757 100644 --- a/plugins/watsyn/Watsyn.h +++ b/plugins/watsyn/Watsyn.h @@ -56,11 +56,11 @@ #define B2ROW 95 -const int GRAPHLEN = 220; -const int WAVELEN = 4400; +const int GRAPHLEN = 220; // don't change - must be same as the size of the widget -const int WAVERATIO = WAVELEN / GRAPHLEN; +const int WAVERATIO = 25; // oversampling ratio +const int WAVELEN = GRAPHLEN * WAVERATIO; const int PMOD_AMT = WAVELEN / 2; const int MOD_MIX = 0; @@ -107,34 +107,6 @@ private: { return s1 + ( s2 - s1 ) * x; } -/* - // quick and dirty approximation of cubic interpolation - inline sample_t interpolate( sample_t s1, sample_t s2, float x ) - { - const float x2 = powf( x, 2 ); - const float x3 = powf( x, 3 ); - const float m = s2 - s1; - - return ( ( x3 * 2.0 - x2 * 3.0 + 1.0 ) * s1 ) + - ( ( x3 * -2.0 + x2 * 3.0 ) * s2 ); + - ( ( x + x3 * 2.0 - x2 * 3.0 ) * m ); - } -*/ - // more accurate cubic interpolation... - // consumes more cpu than ^ but doesn't bring a marked increase in sound quality IMO -/* inline sample_t interpolate( sample_t s0, sample_t s1, sample_t s2, sample_t s3, float x ) - { - const float x2 = powf( x, 2 ); - const float x3 = powf( x, 3 ); - const float m1 = ( s2 - s0 ) / 2; - const float m2 = ( s3 - s1 ) / 2; - - return ( ( x3 * 2.0 - x2 * 3.0 + 1.0 ) * s1 ) + - ( ( x3 * -2.0 + x2 * 3.0 ) * s2 ) + - ( ( x3 - x2 * 2 + x ) * m1 ) + - ( ( x3 - x2 ) * m2 ); - }*/ - int m_amod; int m_bmod;