Added detector for invalid sample values in plugin output

This commit is contained in:
xenakios 2017-12-18 22:27:12 +02:00
parent 8c9749a90c
commit d900572506
3 changed files with 12 additions and 0 deletions

View File

@ -116,6 +116,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
String infotext = String(processor.getPreBufferingPercent(), 1) + "% buffered " String infotext = String(processor.getPreBufferingPercent(), 1) + "% buffered "
+ String(processor.getStretchSource()->m_param_change_count)+" param changes "+m_last_err+" FFT size "+ + String(processor.getStretchSource()->m_param_change_count)+" param changes "+m_last_err+" FFT size "+
String(processor.getStretchSource()->getFFTSize()); String(processor.getStretchSource()->getFFTSize());
if (processor.m_abnormal_output_samples > 0)
infotext += " " + String(processor.m_abnormal_output_samples) + " invalid sample values";
m_info_label.setText(infotext, dontSendNotification); m_info_label.setText(infotext, dontSendNotification);
} }
if (id == 2) if (id == 2)

View File

@ -416,6 +416,15 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M
AudioSourceChannelInfo aif(buffer); AudioSourceChannelInfo aif(buffer);
m_buffering_source->getNextAudioBlock(aif); m_buffering_source->getNextAudioBlock(aif);
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;
}
}
} }
//============================================================================== //==============================================================================

View File

@ -110,6 +110,7 @@ public:
double getPreBufferingPercent(); double getPreBufferingPercent();
void timerCallback(int id) override; void timerCallback(int id) override;
double getSampleRateChecked(); double getSampleRateChecked();
int m_abnormal_output_samples = 0;
private: private: