Added a separate performance meter component
This commit is contained in:
parent
6f89b544ab
commit
ad86b46f95
@ -28,9 +28,11 @@ extern String g_plugintitle;
|
|||||||
PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(PaulstretchpluginAudioProcessor& p)
|
PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(PaulstretchpluginAudioProcessor& p)
|
||||||
: AudioProcessorEditor(&p),
|
: AudioProcessorEditor(&p),
|
||||||
m_wavecomponent(p.m_afm,p.m_thumb.get()),
|
m_wavecomponent(p.m_afm,p.m_thumb.get()),
|
||||||
processor(p)
|
processor(p), m_perfmeter(&p)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
addAndMakeVisible(&m_perfmeter);
|
||||||
|
|
||||||
addAndMakeVisible(&m_import_button);
|
addAndMakeVisible(&m_import_button);
|
||||||
m_import_button.setButtonText("Import file...");
|
m_import_button.setButtonText("Import file...");
|
||||||
m_import_button.onClick = [this]() { chooseFile(); };
|
m_import_button.onClick = [this]() { chooseFile(); };
|
||||||
@ -84,12 +86,6 @@ PaulstretchpluginAudioProcessorEditor::~PaulstretchpluginAudioProcessorEditor()
|
|||||||
void PaulstretchpluginAudioProcessorEditor::paint (Graphics& g)
|
void PaulstretchpluginAudioProcessorEditor::paint (Graphics& g)
|
||||||
{
|
{
|
||||||
g.fillAll(Colours::darkgrey);
|
g.fillAll(Colours::darkgrey);
|
||||||
double amt = processor.getPreBufferingPercent();
|
|
||||||
g.setColour(Colours::green);
|
|
||||||
int w = amt * 100.0;
|
|
||||||
g.fillRect(m_settings_button.getRight() + 1, 1, w, 24);
|
|
||||||
g.setColour(Colours::white);
|
|
||||||
g.drawRect(m_settings_button.getRight() + 1, 1, 100, 24);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaulstretchpluginAudioProcessorEditor::resized()
|
void PaulstretchpluginAudioProcessorEditor::resized()
|
||||||
@ -98,6 +94,7 @@ void PaulstretchpluginAudioProcessorEditor::resized()
|
|||||||
m_import_button.changeWidthToFitText();
|
m_import_button.changeWidthToFitText();
|
||||||
m_settings_button.setBounds(m_import_button.getRight() + 1, 1, 60, 24);
|
m_settings_button.setBounds(m_import_button.getRight() + 1, 1, 60, 24);
|
||||||
m_settings_button.changeWidthToFitText();
|
m_settings_button.changeWidthToFitText();
|
||||||
|
m_perfmeter.setBounds(m_settings_button.getRight() + 1, 1, 200, 12);
|
||||||
m_info_label.setBounds(m_settings_button.getRight() + 1, m_settings_button.getY(),
|
m_info_label.setBounds(m_settings_button.getRight() + 1, m_settings_button.getY(),
|
||||||
getWidth()-m_settings_button.getRight()-1, 24);
|
getWidth()-m_settings_button.getRight()-1, 24);
|
||||||
int w = getWidth();
|
int w = getWidth();
|
||||||
@ -205,8 +202,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
|
|||||||
infotext += " (offline rendering)";
|
infotext += " (offline rendering)";
|
||||||
if (processor.m_playposinfo.isPlaying)
|
if (processor.m_playposinfo.isPlaying)
|
||||||
infotext += " "+String(processor.m_playposinfo.timeInSeconds,1);
|
infotext += " "+String(processor.m_playposinfo.timeInSeconds,1);
|
||||||
|
|
||||||
m_info_label.setText(infotext, dontSendNotification);
|
m_info_label.setText(infotext, dontSendNotification);
|
||||||
|
m_perfmeter.repaint();
|
||||||
}
|
}
|
||||||
if (id == 2)
|
if (id == 2)
|
||||||
{
|
{
|
||||||
|
@ -72,6 +72,23 @@ private:
|
|||||||
bool m_dragging = false;
|
bool m_dragging = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PerfMeterComponent : public Component
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PerfMeterComponent(PaulstretchpluginAudioProcessor* p) : m_proc(p) {}
|
||||||
|
void paint(Graphics& g) override
|
||||||
|
{
|
||||||
|
g.fillAll(Colours::grey);
|
||||||
|
double amt = m_proc->getPreBufferingPercent();
|
||||||
|
g.setColour(Colours::green);
|
||||||
|
int w = amt * getWidth();
|
||||||
|
g.fillRect(0, 0, w, getHeight());
|
||||||
|
g.setColour(Colours::white);
|
||||||
|
g.drawRect(0, 0, getWidth(), getHeight());
|
||||||
|
}
|
||||||
|
PaulstretchpluginAudioProcessor* m_proc = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
class MyThumbCache : public AudioThumbnailCache
|
class MyThumbCache : public AudioThumbnailCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -192,7 +209,7 @@ private:
|
|||||||
PaulstretchpluginAudioProcessor& processor;
|
PaulstretchpluginAudioProcessor& processor;
|
||||||
std::vector<std::shared_ptr<ParameterComponent>> m_parcomps;
|
std::vector<std::shared_ptr<ParameterComponent>> m_parcomps;
|
||||||
//SpectralVisualizer m_specvis;
|
//SpectralVisualizer m_specvis;
|
||||||
|
PerfMeterComponent m_perfmeter;
|
||||||
TextButton m_import_button;
|
TextButton m_import_button;
|
||||||
TextButton m_settings_button;
|
TextButton m_settings_button;
|
||||||
Label m_info_label;
|
Label m_info_label;
|
||||||
|
Loading…
Reference in New Issue
Block a user