diff options
author | Philip Balister <philip@opensdr.com> | 2011-04-29 14:51:07 -0400 |
---|---|---|
committer | Philip Balister <philip@opensdr.com> | 2011-10-23 22:05:29 -0400 |
commit | 639e14e2a563215eae3f0e5608091d816bfb6f9c (patch) | |
tree | cf9dbcd8b98f5cfeb15eb7869e18a8fd286f053c /gr-qtgui/lib | |
parent | ead053858d4f8e2c3f258c09f65f6fe59d404deb (diff) |
qtqui-sink : Do not run the FFT unless updating the display.
Signed-off-by: Philip Balister <philip@opensdr.com>
Diffstat (limited to 'gr-qtgui/lib')
-rw-r--r-- | gr-qtgui/lib/qtgui_sink_c.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index 965be0773a..625ddbdf64 100644 --- a/gr-qtgui/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -125,6 +125,9 @@ qtgui_sink_c::initialize() // initialize update time to 10 times a second set_update_time(0.1); + + d_last_update = gruel::high_res_timer_now(); + d_update_active = false; } @@ -270,6 +273,14 @@ qtgui_sink_c::general_work (int noutput_items, unsigned int datasize = noutput_items - i; unsigned int resid = d_fftsize-d_index; + if (!d_update_active && (gruel::high_res_timer_now() - d_last_update) < d_update_time) { + consume_each(noutput_items); + return noutput_items; + } else { + d_last_update = gruel::high_res_timer_now(); + d_update_active = true; + } + // If we have enough input for one full FFT, do it if(datasize >= resid) { const gruel::high_res_timer_type currentTime = gruel::high_res_timer_now(); @@ -284,6 +295,7 @@ qtgui_sink_c::general_work (int noutput_items, d_main_gui->UpdateWindow(true, d_fft->get_outbuf(), d_fftsize, NULL, 0, (float*)d_residbuf, d_fftsize, currentTime, true); + d_update_active = false; } // Otherwise, copy what we received into the residbuf for next time else { |