Skip to content

Commit cefa217

Browse files
committed
Merge branch 'autodj-orientation-main' into huxley-hacks-shared-data-2
2 parents 3f70145 + a890797 commit cefa217

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

src/library/autodj/autodjprocessor.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ DeckAttributes::DeckAttributes(int index,
5757
m_outroStartPos.connectValueChanged(this, &DeckAttributes::slotOutroStartPositionChanged);
5858
m_outroEndPos.connectValueChanged(this, &DeckAttributes::slotOutroEndPositionChanged);
5959
m_rateRatio.connectValueChanged(this, &DeckAttributes::slotRateChanged);
60+
m_orientation.connectValueChanged(this, &DeckAttributes::slotOrientationChanged);
6061
}
6162

6263
DeckAttributes::~DeckAttributes() {
@@ -104,6 +105,11 @@ void DeckAttributes::slotRateChanged(double v) {
104105
emit rateChanged(this);
105106
}
106107

108+
void DeckAttributes::slotOrientationChanged(double v) {
109+
Q_UNUSED(v);
110+
emit orientationChanged(this);
111+
}
112+
107113
TrackPointer DeckAttributes::getLoadedTrack() const {
108114
return m_pPlayer != nullptr ? m_pPlayer->getLoadedTrack() : TrackPointer();
109115
}
@@ -551,6 +557,16 @@ AutoDJProcessor::AutoDJError AutoDJProcessor::toggleAutoDJ(bool enable) {
551557
&DeckAttributes::rateChanged,
552558
this,
553559
&AutoDJProcessor::playerRateChanged);
560+
561+
connect(pLeftDeck,
562+
&DeckAttributes::orientationChanged,
563+
this,
564+
&AutoDJProcessor::playerOrientationChanged);
565+
connect(pRightDeck,
566+
&DeckAttributes::orientationChanged,
567+
this,
568+
&AutoDJProcessor::playerOrientationChanged);
569+
554570
connect(m_pAutoDJTableModel,
555571
&PlaylistTableModel::firstTrackChanged,
556572
this,
@@ -1701,6 +1717,19 @@ void AutoDJProcessor::playerRateChanged(DeckAttributes* pAttributes) {
17011717
calculateTransition(fromDeck, getOtherDeck(fromDeck), false);
17021718
}
17031719

1720+
void AutoDJProcessor::playerOrientationChanged(DeckAttributes* pAttributes) {
1721+
if constexpr (sDebug) {
1722+
qDebug() << this << "playerOrientationChanged" << pAttributes->group;
1723+
}
1724+
1725+
if (m_eState != ADJ_DISABLED) {
1726+
// Disable and Enable auto DJ. We will likely fail to enable auto DJ
1727+
// but that will pop up an error to explain the situation to the user.
1728+
toggleAutoDJ(false);
1729+
toggleAutoDJ(true);
1730+
}
1731+
}
1732+
17041733
void AutoDJProcessor::playlistFirstTrackChanged() {
17051734
if constexpr (sDebug) {
17061735
qDebug() << this << "playlistFirstTrackChanged";

src/library/autodj/autodjprocessor.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class DeckAttributes : public QObject {
101101
void loadingTrack(DeckAttributes* pDeck, TrackPointer pNewTrack, TrackPointer pOldTrack);
102102
void playerEmpty(DeckAttributes* pDeck);
103103
void rateChanged(DeckAttributes* pDeck);
104+
void orientationChanged(DeckAttributes* pDeck);
104105

105106
private slots:
106107
void slotPlayPosChanged(double v);
@@ -113,6 +114,7 @@ class DeckAttributes : public QObject {
113114
void slotLoadingTrack(TrackPointer pNewTrack, TrackPointer pOldTrack);
114115
void slotPlayerEmpty();
115116
void slotRateChanged(double v);
117+
void slotOrientationChanged(double v);
116118

117119
public:
118120
int index;
@@ -227,6 +229,7 @@ class AutoDJProcessor : public QObject {
227229
void playerLoadingTrack(DeckAttributes* pDeck, TrackPointer pNewTrack, TrackPointer pOldTrack);
228230
void playerEmpty(DeckAttributes* pDeck);
229231
void playerRateChanged(DeckAttributes* pDeck);
232+
void playerOrientationChanged(DeckAttributes* pDeck);
230233
void playlistFirstTrackChanged();
231234

232235
void controlEnableChangeRequest(double value);

0 commit comments

Comments
 (0)