Control click on waveform seeks if click within active play range. Draw waveform length in seconds. (Should format into hours:minutes:seconds.milliseconds or something...)

This commit is contained in:
xenakios 2018-02-06 17:38:26 +02:00
parent ff130c6c29
commit 85f3552af4

View File

@ -88,6 +88,11 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau
{ {
return processor.getStretchSource()->getInfilePositionPercent(); return processor.getStretchSource()->getInfilePositionPercent();
}; };
m_wavecomponent.SeekCallback = [this](double pos)
{
if (processor.getStretchSource()->getPlayRange().contains(pos))
processor.getStretchSource()->seekPercent(pos);
};
m_wavecomponent.ShowFileCacheRange = true; m_wavecomponent.ShowFileCacheRange = true;
m_spec_order_ed.setSource(processor.getStretchSource()); m_spec_order_ed.setSource(processor.getStretchSource());
addAndMakeVisible(&m_spec_order_ed); addAndMakeVisible(&m_spec_order_ed);
@ -491,6 +496,7 @@ void WaveformComponent::paint(Graphics & g)
} }
g.setColour(Colours::aqua.darker()); g.setColour(Colours::aqua.darker());
g.drawText(GetFileCallback().getFileName(), 2, m_topmargin + 2, getWidth(), 20, Justification::topLeft); g.drawText(GetFileCallback().getFileName(), 2, m_topmargin + 2, getWidth(), 20, Justification::topLeft);
g.drawText(String(thumblen, 1), getWidth() - 100, m_topmargin + 2, 100, 20, Justification::topRight);
} }
void WaveformComponent::timerCallback() void WaveformComponent::timerCallback()
@ -525,7 +531,7 @@ void WaveformComponent::mouseDown(const MouseEvent & e)
m_mousedown = true; m_mousedown = true;
m_lock_timesel_set = true; m_lock_timesel_set = true;
double pos = jmap<double>(e.x, 0, getWidth(), m_view_range.getStart(), m_view_range.getEnd()); double pos = jmap<double>(e.x, 0, getWidth(), m_view_range.getStart(), m_view_range.getEnd());
if (e.y < m_topmargin) if (e.y < m_topmargin || e.mods.isCommandDown())
{ {
if (SeekCallback) if (SeekCallback)
SeekCallback(pos); SeekCallback(pos);