The codebase to run the *spark d-fuser controller www.sparkav.co.uk/dvimixer

Dependencies:   SPK-TVOne DMX DmxArtNet NetServicesMin OSC PinDetect mRotaryEncoder iniparser mbed spk_oled_ssd1305 filter

Committer:
tobyspark
Date:
Tue Dec 11 20:18:09 2012 +0000
Revision:
50:e98220a71065
Parent:
36:8b5c75c8bc23
Child:
51:98cc27390484
Work in progress: persistence. Is autosaving keyer param updates, no load mechanism. Should move state vars in there, ie. mixMode, commsMode.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tobyspark 11:0783cfbeb746 1 #include "mbed.h"
tobyspark 13:3796bde6ba8f 2 #include <string>
tobyspark 13:3796bde6ba8f 3 #include <vector>
tobyspark 13:3796bde6ba8f 4
tobyspark 13:3796bde6ba8f 5 extern "C"
tobyspark 13:3796bde6ba8f 6 {
tobyspark 13:3796bde6ba8f 7 #include "iniparser.h"
tobyspark 13:3796bde6ba8f 8 }
tobyspark 11:0783cfbeb746 9
tobyspark 11:0783cfbeb746 10 class SPKSettings {
tobyspark 11:0783cfbeb746 11 public:
tobyspark 36:8b5c75c8bc23 12 enum keyerParameterType {minY = 0, maxY, minU, maxU, minV, maxV};
tobyspark 36:8b5c75c8bc23 13
tobyspark 36:8b5c75c8bc23 14 int editingKeyerSetIndex;
tobyspark 31:01845a2347ff 15
tobyspark 11:0783cfbeb746 16 SPKSettings()
tobyspark 11:0783cfbeb746 17 {
tobyspark 36:8b5c75c8bc23 18 editingKeyerSetIndex = -1;
tobyspark 16:52484666b323 19 loadDefaults();
tobyspark 16:52484666b323 20 }
tobyspark 16:52484666b323 21
tobyspark 16:52484666b323 22 void loadDefaults()
tobyspark 16:52484666b323 23 {
tobyspark 16:52484666b323 24 //// KEYS
tobyspark 16:52484666b323 25
tobyspark 27:27851d3d2bba 26 keyerParamNames.clear();
tobyspark 27:27851d3d2bba 27 keyerParamSets.clear();
tobyspark 31:01845a2347ff 28 vector<int> paramSet(6);
tobyspark 27:27851d3d2bba 29
tobyspark 31:01845a2347ff 30 paramSet[minY] = 0;
tobyspark 31:01845a2347ff 31 paramSet[maxY] = 18;
tobyspark 31:01845a2347ff 32 paramSet[minU] = 128;
tobyspark 31:01845a2347ff 33 paramSet[maxU] = 129;
tobyspark 31:01845a2347ff 34 paramSet[minV] = 128;
tobyspark 31:01845a2347ff 35 paramSet[maxV] = 129;
tobyspark 31:01845a2347ff 36 keyerParamSets.push_back(paramSet);
tobyspark 16:52484666b323 37 keyerParamNames.push_back("Lumakey");
tobyspark 11:0783cfbeb746 38
tobyspark 31:01845a2347ff 39 paramSet[minY] = 30;
tobyspark 31:01845a2347ff 40 paramSet[maxY] = 35;
tobyspark 31:01845a2347ff 41 paramSet[minU] = 237;
tobyspark 31:01845a2347ff 42 paramSet[maxU] = 242;
tobyspark 31:01845a2347ff 43 paramSet[minV] = 114;
tobyspark 31:01845a2347ff 44 paramSet[maxV] = 121;
tobyspark 31:01845a2347ff 45 keyerParamSets.push_back(paramSet);
tobyspark 16:52484666b323 46 keyerParamNames.push_back("Chromakey - Blue");
tobyspark 16:52484666b323 47
tobyspark 16:52484666b323 48 //// RESOLUTIONS
tobyspark 16:52484666b323 49
tobyspark 27:27851d3d2bba 50 resolutionNames.clear();
tobyspark 27:27851d3d2bba 51 resolutionIndexes.clear();
tobyspark 27:27851d3d2bba 52 resolutionEDIDIndexes.clear();
tobyspark 27:27851d3d2bba 53
tobyspark 16:52484666b323 54 resolutionNames.push_back(kTV1ResolutionDescriptionVGA);
tobyspark 16:52484666b323 55 resolutionIndexes.push_back(kTV1ResolutionVGA);
tobyspark 34:69dfe64e7e6b 56 resolutionEDIDIndexes.push_back(6);
tobyspark 16:52484666b323 57
tobyspark 16:52484666b323 58 resolutionNames.push_back(kTV1ResolutionDescriptionSVGA);
tobyspark 16:52484666b323 59 resolutionIndexes.push_back(kTV1ResolutionSVGA);
tobyspark 34:69dfe64e7e6b 60 resolutionEDIDIndexes.push_back(6);
tobyspark 16:52484666b323 61
tobyspark 16:52484666b323 62 resolutionNames.push_back(kTV1ResolutionDescriptionXGAp60);
tobyspark 16:52484666b323 63 resolutionIndexes.push_back(kTV1ResolutionXGAp60);
tobyspark 34:69dfe64e7e6b 64 resolutionEDIDIndexes.push_back(6);
tobyspark 16:52484666b323 65
tobyspark 16:52484666b323 66 resolutionNames.push_back(kTV1ResolutionDescriptionWSXGAPLUSp60);
tobyspark 16:52484666b323 67 resolutionIndexes.push_back(kTV1ResolutionWSXGAPLUSp60);
tobyspark 34:69dfe64e7e6b 68 resolutionEDIDIndexes.push_back(6);
tobyspark 16:52484666b323 69
tobyspark 16:52484666b323 70 resolutionNames.push_back(kTV1ResolutionDescriptionWUXGAp60);
tobyspark 16:52484666b323 71 resolutionIndexes.push_back(kTV1ResolutionWUXGAp60);
tobyspark 34:69dfe64e7e6b 72 resolutionEDIDIndexes.push_back(6);
tobyspark 16:52484666b323 73
tobyspark 16:52484666b323 74 resolutionNames.push_back(kTV1ResolutionDescription720p60);
tobyspark 16:52484666b323 75 resolutionIndexes.push_back(kTV1Resolution720p60);
tobyspark 16:52484666b323 76 resolutionEDIDIndexes.push_back(5);
tobyspark 16:52484666b323 77
tobyspark 16:52484666b323 78 resolutionNames.push_back(kTV1ResolutionDescription1080p60);
tobyspark 16:52484666b323 79 resolutionIndexes.push_back(kTV1Resolution1080p60);
tobyspark 16:52484666b323 80 resolutionEDIDIndexes.push_back(5);
tobyspark 16:52484666b323 81
tobyspark 16:52484666b323 82 resolutionNames.push_back(kTV1ResolutionDescriptionDualHeadSVGAp60);
tobyspark 16:52484666b323 83 resolutionIndexes.push_back(kTV1ResolutionDualHeadSVGAp60);
tobyspark 34:69dfe64e7e6b 84 resolutionEDIDIndexes.push_back(4);
tobyspark 16:52484666b323 85
tobyspark 16:52484666b323 86 resolutionNames.push_back(kTV1ResolutionDescriptionDualHeadXGAp60);
tobyspark 16:52484666b323 87 resolutionIndexes.push_back(kTV1ResolutionDualHeadXGAp60);
tobyspark 34:69dfe64e7e6b 88 resolutionEDIDIndexes.push_back(4);
tobyspark 16:52484666b323 89
tobyspark 16:52484666b323 90 resolutionNames.push_back(kTV1ResolutionDescriptionTripleHeadVGAp60);
tobyspark 16:52484666b323 91 resolutionIndexes.push_back(kTV1ResolutionTripleHeadVGAp60);
tobyspark 34:69dfe64e7e6b 92 resolutionEDIDIndexes.push_back(4);
tobyspark 11:0783cfbeb746 93 }
tobyspark 11:0783cfbeb746 94
tobyspark 13:3796bde6ba8f 95 string keyerParamName (int index)
tobyspark 11:0783cfbeb746 96 {
tobyspark 11:0783cfbeb746 97 // TODO: Bounds check and return out of bounds name
tobyspark 11:0783cfbeb746 98 return keyerParamNames[index];
tobyspark 11:0783cfbeb746 99 }
tobyspark 11:0783cfbeb746 100
tobyspark 31:01845a2347ff 101 vector<int> keyerParamSet(int index)
tobyspark 11:0783cfbeb746 102 {
tobyspark 11:0783cfbeb746 103 return keyerParamSets[index];
tobyspark 11:0783cfbeb746 104 }
tobyspark 11:0783cfbeb746 105
tobyspark 11:0783cfbeb746 106 int keyerSetCount()
tobyspark 11:0783cfbeb746 107 {
tobyspark 11:0783cfbeb746 108 return keyerParamSets.size();
tobyspark 11:0783cfbeb746 109 }
tobyspark 11:0783cfbeb746 110
tobyspark 36:8b5c75c8bc23 111 int editingKeyerSetValue(keyerParameterType parameter)
tobyspark 36:8b5c75c8bc23 112 {
tobyspark 36:8b5c75c8bc23 113 int value = -1;
tobyspark 36:8b5c75c8bc23 114 if (editingKeyerSetIndex >= 0 && editingKeyerSetIndex < keyerSetCount())
tobyspark 36:8b5c75c8bc23 115 {
tobyspark 36:8b5c75c8bc23 116 value = keyerParamSets[editingKeyerSetIndex][parameter];
tobyspark 36:8b5c75c8bc23 117 }
tobyspark 36:8b5c75c8bc23 118 return value;
tobyspark 36:8b5c75c8bc23 119 }
tobyspark 36:8b5c75c8bc23 120
tobyspark 36:8b5c75c8bc23 121 void setEditingKeyerSetValue(keyerParameterType parameter, int value)
tobyspark 36:8b5c75c8bc23 122 {
tobyspark 36:8b5c75c8bc23 123 if (editingKeyerSetIndex >= 0 && editingKeyerSetIndex < keyerSetCount())
tobyspark 36:8b5c75c8bc23 124 {
tobyspark 36:8b5c75c8bc23 125 keyerParamSets[editingKeyerSetIndex][parameter] = value;
tobyspark 36:8b5c75c8bc23 126 }
tobyspark 36:8b5c75c8bc23 127 }
tobyspark 36:8b5c75c8bc23 128
tobyspark 36:8b5c75c8bc23 129 string resolutionName (int index)
tobyspark 16:52484666b323 130 {
tobyspark 16:52484666b323 131 // TODO: Bounds check and return out of bounds name
tobyspark 16:52484666b323 132 return resolutionNames[index];
tobyspark 16:52484666b323 133 }
tobyspark 16:52484666b323 134
tobyspark 16:52484666b323 135 int32_t resolutionIndex(int index)
tobyspark 16:52484666b323 136 {
tobyspark 16:52484666b323 137 return resolutionIndexes[index];
tobyspark 16:52484666b323 138 }
tobyspark 16:52484666b323 139
tobyspark 16:52484666b323 140 int32_t resolutionEDIDIndex(int index)
tobyspark 16:52484666b323 141 {
tobyspark 16:52484666b323 142 return resolutionEDIDIndexes[index];
tobyspark 16:52484666b323 143 }
tobyspark 16:52484666b323 144
tobyspark 16:52484666b323 145 int resolutionsCount()
tobyspark 16:52484666b323 146 {
tobyspark 16:52484666b323 147 return resolutionNames.size();
tobyspark 16:52484666b323 148 }
tobyspark 16:52484666b323 149
tobyspark 13:3796bde6ba8f 150 bool load(string filename)
tobyspark 11:0783cfbeb746 151 {
tobyspark 11:0783cfbeb746 152 bool success = false;
tobyspark 13:3796bde6ba8f 153
tobyspark 13:3796bde6ba8f 154 local = new LocalFileSystem("local");
tobyspark 13:3796bde6ba8f 155 string filePath("/local/");
tobyspark 13:3796bde6ba8f 156 filePath += filename;
tobyspark 13:3796bde6ba8f 157
tobyspark 13:3796bde6ba8f 158 dictionary* settings = iniparser_load(filePath.c_str());
tobyspark 13:3796bde6ba8f 159
tobyspark 13:3796bde6ba8f 160 // KEYER
tobyspark 13:3796bde6ba8f 161 {
tobyspark 13:3796bde6ba8f 162 int counter = 1;
tobyspark 13:3796bde6ba8f 163
tobyspark 13:3796bde6ba8f 164 bool keyParamReadOK = true;
tobyspark 13:3796bde6ba8f 165 bool keyParamCleared = false;
tobyspark 13:3796bde6ba8f 166
tobyspark 28:67269c2d042b 167 char* const failString = "Failed to read";
tobyspark 28:67269c2d042b 168 const int failInt = -1;
tobyspark 28:67269c2d042b 169 const int stringLength = 11;
tobyspark 13:3796bde6ba8f 170
tobyspark 13:3796bde6ba8f 171 // Loop through [Key1,2,...,99] sections
tobyspark 13:3796bde6ba8f 172 while(keyParamReadOK)
tobyspark 13:3796bde6ba8f 173 {
tobyspark 31:01845a2347ff 174 vector<int> paramSet(6);
tobyspark 31:01845a2347ff 175 char* paramName;
tobyspark 13:3796bde6ba8f 176
tobyspark 28:67269c2d042b 177 char key[stringLength];
tobyspark 11:0783cfbeb746 178
tobyspark 28:67269c2d042b 179 snprintf(key, stringLength, "Key%i:Name", counter);
tobyspark 13:3796bde6ba8f 180 paramName = iniparser_getstring(settings, key, failString);
tobyspark 13:3796bde6ba8f 181 keyParamReadOK = keyParamReadOK && strcmp(paramName, failString);
tobyspark 13:3796bde6ba8f 182
tobyspark 28:67269c2d042b 183 snprintf(key, stringLength, "Key%i:MinY", counter);
tobyspark 31:01845a2347ff 184 paramSet[minY] = iniparser_getint(settings, key, failInt);
tobyspark 31:01845a2347ff 185 keyParamReadOK = keyParamReadOK && (paramSet[minY] != failInt);
tobyspark 13:3796bde6ba8f 186
tobyspark 28:67269c2d042b 187 snprintf(key, stringLength, "Key%i:MaxY", counter);
tobyspark 31:01845a2347ff 188 paramSet[maxY] = iniparser_getint(settings, key, failInt);
tobyspark 31:01845a2347ff 189 keyParamReadOK = keyParamReadOK && (paramSet[maxY] != failInt);
tobyspark 13:3796bde6ba8f 190
tobyspark 28:67269c2d042b 191 snprintf(key, stringLength, "Key%i:MinU", counter);
tobyspark 31:01845a2347ff 192 paramSet[minU] = iniparser_getint(settings, key, failInt);
tobyspark 31:01845a2347ff 193 keyParamReadOK = keyParamReadOK && (paramSet[minU] != failInt);
tobyspark 13:3796bde6ba8f 194
tobyspark 28:67269c2d042b 195 snprintf(key, stringLength, "Key%i:MaxU", counter);
tobyspark 31:01845a2347ff 196 paramSet[maxU] = iniparser_getint(settings, key, failInt);
tobyspark 31:01845a2347ff 197 keyParamReadOK = keyParamReadOK && (paramSet[maxU] != failInt);
tobyspark 13:3796bde6ba8f 198
tobyspark 28:67269c2d042b 199 snprintf(key, stringLength, "Key%i:MinV", counter);
tobyspark 31:01845a2347ff 200 paramSet[minV] = iniparser_getint(settings, key, failInt);
tobyspark 31:01845a2347ff 201 keyParamReadOK = keyParamReadOK && (paramSet[minV] != failInt);
tobyspark 13:3796bde6ba8f 202
tobyspark 28:67269c2d042b 203 snprintf(key, stringLength, "Key%i:MaxV", counter);
tobyspark 31:01845a2347ff 204 paramSet[maxV] = iniparser_getint(settings, key, failInt);
tobyspark 31:01845a2347ff 205 keyParamReadOK = keyParamReadOK && (paramSet[maxV] != failInt);
tobyspark 13:3796bde6ba8f 206
tobyspark 13:3796bde6ba8f 207 // If all parameters have been read successfully
tobyspark 13:3796bde6ba8f 208 if (keyParamReadOK)
tobyspark 13:3796bde6ba8f 209 {
tobyspark 13:3796bde6ba8f 210
tobyspark 13:3796bde6ba8f 211 // If this is the first time through, clear old values
tobyspark 13:3796bde6ba8f 212 if (!keyParamCleared)
tobyspark 13:3796bde6ba8f 213 {
tobyspark 13:3796bde6ba8f 214 keyerParamNames.clear();
tobyspark 13:3796bde6ba8f 215 keyerParamSets.clear();
tobyspark 13:3796bde6ba8f 216 keyParamCleared = true;
tobyspark 13:3796bde6ba8f 217 }
tobyspark 13:3796bde6ba8f 218
tobyspark 13:3796bde6ba8f 219 // Apply settings
tobyspark 13:3796bde6ba8f 220 keyerParamNames.push_back(paramName);
tobyspark 13:3796bde6ba8f 221 keyerParamSets.push_back(paramSet);
tobyspark 13:3796bde6ba8f 222
tobyspark 13:3796bde6ba8f 223 // We've successfully read a keyer param set, so should return true;
tobyspark 31:01845a2347ff 224 success = true;
tobyspark 13:3796bde6ba8f 225 }
tobyspark 13:3796bde6ba8f 226
tobyspark 13:3796bde6ba8f 227 counter++;
tobyspark 13:3796bde6ba8f 228 }
tobyspark 13:3796bde6ba8f 229 }
tobyspark 13:3796bde6ba8f 230
tobyspark 16:52484666b323 231 // RESOLUTIONS
tobyspark 16:52484666b323 232 {
tobyspark 16:52484666b323 233 int counter = 1;
tobyspark 16:52484666b323 234
tobyspark 16:52484666b323 235 bool resolutionReadOK = true;
tobyspark 16:52484666b323 236 bool resolutionCleared = false;
tobyspark 16:52484666b323 237
tobyspark 28:67269c2d042b 238 char* const failString = "Failed to read";
tobyspark 28:67269c2d042b 239 const int failInt = -1;
tobyspark 28:67269c2d042b 240 const int stringLength = 25;
tobyspark 16:52484666b323 241
tobyspark 16:52484666b323 242 // Loop through [Key1,2,...,99] sections
tobyspark 16:52484666b323 243 while(resolutionReadOK)
tobyspark 16:52484666b323 244 {
tobyspark 16:52484666b323 245 char* resolutionName;
tobyspark 16:52484666b323 246 int resolutionIndex;
tobyspark 16:52484666b323 247 int resolutionEDIDIndex;
tobyspark 16:52484666b323 248
tobyspark 28:67269c2d042b 249 char key[stringLength];
tobyspark 16:52484666b323 250
tobyspark 28:67269c2d042b 251 snprintf(key, stringLength, "Resolution%i:Name", counter);
tobyspark 16:52484666b323 252 resolutionName = iniparser_getstring(settings, key, failString);
tobyspark 16:52484666b323 253 resolutionReadOK = resolutionReadOK && strcmp(resolutionName, failString);
tobyspark 16:52484666b323 254
tobyspark 28:67269c2d042b 255 snprintf(key, stringLength, "Resolution%i:Number", counter);
tobyspark 16:52484666b323 256 resolutionIndex = iniparser_getint(settings, key, failInt);
tobyspark 16:52484666b323 257 resolutionReadOK = resolutionReadOK && (resolutionIndex != failInt);
tobyspark 16:52484666b323 258
tobyspark 28:67269c2d042b 259 snprintf(key, stringLength, "Resolution%i:EDIDNumber", counter);
tobyspark 16:52484666b323 260 resolutionEDIDIndex = iniparser_getint(settings, key, failInt);
tobyspark 16:52484666b323 261 resolutionReadOK = resolutionReadOK && (resolutionEDIDIndex != failInt);
tobyspark 16:52484666b323 262
tobyspark 16:52484666b323 263 // If all parameters have been read successfully
tobyspark 16:52484666b323 264 if (resolutionReadOK)
tobyspark 16:52484666b323 265 {
tobyspark 16:52484666b323 266 // If this is the first time through, clear old values
tobyspark 16:52484666b323 267 if (!resolutionCleared)
tobyspark 16:52484666b323 268 {
tobyspark 16:52484666b323 269 resolutionNames.clear();
tobyspark 16:52484666b323 270 resolutionIndexes.clear();
tobyspark 16:52484666b323 271 resolutionEDIDIndexes.clear();
tobyspark 16:52484666b323 272 resolutionCleared = true;
tobyspark 16:52484666b323 273 }
tobyspark 16:52484666b323 274
tobyspark 16:52484666b323 275 // Apply settings
tobyspark 16:52484666b323 276 resolutionNames.push_back(resolutionName);
tobyspark 16:52484666b323 277 resolutionIndexes.push_back(resolutionIndex);
tobyspark 16:52484666b323 278 resolutionEDIDIndexes.push_back(resolutionEDIDIndex);
tobyspark 16:52484666b323 279
tobyspark 16:52484666b323 280 // We've successfully read a resolution, so should return true;
tobyspark 16:52484666b323 281 success = true;
tobyspark 16:52484666b323 282 }
tobyspark 16:52484666b323 283
tobyspark 16:52484666b323 284 counter++;
tobyspark 16:52484666b323 285 }
tobyspark 16:52484666b323 286 }
tobyspark 16:52484666b323 287
tobyspark 13:3796bde6ba8f 288 iniparser_freedict(settings);
tobyspark 13:3796bde6ba8f 289
tobyspark 13:3796bde6ba8f 290 delete local;
tobyspark 11:0783cfbeb746 291
tobyspark 11:0783cfbeb746 292 return success;
tobyspark 11:0783cfbeb746 293 }
tobyspark 11:0783cfbeb746 294
tobyspark 50:e98220a71065 295 bool saveEditingKeyerSet(string filename)
tobyspark 50:e98220a71065 296 {
tobyspark 50:e98220a71065 297 int success = 0;
tobyspark 50:e98220a71065 298
tobyspark 50:e98220a71065 299 local = new LocalFileSystem("local");
tobyspark 50:e98220a71065 300 string filePath("/local/");
tobyspark 50:e98220a71065 301 filePath += filename;
tobyspark 50:e98220a71065 302
tobyspark 50:e98220a71065 303 dictionary* settings = iniparser_load(filePath.c_str());
tobyspark 50:e98220a71065 304 if (!settings) settings = dictionary_new(7);
tobyspark 50:e98220a71065 305
tobyspark 50:e98220a71065 306 const int keyLength = 11;
tobyspark 50:e98220a71065 307 const int valueLength = 4;
tobyspark 50:e98220a71065 308
tobyspark 50:e98220a71065 309 char keyMinY[keyLength];
tobyspark 50:e98220a71065 310 char valueMinY[valueLength];
tobyspark 50:e98220a71065 311 snprintf(keyMinY, keyLength, "Key%i:MinY", editingKeyerSetIndex);
tobyspark 50:e98220a71065 312 snprintf(valueMinY, valueLength, "%i", keyerParamSets[editingKeyerSetIndex][minY]);
tobyspark 50:e98220a71065 313 success += iniparser_set(settings, keyMinY, valueMinY);
tobyspark 50:e98220a71065 314
tobyspark 50:e98220a71065 315 char keyMaxY[keyLength];
tobyspark 50:e98220a71065 316 char valueMaxY[valueLength];
tobyspark 50:e98220a71065 317 snprintf(keyMaxY, keyLength, "Key%i:MaxY", editingKeyerSetIndex);
tobyspark 50:e98220a71065 318 snprintf(valueMaxY, valueLength, "%i", keyerParamSets[editingKeyerSetIndex][maxY]);
tobyspark 50:e98220a71065 319 success += iniparser_set(settings, keyMaxY, valueMaxY);
tobyspark 50:e98220a71065 320
tobyspark 50:e98220a71065 321 char keyMinU[keyLength];
tobyspark 50:e98220a71065 322 char valueMinU[valueLength];
tobyspark 50:e98220a71065 323 snprintf(keyMinU, keyLength, "Key%i:MinU", editingKeyerSetIndex);
tobyspark 50:e98220a71065 324 snprintf(valueMinU, valueLength, "%i", keyerParamSets[editingKeyerSetIndex][minU]);
tobyspark 50:e98220a71065 325 success += iniparser_set(settings, keyMinU, valueMinU);
tobyspark 50:e98220a71065 326
tobyspark 50:e98220a71065 327 char keyMaxU[keyLength];
tobyspark 50:e98220a71065 328 char valueMaxU[valueLength];
tobyspark 50:e98220a71065 329 snprintf(keyMaxU, keyLength, "Key%i:MaxU", editingKeyerSetIndex);
tobyspark 50:e98220a71065 330 snprintf(valueMaxU, valueLength, "%i", keyerParamSets[editingKeyerSetIndex][maxU]);
tobyspark 50:e98220a71065 331 success += iniparser_set(settings, keyMaxU, valueMaxU);
tobyspark 50:e98220a71065 332
tobyspark 50:e98220a71065 333 char keyMinV[keyLength];
tobyspark 50:e98220a71065 334 char valueMinV[valueLength];
tobyspark 50:e98220a71065 335 snprintf(keyMinV, keyLength, "Key%i:MinV", editingKeyerSetIndex);
tobyspark 50:e98220a71065 336 snprintf(valueMinV, valueLength, "%i", keyerParamSets[editingKeyerSetIndex][minV]);
tobyspark 50:e98220a71065 337 success += iniparser_set(settings, keyMinV, valueMinV);
tobyspark 50:e98220a71065 338
tobyspark 50:e98220a71065 339 char keyMaxV[keyLength];
tobyspark 50:e98220a71065 340 char valueMaxV[valueLength];
tobyspark 50:e98220a71065 341 snprintf(keyMaxV, keyLength, "Key%i:MaxV", editingKeyerSetIndex);
tobyspark 50:e98220a71065 342 snprintf(valueMaxV, valueLength, "%i", keyerParamSets[editingKeyerSetIndex][maxV]);
tobyspark 50:e98220a71065 343 success += iniparser_set(settings, keyMaxV, valueMaxV);
tobyspark 50:e98220a71065 344
tobyspark 50:e98220a71065 345 FILE* file = fopen(filePath.c_str(), "w");
tobyspark 50:e98220a71065 346 if (file)
tobyspark 50:e98220a71065 347 {
tobyspark 50:e98220a71065 348 iniparser_dump_ini(settings, file);
tobyspark 50:e98220a71065 349
tobyspark 50:e98220a71065 350 fclose(file);
tobyspark 50:e98220a71065 351 }
tobyspark 50:e98220a71065 352
tobyspark 50:e98220a71065 353 iniparser_freedict(settings);
tobyspark 50:e98220a71065 354
tobyspark 50:e98220a71065 355 delete local;
tobyspark 50:e98220a71065 356
tobyspark 50:e98220a71065 357 return (success == 0);
tobyspark 50:e98220a71065 358 }
tobyspark 50:e98220a71065 359
tobyspark 11:0783cfbeb746 360 protected:
tobyspark 11:0783cfbeb746 361 LocalFileSystem *local;
tobyspark 31:01845a2347ff 362 vector< vector<int> > keyerParamSets;
tobyspark 31:01845a2347ff 363 vector<string> keyerParamNames;
tobyspark 31:01845a2347ff 364 vector<string> resolutionNames;
tobyspark 31:01845a2347ff 365 vector<int32_t> resolutionIndexes;
tobyspark 31:01845a2347ff 366 vector<int32_t> resolutionEDIDIndexes;
tobyspark 16:52484666b323 367 };