Skip to content

Commit

Permalink
add 'LoadTrackFromDeck' and '~Sampler' controls
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Feb 1, 2023
1 parent 6f9b26f commit 0f1e2c1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/mixer/basetrackplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,22 @@ BaseTrackPlayerImpl::BaseTrackPlayerImpl(
this,
&BaseTrackPlayerImpl::slotCloneFromSampler);

// Load track from other deck/sampler
m_pLoadTrackFromDeck = std::make_unique<ControlObject>(
ConfigKey(getGroup(), "LoadTrackFromDeck"),
false);
connect(m_pLoadTrackFromDeck.get(),
&ControlObject::valueChanged,
this,
&BaseTrackPlayerImpl::slotLoadTrackFromDeck);
m_pLoadTrackFromSampler = std::make_unique<ControlObject>(
ConfigKey(getGroup(), "LoadTrackFromSampler"),
false);
connect(m_pLoadTrackFromSampler.get(),
&ControlObject::valueChanged,
this,
&BaseTrackPlayerImpl::slotLoadTrackFromSampler);

// Waveform controls
// This acts somewhat like a ControlPotmeter, but the normal _up/_down methods
// do not work properly with this CO.
Expand Down Expand Up @@ -650,6 +666,34 @@ void BaseTrackPlayerImpl::slotCloneChannel(EngineChannel* pChannel) {
slotLoadTrack(pTrack, false);
}

void BaseTrackPlayerImpl::slotLoadTrackFromDeck(double d) {
int deck = static_cast<int>(d);
if (deck >= 1) {
slotLoadTrackFromGroup(PlayerManager::groupForDeck(deck - 1));
}
}

void BaseTrackPlayerImpl::slotLoadTrackFromSampler(double d) {
int sampler = static_cast<int>(d);
if (sampler >= 1) {
slotLoadTrackFromGroup(PlayerManager::groupForDeck(sampler - 1));
}
}

void BaseTrackPlayerImpl::slotLoadTrackFromGroup(const QString& group) {
EngineChannel* pChannel = m_pEngineMaster->getChannel(group);
if (!pChannel) {
return;
}

TrackPointer pTrack = pChannel->getEngineBuffer()->getLoadedTrack();
if (!pTrack) {
return;
}

slotLoadTrack(pTrack, false);
}

void BaseTrackPlayerImpl::slotSetReplayGain(mixxx::ReplayGain replayGain) {
// Do not change replay gain when track is playing because
// this may lead to an unexpected volume change.
Expand Down
7 changes: 7 additions & 0 deletions src/mixer/basetrackplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer {
void slotCloneChannel(EngineChannel* pChannel);
void slotCloneFromDeck(double deck);
void slotCloneFromSampler(double sampler);
void slotLoadTrackFromGroup(const QString& group);
void slotLoadTrackFromDeck(double deck);
void slotLoadTrackFromSampler(double sampler);
void slotTrackColorChangeRequest(double value);
void slotVinylControlEnabled(double v);
void slotWaveformZoomValueChangeRequest(double pressed);
Expand Down Expand Up @@ -129,6 +132,10 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer {
std::unique_ptr<ControlObject> m_pCloneFromDeck;
std::unique_ptr<ControlObject> m_pCloneFromSampler;

// Load track from other deck/sampler
std::unique_ptr<ControlObject> m_pLoadTrackFromDeck;
std::unique_ptr<ControlObject> m_pLoadTrackFromSampler;

// Track color control
std::unique_ptr<ControlObject> m_pTrackColor;

Expand Down

0 comments on commit 0f1e2c1

Please sign in to comment.