Commit 1ba525b9 authored by Josh Coalson's avatar Josh Coalson
Browse files

fix rounding bug in buffer size calculation (MAX_SAMPLES_PER_WINDOW)

parent bef021a1
......@@ -110,7 +110,13 @@ typedef signed int Int32_t;
#define MAX_dB 120. /* Table entries for 0...MAX_dB (normal max. values are 70...80 dB) */
#define MAX_ORDER (BUTTER_ORDER > YULE_ORDER ? BUTTER_ORDER : YULE_ORDER)
#define MAX_SAMPLES_PER_WINDOW (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME) /* max. Samples per Time slice */
/* [JEC] the following was originally #defined as:
* (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME)
* but that seemed to fail to take into account the ceil() part of the
* sampleWindow calculation in ResetSampleFrequency(), and was causing
* buffer overflows for 48kHz analysis, hence the +1.
*/
#define MAX_SAMPLES_PER_WINDOW (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME + 1.) /* max. Samples per Time slice */
#define PINK_REF 64.82 /* 298640883795 */ /* calibration value */
static Float_t linprebuf [MAX_ORDER * 2];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment