Pauses audio to open file @param path optional path to load, otherwise will prompt user for file location */
| 371 | location |
| 372 | */ |
| 373 | void GRainbowAudioProcessorEditor::openNewFile(const char* path) { |
| 374 | if (path == nullptr) { |
| 375 | auto recentFiles = Utils::getRecentFiles(); |
| 376 | auto mostRecentFile = juce::File(recentFiles.getArray()->getLast().toString()).getParentDirectory(); |
| 377 | |
| 378 | mFileChooser = std::make_unique<juce::FileChooser>("Select a file to granulize...", mostRecentFile, |
| 379 | "*.wav;*.mp3;*.gbow", true); |
| 380 | |
| 381 | int openFlags = |
| 382 | juce::FileBrowserComponent::FileChooserFlags::openMode | juce::FileBrowserComponent::canSelectFiles; |
| 383 | |
| 384 | mFileChooser->launchAsync(openFlags, [this](const juce::FileChooser& fc) { |
| 385 | auto file = fc.getResult(); |
| 386 | if (file.existsAsFile()) loadFile(file); |
| 387 | }); |
| 388 | } else { |
| 389 | auto file = juce::File(juce::String(path)); |
| 390 | if (file.existsAsFile()) loadFile(file); |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | // TODO: re-enable me when recording is back in |
| 395 | //void GRainbowAudioProcessorEditor::startRecording() { |
nothing calls this directly
no test coverage detected