| 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 | |
| 28 | /** |
| 29 | * Pseudo-code to process an album: |
| 30 | * |
| 31 | * Float_t l_samples [4096]; |
| 32 | * Float_t r_samples [4096]; |
| 33 | * size_t num_samples; |
| 34 | * unsigned int num_songs; |
| 35 | * unsigned int i; |
| 36 | * |
| 37 | * gain_init_analysis ( 44100 ); |
| 38 | * for ( i = 1; i <= num_songs; i++ ) { |
| 39 | * while ( ( num_samples = getSongSamples ( song[i], left_samples, right_samples ) ) > 0 ) |
| 40 | * gain_analyze_samples ( left_samples, right_samples, num_samples, 2 ); |
| 41 | * fprintf ("Recommended dB change for song %2d: %+6.2f dB\n", i, gain_get_title() ); |
| 42 | * } |
| 43 | * fprintf ("Recommended dB change for whole album: %+6.2f dB\n", gain_get_album() ); |
| 44 | */ |
| 45 | |
| 46 | #ifndef GAIN_ANALYSIS_H |
| 47 | #define GAIN_ANALYSIS_Hcxx . . $ `include/replaygain/gain_analysis.h:47:9`! |
| 48 | |
| 49 | #include <stddef.h> |
| 50 | |
| 51 | #define GAIN_NOT_ENOUGH_SAMPLEScxx . . $ `include/replaygain/gain_analysis.h:51:9`! -24601 |
| 52 | #define GAIN_ANALYSIS_ERRORcxx . . $ `include/replaygain/gain_analysis.h:52:9`! 0 |
| 53 | #define GAIN_ANALYSIS_OKcxx . . $ `include/replaygain/gain_analysis.h:53:9`! 1 |
| 54 | |
| 55 | #define INIT_GAIN_ANALYSIS_ERRORcxx . . $ `include/replaygain/gain_analysis.h:55:9`! 0 |
| 56 | #define INIT_GAIN_ANALYSIS_OKcxx . . $ `include/replaygain/gain_analysis.h:56:9`! 1 |
| 57 | |
| 58 | #ifdef __cplusplus |
| 59 | extern "C" { |
| 60 | #endif |
| 61 | |
| 62 | typedef double Float_tcxx . . $ Float_t#; // Type used for filtering |
| 63 | |
| 64 | /// Here's the deal : Call |
| 65 | int gain_init_analysiscxx . . $ gain_init_analysis(a9e4e82268fd7bfa). ( long samplefreq ); |
| 66 | /// to initialize everything. Call |
| 67 | int gain_analyze_samplescxx . . $ gain_analyze_samples(e4c937d56c9834c7). ( const Float_tcxx . . $ Float_t#* left_samples, const Float_tcxx . . $ Float_t#* right_samples, size_t num_samples, int num_channels ); |
| 68 | /// as many times as you want, with as many or as few samples as you want. |
| 69 | /// If mono, pass the sample buffer in through left_samples, leave |
| 70 | /// right_samples NULL, and make sure num_channels = 1. |
| 71 | |
| 72 | Float_tcxx . . $ Float_t# gain_get_chaptercxx . . $ gain_get_chapter(31fa7155c10fdd13). ( void ); |
| 73 | /// will return the recommended dB level change for all samples analyzed |
| 74 | /// SINCE THE LAST TIME you called gain_get_chapter() OR gain_init_analysis() OR gain_get_title. |
| 75 | |
| 76 | Float_tcxx . . $ Float_t# gain_get_titlecxx . . $ gain_get_title(31fa7155c10fdd13). ( void ); |
| 77 | /// will return the recommended dB level change for all samples analyzed |
| 78 | /// SINCE THE LAST TIME you called gain_get_title() OR gain_init_analysis(). |
| 79 | |
| 80 | Float_tcxx . . $ Float_t# gain_get_albumcxx . . $ gain_get_album(31fa7155c10fdd13). ( void ); |
| 81 | /// will return the recommended dB level change for all samples analyzed |
| 82 | /// since gain_init_analysis() was called and finalized with gain_get_title(). |
| 83 | |
| 84 | #ifdef __cplusplus |
| 85 | } |
| 86 | #endif |
| 87 | |
| 88 | #endif /* GAIN_ANALYSIS_H */ |