Add option to mute audio when capturing

This commit is contained in:
xenakios 2018-06-01 16:31:31 +03:00
parent 8547ccc3d4
commit c5e4f78d0f
3 changed files with 9 additions and 2 deletions

View File

@ -520,7 +520,7 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
menu.addItem(5, "Load file with plugin state", true, processor.m_load_file_with_state);
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(8, "Mute audio while capturing", true, processor.m_mute_while_capturing);
int capturelen = *processor.getFloatParameter(cpi_max_capture_len);
PopupMenu capturelenmenu;
std::vector<int> capturelens{ 2,5,10,30,60,120 };
@ -547,6 +547,10 @@ void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
{
toggleBool(processor.m_capture_when_host_plays);
}
if (r == 8)
{
toggleBool(processor.m_mute_while_capturing);
}
if (r == 4)
{
processor.resetParameters();

View File

@ -662,6 +662,8 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
copyAudioBufferWrappingPosition(buffer, m_recbuffer, m_rec_pos, recbuflenframes);
m_thumb->addBlock(m_rec_pos, buffer, 0, buffer.getNumSamples());
m_rec_pos = (m_rec_pos + buffer.getNumSamples()) % recbuflenframes;
if (m_mute_while_capturing == true)
buffer.clear();
return;
}
jassert(m_buffering_source != nullptr);
@ -728,7 +730,7 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
{
m_buffering_source->getNextAudioBlock(aif);
}
if (getParameter(cpi_passthrough) > 0.5f)
if (m_is_recording == false && getParameter(cpi_passthrough) > 0.5f)
{
for (int i = 0; i < totalNumInputChannels; ++i)
{

View File

@ -188,6 +188,7 @@ public:
AudioPlayHead::CurrentPositionInfo m_playposinfo;
bool m_play_when_host_plays = false;
bool m_capture_when_host_plays = false;
bool m_mute_while_capturing = false;
bool m_use_backgroundbuffering = true;
void resetParameters();
void setPreBufferAmount(int x);