Starting cleanup, style, etc. in preparation of big API update before release

parent 806eff92
/*
* --------------------------------------------------------------------------------------------
*
* VVV VVV A Virtual Acoustics (VA) | http://www.virtualacoustics.org
* VVV VVV AAA Licensed under the Apache License, Version 2.0
* VVV VVV AAA
* VVV VVV AAA Copyright 2015-2017
* VVVVVV AAA Institute of Technical Acoustics (ITA)
* VVVV AAA RWTH Aachen University
*
* --------------------------------------------------------------------------------------------
*/
#ifndef IW_VABASE_ATTRIBUTABLE
#define IW_VABASE_ATTRIBUTABLE
#include <VABaseDefinitions.h>
#include <map>
//! Attribute base class
/**
* This is the base class for attributes.
* Currently it only defines the destructor.
*/
class VABASE_API IVAAttribute
{
public:
virtual ~IVAAttribute();
};
//! Attributation interface
/**
* This aspect allows attaching/detaching attributes by means of a pointer
* to some instance of a class. The attributes are associated with their owner,
* the instance, which added/removed them. Thereby 1 instance can be associated
* with N attributes. The interface is used, so that other class can extend
* previously created instances of some base class with their own runtime data.
* Example: An HRIR dataset can be attach with some frequency-domain HRTF representation.
*/
class VABASE_API IVAAttributable
{
public:
virtual ~IVAAttributable();
virtual void AttachAttribute( void* pOwner, IVAAttribute* pAttr ) = 0;
virtual void DetachAttribute( void* pOwner ) = 0;
virtual IVAAttribute* GetAttribute( void* pOwner ) = 0;
};
//! Attributation interface default implementation
/**
* Implements the IVAAttributable interface using std::map.
* @note not thread-safe
*/
class VABASE_API CVAAttributableImpl : public IVAAttributable
{
public:
virtual ~CVAAttributableImpl();
virtual void AttachAttribute( void* pOwner, IVAAttribute* pAttr );
virtual void DetachAttribute( void* pOwner );
virtual IVAAttribute* GetAttribute( void* pOwner );
private:
typedef std::map<void*, IVAAttribute*> AttrMap;
typedef AttrMap::iterator AttrMapIt;
AttrMap m_mAttr;
};
#endif // IW_VABASE_ATTRIBUTABLE
......@@ -15,6 +15,7 @@
#define IW_VABASE_AUDIO_SIGNAL_SOURCE
#include <VABaseDefinitions.h>
#include <VABase.h>
#include <VAStruct.h>
#include <string>
......@@ -49,20 +50,20 @@ public:
VA_SS_ENGINE, //!< Sound source is an engine
VA_SS_MACHINE, //!< Sound source is a machine
VA_SS_TEXT_TO_SPEECH,
} SoundSourceTypes;
};
//! Destructor.
inline virtual ~IVAAudioSignalSource() {};
//! Type ID getter
/**
* \return Returns the ID (one out of #SoundSourceTypes)
* @return Returns the ID (one out of #SoundSourceTypes)
*/
virtual int GetType() const = 0;
//! Type getter (human readable string)
/**
* \return Returns the type (one out of #SoundSourceTypes as a human readable string)
* @return Returns the type (one out of #SoundSourceTypes as a human readable string)
*/
virtual std::string GetTypeString() const = 0;
......@@ -71,7 +72,7 @@ public:
* The description formulates a human readable string that describes the
* sound source, i.e. 'Network stream on port 2344'
*
* \return Returns a human readable sound source description
* @return Returns a human readable sound source description
*/
virtual std::string GetDesc() const = 0;
......@@ -80,7 +81,7 @@ public:
* The sound state is for example the percentage of progess
* in an audio file sound source, i.e. 'Playback (10%)'
*
* \return Returns a human readable status of the sound source
* @return Returns a human readable status of the sound source
*/
virtual std::string GetStateString() const = 0;
......@@ -92,7 +93,7 @@ public:
* This method is used by the core to assuure that the sound source
* object has not been associated to another core (not allowed).
*
* \return Pointer to the associated #IVACore, NULL if non present
* @return Pointer to the associated #IVACore, NULL if non present
*/
virtual IVACore* GetAssociatedCore() const = 0;
......
/*
* --------------------------------------------------------------------------------------------
*
* VVV VVV A Virtual Acoustics (VA) | http://www.virtualacoustics.org
* VVV VVV AAA Licensed under the Apache License, Version 2.0
* VVV VVV AAA
* VVV VVV AAA Copyright 2015-2017
* VVVVVV AAA Institute of Technical Acoustics (ITA)
* VVVV AAA RWTH Aachen University
*
* --------------------------------------------------------------------------------------------
*/
#ifndef IW_VABASE
#define IW_VABASE
#include <VABaseDefinitions.h>
#include <string>
#include <vector>
#include <cmath>
//! 3-element Vector (double precision), in a geometrical context in meters (if not stated otherwise)
class VABASE_API VAVec3
{
public:
union
{
double comp[ 3 ];
struct
{
double x, y, z;
};
};
inline VAVec3() : x( 0 ), y( 0 ), z( 0 ) {};
inline VAVec3( const VAVec3& v ) : x( v.x ), y( v.y ), z( v.z ) {};
inline VAVec3( double x, double y, double z ) : x( x ), y( y ), z( z ) {};
inline virtual ~VAVec3() {};
inline virtual double Length() const
{
return sqrt( x*x + y*y + z*z );
};
inline virtual void Set( double x_, double y_, double z_ )
{
x = x_;
y = y_;
z = z_;
};
inline VAVec3 Cross( const VAVec3& vCrossProduct ) const
{
VAVec3 vCrossResult;
vCrossResult.x = y * vCrossProduct.z - z * vCrossProduct.y;
vCrossResult.y = z * vCrossProduct.x - x * vCrossProduct.z;
vCrossResult.z = x * vCrossProduct.y - y * vCrossProduct.x;
return vCrossResult;
};
inline double Dot( const VAVec3& vDotProduct ) const
{
return ( x * vDotProduct.x + y * vDotProduct.y + z * vDotProduct.z );
};
inline void Norm()
{
const double l = Length();
x /= l;
y /= l;
z /= l;
};
};
inline VABASE_API bool operator==( const VAVec3& a, const VAVec3& b )
{
return ( ( a.x == b.x ) && ( a.y == b.y ) && ( a.z == b.z ) );
};
inline VABASE_API bool operator!=( const VAVec3& a, const VAVec3& b )
{
return !( a == b );
};
inline VABASE_API VAVec3 operator+( const VAVec3& oSummand1, const VAVec3& oSummand2 )
{
VAVec3 vSum;
vSum.x = oSummand1.x + oSummand2.x;
vSum.y = oSummand1.y + oSummand2.y;
vSum.z = oSummand1.z + oSummand2.z;
return vSum;
};
inline VABASE_API VAVec3 operator-( const VAVec3& oSummand1, const VAVec3& oSummand2 )
{
VAVec3 vDiff;
vDiff.x = oSummand1.x - oSummand2.x;
vDiff.y = oSummand1.y - oSummand2.y;
vDiff.z = oSummand1.z - oSummand2.z;
return vDiff;
};
inline VABASE_API VAVec3 operator*( const VAVec3& oVec, double dScalar )
{
VAVec3 vScaledVector = oVec;
vScaledVector.x *= dScalar;
vScaledVector.y *= dScalar;
vScaledVector.z *= dScalar;
return vScaledVector;
};
//! Stream output operator
// Output format: "<1, 2, 3>"
VABASE_API std::ostream& operator<<( std::ostream& os, const VAVec3& oVec );
//! Orientation Yaw-Pitch-Roll angles (double precision) in degree (if not states otherwise)
/**
* @warn Deprecated, will be removed by VAQuat
*/
class VABASE_API VAOrientYPR
{
public:
double yaw; //!< Right-hand rotation around Y-axis
double pitch; //!< Right-hand rotation around X-axis
double roll; //!< Right-hand rotation around negative Z-axis
inline VAOrientYPR() : yaw( 0 ), pitch( 0 ), roll( 0 ) {};
inline VAOrientYPR( double yaw, double pitch, double roll ) : yaw( yaw ), pitch( pitch ), roll( roll ) {};
inline virtual ~VAOrientYPR() {};
inline virtual void Set( double yaw_deg, double pitch_deg, double roll_deg )
{
yaw = yaw_deg;
pitch = pitch_deg;
roll = roll_deg;
};
};
//! Stream output operator
// Output format: "<1, 2, 3>"
VABASE_API std::ostream& operator<<( std::ostream& os, const VAOrientYPR& oOrient );
//! Data class describing callable and registrable objects
struct VABASE_API CVAObjectInfo
{
int iID; //!< Object ID
std::string sName; //!< Object name
std::string sDesc; //!< Object description
};
//! Pure data class describing modules of the core
struct VABASE_API CVAModuleInfo
{
std::string sName; //!< Module name
std::string sDesc; //!< Module description
};
//! Struct describing an audio renderer
struct VABASE_API CVAAudioRendererInfo
{
std::string sID; //!< Renderer identifier
std::string sClass; //!< Renderer class
std::string sDescription; //!< Renderer description
bool bEnabled; //!< Availability during runtime
};
//! Struct describing an audio reproduction module
struct VABASE_API CVAAudioReproductionInfo
{
std::string sID; //!< Reproduction module identifier
std::string sClass; //!< Reproduction module class
std::string sDescription; //!< Reproduction module description
bool bEnabled; //!< Availability during runtime
};
//! Describes the current state of a progress
/**
* This data class is used to describe the current state of a
* running process (progress). It is intended for the purpose
* of displaying the progress of an action that takes some time
* to be shown in a user interface (i.e. the initialisation of
* a core)
*/
class VABASE_API CVAProgress
{
public:
int iCurrentStep; //!< Current step number (0 = nothing happened yet)
int iMaxStep; //!< Maximum step number (end)
std::string sAction; //!< Currently performed action (top level)
std::string sSubaction; //!< Currently performed sub action
//! Constructor
inline CVAProgress()
: iCurrentStep( 0 )
, iMaxStep( 0 )
{
};
};
//! Data class describing integer literals within the core interface (reflexions)
class VABASE_API CVAIntLiteral
{
public:
std::string sScope; //!< Interface name (e.g. IVACore)
std::string sName; //!< Literal name (e.g. 'VA_AURAMODE_DIRECT_SOUND')
int iValue; //!< Literal integer value
//! Constructor
/**
* 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
*/
inline CVAIntLiteral( const std::string& sTheScope, const std::string& sTheName, int iTheValue )
: sScope( sTheScope )
, sName( sTheName )
, iValue( iTheValue )
{
};
};
//! Data class containing information of loaded directivities
class VABASE_API CVADirectivityInfo
{
public:
int iID; //!< ID
std::string sName; //!< Name (optional)
std::string sFilename; //!< Filename
std::string sDesc; //!< Description (e.g. resolution)
int iReferences; //!< Number of references
// TODO: Auflsung usw.
//! Default constructor
inline CVADirectivityInfo()
: iID( -1 )
, iReferences( 0 )
{
};
//! Initializing constructor
/**
* \param iID Identifier
* \param sName Name of directivity
* \param sFilename Path to the data file
* \param sDesc Brief description of the directivity
* \param iReferences Usage reference count of directivity data
*/
inline CVADirectivityInfo( int iID,
const std::string& sName,
const std::string& sFilename,
const std::string& sDesc,
int iReferences )
{
this->iID = iID;
this->sName = sName;
this->sFilename = sFilename;
this->sDesc = sDesc;
this->iReferences = iReferences;
};
};
//! Data class containing information of loaded HRIR datasets
/**
* Head-related impulse respone (HRIR) data class
*/
class VABASE_API CVAHRIRInfo
{
public:
int iID; //!< ID
std::string sName; //!< Name (optional)
std::string sFilename; //!< Filename
std::string sDesc; //!< Description (e.g. resolution)
int iReferences; //!< Number of references
// TODO: More fields?
//! Default constructor
inline CVAHRIRInfo()
: iID( -1 )
, iReferences( 0 )
{
};
//! Initializing constructor
/**
* \param iID Identifier
* \param sName Name of HRIR
* \param sFilename Path to the data file
* \param sDesc Brief description of the HRIR
* \param iReferences Usage reference count of HRIR data
*/
inline CVAHRIRInfo( int iID,
const std::string& sName,
const std::string& sFilename,
const std::string& sDesc,
int iReferences )
{
this->iID = iID;
this->sName = sName;
this->sFilename = sFilename;
this->sDesc = sDesc;
this->iReferences = iReferences;
};
};
//! Data class containing information of loaded sounds
class VABASE_API CVASoundInfo
{
public:
int iID; //!< ID
std::string sName; //!< Name (optional)
std::string sFilename; //!< Filename
int iLength; //!< Length [Samples]
double dDuration; //!< Duration [s]
//! Default constructor
inline CVASoundInfo()
: iID( -1 )
, iLength( 0 )
, dDuration( 0 )
{
};
//! Initializing constructor
/**
* \param iID Identifier
* \param sName Name of sound
* \param sFilename Path to the data file
* \param iLength Length of track in samples
* \param dDuration Duration of track in seconds
*/
inline CVASoundInfo( int iID,
const std::string& sName,
const std::string& sFilename,
int iLength,
double dDuration )
{
this->iID = iID;
this->sName = sName;
this->sFilename = sFilename;
this->iLength = iLength;
this->dDuration = dDuration;
};
};
/* stienen fragt: ist das nicht berlagernd mit IVAAudioSignalSource? */
//! Data class for signal source information
class VABASE_API CVASignalSourceInfo
{
public:
std::string sID; //!< ID (i.e. "af1")
std::string sType; //!< Type (File|Sampler|Device input|Network stream)
std::string sName; //!< Name (i.e. "Trompet 1")
std::string sDesc; //!< Description
std::string sState; //!< State description
int iReferences; //!< Reference counter
//! Default constructor
inline CVASignalSourceInfo() : iReferences( 0 ) {};
//! Initializing constructor
/**
* \param sID Identifier string
* \param sType Type of signal source info (i.e. File|Sampler|Device input|Network stream)
* \param sName Name of signal source info
* \param sDesc Brief description of signal source info
* \param sState State description of signal source info
* \param iReference Usage reference counter
*/
inline CVASignalSourceInfo( const std::string& sID, const std::string& sType, const std::string& sName, const std::string& sDesc, const std::string& sState, int iReferences )
{
this->sID = sID;
this->sType = sType;
this->sName = sName;
this->sDesc = sDesc;
this->sState = sState;
this->iReferences = iReferences;
}
};
//! Data class containing information of a loaded scene
class VABASE_API CVASceneInfo
{
public:
//std::string sName; //!< Name (optional)
//std::string sFilename; //!< Scene filename (e.g. RAVEN project file)
// TODO: More fields, num polygons, num portals, num rooms, etc.
};
//! Data class describing states of audio streams
class VABASE_API CVAAudiostreamState
{
public:
int64_t i64Sample; //!< Index of the first sample since last clock reset
double dSysTime; //!< Associated system time in time [s] (internal core clock) of the first sample of the requested output block.
double dCoreTime; //!< Associated playback time in core clock time [s] (world time) of the first sample of the requested output block.
bool bTimeReset; //!< Flag that indicates a discontinous change of the playback time (world time)
//!< Synchronise commands on the stream
/** Flag that indicates, that a synchronized
* sequence of atomic commands is executed on
* elements of the stream. If this flag is true
* the source shall handle parameter
* changes and buffer them internally, but
* first apply them for the stream, if the
* flag is set to false again.
* Example: Synchronized start/stop of file sources
*/
bool bSyncMod;
//! Destructor
inline virtual ~CVAAudiostreamState() {};
};
//! Data class containing information of a sound source (acoustic actuator)
class VABASE_API CVASoundSourceInfo
{
public:
int iID; //!< ID
std::string sName; //!< Displayed name
VAVec3 vPos; //!< Position vector [m]
VAVec3 vVel; //!< Velocity vector [m/s]
VAVec3 vView, vUp; //!< View-/Up vector
VAOrientYPR oOrient; //!< Orientation (Yaw-Pitch-Roll)
double dVolume; //!< Volume
bool bMuted; //!< Muted?
int iSignalSourceID; //!< ID of assigned signal source (-1 => none)
int iDirectivityID; //!< ID of assigned directivity (-1 => none)
int iAuraMode; //!< Auralization mode (flags)
};
//! Data class containing information of a listener (acoustic receiver)
class VABASE_API CVAListenerInfo
{
public:
int iID; //!< ID
std::string sName; //!< Displayed name
VAVec3 vPos; //!< Position vector [m]
VAVec3 vVel; //!< Velocity vector [m/s]
VAVec3 vView, vUp; //!< View-/Up-vector
VAOrientYPR oOrient; //!< Orientation (Yaw-Pitch-Roll)
int iHRIRDatasetID; //!< ID of assigned HRIR dataset (-1 => none)
int iAuraMode; //!< Auralization mode (flags)
};
//! Data class containing information of a portal (acoustic portal)
class VABASE_API CVAPortalInfo
{
public:
int iID; //!< ID
std::string sName; //!< Displayed name (optional)
VAVec3 vPos; //!< Position vector [m]
VAVec3 vView, vUp; //!< View-/Up-vector
VAOrientYPR oOrient; //!< Orientation (Yaw-Pitch-Roll)
double dState; //!< Portal state [0..1] (0 => fully closed, 1 => fully opened)
};
#endif // IW_VABASE
......@@ -14,11 +14,7 @@
#ifndef IW_VABASE_DEFINITIONS
#define IW_VABASE_DEFINITIONS
#include <string>
#include <vector>
#include <cmath>
#if ( defined WIN32 ) && !( defined VABASE_STATIC )
#if ( defined WIN32 ) && !( defined VABASE_STATIC || defined VA_STATIC )
#ifdef VABASE_EXPORTS
#define VABASE_API __declspec( dllexport )
#define VABASE_IMPL_TEMPLATE
......@@ -63,450 +59,4 @@ typedef unsigned __int64 uint64_t;
#define NULL 0
#endif
//! 3-element Vector (double precision), in a geometrical context in meters (if not stated otherwise)
class VABASE_API VAVec3
{
public:
union
{
double comp[ 3 ];
struct
{
double x, y, z;
};
};