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

Method applySCLTuning

Source/PluginProcessor.cpp:912–955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

910}
911
912void DexedAudioProcessor::applySCLTuning() {
913 FileChooser fc( "Please select a scale (.scl) file.", File(), "*.scl" );
914 File s;
915
916 // loop to enforce the proper selection
917 for (;;) {
918 // open file chooser dialog
919 if (!fc.browseForFileToOpen())
920 // User cancelled
921 return;
922 s = fc.getResult();
923
924 // enforce file extenstion ''.scl''.
925 // (reason: the extension ''.scl'' is mandatory according to
926 // ''https://www.huygens-fokker.org/scala/scl_format.html''
927 if (s.getFileExtension() != ".scl") {
928 AlertWindow::showMessageBox(AlertWindow::WarningIcon, "Invalid file type!", "Only files with the \".scl\" extension (in lowercase!) are allowed.");
929 continue;
930 }
931
932 // enforce to select file below the max limit16KB sized files
933 if (s.getSize() > MAX_SCL_KBM_FILE_SIZE) {
934 std::string msg;
935 msg = "File size exceeded the maximum limit of " + std::to_string(MAX_SCL_KBM_FILE_SIZE) + " bytes.";
936 AlertWindow::showMessageBox(AlertWindow::WarningIcon, "File size error!", msg);
937 continue;
938 }
939
940 // enforce to select non-empty file
941 // TODO: check, whether zero sized files may occur indeed here; if not, delete this if-statement, please
942 if (s.getSize() == 0) {
943 std::string msg;
944 msg = "File is empty.";
945 AlertWindow::showMessageBox(AlertWindow::WarningIcon, "File size error!", msg);
946 continue;
947 }
948
949 // try to apply the SCL file
950 applySCLTuning(s);
951
952 // exit the loop
953 break;
954 }
955}
956
957void DexedAudioProcessor::applySCLTuning(File s) {
958 std::string sclcontents = s.loadFileAsString().toStdString();

Callers 2

parmShowMethod · 0.80
filesDroppedMethod · 0.80

Calls 2

createTuningFromSCLDataFunction · 0.85

Tested by

no test coverage detected