Commit 32057179 authored by henryjandrew's avatar henryjandrew

Fixing some problems with VDL processing, now writing and incrementing.

parent 632ea5af
......@@ -72,7 +72,7 @@ void CVABinauralClustering::Init( int iSoundReceiverID, CVABinauralClusteringDir
pHRIRFilterChR->identity();
pFIRConvolverChR->ExchangeFilter( pHRIRFilterChR );
pFIRConvolverChR->ReleaseFilter( ^pHRIRFilterChR );
pFIRConvolverChR->ReleaseFilter( pHRIRFilterChR );
mFIRConvolversR.insert( std::pair< int, ITAUPConvolution* >( i, pFIRConvolverChR ) );
}
......
......@@ -101,7 +101,8 @@ ITASampleFrame* CVABinauralClusteringDirection::GetOutput()
{
IVABinauralWaveFront* pWaveFront( it->second );
pWaveFront->SetClusteringPose( m_pClusteringDirectionReceiver->v3PredictedPosition, m_pClusteringDirectionReceiver->predView, m_pClusteringDirectionReceiver->predUp );
pWaveFront->SetClusteringPose( m_v3ClusteringDirectionPos, m_pClusteringDirectionReceiver->predView, m_pClusteringDirectionReceiver->predUp ); //WARNING: THIS WAS CHANGED FROM PREVIOUS LINE
//pWaveFront->SetClusteringPose(m_pClusteringDirectionReceiver->v3PredictedPosition, m_pClusteringDirectionReceiver->predView, m_pClusteringDirectionReceiver->predUp);
pWaveFront->GetOutput( &( m_sbTempChL ), &( m_sbTempChR ) );
( *m_psfOutput )[ 0 ] += m_sbTempChL;
......
#include "VABinauralOutdoorNoiseAudioRenderer.h"
#include <atomic>
#include <iostream>
#include <fstream>
#include <ctime>
......@@ -21,12 +22,14 @@
// VA Core Includes
#include "../../../Scene/VAScene.h"
#include "../../../Scene/VASoundSourceDesc.h"
// ITA includes
#include <ITAException.h>
#include <ITAFastMath.h>
#include <ITAStreamInfo.h>
#include <ITAVariableDelayLine.h>
#include <ITASampleBuffer.h>
// Utils
#include "../Clustering/VAConfig.h"
......@@ -143,7 +146,7 @@ ITADatasource* CVABinauralOutdoorNoiseRenderer::GetOutputDatasource()
void CVABinauralOutdoorNoiseRenderer::SetParameters(const CVAStruct& oInArgs)
{
auto it = oInArgs.Begin();
while (it != oInArgs.End()) {
const CVAStructValue path_value = it->second; //extract data for the current path from the iterator in a useful form
......@@ -192,7 +195,8 @@ void CVABinauralOutdoorNoiseRenderer::SetParameters(const CVAStruct& oInArgs)
double delay = path["delay"];
m_mPaths[path_ID]->setDelay(delay);
int idelay = (int)round(delay * m_oDefaultWaveFrontConf.sampleRate);
m_mPaths[path_ID]->setDelay(idelay);
CVAStructValue position = path["position"]; //
......@@ -265,6 +269,16 @@ CVABinauralOutdoorNoiseRenderer::ProcessStream( const ITAStreamInfo* streamInfo
double time = streamState->dSysTime;
//updateTrajectories(time); // @todo jst: why is this outcommented? Trajectories must be updated here for Doppler shifts ...
// -- copy new samples from source' signal stream and feed the SIMO VDLs
for (auto oSource : m_mSources)
{
CVABinauralOutdoorSource* pSource = oSource.second;
CVASoundSourceDesc* pSourceDesc = pSource->pData;
const ITASampleBuffer* pInBuf = pSourceDesc->pSignalSourceInputBuf;
pSource->pVDL->Write(GetBlocklength(), pInBuf->GetData());
}
// -- create output for every listener
for( auto const& clusteringIt : m_pClusterEngine->m_mClusteringInstances )
{
......@@ -276,6 +290,13 @@ CVABinauralOutdoorNoiseRenderer::ProcessStream( const ITAStreamInfo* streamInfo
fm_copy( outputChR, ( *output )[ 1 ].data(), m_uiBlocklength );
}
// -- copy new samples from source' signal stream and feed the SIMO VDLs
for (auto oSource : m_mSources)
{
CVABinauralOutdoorSource* pSource = oSource.second;
pSource->pVDL->Increment(GetBlocklength());
}
#ifdef BINAURAL_CLUSTERING_RENDERER_WITH_BENCHMARKING
// stop timer
......
......@@ -30,11 +30,13 @@ CVABinauralOutdoorWaveFront::CVABinauralOutdoorWaveFront( const CVABinauralOutdo
tempBuffer.Init(oConf.BufferSize); //initialise the buffers to a size which will not be exceeded
interpolatedSignal.Init(oConf.BufferSize);
m_pInterpolationRoutine = new CITASampleLinearInterpolation();
}
CVABinauralOutdoorWaveFront::~CVABinauralOutdoorWaveFront()
{
delete m_pInterpolationRoutine;
}
......@@ -82,6 +84,7 @@ void CVABinauralOutdoorWaveFront::GetOutput( ITASampleBuffer* pfLeftChannel, ITA
int toaClusterLeft = (int)round( sound_receiver->pTimeOfArrivalEstimator->getTOALeft(clusterMetrics.phi, clusterMetrics.theta) ); //the TOA difference for a signal coming from the specified angles for the left ear
int toaClusterRight = (int)round(sound_receiver->pTimeOfArrivalEstimator->getTOARight(clusterMetrics.phi, clusterMetrics.theta)); //TODO: test if this works/ how accurate
VARelationMetrics pathMetrics; //get metrics about the current path
pathMetrics.calc(v3PredictedPos, m_v3PredictedClusteringView, m_v3PredictedClusteringUp, v3ReceiverPos); //TODO: add these variables in setMotion NOTE: uses same view and up vectors as for cluster, I THINK this is ok
int toaPathLeft = (int)round(sound_receiver->pTimeOfArrivalEstimator->getTOALeft(pathMetrics.phi, pathMetrics.theta)); //the TOA difference for a signal coming from the specified angles for the left ear
......@@ -91,6 +94,11 @@ void CVABinauralOutdoorWaveFront::GetOutput( ITASampleBuffer* pfLeftChannel, ITA
ITD_diff_margin_left = toaPathLeft - toaClusterLeft;
ITD_diff_margin_right = toaPathRight - toaClusterRight;
float test = sound_receiver->pTimeOfArrivalEstimator->getTOALeft(clusterMetrics.phi, clusterMetrics.theta) * oConf.sampleRate;
float test1 = sound_receiver->pTimeOfArrivalEstimator->getTOALeft(pathMetrics.phi, pathMetrics.theta) * oConf.sampleRate;
if (toaClusterLeft > 0) {
int test = 1;
}
int iCurrentDelay = VDL->GetCurrentDelaySamples(iCursorID); //get current and new delay in samples
int iNewDelay = VDL->GetNewDelaySamples(iCursorID);
......
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