Commit 0ad814ac authored by Jonas Stienen's avatar Jonas Stienen

Adding GetRenderer and GetReproduction to core interface. Also sime style changes

parent a94b8598
......@@ -31,9 +31,9 @@
#define VABASE_IMPL_TEMPLATE
#endif
// Disable STL template-instantiation warning with DLLs for Visual C++
#if defined( _MSC_VER ) || defined( WIN32 )
#pragma warning( disable: 4251 )
#pragma warning( disable: 4251 ) // Disable STL template-instantiation warning with DLLs for Visual C++
#pragma warning( disable: 4201 ) // Non-compliant union definition of VAVec3.comp
#endif
// Define necessary typedef from stdint.h for Microsoft compilers before Visual C++ 2010
......@@ -183,7 +183,7 @@ public:
//! Stream output operator
// Output format: "<1, 2, 3>"
VABASE_API std::ostream& operator<<(std::ostream& os, const VAOrientYPR& oOrient);
VABASE_API std::ostream& operator<<( std::ostream& os, const VAOrientYPR& oOrient );
//! Data class describing callable and registrable objects
struct VABASE_API CVAObjectInfo
......@@ -201,6 +201,23 @@ struct VABASE_API CVAModuleInfo
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
/**
......@@ -210,7 +227,8 @@ struct VABASE_API CVAModuleInfo
* to be shown in a user interface (i.e. the initialisation of
* a core)
*/
class VABASE_API CVAProgress {
class VABASE_API CVAProgress
{
public:
int iCurrentStep; //!< Current step number (0 = nothing happened yet)
int iMaxStep; //!< Maximum step number (end)
......@@ -244,22 +262,6 @@ public:
: sScope(sTheScope), sName(sTheName), iValue(iTheValue) {}
};
//! Data class containing information of an audio renderer module
class VABASE_API CVAAudioRenderingModuleInfo
{
public:
std::string sID; //!< Identifier
std::string sClass; //!< Class
};
//! Data class containing information of an audio reproduction module
class VABASE_API CVAAudioReproductionModuleInfo
{
public:
std::string sID; //!< Identifier
std::string sClass; //!< Class
};
//! Data class containing information of loaded directivities
class VABASE_API CVADirectivityInfo
{
......
......@@ -1220,8 +1220,12 @@ public:
* | | *
* +----------------------------------------------------------+ */
//! Get information on rendering modules
virtual void GetRenderingModules( std::vector< CVAAudioRenderingModuleInfo >& voRenderer ) const=0;
//! Returns all available renderers (default: only those that are enabled)
/**
* @param [out] voRenderer List of renderers modules
* @param [in] bFilterEnabled If true, only enabled renderers are returned (via configuration, during runtime)
*/
virtual void GetRenderingModules( std::vector< CVAAudioRendererInfo >& voRenderer, bool bFilterEnabled = true ) const = 0;
//! Mutes a rendering module audio output
virtual void SetRenderingModuleMuted( const std::string& sModuleID, bool bMuted ) =0;
......@@ -1241,8 +1245,12 @@ public:
* | | *
* +----------------------------------------------------------+ */
//! Get information on reproduction modules
virtual void GetReproductionModules( std::vector< CVAAudioReproductionModuleInfo >& voReproductionModules ) const=0;
//! Returns all available reproductions (default: only those that are enabled)
/**
* @param [out] voReproductions List of reproduction modules
* @param [in] bFilterEnabled If true, only enabled renderers are returned (via configuration, during runtime)
*/
virtual void GetReproductionModules( std::vector< CVAAudioRendererInfo >& voReproductions, bool bFilterEnabled = true ) const=0;
//! Mutes a rendering module audio output
virtual void SetReproductionModuleMuted( const std::string& sModuleID, bool bMuted ) =0;
......
/*
* --------------------------------------------------------------------------------------------
*
* VVV VVV A
* VVV VVV AAA Virtual Acoustics
* VVV VVV AAA Virtual Acoustics (VA)
* VVV VVV AAA Real-time auralisation for virtual reality
* VVV VVV AAA
* VVVVVV AAA (c) Copyright Institut fr Technische Akustik (ITA)
* VVVV AAA RWTH Aachen (http://www.akustik.rwth-aachen.de)
* VVVVVV AAA (c) Copyright Institute of Technical Acoustics (ITA)
* VVVV AAA RWTH Aachen University (http://www.akustik.rwth-aachen.de)
*
* ---------------------------------------------------------------------------------
*
* File: CVAObject.h
*
* Purpose: Base class for objects with identity and message interface
*
* Autor(en): Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de)
*
* ---------------------------------------------------------------------------------
* --------------------------------------------------------------------------------------------
*/
// $Id:
#ifndef __VABASE_OBJECT_H__
#define __VABASE_OBJECT_H__
#ifndef VA_INCLUDE_GUARD_VAOBJECT
#define VA_INCLUDE_GUARD_VAOBJECT
#include <VABaseDefinitions.h>
#include <VAStruct.h>
// Forward declarations
class VABASE_API CVAStruct;
//class VABASE_API CVAObjectRegistry;
//! Base class for objects with identity and message interface
/**
*
*/
class VABASE_API CVAObject {
* In VA, anything can be an object and can be called via the module call interface during runtime.
* These calls are usually not thread-safe.
*/
class VABASE_API CVAObject
{
public:
//! Default constructor
CVAObject();
//! Initialization constructors
CVAObject(const char* pszName);
CVAObject(const std::string& sName);
CVAObject( const char* pszName );
CVAObject( const std::string& sName );
//! Destructor
virtual ~CVAObject();
......@@ -61,21 +54,21 @@ public:
* -1, if the message could not be handled
*/
// TODO: Int als Rckgabe?
virtual int CallObject(const CVAStruct& oArgs, CVAStruct& oReturn);
virtual int CallObject( const CVAStruct& oArgs, CVAStruct& oReturn );
protected:
// Important: An object may not change its name after it is registered
void SetObjectName(const std::string& sName);
void SetObjectName( const std::string& sName );
private:
int m_iObjectID;
std::string m_sObjectName;
// Note: This may only be called from an object registry
void SetObjectID(int iID);
void SetObjectID( int iID );
friend class CVAObjectRegistry;
};
#endif // __VABASE_OBJECT_H__
#endif // VA_INCLUDE_GUARD_VAOBJECT
......@@ -106,15 +106,17 @@ int ParseAuralizationModeToken(const std::string& t) {
return -1;
}
int IVACore::ParseAuralizationModeStr(const std::string& sModeStr, int iBaseMode) {
int IVACore::ParseAuralizationModeStr( const std::string& sModeStr, int iBaseMode )
{
// Remove all whitespaces, valid chars: Alphabetic + *+-,
std::string s;
for (size_t k=0; k<sModeStr.size(); k++) {
if (isspace(sModeStr[k])) continue;
for( size_t k = 0; k < sModeStr.size(); k++ )
{
if( isspace( sModeStr[ k ] ) )
continue;
if (isalpha(sModeStr[k])) {
s += toupper(sModeStr[k]);
s += char( toupper( sModeStr[ k ] ) );
continue;
}
......@@ -122,7 +124,7 @@ int IVACore::ParseAuralizationModeStr(const std::string& sModeStr, int iBaseMode
(sModeStr[k] == '+') ||
(sModeStr[k] == '-') ||
(sModeStr[k] == ',')) {
s += toupper(sModeStr[k]);
s += char( toupper( sModeStr[ k ] ) );
continue;
}
......@@ -273,8 +275,8 @@ std::string IVACore::GetAuralizationModeStr( int iAuralizationMode, bool bShortF
}
// Remove last ,_
std::string s(ss.str());
s[0] = toupper(s[0]);
std::string s( ss.str() );
s[ 0 ] = char( toupper( s[ 0 ] ) );
return s.substr(0, s.length()-2);
}
......@@ -296,11 +298,15 @@ int IVACore::ParsePlaybackState( const std::string& t )
{
std::string T = t;
for( size_t i=0; i<t.size(); i++ )
T[i] = toupper( t[i] );
T[i] = char( toupper( t[i] ) );
if( T == "PLAYING" )
return IVACore::VA_PLAYBACK_STATE_PLAYING;
if( T == "STOPPED" )
return IVACore::VA_PLAYBACK_STATE_STOPPED;
if( T == "PAUSED" )
return IVACore::VA_PLAYBACK_STATE_PAUSED;
if( T == "PLAYING" ) return IVACore::VA_PLAYBACK_STATE_PLAYING;
if( T == "STOPPED" ) return IVACore::VA_PLAYBACK_STATE_STOPPED;
if( T == "PAUSED" ) return IVACore::VA_PLAYBACK_STATE_PAUSED;
return -1;
}
......@@ -316,7 +322,7 @@ int IVACore::ParsePlaybackAction( const std::string& t )
{
std::string T = t;
for( size_t i=0; i<t.size(); i++ )
T[i] = toupper( t[i] );
T[i] = char( toupper( t[i] ) );
if( T == "PLAY" ) return IVACore::VA_PLAYBACK_ACTION_PLAY;
if( T == "STOP" ) return IVACore::VA_PLAYBACK_ACTION_STOP;
......@@ -437,7 +443,7 @@ void IVACore::DisableListener( int iListenerID )
SetListenerEnabled( iListenerID, false );
}
std::string IVACore::FindFilePath( const std::string& sFilePath ) const
std::string IVACore::FindFilePath( const std::string& ) const
{
return std::string();
}
/*
*
* VVV VVV A
* VVV VVV AAA Virtual Acoustics
* VVV VVV AAA Real-time auralisation for virtual reality
* VVV VVV AAA
* VVVVVV AAA (c) Copyright Institut fr Technische Akustik (ITA)
* VVVV AAA RWTH Aachen (http://www.akustik.rwth-aachen.de)
*
* ---------------------------------------------------------------------------------
*
* File: VAObject.cpp
*
* Purpose: Base class for objects with identity and message interface
*
* Autor(en): Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de)
*
* ---------------------------------------------------------------------------------
*/
// $Id: $
#include <VAObject.h>
#include <cassert>
CVAObject::CVAObject() : m_iObjectID(0) {}
CVAObject::CVAObject()
: m_iObjectID( 0 )
{
}
CVAObject::CVAObject( const char* pszName )
: CVAObject( std::string( pszName ) )
{
}
CVAObject::CVAObject(const char* pszName) : m_iObjectID(0), m_sObjectName(pszName) {}
CVAObject::CVAObject(const std::string& sName) : m_iObjectID(0), m_sObjectName(sName) {}
CVAObject::CVAObject( const std::string& sName )
: m_iObjectID( 0 )
, m_sObjectName( sName )
{
}
CVAObject::~CVAObject() {}
CVAObject::~CVAObject()
{
}
int CVAObject::GetObjectID() const {
int CVAObject::GetObjectID() const
{
return m_iObjectID;
}
void CVAObject::SetObjectID(int iID) {
void CVAObject::SetObjectID( int iID )
{
m_iObjectID = iID;
}
std::string CVAObject::GetObjectName() const {
std::string CVAObject::GetObjectName() const
{
return m_sObjectName;
}
void CVAObject::SetObjectName(const std::string& sName) {
void CVAObject::SetObjectName( const std::string& sName )
{
m_sObjectName = sName;
}
CVAObjectInfo CVAObject::GetObjectInfo() const {
CVAObjectInfo CVAObject::GetObjectInfo() const
{
CVAObjectInfo oInfo;
oInfo.iID = GetObjectID();
oInfo.sName = GetObjectName();
......@@ -55,7 +51,9 @@ CVAObjectInfo CVAObject::GetObjectInfo() const {
return oInfo;
}
int CVAObject::CallObject(const CVAStruct& pArgs, CVAStruct& pReturn) {
int CVAObject::CallObject( const CVAStruct&, CVAStruct& oRet )
{
// Default implementation: Do nothing, no return message
oRet.Clear();
return 0;
}
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