Again draw file name in waveform component
This commit is contained in:
parent
99127c79bb
commit
bc3f456485
@ -42,6 +42,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
|
|||||||
addAndMakeVisible(&m_info_label);
|
addAndMakeVisible(&m_info_label);
|
||||||
m_info_label.setJustificationType(Justification::centredRight);
|
m_info_label.setJustificationType(Justification::centredRight);
|
||||||
|
|
||||||
|
m_wavecomponent.GetFileCallback = [this]() { return processor.getAudioFile(); };
|
||||||
addAndMakeVisible(&m_wavecomponent);
|
addAndMakeVisible(&m_wavecomponent);
|
||||||
const auto& pars = processor.getParameters();
|
const auto& pars = processor.getParameters();
|
||||||
for (int i=0;i<pars.size();++i)
|
for (int i=0;i<pars.size();++i)
|
||||||
@ -372,6 +373,7 @@ void WaveformComponent::changeListenerCallback(ChangeBroadcaster * /*cb*/)
|
|||||||
|
|
||||||
void WaveformComponent::paint(Graphics & g)
|
void WaveformComponent::paint(Graphics & g)
|
||||||
{
|
{
|
||||||
|
jassert(GetFileCallback);
|
||||||
//Logger::writeToLog("Waveform component paint");
|
//Logger::writeToLog("Waveform component paint");
|
||||||
g.fillAll(Colours::black);
|
g.fillAll(Colours::black);
|
||||||
g.setColour(Colours::darkgrey);
|
g.setColour(Colours::darkgrey);
|
||||||
@ -454,7 +456,7 @@ void WaveformComponent::paint(Graphics & g)
|
|||||||
g.fillRect((int)pos, m_topmargin, 1, getHeight() - m_topmargin);
|
g.fillRect((int)pos, m_topmargin, 1, getHeight() - m_topmargin);
|
||||||
}
|
}
|
||||||
g.setColour(Colours::aqua.darker());
|
g.setColour(Colours::aqua.darker());
|
||||||
g.drawText(m_curfile.getFullPathName(), 2, m_topmargin + 2, getWidth(), 20, Justification::topLeft);
|
g.drawText(GetFileCallback().getFileName(), 2, m_topmargin + 2, getWidth(), 20, Justification::topLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaveformComponent::timerCallback()
|
void WaveformComponent::timerCallback()
|
||||||
|
@ -86,12 +86,11 @@ public:
|
|||||||
~WaveformComponent();
|
~WaveformComponent();
|
||||||
void changeListenerCallback(ChangeBroadcaster* cb) override;
|
void changeListenerCallback(ChangeBroadcaster* cb) override;
|
||||||
void paint(Graphics& g) override;
|
void paint(Graphics& g) override;
|
||||||
const File& getAudioFile() const { return m_curfile; }
|
|
||||||
bool isUsingAudioBuffer() const { return m_using_audio_buffer; }
|
|
||||||
void timerCallback() override;
|
void timerCallback() override;
|
||||||
std::function<double()> CursorPosCallback;
|
std::function<double()> CursorPosCallback;
|
||||||
std::function<void(double)> SeekCallback;
|
std::function<void(double)> SeekCallback;
|
||||||
std::function<void(Range<double>, int)> TimeSelectionChangedCallback;
|
std::function<void(Range<double>, int)> TimeSelectionChangedCallback;
|
||||||
|
std::function<File()> GetFileCallback;
|
||||||
void mouseDown(const MouseEvent& e) override;
|
void mouseDown(const MouseEvent& e) override;
|
||||||
void mouseUp(const MouseEvent& e) override;
|
void mouseUp(const MouseEvent& e) override;
|
||||||
void mouseDrag(const MouseEvent& e) override;
|
void mouseDrag(const MouseEvent& e) override;
|
||||||
@ -116,7 +115,7 @@ private:
|
|||||||
int m_topmargin = 0;
|
int m_topmargin = 0;
|
||||||
int getTimeSelectionEdge(int x, int y);
|
int getTimeSelectionEdge(int x, int y);
|
||||||
std::pair<Range<double>, Range<double>> m_file_cached;
|
std::pair<Range<double>, Range<double>> m_file_cached;
|
||||||
File m_curfile;
|
|
||||||
Image m_waveimage;
|
Image m_waveimage;
|
||||||
OpenGLContext m_ogl;
|
OpenGLContext m_ogl;
|
||||||
bool m_use_opengl = false;
|
bool m_use_opengl = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user