-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCDpcmStorage.h
45 lines (37 loc) · 1.01 KB
/
CDpcmStorage.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
#pragma once
// Simple DPCM data storage for DPCM data prodivers
// Owns all added audio samples
#include <vector>
#include <map>
#include <cstdint>
#include <cstddef>
#include "DClass.h"
#include "CDpcmSample.h"
namespace PurrFX
{
class CDpcmStorage
{
CLASS_MAKE_NON_COPYABLE(CDpcmStorage)
CLASS_DISABLE_DEFAULT_CONSTRUCTOR(CDpcmStorage)
public:
CDpcmStorage(bool i_bUseClassicAccessMode);
~CDpcmStorage();
void add(CDpcmSample* i_pSample);
// For classic access mode
const CDpcmSample* get(uint8_t i_nAddress, uint8_t i_nLength) const;
// For modern access mode
const CDpcmSample* get() const;
const bool del(size_t i_nIndex);
size_t size() const;
bool setCurrent(size_t i_nIndex);
private:
uint16_t key(uint8_t i_nAddress, uint8_t i_nLength) const;
bool m_bUseClassicAccessMode = false;
// Modern access
std::vector<CDpcmSample*> m_aSamples;
bool m_bIsCurrentIndexSet = false;
size_t m_nCurrentIndex = 0;
// Classic access
std::map<uint16_t, CDpcmSample*> m_mSamples;
};
}