Radio Control  Control Software and GUI for the Panoradio SDR, by DC9ST 2016
audiorx.h
1 #ifndef AUDIORX_H
2 #define AUDIORX_H
3 
4 #include "../waterfall/waterfallplot.h"
5 #include "stipcores.h"
6 #include "fft/fft_basic.h"
7 #include "fft/fft_avg_complex.h"
8 #include "audioddc.h"
9 
10 #include <qwt_plot_curve.h>
11 #include <qwt_plot_grid.h>
12 #include <qwt_plot.h>
13 
14 #include <QTimer>
15 
22 class AudioRX : public QObject
23 {
24  Q_OBJECT
25 
26 public:
28  AudioRX();
29 
31  ~AudioRX();
32 
36  void init_reset(int address, int memsize);
37 
38 
42  void init_ddc_selector(int address, int memsize);
43 
51  void init_lo(int address, int memsize, double master_frequency, int phase_width, double init_frequency, int ddc_number);
52 
53 
59  void init_capture(int address, int memsize, int capture_size, int ddc_number);
60 
61 
71  void init_waterfall(WaterfallPlot *waterfall_audio, int max_frequency, double data_range_min, double data_range_max, double span_init, int data_size, int waterfall_depth, int ddc_number);
72 
79  void init_scaling(int i_address, int i_memsize, int q_address, int q_memsize, int max_scaling_db);
80 
84  void init_mux_controller(int address, int memsize);
85 
92  void init_weaver_lo(int address, int memsize, double master_frequency, int phase_width, double init_frequency);
93 
94 
98  void capture_and_show(double gain_correction, int ddc_number);
99 
100 
106  void init_output_spectrum_display(int capture_address, int capture_memsize, int capture_size, QwtPlot *spectrum_out_plot);
107 
110 
111 
113  void reset();
114 
116  void correct_size();
117 
119  bool get_ddc_output_active(int ddc_number) {return ddc_out_active_[ddc_number];}
120 
121 
122 signals:
124  void send_scaling_value(int true_scaler_value_db);
125 
127  void send_audio_out_level(int audio_level, int audio_level_dbfs);
128 
130  void send_true_frequency(double frequency, int ddc);
131 
133  void send_new_frequency_ddc0(double frequency);
134 
136  void send_new_frequency_ddc1(double frequency);
137 
138 
139 public slots:
144  void get_output_properties(int bandwidth, bool inverted, bool binaural);
145 
149  void get_ddc_frequency(double frequency, int ddc_number);
150 
152  void get_output_ddc_selection(int ddc_number, bool active);
153 
155  void get_output_scaler_setting(int scaling_value_db);
156 
158  void get_output_scaler_auto_setting(bool auto_setting);
159 
161  void scaler_timer_slot();
162 
163 private:
164 
165  void set_audio_scaling(int scaling_factor_db); // low level function, that sets gain values for the scaler
166 
167  IP_Driver *ddc_selector_;
168  IP_Driver *reset_module_;
169  AudioDDC **audio_ddc_;
170 
171  Data_Capture_Dual *capture_spectrum_out_;
172  QwtPlot *spectrum_out_plot_;
173  QwtPlotCurve *spectrum_out_curve_;
174  QwtPlotGrid *spectrum_out_grid_;
175  fft_basic *fft_;
176  double *captured_data_i_;
177  double *captured_data_q_;
178  double *captured_data_fft_db_;
179  double *captured_data_fft_db_real_;
180  int capture_size_;
181 
182  int num_audio_ddcs_; // current implementation supports only 2 DDCs, i.e. num_audio_ddcs_ = 2
183 
184  bool reset_initialized_; // signal, which init functions have been called
185  bool ddc_selector_initialized_;
186  bool spectrum_out_initialized_;
187  bool scaler_initalized_;
188  bool mux_controller_initialized_;
189  bool weaver_lo_initialized_;
190 
191  bool *ddc_out_active_;
192 
193  Signal_Scaler *audio_scaler_i_;
194  Signal_Scaler *audio_scaler_q_;
195  IP_Driver *mux_controller_;
196  DDS *weaver_lo_;
197 
198  bool auto_scaling_;
199  int manual_scaler_setting_db_;
200  int max_scaling_db_;
201 
202  bool binaural_out_;
203 
204 };
205 
206 #endif // AUDIORX_H
void send_new_frequency_ddc1(double frequency)
sends the current LO frequency for DDC 1 (when it has been newly set in the DDC, e.g. originating in a waterfall shift)
void init_capture(int address, int memsize, int capture_size, int ddc_number)
initializes Dual Capture IP core for IQ data of one DDC
Definition: audiorx.cpp:99
void capture_and_show(double gain_correction, int ddc_number)
updates waterfall: captures data, does FFT and draws one line for the audio DDC
Definition: audiorx.cpp:161
void init_reset(int address, int memsize)
initializes the reset IP core
Definition: audiorx.cpp:73
void get_ddc_frequency(double frequency, int ddc_number)
receives request for changing the audio DDC&#39;s LO freqency
Definition: audiorx.cpp:151
void capture_and_show_spectrum_out()
shows the audio output spectrum before the audio IF to the PS or ADAU
Definition: audiorx.cpp:212
Class for controlling a single Audio DDC.
Definition: audioddc.h:13
void send_scaling_value(int true_scaler_value_db)
sends the current gain value (in dB) of the audio scaler
void get_output_ddc_selection(int ddc_number, bool active)
receives request for selection, which DDCs are active for outputting audio data
Definition: audiorx.cpp:268
Toplevel class for an audio receiver with two audio DDCs with IQ Reset (DDC)
Definition: audiorx.h:22
AudioRX()
constructor
Definition: audiorx.cpp:3
~AudioRX()
destructor
Definition: audiorx.cpp:44
void get_output_scaler_setting(int scaling_value_db)
receives request to change the audio scaler gain setting
Definition: audiorx.cpp:309
void init_ddc_selector(int address, int memsize)
initializes the MUX controller for selecting the audio DDCs
Definition: audiorx.cpp:82
void init_lo(int address, int memsize, double master_frequency, int phase_width, double init_frequency, int ddc_number)
initializes LO IP core of one DDC
Definition: audiorx.cpp:89
bool get_ddc_output_active(int ddc_number)
returns if DDC with specified number (0 to num_audio_ddcs_-1) currently outputs data ...
Definition: audiorx.h:119
void reset()
resets all audio DDCs and audio out interface, i.e. IQ paths (and sample rate conversion and audio in...
Definition: audiorx.cpp:249
void send_audio_out_level(int audio_level, int audio_level_dbfs)
sends the current audio level (after the audio DDC)
void scaler_timer_slot()
receives timer signal (every 500ms) to automatically update the scaler setting and sending the curren...
Definition: audiorx.cpp:334
void send_new_frequency_ddc0(double frequency)
sends the current LO frequency for DDC 0 (when it has been newly set in the DDC, e.g. originating in a waterfall shift)
void send_true_frequency(double frequency, int ddc)
sends the actually set LO frequency after a frequency update has been recevied by slot get_ddc_freque...
void init_output_spectrum_display(int capture_address, int capture_memsize, int capture_size, QwtPlot *spectrum_out_plot)
shows the audio output spectrum before the audio IF to the PS or ADAU
Definition: audiorx.cpp:172
void get_output_properties(int bandwidth, bool inverted, bool binaural)
receives request for changing the audio processing properties
Definition: audiorx.cpp:280
void init_weaver_lo(int address, int memsize, double master_frequency, int phase_width, double init_frequency)
initializes Weaver LO
Definition: audiorx.cpp:143
void init_mux_controller(int address, int memsize)
initializes the MUX controller for bandwidth, spectrum inversion and binaural mode selection ...
Definition: audiorx.cpp:137
void get_output_scaler_auto_setting(bool auto_setting)
receives request to change the automatic mode of the audio scaler
Definition: audiorx.cpp:314
Main FFT Class for single non-averaging FFT (performs FFT of real and complex time domain inputs) ...
Definition: fft_basic.h:7
void init_scaling(int i_address, int i_memsize, int q_address, int q_memsize, int max_scaling_db)
initializes the scaling IP cores for I and Q components
Definition: audiorx.cpp:118
void init_waterfall(WaterfallPlot *waterfall_audio, int max_frequency, double data_range_min, double data_range_max, double span_init, int data_size, int waterfall_depth, int ddc_number)
initializes the waterfall for one DDC
Definition: audiorx.cpp:109
void correct_size()
corrects size of the waterfall plots of all audio DDCs
Definition: audiorx.cpp:261
Top class for Waterfall Plots ,.
Definition: waterfallplot.h:16