VABinauralClustering.h 1.61 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#ifndef IW_VACORE_BINAURALCLUSTERING
#define IW_VACORE_BINAURALCLUSTERING

#include <queue>

// VA Includes
#include <VA.h>
#include <VAPoolObject.h>

// Utils
#include "VABinauralCluster.h"
#include "VABinauralClusteringState.h"
#include "../BinauralListener/VABinauralListener.h"
#include "../BinauralSoundSource/VABinauralSoundSource.h"
15
#include "../BinauralTimeOfArrivalEstimator/VABinauralTOAEstimator.h"
16 17 18

class VABinauralClustering : public CVAPoolObject
{
19
//	friend VABinauralClusteringState;
Lucas Moesch's avatar
WIP  
Lucas Moesch committed
20

21
public:
22 23 24 25 26
	IVAObjectPool* clusterPool;

	std::map< int, ITAUPConvolution* > FIRConvolverChL;
	std::map< int, ITAUPConvolution* > FIRConvolverChR;

27 28
	~VABinauralClustering();
	
29
	VABinauralClustering(int blocklength);
30 31

	void
32
	init(int listenerID, VABinauralListener* listener, int numClusters, int HRIRFilterLength);
33

34
	ITASampleFrame*
Lucas Moesch's avatar
WIP  
Lucas Moesch committed
35 36
	getOutput();

37 38 39 40
	void
	update();

	void
Lucas Moesch's avatar
WIP  
Lucas Moesch committed
41 42 43 44
	addSource( int sourceID, VABinauralSoundSource* source );

	void
	removeSource(int sourceID);
45 46 47


private:
48 49
	int _HRIRFilterLength;
	int _blocklength;
50 51 52 53
	int _listenerID;
	int _numClusters;
	double _threshold;

54
	ITASampleFrame* _output;
55 56
	VABinauralListener* _listener;

Lucas Moesch's avatar
WIP  
Lucas Moesch committed
57
	std::set< int > _delSourceIDs;
58 59 60 61

	std::unique_ptr<VABinauralClusteringState> _curState;
	std::unique_ptr<VABinauralClusteringState> _nextState;

62 63 64 65 66 67 68 69 70 71 72 73 74 75
	std::map< int, VABinauralSoundSource* > _unassignedSources;
	std::map< int, VABinauralSoundSource* > _assignedSources;

	std::pair< int, VABinauralCluster* >
	assignCluster(VABinauralClusteringState* clustering, VABinauralSoundSource* source, double threshold, int numFreeClusters);

	void
	PreRequest();

	void
	PreRelease();
};

#endif // IW_VACORE_BINAURALCLUSTERING