shithub: sox

Download patch

ref: 5ed1edc8dfe52f5d8f788330558ed2e6e8bee5f7
parent: b221c992310f1758c2ece6a2d49cb2d047a57be6
author: Alexandre Ratchov <alex@caoua.org>
date: Tue Sep 20 18:00:40 EDT 2016

sndio: handle 24-bit samples properly on OpenBSD

Reported-by: Jan Stary <hans@stare.cz>
cf. http://marc.info/?l=openbsd-ports&m=147395657332262&w=2

--- a/src/sndio.c
+++ b/src/sndio.c
@@ -113,8 +113,6 @@
     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 @@
   }
   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)