If capture buffer used, refresh waveform when GUI has been closed and reopened.

This commit is contained in:
xenakios 2017-12-13 05:18:39 +02:00
parent f872a13257
commit e411a99f70
5 changed files with 25 additions and 2 deletions

View File

@ -65,6 +65,12 @@ public:
seek(m_activerange.getStart());
updateXFadeCache();
}
virtual AudioBuffer<float>* getAudioBuffer() override
{
if (m_using_memory_buffer)
return &m_readbuf;
return nullptr;
}
bool openAudioFile(File file) override
{
m_silenceoutputted = 0;

View File

@ -79,7 +79,7 @@ public:
{
return m_currentsample >= info.nsamples*m_activerange.getEnd();
}
virtual AudioBuffer<float>* getAudioBuffer()=0;
protected:
volatile int64_t m_currentsample = 0;
int m_silenceoutputted = 0;

View File

@ -44,6 +44,13 @@ void StretchAudioSource::releaseResources()
}
AudioBuffer<float>* StretchAudioSource::getSourceAudioBuffer()
{
if (m_inputfile==nullptr)
return nullptr;
return m_inputfile->getAudioBuffer();
}
bool StretchAudioSource::isResampling()
{
if (m_inputfile==nullptr || m_inputfile->info.samplerate==0)

View File

@ -51,6 +51,8 @@ public:
String setAudioFile(File file);
File getAudioFile();
AudioBuffer<float>* getSourceAudioBuffer();
void setNumOutChannels(int chans);
int getNumOutChannels() { return m_num_outchans; }
double getInfilePositionPercent();

View File

@ -111,6 +111,13 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
{
m_wavecomponent.setAudioFile(processor.getAudioFile());
}
if (processor.getAudioFile()==File() && processor.isRecordingEnabled()==false)
{
auto bufptr = processor.getStretchSource()->getSourceAudioBuffer();
if (bufptr!=nullptr)
m_wavecomponent.setAudioBuffer(bufptr,
processor.getSampleRate(), bufptr->getNumSamples());
}
m_wavecomponent.setTimeSelection(processor.getTimeSelection());
}
@ -297,7 +304,8 @@ void WaveformComponent::setAudioFile(File f)
void WaveformComponent::setAudioBuffer(AudioBuffer<float>* buf, int samplerate, int len)
{
m_waveimage = Image();
jassert(buf!=nullptr);
m_waveimage = Image();
m_curfile = File();
m_thumb->reset(buf->getNumChannels(), samplerate, len);
m_thumb->addBlock(0, *buf, 0, len);