VABase.h 21.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 *  --------------------------------------------------------------------------------------------
 *
 *    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>

19 20
#include <VAStruct.h>

21 22 23 24
#include <string>
#include <vector>
#include <cmath>

25 26 27 28
static const double g_dSoundPower_94dB_SPL_1m = 1.0f; // [W] Sound power that results in 94 dB SPL re 20uPa @ 1m for spherical spreading
static const double g_dDefaultSoundPower_128dB_SPL_1m = 1.0f; // [W] Sound power that results in 124 dB SPL re 20uPa @ 1m for spherical spreading
static const double g_dDefaultSpeedOfSound = 344.0f; // [m/s]
static const double g_dDefaultStaticPressure = 101125; // [Pa]
29 30

//! 3-element Vector (double precision), in a geometrical context in meters (if not stated otherwise)
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
31 32 33
/**
  * Uses cartesian style, mostly used in OpenGL-rotation convention context
  */
34 35 36 37 38
class VABASE_API VAVec3
{
public:
	union
	{
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
39
		//!< Vector compontents in order x,y,z
40 41 42 43 44 45 46
		double comp[ 3 ];
		struct
		{
			double x, y, z;
		};
	};

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
47
	//! Default constructur, sets values to zero
48
	inline VAVec3() : x( 0 ), y( 0 ), z( 0 ) {};
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
49 50 51 52 53

	//! Copy constructor
	/**
	  * @param[in] v Copy values from this vector
	  */
54
	inline VAVec3( const VAVec3& v ) : x( v.x ), y( v.y ), z( v.z ) {};
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
55 56 57 58 59 60 61

	//! Init constructor
	/**
	  * @param[in] x X component
	  * @param[in] y Y component
	  * @param[in] z Z component
	  */
62
	inline VAVec3( const double x, const double y, const double z ) : x( x ), y( y ), z( z ) {};
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
63 64

	//! Destructor
65 66
	inline virtual ~VAVec3() {};

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
67 68 69 70
	//! Returns RMS lengs / L2 norm
	/*
	 * @return L2 norm length of cartesian cevrot
	 */
71 72 73 74 75
	inline virtual double Length() const
	{
		return sqrt( x*x + y*y + z*z );
	};

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
76 77 78 79 80 81
	//! Component setter
	/**
	  * @param[in] x_ X component
	  * @param[in] y_ Y component
	  * @param[in] z_ Z component
	  */
82
	inline virtual void Set( const double x_, const double y_, const double z_ )
83 84 85 86 87 88
	{
		x = x_;
		y = y_;
		z = z_;
	};

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
89 90 91 92 93 94
	//! Get cross product
	/**
	  * Performs cross product of internal components with parameter vector
	  * @param[in] vCrossProduct Cross product right-hand value
	  * @return Cross product vector
	  */
95 96 97 98 99 100 101 102 103
	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;
	};

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
104 105 106 107 108 109
	//! Get dot product
	/**
	  * Performs dot product of internal components with parameter vector
	  * @param[in] vDotProduct Dot product right-hand value
	  * @return Dot product scalar
	  */
110 111 112 113 114
	inline double Dot( const VAVec3& vDotProduct ) const
	{
		return ( x * vDotProduct.x + y * vDotProduct.y + z * vDotProduct.z );
	};

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
115 116 117 118
	//!< Normalizes internal components
	/**
	  * Will return in a L2 norm of 1.0
	  */
119 120 121 122 123 124 125
	inline void Norm()
	{
		const double l = Length();
		x /= l;
		y /= l;
		z /= l;
	};
126

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
127 128 129 130 131 132
	//!< 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".
	  */
133 134 135 136 137 138 139 140
	inline CVAStruct GetAsStruct() const
	{
		CVAStruct oVec;
		oVec[ "x" ] = x;
		oVec[ "y" ] = y;
		oVec[ "z" ] = z;
		return oVec;
	};
141 142
};

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
143 144 145 146 147 148 149
//!< Compare operator for vectors
/**
  * @param[in] a Left-hand vector
  * @param[in] b Right-hand vector
  *
  * @return True, if equal
  */
150 151 152 153 154
inline VABASE_API bool operator==( const VAVec3& a, const VAVec3& b )
{
	return ( ( a.x == b.x ) && ( a.y == b.y ) && ( a.z == b.z ) );
};

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
155 156 157 158 159 160 161
//!< Unequal operator for vectors
/**
  * @param[in] a Left-hand vector
  * @param[in] b Right-hand vector
  *
  * @return True, if unequal
  */
162 163 164 165 166
inline VABASE_API bool operator!=( const VAVec3& a, const VAVec3& b )
{
	return !( a == b );
};

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
167 168 169 170 171 172 173
//!< Add operator for vectors
/**
  * @param[in] oSummand1 Left-hand vector
  * @param[in] oSummand2 Right-hand vector
  *
  * @return Addition result
  */
174 175 176 177 178 179 180 181 182
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;
};

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
183 184 185 186 187 188 189
//!< Subtract operator for vectors
/**
  * @param[in] oSummand1 Left-hand vector
  * @param[in] oSummand2 Right-hand vector
  *
  * @return Subtraction result
  */
190 191 192 193 194 195 196 197 198
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;
};

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
199 200
//!< Scalar multiply operator for vectors
/**
201
  * @param[in] oVec Vector
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
202 203
  * @param[in] dScalar Scalar
  *
204
  * @return Scaled vector
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
205
  */
206
inline VABASE_API VAVec3 operator*( const VAVec3& oVec, const double dScalar )
207 208 209 210 211 212 213 214
{
	VAVec3 vScaledVector = oVec;
	vScaledVector.x *= dScalar;
	vScaledVector.y *= dScalar;
	vScaledVector.z *= dScalar;
	return vScaledVector;
};

215
//! Stream output operator for VAVec3
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
216 217 218 219 220 221 222 223
/**
  * Output format: "< x, y, z >"
  *
  * @param[in] os Outstream
  * @param[in] oVec Vector
  *
  * @return Outstream with vector output attached
  */
224 225
VABASE_API std::ostream& operator<<( std::ostream& os, const VAVec3& oVec );

226 227

//! 4-element Quaternion (double precision)
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
228 229 230
/**
  * Quaternion representation for solid rotation and orientation representation.
  */
231
class VABASE_API VAQuat
232 233
{
public:
234 235
	union
	{
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
236
		//!< Components in order x,y,z,w
237 238 239 240 241 242
		double comp[ 4 ];
		struct
		{
			double x, y, z, w;
		};
	};
243

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
244
	//! Default constructur, sets values to zero and w to 1.0
245
	inline VAQuat() : x( 0 ), y( 0 ), z( 0 ), w( 1.0f ) {};
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
246 247 248 249 250

	//! Copy constructor
	/**
	  * @param[in] v Will copy values from this quaternion
	  */
251
	inline VAQuat( const VAQuat& v ) : x( v.x ), y( v.y ), z( v.z ), w( v.w ) {};
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
252 253 254 255 256 257 258 259
	
	//! Init constructor
	/**
	  * @param[in] x X component
	  * @param[in] y Y component
	  * @param[in] z Z component
	  * @param[in] w W component
	  */
260
	inline VAQuat( const double x, const double y, const double z, const double w = 1.0f ) : x( x ), y( y ), z( z ), w( w ) {};
261

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
262 263 264 265 266 267 268 269 270 271
	//! 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
	  */
272
	inline virtual void Set( const double x_, const double y_, const double z_, const double w_ )
273
	{
274 275 276 277
		x = x_;
		y = y_;
		z = z_;
		w = w_;
278
	};
279
	
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
280 281 282 283 284 285
	//!< 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".
	  */
286 287 288 289 290 291 292 293 294
	inline CVAStruct GetAsStruct() const
	{
		CVAStruct oOrient;
		oOrient[ "x" ] = x;
		oOrient[ "y" ] = y;
		oOrient[ "z" ] = z;
		oOrient[ "w" ] = w;
		return oOrient;
	};
295 296
};

297
//! Stream output operator for Quaternion
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
298 299 300 301 302 303 304 305 306
/**
  * 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 );
307 308 309


//! Data class describing callable and registrable objects
310 311 312 313 314
/**
  * In VA, anything can be an object. If an object is registered,
  * it can also be listed and called over the VA interface. Then, it
  * is called a module, @sa CVAModuleInfo, GetModules
  */
315 316 317 318 319
struct VABASE_API CVAObjectInfo
{
	int iID;			//!< Object ID
	std::string sName;	//!< Object name
	std::string sDesc;	//!< Object description
320

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
321
	//! Default constructor will set identifier to -1
322 323 324
	inline CVAObjectInfo()
		: iID( -1 )
	{};
325 326 327 328
};


//! Pure data class describing modules of the core
329
/**
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
330
  * For module info getter.
331
  */
332 333 334 335
struct VABASE_API CVAModuleInfo
{
	std::string sName;	//!< Module name
	std::string sDesc;	//!< Module description
336
	CVAStruct oParams; //!< Parameters
337 338 339
};

//! Struct describing an audio renderer
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
340 341 342
/**
  * Rendering module info for getters.
  */
343 344 345 346 347 348
struct VABASE_API CVAAudioRendererInfo
{
	std::string sID;	//!< Renderer identifier
	std::string sClass; //!< Renderer class
	std::string sDescription; //!< Renderer description
	bool bEnabled; //!< Availability during runtime
349 350 351 352 353 354 355 356 357 358 359
	bool bOutputDetectorEnabled; //!< Indicates if output detector is enabled
	bool bOutputRecordingEnabled; //!< Indicates if output detector is enabled
	std::string sOutputRecordingFilePath; //!< Output recording file path
	CVAStruct oParams; //!< Additional parameters, may be changed during runtime

	//! Constructor with default init values
	inline CVAAudioRendererInfo()
		: bEnabled( false )
		, bOutputDetectorEnabled( false )
		, bOutputRecordingEnabled( false )
	{};
360 361 362
};

//! Struct describing an audio reproduction module
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
363 364 365
/**
  * Reproduction module info for getters.
  */
366 367 368 369 370 371
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
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
	bool bInputDetectorEnabled; //!< Indicates if output detector is enabled
	bool bInputRecordingEnabled; //!< Indicates if output detector is enabled
	std::string sInputRecordingFilePath; //!< Output recording file path
	bool bOutputDetectorEnabled; //!< Indicates if output detector is enabled
	bool bOutputRecordingEnabled; //!< Indicates if output detector is enabled
	std::string sOutputRecordingFilePath; //!< Output recording file path
	CVAStruct oParams; //!< Additional parameters, may be changed during runtime

	//! Constructor with default init values
	inline CVAAudioReproductionInfo()
		: bEnabled( false )
		, bInputDetectorEnabled( false )
		, bInputRecordingEnabled( false )
		, bOutputDetectorEnabled( false )
		, bOutputRecordingEnabled( false )
	{};
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
};

//! 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

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
406
	//! Constructor inits values
407
	inline CVAProgress()
408 409 410 411 412 413 414 415
		: iCurrentStep( 0 )
		, iMaxStep( 0 )
	{
	};
};


//! Data class describing integer literals within the core interface (reflexions)
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
416 417 418
/**
  * For literals getter.
  */
419 420 421 422 423 424 425 426 427 428 429
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.
	  *
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
430 431 432
	  * @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
433
	  */
434
	inline CVAIntLiteral( const std::string& sTheScope, const std::string& sTheName, const int iTheValue )
435 436 437 438 439
		: sScope( sTheScope )
		, sName( sTheName )
		, iValue( iTheValue )
	{
	};
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
440

441 442 443
private:
	//! No default construction
	inline CVAIntLiteral() {};
444 445
};

446 447 448 449 450 451 452 453 454 455 456
//! Data class containing information on directivities of sound sources and sound receivers
/**
  * This class describes a directivity: the sound changes depending on the directional component
  * of a sending or receiving entity. It may also include distance-dependent data.
  *
  * There are certain classes available, that will be recognized by most renderers. However,
  * you might want to use the PROTOTYPE class if you are testing new types that are not part
  * of the VA base interface.
  *
  * Special parameters are stores in the parameter struct.
  */
457 458 459
class VABASE_API CVADirectivityInfo
{
public:
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
460
	//! Directivity class definitions
461
	enum DirectivityClass
462
	{
463 464 465
		UNSPECIFIED = -1,
		PROTOTYPE = 0,
		IMPULSE_RESPONSE,
466 467
		TRANSFER_FUNCTION,
		ENERGETIC_BAND_SPECTRUM,
468 469
	};

470 471 472 473
	int iID;					//!< Identifier
	int iClass;					//!< Class identifier
	std::string sName;			//!< Name
	std::string sDesc;			//!< Verbose description
474
	int iReferences;			//!< Number of references
475
	CVAStruct oParams; 			//!< Special parameters (including file path etc.)
476

Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
477
	//! Default constructor inits some values
478
	inline CVADirectivityInfo()
479
		: iID( -1 )
480
		, iClass( UNSPECIFIED )
481 482 483 484 485 486
		, iReferences( 0 )
	{
	};

	//! Initializing constructor
	/**
487 488 489 490 491 492
	  * @param[in] iID Identifier
	  * @param[in] iClass Directivity class
	  * @param[in] sName Name of directivity
	  * @param[in] sDesc Brief description of the directivity
	  * @param[in] iReferences Usage reference count of directivity data
	  * @param[in] oParams Special parameters
493
	  */
494 495 496 497 498 499 500
	inline CVADirectivityInfo( const int iID, const int iClass, const std::string& sName, const std::string& sDesc, const int iReferences, const CVAStruct& oParams )
		: iID( iID )
		, iClass( iClass )
		, sName( sName )
		, sDesc( sDesc )
		, iReferences( iReferences )
		, oParams( oParams )
501 502 503 504 505 506
	{
	};
};


//! Data class for signal source information
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
507 508 509
/**
  * For info getter.
  */
510 511 512
class VABASE_API CVASignalSourceInfo
{
public:
513 514 515 516 517 518 519 520 521 522 523 524
	//! Signal source type
	enum Type
	{
		UNSPECIFIED = -1,
		FILE = 0,
		SAMPLER,
		DEVICE_INPUT,
		NETSTREAM,
		MACHINE,
		ENGINE
	};

525
	std::string	sID;			//!< ID (i.e. "af1")
526 527
	int	iType;					//!< Type
	std::string sName;			//!< Name (i.e. "Blue horn 2")
528 529 530 531 532
	std::string sDesc;			//!< Description
	std::string sState;			//!< State description
	int iReferences;			//!< Reference counter

	//! Default constructor
533 534 535 536 537
	inline CVASignalSourceInfo()
		: iReferences( 0 )
		, iType( UNSPECIFIED )
	{};

538
	// Signal source destructor
539
	virtual inline ~CVASignalSourceInfo() {};
540 541 542

	//! Initializing constructor
	/**
543
	  * @param[in] sID Identifier string
544
	  * @param[in] iType Type
545 546 547
	  * @param[in] sName Name of signal source info
	  * @param[in] sDesc Brief description of signal source info
	  * @param[in] sState State description of signal source info
548
	  * @param[in] iReferences Usage reference counter
549
	  */
550 551 552 553 554 555 556
	inline CVASignalSourceInfo( const std::string& sID, const int iType, const std::string& sName, const std::string& sDesc, const std::string& sState, const int iReferences )
		: sID( sID )
		, iType( iType )
		, sName( sName )
		, sDesc( sDesc )
		, sState( sState )
		, iReferences( iReferences )
557
	{
558
	};
559 560 561
};


562
//! Data class containing information of a virtual acoustic scene
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
563 564 565
/**
  * For scene getter.
  */
566 567 568
class VABASE_API CVASceneInfo
{
public:
569 570
	std::string sID;	//!< Scene identifier
	std::string sName;	//!< Scene name
571
	bool bEnabled; //!< Enabled flag
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
572

573 574
	CVAStruct oParams; //!< Scene parameters

575
	//! Scene info default constructor
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
576 577 578 579 580
	inline CVASceneInfo()
		: bEnabled( true )
	{
	};

581
	//! Scene info destructor
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
582 583 584
	inline virtual ~CVASceneInfo()
	{
	};
585 586 587 588
};


//! Data class describing states of audio streams
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
589 590 591
/**
  * For audio stream state getter.
  */
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617
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)
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
618 619 620
/**
  * For sound source info getter.
  */
621 622 623
class VABASE_API CVASoundSourceInfo
{
public:
624 625 626 627 628 629 630
	int iID;				//!< ID
	std::string sName;		//!< Displayed name
	double dSpoundPower;	//!< Sound power [W]
	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)
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
631 632 633 634 635

	VAVec3 v3Pos;			//!< Position vector of location between ears [m]
	VAVec3 v3View, v3Up;	//!< Orientation of ears/eyes (view and up vectors in OpenGL convention)
	VAQuat qOrient;			//!< Orientation of ears/eyes (quaternion)

636 637
	CVAStruct oParams;		//!< Special parameters

638
	//! Constructor for sound source info
639 640 641 642 643 644 645 646
	inline CVASoundSourceInfo()
		: iID( -1 )
		, bMuted( false )
		, dSpoundPower( g_dSoundPower_94dB_SPL_1m )
		, iSignalSourceID( -1 )
		, iDirectivityID( -1 )
		, iAuraMode( -1 )
	{};
647

648
	//! Destructor
649
	virtual inline ~CVASoundSourceInfo() {};
650 651 652
};


Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
653
//! Data class containing information of a sound receiver (acoustic receiver)
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
654 655 656
/**
  * For sound source info receiver.
  */
657
class VABASE_API CVASoundReceiverInfo
658 659
{
public:
660 661
	int iID;				//!< ID
	std::string sName;		//!< Displayed name
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
662 663 664 665 666
	int iDirectivityID;		//!< ID of assigned directivity (-1 => none)
	int iAuraMode;			//!< Auralization mode (flags)
	double dSensivitity;	//!< Sensitivity of receiving entity
	bool bEnabled; 			//!< Enabled/disable from processing

667
	VAVec3 v3Pos;			//!< Position vector of location between ears [m]
Dipl.-Ing. Jonas Stienen's avatar
Style  
Dipl.-Ing. Jonas Stienen committed
668
	VAVec3 v3View;//!< Orientation of ears/eyes (view and up vectors in OpenGL convention)
669
	VAVec3 v3Up;		//!< Orientation of ears/eyes (view and up vectors in OpenGL convention)
670
	VAQuat qOrient;			//!< Orientation of ears/eyes (quaternion)
671
	VAQuat qHeadAboveTorsoOrientation;	//!< Orientation of head above torso relative to ears
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
672 673

	VAVec3 v3RealWorldPos;					//!< Position vector of location between ears [m] in real world (from tracking)
674 675
	VAVec3 v3RealWorldView; //!< Orientation of ears/eyes (view and up vectors in OpenGL convention) in real world (from tracking)
	VAVec3 v3RealWorldUp;	//!< Orientation of ears/eyes (view and up vectors in OpenGL convention) in real world (from tracking)
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
676
	VAQuat qRealWorldOrient;				//!< Orientation of ears/eyes (quaternion) in real world (from tracking)
677
	VAQuat qRealWorldHeadAboveTorsoOrientation;	//!< Orientation of head above torso in real world (from tracking) relative to ears
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
678 679

	CVAStruct oParams; 	//!< Special parameters
680

681
	//! Constructor for sound receiver info
682 683 684 685 686
	inline CVASoundReceiverInfo()
		: iID( -1 )
		, iDirectivityID( -1 )
		, iAuraMode( -1 )
		, dSensivitity( 1.0f )
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
687
		, bEnabled( true )
688
	{};
689

690
	//! Destructor
691
	virtual inline ~CVASoundReceiverInfo() {};
692 693 694
};


695 696
//! Data class containing information of a sound portal (acoustic portal)
class VABASE_API CVASoundPortalInfo
697 698
{
public:
699 700
	int iID;			//!< ID
	std::string sName;	//!< Displayed name (optional)
701
	bool bEnabled; //!< Enabled flag
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
702

703
	int iMaterialID; //!< Material ID with transmission data
704 705 706
	int iNextPortalID; //!< Next sound portal identifier, if existing
	int iSoundReceiverID; //!< Source receiver identifier, if existing
	int iSoundSourceID; //!< Source sound identifier, if existing
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
707

708 709
	VAVec3 v3Pos;		//!< Position vector [m]
	VAVec3 v3View, v3Up;	//!< View-/Up-vector
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
710 711
	VAQuat qOrient;		//!< Orientation (quaternion)

712 713
	CVAStruct oParams; 	//!< Special parameters

714
	//! Default constructor for sound portal
715
	inline CVASoundPortalInfo()
716
		: iID( -1 )
717 718 719 720
		, iNextPortalID( -1 )
		, iSoundSourceID( -1 )
		, iSoundReceiverID( -1 )
		, iMaterialID( -1 )
721
	{};
722

723
	//! Destructor
724
	virtual inline ~CVASoundPortalInfo() {};
725 726 727
};


728 729 730 731 732 733
//! Data class containing information of an acoustic material
/**
  * This data class holds information on acoustic materials such as
  * absorption, scattering and transmission coefficients. Data has
  * a type, a data vector for floating point values and a set of parametres.
  */
734 735 736
class VABASE_API CVAAcousticMaterial
{
public:
737
	//! Material base frequency resolution
738 739 740 741 742 743 744 745
	enum Type
	{
		UNSPECIFIED = -1,
		PROTOTYPE = 0,
		ENERGETIC_BAND_FILTER_WHOLE_OCTAVE,
		ENERGETIC_BAND_FILTER_THIRD_OCTAVE,
	};

746 747 748 749 750 751 752
	int iID;			//!< Material identifier
	int iType; //!< Type, see #Type
	std::string sName; //!< Verbatim name
	CVAStruct oParams; //!< Parameters for prototyping
	std::vector< float > vfAbsorptionValues; //!< Absorption values
	std::vector< float > vfScatteringValues; //!< Scattering values
	std::vector< float > vfTransmissionValues; //!< Transmission values
753

754
	//! Instantiate empty material
755 756 757
	inline CVAAcousticMaterial()
		: iID( -1 )
	{};
758 759 760

	//! Destructor
	virtual inline ~CVAAcousticMaterial() {};
761 762 763 764 765 766 767 768 769 770 771 772 773 774
};



//! Geometry mesh class
/**
  * This is only intended to be used as an exchange
  * format of the simplest mesh structure. Renderers
  * use more elaborate representations.
  *
  * It can be used for rudimentary rooms and dynamic geometry objects.
  */
class VABASE_API CVAGeometryMesh
{
775
public:
776
	//! Vertex representation
777 778 779
	class CVAVertex
	{
	public:
780 781 782 783
		int iID; //!< Vertex identifier
		VAVec3 v3Point; //!< Vertext point / position

		//! Constructor initializing defaults
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
784
		inline CVAVertex() : iID( -1 ) {};
785 786
	};

787
	//! Face representation
788 789
	class CVAFace
	{
790
	public:
791
		int iID; //!< Face identifier
792
		int iMaterialID; //!< Assigned material
793 794 795
		std::vector< int > viVertexList; //!< Face vertices
		
		//! Constructor initializing defaults
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
796
		inline CVAFace() : iID( -1 ), iMaterialID( -1 ) {};
797 798
	};

799 800
	int iID; //!< Geometry mesh identifier
	bool bEnabled; //!< Enabled flag
801 802 803
	std::vector< CVAVertex > voVertices; //!< List of available vertices
	std::vector< CVAFace > voFaces; //!< List of faces defined by vertices
	CVAStruct oParams; //!< Additional parameters
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
804

805
	//! Constructor initializing members
Dipl.-Ing. Jonas Stienen's avatar
Dipl.-Ing. Jonas Stienen committed
806 807 808 809
	inline CVAGeometryMesh()
		: iID( -1 )
		, bEnabled( true )
	{};
810 811
};

812
#endif // IW_VABASE