MCPcopy Create free account
hub / github.com/asb2m10/dexed / applyKBMMapping

Method applyKBMMapping

Source/PluginProcessor.cpp:989–1031  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

987}
988
989void DexedAudioProcessor::applyKBMMapping() {
990 FileChooser fc( "Please select a keyboard map (.kbm) file.", File(), "*.kbm" );
991 File s;
992
993 // loop to enforce the proper selection
994 for (;;) {
995 // invoke file chooser dialog
996 if (!fc.browseForFileToOpen())
997 return; // User cancelled
998 s = fc.getResult();
999
1000 // enforce file extenstion ''.kbm''.
1001 // (reason: the extension ''.kbm'' is mandatory according to
1002 // ''https://www.huygens-fokker.org/scala/scl_format.html''
1003 if (s.getFileExtension() != ".kbm") {
1004 AlertWindow::showMessageBox(AlertWindow::WarningIcon, "Invalid file type!", "Only files with the \".kbm\" extension (in lowercase!) are allowed.");
1005 continue;
1006 }
1007
1008 // enforce to select file below the max limit16KB sized files
1009 if (s.getSize() > MAX_SCL_KBM_FILE_SIZE) {
1010 std::string msg;
1011 msg = "File size exceeded the maximum limit of " + std::to_string(MAX_SCL_KBM_FILE_SIZE) + " bytes.";
1012 AlertWindow::showMessageBox(AlertWindow::WarningIcon, "File size error!", msg);
1013 continue;
1014 }
1015
1016 // enforce to select non-empty file
1017 // TODO: check, whether zero sized files may occur indeed here; if not, delete this if-statement, please
1018 if (s.getSize() == 0) {
1019 std::string msg;
1020 msg = "File is empty.";
1021 AlertWindow::showMessageBox(AlertWindow::WarningIcon, "File size error!", msg);
1022 continue;
1023 }
1024
1025 // try to apply KBM mapping
1026 applyKBMMapping(s);
1027
1028 // exit the loop
1029 break;
1030 }
1031}
1032
1033void DexedAudioProcessor::applyKBMMapping( File s )
1034{

Callers 2

parmShowMethod · 0.80
filesDroppedMethod · 0.80

Calls 2

createTuningFromKBMDataFunction · 0.85

Tested by

no test coverage detected