Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
VACore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
VACore
Commits
172dbc8c
Commit
172dbc8c
authored
Sep 20, 2018
by
Lucas Moesch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed assertion bugs.
parent
188a745c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
137 additions
and
30 deletions
+137
-30
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralCluster.cpp
...ealTime/Utils/BinauralClusterEngine/VABinauralCluster.cpp
+25
-0
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralCluster.h
.../RealTime/Utils/BinauralClusterEngine/VABinauralCluster.h
+3
-0
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClusterEngine.cpp
...e/Utils/BinauralClusterEngine/VABinauralClusterEngine.cpp
+11
-2
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClustering.cpp
...Time/Utils/BinauralClusterEngine/VABinauralClustering.cpp
+3
-3
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClusteringState.cpp
...Utils/BinauralClusterEngine/VABinauralClusteringState.cpp
+21
-5
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClusteringState.h
...e/Utils/BinauralClusterEngine/VABinauralClusteringState.h
+3
-0
src/Rendering/Binaural/RealTime/VABinauralRealTimeRenderer.cpp
...endering/Binaural/RealTime/VABinauralRealTimeRenderer.cpp
+11
-9
tests/VABinauralRealTimeRendererTest.cpp
tests/VABinauralRealTimeRendererTest.cpp
+60
-11
No files found.
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralCluster.cpp
View file @
172dbc8c
...
...
@@ -57,6 +57,31 @@ VABinauralCluster::init(int sourceID, VABinauralSoundSource* source, VABinauralL
++
numSources
;
}
void
VABinauralCluster
::
init
(
VABinauralCluster
*
cluster
)
{
_listener
=
cluster
->
_listener
;
_listenerPos
=
_listener
->
predPos
;
_clusterSourcePos
=
cluster
->
_clusterSourcePos
;
_clusterSourceToListenerPos
=
_clusterSourcePos
-
_listenerPos
;
_output
=
new
ITASampleFrame
(
2
,
_listener
->
output
->
GetLength
(),
true
);
_tmpChL
.
Init
(
_listener
->
output
->
GetLength
(),
true
);
_tmpChR
.
Init
(
_listener
->
output
->
GetLength
(),
true
);
maxError
=
cluster
->
maxError
;
std
::
map
<
int
,
VABinauralSoundSource
*>::
const_iterator
it
;
for
(
it
=
cluster
->
_sources
.
begin
();
it
!=
cluster
->
_sources
.
end
();
++
it
)
{
_sources
.
insert
(
std
::
pair
<
int
,
VABinauralSoundSource
*>
(
it
->
first
,
it
->
second
));
it
->
second
->
AddReference
();
}
numSources
=
cluster
->
numSources
;
}
ITASampleFrame
*
VABinauralCluster
::
getOutput
()
{
...
...
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralCluster.h
View file @
172dbc8c
...
...
@@ -24,6 +24,9 @@ public:
void
init
(
int
sourceID
,
VABinauralSoundSource
*
source
,
VABinauralListener
*
listener
);
void
init
(
VABinauralCluster
*
cluster
);
ITASampleFrame
*
getOutput
();
...
...
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClusterEngine.cpp
View file @
172dbc8c
...
...
@@ -3,10 +3,14 @@
// VA includes
#include <VAObjectPool.h>
// Utils
#include "./VABinauralClusteringPoolFactory.h">
VABinauralClusterEngine
::
VABinauralClusterEngine
()
{
IVAPoolObjectFactory
*
clusteringFactory
=
new
VABinauralClusteringPoolFactory
();
_clusteringPool
=
IVAObjectPool
::
Create
(
16
,
2
,
clusteringFactory
,
true
);
}
...
...
@@ -17,10 +21,15 @@ VABinauralClusterEngine::~VABinauralClusterEngine()
void
VABinauralClusterEngine
::
update
()
{
std
::
map
<
int
,
VABinauralClustering
*
>::
iterator
it
;
/*
std::map< int, VABinauralClustering* >::iterator it;
for (it = _clusterings.begin(); it != _clusterings.end(); ++it)
{
it->second->update();
}*/
for
(
auto
const
&
clustering
:
_clusterings
)
{
clustering
.
second
->
update
();
}
}
...
...
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClustering.cpp
View file @
172dbc8c
...
...
@@ -52,7 +52,7 @@ VABinauralClustering::getOutput()
_output
->
zero
();
// swap out clustering state
_curState
.
reset
(
_nextState
.
release
());
//TODO: only if next State is not null!
if
(
_nextState
!=
nullptr
)
_curState
.
reset
(
_nextState
.
release
());
std
::
map
<
int
,
VABinauralCluster
*>::
const_iterator
it
;
for
(
it
=
_curState
->
clusters
.
begin
();
it
!=
_curState
->
clusters
.
end
();
++
it
)
...
...
@@ -102,9 +102,9 @@ VABinauralClustering::update()
// TODO: refinement
// update source status
for
(
sourceIt
=
_unassignedSources
.
begin
();
sourceIt
!=
_unassignedSources
.
end
();
++
it
)
for
(
auto
const
&
assignedSources
:
_assignedSources
)
{
_assignedSources
.
insert
(
std
::
pair
<
int
,
VABinauralSoundSource
*
>
(
sourceIt
->
first
,
sourceIt
->
second
));
_assignedSources
.
insert
(
std
::
pair
<
int
,
VABinauralSoundSource
*
>
(
assignedSources
.
first
,
assignedSources
.
second
));
}
_unassignedSources
.
clear
();
...
...
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClusteringState.cpp
View file @
172dbc8c
...
...
@@ -18,6 +18,9 @@ VABinauralClusteringState::VABinauralClusteringState(int numClusters, VABinaural
{
freeClusterIDs
.
push
(
i
);
}
IVAPoolObjectFactory
*
clusterFactory
=
new
VABinauralClusterPoolFactory
();
_clusterPool
=
IVAObjectPool
::
Create
(
16
,
2
,
clusterFactory
,
true
);
}
...
...
@@ -28,15 +31,17 @@ VABinauralClusteringState::~VABinauralClusteringState()
VABinauralClusteringState
::
VABinauralClusteringState
(
const
VABinauralClusteringState
&
state
)
:
numClusters
(
state
.
numClusters
),
listener
(
state
.
listener
),
sourceClusterReference
(
state
.
sourceClusterReference
)
sourceClusterReference
(
state
.
sourceClusterReference
),
freeClusterIDs
(
state
.
freeClusterIDs
)
{
IVAPoolObjectFactory
*
clusterFactory
=
new
VABinauralClusterPoolFactory
();
_clusterPool
=
IVAObjectPool
::
Create
(
16
,
2
,
clusterFactory
,
true
);
std
::
map
<
int
,
VABinauralCluster
*
>::
const_iterator
it
;
for
(
it
=
state
.
clusters
.
begin
();
it
!=
state
.
clusters
.
end
();
++
it
)
{
int
clusterID
=
it
->
first
;
VABinauralCluster
*
cluster
=
new
VABinauralCluster
(
*
(
it
->
second
));
clusters
.
insert
(
std
::
pair
<
int
,
VABinauralCluster
*
>
(
clusterID
,
cluster
));
createCluster
(
it
->
first
,
it
->
second
);
}
}
...
...
@@ -107,6 +112,17 @@ VABinauralClusteringState::createCluster(int sourceID, VABinauralSoundSource* s
return
std
::
pair
<
int
,
VABinauralCluster
*
>
(
clusterID
,
cluster
);
}
std
::
pair
<
int
,
VABinauralCluster
*>
VABinauralClusteringState
::
createCluster
(
int
clusterID
,
VABinauralCluster
*
cluster
)
{
VABinauralCluster
*
_cluster
=
dynamic_cast
<
VABinauralCluster
*
>
(
_clusterPool
->
RequestObject
());
_cluster
->
init
(
cluster
);
clusters
.
insert
(
std
::
pair
<
int
,
VABinauralCluster
*
>
(
clusterID
,
_cluster
));
return
std
::
pair
<
int
,
VABinauralCluster
*
>
(
clusterID
,
_cluster
);
}
double
VABinauralClusteringState
::
getMaxError
()
...
...
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClusteringState.h
View file @
172dbc8c
...
...
@@ -38,6 +38,9 @@ public:
std
::
pair
<
int
,
VABinauralCluster
*>
createCluster
(
int
sourceID
,
VABinauralSoundSource
*
source
);
std
::
pair
<
int
,
VABinauralCluster
*>
createCluster
(
int
clusterID
,
VABinauralCluster
*
cluster
);
double
getMaxError
();
private:
...
...
src/Rendering/Binaural/RealTime/VABinauralRealTimeRenderer.cpp
View file @
172dbc8c
...
...
@@ -150,12 +150,14 @@ VABinauralRealTimeRenderer::ProcessStream(const ITAStreamInfo* streamInfo)
for
(
it
=
_listeners
.
begin
();
it
!=
_listeners
.
end
();
++
it
)
{
VABinauralClustering
*
clustering
=
_clusterEngine
.
getClustering
(
it
->
first
);
output
=
clustering
->
getOutput
();
fm_copy
(
outputChL
,
(
*
output
)[
0
].
data
(),
m_uiBlocklength
);
fm_copy
(
outputChR
,
(
*
output
)[
1
].
data
(),
m_uiBlocklength
);
}
if
(
clustering
){
output
=
clustering
->
getOutput
();
fm_copy
(
outputChL
,
(
*
output
)[
0
].
data
(),
m_uiBlocklength
);
fm_copy
(
outputChR
,
(
*
output
)[
1
].
data
(),
m_uiBlocklength
);
}
}
IncrementWritePointer
();
...
...
@@ -198,14 +200,14 @@ VABinauralRealTimeRenderer::updateSources( CVASceneStateDiff* diff )
typedef
std
::
vector
<
int
>::
const_iterator
icit_t
;
// Delete sources
for
(
icit_t
it
=
diff
->
viDelSoundSourceIDs
.
begin
();
it
!=
diff
->
viDelSoundSourceIDs
.
end
();
++
it
)
for
(
icit_t
it
=
diff
->
viDelSoundSourceIDs
.
begin
();
it
!=
diff
->
viDelSoundSourceIDs
.
end
();)
{
const
int
&
iID
(
*
it
++
);
deleteSource
(
iID
);
}
// Add sources
for
(
icit_t
it
=
diff
->
viNewSoundSourceIDs
.
begin
();
it
!=
diff
->
viNewSoundSourceIDs
.
end
();
++
it
)
for
(
icit_t
it
=
diff
->
viNewSoundSourceIDs
.
begin
();
it
!=
diff
->
viNewSoundSourceIDs
.
end
();)
{
const
int
&
iID
(
*
it
++
);
createSource
(
iID
,
_newSceneState
->
GetSoundSourceState
(
iID
));
...
...
@@ -220,7 +222,7 @@ VABinauralRealTimeRenderer::updateSources( CVASceneStateDiff* diff )
VABinauralSoundSource
*
source
=
it
->
second
;
CVASoundSourceState
*
sourceCur
=
(
_curSceneState
?
_curSceneState
->
GetSoundSourceState
(
sourceID
)
:
nullptr
);
CVASoundSourceState
*
sourceNew
=
(
_newSceneState
?
_
cur
SceneState
->
GetSoundSourceState
(
sourceID
)
:
nullptr
);
CVASoundSourceState
*
sourceNew
=
(
_newSceneState
?
_
new
SceneState
->
GetSoundSourceState
(
sourceID
)
:
nullptr
);
const
CVAMotionState
*
motionCur
=
(
sourceCur
?
sourceCur
->
GetMotionState
()
:
nullptr
);
const
CVAMotionState
*
motionNew
=
(
sourceNew
?
sourceNew
->
GetMotionState
()
:
nullptr
);
...
...
@@ -240,14 +242,14 @@ VABinauralRealTimeRenderer::updateListeners( CVASceneStateDiff* diff )
typedef
std
::
vector
<
int
>::
const_iterator
icit_t
;
// Delete listeners
for
(
icit_t
it
=
diff
->
viDelReceiverIDs
.
begin
();
it
!=
diff
->
viDelReceiverIDs
.
end
();
++
it
)
for
(
icit_t
it
=
diff
->
viDelReceiverIDs
.
begin
();
it
!=
diff
->
viDelReceiverIDs
.
end
();)
{
const
int
&
iID
(
*
it
++
);
deleteListener
(
iID
);
}
// Add listeners
for
(
icit_t
it
=
diff
->
viNewReceiverIDs
.
begin
();
it
!=
diff
->
viNewReceiverIDs
.
end
();
++
it
)
for
(
icit_t
it
=
diff
->
viNewReceiverIDs
.
begin
();
it
!=
diff
->
viNewReceiverIDs
.
end
();)
{
const
int
&
iID
(
*
it
++
);
createListener
(
iID
,
_newSceneState
->
GetReceiverState
(
iID
));
...
...
tests/VABinauralRealTimeRendererTest.cpp
View file @
172dbc8c
...
...
@@ -3,6 +3,8 @@
#include <VistaBase/VistaTimeUtils.h>
IVAInterface
*
va
=
NULL
;
CVAStruct
GetCoreConfig
()
{
CVAStruct
oConfig
;
...
...
@@ -30,20 +32,61 @@ CVAStruct GetCoreConfig()
oConfig
[
"Reproduction:Talkthrough"
]
=
oReproduction1
;
CVAStruct
oRenderer1
;
oRenderer1
[
"class"
]
=
"Binaural
FreeField
"
;
oRenderer1
[
"class"
]
=
"Binaural
RealTime
"
;
oRenderer1
[
"Reproductions"
]
=
"MyTalkthroughHeadphones"
;
oConfig
[
"Renderer:B
FF
_CoreTest"
]
=
oRenderer1
;
oConfig
[
"Renderer:B
RT
_CoreTest"
]
=
oRenderer1
;
CVAStruct
oRenderer2
;
oRenderer2
[
"class"
]
=
"PrototypeGenericPath"
;
oRenderer2
[
"numchannels"
]
=
2
;
oRenderer2
[
"Reproductions"
]
=
"MyTalkthroughHeadphones"
;
oConfig
[
"Renderer:PTGP_CoreTest"
]
=
oRenderer2
;
return
oConfig
;
}
IVAInterface
*
va
=
NULL
;
class
EventBasedGenericRenderingController
:
public
IVAEventHandler
{
public:
inline
void
HandleVAEvent
(
const
CVAEvent
*
pEvent
)
{
if
(
pEvent
->
iEventType
&
CVAEvent
::
SOUND_RECEIVER_CHANGED_POSE
)
{
std
::
cout
<<
"[ListenerUpdate] "
<<
pEvent
->
ToString
();
// Determine new file path for filter update
std
::
string
sNewFilePath
;
VAVec3
vNewListenerView
=
pEvent
->
vView
;
VAVec3
vNewListenerUp
=
pEvent
->
vUp
;
if
(
true
)
// Some geometric expression
sNewFilePath
=
"$(VADataDir)/rooms/shoebox_room_brir_azi020_ele000.wav"
;
CVAStruct
oArgs
,
oReturn
;
oArgs
[
"COMMAND"
]
=
"UPDATE"
;
oArgs
[
"TYPE"
]
=
"FILE"
;
// or DATA that sends ITASampleFrame from this controller context
oArgs
[
"FilePath"
]
=
sNewFilePath
;
oArgs
[
"ListenerID"
]
=
pEvent
->
iObjectID
;
oArgs
[
"SourceID"
]
=
1
;
try
{
oReturn
=
va
->
CallModule
(
"GenericPath:MyGenericRenderer"
,
oArgs
);
}
catch
(
CVAException
&
e
)
{
std
::
cerr
<<
e
<<
std
::
endl
;
}
}
}
};
EventBasedGenericRenderingController
rendering_controller
;
void
SetupScene
()
{
int
iListenerID
=
va
->
CreateSoundReceiver
(
"MyListener"
);
va
->
SetSoundReceiverAuralizationMode
(
iListenerID
,
IVAInterface
::
VA_AURAMODE_ALL
);
va
->
SetSoundReceiverOrientationVU
(
iListenerID
,
VAVec3
(
0.7172
f
,
0.0
f
,
-
0.7172
f
),
VAVec3
(
0
,
1
,
0
));
//va->SetSoundReceiverDirectivity(iListenerID, 1);
va
->
SetActiveSoundReceiver
(
iListenerID
);
int
iSoundSource
=
va
->
CreateSoundSource
(
"MySoundSource"
);
va
->
SetSoundSourcePosition
(
iSoundSource
,
VAVec3
(
-
2.0
f
,
0
,
0
));
}
int
main
(
int
,
char
**
)
{
...
...
@@ -51,22 +94,28 @@ int main(int, char**)
{
va
=
VACore
::
CreateCoreInstance
(
GetCoreConfig
());
va
->
AttachEventHandler
(
&
rendering_controller
);
va
->
Initialize
();
VistaTimeUtils
::
Sleep
(
60000
);
va
->
AddSearchPath
(
"../data"
);
va
->
Finalize
();
SetupScene
();
//va->Finalize();
}
catch
(
CVAException
&
e
)
{
std
::
cerr
<<
"Error: "
<<
e
<<
std
::
endl
;
int
iErrorCode
=
e
.
GetErrorCode
();
delete
va
;
VistaTimeUtils
::
Sleep
(
60000
);
return
iErrorCode
;
}
delete
va
;
VistaTimeUtils
::
Sleep
(
10000
);
return
0
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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