diff options
author | Ben Reynwar | 2011-06-13 13:30:19 -0700 |
---|---|---|
committer | Ben Reynwar | 2011-06-13 13:30:19 -0700 |
commit | f73984a6b43af4c4795af4b91657cc7b1ff49dae (patch) | |
tree | f7ed1390445a1a3e8905dba741163a3876ad40f2 /gr-qtgui/lib/qtgui_time_sink_f.cc | |
parent | 2c8b1d999e7388c4513149615b5c7ebedb854d35 (diff) | |
parent | 5ce630cbce6460b739b175257ce0d717095a55f4 (diff) | |
download | gnuradio-f73984a6b43af4c4795af4b91657cc7b1ff49dae.tar.gz gnuradio-f73984a6b43af4c4795af4b91657cc7b1ff49dae.tar.bz2 gnuradio-f73984a6b43af4c4795af4b91657cc7b1ff49dae.zip |
Merge branch '8psk' of https://github.com/trondeau/gnuradio into 8psk
Diffstat (limited to 'gr-qtgui/lib/qtgui_time_sink_f.cc')
-rw-r--r-- | gr-qtgui/lib/qtgui_time_sink_f.cc | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/gr-qtgui/lib/qtgui_time_sink_f.cc b/gr-qtgui/lib/qtgui_time_sink_f.cc index 28789c163..2fe99f43c 100644 --- a/gr-qtgui/lib/qtgui_time_sink_f.cc +++ b/gr-qtgui/lib/qtgui_time_sink_f.cc @@ -44,9 +44,9 @@ qtgui_time_sink_f::qtgui_time_sink_f (int size, double bw, const std::string &name, int nconnections, QWidget *parent) - : gr_block ("time_sink_f", - gr_make_io_signature (nconnections, nconnections, sizeof(float)), - gr_make_io_signature (0, 0, 0)), + : gr_sync_block ("time_sink_f", + gr_make_io_signature (nconnections, nconnections, sizeof(float)), + gr_make_io_signature (0, 0, 0)), d_size(size), d_bandwidth(bw), d_name(name), d_nconnections(nconnections), d_parent(parent) { @@ -59,6 +59,7 @@ qtgui_time_sink_f::qtgui_time_sink_f (int size, double bw, } initialize(); + set_output_multiple(d_size); } qtgui_time_sink_f::~qtgui_time_sink_f() @@ -70,15 +71,6 @@ qtgui_time_sink_f::~qtgui_time_sink_f() } void -qtgui_time_sink_f::forecast(int noutput_items, gr_vector_int &ninput_items_required) -{ - unsigned int ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) { - ninput_items_required[i] = std::min(d_size, 8191); - } -} - -void qtgui_time_sink_f::initialize() { if(qApp != NULL) { @@ -94,7 +86,7 @@ qtgui_time_sink_f::initialize() // initialize update time to 10 times a second set_update_time(0.1); - timespec_reset(&d_last_time); + d_last_time = 0; } @@ -144,10 +136,9 @@ qtgui_time_sink_f::set_color(int which, const std::string &color) } int -qtgui_time_sink_f::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +qtgui_time_sink_f::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { int n=0, j=0, idx=0; const float *in = (const float*)input_items[idx]; @@ -159,7 +150,7 @@ qtgui_time_sink_f::general_work (int noutput_items, // If we have enough input for one full plot, do it if(datasize >= resid) { - d_current_time = get_highres_clock(); + d_current_time = gruel::high_res_timer_now(); // Fill up residbufs with d_size number of items for(n = 0; n < d_nconnections; n++) { @@ -170,7 +161,7 @@ qtgui_time_sink_f::general_work (int noutput_items, } // Update the plot if its time - if(diff_timespec(d_current_time, d_last_time) > d_update_time) { + if(gruel::high_res_timer_now() - d_last_time > d_update_time) { d_last_time = d_current_time; d_qApplication->postEvent(d_main_gui, new TimeUpdateEvent(d_residbufs, d_size)); @@ -180,7 +171,9 @@ qtgui_time_sink_f::general_work (int noutput_items, j += resid; } // Otherwise, copy what we received into the residbufs for next time + // because we set the output_multiple, this should never need to be called else { + assert(0); for(n = 0; n < d_nconnections; n++) { in = (const float*)input_items[idx++]; for(unsigned int k = 0; k < resid; k++) { @@ -192,6 +185,5 @@ qtgui_time_sink_f::general_work (int noutput_items, } } - consume_each(j); - return j; + return noutput_items; } |