3f0e785c6005edf0638f18c12b9da40d1060223b
[debian/gnuradio] / gr-qtgui / src / lib / qtgui_sink_f.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 #ifndef INCLUDED_QTGUI_SINK_F_H
24 #define INCLUDED_QTGUI_SINK_F_H
25
26 #include <gr_block.h>
27 #include <gri_fft.h>
28 #include <qapplication.h>
29 #include <qtgui.h>
30 #include "SpectrumGUIClass.h"
31
32
33 class qtgui_sink_f;
34 typedef boost::shared_ptr<qtgui_sink_f> qtgui_sink_f_sptr;
35
36 qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, const std::vector<float> &window,
37                                      float fmin=-0.5, float fmax=0.5, const std::string &name="Display");
38
39 class qtgui_sink_f : public gr_block
40 {
41 private:
42   friend qtgui_sink_f_sptr qtgui_make_sink_f (int fftsize, const std::vector<float> &window,
43                                               float fmin, float fmax, const std::string &name);
44   qtgui_sink_f (int fftsize, const std::vector<float> &window,
45                 float fmin, float fmax, const std::string &name);
46   
47   int d_fftsize;
48   std::vector<float> d_window;
49   float d_fmin;
50   float d_fmax;
51   std::string d_name;
52   
53   pthread_mutex_t d_pmutex;
54
55   bool d_shift;
56   gri_fft_complex *d_fft;
57   gr_complex *fftdata;
58
59   int d_index;
60   float *d_residbuf;
61
62   SpectrumGUIClass *d_main_gui; 
63
64   void fft(const float *data_in, int size, gr_complex *data_out);
65   
66 public:
67   ~qtgui_sink_f();
68   void start_app();
69   void lock();
70   void unlock();
71
72   QApplication *d_qApplication
73 ;
74
75   int general_work (int noutput_items,
76                     gr_vector_int &ninput_items,
77                     gr_vector_const_void_star &input_items,
78                     gr_vector_void_star &output_items);
79 };
80
81 #endif /* INCLUDED_QTGUI_SINK_F_H */