some cleanup as well as adding a way to pass the Qapplication between sinks that...
authortrondeau <trondeau@221aa14e-8319-0410-a670-987f0aec2ac5>
Sat, 28 Feb 2009 03:41:15 +0000 (03:41 +0000)
committertrondeau <trondeau@221aa14e-8319-0410-a670-987f0aec2ac5>
Sat, 28 Feb 2009 03:41:15 +0000 (03:41 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10535 221aa14e-8319-0410-a670-987f0aec2ac5

gr-qtgui/src/lib/Makefile.am
gr-qtgui/src/lib/SpectrumGUIClass.cc
gr-qtgui/src/lib/qtgui.i
gr-qtgui/src/lib/qtgui_sink_c.cc
gr-qtgui/src/lib/qtgui_sink_c.h
gr-qtgui/src/lib/spectrumdisplayform.cc
gr-qtgui/src/lib/spectrumdisplayform.ui
gr-qtgui/src/python/qttest_c.py

index b3912100a6399ca5c188f5d45c49bacdf91c4493..41281e68768885195dda89953a8182f3fc09aed8 100644 (file)
@@ -76,12 +76,12 @@ lib_LTLIBRARIES = libqtgui.la
 
 # These are the source files that go into the shared library
 libqtgui_la_SOURCES =  \
-       spectrumdisplayform.cc                  \
        FrequencyDisplayPlot.cc                 \
        TimeDomainDisplayPlot.cc                \
        WaterfallDisplayPlot.cc                 \
        Waterfall3DDisplayPlot.cc               \
        waterfallGlobalData.cc                  \
+       spectrumdisplayform.cc                  \
        SpectrumGUIClass.cc                     \
        spectrumUpdateEvents.cc                 \
        plot_waterfall.cc                       \
@@ -95,15 +95,15 @@ _qtgui_la_SOURCES =                         \
 
 # These headers get installed in ${prefix}/include/gnuradio
 grinclude_HEADERS =                    \
-       spectrumdisplayform.h           \
        FrequencyDisplayPlot.h          \
        TimeDomainDisplayPlot.h         \
        WaterfallDisplayPlot.h          \
        Waterfall3DDisplayPlot.h        \
-       SpectrumGUIClass.h              \
        waterfallGlobalData.h           \
        highResTimeFunctions.h          \
        plot_waterfall.h                \
+       spectrumdisplayform.h           \
+       SpectrumGUIClass.h              \
        spectrumUpdateEvents.h          \
        qtgui.h                         \
        qtgui_sink_c.h                  \
index a57395a6719654ed3595a929f45b9ff4f7255362..f9988d8f54bc29864fe3e3fb638c4bd11ed98c2f 100644 (file)
@@ -9,7 +9,8 @@
 const long SpectrumGUIClass::MAX_FFT_SIZE;
 const long SpectrumGUIClass::MIN_FFT_SIZE;
 
-SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize, const double newStartFrequency, const double newStopFrequency){
+SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize, const uint64_t fftSize, 
+                                  const double newStartFrequency, const double newStopFrequency){
   _dataPoints = maxDataSize;
   if(_dataPoints < 2){
     _dataPoints = 2;
@@ -102,7 +103,9 @@ void SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent){
 
 void SpectrumGUIClass::Reset(){
   if(GetWindowOpenFlag()){
-    qApp->postEvent(_spectrumDisplayForm, new SpectrumFrequencyRangeEvent(_centerFrequency, _startFrequency, _stopFrequency));
+    qApp->postEvent(_spectrumDisplayForm, new SpectrumFrequencyRangeEvent(_centerFrequency, 
+                                                                         _startFrequency, 
+                                                                         _stopFrequency));
     qApp->postEvent(_spectrumDisplayForm, new SpectrumWindowResetEvent());
   }
   _droppedEntriesCount = 0;
index 129e9269ed43b3980ac8d45dca07c33b8fc2a0ad..eba37833eff39265a0724746f6ac80c93253d225 100644 (file)
 GR_SWIG_BLOCK_MAGIC(qtgui,sink_c)
 
   qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
-                                      float fmin=-0.5, float fmax=0.5, const std::string &name="Display");
+                                      float fmin=-0.5, float fmax=0.5,
+                                      const std::string &name="Display");
 
 class qtgui_sink_c : public gr_block
 {
 private:
   friend qtgui_sink_c_sptr qtgui_make_sink_c (int fftsize, int wintype,
-                                             float fmin, float fmax, const std::string &name);
+                                             float fmin, float fmax,
+                                             const std::string &name);
   qtgui_sink_c (int fftsize, int wintype,
                float fmin, float fmax, const std::string &name);
 
 public:
   void start_app();
-
+  void initialize();
+  void initialize(QApplication *qapp);
+  QApplication* get_qapplication(); 
 };
 
 
 
-/****************************************************************************************/
+/*********************************************************************/
 
 
 GR_SWIG_BLOCK_MAGIC(qtgui,sink_f)
   
-qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, const std::vector<float> &window,
-                                    float fmin, float fmax, const std::string &name="Display");
+qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, 
+                                    const std::vector<float> &window,
+                                    float fmin, float fmax, 
+                                    const std::string &name="Display");
 
 class qtgui_sink_f : public gr_block
 {
 private:
-  friend qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, const std::vector<float> &window,
-                                             float fmin, float fmax, const std::string &name);
-  qtgui_sink_fy (int fftsize, const std::vector<float> &window,
-                float fmin, float fmax, const std::string &name);
+  friend qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, 
+                                             const std::vector<float> &window,
+                                             float fmin, float fmax, 
+                                             const std::string &name);
+  qtgui_sink_f (int fftsize, 
+               const std::vector<float> &window,
+               float fmin, float fmax,
+               const std::string &name);
   
 public:
   void start_app();
 };
 
+
index eaef58d6ebe8fc8cd1cd14ae6bc6b7d3ad46e3ae..fdd069e7f9ada9c9445f5215bac33211779695aa 100644 (file)
@@ -40,7 +40,7 @@ qtgui_make_sink_c (int fftsize, int wintype,
 qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype,
                            float fmin, float fmax, const std::string &name)
   : gr_block ("sink_c",
-             gr_make_io_signature (1, 1, sizeof(gr_complex)),
+             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_fmin(fmin), d_fmax(fmax), d_name(name)
@@ -59,10 +59,13 @@ qtgui_sink_c::qtgui_sink_c (int fftsize, int wintype,
   d_residbuf = new gr_complex[d_fftsize];
 
   buildwindow();
+
+  //initialize();
 }
 
 qtgui_sink_c::~qtgui_sink_c()
 {
+  delete d_object;
   delete [] d_fftdata;
   delete [] d_residbuf;
   delete d_main_gui;
@@ -79,13 +82,27 @@ void qtgui_sink_c::unlock()
   pthread_mutex_unlock(&d_pmutex);
 }
 
+
 void
-qtgui_sink_c::start_app()
+qtgui_sink_c::initialize()
 {
   int argc;
   char **argv = NULL;
   d_qApplication = new QApplication(argc, argv);
+  __initialize();
+}
+
 
+void
+qtgui_sink_c::initialize(QApplication *qapp)
+{
+  d_qApplication = qapp;
+  __initialize();
+}
+
+void
+qtgui_sink_c::__initialize()
+{
   uint64_t maxBufferSize = 32768;
   d_main_gui = new SpectrumGUIClass(maxBufferSize, d_fftsize, d_fmin, d_fmax);
   d_main_gui->SetDisplayTitle(d_name);
@@ -93,9 +110,20 @@ qtgui_sink_c::start_app()
   d_main_gui->SetWindowType((int)d_wintype);
   d_main_gui->OpenSpectrumWindow(NULL);
 
-  qtgui_obj object(d_qApplication);
-  qApp->postEvent(&object, new qtgui_event(&d_pmutex));
+  d_object = new qtgui_obj(d_qApplication);
+  qApp->postEvent(d_object, new qtgui_event(&d_pmutex));
+}
+
+QApplication* 
+qtgui_sink_c::get_qapplication()
+{
+  return d_qApplication;
+}
 
+
+void
+qtgui_sink_c::start_app()
+{
   d_qApplication->exec();
 }
 
index a6bd59f279af250fff337952921713c09202508e..a1eb056491b92eb4d9b40cf6723a7e9e85e05363 100644 (file)
@@ -44,6 +44,8 @@ private:
                                              float fmin, float fmax, const std::string &name);
   qtgui_sink_c (int fftsize, int wintype,
                float fmin, float fmax, const std::string &name);
+
+  void __initialize();
   
   int d_fftsize;
   gr_firdes::win_type d_wintype;
@@ -70,12 +72,16 @@ private:
   
 public:
   ~qtgui_sink_c();
+  void initialize();
+  void initialize(QApplication *qapp);
   void start_app();
   void lock();
   void unlock();
 
-  QApplication *d_qApplication
-;
+  QApplication* get_qapplication();
+
+  QApplication *d_qApplication;
+  qtgui_obj *d_object;
 
   int general_work (int noutput_items,
                    gr_vector_int &ninput_items,
index 481a55264be21d601c0354bff1c4489e2372c84f..e0b43ae302611de339f3a37de88ab41998f48949 100644 (file)
@@ -123,7 +123,8 @@ void SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumU
     _AverageHistory(_realFFTDataPoints);
 
     double sumMean;
-    const double fft_bin_size = (_stopFrequency-_startFrequency) / static_cast<double>(numFFTDataPoints);
+    const double fft_bin_size = (_stopFrequency-_startFrequency) /
+      static_cast<double>(numFFTDataPoints);
 
     // find the peak, sum (for mean), etc
     _peakAmplitude = -HUGE_VAL;
@@ -161,14 +162,22 @@ void SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumU
   }
 
   if(lastOfMultipleUpdatesFlag){
-    _frequencyDisplayPlot->PlotNewData(_averagedValues, numFFTDataPoints, _noiseFloorAmplitude, _peakFrequency, _peakAmplitude);
-    _timeDomainDisplayPlot->PlotNewData(realTimeDomainDataPoints, imagTimeDomainDataPoints, numTimeDomainDataPoints);
+    _frequencyDisplayPlot->PlotNewData(_averagedValues, numFFTDataPoints, 
+                                      _noiseFloorAmplitude, _peakFrequency, 
+                                      _peakAmplitude);
+    _timeDomainDisplayPlot->PlotNewData(realTimeDomainDataPoints, 
+                                       imagTimeDomainDataPoints, 
+                                       numTimeDomainDataPoints);
   }
   // Don't update the repeated data for the waterfall
   if(!repeatDataFlag){
-    _waterfallDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints, timePerFFT, dataTimestamp, spectrumUpdateEvent->getDroppedFFTFrames());
+    _waterfallDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints, 
+                                      timePerFFT, dataTimestamp, 
+                                      spectrumUpdateEvent->getDroppedFFTFrames());
     if( _openGLWaterfall3DFlag == 1 ){
-      _waterfall3DDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints, timePerFFT, dataTimestamp, spectrumUpdateEvent->getDroppedFFTFrames());
+      _waterfall3DDisplayPlot->PlotNewData(_realFFTDataPoints, numFFTDataPoints, 
+                                          timePerFFT, dataTimestamp, 
+                                          spectrumUpdateEvent->getDroppedFFTFrames());
     }
   }
   
@@ -190,42 +199,70 @@ void SpectrumDisplayForm::resizeEvent( QResizeEvent *e )
   SpectrumTypeTab->resize( e->size().width(), SpectrumTypeTab->height());
 
   // Tell the TabXFreqDisplay to resize
-  Tab1PlotDisplayFrame->resize(e->size().width()-4, Tab1PlotDisplayFrame->height());
-  Tab2PlotDisplayFrame->resize(e->size().width()-4, Tab2PlotDisplayFrame->height());
-  Waterfall3DPlotDisplayFrame->resize(e->size().width()-4, Waterfall3DPlotDisplayFrame->height());
-  TimeDomainDisplayFrame->resize(e->size().width()-4, TimeDomainDisplayFrame->height());
-  _frequencyDisplayPlot->resize( Tab1PlotDisplayFrame->width()-4, Tab1PlotDisplayFrame->height());
-  _waterfallDisplayPlot->resize( Tab2PlotDisplayFrame->width()-4, Tab2PlotDisplayFrame->height());
-  _waterfall3DDisplayPlot->resize( Waterfall3DPlotDisplayFrame->width()-4, Waterfall3DPlotDisplayFrame->height());
-  _timeDomainDisplayPlot->resize( TimeDomainDisplayFrame->width()-4, TimeDomainDisplayFrame->height());
+  Tab1PlotDisplayFrame->resize(e->size().width()-4, 
+                              Tab1PlotDisplayFrame->height());
+  Tab2PlotDisplayFrame->resize(e->size().width()-4,
+                              Tab2PlotDisplayFrame->height());
+  Waterfall3DPlotDisplayFrame->resize(e->size().width()-4, 
+                                     Waterfall3DPlotDisplayFrame->height());
+  TimeDomainDisplayFrame->resize(e->size().width()-4, 
+                                TimeDomainDisplayFrame->height());
+  _frequencyDisplayPlot->resize( Tab1PlotDisplayFrame->width()-4, 
+                                Tab1PlotDisplayFrame->height());
+  _waterfallDisplayPlot->resize( Tab2PlotDisplayFrame->width()-4, 
+                                Tab2PlotDisplayFrame->height());
+  _waterfall3DDisplayPlot->resize( Waterfall3DPlotDisplayFrame->width()-4, 
+                                  Waterfall3DPlotDisplayFrame->height());
+  _timeDomainDisplayPlot->resize( TimeDomainDisplayFrame->width()-4, 
+                                 TimeDomainDisplayFrame->height());
 
   // Move the IntensityWheels and Labels
-  WaterfallMaximumIntensityLabel->move(width() - 5 - WaterfallMaximumIntensityLabel->width(), WaterfallMaximumIntensityLabel->y());
-  WaterfallMinimumIntensityLabel->move(width() - 5 - WaterfallMinimumIntensityLabel->width(), WaterfallMinimumIntensityLabel->y());
-  WaterfallMaximumIntensityWheel->resize(WaterfallMaximumIntensityLabel->x() - 5 - WaterfallMaximumIntensityWheel->x(), WaterfallMaximumIntensityWheel->height());
-  WaterfallMinimumIntensityWheel->resize(WaterfallMinimumIntensityLabel->x() - 5 - WaterfallMinimumIntensityWheel->x(), WaterfallMinimumIntensityWheel->height());
-
-  Waterfall3DMaximumIntensityLabel->move(width() - 5 - Waterfall3DMaximumIntensityLabel->width(), Waterfall3DMaximumIntensityLabel->y());
-  Waterfall3DMinimumIntensityLabel->move(width() - 5 - Waterfall3DMinimumIntensityLabel->width(), Waterfall3DMinimumIntensityLabel->y());
-  Waterfall3DMaximumIntensityWheel->resize(Waterfall3DMaximumIntensityLabel->x() - 5 - Waterfall3DMaximumIntensityWheel->x(), Waterfall3DMaximumIntensityWheel->height());
-  Waterfall3DMinimumIntensityWheel->resize(Waterfall3DMinimumIntensityLabel->x() - 5 - Waterfall3DMinimumIntensityWheel->x(), Waterfall3DMinimumIntensityWheel->height());
+  WaterfallMaximumIntensityLabel->move(width() - 5 - WaterfallMaximumIntensityLabel->width(),
+                                      WaterfallMaximumIntensityLabel->y());
+  WaterfallMinimumIntensityLabel->move(width() - 5 - WaterfallMinimumIntensityLabel->width(),
+                                      WaterfallMinimumIntensityLabel->y());
+  WaterfallMaximumIntensityWheel->resize(WaterfallMaximumIntensityLabel->x() - 5 -
+                                        WaterfallMaximumIntensityWheel->x(),
+                                        WaterfallMaximumIntensityWheel->height());
+  WaterfallMinimumIntensityWheel->resize(WaterfallMinimumIntensityLabel->x() - 5 -
+                                        WaterfallMinimumIntensityWheel->x(),
+                                        WaterfallMinimumIntensityWheel->height());
+
+  Waterfall3DMaximumIntensityLabel->move(width() - 5 -
+                                        Waterfall3DMaximumIntensityLabel->width(),
+                                        Waterfall3DMaximumIntensityLabel->y());
+  Waterfall3DMinimumIntensityLabel->move(width() - 5 -
+                                        Waterfall3DMinimumIntensityLabel->width(),
+                                        Waterfall3DMinimumIntensityLabel->y());
+  Waterfall3DMaximumIntensityWheel->resize(Waterfall3DMaximumIntensityLabel->x() - 5 -
+                                          Waterfall3DMaximumIntensityWheel->x(),
+                                          Waterfall3DMaximumIntensityWheel->height());
+  Waterfall3DMinimumIntensityWheel->resize(Waterfall3DMinimumIntensityLabel->x() - 5 -
+                                          Waterfall3DMinimumIntensityWheel->x(),
+                                          Waterfall3DMinimumIntensityWheel->height());
 
 
   // Move the Power Lbl
-  PowerLabel->move(e->size().width()-(415-324) - PowerLabel->width(), PowerLabel->y());
+  PowerLabel->move(e->size().width()-(415-324) - PowerLabel->width(),
+                  PowerLabel->y());
 
   // Move the Power Line Edit
-  PowerLineEdit->move(e->size().width()-(415-318) - PowerLineEdit->width(), PowerLineEdit->y());
+  PowerLineEdit->move(e->size().width()-(415-318) - PowerLineEdit->width(),
+                     PowerLineEdit->y());
 
   // Move the Avg Lbl
-  AvgLabel->move(e->size().width()-(415-406) - AvgLabel->width(), AvgLabel->y());
+  AvgLabel->move(e->size().width()-(415-406) - AvgLabel->width(),
+                AvgLabel->y());
 
   // Move the Avg Line Edit
-  AvgLineEdit->move(e->size().width()-(415-400) - AvgLineEdit->width(), AvgLineEdit->y());
+  AvgLineEdit->move(e->size().width()-(415-400) - AvgLineEdit->width(),
+                   AvgLineEdit->y());
   
   // Move the FFT Size Combobox and label
-  FFTSizeComboBox->move(width() - 5 - FFTSizeComboBox->width(), FFTSizeComboBox->y());
-  FFTSizeLabel->move(width() - 10 - FFTSizeComboBox->width() - FFTSizeLabel->width(), FFTSizeLabel->y());
+  FFTSizeComboBox->move(width() - 5 - FFTSizeComboBox->width(),
+                       FFTSizeComboBox->y());
+  FFTSizeLabel->move(width() - 10 - FFTSizeComboBox->width() - FFTSizeLabel->width(),
+                    FFTSizeLabel->y());
 }
 
 
index f75022f346c34ddd5cf14d931d8382d42771e8e0..aac323dac5f90dd18ec9cfd0f962c71db3890916 100644 (file)
@@ -5,7 +5,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>637</width>
+    <width>633</width>
     <height>436</height>
    </rect>
   </property>
      <height>380</height>
     </rect>
    </property>
+   <property name="currentIndex" >
+    <number>0</number>
+   </property>
    <widget class="QWidget" name="FrequencyPage" >
     <attribute name="title" >
      <string>Frequency Display</string>
       </property>
      </item>
     </widget>
-    <widget class="QwtWheel" name="WaterfallMaximumIntensityWheel" >
+    <widget class="QwtWheel" native="1" name="WaterfallMaximumIntensityWheel" >
      <property name="geometry" >
       <rect>
        <x>215</x>
      <property name="focusPolicy" >
       <enum>Qt::WheelFocus</enum>
      </property>
-     <property name="valid" >
+     <property name="valid" stdset="0" >
       <bool>true</bool>
      </property>
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="totalAngle" >
+     <property name="totalAngle" stdset="0" >
       <double>200.000000000000000</double>
      </property>
-     <property name="viewAngle" >
+     <property name="viewAngle" stdset="0" >
       <double>20.000000000000000</double>
      </property>
-     <property name="mass" >
+     <property name="mass" stdset="0" >
       <double>0.000000000000000</double>
      </property>
     </widget>
       <enum>QFrame::Plain</enum>
      </property>
     </widget>
-    <widget class="QwtWheel" name="WaterfallMinimumIntensityWheel" >
+    <widget class="QwtWheel" native="1" name="WaterfallMinimumIntensityWheel" >
      <property name="geometry" >
       <rect>
        <x>215</x>
        <height>24</height>
       </rect>
      </property>
-     <property name="valid" >
+     <property name="valid" stdset="0" >
       <bool>true</bool>
      </property>
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="totalAngle" >
+     <property name="totalAngle" stdset="0" >
       <double>200.000000000000000</double>
      </property>
-     <property name="viewAngle" >
+     <property name="viewAngle" stdset="0" >
       <double>20.000000000000000</double>
      </property>
-     <property name="mass" >
+     <property name="mass" stdset="0" >
       <double>0.000000000000000</double>
      </property>
     </widget>
       <string>Auto Scale</string>
      </property>
     </widget>
-    <widget class="QwtWheel" name="Waterfall3DMinimumIntensityWheel" >
+    <widget class="QwtWheel" native="1" name="Waterfall3DMinimumIntensityWheel" >
      <property name="geometry" >
       <rect>
        <x>215</x>
        <height>24</height>
       </rect>
      </property>
-     <property name="valid" >
+     <property name="valid" stdset="0" >
       <bool>true</bool>
      </property>
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="totalAngle" >
+     <property name="totalAngle" stdset="0" >
       <double>200.000000000000000</double>
      </property>
-     <property name="viewAngle" >
+     <property name="viewAngle" stdset="0" >
       <double>20.000000000000000</double>
      </property>
-     <property name="mass" >
+     <property name="mass" stdset="0" >
       <double>0.000000000000000</double>
      </property>
     </widget>
       </property>
      </item>
     </widget>
-    <widget class="QwtWheel" name="Waterfall3DMaximumIntensityWheel" >
+    <widget class="QwtWheel" native="1" name="Waterfall3DMaximumIntensityWheel" >
      <property name="geometry" >
       <rect>
        <x>215</x>
      <property name="focusPolicy" >
       <enum>Qt::WheelFocus</enum>
      </property>
-     <property name="valid" >
+     <property name="valid" stdset="0" >
       <bool>true</bool>
      </property>
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="totalAngle" >
+     <property name="totalAngle" stdset="0" >
       <double>200.000000000000000</double>
      </property>
-     <property name="viewAngle" >
+     <property name="viewAngle" stdset="0" >
       <double>20.000000000000000</double>
      </property>
-     <property name="mass" >
+     <property name="mass" stdset="0" >
       <double>0.000000000000000</double>
      </property>
     </widget>
index 40d1f42b7540c8d6ab58ba69c7b8fe11e432e4c0..c681c84a380bdc23be1b0a645bac0edabef9fedc 100755 (executable)
@@ -7,21 +7,31 @@ class my_top_block(gr.top_block):
     def __init__(self):
         gr.top_block.__init__(self)
 
+        Rs = 8000
+        f1 = 1000
+        f2 = 2000
+
         fftsize = 2048
 
-        src1 = gr.sig_source_c(1, gr.GR_SIN_WAVE, 0.1, 0.01, 0)
-        src2 = gr.sig_source_c(1, gr.GR_SIN_WAVE, 0.015, 0.01, 0)
+        src1 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f1, 0.1, 0)
+        src2 = gr.sig_source_c(Rs, gr.GR_SIN_WAVE, f2, 0.1, 0)
         src  = gr.add_cc()
         thr = gr.throttle(gr.sizeof_gr_complex, 20*fftsize)
-        self.snk = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, -0.5, 0.5)
+        self.snk1 = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, -Rs/2, Rs/2)
+        self.snk2 = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, -Rs/2, Rs/2)
 
         self.connect(src1, (src,0))
         self.connect(src2, (src,1))
-        self.connect(src,  thr, self.snk)
+        self.connect(src,  thr, self.snk1)
+        self.connect(src1, self.snk2)
         
+        self.snk1.initialize()
+        qapp = self.snk1.get_qapplication()
+        self.snk2.initialize(qapp)
+
 if __name__ == "__main__":
     tb = my_top_block();
     tb.start()
-    tb.snk.start_app();
+    tb.snk1.start_app();
     #tb.wait();