Merge lp:~khyew/mixxx/fixes-1.9 into lp:mixxx/1.9

Proposed by Qifan Xi
Status: Merged
Approved by: Albert Santoni
Approved revision: 2757
Merged at revision: 2762
Proposed branch: lp:~khyew/mixxx/fixes-1.9
Merge into: lp:mixxx/1.9
Diff against target: 177 lines (+69/-11)
3 files modified
mixxx/src/engine/cuecontrol.cpp (+51/-10)
mixxx/src/engine/cuecontrol.h (+4/-0)
mixxx/src/midi/mididevice.cpp (+14/-1)
To merge this branch: bzr merge lp:~khyew/mixxx/fixes-1.9
Reviewer Review Type Date Requested Status
Albert Santoni Approve
Review via email: mp+52937@code.launchpad.net

Description of the change

fixes shit. I think I'm getting the hang of this Launchpad stuff finally.

To post a comment you must log in.
Revision history for this message
Albert Santoni (gamegod) wrote :

Looks good, thanks Qifan!

review: Approve
Revision history for this message
Albert Santoni (gamegod) wrote :

Also - Tests good with the SCS.3d.

The cue+play behaviour is slightly different with the SCS.3d compared to the keyboard, but I don't think it's a big deal for now. At some point the custom .js that implements this cue+play feature for the SCS.3d should be removed, now that it's in the Mixxx core.

For the record, the current behaviours are:

SCS.3d - to get cue+play to continue the song, you must press both cue and play down, then release cue first. If you release play first, it will not continue the song upon releasing cue.

Keyboard - to get cue+play to continue the song, you just need to tap play while cue is depressed. It doesn't matter what order you release the keys in after that. (This is the better behaviour.)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mixxx/src/engine/cuecontrol.cpp'
2--- mixxx/src/engine/cuecontrol.cpp 2010-12-03 17:55:48 +0000
3+++ mixxx/src/engine/cuecontrol.cpp 2011-03-10 22:17:15 +0000
4@@ -3,6 +3,8 @@
5
6 #include <QMutexLocker>
7
8+#include <QDebug>
9+
10 #include "engine/cuecontrol.h"
11
12 #include "controlobject.h"
13@@ -23,9 +25,11 @@
14 m_iCurrentlyPreviewingHotcues(0),
15 m_iNumHotCues(NUM_HOT_CUES),
16 m_pLoadedTrack(),
17- m_mutex(QMutex::Recursive) {
18+ m_mutex(QMutex::Recursive),
19+ m_bHotcueCancel(false) {
20 createControls();
21
22+
23 m_pTrackSamples = ControlObject::getControl(ConfigKey(_group, "track_samples"));
24
25 m_pCuePoint = new ControlObject(ConfigKey(_group, "cue_point"));
26@@ -67,6 +71,12 @@
27 connect(m_pCueDefault, SIGNAL(valueChanged(double)),
28 this, SLOT(cueDefault(double)),
29 Qt::DirectConnection);
30+
31+ connect(m_pPlayButton, SIGNAL(valueChanged(double)),
32+ this, SLOT(cuePlay(double)),
33+ Qt::DirectConnection);
34+
35+
36 }
37
38 CueControl::~CueControl() {
39@@ -342,6 +352,7 @@
40
41 if (pCue) {
42 if (v) {
43+ m_bHotcueCancel = false;
44 if (pCue->getPosition() == -1) {
45 hotcueSet(pControl, v);
46 } else {
47@@ -358,6 +369,8 @@
48 }
49 } else {
50 if (v) {
51+ // just in case
52+ m_bHotcueCancel = false;
53 hotcueSet(pControl, v);
54 }
55 }
56@@ -383,15 +396,25 @@
57 }
58 } else {
59 if (m_bPreviewingHotcue && pCue && pCue->getPosition() != -1) {
60- if (--m_iCurrentlyPreviewingHotcues == 0) {
61- int iPosition = pCue->getPosition();
62- m_pPlayButton->set(0.0);
63- m_bPreviewingHotcue = false;
64-
65- // Need to unlock before emitting any signals to prevent deadlock.
66- lock.unlock();
67-
68- emit(seekAbs(iPosition));
69+ if (m_bHotcueCancel) { // we want to keep playing from where we are
70+ if (--m_iCurrentlyPreviewingHotcues == 0) {
71+ m_bPreviewingHotcue = false;
72+ m_bHotcueCancel = false;
73+
74+ lock.unlock();
75+ }
76+ } else {
77+ if (--m_iCurrentlyPreviewingHotcues == 0) {
78+ int iPosition = pCue->getPosition();
79+ m_pPlayButton->set(0.0);
80+ m_bPreviewingHotcue = false;
81+
82+ // Need to unlock before emitting any signals to prevent deadlock.
83+ lock.unlock();
84+
85+ emit(seekAbs(iPosition));
86+ }
87+
88 }
89 }
90 }
91@@ -597,6 +620,24 @@
92 }
93 }
94
95+void CueControl::cuePlay(double v) {
96+// qDebug() << "cuePlay activated";
97+ QMutexLocker lock(&m_mutex);
98+
99+ if (m_bPreviewing && !v) {
100+ // we're previewing? Then stop previewing and go into normal play mode.
101+ m_pPlayButton->set(1.0);
102+ m_bPreviewing = false;
103+ }
104+
105+ if (m_bPreviewingHotcue && !v) {
106+ m_pPlayButton->set(1.0);
107+ m_bHotcueCancel = true;
108+ }
109+
110+ lock.unlock();
111+}
112+
113 void CueControl::cueDefault(double v) {
114 // Decide which cue implementation to call based on the user preference
115 if (m_pCueMode->get() == 0.0f) {
116
117=== modified file 'mixxx/src/engine/cuecontrol.h'
118--- mixxx/src/engine/cuecontrol.h 2010-12-03 17:51:41 +0000
119+++ mixxx/src/engine/cuecontrol.h 2011-03-10 22:17:15 +0000
120@@ -44,6 +44,7 @@
121 void hotcueActivatePreview(HotcueControl* pHotcue, double v);
122 void hotcueClear(HotcueControl* pHotcue, double v);
123 void hotcuePositionChanged(HotcueControl* pHotcue, double newPosition);
124+ void hotcuePlay(double v);
125
126 private:
127 ConfigKey keyForControl(int hotcue, QString name);
128@@ -62,6 +63,7 @@
129 ControlObject* m_hotcueActivate;
130 ControlObject* m_hotcueActivatePreview;
131 ControlObject* m_hotcueClear;
132+
133 };
134
135 class CueControl : public EngineControl {
136@@ -95,6 +97,7 @@
137 void cuePreview(double v);
138 void cueCDJ(double v);
139 void cueDefault(double v);
140+ void cuePlay(double v);
141
142 private:
143 // These methods are not thread safe, only call them when the lock is held.
144@@ -103,6 +106,7 @@
145 void detachCue(int hotcueNumber);
146 void saveCuePoint(double cuePoint);
147
148+ bool m_bHotcueCancel;
149 bool m_bPreviewing;
150 bool m_bPreviewingHotcue;
151 ControlObject* m_pPlayButton;
152
153=== modified file 'mixxx/src/midi/mididevice.cpp'
154--- mixxx/src/midi/mididevice.cpp 2011-02-13 07:26:18 +0000
155+++ mixxx/src/midi/mididevice.cpp 2011-03-10 22:17:15 +0000
156@@ -253,7 +253,20 @@
157
158 if (p) //Only pass values on to valid ControlObjects.
159 {
160- double newValue = m_pMidiMapping->ComputeValue(mixxxControl.getMidiOption(), p->GetMidiValue(), value);
161+ double newValue;
162+
163+ // compute LSB and MSB for pitch bend messages
164+ if (status == MIDI_STATUS_PITCH_BEND) {
165+ unsigned int ivalue;
166+ ivalue = (value << 7) + control;
167+
168+ newValue = m_pMidiMapping->ComputeValue(mixxxControl.getMidiOption(), p->GetMidiValue(), ivalue);
169+
170+ // normalize our value to 0-127
171+ newValue = (newValue / 0x3FFF) * 0x7F;
172+ } else {
173+ newValue = m_pMidiMapping->ComputeValue(mixxxControl.getMidiOption(), p->GetMidiValue(), value);
174+ }
175
176 // ControlPushButton ControlObjects only accept NOTE_ON, so if the midi
177 // mapping is <button> we override the Midi 'status' appropriately.

Subscribers

People subscribed via source and target branches