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
6a52da6c
Commit
6a52da6c
authored
Oct 10, 2018
by
Lucas Moesch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added first HRTF convolution implementation.
parent
813af282
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
12 deletions
+38
-12
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralCluster.cpp
...ealTime/Utils/BinauralClusterEngine/VABinauralCluster.cpp
+24
-4
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralCluster.h
.../RealTime/Utils/BinauralClusterEngine/VABinauralCluster.h
+1
-0
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClustering.cpp
...Time/Utils/BinauralClusterEngine/VABinauralClustering.cpp
+13
-8
No files found.
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralCluster.cpp
View file @
6a52da6c
...
...
@@ -7,6 +7,8 @@
#include "../../../../../directivities/VADirectivityDAFFHRIR.h"
// ITA includes
#include <ITAUPFilter.h>
#include <ITAUPFilterPool.h>
#include <ITAConstants.h>
// Utils
...
...
@@ -51,7 +53,9 @@ VABinauralCluster::init(int sourceID, VABinauralSoundSource* source, VABinauralL
_clusterSourcePos
=
_clusterSourcePos
+
source
->
predPos
;
_clusterSourceToListenerPos
=
_clusterSourcePos
-
_listenerPos
;
// TODO: do new in the constructor and reshape on init if nescessary
_output
=
new
ITASampleFrame
(
2
,
listener
->
output
->
GetLength
(),
true
);
_tempHRIR
=
new
ITASampleFrame
(
2
,
256
,
true
);
_tmpChL
.
Init
(
listener
->
output
->
GetLength
(),
true
);
_tmpChR
.
Init
(
listener
->
output
->
GetLength
(),
true
);
...
...
@@ -124,9 +128,6 @@ VABinauralCluster::getOutput()
source
->
vdlChL
->
SetDelayTime
(
toaDistance
+
toaSourceChL
-
toaHRTFChL
);
source
->
vdlChR
->
SetDelayTime
(
toaDistance
+
toSourceaChR
-
toaHRTFChR
);
//source->vdlChL->SetDelayTime(toaDistance + toaSourceChL);
//source->vdlChR->SetDelayTime(toaDistance + toSourceaChR);
source
->
vdlChL
->
Process
(
input
,
&
(
_tmpChL
));
source
->
vdlChR
->
Process
(
input
,
&
(
_tmpChR
));
...
...
@@ -137,10 +138,29 @@ VABinauralCluster::getOutput()
// convolve here!
CVADirectivityDAFFHRIR
*
HRIR
=
(
CVADirectivityDAFFHRIR
*
)
_listener
->
directivity
;
ITAUPFilter
*
HRIRFilterChL
=
_FIRConvolverChL
->
GetFilterPool
()
->
RequestFilter
();
ITAUPFilter
*
HRIRFilterChR
=
_FIRConvolverChR
->
GetFilterPool
()
->
RequestFilter
();
if
(
HRIR
){
int
index
=
-
1
;
int
filterLength
=
0
;
filterLength
=
HRIR
->
GetProperties
()
->
iFilterLength
;
if
(
_tempHRIR
->
length
()
!=
filterLength
)
{
_tempHRIR
->
init
(
2
,
filterLength
,
false
);
}
HRIR
->
GetHRIR
(
_tempHRIR
,
clusterSourceMetrics
.
phi
*
180
/
ITAConstants
::
PI_F
,
clusterSourceMetrics
.
theta
*
180
/
ITAConstants
::
PI_F
,
clusterSourceMetrics
.
dist
);
HRIRFilterChL
->
Load
((
*
_tempHRIR
)[
0
].
data
(),
filterLength
);
HRIRFilterChR
->
Load
((
*
_tempHRIR
)[
1
].
data
(),
filterLength
);
HRIR
->
GetNearestNeighbour
(
clusterSourceMetrics
.
phi
,
clusterSourceMetrics
.
theta
,
&
index
);
_FIRConvolverChL
->
ExchangeFilter
(
HRIRFilterChL
);
_FIRConvolverChR
->
ExchangeFilter
(
HRIRFilterChR
);
_FIRConvolverChL
->
ReleaseFilter
(
HRIRFilterChL
);
_FIRConvolverChR
->
ReleaseFilter
(
HRIRFilterChR
);
_FIRConvolverChL
->
Process
((
*
_output
)[
0
].
data
(),
(
*
_output
)[
0
].
data
(),
ITABase
::
MixingMethod
::
OVERWRITE
);
_FIRConvolverChR
->
Process
((
*
_output
)[
1
].
data
(),
(
*
_output
)[
1
].
data
(),
ITABase
::
MixingMethod
::
OVERWRITE
);
...
...
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralCluster.h
View file @
6a52da6c
...
...
@@ -53,6 +53,7 @@ private:
ITASampleBuffer
_tmpChR
;
ITASampleFrame
*
_output
;
ITASampleFrame
*
_tempHRIR
;
VABinauralListener
*
_listener
;
...
...
src/Rendering/Binaural/RealTime/Utils/BinauralClusterEngine/VABinauralClustering.cpp
View file @
6a52da6c
...
...
@@ -87,16 +87,23 @@ VABinauralClustering::init(int listenerID, VABinauralListener* listener, int num
ITASampleFrame
*
VABinauralClustering
::
getOutput
()
{
// --
_output
->
zero
();
// swap out clustering state
if
(
_nextState
!=
nullptr
)
_curState
.
reset
(
_nextState
.
release
());
if
(
_nextState
!=
nullptr
){
_curState
.
reset
(
_nextState
.
release
());
};
std
::
map
<
int
,
VABinauralCluster
*>::
const_iterator
clusterIt
;
clusterIt
=
_curState
->
clusters
.
begin
();
ITASampleFrame
*
clusterOutput
=
clusterIt
->
second
->
getOutput
();
std
::
map
<
int
,
VABinauralCluster
*>::
const_iterator
it
;
for
(
it
=
_curState
->
clusters
.
begin
();
it
!=
_curState
->
clusters
.
end
();
++
it
)
(
*
_output
)[
0
]
+=
(
*
clusterOutput
)[
0
];
(
*
_output
)[
1
]
+=
(
*
clusterOutput
)[
1
];
for
(
++
clusterIt
;
clusterIt
!=
_curState
->
clusters
.
end
();
++
clusterIt
)
{
ITASampleFrame
*
clusterOutput
=
i
t
->
second
->
getOutput
();
clusterOutput
=
clusterI
t
->
second
->
getOutput
();
(
*
_output
)[
0
]
+=
(
*
clusterOutput
)[
0
];
(
*
_output
)[
1
]
+=
(
*
clusterOutput
)[
1
];
...
...
@@ -108,8 +115,6 @@ VABinauralClustering::getOutput()
void
VABinauralClustering
::
update
()
{
//TODO: DIRTY HACK
if
(
_nextState
==
nullptr
)
{
...
...
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