Skip to content

Commit

Permalink
Small refactor in FxMixerView and FxMixer (#5577)
Browse files Browse the repository at this point in the history
FxMixerView.cpp and FxMixer.cpp were inconsistent in their use of TrackContainer::TrackList vs QVector<Track *>. The former is a typedef of the latter, so this PR replaces all instances of QVector<Track *> with TrackContainer::TrackList.

Also, we were not including "TrackContainer.h" directly (the typedef was likely being included indirectly through one of the other include files), so we also include this header on both source codes.
  • Loading branch information
Spekular authored Jul 12, 2020
2 parents d0ef875 + 3795fdf commit 574839f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/core/FxMixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "InstrumentTrack.h"
#include "SampleTrack.h"
#include "BBTrackContainer.h"
#include "TrackContainer.h" // For TrackContainer::TrackList typedef

FxRoute::FxRoute( FxChannel * from, FxChannel * to, float amount ) :
m_from( from ),
Expand Down Expand Up @@ -383,13 +384,13 @@ void FxMixer::moveChannelLeft( int index )
else if (m_lastSoloed == b) { m_lastSoloed = a; }

// go through every instrument and adjust for the channel index change
QVector<Track *> songTrackList = Engine::getSong()->tracks();
QVector<Track *> bbTrackList = Engine::getBBTrackContainer()->tracks();
TrackContainer::TrackList songTrackList = Engine::getSong()->tracks();
TrackContainer::TrackList bbTrackList = Engine::getBBTrackContainer()->tracks();

QVector<Track *> trackLists[] = {songTrackList, bbTrackList};
TrackContainer::TrackList trackLists[] = {songTrackList, bbTrackList};
for(int tl=0; tl<2; ++tl)
{
QVector<Track *> trackList = trackLists[tl];
TrackContainer::TrackList trackList = trackLists[tl];
for(int i=0; i<trackList.size(); ++i)
{
if( trackList[i]->type() == Track::InstrumentTrack )
Expand Down
9 changes: 5 additions & 4 deletions src/gui/FxMixerView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include "SampleTrack.h"
#include "Song.h"
#include "BBTrackContainer.h"
#include "TrackContainer.h" // For TrackContainer::TrackList typedef

FxMixerView::FxMixerView() :
QWidget(),
Expand Down Expand Up @@ -237,13 +238,13 @@ void FxMixerView::refreshDisplay()
// update the and max. channel number for every instrument
void FxMixerView::updateMaxChannelSelector()
{
QVector<Track *> songTrackList = Engine::getSong()->tracks();
QVector<Track *> bbTrackList = Engine::getBBTrackContainer()->tracks();
TrackContainer::TrackList songTrackList = Engine::getSong()->tracks();
TrackContainer::TrackList bbTrackList = Engine::getBBTrackContainer()->tracks();

QVector<Track *> trackLists[] = {songTrackList, bbTrackList};
TrackContainer::TrackList trackLists[] = {songTrackList, bbTrackList};
for(int tl=0; tl<2; ++tl)
{
QVector<Track *> trackList = trackLists[tl];
TrackContainer::TrackList trackList = trackLists[tl];
for(int i=0; i<trackList.size(); ++i)
{
if( trackList[i]->type() == Track::InstrumentTrack )
Expand Down

0 comments on commit 574839f

Please sign in to comment.