Restore ability to set capture buffer lengthm now via settings menu. Use AudioProcessor owned thumbnail for live input captured audio. Still need to clean up some of the old messy code that is now commented out.

This commit is contained in:
xenakios 2018-01-17 21:53:26 +02:00
parent f6274f19be
commit 8bf3225b83
2 changed files with 21 additions and 1 deletions

View File

@ -98,6 +98,8 @@ void PaulstretchpluginAudioProcessorEditor::resized()
int yoffs = 30;
int div = w / 4;
m_parcomps[cpi_capture_enabled]->setBounds(xoffs, yoffs, div-1, 24);
//xoffs += div;
//m_parcomps[cpi_max_capture_len]->setBounds(xoffs, yoffs, div - 1, 24);
xoffs += div;
m_parcomps[cpi_passthrough]->setBounds(xoffs, yoffs, div - 1, 24);
xoffs += div;
@ -317,11 +319,22 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
bufferingmenu.addItem(104,"Very large",true,curbufamount == 4);
bufferingmenu.addItem(105,"Huge",true,curbufamount == 5);
menu.addSubMenu("Prebuffering", bufferingmenu);
int capturelen = *processor.getFloatParameter(cpi_max_capture_len);
PopupMenu capturelenmenu;
std::vector<int> capturelens{ 2,5,10,30,60,120 };
for (int i=0;i<capturelens.size();++i)
capturelenmenu.addItem(200+i, String(capturelens[i])+" seconds", true, capturelen == capturelens[i]);
menu.addSubMenu("Capture buffer length", capturelenmenu);
menu.addItem(3, "About...", true, false);
#ifdef JUCE_DEBUG
menu.addItem(6, "Dump preset to clipboard", true, false);
#endif
int r = menu.show();
if (r >= 200 && r < 210)
{
int caplen = capturelens[r - 200];
*processor.getFloatParameter(cpi_max_capture_len) = (float)caplen;
}
if (r == 1)
{
processor.m_play_when_host_plays = !processor.m_play_when_host_plays;

View File

@ -441,7 +441,8 @@ void PaulstretchpluginAudioProcessor::prepareToPlay(double sampleRate, int sampl
m_stretch_source->setAudioBufferAsInputSource(&m_recbuffer,
getSampleRateChecked(),
len);
callGUI(this,[this,len](auto ed) { ed->setAudioBuffer(&m_recbuffer, getSampleRateChecked(), len); },false);
m_thumb->reset(m_recbuffer.getNumChannels(), sampleRate, len);
//callGUI(this,[this,len](auto ed) { ed->setAudioBuffer(&m_recbuffer, getSampleRateChecked(), len); },false);
}
if (m_prebuffering_inited == false)
{
@ -535,10 +536,13 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
return;
int recbuflenframes = m_max_reclen * getSampleRate();
copyAudioBufferWrappingPosition(buffer, m_recbuffer, m_rec_pos, recbuflenframes);
m_thumb->addBlock(m_rec_pos, buffer, 0, buffer.getNumSamples());
/*
callGUI(this,[this, &buffer](PaulstretchpluginAudioProcessorEditor*ed)
{
ed->addAudioBlock(buffer, getSampleRate(), m_rec_pos);
}, false);
*/
m_rec_pos = (m_rec_pos + buffer.getNumSamples()) % recbuflenframes;
return;
}
@ -657,10 +661,13 @@ void PaulstretchpluginAudioProcessor::setRecordingEnabled(bool b)
m_recbuffer.setSize(2, m_max_reclen*getSampleRateChecked()+4096,false,false,true);
m_recbuffer.clear();
m_rec_pos = 0;
/*
callGUI(this,[this,lenbufframes](PaulstretchpluginAudioProcessorEditor* ed)
{
ed->beginAddingAudioBlocks(2, getSampleRateChecked(), lenbufframes);
},false);
*/
m_thumb->reset(m_recbuffer.getNumChannels(), getSampleRateChecked(), lenbufframes);
m_is_recording = true;
}
else