Mute output audio if abnormal sample values detected
This commit is contained in:
parent
c691d6358d
commit
fb710e0ec7
@ -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…
Reference in New Issue
Block a user