From: John Melton - G0ORX/N6LYT Date: Wed, 30 Nov 2016 08:44:57 +0000 (+0000) Subject: updated tune drive level and mic gain levels X-Git-Url: https://git.rkrishnan.org/pf/frontends/...?a=commitdiff_plain;h=49d7655c3657c3709ff2bc8493ed7a62cb8dac78;p=pihpsdr.git updated tune drive level and mic gain levels --- diff --git a/audio.c b/audio.c index 86df47a..fc73794 100644 --- a/audio.c +++ b/audio.c @@ -408,54 +408,3 @@ fprintf(stderr,"output_device: %s\n",device_id); } } -/* -int audio_get_mic_level() { - fprintf(stderr,"audio_get_mic_level\n"); - if(local_microphone==0) { - fprintf(stderr,"local microphone not enabled\n"); - return -1; - } - if(n_selected_input_device<0 || n_selected_input_device>=n_input_devices) { - fprintf(stderr,"no imput device selected\n"); - return -1; - } - - long db; - - int i; - char hw[16]; - char *selected=input_devices[n_selected_input_device]; - fprintf(stderr,"audio_get_mic_level: selected=%d:%s\n",n_selected_input_device,selected); - - i=0; - while(selected[i]!=' ') { - hw[i]=selected[i]; - i++; - } - hw[i]='\0'; - fprintf(stderr,"audio_get_mic_level: hw=%s\n",hw); - - snd_mixer_t* handle; - snd_mixer_selem_id_t* sid; - const char *selem_name="Mic"; - - snd_mixer_open(&handle, 0); - snd_mixer_attach(handle, hw); - snd_mixer_selem_register(handle, NULL, NULL); - snd_mixer_load(handle); - - snd_mixer_selem_id_alloca(&sid); - snd_mixer_selem_id_set_index(sid, 0); - snd_mixer_selem_id_set_name(sid, selem_name); - snd_mixer_elem_t* elem = snd_mixer_find_selem(handle, sid); - - //snd_mixer_selem_get_capture_volume_range(elem, &min, &max); - snd_mixer_selem_get_capture_dB(elem,0,&db); - - fprintf(stderr,"audio_get_mic_level: %ld dB\n",db); - snd_mixer_close(handle); - - - return 0; -} -*/ diff --git a/audio.h b/audio.h index 8ff8fe6..57ad396 100644 --- a/audio.h +++ b/audio.h @@ -34,7 +34,4 @@ extern void audio_close_output(); extern void audio_close_input(); extern int audio_write(short left_sample,short right_sample); extern void audio_get_cards(); -/* -extern int audio_get_mic_level(); -*/ #endif diff --git a/new_menu.c b/new_menu.c index defa9c4..3f66f7f 100644 --- a/new_menu.c +++ b/new_menu.c @@ -143,7 +143,7 @@ static gboolean equalizer_cb (GtkWidget *widget, GdkEventButton *event, gpointer static gboolean test_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) { fprintf(stderr,"test_cb\n"); - audio_get_mic_level(); + // some test code return TRUE; } diff --git a/old_protocol.c b/old_protocol.c index 07f9ac0..97c2889 100644 --- a/old_protocol.c +++ b/old_protocol.c @@ -376,7 +376,7 @@ static void process_ozy_input_buffer(char *buffer) { int last_dash; int left_sample[RECEIVERS]; int right_sample[RECEIVERS]; - int mic_sample; + short mic_sample; double left_sample_double[RECEIVERS]; double right_sample_double[RECEIVERS]; double mic_sample_double; @@ -455,14 +455,14 @@ static void process_ozy_input_buffer(char *buffer) { right_sample[r] += (int)((unsigned char)buffer[b++]) << 8; right_sample[r] += (int)((unsigned char)buffer[b++]); } - mic_sample = (int)((signed char) buffer[b++]) << 8; - mic_sample += (int)((unsigned char)buffer[b++]); + mic_sample = (short)((signed char) buffer[b++]) << 16; + mic_sample |= (short)((unsigned char)buffer[b++]); + mic_sample_double = (1.0 / 2147483648.0) * (double)(mic_sample<<16); for(r=0;r