summaryrefslogtreecommitdiffstats
path: root/src/mixer
diff options
context:
space:
mode:
authorUwe Klotz <uklotz@mixxx.org>2021-01-01 12:45:51 +0100
committerUwe Klotz <uklotz@mixxx.org>2021-01-01 12:45:51 +0100
commitf48198216b76b44ba1ba1d696783b89477da2ccf (patch)
tree587a7c57b1e604ba536455e9f1775655900d34bf /src/mixer
parentca5521dba984a577decd9eac0ccd1f122e7578f3 (diff)
parenta532b195e3778f66835a9f1c070f63eb8d895980 (diff)
Merge branch '2.3' of git@github.com:mixxxdj/mixxx.git into main
Diffstat (limited to 'src/mixer')
-rw-r--r--src/mixer/playerinfo.cpp30
-rw-r--r--src/mixer/playerinfo.h3
2 files changed, 22 insertions, 11 deletions
diff --git a/src/mixer/playerinfo.cpp b/src/mixer/playerinfo.cpp
index 91b2bfc42c..93e43db93a 100644
--- a/src/mixer/playerinfo.cpp
+++ b/src/mixer/playerinfo.cpp
@@ -67,6 +67,11 @@ void PlayerInfo::setTrackInfo(const QString& group, const TrackPointer& track) {
emit trackUnloaded(group, pOld);
}
emit trackLoaded(group, track);
+
+ if (m_currentlyPlayingDeck >= 0 &&
+ group == PlayerManager::groupForDeck(m_currentlyPlayingDeck)) {
+ emit currentPlayingTrackChanged(track);
+ }
}
bool PlayerInfo::isTrackLoaded(const TrackPointer& pTrack) const {
@@ -113,6 +118,17 @@ void PlayerInfo::updateCurrentPlayingDeck() {
double maxVolume = 0;
int maxDeck = -1;
+ CSAMPLE_GAIN xfl, xfr;
+ // TODO: supply correct parameters to the function. If the hamster style
+ // for the crossfader is enabled, the result is currently wrong.
+ EngineXfader::getXfadeGains(m_pCOxfader->get(),
+ 1.0,
+ 0.0,
+ MIXXX_XFADER_ADDITIVE,
+ false,
+ &xfl,
+ &xfr);
+
for (int i = 0; i < (int)PlayerManager::numDecks(); ++i) {
DeckControls* pDc = getDeckControls(i);
@@ -129,12 +145,6 @@ void PlayerInfo::updateCurrentPlayingDeck() {
continue;
}
- CSAMPLE_GAIN xfl, xfr;
- // TODO: supply correct parameters to the function. If the hamster style
- // for the crossfader is enabled, the result is currently wrong.
- EngineXfader::getXfadeGains(m_pCOxfader->get(), 1.0, 0.0, MIXXX_XFADER_ADDITIVE, false,
- &xfl, &xfr);
-
const auto orient = static_cast<int>(pDc->m_orientation.get());
double xfvol;
if (orient == EngineChannel::LEFT) {
@@ -151,16 +161,16 @@ void PlayerInfo::updateCurrentPlayingDeck() {
maxVolume = dvol;
}
}
- if (maxDeck != m_currentlyPlayingDeck) {
- m_currentlyPlayingDeck = maxDeck;
- locker.unlock();
+ locker.unlock();
+
+ int oldDeck = m_currentlyPlayingDeck.fetchAndStoreRelease(maxDeck);
+ if (maxDeck != oldDeck) {
emit currentPlayingDeckChanged(maxDeck);
emit currentPlayingTrackChanged(getCurrentPlayingTrack());
}
}
int PlayerInfo::getCurrentPlayingDeck() {
- QMutexLocker locker(&m_mutex);
return m_currentlyPlayingDeck;
}
diff --git a/src/mixer/playerinfo.h b/src/mixer/playerinfo.h
index 2b06412cb0..7fc1035fcc 100644
--- a/src/mixer/playerinfo.h
+++ b/src/mixer/playerinfo.h
@@ -1,6 +1,7 @@
// Helper class to have easy access
#pragma once
+#include <QAtomicInt>
#include <QMap>
#include <QMutex>
#include <QObject>
@@ -57,7 +58,7 @@ class PlayerInfo : public QObject {
ControlProxy* m_pCOxfader;
// QMap is faster than QHash for small count of elements < 50
QMap<QString, TrackPointer> m_loadedTrackMap;
- int m_currentlyPlayingDeck;
+ QAtomicInt m_currentlyPlayingDeck;
QList<DeckControls*> m_deckControlList;
static PlayerInfo* m_pPlayerinfo;