1 /*----------------------------------------------------------------------------
2  *
3  * File:
4  * eas_audioconst.h
5  *
6  * Contents and purpose:
7  * Defines audio constants related to the sample rate, bit size, etc.
8  *
9  *
10  * Copyright Sonic Network Inc. 2005
11 
12  * Licensed under the Apache License, Version 2.0 (the "License");
13  * you may not use this file except in compliance with the License.
14  * You may obtain a copy of the License at
15  *
16  *      http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  *
24  *----------------------------------------------------------------------------
25  * Revision Control:
26  *   $Revision: 82 $
27  *   $Date: 2006-07-10 11:45:19 -0700 (Mon, 10 Jul 2006) $
28  *----------------------------------------------------------------------------
29 */
30 
31 #ifndef _EAS_AUDIOCONST_H
32 #define _EAS_AUDIOCONST_H
33 
34 /*----------------------------------------------------------------------------
35  * These macros define the various characteristics of the defined sample rates
36  *----------------------------------------------------------------------------
37  * BUFFER_SIZE_IN_MONO_SAMPLES  size of buffer in samples
38  * _OUTPUT_SAMPLE_RATE          compiled output sample rate
39  * AUDIO_FRAME_LENGTH           length of an audio frame in 256ths of a millisecond
40  * SYNTH_UPDATE_PERIOD_IN_BITS  length of an audio frame (2^x samples)
41  *----------------------------------------------------------------------------
42 */
43 
44 #if defined (_SAMPLE_RATE_8000)
45 #define BUFFER_SIZE_IN_MONO_SAMPLES     32
46 #define _OUTPUT_SAMPLE_RATE             8000
47 #define AUDIO_FRAME_LENGTH              1024
48 #define SYNTH_UPDATE_PERIOD_IN_BITS     5
49 
50 #elif defined (_SAMPLE_RATE_16000)
51 #define BUFFER_SIZE_IN_MONO_SAMPLES     64
52 #define _OUTPUT_SAMPLE_RATE             16000
53 #define AUDIO_FRAME_LENGTH              1024
54 #define SYNTH_UPDATE_PERIOD_IN_BITS     6
55 
56 #elif defined (_SAMPLE_RATE_20000)
57 #define BUFFER_SIZE_IN_MONO_SAMPLES     128
58 #define _OUTPUT_SAMPLE_RATE             20000
59 #define AUDIO_FRAME_LENGTH              1638
60 #define SYNTH_UPDATE_PERIOD_IN_BITS     7
61 
62 #elif defined (_SAMPLE_RATE_22050)
63 #define BUFFER_SIZE_IN_MONO_SAMPLES     128
64 #define _OUTPUT_SAMPLE_RATE             22050
65 #define AUDIO_FRAME_LENGTH              1486
66 #define SYNTH_UPDATE_PERIOD_IN_BITS     7
67 
68 #elif defined (_SAMPLE_RATE_24000)
69 #define BUFFER_SIZE_IN_MONO_SAMPLES     128
70 #define _OUTPUT_SAMPLE_RATE             24000
71 #define AUDIO_FRAME_LENGTH              1365
72 #define SYNTH_UPDATE_PERIOD_IN_BITS     7
73 
74 #elif defined (_SAMPLE_RATE_32000)
75 #define BUFFER_SIZE_IN_MONO_SAMPLES     128
76 #define _OUTPUT_SAMPLE_RATE             32000
77 #define AUDIO_FRAME_LENGTH              1024
78 #define SYNTH_UPDATE_PERIOD_IN_BITS     7
79 
80 #elif defined (_SAMPLE_RATE_44100)
81 #define BUFFER_SIZE_IN_MONO_SAMPLES     256
82 #define _OUTPUT_SAMPLE_RATE             44100
83 #define AUDIO_FRAME_LENGTH              1486
84 #define SYNTH_UPDATE_PERIOD_IN_BITS     8
85 
86 #elif defined (_SAMPLE_RATE_48000)
87 #define BUFFER_SIZE_IN_MONO_SAMPLES     256
88 #define _OUTPUT_SAMPLE_RATE             48000
89 #define AUDIO_FRAME_LENGTH              1365
90 #define SYNTH_UPDATE_PERIOD_IN_BITS     8
91 
92 #else
93 #error "_SAMPLE_RATE_XXXXX must be defined to valid rate"
94 #endif
95 
96 #endif /* #ifndef _EAS_AUDIOCONST_H */
97 
98