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

Implementing API changes for repros and renderings, but still refactoring required

parent 7fab8f32
......@@ -20,7 +20,8 @@ class IVADirectivity;
class ITADatasource;
class CVACoreImpl;
class CVASceneState;
class CVAStruct;
#include <VA.h>
#include <string>
#include <vector>
......@@ -61,26 +62,16 @@ public:
virtual inline void PostLoadHRIRDataset( const IVADirectivity* ) {};
virtual inline void PreFreeHRIRDataset( const IVADirectivity* ) {};
// --= Update methods =--
//! Handle a scene change
virtual void UpdateScene( CVASceneState* pNewSceneState ) = 0;
//! Handle global auralisation mode change
// @todo refactor.
virtual void UpdateGlobalAuralizationMode( int iGlobalAuralisationMode ) = 0;
virtual inline int GetAuralizationMode() { return IVAInterface::VA_AURAMODE_ALL; };
// --= Audio streaming =--
virtual inline void SetParameters( const CVAStruct& ) {};
virtual inline CVAStruct GetParameters( const CVAStruct& ) const { return CVAStruct(); };
virtual ITADatasource* GetOutputDatasource() = 0;
/*
TODO:
Parameter abfrage ...
Module Interface ...
*/
};
......
......@@ -68,6 +68,9 @@ public:
//! Receive scene updates from core
virtual void UpdateScene( CVASceneState* pNewState )=0;
virtual inline void SetParameters( const CVAStruct& ) {};
virtual inline CVAStruct GetParameters( const CVAStruct& ) const { return CVAStruct(); };
protected:
IVAAudioReproductionModule() {};
};
......
......@@ -1506,7 +1506,7 @@ void CVACoreImpl::SetSignalSourceBufferPlaybackAction( const std::string& sSigna
VA_TRY
{
if( !IsValidAudiofileSignalSourcePlaybackAction( iPlaybackAction ) )
if( !GetSignalSourceBufferPlaybackActionValid( iPlaybackAction ) )
VA_EXCEPT2( INVALID_PARAMETER, "Invalid playback action" );
IVAAudioSignalSource* pSource = m_pSignalSourceMan->RequestSignalSource( sSignalSourceID );
......@@ -2168,7 +2168,7 @@ void CVACoreImpl::SetSoundSourceAuralizationMode( int iSoundSourceID, int iAural
VA_TRY
{
// Parameter berprfen
if( !IsValidAuralizationMode( iAuralizationMode ) )
if( !GetAuralizationModeValid( iAuralizationMode ) )
VA_EXCEPT2( INVALID_PARAMETER, "Invalid auralization mode" );
bool bSync = GetUpdateLocked();
......@@ -2344,7 +2344,7 @@ void CVACoreImpl::SetSoundSourceSoundPower( const int iSoundSourceID, const doub
VA_TRY
{
// Parameter berprfen
if( !IsValidVolume( dSoundPower ) )
if( !GetVolumeValid( dSoundPower ) )
VA_EXCEPT2( INVALID_PARAMETER, "Invalid volume" );
bool bSync = GetUpdateLocked();
......@@ -2839,7 +2839,7 @@ void CVACoreImpl::SetSoundReceiverAuralizationMode( const int iID, const int iAu
VA_TRY
{
// Parameter berprfen
if( !IsValidAuralizationMode( iAuralizationMode ) )
if( !GetAuralizationModeValid( iAuralizationMode ) )
VA_EXCEPT2( INVALID_PARAMETER, "Invalid auralization mode" );
bool bSync = GetUpdateLocked();
......@@ -3601,7 +3601,7 @@ void CVACoreImpl::SetInputGain( double dGain )
VA_TRY
{
if( !IsValidVolume( dGain ) )
if( !GetVolumeValid( dGain ) )
VA_EXCEPT2( INVALID_PARAMETER, "Invalid gain" );
if( m_dInputGain == dGain )
......@@ -3647,7 +3647,7 @@ void CVACoreImpl::SetOutputGain( const double dGain )
VA_TRY
{
if( !IsValidVolume( dGain ) )
if( !GetVolumeValid( dGain ) )
VA_EXCEPT2( INVALID_PARAMETER, "Invalid gain" );
if( m_dOutputGain == dGain )
......@@ -3725,7 +3725,7 @@ void CVACoreImpl::SetGlobalAuralizationMode( const int iAuralizationMode )
VA_TRY
{
if( !IsValidAuralizationMode( iAuralizationMode ) )
if( !GetAuralizationModeValid( iAuralizationMode ) )
VA_EXCEPT2( INVALID_PARAMETER, "Invalid auralization mode" );
if( m_iGlobalAuralizationMode == iAuralizationMode )
......@@ -4743,6 +4743,34 @@ double CVACoreImpl::GetRenderingModuleGain( const std::string& sModuleID ) const
return 0.0f;
}
void CVACoreImpl::SetRenderingModuleAuralizationMode( const std::string& sModuleID, const int iAM )
{
for( size_t n = 0; n < m_voRenderers.size(); n++ )
{
const CVAAudioRendererDesc& oRend( m_voRenderers[ n ] );
if( oRend.sID == sModuleID )
{
oRend.pInstance->UpdateGlobalAuralizationMode( iAM );
return;
}
}
VA_ERROR( "Core", "Could not find rendering module '" << sModuleID << "'" );
}
int CVACoreImpl::GetRenderingModuleAuralizationMode( const std::string& sModuleID ) const
{
for( size_t n = 0; n < m_voRenderers.size(); n++ )
{
const CVAAudioRendererDesc& oRend( m_voRenderers[ n ] );
if( oRend.sID == sModuleID )
return oRend.pInstance->GetAuralizationMode();
}
VA_ERROR( "Core", "Could not find rendering module '" << sModuleID << "'" );
return 0.0f;
}
bool CVACoreImpl::GetRenderingModuleMuted( const std::string& sModuleID ) const
{
for( size_t n = 0; n < m_voRenderers.size(); n++ )
......@@ -4827,6 +4855,35 @@ void CVACoreImpl::GetRenderingModules( std::vector< CVAAudioRendererInfo >& vRen
}
}
void CVACoreImpl::SetReproductionModuleParameters( const std::string& sModuleID, const CVAStruct& oParams )
{
for( size_t n = 0; n < m_voReproductionModules.size(); n++ )
{
const CVAAudioReproductionModuleDesc& oRep( m_voReproductionModules[ n ] );
if( oRep.sID == sModuleID )
{
oRep.pInstance->SetParameters( oParams );
return;
}
}
VA_ERROR( "Core", "Could not find Reproduction module '" << sModuleID << "'" );
}
CVAStruct CVACoreImpl::GetReproductionModuleParameters( const std::string& sModuleID, const CVAStruct& oParams ) const
{
for( size_t n = 0; n < m_voReproductionModules.size(); n++ )
{
const CVAAudioReproductionModuleDesc& oRep( m_voReproductionModules[ n ] );
if( oRep.sID == sModuleID )
return oRep.pInstance->GetParameters( oParams );
}
VA_ERROR( "Core", "Could not find Reproduction module '" << sModuleID << "'" );
return CVAStruct();
}
void CVACoreImpl::GetReproductionModules( std::vector< CVAAudioReproductionInfo >& vRepros, const bool bFilterEnabled /* = true */ ) const
{
vRepros.clear();
......@@ -4840,4 +4897,32 @@ void CVACoreImpl::GetReproductionModules( std::vector< CVAAudioReproductionInfo
if( !bFilterEnabled || oRepInfo.bEnabled )
vRepros.push_back( oRepInfo );
}
}
\ No newline at end of file
}
void CVACoreImpl::SetRenderingModuleParameters( const std::string& sModuleID, const CVAStruct& oParams )
{
for( size_t n = 0; n < m_voRenderers.size(); n++ )
{
const CVAAudioRendererDesc& oRend( m_voRenderers[ n ] );
if( oRend.sID == sModuleID )
{
oRend.pInstance->SetParameters( oParams );
return;
}
}
VA_ERROR( "Core", "Could not find rendering module '" << sModuleID << "'" );
}
CVAStruct CVACoreImpl::GetRenderingModuleParameters( const std::string& sModuleID, const CVAStruct& oParams ) const
{
for( size_t n = 0; n < m_voRenderers.size(); n++ )
{
const CVAAudioRendererDesc& oRend( m_voRenderers[ n ] );
if( oRend.sID == sModuleID )
return oRend.pInstance->GetParameters( oParams );
}
VA_ERROR( "Core", "Could not find rendering module '" << sModuleID << "'" );
return CVAStruct();
}
......@@ -258,10 +258,14 @@ public:
// Rendering
void GetRenderingModules( std::vector< CVAAudioRendererInfo >&, const bool ) const;
void SetRenderingModuleMuted( const std::string& sModuleID, const bool bMuted );
double GetRenderingModuleGain( const std::string& sModuleID ) const;
void SetRenderingModuleGain( const std::string& sModuleID, const double dGain );
bool GetRenderingModuleMuted( const std::string& sModuleID ) const;
void SetRenderingModuleMuted( const std::string& sModuleID, const bool bMuted );
void SetRenderingModuleParameters( const std::string& sModuleID, const CVAStruct& oParams );
CVAStruct GetRenderingModuleParameters( const std::string& sModuleID, const CVAStruct& oParams ) const;
int GetRenderingModuleAuralizationMode( const std::string& sModuleID ) const;
void SetRenderingModuleAuralizationMode( const std::string& sModuleID, const int iAuralizationMode );
// Reproduction
void GetReproductionModules( std::vector< CVAAudioReproductionInfo >&, const bool ) const;
......@@ -269,6 +273,8 @@ public:
double GetReproductionModuleGain( const std::string& sModuleID ) const;
void SetReproductionModuleGain( const std::string& sModuleID, const double dGain );
bool GetReproductionModuleMuted( const std::string& sModuleID ) const;
void SetReproductionModuleParameters( const std::string& sModuleID, const CVAStruct& oParams );
CVAStruct GetReproductionModuleParameters( const std::string& sModuleID, const CVAStruct& oParams ) const;
// Global controls
bool GetInputMuted() const;
......
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