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 TouchkeyOnsetAngleMappingFactory.h: factory for the onset angle mapping,
|
andrewm@0
|
21 which measures the speed of finger motion along the key surface at the
|
andrewm@0
|
22 time of MIDI note onset.
|
andrewm@0
|
23 */
|
andrewm@0
|
24
|
andrewm@0
|
25
|
andrewm@0
|
26 #ifndef __TouchKeys__TouchkeyOnsetAngleMappingFactory__
|
andrewm@0
|
27 #define __TouchKeys__TouchkeyOnsetAngleMappingFactory__
|
andrewm@0
|
28
|
andrewm@0
|
29 #include "../TouchkeyBaseMappingFactory.h"
|
andrewm@0
|
30 #include "TouchkeyOnsetAngleMapping.h"
|
andrewm@0
|
31
|
andrewm@0
|
32 class TouchkeyOnsetAngleMappingFactory : public TouchkeyBaseMappingFactory<TouchkeyOnsetAngleMapping> {
|
andrewm@0
|
33 private:
|
andrewm@0
|
34 static const timestamp_diff_type kDefaultMaxLookbackTime;
|
andrewm@0
|
35
|
andrewm@0
|
36 public:
|
andrewm@0
|
37 // ***** Constructor *****
|
andrewm@0
|
38
|
andrewm@0
|
39 // Default constructor, containing a reference to the PianoKeyboard class.
|
andrewm@0
|
40 TouchkeyOnsetAngleMappingFactory(PianoKeyboard &keyboard, MidiKeyboardSegment& segment);
|
andrewm@0
|
41
|
andrewm@0
|
42 // ***** Destructor *****
|
andrewm@0
|
43
|
andrewm@0
|
44 ~TouchkeyOnsetAngleMappingFactory() {}
|
andrewm@0
|
45
|
andrewm@0
|
46 // ***** Accessors *****
|
andrewm@0
|
47
|
andrewm@0
|
48 virtual const std::string factoryTypeName() { return "Onset\nAngle"; }
|
andrewm@0
|
49
|
andrewm@36
|
50 // ****** Preset Save/Load ******
|
andrewm@36
|
51 XmlElement* getPreset();
|
andrewm@36
|
52 bool loadPreset(XmlElement const* preset);
|
andrewm@36
|
53
|
andrewm@0
|
54 // ***** State Updaters *****
|
andrewm@0
|
55
|
andrewm@0
|
56 // Override the MIDI note on method to process the onset angle
|
andrewm@0
|
57 void midiNoteOn(int noteNumber, bool touchIsOn, bool keyMotionActive,
|
andrewm@0
|
58 Node<KeyTouchFrame>* touchBuffer,
|
andrewm@0
|
59 Node<key_position>* positionBuffer,
|
andrewm@0
|
60 KeyPositionTracker* positionTracker);
|
andrewm@0
|
61
|
andrewm@0
|
62 };
|
andrewm@0
|
63 #endif /* defined(__TouchKeys__TouchkeyOnsetAngleMappingFactory__) */
|