Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed ControlObjectThreadMain instances to ControlObjectThread where no direct connection is used. #43

Merged
merged 7 commits into from
Oct 11, 2013
29 changes: 7 additions & 22 deletions src/basetrackplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,8 @@ BaseTrackPlayer::BaseTrackPlayer(QObject* pParent,

// Set the routing option defaults for the master and headphone mixes.
{
ControlObjectThreadMain* pMaster = new ControlObjectThreadMain(
getGroup(), "master");
pMaster->slotSet(defaultMaster);
delete pMaster;

ControlObjectThreadMain* pHeadphones = new ControlObjectThreadMain(
getGroup(), "pfl");
pHeadphones->slotSet(defaultHeadphones);
delete pHeadphones;
ControlObject::set(ConfigKey(getGroup(), "master"), (double)defaultMaster);
ControlObject::set(ConfigKey(getGroup(), "pfl"), (double)defaultHeadphones);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saves memory allocation.

}

ClockControl* pClockControl = new ClockControl(pSafeGroupName, pConfig);
Expand All @@ -72,17 +65,11 @@ BaseTrackPlayer::BaseTrackPlayer(QObject* pParent,
connect(pEngineBuffer, SIGNAL(trackUnloaded(TrackPointer)),
this, SLOT(slotUnloadTrack(TrackPointer)));

//Get cue point control object
m_pCuePoint = new ControlObjectThreadMain(
getGroup(),"cue_point");
// Get loop point control objects
m_pLoopInPoint = new ControlObjectThreadMain(
m_pLoopInPoint = new ControlObjectThread(
getGroup(),"loop_start_position");
m_pLoopOutPoint = new ControlObjectThreadMain(
m_pLoopOutPoint = new ControlObjectThread(
getGroup(),"loop_end_position");
//Playback position within the currently loaded track (in this player).
m_pPlayPosition = new ControlObjectThreadMain(
getGroup(), "playposition");

// Duration of the current song, we create this one because nothing else does.
m_pDuration = new ControlObject(ConfigKey(getGroup(), "duration"));
Expand All @@ -99,9 +86,9 @@ BaseTrackPlayer::BaseTrackPlayer(QObject* pParent,
m_pEndOfTrack->set(0.);

//BPM of the current song
m_pBPM = new ControlObjectThreadMain(group, "file_bpm");
m_pReplayGain = new ControlObjectThreadMain(group, "replaygain");
m_pPlay = new ControlObjectThreadMain(group, "play");
m_pBPM = new ControlObjectThread(group, "file_bpm");
m_pReplayGain = new ControlObjectThread(group, "replaygain");
m_pPlay = new ControlObjectThread(group, "play");
}

BaseTrackPlayer::~BaseTrackPlayer()
Expand All @@ -113,10 +100,8 @@ BaseTrackPlayer::~BaseTrackPlayer()

delete m_pWaveformZoom;
delete m_pEndOfTrack;
delete m_pCuePoint;
delete m_pLoopInPoint;
delete m_pLoopOutPoint;
delete m_pPlayPosition;
delete m_pBPM;
delete m_pReplayGain;
delete m_pDuration;
Expand Down
14 changes: 6 additions & 8 deletions src/basetrackplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class EngineMaster;
class ControlObject;
class ControlPotmeter;
class ControlObjectThreadMain;
class ControlObjectThread;
class AnalyserQueue;

class BaseTrackPlayer : public BasePlayer {
Expand Down Expand Up @@ -52,14 +52,12 @@ class BaseTrackPlayer : public BasePlayer {
ControlPotmeter* m_pWaveformZoom;
ControlObject* m_pEndOfTrack;

ControlObjectThreadMain* m_pCuePoint;
ControlObjectThreadMain* m_pLoopInPoint;
ControlObjectThreadMain* m_pLoopOutPoint;
ControlObjectThreadMain* m_pPlayPosition;
ControlObjectThread* m_pLoopInPoint;
ControlObjectThread* m_pLoopOutPoint;
ControlObject* m_pDuration;
ControlObjectThreadMain* m_pBPM;
ControlObjectThreadMain* m_pReplayGain;
ControlObjectThreadMain* m_pPlay;
ControlObjectThread* m_pBPM;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_pPlayPosition and m_pCuePoint where unused

ControlObjectThread* m_pReplayGain;
ControlObjectThread* m_pPlay;
EngineDeck* m_pChannel;
};

Expand Down
28 changes: 14 additions & 14 deletions src/dlgautodj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,23 @@ DlgAutoDJ::DlgAutoDJ(QWidget* parent, ConfigObject<ConfigValue>* pConfig,

m_pCOShufflePlaylist = new ControlPushButton(
ConfigKey("[AutoDJ]", "shuffle_playlist"));
m_pCOTShufflePlaylist = new ControlObjectThreadMain(m_pCOShufflePlaylist->getKey());
m_pCOTShufflePlaylist = new ControlObjectThread(m_pCOShufflePlaylist->getKey());
connect(m_pCOTShufflePlaylist, SIGNAL(valueChanged(double)),
this, SLOT(shufflePlaylist(double)));
connect(pushButtonShuffle, SIGNAL(clicked(bool)),
this, SLOT(shufflePlaylistButton(bool)));

m_pCOSkipNext = new ControlPushButton(
ConfigKey("[AutoDJ]", "skip_next"));
m_pCOTSkipNext = new ControlObjectThreadMain(m_pCOSkipNext->getKey());
m_pCOTSkipNext = new ControlObjectThread(m_pCOSkipNext->getKey());
connect(m_pCOTSkipNext, SIGNAL(valueChanged(double)),
this, SLOT(skipNext(double)));
connect(pushButtonSkipNext, SIGNAL(clicked(bool)),
this, SLOT(skipNextButton(bool)));

m_pCOFadeNow = new ControlPushButton(
ConfigKey("[AutoDJ]", "fade_now"));
m_pCOTFadeNow = new ControlObjectThreadMain(m_pCOFadeNow->getKey());
m_pCOTFadeNow = new ControlObjectThread(m_pCOFadeNow->getKey());
connect(m_pCOTFadeNow, SIGNAL(valueChanged(double)),
this, SLOT(fadeNow(double)));
connect(pushButtonFadeNow, SIGNAL(clicked(bool)),
Expand All @@ -94,21 +94,21 @@ DlgAutoDJ::DlgAutoDJ(QWidget* parent, ConfigObject<ConfigValue>* pConfig,
m_pCOEnabledAutoDJ = new ControlPushButton(
ConfigKey("[AutoDJ]", "enabled"));
m_pCOEnabledAutoDJ->setButtonMode(ControlPushButton::TOGGLE);
m_pCOTEnabledAutoDJ = new ControlObjectThreadMain(m_pCOEnabledAutoDJ->getKey());
m_pCOTEnabledAutoDJ = new ControlObjectThread(m_pCOEnabledAutoDJ->getKey());
connect(m_pCOTEnabledAutoDJ, SIGNAL(valueChanged(double)),
this, SLOT(enableAutoDJCo(double)));

// playposition is from -0.14 to + 1.14
m_pCOPlayPos1 = new ControlObjectThreadMain("[Channel1]", "playposition");
m_pCOPlayPos2 = new ControlObjectThreadMain("[Channel2]", "playposition");
m_pCOPlay1 = new ControlObjectThreadMain("[Channel1]", "play");
m_pCOPlay2 = new ControlObjectThreadMain("[Channel2]", "play");
m_pCOPlay1Fb = new ControlObjectThreadMain("[Channel1]", "play");
m_pCOPlay2Fb = new ControlObjectThreadMain("[Channel2]", "play");
m_pCORepeat1 = new ControlObjectThreadMain("[Channel1]", "repeat");
m_pCORepeat2 = new ControlObjectThreadMain("[Channel2]", "repeat");
m_pCOCrossfader = new ControlObjectThreadMain("[Master]", "crossfader");
m_pCOCrossfaderReverse = new ControlObjectThreadMain("[Mixer Profile]", "xFaderReverse");
m_pCOPlayPos1 = new ControlObjectThread("[Channel1]", "playposition");
m_pCOPlayPos2 = new ControlObjectThread("[Channel2]", "playposition");
m_pCOPlay1 = new ControlObjectThread("[Channel1]", "play");
m_pCOPlay2 = new ControlObjectThread("[Channel2]", "play");
m_pCOPlay1Fb = new ControlObjectThread("[Channel1]", "play");
m_pCOPlay2Fb = new ControlObjectThread("[Channel2]", "play");
m_pCORepeat1 = new ControlObjectThread("[Channel1]", "repeat");
m_pCORepeat2 = new ControlObjectThread("[Channel2]", "repeat");
m_pCOCrossfader = new ControlObjectThread("[Master]", "crossfader");
m_pCOCrossfaderReverse = new ControlObjectThread("[Mixer Profile]", "xFaderReverse");

QString str_autoDjTransition = m_pConfig->getValueString(
ConfigKey(CONFIG_KEY, kTransitionPreferenceName));
Expand Down
29 changes: 15 additions & 14 deletions src/dlgautodj.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class WTrackTableView;
class AnalyserQueue;
class QSqlTableModel;
class ControlObjectThreadMain;
class ControlObjectThread;

class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView {
Q_OBJECT
Expand Down Expand Up @@ -87,20 +88,20 @@ class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView {
float m_fadeDuration1;
float m_fadeDuration2;
int m_backUpTransition;
ControlObjectThreadMain* m_pCOPlayPos1;
ControlObjectThreadMain* m_pCOPlayPos2;
ControlObjectThreadMain* m_pCOPlay1;
ControlObjectThreadMain* m_pCOPlay2;
ControlObjectThreadMain* m_pCOPlay1Fb;
ControlObjectThreadMain* m_pCOPlay2Fb;
ControlObjectThreadMain* m_pCORepeat1;
ControlObjectThreadMain* m_pCORepeat2;
ControlObjectThreadMain* m_pCOCrossfader;
ControlObjectThreadMain* m_pCOCrossfaderReverse;
ControlObjectThreadMain* m_pCOTSkipNext;
ControlObjectThreadMain* m_pCOTFadeNow;
ControlObjectThreadMain* m_pCOTShufflePlaylist;
ControlObjectThreadMain* m_pCOTEnabledAutoDJ;
ControlObjectThread* m_pCOPlayPos1;
ControlObjectThread* m_pCOPlayPos2;
ControlObjectThread* m_pCOPlay1;
ControlObjectThread* m_pCOPlay2;
ControlObjectThread* m_pCOPlay1Fb;
ControlObjectThread* m_pCOPlay2Fb;
ControlObjectThread* m_pCORepeat1;
ControlObjectThread* m_pCORepeat2;
ControlObjectThread* m_pCOCrossfader;
ControlObjectThread* m_pCOCrossfaderReverse;
ControlObjectThread* m_pCOTSkipNext;
ControlObjectThread* m_pCOTFadeNow;
ControlObjectThread* m_pCOTShufflePlaylist;
ControlObjectThread* m_pCOTEnabledAutoDJ;
ControlPushButton* m_pCOSkipNext;
ControlPushButton* m_pCOFadeNow;
ControlPushButton* m_pCOShufflePlaylist;
Expand Down
32 changes: 16 additions & 16 deletions src/dlgprefcontrols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,25 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx,

for (unsigned int i = 0; i < m_pPlayerManager->numDecks(); ++i) {
QString group = PlayerManager::groupForDeck(i);
m_rateControls.push_back(new ControlObjectThreadMain(
m_rateControls.push_back(new ControlObjectThread(
group, "rate"));
m_rateRangeControls.push_back(new ControlObjectThreadMain(
m_rateRangeControls.push_back(new ControlObjectThread(
group, "rateRange"));
m_rateDirControls.push_back(new ControlObjectThreadMain(
m_rateDirControls.push_back(new ControlObjectThread(
group, "rate_dir"));
m_cueControls.push_back(new ControlObjectThreadMain(
m_cueControls.push_back(new ControlObjectThread(
group, "cue_mode"));
}

for (unsigned int i = 0; i < m_pPlayerManager->numSamplers(); ++i) {
QString group = PlayerManager::groupForSampler(i);
m_rateControls.push_back(new ControlObjectThreadMain(
m_rateControls.push_back(new ControlObjectThread(
group, "rate"));
m_rateRangeControls.push_back(new ControlObjectThreadMain(
m_rateRangeControls.push_back(new ControlObjectThread(
group, "rateRange"));
m_rateDirControls.push_back(new ControlObjectThreadMain(
m_rateDirControls.push_back(new ControlObjectThread(
group, "rate_dir"));
m_cueControls.push_back(new ControlObjectThreadMain(
m_cueControls.push_back(new ControlObjectThread(
group, "cue_mode"));
}

Expand Down Expand Up @@ -287,16 +287,16 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxApp * mixxx,

DlgPrefControls::~DlgPrefControls()
{
foreach (ControlObjectThreadMain* pControl, m_rateControls) {
foreach (ControlObjectThread* pControl, m_rateControls) {
delete pControl;
}
foreach (ControlObjectThreadMain* pControl, m_rateDirControls) {
foreach (ControlObjectThread* pControl, m_rateDirControls) {
delete pControl;
}
foreach (ControlObjectThreadMain* pControl, m_cueControls) {
foreach (ControlObjectThread* pControl, m_cueControls) {
delete pControl;
}
foreach (ControlObjectThreadMain* pControl, m_rateRangeControls) {
foreach (ControlObjectThread* pControl, m_rateRangeControls) {
delete pControl;
}
}
Expand Down Expand Up @@ -376,12 +376,12 @@ void DlgPrefControls::slotSetRateRange(int pos)
range = 0.08f;

// Set rate range for every group
foreach (ControlObjectThreadMain* pControl, m_rateRangeControls) {
foreach (ControlObjectThread* pControl, m_rateRangeControls) {
pControl->slotSet(range);
}

// Reset rate for every group
foreach (ControlObjectThreadMain* pControl, m_rateControls) {
foreach (ControlObjectThread* pControl, m_rateControls) {
pControl->slotSet(0);
}
}
Expand All @@ -393,7 +393,7 @@ void DlgPrefControls::slotSetRateDir(int index)
dir = -1.;

// Set rate direction for every group
foreach (ControlObjectThreadMain* pControl, m_rateDirControls) {
foreach (ControlObjectThread* pControl, m_rateDirControls) {
pControl->slotSet(dir);
}
}
Expand All @@ -409,7 +409,7 @@ void DlgPrefControls::slotSetCueDefault(int)
m_pConfig->set(ConfigKey("[Controls]","CueDefault"), ConfigValue(cueIndex));

// Set cue behavior for every group
foreach (ControlObjectThreadMain* pControl, m_cueControls) {
foreach (ControlObjectThread* pControl, m_cueControls) {
pControl->slotSet(cueIndex);
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/dlgprefcontrols.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "configobject.h"

class QWidget;
class ControlObjectThreadMain;
class ControlObjectThread;
class ControlPotmeter;
class SkinLoader;
class PlayerManager;
Expand Down Expand Up @@ -91,10 +91,10 @@ public slots:
ConfigObject<ConfigValue> *m_pConfig;
int m_timer;
ControlObject* m_pControlPositionDisplay;
QList<ControlObjectThreadMain*> m_cueControls;
QList<ControlObjectThreadMain*> m_rateControls;
QList<ControlObjectThreadMain*> m_rateDirControls;
QList<ControlObjectThreadMain*> m_rateRangeControls;
QList<ControlObjectThread*> m_cueControls;
QList<ControlObjectThread*> m_rateControls;
QList<ControlObjectThread*> m_rateDirControls;
QList<ControlObjectThread*> m_rateRangeControls;
PlayerManager* m_pPlayerManager;
MixxxApp *m_mixxx;
SkinLoader* m_pSkinLoader;
Expand Down
6 changes: 3 additions & 3 deletions src/dlgprefrecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ DlgPrefRecord::DlgPrefRecord(QWidget * parent, ConfigObject<ConfigValue> * _conf
setupUi(this);

//See RECORD_* #defines in defs_recording.h
recordControl = new ControlObjectThreadMain(
m_recordControl = new ControlObjectThread(
RECORDING_PREF_KEY, "status");

radioOgg = new QRadioButton("Ogg Vorbis");
Expand Down Expand Up @@ -115,7 +115,7 @@ DlgPrefRecord::DlgPrefRecord(QWidget * parent, ConfigObject<ConfigValue> * _conf
connect(comboBoxSplitting, SIGNAL(activated(int)), this, SLOT(slotChangeSplitSize()));

slotApply();
recordControl->slotSet(RECORD_OFF); //make sure a corrupt config file won't cause us to record constantly
m_recordControl->slotSet(RECORD_OFF); //make sure a corrupt config file won't cause us to record constantly

comboBoxSplitting->addItem(SPLIT_650MB);
comboBoxSplitting->addItem(SPLIT_700MB);
Expand Down Expand Up @@ -228,7 +228,7 @@ void DlgPrefRecord::loadMetaData()

DlgPrefRecord::~DlgPrefRecord()
{
delete recordControl;
delete m_recordControl;
}

void DlgPrefRecord::slotRecordPathChange()
Expand Down
4 changes: 2 additions & 2 deletions src/dlgprefrecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <QRadioButton>

class ControlObject;
class ControlObjectThreadMain;
class ControlObjectThread;



Expand Down Expand Up @@ -59,7 +59,7 @@ public slots:

/** Pointer to config object */
ConfigObject<ConfigValue> *config;
ControlObjectThreadMain* recordControl;
ControlObjectThread* m_recordControl;
bool confirmOverwrite;
QString fileTypeExtension;
QRadioButton *radioOgg;
Expand Down
2 changes: 1 addition & 1 deletion src/dlgprefshoutcast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DlgPrefShoutcast::DlgPrefShoutcast(QWidget *parent, ConfigObject<ConfigValue> *_
QString tmp_string;
setupUi(this);

m_pUpdateShoutcastFromPrefs = new ControlObjectThreadMain(
m_pUpdateShoutcastFromPrefs = new ControlObjectThread(
SHOUTCAST_PREF_KEY, "update_from_prefs");

// Enable live broadcasting checkbox
Expand Down
2 changes: 1 addition & 1 deletion src/dlgprefshoutcast.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public slots:
private:
/** Pointer to config object */
ConfigObject<ConfigValue> *m_pConfig;
ControlObjectThreadMain* m_pUpdateShoutcastFromPrefs; //If set to 1, EngineShoutcast will update it's settings.
ControlObjectThread* m_pUpdateShoutcastFromPrefs; //If set to 1, EngineShoutcast will update it's settings.

};

Expand Down
4 changes: 2 additions & 2 deletions src/dlgprefsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ DlgPrefSound::DlgPrefSound(QWidget *pParent, SoundManager *pSoundManager,
this, SLOT(loadSettings()));

m_pMasterUnderflowCount =
new ControlObjectThreadMain("[Master]", "underflow_count");
new ControlObjectThread("[Master]", "underflow_count");
connect(m_pMasterUnderflowCount, SIGNAL(valueChanged(double)),
this, SLOT(bufferUnderflow(double)));

m_pMasterLatency =
new ControlObjectThreadMain("[Master]", "latency");
new ControlObjectThread("[Master]", "latency");
connect(m_pMasterLatency, SIGNAL(valueChanged(double)),
this, SLOT(masterLatencyChanged(double)));

Expand Down