diff --git a/src/README.md b/src/README.md index c261771..9b00461 100644 --- a/src/README.md +++ b/src/README.md @@ -1,43 +1,60 @@ -accuraterip-checksum -==================== +# accuraterip-checksum -# Description: -A C99 commandline program to compute the AccurateRip checksum of singletrack WAV files. -Implemented according to +## Description +A C99 command line program to compute the [AccurateRip](http://accuraterip.com/) checksum of single track WAV files, i.e. WAV files which contain only a single track of an audio CD. +Such files can for example be generated by [Exact Audio Copy](http://exactaudiocopy.de/) and various other CD ripping programs, as listed e.g. [here](http://accuraterip.com/software.htm) and [here](https://wiki.hydrogenaud.io/index.php?title=AccurateRip). - http://www.hydrogenaudio.org/forums/index.php?showtopic=97603 +Implemented according to [this thread on HydrogenAudio](http://www.hydrogenaudio.org/forums/index.php?showtopic=97603). -# Syntax: - accuraterip-checksum [--version / --accuraterip-v1 / --accuraterip-v2 (default)] filename track_number total_tracks +## Usage +Calculate AccurateRip v2 checksum of track number ```TRACK``` which is contained in WAV file ```TRACK_FILE```, and which was ripped from a disc with a total track count of ```TOTAL_TRACKS```: -# Output: -By default, the V2 (AccurateRip version 2) checksum will be printed. -You can also obtain the V1 checksum with the "--accuraterip-v1" parameter. + accuraterip-checksum TRACK_FILE TRACK TOTAL_TRACKS -You can obtain the version of accuraterip-checksum using the "--version" parameter. This is not to be confused with the AccurateRip version! +Explicitly choose AccurateRip checksum version, where ```VERSION``` is 1 or 2: -The version of accuraterip-checksum should be added to audio files which are tagged using the output of accuraterip-checksum. If any severe bugs are ever found in accuraterip-checksum, this will allow you to identify files which were tagged using affected version. + accuraterip-checksum --accuraterip-vVERSION TRACK_FILE TRACK TOTAL_TRACKS +Show accuraterip-checksum program version (this is **not** the AccurateRip checksum version!): -# Compiling: + accuraterip-checksum --version + +The version of accuraterip-checksum should be added to the tags of audio files which were processed using the output of accuraterip-checksum: +If any severe bugs are ever found in accuraterip-checksum this will allow you to identify files which were tagged using affected version. + +## Dependencies libsndfile is used for reading the WAV files. -Therefore, on Ubuntu 12.04, make sure you have the following packages installed: +Therefore, on Ubuntu, make sure you have the following packages installed: + + libsndfile1 + +For compiling you need: - libsndfile1 (should be installed by default) libsndfile1-dev +## Compiling + +### Using GNU Make +```shell +make clean +make +``` + +### Using Eclipse The configuration files of an Eclipse project are included. You can use "EGit" (Eclipse git) to import the whole repository. It should as well ask you to import the project configuration then. -# Author: +The Eclipse configuration is currently unmaintained, using GNU Make is preferred. + +## Author Leo Bogert (http://leo.bogert.de) -# Version: -1.4 +## Version +1.5 -# Donations: +## Donations bitcoin:14kPd2QWsri3y2irVFX6wC33vv7FqTaEBh -# License: +## License GPLv3 diff --git a/src/accuraterip-checksum.c b/src/accuraterip-checksum.c index 5d7b476..68c9dd5 100644 --- a/src/accuraterip-checksum.c +++ b/src/accuraterip-checksum.c @@ -2,9 +2,9 @@ ============================================================================ Name : accuraterip-checksum.c Author : Leo Bogert (http://leo.bogert.de) - Git : http://leo.bogert.de/accuraterip-checksum + Git : https://github.com/leo-bogert/accuraterip-checksum Version : See global variable "version" - Copyright : GPL + Copyright : GPLv3 Description : A C99 commandline program to compute the AccurateRip checksum of singletrack WAV files. Implemented according to http://www.hydrogenaudio.org/forums/index.php?showtopic=97603 ============================================================================ @@ -18,7 +18,7 @@ #include #include -const char *const version = "1.4"; +const char *const version = "1.5"; bool check_fileformat(const SF_INFO* sfinfo) { #ifdef DEBUG @@ -91,7 +91,7 @@ uint32_t compute_v1_checksum(const uint32_t* audio_data, const size_t audio_data uint32_t compute_v2_checksum(const uint32_t* audio_data, const size_t audio_data_size, const int track_number, const int total_tracks) { #define DWORD uint32_t -#define __int64 uint64_t +#define QWORD uint64_t const DWORD *pAudioData = audio_data; // this should point entire track audio data int DataSize = audio_data_size; // size of the data @@ -117,9 +117,9 @@ uint32_t compute_v2_checksum(const uint32_t* audio_data, const size_t audio_data { DWORD Value = pAudioData[i]; - uint64_t CalcCRCNEW = (uint64_t)Value * (uint64_t)MulBy; - DWORD LOCalcCRCNEW = (DWORD)(CalcCRCNEW & (uint64_t)0xFFFFFFFF); - DWORD HICalcCRCNEW = (DWORD)(CalcCRCNEW / (uint64_t)0x100000000); + QWORD CalcCRCNEW = (QWORD)Value * (QWORD)MulBy; + DWORD LOCalcCRCNEW = (DWORD)(CalcCRCNEW & (QWORD)0xFFFFFFFF); + DWORD HICalcCRCNEW = (DWORD)(CalcCRCNEW / (QWORD)0x100000000); AC_CRCNEW+=HICalcCRCNEW; AC_CRCNEW+=LOCalcCRCNEW; }