summaryrefslogtreecommitdiff
path: root/gr-blocks/lib/wavfile_sink_impl.h
diff options
context:
space:
mode:
authorRon Economos <w6rz@comcast.net>2020-09-23 21:13:12 -0700
committermormj <34754695+mormj@users.noreply.github.com>2020-09-25 06:19:11 -0400
commit8f3d61984ecd9ecc97789a174a54c7f0505bddb4 (patch)
tree994b9372e582a1f8f7e7ef91ccab524e3e0672b5 /gr-blocks/lib/wavfile_sink_impl.h
parent1247d48d5416e0f62147f26907bd6c6f76fc2a31 (diff)
gr-blocks: Fix wavfile sink and source block performance issues.
Calling libsndfile sf_read/write_float() for every sample created too much overhead. sf_read/write_float() is now called every 1024 samples for the wavfile source block and every 8192 samples for the wavfile sink block.
Diffstat (limited to 'gr-blocks/lib/wavfile_sink_impl.h')
-rw-r--r--gr-blocks/lib/wavfile_sink_impl.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/gr-blocks/lib/wavfile_sink_impl.h b/gr-blocks/lib/wavfile_sink_impl.h
index c837592ad9..48cf81b7f0 100644
--- a/gr-blocks/lib/wavfile_sink_impl.h
+++ b/gr-blocks/lib/wavfile_sink_impl.h
@@ -29,12 +29,16 @@ private:
float d_min_sample_val;
float d_normalize_shift;
float d_normalize_fac;
+ std::vector<float> d_buffer;
SNDFILE* d_fp;
SNDFILE* d_new_fp;
bool d_updated;
boost::mutex d_mutex;
+ static constexpr int s_items_size = 8192;
+ static constexpr int s_max_channels = 24;
+
/*!
* \brief If any file changes have occurred, update now. This is called
* internally by work() and thus doesn't usually need to be called by