MCPcopy Create free account
hub / github.com/StrangeLoopsAudio/gRainbow / openNewFile

Method openNewFile

Source/PluginEditor.cpp:373–392  ·  view source on GitHub ↗

Pauses audio to open file @param path optional path to load, otherwise will prompt user for file location */

Source from the content-addressed store, hash-verified

371 location
372*/
373void 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() {

Callers

nothing calls this directly

Calls 1

getRecentFilesFunction · 0.85

Tested by

no test coverage detected