-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCircularBuffer.hpp
More file actions
43 lines (28 loc) · 872 Bytes
/
CircularBuffer.hpp
File metadata and controls
43 lines (28 loc) · 872 Bytes
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
//
// CircularBuffer.hpp
//
// Created by Squishy on 14/02/2018.
//
// If you use this, please credit me :)
#ifndef CircularBuffer_hpp
#define CircularBuffer_hpp
#include <cmath>
#include <vector>
typedef std::vector<float> Vec_Float;
enum Selector{upperBound, lowerBound};
enum InterType{cubic, linear};
class CircularBuffer{
Vec_Float buffer;
int bufferLength, head, tail;
public:
CircularBuffer(float inValue);
float read(float numElementsToRead, InterType inValue);
float readCubic(float numElementsToRead);
float readLinear(float numElementsToRead);
void write(float inValue);
float cubicInterpolation(double y0, double y1, double y2, double y3, double mu);
float getSample(float inValue);
void setBufferLength(float inValue);
int getBufferLength();
};
#endif /* CircularBuffer_hpp */