Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
VAMatlab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
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)
VAMatlab
Commits
ee6a4226
Commit
ee6a4226
authored
Oct 06, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compiling and linking after API change
parent
4b1df35b
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
476 additions
and
899 deletions
+476
-899
src/VAMatlabExecutable.cpp
src/VAMatlabExecutable.cpp
+386
-829
src/VAMatlabHelpers.cpp
src/VAMatlabHelpers.cpp
+66
-48
src/VAMatlabHelpers.h
src/VAMatlabHelpers.h
+18
-16
src/VAMatlabTracking.cpp
src/VAMatlabTracking.cpp
+4
-4
src/VAMatlabTracking.h
src/VAMatlabTracking.h
+2
-2
No files found.
src/VAMatlabExecutable.cpp
View file @
ee6a4226
This diff is collapsed.
Click to expand it.
src/VAMatlabHelpers.cpp
View file @
ee6a4226
...
...
@@ -185,60 +185,67 @@ double matlabGetRealScalar( const mxArray* arg, const char* argname )
VA_EXCEPT1
(
buf
);
}
void
matlabGetRealVector3
(
const
mxArray
*
arg
,
const
char
*
argname
,
double
&
x
,
double
&
y
,
double
&
z
)
void
matlabGetRealVector3
(
const
mxArray
*
arg
,
const
char
*
argname
,
VAVec3
&
v3Pos
)
{
char
buf
[
1024
];
int
size
;
if
(
mxIsNumeric
(
arg
)
&&
!
mxIsComplex
(
arg
)
&&
matlabIsVector
(
arg
,
size
)
)
if
(
size
==
3
)
{
if
(
mxIsInt16
(
arg
)
)
{
{
if
(
size
==
3
)
{
if
(
mxIsInt16
(
arg
)
)
{
int16_t
*
p
=
(
int16_t
*
)
mxGetData
(
arg
);
x
=
(
double
)
p
[
0
];
y
=
(
double
)
p
[
1
];
z
=
(
double
)
p
[
2
];
v3Pos
.
x
=
(
double
)
p
[
0
];
v3Pos
.
y
=
(
double
)
p
[
1
];
v3Pos
.
z
=
(
double
)
p
[
2
];
return
;
}
if
(
mxIsInt32
(
arg
)
)
{
if
(
mxIsInt32
(
arg
)
)
{
int32_t
*
p
=
(
int32_t
*
)
mxGetData
(
arg
);
x
=
(
double
)
p
[
0
];
y
=
(
double
)
p
[
1
];
z
=
(
double
)
p
[
2
];
v3Pos
.
x
=
(
double
)
p
[
0
];
v3Pos
.
y
=
(
double
)
p
[
1
];
v3Pos
.
z
=
(
double
)
p
[
2
];
return
;
}
if
(
mxIsInt64
(
arg
)
)
{
if
(
mxIsInt64
(
arg
)
)
{
int64_t
*
p
=
(
int64_t
*
)
mxGetData
(
arg
);
x
=
(
double
)
p
[
0
];
y
=
(
double
)
p
[
1
];
z
=
(
double
)
p
[
2
];
v3Pos
.
x
=
(
double
)
p
[
0
];
v3Pos
.
y
=
(
double
)
p
[
1
];
v3Pos
.
z
=
(
double
)
p
[
2
];
return
;
}
if
(
mxIsSingle
(
arg
)
)
{
if
(
mxIsSingle
(
arg
)
)
{
float
*
p
=
(
float
*
)
mxGetData
(
arg
);
x
=
(
double
)
p
[
0
];
y
=
(
double
)
p
[
1
];
z
=
(
double
)
p
[
2
];
v3Pos
.
x
=
(
double
)
p
[
0
];
v3Pos
.
y
=
(
double
)
p
[
1
];
v3Pos
.
z
=
(
double
)
p
[
2
];
return
;
}
if
(
mxIsDouble
(
arg
)
)
{
if
(
mxIsDouble
(
arg
)
)
{
double
*
p
=
(
double
*
)
mxGetData
(
arg
);
x
=
p
[
0
];
y
=
p
[
1
];
z
=
p
[
2
];
v3Pos
.
x
=
p
[
0
];
v3Pos
.
y
=
p
[
1
];
v3Pos
.
z
=
p
[
2
];
return
;
}
}
}
sprintf_s
(
buf
,
1024
,
"Argument '%s' must be a real-valued vector with exactly three elements"
,
argname
);
VA_EXCEPT1
(
buf
);
}
void
matlabGetQuaternion
(
const
mxArray
*
arg
,
const
char
*
argname
,
double
&
w
,
double
&
i
,
double
&
j
,
double
&
k
)
void
matlabGetQuaternion
(
const
mxArray
*
arg
,
const
char
*
argname
,
VAQuat
&
qOrient
)
{
char
buf
[
1024
];
int
size
;
...
...
@@ -250,46 +257,46 @@ void matlabGetQuaternion( const mxArray* arg, const char* argname, double& w, do
if
(
mxIsInt16
(
arg
)
)
{
int16_t
*
p
=
(
int16_t
*
)
mxGetData
(
arg
);
w
=
(
double
)
p
[
0
];
i
=
(
double
)
p
[
1
];
j
=
(
double
)
p
[
2
];
k
=
(
double
)
p
[
3
];
qOrient
.
w
=
(
double
)
p
[
0
];
qOrient
.
x
=
(
double
)
p
[
1
];
qOrient
.
y
=
(
double
)
p
[
2
];
qOrient
.
z
=
(
double
)
p
[
3
];
return
;
}
if
(
mxIsInt32
(
arg
)
)
{
int32_t
*
p
=
(
int32_t
*
)
mxGetData
(
arg
);
w
=
(
double
)
p
[
0
];
i
=
(
double
)
p
[
1
];
j
=
(
double
)
p
[
2
];
k
=
(
double
)
p
[
3
];
qOrient
.
w
=
(
double
)
p
[
0
];
qOrient
.
x
=
(
double
)
p
[
1
];
qOrient
.
y
=
(
double
)
p
[
2
];
qOrient
.
z
=
(
double
)
p
[
3
];
return
;
}
if
(
mxIsInt64
(
arg
)
)
{
int64_t
*
p
=
(
int64_t
*
)
mxGetData
(
arg
);
w
=
(
double
)
p
[
0
];
i
=
(
double
)
p
[
1
];
j
=
(
double
)
p
[
2
];
k
=
(
double
)
p
[
3
];
qOrient
.
w
=
(
double
)
p
[
0
];
qOrient
.
x
=
(
double
)
p
[
1
];
qOrient
.
y
=
(
double
)
p
[
2
];
qOrient
.
z
=
(
double
)
p
[
3
];
return
;
}
if
(
mxIsSingle
(
arg
)
)
{
float
*
p
=
(
float
*
)
mxGetData
(
arg
);
w
=
(
double
)
p
[
0
];
i
=
(
double
)
p
[
1
];
j
=
(
double
)
p
[
2
];
k
=
(
double
)
p
[
3
];
qOrient
.
w
=
(
double
)
p
[
0
];
qOrient
.
x
=
(
double
)
p
[
1
];
qOrient
.
y
=
(
double
)
p
[
2
];
qOrient
.
z
=
(
double
)
p
[
3
];
return
;
}
if
(
mxIsDouble
(
arg
)
)
{
double
*
p
=
(
double
*
)
mxGetData
(
arg
);
w
=
(
double
)
p
[
0
];
i
=
(
double
)
p
[
1
];
j
=
(
double
)
p
[
2
];
k
=
(
double
)
p
[
3
];
qOrient
.
w
=
(
double
)
p
[
0
];
qOrient
.
x
=
(
double
)
p
[
1
];
qOrient
.
y
=
(
double
)
p
[
2
];
qOrient
.
z
=
(
double
)
p
[
3
];
return
;
}
}
...
...
@@ -323,16 +330,27 @@ std::string matlabGetString( const mxArray* arg, const char* argname )
VA_EXCEPT1
(
buf
);
}
mxArray
*
matlabCreateRealVector3
(
double
x
,
double
y
,
double
z
)
mxArray
*
matlabCreateRealVector3
(
const
VAVec3
&
v3Vec
)
{
mxArray
*
p
=
mxCreateDoubleMatrix
(
3
,
1
,
mxREAL
);
double
*
d
=
mxGetPr
(
p
);
d
[
0
]
=
x
;
d
[
1
]
=
y
;
d
[
2
]
=
z
;
d
[
0
]
=
v3Vec
.
x
;
d
[
1
]
=
v3Vec
.
y
;
d
[
2
]
=
v3Vec
.
z
;
return
p
;
}
mxArray
*
matlabCreateQuaternion
(
const
VAQuat
&
qOrient
)
{
mxArray
*
q
=
mxCreateDoubleMatrix
(
4
,
1
,
mxREAL
);
double
*
d
=
mxGetPr
(
q
);
d
[
1
]
=
qOrient
.
w
;
d
[
2
]
=
qOrient
.
x
;
d
[
3
]
=
qOrient
.
y
;
d
[
4
]
=
qOrient
.
z
;
return
q
;
}
mxArray
*
matlabCreateID
(
int
iID
)
{
mwSize
d
[
2
]
=
{
1
,
1
};
...
...
src/VAMatlabHelpers.h
View file @
ee6a4226
...
...
@@ -22,10 +22,10 @@
#include <mex.h>
// Type checking functions
bool
matlabIsScalar
(
const
mxArray
*
A
);
bool
matlabIsVector
(
const
mxArray
*
A
);
bool
matlabIsRowVector
(
const
mxArray
*
A
);
bool
matlabIsColumnVector
(
const
mxArray
*
A
);
bool
matlabIsScalar
(
const
mxArray
*
A
);
bool
matlabIsVector
(
const
mxArray
*
A
);
bool
matlabIsRowVector
(
const
mxArray
*
A
);
bool
matlabIsColumnVector
(
const
mxArray
*
A
);
/*
* [fwe] Validating getters
...
...
@@ -36,23 +36,23 @@ bool matlabIsColumnVector(const mxArray *A);
// Boolean scalar
// No strict types: Can be provided int/float/double/string value as well {0,1}
bool
matlabGetBoolScalar
(
const
mxArray
*
arg
,
const
char
*
argname
);
bool
matlabGetBoolScalar
(
const
mxArray
*
arg
,
const
char
*
argname
);
// Integer scalar
// No strict types: Can be provided int/float/double value as well, if this is an integer number
int
matlabGetIntegerScalar
(
const
mxArray
*
arg
,
const
char
*
argname
);
int
matlabGetIntegerScalar
(
const
mxArray
*
arg
,
const
char
*
argname
);
// Real-valued scalar
double
matlabGetRealScalar
(
const
mxArray
*
arg
,
const
char
*
argname
);
double
matlabGetRealScalar
(
const
mxArray
*
arg
,
const
char
*
argname
);
// Real-valued 3-element vector (row|column)
void
matlabGetRealVector3
(
const
mxArray
*
arg
,
const
char
*
argname
,
double
&
x
,
double
&
y
,
double
&
z
);
void
matlabGetRealVector3
(
const
mxArray
*
arg
,
const
char
*
argname
,
VAVec3
&
);
// Real-valued quaternion values as 1x4 vector
void
matlabGetQuaternion
(
const
mxArray
*
arg
,
const
char
*
argname
,
double
&
w
,
double
&
i
,
double
&
j
,
double
&
k
);
void
matlabGetQuaternion
(
const
mxArray
*
arg
,
const
char
*
argname
,
VAQuat
&
);
// String
std
::
string
matlabGetString
(
const
mxArray
*
arg
,
const
char
*
argname
);
std
::
string
matlabGetString
(
const
mxArray
*
arg
,
const
char
*
argname
);
CVAStruct
matlabGetStruct
(
const
mxArray
*
,
const
char
*
);
...
...
@@ -60,23 +60,25 @@ CVAStruct matlabGetStruct( const mxArray*, const char* );
* Return value creation helpers
*/
mxArray
*
matlabCreateQuaternion
(
const
VAQuat
&
);
// 3-Elemente Vektor erzeugen
mxArray
*
matlabCreateRealVector3
(
double
x
,
double
y
,
double
z
);
mxArray
*
matlabCreateRealVector3
(
const
VAVec3
&
v3Vec
);
// Creates an ID in Matlab
mxArray
*
matlabCreateID
(
int
iID
);
mxArray
*
matlabCreateID
(
int
iID
);
// Creates an list (vector) of IDs in Matlab
mxArray
*
matlabCreateIDList
(
const
std
::
vector
<
int
>&
viID
);
mxArray
*
matlabCreateIDList
(
const
std
::
vector
<
int
>&
viID
);
// CVADirectivityInfo in Matlab struct konvertieren
mxArray
*
matlabCreateDirectivityInfo
(
const
CVADirectivityInfo
&
di
);
mxArray
*
matlabCreateDirectivityInfo
(
const
CVADirectivityInfo
&
di
);
// CVASignalSourceInfo in Matlab struct konvertieren
mxArray
*
matlabCreateSignalSourceInfo
(
const
CVASignalSourceInfo
&
ssi
);
mxArray
*
matlabCreateSignalSourceInfo
(
const
CVASignalSourceInfo
&
ssi
);
// CVASceneInfo in Matlab struct konvertieren
mxArray
*
matlabCreateSceneInfo
(
const
CVASceneInfo
&
sci
);
mxArray
*
matlabCreateSceneInfo
(
const
CVASceneInfo
&
sci
);
mxArray
*
matlabCreateStruct
(
const
CVAStruct
&
oStruct
);
...
...
src/VAMatlabTracking.cpp
View file @
ee6a4226
...
...
@@ -33,7 +33,7 @@ void TrackerDataHandler( sFrameOfMocapData* sFrame, void* pUserData )
return
;
// Listener
int
iTrackedReceiverID
=
pVAMatlabTracker
->
iTracked
Listen
erID
;
int
iTrackedReceiverID
=
pVAMatlabTracker
->
iTracked
SoundReceiv
erID
;
int
iTrackedReceiverRigidBodyIndex
=
pVAMatlabTracker
->
iTrackedListenerRigidBodyIndex
;
if
(
(
iTrackedReceiverID
!=
-
1
)
&&
(
iTrackedReceiverRigidBodyIndex
<=
sFrame
->
nRigidBodies
)
&&
(
iTrackedReceiverRigidBodyIndex
>
0
)
)
...
...
@@ -63,7 +63,7 @@ void TrackerDataHandler( sFrameOfMocapData* sFrame, void* pUserData )
}
// Real-world listener
int
iTrackedRealWorldSoundReceiverID
=
pVAMatlabTracker
->
iTrackedRealWorld
Listen
erID
;
int
iTrackedRealWorldSoundReceiverID
=
pVAMatlabTracker
->
iTrackedRealWorld
SoundReceiv
erID
;
int
iTrackedRealWorldListenerRigidBodyIndex
=
pVAMatlabTracker
->
iTrackedRealWorldListenerRigidBodyIndex
;
if
(
(
iTrackedRealWorldSoundReceiverID
!=
-
1
)
&&
(
iTrackedRealWorldListenerRigidBodyIndex
<=
sFrame
->
nRigidBodies
)
&&
(
iTrackedRealWorldListenerRigidBodyIndex
>
0
)
)
...
...
@@ -135,12 +135,12 @@ CVAMatlabTracker::CVAMatlabTracker()
void
CVAMatlabTracker
::
Reset
()
{
iTracked
Listen
erID
=
-
1
;
iTracked
SoundReceiv
erID
=
-
1
;
iTrackedListenerRigidBodyIndex
=
1
;
vTrackedListenerTranslation
.
SetToZeroVector
();
qTrackedListenerRotation
.
SetToNeutralQuaternion
();
iTrackedRealWorld
Listen
erID
=
-
1
;
iTrackedRealWorld
SoundReceiv
erID
=
-
1
;
iTrackedRealWorldListenerRigidBodyIndex
=
1
;
vTrackedRealWorldListenerTranslation
.
SetToZeroVector
();
qTrackedRealWorldListenerRotation
.
SetToNeutralQuaternion
();
...
...
src/VAMatlabTracking.h
View file @
ee6a4226
...
...
@@ -37,12 +37,12 @@ public:
IVAInterface
*
pVACore
;
//!< Pointer to (networked) core instance
int
iTracked
Listen
erID
;
//!< -1 if deactivated, will be preferred over source
int
iTracked
SoundReceiv
erID
;
//!< -1 if deactivated, will be preferred over source
int
iTrackedListenerRigidBodyIndex
;
//!< Starts with 1 (default)
VistaVector3D
vTrackedListenerTranslation
;
//!< Position offset from pivot point (default NatNet rigid body barycenter)
VistaQuaternion
qTrackedListenerRotation
;
//!< Orientation rotation from default orientation (initial NatNet rigid body orientation)
int
iTrackedRealWorld
Listen
erID
;
//!< -1 if deactivated
int
iTrackedRealWorld
SoundReceiv
erID
;
//!< -1 if deactivated
int
iTrackedRealWorldListenerRigidBodyIndex
;
//!< Starts with 1 (default)
VistaVector3D
vTrackedRealWorldListenerTranslation
;
//!< Position offset from pivot point (default NatNet rigid body barycenter)
VistaQuaternion
qTrackedRealWorldListenerRotation
;
//!< Orientation rotation from default orientation (initial NatNet rigid body orientation)
...
...
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