commit 9654660fdca4a2fa15760d1d0f02d451a6569f9a
parent bbd9cf770210867313083db042728dbcda1a67d7
Author: sin <sin@2f30.org>
Date: Wed, 31 Dec 2014 17:50:24 +0000
No need to keep format global
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git 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));