diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index eb078ac..3fecdc7 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -524,12 +524,14 @@ void PaulstretchpluginAudioProcessorEditor::chooseFile() String filterstring = processor.m_afm->getWildcardForAllFormats(); //auto prevcomp = std::make_unique(&processor); //processor.setAudioPreview(prevcomp.get()); - FileChooser myChooser("Please select audio file...", + m_filechooser = std::make_unique("Please select audio file...", initialloc, - filterstring,true); - if (myChooser.browseForFileToOpen()) + filterstring,true,false,this); + m_filechooser->launchAsync(0, processor.m_filechoose_callback); + return; + //if (m_filechooser->launchAsync(0,processor.m_filechoose_callback)) { - File resu = myChooser.getResult(); + File resu = m_filechooser->getResult(); String pathname = resu.getFullPathName(); if (pathname.startsWith("/localhost")) { @@ -539,8 +541,8 @@ void PaulstretchpluginAudioProcessorEditor::chooseFile() processor.m_propsfile->m_props_file->setValue("importfilefolder", resu.getParentDirectory().getFullPathName()); m_last_err = processor.setAudioFile(resu); } - processor.setAudioPreview(nullptr); - toFront(true); + //processor.setAudioPreview(nullptr); + //toFront(true); } void PaulstretchpluginAudioProcessorEditor::showSettingsMenu() diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index a50b32e..a3a3a97 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -436,6 +436,7 @@ public: void showRenderDialog(); void executeModalMenuAction(int menuid, int actionid); SimpleFFTComponent m_sonogram; + String m_last_err; private: PaulstretchpluginAudioProcessor& processor; uptrvec m_parcomps; @@ -449,7 +450,7 @@ private: SpectralChainEditor m_spec_order_ed; void showSettingsMenu(); - String m_last_err; + zoom_scrollbar m_zs; RatioMixerEditor m_ratiomixeditor{ 8 }; FreeFilterComponent m_free_filter_component; @@ -458,6 +459,8 @@ private: Component* m_wave_container=nullptr; void showAbout(); std::vector m_capturelens{ 2,5,10,30,60,120 }; + + std::unique_ptr m_filechooser; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor) }; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 326fb69..827cb3b 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -60,6 +60,23 @@ inline AudioParameterFloat* make_floatpar(String id, String name, float minv, fl PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() : m_bufferingthread("pspluginprebufferthread") { + m_filechoose_callback = [this](const FileChooser& chooser) + { + File resu = chooser.getResult(); + String pathname = resu.getFullPathName(); + if (pathname.startsWith("/localhost")) + { + pathname = pathname.substring(10); + resu = File(pathname); + } + m_propsfile->m_props_file->setValue("importfilefolder", resu.getParentDirectory().getFullPathName()); + String loaderr = setAudioFile(resu); + if (auto ed = dynamic_cast(getActiveEditor()); ed != nullptr) + { + ed->m_last_err = loaderr; + } + + }; m_playposinfo.timeInSeconds = 0.0; m_free_filter_envelope = std::make_shared(); diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 015b5af..6c52421 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -241,6 +241,7 @@ public: bool m_save_captured_audio = true; String m_capture_location; bool m_midinote_control = false; + std::function m_filechoose_callback; private: bool m_prebuffering_inited = false; AudioBuffer m_recbuffer;