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
GitLab 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
85307ecf
Commit
85307ecf
authored
8 years ago
by
Maurice Tayeb Andreas
Browse files
Options
Downloads
Patches
Plain Diff
Rotationsübertragung von Linkshändisch in Rechtshändisch
Directivity Variable hinzugefügt
parent
5e781de8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
VACS.cs
+32
-0
32 additions, 0 deletions
VACS.cs
VAUAdapter.cs
+15
-4
15 additions, 4 deletions
VAUAdapter.cs
VAUListener.cs
+20
-2
20 additions, 2 deletions
VAUListener.cs
VAUSoundSource.cs
+12
-2
12 additions, 2 deletions
VAUSoundSource.cs
with
79 additions
and
8 deletions
VACS.cs
+
32
−
0
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
...
...
This diff is collapsed.
Click to expand it.
VAUAdapter.cs
+
15
−
4
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,6 +59,14 @@ public class VAUAdapter : MonoBehaviour {
}
}
public
static
int
DefaultDirectivity
{
get
{
return
defaultdirectivity
;
}
}
// Use this for initialization
void
Awake
()
...
...
This diff is collapsed.
Click to expand it.
VAUListener.cs
+
20
−
2
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);
...
...
This diff is collapsed.
Click to expand it.
VAUSoundSource.cs
+
12
−
2
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
...
...
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