andrewm@0
|
1 /*
|
andrewm@0
|
2 TouchKeys: multi-touch musical keyboard control software
|
andrewm@0
|
3 Copyright (c) 2013 Andrew McPherson
|
andrewm@0
|
4
|
andrewm@0
|
5 This program is free software: you can redistribute it and/or modify
|
andrewm@0
|
6 it under the terms of the GNU General Public License as published by
|
andrewm@0
|
7 the Free Software Foundation, either version 3 of the License, or
|
andrewm@0
|
8 (at your option) any later version.
|
andrewm@0
|
9
|
andrewm@0
|
10 This program is distributed in the hope that it will be useful,
|
andrewm@0
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
andrewm@0
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
andrewm@0
|
13 GNU General Public License for more details.
|
andrewm@0
|
14
|
andrewm@0
|
15 You should have received a copy of the GNU General Public License
|
andrewm@0
|
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
|
andrewm@0
|
17
|
andrewm@0
|
18 =====================================================================
|
andrewm@0
|
19
|
andrewm@0
|
20 TouchkeyMultiFingerTriggerMappingFactory.h: factory for the multiple-
|
andrewm@0
|
21 finger trigger mapping, which performs actions when two or more fingers
|
andrewm@0
|
22 are added or removed from the key.
|
andrewm@0
|
23 */
|
andrewm@0
|
24
|
andrewm@0
|
25
|
andrewm@0
|
26 #ifndef __TouchKeys__TouchkeyMultiFingerTriggerMappingFactory__
|
andrewm@0
|
27 #define __TouchKeys__TouchkeyMultiFingerTriggerMappingFactory__
|
andrewm@0
|
28
|
andrewm@0
|
29 #include "../TouchkeyBaseMappingFactory.h"
|
andrewm@0
|
30 #include "TouchkeyMultiFingerTriggerMapping.h"
|
andrewm@0
|
31
|
andrewm@0
|
32 class TouchkeyMultiFingerTriggerMappingFactory : public TouchkeyBaseMappingFactory<TouchkeyMultiFingerTriggerMapping> {
|
andrewm@0
|
33 private:
|
andrewm@0
|
34
|
andrewm@0
|
35 public:
|
andrewm@0
|
36 // ***** Constructor *****
|
andrewm@0
|
37
|
andrewm@0
|
38 // Default constructor, containing a reference to the PianoKeyboard class.
|
andrewm@42
|
39 TouchkeyMultiFingerTriggerMappingFactory(PianoKeyboard &keyboard, MidiKeyboardSegment& segment);
|
andrewm@0
|
40
|
andrewm@0
|
41 // ***** Destructor *****
|
andrewm@0
|
42
|
andrewm@0
|
43 ~TouchkeyMultiFingerTriggerMappingFactory() {}
|
andrewm@0
|
44
|
andrewm@0
|
45 // ***** Accessors / Modifiers *****
|
andrewm@0
|
46
|
andrewm@0
|
47 virtual const std::string factoryTypeName() { return "Multi-Finger\nTrigger"; }
|
andrewm@36
|
48
|
andrewm@42
|
49 // ***** Class-Specific Methods *****
|
andrewm@42
|
50
|
andrewm@42
|
51 // Parameters for multi-finger trigger
|
andrewm@42
|
52 int getTouchesForTrigger() { return numTouchesForTrigger_; }
|
andrewm@42
|
53 int getFramesForTrigger() { return numFramesForTrigger_; }
|
andrewm@42
|
54 int getConsecutiveTapsForTrigger() { return numConsecutiveTapsForTrigger_; }
|
andrewm@42
|
55 timestamp_diff_type getMaxTimeBetweenTapsForTrigger() { return maxTapSpacing_; }
|
andrewm@42
|
56 bool getNeedsMidiNoteOn() { return needsMidiNoteOn_; }
|
andrewm@42
|
57 int getTriggerOnAction() { return triggerOnAction_; }
|
andrewm@42
|
58 int getTriggerOffAction() { return triggerOffAction_; }
|
andrewm@42
|
59 int getTriggerOnNoteNumber() { return triggerOnNoteNum_; }
|
andrewm@42
|
60 int getTriggerOffNoteNumber() { return triggerOffNoteNum_; }
|
andrewm@42
|
61 int getTriggerOnNoteVelocity() { return triggerOnNoteVel_; }
|
andrewm@42
|
62 int getTriggerOffNoteVelocity() { return triggerOffNoteVel_; }
|
andrewm@42
|
63
|
andrewm@42
|
64 void setTouchesForTrigger(int touches);
|
andrewm@42
|
65 void setFramesForTrigger(int frames);
|
andrewm@42
|
66 void setConsecutiveTapsForTrigger(int taps);
|
andrewm@42
|
67 void setMaxTimeBetweenTapsForTrigger(timestamp_diff_type timeDiff);
|
andrewm@42
|
68 void setNeedsMidiNoteOn(bool needsMidi);
|
andrewm@42
|
69 void setTriggerOnAction(int action);
|
andrewm@42
|
70 void setTriggerOffAction(int action);
|
andrewm@42
|
71 void setTriggerOnNoteNumber(int note);
|
andrewm@42
|
72 void setTriggerOffNoteNumber(int note);
|
andrewm@42
|
73 void setTriggerOnNoteVelocity(int velocity);
|
andrewm@42
|
74 void setTriggerOffNoteVelocity(int velocity);
|
andrewm@42
|
75
|
andrewm@42
|
76 // ***** GUI Support *****
|
andrewm@42
|
77 bool hasBasicEditor() { return true; }
|
andrewm@42
|
78 MappingEditorComponent* createBasicEditor();
|
andrewm@42
|
79 bool hasExtendedEditor() { return false; }
|
andrewm@42
|
80 MappingEditorComponent* createExtendedEditor() { return nullptr; }
|
andrewm@42
|
81
|
andrewm@36
|
82 // ****** Preset Save/Load ******
|
andrewm@36
|
83 XmlElement* getPreset();
|
andrewm@36
|
84 bool loadPreset(XmlElement const* preset);
|
andrewm@42
|
85
|
andrewm@42
|
86 private:
|
andrewm@42
|
87 // ***** Private Methods *****
|
andrewm@42
|
88 void initializeMappingParameters(int noteNumber, TouchkeyMultiFingerTriggerMapping *mapping);
|
andrewm@42
|
89
|
andrewm@42
|
90 // Parameters
|
andrewm@42
|
91 int numTouchesForTrigger_; // How many touches are needed for a trigger
|
andrewm@42
|
92 int numFramesForTrigger_; // How many consecutive frames with these touches are needed to trigger
|
andrewm@42
|
93 int numConsecutiveTapsForTrigger_; // How many taps with this number of touches are needed to trigger
|
andrewm@42
|
94 timestamp_diff_type maxTapSpacing_; // How far apart the taps can come and be considered a multi-tap gesture
|
andrewm@42
|
95 bool needsMidiNoteOn_; // Whether the MIDI note has to be on for this gesture to trigger
|
andrewm@42
|
96 int triggerOnAction_, triggerOffAction_; // Actions to take on trigger on/off
|
andrewm@42
|
97 int triggerOnNoteNum_, triggerOffNoteNum_; // Which notes to send if a note is being sent
|
andrewm@42
|
98 int triggerOnNoteVel_, triggerOffNoteVel_; // Velocity to send if a note is being sent
|
andrewm@0
|
99 };
|
andrewm@0
|
100
|
andrewm@0
|
101 #endif /* defined(__TouchKeys__TouchkeyMultiFingerTriggerMappingFactory__) */
|