GtkWidget *init_psk() { int i; psk_index=0; detector=createPSKDet(8000); if(detector==NULL) { fprintf(stderr,"init_psk: createPSKDet return null!\n"); return NULL; } SetRXFrequency(detector,1500); ResetDetector(detector); for(i=0;i<TEXT_LINES;i++) { text_label[i][0]='\0'; } build_temp_text(); psk_label=gtk_label_new(temp_text); gtk_label_set_single_line_mode (GTK_LABEL(psk_label), FALSE); gtk_label_set_width_chars (GTK_LABEL(psk_label), 80); gtk_label_set_lines (GTK_LABEL(psk_label), TEXT_LINES); gtk_label_set_line_wrap (GTK_LABEL(psk_label), TRUE); gtk_misc_set_alignment (GTK_MISC(psk_label), 0, 0); //gtk_widget_set_halign(psk_label,GTK_ALIGN_START); //gtk_widget_set_valign(psk_label,GTK_ALIGN_START); return psk_label; }
void Acquire ( void ){ //extern double NCO_Frequency; extern int count; extern int char_count; //extern unsigned int FFT_Display[]; long i, S1, S2, W; double delta; /* this is where I add a correction to the NCO frequency based on the nearby spectral peaks */ S1 = 0; S2 = 0; delta = 0.; //for (i=-2; i<3; i++){ for (i=-4; i<5; i++){ W = (long)FFT_Display[NCO_Point + i]; S1 += W*i; S2 += W; } if (S2 != 0) delta = (double) S1/((double)S2); NCO_Frequency += (double)((float)delta * 15.625); SetRXFrequency (NCO_Frequency ); count = 0; char_count = 0; }
void psk_set_frequency(int f) { if(detector!=NULL) { SetRXFrequency(detector,f); ResetDetector(detector); } }