}
static void sample_rate_cb(GtkWidget *widget, gpointer data) {
- if(protocol==ORIGINAL_PROTOCOL) {
- old_protocol_new_sample_rate((int)data);
- } else {
- new_protocol_new_sample_rate((int)data);
- }
+ switch(protocol) {
+ case ORIGINAL_PROTOCOL:
+ old_protocol_new_sample_rate((int)data);
+ break;
+ case NEW_PROTOCOL:
+ new_protocol_new_sample_rate((int)data);
+ break;
+#ifdef RADIOBERRY
+ case RADIOBERRY_PROTOCOL:
+ radioberry_new_sample_rate((int)data);
+ break;
+#endif
+ }
+
}
static void rit_cb(GtkWidget *widget,gpointer data) {
gtk_grid_attach(GTK_GRID(grid),vfo_divisor,4,2,1,1);
g_signal_connect(vfo_divisor,"value_changed",G_CALLBACK(vfo_divisor_value_changed_cb),NULL);
- if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
+ if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL
+#ifdef RADIOBERRY
+ || protocol==RADIOBERRY_PROTOCOL) {
+#else
+ ){
+#endif
GtkWidget *rx_dither_b=gtk_check_button_new_with_label("Dither");
//gtk_widget_override_font(rx_dither_b, pango_font_description_from_string("Arial 18"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rx_dither_b), rx_dither);
g_signal_connect(bias_b,"toggled",G_CALLBACK(bias_cb),NULL);
}
+#ifdef RADIOBERRY
+ if (protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
+#endif
GtkWidget *alex_b=gtk_check_button_new_with_label("ALEX");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (alex_b), filter_board==ALEX);
gtk_grid_attach(GTK_GRID(grid),alex_b,1,1,1,1);
g_signal_connect(alex_b,"toggled",G_CALLBACK(alex_cb),apollo_b);
g_signal_connect(apollo_b,"toggled",G_CALLBACK(apollo_cb),alex_b);
-
+#ifdef RADIOBERRY
+ }
+#endif
}
GtkWidget *sample_rate_label=gtk_label_new("Sample Rate:");
gtk_grid_attach(GTK_GRID(grid),sample_rate_label,0,1,1,1);
- if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL) {
+ if(protocol==ORIGINAL_PROTOCOL || protocol==NEW_PROTOCOL
+ #ifdef RADIOBERRY
+ || protocol==RADIOBERRY_PROTOCOL) {
+#else
+ ){
+#endif
GtkWidget *sample_rate_48=gtk_radio_button_new_with_label(NULL,"48000");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sample_rate_48), sample_rate==48000);
gtk_grid_attach(GTK_GRID(grid),sample_rate_48,0,2,1,1);
return (t1.tv_sec - t0.tv_sec) * 1000.0f + (t1.tv_usec - t0.tv_usec) / 1000.0f;
}
+void radioberry_calc_buffers() {
+ switch(sample_rate) {
+ case 48000:
+ output_buffer_size=OUTPUT_BUFFER_SIZE;
+ break;
+ case 96000:
+ output_buffer_size=OUTPUT_BUFFER_SIZE/2;
+ break;
+ case 192000:
+ output_buffer_size=OUTPUT_BUFFER_SIZE/4;
+ break;
+ case 384000:
+ output_buffer_size=OUTPUT_BUFFER_SIZE/8;
+ break;
+ default:
+ fprintf(stderr,"Invalid sample rate: %d. Defaulting to 48K.\n",sample_rate);
+ break;
+ }
+}
+
+void radioberry_new_sample_rate(int rate){
+ sample_rate=rate;
+ radioberry_calc_buffers();
+ setSampleSpeed();
+ wdsp_new_sample_rate(rate);
+}
+
void radioberry_protocol_init(int rx,int pixels) {
int i;
receiver=rx;
display_width=pixels;
- switch(sample_rate) {
- case 48000:
- output_buffer_size=OUTPUT_BUFFER_SIZE;
- break;
- case 96000:
- output_buffer_size=OUTPUT_BUFFER_SIZE/2;
- break;
- case 192000:
- output_buffer_size=OUTPUT_BUFFER_SIZE/4;
- break;
- case 384000:
- output_buffer_size=OUTPUT_BUFFER_SIZE/8;
- break;
- default:
- fprintf(stderr,"Invalid sample rate: %d. Defaulting to 48K.\n",sample_rate);
- break;
- }
+ radioberry_calc_buffers();
fprintf(stderr,"radioberry_protocol: buffer size: =%d\n", buffer_size);