diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 748d391..0e7012c 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -280,6 +280,7 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu() { PopupMenu menu; menu.addItem(4, "Reset parameters", true, false); + menu.addItem(5, "Load file with plugin state", true, processor.m_load_file_with_state); menu.addItem(1, "Play when host transport running", true, processor.m_play_when_host_plays); menu.addItem(2, "Capture when host transport running", true, processor.m_capture_when_host_plays); @@ -307,6 +308,10 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu() { processor.resetParameters(); } + if (r == 5) + { + processor.m_load_file_with_state = !processor.m_load_file_with_state; + } if (r == 3) { String fftlib = fftwf_version; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index d68d1d2..e93b8b0 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -111,7 +111,7 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() addParameter(new AudioParameterBool("freeze0", "Freeze", false)); // 7 addParameter(new AudioParameterFloat("spread0", "Frequency spread", 0.0f, 1.0f, 0.0f)); // 8 addParameter(new AudioParameterFloat("compress0", "Compress", 0.0f, 1.0f, 0.0f)); // 9 - addParameter(new AudioParameterFloat("loopxfadelen0", "Loop xfade length", 0.0f, 1.0f, 0.0f)); // 10 + addParameter(new AudioParameterFloat("loopxfadelen0", "Loop xfade length", 0.0f, 1.0f, 0.01f)); // 10 auto numhar_convertFrom0To1Func = [](float rangemin, float rangemax, float value) { return jmap(value, 0.0f, 1.0f, 101.0f, 1.0f); @@ -544,7 +544,8 @@ void PaulstretchpluginAudioProcessor::getStateInformation (MemoryBlock& destData paramtree.setProperty("prebufamount", m_prebuffer_amount, nullptr); else paramtree.setProperty("prebufamount", -1, nullptr); - MemoryOutputStream stream(destData,true); + paramtree.setProperty("loadfilewithstate", m_load_file_with_state, nullptr); + MemoryOutputStream stream(destData,true); paramtree.writeToStream(stream); } @@ -555,6 +556,7 @@ void PaulstretchpluginAudioProcessor::setStateInformation (const void* data, int { { ScopedLock locker(m_cs); + m_load_file_with_state = tree.getProperty("loadfilewithstate", true); if (tree.hasProperty("numspectralstages")) { std::vector order; @@ -583,11 +585,14 @@ void PaulstretchpluginAudioProcessor::setStateInformation (const void* data, int m_use_backgroundbuffering = false; else setPreBufferAmount(prebufamt); - String fn = tree.getProperty("importedfile"); - if (fn.isEmpty() == false) + if (m_load_file_with_state == true) { - File f(fn); - setAudioFile(f); + String fn = tree.getProperty("importedfile"); + if (fn.isEmpty() == false) + { + File f(fn); + setAudioFile(f); + } } } } diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 7f2b38a..08f8c97 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -144,6 +144,7 @@ public: void resetParameters(); void setPreBufferAmount(int x); int getPreBufferAmount(); + bool m_load_file_with_state = true; private: