Update of /cvsroot/alsa/alsa-lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv8141/test

Modified Files:
        omixer.c 
Log Message:
ALISP update
 - function names are more emacs-like
 - implemented (format) function
 - fixed numerous memory-leaks (valgrind is now happy)
Ordinary mixer
 - added the global view (using hdsp names only)


Index: omixer.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/test/omixer.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- omixer.c    13 Oct 2003 12:06:46 -0000      1.3
+++ omixer.c    23 Dec 2003 16:43:04 -0000      1.4
@@ -27,7 +27,7 @@
                {"cname", 1, NULL, 'C'},
                {NULL, 0, NULL, 0},
        };
-       int err, morehelp;
+       int err, morehelp, result = EXIT_SUCCESS;
        char *pname = "default", *cname = "default";
        snd_pcm_t *phandle = NULL, *chandle = NULL;
        sndo_mixer_t *handle;
@@ -59,7 +59,8 @@
                err = snd_pcm_open(&phandle, pname, SND_PCM_STREAM_PLAYBACK, 0);
                if (err < 0) {
                        fprintf(stderr, "Playback PCM open error: %s\n", 
snd_strerror(err));
-                       return EXIT_FAILURE;
+                       result = EXIT_FAILURE;
+                       goto __end;
                }
        }
 
@@ -69,17 +70,23 @@
                        if (phandle)
                                snd_pcm_close(phandle);
                        fprintf(stderr, "Capture PCM open error: %s\n", 
snd_strerror(err));
-                       return EXIT_FAILURE;
+                       result = EXIT_FAILURE;
+                       goto __end;
                }
        }
 
-       err = sndo_mixer_open(&handle, phandle, chandle, NULL);
+       err = sndo_mixer_open_pcm(&handle, phandle, chandle, NULL);
        if (err < 0) {
                fprintf(stderr, "mixer open error: %s\n", snd_strerror(err));
-               return EXIT_FAILURE;
+               result = EXIT_FAILURE;
+       } else {
+               sndo_mixer_close(handle);
        }
-       sndo_mixer_close(handle);
-       snd_pcm_close(chandle);
-       snd_pcm_close(phandle);
-       return EXIT_SUCCESS;
+      __end:
+       if (chandle)
+               snd_pcm_close(chandle);
+       if (phandle)
+               snd_pcm_close(phandle);
+       snd_config_update_free_global(); /* to keep valgrind happy */
+       return result;
 }



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to