added settings save/load for sound card channel mapping settings

This commit is contained in:
Volker Fischer 2010-03-20 18:36:59 +00:00
parent cdfdd62465
commit c1cd911c56
5 changed files with 63 additions and 11 deletions

View file

@ -1,6 +1,6 @@
3.1.1 3.1.1
- - added input/output audio channel mapping for ASIO audio interface
3.1.0 3.1.0

View file

@ -97,6 +97,12 @@
#define MAX_NUMBER_SOUND_CARDS 10 #define MAX_NUMBER_SOUND_CARDS 10
#define INVALID_SNC_CARD_DEVICE -1 #define INVALID_SNC_CARD_DEVICE -1
// define the maximum number of audio channel for input/output we can store
// channel infos for (and therefore this is the maximum number of entries in
// the channel selection combo box regardless of the actual available number
// of channels by the audio device)
#define MAX_NUM_IN_OUT_CHANNELS 32
// maximum number of elemts in the server address combo box // maximum number of elemts in the server address combo box
#define MAX_NUM_SERVER_ADDR_ITEMS 6 #define MAX_NUM_SERVER_ADDR_ITEMS 6

View file

@ -112,6 +112,38 @@ void CSettings::ReadIniFile ( const QString& sFileName )
pClient->SetSndCrdDev ( INVALID_SNC_CARD_DEVICE ); pClient->SetSndCrdDev ( INVALID_SNC_CARD_DEVICE );
} }
// sound card channel mapping settings: make sure these settings are
// set AFTER the sound card device is set, otherwise the settings are
// overwritten by the defaults
//
// sound card left input channel mapping
if ( GetNumericIniSet ( IniXMLDocument, "client", "sndcrdinlch",
0, MAX_NUM_IN_OUT_CHANNELS - 1, iValue ) )
{
pClient->SetSndCrdLeftInputChannel ( iValue );
}
// sound card right input channel mapping
if ( GetNumericIniSet ( IniXMLDocument, "client", "sndcrdinrch",
0, MAX_NUM_IN_OUT_CHANNELS - 1, iValue ) )
{
pClient->SetSndCrdRightInputChannel ( iValue );
}
// sound card left output channel mapping
if ( GetNumericIniSet ( IniXMLDocument, "client", "sndcrdoutlch",
0, MAX_NUM_IN_OUT_CHANNELS - 1, iValue ) )
{
pClient->SetSndCrdLeftOutputChannel ( iValue );
}
// sound card right output channel mapping
if ( GetNumericIniSet ( IniXMLDocument, "client", "sndcrdoutrch",
0, MAX_NUM_IN_OUT_CHANNELS - 1, iValue ) )
{
pClient->SetSndCrdRightOutputChannel ( iValue );
}
// sound card preferred buffer size index // sound card preferred buffer size index
if ( GetNumericIniSet ( IniXMLDocument, "client", "prefsndcrdbufidx", if ( GetNumericIniSet ( IniXMLDocument, "client", "prefsndcrdbufidx",
FRAME_SIZE_FACTOR_PREFERRED, FRAME_SIZE_FACTOR_SAFE, iValue ) ) FRAME_SIZE_FACTOR_PREFERRED, FRAME_SIZE_FACTOR_SAFE, iValue ) )
@ -194,6 +226,22 @@ void CSettings::WriteIniFile ( const QString& sFileName )
SetNumericIniSet ( IniXMLDocument, "client", "auddevidx", SetNumericIniSet ( IniXMLDocument, "client", "auddevidx",
pClient->GetSndCrdDev() ); pClient->GetSndCrdDev() );
// sound card left input channel mapping
SetNumericIniSet ( IniXMLDocument, "client", "sndcrdinlch",
pClient->GetSndCrdLeftInputChannel() );
// sound card right input channel mapping
SetNumericIniSet ( IniXMLDocument, "client", "sndcrdinrch",
pClient->GetSndCrdRightInputChannel() );
// sound card left output channel mapping
SetNumericIniSet ( IniXMLDocument, "client", "sndcrdoutlch",
pClient->GetSndCrdLeftOutputChannel() );
// sound card right output channel mapping
SetNumericIniSet ( IniXMLDocument, "client", "sndcrdoutrch",
pClient->GetSndCrdRightOutputChannel() );
// sound card preferred buffer size index // sound card preferred buffer size index
SetNumericIniSet ( IniXMLDocument, "client", "prefsndcrdbufidx", SetNumericIniSet ( IniXMLDocument, "client", "prefsndcrdbufidx",
pClient->GetSndCrdPrefFrameSizeFactor() ); pClient->GetSndCrdPrefFrameSizeFactor() );

View file

@ -307,7 +307,8 @@ QString CSound::CheckDeviceCapabilities()
void CSound::SetLeftInputChannel ( const int iNewChan ) void CSound::SetLeftInputChannel ( const int iNewChan )
{ {
// apply parameter after input parameter check // apply parameter after input parameter check
if ( ( iNewChan >= 0 ) && ( iNewChan < lNumInChan ) ) if ( ( iNewChan >= 0 ) && ( iNewChan < lNumInChan ) &&
( iNewChan != vSelectedInputChannels[1] ) )
{ {
vSelectedInputChannels[0] = iNewChan; vSelectedInputChannels[0] = iNewChan;
} }
@ -316,7 +317,8 @@ void CSound::SetLeftInputChannel ( const int iNewChan )
void CSound::SetRightInputChannel ( const int iNewChan ) void CSound::SetRightInputChannel ( const int iNewChan )
{ {
// apply parameter after input parameter check // apply parameter after input parameter check
if ( ( iNewChan >= 0 ) && ( iNewChan < lNumInChan ) ) if ( ( iNewChan >= 0 ) && ( iNewChan < lNumInChan ) &&
( iNewChan != vSelectedInputChannels[0] ) )
{ {
vSelectedInputChannels[1] = iNewChan; vSelectedInputChannels[1] = iNewChan;
} }
@ -325,7 +327,8 @@ void CSound::SetRightInputChannel ( const int iNewChan )
void CSound::SetLeftOutputChannel ( const int iNewChan ) void CSound::SetLeftOutputChannel ( const int iNewChan )
{ {
// apply parameter after input parameter check // apply parameter after input parameter check
if ( ( iNewChan >= 0 ) && ( iNewChan < lNumOutChan ) ) if ( ( iNewChan >= 0 ) && ( iNewChan < lNumOutChan ) &&
( iNewChan != vSelectedOutputChannels[1] ) )
{ {
vSelectedOutputChannels[0] = iNewChan; vSelectedOutputChannels[0] = iNewChan;
} }
@ -334,7 +337,8 @@ void CSound::SetLeftOutputChannel ( const int iNewChan )
void CSound::SetRightOutputChannel ( const int iNewChan ) void CSound::SetRightOutputChannel ( const int iNewChan )
{ {
// apply parameter after input parameter check // apply parameter after input parameter check
if ( ( iNewChan >= 0 ) && ( iNewChan < lNumOutChan ) ) if ( ( iNewChan >= 0 ) && ( iNewChan < lNumOutChan ) &&
( iNewChan != vSelectedOutputChannels[0] ) )
{ {
vSelectedOutputChannels[1] = iNewChan; vSelectedOutputChannels[1] = iNewChan;
} }

View file

@ -43,12 +43,6 @@
// stereo for input and output // stereo for input and output
#define NUM_IN_OUT_CHANNELS 2 #define NUM_IN_OUT_CHANNELS 2
// define the maximum number of audio channel for input/output we can store
// channel infos for (and therefore this is the maximum number of entries in
// the channel selection combo box regardless of the actual available number
// of channels by the audio device)
#define MAX_NUM_IN_OUT_CHANNELS 32
/* Classes ********************************************************************/ /* Classes ********************************************************************/
class CSound : public CSoundBase class CSound : public CSoundBase