OpenShot Audio Library | OpenShotAudio  0.6.0
juce_Windowing.h
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2022 - Raw Material Software Limited
6 
7  JUCE is an open source library subject to commercial or open-source
8  licensing.
9 
10  By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11  Agreement and JUCE Privacy Policy.
12 
13  End User License Agreement: www.juce.com/juce-7-licence
14  Privacy Policy: www.juce.com/juce-privacy-policy
15 
16  Or: You may also use this code under the terms of the GPL v3 (see
17  www.gnu.org/licenses).
18 
19  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21  DISCLAIMED.
22 
23  ==============================================================================
24 */
25 
26 namespace juce::dsp
27 {
28 
39 template <typename FloatType>
40 class JUCE_API WindowingFunction
41 {
42 public:
43  //==============================================================================
46  {
47  rectangular = 0,
48  triangular,
49  hann,
50  hamming,
51  blackman,
52  blackmanHarris,
53  flatTop,
54  kaiser,
55  numWindowingMethods
56  };
57 
58  //==============================================================================
64  WindowingFunction (size_t size, WindowingMethod,
65  bool normalise = true, FloatType beta = 0);
66 
67  //==============================================================================
78  void fillWindowingTables (size_t size, WindowingMethod type,
79  bool normalise = true, FloatType beta = 0) noexcept;
80 
91  static void fillWindowingTables (FloatType* samples, size_t size, WindowingMethod,
92  bool normalise = true, FloatType beta = 0) noexcept;
93 
95  void multiplyWithWindowingTable (FloatType* samples, size_t size) const noexcept;
96 
98  static const char* getWindowingMethodName (WindowingMethod) noexcept;
99 
100 
101 private:
102  //==============================================================================
103  Array<FloatType> windowTable;
104 
105  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WindowingFunction)
106 };
107 
108 } // namespace juce::dsp