From 6011c0cef23bd884f773238d195e0e985aa38c82 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sun, 21 Feb 2021 00:11:20 +0200 Subject: [PATCH] resampler : can now query the expected resampled size --- src/resampler.cpp | 12 +++++------- src/resampler.h | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/resampler.cpp b/src/resampler.cpp index e31dbb3..f65e9a5 100644 --- a/src/resampler.cpp +++ b/src/resampler.cpp @@ -49,8 +49,11 @@ int Resampler::resample( data_out = temp1; } - //printf("%8.8f %8.8f\n", data_in, data_out); - samplesOut[idxOut++] = data_out; + if (samplesOut) { + samplesOut[idxOut] = data_out; + } + ++idxOut; + time_now += factor; last_time = int_time; int_time = time_now; @@ -63,11 +66,6 @@ int Resampler::resample( new_data(data_in); last_time += 1; } - // if (!(int_time % 1000)) printf("Sample # %li\n",int_time); - //if (!(int_time % 1000)) { - // printf("."); - // fflush(stdout); - //} } return idxOut; diff --git a/src/resampler.h b/src/resampler.h index aae84c2..298165d 100644 --- a/src/resampler.h +++ b/src/resampler.h @@ -7,6 +7,7 @@ public: int nSamples, const float * samplesInp, float * samplesOut); + private: float gimme_data(long j) const; void new_data(float data);