[pulseaudio-discuss] [PATCH 1/4] Added libsoxr resampler backend.

Andrey Semashev andrey.semashev at gmail.com
Wed Nov 12 03:57:24 PST 2014


On Wed, Nov 12, 2014 at 1:15 PM, Peter Meerwald <pmeerw at pmeerw.net> wrote:
>
>> +    switch (r->work_format) {
>> +        case PA_SAMPLE_S16NE:
>> +            io_format = SOXR_INT16_I;
>> +            break;
>> +        case PA_SAMPLE_S32NE:
>> +            io_format = SOXR_INT32_I;
>> +            break;
>
> currently work_format is either S16NE or FLOAT32NE;
> I think more work is needed to add S32NE as a work format

Yes, I found that out when I was adding this backend to the general
code in resampler.c. I decided to leave this case nevertheless, so
that if resampler.c is enhanced, soxr backend doesn't need any
changes.

If that's considered unneeded clutter I can remove it no problem.

>> +        case PA_SAMPLE_FLOAT32NE:
>> +            io_format = SOXR_FLOAT32_I;
>> +            break;
>> +        default:
>> +            pa_assert(0 && "Unsupported sample format for libsoxr");
>> +            return -1;
>> +    }
>> +
>> +    io_spec = soxr_io_spec(io_format, io_format);
>> +
>> +    switch (r->method) {
>> +        case PA_RESAMPLER_SOXR_LQ:
>> +            quality_recipe = SOXR_LQ | SOXR_LINEAR_PHASE;
>> +            break;
>> +        case PA_RESAMPLER_SOXR_MQ:
>> +            quality_recipe = SOXR_MQ | SOXR_LINEAR_PHASE;
>> +            break;
>> +        case PA_RESAMPLER_SOXR_VHQ:
>> +            quality_recipe = SOXR_VHQ | SOXR_LINEAR_PHASE;
>> +            break;
>> +        default:
>> +            pa_assert(0 && "Unexpected libsoxr resampling method");
>
> 0 && ???

It's a common approach for injecting a message into the assertion
failure. The C runtime typically displays the condition that fails,
and in this case it will include the message. It helps debugging.


More information about the pulseaudio-discuss mailing list