From 80281c8e1bd9cf991cee3e63450d65b814b051d6 Mon Sep 17 00:00:00 2001
From: oparviai
Date: Thu, 7 Sep 2017 17:04:02 +0000
Subject: [PATCH] Disable anti-alias filter if
SOUNDTOUCH_PREVENT_CLICK_AT_RATE_CROSSOVER is defined
---
README.html | 9 +++++++++
source/SoundTouch/RateTransposer.cpp | 11 ++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/README.html b/README.html
index cdb43a8..3d733e2 100644
--- a/README.html
+++ b/README.html
@@ -573,6 +573,13 @@ this corresponds to lowering the pitch by -0.318 semitones:
5. Change History
5.1. SoundTouch library Change History
+ 2.0.1pre:
+
+ - Disable anti-alias filter when switch
+ SOUNDTOUCH_PREVENT_CLICK_AT_RATE_CROSSOVER defined because anti-alias
+ filter cause slight click if the rate change crosses zero during
+ processing
+
2.0:
- Added functions to get initial processing latency, duration ratio between the original input and processed output tracks, and clarified reporting of input/output batch sizes
@@ -855,6 +862,7 @@ submitted bugfixes:
- Jason Garland
- Takashi Iwai
- Thomas Klausner
+ - Lu Zhihe
- Tony Mechelynck
- Mathias Möhl
- Yuval Naveh
@@ -872,6 +880,7 @@ submitted bugfixes:
- Tyson Smith
- John Stumpo
- Katja Vetter
+ - Wu Q.
Moral greetings to all other contributors and users also!
diff --git a/source/SoundTouch/RateTransposer.cpp b/source/SoundTouch/RateTransposer.cpp
index 926adc6..6cedfa9 100644
--- a/source/SoundTouch/RateTransposer.cpp
+++ b/source/SoundTouch/RateTransposer.cpp
@@ -57,7 +57,13 @@ TransposerBase::ALGORITHM TransposerBase::algorithm = TransposerBase::CUBIC;
// Constructor
RateTransposer::RateTransposer() : FIFOProcessor(&outputBuffer)
{
- bUseAAFilter = true;
+ bUseAAFilter =
+#ifndef SOUNDTOUCH_PREVENT_CLICK_AT_RATE_CROSSOVER
+ true;
+#else
+ // Disable Anti-alias filter if desirable to avoid click at rate change zero value crossover
+ false;
+#endif
// Instantiates the anti-alias filter
pAAFilter = new AAFilter(64);
@@ -77,7 +83,10 @@ RateTransposer::~RateTransposer()
/// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable
void RateTransposer::enableAAFilter(bool newMode)
{
+#ifndef SOUNDTOUCH_PREVENT_CLICK_AT_RATE_CROSSOVER
+ // Disable Anti-alias filter if desirable to avoid click at rate change zero value crossover
bUseAAFilter = newMode;
+#endif
}