diff options
author | Rob Sykes <robs@users.sourceforge.net> | 2015-08-27 22:34:24 +0300 |
---|---|---|
committer | Rob Sykes <robs@users.sourceforge.net> | 2015-08-27 22:34:24 +0300 |
commit | 8abe8c8ab863e213f2903f05398f6739ec738214 (patch) | |
tree | ade700cdbd2d5205f87c62adf51ebab453100c85 | |
parent | 559dd4739bc4f001afed32b35b9db9776a503031 (diff) |
fix crash when using soxr_process after calling soxr_clear
-rw-r--r-- | src/soxr.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -67,6 +67,8 @@ struct soxr { +#define RESET_ON_CLEAR (1u<<31) + /* TODO: these should not be here. */ #define TO_3dB(a) ((1.6e-6*a-7.5e-4)*a+.646) #define LOW_Q_BW0 (1385 / 2048.) /* 0.67625 rounded to be a FP exact. */ @@ -81,6 +83,7 @@ soxr_quality_spec_t soxr_quality_spec(unsigned long recipe, unsigned long flags) p->e = "invalid quality type"; return spec; } + flags |= quality < SOXR_LSR0Q? RESET_ON_CLEAR : 0; if (quality == 13) quality = 6; else if (quality > 10) @@ -406,7 +409,8 @@ soxr_error_t soxr_clear(soxr_t p) /* TODO: this, properly. */ memcpy(p->control_block, tmp.control_block, sizeof(p->control_block)); p->deinterleave = tmp.deinterleave; p->interleave = tmp.interleave; - return 0; + return (p->q_spec.flags & RESET_ON_CLEAR)? + soxr_set_io_ratio(p, tmp.io_ratio, 0) : 0; } return "invalid soxr_t pointer"; } |