Hi everyone, this is my first post here.
My goal is to read data held in binary file, decode them and stream to block’s output. Data are just sequence of floats. Moreover I also have a sampling rate, at which they were collected (it is constant for all data). I have C++ OOT module, based on source, I managed to decode file and now I have a vector of floats. How to put them to the block’s output as a stream of floats?
int reader_impl::work(int noutput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items)
{
auto out = static_cast<output_type*>(output_items[0]);
auto size = noutput_items;
static size_t current_data_item = 0;
for (int i = 0; i < std::min(noutput_items, static_cast<int>(data.size())); ++i) {
out[i] = static_cast<float>(data[current_data_item]);
current_data_item++;
if (current_data_item == data.size()) {
current_data_item = 0;
}
}
return noutput_items;
}