VABinauralClustering.h 1.36 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 27 28
	~VABinauralClustering();
	
	VABinauralClustering();

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

29
	ITASampleFrame*
Lucas Moesch's avatar
WIP  
Lucas Moesch committed
30 31
	getOutput();

32 33 34 35 36 37 38 39 40 41 42 43
	void
	update();

	void
	addSource(int sourceID, VABinauralSoundSource* source);


private:
	int _listenerID;
	int _numClusters;
	double _threshold;

44 45
	ITASampleFrame* _output;
		
Lucas Moesch's avatar
WIP  
Lucas Moesch committed
46 47 48
	std::unique_ptr<VABinauralClusteringState> _curState;
	std::unique_ptr<VABinauralClusteringState> _nextState;

49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
	VABinauralListener* _listener;
	IVAObjectPool* _clusterPool;

	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