From a75670944aa124743b6fef4576ac7c70253925d5 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Thu, 8 Mar 2018 20:03:07 +0000 Subject: [PATCH] possible fix for a crash on MacOS High Sierra (reported in the Jamulus forum) --- mac/sound.cpp | 6 ++++++ src/clientsettingsdlg.cpp | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/mac/sound.cpp b/mac/sound.cpp index 049ac213..3392c00d 100755 --- a/mac/sound.cpp +++ b/mac/sound.cpp @@ -161,6 +161,12 @@ CSound::CSound ( void (*fpNewProcessCallback) ( CVector& psData, void* ar lCurDev = INVALID_SNC_CARD_DEVICE; CurrentAudioInputDeviceID = 0; CurrentAudioOutputDeviceID = 0; + iNumInChan = 0; + iNumOutChan = 0; + iSelInputLeftChannel = 0; + iSelInputRightChannel = 0; + iSelOutputLeftChannel = 0; + iSelOutputRightChannel = 0; } void CSound::GetAudioDeviceInfos ( const AudioDeviceID DeviceID, diff --git a/src/clientsettingsdlg.cpp b/src/clientsettingsdlg.cpp index e940d37a..c5fa6d4f 100755 --- a/src/clientsettingsdlg.cpp +++ b/src/clientsettingsdlg.cpp @@ -542,8 +542,11 @@ void CClientSettingsDlg::UpdateSoundChannelSelectionFrame() cbxLInChan->addItem ( pClient->GetSndCrdInputChannelName ( iSndChanIdx ) ); cbxRInChan->addItem ( pClient->GetSndCrdInputChannelName ( iSndChanIdx ) ); } - cbxLInChan->setCurrentIndex ( pClient->GetSndCrdLeftInputChannel() ); - cbxRInChan->setCurrentIndex ( pClient->GetSndCrdRightInputChannel() ); + if ( pClient->GetSndCrdNumInputChannels() > 0 ) + { + cbxLInChan->setCurrentIndex ( pClient->GetSndCrdLeftInputChannel() ); + cbxRInChan->setCurrentIndex ( pClient->GetSndCrdRightInputChannel() ); + } // output cbxLOutChan->clear(); @@ -553,8 +556,11 @@ void CClientSettingsDlg::UpdateSoundChannelSelectionFrame() cbxLOutChan->addItem ( pClient->GetSndCrdOutputChannelName ( iSndChanIdx ) ); cbxROutChan->addItem ( pClient->GetSndCrdOutputChannelName ( iSndChanIdx ) ); } - cbxLOutChan->setCurrentIndex ( pClient->GetSndCrdLeftOutputChannel() ); - cbxROutChan->setCurrentIndex ( pClient->GetSndCrdRightOutputChannel() ); + if ( pClient->GetSndCrdNumOutputChannels() > 0 ) + { + cbxLOutChan->setCurrentIndex ( pClient->GetSndCrdLeftOutputChannel() ); + cbxROutChan->setCurrentIndex ( pClient->GetSndCrdRightOutputChannel() ); + } } #else // for other OS, no sound card channel selection is supported