FxMixerView::FxChannelView::FxChannelView(QWidget * _parent, FxMixerView * _mv, int _chIndex ) { m_fxLine = new FxLine(_parent, _mv, _chIndex); FxMixer * m = engine::fxMixer(); m_fader = new fader( &m->effectChannel(_chIndex)->m_volumeModel, tr( "FX Fader %1" ).arg( _chIndex ), m_fxLine ); m_fader->move( 16-m_fader->width()/2, m_fxLine->height()- m_fader->height()-5 ); m_muteBtn = new pixmapButton( m_fxLine, tr( "Mute" ) ); m_muteBtn->setModel( &m->effectChannel(_chIndex)->m_muteModel ); m_muteBtn->setActiveGraphic( embed::getIconPixmap( "led_off" ) ); m_muteBtn->setInactiveGraphic( embed::getIconPixmap( "led_green" ) ); m_muteBtn->setCheckable( true ); m_muteBtn->move( 9, m_fader->y()-16); toolTip::add( m_muteBtn, tr( "Mute this FX channel" ) ); // Create EffectRack for the channel m_rackView = new EffectRackView( &m->effectChannel(_chIndex)->m_fxChain, _mv->m_racksWidget ); m_rackView->setFixedSize( 245, FxLine::FxLineHeight ); }
void FxLine::renameChannel() { bool ok; FxMixer * mix = engine::fxMixer(); QString new_name = QInputDialog::getText( this, FxMixerView::tr( "Rename FX channel" ), FxMixerView::tr( "Enter the new name for this " "FX channel" ), QLineEdit::Normal, mix->effectChannel(m_channelIndex)->m_name, &ok ); if( ok && !new_name.isEmpty() ) { mix->effectChannel( m_channelIndex )->m_name = new_name; update(); } }
void FxLine::contextMenuEvent( QContextMenuEvent * ) { FxMixer * mix = engine::fxMixer(); QPointer<captionMenu> contextMenu = new captionMenu( mix->effectChannel( m_channelIndex )->m_name ); if( m_channelIndex != 0 ) // no move-options in master { contextMenu->addAction( tr( "Move &left" ), this, SLOT( moveChannelLeft() ) ); contextMenu->addAction( tr( "Move &right" ), this, SLOT( moveChannelRight() ) ); } contextMenu->addAction( tr( "Rename &channel" ), this, SLOT( renameChannel() ) ); contextMenu->addSeparator(); if( m_channelIndex != 0 ) // no remove-option in master { contextMenu->addAction( embed::getIconPixmap( "cancel" ), tr( "R&emove channel" ), this, SLOT( removeChannel() ) ); contextMenu->addSeparator(); } contextMenu->addAction( embed::getIconPixmap( "help" ), tr( "&Help" ), this, SLOT( displayHelp() ) ); contextMenu->exec( QCursor::pos() ); delete contextMenu; }
void FxMixerView::updateFaders() { FxMixer * m = Engine::fxMixer(); // apply master gain m->effectChannel(0)->m_peakLeft *= Engine::mixer()->masterGain(); m->effectChannel(0)->m_peakRight *= Engine::mixer()->masterGain(); for( int i = 0; i < m_fxChannelViews.size(); ++i ) { const float opl = m_fxChannelViews[i]->m_fader->getPeak_L(); const float opr = m_fxChannelViews[i]->m_fader->getPeak_R(); const float fall_off = 1.2; if( m->effectChannel(i)->m_peakLeft > opl ) { m_fxChannelViews[i]->m_fader->setPeak_L( m->effectChannel(i)->m_peakLeft ); m->effectChannel(i)->m_peakLeft = 0; } else { m_fxChannelViews[i]->m_fader->setPeak_L( opl/fall_off ); } if( m->effectChannel(i)->m_peakRight > opr ) { m_fxChannelViews[i]->m_fader->setPeak_R( m->effectChannel(i)->m_peakRight ); m->effectChannel(i)->m_peakRight = 0; } else { m_fxChannelViews[i]->m_fader->setPeak_R( opr/fall_off ); } } }
void FxLine::paintEvent( QPaintEvent * ) { FxMixer * mix = engine::fxMixer(); bool sendToThis = mix->channelSendModel( m_mv->currentFxLine()->m_channelIndex, m_channelIndex) != NULL; QPainter painter; painter.begin( this ); drawFxLine( &painter, this, mix->effectChannel(m_channelIndex)->m_name, m_mv->currentFxLine() == this, sendToThis ); painter.end(); }