Add submenu to set prebuffering amount, including none etc
This commit is contained in:
parent
e5c4025421
commit
643799bceb
@ -225,7 +225,17 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
|
|||||||
PopupMenu menu;
|
PopupMenu menu;
|
||||||
menu.addItem(1, "Play when host transport running", true, processor.m_play_when_host_plays);
|
menu.addItem(1, "Play when host transport running", true, processor.m_play_when_host_plays);
|
||||||
menu.addItem(2, "Capture when host transport running", true, processor.m_capture_when_host_plays);
|
menu.addItem(2, "Capture when host transport running", true, processor.m_capture_when_host_plays);
|
||||||
int r = menu.show();
|
//menu.addItem(3, "Prebuffering", true, processor.m_use_backgroundbuffering);
|
||||||
|
PopupMenu bufferingmenu;
|
||||||
|
int curbufamount = processor.getPreBufferAmount();
|
||||||
|
bufferingmenu.addItem(100,"None",true,curbufamount == -1);
|
||||||
|
bufferingmenu.addItem(101,"Small",true,curbufamount == 1);
|
||||||
|
bufferingmenu.addItem(102,"Medium",true,curbufamount == 2);
|
||||||
|
bufferingmenu.addItem(103,"Large",true,curbufamount == 3);
|
||||||
|
bufferingmenu.addItem(104,"Very large",true,curbufamount == 4);
|
||||||
|
bufferingmenu.addItem(105,"Huge",true,curbufamount == 5);
|
||||||
|
menu.addSubMenu("Prebuffering", bufferingmenu);
|
||||||
|
int r = menu.show();
|
||||||
if (r == 1)
|
if (r == 1)
|
||||||
{
|
{
|
||||||
processor.m_play_when_host_plays = !processor.m_play_when_host_plays;
|
processor.m_play_when_host_plays = !processor.m_play_when_host_plays;
|
||||||
@ -234,6 +244,13 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
|
|||||||
{
|
{
|
||||||
processor.m_capture_when_host_plays = !processor.m_capture_when_host_plays;
|
processor.m_capture_when_host_plays = !processor.m_capture_when_host_plays;
|
||||||
}
|
}
|
||||||
|
if (r >= 100 && r < 200)
|
||||||
|
{
|
||||||
|
if (r == 100)
|
||||||
|
processor.m_use_backgroundbuffering = false;
|
||||||
|
if (r > 100)
|
||||||
|
processor.setPreBufferAmount(r-100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WaveformComponent::WaveformComponent(AudioFormatManager* afm)
|
WaveformComponent::WaveformComponent(AudioFormatManager* afm)
|
||||||
|
@ -90,7 +90,7 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor()
|
|||||||
m_afm->registerBasicFormats();
|
m_afm->registerBasicFormats();
|
||||||
m_stretch_source = std::make_unique<StretchAudioSource>(2, m_afm);
|
m_stretch_source = std::make_unique<StretchAudioSource>(2, m_afm);
|
||||||
|
|
||||||
setPreBufferAmount(2);
|
|
||||||
m_ppar.pitch_shift.enabled = true;
|
m_ppar.pitch_shift.enabled = true;
|
||||||
m_ppar.freq_shift.enabled = true;
|
m_ppar.freq_shift.enabled = true;
|
||||||
m_ppar.filter.enabled = true;
|
m_ppar.filter.enabled = true;
|
||||||
@ -147,7 +147,8 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor()
|
|||||||
addParameter(m_outchansparam); // 27
|
addParameter(m_outchansparam); // 27
|
||||||
addParameter(new AudioParameterBool("pause_enabled0", "Pause", false)); // 28
|
addParameter(new AudioParameterBool("pause_enabled0", "Pause", false)); // 28
|
||||||
addParameter(new AudioParameterFloat("maxcapturelen_0", "Max capture length", 1.0f, 120.0f, 10.0f)); // 29
|
addParameter(new AudioParameterFloat("maxcapturelen_0", "Max capture length", 1.0f, 120.0f, 10.0f)); // 29
|
||||||
startTimer(1, 50);
|
setPreBufferAmount(2);
|
||||||
|
startTimer(1, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
PaulstretchpluginAudioProcessor::~PaulstretchpluginAudioProcessor()
|
PaulstretchpluginAudioProcessor::~PaulstretchpluginAudioProcessor()
|
||||||
@ -159,10 +160,19 @@ PaulstretchpluginAudioProcessor::~PaulstretchpluginAudioProcessor()
|
|||||||
void PaulstretchpluginAudioProcessor::setPreBufferAmount(int x)
|
void PaulstretchpluginAudioProcessor::setPreBufferAmount(int x)
|
||||||
{
|
{
|
||||||
int temp = jlimit(0, 5, x);
|
int temp = jlimit(0, 5, x);
|
||||||
if (temp != m_prebuffer_amount)
|
if (temp != m_prebuffer_amount || m_use_backgroundbuffering == false)
|
||||||
{
|
{
|
||||||
m_prebuffer_amount = temp;
|
m_use_backgroundbuffering = true;
|
||||||
|
m_prebuffer_amount = temp;
|
||||||
m_recreate_buffering_source = true;
|
m_recreate_buffering_source = true;
|
||||||
|
ScopedLock locker(m_cs);
|
||||||
|
m_ready_to_play = false;
|
||||||
|
m_cur_num_out_chans = *m_outchansparam;
|
||||||
|
//Logger::writeToLog("Switching to use " + String(m_cur_num_out_chans) + " out channels");
|
||||||
|
String err;
|
||||||
|
startplay({ *getFloatParameter(cpi_soundstart),*getFloatParameter(cpi_soundend) },
|
||||||
|
m_cur_num_out_chans, m_curmaxblocksize, err);
|
||||||
|
m_ready_to_play = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,7 +442,7 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
|
|||||||
m_stretch_source->setPaused(getParameter(cpi_pause_enabled));
|
m_stretch_source->setPaused(getParameter(cpi_pause_enabled));
|
||||||
m_stretch_source->setProcessParameters(&m_ppar);
|
m_stretch_source->setProcessParameters(&m_ppar);
|
||||||
AudioSourceChannelInfo aif(buffer);
|
AudioSourceChannelInfo aif(buffer);
|
||||||
if (isNonRealtime())
|
if (isNonRealtime() || m_use_backgroundbuffering == false)
|
||||||
{
|
{
|
||||||
m_stretch_source->getNextAudioBlock(aif);
|
m_stretch_source->getNextAudioBlock(aif);
|
||||||
}
|
}
|
||||||
@ -485,7 +495,11 @@ void PaulstretchpluginAudioProcessor::getStateInformation (MemoryBlock& destData
|
|||||||
{
|
{
|
||||||
paramtree.setProperty("specorder" + String(i), specorder[i], nullptr);
|
paramtree.setProperty("specorder" + String(i), specorder[i], nullptr);
|
||||||
}
|
}
|
||||||
MemoryOutputStream stream(destData,true);
|
if (m_use_backgroundbuffering)
|
||||||
|
paramtree.setProperty("prebufamount", m_prebuffer_amount, nullptr);
|
||||||
|
else
|
||||||
|
paramtree.setProperty("prebufamount", -1, nullptr);
|
||||||
|
MemoryOutputStream stream(destData,true);
|
||||||
paramtree.writeToStream(stream);
|
paramtree.writeToStream(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,6 +533,11 @@ void PaulstretchpluginAudioProcessor::setStateInformation (const void* data, int
|
|||||||
*m_outchansparam = tree.getProperty(m_outchansparam->paramID, 2);
|
*m_outchansparam = tree.getProperty(m_outchansparam->paramID, 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
int prebufamt = tree.getProperty("prebufamount", 2);
|
||||||
|
if (prebufamt==-1)
|
||||||
|
m_use_backgroundbuffering = false;
|
||||||
|
else
|
||||||
|
setPreBufferAmount(prebufamt);
|
||||||
String fn = tree.getProperty("importedfile");
|
String fn = tree.getProperty("importedfile");
|
||||||
if (fn.isEmpty() == false)
|
if (fn.isEmpty() == false)
|
||||||
{
|
{
|
||||||
|
@ -138,6 +138,14 @@ public:
|
|||||||
AudioPlayHead::CurrentPositionInfo m_playposinfo;
|
AudioPlayHead::CurrentPositionInfo m_playposinfo;
|
||||||
bool m_play_when_host_plays = false;
|
bool m_play_when_host_plays = false;
|
||||||
bool m_capture_when_host_plays = false;
|
bool m_capture_when_host_plays = false;
|
||||||
|
bool m_use_backgroundbuffering = true;
|
||||||
|
void setPreBufferAmount(int x);
|
||||||
|
int getPreBufferAmount()
|
||||||
|
{
|
||||||
|
if (m_use_backgroundbuffering==false)
|
||||||
|
return -1;
|
||||||
|
return m_prebuffer_amount;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
@ -164,7 +172,7 @@ private:
|
|||||||
double m_last_in_pos = 0.0;
|
double m_last_in_pos = 0.0;
|
||||||
std::vector<int> m_bufamounts{ 4096,8192,16384,32768,65536,262144 };
|
std::vector<int> m_bufamounts{ 4096,8192,16384,32768,65536,262144 };
|
||||||
ProcessParameters m_ppar;
|
ProcessParameters m_ppar;
|
||||||
void setPreBufferAmount(int x);
|
|
||||||
void setFFTSize(double size);
|
void setFFTSize(double size);
|
||||||
void startplay(Range<double> playrange, int numoutchans, int maxBlockSize, String& err);
|
void startplay(Range<double> playrange, int numoutchans, int maxBlockSize, String& err);
|
||||||
SharedResourcePointer<MyThumbCache> m_thumbcache;
|
SharedResourcePointer<MyThumbCache> m_thumbcache;
|
||||||
|
Loading…
Reference in New Issue
Block a user