diff --git a/include/bw_osc_pulse.h b/include/bw_osc_pulse.h index 6f2b7d6..4b70183 100644 --- a/include/bw_osc_pulse.h +++ b/include/bw_osc_pulse.h @@ -44,6 +44,9 @@ * x_inc is not BW_NULL when antialiasing * is on and that buffers used for both input and output appear at * the same channel indices. + *
  • Added extra checks in + * bw_osc_pulse_coeffs_is_valid().
  • + *
  • Changed the name of C++ arguments to camel case.
  • * * *
  • Version 1.1.0: @@ -547,7 +550,15 @@ static inline char bw_osc_pulse_coeffs_is_valid( return 0; #endif - return bw_is_finite(coeffs->pulse_width) && coeffs->pulse_width >= 0.f && coeffs->pulse_width <= 1.f; + if (!bw_is_finite(coeffs->pulse_width) || coeffs->pulse_width < 0.f || coeffs->pulse_width > 1.f) + return 0; + +#ifdef BW_DEBUG_DEEP + if (coeffs->state >= bw_gain_coeffs_state_reset_coeffs && !bw_one_pole_state_is_valid(&coeffs->smooth_coeffs, &coeffs->smooth_state)) + return 0; +#endif + + return 1; } #ifdef __cplusplus @@ -576,14 +587,14 @@ public: void process( const float * const * x, - const float * const * x_inc, + const float * const * xInc, float * const * y, size_t nSamples); #ifndef BW_CXX_NO_ARRAY void process( std::array x, - std::array x_inc, + std::array xInc, std::array y, size_t nSamples); #endif @@ -626,20 +637,20 @@ inline void OscPulse::reset() { template inline void OscPulse::process( const float * const * x, - const float * const * x_inc, + const float * const * xInc, float * const * y, size_t nSamples) { - bw_osc_pulse_process_multi(&coeffs, x, x_inc, y, N_CHANNELS, nSamples); + bw_osc_pulse_process_multi(&coeffs, x, xInc, y, N_CHANNELS, nSamples); } #ifndef BW_CXX_NO_ARRAY template inline void OscPulse::process( std::array x, - std::array x_inc, + std::array xInc, std::array y, size_t nSamples) { - process(x.data(), x_inc.data(), y.data(), nSamples); + process(x.data(), xInc.data(), y.data(), nSamples); } #endif diff --git a/include/bw_osc_saw.h b/include/bw_osc_saw.h index 7f43f0a..e372765 100644 --- a/include/bw_osc_saw.h +++ b/include/bw_osc_saw.h @@ -43,6 +43,7 @@ * x_inc is not BW_NULL when antialiasing * is on and that buffers used for both input and output appear at * the same channel indices.
  • + *
  • Changed the name of C++ arguments to camel case.
  • * * *
  • Version 1.1.0: @@ -524,19 +525,20 @@ public: void process( const float * const * x, - const float * const * x_inc, + const float * const * xInc, float * const * y, size_t nSamples); #ifndef BW_CXX_NO_ARRAY void process( std::array x, - std::array x_inc, + std::array xInc, std::array y, size_t nSamples); #endif - void setAntialiasing(bool value); + void setAntialiasing( + bool value); /*! <<<... * } * ``` @@ -570,20 +572,20 @@ inline void OscSaw::reset() { template inline void OscSaw::process( const float * const * x, - const float * const * x_inc, + const float * const * xInc, float * const * y, size_t nSamples) { - bw_osc_saw_process_multi(&coeffs, x, x_inc, y, N_CHANNELS, nSamples); + bw_osc_saw_process_multi(&coeffs, x, xInc, y, N_CHANNELS, nSamples); } #ifndef BW_CXX_NO_ARRAY template inline void OscSaw::process( std::array x, - std::array x_inc, + std::array xInc, std::array y, size_t nSamples) { - process(x.data(), x_inc.data(), y.data(), nSamples); + process(x.data(), xInc.data(), y.data(), nSamples); } #endif diff --git a/include/bw_osc_tri.h b/include/bw_osc_tri.h index bdfba0d..f3b1103 100644 --- a/include/bw_osc_tri.h +++ b/include/bw_osc_tri.h @@ -44,6 +44,9 @@ * x_inc is not BW_NULL when antialiasing * is on and that buffers used for both input and output appear at * the same channel indices.
  • + *
  • Added extra checks in + * bw_osc_pulse_coeffs_is_valid().
  • + *
  • Changed the name of C++ arguments to camel case.
  • * * *
  • Version 1.1.0: @@ -554,7 +557,15 @@ static inline char bw_osc_tri_coeffs_is_valid( return 0; #endif - return bw_is_finite(coeffs->slope) && coeffs->slope >= 0.001f && coeffs->slope <= 0.999f; + if (!bw_is_finite(coeffs->slope) || coeffs->slope < 0.001f || coeffs->slope > 0.999f) + return 0; + +#ifdef BW_DEBUG_DEEP + if (coeffs->state >= bw_gain_coeffs_state_reset_coeffs && !bw_one_pole_state_is_valid(&coeffs->smooth_coeffs, &coeffs->smooth_state)) + return 0; +#endif + + return 1; } #ifdef __cplusplus @@ -583,14 +594,14 @@ public: void process( const float * const * x, - const float * const * x_inc, + const float * const * xInc, float * const * y, size_t nSamples); #ifndef BW_CXX_NO_ARRAY void process( std::array x, - std::array x_inc, + std::array xInc, std::array y, size_t nSamples); #endif @@ -633,20 +644,20 @@ inline void OscTri::reset() { template inline void OscTri::process( const float * const * x, - const float * const * x_inc, + const float * const * xInc, float * const * y, size_t nSamples) { - bw_osc_tri_process_multi(&coeffs, x, x_inc, y, N_CHANNELS, nSamples); + bw_osc_tri_process_multi(&coeffs, x, xInc, y, N_CHANNELS, nSamples); } #ifndef BW_CXX_NO_ARRAY template inline void OscTri::process( std::array x, - std::array x_inc, + std::array xInc, std::array y, size_t nSamples) { - process(x.data(), x_inc.data(), y.data(), nSamples); + process(x.data(), xInc.data(), y.data(), nSamples); } #endif