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;

View File

@ -505,8 +505,10 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
WaveformComponent::WaveformComponent(AudioFormatManager* afm, AudioThumbnail* thumb)
{
TimeSelectionChangedCallback = [](Range<double>, int) {};
#ifdef JUCE_MODULE_AVAILABLE_juce_opengl
if (m_use_opengl == true)
m_ogl.attachTo(*this);
#endif
m_thumbnail = thumb;
m_thumbnail->addChangeListener(this);
setOpaque(true);
@ -514,8 +516,10 @@ WaveformComponent::WaveformComponent(AudioFormatManager* afm, AudioThumbnail* th
WaveformComponent::~WaveformComponent()
{
#ifdef JUCE_MODULE_AVAILABLE_juce_opengl
if (m_use_opengl == true)
m_ogl.detach();
#endif
m_thumbnail->removeChangeListener(this);
}

View File

@ -165,8 +165,10 @@ private:
std::pair<Range<double>, Range<double>> m_file_cached;
bool m_image_dirty = false;
Image m_waveimage;
#ifdef JUCE_MODULE_AVAILABLE_juce_opengl
OpenGLContext m_ogl;
bool m_use_opengl = false;
#endif
double m_rec_pos = 0.0;
bool m_lock_timesel_set = false;
bool m_using_audio_buffer = false;

View File

@ -69,7 +69,6 @@
<MODULEPATH id="juce_gui_basics" path="../JUCE/modules"/>
<MODULEPATH id="juce_gui_extra" path="../JUCE/modules"/>
<MODULEPATH id="juce_cryptography" path="../JUCE/modules"/>
<MODULEPATH id="juce_opengl" path="../JUCE/modules"/>
<MODULEPATH id="juce_audio_basics" path="../JUCE/modules"/>
<MODULEPATH id="juce_audio_devices" path="../JUCE/modules"/>
<MODULEPATH id="juce_audio_formats" path="../JUCE/modules"/>
@ -99,7 +98,6 @@
<MODULEPATH id="juce_gui_basics" path="../JUCE/modules"/>
<MODULEPATH id="juce_gui_extra" path="../JUCE/modules"/>
<MODULEPATH id="juce_cryptography" path="../JUCE/modules"/>
<MODULEPATH id="juce_opengl" path="../JUCE/modules"/>
<MODULEPATH id="juce_audio_basics" path="../JUCE/modules"/>
<MODULEPATH id="juce_audio_devices" path="../JUCE/modules"/>
<MODULEPATH id="juce_audio_formats" path="../JUCE/modules"/>
@ -123,7 +121,6 @@
<MODULEPATH id="juce_gui_basics" path="../JUCE/modules"/>
<MODULEPATH id="juce_gui_extra" path="../JUCE/modules"/>
<MODULEPATH id="juce_cryptography" path="../JUCE/modules"/>
<MODULEPATH id="juce_opengl" path="../JUCE/modules"/>
<MODULEPATH id="juce_audio_basics" path="../JUCE/modules"/>
<MODULEPATH id="juce_audio_devices" path="../JUCE/modules"/>
<MODULEPATH id="juce_audio_formats" path="../JUCE/modules"/>
@ -148,7 +145,6 @@
<MODULE id="juce_graphics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_gui_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_gui_extra" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_opengl" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
</MODULES>
<JUCEOPTIONS JUCE_QUICKTIME="disabled"/>
</JUCERPROJECT>