From f2bc24f76152837904fc5ff72f032c234302d584 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 8 Feb 2020 22:39:32 -0800 Subject: [PATCH] Consistently use distant wavefronts for 0 distance --- alc/alu.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/alc/alu.cpp b/alc/alu.cpp index 27075477..00d6dade 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -1138,13 +1138,10 @@ void CalcPanningAndFilters(ALvoice *voice, const ALfloat xpos, const ALfloat ypo { if(Device->AvgSpeakerDist > 0.0f) { - /* If the source distance is 0, set w0 to w1 to act as a pass- - * through. We still want to pass the signal through the - * filters so they keep an appropriate history, in case the - * source moves away from the listener. + /* If the source distance is 0, simulate a plane-wave by using + * infinite distance, which results in a w0 of 0. */ - const ALfloat w0{SPEEDOFSOUNDMETRESPERSEC / (Device->AvgSpeakerDist * Frequency)}; - + constexpr float w0{0.0f}; for(ALuint c{0};c < num_channels;c++) voice->mChans[c].mDryParams.NFCtrlFilter.adjust(w0);