Browse Source

Filter: LowPassFilter gets another div-by-zero check

mission-4.1.18
Randy Mackay 10 years ago
parent
commit
ca92821445
  1. 2
      libraries/Filter/LowPassFilter.h

2
libraries/Filter/LowPassFilter.h

@ -107,7 +107,7 @@ template <class T> @@ -107,7 +107,7 @@ template <class T>
void LowPassFilter<T>::set_time_constant(float time_step, float time_constant)
{
// avoid divide by zero
if (time_constant + time_step <= 0.0f) {
if ((time_constant <= 0.0f) || (time_step <= 0.0f)) {
_cutoff_hz = 0.0f;
_alpha = 1.0f;
return;

Loading…
Cancel
Save