Ability to delete mixer channels in the FX Mixer
Users can now delete mixer channels from the FX mixer, and it doesn't mess up the instrument send channels.
This commit is contained in:
@@ -21,11 +21,11 @@ public:
|
||||
virtual void mouseDoubleClickEvent( QMouseEvent * );
|
||||
|
||||
inline int channelIndex() { return m_channelIndex; }
|
||||
inline void setChannelIndex(int index) { m_channelIndex = index; }
|
||||
|
||||
knob * m_sendKnob;
|
||||
SendButtonIndicator * m_sendBtn;
|
||||
|
||||
|
||||
private:
|
||||
FxMixerView * m_mv;
|
||||
|
||||
|
||||
@@ -109,6 +109,13 @@ public:
|
||||
// returns the index of the channel that was just added
|
||||
int createChannel();
|
||||
|
||||
// delete a channel from the FX mixer.
|
||||
void deleteChannel(int index);
|
||||
|
||||
// re-arrange channels
|
||||
void moveChannelLeft(int index);
|
||||
void moveChannelRight(int index);
|
||||
|
||||
// reset a channel's name, fx, sends, etc
|
||||
void clearChannel(fx_ch_t channelIndex);
|
||||
|
||||
|
||||
@@ -52,15 +52,16 @@ public:
|
||||
FxChannelView(QWidget * _parent, FxMixerView * _mv, int _chIndex );
|
||||
|
||||
FxLine * m_fxLine;
|
||||
//EffectRackView * m_rackView;
|
||||
pixmapButton * m_muteBtn;
|
||||
fader * m_fader;
|
||||
} ;
|
||||
};
|
||||
|
||||
|
||||
FxMixerView();
|
||||
virtual ~FxMixerView();
|
||||
|
||||
virtual void keyPressEvent(QKeyEvent * e);
|
||||
|
||||
virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
|
||||
virtual void loadSettings( const QDomElement & _this );
|
||||
|
||||
@@ -81,7 +82,10 @@ public:
|
||||
|
||||
|
||||
// display the send button and knob correctly
|
||||
void updateFxLine(int i);
|
||||
void updateFxLine(int index);
|
||||
|
||||
// notify the view that an fx channel was deleted
|
||||
void deleteChannel(int index);
|
||||
|
||||
private slots:
|
||||
void updateFaders();
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
#include "Effect.h"
|
||||
#include "song.h"
|
||||
|
||||
#include "InstrumentTrack.h"
|
||||
#include "bb_track_container.h"
|
||||
|
||||
|
||||
FxChannel::FxChannel( Model * _parent ) :
|
||||
m_fxChain( NULL ),
|
||||
@@ -97,6 +100,98 @@ int FxMixer::createChannel()
|
||||
}
|
||||
|
||||
|
||||
void FxMixer::deleteChannel(int index)
|
||||
{
|
||||
// go through every instrument and adjust for the channel index change
|
||||
QVector<track *> songTrackList = engine::getSong()->tracks();
|
||||
QVector<track *> bbTrackList = engine::getBBTrackContainer()->tracks();
|
||||
|
||||
QVector<track *> trackLists[] = {songTrackList, bbTrackList};
|
||||
for(int tl=0; tl<2; ++tl)
|
||||
{
|
||||
QVector<track *> trackList = trackLists[tl];
|
||||
for(int i=0; i<trackList.size(); ++i)
|
||||
{
|
||||
if( trackList[i]->type() == track::InstrumentTrack )
|
||||
{
|
||||
InstrumentTrack * inst = (InstrumentTrack *) trackList[i];
|
||||
int val = inst->effectChannelModel()->value(0);
|
||||
if( val == index )
|
||||
{
|
||||
// we are deleting this track's fx send
|
||||
// send to master
|
||||
inst->effectChannelModel()->setValue(0);
|
||||
}
|
||||
else if( val > index )
|
||||
{
|
||||
// subtract 1 to make up for the missing channel
|
||||
inst->effectChannelModel()->setValue(val-1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// delete all of this channel's sends and receives
|
||||
for(int i=0; i<m_fxChannels[index]->m_sends.size(); ++i)
|
||||
{
|
||||
deleteChannelSend(index, m_fxChannels[index]->m_sends[i]);
|
||||
}
|
||||
for(int i=0; i<m_fxChannels[index]->m_receives.size(); ++i)
|
||||
{
|
||||
deleteChannelSend(m_fxChannels[index]->m_receives[i], index);
|
||||
}
|
||||
|
||||
for(int i=0; i<m_fxChannels.size(); ++i)
|
||||
{
|
||||
// for every send/receive, adjust for the channel index change
|
||||
for(int j=0; j<m_fxChannels[i]->m_sends.size(); ++j)
|
||||
{
|
||||
if( m_fxChannels[i]->m_sends[j] > index )
|
||||
{
|
||||
// subtract 1 to make up for the missing channel
|
||||
--m_fxChannels[i]->m_sends[j];
|
||||
}
|
||||
}
|
||||
for(int j=0; j<m_fxChannels[i]->m_receives.size(); ++j)
|
||||
{
|
||||
if( m_fxChannels[i]->m_receives[j] > index )
|
||||
{
|
||||
// subtract 1 to make up for the missing channel
|
||||
--m_fxChannels[i]->m_receives[j];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// actually delete the channel
|
||||
m_fxChannels.remove(index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FxMixer::moveChannelLeft(int index)
|
||||
{
|
||||
// can't move master or first channel
|
||||
if( index <= 1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// channels to swap
|
||||
int a = index - 1, b = index;
|
||||
|
||||
// go through every instrument and adjust for the channel index change
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FxMixer::moveChannelRight(int index)
|
||||
{
|
||||
moveChannelLeft(index+1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FxMixer::createChannelSend(fx_ch_t fromChannel, fx_ch_t toChannel,
|
||||
float amount)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QDebug>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include <QtGui/QInputDialog>
|
||||
@@ -63,9 +64,6 @@ FxMixerView::FxMixerView() :
|
||||
|
||||
// main-layout
|
||||
QHBoxLayout * ml = new QHBoxLayout;
|
||||
//ml->setMargin( 0 );
|
||||
//ml->setSpacing( 0 );
|
||||
//ml->addSpacing( 6 );
|
||||
|
||||
// Channel area
|
||||
m_channelAreaWidget = new QWidget;
|
||||
@@ -237,6 +235,56 @@ void FxMixerView::updateFxLine(int index)
|
||||
}
|
||||
|
||||
|
||||
void FxMixerView::deleteChannel(int index)
|
||||
{
|
||||
// remember selected line
|
||||
int selLine = m_currentFxLine->channelIndex();
|
||||
|
||||
// can't delete master
|
||||
if( index == 0 )
|
||||
return;
|
||||
|
||||
// delete the real channel
|
||||
engine::fxMixer()->deleteChannel(index);
|
||||
|
||||
// delete the view
|
||||
chLayout->removeWidget(m_fxChannelViews[index]->m_fxLine);
|
||||
delete m_fxChannelViews[index]->m_fader;
|
||||
delete m_fxChannelViews[index]->m_muteBtn;
|
||||
delete m_fxChannelViews[index]->m_fxLine;
|
||||
delete m_fxChannelViews[index];
|
||||
|
||||
// make sure every channel knows what index it is
|
||||
for(int i=0; i<m_fxChannelViews.size(); ++i)
|
||||
{
|
||||
if( i > index )
|
||||
{
|
||||
m_fxChannelViews[i]->m_fxLine->setChannelIndex(i-1);
|
||||
}
|
||||
}
|
||||
m_fxChannelViews.remove(index);
|
||||
|
||||
// select the next channel
|
||||
if( selLine >= m_fxChannelViews.size() )
|
||||
{
|
||||
selLine = m_fxChannelViews.size()-1;
|
||||
}
|
||||
setCurrentFxLine(selLine);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FxMixerView::keyPressEvent(QKeyEvent * e)
|
||||
{
|
||||
switch(e->key())
|
||||
{
|
||||
case Qt::Key_Delete:
|
||||
deleteChannel(m_currentFxLine->channelIndex());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FxMixerView::setCurrentFxLine( int _line )
|
||||
{
|
||||
@@ -245,7 +293,6 @@ void FxMixerView::setCurrentFxLine( int _line )
|
||||
|
||||
|
||||
|
||||
|
||||
void FxMixerView::clear()
|
||||
{
|
||||
m_rackView->clearViews();
|
||||
|
||||
Reference in New Issue
Block a user