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

Improving hardware initialization information output and storing auto-init...

Improving hardware initialization information output and storing auto-init information into vacore audio hardware config.
parent 1f100ac1
......@@ -71,6 +71,7 @@
// STL includes
#include <algorithm>
#include <iomanip>
#include <iostream>
/*
......@@ -857,7 +858,7 @@ void CVACoreImpl::EnumerateModules(std::vector<CVAModuleInfo>& viModuleInfos) co
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
#if (VACORE_ENABLE_MODULE_INTERFACE==1)
#if ( VACORE_MODULE_INTERFACE_ENABLED == 1 )
VA_TRY {
std::vector<CVAObjectInfo> v;
m_oModules.GetObjectInfos(v);
......@@ -872,16 +873,16 @@ void CVACoreImpl::EnumerateModules(std::vector<CVAModuleInfo>& viModuleInfos) co
viModuleInfos[i].sDesc = v[i].sDesc;
}
} VA_RETHROW;
#else
#else // VACORE_MODULE_INTERFACE_ENABLED
VA_EXCEPT1("This VACore version does not provide modules");
#endif
#endif // VACORE_MODULE_INTERFACE_ENABLED
}
void CVACoreImpl::CallModule(const std::string& sModuleName, const CVAStruct& oArgs, CVAStruct& oReturn) {
VA_NO_REENTRANCE;
VA_CHECK_INITIALIZED;
#if ( DVACORE_MODULE_INTERFACE_ENABLED == 1 )
#if ( VACORE_MODULE_INTERFACE_ENABLED == 1 )
VA_TRY {
CVAObject* pModule = m_oModules.FindObjectByName(sModuleName);
if (!pModule)
......@@ -889,14 +890,14 @@ void CVACoreImpl::CallModule(const std::string& sModuleName, const CVAStruct& oA
pModule->CallObject(oArgs, oReturn);
} VA_RETHROW;
#else
#if ( DVACORE_NO_MODULE_INTERFACE_THROW_EXCEPTION == 1 )
#else // VACORE_MODULE_INTERFACE_ENABLED
#if ( VACORE_NO_MODULE_INTERFACE_THROW_EXCEPTION == 1 )
VA_EXCEPT1("This VACore version does not provide modules");
#else
// Ignore. No return values.
oReturn.Clear();
#endif
#endif
#endif // VACORE_MODULE_INTERFACE_ENABLED
}
/* +----------------------------------------------------------+ *
......@@ -3882,25 +3883,39 @@ void CVACoreImpl::PrintSceneState() {
* +----------------------------------------------------------+ */
void CVACoreImpl::InitializeAudioDriver() {
if (m_oCoreConfig.oAudioDriverConfig.sDriver == "ASIO")
m_pAudioDriverBackend = new CVAASIOBackend(&m_oCoreConfig.oAudioDriverConfig);
else if (m_oCoreConfig.oAudioDriverConfig.sDriver == "Portaudio")
m_pAudioDriverBackend = new CVAPortaudioBackend(&m_oCoreConfig.oAudioDriverConfig);
void CVACoreImpl::InitializeAudioDriver()
{
if( m_oCoreConfig.oAudioDriverConfig.sDriver == "ASIO" )
m_pAudioDriverBackend = new CVAASIOBackend( &m_oCoreConfig.oAudioDriverConfig );
else if( m_oCoreConfig.oAudioDriverConfig.sDriver == "Portaudio" )
m_pAudioDriverBackend = new CVAPortaudioBackend( &m_oCoreConfig.oAudioDriverConfig );
else
VA_ERROR("Core", "Unkown audio driver backend '" << m_oCoreConfig.oAudioDriverConfig.sDriver << "'");
VA_ERROR( "Core", "Unkown audio driver backend '" << m_oCoreConfig.oAudioDriverConfig.sDriver << "'" );
try {
VA_INFO("Core", "Initializing audio device \"" << m_oCoreConfig.oAudioDriverConfig.sDevice <<
"\" [" << m_oCoreConfig.oAudioDriverConfig.sDriver << "]");
VA_INFO("Core", "(Samplerate " << m_oCoreConfig.oAudioDriverConfig.dSamplerate << " Hz, " <<
m_oCoreConfig.oAudioDriverConfig.iInputChannels << " inputs, " <<
m_oCoreConfig.oAudioDriverConfig.iOutputChannels << " outputs, buffersize " <<
(m_oCoreConfig.oAudioDriverConfig.iBuffersize == 0 ? "auto" : IntToString(m_oCoreConfig.oAudioDriverConfig.iBuffersize)) << ")");
try
{
VA_INFO( "Core", "Initializing audio device '" << m_pAudioDriverBackend->getDeviceName() << "' using '" << m_pAudioDriverBackend->getDriverName() << "' driver" );
VA_TRACE( "Core", "Desired settings: sampling rate " << m_oCoreConfig.oAudioDriverConfig.dSamplerate << " Hz, " <<
( m_oCoreConfig.oAudioDriverConfig.iInputChannels == CVAAudioDriverConfig::AUTO ? "all" : std::to_string( m_oCoreConfig.oAudioDriverConfig.iInputChannels ) ) << " inputs, " <<
( m_oCoreConfig.oAudioDriverConfig.iOutputChannels == CVAAudioDriverConfig::AUTO ? "all" : std::to_string( m_oCoreConfig.oAudioDriverConfig.iOutputChannels ) ) << " outputs, " <<
"buffer size = " << ( m_oCoreConfig.oAudioDriverConfig.iBuffersize == 0 ? "auto" : std::to_string( m_oCoreConfig.oAudioDriverConfig.iBuffersize ) ) );
m_pAudioDriverBackend->initialize();
} catch (...) {
m_oCoreConfig.oAudioDriverConfig.dSamplerate = m_pAudioDriverBackend->getOutputStreamProperties()->dSamplerate;
m_oCoreConfig.oAudioDriverConfig.iInputChannels = m_pAudioDriverBackend->getNumberOfInputs();
m_oCoreConfig.oAudioDriverConfig.iOutputChannels = m_pAudioDriverBackend->getOutputStreamProperties()->uiChannels;
m_oCoreConfig.oAudioDriverConfig.iBuffersize = m_pAudioDriverBackend->getOutputStreamProperties()->uiBlocklength;
VA_INFO( "Core", "Audio device successfully initialized." );
VA_VERBOSE( "Core", "Streaming at " << std::fixed << std::setw( 3 ) << std::setprecision( 1 ) << ( m_oCoreConfig.oAudioDriverConfig.dSamplerate / 1000.0f ) << " kHz on " <<
m_oCoreConfig.oAudioDriverConfig.iInputChannels << " inputs and " << m_oCoreConfig.oAudioDriverConfig.iOutputChannels <<
" outputs with a buffer size of " << m_oCoreConfig.oAudioDriverConfig.iBuffersize << " samples." );
}
catch (...)
{
delete m_pAudioDriverBackend;
m_pAudioDriverBackend = nullptr;
......
Supports Markdown
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