#define NOMINMAX #include #include #include // VA #include // Utils #include "./VABinauralClustering.h" #include "./VABinauralClusterPoolFactory.h" VABinauralClustering::~VABinauralClustering() { IVAPoolObjectFactory* clusterFactory = new VABinauralClusterPoolFactory(); _clusterPool = IVAObjectPool::Create(16, 2, clusterFactory, true); }; VABinauralClustering::VABinauralClustering(){}; void VABinauralClustering::addSource(int sourceID, VABinauralSoundSource* source) { _unassignedSources.insert(std::pair< int, VABinauralSoundSource* >(sourceID, source)); }; void VABinauralClustering::init(int listenerID, VABinauralListener* listener, int numClusters) { _listenerID = listenerID; _listener = listener; _numClusters = numClusters; _threshold = cos(180. / numClusters) * cos(180. / numClusters); } void VABinauralClustering::update() { VABinauralClusteringState* state = new VABinauralClusteringState(*_clustering); // update unassigned sources std::map< int , VABinauralSoundSource* >::iterator it; for (it = _unassignedSources.begin(); it != _unassignedSources.end(); ++it) { state->addSource(it->first, it->second, _threshold, 0); } // TODO: refinement for (it = _unassignedSources.begin(); it != _unassignedSources.end(); ++it) { _assignedSources.insert(std::pair< int, VABinauralSoundSource* >(it->first, it->second)); } _unassignedSources.clear(); // TODO: update fixed clustertrajectories } void VABinauralClustering::PreRequest(){}; void VABinauralClustering::PreRelease(){};