Take into account encoding's bits_per_sample. Fixes recording

of 24-bit files. Tested by many.
This commit is contained in:
ratchov 2016-09-21 11:40:14 +00:00
parent ae8b155135
commit a07bc20c85
2 changed files with 27 additions and 2 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.66 2016/09/20 10:16:27 sthen Exp $
# $OpenBSD: Makefile,v 1.67 2016/09/21 11:40:14 ratchov Exp $
BROKEN-hppa = bend.c:155:12: internal compiler error: in expand_expr_addr_expr_1, at expr.c:7697
COMMENT= Sound eXchange, the Swiss Army knife of audio manipulation
DISTNAME= sox-14.4.2
REVISION= 0
REVISION= 1
SHARED_LIBS += sox 4.0 # 3.0
CATEGORIES= audio

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-src_sndio_c,v 1.1 2016/09/21 11:40:14 ratchov Exp $
--- src/sndio.c.orig Mon Jan 30 04:01:44 2012
+++ src/sndio.c Tue Feb 9 23:23:00 2016
@@ -113,8 +113,6 @@ static int startany(sox_format_t *ft, unsigned mode)
else
reqpar.rchan = ft->signal.channels;
}
- if (ft->signal.precision > 0)
- reqpar.bits = ft->signal.precision;
switch (ft->encoding.encoding) {
case SOX_ENCODING_SIGN2:
reqpar.sig = 1;
@@ -127,6 +125,12 @@ static int startany(sox_format_t *ft, unsigned mode)
}
if (ft->encoding.bits_per_sample > 0)
reqpar.bits = ft->encoding.bits_per_sample;
+ else if (ft->signal.precision > 0)
+ reqpar.bits = ft->signal.precision;
+ else
+ reqpar.bits = SOX_DEFAULT_PRECISION;
+ reqpar.bps = (reqpar.bits + 7) / 8;
+ reqpar.msb = 1;
if (ft->encoding.reverse_bytes != sox_option_default) {
reqpar.le = SIO_LE_NATIVE;
if (ft->encoding.reverse_bytes)