gain_analysis.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * ReplayGainAnalysis - analyzes input samples and give the recommended dB change
  3. * Copyright (C) 2001 David Robinson and Glen Sawyer
  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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. * concept and filter values by David Robinson ([email protected])
  20. * -- blame him if you think the idea is flawed
  21. * coding by Glen Sawyer ([email protected]) 735 W 255 N, Orem, UT 84057-4505 USA
  22. * -- blame him if you think this runs too slowly, or the coding is otherwise flawed
  23. *
  24. * For an explanation of the concepts and the basic algorithms involved, go to:
  25. * http://www.replaygain.org/
  26. */
  27. #ifndef GAIN_ANALYSIS_H
  28. #define GAIN_ANALYSIS_H
  29. #include <stddef.h>
  30. #include <bfc/platform/export.h>
  31. #define GAIN_NOT_ENOUGH_SAMPLES -24601
  32. #define GAIN_ANALYSIS_ERROR 0
  33. #define GAIN_ANALYSIS_OK 1
  34. #define INIT_GAIN_ANALYSIS_ERROR 0
  35. #define INIT_GAIN_ANALYSIS_OK 1
  36. #ifdef __cplusplus
  37. extern "C"
  38. {
  39. #endif
  40. typedef float Float_t; // Type used for filtering
  41. DLLEXPORT void * WACreateRGContext();
  42. DLLEXPORT void WAFreeRGContext(void *context);
  43. int DLLEXPORT WAInitGainAnalysis(void *context, long samplefreq);
  44. int DLLEXPORT WAAnalyzeSamples(void *context, const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels);
  45. int DLLEXPORT WAResetSampleFrequency ( void *context, long samplefreq );
  46. Float_t DLLEXPORT WAGetTitleGain(void *context);
  47. Float_t DLLEXPORT WAGetAlbumGain(void *context);
  48. #ifdef __cplusplus
  49. }
  50. #endif
  51. #endif /* GAIN_ANALYSIS_H */