|
HART
0.2.0
High level Audio Regression and Testing
|
Polymorphic base for all matchers. More...
#include <hart_matcher.hpp>
Public Member Functions | |
| virtual | ~MatcherBase ()=default |
| virtual void | prepare (double sampleRateHz, size_t numChannels, size_t maxBlockSizeFrames)=0 |
| Prepare for processing It is guaranteed that all subsequent process() calls will be in line with the arguments received in this callback. This callback is guaranteed to be called after canOperatePerBlock() If any of the values supplied by this callback are not supported by the matcher, it is expected to act as if the match has failed when match() gets called. | |
| HART_DEPRECATED ("This match() overload will be removed in HART 1.0.0, use \"match (const AudioBuffer&, const AudioBuffer&)\" instead") virtual bool match(const AudioBuffer< SampleType > &observedAudio) | |
| Tells the host if the piece of audio satisfies Matcher's condition or not. | |
| virtual bool | match (const AudioBuffer< SampleType > &inputAudio, const AudioBuffer< SampleType > &observedOutputAudio) |
| Tells the host if the piece of audio satisfies Matcher's condition or not. | |
| virtual bool | canOperatePerBlock () const =0 |
| Tells the host if it can operate on a block-by-block basis. | |
| virtual void | reset () |
| Resets the matcher to its initial state. | |
| virtual MatcherFailureDetails | getFailureDetails () const =0 |
| Returns a description of why the match has failed. | |
| virtual void | represent (std::ostream &stream) const =0 |
| Makes a text representation of this Matcher for test failure outputs. | |
| virtual std::unique_ptr< MatcherBase< SampleType > > | copy () const =0 |
| Returns a smart pointer with a copy of this object. | |
| virtual std::unique_ptr< MatcherBase< SampleType > > | move ()=0 |
| Returns a smart pointer with a moved instance of this object. | |
| virtual void | representWithActiveChannels (std::ostream &stream) const =0 |
| Makes a text representation of this Matcher with optional "atChannels" appendix. | |
Polymorphic base for all matchers.
Definition at line 24 of file hart_matcher.hpp.
|
virtualdefault |
|
pure virtual |
Prepare for processing It is guaranteed that all subsequent process() calls will be in line with the arguments received in this callback. This callback is guaranteed to be called after canOperatePerBlock() If any of the values supplied by this callback are not supported by the matcher, it is expected to act as if the match has failed when match() gets called.
| sampleRateHz | sample rate at which the audio should be interpreted |
| numChannels | Number of audio channels |
| maxBlockSizeFrames | Maximum block size in frames (samples) |
Implemented in EqualsTo< SampleType >, FundamentalEquals< SampleType >, MatcherFunction< SampleType >, NoDenormals< SampleType >, PeaksAt< SampleType >, and PeaksBelow< SampleType >.
|
inline |
Tells the host if the piece of audio satisfies Matcher's condition or not.
It is guaranteed to be called only after prepare(), or not be called at all. It is guaranteed to be handed an AudioBuffer in line with values set by the last prepare() call. If canOperatePerBlock() has returned false, this callback is guaranteed to be handed a full piece of audio to check. Otherwise, it may still get a full piece of audio, or get data on a block-by-block basis.
| observedAudio | A piece of audio to check |
match (const AudioBuffer&, const AudioBuffer&) instead Definition at line 47 of file hart_matcher.hpp.
|
inlinevirtual |
Tells the host if the piece of audio satisfies Matcher's condition or not.
It is guaranteed to be called only after prepare(), or not be called at all. It is guaranteed to be handed a pair of AudioBuffers in line with values set by the last prepare() call. If canOperatePerBlock() has returned false, this callback is guaranteed to be handed a full piece of audio to check. Otherwise, it may still get a full piece of audio, or get data on a block-by-block basis.
| inputAudio | A piece of input audio. Some matchers may be based on a relationship between input and output, rather than checking just the output audio. And in a lot of cases Matcher can ingore the input completely. |
| observedOutputAudio | A piece of observed output audio to check |
true if the audio satisfies the Matcher's condition, false otherwise Reimplemented in EqualsTo< SampleType >, FundamentalEquals< SampleType >, NoDenormals< SampleType >, PeaksAt< SampleType >, PeaksBelow< SampleType >, and MatcherFunction< SampleType >.
Definition at line 63 of file hart_matcher.hpp.
|
pure virtual |
Tells the host if it can operate on a block-by-block basis.
Some types of conditions absolutely require having a full piece of audio to produce an appropriate response. For example, hart::PeaksAt matcher. Those types of matchers will return false on this callback. Matcher is guaranteed to receive a full piece of audio if this callback has returned false. Otherwise, it may receive audio either block-by-block basis, or still get a full piece of audio, if the host decides to do so.
Implemented in EqualsTo< SampleType >, FundamentalEquals< SampleType >, MatcherFunction< SampleType >, NoDenormals< SampleType >, PeaksAt< SampleType >, and PeaksBelow< SampleType >.
|
inlinevirtual |
Resets the matcher to its initial state.
Reimplemented in EqualsTo< SampleType >, and FundamentalEquals< SampleType >.
Definition at line 80 of file hart_matcher.hpp.
|
pure virtual |
Returns a description of why the match has failed.
It is guaranteed to be called strictly after calling match(), or not called at all
| MatcherFailureDetails::frame | Index of frame at which the match has failed |
| MatcherFailureDetails::channel | Index of channel at which the failure was detected |
| MatcherFailureDetails::description | Readable description of why the match has failed. Do not include the value of observed frame value or its timing in the description, as well as any of values printed by represent(), as all of this will be added to the output anyway. Also, query hart::CLIConfig for number of displayed decimal places, whenever applicable. |
Implemented in EqualsTo< SampleType >, FundamentalEquals< SampleType >, MatcherFunction< SampleType >, NoDenormals< SampleType >, PeaksAt< SampleType >, and PeaksBelow< SampleType >.
|
pure virtual |
Makes a text representation of this Matcher for test failure outputs.
It is strongly encouraged to follow python's repr() conventions for returned text - basically, put something like "MyClass(value1, value2)" (with no quotes) into the stream whenever possible, or "<Readable info in angled brackets>" otherwise. Also, use built-in stream manipulators like hart::dbPrecision wherever applicable. Use HART_DEFINE_GENERIC_REPRESENT() to get a basic implementation for this method.
| [out] | stream | Output stream to write to |
Implemented in FundamentalEquals< SampleType >, EqualsTo< SampleType >, MatcherFunction< SampleType >, PeaksAt< SampleType >, and PeaksBelow< SampleType >.
|
pure virtual |
Returns a smart pointer with a copy of this object.
Implemented in Matcher< SampleType, Derived >, Matcher< SampleType, EqualsTo< SampleType > >, Matcher< SampleType, FundamentalEquals< SampleType > >, Matcher< SampleType, MatcherFunction< SampleType > >, Matcher< SampleType, NoDenormals< SampleType > >, Matcher< SampleType, PeaksAt< SampleType > >, and Matcher< SampleType, PeaksBelow< SampleType > >.
|
pure virtual |
Returns a smart pointer with a moved instance of this object.
Implemented in Matcher< SampleType, Derived >, Matcher< SampleType, EqualsTo< SampleType > >, Matcher< SampleType, FundamentalEquals< SampleType > >, Matcher< SampleType, MatcherFunction< SampleType > >, Matcher< SampleType, NoDenormals< SampleType > >, Matcher< SampleType, PeaksAt< SampleType > >, and Matcher< SampleType, PeaksBelow< SampleType > >.
|
pure virtual |
Makes a text representation of this Matcher with optional "atChannels" appendix.
For internal use by hosts, don't override it in custom matchers.
Implemented in Matcher< SampleType, Derived >, Matcher< SampleType, EqualsTo< SampleType > >, Matcher< SampleType, FundamentalEquals< SampleType > >, Matcher< SampleType, MatcherFunction< SampleType > >, Matcher< SampleType, NoDenormals< SampleType > >, Matcher< SampleType, PeaksAt< SampleType > >, and Matcher< SampleType, PeaksBelow< SampleType > >.