Skip to content
Snippets Groups Projects
Commit 3e1c0390 authored by Dipl.-Ing. Jonas Stienen's avatar Dipl.-Ing. Jonas Stienen
Browse files

Setting output channel number after init in Portaudio (was skipped), also some style changes.

Current streaming output is now at log level "info" and not "trace".
parent 04736e33
Branches
Tags
No related merge requests found
......@@ -20,7 +20,6 @@ CVAPortaudioBackend::CVAPortaudioBackend(CVAAudioDriverConfig* pConfig)
if ( m_pConfig->iBuffersize <= 0 )
m_pConfig->iBuffersize = ITAPortaudioInterface::GetPreferredBufferSize();
// ITAPortaudioInterface erzeugen
m_pITAPA = new ITAPortaudioInterface( m_pConfig->dSamplerate, m_pConfig->iBuffersize );
// An diesen Einstellungen ist nicht mehr zu drehen ...
......@@ -37,7 +36,7 @@ CVAPortaudioBackend::~CVAPortaudioBackend()
std::string CVAPortaudioBackend::getDriverName() const
{
return "PortAudio";
return "Portaudio";
}
std::string CVAPortaudioBackend::getDeviceName() const
......@@ -75,22 +74,29 @@ void CVAPortaudioBackend::initialize()
#endif // USE_MEDIATOR_THREAD
}
void CVAPortaudioBackend::threadInitialize() {
void CVAPortaudioBackend::threadInitialize()
{
ITAPortaudioInterface::ITA_PA_ERRORCODE e;
int iDriverID = -1;
try {
try
{
iDriverID = StringToInt( m_pConfig->sDevice );
} catch( ITAException& e) {
}
catch( ITAException& e )
{
if( e.iErrorCode != ITAException::PARSE_ERROR )
throw e;
}
if (iDriverID == -1) {
if( iDriverID == -1 )
{
if( ( e = m_pITAPA->Initialize() ) != ITAPortaudioInterface::ITA_PA_NO_ERROR )
ITA_EXCEPT1( INVALID_PARAMETER, ITAPortaudioInterface::GetErrorCodeString( e ).c_str() );
iDriverID = m_pITAPA->GetDefaultOutputDevice(); // Schneller, wenn Portaudio initialisiert ist
} else {
}
else
{
if( ( e = m_pITAPA->Initialize( iDriverID ) ) != ITAPortaudioInterface::ITA_PA_NO_ERROR )
ITA_EXCEPT1( INVALID_PARAMETER, ITAPortaudioInterface::GetErrorCodeString( e ).c_str() );
}
......@@ -109,9 +115,7 @@ void CVAPortaudioBackend::threadInitialize() {
ITA_EXCEPT1( INVALID_PARAMETER, "Samplerate " + DoubleToString( m_pConfig->dSamplerate ) + " is invalid for this audio device." );
m_oOutputStreamProps.uiBlocklength = ( unsigned int ) m_pConfig->iBuffersize;
//m_oOutputStreamProps.uiChannels = m_pITAPA->GetNumOutputChannels(iDriverID);
// TODO: (FWE) Bitte prfen, ob die Buffersize von PortAudio wirklich so genommen wird.
m_oOutputStreamProps.uiChannels = ( unsigned int )m_pITAPA->GetNumOutputChannels( iDriverID );
}
void CVAPortaudioBackend::finalize()
......
......@@ -3908,9 +3908,9 @@ void CVACoreImpl::InitializeAudioDriver()
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 <<
VA_INFO( "Core", "Streaming at " << std::fixed << std::setw( 3 ) << std::setprecision( 1 ) << ( m_oCoreConfig.oAudioDriverConfig.dSamplerate / 1000.0f ) << " kHz on " <<
( m_oCoreConfig.oAudioDriverConfig.iInputChannels == 0 ? "no" : std::to_string( m_oCoreConfig.oAudioDriverConfig.iInputChannels ) ) << " inputs and " <<
( m_oCoreConfig.oAudioDriverConfig.iOutputChannels == 0 ? "no" : std::to_string( m_oCoreConfig.oAudioDriverConfig.iOutputChannels ) ) <<
" outputs with a buffer size of " << m_oCoreConfig.oAudioDriverConfig.iBuffersize << " samples." );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment