Commit cc8a491a authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen

Merging develop branch

parents f7ff164a fd7766fb
cmake_minimum_required( VERSION 2.8 )
project( VABase )
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
vista_use_package( VistaCoreLibs REQUIRED COMPONENTS VistaInterProcComm FIND_DEPENDENCIES )
# Including the source files of all source subfolders recursively
include( "include/_SourceFiles.cmake" )
include( "src/_SourceFiles.cmake" )
# ViSTA CMake build environment
if( EXISTS $ENV{VISTA_CMAKE_COMMON} )
# VistaCMakeCommon is available, use the ViSTA build environment
list( APPEND CMAKE_MODULE_PATH "$ENV{VISTA_CMAKE_COMMON}" )
include( VistaCommon )
else( )
message( "Could not find VistaCMakeCommon. Only VABase can be build without the ViSTA CMake build environment. See http://www.virtualacoustics.org for help." )
endif( )
include_directories( "include" )
# preprocessor
if( BUILD_SHARED_LIBS )
add_definitions( -DVABASE_EXPORT )
else( )
add_definitions( -DVABASE_STATIC )
endif( )
if( ITA_VISTA_BUILD_STATIC )
add_definitions( -DVISTAINTERPROCCOMM_STATIC -DVISTA_STATIC )
endif( )
if( NOT WIN32 )
add_definitions( -std=gnu++11 )
endif( )
# headers and source files
set( VABase_Headers
"include/VA.h"
"include/VAAudioSignalSource.h"
"include/VABase.h"
"include/VABaseDefinitions.h"
"include/VAEvent.h"
"include/VAEventHandlerGlobalLock.h"
"include/VAException.h"
"include/VAInterface.h"
"include/VAObject.h"
"include/VAObjectRegistry.h"
"include/VASamples.h"
"include/VAStruct.h"
"include/VAVersion.h"
)
set( VABase_Src
"src/VABase.cpp"
"src/VAEvent.cpp"
"src/VAEventHandlerGlobalLock.cpp"
"src/VAException.cpp"
"src/VAInterface.cpp"
"src/VAObject.cpp"
"src/VAObjectRegistry.cpp"
"src/VASamples.cpp"
"src/VAStruct.cpp"
"src/VAVersion.cpp"
)
# linker
add_library( VABase "${ProjectSources}" )
target_link_libraries( VABase ${VISTA_USE_PACKAGE_LIBRARIES} )
add_library( VABase ${VABase_Headers} ${VABase_Src} )
target_link_libraries( VABase )
# configure
......@@ -47,4 +76,4 @@ set_property( TARGET VABase PROPERTY FOLDER "VA" )
if( ITA_VA_WITH_TESTS )
set( VABASE_COMMON_BUILD TRUE )
add_subdirectory( "${CMAKE_CURRENT_SOURCE_DIR}/tests" )
endif()
endif( )
## VABase
VABase provides a (partly abstract) C++ interface for the Virtual Acoustics framework called [VA](http://git.rwth-aachen.de/ita/VA).
It is implemented by a core ([VACore](http://git.rwth-aachen.de/ita/VACore)) that creates virtual acoustic environments for real-time applications.
To use VA in other applications, you can use this C++ interface directly or via a network protocol where you can connect with a VA server (for example [VAServer](http://git.rwth-aachen.de/ita/VAServer) or [VAGUI/todo](http://git.rwth-aachen.de/ita/VA)) and remotely control it.
There are also binding interfaces for oter languages, like Matlab ([VAMatlab](http://git.rwth-aachen.de/ita/VAVAMatlab)), Lua ([VALua](http://git.rwth-aachen.de/ita/VALua)) and C# ([VACS](http://git.rwth-aachen.de/ita/VACS)).
For the [ViSTA framework](https://devhub.vr.rwth-aachen.de/VR-Group/ViSTA), the [VistaMedia/Audio](http://devhub.vr.rwth-aachen.de/VR-Group/VistaMedia) add-on has an implementation that can run a VA core or control a remote VA server.
VABase provides a (mostly abstract) C++ interface for the Virtual Acoustics framework called [VA](http://git.rwth-aachen.de/ita/VA).
It is implemented by a core called [VACore](http://git.rwth-aachen.de/ita/VACore) that creates virtual acoustic environments for real-time applications.
To use VA, you can include this C++ interface directly with the VACore libraries, or via a network protocol called [VANet](http://git.rwth-aachen.de/ita/VANet). With VANet you can connect with a VA server (for example [VAServer](http://git.rwth-aachen.de/ita/VAServer) or [Redstart](http://git.rwth-aachen.de/ita/VA/Redstart)) and remotely control it. VANet is lightweight and fast and is usually the better choice.
There are also binding interfaces for scripting languages, like Matlab with [VAMatlab](http://git.rwth-aachen.de/ita/VAMatlab), Python in [VAPython](http://git.rwth-aachen.de/ita/VAPython), Lua in [VALua](http://git.rwth-aachen.de/ita/VALua) and C# in [VACS](http://git.rwth-aachen.de/ita/VACS).
For the [ViSTA framework](https://devhub.vr.rwth-aachen.de/VR-Group/ViSTA), the [VistaMedia/Audio](http://devhub.vr.rwth-aachen.de/VR-Group/VistaMedia) add-on has an implementation that both can run an internal VA core or control a remote VA server.
### License
......@@ -26,4 +27,23 @@ limitations under the License.
### Quick build guide
It is recommended to clone and follow the build guide of the parent project [VA](https://git.rwth-aachen.de/ita/VA), which includes this project as a submodule.
#### Preface
It is recommended to clone and follow the build guide of the parent project [VA](https://git.rwth-aachen.de/ita/VA), which includes this project as a submodule. You can find comprehensive help on [virtualacoustics.org](http://www.virtualacoustics.org).
#### Building VABase
You can build VABase using a C++11 compiler. Use CMake to generate project files that help building it, for instance Makefiles or Visual Studio solutions. VABase has no dependencies.
If you want to include VA into your application, you either have to link against VANet or VACore (see above).
#### Extending the VA interface
If you want to extend the abstract VA interface, this move will effect VA deeply. Only consider an extension of the interface if you are sure that this new features are absolutely necessary and will improve the usage of VA significantly.
Interface extension workflow:
1. Add the virtual methods to IVAInterface
2. Add classes to VABase, if necessary
3. Implement the methods in VANet by using similar methods as template. Make sure to use a new net message identifier. Add message serializer/deserializer if you introduce a new data class. Do not make mistakes here, the debugging of VANet problems are painful.
4. Add the methods to VACore. Now you can already run VA as a server.
5. Don't forget to add your new methods to the bindings. Here, at least provide the new features for VAPython and VAMatlab as they are heavily used. Again, use similar methods as templates and be careful, because debugging is cumbersome.
/*
* --------------------------------------------------------------------------------------------
*
* 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-2018
* VVVVVV AAA Institute of Technical Acoustics (ITA)
* VVVV AAA RWTH Aachen University
*
* --------------------------------------------------------------------------------------------
*/
/*!
@mainpage
@section vabase_intro_sec Introduction
The Virtual Acoustics project is free, open source real-time auralization framework. It is distributed under the terms of the Apache License Version 2.0.
The official website can be found at http://www.virtualacoustics.org.
@section vabase_sec VABase
VABase provides basic classes and a sophisticated interface calls #IVAInterface that is used throughout the entire
@section vabase_license_sec License
Copyright 2015-2018 Institute of Technical Acoustics (ITA), RWTH Aachen University
Licensed under the Apache License, Version 2.0 (the "License");
you may not use the VA software package except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You should also have received a copy of the License with the VA software package.
@section vabase_getting_started_sec Getting started
If you are a C++ developer and want to investigate the interface and integrate VA into your application, the first contact point should be the VABase interface represented by the #IVAInterface class.
If you are planning to create a binding for any other programming and/or scripting language, also have a look at VANet and the #IVANetClient class.
If you want to host a VA server or want to extend the core of VA by new rendering and reproduction modules, see #VACore.
*/
#ifndef IW_VA
#define IW_VA
#include "VAAudioSignalSource.h"
#include "VABase.h"
#include "VAEvent.h"
#include "VAEventHandlerGlobalLock.h"
#include "VAException.h"
#include "VAInterface.h"
#include "VAObject.h"
#include "VAObjectRegistry.h"
#include "VASamples.h"
#include "VAStruct.h"
#include "VAVersion.h"
#endif // IW_VA
......@@ -4,7 +4,7 @@
* 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
* VVV VVV AAA Copyright 2015-2018
* VVVVVV AAA Institute of Technical Acoustics (ITA)
* VVVV AAA RWTH Aachen University
*
......@@ -21,7 +21,7 @@
#include <string>
// Forward declarations
class IVACore;
class IVAInterface;
//! Interface class for audio signal sources
/**
......@@ -32,7 +32,7 @@ class IVACore;
*
* A data source is always monaural (single channel)
* and can only be connected to a single instance of a
* #IVACore during runtime.
* #IVAInterface during runtime.
*/
class IVAAudioSignalSource
{
......@@ -49,7 +49,7 @@ public:
VA_SS_NETSTREAM, //!< Sound source is a network stream receiver socket
VA_SS_ENGINE, //!< Sound source is an engine
VA_SS_MACHINE, //!< Sound source is a machine
VA_SS_TEXT_TO_SPEECH,
VA_SS_TEXT_TO_SPEECH, //!< Text-to-speech signal source
};
//! Destructor.
......@@ -57,13 +57,13 @@ public:
//! Type ID getter
/**
* @return Returns the ID (one out of #SoundSourceTypes)
* @return Returns the ID (one out of AudioSignalSourceType)
*/
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 AudioSignalSourceType as a human readable string)
*/
virtual std::string GetTypeString() const = 0;
......@@ -87,33 +87,32 @@ public:
//! Associated core getter
/**
* Returns the pointer to the associated core (#IVACore) that is
* Returns the pointer to the associated core (#IVAInterface) that is
* registered with the sound source. Will return NULL if the source
* has not been associated to a core yet.
* 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 #IVAInterface, NULL if non present
*/
virtual IVACore* GetAssociatedCore() const = 0;
virtual IVAInterface* GetAssociatedCore() const = 0;
//! Stream block getter
/**
* Returns the data pointer to the next audio block of the sound source.
*
* @param[in] oStreamState Information on stream state
* @param[in] pStreamInfo Information on stream state
*
* @return Pointer to the audio data array containing data for next block (NULL if no data available)
*
* @note This method is called by the core to fetch data. If the core
* receives a NULL pointer it will be interpreted as silence.
* @note This method is called by the core to fetch data. If the core receives a NULL pointer it will be interpreted as silence.
*/
virtual const float* GetStreamBlock( const CVAAudiostreamState* pStreamInfo ) = 0;
//! Parameter getter interaction hook
/**
* @param[in] oIn Parameter request set
* @param[out] Parameters
* @return Parameters
*/
virtual CVAStruct GetParameters( const CVAStruct& oIn ) const = 0;
......@@ -133,7 +132,7 @@ private:
*
* @sa CVAAudioSignalSourceManager
*/
virtual void HandleRegistration( IVACore* pParentCore ) = 0;
virtual void HandleRegistration( IVAInterface* pParentCore ) = 0;
//! Unregister sound source at a core instance
/**
......@@ -144,7 +143,7 @@ private:
*
* @sa CVAAudioSignalSourceManager
*/
virtual void HandleUnregistration( IVACore* pParentCore ) = 0;
virtual void HandleUnregistration( IVAInterface* pParentCore ) = 0;
friend class CVAAudioSignalSourceManager;
};
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
* 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
* VVV VVV AAA Copyright 2015-2018
* VVVVVV AAA Institute of Technical Acoustics (ITA)
* VVVV AAA RWTH Aachen University
*
......
This diff is collapsed.
/*
* --------------------------------------------------------------------------------------------
*
* 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_CORE_EVENT
#define IW_VABASE_CORE_EVENT
#include <VABaseDefinitions.h>
#include <VABase.h>
#include <string>
#include <vector>
// Forwards
class IVACore;
// Helper macro for 64-bit bitmasks
#define VA_BIT64( i ) ( ( ( const uint64_t ) 1) << i )
//! Data class encapsulating events of a VACore
class VABASE_API CVACoreEvent
{
public:
static const uint64_t VA_COREEVENT_NOTHING = 0;
static const uint64_t VA_COREEVENT_INITIALIZED = VA_BIT64( 1 );
static const uint64_t VA_COREEVENT_FINALIZED = VA_BIT64( 2 );
static const uint64_t VA_COREEVENT_PROGRESS_UPDATE = VA_BIT64( 3 );
static const uint64_t VA_COREEVENT_DIRECTIVITY_LOADED = VA_BIT64( 4 );
static const uint64_t VA_COREEVENT_DIRECTIVITY_FREED = VA_BIT64( 5 );
static const uint64_t VA_COREEVENT_SIGNALSOURCE_CREATED = VA_BIT64( 6 );
static const uint64_t VA_COREEVENT_SIGNALSOURCE_DELETED = VA_BIT64( 7 );
static const uint64_t VA_COREEVENT_SIGNALSOURCE_REGISTERED = VA_BIT64( 8 );
static const uint64_t VA_COREEVENT_SIGNALSOURCE_UNREGISTERED = VA_BIT64( 9 );
static const uint64_t VA_COREEVENT_SIGNALSOURCE_STATE_CHANGED = VA_BIT64( 10 );
static const uint64_t VA_COREEVENT_SAMPLE_LOADED = VA_BIT64( 11 );
static const uint64_t VA_COREEVENT_SAMPLE_FREED = VA_BIT64( 12 );
static const uint64_t VA_COREEVENT_SOUNDSOURCE_CREATED = VA_BIT64( 13 );
static const uint64_t VA_COREEVENT_SOUNDSOURCE_DELETED = VA_BIT64( 14 );
static const uint64_t VA_COREEVENT_SOUNDSOURCE_CHANGED_NAME = VA_BIT64( 15 );
static const uint64_t VA_COREEVENT_SOUNDSOURCE_CHANGED_SIGNALSOURCE = VA_BIT64( 16 );
static const uint64_t VA_COREEVENT_SOUNDSOURCE_CHANGED_AURALIZATIONMODE = VA_BIT64( 17 );
static const uint64_t VA_COREEVENT_SOUNDSOURCE_CHANGED_VOLUME = VA_BIT64( 18 );
static const uint64_t VA_COREEVENT_SOUNDSOURCE_CHANGED_MUTING = VA_BIT64( 19 );
static const uint64_t VA_COREEVENT_SOUNDSOURCE_CHANGED_POSITIONORIENTATION = VA_BIT64( 20 );
static const uint64_t VA_COREEVENT_LISTENER_CREATED = VA_BIT64( 21 );
static const uint64_t VA_COREEVENT_LISTENER_DELETED = VA_BIT64( 22 );
static const uint64_t VA_COREEVENT_LISTENER_CHANGED_NAME = VA_BIT64( 23 );
static const uint64_t VA_COREEVENT_LISTENER_CHANGED_AURALIZATIONMODE = VA_BIT64( 24 );
static const uint64_t VA_COREEVENT_LISTENER_CHANGED_POSITIONORIENTATION = VA_BIT64( 25 );
static const uint64_t VA_COREEVENT_PORTAL_CHANGED_NAME = VA_BIT64( 26 );
static const uint64_t VA_COREEVENT_PORTAL_CHANGED_STATE = VA_BIT64( 27 );
static const uint64_t VA_COREEVENT_ACTIVE_LISTENER_CHANGED = VA_BIT64( 28 );
static const uint64_t VA_COREEVENT_INPUTGAIN_CHANGED = VA_BIT64( 29 );
static const uint64_t VA_COREEVENT_INPUTMUTING_CHANGED = VA_BIT64( 30 );
static const uint64_t VA_COREEVENT_OUTPUTGAIN_CHANGED = VA_BIT64( 31 );
static const uint64_t VA_COREEVENT_OUTPUTMUTING_CHANGED = VA_BIT64( 32 );
static const uint64_t VA_COREEVENT_GLOBALAURALIZATIONMODE_CHANGED = VA_BIT64( 33 );
static const uint64_t VA_COREEVENT_HRIR_LOADED = VA_BIT64( 34 );
static const uint64_t VA_COREEVENT_HRIR_FREED = VA_BIT64( 35 );
static const uint64_t VA_COREEVENT_LISTENER_CHANGED_HRIR = VA_BIT64( 36 );
static const uint64_t VA_COREEVENT_MEASURES_UPDATE = VA_BIT64( 37 );
static const uint64_t VA_COREEVENT_RESET = VA_BIT64( 38 ); // DO NOT USE AS A KOMBINED EVENT TYPE
static const uint64_t VA_COREEVENT_SOUNDSOURCE_CHANGED_DIRECTIVITY = VA_BIT64( 39 );
// Nachricht das ein Core gelscht wird.
static const uint64_t VA_COREEVENT_DESTROY = VA_BIT64( 40 );
// Selector mask for signal source related events
static const uint64_t VA_COREEVENT_SIGNALSOURCE_EVENT = VA_COREEVENT_SIGNALSOURCE_CREATED |
VA_COREEVENT_SIGNALSOURCE_DELETED |
VA_COREEVENT_SIGNALSOURCE_REGISTERED |
VA_COREEVENT_SIGNALSOURCE_UNREGISTERED |
VA_COREEVENT_SIGNALSOURCE_STATE_CHANGED |
VA_COREEVENT_SOUNDSOURCE_CHANGED_SIGNALSOURCE;
// Selector mask for sound source related events
static const uint64_t VA_COREEVENT_SOUNDSOURCE_EVENT = VA_COREEVENT_SOUNDSOURCE_CREATED |
VA_COREEVENT_SOUNDSOURCE_DELETED |
VA_COREEVENT_SOUNDSOURCE_CHANGED_NAME |
VA_COREEVENT_SOUNDSOURCE_CHANGED_SIGNALSOURCE |
VA_COREEVENT_SOUNDSOURCE_CHANGED_AURALIZATIONMODE |
VA_COREEVENT_SOUNDSOURCE_CHANGED_VOLUME |
VA_COREEVENT_SOUNDSOURCE_CHANGED_MUTING |
VA_COREEVENT_SOUNDSOURCE_CHANGED_POSITIONORIENTATION |
VA_COREEVENT_SOUNDSOURCE_CHANGED_DIRECTIVITY;
// Selector mask for listener related events
static const uint64_t VA_COREEVENT_LISTENER_EVENT = VA_COREEVENT_LISTENER_CREATED |
VA_COREEVENT_LISTENER_DELETED |
VA_COREEVENT_LISTENER_CHANGED_NAME |
VA_COREEVENT_LISTENER_CHANGED_AURALIZATIONMODE |
VA_COREEVENT_LISTENER_CHANGED_HRIR |
VA_COREEVENT_LISTENER_CHANGED_POSITIONORIENTATION;
// Selector mask for portal related events
static const uint64_t VA_COREEVENT_PORTAL_EVENT = VA_COREEVENT_PORTAL_CHANGED_NAME |
VA_COREEVENT_PORTAL_CHANGED_STATE;
// Selector mask for sound source modification event
static const uint64_t VA_COREEVENT_SOUNDSOURCE_MODIFICATION = VA_COREEVENT_SOUNDSOURCE_CHANGED_NAME |
VA_COREEVENT_SOUNDSOURCE_CHANGED_SIGNALSOURCE |
VA_COREEVENT_SOUNDSOURCE_CHANGED_AURALIZATIONMODE |
VA_COREEVENT_SOUNDSOURCE_CHANGED_VOLUME |
VA_COREEVENT_SOUNDSOURCE_CHANGED_MUTING |
VA_COREEVENT_SOUNDSOURCE_CHANGED_POSITIONORIENTATION |
VA_COREEVENT_SOUNDSOURCE_CHANGED_DIRECTIVITY;
// Selector mask for listener modification event
static const uint64_t VA_COREEVENT_LISTENER_MODIFICATION = VA_COREEVENT_LISTENER_CHANGED_NAME |
VA_COREEVENT_LISTENER_CHANGED_AURALIZATIONMODE |
VA_COREEVENT_LISTENER_CHANGED_HRIR |
VA_COREEVENT_LISTENER_CHANGED_POSITIONORIENTATION;
IVACore* pSender;
int iEventID;
uint64_t iEventType;
int iObjectID; // Integer-ID (Standard)
std::string sObjectID; // String-ID (z.B. fr Signalquellen)
int iParamID;
std::string sParam;
int iIndex;
int iAuralizationMode;
double dVolume;
double dState;
bool bMuted;
std::string sName;
std::string sFilename;
// All angles in degrees!
VAVec3 vPos, vView, vUp, vVelocity;
VAOrientYPR oOrientation;
std::vector< float > vfInputPeaks; // Peak values of the input channels [factor]
std::vector< float > vfOutputPeaks; // Peak values of the output channels [factor]
float fSysLoad, fDSPLoad; // System and DSP load [percent]
double dCoreClock; // Current value of the core clock [s]
// Progress data
CVAProgress oProgress;
// --= Methoden =--
inline CVACoreEvent()
: pSender( NULL )
, iEventID( 0 )
, iEventType( 0 )
, iObjectID( -1 )
, iParamID( -1 )
, iIndex( -1 )
, iAuralizationMode( 0 )
, dVolume( 0 )
, dState( 0 )
, bMuted( false )
{};
inline virtual ~CVACoreEvent() {};
virtual std::string ToString() const;
};
/**
* Diese rein abstrakte Klasse definiert eine Schnittstelle
* zur Behandlung von Ereignissen des VA-Kerns. Beispielsweise
* wird diese vom GUI implementiert, um sich ber nderungen
* der Szene informieren zu lassen.
*/
class VABASE_API IVACoreEventHandler
{
public:
inline virtual ~IVACoreEventHandler() {};
virtual void HandleVACoreEvent( const CVACoreEvent* pEvent ) = 0;
};
#endif // IW_VABASE_CORE_EVENT
/*
* --------------------------------------------------------------------------------------------
*
* 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-2018
* VVVVVV AAA Institute of Technical Acoustics (ITA)
* VVVV AAA RWTH Aachen University
*
* --------------------------------------------------------------------------------------------
*/
#ifndef IW_VABASE_EVENT
#define IW_VABASE_EVENT
#include <VABaseDefinitions.h>
#include <VABase.h>
#include <string>
#include <vector>
// Forwards
class IVAInterface;
// Helper macro for 64-bit bitmasks
#define VA_BIT64( i ) ( ( ( const uint64_t ) 1 ) << i )
//! Data class encapsulating events of a VA
/**
* Events are emitted by the core and propagated to all atached event handlers.
* It is up to the event handlers to filter the corresponding types and react upon
* the data provided by the event. Therefore, the event data is not fixed but is
* related to the event type. Many of the provided slots are unused for simple
* events (like a gain change of the core).
*
* Use this events to synchronize your application if you are not controlling the
* core and can not intercept method calls. This way, you still receive information
* on updates e.g. from real world sound receiver head rotation and so on.
*
*/
class VABASE_API CVAEvent
{
public:
static const uint64_t NOTHING = 0;
static const uint64_t INITIALIZED = VA_BIT64( 1 );
static const uint64_t FINALIZED = VA_BIT64( 2 );
static const uint64_t PROGRESS_UPDATE = VA_BIT64( 3 );
static const uint64_t DIRECTIVITY_LOADED = VA_BIT64( 4 );
static const uint64_t DIRECTIVITY_DELETED = VA_BIT64( 5 );
static const uint64_t SIGNALSOURCE_CREATED = VA_BIT64( 6 );
static const uint64_t SIGNALSOURCE_DELETED = VA_BIT64( 7 );
static const uint64_t SIGNALSOURCE_REGISTERED = VA_BIT64( 8 );
static const uint64_t SIGNALSOURCE_UNREGISTERED = VA_BIT64( 9 );
static const uint64_t SIGNALSOURCE_STATE_CHANGED = VA_BIT64( 10 );
static const uint64_t SAMPLE_LOADED = VA_BIT64( 11 );
static const uint64_t SAMPLE_FREED = VA_BIT64( 12 );
static const uint64_t SOUND_SOURCE_CREATED = VA_BIT64( 13 );
static const uint64_t SOUND_SOURCE_DELETED = VA_BIT64( 14 );
static const uint64_t SOUND_SOURCE_CHANGED_NAME = VA_BIT64( 15 );
static const uint64_t SOUND_SOURCE_CHANGED_SIGNALSOURCE = VA_BIT64( 16 );
static const uint64_t SOUND_SOURCE_CHANGED_AURALIZATIONMODE = VA_BIT64( 17 );
static const uint64_t SOUND_SOURCE_CHANGED_SOUND_POWER = VA_BIT64( 18 );
static const uint64_t SOUND_SOURCE_CHANGED_MUTING = VA_BIT64( 19 );
static const uint64_t SOUND_SOURCE_CHANGED_POSE = VA_BIT64( 20 );
static const uint64_t SOUND_RECEIVER_CREATED = VA_BIT64( 21 );
static const uint64_t SOUND_RECEIVER_DELETED = VA_BIT64( 22 );
static const uint64_t SOUND_RECEIVER_CHANGED_NAME = VA_BIT64( 23 );
static const uint64_t SOUND_RECEIVER_CHANGED_AURALIZATIONMODE = VA_BIT64( 24 );
static const uint64_t SOUND_RECEIVER_CHANGED_POSE = VA_BIT64( 25 );
static const uint64_t SOUND_PORTAL_CHANGED_NAME = VA_BIT64( 26 );
static const uint64_t SOUND_PORTAL_CHANGED_POSE = VA_BIT64( 27 );
static const uint64_t SOUND_PORTAL_CHANGED_PARAMETER = VA_BIT64( 41 );
static const uint64_t ACTIVE_SOUND_RECEIVER_CHANGED = VA_BIT64( 28 );
static const uint64_t INPUT_GAIN_CHANGED = VA_BIT64( 29 );
static const uint64_t INPUT_MUTING_CHANGED = VA_BIT64( 30 );
static const uint64_t OUTPUT_GAIN_CHANGED = VA_BIT64( 31 );
static const uint64_t OUTPUT_MUTING_CHANGED = VA_BIT64( 32 );
static const uint64_t GLOBAL_AURALIZATION_MODE_CHANGED = VA_BIT64( 33 );
static const uint64_t UNSPECIFIED_34 = VA_BIT64( 34 );
static const uint64_t UNSPECIFIED_35 = VA_BIT64( 35 );
static const uint64_t SOUND_RECEIVER_CHANGED_DIRECTIVITY = VA_BIT64( 36 );
static const uint64_t MEASURES_UPDATE = VA_BIT64( 37 );
static const uint64_t RESET = VA_BIT64( 38 );
static const uint64_t SOUND_SOURCE_CHANGED_DIRECTIVITY = VA_BIT64( 39 );
static const uint64_t DESTROY = VA_BIT64( 40 );
static const uint64_t SOUND_SOURCE_REAL_WORLD_POSE_CHANGED = VA_BIT64( 41 );
static const uint64_t SOUND_RECEIVER_REAL_WORLD_POSE_CHANGED = VA_BIT64( 42 );
// Next free slot: 43
//!< Selector mask for signal source related events
static const uint64_t SIGNALSOURCE_EVENT = SIGNALSOURCE_CREATED |
SIGNALSOURCE_DELETED |
SIGNALSOURCE_REGISTERED |
SIGNALSOURCE_UNREGISTERED |
SIGNALSOURCE_STATE_CHANGED |
SOUND_SOURCE_CHANGED_SIGNALSOURCE;
//!< Selector mask for sound source related events
static const uint64_t SOUNDSOURCE_EVENT = SOUND_SOURCE_CREATED |
SOUND_SOURCE_DELETED |
SOUND_SOURCE_CHANGED_NAME |
SOUND_SOURCE_CHANGED_SIGNALSOURCE |
SOUND_SOURCE_CHANGED_AURALIZATIONMODE |
SOUND_SOURCE_CHANGED_SOUND_POWER |
SOUND_SOURCE_CHANGED_MUTING |
SOUND_SOURCE_CHANGED_POSE |
SOUND_SOURCE_CHANGED_DIRECTIVITY;
//!< Selector mask for sound receiver related events
static const uint64_t SOUND_RECEIVER_EVENT = SOUND_RECEIVER_CREATED |
SOUND_RECEIVER_DELETED |
SOUND_RECEIVER_CHANGED_NAME |
SOUND_RECEIVER_CHANGED_AURALIZATIONMODE |
SOUND_RECEIVER_CHANGED_DIRECTIVITY |
SOUND_RECEIVER_CHANGED_POSE;
//!< Selector mask for portal related events
static const uint64_t PORTAL_EVENT = SOUND_PORTAL_CHANGED_NAME |
SOUND_PORTAL_CHANGED_PARAMETER;
//!< Selector mask for sound source modification event
static const uint64_t SOUNDSOURCE_MODIFICATION = SOUND_SOURCE_CHANGED_NAME |
SOUND_SOURCE_CHANGED_SIGNALSOURCE |
SOUND_SOURCE_CHANGED_AURALIZATIONMODE |
SOUND_SOURCE_CHANGED_SOUND_POWER |
SOUND_SOURCE_CHANGED_MUTING |
SOUND_SOURCE_CHANGED_POSE |
SOUND_SOURCE_CHANGED_DIRECTIVITY;
//!< Selector mask for sound receiver modification event
static const uint64_t SOUND_RECEIVER_MODIFICATION = SOUND_RECEIVER_CHANGED_NAME |
SOUND_RECEIVER_CHANGED_AURALIZATIONMODE |
SOUND_RECEIVER_CHANGED_DIRECTIVITY |
SOUND_RECEIVER_CHANGED_POSE;
IVAInterface* pSender; //!< Sender interface
int iEventID; //!< Event identifier
uint64_t iEventType; //!< Event type (bit vector)
int iObjectID; //!< Integer-ID (Standard)
std::string sObjectID; //!< String-ID (z.B. für Signalquellen)
int iParamID; //!< Parameter identifier
std::string sParam; //!< Parameter string
int iIndex; //!< Index value
int iAuralizationMode; //!< Auralization mode
double dVolume; //!< Volume, gain, sound power
double dState; //!< Floating point state
bool bMuted; //!< Mute flag
std::string sName; //!< Name
std::string sFilenPath; //!< File path
VAVec3 vPos; //!< Position vector
VAVec3 vView; //!< View vector
VAVec3 vUp; //!< Up vector
VAQuat qHATO; //!< Head-above-torso quaternion orientation
VAQuat oOrientation; //!< Quaternion orientation
std::vector< float > vfInputPeaks; //!< Peak values of the input channels [factor]
std::vector< float > vfInputRMSs; //!< RMS values of the input channels [factor]
std::vector< float > vfOutputPeaks; //!< Peak values of the output channels [factor]
std::vector< float > vfOutputRMSs; //!< RMS values of the output channels [factor]
float fSysLoad, fDSPLoad; //!< System and DSP load [percent]
double dCoreClock; //!< Current value of the core clock [s]
//!< Progress data
CVAProgress oProgress;
CVAStruct oPrototypeParams;
//! Create empty event
inline CVAEvent()
: pSender( NULL )
, iEventID( 0 )
, iEventType( 0 )
, iObjectID( -1 )
, iParamID( -1 )
, iIndex( -1 )
, iAuralizationMode( 0 )
, dVolume( 0 )
, dState( 0 )
, bMuted( false )
{};
//! Destroy event
inline virtual ~CVAEvent() {};
//! Convert to string
/**
* @return String formatted event (for debugging output)
*/
virtual std::string ToString() const;
};
//! Event handler interface class
/**
* This purely abstract class defines an interface to receive
* core events, e.g. for a graphical user intface. Derive your
* class and implement the handler. Attach your instance to the VA
* class (also works with network connections, event will be transmitted).
*/
class VABASE_API IVAEventHandler
{
public:
//! Destructor
inline virtual ~IVAEventHandler() {};
//! Event handler hook
/**
* @param[in] pEvent Event pointer
*/
virtual void HandleVAEvent( const CVAEvent* pEvent ) = 0;
};
#endif // IW_VABASE_EVENT
......@@ -4,7 +4,7 @@
* VVV VVV A Virtual Acoustics (VA) | http://www.virtualacoustics.org