7#include "matchers/hart_matcher.hpp"
16template<
typename SampleType>
23 const AudioBuffer<SampleType>& observedOutputAudio = context.outputAudio();
25 for (size_t channel = 0; channel < observedOutputAudio.getNumChannels(); ++channel)
27 if (!
this->appliesToChannel (channel))
30 for (size_t frame = 0; frame < observedOutputAudio.getNumFrames(); ++frame)
32 const SampleType sample = observedOutputAudio[channel][frame];
33 const bool notZero = std::fabs (sample) > SampleType (0);
35 if (notZero && ! std::isnormal (sample) && ! std::isinf (sample) && ! std::isnan (sample))
37 m_failedFrame = frame;
38 m_failedChannel = channel;
39 m_observedValue = sample;
50 std::stringstream stream;
53 << std::scientific << std::setprecision (3)
58 details
.frame = m_failedFrame;
70 void prepare (
double , size_t , size_t , size_t )
override {}
75 size_t m_failedFrame = 0;
76 size_t m_failedChannel = 0;
77 SampleType m_observedValue = SampleType (0);
Contains audio-related artefacts useful for analysis by matchers.
Container for audio data.
Checks whether the audio has no denormal values.
MatcherFailureDetails getFailureDetails() const override
Returns a description of why the match has failed.
void prepare(double, size_t, size_t, size_t) override
Prepare for processing It is guaranteed that all subsequent process() calls will be in line with the ...
bool match(AnalysisContext< SampleType > context) override
Tells the host if the piece of audio satisfies Matcher's condition or not.
bool canOperatePerBlock() const override
Tells the host if it can operate on a block-by-block basis.
#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.