-
Notifications
You must be signed in to change notification settings - Fork 73
/
receiver.h
198 lines (160 loc) · 4.78 KB
/
receiver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/* Copyright (C)
* 2017 - John Melton, G0ORX/N6LYT
*
* This program 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 2
* of the License, or (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef _RECEIVER_H
#define _RECEIVER_H
#include <gtk/gtk.h>
#ifdef PORTAUDIO
#include "portaudio.h"
#else
#include <pulse/pulseaudio.h>
#include <pulse/simple.h>
#endif
enum _audio_t {
STEREO=0,
LEFT,
RIGHT
};
typedef enum _audio_t audio_t;
typedef struct _receiver {
gint id;
GMutex mutex;
GMutex display_mutex;
gint ddc;
gint adc;
gdouble volume;
gint agc;
gdouble agc_gain;
gdouble agc_slope;
gdouble agc_hang_threshold;
gdouble agc_hang;
gdouble agc_thresh;
gint fps;
gint displaying;
audio_t audio_channel;
gint sample_rate;
gint buffer_size;
gint fft_size;
gint pixels;
gint samples;
gint output_samples;
gdouble *iq_input_buffer;
gdouble *audio_output_buffer;
gint audio_buffer_size;
gint audio_index;
guint32 audio_sequence;
gfloat *pixel_samples;
gint display_panadapter;
gint display_waterfall;
gint update_timer_id;
gdouble meter;
gdouble hz_per_pixel;
gint dither;
gint random;
gint preamp;
gint nb;
gint nb2;
gint nr;
gint nr2;
gint anf;
gint snb;
int nr_agc;
int nr2_gain_method;
int nr2_npe_method;
int nr2_ae;
gint alex_antenna;
gint alex_attenuation;
gint filter_low;
gint filter_high;
gint width;
gint height;
GtkWidget *panel;
GtkWidget *panadapter;
GtkWidget *waterfall;
gint panadapter_low;
gint panadapter_high;
gint panadapter_step;
gint waterfall_low;
gint waterfall_high;
gint waterfall_automatic;
cairo_surface_t *panadapter_surface;
GdkPixbuf *pixbuf;
gint local_audio;
gint mute_when_not_active;
gint audio_device;
gchar *audio_name;
#ifdef PORTAUDIO
PaStream *playback_handle;
#else
pa_simple* playstream;
gboolean output_started;
// snd_pcm_t *playback_handle;
// snd_pcm_format_t local_audio_format;
#endif
gint local_audio_buffer_size;
gint local_audio_buffer_offset;
float *local_audio_buffer;
GMutex local_audio_mutex;
gint low_latency;
gint squelch_enable;
gdouble squelch;
gint deviation;
gint64 waterfall_frequency;
gint waterfall_sample_rate;
gint mute_radio;
gdouble *buffer;
void *resampler;
gdouble *resample_buffer;
gint resample_buffer_size;
gint fexchange_errors;
gint zoom;
gint pan;
gint x;
gint y;
} RECEIVER;
extern RECEIVER *create_pure_signal_receiver(int id, int buffer_size,int sample_rate,int pixels);
extern RECEIVER *create_receiver(int id, int buffer_size, int fft_size, int pixels, int fps, int width, int height);
extern void receiver_change_sample_rate(RECEIVER *rx,int sample_rate);
extern void receiver_change_adc(RECEIVER *rx,int adc);
extern void receiver_frequency_changed(RECEIVER *rx);
extern void receiver_mode_changed(RECEIVER *rx);
extern void receiver_filter_changed(RECEIVER *rx);
extern void receiver_vfo_changed(RECEIVER *rx);
extern void receiver_change_zoom(RECEIVER *rx,double zoom);
extern void receiver_change_pan(RECEIVER *rx,double pan);
extern void set_mode(RECEIVER* rx,int m);
extern void set_filter(RECEIVER *rx);
extern void set_agc(RECEIVER *rx, int agc);
extern void set_offset(RECEIVER *rx, long long offset);
extern void set_deviation(RECEIVER *rx);
extern void add_iq_samples(RECEIVER *rx, double i_sample,double q_sample);
extern void add_div_iq_samples(RECEIVER *rx, double i0,double q0, double i1, double q1);
extern void reconfigure_receiver(RECEIVER *rx,int height);
extern void receiver_save_state(RECEIVER *rx);
extern gboolean receiver_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data);
extern gboolean receiver_button_release_event(GtkWidget *widget, GdkEventButton *event, gpointer data);
extern gboolean receiver_motion_notify_event(GtkWidget *widget, GdkEventMotion *event, gpointer data);
extern gboolean receiver_scroll_event(GtkWidget *widget, GdkEventScroll *event, gpointer data);
extern void set_displaying(RECEIVER *rx,int state);
extern void receiver_restore_state(RECEIVER *rx);
extern void receiver_set_active(RECEIVER *rx);
#ifdef CLIENT_SERVER
extern void receiver_create_remote(RECEIVER *rx);
extern void receiver_remote_update_display(RECEIVER *rx);
#endif
#endif