blob: 334c0484f2b88cc46b5e2d22b635e8c79acdbab9 (
plain)
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
|
#ifndef SAMPLEBUFFER_HPP_
#define SAMPLEBUFFER_HPP_
#include <array>
#include <cstdint>
using Sample = uint16_t;
// gives 8000 (8192)
constexpr unsigned int MAX_SAMPLE_BUFFER_BYTESIZE = 16384;
constexpr unsigned int MAX_SAMPLE_BUFFER_SIZE = MAX_SAMPLE_BUFFER_BYTESIZE / sizeof(Sample);
class SampleBuffer
{
public:
SampleBuffer(Sample *buffer);
void clear();
void modify(Sample *data, unsigned int srcsize);
void midmodify(Sample *data, unsigned int srcsize);
Sample *modified();
Sample *data();
Sample *middata();
uint8_t *bytedata();
void setSize(unsigned int size);
unsigned int size() const;
unsigned int bytesize() const;
private:
Sample *m_buffer = nullptr;
unsigned int m_size = MAX_SAMPLE_BUFFER_SIZE;
Sample *m_modified = nullptr;
};
#endif // SAMPLEBUFFER_HPP_
|