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)
VAUnity
Commits
85307ecf
Commit
85307ecf
authored
Nov 23, 2016
by
Maurice Tayeb Andreas
Browse files
Rotationsübertragung von Linkshändisch in Rechtshändisch
Directivity Variable hinzugefügt
parent
5e781de8
Changes
4
Hide whitespace changes
Inline
Side-by-side
VACS.cs
View file @
85307ecf
...
...
@@ -64,6 +64,13 @@ namespace VA
NativeSetListenerOrientationYPR
(
_NetClient
,
iListenerID
,
yaw
,
pitch
,
roll
);
}
public
void
SetListenerOrientationVU
(
int
iListenerID
,
double
vx
,
double
vy
,
double
vz
,
double
ux
,
double
uy
,
double
uz
)
{
NativeSetListenerOrientationVU
(
_NetClient
,
iListenerID
,
vx
,
vy
,
vz
,
ux
,
uy
,
uz
);
}
public
int
CreateSoundSource
(
string
sName
,
int
iAuralizationMode
,
double
dVolume
)
{
return
NativeCreateSoundSource
(
_NetClient
,
sName
,
iAuralizationMode
,
dVolume
);
...
...
@@ -78,6 +85,12 @@ namespace VA
NativeSetSoundSourceOrientationYPR
(
_NetClient
,
iSoundSourceID
,
yaw
,
pitch
,
roll
);
}
public
void
SetSoundSourceOrientationVU
(
int
iSoundSourceID
,
double
vx
,
double
vy
,
double
vz
,
double
ux
,
double
uy
,
double
uz
)
{
NativeSetListenerOrientationVU
(
_NetClient
,
iSoundSourceID
,
vx
,
vy
,
vz
,
ux
,
uy
,
uz
);
}
public
int
LoadHRIRDataset
(
string
FilePath
,
string
Name
)
{
Console
.
WriteLine
(
"test"
);
...
...
@@ -186,6 +199,25 @@ namespace VA
{
NativeSetListenerHRIRDataset
(
_NetClient
,
iListenerID
,
iHRIRDatasetID
);
}
public
void
GetListenerPositionOrientationVU
(
int
iListenerID
,
double
px
,
double
py
,
double
pz
,
double
vx
,
double
vy
,
double
vz
,
double
ux
,
double
uy
,
double
uz
)
{
NativeGetListenerPositionOrientationVU
(
_NetClient
,
iListenerID
,
px
,
py
,
pz
,
vx
,
vy
,
vz
,
ux
,
uy
,
uz
);
}
public
void
SetListenerPositionOrientationVU
(
int
iListenerID
,
double
px
,
double
py
,
double
pz
,
double
vx
,
double
vy
,
double
vz
,
double
ux
,
double
uy
,
double
uz
)
{
NativeSetListenerPositionOrientationVU
(
_NetClient
,
iListenerID
,
px
,
py
,
pz
,
vx
,
vy
,
vz
,
ux
,
uy
,
uz
);
}
public
void
SetSoundSourceDirectivity
(
int
iSoundSourceID
,
int
iDirectivityID
)
{
NativeSetSoundSourceDirectivity
(
_NetClient
,
iSoundSourceID
,
iDirectivityID
);
}
/*
* Native imported functions from C++ unmanaged library declared private, so they can not be accessed
* directly through C# class method
...
...
VAUAdapter.cs
View file @
85307ecf
...
...
@@ -10,10 +10,12 @@ using VA;
public
class
VAUAdapter
:
MonoBehaviour
{
public
static
string
HostIP
=
"localhost"
;
public
static
int
Port
=
12340
;
public
static
string
DefaultHRIRPath
=
"$(DefaultHRIR)"
;
private
static
string
HostIP
=
"localhost"
;
private
static
int
Port
=
12340
;
private
static
string
DefaultHRIRPath
=
"$(DefaultHRIR)"
;
private
static
string
DefaultDirectivityPath
=
"$(DefaultDirectivity)"
;
private
static
int
defaulthrir
;
private
static
int
defaultdirectivity
;
private
static
VANet
_VA
=
null
;
// No public construction allowed
...
...
@@ -41,6 +43,7 @@ public class VAUAdapter : MonoBehaviour {
_VA
.
Connect
(
HostIP
,
Port
);
_VA
.
Reset
();
defaulthrir
=
_VA
.
LoadHRIRDataset
(
DefaultHRIRPath
,
"DefaultHRIR"
);
//defaultdirectivity = _VA.LoadDirectivity(DefaultDirectivityPath, "DefaultDirectivity");
}
catch
(
ExternalException
e
)
{
...
...
@@ -56,7 +59,15 @@ public class VAUAdapter : MonoBehaviour {
}
}
public
static
int
DefaultDirectivity
{
get
{
return
defaultdirectivity
;
}
}
// Use this for initialization
void
Awake
()
{
...
...
VAUListener.cs
View file @
85307ecf
...
...
@@ -10,9 +10,16 @@ public class VAUListener : MonoBehaviour {
public
int
auramode
=
123
;
private
int
Listener
;
private
VANet
_VA
=
null
;
private
Vector3
viewvec
;
private
Vector3
upvec
;
private
Quaternion
q
;
private
Transform
t
;
// Use this for initialization
void
Start
()
{
upvec
.
Set
(
0
,
1
,
0
);
viewvec
.
Set
(
0
,
0
,
1
);
_VA
=
VAUAdapter
.
VA
;
Listener
=
_VA
.
CreateListener
(
listenername
,
auramode
,
VAUAdapter
.
DefaultHRIR
);
_VA
.
SetListenerHRIRDataset
(
Listener
,
VAUAdapter
.
DefaultHRIR
);
...
...
@@ -21,11 +28,22 @@ public class VAUListener : MonoBehaviour {
// Update is called once per frame
void
Update
()
{
Transform
t
=
GetComponent
<
Transform
>();
t
=
GetComponent
<
Transform
>();
q
=
t
.
rotation
;
Vector3
up
=
q
*
upvec
;
Vector3
view
=
q
*
viewvec
;
Vector3
view_ogl
=
new
Vector3
(
view
.
x
,
view
.
y
,
-
view
.
z
);
Vector3
up_ogl
=
new
Vector3
(
up
.
x
,
up
.
y
,
-
up
.
z
);
_VA
.
SetListenerPosition
(
Listener
,
t
.
transform
.
position
.
x
,
t
.
transform
.
position
.
y
,
-
t
.
transform
.
position
.
z
);
_VA
.
SetListenerOrientationYPR
(
Listener
,
-
t
.
transform
.
rotation
.
eulerAngles
.
x
,
-
t
.
transform
.
rotation
.
eulerAngles
.
y
,
t
.
transform
.
rotation
.
eulerAngles
.
z
);
_VA
.
SetListenerOrientationVU
(
Listener
,
view_ogl
.
x
,
view_ogl
.
y
,
view_ogl
.
z
,
up_ogl
.
x
,
up_ogl
.
y
,
up_ogl
.
z
);
//Quaternion q_ogl = new Quaternion(q.x, q.y, -q.z, -q.w);
//Vector3 t1 = new Vector3(0, 0, 1);
//Vector3 t1_ogl = ( q_ogl * t1 ); // result: 0 0 -1
// Debug.Log(t1_ogl);
}
//void OnDestroy()
//{
// _VA.DeleteListener(Listener);
...
...
VAUSoundSource.cs
View file @
85307ecf
...
...
@@ -12,6 +12,10 @@ public class VAUSoundSource : MonoBehaviour {
public
string
SignalSource
=
""
;
private
VANet
_VA
=
null
;
private
int
SoundSource
;
private
Vector3
viewvec
;
private
Vector3
upvec
;
private
Quaternion
q
;
private
Transform
t
;
private
bool
islooping
;
private
bool
ismuted
;
...
...
@@ -35,9 +39,15 @@ public class VAUSoundSource : MonoBehaviour {
void
Update
()
{
//position and oritentation -> VA
Transform
t
=
GetComponent
<
Transform
>();
t
=
GetComponent
<
Transform
>();
q
=
t
.
rotation
;
Vector3
up
=
q
*
upvec
;
Vector3
view
=
q
*
viewvec
;
Vector3
view_ogl
=
new
Vector3
(
view
.
x
,
view
.
y
,
-
view
.
z
);
Vector3
up_ogl
=
new
Vector3
(
up
.
x
,
up
.
y
,
-
up
.
z
);
_VA
.
SetSoundSourcePosition
(
SoundSource
,
t
.
transform
.
position
.
x
,
t
.
transform
.
position
.
y
,
-
t
.
transform
.
position
.
z
);
_VA
.
SetSoundSourceOrientation
YPR
(
SoundSource
,
-
t
.
transform
.
rotation
.
eulerAngles
.
x
,
-
t
.
transform
.
rotation
.
y
,
t
.
transform
.
rotation
.
eulerAngles
.
z
);
_VA
.
SetSoundSourceOrientation
VU
(
SoundSource
,
view_ogl
.
x
,
view_ogl
.
y
,
view_ogl
.
z
,
up_ogl
.
x
,
up_ogl
.
y
,
up_ogl
.
z
);
ismuted
=
GetComponent
<
AudioSource
>().
mute
;
_VA
.
SetSoundSourceMuted
(
SoundSource
,
ismuted
);
//_VA.SetSoundSourceVolume(SoundSource, Volume); <- flaot ändern
...
...
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