📄 voice_drv.lst
字号:
148 1 {
149 2 AUDDAT = (char)voice_buffer[gl_pointer++] / (char)voc_volume;
150 2 }
151 1 Aud_voice_play(); /* start sample request */
152 1 }
153
154
155 /*F**************************************************************************
156 * NAME: voc_play_stop
157 *----------------------------------------------------------------------------
158 * PARAMS:
159 *
160 * return:
161 *----------------------------------------------------------------------------
162 * PURPOSE:
163 * Stop voice playing
164 *----------------------------------------------------------------------------
165 * EXAMPLE:
166 *----------------------------------------------------------------------------
167 * NOTE:
168 *----------------------------------------------------------------------------
169 * REQUIREMENTS:
170 *****************************************************************************/
171 void voc_play_stop (void)
172 {
173 1 Dac_mute(); /* silence */
174 1 aud_stop(); /* disable audio */
175 1 Pll_stop(); /* disable pll */
176 1 }
177
178
C51 COMPILER V7.06 VOICE_DRV 05/05/2005 12:12:03 PAGE 4
179 /*F**************************************************************************
180 * NAME: voc_inc_volume
181 *----------------------------------------------------------------------------
182 * PARAMS:
183 *
184 * return:
185 *----------------------------------------------------------------------------
186 * PURPOSE:
187 * Increment playing volume
188 *----------------------------------------------------------------------------
189 * EXAMPLE:
190 *----------------------------------------------------------------------------
191 * NOTE:
192 *----------------------------------------------------------------------------
193 * REQUIREMENTS:
194 *****************************************************************************/
195 void voc_inc_volume (void)
196 {
197 1 if (voc_volume != VOC_VOLUME_MAX)
198 1 {
199 2 voc_volume--;
200 2 }
201 1 }
202
203
204 /*F**************************************************************************
205 * NAME: voc_dec_volume
206 *----------------------------------------------------------------------------
207 * PARAMS:
208 *
209 * return:
210 *----------------------------------------------------------------------------
211 * PURPOSE:
212 * Decrement playing volume
213 *----------------------------------------------------------------------------
214 * EXAMPLE:
215 *----------------------------------------------------------------------------
216 * NOTE:
217 *----------------------------------------------------------------------------
218 * REQUIREMENTS:
219 *****************************************************************************/
220 void voc_dec_volume (void)
221 {
222 1 if (voc_volume != VOC_VOLUME_MIN)
223 1 {
224 2 voc_volume++;
225 2 }
226 1 }
227
228
229 /*F**************************************************************************
230 * NAME: voc_rec_int
231 *----------------------------------------------------------------------------
232 * PARAMS:
233 *
234 * return:
235 *----------------------------------------------------------------------------
236 * PURPOSE:
237 * Timer 1 interrupt function
238 *----------------------------------------------------------------------------
239 * EXAMPLE:
240 *----------------------------------------------------------------------------
C51 COMPILER V7.06 VOICE_DRV 05/05/2005 12:12:03 PAGE 5
241 * NOTE:
242 * IRQ_T1 defined in extsnd1.h
243 * gl_pointer is modulo 256
244 * VOICE_CHANNEL is always selected by default, other conversion on
245 * BATTERY_CHANNEL may pause the Timer 1 and reselect VOICE_CHANNEL for
246 * proper voice conversion.
247 *----------------------------------------------------------------------------
248 * REQUIREMENTS:
249 *****************************************************************************/
250 Interrupt (voc_rec_int(void), IRQ_T1)
251 {
252 1 Adc_convert_idle(); /* launch new conversion */
253 1 voice_buffer[gl_pointer++] = (Adc_get_data_h()); /* write data in buffer */
254 1 Adc_ack_conversion();
255 1 }
256
257
258 /*F**************************************************************************
259 * NAME: voc_play_int
260 *----------------------------------------------------------------------------
261 * PARAMS:
262 *
263 * return:
264 *----------------------------------------------------------------------------
265 * PURPOSE:
266 * Audio interrupt function
267 *----------------------------------------------------------------------------
268 * EXAMPLE:
269 *----------------------------------------------------------------------------
270 * NOTE:
271 * IRQ_AUD defined in extsnd1.h
272 * The underrun condition is not tested as it must not appear
273 * 0x80 offset is added for unsigned to signed samples conversion
274 *----------------------------------------------------------------------------
275 * REQUIREMENTS:
276 *****************************************************************************/
277 Interrupt (voc_play_int (void), IRQ_AUD)
278 {
279 1 ACC= AUDSTA; /* dummy read to clear flags */
280 1 AUDDAT = (char)(voice_buffer[gl_pointer++] + 0x80)/(char)voc_volume;
281 1 AUDDAT = (char)(voice_buffer[gl_pointer++] + 0x80)/(char)voc_volume;
282 1 AUDDAT = (char)(voice_buffer[gl_pointer++] + 0x80)/(char)voc_volume;
283 1 AUDDAT = (char)(voice_buffer[gl_pointer++] + 0x80)/(char)voc_volume;
284 1 }
285
286
287
288
289
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 348 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 1 ----
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -