Mercurial > hg > touchkeys
view Source/Mappings/Control/TouchkeyControlMappingFactory.h @ 11:c6f30c1e2bda
Fixes for OSC emulation. Also a debugging tool for generating random TouchKeys data.
author | Andrew McPherson <andrewm@eecs.qmul.ac.uk> |
---|---|
date | Sat, 23 Nov 2013 14:47:02 +0000 |
parents | 3580ffe87dc8 |
children | e8965409903e |
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/>. ===================================================================== TouchkeyControlMappingFactory.h: factory for the TouchKeys control mapping, which converts an arbitrary touch parameter into a MIDI or OSC control message. */ #ifndef __touchkeys__TouchkeyControlMappingFactory__ #define __touchkeys__TouchkeyControlMappingFactory__ #include <iostream> #include "../TouchkeyBaseMappingFactory.h" #include "TouchkeyControlMapping.h" // Factory class to produce Touchkey control messages for generic MIDI/OSC controllers class TouchkeyControlMappingFactory : public TouchkeyBaseMappingFactory<TouchkeyControlMapping> { private: static const int kDefaultController; static const float kDefaultOutputRangeMin; static const float kDefaultOutputRangeMax; static const float kDefaultOutputDefault; public: // ***** Constructor ***** // Default constructor, containing a reference to the PianoKeyboard class. TouchkeyControlMappingFactory(PianoKeyboard &keyboard, MidiKeyboardSegment& segment); // ***** Destructor ***** ~TouchkeyControlMappingFactory(); // ***** Accessors / Modifiers ***** virtual const std::string factoryTypeName() { return "Control"; } // ***** Class-Specific Methods ***** int getController() { return midiControllerNumber_; } int getInputParameter() { return inputParameter_; } int getInputType() { return inputType_; } float getRangeInputMin() { return inputRangeMin_; } float getRangeInputMax() { return inputRangeMax_; } float getRangeInputCenter() { return inputRangeCenter_; } float getRangeOutputMin() { return outputRangeMin_; } float getRangeOutputMax() { return outputRangeMax_; } float getRangeOutputDefault() { return outputDefault_; } float getThreshold() { return threshold_; } bool getIgnoresTwoFingers() { return ignoresTwoFingers_; } bool getIgnoresThreeFingers() { return ignoresThreeFingers_; } int getDirection() { return direction_; } void setInputParameter(int inputParameter); void setInputType(int inputType); void setController(int controller); //void setRange(float inputMin, float inputMax, float inputCenter, float outputMin, float outputMax, float outputDefault); void setRangeInputMin(float inputMin); void setRangeInputMax(float inputMax); void setRangeInputCenter(float inputCenter); void setRangeOutputMin(float outputMin); void setRangeOutputMax(float outputMax); void setRangeOutputDefault(float outputDefault); void setThreshold(float threshold); void setIgnoresTwoFingers(bool ignoresTwo); void setIgnoresThreeFingers(bool ignoresThree); void setDirection(int direction); // ***** GUI Support ***** bool hasBasicEditor() { return true; } MappingEditorComponent* createBasicEditor(); bool hasExtendedEditor() { return false; } MappingEditorComponent* createExtendedEditor() { return nullptr; } private: // ***** Private Methods ***** void initializeMappingParameters(int noteNumber, TouchkeyControlMapping *mapping); int inputParameter_; // Type of input data int inputType_; // Whether data is absolute or relative //float inputRangeMin_, inputRangeMax_; // Input ranges float outputRangeMin_, outputRangeMax_; // Output ranges float outputDefault_; // Default values float threshold_; // Detection threshold for relative motion bool ignoresTwoFingers_; // Whether this mapping suspends messages when two bool ignoresThreeFingers_; // or three fingers are present int direction_; // Whether the mapping uses the absolute value in negative cases }; #endif /* defined(__touchkeys__TouchkeyControlMappingFactory__) */