Mercurial > hg > touchkeys
view Source/Mappings/OnsetAngle/TouchkeyOnsetAngleMappingFactory.cpp @ 28:cfbcd31a54e7
First attempt at "rescan devices". Reloads TouchKeys and MIDI in/out devices. Sets MIDI in/out to Disabled if previous device not found. Does not yet handle order of devices changing.
Also fix some bugs:
-- Can now disable Standalone mode
-- Poly-AT now accounts for transposition
-- If TK device stops on error, GUI reflects it
-- Possible crash on quit should be fixed (needs more testing)
author | Andrew McPherson <andrewm@eecs.qmul.ac.uk> |
---|---|
date | Sun, 02 Mar 2014 22:31:54 +0000 |
parents | 3580ffe87dc8 |
children | 0deac2806a7b |
line wrap: on
line source
/* TouchKeys: multi-touch musical keyboard control software Copyright (c) 2013 Andrew McPherson This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ===================================================================== TouchkeyOnsetAngleMappingFactory.cpp: factory for the onset angle mapping, which measures the speed of finger motion along the key surface at the time of MIDI note onset. */ #include "TouchkeyOnsetAngleMappingFactory.h" // Class constants const timestamp_diff_type TouchkeyOnsetAngleMappingFactory::kDefaultMaxLookbackTime = milliseconds_to_timestamp(100); TouchkeyOnsetAngleMappingFactory::TouchkeyOnsetAngleMappingFactory(PianoKeyboard &keyboard, MidiKeyboardSegment& segment) : TouchkeyBaseMappingFactory<TouchkeyOnsetAngleMapping>(keyboard, segment) { //setName("/touchkeys/scoop"); setMidiParameters(MidiKeyboardSegment::kControlPitchWheel, -2.0, 2.0, 0.0); } // MIDI note ended: see whether the mapping was suspended and if not, execute the angle calculation void TouchkeyOnsetAngleMappingFactory::midiNoteOn(int noteNumber, bool touchIsOn, bool keyMotionActive, Node<KeyTouchFrame>* touchBuffer, Node<key_position>* positionBuffer, KeyPositionTracker* positionTracker) { // Call base class method TouchkeyBaseMappingFactory<TouchkeyOnsetAngleMapping>::midiNoteOn(noteNumber, touchIsOn, keyMotionActive, touchBuffer, positionBuffer, positionTracker); if(mappings_.count(noteNumber) != 0) { mappings_[noteNumber]->processOnset(keyboard_.schedulerCurrentTimestamp()); } }