diff options
author | Chris Robinson <[email protected]> | 2020-05-08 01:25:32 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-05-08 01:25:32 -0700 |
commit | 48fbad98369861985109764a530bc789e3a72170 (patch) | |
tree | 220e3af87e8f82af7cadd61d09a76c094089b8f2 | |
parent | 301f8f5db5b9dd43ed2ef8c6628c2adf7ce4944c (diff) |
Slightly improve the Hann windows
There's no need to include the 0 terms on the ends since they'll never
contribute a sample. So extend the width to have the 0 terms just outside the
window where it wouldn't contribute anyway.
-rw-r--r-- | alc/effects/fshifter.cpp | 4 | ||||
-rw-r--r-- | alc/effects/pshifter.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/alc/effects/fshifter.cpp b/alc/effects/fshifter.cpp index 1e7d1962..2ad98231 100644 --- a/alc/effects/fshifter.cpp +++ b/alc/effects/fshifter.cpp @@ -50,8 +50,8 @@ std::array<double,HIL_SIZE> InitHannWindow() /* Create lookup table of the Hann window for the desired size, i.e. HIL_SIZE */ for(size_t i{0};i < HIL_SIZE>>1;i++) { - constexpr double scale{al::MathDefs<double>::Pi() / double{HIL_SIZE-1}}; - const double val{std::sin(static_cast<double>(i) * scale)}; + constexpr double scale{al::MathDefs<double>::Pi() / double{HIL_SIZE}}; + const double val{std::sin(static_cast<double>(i+1) * scale)}; ret[i] = ret[HIL_SIZE-1-i] = val * val; } return ret; diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp index 375681df..a91fd2fb 100644 --- a/alc/effects/pshifter.cpp +++ b/alc/effects/pshifter.cpp @@ -56,8 +56,8 @@ std::array<double,STFT_SIZE> InitHannWindow() /* Create lookup table of the Hann window for the desired size, i.e. STFT_SIZE */ for(size_t i{0};i < STFT_SIZE>>1;i++) { - constexpr double scale{al::MathDefs<double>::Pi() / double{STFT_SIZE-1}}; - const double val{std::sin(static_cast<double>(i) * scale)}; + constexpr double scale{al::MathDefs<double>::Pi() / double{STFT_SIZE}}; + const double val{std::sin(static_cast<double>(i+1) * scale)}; ret[i] = ret[STFT_SIZE-1-i] = val * val; } return ret; |