xref: /aosp_15_r20/external/flac/include/share/replaygain_analysis.h (revision 600f14f40d737144c998e2ec7a483122d3776fbc)
1*600f14f4SXin Li /*
2*600f14f4SXin Li  *  ReplayGainAnalysis - analyzes input samples and give the recommended dB change
3*600f14f4SXin Li  *  Copyright (C) 2001 David Robinson and Glen Sawyer
4*600f14f4SXin Li  *
5*600f14f4SXin Li  *  This library is free software; you can redistribute it and/or
6*600f14f4SXin Li  *  modify it under the terms of the GNU Lesser General Public
7*600f14f4SXin Li  *  License as published by the Free Software Foundation; either
8*600f14f4SXin Li  *  version 2.1 of the License, or (at your option) any later version.
9*600f14f4SXin Li  *
10*600f14f4SXin Li  *  This library is distributed in the hope that it will be useful,
11*600f14f4SXin Li  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12*600f14f4SXin Li  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13*600f14f4SXin Li  *  Lesser General Public License for more details.
14*600f14f4SXin Li  *
15*600f14f4SXin Li  *  You should have received a copy of the GNU Lesser General Public
16*600f14f4SXin Li  *  License along with this library; if not, write to the Free Software
17*600f14f4SXin Li  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18*600f14f4SXin Li  *
19*600f14f4SXin Li  *  concept and filter values by David Robinson ([email protected])
20*600f14f4SXin Li  *    -- blame him if you think the idea is flawed
21*600f14f4SXin Li  *  coding by Glen Sawyer ([email protected]) 442 N 700 E, Provo, UT 84606 USA
22*600f14f4SXin Li  *    -- blame him if you think this runs too slowly, or the coding is otherwise flawed
23*600f14f4SXin Li  *  minor cosmetic tweaks to integrate with FLAC by Josh Coalson
24*600f14f4SXin Li  *
25*600f14f4SXin Li  *  For an explanation of the concepts and the basic algorithms involved, go to:
26*600f14f4SXin Li  *    http://www.replaygain.org/
27*600f14f4SXin Li  */
28*600f14f4SXin Li 
29*600f14f4SXin Li #ifndef GAIN_ANALYSIS_H
30*600f14f4SXin Li #define GAIN_ANALYSIS_H
31*600f14f4SXin Li 
32*600f14f4SXin Li #include <stddef.h>
33*600f14f4SXin Li 
34*600f14f4SXin Li #define GAIN_NOT_ENOUGH_SAMPLES  -24601
35*600f14f4SXin Li #define GAIN_ANALYSIS_ERROR           0
36*600f14f4SXin Li #define GAIN_ANALYSIS_OK              1
37*600f14f4SXin Li 
38*600f14f4SXin Li #define INIT_GAIN_ANALYSIS_ERROR      0
39*600f14f4SXin Li #define INIT_GAIN_ANALYSIS_OK         1
40*600f14f4SXin Li 
41*600f14f4SXin Li #ifdef __cplusplus
42*600f14f4SXin Li extern "C" {
43*600f14f4SXin Li #endif
44*600f14f4SXin Li 
45*600f14f4SXin Li typedef float   flac_float_t;         /* Type used for filtering */
46*600f14f4SXin Li 
47*600f14f4SXin Li extern flac_float_t ReplayGainReferenceLoudness; /* in dB SPL, currently == 89.0 */
48*600f14f4SXin Li 
49*600f14f4SXin Li int     InitGainAnalysis ( long samplefreq );
50*600f14f4SXin Li int     ValidGainFrequency ( long samplefreq );
51*600f14f4SXin Li int     AnalyzeSamples   ( const flac_float_t* left_samples, const flac_float_t* right_samples, size_t num_samples, int num_channels );
52*600f14f4SXin Li flac_float_t GetTitleGain     ( void );
53*600f14f4SXin Li flac_float_t GetAlbumGain     ( void );
54*600f14f4SXin Li 
55*600f14f4SXin Li #ifdef __cplusplus
56*600f14f4SXin Li }
57*600f14f4SXin Li #endif
58*600f14f4SXin Li 
59*600f14f4SXin Li #endif /* GAIN_ANALYSIS_H */
60