Attempt implementing seek while frozen, doesn't work too well like this...Don't use opengl stuff at all if the opengl module isn't set available.

This commit is contained in:
xenakios
2018-04-02 20:07:55 +03:00
parent ce30e2afd9
commit 890c568155
5 changed files with 25 additions and 8 deletions

View File

@ -246,13 +246,20 @@ void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & buffer
if (m_stretchoutringbuf.available() > 0)
m_output_has_begun = true;
bool freezing = m_freezing;
if (m_stretchers[0]->isFreezing() != freezing)
if (m_do_freeze_seek == true)
{
freezing = false;
m_stretchoutringbuf.clear();
m_firstbuffer = true;
}
if (m_stretchers[0]->isFreezing() != freezing)
{
if (freezing == true && m_inputfile!=nullptr)
m_freeze_pos = 1.0/m_inputfile->info.nsamples*m_inputfile->getCurrentPosition();
for (auto& e : m_stretchers)
e->set_freezing(m_freezing);
{
e->set_freezing(freezing);
}
}
@ -381,6 +388,12 @@ void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & buffer
//Logger::writeToLog("Rerunning resampler task");
resamplertask();
}
if (m_do_freeze_seek == true)
{
for (auto& e : m_stretchers)
e->set_freezing(true);
m_do_freeze_seek = false;
}
bool source_ended = m_inputfile->hasEnded();
double samplelimit = 16384.0;
if (m_clip_output == true)
@ -666,6 +679,8 @@ bool StretchAudioSource::isPaused() const
void StretchAudioSource::seekPercent(double pos)
{
ScopedLock locker(m_cs);
if (m_freezing == true)
m_do_freeze_seek = true;
m_seekpos = pos;
//m_resampler->Reset();
m_inputfile->seek(pos);

View File

@ -130,7 +130,7 @@ private:
double m_seekpos = 0.0;
bool m_freezing = false;
bool m_do_freeze_seek = false;
int m_pause_state = 0;
Range<double> m_playrange{ 0.0,1.0 };
int64_t m_rand_count = 0;