Merge lp:~daschuer/mixxx/atomic-co into lp:~mixxxdevelopers/mixxx/atomic-co
- atomic-co
- Merge into atomic-co
Status: | Needs review |
---|---|
Proposed branch: | lp:~daschuer/mixxx/atomic-co |
Merge into: | lp:~mixxxdevelopers/mixxx/atomic-co |
Diff against target: |
416 lines (+59/-76) 12 files modified
mixxx/src/control/control.cpp (+10/-7) mixxx/src/control/control.h (+6/-6) mixxx/src/control/controlbehavior.cpp (+20/-14) mixxx/src/control/controlbehavior.h (+6/-3) mixxx/src/controllers/midi/midicontroller.cpp (+1/-1) mixxx/src/controlobject.cpp (+5/-12) mixxx/src/controlobject.h (+0/-3) mixxx/src/controlobjectthread.cpp (+1/-1) mixxx/src/engine/bpmcontrol.cpp (+0/-9) mixxx/src/engine/enginebuffer.cpp (+0/-3) mixxx/src/engine/ratecontrol.cpp (+0/-6) mixxx/src/vinylcontrol/vinylcontrolmanager.cpp (+10/-11) |
To merge this branch: | bzr merge lp:~daschuer/mixxx/atomic-co |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel Schürmann | Needs Fixing | ||
Review via email:
|
Commit message
Description of the change
See commit log
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
RJ Skerry-Ryan (rryan) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Daniel Schürmann (daschuer) wrote : | # |
For me this is an issue from BpmControl.
In slotControlBeatSync it sets a value to m_pRateSlider and rely on the call of slotAdjustBpm.
Simply calling slotAdjustBpm manually will fix this.
I think we must have a close look to
mixxx/src/
mixxx/src/
mixxx/src/
to find out similar issues and than it should be safe.
I like to do these changes, because it makes the code better understandable.
Our whole discussion convinced me, that it is the best approach:
NEVER receive a loopback value change signal.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
RJ Skerry-Ryan (rryan) wrote : | # |
This means all engine logic will become entangled. Take pitch bend for
example. Will you call slotadjustbpm from RateController? This will get bad
very quickly.
On May 17, 2013 2:12 AM, "Daniel Schürmann" <email address hidden> wrote:
> Review: Needs Fixing
>
> For me this is an issue from BpmControl.
> In slotControlBeatSync it sets a value to m_pRateSlider and rely on the
> call of slotAdjustBpm.
> Simply calling slotAdjustBpm manually will fix this.
>
> I think we must have a close look to
> mixxx/src/
> mixxx/src/
> mixxx/src/
> to find out similar issues and than it should be safe.
>
> I like to do these changes, because it makes the code better
> understandable.
>
> Our whole discussion convinced me, that it is the best approach:
> NEVER receive a loopback value change signal.
>
>
> --
> https:/
> Your team Mixxx Development Team is subscribed to branch
> lp:~mixxxdevelopers/mixxx/atomic-co.
>
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Daniel Schürmann (daschuer) wrote : | # |
Ah, I think I have got the point!
In the old model, we had a signal per thread and a thread based valve Logic.
Now, it is moved to CO/COT
So if RateControl sets "rate" it is done by his own private member m_pRateSlider which carry the valve logic.
BpmControl has an other private m_pRateSlider with its own valve logic.
So BpmControll will receive all updates from RateControl, (unless there is no bug ;-))
So we have now the benefit that two objects in the same thread can communicate via COs by a common interface :-))
Great!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
RJ Skerry-Ryan (rryan) wrote : | # |
Sure -- even the engine could use COTs now, but this is a more significant change than should be dealt with in this patch and something that IMO should wait until Control 2.0 is done (or even until the CO/COT are out of the engine completely a-la engine-
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Daniel Schürmann (daschuer) wrote : | # |
For me CO and COT behave almost similar already. So the change is nothing more than run a refactor-rename. :-)
- 3369. By Daniel Schürmann
-
merged from lp:~mixxxdevelopers/mixxx/atomic-co
Unmerged revisions
- 3369. By Daniel Schürmann
-
merged from lp:~mixxxdevelopers/mixxx/atomic-co
- 3368. By Daniel Schürmann
-
removed pSender from ControlDoublePr
ivate:: reset() - 3367. By Daniel Schürmann
-
removed setValueFromThread
- 3366. By Daniel Schürmann
-
added pSender to setMidiParameter
- 3365. By Daniel Schürmann
-
unified word choice for pSender, pSetter is the a function pointer to set() for me
- 3364. By Daniel Schürmann
-
removed valueChangedFro
mEngine( )
Preview Diff
1 | === modified file 'mixxx/src/control/control.cpp' | |||
2 | --- mixxx/src/control/control.cpp 2013-06-04 00:42:24 +0000 | |||
3 | +++ mixxx/src/control/control.cpp 2013-06-09 22:05:30 +0000 | |||
4 | @@ -77,9 +77,12 @@ | |||
5 | 77 | return m_value.getValue(); | 77 | return m_value.getValue(); |
6 | 78 | } | 78 | } |
7 | 79 | 79 | ||
9 | 80 | void ControlDoublePrivate::reset(QObject* pSender) { | 80 | void ControlDoublePrivate::reset() { |
10 | 81 | double defaultValue = m_defaultValue.getValue(); | 81 | double defaultValue = m_defaultValue.getValue(); |
12 | 82 | set(defaultValue, pSender); | 82 | // NOTE: pSender = NULL is important. The originator of this action does |
13 | 83 | // not know the resulting value so it makes sense that we should emit a | ||
14 | 84 | // general valueChanged() signal even though we know the originator. | ||
15 | 85 | set(defaultValue, NULL); | ||
16 | 83 | } | 86 | } |
17 | 84 | 87 | ||
18 | 85 | void ControlDoublePrivate::set(const double& value, QObject* pSender) { | 88 | void ControlDoublePrivate::set(const double& value, QObject* pSender) { |
19 | @@ -106,9 +109,9 @@ | |||
20 | 106 | return m_pBehavior.fetchAndStoreRelaxed(pBehavior); | 109 | return m_pBehavior.fetchAndStoreRelaxed(pBehavior); |
21 | 107 | } | 110 | } |
22 | 108 | 111 | ||
24 | 109 | void ControlDoublePrivate::setWidgetParameter(double dParam, QObject* pSetter) { | 112 | void ControlDoublePrivate::setWidgetParameter(double dParam, QObject* pSender) { |
25 | 110 | ControlNumericBehavior* pBehavior = m_pBehavior; | 113 | ControlNumericBehavior* pBehavior = m_pBehavior; |
27 | 111 | set(pBehavior ? pBehavior->widgetParameterToValue(dParam) : dParam, pSetter); | 114 | set(pBehavior ? pBehavior->widgetParameterToValue(dParam) : dParam, pSender); |
28 | 112 | } | 115 | } |
29 | 113 | 116 | ||
30 | 114 | double ControlDoublePrivate::getWidgetParameter() const { | 117 | double ControlDoublePrivate::getWidgetParameter() const { |
31 | @@ -116,12 +119,12 @@ | |||
32 | 116 | return pBehavior ? pBehavior->valueToWidgetParameter(get()) : get(); | 119 | return pBehavior ? pBehavior->valueToWidgetParameter(get()) : get(); |
33 | 117 | } | 120 | } |
34 | 118 | 121 | ||
36 | 119 | void ControlDoublePrivate::setMidiParameter(MidiOpCode opcode, double dParam) { | 122 | void ControlDoublePrivate::setMidiParameter(MidiOpCode opcode, double dParam, QObject* pSender) { |
37 | 120 | ControlNumericBehavior* pBehavior = m_pBehavior; | 123 | ControlNumericBehavior* pBehavior = m_pBehavior; |
38 | 121 | if (pBehavior) { | 124 | if (pBehavior) { |
40 | 122 | pBehavior->setValueFromMidiParameter(opcode, dParam, this); | 125 | pBehavior->setValueFromMidiParameter(opcode, dParam, this, pSender); |
41 | 123 | } else { | 126 | } else { |
43 | 124 | set(dParam, NULL); | 127 | set(dParam, pSender); |
44 | 125 | } | 128 | } |
45 | 126 | } | 129 | } |
46 | 127 | 130 | ||
47 | 128 | 131 | ||
48 | === modified file 'mixxx/src/control/control.h' | |||
49 | --- mixxx/src/control/control.h 2013-05-16 01:40:06 +0000 | |||
50 | +++ mixxx/src/control/control.h 2013-06-09 22:05:30 +0000 | |||
51 | @@ -32,11 +32,11 @@ | |||
52 | 32 | } | 32 | } |
53 | 33 | 33 | ||
54 | 34 | // Sets the control value. | 34 | // Sets the control value. |
56 | 35 | void set(const double& value, QObject* pSetter); | 35 | void set(const double& value, QObject* pSender); |
57 | 36 | // Gets the control value. | 36 | // Gets the control value. |
58 | 37 | double get() const; | 37 | double get() const; |
59 | 38 | // Resets the control value to its default. | 38 | // Resets the control value to its default. |
61 | 39 | void reset(QObject* pSetter); | 39 | void reset(); |
62 | 40 | 40 | ||
63 | 41 | // Set the behavior to be used when setting values and translating between | 41 | // Set the behavior to be used when setting values and translating between |
64 | 42 | // parameter and value space. Returns the previously set behavior (if any). | 42 | // parameter and value space. Returns the previously set behavior (if any). |
65 | @@ -44,10 +44,10 @@ | |||
66 | 44 | // memory will leak. | 44 | // memory will leak. |
67 | 45 | ControlNumericBehavior* setBehavior(ControlNumericBehavior* pBehavior); | 45 | ControlNumericBehavior* setBehavior(ControlNumericBehavior* pBehavior); |
68 | 46 | 46 | ||
70 | 47 | void setWidgetParameter(double dParam, QObject* pSetter); | 47 | void setWidgetParameter(double dParam, QObject* pSender); |
71 | 48 | double getWidgetParameter() const; | 48 | double getWidgetParameter() const; |
72 | 49 | 49 | ||
74 | 50 | void setMidiParameter(MidiOpCode opcode, double dParam); | 50 | void setMidiParameter(MidiOpCode opcode, double dParam, QObject* pSender); |
75 | 51 | double getMidiParameter() const; | 51 | double getMidiParameter() const; |
76 | 52 | 52 | ||
77 | 53 | inline bool ignoreNops() const { | 53 | inline bool ignoreNops() const { |
78 | @@ -63,9 +63,9 @@ | |||
79 | 63 | } | 63 | } |
80 | 64 | 64 | ||
81 | 65 | signals: | 65 | signals: |
83 | 66 | // Emitted when the ControlDoublePrivate value changes. pSetter is a | 66 | // Emitted when the ControlDoublePrivate value changes. pSender is a |
84 | 67 | // pointer to the setter of the value (potentially NULL). | 67 | // pointer to the setter of the value (potentially NULL). |
86 | 68 | void valueChanged(double value, QObject* pSetter); | 68 | void valueChanged(double value, QObject* pSender); |
87 | 69 | 69 | ||
88 | 70 | private: | 70 | private: |
89 | 71 | ConfigKey m_key; | 71 | ConfigKey m_key; |
90 | 72 | 72 | ||
91 | === modified file 'mixxx/src/control/controlbehavior.cpp' | |||
92 | --- mixxx/src/control/controlbehavior.cpp 2013-05-19 10:55:28 +0000 | |||
93 | +++ mixxx/src/control/controlbehavior.cpp 2013-06-09 22:05:30 +0000 | |||
94 | @@ -23,9 +23,10 @@ | |||
95 | 23 | } | 23 | } |
96 | 24 | 24 | ||
97 | 25 | void ControlNumericBehavior::setValueFromMidiParameter(MidiOpCode o, double dParam, | 25 | void ControlNumericBehavior::setValueFromMidiParameter(MidiOpCode o, double dParam, |
99 | 26 | ControlDoublePrivate* pControl) { | 26 | ControlDoublePrivate* pControl, |
100 | 27 | QObject* pSender) { | ||
101 | 27 | Q_UNUSED(o); | 28 | Q_UNUSED(o); |
103 | 28 | pControl->set(dParam, NULL); | 29 | pControl->set(dParam, pSender); |
104 | 29 | } | 30 | } |
105 | 30 | 31 | ||
106 | 31 | ControlPotmeterBehavior::ControlPotmeterBehavior(double dMinValue, double dMaxValue) | 32 | ControlPotmeterBehavior::ControlPotmeterBehavior(double dMinValue, double dMaxValue) |
107 | @@ -67,9 +68,10 @@ | |||
108 | 67 | } | 68 | } |
109 | 68 | 69 | ||
110 | 69 | void ControlPotmeterBehavior::setValueFromMidiParameter(MidiOpCode o, double dParam, | 70 | void ControlPotmeterBehavior::setValueFromMidiParameter(MidiOpCode o, double dParam, |
112 | 70 | ControlDoublePrivate* pControl) { | 71 | ControlDoublePrivate* pControl, |
113 | 72 | QObject* pSender) { | ||
114 | 71 | Q_UNUSED(o); | 73 | Q_UNUSED(o); |
116 | 72 | pControl->set(widgetParameterToValue(dParam), NULL); | 74 | pControl->set(widgetParameterToValue(dParam), pSender); |
117 | 73 | } | 75 | } |
118 | 74 | 76 | ||
119 | 75 | #define maxPosition 127 | 77 | #define maxPosition 127 |
120 | @@ -161,47 +163,51 @@ | |||
121 | 161 | } | 163 | } |
122 | 162 | 164 | ||
123 | 163 | void ControlPushButtonBehavior::setValueFromMidiParameter( | 165 | void ControlPushButtonBehavior::setValueFromMidiParameter( |
125 | 164 | MidiOpCode o, double dParam, ControlDoublePrivate* pControl) { | 166 | MidiOpCode o, double dParam, ControlDoublePrivate* pControl, QObject* pSender) { |
126 | 165 | // This block makes push-buttons act as power window buttons. | 167 | // This block makes push-buttons act as power window buttons. |
127 | 166 | if (m_buttonMode == POWERWINDOW && m_iNumStates == 2) { | 168 | if (m_buttonMode == POWERWINDOW && m_iNumStates == 2) { |
128 | 167 | if (o == MIDI_NOTE_ON) { | 169 | if (o == MIDI_NOTE_ON) { |
129 | 168 | if (dParam > 0.) { | 170 | if (dParam > 0.) { |
130 | 169 | double value = pControl->get(); | 171 | double value = pControl->get(); |
132 | 170 | pControl->set(!value, NULL); | 172 | pControl->set(!value, pSender); |
133 | 171 | m_pushTimer.setSingleShot(true); | 173 | m_pushTimer.setSingleShot(true); |
134 | 172 | m_pushTimer.start(kPowerWindowTimeMillis); | 174 | m_pushTimer.start(kPowerWindowTimeMillis); |
135 | 173 | } | 175 | } |
136 | 174 | } else if (o == MIDI_NOTE_OFF) { | 176 | } else if (o == MIDI_NOTE_OFF) { |
137 | 175 | if (!m_pushTimer.isActive()) { | 177 | if (!m_pushTimer.isActive()) { |
139 | 176 | pControl->set(0.0, NULL); | 178 | pControl->set(0.0, pSender); |
140 | 177 | } | 179 | } |
141 | 178 | } | 180 | } |
142 | 179 | } else if (m_buttonMode == TOGGLE) { | 181 | } else if (m_buttonMode == TOGGLE) { |
143 | 180 | // This block makes push-buttons act as toggle buttons. | 182 | // This block makes push-buttons act as toggle buttons. |
146 | 181 | if (m_iNumStates > 2) { //multistate button | 183 | if (m_iNumStates > 2) { // multistate button |
147 | 182 | if (dParam > 0.) { //looking for NOTE_ON doesn't seem to work... | 184 | if (dParam > 0.) { // looking for NOTE_ON doesn't seem to work... |
148 | 185 | // This is a possible race condition if an other writer wants | ||
149 | 186 | // to change the value at the same time. We allow the race her, | ||
150 | 187 | // because this is possible what the user expect if he controls | ||
151 | 188 | // the same control from different devices. | ||
152 | 183 | double value = pControl->get(); | 189 | double value = pControl->get(); |
153 | 184 | value++; | 190 | value++; |
154 | 185 | if (value >= m_iNumStates) { | 191 | if (value >= m_iNumStates) { |
156 | 186 | pControl->set(0, NULL); | 192 | pControl->set(0, pSender); |
157 | 187 | } else { | 193 | } else { |
159 | 188 | pControl->set(value, NULL); | 194 | pControl->set(value, pSender); |
160 | 189 | } | 195 | } |
161 | 190 | } | 196 | } |
162 | 191 | } else { | 197 | } else { |
163 | 192 | if (o == MIDI_NOTE_ON) { | 198 | if (o == MIDI_NOTE_ON) { |
164 | 193 | if (dParam > 0.) { | 199 | if (dParam > 0.) { |
165 | 194 | double value = pControl->get(); | 200 | double value = pControl->get(); |
167 | 195 | pControl->set(!value, NULL); | 201 | pControl->set(!value, pSender); |
168 | 196 | } | 202 | } |
169 | 197 | } | 203 | } |
170 | 198 | } | 204 | } |
171 | 199 | } else { //Not a toggle button (trigger only when button pushed) | 205 | } else { //Not a toggle button (trigger only when button pushed) |
172 | 200 | if (o == MIDI_NOTE_ON) { | 206 | if (o == MIDI_NOTE_ON) { |
173 | 201 | double value = pControl->get(); | 207 | double value = pControl->get(); |
175 | 202 | pControl->set(!value, NULL); | 208 | pControl->set(!value, pSender); |
176 | 203 | } else if (o == MIDI_NOTE_OFF) { | 209 | } else if (o == MIDI_NOTE_OFF) { |
178 | 204 | pControl->set(0.0, NULL); | 210 | pControl->set(0.0, pSender); |
179 | 205 | } | 211 | } |
180 | 206 | } | 212 | } |
181 | 207 | } | 213 | } |
182 | 208 | 214 | ||
183 | === modified file 'mixxx/src/control/controlbehavior.h' | |||
184 | --- mixxx/src/control/controlbehavior.h 2013-05-19 10:55:28 +0000 | |||
185 | +++ mixxx/src/control/controlbehavior.h 2013-06-09 22:05:30 +0000 | |||
186 | @@ -21,7 +21,8 @@ | |||
187 | 21 | virtual double widgetParameterToValue(double dParam); | 21 | virtual double widgetParameterToValue(double dParam); |
188 | 22 | virtual double valueToMidiParameter(double dValue); | 22 | virtual double valueToMidiParameter(double dValue); |
189 | 23 | virtual void setValueFromMidiParameter(MidiOpCode o, double dParam, | 23 | virtual void setValueFromMidiParameter(MidiOpCode o, double dParam, |
191 | 24 | ControlDoublePrivate* pControl); | 24 | ControlDoublePrivate* pControl, |
192 | 25 | QObject* pSender); | ||
193 | 25 | }; | 26 | }; |
194 | 26 | 27 | ||
195 | 27 | class ControlPotmeterBehavior : public ControlNumericBehavior { | 28 | class ControlPotmeterBehavior : public ControlNumericBehavior { |
196 | @@ -35,7 +36,8 @@ | |||
197 | 35 | virtual double widgetParameterToValue(double dParam); | 36 | virtual double widgetParameterToValue(double dParam); |
198 | 36 | virtual double valueToMidiParameter(double dValue); | 37 | virtual double valueToMidiParameter(double dValue); |
199 | 37 | virtual void setValueFromMidiParameter(MidiOpCode o, double dParam, | 38 | virtual void setValueFromMidiParameter(MidiOpCode o, double dParam, |
201 | 38 | ControlDoublePrivate* pControl); | 39 | ControlDoublePrivate* pControl, |
202 | 40 | QObject* pSender); | ||
203 | 39 | 41 | ||
204 | 40 | protected: | 42 | protected: |
205 | 41 | double m_dMinValue; | 43 | double m_dMinValue; |
206 | @@ -87,7 +89,8 @@ | |||
207 | 87 | 89 | ||
208 | 88 | ControlPushButtonBehavior(ButtonMode buttonMode, int iNumStates); | 90 | ControlPushButtonBehavior(ButtonMode buttonMode, int iNumStates); |
209 | 89 | virtual void setValueFromMidiParameter(MidiOpCode o, double dParam, | 91 | virtual void setValueFromMidiParameter(MidiOpCode o, double dParam, |
211 | 90 | ControlDoublePrivate* pControl); | 92 | ControlDoublePrivate* pControl, |
212 | 93 | QObject* pSender); | ||
213 | 91 | 94 | ||
214 | 92 | private: | 95 | private: |
215 | 93 | ButtonMode m_buttonMode; | 96 | ButtonMode m_buttonMode; |
216 | 94 | 97 | ||
217 | === modified file 'mixxx/src/controllers/midi/midicontroller.cpp' | |||
218 | --- mixxx/src/controllers/midi/midicontroller.cpp 2013-05-16 00:14:12 +0000 | |||
219 | +++ mixxx/src/controllers/midi/midicontroller.cpp 2013-06-09 22:05:30 +0000 | |||
220 | @@ -356,7 +356,7 @@ | |||
221 | 356 | return; | 356 | return; |
222 | 357 | } | 357 | } |
223 | 358 | } | 358 | } |
225 | 359 | p->setValueFromThread(newValue, NULL); | 359 | p->set(newValue); |
226 | 360 | } else { | 360 | } else { |
227 | 361 | if (options.soft_takeover) { | 361 | if (options.soft_takeover) { |
228 | 362 | if (m_st.ignore(p, newValue, true)) { | 362 | if (m_st.ignore(p, newValue, true)) { |
229 | 363 | 363 | ||
230 | === modified file 'mixxx/src/controlobject.cpp' | |||
231 | --- mixxx/src/controlobject.cpp 2013-05-17 16:33:04 +0000 | |||
232 | +++ mixxx/src/controlobject.cpp 2013-06-09 22:05:30 +0000 | |||
233 | @@ -64,12 +64,11 @@ | |||
234 | 64 | m_sqCOHashMutex.unlock(); | 64 | m_sqCOHashMutex.unlock(); |
235 | 65 | } | 65 | } |
236 | 66 | 66 | ||
238 | 67 | void ControlObject::privateValueChanged(double dValue, QObject* pSetter) { | 67 | // slot |
239 | 68 | void ControlObject::privateValueChanged(double dValue, QObject* pSender) { | ||
240 | 68 | // Only emit valueChanged() if we did not originate this change. | 69 | // Only emit valueChanged() if we did not originate this change. |
242 | 69 | if (pSetter != this) { | 70 | if (pSender != this) { |
243 | 70 | emit(valueChanged(dValue)); | 71 | emit(valueChanged(dValue)); |
244 | 71 | } else { | ||
245 | 72 | emit(valueChangedFromEngine(dValue)); | ||
246 | 73 | } | 72 | } |
247 | 74 | } | 73 | } |
248 | 75 | 74 | ||
249 | @@ -128,7 +127,7 @@ | |||
250 | 128 | 127 | ||
251 | 129 | void ControlObject::setValueFromMidi(MidiOpCode o, double v) { | 128 | void ControlObject::setValueFromMidi(MidiOpCode o, double v) { |
252 | 130 | if (m_pControl) { | 129 | if (m_pControl) { |
254 | 131 | m_pControl->setMidiParameter(o, v); | 130 | m_pControl->setMidiParameter(o, v, this); |
255 | 132 | } | 131 | } |
256 | 133 | } | 132 | } |
257 | 134 | 133 | ||
258 | @@ -136,19 +135,13 @@ | |||
259 | 136 | return m_pControl ? m_pControl->getMidiParameter() : 0.0; | 135 | return m_pControl ? m_pControl->getMidiParameter() : 0.0; |
260 | 137 | } | 136 | } |
261 | 138 | 137 | ||
262 | 139 | void ControlObject::setValueFromThread(double dValue, QObject* pSender) { | ||
263 | 140 | if (m_pControl) { | ||
264 | 141 | m_pControl->set(dValue, pSender); | ||
265 | 142 | } | ||
266 | 143 | } | ||
267 | 144 | |||
268 | 145 | double ControlObject::get() const { | 138 | double ControlObject::get() const { |
269 | 146 | return m_pControl ? m_pControl->get() : 0.0; | 139 | return m_pControl ? m_pControl->get() : 0.0; |
270 | 147 | } | 140 | } |
271 | 148 | 141 | ||
272 | 149 | void ControlObject::reset() { | 142 | void ControlObject::reset() { |
273 | 150 | if (m_pControl) { | 143 | if (m_pControl) { |
275 | 151 | m_pControl->reset(this); | 144 | m_pControl->reset(); |
276 | 152 | } | 145 | } |
277 | 153 | } | 146 | } |
278 | 154 | 147 | ||
279 | 155 | 148 | ||
280 | === modified file 'mixxx/src/controlobject.h' | |||
281 | --- mixxx/src/controlobject.h 2013-05-17 16:33:04 +0000 | |||
282 | +++ mixxx/src/controlobject.h 2013-06-09 22:05:30 +0000 | |||
283 | @@ -66,15 +66,12 @@ | |||
284 | 66 | 66 | ||
285 | 67 | signals: | 67 | signals: |
286 | 68 | void valueChanged(double); | 68 | void valueChanged(double); |
287 | 69 | void valueChangedFromEngine(double); | ||
288 | 70 | 69 | ||
289 | 71 | public: | 70 | public: |
290 | 72 | // DEPRECATED: Called to set the control value from the controller | 71 | // DEPRECATED: Called to set the control value from the controller |
291 | 73 | // subsystem. | 72 | // subsystem. |
292 | 74 | virtual void setValueFromMidi(MidiOpCode o, double v); | 73 | virtual void setValueFromMidi(MidiOpCode o, double v); |
293 | 75 | virtual double getValueToMidi() const; | 74 | virtual double getValueToMidi() const; |
294 | 76 | // DEPRECATED: Called to set the control value from another thread. | ||
295 | 77 | virtual void setValueFromThread(double dValue, QObject* pSetter); | ||
296 | 78 | 75 | ||
297 | 79 | protected: | 76 | protected: |
298 | 80 | // Key of the object | 77 | // Key of the object |
299 | 81 | 78 | ||
300 | === modified file 'mixxx/src/controlobjectthread.cpp' | |||
301 | --- mixxx/src/controlobjectthread.cpp 2013-06-04 02:31:32 +0000 | |||
302 | +++ mixxx/src/controlobjectthread.cpp 2013-06-09 22:05:30 +0000 | |||
303 | @@ -70,7 +70,7 @@ | |||
304 | 70 | // general valueChanged() signal even though the change originated from | 70 | // general valueChanged() signal even though the change originated from |
305 | 71 | // us. For this reason, we provide NULL here so that the change is | 71 | // us. For this reason, we provide NULL here so that the change is |
306 | 72 | // broadcast as valueChanged() and not valueChangedByThis(). | 72 | // broadcast as valueChanged() and not valueChangedByThis(). |
308 | 73 | m_pControl->reset(NULL); | 73 | m_pControl->reset(); |
309 | 74 | } | 74 | } |
310 | 75 | } | 75 | } |
311 | 76 | 76 | ||
312 | 77 | 77 | ||
313 | === modified file 'mixxx/src/engine/bpmcontrol.cpp' | |||
314 | --- mixxx/src/engine/bpmcontrol.cpp 2013-06-04 18:09:35 +0000 | |||
315 | +++ mixxx/src/engine/bpmcontrol.cpp 2013-06-09 22:05:30 +0000 | |||
316 | @@ -26,25 +26,16 @@ | |||
317 | 26 | connect(m_pRateSlider, SIGNAL(valueChanged(double)), | 26 | connect(m_pRateSlider, SIGNAL(valueChanged(double)), |
318 | 27 | this, SLOT(slotAdjustBpm()), | 27 | this, SLOT(slotAdjustBpm()), |
319 | 28 | Qt::DirectConnection); | 28 | Qt::DirectConnection); |
320 | 29 | connect(m_pRateSlider, SIGNAL(valueChangedFromEngine(double)), | ||
321 | 30 | this, SLOT(slotAdjustBpm()), | ||
322 | 31 | Qt::DirectConnection); | ||
323 | 32 | 29 | ||
324 | 33 | m_pRateRange = ControlObject::getControl(ConfigKey(_group, "rateRange")); | 30 | m_pRateRange = ControlObject::getControl(ConfigKey(_group, "rateRange")); |
325 | 34 | connect(m_pRateRange, SIGNAL(valueChanged(double)), | 31 | connect(m_pRateRange, SIGNAL(valueChanged(double)), |
326 | 35 | this, SLOT(slotAdjustBpm()), | 32 | this, SLOT(slotAdjustBpm()), |
327 | 36 | Qt::DirectConnection); | 33 | Qt::DirectConnection); |
328 | 37 | connect(m_pRateRange, SIGNAL(valueChangedFromEngine(double)), | ||
329 | 38 | this, SLOT(slotAdjustBpm()), | ||
330 | 39 | Qt::DirectConnection); | ||
331 | 40 | 34 | ||
332 | 41 | m_pRateDir = ControlObject::getControl(ConfigKey(_group, "rate_dir")); | 35 | m_pRateDir = ControlObject::getControl(ConfigKey(_group, "rate_dir")); |
333 | 42 | connect(m_pRateDir, SIGNAL(valueChanged(double)), | 36 | connect(m_pRateDir, SIGNAL(valueChanged(double)), |
334 | 43 | this, SLOT(slotAdjustBpm()), | 37 | this, SLOT(slotAdjustBpm()), |
335 | 44 | Qt::DirectConnection); | 38 | Qt::DirectConnection); |
336 | 45 | connect(m_pRateDir, SIGNAL(valueChangedFromEngine(double)), | ||
337 | 46 | this, SLOT(slotAdjustBpm()), | ||
338 | 47 | Qt::DirectConnection); | ||
339 | 48 | 39 | ||
340 | 49 | m_pLoopEnabled = ControlObject::getControl( | 40 | m_pLoopEnabled = ControlObject::getControl( |
341 | 50 | ConfigKey(_group, "loop_enabled")); | 41 | ConfigKey(_group, "loop_enabled")); |
342 | 51 | 42 | ||
343 | === modified file 'mixxx/src/engine/enginebuffer.cpp' | |||
344 | --- mixxx/src/engine/enginebuffer.cpp 2013-06-09 04:01:53 +0000 | |||
345 | +++ mixxx/src/engine/enginebuffer.cpp 2013-06-09 22:05:30 +0000 | |||
346 | @@ -147,9 +147,6 @@ | |||
347 | 147 | connect(m_pSlipButton, SIGNAL(valueChanged(double)), | 147 | connect(m_pSlipButton, SIGNAL(valueChanged(double)), |
348 | 148 | this, SLOT(slotControlSlip(double)), | 148 | this, SLOT(slotControlSlip(double)), |
349 | 149 | Qt::DirectConnection); | 149 | Qt::DirectConnection); |
350 | 150 | connect(m_pSlipButton, SIGNAL(valueChangedFromEngine(double)), | ||
351 | 151 | this, SLOT(slotControlSlip(double)), | ||
352 | 152 | Qt::DirectConnection); | ||
353 | 153 | m_pSlipPosition = new ControlObject(ConfigKey(m_group, "slip_playposition")); | 150 | m_pSlipPosition = new ControlObject(ConfigKey(m_group, "slip_playposition")); |
354 | 154 | 151 | ||
355 | 155 | // Actual rate (used in visuals, not for control) | 152 | // Actual rate (used in visuals, not for control) |
356 | 156 | 153 | ||
357 | === modified file 'mixxx/src/engine/ratecontrol.cpp' | |||
358 | --- mixxx/src/engine/ratecontrol.cpp 2013-05-15 23:01:31 +0000 | |||
359 | +++ mixxx/src/engine/ratecontrol.cpp 2013-06-09 22:05:30 +0000 | |||
360 | @@ -153,9 +153,6 @@ | |||
361 | 153 | connect(pVCEnabled, SIGNAL(valueChanged(double)), | 153 | connect(pVCEnabled, SIGNAL(valueChanged(double)), |
362 | 154 | this, SLOT(slotControlVinyl(double)), | 154 | this, SLOT(slotControlVinyl(double)), |
363 | 155 | Qt::DirectConnection); | 155 | Qt::DirectConnection); |
364 | 156 | connect(pVCEnabled, SIGNAL(valueChangedFromEngine(double)), | ||
365 | 157 | this, SLOT(slotControlVinyl(double)), | ||
366 | 158 | Qt::DirectConnection); | ||
367 | 159 | 156 | ||
368 | 160 | ControlObject* pVCScratching = ControlObject::getControl(ConfigKey(_group, "vinylcontrol_scratching")); | 157 | ControlObject* pVCScratching = ControlObject::getControl(ConfigKey(_group, "vinylcontrol_scratching")); |
369 | 161 | // Throw a hissy fit if somebody moved us such that the vinylcontrol_enabled | 158 | // Throw a hissy fit if somebody moved us such that the vinylcontrol_enabled |
370 | @@ -164,9 +161,6 @@ | |||
371 | 164 | connect(pVCScratching, SIGNAL(valueChanged(double)), | 161 | connect(pVCScratching, SIGNAL(valueChanged(double)), |
372 | 165 | this, SLOT(slotControlVinylScratching(double)), | 162 | this, SLOT(slotControlVinylScratching(double)), |
373 | 166 | Qt::DirectConnection); | 163 | Qt::DirectConnection); |
374 | 167 | connect(pVCScratching, SIGNAL(valueChangedFromEngine(double)), | ||
375 | 168 | this, SLOT(slotControlVinylScratching(double)), | ||
376 | 169 | Qt::DirectConnection); | ||
377 | 170 | #endif | 164 | #endif |
378 | 171 | } | 165 | } |
379 | 172 | 166 | ||
380 | 173 | 167 | ||
381 | === modified file 'mixxx/src/vinylcontrol/vinylcontrolmanager.cpp' | |||
382 | --- mixxx/src/vinylcontrol/vinylcontrolmanager.cpp 2013-06-08 16:58:22 +0000 | |||
383 | +++ mixxx/src/vinylcontrol/vinylcontrolmanager.cpp 2013-06-09 22:05:30 +0000 | |||
384 | @@ -52,22 +52,21 @@ | |||
385 | 52 | void VinylControlManager::init() { | 52 | void VinylControlManager::init() { |
386 | 53 | // Load saved preferences now that the objects exist | 53 | // Load saved preferences now that the objects exist |
387 | 54 | ControlObject::getControl(ConfigKey("[Channel1]","vinylcontrol_enabled")) | 54 | ControlObject::getControl(ConfigKey("[Channel1]","vinylcontrol_enabled")) |
389 | 55 | ->setValueFromThread(0, NULL); | 55 | ->set(0); |
390 | 56 | ControlObject::getControl(ConfigKey("[Channel2]","vinylcontrol_enabled")) | 56 | ControlObject::getControl(ConfigKey("[Channel2]","vinylcontrol_enabled")) |
393 | 57 | ->setValueFromThread(0, NULL); | 57 | ->set(0); |
392 | 58 | |||
394 | 59 | ControlObject::getControl(ConfigKey("[Channel1]","vinylcontrol_mode")) | 58 | ControlObject::getControl(ConfigKey("[Channel1]","vinylcontrol_mode")) |
397 | 60 | ->setValueFromThread(m_pConfig->getValueString( | 59 | ->set(m_pConfig->getValueString( |
398 | 61 | ConfigKey(VINYL_PREF_KEY,"mode")).toDouble(), NULL); | 60 | ConfigKey(VINYL_PREF_KEY,"mode")).toDouble()); |
399 | 62 | ControlObject::getControl(ConfigKey("[Channel2]","vinylcontrol_mode")) | 61 | ControlObject::getControl(ConfigKey("[Channel2]","vinylcontrol_mode")) |
402 | 63 | ->setValueFromThread(m_pConfig->getValueString( | 62 | ->set(m_pConfig->getValueString( |
403 | 64 | ConfigKey(VINYL_PREF_KEY,"mode")).toDouble(), NULL); | 63 | ConfigKey(VINYL_PREF_KEY,"mode")).toDouble()); |
404 | 65 | ControlObject::getControl(ConfigKey("[Channel1]","vinylcontrol_cueing")) | 64 | ControlObject::getControl(ConfigKey("[Channel1]","vinylcontrol_cueing")) |
407 | 66 | ->setValueFromThread(m_pConfig->getValueString( | 65 | ->set(m_pConfig->getValueString( |
408 | 67 | ConfigKey(VINYL_PREF_KEY,"cueing_ch1")).toDouble(), NULL); | 66 | ConfigKey(VINYL_PREF_KEY,"cueing_ch1")).toDouble()); |
409 | 68 | ControlObject::getControl(ConfigKey("[Channel2]","vinylcontrol_cueing")) | 67 | ControlObject::getControl(ConfigKey("[Channel2]","vinylcontrol_cueing")) |
412 | 69 | ->setValueFromThread(m_pConfig->getValueString( | 68 | ->set(m_pConfig->getValueString( |
413 | 70 | ConfigKey(VINYL_PREF_KEY,"cueing_ch2")).toDouble(), NULL); | 69 | ConfigKey(VINYL_PREF_KEY,"cueing_ch2")).toDouble()); |
414 | 71 | } | 70 | } |
415 | 72 | 71 | ||
416 | 73 | void VinylControlManager::requestReloadConfig() { | 72 | void VinylControlManager::requestReloadConfig() { |
We have to keep valueChangedFro mEngine. It's important to be able to react
to internal sets of controls. For example this breaks BpmControl reacting
to engine rate changes. Try hitting the sync button. The BPM text won't
change.
On May 16, 2013 7:49 PM, "Daniel Schürmann" <email address hidden> wrote:
> Daniel Schürmann has proposed merging lp:~daschuer/mixxx/atomic-co into /code.launchpad .net/~daschuer/ mixxx/atomic- co/+merge/ 164281 /code.launchpad .net/~daschuer/ mixxx/atomic- co/+merge/ 164281 src/control/ control. cpp' control/ control. cpp 2013-05-16 01:40:06 +0000 control/ control. cpp 2013-05-16 23:48:28 +0000 ivate:: reset(QObject* pSender) { ivate:: reset() { getValue( ); ivate:: set(const double& value, QObject* pSender) { fetchAndStoreRe laxed(pBehavior ); ivate:: setWidgetParame ter(double dParam, QObject* ivate:: setWidgetParame ter(double dParam, QObject* ehavior* pBehavior = m_pBehavior; >widgetParamete rToValue( dParam) : dParam, >widgetParamete rToValue( dParam) : dParam, ivate:: getWidgetParame ter() const { >valueToWidgetP arameter( get()) : get(); ivate:: setMidiParamete r(MidiOpCode opcode, double ivate:: setMidiParamete r(MidiOpCode opcode, double ehavior* pBehavior = m_pBehavior; >setValueFromMi diParameter( opcode, dParam, this); >setValueFromMi diParameter( opcode, dParam, this, src/control/ control. h' control/ control. h 2013-05-16 01:40:06 +0000 control/ control. h 2013-05-16 23:48:28 +0000
> lp:~mixxxdevelopers/mixxx/atomic-co.
>
> Requested reviews:
> Mixxx Development Team (mixxxdevelopers)
>
> For more details, see:
> https:/
>
> See commit log
> --
> https:/
> Your team Mixxx Development Team is requested to review the proposed merge
> of lp:~daschuer/mixxx/atomic-co into lp:~mixxxdevelopers/mixxx/atomic-co.
>
> === modified file 'mixxx/
> --- mixxx/src/
> +++ mixxx/src/
> @@ -77,9 +77,12 @@
> return m_value.getValue();
> }
>
> -void ControlDoublePr
> +void ControlDoublePr
> double defaultValue = m_defaultValue.
> - set(defaultValue, pSender);
> + // NOTE: pSender = NULL is important. The originator of this action
> does
> + // not know the resulting value so it makes sense that we should emit
> a
> + // general valueChanged() signal even though we know the originator.
> + set(defaultValue, NULL);
> }
>
> void ControlDoublePr
> @@ -106,9 +109,9 @@
> return m_pBehavior.
> }
>
> -void ControlDoublePr
> pSetter) {
> +void ControlDoublePr
> pSender) {
> ControlNumericB
> - set(pBehavior ? pBehavior-
> pSetter);
> + set(pBehavior ? pBehavior-
> pSender);
> }
>
> double ControlDoublePr
> @@ -116,12 +119,12 @@
> return pBehavior ? pBehavior-
> }
>
> -void ControlDoublePr
> dParam) {
> +void ControlDoublePr
> dParam, QObject* pSender) {
> ControlNumericB
> if (pBehavior) {
> - pBehavior-
> + pBehavior-
> pSender);
> } else {
> - set(dParam, NULL);
> + set(dParam, pSender);
> }
> }
>
>
> === modified file 'mixxx/
> --- mixxx/src/
> +++ mixxx/src/
> @@ -32,11 +32,11 @@
> }
>
> // Sets the control value.
> - void set(const double& value, QObject* pSetter);
> + void set(const double& value, QObject* pSender);
> // Gets the control value.
> double get...