void FxMixer::loadSettings( const QDomElement & _this ) { clear(); QDomNode node = _this.firstChild(); bool thereIsASend = false; while( ! node.isNull() ) { QDomElement fxch = node.toElement(); // index of the channel we are about to load int num = fxch.attribute( "num" ).toInt(); // allocate enough channels allocateChannelsTo( num ); m_fxChannels[num]->m_volumeModel.loadSettings( fxch, "volume" ); m_fxChannels[num]->m_muteModel.loadSettings( fxch, "muted" ); m_fxChannels[num]->m_soloModel.loadSettings( fxch, "soloed" ); m_fxChannels[num]->m_name = fxch.attribute( "name" ); m_fxChannels[num]->m_fxChain.restoreState( fxch.firstChildElement( m_fxChannels[num]->m_fxChain.nodeName() ) ); // mixer sends QDomNodeList chData = fxch.childNodes(); for( unsigned int i=0; i<chData.length(); ++i ) { QDomElement chDataItem = chData.at(i).toElement(); if( chDataItem.nodeName() == QString( "send" ) ) { thereIsASend = true; int sendTo = chDataItem.attribute( "channel" ).toInt(); allocateChannelsTo( sendTo ) ; FxRoute * fxr = createChannelSend( num, sendTo, 1.0f ); if( fxr ) fxr->amount()->loadSettings( chDataItem, "amount" ); } } node = node.nextSibling(); } // check for old format. 65 fx channels and no explicit sends. if( ! thereIsASend && m_fxChannels.size() == 65 ) { // create a send from every channel into master for( int i=1; i<m_fxChannels.size(); ++i ) { createChannelSend( i, 0 ); } } emit dataChanged(); }
void FxMixer::clearChannel(fx_ch_t index) { FxChannel * ch = m_fxChannels[index]; ch->m_fxChain.clear(); ch->m_volumeModel.setValue( 1.0f ); ch->m_muteModel.setValue( false ); ch->m_soloModel.setValue( false ); ch->m_name = ( index == 0 ) ? tr( "Master" ) : tr( "FX %1" ).arg( index ); ch->m_volumeModel.setDisplayName( ch->m_name ); // send only to master if( index > 0) { // delete existing sends while( ! ch->m_sends.isEmpty() ) { deleteChannelSend( ch->m_sends.first() ); } // add send to master createChannelSend( index, 0 ); } // delete receives while( ! ch->m_receives.isEmpty() ) { deleteChannelSend( ch->m_receives.first() ); } }
void FxMixer::loadSettings( const QDomElement & _this ) { clear(); QDomNode node = _this.firstChild(); while( ! node.isNull() ) { QDomElement fxch = node.toElement(); // index of the channel we are about to load int num = fxch.attribute( "num" ).toInt(); // allocate enough channels allocateChannelsTo( num ); m_fxChannels[num]->m_volumeModel.loadSettings( fxch, "volume" ); m_fxChannels[num]->m_muteModel.loadSettings( fxch, "muted" ); m_fxChannels[num]->m_soloModel.loadSettings( fxch, "soloed" ); m_fxChannels[num]->m_name = fxch.attribute( "name" ); m_fxChannels[num]->m_fxChain.restoreState( fxch.firstChildElement( m_fxChannels[num]->m_fxChain.nodeName() ) ); // mixer sends QDomNodeList chData = fxch.childNodes(); for( unsigned int i=0; i<chData.length(); ++i ) { QDomElement chDataItem = chData.at(i).toElement(); if( chDataItem.nodeName() == QString( "send" ) ) { int sendTo = chDataItem.attribute( "channel" ).toInt(); allocateChannelsTo( sendTo ) ; FxRoute * fxr = createChannelSend( num, sendTo, 1.0f ); if( fxr ) fxr->amount()->loadSettings( chDataItem, "amount" ); } } node = node.nextSibling(); } emit dataChanged(); }