Commit f23b8168 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Progress on API adaption

parent c84a0bc8
......@@ -16,7 +16,7 @@
#if ( VACORE_WITH_RENDERER_AMBISONICS_FREE_FIELD == 1 )
// VA includes
#include "../../../Data/VADirectivity.h"
#include "../../../directivities/VADirectivity.h"
#include "../../../Filtering/VAAtmosphere.h"
#include "../../../Motion/VAMotionModelBase.h"
#include "../../../Motion/VASharedMotionModel.h"
......
......@@ -21,8 +21,8 @@
#include <VA.h>
#include <VAObjectPool.h>
#include <VAReferenceableObject.h>
#include "../../../Data/VADirectivityDAFFEnergetic.h"
#include "../../../Data/VADirectivityDAFFHRIR.h"
#include "../../../directivities/VADirectivityDAFFEnergetic.h"
#include "../../../directivities/VADirectivityDAFFHRIR.h"
#include "../../../Filtering/VAAtmosphere.h"
#include "../../../Motion/VAMotionModelBase.h"
#include "../../../Motion/VASharedMotionModel.h"
......@@ -73,8 +73,8 @@ public:
{
public:
double dRetardedDistance; //!< Metrical distance to retarded sound position
VAOrientYPR yprAngleRetSourceToListener; //!< Immediate angle of incidence to retarded source position in listener reference frame in YPR convention
VAOrientYPR yprAngleListenerToRetSource; //!< Retarded angle of incidence to listener in source reference frame in YPR convention
VAQuat qAngleRetSourceToListener; //!< Immediate angle of incidence to retarded source position in listener reference frame in YPR convention
VAQuat qAngleListenerToRetSource; //!< Retarded angle of incidence to listener in source reference frame in YPR convention
};
//! State of directivity
......@@ -707,15 +707,15 @@ void CVABinauralAirTrafficNoiseAudioRenderer::ProcessStream( const ITAStreamInfo
pPath->UpdateMetrics();
bool bAASourceStatusEnabled = ( pSourceState->GetAuralizationMode() & IVAInterface::VA_AURAMODE_AIR_ABSORPTION ) > 0;
bool bAAListenerStatusEnabled = ( pListenerState->GetAuralizationMode() & IVAInterface::VA_AURAMODE_AIR_ABSORPTION ) > 0;
bool bAAGlobalStatusEnabled = ( m_iCurGlobalAuralizationMode & IVAInterface::VA_AURAMODE_AIR_ABSORPTION ) > 0;
bool bAASourceStatusEnabled = ( pSourceState->GetAuralizationMode() & IVAInterface::VA_AURAMODE_MEDIUM_ABSORPTION ) > 0;
bool bAAListenerStatusEnabled = ( pListenerState->GetAuralizationMode() & IVAInterface::VA_AURAMODE_MEDIUM_ABSORPTION ) > 0;
bool bAAGlobalStatusEnabled = ( m_iCurGlobalAuralizationMode & IVAInterface::VA_AURAMODE_MEDIUM_ABSORPTION ) > 0;
bool bAAEnabled = bAASourceStatusEnabled && bAAListenerStatusEnabled && bAAGlobalStatusEnabled;
pPath->UpdateAirAttenuation( bAAEnabled );
bool bTVSourceStatusEnabled = ( pSourceState->GetAuralizationMode() & IVAInterface::VA_AURAMODE_ATMOS_TEMP_VAR ) > 0;
bool bTVListenerStatusEnabled = ( pListenerState->GetAuralizationMode() & IVAInterface::VA_AURAMODE_ATMOS_TEMP_VAR ) > 0;
bool bTVGlobalStatusEnabled = ( m_iCurGlobalAuralizationMode & IVAInterface::VA_AURAMODE_ATMOS_TEMP_VAR ) > 0;
bool bTVSourceStatusEnabled = ( pSourceState->GetAuralizationMode() & IVAInterface::VA_AURAMODE_TEMP_VAR ) > 0;
bool bTVListenerStatusEnabled = ( pListenerState->GetAuralizationMode() & IVAInterface::VA_AURAMODE_TEMP_VAR ) > 0;
bool bTVGlobalStatusEnabled = ( m_iCurGlobalAuralizationMode & IVAInterface::VA_AURAMODE_TEMP_VAR ) > 0;
bool bTVEnabled = bTVSourceStatusEnabled && bTVListenerStatusEnabled && bTVGlobalStatusEnabled;
pPath->UpdateTemporalVariation( bTVEnabled );
......@@ -743,9 +743,9 @@ void CVABinauralAirTrafficNoiseAudioRenderer::ProcessStream( const ITAStreamInfo
if( !bSSLEnabled )
dDirSoundPathDistanceDecrease = dRefSoundPathDistanceDecrease = 1.0f;
bool bDIREnabledSoure = ( pSourceState->GetAuralizationMode() & IVAInterface::VA_AURAMODE_DIRECTIVITY ) > 0;
bool bDIREnabledListener = ( pListenerState->GetAuralizationMode() & IVAInterface::VA_AURAMODE_DIRECTIVITY ) > 0;
bool bDIREnabledGlobal = ( m_iCurGlobalAuralizationMode & IVAInterface::VA_AURAMODE_DIRECTIVITY ) > 0;
bool bDIREnabledSoure = ( pSourceState->GetAuralizationMode() & IVAInterface::VA_AURAMODE_SOURCE_DIRECTIVITY ) > 0;
bool bDIREnabledListener = ( pListenerState->GetAuralizationMode() & IVAInterface::VA_AURAMODE_SOURCE_DIRECTIVITY ) > 0;
bool bDIREnabledGlobal = ( m_iCurGlobalAuralizationMode & IVAInterface::VA_AURAMODE_SOURCE_DIRECTIVITY ) > 0;
bool bDIREnabled = ( bDIREnabledSoure && bDIREnabledListener && bDIREnabledGlobal );
pPath->UpdateDir( bDIREnabled );
......@@ -1411,7 +1411,7 @@ void CVABATNSoundPath::CalculateInverseDistanceDecrease( double& dDirSoundDistDe
void CVABATNSoundPath::UpdateHRIR()
{
IVADirectivity* pDirSoundPathHRIRDataNew = oDirSoundPath.oHRIRStateNew.pData;
CVADirectivityDAFFHRIR* pDirSoundPathHRIRDataNew = ( CVADirectivityDAFFHRIR * )( oDirSoundPath.oHRIRStateNew.pData );
bool bForeUpdate = false;
if( pDirSoundPathHRIRDataNew != nullptr )
{
......@@ -1471,8 +1471,8 @@ void CVABATNSoundPath::UpdateHRIR()
}
// Reflected sound path
CVADirectivityDAFFHRIR* pRefSoundPathHRIRDataNew = ( CVADirectivityDAFFHRIR * ) ( oRefSoundPath.oHRIRStateNew.pData );
IVADirectivity* pRefSoundPathHRIRDataNew = oRefSoundPath.oHRIRStateNew.pData;
bForeUpdate = false;
if( pRefSoundPathHRIRDataNew != nullptr )
{
......
......@@ -16,8 +16,8 @@
#if ( VACORE_WITH_RENDERER_BINAURAL_ARTIFICIAL_REVERB == 1 )
// VA includes
#include "../../../Data/VADirectivityDAFFEnergetic.h"
#include "../../../Data/VADirectivityDAFFHRIR.h"
#include "../../../directivities/VADirectivityDAFFEnergetic.h"
#include "../../../directivities/VADirectivityDAFFHRIR.h"
#include "../../../Filtering/VAAtmosphere.h"
#include "../../../Motion/VAMotionModelBase.h"
#include "../../../Motion/VASharedMotionModel.h"
......
......@@ -19,8 +19,8 @@
#include <VA.h>
// VA core includes
#include "../../../Data/VADirectivityDAFFEnergetic.h"
#include "../../../Data/VADirectivityDAFFHRIR.h"
#include "../../../directivities/VADirectivityDAFFEnergetic.h"
#include "../../../directivities/VADirectivityDAFFHRIR.h"
#include "../../../Filtering/VAAtmosphere.h"
#include "../../../Motion/VAMotionModelBase.h"
#include "../../../Motion/VASharedMotionModel.h"
......
......@@ -28,8 +28,8 @@
#include <VAObjectPool.h>
#include "../../../VALockfreeObjectPool.h"
#include "../../../VASourceListenerMetrics.h"
#include "../../../Data/VADirectivity.h"
#include "../../../Data/VAHRIRDataset.h"
#include "../../../directivities/VADirectivity.h"
#include "../../../directivities/VAHRIRDataset.h"
#include "../../../Filtering/VAAtmosphere.h"
#include "../../../Motion/VAMotionModelBase.h"
#include "../../../Motion/VASampleAndHoldMotionModel.h"
......
......@@ -16,7 +16,7 @@
#if( VACORE_WITH_RENDERER_MONAURAL_FREE_FIELD==1 )
// VA includes
#include "../../../Data/VADirectivity.h"
#include "../../../directivities/VADirectivity.h"
#include "../../../Filtering/VAAtmosphere.h"
#include "../../../Motion/VAMotionModelBase.h"
#include "../../../Motion/VASharedMotionModel.h"
......
......@@ -16,8 +16,8 @@
#if ( VACORE_WITH_RENDERER_PROTOTYPE_HEARING_AID == 1 )
// VA includes
#include "../../../Data/VADirectivityDAFFEnergetic.h"
#include "../../../Data/VADirectivityDAFFHRIR.h"
#include "../../../directivities/VADirectivityDAFFEnergetic.h"
#include "../../../directivities/VADirectivityDAFFHRIR.h"
#include "../../../Filtering/VAAtmosphere.h"
#include "../../../Motion/VAMotionModelBase.h"
#include "../../../Motion/VASharedMotionModel.h"
......
......@@ -15,7 +15,7 @@
#if (VACORE_WITH_REPRODUCTION_AMBISONICS_BINAURAL_MIXDOWN==1 )
#include "../../../Data/VADirectivityDAFFHRIR.h"
#include "../../directivities/VADirectivityDAFFHRIR.h"
#include "../../Scene/VAListenerState.h"
#include "../../Scene/VAMotionState.h"
#include "../../Scene/VASceneState.h"
......
......@@ -15,7 +15,7 @@
#if ( VACORE_WITH_REPRODUCTION_BINAURAL_MIXDOWN == 1 )
#include "../../../Data/VADirectivityDAFFHRIR.h"
#include "../../directivities/VADirectivityDAFFHRIR.h"
#include "../../Scene/VAListenerState.h"
#include "../../Scene/VAMotionState.h"
#include "../../Scene/VASceneState.h"
......
......@@ -15,7 +15,7 @@
#if ( VACORE_WITH_REPRODUCTION_BINAURAL_NCTC == 1 )
#include "../../Data/VADirectivityDAFFHRIR.h"
#include "../../directivities/VADirectivityDAFFHRIR.h"
#include "../../Scene/VAListenerState.h"
#include "../../Scene/VAMotionState.h"
#include "../../Scene/VASceneState.h"
......
......@@ -17,6 +17,7 @@
#include "../VALog.h"
#include "VASceneManager.h"
#include "VAMotionState.h"
#include "../directivities/VADirectivity.h"
#include <ITANumericUtils.h>
......@@ -122,7 +123,8 @@ int CVASoundSourceState::GetDirectivityID() const {
return data.iDirID;
}
const DAFFContentMS* CVASoundSourceState::GetDirectivityData() const {
const IVADirectivity* CVASoundSourceState::GetDirectivityData() const
{
return data.pDirData;
}
......@@ -133,7 +135,7 @@ void CVASoundSourceState::SetDirectivityID( int iDirectivityID )
data.iDirID = iDirectivityID;
}
void CVASoundSourceState::SetDirectivityData( const DAFFContentMS* pDirData )
void CVASoundSourceState::SetDirectivityData( const IVADirectivity* pDirData )
{
assert( !IsFixed() );
// TODO: Validation
......
......@@ -19,7 +19,7 @@
#include <VAStruct.h>
class CVAMotionState;
class DAFFContentMS;
class IVADirectivity;
// Diese Klasse bescheibt den dynamischen (versionierten) Zustand einer Schallquelle
class CVASoundSourceState : public CVASceneStateBase
......@@ -39,13 +39,13 @@ public:
const CVAMotionState* GetMotionState() const;
double GetVolume() const;
int GetDirectivityID() const;
const DAFFContentMS* GetDirectivityData() const;
const IVADirectivity* GetDirectivityData() const;
int GetAuralizationMode() const;
// Setter
void SetVolume( double dVolume );
void SetDirectivityID( int iDirectivityID );
void SetDirectivityData( const DAFFContentMS* pDirData );
void SetDirectivityData( const IVADirectivity* pDirData );
void SetAuralizationMode( int iAuralizationMode );
//! Sets parameters
......@@ -76,7 +76,7 @@ private:
int iDirID;
// Richtcharakteristik-Datensatz (DAFF)
const DAFFContentMS* pDirData;
const IVADirectivity* pDirData;
} data;
};
......
......@@ -23,7 +23,7 @@
#include "Audiosignals/VAEngineSignalSource.h"
#include "Audiosignals/VAMachineSignalSource.h"
#include "Audiosignals/VASequencerSignalSource.h"
#include "Data/VADirectivityManager.h"
#include "directivities/VADirectivityManager.h"
#include "Rendering/VAAudioRenderer.h"
#include "Rendering/VAAudioRendererRegistry.h"
#include "Reproduction/VAAudioReproductionModule.h"
......@@ -34,7 +34,6 @@
#include "Utils/VADebug.h"
#include "Utils/VAUtils.h"
#include "VAAudiostreamTracker.h"
#include "VADirectivityManager.h"
#include "VALog.h"
#include "VACoreEventManager.h"
#include "VACoreFactory.h"
......@@ -296,7 +295,6 @@ CVACoreImpl::CVACoreImpl( const CVAStruct& oArgs )
m_pGlobalSampler( nullptr ),
m_pSignalSourceMan( nullptr ),
m_pDirMan( nullptr ),
m_pHRIRMan( nullptr ),
m_pSceneMan( nullptr ),
m_pNewSceneState( nullptr ),
m_iCurActiveListener( -1 ),
......@@ -500,12 +498,9 @@ void CVACoreImpl::Initialize() {
m_pGlobalSampler = ITASoundSampler::Create( 1, m_oCoreConfig.oAudioDriverConfig.dSampleRate, m_oCoreConfig.oAudioDriverConfig.iBuffersize, m_pGlobalSamplePool );
m_pGlobalSampler->AddMonoTrack();
 
m_pDirMan = new CVADirectivityManager;
m_pDirMan = new CVADirectivityManager( this, m_oCoreConfig.oAudioDriverConfig.dSampleRate );
m_pDirMan->Initialize();
 
m_pHRIRMan = new CVAHRIRManager( m_oCoreConfig.oAudioDriverConfig.dSampleRate );
m_pHRIRMan->Initialize();
SetProgress( "Setting up scene management", "", 3 );
 
m_pSceneMan = new CVASceneManager( m_pClock );
......@@ -632,7 +627,6 @@ void CVACoreImpl::Reset()
m_pSceneMan->Reset();
m_pSignalSourceMan->Reset();
m_pDirMan->Reset();
m_pHRIRMan->Reset();
 
// TODO: Check if the pool and sampler must really be recreated
/*
......@@ -734,10 +728,6 @@ void CVACoreImpl::Tidyup() {
delete m_pDirMan;
m_pDirMan = nullptr;
 
if( m_pHRIRMan )
m_pHRIRMan->Finalize();
delete m_pHRIRMan;
m_pHRIRMan = nullptr;
 
if( m_pSceneMan )
m_pSceneMan->Finalize();
......@@ -842,10 +832,6 @@ void CVACoreImpl::Finalize()
delete m_pDirMan;
m_pDirMan = nullptr;
 
m_pHRIRMan->Finalize();
delete m_pHRIRMan;
m_pHRIRMan = nullptr;
m_pSceneMan->Finalize();
delete m_pSceneMan;
m_pSceneMan = nullptr;
......@@ -979,7 +965,7 @@ int CVACoreImpl::CreateDirectivityFromParameters( const CVAStruct& oParams, cons
ev.iObjectID = iDirID;
m_pCoreEventMan->BroadcastEvent( ev );
 
VA_INFO( "Core", "Directivity \"" << sDestFilePath << "\" successfully loaded, assigned directivity ID " << iDirID );
VA_INFO( "Core", "Directivity successfully loaded, assigned directivity ID " << iDirID );
 
return iDirID;
 
......@@ -993,7 +979,7 @@ bool CVACoreImpl::DeleteDirectivity( const int iDirID )
 
VA_TRY
{
bool bSuccess = m_pDirMan->FreeDirectivity( iDirID );
bool bSuccess = m_pDirMan->DeleteDirectivity( iDirID );
//assert( bSuccess );
 
// Ereignis generieren, wenn Operation erfolgreich
......@@ -2110,7 +2096,7 @@ void CVACoreImpl::SetSoundSourceDirectivity( const int iSoundSourceID, const int
VA_EXCEPT2( INVALID_PARAMETER, "Invalid sound source ID" );
}
 
const CVADirectivity* pNewDirectivity = nullptr;
const IVADirectivity* pNewDirectivity = nullptr;
if( iDirectivityID != -1 )
{
pNewDirectivity = m_pDirMan->RequestDirectivity( iDirectivityID );
......@@ -2753,7 +2739,7 @@ void CVACoreImpl::SetSoundReceiverDirectivity( const int iID, const int iDirecti
const IVADirectivity* pDirectivity = nullptr;
if( iDirectivityID != -1 )
{
pDirectivity = m_pHRIRMan->RequestHRIR( iDirectivityID );
pDirectivity = m_pDirMan->RequestDirectivity( iDirectivityID );
if( !pDirectivity )
VA_EXCEPT2( INVALID_ID, "Invalid directivity dataset for ID " + std::to_string( iID ) );
}
......@@ -2771,7 +2757,7 @@ void CVACoreImpl::SetSoundReceiverDirectivity( const int iID, const int iDirecti
UnlockUpdate();
 
if( pDirectivity )
m_pDirMan->ReleaseDirectivity( iDirectivityID );
m_pDirMan->DeleteDirectivity( iDirectivityID );
 
VA_EXCEPT2( INVALID_PARAMETER, "Invalid listener ID " + std::to_string( iID ) );
}
......@@ -40,7 +40,6 @@ class IVAAudioReproductionModule;
class CVACoreEventManager;
class CVACoreThread;
class CVADirectivityManager;
class CVADirectivityManager;
class CVASceneManager;
class CVASceneState;
class DAFFContentIR;
......@@ -336,7 +335,6 @@ private:
// --= Directivity & HRIRs =----------------------------------------
CVADirectivityManager* m_pDirMan;
CVADirectivityManager* m_pHRIRMan;
// --= Rendering & Reproduction =-----------------------------------
......
#include "VADirectivityManager.h"
#include "VALog.h"
#include <VAException.h>
#include <ITAASCIITable.h>
#include <ITAFilesystemUtils.h>
#include <ITAException.h>
#include <ITAFunctors.h>
#include <ITAStringUtils.h>
#include <DAFF.h>
#include <algorithm>
CVADirectivityManager::CVADirectivityManager() {
}
CVADirectivityManager::~CVADirectivityManager() {
}
void CVADirectivityManager::Initialize() {
}
void CVADirectivityManager::Finalize() {
// Alle Richtcharakteristiken freigeben
for (CVAObjectContainer<CVADirectivity>::iterator it=m_ocDir.begin(); it!=m_ocDir.end(); ++it) {
delete it->second->getParent();
}
}
void CVADirectivityManager::Reset() {
// Alle Richtcharakteristiken freigeben
for (CVAObjectContainer<CVADirectivity>::iterator it=m_ocDir.begin(); it!=m_ocDir.end(); ++it) {
delete it->second->getParent();
}
m_ocDir.Clear();
}
int CVADirectivityManager::LoadDirectivity(const std::string& sFilename, const std::string& sName) {
std::string s = correctPath(sFilename);
int iDirID=0;
// TODO: Log-Level
VA_TRACE("DirMan", "LoadDirectivity(\"" << s << "\", \"" << sName << "\")");
// Zunchst prfen ob diese Datenbank schon geladen wurde
for (CVAObjectContainer<CVADirectivity>::const_iterator cit=m_ocDir.begin(); cit!=m_ocDir.end(); ++cit) {
if (cit->second->getParent()->getFilename() == s) {
iDirID = cit->first;
m_csDir.leave();
VA_TRACE("DirMan", "LoadDirectivity successful, directivity already loaded ID " << iDirID);
return iDirID;
}
}
DAFFReader* pReader = DAFFReader::create();
DAFFContentMS* pDir = NULL;
try {
int ec = pReader->openFile(s);
if (ec != DAFF_NO_ERROR) {
delete pReader;
ITA_EXCEPT1(IO_ERROR, DAFFUtils::StrError(ec));
}
// Ensure third-octave magnitude responses (pedantic!)
if (pReader->getContentType() != DAFF_MAGNITUDE_SPECTRUM) {
delete pReader;
ITA_EXCEPT1(INVALID_PARAMETER, "Directivity must be magnitude spectra in third-octave bands");
}
if (pReader->getProperties()->getNumberOfChannels() != 1) {
delete pReader;
ITA_EXCEPT1(INVALID_PARAMETER, "Directivity data must have one channel");
}
if (!pReader->getProperties()->coversFullSphere()) {
delete pReader;
ITA_EXCEPT1(INVALID_PARAMETER, "Directivity data does not cover the full sphere");
}
pDir = dynamic_cast<DAFFContentMS*>( pReader->getContent() );
iDirID = m_ocDir.Add(pDir);
} catch (ITAException& e) {
VA_TRACE("DirMan", "LoadDirectivity failed (" << e << ")");
throw;
} catch (...) {
VA_TRACE("DirMan", "LoadDirectivity failed due to an unknown error");
throw;
}
VA_TRACE("DirMan", "LoadDirectivity successful, assigned directivity ID " << iDirID);
return iDirID;
}
bool CVADirectivityManager::FreeDirectivity(int iDirID) {
VA_TRACE("DirMan", "FreeDirectivity(" << iDirID << ")");
// Prfen ob die ID gltig ist
int iRefCount = m_ocDir.GetRefCount(iDirID);
if (iRefCount != 0) {
// Noch Referenzen vorhanden oder ungltige ID (-1)
m_csDir.leave();
VA_TRACE("DirMan", "FreeDirectivity failed, directivity in use or invalid ID" << iDirID << ")");
return false;
}
// Directivity lschen
DAFFContentMS* pDir = m_ocDir[iDirID];
delete pDir->getParent();
m_ocDir.Remove(iDirID);
VA_TRACE("DirMan", "FreeDirectivity successful");
return true;
}
const CVADirectivity* CVADirectivityManager::RequestDirectivity(int iDirID) {
CVADirectivity* pDir = m_ocDir.Request(iDirID);
return pDir;
}
int CVADirectivityManager::ReleaseDirectivity(int iDirID) {
int iRefCount = m_ocDir.Release(iDirID);
return iRefCount;
}
int CVADirectivityManager::GetDirectivityRefCount(int iDirID) const {
return m_ocDir.GetRefCount(iDirID);
}
CVADirectivityInfo CVADirectivityManager::GetDirectivityInfo(int iDirID) {
DAFFContentMS* pDir = m_ocDir[iDirID];
if (!pDir) VA_EXCEPT2(INVALID_ID, "Invalid directivity ID");
return CVADirectivityInfo(iDirID,
"<TODO: NAME>",
pDir->getParent()->getFilename(),
"<TODO: DESC>", // TODO: pDir->getDesc(),
m_ocDir.GetRefCount(iDirID)
);
}
void CVADirectivityManager::GetDirectivityInfos(std::vector<CVADirectivityInfo>& vdiDest) {
vdiDest.clear();
vdiDest.reserve(m_ocDir.size());
for (CVAObjectContainer<CVADirectivity>::const_iterator cit=m_ocDir.begin(); cit!=m_ocDir.end(); ++cit) {
vdiDest.push_back( GetDirectivityInfo( cit->first ) );
}
}
void CVADirectivityManager::PrintDirectivityInfos() {
std::vector<CVADirectivityInfo> v;
GetDirectivityInfos(v);
ITAASCIITable t((unsigned int) v.size(), 4);
t.setColumnTitle(0, "ID");
t.setColumnTitle(1, "Name");
t.setColumnTitle(2, "Filename");
t.setColumnTitle(3, "Description");
for (int i=0; i<(int) v.size(); i++) {
t.setContent(i, 0, IntToString(v[i].iID));
t.setContent(i, 1, v[i].sName);
t.setContent(i, 2, v[i].sFilename);
t.setContent(i, 3, v[i].sDesc);
}
VA_INFO("DirMan", t.toString());
}
#ifndef __VA_DIRECTIVITY_MANAGER_H__
#define __VA_DIRECTIVITY_MANAGER_H__
#include <VABaseDefinitions.h>
#include "VAObjectContainer.h"
#include <ITACriticalSection.h>
#include <vector>
class DAFFContentMS;
// Alias fr Directivity-Content
typedef DAFFContentMS CVADirectivity;
/**
* Diese Klasse realisiert die Verwaltungseinheit fr Richtcharakteristiken.
*/
class CVADirectivityManager {
public:
CVADirectivityManager();
virtual ~CVADirectivityManager();
//! Initialisiert den Manager
void Initialize();
//! Schliet den Manager und gibt alle Richtcharakteristik frei
void Finalize();
//! Lscht alle Richtcharakteristiken
void Reset();
//! Ldt eine Richtcharakteristik aus einer Datei und gibt deren ID zurck
/**
* AUFRUFER: Nur User-CF
*/
int LoadDirectivity(const std::string& sFilename, const std::string& sName="");
//! Gibt eine geladene Richtcharakteristik wieder frei
/**
* AUFRUFER: Nur User-CF
*
* Hinweis: Die Richtcharakteristik wird gelscht, falls sie nicht in Benutzung ist
*
* \return true Richtcharakteristik wurde gelscht und deren Speicher freigegeben
* false Richtcharakteristik ist noch in Benutzung und wurde nicht freigegeben
*/
bool FreeDirectivity(int iDirID);
//! Gibt eine Richtcharakteristik zurck und erhht deren Referenzzhler
/**
* AUFRUFER: Nur Core-CF
*/
const CVADirectivity* RequestDirectivity(int iDirID);
//! Dekrementiert den Referenzzhler einer Richtcharakteristik (kein automatisches Lschen)
/**
* AUFRUFER: Nur Core-CF
* \return Anzahl der verbleibenden Referenzen auf die Richtcharakteristik
*/
int ReleaseDirectivity(int iDirID);
//! Gibt die Anzahl an Referenzen (Anzahl benutzende Schallquellen) zurck
int GetDirectivityRefCount(int iDirID) const;
//! Gibt Informationen ber eine geladene Richtcharakteristik zurck
/**
* AUFRUFER: Nur User-CF
*/
CVADirectivityInfo GetDirectivityInfo(int iDirID);
//! Gibt Informationen ber alle geladenen Richtcharakteristiken zurck
/**
* AUFRUFER: Nur User-CF
*/
void GetDirectivityInfos(std::vector<CVADirectivityInfo>& vdiDest);
//! Gibt Informationen ber alle geladenen Richtcharakteristiken auf der Konsole aus
void PrintDirectivityInfos();
private:
CVAObjectContainer<CVADirectivity> m_ocDir; // Zuordnungen ID <-> Datenbank
ITACriticalSection m_csDir;
};