Recently Written · git

sad

sad (2f30.org simple audio daemon) with a Cygwin/OSS port on branch cygwin

git clone https://github.com/equwal/sad

Log | Files | Refs


commit 9654660fdca4a2fa15760d1d0f02d451a6569f9a
sin <sin@2f30.org>
2014-12-31 17:50:24 +0000

No need to keep format global

 alsa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/alsa.c b/alsa.c
index d9da80e..85c0843 100644
--- a/alsa.c
+++ b/alsa.c
@@ -8,7 +8,6 @@
 #include "sad.h"
 
 static snd_pcm_t *hdl;
-static snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
 static int framesize;
 static const char *device = "default"; /* TODO: make configurable? */
 
@@ -63,12 +62,14 @@ err0:
 static int
 alsaopen(int bits, int rate, int channels)
 {
+	snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
 	int r;
 
 	if ((r = snd_pcm_open(&hdl, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
 		warnx("snd_pcm_open: %s\n", snd_strerror(r));
 		return -1;
 	}
+
 	if ((r = snd_pcm_set_params(hdl, format, SND_PCM_ACCESS_RW_INTERLEAVED,
 	     channels, rate, 1, 500000)) < 0) {
 		warnx("send_pcm_set_params: %s\n", snd_strerror(r));