From e645d25b62f3c9d465d6750fa86c620615d41999 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 6 Jan 2019 00:54:39 -0800 Subject: Use double-precision biquads for the HRTF shelf filters --- Alc/hrtf.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Alc') diff --git a/Alc/hrtf.cpp b/Alc/hrtf.cpp index 50c5c459..2b66d2f7 100644 --- a/Alc/hrtf.cpp +++ b/Alc/hrtf.cpp @@ -313,17 +313,17 @@ void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALsiz }; std::transform(AmbiPoints, AmbiPoints+AmbiCount, idx.begin(), calc_idxs); - const ALfloat xover_norm{400.0f / (ALfloat)Hrtf->sampleRate}; + const ALdouble xover_norm{400.0 / Hrtf->sampleRate}; const ALsizei order_limit{OrderFromChan[NumChannels-1] + 1}; - BiquadFilter shelf[MAX_AMBI_ORDER+1]; + BiquadFilterR shelf[MAX_AMBI_ORDER+1]; for(ALsizei o{0};o < order_limit;++o) { - const ALfloat g{std::sqrt(AmbiOrderHFGain[o])}; - shelf[o].setParams(BiquadType::HighShelf, g, xover_norm, calc_rcpQ_from_slope(g, 1.0f)); + const auto g = std::sqrt(double{AmbiOrderHFGain[o]}); + shelf[o].setParams(BiquadType::HighShelf, g, xover_norm, calc_rcpQ_from_slope(g, 1.0)); } al::vector,HRIR_LENGTH>> tmpres(NumChannels); - al::vector> tmpfilt(order_limit+1); + al::vector> tmpfilt(order_limit+1); for(ALsizei c{0};c < AmbiCount;++c) { const ALfloat (*fir)[2]{&Hrtf->coeffs[idx[c] * Hrtf->irSize]}; @@ -351,7 +351,7 @@ void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALsiz */ auto tmpfilt_iter = std::transform(fir, fir+Hrtf->irSize, tmpfilt.back().begin(), [](const ALfloat (&ir)[2]) noexcept { return ir[0]; }); - std::fill(tmpfilt_iter, tmpfilt.back().end(), 0.0f); + std::fill(tmpfilt_iter, tmpfilt.back().end(), 0.0); for(ALsizei o{0};o < order_limit;++o) { shelf[o].clear(); @@ -372,7 +372,7 @@ void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALsiz */ tmpfilt_iter = std::transform(fir, fir+Hrtf->irSize, tmpfilt.back().begin(), [](const ALfloat (&ir)[2]) noexcept { return ir[1]; }); - std::fill(tmpfilt_iter, tmpfilt.back().end(), 0.0f); + std::fill(tmpfilt_iter, tmpfilt.back().end(), 0.0); for(ALsizei o{0};o < order_limit;++o) { shelf[o].clear(); -- cgit v1.2.3