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

Adding medium configuration feature

parent 39b9ef19
/*
* --------------------------------------------------------------------------------------------
*
* 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_VA_HOMOGENEOUS_MEDIUM
#define IW_VA_HOMOGENEOUS_MEDIUM
#include <VABase.h>
#include <VAStruct.h>
//! Homogeneous medium definitions
class CVAHomogeneousMedium
{
public:
double dSoundSpeed; //!< Speed of sound in m/s
double dStaticPressurePascal; //!< Static pressure in Pascal
double dTemperatureDegreeCentigrade; //!< Temperature in degree centigrade
double dRelativeHumidityPercent; //!< Relative humidity
VAVec3 v3ShiftSpeed; //!< Medium shift speed in m/s
CVAStruct oParameters; //!< Special parameters, for prototyping
//! Default constructor sets parameters to VA defaults defined in VABase
inline CVAHomogeneousMedium()
{
dSoundSpeed = g_dDefaultSpeedOfSound;
dStaticPressurePascal = g_dDefaultStaticPressure;
dTemperatureDegreeCentigrade = g_dDefaultTemperature;
dRelativeHumidityPercent = g_dDefaultRelativeHumidity;
v3ShiftSpeed.Set( 0.0f, 0.0f, 0.0f );
};
};
#endif // IW_VA_HOMOGENEOUS_MEDIUM
set( RelativeDir "src/Medium" )
set( RelativeSourceGroup "Source Files\\Medium" )
set( DirFiles
VAHomogeneousMedium.h
_SourceFiles.cmake
)
set( DirFiles_SourceGroup "${RelativeSourceGroup}" )
set( LocalSourceGroupFiles )
foreach( File ${DirFiles} )
list( APPEND LocalSourceGroupFiles "${RelativeDir}/${File}" )
list( APPEND ProjectSources "${RelativeDir}/${File}" )
endforeach()
source_group( ${DirFiles_SourceGroup} FILES ${LocalSourceGroupFiles} )
# $Id:$
set( RelativeDir "src/Motion" )
set( RelativeSourceGroup "Source Files\\Motion" )
......
......@@ -768,7 +768,7 @@ void CVABinauralArtificialReverbAudioRenderer::ProcessStream( const ITAStreamInf
pPath->UpdateMetrics();
// VDL delay
assert( m_dSpeedOfSound > 0 );
assert( m_pCore->oHomogeneousMedium.dSoundSpeed > 0 );
double dDelay = pPath->oRelations.dDistance / m_pCore->oHomogeneousMedium.dSoundSpeed;
pPath->pVariableDelayLine->SetDelayTime( float( dDelay ) );
......
......@@ -98,6 +98,11 @@ void CVACoreConfig::Init( const CVAStruct& oData )
conf.OptBool( "Debug/OutputRecordEnabled", bRecordDeviceOutputEnabled, false );
conf.OptString( "Debug/OutputRecordFilePath", sRecordFinalOutputFilePath );
sRecordFinalOutputFilePath = mMacros.SubstituteMacros( sRecordFinalOutputFilePath );
conf.OptNumber( "HomogeneousMedium/DefaultRelativeHumidity", oInitialHomogeneousMedium.dRelativeHumidityPercent, g_dDefaultRelativeHumidity );
conf.OptNumber( "HomogeneousMedium/DefaultSoundSpeed", oInitialHomogeneousMedium.dSoundSpeed, g_dDefaultSpeedOfSound );
conf.OptNumber( "HomogeneousMedium/DefaultStaticPressure", oInitialHomogeneousMedium.dStaticPressurePascal, g_dDefaultStaticPressure );
conf.OptNumber( "HomogeneousMedium/DefaultTemperature", oInitialHomogeneousMedium.dTemperatureDegreeCentigrade, g_dDefaultTemperature );
}
const CVAStruct& CVACoreConfig::GetStruct() const
......
......@@ -19,6 +19,7 @@
#include "Reproduction/VAAudioReproductionModule.h"
#include "VAHardwareSetup.h"
#include "VAMacroMap.h"
#include "Medium/VAHomogeneousMedium.h"
#include <VAStruct.h>
......@@ -31,8 +32,8 @@ class CVACoreImpl;
class CVACoreConfig
{
public:
CVAAudioDriverConfig oAudioDriverConfig; //!< Audio interface
CVAHardwareSetup oHardwareSetup; //!< Reproduction hardware setup
CVAAudioDriverConfig oAudioDriverConfig; //!< Initial audio interface settings
CVAHardwareSetup oHardwareSetup; //!< Initial reproduction hardware setup
CVAMacroMap mMacros; //!< Macros used in configuration file
std::vector< std::string > vsSearchPaths; //!< Search paths (existing directories only)
......@@ -45,6 +46,8 @@ public:
int iTriggerUpdateMilliseconds;
CVAHomogeneousMedium oInitialHomogeneousMedium; //!< Initial homogeneous medium information
//! Initialize the configuration with a struct
/**
* \note: Errors are forwarded as exceptions, see \CVAException
......
......@@ -487,12 +487,20 @@ void CVACoreImpl::Initialize() {
m_pDirectivityManager = new CVADirectivityManager( this, m_oCoreConfig.oAudioDriverConfig.dSampleRate );
m_pDirectivityManager->Initialize();
SetProgress( "Setting up scene management", "", 3 );
m_pSceneManager = new CVASceneManager( m_pClock );
m_pSceneManager->Initialize();
m_pCurSceneState = m_pSceneManager->GetHeadSceneState();
SetProgress( "Setting up medium environment", "", 4 );
oHomogeneousMedium = m_oCoreConfig.oInitialHomogeneousMedium;
SetProgress( "Initializing rendering modules", "", 5 );
// Register all renderers and initialize
CVAAudioRendererRegistry::GetInstance()->RegisterInternalCoreFactoryMethods();
InitializeAudioRenderers();
......@@ -500,6 +508,7 @@ void CVACoreImpl::Initialize() {
if( m_voRenderers.empty() )
VA_EXCEPT1( "No audio renderers created" );
SetProgress( "Initializing reproduction modules", "", 6 );
// Register all reproductions and initialize
......@@ -509,20 +518,15 @@ void CVACoreImpl::Initialize() {
if( m_voReproductionModules.empty() )
VA_EXCEPT1( "No audio reproduction modules created" );
SetProgress( "Patching audio i/o of rendering and reproduction modules", "", 7 );
// Patch renderer and reproduction modules
PatchRendererToReproductionModules();
// Patch audio reproduction to output
// TODO:
//SetProgress( "Patching audio modules", "", 7 );
PatchReproductionModulesToOutput();
/* Wire the global sampler (1:N)
int iGlobalSamplerInput = m_pOutputPatchbay->AddInput( m_pGlobalSampler );
int iNumPhysicalOutputChannels = m_pOutputPatchbay->GetOutputNumChannels( iPhysicalHardwareOutput );
for( int i=0; i<iNumPhysicalOutputChannels; i++ )
m_pOutputPatchbay->ConnectChannels( iGlobalSamplerInput, 0, iPhysicalHardwareOutput, i );
*/
// Create output peak detector that uses patch bay output stream
m_pOutputStreamDetector = new ITAStreamDetector( m_pOutputPatchbay->GetOutputDatasource( iPhysicalHardwareOutput ) );
......@@ -553,7 +557,7 @@ void CVACoreImpl::Initialize() {
m_pTicker->SetAfterPulseFunctor( this );
// Audio-Streaming starten
SetProgress( "Starting audio streaming", "", 7 );
SetProgress( "Starting audio streaming", "", 8 );
m_pAudioDriverBackend->startStreaming();
// Timer fr Peak-Events starten
......@@ -562,7 +566,7 @@ void CVACoreImpl::Initialize() {
// Initialisierung erfolgreich!
m_iState = VA_CORESTATE_READY;
SetProgress( "Initialization finished", "", 8 );
SetProgress( "Initialization finished", "", 9 );
FinishProgress();
}
......@@ -877,7 +881,7 @@ void CVACoreImpl::GetModules( std::vector< CVAModuleInfo >& viModuleInfos ) cons
#endif // VACORE_MODULE_INTERFACE_ENABLED
}
}
CVAStruct CVACoreImpl::CallModule( const std::string& sModuleName, const CVAStruct& oArgs )
{
......@@ -920,7 +924,7 @@ CVAStruct CVACoreImpl::CallModule( const std::string& sModuleName, const CVAStru
#endif // VACORE_NO_MODULE_INTERFACE_THROW_EXCEPTION
#endif // VACORE_MODULE_INTERFACE_ENABLED
}
}
CVAStruct CVACoreImpl::GetSearchPaths() const
{
......
......@@ -28,6 +28,8 @@
#include "Scene/VASceneState.h"
#include "Rendering/VAAudioRenderer.h"
#include "Medium/VAHomogeneousMedium.h"
#include <VistaInterProcComm/Concurrency/VistaMutex.h>
#include <VistaInterProcComm/Concurrency/VistaTicker.h>
......@@ -309,27 +311,7 @@ public:
bool IsStreaming() const;
//! Homogeneous medium definitions
struct CVAHomogeneousMedium
{
double dSoundSpeed; //!< Speed of sound in m/s
double dStaticPressurePascal; //!< Static pressure in Pascal
double dTemperatureDegreeCentigrade; //!< Temperature in degree centigrade
double dRelativeHumidityPercent; //!< Relative humidity
VAVec3 v3ShiftSpeed; //!< Medium shift speed in m/s
CVAStruct oParameters; //!< Special parameters, for prototyping
inline CVAHomogeneousMedium()
{
dSoundSpeed = g_dDefaultSpeedOfSound;
dStaticPressurePascal = g_dDefaultStaticPressure;
dTemperatureDegreeCentigrade = g_dDefaultTemperature;
dRelativeHumidityPercent = g_dDefaultRelativeHumidity;
v3ShiftSpeed.Set( 0.0f, 0.0f, 0.0f );
}
} oHomogeneousMedium;
CVAHomogeneousMedium oHomogeneousMedium;
private:
......
# $Id:$
set( RelativeDir "src" )
set( RelativeSourceGroup "Source Files" )
set( SubDirs Audiosignals directivities Drivers Filtering Motion Rendering Reproduction Scene Utils )
set( SubDirs Audiosignals directivities Drivers Filtering Medium Motion Rendering Reproduction Scene Utils )
set( DirFiles
VAAudiostreamTracker.h
......
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