filter_menu.c \
noise_menu.c \
agc_menu.c \
+fm_menu.c \
rit.c \
meter.c \
mode.c \
filter_menu.h \
noise_menu.h \
agc_menu.h \
+fm_menu.h \
rit.h \
meter.h \
mode.h \
filter_menu.o \
noise_menu.o \
agc_menu.o \
+fm_menu.o \
rit.o \
meter.o \
mode.o \
#include "radio.h"
#include "vfo.h"
#include "button_text.h"
+#include "wdsp_init.h"
static GtkWidget *parent_window=NULL;
vfo_update(NULL);
}
+static gboolean deviation_select_cb (GtkWidget *widget, gpointer data) {
+ deviation=(int)data;
+ if(deviation==2500) {
+ setFilter(-4000,4000);
+ } else {
+ setFilter(-8000,8000);
+ }
+ wdsp_set_deviation((double)deviation);
+ set_button_text_color(last_filter,"black");
+ last_filter=widget;
+ set_button_text_color(last_filter,"orange");
+ vfo_update(NULL);
+}
+
void filter_menu(GtkWidget *parent) {
GtkWidget *b;
int i;
BANDSTACK_ENTRY *entry=bandstack_entry_get_current();
FILTER* band_filters=filters[entry->mode];
- for(i=0;i<FILTERS;i++) {
- FILTER* band_filter=&band_filters[i];
- GtkWidget *b=gtk_button_new_with_label(band_filters[i].title);
- if(i==entry->filter) {
- set_button_text_color(b,"orange");
- last_filter=b;
- } else {
- set_button_text_color(b,"black");
- }
- gtk_widget_show(b);
- gtk_grid_attach(GTK_GRID(grid),b,i%5,1+(i/5),1,1);
- g_signal_connect(b,"pressed",G_CALLBACK(filter_select_cb),(gpointer *)i);
+ switch(entry->mode) {
+ case modeFMN:
+ {
+ GtkWidget *l=gtk_label_new("Deviation:");
+ gtk_grid_attach(GTK_GRID(grid),l,0,1,1,1);
+
+ GtkWidget *b=gtk_button_new_with_label("2.5K");
+ if(deviation==2500) {
+ set_button_text_color(b,"orange");
+ last_filter=b;
+ } else {
+ set_button_text_color(b,"black");
+ }
+ g_signal_connect(b,"pressed",G_CALLBACK(deviation_select_cb),(gpointer *)2500);
+ gtk_grid_attach(GTK_GRID(grid),b,1,1,1,1);
+
+ b=gtk_button_new_with_label("5.0K");
+ if(deviation==5000) {
+ set_button_text_color(b,"orange");
+ last_filter=b;
+ } else {
+ set_button_text_color(b,"black");
+ }
+ g_signal_connect(b,"pressed",G_CALLBACK(deviation_select_cb),(gpointer *)5000);
+ gtk_grid_attach(GTK_GRID(grid),b,2,1,1,1);
+ }
+ break;
+
+ default:
+ for(i=0;i<FILTERS;i++) {
+ FILTER* band_filter=&band_filters[i];
+ GtkWidget *b=gtk_button_new_with_label(band_filters[i].title);
+ if(i==entry->filter) {
+ set_button_text_color(b,"orange");
+ last_filter=b;
+ } else {
+ set_button_text_color(b,"black");
+ }
+ gtk_grid_attach(GTK_GRID(grid),b,i%5,1+(i/5),1,1);
+ g_signal_connect(b,"pressed",G_CALLBACK(filter_select_cb),(gpointer *)i);
+ }
+ break;
}
gtk_container_add(GTK_CONTAINER(content),grid);
--- /dev/null
+/* Copyright (C)
+* 2016 - 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.
+*
+*/
+
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "new_menu.h"
+#include "fm_menu.h"
+#include "radio.h"
+#include "wdsp_init.h"
+
+static GtkWidget *parent_window=NULL;
+
+static GtkWidget *dialog=NULL;
+
+static GtkWidget *last_band;
+
+static gboolean close_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ if(dialog!=NULL) {
+ gtk_widget_destroy(dialog);
+ dialog=NULL;
+ sub_menu=NULL;
+ }
+ return TRUE;
+}
+
+static gboolean emp_cb (GtkWidget *widget, gpointer data) {
+ if(gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+ pre_emphasize=1;
+ } else {
+ pre_emphasize=0;
+ }
+ wdsp_set_pre_emphasize(pre_emphasize);
+}
+
+void fm_menu(GtkWidget *parent) {
+ GtkWidget *b;
+ int i;
+
+ parent_window=parent;
+
+ dialog=gtk_dialog_new();
+ gtk_window_set_transient_for(GTK_WINDOW(dialog),GTK_WINDOW(parent_window));
+ gtk_window_set_decorated(GTK_WINDOW(dialog),FALSE);
+
+ GdkRGBA color;
+ color.red = 1.0;
+ color.green = 1.0;
+ color.blue = 1.0;
+ color.alpha = 1.0;
+ gtk_widget_override_background_color(dialog,GTK_STATE_FLAG_NORMAL,&color);
+
+ GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+
+ GtkWidget *grid=gtk_grid_new();
+
+ gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE);
+ gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE);
+ gtk_grid_set_column_spacing (GTK_GRID(grid),5);
+ gtk_grid_set_row_spacing (GTK_GRID(grid),5);
+
+ GtkWidget *close_b=gtk_button_new_with_label("Close FM");
+ g_signal_connect (close_b, "pressed", G_CALLBACK(close_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
+
+ GtkWidget *emp_b=gtk_check_button_new_with_label("FM TX Pre-emphasize before limiting");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (emp_b), pre_emphasize);
+ gtk_widget_show(emp_b);
+ gtk_grid_attach(GTK_GRID(grid),emp_b,0,1,3,1);
+ g_signal_connect(emp_b,"toggled",G_CALLBACK(emp_cb),NULL);
+
+ gtk_container_add(GTK_CONTAINER(content),grid);
+
+ sub_menu=dialog;
+
+ gtk_widget_show_all(dialog);
+
+}
--- /dev/null
+/* Copyright (C)
+* 2016 - 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.
+*
+*/
+
+void fm_menu(GtkWidget *parent);
#include "filter_menu.h"
#include "noise_menu.h"
#include "agc_menu.h"
+#include "fm_menu.h"
static GtkWidget *parent_window=NULL;
return TRUE;
}
+void start_fm() {
+ cleanup();
+ fm_menu(parent_window);
+}
+
+static gboolean fm_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+ start_fm();
+ return TRUE;
+}
+
static gboolean new_menu_pressed_event_cb (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
g_signal_connect (equalizer_b, "button-press-event", G_CALLBACK(equalizer_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),equalizer_b,4,2,1,1);
+ GtkWidget *fm_b=gtk_button_new_with_label("FM");
+ g_signal_connect (fm_b, "button-press-event", G_CALLBACK(fm_cb), NULL);
+ gtk_grid_attach(GTK_GRID(grid),fm_b,5,2,1,1);
+
GtkWidget *step_b=gtk_button_new_with_label("Step");
g_signal_connect (step_b, "button-press-event", G_CALLBACK(step_cb), NULL);
gtk_grid_attach(GTK_GRID(grid),step_b,0,3,1,1);
int last_dash;
int left_sample[RECEIVERS];
int right_sample[RECEIVERS];
- short mic_sample;
+ int mic_sample;
double left_sample_double[RECEIVERS];
double right_sample_double[RECEIVERS];
double mic_sample_double;
right_sample[r] += (int)((unsigned char)buffer[b++]) << 8;
right_sample[r] += (int)((unsigned char)buffer[b++]);
}
- mic_sample = (short)((signed char) buffer[b++]) << 16;
- mic_sample |= (short)((unsigned char)buffer[b++]);
+ mic_sample = (int)((signed char) buffer[b++]) << 8;
+ mic_sample |= (int)((unsigned char)buffer[b++]);
mic_sample_double = (1.0 / 2147483648.0) * (double)(mic_sample<<16);
for(r=0;r<RECEIVERS;r++) {
int enable_rx_equalizer=0;
int rx_equalizer[4]={0,0,0,0};
+int deviation=2500;
+int pre_emphasize=0;
+
void init_radio() {
int rc;
rc=sem_init(&property_sem, 0, 0);
if(value) rx_equalizer[3]=atoi(value);
value=getProperty("rit_increment");
if(value) rit_increment=atoi(value);
+ value=getProperty("deviation");
+ if(value) deviation=atoi(value);
+ value=getProperty("pre_emphasize");
+ if(value) pre_emphasize=atoi(value);
bandRestoreState();
setProperty("rx_equalizer.3",value);
sprintf(value,"%d",rit_increment);
setProperty("rit_increment",value);
+ sprintf(value,"%d",deviation);
+ setProperty("deviation",value);
+ sprintf(value,"%d",pre_emphasize);
+ setProperty("pre_emphasize",value);
bandSaveState();
extern int enable_rx_equalizer;
extern int rx_equalizer[4];
+extern int deviation;
+extern int pre_emphasize;
+
extern void init_radio();
extern void setSampleRate(int rate);
extern int getSampleRate();
cairo_show_text(cr, mode_string[entry->mode]);
cairo_move_to(cr, 190, 50);
- cairo_show_text(cr, band_filter->title);
+ if(mode==modeFMN) {
+ if(deviation==2500) {
+ cairo_show_text(cr, "8k");
+ } else {
+ cairo_show_text(cr, "16k");
+ }
+ } else {
+ cairo_show_text(cr, band_filter->title);
+ }
cairo_move_to(cr, 250, 50);
if(nr) {
setRXMode(rx,mode);
SetRXABandpassFreqs(rx, (double)filterLow, (double)filterHigh);
+ SetRXAFMDeviation(rx,(double)deviation);
//SetRXAAGCMode(rx, agc);
//SetRXAAGCTop(rx,agc_gain);
wdsp_set_agc(rx, agc);
SetTXABandpassWindow(tx, 1);
SetTXABandpassRun(tx, 1);
+ SetTXAFMDeviation(tx,(double)deviation);
+ SetTXAFMEmphPosition(tx,pre_emphasize);
+
SetTXACFIRRun(tx, protocol==NEW_PROTOCOL?1:0); // turned in if new protocol
if(enable_tx_equalizer) {
SetTXAGrphEQ(tx, tx_equalizer);
SetTXAPostGenToneFreq(tx, 0.0);
SetTXAPostGenRun(tx, 0);
- if(protocol==NEW_PROTOCOL) {
- double gain=pow(10.0, mic_gain / 20.0);
- SetTXAPanelGain1(tx,gain);
- //SetTXAPanelRun(tx, protocol==NEW_PROTOCOL?1:0);
- }
+ double gain=pow(10.0, mic_gain / 20.0);
+ SetTXAPanelGain1(tx,gain);
+ SetTXAPanelRun(tx, 1);
//SetChannelState(tx,1,0);
}
SetChannelState(receiver,1,0);
}
+void wdsp_set_deviation(double deviation) {
+ SetRXAFMDeviation(CHANNEL_RX0, deviation);
+ SetTXAFMDeviation(CHANNEL_TX, deviation);
+}
+
+void wdsp_set_pre_emphasize(int state) {
+ SetTXAFMEmphPosition(CHANNEL_TX,state);
+}
+
static void initAnalyzer(int channel,int buffer_size) {
int flp[] = {0};
double KEEP_TIME = 0.1;
extern void wdsp_init(int rx,int pixels,int protocol);
extern void wdsp_new_sample_rate(int rate);
extern void wdsp_set_agc(int rx, int agc);
-
+extern void wdsp_set_deviation(double deviation);
+extern void wdsp_set_pre_emphasize(int state);
#endif