Skip to contentSkip to conversation

Re-reading alsa-lib configuration when opening sound device

DISCUSSION Pavel Hofman 2 participants 5 messages Sep 30, 2018 – Oct 2, 2018

lore
Share & tools
lore
#0 lore raw

Hi,

I am playing with virtual balanced inputs https://www.diyaudio.com/forums/pc-based/326747-virtual-balanced-regular-soundcard-linux-results.html . For proper functionality it needs a regular recalibration of the ttable multiplication coefficients of route plugin in .asoundrc.

The audio stack is alsa -> wine -> Arta measurement software. When I stop measuring in arta (without exiting the software), the soundcard gets closed - confirmed in /proc/asound/.../hw_params. Now I change the ttable coeffs. After re-opening the device (continuing with measurement in the running arta instance) the changes in .asoundrc are ignored. I have to restart the arta application for the changes to take effect.

When I run e.g. aplay inbetween, it accepts the changes right away. Upon continuing in arta, the original ttable coeffs are still loaded for this instance.

I understand it is the way wine handles the device somewhere in https://github.com/wine-mirror/wine/blob/master/dlls/winealsa.drv/mmdevdrv.c .

Please when is the alsa-lib config loaded by the library/application? Is there any way to force a config reload from outside?

Would e.g. calling snd_config_update before snd_pcm_open on line https://github.com/wine-mirror/wine/blob/master/dlls/winealsa.drv/mmdevdrv.c#L827
help? If so, what overhead does it impose? Perhaps I could ask the
wine guys to consider such change if it worked and required minimum overhead.

I very much appreciate any help.

Best regards,

Pavel.

#1 lore raw
Quoted 1 line · Pavel Hofman

when is the alsa-lib config loaded by the library/application?

Whenever a device is opened, alsa-lib checks the timestamp of the alsa.conf file.

Quoted 1 line

Is there any way to force a config reload from outside?

Touch that file. If you cannot modify the global configuration file, redirect the program to use your own file by setting the ALSA_CONFIG_PATH environment variable.

Regards,
Clemens

#2 lore raw

Dne 2.10.2018 v 13:26 Clemens Ladisch napsal(a):

Quoted 5 lines
Quoted 1 line · Pavel Hofman

when is the alsa-lib config loaded by the library/application?

Whenever a device is opened, alsa-lib checks the timestamp of the alsa.conf file.

Hi Clemens,

Thanks a lot. Does it concern only /usr/share/alsa/alsa.conf file, or the files configured in the config hooks too (/etc/asound.conf, /alsa.conf.d/, ~/.asoundrc)? Based on your answer I assume not :-)

Quoted 3 lines

Touch that file. If you cannot modify the global configuration file, redirect the program to use your own file by setting the ALSA_CONFIG_PATH environment variable.

Could I setup ALSA_CONFIG_PATH=$USER/.my_global_alsa.conf as a symlink to /usr/share/alsa/alsa.conf and touch this symlink only?

I very much appreciate this great help.

Pavel.

#3 lore raw
Quoted 5 lines · Pavel Hofman

Dne 2.10.2018 v 13:26 Clemens Ladisch napsal(a):

Quoted 1 line

Whenever a device is opened, alsa-lib checks the timestamp of the alsa.conf file.

Does it concern only /usr/share/alsa/alsa.conf file, or the files configured in the config hooks too (/etc/asound.conf, /alsa.conf.d/, ~/.asoundrc)?

It checks only the top configuration file.

Quoted 2 lines

Could I setup ALSA_CONFIG_PATH=$USER/.my_global_alsa.conf as a symlink to /usr/share/alsa/alsa.conf and touch this symlink only?

No; stat() would return the timestamp of the target.

Regards,
Clemens

#4 lore raw

Dne 2.10.2018 v 15:42 Clemens Ladisch napsal(a):

Quoted 2 lines

It checks only the top configuration file.

Thanks. When knowing what to look for, I see the code in https://github.com/tiwai/alsa-lib/blob/master/src/conf.c#L3960 .

Quoted 5 lines
Quoted 3 lines

Could I setup ALSA_CONFIG_PATH=$USER/.my_global_alsa.conf as a symlink to /usr/share/alsa/alsa.conf and touch this symlink only?

No; stat() would return the timestamp of the target.

OK, I will touch the global file instead (no problem with modifying perms).

Again, thanks a lot for your great help.

Best regards,

Pavel.