Attempt to draw the points in the audio file where the FFTs are taken but of course it doesn't work like this because of the looping
This commit is contained in:
parent
aae05950f0
commit
11e61f8cfd
@ -106,6 +106,7 @@ public:
|
||||
void setPreviewDry(bool b);
|
||||
bool isPreviewingDry() const;
|
||||
int m_param_change_count = 0;
|
||||
double getLastSeekPos() const { return m_seekpos; }
|
||||
CriticalSection* getMutex() { return &m_cs; }
|
||||
private:
|
||||
CircularBuffer<float> m_stretchoutringbuf{ 1024 * 1024 };
|
||||
|
@ -421,6 +421,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
|
||||
m_wavecomponent.setRecordingPosition(processor.getRecordingPositionPercent());
|
||||
} else
|
||||
m_wavecomponent.setRecordingPosition(-1.0);
|
||||
m_wavecomponent.setAudioInfo(processor.getSampleRateChecked(), processor.getStretchSource()->getLastSeekPos(),
|
||||
processor.getStretchSource()->getFFTSize());
|
||||
String infotext;
|
||||
if (processor.m_show_technical_info)
|
||||
{
|
||||
@ -653,6 +655,8 @@ void WaveformComponent::paint(Graphics & g)
|
||||
thumblen*m_view_range.getStart(), thumblen*m_view_range.getEnd(), 0.0f, (float)getWidth());
|
||||
g.drawLine(tickxcor, 0.0, tickxcor, (float)m_topmargin, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
bool m_use_cached_image = true;
|
||||
if (m_use_cached_image == true)
|
||||
{
|
||||
@ -676,6 +680,18 @@ void WaveformComponent::paint(Graphics & g)
|
||||
m_thumbnail->drawChannels(g, { 0,m_topmargin,getWidth(),getHeight() - m_topmargin },
|
||||
thumblen*m_view_range.getStart(), thumblen*m_view_range.getEnd(), 1.0f);
|
||||
}
|
||||
if (m_sr > 0.0 && m_fft_size > 0 && m_time_sel_start>=0.0)
|
||||
{
|
||||
tick_interval = 1.0 / m_sr * m_fft_size;
|
||||
/*
|
||||
for (double secs = m_time_sel_start*thumblen; secs < m_time_sel_end*thumblen; secs += tick_interval)
|
||||
{
|
||||
float tickxcor = (float)jmap<double>(fmod(secs, thumblen),
|
||||
thumblen*m_view_range.getStart(), thumblen*m_view_range.getEnd(), 0.0f, (float)getWidth());
|
||||
g.drawLine(tickxcor, (float)m_topmargin, tickxcor, (float)50, 2.0f);
|
||||
}
|
||||
*/
|
||||
}
|
||||
if (m_is_at_selection_drag_area)
|
||||
g.setColour(Colours::white.withAlpha(0.6f));
|
||||
else
|
||||
@ -753,7 +769,10 @@ void WaveformComponent::mouseDown(const MouseEvent & e)
|
||||
if (e.y < m_topmargin || e.mods.isCommandDown())
|
||||
{
|
||||
if (SeekCallback)
|
||||
{
|
||||
SeekCallback(pos);
|
||||
m_last_startpos = pos;
|
||||
}
|
||||
m_didseek = true;
|
||||
}
|
||||
else
|
||||
@ -880,6 +899,13 @@ void WaveformComponent::mouseWheelMove(const MouseEvent & e, const MouseWheelDet
|
||||
*/
|
||||
}
|
||||
|
||||
void WaveformComponent::setAudioInfo(double sr, double seekpos, int fftsize)
|
||||
{
|
||||
m_sr = sr;
|
||||
m_fft_size = fftsize;
|
||||
m_last_startpos = seekpos;
|
||||
}
|
||||
|
||||
Range<double> WaveformComponent::getTimeSelection()
|
||||
{
|
||||
if (m_time_sel_start >= 0.0 && m_time_sel_end>m_time_sel_start + 0.001)
|
||||
|
@ -142,6 +142,7 @@ public:
|
||||
void mouseMove(const MouseEvent& e) override;
|
||||
void mouseDoubleClick(const MouseEvent& e) override;
|
||||
void mouseWheelMove(const MouseEvent& e, const MouseWheelDetails& wd) override;
|
||||
void setAudioInfo(double sr, double seekpos, int fftsize);
|
||||
Range<double> getTimeSelection();
|
||||
void setTimeSelection(Range<double> rng);
|
||||
void setFileCachedRange(std::pair<Range<double>, Range<double>> rng);
|
||||
@ -165,6 +166,9 @@ private:
|
||||
int getTimeSelectionEdge(int x, int y);
|
||||
std::pair<Range<double>, Range<double>> m_file_cached;
|
||||
bool m_image_dirty = false;
|
||||
double m_sr = 0.0;
|
||||
int m_fft_size = 0;
|
||||
double m_last_startpos = 0.0;
|
||||
Image m_waveimage;
|
||||
#ifdef JUCE_MODULE_AVAILABLE_juce_opengl
|
||||
OpenGLContext m_ogl;
|
||||
|
Loading…
Reference in New Issue
Block a user