summaryrefslogtreecommitdiffstats
path: root/src/controllers/midi/midicontroller.h
diff options
context:
space:
mode:
authorRJ Ryan <rryan@mixxx.org>2014-03-24 10:25:56 -0400
committerRJ Ryan <rryan@mixxx.org>2014-03-24 10:25:56 -0400
commit5dff95cbc9e90d6db0d654c7daed98bfdeeb3279 (patch)
tree2d25c645cd7ab23e51c3b6d29253a667f9886c4e /src/controllers/midi/midicontroller.h
parent149c3d72d018a117ec66e32dee1126dc876d2562 (diff)
Refactor MIDI learning to support learning select knobs, jog wheels, etc.
* Learn mappings over multiple MIDI messages instead of just one. * Allow the user to enable MIDI options from the GUI -- currently supports soft-takeover, invert, select-knob (two's complement), and switch mode. * Add Undo option for reverting the most recently learned mapping. * Introduce LearningUtils, a class that recognizes mappings from message streams. * LearningUtils has a test suite for each mapping type we want to recognize. If we don't recognize a mapping then we fall back on the 1.11.0 behavior of mapping the first message in the stream. This paves the way for learning 14-bit CC and pitch bend controls and providing richer user feedback about what we thought the control was or why we couldn't learn it.
Diffstat (limited to 'src/controllers/midi/midicontroller.h')
-rw-r--r--src/controllers/midi/midicontroller.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/controllers/midi/midicontroller.h b/src/controllers/midi/midicontroller.h
index 2338b7f93a..f2a14dd90f 100644
--- a/src/controllers/midi/midicontroller.h
+++ b/src/controllers/midi/midicontroller.h
@@ -55,6 +55,10 @@ class MidiController : public Controller {
virtual bool matchPreset(const PresetInfo& preset);
+ signals:
+ void messageReceived(unsigned char status, unsigned char control,
+ unsigned char value);
+
protected:
Q_INVOKABLE void sendShortMsg(unsigned char status, unsigned char byte1, unsigned char byte2);
// Alias for send()
@@ -76,6 +80,11 @@ class MidiController : public Controller {
// Initializes the engine and static output mappings.
void applyPreset(QList<QString> scriptPaths);
+ void learnTemporaryInputMappings(const MixxxControl& control,
+ const MidiKeyAndOptionsList& mappings);
+ void clearTemporaryInputMappings();
+ void commitTemporaryInputMappings();
+
private:
virtual void sendWord(unsigned int word) = 0;
double computeValue(MidiOptions options, double _prevmidivalue, double _newmidivalue);
@@ -89,6 +98,7 @@ class MidiController : public Controller {
return &m_preset;
}
+ QHash<uint16_t, QPair<MixxxControl, MidiOptions> > m_temporaryInputMappings;
QList<MidiOutputHandler*> m_outputs;
MidiControllerPreset m_preset;
SoftTakeover m_st;