Commit e5a55862 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Minor style changes and removed some warnings

parent fc71d333
......@@ -86,7 +86,7 @@ public:
private:
CBARPath();
CBARPath( double dSamplerate, int iBlocklength );
CBARPath( const double dSampleRate, const int iBlockLength );
int m_iDefaultVDLSwitchingAlgorithm;
......@@ -98,15 +98,20 @@ class CBARPathFactory : public IVAPoolObjectFactory
{
public:
CBARPathFactory( double dSamplerate, int iBlocklength ) : m_dSamplerate( dSamplerate ), m_iBlocklength( iBlocklength ) {}
CVAPoolObject* CreatePoolObject()
inline CBARPathFactory( const double dSampleRate, const int iBlockLength )
: m_dSampleRate( dSampleRate )
, m_iBlockLength( iBlockLength )
{
return new CBARPath( m_dSamplerate, m_iBlocklength );
};
inline CVAPoolObject* CreatePoolObject()
{
return new CBARPath( m_dSampleRate, m_iBlockLength );
};
private:
double m_dSamplerate;
int m_iBlocklength;
double m_dSampleRate;
int m_iBlockLength;
};
//! Binaural artificial reverberation simulation class
......@@ -121,18 +126,19 @@ class CBARSimulator : public VistaThreadLoop
{
public:
CBARSimulator( CVABinauralArtificialReverbAudioRenderer* pParent ) : m_pParentRenderer( pParent )
inline CBARSimulator( CVABinauralArtificialReverbAudioRenderer* pParent )
: m_pParentRenderer( pParent )
{
Run();
m_iState = 0; // idle
};
~CBARSimulator()
inline ~CBARSimulator()
{
//StopGently( true );
}
};
bool LoopBody()
inline bool LoopBody()
{
evStartSimulationTrigger.WaitForEvent( true );
......@@ -141,7 +147,7 @@ public:
return true;
};
void AddARUpdateTask( CVABinauralArtificialReverbAudioRenderer::Listener* pL )
inline void AddARUpdateTask( CVABinauralArtificialReverbAudioRenderer::Listener* pL )
{
// Decline during reset
if( m_iState > 1 )
......@@ -151,7 +157,7 @@ public:
m_lTasks.push( pL );
};
void CalculateSimulationTasks()
inline void CalculateSimulationTasks()
{
CVABinauralArtificialReverbAudioRenderer::Listener* pListener( NULL );
......@@ -172,7 +178,7 @@ public:
m_iState = 3; // reset ack
};
void Reset()
inline void Reset()
{
m_iState = 2; // reset request
......@@ -553,7 +559,9 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateScene( CVASceneState* pNewS
UpdateArtificialReverbPaths( false ); // Unforced update validation
if( m_pCurSceneState ) m_pCurSceneState->RemoveReference();
if( m_pCurSceneState )
m_pCurSceneState->RemoveReference();
m_pCurSceneState = m_pNewSceneState;
m_pNewSceneState = NULL;
......@@ -620,14 +628,12 @@ void CVABinauralArtificialReverbAudioRenderer::ManageArtificialReverbPaths( cons
}
// ber aktuelle Quellen und Hrer iterieren und gelschte entfernen
for( std::vector<int>::const_iterator cit = pDiff->viDelSoundSourceIDs.begin();
cit != pDiff->viDelSoundSourceIDs.end(); ++cit )
for( std::vector<int>::const_iterator cit = pDiff->viDelSoundSourceIDs.begin(); cit != pDiff->viDelSoundSourceIDs.end(); ++cit )
{
DeleteSource( *cit );
}
for( std::vector<int>::const_iterator cit = pDiff->viDelListenerIDs.begin();
cit != pDiff->viDelListenerIDs.end(); ++cit )
for( std::vector<int>::const_iterator cit = pDiff->viDelListenerIDs.begin(); cit != pDiff->viDelListenerIDs.end(); ++cit )
{
DeleteListener( *cit );
}
......@@ -635,7 +641,7 @@ void CVABinauralArtificialReverbAudioRenderer::ManageArtificialReverbPaths( cons
// Neue Pfade anlegen: ( neue Hrer ) verknpfen mit ( aktuellen Quellen + neuen Quellen )
for( std::vector<int>::const_iterator lcit = pDiff->viNewListenerIDs.begin(); lcit != pDiff->viNewListenerIDs.end(); ++lcit )
{
int iListenerID = ( *lcit );
const int iListenerID = ( *lcit );
// Neuen Hrer erstellen
Listener* pListener = CreateListener( iListenerID );
......@@ -653,7 +659,7 @@ void CVABinauralArtificialReverbAudioRenderer::ManageArtificialReverbPaths( cons
continue;
if( !pSource->bDeleted )
CBARPath* pPath = CreateArtificialReverbPath( pSource, pListener );
CreateArtificialReverbPath( pSource, pListener );
}
// Neue Quellen
......@@ -668,15 +674,14 @@ void CVABinauralArtificialReverbAudioRenderer::ManageArtificialReverbPaths( cons
continue;
Source* pSource = CreateSource( iSourceID );
CBARPath* pPath = CreateArtificialReverbPath( pSource, pListener );
CreateArtificialReverbPath( pSource, pListener );
}
}
// Neue Pfade anlegen: ( neue Quellen ) verknpfen mit ( aktuellen Hrern )
for( std::vector<int>::const_iterator scit = pDiff->viNewSoundSourceIDs.begin();
scit != pDiff->viNewSoundSourceIDs.end(); ++scit )
for( std::vector<int>::const_iterator scit = pDiff->viNewSoundSourceIDs.begin(); scit != pDiff->viNewSoundSourceIDs.end(); ++scit )
{
int iSourceID = ( *scit );
const int iSourceID = ( *scit );
// Only add, if no other renderer has been connected explicitly with this source
const CVASoundSourceDesc* pSoundSourceDesc = m_pCore->GetSceneManager()->GetSoundSourceDesc( iSourceID );
......@@ -691,7 +696,7 @@ void CVABinauralArtificialReverbAudioRenderer::ManageArtificialReverbPaths( cons
// Neuen Pfad erzeugen zu neuer Quelle
int iListenerID = pDiff->viComListenerIDs[ i ];
Listener* pListener = m_mListener[ iListenerID ];
CBARPath* pPath = CreateArtificialReverbPath( pSource, pListener );
CreateArtificialReverbPath( pSource, pListener );
}
}
......@@ -899,7 +904,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateTrajectories()
return;
}
void CVABinauralArtificialReverbAudioRenderer::SampleTrajectoriesInternal( double dTime )
void CVABinauralArtificialReverbAudioRenderer::SampleTrajectoriesInternal( const double dTime )
{
std::list< Source* >::iterator sit = ctxAudio.m_lSources.begin();
while( sit != ctxAudio.m_lSources.end() )
......@@ -928,7 +933,7 @@ void CVABinauralArtificialReverbAudioRenderer::SampleTrajectoriesInternal( doubl
return;
}
CBARPath* CVABinauralArtificialReverbAudioRenderer::CreateArtificialReverbPath( Source* pSource, Listener* pListener )
void CVABinauralArtificialReverbAudioRenderer::CreateArtificialReverbPath( Source* pSource, Listener* pListener )
{
int iSourceID = pSource->pData->iID;
int iListenerID = pListener->pData->iID;
......@@ -947,8 +952,6 @@ CBARPath* CVABinauralArtificialReverbAudioRenderer::CreateArtificialReverbPath(
m_lARPaths.push_back( pPath );
ctxAudio.m_qpNewARPaths.push( pPath );
return pPath;
}
void CVABinauralArtificialReverbAudioRenderer::DeleteArtificialReverbPath( CBARPath* pPath )
......@@ -963,7 +966,7 @@ void CVABinauralArtificialReverbAudioRenderer::DeleteArtificialReverbPath( CBARP
ctxAudio.m_qpDelARPaths.push( pPath );
}
CVABinauralArtificialReverbAudioRenderer::Listener* CVABinauralArtificialReverbAudioRenderer::CreateListener( int iID )
CVABinauralArtificialReverbAudioRenderer::Listener* CVABinauralArtificialReverbAudioRenderer::CreateListener( const int iID )
{
VA_VERBOSE( "CVABinauralAudioRenderer", "Creating listener with ID " << iID );
......@@ -995,7 +998,7 @@ CVABinauralArtificialReverbAudioRenderer::Listener* CVABinauralArtificialReverbA
return pListener;
}
void CVABinauralArtificialReverbAudioRenderer::DeleteListener( int iListenerID )
void CVABinauralArtificialReverbAudioRenderer::DeleteListener( const int iListenerID )
{
VA_VERBOSE( "CVABinauralAudioRenderer", "Marking listener with ID " << iListenerID << " for removal" );
std::map< int, Listener* >::iterator it = m_mListener.find( iListenerID );
......@@ -1015,7 +1018,7 @@ void CVABinauralArtificialReverbAudioRenderer::DeleteListener( int iListenerID )
return;
}
CVABinauralArtificialReverbAudioRenderer::Source* CVABinauralArtificialReverbAudioRenderer::CreateSource( int iID )
CVABinauralArtificialReverbAudioRenderer::Source* CVABinauralArtificialReverbAudioRenderer::CreateSource( const int iID )
{
VA_VERBOSE( "CVABinauralArtificialReverbAudioRenderer", "Creating source with ID " << iID );
......@@ -1034,7 +1037,7 @@ CVABinauralArtificialReverbAudioRenderer::Source* CVABinauralArtificialReverbAud
return pSource;
}
void CVABinauralArtificialReverbAudioRenderer::DeleteSource( int iSourceID )
void CVABinauralArtificialReverbAudioRenderer::DeleteSource( const int iSourceID )
{
VA_VERBOSE( "CVABinauralAudioRenderer", "Marking source with ID " << iSourceID << " for removal" );
std::map< int, Source* >::iterator it = m_mSources.find( iSourceID );
......@@ -1134,7 +1137,7 @@ void CVABinauralArtificialReverbAudioRenderer::ResetInternalData()
ctxAudio.m_iResetFlag = 2; // set ack
}
void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbPaths( bool bForceUpdate )
void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbPaths( const bool bForceUpdate /* = true */ )
{
// Recalculate artificial reverberation filters where required (listeners only)
std::map< int, Listener* >::const_iterator lcit = m_mListener.begin();
......@@ -1222,17 +1225,16 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
if( ceil( dReverberationTime * GetSampleRate() ) > m_iMaxReverbFilterLengthSamples )
VA_WARN( "CVABinauralArtificialReverbAudioRenderer", "Target filter length smaller than requested reverberation time, truncating." )
ITASampleFrame sfBRIR( 2, m_iMaxReverbFilterLengthSamples, true ); // 0=L, 1=R, TODO member var?
ITASampleFrame sfBRIR( 2, m_iMaxReverbFilterLengthSamples, true ); // 0=L, 1=R, TODO member var?
IVAHRIRDataset* pHRIR = NULL;
if( pListener->pNewHRIR != nullptr )
{
// Acknowledge new HRIR and overwrite current pointer
pListener->pCurHRIR = pListener->pNewHRIR;
pListener->pNewHRIR = NULL;
}
pHRIR = pListener->pCurHRIR;
// HRIR pull example
IVAHRIRDataset* pHRIR = pListener->pCurHRIR;
int iHRIRLength = pHRIR->GetProperties()->iFilterLength;
ITASampleFrame sfTempHRIR( 2, iHRIRLength, true ); // TODO member?
......@@ -1261,7 +1263,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
const double dTimeConst = -13.816f / dReverberationTime;
assert( dTimeConst != 0.0f );
double dAreaNormIntegral = ( exp( dTimeConst * double( m_iMaxReverbFilterLengthSamples ) ) - exp( dTimeConst * dTimeLastImageSource ) ) / dTimeConst;
const double dAreaNormIntegral = ( exp( dTimeConst * double( m_iMaxReverbFilterLengthSamples ) ) - exp( dTimeConst * dTimeLastImageSource ) ) / dTimeConst;
assert( dAreaNormIntegral > 0.0f );
// calc critical distance
......@@ -1315,7 +1317,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
// get random angles
double dAziAngle = rand() / RAND_MAX * 360.0f;
double dAziAngleVistaImpl = VistaRandomNumberGenerator::GetStandardRNG()->GenerateDouble( 0.0f, 360.0f );
//double dAziAngleVistaImpl = VistaRandomNumberGenerator::GetStandardRNG()->GenerateDouble( 0.0f, 360.0f );
double dEleAngle = ( 1.0f - 2.0f * ( rand() / RAND_MAX ) ) * 90.0f;
// get respective HRIRs
......@@ -1329,7 +1331,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
int iRandomSign = 2 * ( rand() % 2 ) - 1;
// Beispiel mit Vista:
double dRandomSignVistaImpl = ( int( VistaRandomNumberGenerator::GetStandardRNG()->GenerateInt31() ) > 0 ) ? 1.0f : -1.0f;
//double dRandomSignVistaImpl = ( int( VistaRandomNumberGenerator::GetStandardRNG()->GenerateInt31() ) > 0 ) ? 1.0f : -1.0f;
bool bEarlyReflectionsPhase = ( dAbsoluteTimePosition < dTimeLastImageSource );
bool bLateReflectionPhase = ( dAbsoluteTimePosition > dTimeLastImageSource ) &&
......@@ -1368,7 +1370,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
if( iDestOffset + iHRIRLength > sfBRIR.length() )
continue;
float* pfDestCh1 = sfBRIR[ 0 ].data();
//float* pfDestCh1 = sfBRIR[ 0 ].data();
sfBRIR.muladd_frame( sfTempHRIR, float( dCurrentScatterFactor ), 0, iDestOffset, iHRIRLength );
}
}
......@@ -1391,7 +1393,7 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
}
assert( int( iCurrentDiracPosition ) + iHRIRLength <= sfBRIR.length() );
float* pfDestCh1 = sfBRIR[ 0 ].data();
//float* pfDestCh1 = sfBRIR[ 0 ].data();
sfBRIR.muladd_frame( sfTempHRIR, float( dCurrentScaleFactor ), 0, iCurrentDiracPosition, iHRIRLength );
} // END PLACING DIRACS IN CURRENT TIMESLOT LOOP
......@@ -1434,11 +1436,11 @@ void CVABinauralArtificialReverbAudioRenderer::UpdateArtificialReverbFilter( Lis
// Class ARPath
CBARPath::CBARPath( double dSamplerate, int iBlocklength )
CBARPath::CBARPath( const double dSampleRate, const int iBlockLength )
{
float fReserverdMaxDelaySamples = ( float ) ( 3 * dSamplerate ); // 3 seconds ~ 1km initial distance
const float fReserverdMaxDelaySamples = ( float ) ( 3 * dSampleRate ); // 3 seconds ~ 1km initial distance
m_iDefaultVDLSwitchingAlgorithm = CITAVariableDelayLine::CUBIC_SPLINE_INTERPOLATION;
pVariableDelayLine = new CITAVariableDelayLine( dSamplerate, iBlocklength, fReserverdMaxDelaySamples, m_iDefaultVDLSwitchingAlgorithm );
pVariableDelayLine = new CITAVariableDelayLine( dSampleRate, iBlockLength, fReserverdMaxDelaySamples, m_iDefaultVDLSwitchingAlgorithm );
return;
}
......
......@@ -84,7 +84,7 @@ public:
int CallObject( const CVAStruct&, CVAStruct& );
void Reset();
void LoadScene( const std::string& ) {};
inline void LoadScene( const std::string& ) {};
void UpdateScene( CVASceneState* pNewSceneState );
void UpdateGlobalAuralizationMode( int iGlobalAuralizationMode );
void ProcessStream( const ITAStreamInfo* pStreamInfo );
......@@ -156,7 +156,7 @@ private:
VAVec3 vPredView; //!< Estimated Orientation (View-Vector)
VAVec3 vPredUp; //!< Estimated Orientation (Up-Vector)
void PreRequest()
inline void PreRequest()
{
pData = NULL;
......@@ -169,13 +169,13 @@ private:
pMotionModel = new CVASharedMotionModel( new CVABasicMotionModel( oDefaultConfig ), true );
};
void PreRelease()
inline void PreRelease()
{
delete pMotionModel;
pMotionModel = NULL;
};
double GetCreationTimestamp() const
inline double GetCreationTimestamp() const
{
return m_dCreationTimeStamp;
};
......@@ -254,18 +254,18 @@ private:
// --= Update internal lists (sources, listener, artificial reverb paths) =--
void ManageArtificialReverbPaths( const CVASceneStateDiff* pDiff );
Listener* CreateListener( int iID );
void DeleteListener( int iID);
Source* CreateSource( int iID );
void DeleteSource( int iID );
CBARPath* CreateArtificialReverbPath( Source* pSource, Listener* pListener );
Listener* CreateListener( const int iID );
void DeleteListener( const int iID);
Source* CreateSource( const int iID );
void DeleteSource( const int iID );
void CreateArtificialReverbPath( Source* pSource, Listener* pListener );
void DeleteArtificialReverbPath( CBARPath* pPath );
// --= Async updates (user context) =--
void UpdateTrajectories();
void UpdateArtificialReverbPaths( bool bForceUpdate = true );
void UpdateArtificialReverbPaths( const bool bForceUpdate = true );
//! Update artificial reverberation filter for a listener
/**
......@@ -275,7 +275,7 @@ private:
// --= Sync updates (audio thread context) =--
void SampleTrajectoriesInternal( double dTime );
void SampleTrajectoriesInternal( const double dTime );
void SyncInternalData();
void ResetInternalData();
......
......@@ -1124,8 +1124,8 @@ void CVABinauralFreeFieldAudioRenderer::UpdateGlobalAuralizationMode( int iGloba
CVABFFSoundPath::CVABFFSoundPath( double dSamplerate, int iBlocklength, int iHRIRFilterLength, int iDirFilterLength )
{
pThirdOctaveFilterBank = CITAThirdOctaveFilterbank::Create( dSamplerate, iBlocklength,
CITAThirdOctaveFilterbank::FIR_SPLINE_LINEAR_PHASE);
//CVAThirdOctaveFilterbank::IIR_BIQUADS_ORDER10 );
//CITAThirdOctaveFilterbank::FIR_SPLINE_LINEAR_PHASE);
CITAThirdOctaveFilterbank::IIR_BIQUADS_ORDER10 );
pThirdOctaveFilterBank->SetIdentity();
float fReserverdMaxDelaySamples = (float) ( 3 * dSamplerate ); // 3 Sekunden ~ 1km Entfernung
......
......@@ -1065,7 +1065,7 @@ void CVAMonauralFreeFieldAudioRenderer::UpdateSoundPaths()
return;
}
void CVAMonauralFreeFieldAudioRenderer::UpdateGlobalAuralizationMode( int iGlobalAuralizationMode )
void CVAMonauralFreeFieldAudioRenderer::UpdateGlobalAuralizationMode( const int iGlobalAuralizationMode )
{
if( m_iCurGlobalAuralizationMode == iGlobalAuralizationMode )
return;
......
/*
*
* VVV VVV A
* VVV VVV AAA Virtual Acoustics
* VVV VVV AAA Real-time auralisation for virtual reality
* VVV VVV AAA
* VVVVVV AAA (c) Copyright Institut fr Technische Akustik (ITA)
* VVVV AAA RWTH Aachen (http://www.akustik.rwth-aachen.de)
*
* ---------------------------------------------------------------------------------
*
* Datei: VAAudioRenderer.h
*
* Zweck: Audio renderer interface
*
* Autor(en): Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de)
* Jonas Stienen (Jonas.Stienen@akustik.rwth-aachen.de)
*
* ---------------------------------------------------------------------------------
*/
// $Id: $
#ifndef __VA_AUDIORENDERER__
#define __VA_AUDIORENDERER__
#ifndef IW_VA_AUDIO_RENDERER
#define IW_VA_AUDIO_RENDERER
// Forward declarations
class IVADirectivity;
......@@ -40,11 +17,11 @@ class CVAStruct;
class CVAAudioRendererInitParams
{
public:
std::string sID; // ID (right-hand side of declaration CLASS:ID)
std::string sClass; // Renderer class
CVACoreImpl* pCore; // Parent core
const CVAStruct* pConfig; // Renderer configuration
std::vector< std::string > vsOutputs; // Renderer outputs (e.g. Output:HP, Reproduction:CTC4)
std::string sID; //!< ID (right-hand side of declaration CLASS:ID)
std::string sClass; //!< Renderer class
CVACoreImpl* pCore; //!< Parent core
const CVAStruct* pConfig; //!< Renderer configuration
std::vector< std::string > vsOutputs; //!< Renderer outputs (e.g. Output:HP, Reproduction:CTC4)
};
//! Audio renderer interface
......@@ -54,19 +31,19 @@ public:
class IVAAudioRenderer
{
public:
virtual ~IVAAudioRenderer() {};
virtual inline ~IVAAudioRenderer() {};
virtual void Reset() = 0;
// --= Resource hooks =--
virtual void LoadScene( const std::string& sFilename ) = 0;
virtual void LoadScene( const std::string& sFileName ) = 0;
virtual void PostLoadDirectivity( const IVADirectivity* ) {};
virtual void PreFreeDirectivity( const IVADirectivity* ) {};
virtual inline void PostLoadDirectivity( const IVADirectivity* ) {};
virtual inline void PreFreeDirectivity( const IVADirectivity* ) {};
virtual void PostLoadHRIRDataset( const IVAHRIRDataset* ) {};
virtual void PreFreeHRIRDataset( const IVAHRIRDataset* ) {};
virtual inline void PostLoadHRIRDataset( const IVAHRIRDataset* ) {};
virtual inline void PreFreeHRIRDataset( const IVAHRIRDataset* ) {};
// --= Update methods =--
......@@ -131,4 +108,4 @@ private:
std::string m_sClassIdentifier;
};
#endif // __VA_AUDIORENDERER__
#endif // IW_VA_AUDIO_RENDERER
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