Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VAUnity
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institute of Technical Acoustics (ITA)
VAUnity
Commits
79ce0e30
Commit
79ce0e30
authored
8 years ago
by
Maurice Tayeb Andreas
Browse files
Options
Downloads
Patches
Plain Diff
Adding artificial reverb support (tests)
parent
805f2a12
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
VAUListener.cs
+53
-2
53 additions, 2 deletions
VAUListener.cs
with
53 additions
and
2 deletions
VAUListener.cs
+
53
−
2
View file @
79ce0e30
...
...
@@ -7,11 +7,16 @@ using VA;
public
class
VAUListener
:
MonoBehaviour
{
public
string
listenername
=
"Listener"
;
public
int
maxreverbZones
=
2
;
public
string
VAAudioRenderer
=
"MyBinauralArtificialReverb"
;
private
int
Listener
;
private
VANet
_VA
=
null
;
private
Quaternion
q
;
private
Transform
t
;
private
AudioReverbZone
[]
reverbZones
;
private
AudioReverbZone
[]
shadowReverbZones
;
private
double
currentArtificialReverberationTime
=
1
;
public
int
ID
{
get
...
...
@@ -30,16 +35,22 @@ public class VAUListener : MonoBehaviour {
Debug
.
Log
(
listenername
+
" created"
);
_VA
.
SetListenerHRIRDataset
(
Listener
,
VAUAdapter
.
DefaultHRIR
);
SetListenerPositionOrientation
();
_VA
.
SetArtificalReverbarationTime
(
VAAudioRenderer
,
2
);
}
void
OnEnable
()
{
if
(
GetComponent
<
VAUAuralizationMode
>()
!=
null
)
GetComponent
<
VAUAuralizationMode
>().
AuraStringChanged
+=
OnListenerAuralizationModeChanged
;
}
// Update is called once per frame
void
Update
()
{
SetListenerPositionOrientation
();
SetActiveReverbZones
();
}
//uses the View- and Up-Vector to transmit the position of the listener to VA
void
SetListenerPositionOrientation
()
{
...
...
@@ -53,6 +64,46 @@ public class VAUListener : MonoBehaviour {
_VA
.
SetListenerOrientationVU
(
Listener
,
view_ogl
.
x
,
view_ogl
.
y
,
view_ogl
.
z
,
up_ogl
.
x
,
up_ogl
.
y
,
up_ogl
.
z
);
}
void
SetActiveReverbZones
()
{
double
actReverbTime
=
currentArtificialReverberationTime
;
reverbZones
=
FindObjectsOfType
(
typeof
(
AudioReverbZone
))
as
AudioReverbZone
[];
if
(
reverbZones
==
shadowReverbZones
)
return
;
if
(
reverbZones
==
null
)
{
if
(
actReverbTime
!=
currentArtificialReverberationTime
)
_VA
.
SetArtificalReverbarationTime
(
VAAudioRenderer
,
actReverbTime
);
return
;
}
shadowReverbZones
=
reverbZones
;
int
i
=
0
;
foreach
(
AudioReverbZone
reverbZone
in
reverbZones
)
{
float
actdistance
=
Vector3
.
Distance
(
reverbZone
.
transform
.
position
,
gameObject
.
transform
.
position
);
if
(
actdistance
<
reverbZone
.
maxDistance
)
{
if
(
i
<=
maxreverbZones
)
{
actReverbTime
+=
reverbZone
.
decayTime
;
i
++;
}
if
(
actdistance
>
reverbZone
.
minDistance
)
{
}
}
}
if
(
i
>
0
)
actReverbTime
/=
i
;
if
(
actReverbTime
!=
currentArtificialReverberationTime
)
_VA
.
SetArtificalReverbarationTime
(
VAAudioRenderer
,
actReverbTime
);
}
void
OnListenerAuralizationModeChanged
(
string
AuraMode
)
{
_VA
.
SetListenerAuralizationMode
(
Listener
,
AuraMode
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment