[vlc-devel] Problem in the equalizer with strtof

Cyril MATHE cmathe at actech-innovation.com
Tue Apr 14 11:28:59 CEST 2009


Hello,

I am currently working on adding the equalizer to the Web Plugin. I had
a problem with strtof. 
In the equalizer 
	- when you want to change the settings you need to do :
		var_SetString(p_aout, "equalizer", psz_band), with
		psz_band a string containing the new equalizer values ;
	- when you want to get the current settings you need to do :
		var_GetString(p_aout, "equalizer", val), with val a
		string containing the current settings
psz_band and val have the following form :
"0.0 12.0 9.6 -5.2 -12.0 5.6 -8.0 9.6 3.4 5.2" 
It's made of ten bands, to each band corespond a float value.

strtof converts number from a string to a float value. But the way that
strtof converts a string to a float value depends of your country,
because the decimal separator can be a point (3.2 : United Kingdom,
United States ...) or a comma (3,2 : Brazil, France, Germany ...). This
is LC_NUMERIC which defines if strtof will look for a point, or for a
comma as a decimal separator.
There is no problem in the main VLC, the problem appears when i launch
the mozilla plugin in firefox. I am using firefox in French mode and I
think that firefox change the LC_NUMERIC value. three reasons of that :

1) I launch Firefox in French mode when I ask for the current value I
have :
"0 0 12 0 9 6 -5 2 -12 0" instead of  "0.0 12.0 9.6 -5.2 -12.0 5.6 -8.0
9.6 3.4 5.2", the plugin consider the decimal part as an equalizer band.

2) I launch Firefox in English mode and i have the good values

3) I made a change in VLC to have comma as decimal separator, I launch
Firefox in French mode and I have the correct values.

I noticed this problem and I really don't know how to deal with this
decimal separator problem. One solution could be  to put integer values
instead of float values (i tried it, it works) but the problem is still
existing when you get the values (you get incorrect values).

Best Regards

	Cyril Mathé









More information about the vlc-devel mailing list