HART  0.2.0
High level Audio Regression and Testing
Loading...
Searching...
No Matches
Matcher< SampleType, Derived > Class Template Reference

Base for audio matchers. More...

#include <hart_matcher.hpp>

Inheritance diagram for Matcher< SampleType, Derived >:

Public Member Functions

virtual std::unique_ptr< MatcherBase< SampleType > > copy () const override
 Returns a smart pointer with a copy of this object.
 
virtual std::unique_ptr< MatcherBase< SampleType > > move () override
 Returns a smart pointer with a moved instance of this object.
 
Derived & atChannels (std::initializer_list< size_t > channelsToMatch) &
 Makes this matcher check only specific channels, and ignore the rest.
 
Derived && atChannels (std::initializer_list< size_t > channelsToMatch) &&
 Makes this matcher check only specific channels, and ignore the rest.
 
Derived & atChannel (size_t channelToMatch) &
 Makes this matcher check only one specific channel, and ignore the rest.
 
Derived && atChannel (size_t channelToMatch) &&
 Makes this matcher check only one specific channel, and ignore the rest.
 
Derived & atAllChannels () &
 Makes this matcher check all channels.
 
Derived && atAllChannels () &&
 Makes this matcher check all channels.
 
Derived & atAllChannelsExcept (std::initializer_list< size_t > channelsToSkip) &
 Makes this matcher check only specific channels, and ignore the rest.
 
Derived && atAllChannelsExcept (std::initializer_list< size_t > channelsToSkip) &&
 Makes this matcher check only specific channels, and ignore the rest.
 
- Public Member Functions inherited from MatcherBase< SampleType >
virtual ~MatcherBase ()=default
 
virtual void prepare (double sampleRateHz, size_t numInputChannels, size_t numOutputChannels, 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 method is deprecated. Switch to the one that uses AnalysisContext instead.") virtual bool match(const AudioBuffer< SampleType > &inputAudio
 Tells the host if the piece of audio satisfies Matcher's condition or not.
 
return match (analysisContext)
 
virtual bool match (AnalysisContext< SampleType > analysisContext)
 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 bool supportsChannelLayout (size_t, size_t) const
 Tells the host whether this Matcher is capable of operating on audio with a specific number of channels.
 
virtual bool supportsSampleRate (double) const
 Tells whether this Matcher supports given sample rate.
 
void prepareWithActiveChannels (double sampleRateHz, size_t numInputChannels, size_t numOutputChannels, size_t maxBlockSizeFrames)
 Prepare for processing, meant to be called by a host.
 
void representWithActiveChannels (std::ostream &stream) const
 Makes a text representation of this Matcher with optional "atChannels" appendix.
 

Related Symbols

(Note that these are not member symbols.)

template<typename SampleType >
std::ostream & operator<< (std::ostream &stream, const MatcherBase< SampleType > &matcher)
 Prints readable text representation of the Matcher object into the I/O stream.
 

Additional Inherited Members

- Public Attributes inherited from MatcherBase< SampleType >
const AudioBuffer< SampleType > & observedOutputAudio
 
- Protected Member Functions inherited from MatcherBase< SampleType >
bool appliesToChannel (size_t channel)
 Indicates whether this matcher should check a specific channel.
 
ChannelFlags getChannelFlags () const
 Returns flags for the channels that the matcher should apply to.
 
- Protected Attributes inherited from MatcherBase< SampleType >
ChannelFlags m_channelsToMatch {true}
 

Detailed Description

template<typename SampleType, typename Derived>
class hart::Matcher< SampleType, Derived >

Base for audio matchers.

Those matchers get a piece of audio generated by some DSP effect and asked if if satisfies their condition or not You can inherit from this class to create a new matcher (note the CRTP in the template args here, it's important!):

template<typename SampleType>
class MyCustomMatcher: public Matcher<SampleType, MyCustomMatcher<SampleType>>
{
// ...
};
Base for audio matchers.
Template Parameters
SampleTypeType of data in the buffers to be checked, typically float or double.
DerivedSubclass for CRTP

Definition at line 187 of file hart_matcher.hpp.

Member Function Documentation

◆ copy()

template<typename SampleType , typename Derived >
virtual std::unique_ptr< MatcherBase< SampleType > > copy ( ) const
inlineoverridevirtual

Returns a smart pointer with a copy of this object.

Returns
Copy of this object wrapped in a smart pointer

Implements MatcherBase< SampleType >.

Definition at line 194 of file hart_matcher.hpp.

◆ move()

template<typename SampleType , typename Derived >
virtual std::unique_ptr< MatcherBase< SampleType > > move ( )
inlineoverridevirtual

Returns a smart pointer with a moved instance of this object.

Returns
This object, moved and wrapped in a smart pointer

Implements MatcherBase< SampleType >.

Definition at line 201 of file hart_matcher.hpp.

◆ atChannels() [1/2]

template<typename SampleType , typename Derived >
Derived & atChannels ( std::initializer_list< size_t >  channelsToMatch) &
inline

Makes this matcher check only specific channels, and ignore the rest.

If not set, the matcher applies to all channels by default. If you call this method multiple times, only the last one will be applied. To select only one channel, consider using Matcher::atChannel() instead.

Parameters
channelsToMatchList of channels this matcher should apply to, e.g. {0, 1} or {Channel::left, Channel::right} for left and right channels only.
See also
hart::Channel

Definition at line 213 of file hart_matcher.hpp.

◆ atChannels() [2/2]

template<typename SampleType , typename Derived >
Derived && atChannels ( std::initializer_list< size_t >  channelsToMatch) &&
inline

Makes this matcher check only specific channels, and ignore the rest.

If not set, the matcher applies to all channels by default. If you call this method multiple times, only the last one will be applied. To select only one channel, consider using Matcher::atChannel() instead.

Parameters
channelsToMatchList of channels this matcher should apply to, e.g. {0, 1} or {Channel::left, Channel::right} for left and right channels only.
See also
hart::Channel

Definition at line 226 of file hart_matcher.hpp.

◆ atChannel() [1/2]

template<typename SampleType , typename Derived >
Derived & atChannel ( size_t  channelToMatch) &
inline

Makes this matcher check only one specific channel, and ignore the rest.

If not set, the matcher applies to all channels by default. If you call this method multiple times, only the last one will be applied. To select multiple channels, use Matcher::atChannels() instead.

Parameters
channelToMatchChannel this matcher should apply to (zero-based), e.g. 0 or Channel::left for left channel.
Note
If not set, the matcher applies to all channels by default
See also
hart::Channel

Definition at line 240 of file hart_matcher.hpp.

◆ atChannel() [2/2]

template<typename SampleType , typename Derived >
Derived && atChannel ( size_t  channelToMatch) &&
inline

Makes this matcher check only one specific channel, and ignore the rest.

If not set, the matcher applies to all channels by default. If you call this method multiple times, only the last one will be applied. To select multiple channels, use Matcher::atChannels() instead.

Parameters
channelToMatchChannel this matcher should apply to (zero-based), e.g. 0 or Channel::left for left channel.
Note
If not set, the matcher applies to all channels by default
See also
hart::Channel

Definition at line 254 of file hart_matcher.hpp.

◆ atAllChannels() [1/2]

template<typename SampleType , typename Derived >
Derived & atAllChannels ( ) &
inline

Makes this matcher check all channels.

This is the default setting anyway, so this method is only for cases when you need to override previous atChannel(), atChannels() or atAllChannelsExcept() calls.

Definition at line 264 of file hart_matcher.hpp.

◆ atAllChannels() [2/2]

template<typename SampleType , typename Derived >
Derived && atAllChannels ( ) &&
inline

Makes this matcher check all channels.

This is the default setting anyway, so this method is only for cases when you need to override previous atChannel(), atChannels() or atAllChannelsExcept() calls.

Definition at line 274 of file hart_matcher.hpp.

◆ atAllChannelsExcept() [1/2]

template<typename SampleType , typename Derived >
Derived & atAllChannelsExcept ( std::initializer_list< size_t >  channelsToSkip) &
inline

Makes this matcher check only specific channels, and ignore the rest.

If not set, matcher checks all channels by default. If you call this method multiple times, only the last one will be applied.

Parameters
channelsToSkipList of channels this matcher should NOT check, e.g. {0, 1} or {Channel::left, Channel::right} to skip left and right channels, and match the rest
See also
hart::Channel

Definition at line 287 of file hart_matcher.hpp.

◆ atAllChannelsExcept() [2/2]

template<typename SampleType , typename Derived >
Derived && atAllChannelsExcept ( std::initializer_list< size_t >  channelsToSkip) &&
inline

Makes this matcher check only specific channels, and ignore the rest.

If not set, matcher checks all channels by default. If you call this method multiple times, only the last one will be applied.

Parameters
channelsToSkipList of channels this matcher should NOT check, e.g. {0, 1} or {Channel::left, Channel::right} to skip left and right channels, and match the rest
See also
hart::Channel

Definition at line 300 of file hart_matcher.hpp.


The documentation for this class was generated from the following file: