Compiling and linking after API change

parent 4b1df35b
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -185,60 +185,67 @@ double matlabGetRealScalar( const mxArray* arg, const char* argname ) ...@@ -185,60 +185,67 @@ double matlabGetRealScalar( const mxArray* arg, const char* argname )
VA_EXCEPT1( buf ); 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 ]; char buf[ 1024 ];
int size; int size;
if( mxIsNumeric( arg ) && !mxIsComplex( arg ) && matlabIsVector( arg, size ) ) if( mxIsNumeric( arg ) && !mxIsComplex( arg ) && matlabIsVector( arg, size ) )
if( size == 3 ) { {
if( size == 3 )
if( mxIsInt16( arg ) ) { {
if( mxIsInt16( arg ) )
{
int16_t* p = ( int16_t* ) mxGetData( arg ); int16_t* p = ( int16_t* ) mxGetData( arg );
x = ( double ) p[ 0 ]; v3Pos.x = ( double ) p[ 0 ];
y = ( double ) p[ 1 ]; v3Pos.y = ( double ) p[ 1 ];
z = ( double ) p[ 2 ]; v3Pos.z = ( double ) p[ 2 ];
return; return;
} }
if( mxIsInt32( arg ) ) { if( mxIsInt32( arg ) )
{
int32_t* p = ( int32_t* ) mxGetData( arg ); int32_t* p = ( int32_t* ) mxGetData( arg );
x = ( double ) p[ 0 ]; v3Pos.x = ( double ) p[ 0 ];
y = ( double ) p[ 1 ]; v3Pos.y = ( double ) p[ 1 ];
z = ( double ) p[ 2 ]; v3Pos.z = ( double ) p[ 2 ];
return; return;
} }
if( mxIsInt64( arg ) ) { if( mxIsInt64( arg ) )
{
int64_t* p = ( int64_t* ) mxGetData( arg ); int64_t* p = ( int64_t* ) mxGetData( arg );
x = ( double ) p[ 0 ]; v3Pos.x = ( double ) p[ 0 ];
y = ( double ) p[ 1 ]; v3Pos.y = ( double ) p[ 1 ];
z = ( double ) p[ 2 ]; v3Pos.z = ( double ) p[ 2 ];
return; return;
} }
if( mxIsSingle( arg ) ) { if( mxIsSingle( arg ) )
{
float* p = ( float* ) mxGetData( arg ); float* p = ( float* ) mxGetData( arg );
x = ( double ) p[ 0 ]; v3Pos.x = ( double ) p[ 0 ];
y = ( double ) p[ 1 ]; v3Pos.y = ( double ) p[ 1 ];
z = ( double ) p[ 2 ]; v3Pos.z = ( double ) p[ 2 ];
return; return;
} }
if( mxIsDouble( arg ) ) { if( mxIsDouble( arg ) )
{
double* p = ( double* ) mxGetData( arg ); double* p = ( double* ) mxGetData( arg );
x = p[ 0 ]; v3Pos.x = p[ 0 ];
y = p[ 1 ]; v3Pos.y = p[ 1 ];
z = p[ 2 ]; v3Pos.z = p[ 2 ];
return; return;
} }
} }
}
sprintf_s( buf, 1024, "Argument '%s' must be a real-valued vector with exactly three elements", argname ); sprintf_s( buf, 1024, "Argument '%s' must be a real-valued vector with exactly three elements", argname );
VA_EXCEPT1( buf ); 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 ]; char buf[ 1024 ];
int size; int size;
...@@ -250,46 +257,46 @@ void matlabGetQuaternion( const mxArray* arg, const char* argname, double& w, do ...@@ -250,46 +257,46 @@ void matlabGetQuaternion( const mxArray* arg, const char* argname, double& w, do
if( mxIsInt16( arg ) ) { if( mxIsInt16( arg ) ) {
int16_t* p = ( int16_t* ) mxGetData( arg ); int16_t* p = ( int16_t* ) mxGetData( arg );
w = ( double ) p[ 0 ]; qOrient.w = ( double ) p[ 0 ];
i = ( double ) p[ 1 ]; qOrient.x = ( double ) p[ 1 ];
j = ( double ) p[ 2 ]; qOrient.y = ( double ) p[ 2 ];
k = ( double ) p[ 3 ]; qOrient.z = ( double ) p[ 3 ];
return; return;
} }
if( mxIsInt32( arg ) ) { if( mxIsInt32( arg ) ) {
int32_t* p = ( int32_t* ) mxGetData( arg ); int32_t* p = ( int32_t* ) mxGetData( arg );
w = ( double ) p[ 0 ]; qOrient.w = ( double ) p[ 0 ];
i = ( double ) p[ 1 ]; qOrient.x = ( double ) p[ 1 ];
j = ( double ) p[ 2 ]; qOrient.y = ( double ) p[ 2 ];
k = ( double ) p[ 3 ]; qOrient.z = ( double ) p[ 3 ];
return; return;
} }
if( mxIsInt64( arg ) ) { if( mxIsInt64( arg ) ) {
int64_t* p = ( int64_t* ) mxGetData( arg ); int64_t* p = ( int64_t* ) mxGetData( arg );
w = ( double ) p[ 0 ]; qOrient.w = ( double ) p[ 0 ];
i = ( double ) p[ 1 ]; qOrient.x = ( double ) p[ 1 ];
j = ( double ) p[ 2 ]; qOrient.y = ( double ) p[ 2 ];
k = ( double ) p[ 3 ]; qOrient.z = ( double ) p[ 3 ];
return; return;
} }
if( mxIsSingle( arg ) ) { if( mxIsSingle( arg ) ) {
float* p = ( float* ) mxGetData( arg ); float* p = ( float* ) mxGetData( arg );
w = ( double ) p[ 0 ]; qOrient.w = ( double ) p[ 0 ];
i = ( double ) p[ 1 ]; qOrient.x = ( double ) p[ 1 ];
j = ( double ) p[ 2 ]; qOrient.y = ( double ) p[ 2 ];
k = ( double ) p[ 3 ]; qOrient.z = ( double ) p[ 3 ];
return; return;
} }
if( mxIsDouble( arg ) ) { if( mxIsDouble( arg ) ) {
double* p = ( double* ) mxGetData( arg ); double* p = ( double* ) mxGetData( arg );
w = ( double ) p[ 0 ]; qOrient.w = ( double ) p[ 0 ];
i = ( double ) p[ 1 ]; qOrient.x = ( double ) p[ 1 ];
j = ( double ) p[ 2 ]; qOrient.y = ( double ) p[ 2 ];
k = ( double ) p[ 3 ]; qOrient.z = ( double ) p[ 3 ];
return; return;
} }
} }
...@@ -323,16 +330,27 @@ std::string matlabGetString( const mxArray* arg, const char* argname ) ...@@ -323,16 +330,27 @@ std::string matlabGetString( const mxArray* arg, const char* argname )
VA_EXCEPT1( buf ); VA_EXCEPT1( buf );
} }
mxArray* matlabCreateRealVector3( double x, double y, double z ) mxArray* matlabCreateRealVector3( const VAVec3& v3Vec )
{ {
mxArray* p = mxCreateDoubleMatrix( 3, 1, mxREAL ); mxArray* p = mxCreateDoubleMatrix( 3, 1, mxREAL );
double* d = mxGetPr( p ); double* d = mxGetPr( p );
d[ 0 ] = x; d[ 0 ] = v3Vec.x;
d[ 1 ] = y; d[ 1 ] = v3Vec.y;
d[ 2 ] = z; d[ 2 ] = v3Vec.z;
return p; 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 ) mxArray* matlabCreateID( int iID )
{ {
mwSize d[ 2 ] = { 1, 1 }; mwSize d[ 2 ] = { 1, 1 };
......
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
#include <mex.h> #include <mex.h>
// Type checking functions // Type checking functions
bool matlabIsScalar(const mxArray *A); bool matlabIsScalar( const mxArray *A );
bool matlabIsVector(const mxArray *A); bool matlabIsVector( const mxArray *A );
bool matlabIsRowVector(const mxArray *A); bool matlabIsRowVector( const mxArray *A );
bool matlabIsColumnVector(const mxArray *A); bool matlabIsColumnVector( const mxArray *A );
/* /*
* [fwe] Validating getters * [fwe] Validating getters
...@@ -36,23 +36,23 @@ bool matlabIsColumnVector(const mxArray *A); ...@@ -36,23 +36,23 @@ bool matlabIsColumnVector(const mxArray *A);
// Boolean scalar // Boolean scalar
// No strict types: Can be provided int/float/double/string value as well {0,1} // 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 // Integer scalar
// No strict types: Can be provided int/float/double value as well, if this is an integer number // 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 // 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) // 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 // 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 // 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* ); CVAStruct matlabGetStruct( const mxArray*, const char* );
...@@ -60,23 +60,25 @@ CVAStruct matlabGetStruct( const mxArray*, const char* ); ...@@ -60,23 +60,25 @@ CVAStruct matlabGetStruct( const mxArray*, const char* );
* Return value creation helpers * Return value creation helpers
*/ */
mxArray* matlabCreateQuaternion( const VAQuat& );
// 3-Elemente Vektor erzeugen // 3-Elemente Vektor erzeugen
mxArray* matlabCreateRealVector3(double x, double y, double z); mxArray* matlabCreateRealVector3( const VAVec3& v3Vec );
// Creates an ID in Matlab // Creates an ID in Matlab
mxArray* matlabCreateID(int iID); mxArray* matlabCreateID( int iID );
// Creates an list (vector) of IDs in Matlab // 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 // CVADirectivityInfo in Matlab struct konvertieren
mxArray* matlabCreateDirectivityInfo(const CVADirectivityInfo& di); mxArray* matlabCreateDirectivityInfo( const CVADirectivityInfo& di );
// CVASignalSourceInfo in Matlab struct konvertieren // CVASignalSourceInfo in Matlab struct konvertieren
mxArray* matlabCreateSignalSourceInfo(const CVASignalSourceInfo& ssi); mxArray* matlabCreateSignalSourceInfo( const CVASignalSourceInfo& ssi );
// CVASceneInfo in Matlab struct konvertieren // CVASceneInfo in Matlab struct konvertieren
mxArray* matlabCreateSceneInfo(const CVASceneInfo& sci); mxArray* matlabCreateSceneInfo( const CVASceneInfo& sci );
mxArray* matlabCreateStruct( const CVAStruct& oStruct ); mxArray* matlabCreateStruct( const CVAStruct& oStruct );
......
...@@ -33,7 +33,7 @@ void TrackerDataHandler( sFrameOfMocapData* sFrame, void* pUserData ) ...@@ -33,7 +33,7 @@ void TrackerDataHandler( sFrameOfMocapData* sFrame, void* pUserData )
return; return;
// Listener // Listener
int iTrackedReceiverID = pVAMatlabTracker->iTrackedListenerID; int iTrackedReceiverID = pVAMatlabTracker->iTrackedSoundReceiverID;
int iTrackedReceiverRigidBodyIndex = pVAMatlabTracker->iTrackedListenerRigidBodyIndex; int iTrackedReceiverRigidBodyIndex = pVAMatlabTracker->iTrackedListenerRigidBodyIndex;
if( ( iTrackedReceiverID != -1 ) && ( iTrackedReceiverRigidBodyIndex <= sFrame->nRigidBodies ) && ( iTrackedReceiverRigidBodyIndex > 0 ) ) if( ( iTrackedReceiverID != -1 ) && ( iTrackedReceiverRigidBodyIndex <= sFrame->nRigidBodies ) && ( iTrackedReceiverRigidBodyIndex > 0 ) )
...@@ -63,7 +63,7 @@ void TrackerDataHandler( sFrameOfMocapData* sFrame, void* pUserData ) ...@@ -63,7 +63,7 @@ void TrackerDataHandler( sFrameOfMocapData* sFrame, void* pUserData )
} }
// Real-world listener // Real-world listener
int iTrackedRealWorldSoundReceiverID = pVAMatlabTracker->iTrackedRealWorldListenerID; int iTrackedRealWorldSoundReceiverID = pVAMatlabTracker->iTrackedRealWorldSoundReceiverID;
int iTrackedRealWorldListenerRigidBodyIndex = pVAMatlabTracker->iTrackedRealWorldListenerRigidBodyIndex; int iTrackedRealWorldListenerRigidBodyIndex = pVAMatlabTracker->iTrackedRealWorldListenerRigidBodyIndex;
if( ( iTrackedRealWorldSoundReceiverID != -1 ) && ( iTrackedRealWorldListenerRigidBodyIndex <= sFrame->nRigidBodies ) && ( iTrackedRealWorldListenerRigidBodyIndex > 0 ) ) if( ( iTrackedRealWorldSoundReceiverID != -1 ) && ( iTrackedRealWorldListenerRigidBodyIndex <= sFrame->nRigidBodies ) && ( iTrackedRealWorldListenerRigidBodyIndex > 0 ) )
...@@ -135,12 +135,12 @@ CVAMatlabTracker::CVAMatlabTracker() ...@@ -135,12 +135,12 @@ CVAMatlabTracker::CVAMatlabTracker()
void CVAMatlabTracker::Reset() void CVAMatlabTracker::Reset()
{ {
iTrackedListenerID = -1; iTrackedSoundReceiverID = -1;
iTrackedListenerRigidBodyIndex = 1; iTrackedListenerRigidBodyIndex = 1;
vTrackedListenerTranslation.SetToZeroVector(); vTrackedListenerTranslation.SetToZeroVector();
qTrackedListenerRotation.SetToNeutralQuaternion(); qTrackedListenerRotation.SetToNeutralQuaternion();
iTrackedRealWorldListenerID = -1; iTrackedRealWorldSoundReceiverID = -1;
iTrackedRealWorldListenerRigidBodyIndex = 1; iTrackedRealWorldListenerRigidBodyIndex = 1;
vTrackedRealWorldListenerTranslation.SetToZeroVector(); vTrackedRealWorldListenerTranslation.SetToZeroVector();
qTrackedRealWorldListenerRotation.SetToNeutralQuaternion(); qTrackedRealWorldListenerRotation.SetToNeutralQuaternion();
......
...@@ -37,12 +37,12 @@ public: ...@@ -37,12 +37,12 @@ public:
IVAInterface* pVACore; //!< Pointer to (networked) core instance IVAInterface* pVACore; //!< Pointer to (networked) core instance
int iTrackedListenerID; //!< -1 if deactivated, will be preferred over source int iTrackedSoundReceiverID; //!< -1 if deactivated, will be preferred over source
int iTrackedListenerRigidBodyIndex; //!< Starts with 1 (default) int iTrackedListenerRigidBodyIndex; //!< Starts with 1 (default)
VistaVector3D vTrackedListenerTranslation; //!< Position offset from pivot point (default NatNet rigid body barycenter) VistaVector3D vTrackedListenerTranslation; //!< Position offset from pivot point (default NatNet rigid body barycenter)
VistaQuaternion qTrackedListenerRotation; //!< Orientation rotation from default orientation (initial NatNet rigid body orientation) VistaQuaternion qTrackedListenerRotation; //!< Orientation rotation from default orientation (initial NatNet rigid body orientation)
int iTrackedRealWorldListenerID; //!< -1 if deactivated int iTrackedRealWorldSoundReceiverID; //!< -1 if deactivated
int iTrackedRealWorldListenerRigidBodyIndex; //!< Starts with 1 (default) int iTrackedRealWorldListenerRigidBodyIndex; //!< Starts with 1 (default)
VistaVector3D vTrackedRealWorldListenerTranslation; //!< Position offset from pivot point (default NatNet rigid body barycenter) VistaVector3D vTrackedRealWorldListenerTranslation; //!< Position offset from pivot point (default NatNet rigid body barycenter)
VistaQuaternion qTrackedRealWorldListenerRotation; //!< Orientation rotation from default orientation (initial NatNet rigid body orientation) VistaQuaternion qTrackedRealWorldListenerRotation; //!< Orientation rotation from default orientation (initial NatNet rigid body orientation)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment