style

parent a8a12d66
......@@ -3,7 +3,7 @@
*
* VVV VVV A
* VVV VVV AAA Virtual Acoustics (VA)
* VVV VVV AAA Real-time auralisation for virtual reality
* VVV VVV AAA Real-time auralisation for virtual reality
* VVV VVV AAA
* VVVVVV AAA (c) Copyright Institute of Technical Acoustics (ITA), 2015-2017
* VVVV AAA RWTH Aachen University (http://www.akustik.rwth-aachen.de)
......@@ -19,44 +19,47 @@
//! Attribute base class
/**
* This is the base class for attributes.
* Currently it only defines the destructor.
*/
class VABASE_API IVAAttribute {
* 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.
*/
* 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 {
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;
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.
* This implementation is not thread-safe! You need to take care yourself!
*/
class VABASE_API CVAAttributableImpl : public IVAAttributable {
* 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);
virtual void AttachAttribute( void* pOwner, IVAAttribute* pAttr );
virtual void DetachAttribute( void* pOwner );
virtual IVAAttribute* GetAttribute( void* pOwner );
private:
typedef std::map<void*, IVAAttribute*> AttrMap;
......
......@@ -3,7 +3,7 @@
*
* VVV VVV A
* VVV VVV AAA Virtual Acoustics (VA)
* VVV VVV AAA Real-time auralisation for virtual reality
* VVV VVV AAA Real-time auralisation for virtual reality
* VVV VVV AAA
* VVVVVV AAA (c) Copyright Institute of Technical Acoustics (ITA), 2015-2017
* VVVV AAA RWTH Aachen University (http://www.akustik.rwth-aachen.de)
......@@ -27,7 +27,7 @@ class ITAStreamInfo;
/**
* This purely abstract class defines an interface for
* data source objects that provide audio-streams. It
* is intended to acoustically represent sound emitting
* is intended to acoustically represent sound emitting
* objects in a virtual scene.
*
* A data source is always monaural (single channel)
......@@ -43,7 +43,7 @@ public:
*/
enum AudioSignalSourceType
{
VA_SS_AUDIOFILE=0, //!< Sound source is an audio file (from secondary storage)
VA_SS_AUDIOFILE = 0, //!< Sound source is an audio file (from secondary storage)
VA_SS_SEQUENCER, //!< Sound source is a music sequencer (MIDI, DAWs, ...)
VA_SS_DEVICE_INPUT, //!< Sound source is fed through audio device input channel(s)
VA_SS_NETSTREAM, //!< Sound source is a network stream receiver socket
......@@ -52,19 +52,19 @@ public:
} SoundSourceTypes;
//! Destructor.
virtual ~IVAAudioSignalSource() {};
inline virtual ~IVAAudioSignalSource() {};
//! Type ID getter
/**
* \return Returns the ID (one out of #SoundSourceTypes)
*/
virtual int GetType() const=0;
virtual int GetType() const = 0;
//! Type getter (human readable string)
/**
* \return Returns the type (one out of #SoundSourceTypes as a human readable string)
*/
virtual std::string GetTypeString() const=0;
virtual std::string GetTypeString() const = 0;
//! Description getter
/**
......@@ -73,7 +73,7 @@ public:
*
* \return Returns a human readable sound source description
*/
virtual std::string GetDesc() const=0;
virtual std::string GetDesc() const = 0;
//! State getter
/**
......@@ -82,7 +82,7 @@ public:
*
* \return Returns a human readable status of the sound source
*/
virtual std::string GetStateString() const=0;
virtual std::string GetStateString() const = 0;
//! Associated core getter
/**
......@@ -94,35 +94,33 @@ public:
*
* \return Pointer to the associated #IVACore, NULL if non present
*/
virtual IVACore* GetAssociatedCore() const=0;
//! Gibt die ID zurück (z.B. "adi1")
//virtual std::string GetID() const=0;
//! Gibt zurück ob der Audio-Datenstrom pausiert werden kann
//virtual bool IsStartStoppable() const=0;
//! Gibt zurück ob der Audio-Datenstrom zurückgespult werden werden kann
//virtual bool IsPausable() const=0;
virtual IVACore* GetAssociatedCore() const = 0;
//! Stream block getter
/**
* Returns the data pointer to the next audio block of the sound source.
/**
* Returns the data pointer to the next audio block of the sound source.
*
* \param oStreamState Information on stream state
* @param[in] oStreamState Information on stream state
*
* \return Pointer to the audio data array containing data for next block (NULL if no data available)
* @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
* @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;
virtual const float* GetStreamBlock( const CVAAudiostreamState* pStreamInfo ) = 0;
//! Parameter getter interaction hook
virtual CVAStruct GetParameters( const CVAStruct&) const=0;
/**
* @param[in] oIn Parameter request set
* @param[out] Parameters
*/
virtual CVAStruct GetParameters( const CVAStruct& oIn ) const = 0;
//! Parameter setter interaction hook
virtual void SetParameters( const CVAStruct& )=0;
/**
* @param[in] oIn Parameter set
*/
virtual void SetParameters( const CVAStruct& oIn ) = 0;
private:
......@@ -130,22 +128,22 @@ private:
/**
* Calls the audio signal source manager to register this sound source a the given core.
*
* \param pParentCore Pointer to the associated core.
* @param[in] pParentCore Pointer to the associated core.
*
* \see #CVAAudioSignalSourceManager
* @sa CVAAudioSignalSourceManager
*/
virtual void HandleRegistration(IVACore* pParentCore)=0;
virtual void HandleRegistration( IVACore* pParentCore ) = 0;
//! Unregister sound source at a core instance
/**
* Calls the audio signal source manager to unregister this sound source a the given core.
* Will inform the core about a new signal source.
*
* \param pParentCore Pointer to the associated core.
* @param[in] pParentCore Pointer to the associated core.
*
* \see #CVAAudioSignalSourceManager
* @sa CVAAudioSignalSourceManager
*/
virtual void HandleUnregistration(IVACore* pParentCore)=0;
virtual void HandleUnregistration( IVACore* pParentCore ) = 0;
friend class CVAAudioSignalSourceManager;
};
......
......@@ -372,15 +372,17 @@ public:
//! Creates a network-based signal source
/**
* Creates a signal source which receives audio samples via network.
* Therefore an IP socket is set up with the given parameters.
*
* \param sInterface IP address of the socket (e.g. 127.0.0.1, no hostnames!)
* \param iPort Destination port on which samples are received
* \param sName Name (optional, e.g. "Network stream 1")
*
* \return ID of signal source
*/
* Creates a signal source which receives audio samples via network.
* Therefore an IP socket is set up with the given parameters.
*
* @param[in] sInterface IP address of the socket (e.g. 127.0.0.1, no hostnames!)
* @param[in] iPort Destination port on which samples are received
* @param[in] sName Optional name
*
* @note Usual port range is 12480 to 12500
*
* @return ID of signal source
*/
virtual std::string CreateNetworkStreamSignalSource( const std::string& sInterface, int iPort, const std::string& sName = "" ) = 0;
//! Creates a rotating engine source
......
/*
*
* 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: VAAttributable.cpp
*
* Purpose: Attribute aspect interface
*
* Autor(en): Frank Wefers (Frank.Wefers@akustik.rwth-aachen.de)
*
* ---------------------------------------------------------------------------------
*/
// $Id: $
#include <VAAttributable.h>
#include <cassert>
IVAAttribute::~IVAAttribute() {};
IVAAttributable::~IVAAttributable() {};
IVAAttribute::~IVAAttribute()
{
};
IVAAttributable::~IVAAttributable()
{
};
CVAAttributableImpl::~CVAAttributableImpl() {
CVAAttributableImpl::~CVAAttributableImpl()
{
// Free all remaining attributes
for (AttrMapIt it=m_mAttr.begin(); it!=m_mAttr.end(); ++it) delete it->second;
for( AttrMapIt it = m_mAttr.begin(); it != m_mAttr.end(); ++it )
delete it->second;
}
void CVAAttributableImpl::AttachAttribute(void* pOwner, IVAAttribute* pAttr) {
void CVAAttributableImpl::AttachAttribute( void* pOwner, IVAAttribute* pAttr )
{
assert( pOwner && pAttr );
if (!pOwner || !pAttr) return;
m_mAttr[pOwner] = pAttr;
if( !pOwner || !pAttr )
return;
m_mAttr[ pOwner ] = pAttr;
}
void CVAAttributableImpl::DetachAttribute(void* pOwner) {
AttrMapIt it = m_mAttr.find(pOwner);
void CVAAttributableImpl::DetachAttribute( void* pOwner )
{
AttrMapIt it = m_mAttr.find( pOwner );
assert( it != m_mAttr.end() ); // Owner not found
if (it == m_mAttr.end()) return;
m_mAttr.erase(it);
if( it == m_mAttr.end() ) return;
m_mAttr.erase( it );
}
IVAAttribute* CVAAttributableImpl::GetAttribute(void* pOwner) {
AttrMapIt it = m_mAttr.find(pOwner);
IVAAttribute* CVAAttributableImpl::GetAttribute( void* pOwner )
{
AttrMapIt it = m_mAttr.find( pOwner );
assert( it != m_mAttr.end() ); // Owner not found
return (it != m_mAttr.end() ? it->second : NULL);
return ( it != m_mAttr.end() ? it->second : NULL );
}
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