replaygain.h 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* grabbag - Convenience lib for various routines common to several tools
  2. * Copyright (C) 2002-2009 Josh Coalson
  3. * Copyright (C) 2011-2023 Xiph.Org Foundation
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. /*
  20. * This wraps the replaygain_analysis lib, which is LGPL. This wrapper
  21. * allows analysis of different input resolutions by automatically
  22. * scaling the input signal
  23. */
  24. /* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
  25. #ifndef GRABBAG__REPLAYGAIN_H
  26. #define GRABBAG__REPLAYGAIN_H
  27. #include "FLAC/metadata.h"
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. extern const uint32_t GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED;
  32. extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS; /* = "REPLAYGAIN_REFERENCE_LOUDNESS" */
  33. extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN; /* = "REPLAYGAIN_TRACK_GAIN" */
  34. extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK; /* = "REPLAYGAIN_TRACK_PEAK" */
  35. extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN; /* = "REPLAYGAIN_ALBUM_GAIN" */
  36. extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK; /* = "REPLAYGAIN_ALBUM_PEAK" */
  37. FLAC__bool grabbag__replaygain_is_valid_sample_frequency(uint32_t sample_frequency);
  38. FLAC__bool grabbag__replaygain_init(uint32_t sample_frequency);
  39. /* 'bps' must be valid for FLAC, i.e. >=4 and <= 32 */
  40. FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__bool is_stereo, uint32_t bps, uint32_t samples);
  41. void grabbag__replaygain_get_album(float *gain, float *peak);
  42. void grabbag__replaygain_get_title(float *gain, float *peak);
  43. /* These three functions return an error string on error, or NULL if successful */
  44. const char *grabbag__replaygain_analyze_file(const char *filename, float *title_gain, float *title_peak);
  45. const char *grabbag__replaygain_store_to_vorbiscomment(FLAC__StreamMetadata *block, float album_gain, float album_peak, float title_gain, float title_peak);
  46. const char *grabbag__replaygain_store_to_vorbiscomment_reference(FLAC__StreamMetadata *block);
  47. const char *grabbag__replaygain_store_to_vorbiscomment_album(FLAC__StreamMetadata *block, float album_gain, float album_peak);
  48. const char *grabbag__replaygain_store_to_vorbiscomment_title(FLAC__StreamMetadata *block, float title_gain, float title_peak);
  49. const char *grabbag__replaygain_store_to_file(const char *filename, float album_gain, float album_peak, float title_gain, float title_peak, FLAC__bool preserve_modtime);
  50. const char *grabbag__replaygain_store_to_file_reference(const char *filename, FLAC__bool preserve_modtime);
  51. const char *grabbag__replaygain_store_to_file_album(const char *filename, float album_gain, float album_peak, FLAC__bool preserve_modtime);
  52. const char *grabbag__replaygain_store_to_file_title(const char *filename, float title_gain, float title_peak, FLAC__bool preserve_modtime);
  53. FLAC__bool grabbag__replaygain_load_from_vorbiscomment(const FLAC__StreamMetadata *block, FLAC__bool album_mode, FLAC__bool strict, double *reference, double *gain, double *peak);
  54. double grabbag__replaygain_compute_scale_factor(double peak, double gain, double preamp, FLAC__bool prevent_clipping);
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58. #endif