36 soxr_datatype_t type =
46 soxr_io_spec_t io_spec = soxr_io_spec(type, type);
48 soxr_quality_spec_t q_spec = soxr_quality_spec((
int)((precision-2)/4), (SOXR_HI_PREC_CLOCK|SOXR_ROLLOFF_NONE)*!!cheby);
49 q_spec.precision = linear? 0 : precision;
50 #if !defined SOXR_VERSION
51 q_spec.bw_pc = cutoff?
FFMAX(
FFMIN(cutoff,.995),.8)*100 : q_spec.bw_pc;
53 q_spec.passband_end = cutoff?
FFMAX(
FFMIN(cutoff,.995),.8) : q_spec.passband_end;
56 soxr_delete((soxr_t)c);
58 soxr_create(in_rate, out_rate, 0, &error, &io_spec, &q_spec, 0);
65 soxr_delete((soxr_t)*c);
76 AudioData *src,
int src_size,
int *consumed){
78 soxr_error_t error = soxr_set_error((soxr_t)c, soxr_set_num_channels((soxr_t)c, src->
ch_count));
79 error = soxr_process((soxr_t)c, src->
ch, (
size_t)src_size,
80 &idone, dst->
ch, (
size_t)dst_size, &odone);
81 *consumed = (int)idone;
82 return error? -1 : odone;
87 return (int64_t)(delay_s * base + .5);