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

// VA Includes
#include <VA.h>

// Utils
#include "../BinauralSoundSource/VABinauralSoundSource.h"
9
#include "../BinauralListener/VABinauralListener.h"
10 11 12 13 14 15 16 17 18 19 20 21 22 23


class VABinauralCluster : public CVAPoolObject
{
public:
	double maxError;

	VABinauralCluster();

	VABinauralCluster(const VABinauralCluster& cluster);

	~VABinauralCluster();

	void 
24 25 26 27
	init(int sourceID, VABinauralSoundSource* source, VABinauralListener* listener);

	ITASampleFrame*
	getOutput();
28 29 30 31 32

	double
	getDistError(VABinauralSoundSource* source);

	void
Lucas Moesch's avatar
WIP  
Lucas Moesch committed
33
	addSource(int sourceID, VABinauralSoundSource* source);
34 35

	void
36
	addSource(int sourceID, VABinauralSoundSource* source, double error);
37 38 39 40 41 42 43 44 45 46

	void
	removeSource();

	void
	reset();

private:
	int _numSources;

47 48 49 50 51 52 53 54
	ITASampleBuffer _tmpChL;
	ITASampleBuffer _tmpChR;

	ITASampleFrame* _output;

	VABinauralListener* _listener;
	
	VAVec3 _listenerPos;
55
	VAVec3 _clusterSourcePos;
56 57 58 59
	VAVec3 _clusterSourceToListenerPos;

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

60 61 62 63 64 65

	double 
	cummulativeMovingAverage(int n, double average, double value);
};

#endif // IW_VACORE_BINAURALCLUSTER