Adding todos after code review with student

parent 415ca627
......@@ -140,7 +140,7 @@ void CVAAmbientMixerAudioRenderer::HandleProcessStream( ITADatasourceRealization
const double dGainFactor = pState->GetVolume( m_oParams.pCore->GetCoreConfig()->dDefaultAmplitudeCalibration );
assert( pDesc->pSignalSource.load() );
assert( pDesc->pSignalSource.get() );
const ITASampleBuffer* psbInput = pDesc->pSignalSourceInputBuf;
// Add samples to out buffer
......
......@@ -84,6 +84,7 @@ VABinauralCluster::getOutput()
// double toaHRTFChL = _listener->toaEstimator->getTOALeft(clusterSourceMetrics.phi, clusterSourceMetrics.theta);
// double toaHRTFChR = _listener->toaEstimator->getTOARight(clusterSourceMetrics.phi, clusterSourceMetrics.theta);
// @todo use listener orientation (quaternion?) to roate the ears in the global coordinate systems
double toaHRTFChL = _listener->toaEstimator->getTOA(VAVec3(-1, 0, 0), _clusterSourcePos);
double toaHRTFChR = _listener->toaEstimator->getTOA(VAVec3(1, 0, 0), _clusterSourcePos);
......@@ -106,6 +107,7 @@ VABinauralCluster::getOutput()
float gain = float((1/sourceMetrics.dist) * source->state->GetVolume(VAConfig::amplitudeCalibration));
// @todo finalize and use TOA estimation
// source->vdlChL->SetDelayTime(std::max(0., toaDistance + toaSourceChL - toaHRTFChL));
// source->vdlChR->SetDelayTime(std::max(0., toaDistance + toaSourceChR - toaHRTFChR));
......@@ -137,6 +139,7 @@ VABinauralCluster::getOutput()
filterLength = HRIR->GetProperties()->iFilterLength;
// @todo remove, because getHRIR will override sample frame values!
_tempHRIR->init(2, filterLength, true);
if (_tempHRIR->length() != filterLength)
......@@ -147,6 +150,8 @@ VABinauralCluster::getOutput()
float phi = clusterSourceMetrics.phi * 180 / ITAConstants::PI_F;
float theta = clusterSourceMetrics.theta * 180 / ITAConstants::PI_F;
// @todo use index getter, compare with last index and only exchange if necessary
// HRIR->GetHRIRByIndex()
HRIR->GetHRIR(_tempHRIR, clusterSourceMetrics.phi * 180 / ITAConstants::PI_F, clusterSourceMetrics.theta * 180 / ITAConstants::PI_F, clusterSourceMetrics.dist);
HRIRFilterChL->Load((*_tempHRIR)[0].data(), filterLength);
......
......@@ -25,6 +25,7 @@ public:
~VABinauralClusterEngine();
//! Managing instance that handles the entire clustering for all receivers
VABinauralClusterEngine();
void
......
......@@ -115,47 +115,47 @@ VABinauralClustering::update()
//std::shared_ptr<VABinauralClusteringState> state = std::make_shared<VABinauralClusteringState>(*_prevState);
std::shared_ptr<VABinauralClusteringState> state = std::make_shared<VABinauralClusteringState>(_numClusters, _listener, clusterPool, &FIRConvolversL, &FIRConvolversR);
// remove removed sources
std::set< int >::const_iterator it;
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;
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;
state->removeSource(*it);
state->removeSource(*it);
_unassignedSources.erase(delIt);
_unassignedSources.erase(delIt);
// remove if in assigned sources
delIt = _assignedSources.find(*it);
source = delIt->second;
// remove if in assigned sources
delIt = _assignedSources.find(*it);
source = delIt->second;
_assignedSources.erase(delIt);
}
_assignedSources.erase(delIt);
}
// add unassigned sources
std::map< int, VABinauralSoundSource* >::iterator sourceIt;
// add unassigned sources
std::map< int, VABinauralSoundSource* >::iterator sourceIt;
for (sourceIt = _unassignedSources.begin(); sourceIt != _unassignedSources.end(); ++sourceIt)
{
if (sourceIt->second->hasValidTrajectory){
state->addSource(sourceIt->first, sourceIt->second, _threshold, 0);
};
}
for (sourceIt = _unassignedSources.begin(); sourceIt != _unassignedSources.end(); ++sourceIt)
{
if (sourceIt->second->hasValidTrajectory){
state->addSource(sourceIt->first, sourceIt->second, _threshold, 0);
};
}
// TODO: refinement
// TODO: refinement
// update source status
/*for (auto const& unassignedSources : _unassignedSources)
{
_assignedSources.insert(std::pair< int, VABinauralSoundSource* >(assignedSources.first, assignedSources.second));
}*/
// update source status
/*for (auto const& unassignedSources : _unassignedSources)
{
_assignedSources.insert(std::pair< int, VABinauralSoundSource* >(assignedSources.first, assignedSources.second));
}*/
//_unassignedSources.clear();
//_unassignedSources.clear();
_nextState = state;
_prevState = _nextState;
_nextState = state;
_prevState = _nextState;
// }
}
......
......@@ -24,6 +24,7 @@ class VABinauralClustering : public CVAPoolObject
public:
IVAObjectPool* clusterPool;
//! Clustering per receiver entity
~VABinauralClustering();
VABinauralClustering();
......@@ -49,8 +50,8 @@ public:
private:
int _listenerID;
int _numClusters;
double _threshold;
int _numClusters; //!< Cluster budget (maximum number of usable clusters)
double _threshold; //!< Threshold for clustering algorithm (abstract "distance"), see MA 2019 Msch
ITASampleFrame* _output;
VABinauralListener* _listener;
......
......@@ -22,7 +22,7 @@ public:
std::queue< int > freeClusterIDs;
std::map< int, int> sourceClusterReference;
std::map< int, VABinauralCluster* > clusters;
std::map< int, VABinauralCluster* > clusters; //!< Clusters that combine sound sources
std::map<int, ITAUPConvolution* > *_FIRConvolversL;
std::map<int, ITAUPConvolution* > *_FIRConvolversR;
......
......@@ -39,4 +39,8 @@ void
VABinauralListener::PreRelease()
{
delete motionModel;
/* @todo use reset of motion model instead of new / delete in request and release of pool
motionModel->Reset();
motionModel->Reset();
*/
}
......@@ -4,6 +4,7 @@
VABinauralSoundSource::VABinauralSoundSource(const config_t& conf) :
conf( conf )
{
// @todo move these DSP elements to the clustering
vdlChL = new CITAVariableDelayLine(conf.sampleRate, conf.blockLength, 3. * conf.sampleRate, CITAVariableDelayLine::CUBIC_SPLINE_INTERPOLATION);
vdlChR = new CITAVariableDelayLine(conf.sampleRate, conf.blockLength, 3. * conf.sampleRate, CITAVariableDelayLine::CUBIC_SPLINE_INTERPOLATION);
}
......@@ -11,6 +12,8 @@ VABinauralSoundSource::VABinauralSoundSource(const config_t& conf) :
VABinauralSoundSource::~VABinauralSoundSource()
{
delete vdlChR;
delete vdlChL;
}
void
......@@ -28,10 +31,19 @@ VABinauralSoundSource::PreRequest()
state = nullptr;
data = nullptr;
hasValidTrajectory = false;
/* @todo implement reset functionality for VDL
vdlChL->Reset();
vdlChR->Reset();
*/
}
void
VABinauralSoundSource::PreRelease()
{
delete motionModel;
/* @todo use reset of motion model instead of new / delete in request and release of pool
motionModel->Reset();
motionModel->Reset();
*/
}
\ No newline at end of file
......@@ -6,6 +6,12 @@
class VABinauralTOAEstimator
{
public:
//! Time of arriavel extimator clas
/*
* @todo Implement for arbitrary HRTFs
* @todo Make faster by LUT of trigonometric functions like sin/cos
* @todo Include feature for anthropometric parameters
*/
VABinauralTOAEstimator();
~VABinauralTOAEstimator();
......
......@@ -118,7 +118,7 @@ VABinauralRealTimeRenderer::init( const CVAStruct& oArgs )
void
VABinauralRealTimeRenderer::Reset()
{
VA_ERROR( "BinauralRealTimeRenderer", "Reset hast not yet been implemented" );
};
ITADatasource*
......@@ -126,12 +126,6 @@ VABinauralRealTimeRenderer::GetOutputDatasource() {
return this;
};
CVAStruct
VABinauralRealTimeRenderer::CallObject(const CVAStruct& oArgs){
CVAStruct oReturn;
return oReturn;
};
void VABinauralRealTimeRenderer::UpdateGlobalAuralizationMode(int iGlobalAuralizationMode)
{
......@@ -433,7 +427,7 @@ VABinauralRealTimeRenderer::createListener(int listenerID, const CVAReceiverStat
_listeners.insert(std::pair< int, VABinauralListener* >(listenerID, listener));
// add listener to clustering
VABinauralClusterEngine::clusterConfig_t config = { /*numClusters=*/ 12};
VABinauralClusterEngine::clusterConfig_t config = { /*numClusters=*/ 12}; // @todo use configuranble number of clusters -> config
_clusterEngine->addListener(listenerID, listener, config);
}
......
......@@ -13,7 +13,7 @@
#include "./Utils/BinauralSoundSource/VABinauralSoundSource.h"
#include "./Utils/BinauralListener/VABinauralListener.h"
class VABinauralRealTimeRenderer : public IVAAudioRenderer, public CVAObject, public ITADatasourceRealization
class VABinauralRealTimeRenderer : public IVAAudioRenderer, public ITADatasourceRealization
{
public:
VABinauralRealTimeRenderer( const CVAAudioRendererInitParams& );
......@@ -40,9 +40,6 @@ public:
ITADatasource*
GetOutputDatasource();
CVAStruct
CallObject(const CVAStruct& oArgs);
private:
const CVAAudioRendererInitParams _params;
......@@ -68,7 +65,7 @@ private:
int _defaultVDLSwitchingAlgorithm;
int _hrirFilterLength;
int _curGlobalAuralizationMode;
int _curGlobalAuralizationMode; // @todo use in UpdateScene
double _additionalStaticDelaySeconds;
void
......
......@@ -102,11 +102,14 @@ int main() {
va = VACore::CreateCoreInstance("../conf/VACore.ini");
va->Initialize();
va->AddSearchPath("X:/Sciebo/master-thesis/input_files");
std::vector<std::string> vFileNames = GetFileNamesInDirectory("X:/Sciebo/master-thesis/input_files/*.wav");
va->AddSearchPath( "X:/Sciebo/master-thesis/input_files" );
va->AddSearchPath( "D:/Users/stienen/dev/VA/VACore/data" );
va->AddSearchPath( "D:/Users/stienen/Sciebo/ITA/Lehre/Masterarbeiten/2018 Lucas Msch/2018 MA Lucas Msch Auralization/input_files" );
std::vector<std::string> vFileNames = GetFileNamesInDirectory("D:/Users/stienen/Sciebo/ITA/Lehre/Masterarbeiten/2018 Lucas Msch/2018 MA Lucas Msch Auralization/input_files/*.wav");
int receiverID = va->CreateSoundReceiver("ITAListener");
int directivityID = va->CreateDirectivityFromFile("C:/dev/VA/VACore/data/ITA_Artificial_Head_5x5_44kHz_128.v17.ir.daff", "HRTF");
int directivityID = va->CreateDirectivityFromFile("ITA_Artificial_Head_5x5_44kHz_128.v17.ir.daff", "HRTF");
va->SetSoundReceiverDirectivity(receiverID, directivityID);
va->SetSoundReceiverPosition(receiverID, VAVec3(0, 1.7, 0));
......
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