summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-blocks/grc/blocks_wavfile_sink.block.yml13
-rw-r--r--gr-blocks/lib/wavfile_sink_impl.cc2
2 files changed, 12 insertions, 3 deletions
diff --git a/gr-blocks/grc/blocks_wavfile_sink.block.yml b/gr-blocks/grc/blocks_wavfile_sink.block.yml
index 5139a17244..4fd6aef5e5 100644
--- a/gr-blocks/grc/blocks_wavfile_sink.block.yml
+++ b/gr-blocks/grc/blocks_wavfile_sink.block.yml
@@ -19,6 +19,12 @@ parameters:
label: Bits per Sample
dtype: int
default: '8'
+- id: append
+ label: Append to existing file
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
inputs:
- domain: stream
@@ -30,7 +36,7 @@ asserts:
templates:
imports: from gnuradio import blocks
- make: blocks.wavfile_sink(${file}, ${nchan}, ${samp_rate}, ${bits_per_sample})
+ make: blocks.wavfile_sink(${file}, ${nchan}, ${samp_rate}, ${bits_per_sample}, ${append})
callbacks:
- open(${file})
@@ -38,9 +44,12 @@ cpp_templates:
includes: ['#include <gnuradio/blocks/wavfile_sink.h>']
declarations: 'blocks::wavfile_sink::sptr ${id};'
make: |-
- this->${id} = blocks::wavfile_sink::make(${file}${'.c_str()' if str(file)[0] != "'" and str(file)[0] != "\"" else ''}, ${nchan}, ${samp_rate}, ${bits_per_sample});
+ this->${id} = blocks::wavfile_sink::make(${file}${'.c_str()' if str(file)[0] != "'" and str(file)[0] != "\"" else ''}, ${nchan}, ${samp_rate}, ${bits_per_sample}, ${append});
callbacks:
## TODO Handle std::string type when const char* argument is needed
- this->${id}->open(${file})
+ translations:
+ 'True': 'true'
+ 'False': 'false'
file_format: 1
diff --git a/gr-blocks/lib/wavfile_sink_impl.cc b/gr-blocks/lib/wavfile_sink_impl.cc
index 09ff801822..286d065ddc 100644
--- a/gr-blocks/lib/wavfile_sink_impl.cc
+++ b/gr-blocks/lib/wavfile_sink_impl.cc
@@ -127,7 +127,7 @@ bool wavfile_sink_impl::open(const char* filename)
d_h.first_sample_pos = 44;
if (!wavheader_write(
d_new_fp, d_h.sample_rate, d_h.nchans, d_bytes_per_sample_new)) {
- GR_LOG_ERROR(d_logger, boost::format("could not save WAV header"));
+ GR_LOG_ERROR(d_logger, "could not save WAV header");
fclose(d_new_fp);
return false;
}