# uncomment to get ALSA audio module on Linux (default is now to use pulseaudio)
#AUDIO_MODULE=ALSA
-
# uncomment the line below for various debug facilities
#DEBUG_OPTION=-D DEBUG
all: prebuild $(PROGRAM) $(HEADERS) $(AUDIO_HEADERS) $(USBOZY_HEADERS) $(SOAPYSDR_HEADERS) \
$(LOCALCW_HEADERS) $(GPIO_HEADERS) \
$(PURESIGNAL_HEADERS) $(MIDI_HEADERS) $(STEMLAB_HEADERS) $(SERVER_HEADERS) \
- $(AUDIO_SOURCES) $(GPIO_SOURCES) $(SOURCES) \
+ $(AUDIO_SOURCES) $(SOURCES) $(GPIO_SOURCES) \
$(USBOZY_SOURCES) $(SOAPYSDR_SOURCES) $(LOCALCW_SOURCE) \
$(PURESIGNAL_SOURCES) $(MIDI_SOURCES) $(STEMLAB_SOURCES) $(SERVER_SOURCES)
#############################################################################
.PHONY: app
-app: $(OBJS) $(REMOTE_OBJS) $(AUDIO_OBJS) $(GPIO_OBJS) \
- $(USBOZY_OBJS) $(SOAPYSDR_OBJS) \
- $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
+app: $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(SOAPYSDR_OBJS) \
+ $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) $(GPIO_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS)
- $(CC) -headerpad_max_install_names -o $(PROGRAM) \
- $(OBJS) $(AUDIO_OBJS) $(GPIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) \
- $(SOAPYSDR_OBJS) $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
+ $(CC) -headerpad_max_install_names -o $(PROGRAM) $(OBJS) $(AUDIO_OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) \
+ $(SOAPYSDR_OBJS) $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) $(GPIO_OBJS) \
$(MIDI_OBJS) $(STEMLAB_OBJS) $(SERVER_OBJS) $(LIBS) $(LDFLAGS)
@rm -rf pihpsdr.app
@mkdir -p pihpsdr.app/Contents/MacOS
#include "receiver.h"
#include "new_protocol.h"
#include "old_protocol.h"
-#ifdef LOCALCW
#include "iambic.h"
-#endif
#include "ext.h"
static GtkWidget *parent_window=NULL;
#ifdef SOAPYSDR
#include "soapy_protocol.h"
#endif
-#ifdef GPIO
#include "gpio.h"
-#endif
static GtkWidget *parent_window=NULL;
//
// Re-structuring of the rigctl, MIDI, and gpio code
// eliminates the need for many "ext" functions
-// defined here. For the time being, they are
-// moved to the end of the file, and the whole block is
-// deactivated with #if0/#endif
+// defined here.
//
//
-// Furthermore, some "helper" functions defined here
+// Some "helper" functions defined in this file
// are moved to the top of the file, since they
// eventually are moved elsewhere.
//
}
void update_vfo_step(int direction) {
- int i=0;
- while(steps[i]!=step && steps[i]!=0) {
- i++;
+ int i;
+ for (i=0; i<STEPS; i++) {
+ if (steps[i] == step) break;
}
+ //
+ // This should not happen (step size not found). If it happens,
+ // take the seond-smallest one such that the step size remains
+ // small after changing it.
+ //
+ if (i >= STEPS) i=1;
- if(steps[i]!=0) {
- // current step size is in slot #i.
- if(direction>0) {
- // move to next slot (if it exists)
- i++;
- if(steps[i]!=0) {
- step=steps[i];
- }
- } else {
- // move to previous slot (if it exists)
- i--;
- if(i>=0) {
- step=steps[i];
- }
- }
+ if (direction > 0) {
+ i++;
+ } else {
+ i--;
}
+ if (i >= STEPS) i=STEPS;
+ if (i < 0 ) i=0;
+ step=steps[i];
+
vfo_update();
}
//
// Functions to be invoked through the GTK idle queue,
-// still in use
//
+int ext_menu_filter(void *data) {
+ start_filter();
+ return 0;
+}
+
+int ext_menu_mode(void *data) {
+ start_mode();
+ return 0;
+}
+
+int ext_num_pad(void *data) {
+ gint val=GPOINTER_TO_INT(data);
+ num_pad(val);
+ return 0;
+}
+
+int ext_vfo_mode_changed(void * data)
+{
+ int mode=GPOINTER_TO_INT(data);
+ vfo_mode_changed(mode);
+ return 0;
+}
+
int ext_discovery(void *data) {
discovery();
return 0;
}
-//
-// ext_vfo_update includes a limitation to how often
-// the VFO bar is actually re-drawn (every 100 msec)
-//
+int ext_set_frequency(void *data) {
+ //
+ // If new frequency is outside of current band,
+ // behave as if the user had chosen the new band
+ // via the menu prior to changing the frequency
+ //
+ SET_FREQUENCY *SetFreq=(SET_FREQUENCY *)data;
+g_print("ext_set_frequency: vfo=%d freq=%lld\n",SetFreq->vfo,SetFreq->frequency);
+ set_frequency(SetFreq->vfo,SetFreq->frequency);
+ free(data);
+ return 0;
+}
static guint vfo_timeout=0;
return 0;
}
+int ext_vfo_filter_changed(void *data) {
+ vfo_filter_changed(GPOINTER_TO_INT(data));
+ return 0;
+}
+
int ext_band_update(void *data) {
if(data==NULL) {
start_band();
return 0;
}
+int ext_noise_update(void *data) {
+ start_noise();
+ return 0;
+}
+
int ext_mox_update(void *data) {
+g_print("%s\n",__FUNCTION__);
mox_update(GPOINTER_TO_INT(data));
return 0;
}
return 0;
}
+int ext_update_agc_gain(void *data) {
+ update_agc_gain(GPOINTER_TO_INT(data));
+ free(data);
+ return 0;
+}
+
+int ext_update_af_gain(void *data) {
+ update_af_gain();
+ return 0;
+}
+
+int ext_calc_drive_level(void *data) {
+ calcDriveLevel();
+ return 0;
+}
+
+int ext_vfo_band_changed(void *data) {
+ int b=GPOINTER_TO_INT(data);
+ vfo_band_changed(active_receiver->id,b);
+ return 0;
+}
+
+int ext_radio_change_sample_rate(void *data) {
+ radio_change_sample_rate(GPOINTER_TO_INT(data));
+ return 0;
+}
+
+int ext_update_squelch(void *data) {
+ set_squelch();
+ return 0;
+}
+
int ext_sliders_update(void *data) {
sliders_update();
return 0;
}
#endif
+int ext_update_vfo_step(void *data) {
+ int direction=GPOINTER_TO_INT(data);
+ update_vfo_step(direction);
+ return 0;
+}
+
+int ext_vfo_step(void *data) {
+ int step=GPOINTER_TO_INT(data);
+ vfo_step(step);
+ return 0;
+}
+
+int ext_vfo_id_step(void *data) {
+ int *ip=(int *) data;
+ int id=ip[0];
+ int step=ip[1];
+ vfo_id_step(id,step);
+ free(data);
+ return 0;
+}
+
+int ext_set_mic_gain(void * data) {
+ double d=*(double *)data;
+ set_mic_gain(d);
+ free(data);
+ return 0;
+}
+
+int ext_set_af_gain(void *data) {
+ double d=*(double *)data;
+ set_af_gain(active_receiver->id,d);
+ free(data);
+ return 0;
+}
+
+int ext_set_agc_gain(void *data) {
+ double d=*(double *)data;
+ set_agc_gain(active_receiver->id,d);
+ free(data);
+ return 0;
+}
+
+int ext_set_drive(void *data) {
+ double d=*(double *)data;
+ set_drive(d);
+ free(data);
+ return 0;
+}
+
+int ext_set_compression(void *data) {
+ if(can_transmit) {
+ set_compression(transmitter);
+ }
+ return 0;
+}
+
int ext_vfo_a_swap_b(void *data) {
vfo_a_swap_b();
return 0;
return 0;
}
+int ext_update_att_preamp(void *data) {
+ update_att_preamp();
+ return 0;
+}
+
+int ext_set_alex_attenuation(void *data) {
+ int val=GPOINTER_TO_INT(data);
+ set_alex_attenuation(val);
+ return 0;
+}
+
+int ext_set_attenuation_value(void *data) {
+ double d=*(double *)data;
+ set_attenuation_value(d);
+ free(data);
+ return 0;
+}
+
+
#ifdef PURESIGNAL
int ext_ps_update(void *data) {
if(can_transmit) {
return 0;
}
+int ext_band_select(void *data) {
+ int b=GPOINTER_TO_INT(data);
+ g_print("%s: %d\n",__FUNCTION__,b);
+ vfo_band_changed(active_receiver->id,b);
+ return 0;
+}
+
int ext_band_plus(void *data) {
band_plus(active_receiver->id);
return 0;
}
int ext_split_toggle(void *data) {
- int val = split ? 0 : 1;
- set_split(val);
+ if(can_transmit) {
+ set_split(!split);
+ g_idle_add(ext_vfo_update, NULL);
+ }
return 0;
}
return 0;
}
+int ext_diversity_change_gain(void *data) {
+ double *dp = (double *) data;
+ update_diversity_gain(*dp);
+ free(dp);
+ return 0;
+}
+
+int ext_diversity_change_phase(void *data) {
+ double *dp = (double *) data;
+ update_diversity_phase(*dp);
+ free(dp);
+ return 0;
+}
+
#ifdef PURESIGNAL
int ext_start_ps(void *data) {
start_ps();
return 0;
}
+int ext_set_rf_gain(void *data) {
+ int pos=GPOINTER_TO_INT(data);
+ double value;
+ value=(double)pos;
+ if(value<-12.0) {
+ value=-12.0;
+ } else if(value>48.0) {
+ value=48.0;
+ }
+ set_rf_gain(active_receiver->id,value);
+ return 0;
+}
+
int ext_update_noise(void *data) {
update_noise();
return 0;
}
#endif
-int ext_mute_update(void *data) {
- active_receiver->mute_radio=!active_receiver->mute_radio;
- return 0;
-}
-
-int ext_zoom_update(void *data) {
- update_zoom((double)GPOINTER_TO_INT(data));
- return 0;
-}
-
-int ext_pan_update(void *data) {
- update_pan((double)GPOINTER_TO_INT(data));
- return 0;
-}
-
-int ext_remote_set_zoom(void *data) {
- int zoom=GPOINTER_TO_INT(data);
-g_print("ext_remote_set_zoom: %d\n",zoom);
- remote_set_zoom(active_receiver->id,(double)zoom);
- return 0;
-}
-
-int ext_remote_set_pan(void *data) {
- int pan=GPOINTER_TO_INT(data);
-g_print("ext_remote_set_pan: %d\n",pan);
- remote_set_pan(active_receiver->id,(double)pan);
- return 0;
-}
-
-int ext_set_title(void *data) {
- gtk_window_set_title(GTK_WINDOW(top_window),(char *)data);
- return 0;
-}
-
-//
-// Functions no longer used
-//
-#if 0
-int ext_recall_memory_slot(void *data) {
- recall_memory_slot(GPOINTER_TO_INT(data));
- return 0;
-}
-
-int ext_vfo_mode_changed(void * data)
-{
- int mode=GPOINTER_TO_INT(data);
- vfo_mode_changed(mode);
- return 0;
-}
-
-int ext_set_frequency(void *data) {
- //
- // If new frequency is outside of current band,
- // behave as if the user had chosen the new band
- // via the menu prior to changing the frequency
- //
- SET_FREQUENCY *set_frequency=(SET_FREQUENCY *)data;
-g_print("ext_set_frequency: vfo=%d freq=%lld\n",set_frequency->vfo,set_frequency->frequency);
- set_frequency(set_frequency->vfo,set_frequency->frequency);
- free(data);
- return 0;
-}
-
-int ext_vfo_filter_changed(void *data) {
- vfo_filter_changed(GPOINTER_TO_INT(data));
- return 0;
-}
-
-int ext_noise_update(void *data) {
- start_noise();
- return 0;
-}
-
-int ext_update_agc_gain(void *data) {
- update_agc_gain(GPOINTER_TO_INT(data));
- return 0;
-}
-
-int ext_update_af_gain(void *data) {
- update_af_gain();
- return 0;
-}
-
-int ext_calc_drive_level(void *data) {
- calcDriveLevel();
- return 0;
-}
-
-int ext_vfo_band_changed(void *data) {
- int b=GPOINTER_TO_INT(data);
- vfo_band_changed(active_receiver->id,b);
- return 0;
-}
-
-int ext_radio_change_sample_rate(void *data) {
- radio_change_sample_rate(GPOINTER_TO_INT(data));
- return 0;
-}
-
-int ext_update_squelch(void *data) {
- set_squelch();
- return 0;
-}
-
-int ext_update_vfo_step(void *data) {
- int direction=GPOINTER_TO_INT(data);
- int i=0;
- while(steps[i]!=step && steps[i]!=0) {
- i++;
- }
-
- if(steps[i]!=0) {
- if(direction>0) {
- i++;
- if(steps[i]!=0) {
- step=steps[i];
- }
- } else {
- i--;
- if(i>=0) {
- step=steps[i];
- }
- }
- }
- g_idle_add(ext_vfo_update, NULL);
- return 0;
-}
-
-int ext_vfo_step(void *data) {
- int step=GPOINTER_TO_INT(data);
- vfo_step(step);
- return 0;
-}
-
-int ext_vfo_id_step(void *data) {
- //
- // the two integer input arguments (VFO id and Step in Hz)
- // are encoded in a single integer-type number:
- // input = 10000*vfo_id + (step+1000);
- //
- // Normally vfo_id is a small number (0 or 1)
- // and the step is in the range -100 - 100 (in units of the VFO step size)
- //
- int val = GPOINTER_TO_INT(data);
- int id = val / 10000;
- int step = (val % 10000) - 1000;
- vfo_id_step(id,step);
- return 0;
-}
-
-int ext_set_mic_gain(void * data) {
- //
- // mic gain is (input value - 1000), normally between -12 and 50
- //
- int val = GPOINTER_TO_INT(data);
- double d = val - 1000;
- set_mic_gain(d);
- return 0;
-}
-
-int ext_set_agc_gain(void *data) {
- //
- // AGC is (input value - 1000), normally between -20 and +120
- //
- int val=GPOINTER_TO_INT(data);
- double d= val - 1000;
- set_agc_gain(active_receiver->id,d);
- return 0;
-}
-
-int ext_set_drive(void *data) {
- //
- // Drive is input value, normally between 0 and 100
- //
- int val=GPOINTER_TO_INT(data);
- double d=(double) val;
- set_drive(d);
- return 0;
-}
-
-int ext_set_compression(void *data) {
- if(can_transmit) {
- set_compression(transmitter);
- }
- return 0;
-}
-
-int ext_update_att_preamp(void *data) {
- update_att_preamp();
- return 0;
-}
-
-int ext_set_alex_attenuation(void *data) {
- int val=GPOINTER_TO_INT(data);
- set_alex_attenuation(val);
- return 0;
-}
-
-int ext_set_attenuation_value(void *data) {
- //
- // Att valus is (input -1000), normally between 0 and 31
- // but HermesLite-II and others have the range -12 to 48.
- //
- int val=GPOINTER_TO_INT(data);
- double d = val - 1000;
- set_attenuation_value(d);
- return 0;
-}
-
-int ext_set_split(void *data) {
- val=GPOINTER_TO_INT(data),
- set_split(val);
- return 0;
-}
-
-int ext_diversity_change_gain(void *data) {
- //
- // value = (input-10000) * 0.1
- //
- int val=GPOINTER_TO_INT(data);
- double d = (val - 10000) * 0.1;
- update_diversity_gain(d);
- return 0;
-}
-
-int ext_diversity_change_phase(void *data) {
- //
- // value = (input-10000) * 0.1
- //
- int val=GPOINTER_TO_INT(data);
- double d = (val - 10000) * 0.1;
- update_diversity_phase(d);
- return 0;
-}
-
-int ext_set_rf_gain(void *data) {
- int pos=GPOINTER_TO_INT(data);
- double value;
- value=(double)pos;
- if(value<-12.0) {
- value=-12.0;
- } else if(value>48.0) {
- value=48.0;
- }
- set_rf_gain(active_receiver->id,value);
- return 0;
-}
-
int ext_anf_update(void *data) {
if(active_receiver->anf==0) {
active_receiver->anf=1;
return 0;
}
+int ext_mute_update(void *data) {
+ active_receiver->mute_radio=!active_receiver->mute_radio;
+ return 0;
+}
+
+int ext_zoom_update(void *data) {
+ update_zoom((double)GPOINTER_TO_INT(data));
+ return 0;
+}
+
int ext_zoom_set(void *data) {
int pos=GPOINTER_TO_INT(data);
double zoom=((double)pos/(100.0/7.0))+1.0;
return 0;
}
+int ext_pan_update(void *data) {
+ update_pan((double)GPOINTER_TO_INT(data));
+ return 0;
+}
+
int ext_pan_set(void *data) {
if(active_receiver->zoom>1) {
int pos=GPOINTER_TO_INT(data);
return 0;
}
-int ext_store_memory_slot(void *data) {
- store_memory_slot(GPOINTER_TO_INT(data));
+int ext_remote_set_zoom(void *data) {
+ int zoom=GPOINTER_TO_INT(data);
+g_print("ext_remote_set_zoom: %d\n",zoom);
+ remote_set_zoom(active_receiver->id,(double)zoom);
+ return 0;
+}
+
+int ext_remote_set_pan(void *data) {
+ int pan=GPOINTER_TO_INT(data);
+g_print("ext_remote_set_pan: %d\n",pan);
+ remote_set_pan(active_receiver->id,(double)pan);
+ return 0;
+}
+
+int ext_set_title(void *data) {
+ gtk_window_set_title(GTK_WINDOW(top_window),(char *)data);
return 0;
}
-#endif
#ifndef _IAMBIC_H
#define _IAMBIC_H
+#ifdef LOCALCW
enum {
CHECK = 0,
STRAIGHT,
int keyer_init();
#endif
+#endif
#include "toolbar.h"
#include "vox.h"
#include "ext.h"
-#ifdef LOCALCW
#include "iambic.h"
-#endif
#define min(x,y) (x<y?x:y)
#endif
micoutputsamples=buffer_size*4;
-// if(local_audio) {
-// if(audio_open_output()!=0) {
-// g_print("audio_open_output failed\n");
-// local_audio=0;
-// }
-// }
-
if(transmitter->local_microphone) {
if(audio_open_input()!=0) {
g_print("audio_open_input failed\n");
#include "toolbar.h"
#include "vfo.h"
#include "ext.h"
-#ifdef LOCALCW
#include "iambic.h"
-#endif
#include "error_handler.h"
#define min(x,y) (x<y?x:y)
void receiver_weak_notify(gpointer data,GObject *obj) {
RECEIVER *rx=(RECEIVER *)data;
- fprintf(stderr,"receiver_weak_notify: id=%d obj=%p\n",rx->id, obj);
+ g_print("%s: id=%d obj=%p\n",__FUNCTION__,rx->id, obj);
}
gboolean receiver_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer data) {
char name[128];
char value[128];
- g_print("receiver_save_state: %d\n",rx->id);
+ g_print("%s: %d\n",__FUNCTION__,rx->id);
sprintf(name,"receiver.%d.audio_channel",rx->id);
sprintf(value,"%d",rx->audio_channel);
setProperty(name,value);
// for PS_RX_RECEIVER, *only* save the ALEX antenna setting
// and then return quickly.
//
- if (rx->id == PS_RX_FEEDBACK) return;
+ if (rx->id == PS_RX_FEEDBACK
+#ifdef SOAPYSDR
+ && protocol!=SOAPYSDR_PROTOCOL
+#endif
+ ) return;
#endif
sprintf(name,"receiver.%d.sample_rate",rx->id);
char name[128];
char *value;
-fprintf(stderr,"receiver_restore_state: id=%d\n",rx->id);
+g_print("%s: id=%d\n",__FUNCTION__,rx->id);
sprintf(name,"receiver.%d.audio_channel",rx->id);
value=getProperty(name);
// for PS_RX_RECEIVER, *only* restore the ALEX antenna and setting
// and then return quickly
//
- if (rx->id == PS_RX_FEEDBACK) return;
+ if (rx->id == PS_RX_FEEDBACK
+#ifdef SOAPYSDR
+ && protocol!=SOAPYSDR_PROTOCOL
+#endif
+ ) return;
#endif
sprintf(name,"receiver.%d.sample_rate",rx->id);
if(rx->display_panadapter) {
if(rx->panadapter==NULL) {
-fprintf(stderr,"reconfigure_receiver: panadapter_init: width:%d height:%d\n",rx->width,myheight);
+g_print("%s: panadapter_init: width:%d height:%d\n",__FUNCTION__,rx->width,myheight);
rx_panadapter_init(rx, rx->width,myheight);
gtk_fixed_put(GTK_FIXED(rx->panel),rx->panadapter,0,y); // y=0 here always
} else {
// set the size
-//fprintf(stderr,"reconfigure_receiver: panadapter set_size_request: width:%d height:%d\n",rx->width,myheight);
gtk_widget_set_size_request(rx->panadapter, rx->width, myheight);
// move the current one
gtk_fixed_move(GTK_FIXED(rx->panel),rx->panadapter,0,y);
if(rx->display_waterfall) {
if(rx->waterfall==NULL) {
-fprintf(stderr,"reconfigure_receiver: waterfall_init: width:%d height:%d\n",rx->width,myheight);
+g_print("%s: waterfall_init: width:%d height:%d\n",__FUNCTION__,rx->width,myheight);
waterfall_init(rx,rx->width,myheight);
gtk_fixed_put(GTK_FIXED(rx->panel),rx->waterfall,0,y); // y=0 if ONLY waterfall is present
} else {
// set the size
-fprintf(stderr,"reconfigure_receiver: waterfall set_size_request: width:%d height:%d\n",rx->width,myheight);
+g_print("%s: waterfall set_size_request: width:%d height:%d\n",__FUNCTION__,rx->width,myheight);
gtk_widget_set_size_request(rx->waterfall, rx->width, myheight);
// move the current one
gtk_fixed_move(GTK_FIXED(rx->panel),rx->waterfall,0,y);
RECEIVER *rx=(RECEIVER *)data;
int rc;
-//g_print("update_display: rx=%d displaying=%d\n",rx->id,rx->displaying);
-
if(rx->displaying) {
if(rx->pixels>0) {
g_mutex_lock(&rx->display_mutex);
}
void set_offset(RECEIVER *rx,long long offset) {
-//fprintf(stderr,"set_offset: id=%d ofset=%lld\n",rx->id,offset);
-//fprintf(stderr,"set_offset: frequency=%lld ctun_freqeuncy=%lld offset=%lld\n",vfo[rx->id].frequency,vfo[rx->id].ctun_frequency,vfo[rx->id].offset);
if(offset==0) {
SetRXAShiftFreq(rx->id, (double)offset);
RXANBPSetShiftFrequency(rx->id, (double)offset);
overlap = (int)fmax(0.0, ceil(fft_size - (double)rx->sample_rate / (double)rx->fps));
- //g_print("SetAnalyzer id=%d buffer_size=%d overlap=%d\n",rx->id,rx->buffer_size,overlap);
+ //g_print("%s: id=%d buffer_size=%d overlap=%d\n",_FUNCTION__,rx->id,rx->buffer_size,overlap);
SetAnalyzer(rx->id,
int y=0;
rx->panel=gtk_fixed_new();
-fprintf(stderr,"receiver: create_visual: id=%d width=%d height=%d %p\n",rx->id, rx->width, rx->height, rx->panel);
+g_print("%s: id=%d width=%d height=%d %p\n",__FUNCTION__,rx->id, rx->width, rx->height, rx->panel);
g_object_weak_ref(G_OBJECT(rx->panel),receiver_weak_notify,(gpointer)rx);
gtk_widget_set_size_request (rx->panel, rx->width, rx->height);
}
rx_panadapter_init(rx, rx->width,height);
-fprintf(stderr,"receiver: panadapter_init: height=%d y=%d %p\n",height,y,rx->panadapter);
+g_print("%s: panadapter height=%d y=%d %p\n",__FUNCTION__,height,y,rx->panadapter);
g_object_weak_ref(G_OBJECT(rx->panadapter),receiver_weak_notify,(gpointer)rx);
gtk_fixed_put(GTK_FIXED(rx->panel),rx->panadapter,0,y);
y+=height;
if(rx->display_waterfall) {
waterfall_init(rx,rx->width,height);
-fprintf(stderr,"receiver: waterfall_init: height=%d y=%d %p\n",height,y,rx->waterfall);
+g_print("%s: waterfall height=%d y=%d %p\n",__FUNCTION__,height,y,rx->waterfall);
g_object_weak_ref(G_OBJECT(rx->waterfall),receiver_weak_notify,(gpointer)rx);
gtk_fixed_put(GTK_FIXED(rx->panel),rx->waterfall,0,y);
}
#ifdef PURESIGNAL
RECEIVER *create_pure_signal_receiver(int id, int buffer_size,int sample_rate,int width) {
-fprintf(stderr,"create_pure_signal_receiver: id=%d buffer_size=%d\n",id,buffer_size);
+g_print("%s: id=%d buffer_size=%d\n",__FUNCTION__,id,buffer_size);
RECEIVER *rx=malloc(sizeof(RECEIVER));
rx->id=id;
int result;
XCreateAnalyzer(rx->id, &result, 262144, 1, 1, "");
if(result != 0) {
- fprintf(stderr, "XCreateAnalyzer id=%d failed: %d\n", rx->id, result);
+ g_print( "%s: XCreateAnalyzer id=%d failed: %d\n",__FUNCTION__, rx->id, result);
} else {
init_analyzer(rx);
}
#endif
RECEIVER *create_receiver(int id, int buffer_size, int fft_size, int pixels, int fps, int width, int height) {
-fprintf(stderr,"create_receiver: id=%d buffer_size=%d fft_size=%d pixels=%d fps=%d\n",id,buffer_size, fft_size, pixels, fps);
+g_print("%s: id=%d buffer_size=%d fft_size=%d pixels=%d fps=%d\n",__FUNCTION__,id,buffer_size, fft_size, pixels, fps);
RECEIVER *rx=malloc(sizeof(RECEIVER));
rx->id=id;
g_mutex_init(&rx->mutex);
break;
}
}
-fprintf(stderr,"create_receiver: id=%d default adc=%d\n",rx->id, rx->adc);
+g_print("%s: id=%d default adc=%d\n",__FUNCTION__,rx->id, rx->adc);
#ifdef SOAPYSDR
if(radio->device==SOAPYSDR_USB_DEVICE) {
rx->sample_rate=radio->info.soapy.sample_rate;
rx->resampler=NULL;
rx->resample_buffer=NULL;
+g_print("%s: id=%d sample_rate=%d\n",__FUNCTION__,rx->id, rx->sample_rate);
} else {
#endif
rx->sample_rate=48000;
rx->pixel_samples=g_new(float,rx->pixels);
-fprintf(stderr,"create_receiver (after restore): rx=%p id=%d audio_buffer_size=%d local_audio=%d\n",rx,rx->id,rx->audio_buffer_size,rx->local_audio);
- //rx->audio_buffer=g_new(guchar,rx->audio_buffer_size);
+g_print("%s (after restore): rx=%p id=%d audio_buffer_size=%d local_audio=%d\n",__FUNCTION__,rx,rx->id,rx->audio_buffer_size,rx->local_audio);
int scale=rx->sample_rate/48000;
rx->output_samples=rx->buffer_size/scale;
rx->audio_output_buffer=g_new(gdouble,2*rx->output_samples);
-fprintf(stderr,"create_receiver: id=%d output_samples=%d\n",rx->id,rx->output_samples);
+g_print("%s: id=%d output_samples=%d audio_output_buffer=%p\n",__FUNCTION__,rx->id,rx->output_samples,rx->audio_output_buffer);
rx->hz_per_pixel=(double)rx->sample_rate/(double)rx->pixels;
// setup wdsp for this receiver
-fprintf(stderr,"create_receiver: id=%d after restore adc=%d\n",rx->id, rx->adc);
+g_print("%s: id=%d after restore adc=%d\n",__FUNCTION__,rx->id, rx->adc);
-fprintf(stderr,"create_receiver: OpenChannel id=%d buffer_size=%d fft_size=%d sample_rate=%d\n",
+g_print("%s: OpenChannel id=%d buffer_size=%d fft_size=%d sample_rate=%d\n",
+ __FUNCTION__,
rx->id,
rx->buffer_size,
rx->fft_size,
create_anbEXT(rx->id,1, rx->buffer_size,rx->sample_rate,0.00001,0.00001,0.00001,0.05, 4.95);
create_nobEXT(rx->id,1,0,rx->buffer_size,rx->sample_rate,0.00001,0.00001,0.00001,0.05, 4.95);
-fprintf(stderr,"RXASetNC %d\n",rx->fft_size);
RXASetNC(rx->id, rx->fft_size);
-fprintf(stderr,"RXASetMP %d\n",rx->low_latency);
RXASetMP(rx->id, rx->low_latency);
set_agc(rx, rx->agc);
int result;
XCreateAnalyzer(rx->id, &result, 262144, 1, 1, "");
if(result != 0) {
- fprintf(stderr, "XCreateAnalyzer id=%d failed: %d\n", rx->id, result);
+ g_print( "%s: XCreateAnalyzer id=%d failed: %d\n",__FUNCTION__,rx->id, result);
} else {
init_analyzer(rx);
}
create_visual(rx);
-fprintf(stderr,"create_receiver: rx=%p id=%d local_audio=%d\n",rx,rx->id,rx->local_audio);
+g_print("%s: rx=%p id=%d local_audio=%d\n",__FUNCTION__,rx,rx->id,rx->local_audio);
if(rx->local_audio) {
- if (audio_open_output(rx) < 0) rx->local_audio=0;
+ if(audio_open_output(rx)<0) {
+ rx->local_audio=0;
+ }
}
-
return rx;
}
rx->output_samples=rx->buffer_size/scale;
rx->hz_per_pixel=(double)rx->sample_rate/(double)rx->width;
-g_print("receiver_change_sample_rate: id=%d rate=%d scale=%d buffer_size=%d output_samples=%d\n",rx->id,sample_rate,scale,rx->buffer_size,rx->output_samples);
+g_print("%s: id=%d rate=%d scale=%d buffer_size=%d output_samples=%d\n",__FUNCTION__,rx->id,sample_rate,scale,rx->buffer_size,rx->output_samples);
#ifdef PURESIGNAL
//
// In the old protocol, the RX_FEEDBACK sample rate is tied
// to the radio's sample rate and therefore may vary.
// Since there is no downstream WDSP receiver her, the only thing
- // we have to do here is to adapt the spectrum display of the
+ // we have to do here is to adapt the spectrum display of the
// feedback and must then return (rx->id is not a WDSP channel!)
//
if (rx->id == PS_RX_FEEDBACK && protocol == ORIGINAL_PROTOCOL) {
g_mutex_unlock(&rx->mutex);
-fprintf(stderr,"receiver_change_sample_rate: id=%d rate=%d buffer_size=%d output_samples=%d\n",rx->id, rx->sample_rate, rx->buffer_size, rx->output_samples);
+g_print("%s: id=%d rate=%d buffer_size=%d output_samples=%d\n",__FUNCTION__,rx->id, rx->sample_rate, rx->buffer_size, rx->output_samples);
}
void receiver_frequency_changed(RECEIVER *rx) {
gdouble left_sample,right_sample;
short left_audio_sample,right_audio_sample;
int i;
+
+ //g_print("%s: rx=%p id=%d output_samples=%d audio_output_buffer=%p\n",__FUNCTION__,rx,rx->id,rx->output_samples,rx->audio_output_buffer);
+
for(i=0;i<rx->output_samples;i++) {
if(isTransmitting() && (!duplex || mute_rx_while_transmitting)) {
left_sample=0.0;
void full_rx_buffer(RECEIVER *rx) {
int error;
+ //g_print("%s: rx=%p\n",__FUNCTION__,rx);
g_mutex_lock(&rx->mutex);
// noise blanker works on original IQ samples
fexchange0(rx->id, rx->iq_input_buffer, rx->audio_output_buffer, &error);
if(error!=0) {
- //fprintf(stderr,"full_rx_buffer: id=%d fexchange0: error=%d\n",rx->id,error);
rx->fexchange_errors++;
}
g_mutex_unlock(&rx->display_mutex);
}
-//g_print("full_rx_buffer: rx=%d buffer_size=%d samples=%d\n",rx->id,rx->buffer_size,rx->samples);
process_rx_buffer(rx);
g_mutex_unlock(&rx->mutex);
}
}
void receiver_change_zoom(RECEIVER *rx,double zoom) {
-g_print("receiver_change_zoom: %d %f\n",rx->id,zoom);
rx->zoom=(int)zoom;
rx->pixels=rx->width*rx->zoom;
rx->hz_per_pixel=(double)rx->sample_rate/(double)rx->pixels;
#ifdef CLIENT_SERVER
}
#endif
-g_print("receiver_change_zoom: pixels=%d zoom=%d pan=%d\n",rx->pixels,rx->zoom,rx->pan);
}
void receiver_change_pan(RECEIVER *rx,double pan) {
#include "rigctl_menu.h"
#include "noise_menu.h"
#include "new_protocol.h"
-#ifdef LOCALCW
#include "iambic.h" // declare keyer_update()
-#endif
#include <math.h>
+#define NEW_PARSER
+
// IP stuff below
#include <sys/socket.h>
#include <arpa/inet.h> //inet_addr
if(command[4]==';') {
// read the step size
int i=0;
- for(i=0;i<=14;i++) {
+ for(i=0;i<STEPS;i++) {
if(steps[i]==step) break;
}
if(i<=14) {
} else if(command[6]==';') {
// set the step size
int i=atoi(&command[4]) ;
- if(i>=0 && i<=14) {
+ if(i>=0 && i<STEPS) {
step=steps[i];
vfo_update();
}
if(command[6]==';') {
int step_index=atoi(&command[4]);
long long hz=0;
- if(step_index>=0 && step_index<=14) {
+ if(step_index>=0 && step_index<STEPS) {
hz=(long long)steps[step_index];
}
if(hz!=0LL) {
if(command[6]==';') {
int step_index=atoi(&command[4]);
long long hz=0;
- if(step_index>=0 && step_index<=14) {
+ if(step_index>=0 && step_index<STEPS) {
hz=(long long)steps[step_index];
}
if(hz!=0LL) {
if(command[6]==';') {
int step_index=atoi(&command[4]);
long long hz=0;
- if(step_index>=0 && step_index<=14) {
+ if(step_index>=0 && step_index<STEPS) {
hz=(long long)steps[step_index];
}
if(hz!=0LL) {
if(command[6]==';') {
int step_index=atoi(&command[4]);
long long hz=0;
- if(step_index>=0 && step_index<=14) {
+ if(step_index>=0 && step_index<STEPS) {
hz=(long long)steps[step_index];
}
if(hz!=0LL) {
}
static void step_select_cb (GtkToggleButton *widget, gpointer data) {
- if(gtk_toggle_button_get_active(widget)) {
+ int val=GPOINTER_TO_INT(data);
+ if(gtk_toggle_button_get_active(widget) && val >= 0 && val<STEPS) {
step=steps[GPOINTER_TO_INT(data)];
g_idle_add(ext_vfo_update,NULL);
}
gtk_grid_attach(GTK_GRID(grid),close_b,0,0,1,1);
GtkWidget *step_rb=NULL;
- int i=0;
- while(steps[i]!=0) {
+ for (int i=0; i<STEPS; i++) {
if(i==0) {
step_rb=gtk_radio_button_new_with_label(NULL,step_labels[i]);
} else {
gtk_widget_show(step_rb);
gtk_grid_attach(GTK_GRID(grid),step_rb,i%5,1+(i/5),1,1);
g_signal_connect(step_rb,"toggled",G_CALLBACK(step_select_cb),(gpointer)(long)i);
- i++;
}
gtk_container_add(GTK_CONTAINER(content),grid);