7#include "matchers/hart_matcher.hpp"
16template<
typename SampleType>
23 for (size_t channel = 0; channel < observedOutputAudio.getNumChannels(); ++channel)
25 if (!
this->appliesToChannel (channel))
28 for (size_t frame = 0; frame < observedOutputAudio.getNumFrames(); ++frame)
30 const SampleType sample = observedOutputAudio[channel][frame];
31 const bool notZero = std::fabs (sample) > SampleType (0);
33 if (notZero && ! std::isnormal (sample) && ! std::isinf (sample) && ! std::isnan (sample))
35 m_failedFrame = frame;
36 m_failedChannel = channel;
37 m_observedValue = sample;
48 std::stringstream stream;
51 << std::scientific << std::setprecision (3)
56 details
.frame = m_failedFrame;
68 void prepare (
double , size_t , size_t )
override {}
73 size_t m_failedFrame = 0;
74 size_t m_failedChannel = 0;
75 SampleType m_observedValue = SampleType (0);
Container for audio data.
Checks whether the audio has no denormal values.
bool match(const AudioBuffer< SampleType > &, const AudioBuffer< SampleType > &observedOutputAudio) override
Tells the host if the piece of audio satisfies Matcher's condition or not.
MatcherFailureDetails getFailureDetails() const override
Returns a description of why the match has failed.
bool canOperatePerBlock() const override
Tells the host if it can operate on a block-by-block basis.
void prepare(double, size_t, size_t) override
Prepare for processing It is guaranteed that all subsequent process() calls will be in line with the ...
#define HART_DEFINE_GENERIC_REPRESENT(ClassName)
Defines a basic string representation of your class.
#define HART_MATCHER_DECLARE_ALIASES_FOR(ClassName)
Details about matcher failure.
size_t channel
Index of channel at which the failure was detected.
std::string description
Readable description of why the match has failed.
size_t frame
Index of frame at which the match has failed.