When the range of a control has changed between driver versions, it is a
good idea to restore the same dB value of the control. However,
computing the dB value by interpolating betweem the min/max dB values
duplicates alsa-lib's TLV functions and does not even work for controls
with a linear dB range.
A simple conversion to dB and back can be done if we add the dB value(s)
to the saved state.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Reserving new space from the stack in every loop iteration is not
necessary, so move the call to snd_ctl_elem_id_alloca outside where it
is executed only once.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
To save a call to snd_config_set_xxx, replace the calls to
snd_config_make_xxx with snd_config_imake_xxx.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Also, make the initialization & restore logic for one card similar to
multiple card initialization & restore.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
If initialization file (-i option) does not exists, the free_space()
function was called with NULL pointer.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
To increase configuration readability, add CTL{do_search} and CTL{do_count}
actions. The old PROGRAM=="__ctl_search" notion is also allowed.
Add CTL{write} to XML documentation.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Initialize Speaker volume to 0dB as well as Headphone when Master
is present. Also initialize Headphone,1 for machines with dual
headphones.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
- handle virtual master for T61 and TM8100
- when master volume control is available, initialize PCM & CD playback
volumes to 0dB
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The sysfsroot path is /sys/class/sound/cardX/device for recent kernels.
The ACCESS check honors the variable substutition now. Added $config{key}
substitution.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsactl.c:166: warning: assignment from incompatible pointer type
init_utils_string.c:21: warning: ‘string_is_true’ defined but not used
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Some HDA codecs have shifted dB range (-34.5dB - 12dB) for PCM and CD
inputs. Use default 0dB value for them.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Another bug/issue I tripped over when compiling alsa-utils in an
environment using uClibc to supply the C library functions. Here I have
enabled some old BSD style functions. The attached patch will honor
them if they are enabled.
Without this patch I get a redefined error during compile.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fix check when driver contains more controls than state file. In this case,
initialization procedure should be run, too.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
By doing this we move them from the .data section to .rodata setion,
or from .data.rel to .data.rel.ro.
The .rodata section is mapped directly from the on-disk file, which is
always a save, while .data.rel.ro is mapped directly when using
prelink, which is a save in a lot of cases.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
This way the compiler can assume more information about their
interface for optimisation.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Added the check of xmlto program in configure script.
Also added --disable-xmlto configure option for systems with a broken
or older xmlto that doesn't work properly.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Implemented CTL{values)=value to set all values at once.
Implemented CTL{enums} to match against strings in enum list.
Added 'default' (guess method) initialization configuration.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
The initialization procedure consist from default initialization and
state restoration. When restore fails for a reason or the config file
contains inaccurate information, then init is called.
Also, if something fails (init or restore), a file specified using -r
option can be created with description what failed. It can be useful
when user space decides to notify user to set the sound driver properly.
Signed-off-by: Jaroslav Kysela <perex@perex.cz>