diff options
author | Uwe Klotz <uklotz@mixxx.org> | 2019-03-17 21:43:46 +0100 |
---|---|---|
committer | Uwe Klotz <uklotz@mixxx.org> | 2019-03-17 21:43:46 +0100 |
commit | 6edfcd87c1c76d623d49ab946740e4d47f218ac5 (patch) | |
tree | c627cbe33932c044721aaaeb0c569f2ddb822004 /src/mixer/playermanager.cpp | |
parent | 4ebc40f0539868723cb01556e91d789d9256fb81 (diff) | |
parent | 7d19ea43730913aba3aa2ee8b84c0a38e16de0ea (diff) |
Merge branch 'master' into unfinished_batch_analysis
Diffstat (limited to 'src/mixer/playermanager.cpp')
-rw-r--r-- | src/mixer/playermanager.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/mixer/playermanager.cpp b/src/mixer/playermanager.cpp index a759786a4a..899663c91d 100644 --- a/src/mixer/playermanager.cpp +++ b/src/mixer/playermanager.cpp @@ -78,6 +78,8 @@ PlayerManager::PlayerManager(UserSettingsPointer pConfig, // This is parented to the PlayerManager so does not need to be deleted m_pSamplerBank = new SamplerBank(this); + + m_cloneTimer.start(); } PlayerManager::~PlayerManager() { @@ -556,6 +558,17 @@ Auxiliary* PlayerManager::getAuxiliary(unsigned int auxiliary) const { return m_auxiliaries[auxiliary - 1]; } +void PlayerManager::slotCloneDeck(QString source_group, QString target_group) { + BaseTrackPlayer* pPlayer = getPlayer(target_group); + + if (pPlayer == nullptr) { + qWarning() << "Invalid group argument " << target_group << " to slotCloneDeck."; + return; + } + + pPlayer->slotCloneFromGroup(source_group); +} + void PlayerManager::slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bool play) { // Do not lock mutex in this method unless it is changed to access // PlayerManager state. @@ -566,7 +579,15 @@ void PlayerManager::slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bo return; } - pPlayer->slotLoadTrack(pTrack, play); + mixxx::Duration elapsed = m_cloneTimer.restart(); + if (m_lastLoadedPlayer == group && elapsed < mixxx::Duration::fromSeconds(0.5)) { + // load pressed twice quickly, clone instead of loading + pPlayer->slotCloneDeck(); + } else { + pPlayer->slotLoadTrack(pTrack, play); + } + + m_lastLoadedPlayer = group; } void PlayerManager::slotLoadToPlayer(QString location, QString group) { |