[alsa-devel] Re-reading alsa-lib configuration when opening sound device
Hi,
I am playing with virtual balanced inputs https://www.diyaudio.com/forums/pc-based/326747-virtual-balanced-regular-sou... . 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... 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.
Pavel Hofman wrote:
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.
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
Dne 2.10.2018 v 13:26 Clemens Ladisch napsal(a):
Pavel Hofman wrote:
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 :-)
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.
Pavel Hofman wrote:
Dne 2.10.2018 v 13:26 Clemens Ladisch napsal(a):
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.
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
Dne 2.10.2018 v 15:42 Clemens Ladisch napsal(a):
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 .
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.
participants (2)
-
Clemens Ladisch
-
Pavel Hofman