From 8088469eca2ee5886f0a42b33059371cb95831c8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 11 Jan 2017 15:30:30 +0100 Subject: [PATCH] pcm/Convert: add method Reset() --- src/pcm/PcmConvert.cxx | 11 +++++++++++ src/pcm/PcmConvert.hxx | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/src/pcm/PcmConvert.cxx b/src/pcm/PcmConvert.cxx index 0d589eb71..6658a48c6 100644 --- a/src/pcm/PcmConvert.cxx +++ b/src/pcm/PcmConvert.cxx @@ -117,6 +117,17 @@ PcmConvert::Close() #endif } +void +PcmConvert::Reset() +{ + if (enable_resampler) + resampler.Reset(); + +#ifdef ENABLE_DSD + dsd.Reset(); +#endif +} + ConstBuffer PcmConvert::Convert(ConstBuffer buffer) { diff --git a/src/pcm/PcmConvert.hxx b/src/pcm/PcmConvert.hxx index dbb16ee87..617348cac 100644 --- a/src/pcm/PcmConvert.hxx +++ b/src/pcm/PcmConvert.hxx @@ -67,6 +67,11 @@ public: */ void Close(); + /** + * Reset the filter's state, e.g. drop/flush buffers. + */ + void Reset(); + /** * Converts PCM data between two audio formats. *