Double click on waveform selects whole buffer

This commit is contained in:
xenakios 2018-01-20 22:21:26 +02:00
parent bc3f456485
commit fcbd99d4ed
2 changed files with 13 additions and 4 deletions

View File

@ -60,8 +60,8 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
setSize (1000, 30+(pars.size()/2)*25+200);
m_wavecomponent.TimeSelectionChangedCallback = [this](Range<double> range, int which)
{
*processor.getFloatParameter(5) = range.getStart();
*processor.getFloatParameter(6) = range.getEnd();
*processor.getFloatParameter(cpi_soundstart) = range.getStart();
*processor.getFloatParameter(cpi_soundend) = range.getEnd();
};
m_wavecomponent.CursorPosCallback = [this]()
{
@ -503,8 +503,8 @@ void WaveformComponent::mouseDown(const MouseEvent & e)
m_drag_time_start = pos;
if (m_time_sel_drag_target == 0)
{
m_time_sel_start = -1.0;
m_time_sel_end = -1.0;
//m_time_sel_start = 0.0;
//m_time_sel_end = 1.0;
}
}
@ -574,6 +574,14 @@ void WaveformComponent::mouseMove(const MouseEvent & e)
}
void WaveformComponent::mouseDoubleClick(const MouseEvent & e)
{
m_time_sel_start = 0.0;
m_time_sel_end = 1.0;
TimeSelectionChangedCallback({ 0.0,1.0 }, 0);
repaint();
}
Range<double> WaveformComponent::getTimeSelection()
{
if (m_time_sel_start >= 0.0 && m_time_sel_end>m_time_sel_start + 0.001)

View File

@ -95,6 +95,7 @@ public:
void mouseUp(const MouseEvent& e) override;
void mouseDrag(const MouseEvent& e) override;
void mouseMove(const MouseEvent& e) override;
void mouseDoubleClick(const MouseEvent& e) override;
Range<double> getTimeSelection();
void setTimeSelection(Range<double> rng);
void setFileCachedRange(std::pair<Range<double>, Range<double>> rng);