Commit 813af282 authored by Lucas Moesch's avatar Lucas Moesch

WIP

parent 665fbd6e
......@@ -3,6 +3,9 @@
#include <math.h>
#include "VABinauralCluster.h"
// VA includes
#include "../../../../../directivities/VADirectivityDAFFHRIR.h"
// ITA includes
#include <ITAConstants.h>
......@@ -132,9 +135,16 @@ VABinauralCluster::getOutput()
}
// convolve here!
CVADirectivityDAFFHRIR* HRIR = (CVADirectivityDAFFHRIR *)_listener->directivity;
if (HRIR){
int index = -1;
_FIRConvolverChL->Process((*_output)[0].data(), (*_output)[0].data(), ITABase::MixingMethod::OVERWRITE);
_FIRConvolverChR->Process((*_output)[1].data(), (*_output)[1].data(), ITABase::MixingMethod::OVERWRITE);
HRIR->GetNearestNeighbour(clusterSourceMetrics.phi, clusterSourceMetrics.theta, &index);
_FIRConvolverChL->Process((*_output)[0].data(), (*_output)[0].data(), ITABase::MixingMethod::OVERWRITE);
_FIRConvolverChR->Process((*_output)[1].data(), (*_output)[1].data(), ITABase::MixingMethod::OVERWRITE);
}
return _output;
}
......
......@@ -54,7 +54,7 @@ VABinauralClustering::init(int listenerID, VABinauralListener* listener, int num
convChL->SetFilterExchangeFadingFunction(ITABase::FadingFunction::COSINE_SQUARE);
convChL->SetFilterCrossfadeLength((std::min)(_blocklength, 32));
convChL->SetGain(0.0f, true);
convChL->SetGain(1.0f, true);
ITAUPFilter* HRIRFilterChL = convChL->RequestFilter();
HRIRFilterChL->identity();
......@@ -71,7 +71,7 @@ VABinauralClustering::init(int listenerID, VABinauralListener* listener, int num
convChR->SetFilterExchangeFadingFunction(ITABase::FadingFunction::COSINE_SQUARE);
convChR->SetFilterCrossfadeLength((std::min)(_blocklength, 32));
convChR->SetGain(0.0f, true);
convChR->SetGain(1.0f, true);
ITAUPFilter* HRIRFilterChR = convChR->RequestFilter();
HRIRFilterChR->identity();
......@@ -113,7 +113,7 @@ VABinauralClustering::update()
if (_nextState == nullptr)
{
VABinauralClusteringState* state = new VABinauralClusteringState(*_curState);
VABinauralClusteringState* state = new VABinauralClusteringState(_numClusters, _listener, clusterPool, &FIRConvolverChL, &FIRConvolverChR); //new VABinauralClusteringState(*_curState);
// remove removed sources
std::set< int >::const_iterator it;
......@@ -146,17 +146,14 @@ VABinauralClustering::update()
// TODO: refinement
// update source status
for (auto const& assignedSources : _assignedSources)
/*for (auto const& unassignedSources : _unassignedSources)
{
_assignedSources.insert(std::pair< int, VABinauralSoundSource* >(assignedSources.first, assignedSources.second));
}
}*/
_unassignedSources.clear();
//_unassignedSources.clear();
_nextState.reset(state);
// TODO: update fixed clustertrajectories
}
}
......
......@@ -32,6 +32,7 @@ public:
CVAListenerDesc* data;
CVASharedMotionModel* motionModel;
IVADirectivity* directivity;
VAVec3 predPos;
VAVec3 predView;
......
......@@ -272,7 +272,7 @@ VABinauralRealTimeRenderer::updateListeners( CVASceneStateDiff* diff )
createListener(iID, _newSceneState->GetReceiverState(iID));
}
// update listener trajectories
// update listener trajectories and directivity
for (std::map< int, VABinauralListener* >::iterator it = _listeners.begin(); it != _listeners.end(); ++it)
{
int iListenerID = it->first;
......@@ -288,6 +288,11 @@ VABinauralRealTimeRenderer::updateListeners( CVASceneStateDiff* diff )
{
listener->motionModel->InputMotionKey(motionNew);
}
if (listenerNew != nullptr)
{
listener->directivity = (IVADirectivity*) listenerNew->GetDirectivity();
}
}
_clusterEngine.update();
......@@ -341,6 +346,9 @@ VABinauralRealTimeRenderer::createListener(int listenerID, const CVAReceiverStat
motionInstance->SetName(std::string("bfrend_mm_listener_" + listener->data->sName));
motionInstance->Reset();
//set directivity
listener->directivity = ( IVADirectivity* ) recevierState->GetDirectivity();
// add local reference
_listeners.insert(std::pair< int, VABinauralListener* >(listenerID, listener));
......
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