Skip to content

Commit

Permalink
Small refactor on FxMixerView.cpp and FxMixer.cpp
Browse files Browse the repository at this point in the history
The code on FxMixerView.cpp and FxMixer.cpp were using the types TrackContainer::TrackList and QVector<Track *> unconsistently. TrackContainer::TrackList is just a typedef for QVector<Track *> so it makes sense that we use it, specially in terms of readability.

Places where QVector<Track *> were used are now replaced 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
IanCaio committed Jul 12, 2020
1 parent d0ef875 commit 3795fdf
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 3795fdf

Please sign in to comment.