Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
VAUnity
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
VAUnity
Commits
675482c1
Commit
675482c1
authored
Dec 12, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applying API changes
parent
97173de9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
35 deletions
+36
-35
VAUAdapter.cs
VAUAdapter.cs
+1
-1
VAUAudiofileSignalSource.cs
VAUAudiofileSignalSource.cs
+3
-3
VAUDirectivity.cs
VAUDirectivity.cs
+2
-2
VAUHRIRDataset.cs
VAUHRIRDataset.cs
+2
-2
VAUListener.cs
VAUListener.cs
+18
-18
VAUSoundSource.cs
VAUSoundSource.cs
+9
-8
VAUTextToSpeechSignalSource.cs
VAUTextToSpeechSignalSource.cs
+1
-1
No files found.
VAUAdapter.cs
View file @
675482c1
...
...
@@ -61,7 +61,7 @@ public class VAUAdapter : MonoBehaviour
_VA
.
Reset
();
if
(
DefaultHRIRPath
.
Length
>
0
)
_DefaultHRIRID
=
_VA
.
LoadHRIRDataset
(
DefaultHRIRPath
,
"UnityDefaultHRIR"
);
_DefaultHRIRID
=
_VA
.
CreateDirectivityFromFile
(
DefaultHRIRPath
);
}
}
...
...
VAUAudiofileSignalSource.cs
View file @
675482c1
...
...
@@ -17,15 +17,15 @@ public class VAUAudiofileSignalSource : VAUSignalSource
if
(!
VAUAdapter
.
VA
.
IsConnected
())
return
;
_ID
=
VAUAdapter
.
VA
.
Create
AudiofileSignalSourc
e
(
FilePath
,
Name
);
_ID
=
VAUAdapter
.
VA
.
Create
SignalSourceBufferFromFil
e
(
FilePath
,
Name
);
Debug
.
Assert
(
_ID
.
Length
>
0
,
"Could not create audio file signal source '"
+
Name
+
"' file from path "
+
FilePath
);
}
void
Start
()
{
VAUAdapter
.
VA
.
Set
AudiofileSignalSourceIs
Looping
(
_ID
,
IsLooping
);
VAUAdapter
.
VA
.
Set
SignalSourceBuffer
Looping
(
_ID
,
IsLooping
);
if
(
PlayOnStart
)
VAUAdapter
.
VA
.
Set
AudiofileSignalSource
PlaybackAction
(
_ID
,
"PLAY"
);
VAUAdapter
.
VA
.
Set
SignalSourceBuffer
PlaybackAction
(
_ID
,
"PLAY"
);
}
void
OnDestroy
()
...
...
VAUDirectivity.cs
View file @
675482c1
...
...
@@ -20,13 +20,13 @@ public class VAUDirectivity : MonoBehaviour {
void
Start
()
{
if
(
FilePath
.
Length
>
0
)
_ID
=
VAUAdapter
.
VA
.
LoadDirectivity
(
FilePath
,
Name
);
_ID
=
VAUAdapter
.
VA
.
CreateDirectivityFromFile
(
FilePath
);
}
private
void
OnDestroy
()
{
if
(
_ID
!=
-
1
)
VAUAdapter
.
VA
.
Fre
eDirectivity
(
_ID
);
VAUAdapter
.
VA
.
Delet
eDirectivity
(
_ID
);
_ID
=
-
1
;
}
}
VAUHRIRDataset.cs
View file @
675482c1
...
...
@@ -21,13 +21,13 @@ public class VAUHRIRDataset : MonoBehaviour {
void
Start
()
{
if
(
FilePath
.
Length
>
0
)
_ID
=
VAUAdapter
.
VA
.
LoadHRIRDataset
(
FilePath
,
Name
);
_ID
=
VAUAdapter
.
VA
.
CreateDirectivityFromFile
(
FilePath
);
}
private
void
OnDestroy
()
{
if
(
_ID
!=
-
1
)
VAUAdapter
.
VA
.
FreeHRIRDataset
(
_ID
);
VAUAdapter
.
VA
.
DeleteDirectivity
(
_ID
);
_ID
=
-
1
;
}
}
VAUListener.cs
View file @
675482c1
...
...
@@ -4,9 +4,9 @@ using System.Collections;
using
VA
;
public
class
VAU
Listen
er
:
MonoBehaviour
{
public
class
VAU
SoundReceiv
er
:
MonoBehaviour
{
public
string
Name
=
"
Listen
er"
;
public
string
Name
=
"
SoundReceiv
er"
;
[
Tooltip
(
"Number of reverbzones used for determining the current reverb."
)]
public
int
NumMaxReverbZones
=
2
;
...
...
@@ -47,19 +47,19 @@ public class VAUListener : MonoBehaviour {
void
Start
()
{
_VA
=
VAUAdapter
.
VA
;
_ID
=
_VA
.
CreateListen
er
(
Name
);
_VA
.
Set
Listen
erAuralizationMode
(
_ID
,
"all"
);
_ID
=
_VA
.
CreateSoundReceiv
er
(
Name
);
_VA
.
Set
SoundReceiv
erAuralizationMode
(
_ID
,
"all"
);
if
(
HRIR
)
_VA
.
Set
ListenerHRIRDataset
(
_ID
,
HRIR
.
ID
);
_VA
.
Set
SoundReceiverDirectivity
(
_ID
,
HRIR
.
ID
);
else
if
(
VAUAdapter
.
DefaultHRIRID
!=
-
1
)
_VA
.
SetListenerHRIRDataset
(
_ID
,
VAUAdapter
.
DefaultHRIRID
);
_VA
.
SetSoundReceiverDirectivity
(
_ID
,
VAUAdapter
.
DefaultHRIRID
);
_VA
.
SetListen
erAnthropometricData
(
_ID
,
HeadWidth
,
HeadHeight
,
HeadDepth
);
_VA
.
SetSoundReceiv
erAnthropometricData
(
_ID
,
HeadWidth
,
HeadHeight
,
HeadDepth
);
ShadowHeadWidth
=
HeadWidth
;
ShadowHeadHeight
=
HeadHeight
;
ShadowHeadDepth
=
HeadDepth
;
Set
Listen
erPositionOrientation
();
Set
SoundReceiv
erPositionOrientation
();
_VA
.
SetArtificialReverberationTime
(
VAAudioRenderer
,
0.3f
);
reverbZones
=
FindObjectsOfType
(
typeof
(
AudioReverbZone
))
as
AudioReverbZone
[];
...
...
@@ -68,17 +68,17 @@ public class VAUListener : MonoBehaviour {
void
OnEnable
()
{
if
(
GetComponent
<
VAUAuralizationMode
>()
!=
null
)
GetComponent
<
VAUAuralizationMode
>().
AuraStringChanged
+=
On
Listen
erAuralizationModeChanged
;
GetComponent
<
VAUAuralizationMode
>().
AuraStringChanged
+=
On
SoundReceiv
erAuralizationModeChanged
;
}
void
Update
()
{
Set
Listen
erPositionOrientation
();
Set
SoundReceiv
erPositionOrientation
();
SetActiveReverbZones
();
if
(
HeadWidth
!=
ShadowHeadWidth
||
HeadHeight
!=
ShadowHeadHeight
||
HeadDepth
!=
ShadowHeadDepth
)
{
_VA
.
Set
Listen
erAnthropometricData
(
_ID
,
HeadWidth
,
HeadHeight
,
HeadDepth
);
_VA
.
Set
SoundReceiv
erAnthropometricData
(
_ID
,
HeadWidth
,
HeadHeight
,
HeadDepth
);
ShadowHeadWidth
=
HeadWidth
;
ShadowHeadHeight
=
HeadHeight
;
ShadowHeadDepth
=
HeadDepth
;
...
...
@@ -86,7 +86,7 @@ public class VAUListener : MonoBehaviour {
}
// Uses the View- and Up-Vector to transmit the position of the listener to VA
void
Set
Listen
erPositionOrientation
()
void
Set
SoundReceiv
erPositionOrientation
()
{
_VA
=
VAUAdapter
.
VA
;
t
=
GetComponent
<
Transform
>();
...
...
@@ -95,8 +95,8 @@ public class VAUListener : MonoBehaviour {
Vector3
view
=
q
*
Vector3
.
forward
;
Vector3
view_ogl
=
new
Vector3
(
view
.
x
,
view
.
y
,
-
view
.
z
);
Vector3
up_ogl
=
new
Vector3
(
up
.
x
,
up
.
y
,
-
up
.
z
);
_VA
.
SetListenerPosition
(
_ID
,
t
.
transform
.
position
.
x
,
t
.
transform
.
position
.
y
,
-
t
.
transform
.
position
.
z
);
_VA
.
SetListenerOrientationVU
(
_ID
,
view_ogl
.
x
,
view_ogl
.
y
,
view_ogl
.
z
,
up_ogl
.
x
,
up_ogl
.
y
,
up_ogl
.
z
);
_VA
.
SetSoundReceiverPosition
(
_ID
,
new
VAVec3
(
t
.
transform
.
position
.
x
,
t
.
transform
.
position
.
y
,
-
t
.
transform
.
position
.
z
)
);
_VA
.
SetSoundReceiverOrientationVU
(
_ID
,
new
VAVec3
(
view_ogl
.
x
,
view_ogl
.
y
,
view_ogl
.
z
),
new
VAVec3
(
up_ogl
.
x
,
up_ogl
.
y
,
up_ogl
.
z
)
);
}
void
SetActiveReverbZones
()
...
...
@@ -145,16 +145,16 @@ public class VAUListener : MonoBehaviour {
}
void
On
Listen
erAuralizationModeChanged
(
string
AuraMode
)
void
On
SoundReceiv
erAuralizationModeChanged
(
string
AuraMode
)
{
_VA
.
Set
Listen
erAuralizationMode
(
_ID
,
AuraMode
);
_VA
.
Set
SoundReceiv
erAuralizationMode
(
_ID
,
AuraMode
);
}
private
void
OnDestroy
()
{
if
(
GetComponent
<
VAUAuralizationMode
>()
!=
null
)
GetComponent
<
VAUAuralizationMode
>().
AuraStringChanged
-=
On
Listen
erAuralizationModeChanged
;
GetComponent
<
VAUAuralizationMode
>().
AuraStringChanged
-=
On
SoundReceiv
erAuralizationModeChanged
;
_VA
.
Delete
Listen
er
(
_ID
);
_VA
.
Delete
SoundReceiv
er
(
_ID
);
}
}
VAUSoundSource.cs
View file @
675482c1
...
...
@@ -41,7 +41,7 @@ public class VAUSoundSource : MonoBehaviour
return
;
// Add sound source
_ID
=
_VA
.
CreateSoundSource
(
this
.
name
,
0
,
1.0
);
_ID
=
_VA
.
CreateSoundSource
(
this
.
name
);
_VA
.
SetSoundSourceAuralizationMode
(
_ID
,
"all"
);
// Connect to directivity, if linked or attached
...
...
@@ -67,11 +67,11 @@ public class VAUSoundSource : MonoBehaviour
bool
IsLooping
=
GetComponent
<
AudioSource
>().
loop
;
bool
PlayOnAwake
=
GetComponent
<
AudioSource
>().
playOnAwake
;
_AudiofileSignalSource
=
_VA
.
CreateAudiofileSignalSourc
e
(
FilePath
,
Name
);
_AudiofileSignalSource
=
_VA
.
CreateSignalSourceBufferFromFil
e
(
FilePath
,
Name
);
Debug
.
Assert
(
_AudiofileSignalSource
.
Length
>
0
,
"Could not create integrated audio file signal source '"
+
Name
+
"' file from path "
+
FilePath
);
_VA
.
SetAudiofileSignalSourceIs
Looping
(
_AudiofileSignalSource
,
IsLooping
);
_VA
.
SetSignalSourceBuffer
Looping
(
_AudiofileSignalSource
,
IsLooping
);
if
(
PlayOnAwake
)
_VA
.
SetAudiofileSignalSource
PlaybackAction
(
_AudiofileSignalSource
,
"play"
);
_VA
.
SetSignalSourceBuffer
PlaybackAction
(
_AudiofileSignalSource
,
"play"
);
_VA
.
SetSoundSourceSignalSource
(
_ID
,
_AudiofileSignalSource
);
}
...
...
@@ -108,7 +108,8 @@ public class VAUSoundSource : MonoBehaviour
Vector3
view
=
q
*
Vector3
.
forward
;
Vector3
view_ogl
=
new
Vector3
(
view
.
x
,
view
.
y
,
-
view
.
z
);
Vector3
up_ogl
=
new
Vector3
(
up
.
x
,
up
.
y
,
-
up
.
z
);
_VA
.
SetSoundSourcePositionOrientationVU
(
_ID
,
t
.
transform
.
position
.
x
,
t
.
transform
.
position
.
y
,
-
t
.
transform
.
position
.
z
,
view_ogl
.
x
,
view_ogl
.
y
,
view_ogl
.
z
,
up_ogl
.
x
,
up_ogl
.
y
,
up_ogl
.
z
);
_VA
.
SetSoundSourcePosition
(
_ID
,
new
VAVec3
(
t
.
transform
.
position
.
x
,
t
.
transform
.
position
.
y
,
-
t
.
transform
.
position
.
z
));
_VA
.
SetSoundSourceOrientationVU
(
_ID
,
new
VAVec3
(
view_ogl
.
x
,
view_ogl
.
y
,
view_ogl
.
z
),
new
VAVec3
(
up_ogl
.
x
,
up_ogl
.
y
,
up_ogl
.
z
));
}
void
OnSoundSourceAuralizationModeChanged
(
string
AuraMode
)
...
...
@@ -119,7 +120,7 @@ public class VAUSoundSource : MonoBehaviour
public
void
OnEnable
()
{
if
(
enable
)
_VA
.
SetAudiofileSignalSource
PlaybackAction
(
_AudiofileSignalSource
,
"play"
);
_VA
.
SetSignalSourceBuffer
PlaybackAction
(
_AudiofileSignalSource
,
"play"
);
}
public
void
OnDisable
()
...
...
@@ -127,9 +128,9 @@ public class VAUSoundSource : MonoBehaviour
if
(
GetComponent
<
VAUAuralizationMode
>())
GetComponent
<
VAUAuralizationMode
>().
AuraStringChanged
-=
OnSoundSourceAuralizationModeChanged
;
if
(
stopOnDisable
)
_VA
.
Set
AudiofileSignalSource
PlaybackAction
(
_AudiofileSignalSource
,
"stop"
);
_VA
.
Set
SignalSourceBuffer
PlaybackAction
(
_AudiofileSignalSource
,
"stop"
);
else
_VA
.
SetAudiofileSignalSource
PlaybackAction
(
_AudiofileSignalSource
,
"pause"
);
_VA
.
SetSignalSourceBuffer
PlaybackAction
(
_AudiofileSignalSource
,
"pause"
);
}
private
void
OnDestroy
()
...
...
VAUTextToSpeechSignalSource.cs
View file @
675482c1
...
...
@@ -17,7 +17,7 @@ public class VAUTextToSpeechSignalSource : VAUSignalSource
if
(!
VAUAdapter
.
VA
.
IsConnected
())
return
;
_ID
=
VAUAdapter
.
VA
.
Create
TextToSpeechSignalSource
(
Name
);
_ID
=
VAUAdapter
.
VA
.
Create
SignalSourceTextToSpeech
(
Name
);
}
void
Start
()
...
...
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