summaryrefslogtreecommitdiff
path: root/gr-qtgui/src
diff options
context:
space:
mode:
Diffstat (limited to 'gr-qtgui/src')
-rw-r--r--gr-qtgui/src/lib/Makefile.am6
-rw-r--r--gr-qtgui/src/lib/SpectrumGUIClass.cc7
-rw-r--r--gr-qtgui/src/lib/qtgui.i31
-rw-r--r--gr-qtgui/src/lib/qtgui_sink_c.cc36
-rw-r--r--gr-qtgui/src/lib/qtgui_sink_c.h10
-rw-r--r--gr-qtgui/src/lib/spectrumdisplayform.cc93
-rw-r--r--gr-qtgui/src/lib/spectrumdisplayform.ui57
-rwxr-xr-xgr-qtgui/src/python/qttest_c.py20
8 files changed, 173 insertions, 87 deletions
diff --git a/gr-qtgui/src/lib/Makefile.am b/gr-qtgui/src/lib/Makefile.am
index b3912100a..41281e687 100644
--- a/gr-qtgui/src/lib/Makefile.am
+++ b/gr-qtgui/src/lib/Makefile.am
@@ -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 \
diff --git a/gr-qtgui/src/lib/SpectrumGUIClass.cc b/gr-qtgui/src/lib/SpectrumGUIClass.cc
index a57395a67..f9988d8f5 100644
--- a/gr-qtgui/src/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/src/lib/SpectrumGUIClass.cc
@@ -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;
diff --git a/gr-qtgui/src/lib/qtgui.i b/gr-qtgui/src/lib/qtgui.i
index 129e9269e..eba37833e 100644
--- a/gr-qtgui/src/lib/qtgui.i
+++ b/gr-qtgui/src/lib/qtgui.i
@@ -30,40 +30,51 @@
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();
};
+
diff --git a/gr-qtgui/src/lib/qtgui_sink_c.cc b/gr-qtgui/src/lib/qtgui_sink_c.cc
index eaef58d6e..fdd069e7f 100644
--- a/gr-qtgui/src/lib/qtgui_sink_c.cc
+++ b/gr-qtgui/src/lib/qtgui_sink_c.cc
@@ -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();
}
diff --git a/gr-qtgui/src/lib/qtgui_sink_c.h b/gr-qtgui/src/lib/qtgui_sink_c.h
index a6bd59f27..a1eb05649 100644
--- a/gr-qtgui/src/lib/qtgui_sink_c.h
+++ b/gr-qtgui/src/lib/qtgui_sink_c.h
@@ -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,
diff --git a/gr-qtgui/src/lib/spectrumdisplayform.cc b/gr-qtgui/src/lib/spectrumdisplayform.cc
index 481a55264..e0b43ae30 100644
--- a/gr-qtgui/src/lib/spectrumdisplayform.cc
+++ b/gr-qtgui/src/lib/spectrumdisplayform.cc
@@ -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());
}
diff --git a/gr-qtgui/src/lib/spectrumdisplayform.ui b/gr-qtgui/src/lib/spectrumdisplayform.ui
index f75022f34..aac323dac 100644
--- a/gr-qtgui/src/lib/spectrumdisplayform.ui
+++ b/gr-qtgui/src/lib/spectrumdisplayform.ui
@@ -5,7 +5,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>637</width>
+ <width>633</width>
<height>436</height>
</rect>
</property>
@@ -157,6 +157,9 @@
<height>380</height>
</rect>
</property>
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
<widget class="QWidget" name="FrequencyPage" >
<attribute name="title" >
<string>Frequency Display</string>
@@ -355,7 +358,7 @@
</property>
</item>
</widget>
- <widget class="QwtWheel" name="WaterfallMaximumIntensityWheel" >
+ <widget class="QwtWheel" native="1" name="WaterfallMaximumIntensityWheel" >
<property name="geometry" >
<rect>
<x>215</x>
@@ -370,19 +373,16 @@
<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>
@@ -418,7 +418,7 @@
<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>
@@ -427,19 +427,16 @@
<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>
@@ -528,7 +525,7 @@
<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>
@@ -537,19 +534,16 @@
<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>
@@ -620,7 +614,7 @@
</property>
</item>
</widget>
- <widget class="QwtWheel" name="Waterfall3DMaximumIntensityWheel" >
+ <widget class="QwtWheel" native="1" name="Waterfall3DMaximumIntensityWheel" >
<property name="geometry" >
<rect>
<x>215</x>
@@ -635,19 +629,16 @@
<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>
diff --git a/gr-qtgui/src/python/qttest_c.py b/gr-qtgui/src/python/qttest_c.py
index 40d1f42b7..c681c84a3 100755
--- a/gr-qtgui/src/python/qttest_c.py
+++ b/gr-qtgui/src/python/qttest_c.py
@@ -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();