ref: ac4b489228cf6e3c48aab8e0a837ddaa4fea1941
parent: c44b990dd6098f809d2cacca846cefe1d850f040
author: robs <robs>
date: Wed Sep 9 16:08:17 EDT 2009
Try default ALSA record encoding parameters
--- a/ChangeLog
+++ b/ChangeLog
@@ -37,6 +37,8 @@
Audio device drivers:
o Add native windows audio output driver. (Pavel Karneliuk)
+ o Try default ALSA record encoding parameters if those given
+ are invalid (would previously fail). (robs)
Effects:
--- a/src/alsa.c
+++ b/src/alsa.c
@@ -34,8 +34,12 @@
{
unsigned does[3], i, j, k = (*bits >> 3) - 1;
- if (k > 2 || (*e != SOX_ENCODING_SIGN2 && *e != SOX_ENCODING_UNSIGNED))
- return -1;
+ if (k > 2 || (*e != SOX_ENCODING_SIGN2 && *e != SOX_ENCODING_UNSIGNED)) {
+ lsx_warn("invalid encoding; trying 24-bit signed");
+ *bits = 24;
+ *e = SOX_ENCODING_SIGN2;
+ k = 2;
+ }
for (i = 0; i < 3; ++i) for (does[i] = 0, j = 0; j < 2; ++j)
does[i] |= snd_pcm_format_mask_test(mask, encs[j][i]);
if (!does[k])