Commit 21bc8d13 authored by Lucas Moesch's avatar Lucas Moesch

WIP

parent ffeae456
......@@ -42,6 +42,16 @@ VABinauralClusterEngine::addSource( int sourceID, VABinauralSoundSource* source
}
}
void
VABinauralClusterEngine::removeSource(int sourceID)
{
std::map< int, VABinauralClustering* >::iterator it;
for (it = _clusterings.begin(); it != _clusterings.end(); ++it)
{
it->second->removeSource(sourceID);
}
}
void
VABinauralClusterEngine::addListener(int listenerID, VABinauralListener* listener, clusterConfig_t& conf)
{
......
......@@ -26,6 +26,12 @@ VABinauralClustering::addSource(int sourceID, VABinauralSoundSource* source)
_unassignedSources.insert(std::pair< int, VABinauralSoundSource* >(sourceID, source));
};
void
VABinauralClustering::removeSource(int sourceID)
{
_delSourceIDs.insert(sourceID);
}
void
VABinauralClustering::init(int listenerID, VABinauralListener* listener, int numClusters)
{
......@@ -64,9 +70,26 @@ void
VABinauralClustering::update()
{
VABinauralClusteringState* state = new VABinauralClusteringState(*_curState);
//VABinauralClusteringState* del = _newState;
// update unassigned sources
// remove removed sources
std::set< int >::const_iterator it;
for (it = _delSourceIDs.begin(); it != _delSourceIDs.end(); ++it)
{
// remove if in unassigned sources
std::map< int, VABinauralSoundSource* >::iterator delIt = _unassignedSources.find(*it);
VABinauralSoundSource* source = delIt->second;
_unassignedSources.erase(delIt);
// remove if in assigned sources
std::map< int, VABinauralSoundSource* >::iterator = _assignedSources.find(sourceID);
source = it->second;
_assignedSources.erase(it);
}
// add unassigned sources
std::map< int , VABinauralSoundSource* >::iterator it;
for (it = _unassignedSources.begin(); it != _unassignedSources.end(); ++it)
......@@ -76,6 +99,7 @@ VABinauralClustering::update()
// TODO: refinement
// update source status
for (it = _unassignedSources.begin(); it != _unassignedSources.end(); ++it)
{
_assignedSources.insert(std::pair< int, VABinauralSoundSource* >(it->first, it->second));
......
......@@ -33,7 +33,10 @@ public:
update();
void
addSource(int sourceID, VABinauralSoundSource* source);
addSource( int sourceID, VABinauralSoundSource* source );
void
removeSource(int sourceID);
private:
......@@ -49,6 +52,7 @@ private:
VABinauralListener* _listener;
IVAObjectPool* _clusterPool;
std::set< int > _delSourceIDs;
std::map< int, VABinauralSoundSource* > _unassignedSources;
std::map< int, VABinauralSoundSource* > _assignedSources;
......
......@@ -270,13 +270,9 @@ VABinauralRealTimeRenderer::deleteSource(int sourceID)
VABinauralSoundSource* source = it->second;
_sources.erase(it);
//listener->bDeleted = true;
//listener->pData->RemoveReference();
source->RemoveReference();
// remove listener reference from clustering
_clusterEngine.removeListener(sourceID);
_clusterEngine.removeSource(sourceID);
source->RemoveReference();
}
void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment