?? song_drv.lst
字號:
C51 COMPILER V7.00 SONG_DRV 04/28/2004 09:31:56 PAGE 1
C51 COMPILER V7.00, COMPILATION OF MODULE SONG_DRV
OBJECT MODULE PLACED IN C:\Documents and Settings\lvxc\桌面\AA\song_drv.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE modules\song\song_drv.c OPTIMIZE(7,SPEED) BROWSE INCDIR(.\modules\system;.\
-;.\;.\lib_refd) DEFINE(KEIL) DEBUG OBJECTEXTEND PRINT(.\song_drv.lst) OBJECT(C:\Documents and Settings\lvxc\桌面\AA\song
-_drv.obj)
stmt level source
1 /*C**************************************************************************
2 * NAME: song_drv.c
3 *----------------------------------------------------------------------------
4 * Copyright (c) 2003 Atmel.
5 *----------------------------------------------------------------------------
6 * RELEASE: snd1c-refd-nf-4_0_3
7 * REVISION: 1.20
8 *----------------------------------------------------------------------------
9 * PURPOSE:
10 * This file contains the song driver routines
11 *****************************************************************************/
12
13 /*_____ I N C L U D E S ____________________________________________________*/
14
15 #include "config.h" /* system configuration */
16 #include "dac\dac_drv.h" /* dac driver definition */
17 #include "lib_mcu\aud\aud_drv.h" /* audio driver definition */
18 #include "lib_mcu\mp3\mp3_drv.h" /* mp3 driver definition */
19 #include "modules\file\file.h" /* file definition */
20 #include "lib_mcu\clock\clock.h" /* clock definition */
21 #include "song_drv.h" /* song driver definition */
22
23
24 /*_____ M A C R O S ________________________________________________________*/
25
26
27 /*_____ D E F I N I T I O N ________________________________________________*/
28
29 Byte song_sound; /* save the selected sound */
30 Byte mp3_volume;
31 xdata Uint16 song_frame_size; /* Frame size value for one second */
32 idata Byte sound_volume; /* save actual sound level */
33
34 /*_____ D E C L A R A T I O N ______________________________________________*/
35
36 static void song_audio_init (void);
37
38 code Uint16 song_tab_frame_size_00 [2][16] =
39 {/* 44.1 KHz MPEG1 */
40 {0, 104, 130, 156, 182, 208, 261, 313, 365, 417, 522, 626, 731, 835, 1044, 0},
41 /* 22.05 KHz MPEG2 */
42 {0, 26, 52, 78, 104, 130, 156, 182, 208, 261, 313, 365, 417, 470, 522, 0}
43 };
44
45 code Uint16 song_tab_frame_size_01 [2][16] =
46 {
47 /* 48 Khz MPEG1 */
48 {0, 96, 120, 144, 168, 192, 240, 288, 336, 384, 480, 576, 672, 768, 960, 0},
49 /* 24 Khz MPEG2 */
50 {0, 24, 48, 72, 96, 120, 144, 168, 192, 240, 288, 336, 384, 432, 480, 0}
51 };
52
53 code Uint16 song_tab_frame_size_10 [2][16] =
C51 COMPILER V7.00 SONG_DRV 04/28/2004 09:31:56 PAGE 2
54
55 {/* 32 Khz MPEG1 */
56 {0, 144, 180, 216, 252, 288, 360, 432, 504, 576, 720, 864, 1008, 1152, 1440, 0},
57 /* 16 Khz MPEG2 */
58 {0, 36, 72, 108, 144, 180, 216, 252, 288, 360, 432, 504, 576, 648, 720, 0}
59 };
60
61
62 code Uint16 song_tab_seek [2][16]=
63 {
64 {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0},
65 {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0}
66
67 };
68
69
70 /*F**************************************************************************
71 * NAME: song_snd_init
72 *----------------------------------------------------------------------------
73 * PARAMS:
74 *
75 * return:
76 *----------------------------------------------------------------------------
77 * PURPOSE:
78 * Sound control initialization
79 *----------------------------------------------------------------------------
80 * EXAMPLE:
81 *----------------------------------------------------------------------------
82 * NOTE:
83 * Initializes the sound controls to their medium value
84 *----------------------------------------------------------------------------
85 * REQUIREMENTS:
86 *****************************************************************************/
87 void song_snd_init (void)
88 {
89 1 dac_init();
90 1 dac_set_vol(mp3_volume = VOLUME_MED);
91 1 MP3BAS = BASS_MED;
92 1 MP3MED = MEDIUM_MED;
93 1 MP3TRE = TREBLE_MED;
94 1
95 1 song_sound = SND_VOLUME; /* volume control selected by default */
96 1 }
97
98
99
100 /*F**************************************************************************
101 * NAME: song_snd_inc
102 *----------------------------------------------------------------------------
103 * PARAMS:
104 *
105 * return:
106 *----------------------------------------------------------------------------
107 * PURPOSE:
108 * Increment the selected sound control
109 *----------------------------------------------------------------------------
110 * EXAMPLE:
111 *----------------------------------------------------------------------------
112 * NOTE:
113 * The number of the current selected sound control is stored in the
114 * variable snd_select (0.Volume; 1.Bass; 2.Medium; 3. Trebble)
115 *----------------------------------------------------------------------------
C51 COMPILER V7.00 SONG_DRV 04/28/2004 09:31:56 PAGE 3
116 * REQUIREMENTS:
117 *****************************************************************************/
118 void song_snd_inc (void)
119 {
120 1 switch (song_sound)
121 1 {
122 2 case SND_VOLUME:
123 2 if (mp3_volume != VOLUME_MAX)
124 2 {
125 3 if ((MP3CON&MSK_MPBBST) && (MP3VOL > VOLUME_MED || MP3VOR > VOLUME_MED)) Mp3_clr_bass_boost(); /*
-should be less than -15dB */
126 3 dac_set_vol(++mp3_volume);
127 3 }
128 2 break;
129 2
130 2 case SND_BASS:
131 2 {
132 3 if (MP3BAS != BASS_MAX)
133 3 MP3BAS++;
134 3 break;
135 3 }
136 2
137 2 case SND_MEDIUM:
138 2 {
139 3 if (MP3MED != MEDIUM_MAX)
140 3 MP3MED++;
141 3 break;
142 3 }
143 2
144 2 case SND_TREBLE:
145 2 {
146 3 if (MP3TRE != TREBLE_MAX)
147 3 MP3TRE++;
148 3 break;
149 3 }
150 2
151 2 case SND_BBOOST:
152 2 if(MP3VOL > VOLUME_MED || MP3VOR > VOLUME_MED) /* should be less than -15dB */
153 2 dac_set_vol(VOLUME_MED);
154 2 Mp3_set_bass_boost();
155 2 break;
156 2 }
157 1 }
158
159
160 /*F**************************************************************************
161 * NAME: song_snd_dec
162 *----------------------------------------------------------------------------
163 * PARAMS:
164 *
165 * return:
166 *----------------------------------------------------------------------------
167 * PURPOSE:
168 * Decrement the selected sound control
169 *----------------------------------------------------------------------------
170 * EXAMPLE:
171 *----------------------------------------------------------------------------
172 * NOTE:
173 * The number of the current selected sound control is stored in the
174 * variable snd_select (0.Volume; 1.Bass; 2.Medium; 3. Trebble)
175 *----------------------------------------------------------------------------
176 * REQUIREMENTS:
C51 COMPILER V7.00 SONG_DRV 04/28/2004 09:31:56 PAGE 4
177 *****************************************************************************/
178 void song_snd_dec (void)
179 {
180 1 switch (song_sound)
181 1 {
182 2 case SND_VOLUME:
183 2 if (mp3_volume != VOLUME_MIN) dac_set_vol(--mp3_volume);
184 2 break;
185 2
186 2 case SND_BASS:
187 2 {
188 3 if (MP3BAS != BASS_MIN)
189 3 MP3BAS--;
190 3 break;
191 3 }
192 2
193 2 case SND_MEDIUM:
194 2 {
195 3 if (MP3MED != MEDIUM_MIN)
196 3 MP3MED--;
197 3 break;
198 3 }
199 2
200 2 case SND_TREBLE:
201 2 {
202 3 if (MP3TRE != TREBLE_MIN)
203 3 MP3TRE--;
204 3 break;
205 3 }
206 2
207 2 case SND_BBOOST:
208 2 Mp3_clr_bass_boost();
209 2 break;
210 2 }
211 1 }
212
213
214 /*F**************************************************************************
215 * NAME: song_snd_select
216 *----------------------------------------------------------------------------
217 * PARAMS:
218 *
219 * return:
220 *----------------------------------------------------------------------------
221 * PURPOSE:
222 * Select next sound control
223 *----------------------------------------------------------------------------
224 * EXAMPLE:
225 *----------------------------------------------------------------------------
226 * NOTE:
227 *----------------------------------------------------------------------------
228 * REQUIREMENTS:
229 *****************************************************************************/
230 void song_snd_select (void)
231 {
232 1 song_sound = (song_sound + 1) % NB_SOUND;
233 1 }
234
235
236 /*F**************************************************************************
237 * NAME: song_get_sound
238 *----------------------------------------------------------------------------
C51 COMPILER V7.00 SONG_DRV 04/28/2004 09:31:56 PAGE 5
239 * PARAMS:
240 *
241 * return:
242 * sound selected: SND_VOLUME, SND_BASS, SND_MEDIUM, SND_TREBLE
243 *----------------------------------------------------------------------------
244 * PURPOSE:
245 * Returns selected sound control
246 *----------------------------------------------------------------------------
247 * EXAMPLE:
248 *----------------------------------------------------------------------------
249 * NOTE:
250 *----------------------------------------------------------------------------
251 * REQUIREMENTS:
252 *****************************************************************************/
253 Byte song_get_sound (void)
254 {
255 1 return (song_sound);
256 1 }
257
258
259 /*F**************************************************************************
260 * NAME: song_get_level
261 *----------------------------------------------------------------------------
262 * PARAMS:
263 *
264 * return:
265 * level of sound selected
266 *----------------------------------------------------------------------------
267 * PURPOSE:
268 * Returns selected sound level
269 *----------------------------------------------------------------------------
270 * EXAMPLE:
271 *----------------------------------------------------------------------------
272 * NOTE:
273 *----------------------------------------------------------------------------
274 * REQUIREMENTS:
275 *****************************************************************************/
276 Byte song_get_level (void)
277 {
278 1 switch (song_sound)
279 1 {
280 2 case SND_VOLUME: return mp3_volume;
281 2 case SND_BASS: return MP3BAS;
282 2 case SND_MEDIUM: return MP3MED;
283 2 case SND_TREBLE: return MP3TRE;
284 2 case SND_BBOOST: return (MP3CON&MSK_MPBBST)?1:0;
285 2 }
286 1 return 0;
287 1 }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -