From: Johannes Holmberg <johan...@update.uu.se>

---
 wmix/config.c         | 22 ++++++++++++++++++----
 wmix/include/config.h |  2 +-
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/wmix/config.c b/wmix/config.c
index 8fdb293..0b80013 100644
--- a/wmix/config.c
+++ b/wmix/config.c
@@ -66,7 +66,7 @@ const char default_osd_color[] = "green";
 void config_init(void)
 {
        memset(&config, 0, sizeof(config));
-        config.api = 0;
+        config.api = -1;
        config.mixer_device = NULL;
        config.mousewheel = 1;
        config.scrolltext = 1;
@@ -163,8 +163,10 @@ void parse_cli_options(int argc, char **argv)
                case 'a':
                        if(!strcmp("oss", optarg))
                                config.api = 1;
-                       else if (strcmp("alsa", optarg))
-                               fprintf(stderr, "Warning: Incorrect sound api 
specified, defaulting to alsa\n");
+                       else if (!strcmp("alsa", optarg))
+                               config.api = 0;
+                       else
+                               fprintf(stderr, "wmix:warning: incorrect sound 
api specified on command line, ignoring\n");
                        break;
                case 'd':
                        if (config.display_name)
@@ -325,7 +327,16 @@ void config_read(void)
                *ptr = '\0';
 
                /* Check what keyword we have */
-               if (strcmp(keyword, "device") == 0) {
+               if (strcmp(keyword, "api") == 0) {
+                       if (config.api == -1) {
+                               if(!strcmp("oss", value))
+                                       config.api = 1;
+                               else if (!strcmp("alsa", value))
+                                       config.api = 0;
+                               else
+                                       fprintf(stderr, "wmix:warning: 
incorrect sound api in config, ignoring\n");
+                       }
+               } else if (strcmp(keyword, "device") == 0) {
                        if (config.mixer_device == default_mixer_device)
                                config.mixer_device = strdup(value);
                        /* If not the default, keep the previous value because 
it was provided in the command-line */
@@ -393,6 +404,9 @@ void config_read(void)
 
 void config_set_defaults()
 {
+       if (config.api == -1)
+               config.api = 0;
+
        if (!config.mixer_device) {
                if (config.api == 0)
                        config.mixer_device = (char *)default_card_name;
diff --git a/wmix/include/config.h b/wmix/include/config.h
index 7570fcd..d916fa2 100644
--- a/wmix/include/config.h
+++ b/wmix/include/config.h
@@ -28,7 +28,7 @@ extern struct _Config {
        char        *display_name;              /* X Display to connect to */
        char        *mixer_device;              /* device file to use for 
controlling Mixer volumes */
 
-       unsigned int api;               /* Sound API (0 = ALSA, 1 = OSS) */
+       int api;                        /* Sound API (0 = ALSA, 1 = OSS) */
        unsigned int verbose    : 1;    /* be Verbose when starting */
        unsigned int osd        : 1;    /* show OSD? */
        unsigned int mousewheel : 1;    /* mousewheel enabled? */
-- 
2.1.4


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to