-
Notifications
You must be signed in to change notification settings - Fork 0
/
Window.h
50 lines (40 loc) · 976 Bytes
/
Window.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*****
*
* Window.h
* Abstraction of the window used for the grains
* Only one instance of this will be created in render.cpp
* and subsequently passed to all the Voices/Grains
*****/
#include <cmath>
#include <array>
#include "Constants.h"
class Window {
public:
// Create a hann window of max length
Window();
// Create a Hann window
Window(int length);
// Set length
void setLength(int length);
// Window types
enum WindowType {
hann = 0,
tukey,
gaussian,
trapezoidal
};
// Update window type
void updateWindow(int length, int type, float modifier);
// Getter for window array data at index
float getAt(int index);
~Window();
private:
// Length in samples
int length = 0;
// Current window type
WindowType windowType = hann;
// Modifier for Tukey, Gaussian and trapezoidal windows
float modifier = 0.0f;
// Array for windowData
std::array<float, MAX_GRAIN_LENGTH> window = {};
};