if(active_receiver->agc>+AGC_LAST) {
active_receiver->agc=0;
}
- set_agc(active_receiver, active_receiver->agc);
+ set_agc(active_receiver);
g_idle_add(ext_vfo_update, NULL);
}
break;
send_agc(client_socket,active_receiver->id,active_receiver->agc);
} else {
#endif
- set_agc(active_receiver, active_receiver->agc);
+ set_agc(active_receiver);
g_idle_add(ext_vfo_update, NULL);
#ifdef CLIENT_SERVER
}
static void agc_hang_threshold_value_changed_cb(GtkWidget *widget, gpointer data) {
active_receiver->agc_hang_threshold=(int)gtk_range_get_value(GTK_RANGE(widget));
- if(active_receiver->agc==AGC_LONG || active_receiver->agc==AGC_SLOW) {
- SetRXAAGCHangThreshold(active_receiver->id, (int)active_receiver->agc_hang_threshold);
- //
- // recalculate position of hang line for panadapter
- //
- GetRXAAGCHangLevel(active_receiver->id, &active_receiver->agc_hang);
- }
+ set_agc(active_receiver);
}
static void pre_post_agc_cb(GtkToggleButton *widget, gpointer data) {
if(active_receiver->agc>+AGC_LAST) {
active_receiver->agc=0;
}
- set_agc(active_receiver, active_receiver->agc);
+ set_agc(active_receiver);
g_idle_add(ext_vfo_update, NULL);
return 0;
}
SetRXAFMDeviation(rx->id, (double)rx->deviation);
}
-void set_agc(RECEIVER *rx, int agc) {
+void set_agc(RECEIVER *rx) {
- SetRXAAGCMode(rx->id, agc);
+ SetRXAAGCMode(rx->id, rx->agc);
//SetRXAAGCThresh(rx->id, agc_thresh_point, 4096.0, rx->sample_rate);
SetRXAAGCSlope(rx->id,rx->agc_slope);
SetRXAAGCTop(rx->id,rx->agc_gain);
- switch(agc) {
+ switch(rx->agc) {
case AGC_OFF:
break;
case AGC_LONG:
RXASetNC(rx->id, rx->fft_size);
RXASetMP(rx->id, rx->low_latency);
- set_agc(rx, rx->agc);
-
SetRXAAMDSBMode(rx->id, 0);
SetRXAShiftRun(rx->id, 0);
rx->local_audio=0;
}
}
+ // defer set_agc until here, otherwise the AGC threshold is not computed correctly
+ set_agc(rx);
return rx;
}
extern void set_mode(RECEIVER* rx,int m);
extern void set_filter(RECEIVER *rx,int low,int high);
-extern void set_agc(RECEIVER *rx, int agc);
+extern void set_agc(RECEIVER *rx);
extern void set_offset(RECEIVER *rx, long long offset);
extern void set_deviation(RECEIVER *rx);
send_agc_gain(client_socket,active_receiver->id,(int)active_receiver->agc_gain,(int)active_receiver->agc_hang,(int)active_receiver->agc_thresh);
} else {
#endif
- SetRXAAGCTop(active_receiver->id, active_receiver->agc_gain);
- GetRXAAGCHangLevel(active_receiver->id, &active_receiver->agc_hang);
- GetRXAAGCThresh(active_receiver->id, &active_receiver->agc_thresh, 4096.0, (double)active_receiver->sample_rate);
+ set_agc(active_receiver);
#ifdef CLIENT_SERVER
}
#endif
void set_agc_gain(int rx,double value) {
g_print("%s\n",__FUNCTION__);
receiver[rx]->agc_gain=value;
- SetRXAAGCTop(receiver[rx]->id, receiver[rx]->agc_gain);
- GetRXAAGCHangLevel(receiver[rx]->id, &receiver[rx]->agc_hang);
- GetRXAAGCThresh(receiver[rx]->id, &receiver[rx]->agc_thresh, 4096.0, (double)receiver[rx]->sample_rate);
+ set_agc(receiver[rx]);
if(display_sliders) {
gtk_range_set_value (GTK_RANGE(agc_scale),receiver[rx]->agc_gain);
} else {