Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/alexmarsev/soxr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Sykes <robs@users.sourceforge.net>2015-08-27 22:34:24 +0300
committerRob Sykes <robs@users.sourceforge.net>2015-08-27 22:34:24 +0300
commit8abe8c8ab863e213f2903f05398f6739ec738214 (patch)
treeade700cdbd2d5205f87c62adf51ebab453100c85
parent559dd4739bc4f001afed32b35b9db9776a503031 (diff)
fix crash when using soxr_process after calling soxr_clear
-rw-r--r--src/soxr.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/soxr.c b/src/soxr.c
index 36b0251..dc61ad9 100644
--- a/src/soxr.c
+++ b/src/soxr.c
@@ -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";
}