support for storing fader tags/levels in settings file

This commit is contained in:
Volker Fischer 2013-02-28 20:54:47 +00:00
parent b8759620ef
commit 797a991417
7 changed files with 87 additions and 25 deletions

View file

@ -38,11 +38,6 @@
#include "util.h" #include "util.h"
/* Definitions ****************************************************************/
// audio mixer fader range
#define AUD_MIX_FADER_MAX 100
/* Classes ********************************************************************/ /* Classes ********************************************************************/
class CChannelFader : public QObject class CChannelFader : public QObject
{ {
@ -105,6 +100,10 @@ public:
void SetServerName ( const QString& strNewServerName ); void SetServerName ( const QString& strNewServerName );
void SetGUIDesign ( const EGUIDesign eNewDesign ); void SetGUIDesign ( const EGUIDesign eNewDesign );
// settings
CVector<QString> vecStoredFaderTags;
CVector<int> vecStoredFaderLevels;
protected: protected:
int GetStoredFaderLevel ( const CChannelInfo& ChanInfo ); int GetStoredFaderLevel ( const CChannelInfo& ChanInfo );
void StoreFaderLevel ( CChannelFader* pChanFader ); void StoreFaderLevel ( CChannelFader* pChanFader );
@ -115,9 +114,6 @@ protected:
CVector<CChannelFader*> vecpChanFader; CVector<CChannelFader*> vecpChanFader;
QHBoxLayout* pMainLayout; QHBoxLayout* pMainLayout;
CVector<QString> vecStoredFaderTags;
CVector<int> vecStoredFaderGains;
public slots: public slots:
// CODE TAG: MAX_NUM_CHANNELS_TAG // CODE TAG: MAX_NUM_CHANNELS_TAG
// make sure we have MAX_NUM_CHANNELS connections!!! // make sure we have MAX_NUM_CHANNELS connections!!!

View file

@ -29,6 +29,8 @@
CClient::CClient ( const quint16 iPortNumber ) : CClient::CClient ( const quint16 iPortNumber ) :
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ), vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ),
ChannelInfo (), ChannelInfo (),
vecStoredFaderTags ( MAX_NUM_STORED_FADER_LEVELS, "" ),
vecStoredFaderLevels ( MAX_NUM_STORED_FADER_LEVELS, AUD_MIX_FADER_MAX ),
Channel ( false ), /* we need a client channel -> "false" */ Channel ( false ), /* we need a client channel -> "false" */
eAudioCompressionType ( CT_OPUS ), eAudioCompressionType ( CT_OPUS ),
iCeltNumCodedBytes ( CELT_NUM_BYTES_MONO_NORMAL_QUALITY ), iCeltNumCodedBytes ( CELT_NUM_BYTES_MONO_NORMAL_QUALITY ),

View file

@ -244,6 +244,8 @@ public:
// settings // settings
CVector<QString> vstrIPAddress; CVector<QString> vstrIPAddress;
CChannelCoreInfo ChannelInfo; CChannelCoreInfo ChannelInfo;
CVector<QString> vecStoredFaderTags;
CVector<int> vecStoredFaderLevels;
#ifdef LLCON_VST_PLUGIN #ifdef LLCON_VST_PLUGIN
// VST version must have direct access to sound object // VST version must have direct access to sound object

View file

@ -139,6 +139,9 @@ LED bar: lbr
// default network buffer size // default network buffer size
#define DEF_NET_BUF_SIZE_NUM_BL 10 // number of blocks #define DEF_NET_BUF_SIZE_NUM_BL 10 // number of blocks
// audio mixer fader maximum value
#define AUD_MIX_FADER_MAX 100
// maximum number of recognized sound cards installed in the system, // maximum number of recognized sound cards installed in the system,
// definition for "no device" // definition for "no device"
#define MAX_NUMBER_SOUND_CARDS 30 #define MAX_NUMBER_SOUND_CARDS 30

View file

@ -232,6 +232,10 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
// reset mixer board // reset mixer board
MainMixerBoard->HideAll(); MainMixerBoard->HideAll();
// restore fader settings
MainMixerBoard->vecStoredFaderTags = pClient->vecStoredFaderTags;
MainMixerBoard->vecStoredFaderLevels = pClient->vecStoredFaderLevels;
// init fader tag line edit and instrument picture // init fader tag line edit and instrument picture
edtFaderTag->setText ( pClient->ChannelInfo.strName ); edtFaderTag->setText ( pClient->ChannelInfo.strName );
butInstPicture->setIcon ( QIcon ( butInstPicture->setIcon ( QIcon (
@ -481,6 +485,13 @@ void CLlconClientDlg::closeEvent ( QCloseEvent* Event )
// store fader tag // store fader tag
pClient->ChannelInfo.strName = edtFaderTag->text(); pClient->ChannelInfo.strName = edtFaderTag->text();
// store mixer fader settings (we have to hide all mixer faders first to
// initiate a storage of the current mixer fader levels in case we are
// just in a connected state)
MainMixerBoard->HideAll();
pClient->vecStoredFaderTags = MainMixerBoard->vecStoredFaderTags;
pClient->vecStoredFaderLevels = MainMixerBoard->vecStoredFaderLevels;
// default implementation of this event handler routine // default implementation of this event handler routine
Event->accept(); Event->accept();
} }
@ -862,7 +873,7 @@ void CLlconClientDlg::ConnectDisconnect ( const bool bDoStart,
{ {
// store new address at the top of the list, if the list was already // store new address at the top of the list, if the list was already
// full, the last element is thrown out // full, the last element is thrown out
pClient->vstrIPAddress.AddStringFiFoWithCompare ( strSelectedAddress ); pClient->vstrIPAddress.StringFiFoWithCompare ( strSelectedAddress );
} }
// everything was ok with the connection dialog, set flag // everything was ok with the connection dialog, set flag

View file

@ -28,6 +28,7 @@
/* Implementation *************************************************************/ /* Implementation *************************************************************/
void CSettings::Load() void CSettings::Load()
{ {
int iIdx;
int iValue; int iValue;
bool bValue; bool bValue;
QDomDocument IniXMLDocument; QDomDocument IniXMLDocument;
@ -50,19 +51,38 @@ void CSettings::Load()
// client: // client:
// IP addresses // IP addresses
for ( int iIPAddrIdx = 0; iIPAddrIdx < MAX_NUM_SERVER_ADDR_ITEMS; iIPAddrIdx++ ) for ( iIdx = 0; iIdx < MAX_NUM_SERVER_ADDR_ITEMS; iIdx++ )
{ {
QString sDefaultIP = ""; QString sDefaultIP = "";
// use default only for first entry // use default only for first entry
if ( iIPAddrIdx == 0 ) if ( iIdx == 0 )
{ {
sDefaultIP = DEFAULT_SERVER_ADDRESS; sDefaultIP = DEFAULT_SERVER_ADDRESS;
} }
pClient->vstrIPAddress[iIPAddrIdx] = pClient->vstrIPAddress[iIdx] =
GetIniSetting ( IniXMLDocument, "client", GetIniSetting ( IniXMLDocument, "client",
QString ( "ipaddress%1" ).arg ( iIPAddrIdx ), sDefaultIP ); QString ( "ipaddress%1" ).arg ( iIdx ), sDefaultIP );
}
// stored fader tags
for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ )
{
pClient->vecStoredFaderTags[iIdx] =
GetIniSetting ( IniXMLDocument, "client",
QString ( "storedfadertag%1" ).arg ( iIdx ), "" );
}
// stored fader levels
for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ )
{
if ( GetNumericIniSet ( IniXMLDocument, "client", QString ( "storedfaderlevel%1" ).arg ( iIdx ),
0, AUD_MIX_FADER_MAX, iValue ) )
{
pClient->vecStoredFaderLevels[iIdx] = iValue;
}
} }
// name // name
@ -257,6 +277,8 @@ void CSettings::Load()
void CSettings::Save() void CSettings::Save()
{ {
int iIdx;
// create XML document for storing initialization parameters // create XML document for storing initialization parameters
QDomDocument IniXMLDocument; QDomDocument IniXMLDocument;
@ -267,11 +289,27 @@ void CSettings::Save()
// client: // client:
// IP addresses // IP addresses
for ( int iIPAddrIdx = 0; iIPAddrIdx < MAX_NUM_SERVER_ADDR_ITEMS; iIPAddrIdx++ ) for ( iIdx = 0; iIdx < MAX_NUM_SERVER_ADDR_ITEMS; iIdx++ )
{ {
PutIniSetting ( IniXMLDocument, "client", PutIniSetting ( IniXMLDocument, "client",
QString ( "ipaddress%1" ).arg ( iIPAddrIdx ), QString ( "ipaddress%1" ).arg ( iIdx ),
pClient->vstrIPAddress[iIPAddrIdx] ); pClient->vstrIPAddress[iIdx] );
}
// stored fader tags
for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ )
{
PutIniSetting ( IniXMLDocument, "client",
QString ( "storedfadertag%1" ).arg ( iIdx ),
pClient->vecStoredFaderTags[iIdx] );
}
// stored fader levels
for ( iIdx = 0; iIdx < MAX_NUM_STORED_FADER_LEVELS; iIdx++ )
{
SetNumericIniSet ( IniXMLDocument, "client",
QString ( "storedfaderlevel%1" ).arg ( iIdx ),
pClient->vecStoredFaderLevels[iIdx] );
} }
// name // name

View file

@ -112,7 +112,8 @@ public:
void Enlarge ( const int iAddedSize ); void Enlarge ( const int iAddedSize );
void Add ( const TData& tI ) { Enlarge ( 1 ); pData[iVectorSize - 1] = tI; } void Add ( const TData& tI ) { Enlarge ( 1 ); pData[iVectorSize - 1] = tI; }
int AddStringFiFoWithCompare ( const QString strNewValue ); int StringFiFoWithCompare ( const QString strNewValue,
const bool bDoAdding = true );
inline int Size() const { return iVectorSize; } inline int Size() const { return iVectorSize; }
@ -206,16 +207,25 @@ template<class TData> void CVector<TData>::Reset ( const TData tResetVal )
} }
// note: this is only supported for string vectors // note: this is only supported for string vectors
template<class TData> int CVector<TData>::AddStringFiFoWithCompare ( const QString strNewValue ) template<class TData> int CVector<TData>::StringFiFoWithCompare ( const QString strNewValue,
const bool bDoAdding )
{ {
int iOldIndex = -1; // init with illegal index per definition
CVector<QString> vstrTempList ( iVectorSize, "" ); CVector<QString> vstrTempList ( iVectorSize, "" );
// init with illegal index per definition
int iOldIndex = -1;
// init temporary list count (may be overwritten later on)
int iTempListCnt = 0;
if ( bDoAdding )
{
// store the new element in the current storage list at // store the new element in the current storage list at
// the top, make sure we do not have more than allowed stored // the top, make sure we do not have more than allowed stored
// elements // elements
vstrTempList[0] = strNewValue; vstrTempList[0] = strNewValue;
int iTempListCnt = 1; iTempListCnt = 1;
}
for ( int iIdx = 0; iIdx < iVectorSize; iIdx++ ) for ( int iIdx = 0; iIdx < iVectorSize; iIdx++ )
{ {