| 718 | } |
| 719 | |
| 720 | void NeuralPiAudioProcessorEditor::loadIRClicked() |
| 721 | { |
| 722 | FileChooser chooser("Select one or more .wav IR files to import", |
| 723 | {}, |
| 724 | "*.wav"); |
| 725 | if (chooser.browseForMultipleFilesToOpen()) |
| 726 | { |
| 727 | int import_fail = 1; |
| 728 | Array<File> files = chooser.getResults(); |
| 729 | for (auto file : files) { |
| 730 | File fullpath = processor.userAppDataDirectory_irs.getFullPathName() + "/" + file.getFileName(); |
| 731 | bool b = fullpath.existsAsFile(); |
| 732 | if (b == false) { |
| 733 | |
| 734 | processor.loadIR(file); |
| 735 | fname = file.getFileName(); |
| 736 | processor.loaded_ir = file; |
| 737 | processor.loaded_ir_name = fname; |
| 738 | processor.custom_ir = 1; |
| 739 | |
| 740 | // Copy selected file to model directory and load into dropdown menu |
| 741 | bool a = file.copyFileTo(fullpath); |
| 742 | if (a == true) { |
| 743 | irSelect.addItem(file.getFileNameWithoutExtension(), processor.irFiles.size() + 1); |
| 744 | irSelect.setSelectedItemIndex(processor.irFiles.size(), juce::NotificationType::dontSendNotification); |
| 745 | processor.irFiles.push_back(file); |
| 746 | processor.num_irs += 1; |
| 747 | } |
| 748 | // Sort jsonFiles alphabetically |
| 749 | std::sort(processor.irFiles.begin(), processor.irFiles.end()); |
| 750 | } |
| 751 | } |
| 752 | } |
| 753 | } |
| 754 | |
| 755 | |
| 756 | void NeuralPiAudioProcessorEditor::buttonClicked(juce::Button* button) |