Commit f2abab78 authored by Jonas Stienen's avatar Jonas Stienen
Browse files

Moving from macro-based renderer registry to a procedural registration during...

Moving from macro-based renderer registry to a procedural registration during core creation for 'internal' renderers.
Also refactoring Freefield to FreeField (or FREEFIELD to FREE_FIELD) and adding some more qualified names to classes, i.e. 'GenericPath' as 'PrototypeGenericPath'.
parent ca1f6770
......@@ -95,13 +95,13 @@ if( NOT DEFINED ITA_VACORE_WITH_RENDERER_AMBIENT_MIXER )
set( ITA_VACORE_WITH_RENDERER_AMBIENT_MIXER ON CACHE BOOL "Build VACore with rendering module: ambient mixer" )
endif( NOT DEFINED ITA_VACORE_WITH_RENDERER_AMBIENT_MIXER )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_AMBISONICS_FREEFIELD )
set( ITA_VACORE_WITH_RENDERER_AMBISONICS_FREEFIELD ON CACHE BOOL "Build VACore with rendering module: ambisonics free-field" )
endif( NOT DEFINED ITA_VACORE_WITH_RENDERER_AMBISONICS_FREEFIELD )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_AMBISONICS_FREE_FIELD )
set( ITA_VACORE_WITH_RENDERER_AMBISONICS_FREE_FIELD ON CACHE BOOL "Build VACore with rendering module: ambisonics free-field" )
endif( NOT DEFINED ITA_VACORE_WITH_RENDERER_AMBISONICS_FREE_FIELD )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_BINAURAL_FREEFIELD )
set( ITA_VACORE_WITH_RENDERER_BINAURAL_FREEFIELD ON CACHE BOOL "Build VACore with rendering module: binaural free-field" )
endif( NOT DEFINED ITA_VACORE_WITH_RENDERER_BINAURAL_FREEFIELD )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD )
set( ITA_VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD ON CACHE BOOL "Build VACore with rendering module: binaural free-field" )
endif( NOT DEFINED ITA_VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB )
set( ITA_VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB ON CACHE BOOL "Build VACore with rendering module: artificial reverb" )
endif( NOT DEFINED ITA_VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB )
......@@ -112,9 +112,9 @@ if( NOT DEFINED ITA_VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE )
set( ITA_VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE ON CACHE BOOL "Build VACore with rendering module: air traffic noise (VATSS)" )
endif( NOT DEFINED ITA_VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_MONAURAL_FREEFIELD )
set( ITA_VACORE_WITH_RENDERER_MONAURAL_FREEFIELD ON CACHE BOOL "Build VACore with rendering module: monaural free-field" )
endif( NOT DEFINED ITA_VACORE_WITH_RENDERER_MONAURAL_FREEFIELD )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_MONAURAL_FREE_FIELD )
set( ITA_VACORE_WITH_RENDERER_MONAURAL_FREE_FIELD ON CACHE BOOL "Build VACore with rendering module: monaural free-field" )
endif( NOT DEFINED ITA_VACORE_WITH_RENDERER_MONAURAL_FREE_FIELD )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_PROTOTYPE_DUMMY )
set( ITA_VACORE_WITH_RENDERER_PROTOTYPE_DUMMY OFF CACHE BOOL "Build VACore with rendering module: prototype dummy" )
......@@ -126,9 +126,9 @@ if( NOT DEFINED ITA_VACORE_WITH_RENDERER_PROTOTYPE_GENERIC_PATH )
set( ITA_VACORE_WITH_RENDERER_PROTOTYPE_GENERIC_PATH ON CACHE BOOL "Build VACore with rendering module: prototype generic path" )
endif( NOT DEFINED ITA_VACORE_WITH_RENDERER_PROTOTYPE_GENERIC_PATH )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_VBAP_FREEFIELD )
set( ITA_VACORE_WITH_RENDERER_VBAP_FREEFIELD OFF CACHE BOOL "Build VACore with rendering module: vector-base amplitude panning free-field" )
endif( NOT DEFINED ITA_VACORE_WITH_RENDERER_VBAP_FREEFIELD )
if( NOT DEFINED ITA_VACORE_WITH_RENDERER_VBAP_FREE_FIELD )
set( ITA_VACORE_WITH_RENDERER_VBAP_FREE_FIELD OFF CACHE BOOL "Build VACore with rendering module: vector-base amplitude panning free-field" )
endif( NOT DEFINED ITA_VACORE_WITH_RENDERER_VBAP_FREE_FIELD )
# Reproduction modules
......@@ -203,11 +203,11 @@ add_definitions( "-DVACORE_MAX_NUM_LISTENERS=${ITA_VACORE_MAX_NUM_LISTENERS}" )
if( ${ITA_VACORE_WITH_RENDERER_AMBIENT_MIXER} )
add_definitions( "-DVACORE_WITH_RENDERER_AMBIENT_MIXER=1" )
endif()
if( ${ITA_VACORE_WITH_RENDERER_AMBISONICS_FREEFIELD} )
add_definitions( "-DVACORE_WITH_RENDERER_AMBISONICS_FREEFIELD=1" )
if( ${ITA_VACORE_WITH_RENDERER_AMBISONICS_FREE_FIELD} )
add_definitions( "-DVACORE_WITH_RENDERER_AMBISONICS_FREE_FIELD=1" )
endif()
if( ${ITA_VACORE_WITH_RENDERER_BINAURAL_FREEFIELD} )
add_definitions( "-DVACORE_WITH_RENDERER_BINAURAL_FREEFIELD=1" )
if( ${ITA_VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD} )
add_definitions( "-DVACORE_WITH_RENDERER_BINAURAL_FREE_FIELD=1" )
endif()
if( ${ITA_VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB} )
add_definitions( "-DVACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB=1" )
......@@ -223,8 +223,8 @@ endif()
if( ${ITA_VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE} )
add_definitions( "-DVACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE=1" )
endif()
if( ${ITA_VACORE_WITH_RENDERER_MONAURAL_FREEFIELD} )
add_definitions( "-DVACORE_WITH_RENDERER_MONAURAL_FREEFIELD=1" )
if( ${ITA_VACORE_WITH_RENDERER_MONAURAL_FREE_FIELD} )
add_definitions( "-DVACORE_WITH_RENDERER_MONAURAL_FREE_FIELD=1" )
endif()
if( ${ITA_VACORE_WITH_RENDERER_PROTOTYPE_DUMMY} )
add_definitions( "-DVACORE_WITH_RENDERER_PROTOTYPE_DUMMY=1" )
......@@ -235,8 +235,8 @@ endif()
if( ${ITA_VACORE_WITH_RENDERER_PROTOTYPE_GENERIC_PATH} )
add_definitions( "-DVACORE_WITH_RENDERER_PROTOTYPE_GENERIC_PATH=1" )
endif()
if( ${ITA_VACORE_WITH_RENDERER_VBAP_FREEFIELD} )
add_definitions( "-DVACORE_WITH_RENDERER_VBAP_FREEFIELD=1" )
if( ${ITA_VACORE_WITH_RENDERER_VBAP_FREE_FIELD} )
add_definitions( "-DVACORE_WITH_RENDERER_VBAP_FREE_FIELD=1" )
endif()
# Reproduction definitions
......
......@@ -103,8 +103,8 @@ Buffersize = AUTO
#
[Renderer:MyBinauralFreefield]
Class = BinauralFreefield
[Renderer:MyBinauralFreeField]
Class = BinauralFreeField
Enabled = true
Outputs = MyTalkthroughHeadphones
HRIRFilterLength = 256
......@@ -158,7 +158,7 @@ UpdateRateDD = 0.08
DirectSoundPowerCorrectionFactor = 0.05
[Renderer:MyHearingAidRenderer]
Class = HearingAid
Class = PrototypeHearingAid
Enabled = false
Outputs = HearingAidTalkthrough
#Outputs = MyTalkthroughHeadphones
......@@ -174,7 +174,7 @@ DumpListeners = false
DumpListenersGain = 10
[Renderer:MyGenericRenderer]
Class = GenericPath
Class = PrototypeGenericPath
Enabled = false
Outputs = MyTalkthroughHeadphones
NumChannels = 2
......@@ -189,14 +189,14 @@ Outputs = MyTalkthroughHeadphones
[Renderer:MyVBAPFreefield]
Class = VBAPFreefield
Class = VBAPFreeField
Enabled = false
Output = VRLab_Horizontal_LS
Outputs = MixdownHeadphones
[Renderer:MyDummyRenderer]
class = Dummy
class = PrototypeDummy
Description = Dummy renderer for testing and benchmarking
Enabled = false
OutputGroup = MyDesktopHP
......
......@@ -16,7 +16,7 @@
#include <assert.h>
#include <string>
#if VACORE_WITH_RENDERER_AMBIENT_MIXER == 1
#if( VACORE_WITH_RENDERER_AMBIENT_MIXER == 1 )
CVAAmbientMixerAudioRenderer::CVAAmbientMixerAudioRenderer( const CVAAudioRendererInitParams& oParams_ )
: m_oParams( oParams_ )
......
......@@ -44,8 +44,6 @@ private:
ITAAtomicBool m_bIndicateReset, m_bResetAck;
};
VA_REGISTER_AUDIO_RENDERER( CVAAmbientMixerAudioRenderer, "AmbientMixer" );
#endif // ( VACORE_WITH_RENDERER_AMBIENT_MIXER == 1 )
#endif // __VA_AMBIENT_MIXER_AUDIO_RENDERER__
#include "VAAmbisonicsFreefieldAudioRenderer.h"
#if ( VACORE_WITH_RENDERER_AMBISONICS_FREEFIELD == 1 )
#if ( VACORE_WITH_RENDERER_AMBISONICS_FREE_FIELD == 1 )
#include "../../../Scene/VAScene.h"
#include "../../../Utils/VAUtils.h"
......@@ -301,4 +301,4 @@ int CVAAmbisonicsFreefieldAudioRenderer::GetIndex(int m, int n)
}
#endif // ( VACORE_WITH_RENDERER_AMBISONICS_FREEFIELD == 1 )
#endif // ( VACORE_WITH_RENDERER_AMBISONICS_FREE_FIELD == 1 )
......@@ -25,7 +25,7 @@
#ifndef __VA_AMBISONICSFREEFIELDAUDIORENDERER__
#define __VA_AMBISONICSFREEFIELDAUDIORENDERER__
#if ( VACORE_WITH_RENDERER_AMBISONICS_FREEFIELD == 1 )
#if ( VACORE_WITH_RENDERER_AMBISONICS_FREE_FIELD == 1 )
// VA includes
#include "../../../Filtering/VAVariableDelayLine.h"
......@@ -143,8 +143,6 @@ private:
void SyncInternalData();
};
VA_REGISTER_AUDIO_RENDERER( CVAAmbisonicsFreefieldAudioRenderer, "AmbisonicsFreefield" );
#endif // ( VACORE_WITH_RENDERER_AMBISONICS_FREEFIELD == 1 )
#endif // ( VACORE_WITH_RENDERER_AMBISONICS_FREE_FIELD == 1 )
#endif // __VA_AMBISONICSFREEFIELDAUDIORENDERER__
......@@ -318,8 +318,6 @@ private:
friend class CVABATNSourcePoolFactory;
};
VA_REGISTER_AUDIO_RENDERER( CVABinauralAirTrafficNoiseAudioRenderer, "BinauralAirTrafficNoise" );
#endif // ( VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE == 1 )
#endif // __VA_BINAURALAIRTRAFFICNOISEAUDIORENDERER__
......@@ -285,8 +285,6 @@ private:
friend class CBARSimulator;
};
VA_REGISTER_AUDIO_RENDERER( CVABinauralArtificialReverbAudioRenderer, "BinauralArtificialReverb" );
#endif // ( VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB == 1 )
#endif // __VA_BINAURALARTIFICIALREVERBDAUDIORENDERER__
// $Id: $
#include "VABinauralFreefieldAudioRenderer.h"
#if ( VACORE_WITH_RENDERER_BINAURAL_FREEFIELD == 1 )
#if ( VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD == 1 )
// VA includes
#include "../../../Data/VADirectivity.h"
......@@ -51,6 +51,8 @@
#include <tbb/atomic.h>
#include <tbb/concurrent_queue.h>
//static CVAAudioRendererDefaultFactory< CVABinauralFreeFieldAudioRenderer > g_oFactoryCVABinauralFreeFieldAudioRenderer( "BinauralFreeField" );
class CVABFFSoundPath : public CVAPoolObject
{
public:
......@@ -1399,4 +1401,4 @@ void CVABinauralFreeFieldAudioRenderer::onStopDumpListeners()
m_bDumpListeners = false;
}
#endif // ( VACORE_WITH_RENDERER_BINAURAL_FREEFIELD == 1 )
#endif // ( VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD == 1 )
......@@ -24,7 +24,7 @@
#ifndef __VA_BINAURALFREEFIELDAUDIORENDERER__
#define __VA_BINAURALFREEFIELDAUDIORENDERER__
#if( VACORE_WITH_RENDERER_BINAURAL_FREEFIELD == 1 )
#if( VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD == 1 )
// VA includes
#include "../../../Filtering/VAVariableDelayLine.h"
......@@ -375,8 +375,6 @@ private:
friend class CVABFFSourcePoolFactory;
};
VA_REGISTER_AUDIO_RENDERER( CVABinauralFreeFieldAudioRenderer, "BinauralFreeField" );
#endif // ( VACORE_WITH_RENDERER_BINAURAL_FREEFIELD==1 )
#endif // ( VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD==1 )
#endif // __VA_BINAURALFREEFIELDAUDIORENDERER__
......@@ -291,8 +291,6 @@ private:
friend class ComplexSoundPath;
};
VA_REGISTER_AUDIO_RENDERER( CVARoomAcousticsAudioRenderer, "BinauralRoomAcoustics" );
#endif // (VACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS==1)
#endif // __VA_ROOMACOUSTICSLAUDIORENDERER__
......
// $Id: $
#include "VAMonauralFreefieldAudioRenderer.h"
#if( VACORE_WITH_RENDERER_MONAURAL_FREEFIELD==1 )
#if( VACORE_WITH_RENDERER_MONAURAL_FREE_FIELD==1 )
// VA includes
#include "../../../Data/VADirectivity.h"
......@@ -1144,4 +1144,4 @@ int CVAMonauralFreeFieldAudioRenderer::CallObject( const CVAStruct& oArgs, CVASt
oReturn.Clear();
return -1;
}
#endif // (VACORE_WITH_RENDERER_MONAURAL_FREEFIELD==1)
#endif // (VACORE_WITH_RENDERER_MONAURAL_FREE_FIELD==1)
......@@ -24,7 +24,7 @@
#ifndef __VA_MONAURALFREEFIELDAUDIORENDERER__
#define __VA_MONAURALFREEFIELDAUDIORENDERER__
#if( VACORE_WITH_RENDERER_MONAURAL_FREEFIELD==1 )
#if( VACORE_WITH_RENDERER_MONAURAL_FREE_FIELD==1 )
// VA includes
#include "../../../Filtering/VAVariableDelayLine.h"
......@@ -347,8 +347,6 @@ private:
friend class CVAMFFSourcePoolFactory;
};
VA_REGISTER_AUDIO_RENDERER( CVAMonauralFreeFieldAudioRenderer, "MonauralFreeField" );
#endif // ( VACORE_WITH_RENDERER_MONAURAL_FREEFIELD==1 )
#endif // ( VACORE_WITH_RENDERER_MONAURAL_FREE_FIELD == 1 )
#endif // __VA_MONAURALFREEFIELDAUDIORENDERER__
......@@ -47,8 +47,6 @@ private:
const CVAAudioRendererInitParams oParams; //!< Create a const copy of the init params
};
VA_REGISTER_AUDIO_RENDERER( CVAPTDummyAudioRenderer, "Dummy" );
#endif // ( VACORE_WITH_RENDERER_PROTOTYPE_DUMMY == 1 )
#endif // __VA_PT_DUMMY_AUDIO_RENDERER__
......@@ -194,8 +194,6 @@ private:
friend class CVAPTGPSourcePoolFactory;
};
VA_REGISTER_AUDIO_RENDERER( CVAPTGenericPathAudioRenderer, "GenericPath" );
#endif // ( VACORE_WITH_RENDERER_PROTOTYPE_GENERIC_PATH == 1 )
#endif // __VA_PT_GENERIC_PATH_AUDIO_RENDERER__
......@@ -388,8 +388,6 @@ private:
friend class CVAPTHASourcePoolFactory;
};
VA_REGISTER_AUDIO_RENDERER( CVAPTHearingAidRenderer, "PrototypeHearingAid" );
#endif // ( VACORE_WITH_RENDERER_PROTOTYPE_HEARING_AID == 1 )
#endif // __VA_PROTOTYPE_HEARINGAID_RENDERER__
......@@ -90,41 +90,43 @@ public:
//! Audio renderer factory method interface
class IVAAudioRendererFactory {
class IVAAudioRendererFactory
{
public:
virtual ~IVAAudioRendererFactory() {};
virtual inline ~IVAAudioRendererFactory() {};
// Return the class name
virtual std::string GetClassName() const=0;
virtual std::string GetClassIdentifier() const = 0;
// Factory method
virtual IVAAudioRenderer* Create(const CVAAudioRendererInitParams& oParams)=0;
virtual IVAAudioRenderer* Create( const CVAAudioRendererInitParams& oParams ) = 0;
};
//! Audio renderer default factory (template)
template< class T >
class CVAAudioRendererDefaultFactory : IVAAudioRendererFactory
template< class TRenderer >
class CVAAudioRendererDefaultFactory : public IVAAudioRendererFactory
{
public:
inline CVAAudioRendererDefaultFactory( const std::string& sClassName )
: m_sClassName( sClassName )
: m_sClassIdentifier( sClassName )
{
CVAAudioRendererRegistry::GetInstance()->RegisterFactory( this );
// drausch: no ctor side effects like registration on singleton
//CVAAudioRendererRegistry::GetInstance()->RegisterFactory( this );
};
inline std::string GetClassName() const
inline std::string GetClassIdentifier() const
{
return m_sClassName;
return m_sClassIdentifier;
};
inline IVAAudioRenderer* Create( const CVAAudioRendererInitParams& oParams )
{
return new T( oParams );
return new TRenderer( oParams );
};
private:
std::string m_sClassName;
std::string m_sClassIdentifier;
};
#endif // __VA_AUDIORENDERER__
// $Id: $
#include "VAAudioRendererRegistry.h"
#include <cassert>
#include <ITAStringUtils.h>
#include "Ambient/Mixer//VAAmbientMixerAudioRenderer.h"
#include "Ambisonics/Freefield/VAAmbisonicsFreefieldAudioRenderer.h"
#include "Binaural/AirTrafficNoise/VAAirTrafficNoiseAudioRenderer.h"
#include "Binaural/ArtificialReverb/VABinauralArtificialReverb.h"
#include "Binaural/FreeField/VABinauralFreefieldAudioRenderer.h"
#include "Binaural/RoomAcoustics/VARoomAcousticsAudioRenderer.h"
#include "Monaural/FreeField/VAMonauralFreeFieldAudioRenderer.h"
#include "Prototyping/Dummy/VAPTDummyAudioRenderer.h"
#include "Prototyping/GenericPath/VAPTGenericPathAudioRenderer.h"
#include "Prototyping/HearingAid/VAPTHearingAidRenderer.h"
#include "VBAP/Freefield/VAVBAPFreefieldAudioRenderer.h"
CVAAudioRendererRegistry* CVAAudioRendererRegistry::pInstance(nullptr);
CVAAudioRendererRegistry* CVAAudioRendererRegistry::GetInstance() {
if (!pInstance) pInstance = new CVAAudioRendererRegistry;
return pInstance;
}
#include <ITAStringUtils.h>
CVAAudioRendererRegistry::CVAAudioRendererRegistry() {
#include <cassert>
}
static CVAAudioRendererRegistry* g_pInstance;
CVAAudioRendererRegistry::~CVAAudioRendererRegistry() {
// TODO: Gibbet im moment nich... Ma mache...
CVAAudioRendererRegistry* CVAAudioRendererRegistry::GetInstance()
{
if( !g_pInstance )
{
g_pInstance = new CVAAudioRendererRegistry();
}
return g_pInstance;
}
void CVAAudioRendererRegistry::RegisterFactory(IVAAudioRendererFactory* pFactory) {
void CVAAudioRendererRegistry::RegisterFactory( IVAAudioRendererFactory* pFactory )
{
assert( pFactory );
m_pFactories.push_back( pFactory );
}
IVAAudioRendererFactory* CVAAudioRendererRegistry::FindFactory(const std::string& sClassName) {
std::string s = toUppercase(sClassName);
for (std::vector<IVAAudioRendererFactory*>::iterator it=m_pFactories.begin(); it!=m_pFactories.end(); ++it)
if (toUppercase((*it)->GetClassName()) == s) return *it;
IVAAudioRendererFactory* CVAAudioRendererRegistry::FindFactory( const std::string& sClassName )
{
std::string s = toUppercase( sClassName );
for( std::vector<IVAAudioRendererFactory*>::iterator it = m_pFactories.begin(); it != m_pFactories.end(); ++it )
{
IVAAudioRendererFactory* pFactory( *it );
if( toUppercase( pFactory->GetClassIdentifier() ) == s )
return pFactory;
}
return nullptr;
}
void CVAAudioRendererRegistry::RegisterInternalCoreFactoryMethods()
{
// A little protection against double factory creation
if( m_bInternalCoreFactoriesRegistered )
return;
// Ambient
#if( VACORE_WITH_RENDERER_AMBIENT_MIXER == 1 )
RegisterRendererDefaultFactory< CVAAmbientMixerAudioRenderer>( "AmbientMixer" );
#endif // ( VACORE_WITH_RENDERER_AMBIENT_MIXER == 1 )
// Ambisonics
#if( VACORE_WITH_RENDERER_AMBISONICS_FREE_FIELD == 1 )
RegisterRendererDefaultFactory< CVAAmbisonicsFreefieldAudioRenderer >( "AmbisonicsFreeField" );
#endif // ( VACORE_WITH_RENDERER_AMBISONICS_FREE_FIELD == 1 )
// Binaural
#if( VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD == 1 )
RegisterRendererDefaultFactory< CVABinauralFreeFieldAudioRenderer >( "BinauralFreeField" );
#endif // ( VACORE_WITH_RENDERER_BINAURAL_FREE_FIELD == 1 )
#if( VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE == 1 )
RegisterRendererDefaultFactory< CVABinauralAirTrafficNoiseAudioRenderer >( "BinauralAirTrafficNoise" );
#endif // ( VACORE_WITH_RENDERER_BINAURAL_AIR_TRAFFIC_NOISE == 1 )
#if( VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB == 1 )
RegisterRendererDefaultFactory< CVABinauralArtificialReverbAudioRenderer >( "BinauralArtificialReverb" );
#endif // ( VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB == 1 )
#if( VACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS == 1 )
RegisterRendererDefaultFactory< CVARoomAcousticsAudioRenderer>( "BinauralRoomAcoustics" );
#endif // ( VACORE_WITH_RENDERER_BINAURAL_ROOM_ACOUSTICS == 1 )
// Monaural
#if( VACORE_WITH_RENDERER_MONAURAL_FREE_FIELD == 1 )
RegisterRendererDefaultFactory< CVAMonauralFreeFieldAudioRenderer >( "MonauralFreeField" );
#endif // ( VACORE_WITH_RENDERER_MONAURAL_FREE_FIELD == 1 )
// Prototyping
#if( VACORE_WITH_RENDERER_PROTOTYPE_DUMMY == 1 )
RegisterRendererDefaultFactory< CVAPTDummyAudioRenderer >( "PrototypeDummy" );
#endif // ( VACORE_WITH_RENDERER_PROTOTYPE_DUMMY == 1 )
#if( VACORE_WITH_RENDERER_PROTOTYPE_GENERIC_PATH == 1 )
//VA_REGISTER_AUDIO_RENDERER( CVAPTGenericPathAudioRenderer, "GenericPath" );
RegisterRendererDefaultFactory< CVAPTGenericPathAudioRenderer >( "PrototypeGenericPath" );
#endif // ( VACORE_WITH_RENDERER_PROTOTYPE_GENERIC_PATH == 1 )
#if( VACORE_WITH_RENDERER_PROTOTYPE_HEARING_AID == 1 )
RegisterRendererDefaultFactory< CVAPTHearingAidRenderer >( "PrototypeHearingAid" );
#endif // ( VACORE_WITH_RENDERER_PROTOTYPE_HEARING_AID == 1 )
// VBAP
#if( VACORE_WITH_RENDERER_VBAP_FREE_FIELD == 1 )
RegisterRendererDefaultFactory< CVAVBAPFreeFieldAudioRenderer >( "VBAPFreeField" );
#endif // ( VACORE_WITH_RENDERER_VBAP_FREE_FIELD == 1 )
m_bInternalCoreFactoriesRegistered = true;
}
......@@ -30,24 +30,45 @@ class IVAAudioRenderer;
class IVAAudioRendererFactory;
//! Audio renderer registry (singleton)
class CVAAudioRendererRegistry {
// drausch sagt:
class CVAAudioRendererRegistry
{
public:
template< typename TRenderer >
inline void RegisterRendererDefaultFactory( const std::string& sClassIdentifier )
{
this->RegisterFactory( new CVAAudioRendererDefaultFactory< TRenderer >( sClassIdentifier ) );
};
static CVAAudioRendererRegistry* GetInstance();
CVAAudioRendererRegistry();
virtual ~CVAAudioRendererRegistry();
inline CVAAudioRendererRegistry() : m_bInternalCoreFactoriesRegistered( false ) {};
inline virtual ~CVAAudioRendererRegistry() {};
void RegisterFactory( IVAAudioRendererFactory* pFactory );
IVAAudioRendererFactory* FindFactory( const std::string& sClassName );
void RegisterFactory(IVAAudioRendererFactory* pFactory);
IVAAudioRendererFactory* FindFactory(const std::string& sClassName);
protected:
//! Registers core-internal audio rendering factories (only call once)
/**
* If you are writing your own renderer, add your class into
* this method. If you are using plugin, registration will
* be done automatically.
*/
void RegisterInternalCoreFactoryMethods();
friend class CVACoreImpl;
private:
static CVAAudioRendererRegistry* pInstance;
std::vector<IVAAudioRendererFactory*> m_pFactories;
std::vector< IVAAudioRendererFactory* > m_pFactories;
bool m_bInternalCoreFactoriesRegistered;
};
// Audio renderer registration macro (outside class)
/* war:
#define VA_REGISTER_AUDIO_RENDERER(CLASS, CLASSNAME) \
static CVAAudioRendererDefaultFactory<CLASS> g_oFactory_##CLASS##(CLASSNAME);
*/
#endif // __VA_AUDIORENDERERREGISTRY_H__
#include "VAVBAPFreefieldAudioRenderer.h"
#if ( VACORE_WITH_RENDERER_VBAP_FREEFIELD == 1 )
#if ( VACORE_WITH_RENDERER_VBAP_FREE_FIELD == 1 )
#include "../../../Scene/VAScene.h"
#include "../../../Utils/VAUtils.h"
......@@ -30,7 +30,7 @@
#include <math.h>
CVAVBAPFreefieldAudioRenderer::CVAVBAPFreefieldAudioRenderer( const CVAAudioRendererInitParams& oParams )
CVAVBAPFreeFieldAudioRenderer::CVAVBAPFreeFieldAudioRenderer( const CVAAudioRendererInitParams& oParams )
: m_pCurSceneState( nullptr )
, m_bResetTrigger( false )
, m_oParams( oParams )
......@@ -50,7 +50,7 @@ CVAVBAPFreefieldAudioRenderer::CVAVBAPFreefieldAudioRenderer( const CVAAudioRend
// Koordinaten und Auralisierung festlegen (mko: AuraMode? Wozu? Raumakustik?)
m_iCurGlobalAuralizationMode = IVACore::VA_AURAMODE_DEFAULT;
m_vecCaveCenterPos.init( 0, 0, 0 );
m_vecCaveCenterPos.SetValues( 0.0f, 0.0f, 0.0f );
m_vecCaveCenterOrientYPR.init( 0, 0, 0 );
m_vRotRoll.init( 0, 0, -1);
......@@ -150,17 +150,17 @@ CVAVBAPFreefieldAudioRenderer::CVAVBAPFreefieldAudioRenderer( const CVAAudioRend
m_pdsOutput->SetStreamEventHandler( this );
}
CVAVBAPFreefieldAudioRenderer::~CVAVBAPFreefieldAudioRenderer()
CVAVBAPFreeFieldAudioRenderer::~CVAVBAPFreeFieldAudioRenderer()
{
delete m_pdsOutput;
}
void CVAVBAPFreefieldAudioRenderer::Init( const CVAStruct& oArgs )
void CVAVBAPFreeFieldAudioRenderer::Init( const CVAStruct& oArgs )
{
return;
}
void CVAVBAPFreefieldAudioRenderer::Reset()
void CVAVBAPFreeFieldAudioRenderer::Reset()
{
m_bResetTrigger = true;
while( m_bResetTrigger )
......@@ -173,7 +173,7 @@ void CVAVBAPFreefieldAudioRenderer::Reset()
}
void CVAVBAPFreefieldAudioRenderer::UpdateScene( CVASceneState* pNewSceneState )
void CVAVBAPFreeFieldAudioRenderer::UpdateScene( CVASceneState* pNewSceneState )
{ m_pNewSceneState = pNewSceneState;
if (m_pNewSceneState == m_pCurSceneState) return;
......@@ -214,7 +214,7 @@ void CVAVBAPFreefieldAudioRenderer::UpdateScene( CVASceneState* pNewSceneState )
m_pNewSceneState = nullptr;
}
void CVAVBAPFreefieldAudioRenderer::ManageSoundPaths( const CVASceneStateDiff* pDiff )
void CVAVBAPFreeFieldAudioRenderer::ManageSoundPaths( const CVASceneStateDiff* pDiff )
{
// ber aktuelle Pfade iterieren und gelschte markieren
std::list< SoundPath >::iterator it = m_lSoundPaths.begin();
......@@ -249,12 +249,12 @@ void CVAVBAPFreefieldAudioRenderer::ManageSoundPaths( const CVASceneStateDiff* p
return;