Browse Source

Add option for loading imported file with plugin's state. Use a small loop xfade amount as default.

tags/v100_p5
xenakios 7 years ago
parent
commit
21b06b8353
3 changed files with 17 additions and 6 deletions
  1. +5
    -0
      Source/PluginEditor.cpp
  2. +11
    -6
      Source/PluginProcessor.cpp
  3. +1
    -0
      Source/PluginProcessor.h

+ 5
- 0
Source/PluginEditor.cpp View File

@@ -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;


+ 11
- 6
Source/PluginProcessor.cpp View File

@@ -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<float>(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<int> 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);
}
}
}
}


+ 1
- 0
Source/PluginProcessor.h View File

@@ -144,6 +144,7 @@ public:
void resetParameters();
void setPreBufferAmount(int x);
int getPreBufferAmount();
bool m_load_file_with_state = true;
private:


Loading…
Cancel
Save