Browse Source

Mute output audio if abnormal sample values detected

master
xenakios 6 years ago
parent
commit
fb710e0ec7
1 changed files with 8 additions and 0 deletions
  1. +8
    -0
      Source/PluginProcessor.cpp

+ 8
- 0
Source/PluginProcessor.cpp View File

@@ -740,15 +740,23 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
buffer.addFrom(i, 0, m_input_buffer, i, 0, buffer.getNumSamples());
}
}
bool abnordetected = false;
for (int i = 0; i < buffer.getNumChannels(); ++i)
{
for (int j = 0; j < buffer.getNumSamples(); ++j)
{
float sample = buffer.getSample(i,j);
if (std::isnan(sample) || std::isinf(sample))
{
++m_abnormal_output_samples;
abnordetected = true;
}
}
}
if (abnordetected)
{
buffer.clear();
}
}

//==============================================================================


Loading…
Cancel
Save