Added more parameters. Added int constants for parameter indexes. Initial work to do GUI layout with Javascript. Disabled spectrum visualizer for now.

This commit is contained in:
xenakios 2017-12-12 19:14:43 +02:00
parent 2fe40137cc
commit 572b1d2515
4 changed files with 57 additions and 5 deletions

View File

@ -42,7 +42,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor (Pa
addAndMakeVisible(&m_rec_enable);
m_rec_enable.setButtonText("Capture");
attachCallback(m_rec_enable, [this]() { processor.setRecordingEnabled(m_rec_enable.getToggleState()); });
addAndMakeVisible(&m_specvis);
//addAndMakeVisible(&m_specvis);
setSize (700, 30+pars.size()*25+200);
m_wavecomponent.TimeSelectionChangedCallback = [this](Range<double> range, int which)
{
@ -83,8 +83,8 @@ void PaulstretchpluginAudioProcessorEditor::resized()
m_parcomps[i]->setBounds(1, 30 + i * 25, getWidth()-2, 24);
}
int yoffs = m_parcomps.back()->getBottom() + 1;
//m_wavecomponent.setBounds(1, yoffs, getWidth()-2, getHeight()-1-yoffs);
m_specvis.setBounds(1, yoffs, getWidth() - 2, getHeight() - 1 - yoffs);
m_wavecomponent.setBounds(1, yoffs, getWidth()-2, getHeight()-1-yoffs);
//m_specvis.setBounds(1, yoffs, getWidth() - 2, getHeight() - 1 - yoffs);
}
void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
@ -114,8 +114,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
}
if (id == 3)
{
m_specvis.setState(processor.getStretchSource()->getProcessParameters(), processor.getStretchSource()->getFFTSize() / 2,
processor.getSampleRate());
//m_specvis.setState(processor.getStretchSource()->getProcessParameters(), processor.getStretchSource()->getFFTSize() / 2,
// processor.getSampleRate());
}
}

View File

@ -237,6 +237,22 @@ private:
bool m_lock_timesel_set = false;
};
class MyDynamicObject : public DynamicObject
{
public:
bool hasMethod(const Identifier& methodName) const override
{
if (methodName == Identifier("setLabelBounds") ||
methodName == Identifier("setComponentBounds"))
return true;
return false;
}
var invokeMethod(Identifier methodName,
const var::NativeFunctionArgs& args) override
{
return var();
}
};
class PaulstretchpluginAudioProcessorEditor : public AudioProcessorEditor,
public MultiTimer
@ -260,6 +276,8 @@ private:
TextButton m_import_button;
Label m_info_label;
void chooseFile();
JavascriptEngine m_js_engine;
MyDynamicObject m_js_object;
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor)
};

View File

@ -99,6 +99,15 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor()
addParameter(new AudioParameterFloat("loopxfadelen0", "Loop xfade length", 0.0f, 1.0f, 0.0f)); // 10
addParameter(new AudioParameterFloat("numharmonics0", "Num harmonics", 0.0f, 100.0f, 0.0f)); // 11
addParameter(new AudioParameterFloat("harmonicsfreq0", "Harmonics base freq", 1.0f, 5000.0f, 100.0f)); // 12
addParameter(new AudioParameterFloat("harmonicsbw0", "Harmonics bandwidth", 0.1f, 200.0f, 25.0f)); // 13
addParameter(new AudioParameterBool("harmonicsgauss0", "Gaussian harmonics", false)); // 14
addParameter(new AudioParameterFloat("octavemixm2_0", "2 octaves down level", 0.0f, 1.0f, 0.0f)); // 15
addParameter(new AudioParameterFloat("octavemixm1_0", "Octave down level", 0.0f, 1.0f, 0.0f)); // 16
addParameter(new AudioParameterFloat("octavemix0_0", "Normal pitch level", 0.0f, 1.0f, 0.0f)); // 17
addParameter(new AudioParameterFloat("octavemix1_0", "1 octave up level", 0.0f, 1.0f, 0.0f)); // 18
addParameter(new AudioParameterFloat("octavemix15_0", "1 octave and fifth up level", 0.0f, 1.0f, 0.0f)); // 19
addParameter(new AudioParameterFloat("octavemix2_0", "2 octaves up level", 0.0f, 1.0f, 0.0f)); // 20
}
PaulstretchpluginAudioProcessor::~PaulstretchpluginAudioProcessor()

View File

@ -15,6 +15,31 @@
class MyThumbCache;
const int cpi_main_volume = 0;
const int cpi_stretchamount = 1;
const int cpi_fftsize = 2;
const int cpi_pitchshift = 3;
const int cpi_frequencyshift = 4;
const int cpi_soundstart = 5;
const int cpi_soundend = 6;
const int cpi_freeze = 7;
const int cpi_spreadamount = 8;
const int cpi_compress = 9;
const int cpi_loopxfadelen = 10;
const int cpi_numharmonics = 11;
const int cpi_harmonicsfreq = 12;
const int cpi_harmonicsbw = 13;
const int cpi_harmonicsgauss = 14;
const int cpi_octavesm2 = 15;
const int cpi_octavesm1 = 16;
const int cpi_octaves0 = 17;
const int cpi_octaves1 = 18;
const int cpi_octaves15 = 19;
const int cpi_octaves2 = 20;
const int cpi_tonalvsnoisebw = 21;
const int cpi_tonalvsnoisepreserve = 22;
const int cpi_filter_low = 23;
const int cpi_filter_high = 24;
class PaulstretchpluginAudioProcessor : public AudioProcessor
{