Commit 7aab7842 authored by Michael Kohnen's avatar Michael Kohnen
Browse files

basic developing

parent 354e7e76
......@@ -6,8 +6,6 @@
// VA includes
#include "../../../Data/VADirectivity.h"
#include "../../../Filtering/VAAtmosphere.h"
#include "../../../Filtering/VAThirdOctaveFilterbank.h"
#include "../../../Filtering/VAVariableDelayLine.h"
#include "../../../Motion/VAMotionModelBase.h"
#include "../../../Motion/VASharedMotionModel.h"
#include "../../../Motion/VASampleAndHoldMotionModel.h"
......@@ -23,9 +21,9 @@
// ITA includes
#include <DAFF.h>
#include <DSMBCConvolver.h>
#include <DSMBCFilter.h>
#include <DSMBCFilterPool.h>
#include <ITAUPConvolution.h>
#include <ITAUPFilter.h>
#include <ITAUPFilterPool.h>
#include <ITAAtomicPrimitives.h>
#include <ITAClock.h>
#include <ITACriticalSection.h>
......@@ -36,6 +34,9 @@
#include <ITAStreamInfo.h>
#include <ITAFastMath.h>
#include <ITAConstants.h>
#include <ITAThirdOctaveFilterbank.h>
#include <ITAThirdOctaveMagnitudeSpectrum.h>
#include <ITANumericUtils.h>
// Vista includes
#include <VistaInterProcComm/Concurrency/VistaThreadEvent.h>
......@@ -118,9 +119,9 @@ public:
ITAAtomicBool bDelete;
CVAThirdOctaveFilterbank* pThirdOctaveFilterBank;
CVAVariableDelayLine* pVariableDelayLineCh;
DSMBCConvolver* pFIRConvolverCh;
CITAThirdOctaveFilterbank* pThirdOctaveFilterBank;
CITAVariableDelayLine* pVariableDelayLineCh;
//ITAUPConvolver* pFIRConvolverCh;
void PreRequest()
......@@ -131,7 +132,7 @@ public:
// Reset DSP elements
pThirdOctaveFilterBank->Clear();
pVariableDelayLineCh->Clear();
pFIRConvolverCh->clear();
//pFIRConvolverCh->clear();
};
void UpdateDir(bool bDIRAuraModeEnabled);
......@@ -281,15 +282,15 @@ void CVAAmbisonicsFreeFieldAudioRenderer::Init(const CVAStruct& oArgs)
sVLDInterpolationAlgorithm = toLowercase(sVLDInterpolationAlgorithm);
if (sVLDInterpolationAlgorithm == "switch")
m_iDefaultVDLSwitchingAlgorithm = CVAVariableDelayLine::SWITCH;
m_iDefaultVDLSwitchingAlgorithm = CITAVariableDelayLine::SWITCH;
else if (sVLDInterpolationAlgorithm == "crossfade")
m_iDefaultVDLSwitchingAlgorithm = CVAVariableDelayLine::CROSSFADE;
m_iDefaultVDLSwitchingAlgorithm = CITAVariableDelayLine::CROSSFADE;
else if (sVLDInterpolationAlgorithm == "linear")
m_iDefaultVDLSwitchingAlgorithm = CVAVariableDelayLine::LINEAR_INTERPOLATION;
m_iDefaultVDLSwitchingAlgorithm = CITAVariableDelayLine::LINEAR_INTERPOLATION;
else if (sVLDInterpolationAlgorithm == "cubicspline")
m_iDefaultVDLSwitchingAlgorithm = CVAVariableDelayLine::CUBIC_SPLINE_INTERPOLATION;
m_iDefaultVDLSwitchingAlgorithm = CITAVariableDelayLine::CUBIC_SPLINE_INTERPOLATION;
else if (sVLDInterpolationAlgorithm == "windowedsinc")
m_iDefaultVDLSwitchingAlgorithm = CVAVariableDelayLine::WINDOWED_SINC_INTERPOLATION;
m_iDefaultVDLSwitchingAlgorithm = CITAVariableDelayLine::WINDOWED_SINC_INTERPOLATION;
else
ITA_EXCEPT1(INVALID_PARAMETER, "Unrecognized interpolation algorithm '" + sVLDInterpolationAlgorithm + "' in AmbisonicsFreefieldAudioRendererConfig");
......@@ -681,11 +682,11 @@ void CVAAmbisonicsFreeFieldAudioRenderer::ProcessStream(const ITAStreamInfo* pSt
bool bDPEnabledGlobal = (m_iCurGlobalAuralizationMode & IVACore::VA_AURAMODE_DOPPLER) > 0;
bool bDPEnabledListener = (pListenerState->GetAuralizationMode() & IVACore::VA_AURAMODE_DOPPLER) > 0;
bool bDPEnabledSource = (pSourceState->GetAuralizationMode() & IVACore::VA_AURAMODE_DOPPLER) > 0;
bool bDPEnabledCurrent = (pPath->pVariableDelayLineCh->GetAlgorithm() != CVAVariableDelayLine::SWITCH); // switch = disabled
bool bDPEnabledCurrent = (pPath->pVariableDelayLineCh->GetAlgorithm() != CITAVariableDelayLine::SWITCH); // switch = disabled
bool bDPStatusChanged = (bDPEnabledCurrent != (bDPEnabledGlobal && bDPEnabledListener && bDPEnabledSource));
if (bDPStatusChanged)
{
pPath->pVariableDelayLineCh->SetAlgorithm(!bDPEnabledCurrent ? m_iDefaultVDLSwitchingAlgorithm : CVAVariableDelayLine::SWITCH);
pPath->pVariableDelayLineCh->SetAlgorithm(!bDPEnabledCurrent ? m_iDefaultVDLSwitchingAlgorithm : CITAVariableDelayLine::SWITCH);
}
pPath->UpdateMediumPropagation(m_dSpeedOfSound, m_dAdditionalStaticDelaySeconds);
......@@ -715,7 +716,7 @@ void CVAAmbisonicsFreeFieldAudioRenderer::ProcessStream(const ITAStreamInfo* pSt
float fSoundSourceGain = float(dDistanceDecrease * pSourceState->GetVolume());
if (pPath->pSource->pData->bMuted || (bDSEnabled == false))
fSoundSourceGain = 0.0f;
pPath->pFIRConvolverCh->setGain(fSoundSourceGain);
// --= DSP =--
......@@ -724,14 +725,16 @@ void CVAAmbisonicsFreeFieldAudioRenderer::ProcessStream(const ITAStreamInfo* pSt
assert(psbInput); // Knallt es hier, dann ist die Eingabequelle noch nicht gesetzt
assert(pSourceData->iID >= 0); // Knallt es hier, dann wurde dem SoundPath unterm Hintern die Quelle entzogen! -> Problem mit Referenzierung und Reset?
pPath->pThirdOctaveFilterBank->Process(psbInput->data(), ctxAudio.m_sbTemp.data());
pPath->pVariableDelayLineCh->Process(&(ctxAudio.m_sbTemp), &(ctxAudio.m_sbTemp));
std::vector<double> gains = vdRealvalued_basefunctions( (90-pPath->oRelations.dElevationL2S), pPath->oRelations.dAzimuthL2S, m_iMaxOrder);
for (int i = 0; i < m_iNumChannels; i++)
{
(*pPath->pListener->psfOutput)[i].MulAdd(ctxAudio.m_sbTemp, gains[i], 0, 0, GetBlocklength());
(*pPath->pListener->psfOutput)[i].MulAdd(ctxAudio.m_sbTemp, gains[i]*fSoundSourceGain, 0, 0, GetBlocklength());
}
spit++;
}
......@@ -1112,14 +1115,14 @@ void CVAAmbisonicsFreeFieldAudioRenderer::UpdateGlobalAuralizationMode(int iGlob
CVAAFFSoundPath::CVAAFFSoundPath(double dSamplerate, int iBlocklength, int iDirFilterLength)
{
pThirdOctaveFilterBank = CVAThirdOctaveFilterbank::Create(dSamplerate, iBlocklength,
CVAThirdOctaveFilterbank::FIR_SPLINE_LINEAR_PHASE);
pThirdOctaveFilterBank = CITAThirdOctaveFilterbank::Create(dSamplerate, iBlocklength,
CITAThirdOctaveFilterbank::FIR_SPLINE_LINEAR_PHASE);
//CVAThirdOctaveFilterbank::IIR_BIQUADS_ORDER10 );
pThirdOctaveFilterBank->SetIdentity();
float fReserverdMaxDelaySamples = (float)(3 * dSamplerate); // 3 Sekunden ~ 1km Entfernung
m_iDefaultVDLSwitchingAlgorithm = CVAVariableDelayLine::LINEAR_INTERPOLATION;
pVariableDelayLineCh = new CVAVariableDelayLine(dSamplerate, iBlocklength, fReserverdMaxDelaySamples, m_iDefaultVDLSwitchingAlgorithm);
m_iDefaultVDLSwitchingAlgorithm = CITAVariableDelayLine::LINEAR_INTERPOLATION;
pVariableDelayLineCh = new CITAVariableDelayLine(dSamplerate, iBlocklength, fReserverdMaxDelaySamples, m_iDefaultVDLSwitchingAlgorithm);
//pVariableDelayLineChR = new CVAVariableDelayLine(dSamplerate, iBlocklength, fReserverdMaxDelaySamples, m_iDefaultVDLSwitchingAlgorithm);
/*pFIRConvolverCh = new DSMBCConvolver(iBlocklength, iHRIRFilterLength);
......@@ -1184,9 +1187,11 @@ void CVAAFFSoundPath::UpdateDir(bool bDIRAuraModeEnabled)
pDirectivityDataNew->getNearestNeighbour(DAFF_OBJECT_VIEW, float(oRelations.dAzimuthS2L), float(oRelations.dElevationS2L), oDirectivityStateNew.iRecord);
if (oDirectivityStateCur.iRecord != oDirectivityStateNew.iRecord)
{
CVAThirdOctaveMagnitudes oDirectivityMagnitudes;
pDirectivityDataNew->getMagnitudes(oDirectivityStateNew.iRecord, 0, oDirectivityMagnitudes.fGains);
pThirdOctaveFilterBank->SetGains(oDirectivityMagnitudes);
std::vector< float > vfMags(CITAThirdOctaveMagnitudeSpectrum::GetNumBands());
pDirectivityDataNew->getMagnitudes(oDirectivityStateNew.iRecord, 0, &vfMags[0]);
CITAThirdOctaveMagnitudeSpectrum oDirectivityMagnitudes;
oDirectivityMagnitudes.SetMagnitudes(vfMags);
pThirdOctaveFilterBank->SetMagnitudes(oDirectivityMagnitudes);
}
}
}
......
Supports Markdown
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