ao-view: fix snd_pcm_open return checking
authorKeith Packard <keithp@keithp.com>
Wed, 7 Oct 2009 03:06:00 +0000 (20:06 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 7 Oct 2009 03:06:00 +0000 (20:06 -0700)
I don't know how this code was supposed to work before...

Signed-off-by: Keith Packard <keithp@keithp.com>
ao-tools/ao-view/aoview_flite.c

index e1b758983d171211d5ee9ade5ec578e7dfa02575..bc702b0f4cd29275810a574636176378c9ac4a0a 100644 (file)
@@ -42,12 +42,10 @@ aoview_flite_task(gpointer data)
 
        err = snd_pcm_open(&alsa_handle, "default",
                           SND_PCM_STREAM_PLAYBACK, 0);
-       if (err >= 0)
-       {
-               if (err < 0) {
-                       snd_pcm_close(alsa_handle);
-                       alsa_handle = 0;
-               }
+       if (err < 0) {
+               fprintf(stderr, "alsa open failed %s\n",
+                       strerror(-err));
+               alsa_handle = NULL;
        }
        rate = 0;
        channels = 0;