changeset 1129:705fa4ac4fed

hacked to work seek/pause/resume/uninit
author al3x
date Thu, 14 Jun 2001 18:29:05 +0000
parents d2dd25dd11bc
children a95cedf133c1
files libao2/ao_alsa1x.c libao2/ao_alsa9.c
diffstat 2 files changed, 34 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_alsa1x.c	Thu Jun 14 18:00:13 2001 +0000
+++ b/libao2/ao_alsa1x.c	Thu Jun 14 18:29:05 2001 +0000
@@ -198,7 +198,7 @@
 	return(0);
     }
 
-    if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams,
+    if ((err = snd_pcm_hw_params_set_rate(alsa_handler, alsa_hwparams,
 	ao_samplerate, 0)) < 0)
     {
 	printf("alsa-init: unable to set samplerate: %s\n",
@@ -336,11 +336,13 @@
 	return;
     }
 
+#ifdef start
     if ((err = snd_pcm_reset(alsa_handler)) < 0)
     {
 	printf("alsa-uninit: pcm reset error: %s\n", snd_strerror(err));
 	return;
     }
+#endif
 
     if ((err = snd_pcm_close(alsa_handler)) < 0)
     {
@@ -359,11 +361,13 @@
 	return;
     }
 
+#ifdef reset
     if ((err = snd_pcm_reset(alsa_handler)) < 0)
     {
 	printf("alsa-pause: pcm reset error: %s\n", snd_strerror(err));
 	return;
     }
+#endif
 }
 
 static void audio_resume()
@@ -376,11 +380,13 @@
 	return;
     }
 
+#ifdef start
     if ((err = snd_pcm_start(alsa_handler)) < 0)
     {
 	printf("alsa-resume: pcm start error: %s\n", snd_strerror(err));
 	return;
     }
+#endif
 }
 
 /* stop playing and empty buffers (for seeking/pause) */
@@ -394,11 +400,13 @@
 	return;
     }
 
+#ifdef start
     if ((err = snd_pcm_reset(alsa_handler)) < 0)
     {
 	printf("alsa-reset: pcm reset error: %s\n", snd_strerror(err));
 	return;
     }
+#endif
 
     if ((err = snd_pcm_prepare(alsa_handler)) < 0)
     {
@@ -406,11 +414,13 @@
 	return;
     }
 
+#ifdef start
     if ((err = snd_pcm_start(alsa_handler)) < 0)
     {
 	printf("alsa-reset: pcm start error: %s\n", snd_strerror(err));
 	return;
     }
+#endif
 }
 
 /*
@@ -473,6 +483,9 @@
     }
     
     snd_pcm_status_free(status);
+    
+    if (ret < 0)
+	ret = 0;
     return(ret);
 }
 
@@ -506,6 +519,8 @@
     }
     
     snd_pcm_status_free(status);
+
+    if (ret < 0)
+	ret = 0;
     return(ret);
 }
-
--- a/libao2/ao_alsa9.c	Thu Jun 14 18:00:13 2001 +0000
+++ b/libao2/ao_alsa9.c	Thu Jun 14 18:29:05 2001 +0000
@@ -198,7 +198,7 @@
 	return(0);
     }
 
-    if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams,
+    if ((err = snd_pcm_hw_params_set_rate(alsa_handler, alsa_hwparams,
 	ao_samplerate, 0)) < 0)
     {
 	printf("alsa-init: unable to set samplerate: %s\n",
@@ -336,11 +336,13 @@
 	return;
     }
 
+#ifdef start
     if ((err = snd_pcm_reset(alsa_handler)) < 0)
     {
 	printf("alsa-uninit: pcm reset error: %s\n", snd_strerror(err));
 	return;
     }
+#endif
 
     if ((err = snd_pcm_close(alsa_handler)) < 0)
     {
@@ -359,11 +361,13 @@
 	return;
     }
 
+#ifdef reset
     if ((err = snd_pcm_reset(alsa_handler)) < 0)
     {
 	printf("alsa-pause: pcm reset error: %s\n", snd_strerror(err));
 	return;
     }
+#endif
 }
 
 static void audio_resume()
@@ -376,11 +380,13 @@
 	return;
     }
 
+#ifdef start
     if ((err = snd_pcm_start(alsa_handler)) < 0)
     {
 	printf("alsa-resume: pcm start error: %s\n", snd_strerror(err));
 	return;
     }
+#endif
 }
 
 /* stop playing and empty buffers (for seeking/pause) */
@@ -394,11 +400,13 @@
 	return;
     }
 
+#ifdef start
     if ((err = snd_pcm_reset(alsa_handler)) < 0)
     {
 	printf("alsa-reset: pcm reset error: %s\n", snd_strerror(err));
 	return;
     }
+#endif
 
     if ((err = snd_pcm_prepare(alsa_handler)) < 0)
     {
@@ -406,11 +414,13 @@
 	return;
     }
 
+#ifdef start
     if ((err = snd_pcm_start(alsa_handler)) < 0)
     {
 	printf("alsa-reset: pcm start error: %s\n", snd_strerror(err));
 	return;
     }
+#endif
 }
 
 /*
@@ -473,6 +483,9 @@
     }
     
     snd_pcm_status_free(status);
+    
+    if (ret < 0)
+	ret = 0;
     return(ret);
 }
 
@@ -506,6 +519,8 @@
     }
     
     snd_pcm_status_free(status);
+
+    if (ret < 0)
+	ret = 0;
     return(ret);
 }
-