49 | 49 |
void (* soxr_delete)(soxr_t);
|
50 | 50 |
soxr_error_t (* soxr_process)(soxr_t, soxr_in_t, size_t, size_t *, soxr_out_t, size_t olen, size_t *);
|
51 | 51 |
size_t *(* soxr_num_clips)(soxr_t);
|
|
52 |
#if RESAMPLE_OPENMP
|
52 | 53 |
soxr_runtime_spec_t (* soxr_runtime_spec)(unsigned num_threads);
|
|
54 |
#endif
|
53 | 55 |
// soxr_strerror is a macro so not included here
|
54 | 56 |
#endif
|
55 | 57 |
};
|
|
175 | 177 |
|
176 | 178 |
soxr_io_spec_t io_spec;
|
177 | 179 |
soxr_quality_spec_t q_spec;
|
|
180 |
soxr_error_t error;
|
|
181 |
#if RESAMPLE_OPENMP
|
178 | 182 |
soxr_runtime_spec_t r_spec;
|
179 | |
soxr_error_t error;
|
|
183 |
#endif
|
180 | 184 |
|
181 | 185 |
LOG_INFO("resampling from %u -> %u", raw_sample_rate, outrate);
|
182 | 186 |
|
|
197 | 201 |
q_spec.phase_response = r->q_phase_response;
|
198 | 202 |
}
|
199 | 203 |
|
|
204 |
#if RESAMPLE_OPENMP
|
200 | 205 |
r_spec = SOXR(r, runtime_spec, 0); // make use of libsoxr OpenMP support allowing parallel execution if multiple cores
|
|
206 |
#endif
|
201 | 207 |
|
202 | 208 |
LOG_DEBUG("resampling with soxr_quality_spec_t[precision: %03.1f, passband_end: %03.6f, stopband_begin: %03.6f, "
|
203 | 209 |
"phase_response: %03.1f, flags: 0x%02x], soxr_io_spec_t[scale: %03.2f]", q_spec.precision,
|
204 | 210 |
q_spec.passband_end, q_spec.stopband_begin, q_spec.phase_response, q_spec.flags, io_spec.scale);
|
205 | 211 |
|
206 | |
r->resampler = SOXR(r, create, raw_sample_rate, outrate, 2, &error, &io_spec, &q_spec, &r_spec);
|
|
212 |
r->resampler = SOXR(r, create, raw_sample_rate, outrate, 2, &error, &io_spec, &q_spec,
|
|
213 |
#if RESAMPLE_OPENMP
|
|
214 |
&r_spec
|
|
215 |
#else
|
|
216 |
NULL
|
|
217 |
#endif
|
|
218 |
);
|
207 | 219 |
if (error) {
|
208 | 220 |
LOG_INFO("soxr_create error: %s", soxr_strerror(error));
|
209 | 221 |
return false;
|
|
238 | 250 |
|
239 | 251 |
r->soxr_io_spec = dlsym(handle, "soxr_io_spec");
|
240 | 252 |
r->soxr_quality_spec = dlsym(handle, "soxr_quality_spec");
|
241 | |
r->soxr_runtime_spec = dlsym(handle, "soxr_runtime_spec");
|
242 | 253 |
r->soxr_create = dlsym(handle, "soxr_create");
|
243 | 254 |
r->soxr_delete = dlsym(handle, "soxr_delete");
|
244 | 255 |
r->soxr_process = dlsym(handle, "soxr_process");
|
245 | 256 |
r->soxr_num_clips = dlsym(handle, "soxr_num_clips");
|
|
257 |
#if RESAMPLE_OPENMP
|
|
258 |
r->soxr_runtime_spec = dlsym(handle, "soxr_runtime_spec");
|
|
259 |
#endif
|
246 | 260 |
|
247 | 261 |
if ((err = dlerror()) != NULL) {
|
248 | 262 |
LOG_INFO("dlerror: %s", err);
|