Playcursor tweaks but still wonky

This commit is contained in:
xenakios 2018-09-13 14:04:56 +03:00
parent cabf6de7c3
commit eace6f6d53
3 changed files with 8 additions and 3 deletions

View File

@ -112,6 +112,7 @@ public:
double getLastSeekPos() const { return m_seekpos; }
CriticalSection* getMutex() { return &m_cs; }
int64_t getLastSourcePosition() const { return m_last_filepos; }
int m_prebuffersize = 0;
private:
CircularBuffer<float> m_stretchoutringbuf{ 1024 * 1024 };
AudioBuffer<float> m_file_inbuf;

View File

@ -702,8 +702,10 @@ void WaveformComponent::paint(Graphics & g)
if (CursorPosCallback)
{
double timediff = (Time::getMillisecondCounterHiRes() - m_last_source_pos_update_time)*(1.0/m_sas->getRate());
double curpos = ((double)m_last_source_pos / m_sas->getOutputSamplerate()) + (timediff/1000.0);
curpos = 1.0 / m_sas->getInfileLengthSeconds()*curpos;
double curpos = ((double)m_last_source_pos / m_sas->getOutputSamplerate());
double prebufoffset = (double)m_sas->m_prebuffersize / m_sas->getOutputSamplerate();
curpos -= prebufoffset;
curpos = 1.0 / m_sas->getInfileLengthSeconds()*(curpos+(timediff / 1000.0));
g.fillRect(normalizedToViewX<int>(curpos), m_topmargin, 1, getHeight() - m_topmargin);
g.drawText(String(curpos), 1, 30, 200,30, Justification::left);
//g.fillRect(normalizedToViewX<int>(CursorPosCallback()), m_topmargin, 1, getHeight() - m_topmargin);

View File

@ -226,7 +226,8 @@ void PaulstretchpluginAudioProcessor::setPreBufferAmount(int x)
String err;
startplay({ *getFloatParameter(cpi_soundstart),*getFloatParameter(cpi_soundend) },
m_cur_num_out_chans, m_curmaxblocksize, err);
m_prebuffering_inited = true;
m_prebuffering_inited = true;
}
}
@ -422,6 +423,7 @@ void PaulstretchpluginAudioProcessor::startplay(Range<double> playrange, int num
m_stretch_source->setNumOutChannels(numoutchans);
m_stretch_source->setFFTSize(m_fft_size_to_use);
m_stretch_source->setProcessParameters(&m_ppar);
m_stretch_source->m_prebuffersize = bufamt;
m_last_outpos_pos = 0.0;
m_last_in_pos = playrange.getStart()*m_stretch_source->getInfileLengthSeconds();
m_buffering_source->prepareToPlay(maxBlockSize, getSampleRateChecked());