class final
#include <calculate.hpp>
v_1_0_0::Calculation Perform checksums calculation.
A Calculation represents a concrete checksum calculation process. It is manually performed by the caller by calling update().
Calculation instances must be initialized with the specific size of the input audio file and an Algorithm that defines the type of the checksums. If multiple tracks e.g. an entire disc content is to be processed, the ToC information of the disc is required. Additionally, a Settings instance can be specified. Currently, the only supported Settings attribute is Context.
The input of the audio file must be represented as a succession of iterable SampleSequences and the Calculation is to be sequentially updated with these sequences in order. After the last update, the Calculation returns the calculation result on request. The calculated Checksums are represented as an iterable aggregate of ChecksumSets.
Constructors, destructors, conversion operators
- Calculation(Calculation&& rhs) explicit noexcept
- Move constructor.
- Calculation(const Calculation& rhs) explicit
- Copy constructor.
- Calculation(const Settings& settings, std::unique_ptr<Algorithm> algorithm, const AudioSize& size, const Points& points)
- Constructor.
- Calculation(const Settings& settings, std::unique_ptr<Algorithm> algorithm, const ToCData& toc)
- Constructor.
- ~Calculation() noexcept
- Default destructor.
Public functions
- auto algo_time_elapsed() const -> std::chrono::duration<float> noexcept
- Amount of time elapsed so far by the algorithm instance.
- auto algorithm() const -> const Algorithm* noexcept
- Returns the algorithm instance used by this Calculation.
- auto complete() const -> bool noexcept
- Returns
TRUE
iff this Calculation is completed, otherwiseFALSE
. - auto result() const -> Checksums noexcept
- Acquire the resulting Checksums.
- auto samples_expected() const -> int32_t noexcept
- Returns the total number of initially expected PCM 32 bit samples.
- auto samples_processed() const -> int32_t noexcept
- Returns the total number for PCM 32 bit samples yet processed.
- auto samples_todo() const -> int32_t noexcept
- Returns the total number of PCM 32 bit samples that is yet to be processed.
- void set_algorithm(std::unique_ptr<Algorithm> algorithm) noexcept
- Set the algorithm instance to use.
- void set_settings(const Settings& s) noexcept
- Configure the algorithm with settings.
- auto settings() const -> Settings noexcept
- Return the settings of this instance.
- void swap(Calculation& rhs) noexcept
- Swap the instance with another instance.
- auto types() const -> ChecksumtypeSet noexcept
- Returns the types requested to this Calculation.
- void update(const AudioSize& audiosize)
- Update the instance with a new AudioSize.
- void update(SampleInputIterator start, SampleInputIterator stop)
- Update with a sequence of samples.
- auto update_time_elapsed() const -> std::chrono::duration<float> noexcept
- Amount of time elapsed so far by update().
Function documentation
arcstk:: v_1_0_0:: Calculation:: Calculation(Calculation&& rhs) explicit noexcept
Move constructor.
Parameters | |
---|---|
rhs in | Instance to be moved |
arcstk:: v_1_0_0:: Calculation:: Calculation(const Calculation& rhs) explicit
Copy constructor.
Parameters | |
---|---|
rhs in | Instance to be copied |
arcstk:: v_1_0_0:: Calculation:: Calculation(const Settings& settings,
std::unique_ptr<Algorithm> algorithm,
const AudioSize& size,
const Points& points)
Constructor.
Parameters | |
---|---|
settings in | The settings for the calculation |
algorithm in | The algorithm to use for calculating |
size in | Size of the expected input |
points in | Track offsets (as samples) |
If size.zero()
, then first update()
will throw.
arcstk:: v_1_0_0:: Calculation:: Calculation(const Settings& settings,
std::unique_ptr<Algorithm> algorithm,
const ToCData& toc)
Constructor.
Parameters | |
---|---|
settings in | The settings for the calculation |
algorithm in | The algorithm to use for calculating |
toc in | Track offsets and leadout |
std::chrono::duration<float> arcstk:: v_1_0_0:: Calculation:: algo_time_elapsed() const noexcept
Amount of time elapsed so far by the algorithm instance.
Returns | Amount of time elapsed so far by the algorithm instance. |
---|
const Algorithm* arcstk:: v_1_0_0:: Calculation:: algorithm() const noexcept
Returns the algorithm instance used by this Calculation.
Returns | Algorithm used by this Calculation. |
---|
bool arcstk:: v_1_0_0:: Calculation:: complete() const noexcept
Returns TRUE
iff this Calculation is completed, otherwise FALSE
.
Returns | TRUE if the Calculation is completed, otherwise FALSE |
---|
If the instance returns TRUE
it is safe to call result(). Value FALSE
indicates that the instance expects more updates.
int32_t arcstk:: v_1_0_0:: Calculation:: samples_expected() const noexcept
Returns the total number of initially expected PCM 32 bit samples.
Returns | Total number of PCM 32 bit samples expected. |
---|
This value is equivalent to samples_
Intended for debugging.
int32_t arcstk:: v_1_0_0:: Calculation:: samples_processed() const noexcept
Returns the total number for PCM 32 bit samples yet processed.
Returns | Total number of PCM 32 bit samples processed. |
---|
This value is equivalent to samples_
Intended for debugging.
int32_t arcstk:: v_1_0_0:: Calculation:: samples_todo() const noexcept
Returns the total number of PCM 32 bit samples that is yet to be processed.
Returns | Total number of PCM 32 bit samples yet to process. |
---|
This value is equivalent to samples_
Intended for debugging.
void arcstk:: v_1_0_0:: Calculation:: set_algorithm(std::unique_ptr<Algorithm> algorithm) noexcept
Set the algorithm instance to use.
Parameters | |
---|---|
algorithm in | Algorithm to use on update |
Note that the algorithm is stateful and may therefore not be shared between calculations.
void arcstk:: v_1_0_0:: Calculation:: set_settings(const Settings& s) noexcept
Configure the algorithm with settings.
Parameters | |
---|---|
s in | Settings to use on this instance |
void arcstk:: v_1_0_0:: Calculation:: swap(Calculation& rhs) noexcept
Swap the instance with another instance.
Parameters | |
---|---|
rhs in | Instance to swap with |
ChecksumtypeSet arcstk:: v_1_0_0:: Calculation:: types() const noexcept
Returns the types requested to this Calculation.
Returns | All requested Checksum types. |
---|
Convenience function for mycalculation.algorithm().types()
.
void arcstk:: v_1_0_0:: Calculation:: update(SampleInputIterator start,
SampleInputIterator stop)
Update with a sequence of samples.
Parameters | |
---|---|
start in | Iterator pointing to the first sample of the sequence |
stop in | Iterator pointing behind the last sample of the sequence |
std::chrono::duration<float> arcstk:: v_1_0_0:: Calculation:: update_time_elapsed() const noexcept
Amount of time elapsed so far by update().
Returns | Amount of time elapsed so far by update(). |
---|