Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
VACore
Commits
d6bcc6ae
Commit
d6bcc6ae
authored
Oct 04, 2016
by
Jonas Stienen
Browse files
Fixing, refactoring, moving to procedural registration of reproduction factories.
Also some output formatting for trace information.
parent
f2abab78
Changes
14
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
d6bcc6ae
...
...
@@ -192,7 +192,7 @@ if( ${ITA_VACORE_NO_MODULE_INTERFACE_THROW_EXCEPTION} )
add_definitions
(
"-DVACORE_NO_MODULE_INTERFACE_THROW_EXCEPTION=1"
)
endif
()
if
(
${
ITA_VACORE_EVENTS_ENABLED
}
)
add_definitions
(
"-DV
V
ACORE_EVENTS_ENABLED=1"
)
add_definitions
(
"-DVACORE_EVENTS_ENABLED=1"
)
endif
()
add_definitions
(
"-DVACORE_DEFAULT_CONFIGFILE=
\"
${
ITA_VACORE_DEFAULT_CONFIG_FILE_NAME
}
\"
"
)
...
...
@@ -246,8 +246,8 @@ endif()
if
(
${
ITA_VACORE_WITH_REPRODUCTION_HEADPHONES
}
)
add_definitions
(
"-DVACORE_WITH_REPRODUCTION_HEADPHONES=1"
)
endif
()
if
(
${
D
VACORE_WITH_REPRODUCTION_AMBISONICS
}
)
add_definitions
(
"-
ITA_
VACORE_WITH_REPRODUCTION_AMBISONICS=1"
)
if
(
${
ITA_
VACORE_WITH_REPRODUCTION_AMBISONICS
}
)
add_definitions
(
"-
D
VACORE_WITH_REPRODUCTION_AMBISONICS=1"
)
endif
()
if
(
${
ITA_VACORE_WITH_REPRODUCTION_BINAURAL_NCTC
}
)
add_definitions
(
"-DVACORE_WITH_REPRODUCTION_BINAURAL_NCTC=1"
)
...
...
src/Rendering/VAAudioRendererRegistry.cpp
View file @
d6bcc6ae
...
...
@@ -12,6 +12,8 @@
#include
"Prototyping/HearingAid/VAPTHearingAidRenderer.h"
#include
"VBAP/Freefield/VAVBAPFreefieldAudioRenderer.h"
#include
"../VALog.h"
#include
<ITAStringUtils.h>
#include
<cassert>
...
...
@@ -30,7 +32,9 @@ CVAAudioRendererRegistry* CVAAudioRendererRegistry::GetInstance()
void
CVAAudioRendererRegistry
::
RegisterFactory
(
IVAAudioRendererFactory
*
pFactory
)
{
assert
(
pFactory
);
m_pFactories
.
push_back
(
pFactory
);
m_pFactories
.
push_back
(
pFactory
);
VA_TRACE
(
"AudioRendererRegistry"
,
"Registering renderer factory '"
+
pFactory
->
GetClassIdentifier
()
+
"'"
);
}
IVAAudioRendererFactory
*
CVAAudioRendererRegistry
::
FindFactory
(
const
std
::
string
&
sClassName
)
...
...
src/Rendering/VAAudioRendererRegistry.h
View file @
d6bcc6ae
...
...
@@ -30,7 +30,6 @@ class IVAAudioRenderer;
class
IVAAudioRendererFactory
;
//! Audio renderer registry (singleton)
// drausch sagt:
class
CVAAudioRendererRegistry
{
public:
...
...
@@ -53,7 +52,7 @@ 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
* this method
implementation
. If you are using
a
plugin, registration will
* be done automatically.
*/
void
RegisterInternalCoreFactoryMethods
();
...
...
@@ -64,11 +63,4 @@ private:
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__
src/Reproduction/Ambisonics/VAAmbisonicsReproduction.cpp
View file @
d6bcc6ae
...
...
@@ -2,10 +2,10 @@
#if (VACORE_WITH_REPRODUCTION_AMBISONICS==1 )
#include
<
Scene/VASceneState.h
>
#include
<
Utils/VAUtils.h
>
#include
<
VAHardwareSetup.h
>
#include
<
VALog.h
>
#include
"../../
Scene/VASceneState.h
"
#include
"../../
Utils/VAUtils.h
"
#include
"../../
VAHardwareSetup.h
"
#include
"../../
VALog.h
"
#include
<ITADatasourceRealization.h>
#include
<ITAStreamPatchbay.h>
...
...
src/Reproduction/Ambisonics/VAAmbisonicsReproduction.h
View file @
d6bcc6ae
...
...
@@ -3,9 +3,9 @@
#if ( VACORE_WITH_REPRODUCTION_AMBISONICS == 1 )
#include
<Reproduction
/VAAudioReproductionModule.h
>
#include
<Reproduction
/VAAudioReproductionModuleRegistry.h
>
#include
<
VACoreImpl.h
>
#include
"..
/VAAudioReproductionModule.h
"
#include
"..
/VAAudioReproductionModuleRegistry.h
"
#include
"../../
VACoreImpl.h
"
#include
<ITASampleFrame.h>
...
...
@@ -33,7 +33,6 @@ private:
VAVec3
m_v3ReproductionCenterPos
;
};
VA_REGISTER_AUDIO_REPRODUCTION_MODULE_CLASS
(
CVAAmbisonicsReproduction
,
"Ambisonics"
)
#endif // ( VACORE_WITH_REPRODUCTION_AMBISONICS == 1
)
#endif // VACORE_WITH_REPRODUCTION_AMBISONICS
#endif // __VA_AMBISONICSREPRODUCTION_H__
src/Reproduction/Binaural/VAAmbisonicsBinauralMixdownReproduction.h
View file @
d6bcc6ae
...
...
@@ -57,7 +57,6 @@ private:
std
::
vector
<
int
>
m_viLastHRIRIndex
;
};
VA_REGISTER_AUDIO_REPRODUCTION_MODULE_CLASS
(
CVAAmbisonicsBinauralMixdownReproduction
,
"AmbisonicsBinauralMixdown"
)
#endif // VACORE_WITH_REPRODUCTION_AMBISONICS_BINAURAL_MIXDOWN
#endif // __VA_AMBISONICSBINAURALMIXDOWNREPRODUCTION_H__
src/Reproduction/Binaural/VABinauralMixdownReproduction.h
View file @
d6bcc6ae
...
...
@@ -55,8 +55,6 @@ private:
std
::
vector
<
int
>
m_viLastHRIRIndex
;
};
VA_REGISTER_AUDIO_REPRODUCTION_MODULE_CLASS
(
CVABinauralMixdownReproduction
,
"BinauralMixdown"
)
#endif // ( VACORE_WITH_REPRODUCTION_BINAURAL_MIXDOWN == 1 )
#endif // __VA_BINAURALDOWNMIXREPRODUCTION_H__
src/Reproduction/Binaural/VAHeadphonesReproduction.h
View file @
d6bcc6ae
...
...
@@ -44,7 +44,6 @@ private:
ITASampleFrame
m_sfHpIRInv
;
};
VA_REGISTER_AUDIO_REPRODUCTION_MODULE_CLASS
(
CVAHeadphonesReproduction
,
"Headphones"
)
#endif // ( VACORE_WITH_REPRODUCTION_HEADPHONES == 1 )
#endif // __VA_HEADPHONEREPRODUCTION_H__
src/Reproduction/Binaural/VANCTCReproduction.h
View file @
d6bcc6ae
...
...
@@ -59,7 +59,6 @@ private:
double
m_dGain
;
};
VA_REGISTER_AUDIO_REPRODUCTION_MODULE_CLASS
(
CVANCTCReproduction
,
"NCTC"
)
#endif // ( VACORE_WITH_REPRODUCTION_BINAURAL_NCTC == 1 )
#endif // __VA_NCTCREPRODUCTION_H__
src/Reproduction/Talkthrough/VAReproductionTalkthrough.h
View file @
d6bcc6ae
...
...
@@ -17,7 +17,7 @@ public:
void
SetInputDatasource
(
ITADatasource
*
pDatasource
);
ITADatasource
*
GetOutputDatasource
();
int
GetNumInputChannels
()
const
;
void
UpdateScene
(
CVASceneState
*
pNewState
)
{};
inline
void
UpdateScene
(
CVASceneState
*
pNewState
)
{};
void
HandleProcessStream
(
ITADatasourceRealization
*
pSender
,
const
ITAStreamInfo
*
pStreamInfo
);
void
HandlePostIncrementBlockPointer
(
ITADatasourceRealization
*
pSender
);
...
...
@@ -27,8 +27,6 @@ private:
CVAAudioReproductionModuleInitParams
m_oParams
;
};
VA_REGISTER_AUDIO_REPRODUCTION_MODULE_CLASS
(
CVAReproductionTalkthrough
,
"Talkthrough"
)
#endif // ( VACORE_WITH_REPRODUCTION_TALKTHROUGH == 1 )
#endif // __VA_REPRODUCTIONTALKTHROUGH_H__
src/Reproduction/VAAudioReproductionModuleRegistry.cpp
View file @
d6bcc6ae
// $Id: $
#include
"VAAudioReproductionModuleRegistry.h"
#include
<ITAStringUtils.h>
#include
"Ambisonics/VAAmbisonicsReproduction.h"
#include
"Binaural/VAAmbisonicsBinauralMixdownReproduction.h"
#include
"Binaural/VABinauralMixdownReproduction.h"
#include
"Binaural/VAHeadphonesReproduction.h"
#include
"Binaural/VANCTCReproduction.h"
#include
"Talkthrough/VAReproductionTalkthrough.h"
CVAAudioReproductionModuleRegistry
*
CVAAudioReproductionModuleRegistry
::
pInstance
(
nullptr
);
#include
"../VALog.h"
CVAAudioReproductionModuleRegistry
*
CVAAudioReproductionModuleRegistry
::
GetInstance
()
{
if
(
!
pInstance
)
pInstance
=
new
CVAAudioReproductionModuleRegistry
;
return
pInstance
;
}
#include
<ITAStringUtils.h>
CVAAudioReproductionModuleRegistry
::
CVAAudio
Reproduction
Module
Registry
()
{
static
CVAAudioReproductionModuleRegistry
*
g_p
ReproductionRegistry
Instance
;
CVAAudioReproductionModuleRegistry
*
CVAAudioReproductionModuleRegistry
::
GetInstance
()
{
if
(
!
g_pReproductionRegistryInstance
)
g_pReproductionRegistryInstance
=
new
CVAAudioReproductionModuleRegistry
();
return
g_pReproductionRegistryInstance
;
}
CVAAudioReproductionModuleRegistry
::~
CVAAudioReproductionModuleRegistry
()
{
// TODO: Gibbet im moment nich... Ma mache...
CVAAudioReproductionModuleRegistry
::
CVAAudioReproductionModuleRegistry
()
:
m_bInternalCoreFactoriesRegistered
(
false
)
{
}
void
CVAAudioReproductionModuleRegistry
::
RegisterFactory
(
IVAAudioReproductionModuleFactory
*
pFactory
)
{
void
CVAAudioReproductionModuleRegistry
::
RegisterFactory
(
IVAAudioReproductionModuleFactory
*
pFactory
)
{
assert
(
pFactory
);
m_pFactories
.
push_back
(
pFactory
);
m_pFactories
.
push_back
(
pFactory
);
VA_TRACE
(
"AudioReproductionModuleRegistry"
,
"Registering reproduction factory '"
+
pFactory
->
GetClassIdentifier
()
+
"'"
);
}
IVAAudioReproductionModuleFactory
*
CVAAudioReproductionModuleRegistry
::
FindFactory
(
const
std
::
string
&
sClassName
)
{
std
::
string
s
=
toUppercase
(
sClassName
);
for
(
std
::
vector
<
IVAAudioReproductionModuleFactory
*>::
iterator
it
=
m_pFactories
.
begin
();
it
!=
m_pFactories
.
end
();
++
it
)
if
(
toUppercase
((
*
it
)
->
GetClassName
())
==
s
)
return
*
it
;
IVAAudioReproductionModuleFactory
*
CVAAudioReproductionModuleRegistry
::
FindFactory
(
const
std
::
string
&
sClassName
)
{
std
::
string
s
=
toUppercase
(
sClassName
);
for
(
std
::
vector
<
IVAAudioReproductionModuleFactory
*>::
iterator
it
=
m_pFactories
.
begin
();
it
!=
m_pFactories
.
end
();
++
it
)
{
if
(
toUppercase
(
(
*
it
)
->
GetClassIdentifier
()
)
==
s
)
return
*
it
;
}
return
nullptr
;
}
\ No newline at end of file
}
void
CVAAudioReproductionModuleRegistry
::
RegisterInternalCoreFactoryMethods
()
{
// A little protection against double factory creation
if
(
m_bInternalCoreFactoriesRegistered
)
return
;
// Ambisonics
#if( VACORE_WITH_REPRODUCTION_AMBISONICS == 1 )
RegisterReproductionDefaultFactory
<
CVAAmbisonicsReproduction
>
(
"Ambisonics"
);
#endif // ( VACORE_WITH_REPRODUCTION_AMBISONICS == 1 )
// Binaural
#if( VACORE_WITH_REPRODUCTION_AMBISONICS_BINAURAL_MIXDOWN == 1 )
RegisterReproductionDefaultFactory
<
CVAAmbisonicsBinauralMixdownReproduction
>
(
"AmbisonicsBinauralMixdown"
);
#endif // ( VACORE_WITH_REPRODUCTION_AMBISONICS_BINAURAL_MIXDOWN == 1 )
#if ( VACORE_WITH_REPRODUCTION_BINAURAL_MIXDOWN == 1 )
RegisterReproductionDefaultFactory
<
CVABinauralMixdownReproduction
>
(
"BinauralMixdown"
);
#endif // ( VACORE_WITH_REPRODUCTION_BINAURAL_MIXDOWN == 1 )
#if ( VACORE_WITH_REPRODUCTION_HEADPHONES == 1 )
RegisterReproductionDefaultFactory
<
CVAHeadphonesReproduction
>
(
"Headphones"
);
#endif // ( VACORE_WITH_REPRODUCTION_HEADPHONES == 1 )
#if ( VACORE_WITH_REPRODUCTION_BINAURAL_NCTC == 1 )
RegisterReproductionDefaultFactory
<
CVANCTCReproduction
>
(
"NCTC"
);
#endif // ( VACORE_WITH_REPRODUCTION_BINAURAL_NCTC == 1 )
// Talkthrough
#if ( VACORE_WITH_REPRODUCTION_TALKTHROUGH == 1 )
RegisterReproductionDefaultFactory
<
CVAReproductionTalkthrough
>
(
"Talkthrough"
);
#endif // ( VACORE_WITH_REPRODUCTION_TALKTHROUGH == 1 )
m_bInternalCoreFactoriesRegistered
=
true
;
}
src/Reproduction/VAAudioReproductionModuleRegistry.h
View file @
d6bcc6ae
...
...
@@ -34,46 +34,68 @@ class IVAAudioReproductionModule;
class
IVAAudioReproductionModuleFactory
;
//! Factory method interface
class
IVAAudioReproductionModuleFactory
{
class
IVAAudioReproductionModuleFactory
{
public:
virtual
std
::
string
GetClassName
()
const
=
0
;
// Factory method
virtual
IVAAudioReproductionModule
*
Create
(
const
CVAAudioReproductionModuleInitParams
&
oParams
)
=
0
;
virtual
std
::
string
GetClassIdentifier
()
const
=
0
;
virtual
IVAAudioReproductionModule
*
Create
(
const
CVAAudioReproductionModuleInitParams
&
oParams
)
=
0
;
};
//! Module registry (singleton)
class
CVAAudioReproductionModuleRegistry
{
class
CVAAudioReproductionModuleRegistry
{
public:
static
CVAAudioReproductionModuleRegistry
*
GetInstance
();
CVAAudioReproductionModuleRegistry
();
virtual
~
CVAAudioReproductionModuleRegistry
();
void
RegisterFactory
(
IVAAudioReproductionModuleFactory
*
pFactory
);
IVAAudioReproductionModuleFactory
*
FindFactory
(
const
std
::
string
&
sClassName
);
inline
virtual
~
CVAAudioReproductionModuleRegistry
()
{};
template
<
typename
TReproduction
>
inline
void
RegisterReproductionDefaultFactory
(
const
std
::
string
&
sClassIdentifier
)
{
this
->
RegisterFactory
(
new
CVAAudioReproductionModuleDefaultFactory
<
TReproduction
>
(
sClassIdentifier
)
);
};
void
RegisterFactory
(
IVAAudioReproductionModuleFactory
*
pFactory
);
IVAAudioReproductionModuleFactory
*
FindFactory
(
const
std
::
string
&
sClassIdentifier
);
protected:
//! Registers core-internal audio reproduction factories (only call once)
/**
* If you are writing your own reproduction, add your class into
* this method implementation. If you are using a plugin, registration will
* be done automatically.
*/
void
RegisterInternalCoreFactoryMethods
();
friend
class
CVACoreImpl
;
private:
st
atic
C
VAAudioReproductionModule
Registry
*
pInstance
;
std
::
vector
<
IVAAudioReproductionModuleFactory
*>
m_pFactories
;
st
d
::
vector
<
I
VAAudioReproductionModule
Factory
*
>
m_pFactories
;
bool
m_bInternalCoreFactoriesRegistered
;
};
//! Default factory (template)
template
<
class
T
>
class
CVAAudioReproductionModuleDefaultFactory
:
IVAAudioReproductionModuleFactory
{
template
<
class
TReproduction
>
class
CVAAudioReproductionModuleDefaultFactory
:
public
IVAAudioReproductionModuleFactory
{
public:
CVAAudioReproductionModuleDefaultFactory
(
const
std
::
string
&
sClassName
)
:
m_sClassName
(
sClassName
)
{
CVAAudioReproductionModuleRegistry
::
GetInstance
()
->
RegisterFactory
(
this
);
}
inline
CVAAudioReproductionModuleDefaultFactory
(
const
std
::
string
&
sClassIdentifier
)
:
m_sClassIdentifier
(
sClassIdentifier
)
{
};
std
::
string
GetClassName
()
const
{
return
m_sClassName
;
}
IVAAudioReproductionModule
*
Create
(
const
CVAAudioReproductionModuleInitParams
&
oParams
)
{
return
new
T
(
oParams
);
}
inline
std
::
string
GetClassIdentifier
()
const
{
return
this
->
m_sClassIdentifier
;
};
inline
IVAAudioReproductionModule
*
Create
(
const
CVAAudioReproductionModuleInitParams
&
oParams
)
{
return
new
TReproduction
(
oParams
);
};
private:
std
::
string
m_sClass
Name
;
std
::
string
m_sClass
Identifier
;
};
// Registration macro (outside class)
#define VA_REGISTER_AUDIO_REPRODUCTION_MODULE_CLASS(CLASS, CLASSNAME) \
static CVAAudioReproductionModuleDefaultFactory<CLASS> g_oFactory_##CLASS##(CLASSNAME);
#endif // __VA_AUDIOREPRODUCTIONMODULEREGISTRY_H__
src/VACoreConfig.cpp
View file @
d6bcc6ae
...
...
@@ -66,7 +66,7 @@ void CVACoreConfig::Init( const CVAStruct& oData )
{
std
::
string
sMacroValue
=
mMacros
.
SubstituteMacros
(
oMacroValue
);
mMacros
.
AddMacro
(
"$("
+
sMacroName
+
")"
,
sMacroValue
);
VA_VERBOSE
(
"
VA
CoreConfig"
,
"Added macro $("
+
sMacroName
+
") = "
+
sMacroValue
);
VA_VERBOSE
(
"CoreConfig"
,
"Added macro $("
+
sMacroName
+
") = "
+
sMacroValue
);
}
cit
++
;
}
...
...
@@ -88,16 +88,16 @@ void CVACoreConfig::Init( const CVAStruct& oData )
{
vsSearchPaths
.
push_back
(
sPath
);
mMacros
.
AddMacro
(
"$("
+
sPathName
+
")"
,
sPath
);
VA_INFO
(
"
VA
CoreConfig"
,
"Added path '"
+
sPath
+
"' to search path list and made it available as $("
+
sPathName
+
") macro."
);
VA_INFO
(
"CoreConfig"
,
"Added path '"
+
sPath
+
"' to search path list and made it available as $("
+
sPathName
+
") macro."
);
}
else
{
VA_VERBOSE
(
"
VA
CoreConfig"
,
"Could not find path '"
+
sPath
+
"', removed from search path list. Macro $("
+
sPathName
+
") is NOT available."
);
VA_VERBOSE
(
"CoreConfig"
,
"Could not find path '"
+
sPath
+
"', removed from search path list. Macro $("
+
sPathName
+
") is NOT available."
);
}
}
else
{
VA_WARN
(
"
VA
CoreConfig"
,
"Path with key '"
+
sPathName
+
"' is not a string value, skipping."
);
VA_WARN
(
"CoreConfig"
,
"Path with key '"
+
sPathName
+
"' is not a string value, skipping."
);
}
}
...
...
src/VACoreImpl.cpp
View file @
d6bcc6ae
...
...
@@ -517,6 +517,7 @@ void CVACoreImpl::Initialize() {
m_oListenerRealWorldCoords
.
uy
=
1
;
m_oListenerRealWorldCoords
.
uz
=
0
;
// Register all renderers and initialize
CVAAudioRendererRegistry
::
GetInstance
()
->
RegisterInternalCoreFactoryMethods
();
InitializeAudioRenderers
();
...
...
@@ -525,7 +526,8 @@ void CVACoreImpl::Initialize() {
SetProgress
(
"Initializing reproduction modules"
,
""
,
6
);
//CVAAudioReproductionModuleRegistry::GetInstance()->RegisterInternalCoreFactoryMethods();
// Register all reproductions and initialize
CVAAudioReproductionModuleRegistry
::
GetInstance
()
->
RegisterInternalCoreFactoryMethods
();
InitializeReproductionModules
();
if
(
m_vReproductionModules
.
empty
()
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment