Sound mixer levels down in German locale

Feedback and support for the PC version of Osmos
gagern
Posts: 9
Joined: Mon Oct 11, 2010 11:18 pm
Contact:

Sound mixer levels down in German locale

Postby gagern » Tue Oct 12, 2010 12:57 am

After changing the sound mixer levels in Osmos 1.6.0 for Linux, at the next restart the sound was completely disabled. Backing up my ~/.Osmos directory, a newly created profile came back with sound. Diffing these two directories I found that the mixer levels in the broken profile were stored using ',' (comma) as a decimal separator, not '.' (dot). This is the usual convention in Germany, and I've configured my system to mostly use a German locale. So I assume that some locale setting was in effect when the profile was saved, but not when it was loaded, causing the number to become unparsable and interpreted as zero.

Code: Select all

$ diff -Nur /home/mvg/.Osmos{.bac,}/Config.cfg
--- ~/.Osmos.bac/Config.cfg   2010-10-11 18:48:35.019527006 +0200
+++ ~/.Osmos/Config.cfg   2010-10-11 19:11:59.875644582 +0200
@@ -10,9 +10,9 @@
 promptFullscreenOnStartup "0"
 mouseOnly "0"
 vsync "0"
-drawOrbit "1"
+drawOrbit "0"
 drawHUD "1"
-ss_EffectsGain "0,300000"
-ss_MusicGain "0,200000"
+ss_EffectsGain "1.0"
+ss_MusicGain "1.0"
 streamMusic "1"
 soundDevice "-1"
$ locale
LANG=de_DE.utf8
LC_CTYPE=de_DE.utf8
LC_NUMERIC="de_DE.utf8"
LC_TIME="de_DE.utf8"
LC_COLLATE="de_DE.utf8"
LC_MONETARY="de_DE.utf8"
LC_MESSAGES=C
LC_PAPER="de_DE.utf8"
LC_NAME="de_DE.utf8"
LC_ADDRESS="de_DE.utf8"
LC_TELEPHONE="de_DE.utf8"
LC_MEASUREMENT="de_DE.utf8"
LC_IDENTIFICATION="de_DE.utf8"
LC_ALL=


I suggest you set the LC_NUMERIC facet of the locale to "C" when saving and loading the configuration file, so that the semantics of the file won't depend on the current locale. As an additional improvement you might also detect parsing errors for these numbers (perhaps using strtol instead of atoi), and use the same default you use for a new profile if the numbers couldn't be parsed.

User avatar
Meal Worms
Posts: 624
Joined: Wed Apr 22, 2009 12:22 pm
Location: Toronto, Ontario, Canada
Contact:

Re: Sound mixer levels down in German locale

Postby Meal Worms » Tue Oct 12, 2010 10:34 am

Nice catch gagern -- thanks for the report! I'll fix this at tip.

Cheers!
Dave


Return to “Osmos PC (Win/Mac/Linux)”

Who is online

Users browsing this forum: No registered users and 18 guests