diff options
author | japm48 <japm48@users.noreply.github.com> | 2020-04-14 18:28:18 +0200 |
---|---|---|
committer | Michael Dickens <michael.dickens@ettus.com> | 2020-04-14 15:47:29 -0400 |
commit | 7975fb0f63bd90954960658be80790b7a518e64f (patch) | |
tree | 53f376103c9dc93676368f5864c005e71c75097b /gr-blocks/lib/wavfile_source_impl.h | |
parent | d0a351a6fc2f018f36f6e89395f346707a059099 (diff) |
blocks: refactor and reorganize WAV internals
This includes the following:
- WAV header parameters are now stored in a struct.
- do not assume fixed position of data chunk (useful for appending).
- use INT{8,18}T_MAX/MIN.
- 0|NULL -> nullptr.
Diffstat (limited to 'gr-blocks/lib/wavfile_source_impl.h')
-rw-r--r-- | gr-blocks/lib/wavfile_source_impl.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/gr-blocks/lib/wavfile_source_impl.h b/gr-blocks/lib/wavfile_source_impl.h index ce56f8bb8d..8504413fec 100644 --- a/gr-blocks/lib/wavfile_source_impl.h +++ b/gr-blocks/lib/wavfile_source_impl.h @@ -11,6 +11,7 @@ #ifndef INCLUDED_GR_WAVFILE_SOURCE_IMPL_H #define INCLUDED_GR_WAVFILE_SOURCE_IMPL_H +#include <gnuradio/blocks/wavfile.h> #include <gnuradio/blocks/wavfile_source.h> #include <cstdio> // for FILE @@ -23,11 +24,7 @@ private: FILE* d_fp; bool d_repeat; - unsigned d_sample_rate; - int d_nchans; - int d_bytes_per_sample; - int d_first_sample_pos; - unsigned d_samples_per_chan; + wav_header_info d_h; unsigned d_sample_idx; int d_normalize_shift; int d_normalize_fac; @@ -41,11 +38,11 @@ public: wavfile_source_impl(const char* filename, bool repeat); ~wavfile_source_impl(); - unsigned int sample_rate() const { return d_sample_rate; }; + unsigned int sample_rate() const { return d_h.sample_rate; }; - int bits_per_sample() const { return d_bytes_per_sample * 8; }; + int bits_per_sample() const { return d_h.bytes_per_sample * 8; }; - int channels() const { return d_nchans; }; + int channels() const { return d_h.nchans; }; int work(int noutput_items, gr_vector_const_void_star& input_items, |