From c68ed40661f8077557748b6a00fa40d10bd19f74 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 2 Jan 2018 19:07:45 +0100 Subject: [PATCH] pcm/SoxrResampler: implement method Reset() --- NEWS | 2 ++ src/pcm/SoxrResampler.cxx | 8 ++++++++ src/pcm/SoxrResampler.hxx | 1 + 3 files changed, 11 insertions(+) diff --git a/NEWS b/NEWS index 7107eeb31..3788d63a5 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.20.15 (not yet released) +* resampler + - soxr: clear internal state after manual song change * state file - make mount point restore errors non-fatal - fix crash when restoring mounts with incompatible database plugin diff --git a/src/pcm/SoxrResampler.cxx b/src/pcm/SoxrResampler.cxx index 621d3f970..868ad59fd 100644 --- a/src/pcm/SoxrResampler.cxx +++ b/src/pcm/SoxrResampler.cxx @@ -139,6 +139,14 @@ SoxrPcmResampler::Close() soxr_delete(soxr); } +void +SoxrPcmResampler::Reset() +{ +#if SOXR_THIS_VERSION >= SOXR_VERSION(0,1,2) + soxr_clear(soxr); +#endif +} + ConstBuffer SoxrPcmResampler::Resample(ConstBuffer src) { diff --git a/src/pcm/SoxrResampler.hxx b/src/pcm/SoxrResampler.hxx index 0be861179..9f3114a47 100644 --- a/src/pcm/SoxrResampler.hxx +++ b/src/pcm/SoxrResampler.hxx @@ -41,6 +41,7 @@ class SoxrPcmResampler final : public PcmResampler { public: AudioFormat Open(AudioFormat &af, unsigned new_sample_rate) override; void Close() override; + void Reset() override; ConstBuffer Resample(ConstBuffer src) override; };