EchoMap 2026-07-25 6d3977c
An experimental cross-platform digital signal processing application for sound-source localisation.
Loading...
Searching...
No Matches
echomap::WindowFunctions Class Reference

Aggregation of callable DSP window functions. More...

#include <WindowFunctions.hpp>

Classes

struct  Constant
 The Constant invocable window function. More...
struct  Hann
 The Hann raised-cosine window. More...
struct  Hamming
 The Hamming raised-cosine window. More...
struct  Bartlett
 The Bartlett triangular window. More...
struct  Blackman
 The Blackman cosine-sum window. More...
struct  BlackmanHarris
 The minimum four-term Blackman-Harris cosine-sum window. More...
struct  Welch
 The Welch parabolic window. More...
struct  NameGetter
 Provides a callable type for statically invoking the name getter. More...

Public Types

using AllFunctions = std::variant<Constant, Hann, Hamming, Bartlett, Blackman, BlackmanHarris, Welch>

Static Public Member Functions

template<class WindowT, class BuffersT, class InputT>
static float apply_window (BuffersT &buffers, const InputT &input)
template<WindowFunction>
static constexpr std::string_view get_window_name ()
 Retrieve a human-readable name for the templated window function.

Detailed Description

Aggregation of callable DSP window functions.

For some common examples, see https://en.wikipedia.org/wiki/Window_function#Examples_of_window_functions.

Definition at line 32 of file WindowFunctions.hpp.

Member Typedef Documentation

◆ AllFunctions

using echomap::WindowFunctions::AllFunctions = std::variant<Constant, Hann, Hamming, Bartlett, Blackman, BlackmanHarris, Welch>

Definition at line 285 of file WindowFunctions.hpp.

Member Function Documentation

◆ apply_window()

template<class WindowT, class BuffersT, class InputT>
float echomap::WindowFunctions::apply_window ( BuffersT & buffers,
const InputT & input )
inlinestatic

Definition at line 39 of file WindowFunctions.hpp.

43 {
44 using Window = std::remove_cvref_t<WindowT>;
45 static_assert(WindowFunction<Window>, "WindowT does not satisfy WindowFunction.");
46
47 float scale_divisor = 0.0f;
48
49 for (std::size_t index = 0; index < buffers.input_size; ++index) {
50 const float window_value = Window{}(index, buffers.input_size);
51 scale_divisor += window_value;
52 buffers.input[index] = input[index] * window_value;
53 }
54
55 return scale_divisor;
56 }

◆ get_window_name()

template<WindowFunction>
constexpr std::string_view echomap::WindowFunctions::get_window_name ( )
inlinestaticconstexpr

Retrieve a human-readable name for the templated window function.

Returns
A NULL-terminated static non-owning view of the name.

Definition at line 292 of file WindowFunctions.hpp.

293 {
294 // ReSharper disable once CppStaticAssertFailure
295 static_assert(false, "Missing window function name.");
296 return {};
297 }

The documentation for this class was generated from the following file: