VABinauralCluster.h 1.29 KB
Newer Older
1
2
3
4
5
6
#ifndef IW_VACORE_BINAURALCLUSTER
#define IW_VACORE_BINAURALCLUSTER

// VA Includes
#include <VA.h>

7
8
9
// ITA includes
#include <ITAUPConvolution.h>

10
11
// Utils
#include "../BinauralSoundSource/VABinauralSoundSource.h"
12
#include "../BinauralListener/VABinauralListener.h"
13
14
15
16
17


class VABinauralCluster : public CVAPoolObject
{
public:
Lucas Moesch's avatar
wip    
Lucas Moesch committed
18
	int numSources;
19
20
21
22
23
24
25
	double maxError;

	VABinauralCluster();

	~VABinauralCluster();

	void 
Lucas Moesch's avatar
Lucas Moesch committed
26
	init(int sourceID, VABinauralSoundSource* source, VABinauralListener* listener);
27

Lucas Moesch's avatar
Lucas Moesch committed
28
29
30
	void
	init(VABinauralCluster* cluster);

31
32
	ITASampleFrame*
	getOutput();
33
34
35
36
37

	double
	getDistError(VABinauralSoundSource* source);

	void
Lucas Moesch's avatar
WIP    
Lucas Moesch committed
38
	addSource(int sourceID, VABinauralSoundSource* source);
39
40

	void
41
	addSource(int sourceID, VABinauralSoundSource* source, double error);
42
43

	void
Lucas Moesch's avatar
wip    
Lucas Moesch committed
44
	removeSource(int sourceID);
45
46
47
48

	void
	reset();

Lucas Moesch's avatar
Lucas Moesch committed
49
50
51
	void
	PreRelease();

52
private:
53
54
55
56
	ITASampleBuffer _tmpChL;
	ITASampleBuffer _tmpChR;

	ITASampleFrame* _output;
57
	ITASampleFrame* _tempHRIR;
58
59
60

	VABinauralListener* _listener;
	
61
62
63
	ITAUPConvolution* _FIRConvolverChL;
	ITAUPConvolution* _FIRConvolverChR;
	
64
	VAVec3 _listenerPos;
65
	VAVec3 _clusterSourcePos;
66
67
68
69
	VAVec3 _clusterSourceToListenerPos;

	std::map<int, VABinauralSoundSource* > _sources;

70
71
72
73
74
	double 
	cummulativeMovingAverage(int n, double average, double value);
};

#endif // IW_VACORE_BINAURALCLUSTER