aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/panning.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-03-31 18:54:43 -0700
committerChris Robinson <[email protected]>2019-03-31 18:54:43 -0700
commitc88b09170cd5cebf7c64b283fa8dbec4d2f6d29e (patch)
tree3fc2b032018b7a656b17b4deefd6a92569d105ea /Alc/panning.cpp
parentd8c76ba0c06b49ef73697390594f7359cc9e7e71 (diff)
Use phase correction for the front stablizer
Diffstat (limited to 'Alc/panning.cpp')
-rw-r--r--Alc/panning.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/Alc/panning.cpp b/Alc/panning.cpp
index f8ca7149..34984c94 100644
--- a/Alc/panning.cpp
+++ b/Alc/panning.cpp
@@ -27,6 +27,7 @@
#include <cassert>
#include <cmath>
+#include <chrono>
#include <numeric>
#include <algorithm>
#include <functional>
@@ -54,6 +55,8 @@ constexpr std::array<int,MAX_AMBI_CHANNELS> AmbiIndex::From3D;
namespace {
using namespace std::placeholders;
+using std::chrono::seconds;
+using std::chrono::nanoseconds;
inline const char *GetLabelFromChannel(Channel channel)
{
@@ -850,12 +853,16 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, HrtfRequestMode hrtf_appr
stablizer->LFilter.init(scale);
stablizer->RFilter = stablizer->LFilter;
- /* Initialize all-pass filters for all other channels. */
- stablizer->APFilter[0].init(scale);
- std::fill(std::begin(stablizer->APFilter)+1, std::end(stablizer->APFilter),
- stablizer->APFilter[0]);
+ /* Initialize an all-pass filter for the phase corrector. */
+ stablizer->APFilter.init(scale);
device->Stablizer = std::move(stablizer);
+ /* NOTE: Don't know why this has to be "copied" into a local
+ * static constexpr variable to avoid a reference on
+ * FrontStablizer::DelayLength...
+ */
+ static constexpr size_t StablizerDelay{FrontStablizer::DelayLength};
+ device->FixedLatency += nanoseconds{seconds{StablizerDelay}} / device->Frequency;
}
break;
case DevFmtMono: