-
Notifications
You must be signed in to change notification settings - Fork 2
/
audio.c
211 lines (187 loc) · 7.06 KB
/
audio.c
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
199
200
201
202
203
204
205
206
207
208
209
210
/**
* @file audio.c
* @brief Audio files for GHPSDR
* @author John Melton, G0ORX/N6LYT, Doxygen Comments Dave Larsen, KV0S
* @version 0.1
* @date 2009-04-11
*/
/* Copyright (C)
* 2009 - John Melton, G0ORX/N6LYT, Doxygen Comments Dave Larsen, KV0S
* 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.
*
*/
#include <gtk/gtk.h>
#include <math.h>
#include <stdio.h>
#include "screensize.h"
#include "bandstack.h"
#include "command.h"
#include "audio.h"
#include "main.h"
#include "property.h"
#include "wdsp.h"
#include "channel.h"
GtkWidget* audioFrame;
GtkWidget* audioTable;
GtkWidget* buttonNR;
GtkWidget* buttonANF;
//GtkWidget* buttonNB;
GtkWidget* buttonNB2;
GtkWidget* buttonMUTE;
GtkWidget* buttonBIN;
gboolean NR=FALSE;
gboolean ANF=FALSE;
//gboolean NB=FALSE;
gboolean NB2=FALSE;
gboolean MUTE=FALSE;
gboolean BIN=FALSE;
/* --------------------------------------------------------------------------*/
/**
* @brief Audio button Callback
*
* @param widget -- pointer to the parent widget,
* @param data -- pointer to the data.
*/
void audioButtonCallback(GtkWidget* widget,gpointer data) {
GtkWidget* label;
char c[80];
gboolean state;
if(widget==buttonNR) {
NR=!NR;
state=NR;
//SetANF(0,0,1);
//SetNR(0,0,NR);
SetRXAANRRun(CHANNEL_RX0, NR ? 1 : 0);
SetRXAANRRun(CHANNEL_SUBRX, NR ? 1 : 0);
} else if(widget==buttonANF) {
ANF=!ANF;
state=ANF;
//SetANF(0,0,1);
//SetANF(0,0,ANF);
SetRXAANFRun(CHANNEL_RX0, ANF ? 1 : 0);
SetRXAANFRun(CHANNEL_SUBRX, ANF ? 1 : 0);
/*
} else if(widget==buttonNB) {
NB=!NB;
state=NB;
//SetNB(0,0,NB);
*/
} else if(widget==buttonNB2) {
NB2=!NB2;
state=NB2;
//SetNB(0,0,NB2);
SetRXAEMNRRun(CHANNEL_RX0, NB2 ? 1 : 0);
SetRXAEMNRRun(CHANNEL_SUBRX, NB2 ? 1 : 0);
} else if(widget==buttonMUTE) {
MUTE=!MUTE;
state=MUTE;
} else if(widget==buttonBIN) {
BIN=!BIN;
state=BIN;
//SetBIN(0,0,BIN);
SetRXAPanelBinaural(CHANNEL_RX0, BIN ? 1 : 0);
SetRXAPanelBinaural(CHANNEL_SUBRX, BIN ? 1 : 0);
}
label=gtk_bin_get_child((GtkBin*)widget);
if(state) {
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &buttonSelected);
gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, &buttonSelected);
} else {
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, &black);
}
}
/* --------------------------------------------------------------------------*/
/**
* @brief Build Audio User Interface
*
* @return GtkWidget pointer
*/
GtkWidget* buildAudioUI() {
GtkWidget* label;
audioFrame=gtk_frame_new("DSP");
gtk_widget_modify_bg(audioFrame,GTK_STATE_NORMAL,&background);
gtk_widget_modify_fg(gtk_frame_get_label_widget(GTK_FRAME(audioFrame)),GTK_STATE_NORMAL,&white);
audioTable=gtk_table_new(2,4,TRUE);
// audio settings
buttonNR = gtk_button_new_with_label ("NR");
gtk_widget_modify_bg(buttonNR, GTK_STATE_NORMAL, &buttonBackground);
label=gtk_bin_get_child((GtkBin*)buttonNR);
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
gtk_widget_set_size_request(GTK_WIDGET(buttonNR),BUTTON_WIDTH,BUTTON_HEIGHT);
g_signal_connect(G_OBJECT(buttonNR),"clicked",G_CALLBACK(audioButtonCallback),NULL);
gtk_widget_show(buttonNR);
gtk_table_attach_defaults(GTK_TABLE(audioTable),buttonNR,0,1,0,1);
buttonANF = gtk_button_new_with_label ("ANF");
gtk_widget_modify_bg(buttonANF, GTK_STATE_NORMAL, &buttonBackground);
label=gtk_bin_get_child((GtkBin*)buttonANF);
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
gtk_widget_set_size_request(GTK_WIDGET(buttonANF),BUTTON_WIDTH,BUTTON_HEIGHT);
g_signal_connect(G_OBJECT(buttonANF),"clicked",G_CALLBACK(audioButtonCallback),NULL);
gtk_widget_show(buttonANF);
gtk_table_attach_defaults(GTK_TABLE(audioTable),buttonANF,1,2,0,1);
/*
buttonNB = gtk_button_new_with_label ("NB");
gtk_widget_modify_bg(buttonNB, GTK_STATE_NORMAL, &buttonBackground);
label=gtk_bin_get_child((GtkBin*)buttonNB);
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
gtk_widget_set_size_request(GTK_WIDGET(buttonNB),BUTTON_WIDTH,BUTTON_HEIGHT);
g_signal_connect(G_OBJECT(buttonNB),"clicked",G_CALLBACK(audioButtonCallback),NULL);
gtk_widget_show(buttonNB);
gtk_table_attach_defaults(GTK_TABLE(audioTable),buttonNB,2,3,0,1);
*/
buttonNB2 = gtk_button_new_with_label ("NB2");
gtk_widget_modify_bg(buttonNB2, GTK_STATE_NORMAL, &buttonBackground);
label=gtk_bin_get_child((GtkBin*)buttonNB2);
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
gtk_widget_set_size_request(GTK_WIDGET(buttonNB2),BUTTON_WIDTH,BUTTON_HEIGHT);
g_signal_connect(G_OBJECT(buttonNB2),"clicked",G_CALLBACK(audioButtonCallback),NULL);
gtk_widget_show(buttonNB2);
gtk_table_attach_defaults(GTK_TABLE(audioTable),buttonNB2,2,3,0,1);
buttonMUTE = gtk_button_new_with_label ("MUTE");
gtk_widget_modify_bg(buttonMUTE, GTK_STATE_NORMAL, &buttonBackground);
label=gtk_bin_get_child((GtkBin*)buttonMUTE);
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
gtk_widget_set_size_request(GTK_WIDGET(buttonMUTE),BUTTON_WIDTH,BUTTON_HEIGHT);
g_signal_connect(G_OBJECT(buttonMUTE),"clicked",G_CALLBACK(audioButtonCallback),NULL);
gtk_widget_show(buttonMUTE);
gtk_table_attach_defaults(GTK_TABLE(audioTable),buttonMUTE,0,1,1,2);
buttonBIN = gtk_button_new_with_label ("BIN");
gtk_widget_modify_bg(buttonBIN, GTK_STATE_NORMAL, &buttonBackground);
label=gtk_bin_get_child((GtkBin*)buttonBIN);
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &white);
gtk_widget_set_size_request(GTK_WIDGET(buttonBIN),BUTTON_WIDTH,BUTTON_HEIGHT);
g_signal_connect(G_OBJECT(buttonBIN),"clicked",G_CALLBACK(audioButtonCallback),NULL);
gtk_widget_show(buttonBIN);
gtk_table_attach_defaults(GTK_TABLE(audioTable),buttonBIN,1,2,1,2);
gtk_container_add(GTK_CONTAINER(audioFrame),audioTable);
gtk_widget_show(audioTable);
gtk_widget_show(audioFrame);
return audioFrame;
}
/* --------------------------------------------------------------------------*/
/**
* @brief Save the Audio state.
*/
void audioSaveState() {
char string[128];
}
/* --------------------------------------------------------------------------*/
/**
* @brief Restore the Audio state.
*/
void audioRestoreState() {
char* value;
}