Added component to allow reordering the spectral processing stages
This commit is contained in:
parent
e980344bb3
commit
c78c42c153
@ -52,6 +52,8 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor (Pa
|
|||||||
return processor.getStretchSource()->getInfilePositionPercent();
|
return processor.getStretchSource()->getInfilePositionPercent();
|
||||||
};
|
};
|
||||||
m_wavecomponent.ShowFileCacheRange = true;
|
m_wavecomponent.ShowFileCacheRange = true;
|
||||||
|
m_spec_order_ed.setSource(processor.getStretchSource());
|
||||||
|
addAndMakeVisible(&m_spec_order_ed);
|
||||||
startTimer(1, 100);
|
startTimer(1, 100);
|
||||||
startTimer(2, 1000);
|
startTimer(2, 1000);
|
||||||
startTimer(3, 200);
|
startTimer(3, 200);
|
||||||
@ -82,7 +84,9 @@ void PaulstretchpluginAudioProcessorEditor::resized()
|
|||||||
m_parcomps[i]->setBounds(1+gridx*(getWidth()/2), 30 + gridy * 25, getWidth()/2-2, 24);
|
m_parcomps[i]->setBounds(1+gridx*(getWidth()/2), 30 + gridy * 25, getWidth()/2-2, 24);
|
||||||
}
|
}
|
||||||
int yoffs = m_parcomps.back()->getBottom() + 1;
|
int yoffs = m_parcomps.back()->getBottom() + 1;
|
||||||
m_wavecomponent.setBounds(1, yoffs, getWidth()-2, getHeight()-1-yoffs);
|
int remain_h = getHeight() - 1 - yoffs;
|
||||||
|
m_spec_order_ed.setBounds(1, yoffs, getWidth() - 2, remain_h / 5 * 1);
|
||||||
|
m_wavecomponent.setBounds(1, m_spec_order_ed.getBottom()+1, getWidth()-2, remain_h/5*4);
|
||||||
//m_specvis.setBounds(1, yoffs, getWidth() - 2, getHeight() - 1 - yoffs);
|
//m_specvis.setBounds(1, yoffs, getWidth() - 2, getHeight() - 1 - yoffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,3 +522,76 @@ void SpectralVisualizer::paint(Graphics & g)
|
|||||||
g.setColour(Colours::yellow);
|
g.setColour(Colours::yellow);
|
||||||
g.drawText(String(m_elapsed, 1)+" ms", 1, 1, getWidth(), 30, Justification::topLeft);
|
g.drawText(String(m_elapsed, 1)+" ms", 1, 1, getWidth(), 30, Justification::topLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpectralChainEditor::paint(Graphics & g)
|
||||||
|
{
|
||||||
|
g.fillAll(Colours::black);
|
||||||
|
if (m_src == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int box_w = getWidth() / m_order.size();
|
||||||
|
int box_h = getHeight();
|
||||||
|
for (int i = 0; i < m_order.size(); ++i)
|
||||||
|
{
|
||||||
|
String txt;
|
||||||
|
if (m_order[i] == 0)
|
||||||
|
txt = "Harmonics";
|
||||||
|
if (m_order[i] == 1)
|
||||||
|
txt = "Tonal vs Noise";
|
||||||
|
if (m_order[i] == 2)
|
||||||
|
txt = "Frequency shift";
|
||||||
|
if (m_order[i] == 3)
|
||||||
|
txt = "Pitch shift";
|
||||||
|
if (m_order[i] == 4)
|
||||||
|
txt = "Octaves";
|
||||||
|
if (m_order[i] == 5)
|
||||||
|
txt = "Spread";
|
||||||
|
if (m_order[i] == 6)
|
||||||
|
txt = "Filter";
|
||||||
|
if (m_order[i] == 7)
|
||||||
|
txt = "Compressor";
|
||||||
|
if (i == m_cur_index)
|
||||||
|
{
|
||||||
|
g.setColour(Colours::darkgrey);
|
||||||
|
g.fillRect(i*box_w, 0, box_w - 30, box_h - 1);
|
||||||
|
}
|
||||||
|
g.setColour(Colours::white);
|
||||||
|
g.drawRect(i*box_w, 0, box_w - 30, box_h - 1);
|
||||||
|
g.drawFittedText(txt, i*box_w, 0, box_w - 30, box_h - 1, Justification::centred, 3);
|
||||||
|
if (i<m_order.size() - 1)
|
||||||
|
g.drawArrow(juce::Line<float>(i*box_w + (box_w - 30), box_h / 2, i*box_w + box_w, box_h / 2), 2.0f, 15.0f, 15.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpectralChainEditor::mouseDown(const MouseEvent & ev)
|
||||||
|
{
|
||||||
|
m_did_drag = false;
|
||||||
|
int box_w = getWidth() / m_order.size();
|
||||||
|
int box_h = getHeight();
|
||||||
|
m_cur_index = ev.x / box_w;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpectralChainEditor::mouseDrag(const MouseEvent & ev)
|
||||||
|
{
|
||||||
|
if (m_cur_index >= 0 && m_cur_index < m_order.size())
|
||||||
|
{
|
||||||
|
int box_w = getWidth() / m_order.size();
|
||||||
|
int box_h = getHeight();
|
||||||
|
int new_index = ev.x / box_w;
|
||||||
|
if (new_index >= 0 && new_index < m_order.size() && new_index != m_cur_index)
|
||||||
|
{
|
||||||
|
std::swap(m_order[m_cur_index], m_order[new_index]);
|
||||||
|
m_cur_index = new_index;
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpectralChainEditor::mouseUp(const MouseEvent & ev)
|
||||||
|
{
|
||||||
|
if (m_did_drag == true)
|
||||||
|
{
|
||||||
|
//m_src->setSpectrumProcessOrder(m_order);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -239,6 +239,27 @@ private:
|
|||||||
bool m_using_audio_buffer = false;
|
bool m_using_audio_buffer = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SpectralChainEditor : public Component
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SpectralChainEditor() {}
|
||||||
|
void paint(Graphics& g) override;
|
||||||
|
void setSource(StretchAudioSource* src)
|
||||||
|
{
|
||||||
|
m_src = src;
|
||||||
|
m_order = m_src->getSpectrumProcessOrder();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
void mouseDown(const MouseEvent& ev) override;
|
||||||
|
void mouseDrag(const MouseEvent& ev) override;
|
||||||
|
void mouseUp(const MouseEvent& ev) override;
|
||||||
|
private:
|
||||||
|
StretchAudioSource * m_src = nullptr;
|
||||||
|
bool m_did_drag = false;
|
||||||
|
int m_cur_index = -1;
|
||||||
|
std::vector<int> m_order;
|
||||||
|
};
|
||||||
|
|
||||||
class MyDynamicObject : public DynamicObject
|
class MyDynamicObject : public DynamicObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -277,6 +298,7 @@ private:
|
|||||||
|
|
||||||
TextButton m_import_button;
|
TextButton m_import_button;
|
||||||
Label m_info_label;
|
Label m_info_label;
|
||||||
|
SpectralChainEditor m_spec_order_ed;
|
||||||
void chooseFile();
|
void chooseFile();
|
||||||
|
|
||||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor)
|
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor)
|
||||||
|
Loading…
Reference in New Issue
Block a user