arcsdec::v_1_0_0::ARCSCalculator class final

Calculate ARCSs for input audio files.

Note that ARCSCalculator does not perform any lookups in the filesystem. This part is completely delegated to the FileReaders.

Base classes

template<class ReaderType>
class v_1_0_0::FileReaderProvider<AudioReader>
Abstract base class for classes that create opaque readers.

Constructors, destructors, conversion operators

ARCSCalculator()
Constructor.
ARCSCalculator(const ChecksumtypeSet& type) explicit
Constructor.

Public functions

auto calculate(const std::string& audiofilename, const bool is_first_track, const bool is_last_track) -> ChecksumSet
Calculate a single ARCS for an audio file.
auto calculate(const std::string& audiofilename, const Settings& settings, const ChecksumtypeSet& types, std::unique_ptr<AudioSize>& leadout, const Points& offsets) -> Checksums
Calculate Checksums of a single audiofile.
auto calculate(const std::string& audiofilename, const ToC& toc) -> std::pair<Checksums, ARId>
Calculate ARCS values for an audio file, using the given ToC.
auto calculate(const std::vector<std::string>& audiofilenames, const bool first_file_is_first_track, const bool last_file_is_last_track) -> Checksums
Calculate ARCSs for audio files.
auto read_buffer_size() const -> int64_t
Size of the read buffer.
void set_read_buffer_size(const int64_t total_samples)
Set the preferred size of the read buffer.
void set_types(const ChecksumtypeSet& type)
Set checksum::type for the instance to calculate.
auto types() const -> ChecksumtypeSet
Return checksum::types calculated by this instance.

Function documentation

arcsdec::v_1_0_0::ARCSCalculator::ARCSCalculator()

Constructor.

Uses ARCS1 and ARCS2 as default checksum types.

arcsdec::v_1_0_0::ARCSCalculator::ARCSCalculator(const ChecksumtypeSet& type) explicit

Constructor.

Parameters
type in The Checksum type to calculate.

ChecksumSet arcsdec::v_1_0_0::ARCSCalculator::calculate(const std::string& audiofilename, const bool is_first_track, const bool is_last_track)

Calculate a single ARCS for an audio file.

Parameters
audiofilename in Name of the audiofile
is_first_track in Iff TRUE, file is treated as first track
is_last_track in Iff TRUE, file is treated as last track
Returns The AccurateRip checksum of this track

The flags is_first_track and is_last_track control whether the track is processed as first or last track of an album. Since the AccurateRip algorithms process the first and last file in a special way, it is required to flag them accordingly.

Checksums arcsdec::v_1_0_0::ARCSCalculator::calculate(const std::string& audiofilename, const Settings& settings, const ChecksumtypeSet& types, std::unique_ptr<AudioSize>& leadout, const Points& offsets)

Calculate Checksums of a single audiofile.

Parameters
audiofilename in Name of audio file to process
settings in Settings for calculations
types in Requested checksum types
leadout in/out Leadout
offsets in Offsets

std::pair<Checksums, ARId> arcsdec::v_1_0_0::ARCSCalculator::calculate(const std::string& audiofilename, const ToC& toc)

Calculate ARCS values for an audio file, using the given ToC.

Parameters
audiofilename in Name of the audiofile
toc in Offsets for the audiofile
Returns AccurateRip checksums of all tracks specified in the ToC

The ToC is supposed to contain the offsets of all tracks represented in the audio file. It is not required to be complete().

Any audio file names in the ToC are ignored in favor of audiofilename.

The result will contain ARCS v1 and v2 for all tracks specified in the ToC.

Checksums arcsdec::v_1_0_0::ARCSCalculator::calculate(const std::vector<std::string>& audiofilenames, const bool first_file_is_first_track, const bool last_file_is_last_track)

Calculate ARCSs for audio files.

Parameters
audiofilenames in Names of the audiofiles
first_file_is_first_track in Process first file as first track
last_file_is_last_track in Process last file as last track
Returns AccurateRip checksums of the input files

It can be specified that the sequence of audiofiles forms an album by passing TRUE for both boolean parameters.

The ARCSs in the result will have the same order as the input files, so for any index i: 0 <= i < audiofilenames.size(), result[i] will be the result for audiofilenames[i]. The result will have the same size as audiofilenames.

Note that in this use case, it is not offered to compute the ARId of the album since the exact offsets are missing.

int64_t arcsdec::v_1_0_0::ARCSCalculator::read_buffer_size() const

Size of the read buffer.

Returns Preferred size of the read buffer

void arcsdec::v_1_0_0::ARCSCalculator::set_read_buffer_size(const int64_t total_samples)

Set the preferred size of the read buffer.

Parameters
total_samples in Number of PCM 32 bit samples to read at once

This determines the number of samples to read in one read operation.

The Audioreader is not forced to respect it, but it is a strong hint.

void arcsdec::v_1_0_0::ARCSCalculator::set_types(const ChecksumtypeSet& type)

Set checksum::type for the instance to calculate.

Parameters
type in The checksum::type to calculate

ChecksumtypeSet arcsdec::v_1_0_0::ARCSCalculator::types() const

Return checksum::types calculated by this instance.

Returns The set of checksum::types to calculate