Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Institute of Technical Acoustics (ITA)
VABase
Commits
a27b0595
Commit
a27b0595
authored
Oct 13, 2017
by
Dipl.-Ing. Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More comments
parent
48bd0ca1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
170 additions
and
12 deletions
+170
-12
include/VABase.h
include/VABase.h
+170
-12
No files found.
include/VABase.h
View file @
a27b0595
...
...
@@ -28,11 +28,15 @@ static const double g_dDefaultSpeedOfSound = 344.0f; // [m/s]
static
const
double
g_dDefaultStaticPressure
=
101125
;
// [Pa]
//! 3-element Vector (double precision), in a geometrical context in meters (if not stated otherwise)
/**
* Uses cartesian style, mostly used in OpenGL-rotation convention context
*/
class
VABASE_API
VAVec3
{
public:
union
{
//!< Vector compontents in order x,y,z
double
comp
[
3
];
struct
{
...
...
@@ -40,16 +44,41 @@ public:
};
};
//! Default constructur, sets values to zero
inline
VAVec3
()
:
x
(
0
),
y
(
0
),
z
(
0
)
{};
//! Copy constructor
/**
* @param[in] v Copy values from this vector
*/
inline
VAVec3
(
const
VAVec3
&
v
)
:
x
(
v
.
x
),
y
(
v
.
y
),
z
(
v
.
z
)
{};
//! Init constructor
/**
* @param[in] x X component
* @param[in] y Y component
* @param[in] z Z component
*/
inline
VAVec3
(
const
double
x
,
const
double
y
,
const
double
z
)
:
x
(
x
),
y
(
y
),
z
(
z
)
{};
//! Destructor
inline
virtual
~
VAVec3
()
{};
//! Returns RMS lengs / L2 norm
/*
* @return L2 norm length of cartesian cevrot
*/
inline
virtual
double
Length
()
const
{
return
sqrt
(
x
*
x
+
y
*
y
+
z
*
z
);
};
//! Component setter
/**
* @param[in] x_ X component
* @param[in] y_ Y component
* @param[in] z_ Z component
*/
inline
virtual
void
Set
(
const
double
x_
,
const
double
y_
,
const
double
z_
)
{
x
=
x_
;
...
...
@@ -57,6 +86,12 @@ public:
z
=
z_
;
};
//! Get cross product
/**
* Performs cross product of internal components with parameter vector
* @param[in] vCrossProduct Cross product right-hand value
* @return Cross product vector
*/
inline
VAVec3
Cross
(
const
VAVec3
&
vCrossProduct
)
const
{
VAVec3
vCrossResult
;
...
...
@@ -66,11 +101,21 @@ public:
return
vCrossResult
;
};
//! Get dot product
/**
* Performs dot product of internal components with parameter vector
* @param[in] vDotProduct Dot product right-hand value
* @return Dot product scalar
*/
inline
double
Dot
(
const
VAVec3
&
vDotProduct
)
const
{
return
(
x
*
vDotProduct
.
x
+
y
*
vDotProduct
.
y
+
z
*
vDotProduct
.
z
);
};
//!< Normalizes internal components
/**
* Will return in a L2 norm of 1.0
*/
inline
void
Norm
()
{
const
double
l
=
Length
();
...
...
@@ -79,6 +124,12 @@ public:
z
/=
l
;
};
//!< Get vector as struct
/**
* For struct payload serializaton / deserialization. Make sure that keys are not already assigned.
*
* @return Struct with vector as x,y,z components with keys "x", "y", "z".
*/
inline
CVAStruct
GetAsStruct
()
const
{
CVAStruct
oVec
;
...
...
@@ -89,16 +140,37 @@ public:
};
};
//!< Compare operator for vectors
/**
* @param[in] a Left-hand vector
* @param[in] b Right-hand vector
*
* @return True, if equal
*/
inline
VABASE_API
bool
operator
==
(
const
VAVec3
&
a
,
const
VAVec3
&
b
)
{
return
(
(
a
.
x
==
b
.
x
)
&&
(
a
.
y
==
b
.
y
)
&&
(
a
.
z
==
b
.
z
)
);
};
//!< Unequal operator for vectors
/**
* @param[in] a Left-hand vector
* @param[in] b Right-hand vector
*
* @return True, if unequal
*/
inline
VABASE_API
bool
operator
!=
(
const
VAVec3
&
a
,
const
VAVec3
&
b
)
{
return
!
(
a
==
b
);
};
//!< Add operator for vectors
/**
* @param[in] oSummand1 Left-hand vector
* @param[in] oSummand2 Right-hand vector
*
* @return Addition result
*/
inline
VABASE_API
VAVec3
operator
+
(
const
VAVec3
&
oSummand1
,
const
VAVec3
&
oSummand2
)
{
VAVec3
vSum
;
...
...
@@ -108,7 +180,13 @@ inline VABASE_API VAVec3 operator+( const VAVec3& oSummand1, const VAVec3& oSumm
return
vSum
;
};
//!< Subtract operator for vectors
/**
* @param[in] oSummand1 Left-hand vector
* @param[in] oSummand2 Right-hand vector
*
* @return Subtraction result
*/
inline
VABASE_API
VAVec3
operator
-
(
const
VAVec3
&
oSummand1
,
const
VAVec3
&
oSummand2
)
{
VAVec3
vDiff
;
...
...
@@ -118,6 +196,13 @@ inline VABASE_API VAVec3 operator-( const VAVec3& oSummand1, const VAVec3& oSumm
return
vDiff
;
};
//!< Scalar multiply operator for vectors
/**
* @param[in] oVec VEctor
* @param[in] dScalar Scalar
*
* @param Scaled vector
*/
inline
VABASE_API
VAVec3
operator
*
(
const
VAVec3
&
oVec
,
double
dScalar
)
{
VAVec3
vScaledVector
=
oVec
;
...
...
@@ -128,17 +213,27 @@ inline VABASE_API VAVec3 operator*( const VAVec3& oVec, double dScalar )
};
//! Stream output operator for VAVec3
// Output format: "< x, y, z >"
/**
* Output format: "< x, y, z >"
*
* @param[in] os Outstream
* @param[in] oVec Vector
*
* @return Outstream with vector output attached
*/
VABASE_API
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
VAVec3
&
oVec
);
//! 4-element Quaternion (double precision)
/**
* Quaternion representation for solid rotation and orientation representation.
*/
class
VABASE_API
VAQuat
{
public:
union
{
//!< Components in order x,y,z,w
double
comp
[
4
];
struct
{
...
...
@@ -146,11 +241,34 @@ public:
};
};
//! Default constructur, sets values to zero and w to 1.0
inline
VAQuat
()
:
x
(
0
),
y
(
0
),
z
(
0
),
w
(
1.0
f
)
{};
//! Copy constructor
/**
* @param[in] v Will copy values from this quaternion
*/
inline
VAQuat
(
const
VAQuat
&
v
)
:
x
(
v
.
x
),
y
(
v
.
y
),
z
(
v
.
z
),
w
(
v
.
w
)
{};
//! Init constructor
/**
* @param[in] x X component
* @param[in] y Y component
* @param[in] z Z component
* @param[in] w W component
*/
inline
VAQuat
(
const
double
x
,
const
double
y
,
const
double
z
,
const
double
w
=
1.0
f
)
:
x
(
x
),
y
(
y
),
z
(
z
),
w
(
w
)
{};
inline
virtual
~
VAQuat
()
{};
//! Destructor
inline
virtual
~
VAQuat
()
{};
//! Setter
/**
* @param[in] x_ X component
* @param[in] y_ Y component
* @param[in] z_ Z component
* @param[in] w_ W component
*/
inline
virtual
void
Set
(
const
double
x_
,
const
double
y_
,
const
double
z_
,
const
double
w_
)
{
x
=
x_
;
...
...
@@ -159,6 +277,12 @@ public:
w
=
w_
;
};
//!< Get vector as struct
/**
* For struct payload serializaton / deserialization. Make sure that keys are not already assigned.
*
* @return Struct with vector as x,y,z,w components with keys "x", "y", "z", "w".
*/
inline
CVAStruct
GetAsStruct
()
const
{
CVAStruct
oOrient
;
...
...
@@ -171,8 +295,15 @@ public:
};
//! Stream output operator for Quaternion
// Output format: "< x, y, z, 'w' >"
VABASE_API
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
VAQuat
&
oOrient
);
/**
* Output format: "< x, y, z, w >"
*
* @param[in] os Outstream
* @param[in] qOrient Quaternion orientation
*
* @return Outstream with quaternion output attached
*/
VABASE_API
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
VAQuat
&
qOrient
);
//! Data class describing callable and registrable objects
...
...
@@ -187,6 +318,7 @@ struct VABASE_API CVAObjectInfo
std
::
string
sName
;
//!< Object name
std
::
string
sDesc
;
//!< Object description
//! Default constructor will set identifier to -1
inline
CVAObjectInfo
()
:
iID
(
-
1
)
{};
...
...
@@ -195,7 +327,7 @@ struct VABASE_API CVAObjectInfo
//! Pure data class describing modules of the core
/**
*
*
For module info getter.
*/
struct
VABASE_API
CVAModuleInfo
{
...
...
@@ -205,6 +337,9 @@ struct VABASE_API CVAModuleInfo
};
//! Struct describing an audio renderer
/**
* Rendering module info for getters.
*/
struct
VABASE_API
CVAAudioRendererInfo
{
std
::
string
sID
;
//!< Renderer identifier
...
...
@@ -225,6 +360,9 @@ struct VABASE_API CVAAudioRendererInfo
};
//! Struct describing an audio reproduction module
/**
* Reproduction module info for getters.
*/
struct
VABASE_API
CVAAudioReproductionInfo
{
std
::
string
sID
;
//!< Reproduction module identifier
...
...
@@ -265,7 +403,7 @@ public:
std
::
string
sAction
;
//!< Currently performed action (top level)
std
::
string
sSubaction
;
//!< Currently performed sub action
//! Constructor
//! Constructor
inits values
inline
CVAProgress
()
:
iCurrentStep
(
0
)
,
iMaxStep
(
0
)
...
...
@@ -275,6 +413,9 @@ public:
//! Data class describing integer literals within the core interface (reflexions)
/**
* For literals getter.
*/
class
VABASE_API
CVAIntLiteral
{
public:
...
...
@@ -286,9 +427,9 @@ public:
/**
* Create an integer literal.
*
*
\
param sTheScope Scope of the literal, i.e. IVACore
*
\
param sTheName Name string of the integer literal, i.e. 'VA_AURAMOD_DEFAULT'
*
\
param iTheValue Value of the integer
*
@
param
[in]
sTheScope Scope of the literal, i.e. IVACore
*
@
param
[in]
sTheName Name string of the integer literal, i.e. 'VA_AURAMOD_DEFAULT'
*
@
param
[in]
iTheValue Value of the integer
*/
inline
CVAIntLiteral
(
const
std
::
string
&
sTheScope
,
const
std
::
string
&
sTheName
,
const
int
iTheValue
)
:
sScope
(
sTheScope
)
...
...
@@ -296,6 +437,7 @@ public:
,
iValue
(
iTheValue
)
{
};
private:
//! No default construction
inline
CVAIntLiteral
()
{};
...
...
@@ -315,6 +457,7 @@ private:
class
VABASE_API
CVADirectivityInfo
{
public:
//! Directivity class definitions
enum
DirectivityClass
{
UNSPECIFIED
=
-
1
,
...
...
@@ -331,7 +474,7 @@ public:
int
iReferences
;
//!< Number of references
CVAStruct
oParams
;
//!< Special parameters (including file path etc.)
//! Default constructor
//! Default constructor
inits some values
inline
CVADirectivityInfo
()
:
iID
(
-
1
)
,
iClass
(
UNSPECIFIED
)
...
...
@@ -361,6 +504,9 @@ public:
//! Data class for signal source information
/**
* For info getter.
*/
class
VABASE_API
CVASignalSourceInfo
{
public:
...
...
@@ -413,6 +559,9 @@ public:
//! Data class containing information of a virtual acoustic scene
/**
* For scene getter.
*/
class
VABASE_API
CVASceneInfo
{
public:
...
...
@@ -434,6 +583,9 @@ public:
//! Data class describing states of audio streams
/**
* For audio stream state getter.
*/
class
VABASE_API
CVAAudiostreamState
{
public:
...
...
@@ -460,6 +612,9 @@ public:
//! Data class containing information of a sound source (acoustic actuator)
/**
* For sound source info getter.
*/
class
VABASE_API
CVASoundSourceInfo
{
public:
...
...
@@ -491,6 +646,9 @@ public:
//! Data class containing information of a sound receiver (acoustic receiver)
/**
* For sound source info receiver.
*/
class
VABASE_API
CVASoundReceiverInfo
{
public:
...
...
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