Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/MixerChannelView.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class MixerChannelView : public QWidget
void keyPressEvent(QKeyEvent* ke) override;

void reset();

int channelIndex() const { return m_channelIndex; }
void setChannelIndex(int index);

Expand Down
1 change: 0 additions & 1 deletion include/MixerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class LMMS_EXPORT MixerView : public QWidget, public ModelView,

// move the channel to the left or right
void moveChannelLeft(int index);
void moveChannelLeft(int index, int focusIndex);
void moveChannelRight(int index);

void renameChannel(int index);
Expand Down
11 changes: 6 additions & 5 deletions src/core/Mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,13 @@ FloatModel * Mixer::channelSendModel( mix_ch_t fromChannel, mix_ch_t toChannel )

void Mixer::mixToChannel( const SampleFrame* _buf, mix_ch_t _ch )
{
if( m_mixerChannels[_ch]->m_muteModel.value() == false )
const auto channel = m_mixerChannels[_ch];
if (!channel->m_muteModel.value())
{
m_mixerChannels[_ch]->m_lock.lock();
MixHelpers::add( m_mixerChannels[_ch]->m_buffer, _buf, Engine::audioEngine()->framesPerPeriod() );
m_mixerChannels[_ch]->m_hasInput = true;
m_mixerChannels[_ch]->m_lock.unlock();
channel->m_lock.lock();
MixHelpers::add(channel->m_buffer, _buf, Engine::audioEngine()->framesPerPeriod());
channel->m_hasInput = true;
channel->m_lock.unlock();
}
}

Expand Down
6 changes: 0 additions & 6 deletions src/gui/MixerChannelView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,7 @@ void MixerChannelView::keyPressEvent(QKeyEvent* ke)

void MixerChannelView::setChannelIndex(int index)
{
MixerChannel* mixerChannel = Engine::mixer()->mixerChannel(index);
m_fader->setModel(&mixerChannel->m_volumeModel);
m_muteButton->setModel(&mixerChannel->m_muteModel);
m_soloButton->setModel(&mixerChannel->m_soloModel);
m_effectRackView->setModel(&mixerChannel->m_fxChain);
m_channelNumberLcd->setValue(index);
m_renameLineEdit->setText(elideName(mixerChannel->m_name));
m_channelIndex = index;
}

Expand Down
31 changes: 11 additions & 20 deletions src/gui/MixerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,38 +433,29 @@ void MixerView::deleteUnusedChannels()
}
}



void MixerView::moveChannelLeft(int index, int focusIndex)
void MixerView::moveChannelLeft(int index)
{
// can't move master or first channel left or last channel right
if (index <= 1 || index >= m_mixerChannelViews.size()) return;

Mixer *m = getMixer();

// Move instruments channels
m->moveChannelLeft(index);
if (index <= 1 || index >= m_mixerChannelViews.size()) { return; }

// Update widgets models
m_mixerChannelViews[index]->setChannelIndex(index);
m_mixerChannelViews[index - 1]->setChannelIndex(index - 1);

// Focus on new position
setCurrentMixerChannel(focusIndex);
}
m_mixer->moveChannelLeft(index);

const auto layoutIndex = chLayout->indexOf(m_mixerChannelViews[index]);
assert(layoutIndex >= 1);

chLayout->removeWidget(m_mixerChannelViews[index]);
chLayout->insertWidget(layoutIndex - 1, m_mixerChannelViews[index]);

void MixerView::moveChannelLeft(int index)
{
moveChannelLeft(index, index - 1);
m_mixerChannelViews[index]->setChannelIndex(index - 1);
m_mixerChannelViews[index - 1]->setChannelIndex(index);
std::swap(m_mixerChannelViews[index - 1], m_mixerChannelViews[index]);
}



void MixerView::moveChannelRight(int index)
{
moveChannelLeft(index + 1, index + 1);
moveChannelLeft(index + 1);
}


Expand Down
Loading