locale-dependent(?) issues
Closed this issue · 2 comments
Hi, first of all thanks for this awesome program.
I'm using it as a system-wide equalizer, but it seems like it doesn't work in some applications. My default locale is de_AT.utf8, which seems to be causing these problems.
As I understand it, the plugin fails because the Q factors (widths) in the configuration file are handled incorrectly, causing it to believe values lower than 1.00 (but larger than 0) to be invalid. This only happens when I'm using the German locale; as soon as I'm using, for example, en_US.utf8, all applications work flawlessly with the plugin. This may be related to the decimal separator, which is usually "," instead of "." in German locales, but this is only a guess.
Some applications seem to work with any locale, for example dsp itself or mpv, while e.g. aplay or Firefox only work with en_US.utf8. I've uploaded some log files here: http://pastebin.com/UKv2vWpu, my /etc/ladspa_dsp/config looks like this:
effects_chain=gain -3.79 eq 99 0.18 3.79 eq 319 0.93 -1.25 eq 14493 0.3 1.56 eq 2246 2.2 -4.8 eq 6773 3.3 -5.92 eq 10169 4.94 -1.89
I believe that I found the reason for this behavior. In C programs, the locale defaults to "C" regardless of what the environment variables are set to. In order to use the locale specified in the environment variables, the program must to explicitly run setlocale(LC_ALL, "");
. dsp and mpv do not set the locale, but programs like firefox, aplay, etc. do. Since locale settings are global within a process and ladspa_dsp is loaded as a shared library (via libasound), ladspa_dsp inherits the parent program's locale settings. My code uses the standard C-library functions to parse numbers, which respect locale (meaning that the decimal separator is dependent on locale). This affects all floating-point numbers, not just the filter widths.
At the moment, I'm not certain of the best way to fix this behavior. As a stopgap, I wrote a patch that adds an LC_NUMERIC
option (commit a543487 in the unstable branch). Adding the line LC_NUMERIC=C
to /etc/ladspa_dsp/config
should fix the problem.
Awesome, it's working now. I leave it to your judgement whether to close this issue. Thanks a lot!