]> git.alsa-project.org Git - alsa-tools.git/commitdiff
Fix ADC controls with higher resolution in envy24control
authorTakashi Iwai <tiwai@suse.de>
Thu, 7 Sep 2006 18:55:49 +0000 (20:55 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 7 Sep 2006 18:55:49 +0000 (20:55 +0200)
Fixed envy24control to handle ADC volumes with higher resolution
properly.
Also, the bogus sync of gtk_adjustment between ADC and IPGA volumes
is fixed in the case no IPGA is detected.

envy24control/envy24control.c
envy24control/envy24control.h
envy24control/volume.c

index 9268956f140fd6176e9660c19f8320cc2b730c9a..9c6f23cd30070ffe1364b0fc5c631392bde8f341 100644 (file)
@@ -1570,7 +1570,7 @@ static void create_analog_volume(GtkWidget *main, GtkWidget *notebook, int page)
                        gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, TRUE, 6);
                }
 
-               adj = gtk_adjustment_new(0, -127, 0, 1, 16, 0);
+               adj = gtk_adjustment_new(0, -(envy_adc_max()), 0, 1, 16, 0);
                av_adc_volume_adj[i] = adj;
                vscale = gtk_vscale_new(GTK_ADJUSTMENT(adj));
                gtk_scale_set_draw_value(GTK_SCALE(vscale), FALSE);
index 53b5e70f070b1e652ae070819cd4ce99c975e35a..f5c1e39ec1e25d5a27c4a2c738b951db147b14e6 100644 (file)
@@ -217,6 +217,7 @@ void analog_volume_postinit(void);
 int envy_dac_volumes(void);
 int envy_dac_max(void);
 int envy_adc_volumes(void);
+int envy_adc_max(void);
 int envy_ipga_volumes(void);
 int envy_dac_senses(void);
 int envy_adc_senses(void);
index f336bbeb63dbae2000989ed99bfbba314b56e1d8..226c75c94092c6636287ac0a51a595a7a8c90465 100644 (file)
@@ -33,6 +33,7 @@
 
 static int dac_volumes;
 static int dac_max = 127;
+static int adc_max = 127;
 static int adc_volumes;
 static int ipga_volumes;
 static int dac_senses;
@@ -58,6 +59,11 @@ int envy_adc_volumes(void)
        return adc_volumes;
 }
 
+int envy_adc_max(void)
+{
+       return adc_max;
+}
+
 int envy_ipga_volumes(void)
 {
        return ipga_volumes;
@@ -138,8 +144,9 @@ void adc_volume_update(int idx)
                g_print("Unable to read ipga volume: %s\n", snd_strerror(err));
                return;
        }
-       gtk_adjustment_set_value(GTK_ADJUSTMENT(av_ipga_volume_adj[idx]),
-                                -0);
+       if (ipga_volumes > 0)
+               gtk_adjustment_set_value(GTK_ADJUSTMENT(av_ipga_volume_adj[idx]),
+                                        -0);
 }
 
 void ipga_volume_update(int idx)
@@ -165,7 +172,7 @@ void ipga_volume_update(int idx)
        // set ADC volume to max if IPGA volume greater 0
        if (ipga_vol)
                gtk_adjustment_set_value(GTK_ADJUSTMENT(av_adc_volume_adj[idx]),
-                                        -127);
+                                        -adc_max);
 }
 
 void dac_sense_update(int idx)
@@ -342,6 +349,7 @@ void analog_volume_init(void)
                snd_ctl_elem_info_set_index(info, i);
                if (snd_ctl_elem_info(ctl, info) < 0)
                        break;
+               adc_max = snd_ctl_elem_info_get_max(info);
        }
        if (i < input_channels - 1)
                adc_volumes = i;