AccurateRip Checksum Matching module
Match local Checksums against an AccurateRip response.
Matcher provides an interface to match the ARCSs of some audio input against a response from AccurateRip.
Use a Matcher by just calling its constructor with the required input. Thereafter the Matcher provides the caller with information about the Match:
- matches() indicates whether a complete match was found
- best_
match() points to a block with best matching - best_
match_ is_ v2() indicates whether best_match() refers to a Checksum of type ARCSv2 - best_
difference() yields the number of non-matching tracks in the best_match() - match() yields the entire Match matrix
A Matcher returns a Match that represents a matrix of numeric comparisons: the result of matching the Checksums to each ARBlock in the ARResponse.
While Matcher implements the comparison strategy and the above convenience functions about the result, the Match implements the actual result of the comparison.
Match::isV2
indicates by TRUE
that the comparison was performed for ARCSv2.
Three Matcher implementations are provided.
AlbumMatcher matches each checksum in a list of track-based Checksums against the value of the corresponding track in each ARBlock of the ARResponse. This implements the verification process of a complete disc image. AlbumMatcher requires an ARId and respects it in the match against the ARBlock.
ListMatcher performs the same logic as AlbumMatcher, but works on a single list of reference checksums instead of an ARResponse.
TracksetMatcher matches a set of file-based Checksums against an ARResponse by trying to match each of the Checksums against each of the sums in each ARBlock. It is used for matching a set of track files in arbitrary order. An ARId is optional.
Classes
- class arcstk::v_1_0_0::AlbumMatcher
- Match an album track list against an ARResponse.
- class arcstk::v_1_0_0::ListMatcher
- Match a set of actual Checksums against a list of reference Checksums.
- class arcstk::v_1_0_0::Match
- Interface: Result of matching Checksums against an ARResponse.
- class arcstk::v_1_0_0::Matcher
- Interface: Try to Match Checksums against a specified ARResponse.
- class arcstk::v_1_0_0::TracksetMatcher
- Match an arbitrary set of Checksums against an ARResponse.
Typedefs
-
template<typename T>using IsChecksumContainer = std::enable_if_t<details::is_checksum_container<T>::value>
- Defined iff T is a container whose value_type is Checksum.
Functions
-
template<typename Container, typename = IsChecksumContainer<Container>>auto perform_match(const Checksums& actual_sums, const ARId& actual_id, Container&& ref_sums, const ARId& ref_id) -> std::unique_ptr<Match>
- Perform a match of some
checksums
against acontainer
of reference values. -
template<typename Container, typename = IsChecksumContainer<Container>>auto perform_match(const Checksums& actual_sums, Container&& ref_sums) -> std::unique_ptr<Match>
- Perform a match of some
checksums
against acontainer
of reference values.
Typedef documentation
#include <include/match.hpp>
template<typename T>
using IsChecksumContainer = std::enable_if_t<details::is_checksum_container<T>::value>
Defined iff T is a container whose value_type is Checksum.
Template parameters | |
---|---|
T | The type to test |
Function documentation
#include <include/match.hpp>
template<typename Container, typename = IsChecksumContainer<Container>>
std::unique_ptr<Match> perform_match(const Checksums& actual_sums,
const ARId& actual_id,
Container&& ref_sums,
const ARId& ref_id)
Perform a match of some checksums
against a container
of reference values.
Parameters | |
---|---|
actual_sums in | Actual Checksums to verify |
actual_id in | Actual ARId to verify |
ref_sums in | Iterable container of reference Checksums |
ref_id in | Reference ARId |
Returns | Match of checkums against the container values for ARCS2 and ARCS1 |
The container
has to obey the IsChecksumContainer
requirements.
If container.size()
is n, the first n Checksum instances in checksums
will be compared to the Checksum instances on the equivalent index position in container
. For this operation to be successfully completed, the caller has to ensure that checksums.size() >= container.size()
.
#include <include/match.hpp>
template<typename Container, typename = IsChecksumContainer<Container>>
std::unique_ptr<Match> perform_match(const Checksums& actual_sums,
Container&& ref_sums)
Perform a match of some checksums
against a container
of reference values.
Parameters | |
---|---|
actual_sums in | Actual Checksums to verify |
ref_sums in | Iterable container of reference Checksums |
Returns | Match of checkums against the container values for ARCS2 and ARCS1 |
The container
has to obey the IsChecksumContainer
requirements.
If container.size()
is n, the first n Checksum instances in checksums
will be compared to the Checksum instances on the equivalent index position in container
. For this operation to be successfully completed, the caller has to ensure that checksums.size() >= container.size()
.
There is no ARId to compare, therefore the ARId is excluded as source of difference. The block id match flag will therefore always be TRUE
.