From befadabc2f18b483c71250adfd7dbf42f66b16f0 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 27 Mar 2011 12:55:16 -0400 Subject: gr-qtgui: restructuring qtgui directory to new layout. --- gr-qtgui/lib/qtgui_sink_c.cc | 326 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 326 insertions(+) create mode 100644 gr-qtgui/lib/qtgui_sink_c.cc (limited to 'gr-qtgui/lib/qtgui_sink_c.cc') diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc new file mode 100644 index 000000000..05c7b28d5 --- /dev/null +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -0,0 +1,326 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include + +qtgui_sink_c_sptr +qtgui_make_sink_c (int fftsize, int wintype, + double fc, double bw, + const std::string &name, + bool plotfreq, bool plotwaterfall, + bool plotwaterfall3d, bool plottime, + bool plotconst, + bool use_openGL, + QWidget *parent) +{ + return gnuradio::get_initial_sptr(new qtgui_sink_c (fftsize, wintype, + fc, bw, name, + plotfreq, plotwaterfall, + plotwaterfall3d, plottime, + plotconst, + use_openGL, + parent)); +} + +qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, + double fc, double bw, + const std::string &name, + bool plotfreq, bool plotwaterfall, + bool plotwaterfall3d, bool plottime, + bool plotconst, + bool use_openGL, + QWidget *parent) + : gr_block ("sink_c", + gr_make_io_signature (1, -1, sizeof(gr_complex)), + gr_make_io_signature (0, 0, 0)), + d_fftsize(fftsize), + d_wintype((gr_firdes::win_type)(wintype)), + d_center_freq(fc), d_bandwidth(bw), d_name(name), + d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall), + d_plottime(plottime), d_plotconst(plotconst), + d_parent(parent) +{ + if(plotwaterfall3d == true) { + fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n"); + } + + d_main_gui = NULL; + lock(); + + // Perform fftshift operation; + // this is usually desired when plotting + d_shift = true; + + d_fft = new gri_fft_complex (d_fftsize, true); + + d_index = 0; + d_residbuf = new gr_complex[d_fftsize]; + + buildwindow(); + + initialize(use_openGL); +} + +qtgui_sink_c::~qtgui_sink_c() +{ + delete d_main_gui; + delete [] d_residbuf; + delete d_fft; +} + +void +qtgui_sink_c::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_fftsize, 8191); + } +} + +void qtgui_sink_c::lock() +{ + d_mutex.lock(); +} + +void qtgui_sink_c::unlock() +{ + d_mutex.unlock(); +} + + +void +qtgui_sink_c::initialize(const bool opengl) +{ + if(qApp != NULL) { + d_qApplication = qApp; + } + else { + int argc; + char **argv = NULL; + d_qApplication = new QApplication(argc, argv); + } + + if(d_center_freq < 0) { + throw std::runtime_error("qtgui_sink_c: Received bad center frequency.\n"); + } + + uint64_t maxBufferSize = 32768; + d_main_gui = new SpectrumGUIClass(maxBufferSize, d_fftsize, + d_center_freq, + -d_bandwidth/2.0, + d_bandwidth/2.0); + + d_main_gui->SetDisplayTitle(d_name); + d_main_gui->SetFFTSize(d_fftsize); + d_main_gui->SetWindowType((int)d_wintype); + + d_main_gui->OpenSpectrumWindow(d_parent, + d_plotfreq, d_plotwaterfall, + d_plottime, d_plotconst, + opengl); + + // initialize update time to 10 times a second + set_update_time(0.1); + + d_object = new qtgui_obj(d_qApplication); + qApp->postEvent(d_object, new qtgui_event(d_mutex)); +} + + +void +qtgui_sink_c::exec_() +{ + d_qApplication->exec(); +} + +QWidget* +qtgui_sink_c::qwidget() +{ + return d_main_gui->qwidget(); +} + +PyObject* +qtgui_sink_c::pyqwidget() +{ + PyObject *w = PyLong_FromVoidPtr((void*)d_main_gui->qwidget()); + PyObject *retarg = Py_BuildValue("N", w); + return retarg; +} + +void +qtgui_sink_c::set_frequency_range(const double centerfreq, + const double bandwidth) +{ + d_center_freq = centerfreq; + d_bandwidth = bandwidth; + d_main_gui->SetFrequencyRange(d_center_freq, + -d_bandwidth/2.0, + d_bandwidth/2.0); +} + +void +qtgui_sink_c::set_time_domain_axis(double min, double max) +{ + d_main_gui->SetTimeDomainAxis(min, max); +} + +void +qtgui_sink_c::set_constellation_axis(double xmin, double xmax, + double ymin, double ymax) +{ + d_main_gui->SetConstellationAxis(xmin, xmax, ymin, ymax); +} + +void +qtgui_sink_c::set_constellation_pen_size(int size) +{ + d_main_gui->SetConstellationPenSize(size); +} + + +void +qtgui_sink_c::set_frequency_axis(double min, double max) +{ + d_main_gui->SetFrequencyAxis(min, max); +} + +void +qtgui_sink_c::set_update_time(double t) +{ + d_update_time = t; + d_main_gui->SetUpdateTime(d_update_time); +} + +void +qtgui_sink_c::fft(const gr_complex *data_in, int size) +{ + if (d_window.size()) { + gr_complex *dst = d_fft->get_inbuf(); + int i; + for (i = 0; i < size; i++) // apply window + dst[i] = data_in[i] * d_window[i]; + } + else { + memcpy (d_fft->get_inbuf(), data_in, sizeof(gr_complex)*size); + } + + d_fft->execute (); // compute the fft +} + +void +qtgui_sink_c::windowreset() +{ + gr_firdes::win_type newwintype = (gr_firdes::win_type)d_main_gui->GetWindowType(); + if(d_wintype != newwintype) { + d_wintype = newwintype; + buildwindow(); + } +} + +void +qtgui_sink_c::buildwindow() +{ + d_window.clear(); + if(d_wintype != 0) { + d_window = gr_firdes::window(d_wintype, d_fftsize, 6.76); + } +} + +void +qtgui_sink_c::fftresize() +{ + int newfftsize = d_main_gui->GetFFTSize(); + + if(newfftsize != d_fftsize) { + + // Resize residbuf and replace data + delete [] d_residbuf; + d_residbuf = new gr_complex[newfftsize]; + + // Set new fft size and reset buffer index + // (throws away any currently held data, but who cares?) + d_fftsize = newfftsize; + d_index = 0; + + // Reset window to reflect new size + buildwindow(); + + // Reset FFTW plan for new size + delete d_fft; + d_fft = new gri_fft_complex (d_fftsize, true); + } +} + + +int +qtgui_sink_c::general_work (int noutput_items, + gr_vector_int &ninput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + int j=0; + const gr_complex *in = (const gr_complex*)input_items[0]; + + gruel::scoped_lock lock(d_mutex); + + // Update the FFT size from the application + fftresize(); + windowreset(); + + for(int i=0; i < noutput_items; i+=d_fftsize) { + unsigned int datasize = noutput_items - i; + unsigned int resid = d_fftsize-d_index; + + // If we have enough input for one full FFT, do it + if(datasize >= resid) { + const timespec currentTime = get_highres_clock(); + + // Fill up residbuf with d_fftsize number of items + memcpy(d_residbuf+d_index, &in[j], sizeof(gr_complex)*resid); + d_index = 0; + + j += resid; + fft(d_residbuf, d_fftsize); + + d_main_gui->UpdateWindow(true, d_fft->get_outbuf(), d_fftsize, + NULL, 0, (float*)d_residbuf, d_fftsize, + currentTime, true); + } + // Otherwise, copy what we received into the residbuf for next time + else { + memcpy(d_residbuf+d_index, &in[j], sizeof(gr_complex)*datasize); + d_index += datasize; + j += datasize; + } + } + + consume_each(j); + return j; +} -- cgit From 79fa80423ab962e550b57c1bde49673394d8e0db Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 27 Mar 2011 18:17:17 -0400 Subject: gr-qtgui: cleaning up handling of mutex --- gr-qtgui/lib/qtgui_sink_c.cc | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'gr-qtgui/lib/qtgui_sink_c.cc') diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index 05c7b28d5..dee7c2f43 100644 --- a/gr-qtgui/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -71,8 +71,8 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n"); } + gruel::scoped_lock lock(d_mutex); d_main_gui = NULL; - lock(); // Perform fftshift operation; // this is usually desired when plotting @@ -104,17 +104,6 @@ qtgui_sink_c::forecast(int noutput_items, gr_vector_int &ninput_items_required) } } -void qtgui_sink_c::lock() -{ - d_mutex.lock(); -} - -void qtgui_sink_c::unlock() -{ - d_mutex.unlock(); -} - - void qtgui_sink_c::initialize(const bool opengl) { -- cgit From 7563ab82b34600219daf45555a00de79dd254fdb Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 27 Mar 2011 19:21:58 -0400 Subject: gr-qtgui: tightening up and cleaning up some memory leaks. --- gr-qtgui/lib/qtgui_sink_c.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gr-qtgui/lib/qtgui_sink_c.cc') diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index dee7c2f43..405971aa0 100644 --- a/gr-qtgui/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -93,6 +93,7 @@ qtgui_sink_c::~qtgui_sink_c() delete d_main_gui; delete [] d_residbuf; delete d_fft; + delete d_object; } void @@ -111,7 +112,7 @@ qtgui_sink_c::initialize(const bool opengl) d_qApplication = qApp; } else { - int argc; + int argc=0; char **argv = NULL; d_qApplication = new QApplication(argc, argv); } -- cgit From 414ff0e69704f8c75edfc2ad3284a9c1bba5e50c Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 4 Apr 2011 23:37:58 -0400 Subject: gr-qtgui: removing unnecessary mutex and qtevent objects. --- gr-qtgui/lib/qtgui_sink_c.cc | 7 ------- 1 file changed, 7 deletions(-) (limited to 'gr-qtgui/lib/qtgui_sink_c.cc') diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index 405971aa0..bdd941fe1 100644 --- a/gr-qtgui/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -71,7 +71,6 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n"); } - gruel::scoped_lock lock(d_mutex); d_main_gui = NULL; // Perform fftshift operation; @@ -93,7 +92,6 @@ qtgui_sink_c::~qtgui_sink_c() delete d_main_gui; delete [] d_residbuf; delete d_fft; - delete d_object; } void @@ -138,9 +136,6 @@ qtgui_sink_c::initialize(const bool opengl) // initialize update time to 10 times a second set_update_time(0.1); - - d_object = new qtgui_obj(d_qApplication); - qApp->postEvent(d_object, new qtgui_event(d_mutex)); } @@ -278,8 +273,6 @@ qtgui_sink_c::general_work (int noutput_items, int j=0; const gr_complex *in = (const gr_complex*)input_items[0]; - gruel::scoped_lock lock(d_mutex); - // Update the FFT size from the application fftresize(); windowreset(); -- cgit From 8f53f5a782a6500d191ba557b37e7e3785cf6e02 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Wed, 6 Apr 2011 00:22:29 -0400 Subject: gr-qtgui: removing references to 3D waterfall plot and changning QtGui API to remove bool that turns it on/off. --- gr-qtgui/lib/qtgui_sink_c.cc | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'gr-qtgui/lib/qtgui_sink_c.cc') diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index bdd941fe1..4cbd47c55 100644 --- a/gr-qtgui/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -35,16 +35,14 @@ qtgui_make_sink_c (int fftsize, int wintype, double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, + bool plottime, bool plotconst, bool use_openGL, QWidget *parent) { return gnuradio::get_initial_sptr(new qtgui_sink_c (fftsize, wintype, fc, bw, name, plotfreq, plotwaterfall, - plotwaterfall3d, plottime, - plotconst, + plottime, plotconst, use_openGL, parent)); } @@ -53,8 +51,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, double fc, double bw, const std::string &name, bool plotfreq, bool plotwaterfall, - bool plotwaterfall3d, bool plottime, - bool plotconst, + bool plottime, bool plotconst, bool use_openGL, QWidget *parent) : gr_block ("sink_c", @@ -67,10 +64,6 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, d_plottime(plottime), d_plotconst(plotconst), d_parent(parent) { - if(plotwaterfall3d == true) { - fprintf(stderr, "Warning: plotting Waterfall3D has been removed; enabling plotwaterfall3d has no effect.\n"); - } - d_main_gui = NULL; // Perform fftshift operation; -- cgit From c4050c5bdb55ce14565d0ade84bd518cc8c27ec5 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 10 Apr 2011 17:13:15 -0400 Subject: gr-qtgui: removed OpenGL calls; we still link against the QTOPENGL_LIBS because of some dependencies in Qwt. --- gr-qtgui/lib/qtgui_sink_c.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'gr-qtgui/lib/qtgui_sink_c.cc') diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index 4cbd47c55..2cfa67d75 100644 --- a/gr-qtgui/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -36,14 +36,12 @@ qtgui_make_sink_c (int fftsize, int wintype, const std::string &name, bool plotfreq, bool plotwaterfall, bool plottime, bool plotconst, - bool use_openGL, QWidget *parent) { return gnuradio::get_initial_sptr(new qtgui_sink_c (fftsize, wintype, fc, bw, name, plotfreq, plotwaterfall, plottime, plotconst, - use_openGL, parent)); } @@ -52,7 +50,6 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, const std::string &name, bool plotfreq, bool plotwaterfall, bool plottime, bool plotconst, - bool use_openGL, QWidget *parent) : gr_block ("sink_c", gr_make_io_signature (1, -1, sizeof(gr_complex)), @@ -77,7 +74,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, buildwindow(); - initialize(use_openGL); + initialize(); } qtgui_sink_c::~qtgui_sink_c() @@ -97,7 +94,7 @@ qtgui_sink_c::forecast(int noutput_items, gr_vector_int &ninput_items_required) } void -qtgui_sink_c::initialize(const bool opengl) +qtgui_sink_c::initialize() { if(qApp != NULL) { d_qApplication = qApp; @@ -124,8 +121,7 @@ qtgui_sink_c::initialize(const bool opengl) d_main_gui->OpenSpectrumWindow(d_parent, d_plotfreq, d_plotwaterfall, - d_plottime, d_plotconst, - opengl); + d_plottime, d_plotconst); // initialize update time to 10 times a second set_update_time(0.1); -- cgit From 16ec5a3bf5a22cc72423d975666878eeadd2cf3c Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 10 Apr 2011 17:21:38 -0400 Subject: gr-qtgui: exposing set_update_time to Python. --- gr-qtgui/lib/qtgui_sink_c.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gr-qtgui/lib/qtgui_sink_c.cc') diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index 2cfa67d75..7b40dd01d 100644 --- a/gr-qtgui/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -39,10 +39,10 @@ qtgui_make_sink_c (int fftsize, int wintype, QWidget *parent) { return gnuradio::get_initial_sptr(new qtgui_sink_c (fftsize, wintype, - fc, bw, name, - plotfreq, plotwaterfall, - plottime, plotconst, - parent)); + fc, bw, name, + plotfreq, plotwaterfall, + plottime, plotconst, + parent)); } qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, -- cgit From 697562c3d4319ab6f13e4c2910a853409731595d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 7 Jun 2011 21:48:02 -0400 Subject: qtgui: replace timespec with typedef so its easier to replace --- gr-qtgui/lib/qtgui_sink_c.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-qtgui/lib/qtgui_sink_c.cc') diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index 7b40dd01d..e980318ca 100644 --- a/gr-qtgui/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -272,7 +272,7 @@ qtgui_sink_c::general_work (int noutput_items, // If we have enough input for one full FFT, do it if(datasize >= resid) { - const timespec currentTime = get_highres_clock(); + const highres_timespec currentTime = get_highres_clock(); // Fill up residbuf with d_fftsize number of items memcpy(d_residbuf+d_index, &in[j], sizeof(gr_complex)*resid); -- cgit From bbf11bb338a4a88a1f270f77649212fea0b0cab0 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 7 Jun 2011 22:55:41 -0400 Subject: qtgui: removed all traces of highResTimeFunctions.h --- gr-qtgui/lib/qtgui_sink_c.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-qtgui/lib/qtgui_sink_c.cc') diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index e980318ca..965be0773 100644 --- a/gr-qtgui/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -272,7 +272,7 @@ qtgui_sink_c::general_work (int noutput_items, // If we have enough input for one full FFT, do it if(datasize >= resid) { - const highres_timespec currentTime = get_highres_clock(); + const gruel::high_res_timer_type currentTime = gruel::high_res_timer_now(); // Fill up residbuf with d_fftsize number of items memcpy(d_residbuf+d_index, &in[j], sizeof(gr_complex)*resid); -- cgit From 639e14e2a563215eae3f0e5608091d816bfb6f9c Mon Sep 17 00:00:00 2001 From: Philip Balister Date: Fri, 29 Apr 2011 14:51:07 -0400 Subject: qtqui-sink : Do not run the FFT unless updating the display. Signed-off-by: Philip Balister --- gr-qtgui/lib/qtgui_sink_c.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gr-qtgui/lib/qtgui_sink_c.cc') diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index 965be0773..625ddbdf6 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 { -- cgit From 3259e2a6a4effa2e847f096094df36d37e781742 Mon Sep 17 00:00:00 2001 From: Philip Balister Date: Tue, 1 Nov 2011 15:51:26 -0400 Subject: qtgui_sink_c : Fix update rate math. I botched the conversion to gruel high res timers. This patch fixes things. Checked on x86 byt hand adjusting update rate. We should expose the update rate setting to users. Signed-off-by: Philip Balister --- gr-qtgui/lib/qtgui_sink_c.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gr-qtgui/lib/qtgui_sink_c.cc') diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index 625ddbdf6..b99a0c56a 100644 --- a/gr-qtgui/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -124,7 +124,7 @@ qtgui_sink_c::initialize() d_plottime, d_plotconst); // initialize update time to 10 times a second - set_update_time(0.1); + set_update_time(0.5); d_last_update = gruel::high_res_timer_now(); d_update_active = false; @@ -191,8 +191,8 @@ qtgui_sink_c::set_frequency_axis(double min, double max) void qtgui_sink_c::set_update_time(double t) { - d_update_time = t; - d_main_gui->SetUpdateTime(d_update_time); + d_update_time = t * gruel::high_res_timer_tps(); + d_main_gui->SetUpdateTime(t); } void -- cgit From f919f9dcbb54a08e6e26d6c229ce92fb784fa1b2 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Fri, 13 Apr 2012 18:36:53 -0400 Subject: Removed whitespace and added dtools/bin/remove-whitespace as a tool to do this in the future. The sed script was provided by Moritz Fischer. --- gr-qtgui/lib/qtgui_sink_c.cc | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'gr-qtgui/lib/qtgui_sink_c.cc') diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc index b99a0c56a..de730a871 100644 --- a/gr-qtgui/lib/qtgui_sink_c.cc +++ b/gr-qtgui/lib/qtgui_sink_c.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2008,2009,2010,2011 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. - * + * * GNU Radio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -55,7 +55,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, gr_make_io_signature (1, -1, sizeof(gr_complex)), gr_make_io_signature (0, 0, 0)), d_fftsize(fftsize), - d_wintype((gr_firdes::win_type)(wintype)), + d_wintype((gr_firdes::win_type)(wintype)), d_center_freq(fc), d_bandwidth(bw), d_name(name), d_plotfreq(plotfreq), d_plotwaterfall(plotwaterfall), d_plottime(plottime), d_plotconst(plotconst), @@ -65,7 +65,7 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype, // Perform fftshift operation; // this is usually desired when plotting - d_shift = true; + d_shift = true; d_fft = new gri_fft_complex (d_fftsize, true); @@ -110,16 +110,16 @@ qtgui_sink_c::initialize() } uint64_t maxBufferSize = 32768; - d_main_gui = new SpectrumGUIClass(maxBufferSize, d_fftsize, - d_center_freq, - -d_bandwidth/2.0, + d_main_gui = new SpectrumGUIClass(maxBufferSize, d_fftsize, + d_center_freq, + -d_bandwidth/2.0, d_bandwidth/2.0); d_main_gui->SetDisplayTitle(d_name); d_main_gui->SetFFTSize(d_fftsize); d_main_gui->SetWindowType((int)d_wintype); - d_main_gui->OpenSpectrumWindow(d_parent, + d_main_gui->OpenSpectrumWindow(d_parent, d_plotfreq, d_plotwaterfall, d_plottime, d_plotconst); @@ -152,12 +152,12 @@ qtgui_sink_c::pyqwidget() } void -qtgui_sink_c::set_frequency_range(const double centerfreq, +qtgui_sink_c::set_frequency_range(const double centerfreq, const double bandwidth) { d_center_freq = centerfreq; d_bandwidth = bandwidth; - d_main_gui->SetFrequencyRange(d_center_freq, + d_main_gui->SetFrequencyRange(d_center_freq, -d_bandwidth/2.0, d_bandwidth/2.0); } @@ -175,7 +175,7 @@ qtgui_sink_c::set_constellation_axis(double xmin, double xmax, d_main_gui->SetConstellationAxis(xmin, xmax, ymin, ymax); } -void +void qtgui_sink_c::set_constellation_pen_size(int size) { d_main_gui->SetConstellationPenSize(size); @@ -211,10 +211,10 @@ qtgui_sink_c::fft(const gr_complex *data_in, int size) d_fft->execute (); // compute the fft } -void +void qtgui_sink_c::windowreset() { - gr_firdes::win_type newwintype = (gr_firdes::win_type)d_main_gui->GetWindowType(); + gr_firdes::win_type newwintype = (gr_firdes::win_type)d_main_gui->GetWindowType(); if(d_wintype != newwintype) { d_wintype = newwintype; buildwindow(); @@ -241,11 +241,11 @@ qtgui_sink_c::fftresize() delete [] d_residbuf; d_residbuf = new gr_complex[newfftsize]; - // Set new fft size and reset buffer index - // (throws away any currently held data, but who cares?) + // Set new fft size and reset buffer index + // (throws away any currently held data, but who cares?) d_fftsize = newfftsize; d_index = 0; - + // Reset window to reflect new size buildwindow(); @@ -284,14 +284,14 @@ qtgui_sink_c::general_work (int noutput_items, // 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(); - + // Fill up residbuf with d_fftsize number of items memcpy(d_residbuf+d_index, &in[j], sizeof(gr_complex)*resid); d_index = 0; j += resid; fft(d_residbuf, d_fftsize); - + d_main_gui->UpdateWindow(true, d_fft->get_outbuf(), d_fftsize, NULL, 0, (float*)d_residbuf, d_fftsize, currentTime, true); @@ -302,7 +302,7 @@ qtgui_sink_c::general_work (int noutput_items, memcpy(d_residbuf+d_index, &in[j], sizeof(gr_complex)*datasize); d_index += datasize; j += datasize; - } + } } consume_each(j); -- cgit