1 /*
2  * madplay - MPEG audio decoder and player
3  * Copyright (C) 2000-2004 Robert Leslie
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program 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
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  * $Id: rgain.h,v 1.1 2004/02/23 21:34:53 rob Exp $
20  */
21 
22 # ifndef RGAIN_H
23 # define RGAIN_H
24 
25 # include <mad.h>
26 
27 # define RGAIN_REFERENCE  83		/* reference level (dB SPL) */
28 
29 enum rgain_name {
30   RGAIN_NAME_NOT_SET    = 0x0,
31   RGAIN_NAME_RADIO      = 0x1,
32   RGAIN_NAME_AUDIOPHILE = 0x2
33 };
34 
35 enum rgain_originator {
36   RGAIN_ORIGINATOR_UNSPECIFIED = 0x0,
37   RGAIN_ORIGINATOR_PRESET      = 0x1,
38   RGAIN_ORIGINATOR_USER        = 0x2,
39   RGAIN_ORIGINATOR_AUTOMATIC   = 0x3
40 };
41 
42 struct rgain {
43   enum rgain_name name;			/* profile (see above) */
44   enum rgain_originator originator;	/* source (see above) */
45   signed short adjustment;		/* in units of 0.1 dB */
46 };
47 
48 # define RGAIN_SET(rgain)	((rgain)->name != RGAIN_NAME_NOT_SET)
49 
50 # define RGAIN_VALID(rgain)  \
51   (((rgain)->name == RGAIN_NAME_RADIO ||  \
52     (rgain)->name == RGAIN_NAME_AUDIOPHILE) &&  \
53    (rgain)->originator != RGAIN_ORIGINATOR_UNSPECIFIED)
54 
55 # define RGAIN_DB(rgain)  ((rgain)->adjustment / 10.0)
56 
57 void rgain_parse(struct rgain *, struct mad_bitptr *);
58 char const *rgain_originator(struct rgain const *);
59 
60 # endif
61