Fix ADC controls with higher resolution in envy24control

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.
This commit is contained in:
Takashi Iwai 2006-09-07 20:55:49 +02:00
parent 526334dda9
commit 917e71fcc8
3 changed files with 13 additions and 4 deletions

View 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;