Eric Wong <normalper...@yhbt.net> writes:

> Jan Stary <h...@stare.cz> wrote:
>> Hi Eric,
>> 
>> recently, Alex Ratchov (of OpenBSD's sndio) has added a diff
>> to src/sndio.c that enables a finer setting of the desired
>> parameters of the underlying audio (namely, bit width).
>> 
>> Currently, the diff (attached) exists as a patch to the OpenBSD
>> port of SoX (which I maintain). Would you please consider
>> incorporating this change into SoX directly?
>
> Hi Jan,
>
> Seems reasonable; but I have little experience with using sndio
> with Måns sox, much less the API.  Perhaps Måns has an opinion,
> too.

None of my changes should have any impact on this.

> Fwiw, it would be helpful if example files could be
> provided/generated showing where the improvement is.

I'm not familiar with sndio, but it looks like it changes how 24-bit
samples are passed, packed rather than padded to 32 bits.

The patch looks sane, and if OpenBSD is anyway building with this, it's
probably good to pick it up.

>> $OpenBSD$
>> --- 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)

-- 
Måns Rullgård

------------------------------------------------------------------------------
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel

Reply via email to