mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
add NaN/Inf protection now that bypass no longer de/activates
This commit is contained in:
parent
36776bafcd
commit
62de4d0c31
2 changed files with 37 additions and 2 deletions
|
|
@ -23,6 +23,13 @@
|
|||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef COMPILER_MSVC
|
||||
#include <float.h>
|
||||
#define isfinite_local(val) (bool)_finite((double)val)
|
||||
#else
|
||||
#define isfinite_local isfinite
|
||||
#endif
|
||||
|
||||
#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
|
||||
|
||||
#ifdef LV2_EXTENDED
|
||||
|
|
@ -92,6 +99,13 @@ static void linear_svf_reset(struct linear_svf *self)
|
|||
self->s[0] = self->s[1] = 0.0;
|
||||
}
|
||||
|
||||
static void linear_svf_protect(struct linear_svf *self)
|
||||
{
|
||||
if (!isfinite_local (self->s[0]) || !isfinite_local (self->s[1])) {
|
||||
linear_svf_reset (self);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
float* f0[BANDS];
|
||||
float* g[BANDS];
|
||||
|
|
@ -432,6 +446,10 @@ run(LV2_Handle instance, uint32_t n_samples)
|
|||
offset += block;
|
||||
}
|
||||
|
||||
for (uint32_t j = 0; j < BANDS; j++) {
|
||||
linear_svf_protect(&aeq->v_filter[j]);
|
||||
}
|
||||
|
||||
#ifdef LV2_EXTENDED
|
||||
if (aeq->need_expose && aeq->queue_draw) {
|
||||
aeq->need_expose = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue