From 7ccb9b11e6033d0ee3d8351a42d4c18318c61634 Mon Sep 17 00:00:00 2001 From: waker Date: Sun, 9 Jan 2011 19:21:26 +0100 Subject: alsa: set default format if attempted to start playback without prior setformat call --- plugins/alsa/alsa.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'plugins/alsa') diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c index 89d66ad0..8c66c1fa 100644 --- a/plugins/alsa/alsa.c +++ b/plugins/alsa/alsa.c @@ -117,6 +117,15 @@ palsa_set_hw_params (ddb_waveformat_t *fmt) { snd_pcm_hw_params_t *hw_params = NULL; int err = 0; + if (!fmt->channels) { + // generic format + fmt->bps = 16; + fmt->is_float = 0; + fmt->channels = 2; + fmt->samplerate = 44100; + fmt->channelmask = 3; + } + if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0) { fprintf (stderr, "cannot allocate hardware parameter structure (%s)\n", snd_strerror (err)); -- cgit v1.2.3