comparison Source/Mappings/KeyDivision/TouchkeyKeyDivisionMappingFactory.cpp @ 36:0deac2806a7b

Preset support for the rest of the mappings.
author Andrew McPherson <andrewm@eecs.qmul.ac.uk>
date Fri, 21 Mar 2014 12:53:50 +0000
parents 353276611036
children 73576f49ad1c
comparison
equal deleted inserted replaced
35:3f948746885a 36:0deac2806a7b
129 void TouchkeyKeyDivisionMappingFactory::setName(const string& name) { 129 void TouchkeyKeyDivisionMappingFactory::setName(const string& name) {
130 TouchkeyBaseMappingFactory<TouchkeyKeyDivisionMapping>::setName(name); 130 TouchkeyBaseMappingFactory<TouchkeyKeyDivisionMapping>::setName(name);
131 setBendParameters(); 131 setBendParameters();
132 } 132 }
133 133
134
135 // ****** Preset Save/Load ******
136 XmlElement* TouchkeyKeyDivisionMappingFactory::getPreset() {
137 PropertySet properties;
138
139 storeCommonProperties(properties);
140
141 // No properties for now
142
143 XmlElement* preset = properties.createXml("MappingFactory");
144 preset->setAttribute("type", "KeyDivision");
145
146 return preset;
147 }
148
149 bool TouchkeyKeyDivisionMappingFactory::loadPreset(XmlElement const* preset) {
150 if(preset == 0)
151 return false;
152
153 PropertySet properties;
154 properties.restoreFromXml(*preset);
155
156 if(!loadCommonProperties(properties))
157 return false;
158
159 // Nothing specific to do for now
160
161 return true;
162 }
163
164 // ***** Private Methods *****
165
134 // Set the initial parameters for a new mapping 166 // Set the initial parameters for a new mapping
135 void TouchkeyKeyDivisionMappingFactory::initializeMappingParameters(int noteNumber, TouchkeyKeyDivisionMapping *mapping) { 167 void TouchkeyKeyDivisionMappingFactory::initializeMappingParameters(int noteNumber, TouchkeyKeyDivisionMapping *mapping) {
136 // KLUDGE: testing Maqam tunings. Go from absolute tunings in cents to pitch bends in semitones 168 // KLUDGE: testing Maqam tunings. Go from absolute tunings in cents to pitch bends in semitones
137 float tunings[2]; 169 float tunings[2];
138 int index = (noteNumber + 12 - referenceNote_) % 12; 170 int index = (noteNumber + 12 - referenceNote_) % 12;