summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gnuradio-core/src/lib/runtime/gr_random_annotator.cc27
-rw-r--r--gnuradio-core/src/lib/runtime/gr_random_annotator.h2
2 files changed, 21 insertions, 8 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc
index 85995fde1..25e7458e5 100644
--- a/gnuradio-core/src/lib/runtime/gr_random_annotator.cc
+++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.cc
@@ -26,22 +26,24 @@
#include <gr_random_annotator.h>
#include <gr_io_signature.h>
+#include <string.h>
-gr_random_annotator::gr_random_annotator (size_t sizeof_stream_item)
- : gr_sync_block ("random_annotator",
- gr_make_io_signature (1, 1, sizeof_stream_item),
- gr_make_io_signature (1, 1, sizeof_stream_item))
+gr_random_annotator_sptr
+gr_make_random_annotator (size_t sizeof_stream_item)
{
+ return gnuradio::get_initial_sptr (new gr_random_annotator (sizeof_stream_item));
}
-gr_random_annotator::~gr_random_annotator ()
+gr_random_annotator::gr_random_annotator (size_t sizeof_stream_item)
+ : gr_sync_block ("random_annotator",
+ gr_make_io_signature (1, -1, sizeof_stream_item),
+ gr_make_io_signature (1, -1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item)
{
}
-gr_random_annotator_sptr
-gr_make_random_annotator (size_t sizeof_stream_item)
+gr_random_annotator::~gr_random_annotator ()
{
- return gnuradio::get_initial_sptr (new gr_random_annotator (sizeof_stream_item));
}
int
@@ -49,5 +51,14 @@ gr_random_annotator::work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
+ const float **in = (const float **) &input_items[0];
+ float **out = (float **) &output_items[0];
+
+ // Work does nothing to the data stream; just copy all inputs to outputs
+ int ninputs = input_items.size();
+ for (int i = 0; i < ninputs; i++){
+ memcpy(out[i], in[i], noutput_items * d_itemsize);
+ }
+
return noutput_items;
}
diff --git a/gnuradio-core/src/lib/runtime/gr_random_annotator.h b/gnuradio-core/src/lib/runtime/gr_random_annotator.h
index cf894c640..7f200eff7 100644
--- a/gnuradio-core/src/lib/runtime/gr_random_annotator.h
+++ b/gnuradio-core/src/lib/runtime/gr_random_annotator.h
@@ -44,6 +44,8 @@ protected:
gr_random_annotator (size_t sizeof_stream_item);
private:
+ size_t d_itemsize;
+
friend gr_random_annotator_sptr
gr_make_random_annotator (size_t sizeof_stream_item);
};