FreeCalypso > hg > tcs211-l1-reconst
comparison chipsetsw/services/Audio/audio_vm_amr_play.c @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /****************************************************************************/ | |
2 /* */ | |
3 /* File Name: audio_vm_play.c */ | |
4 /* */ | |
5 /* Purpose: This file contains all the functions used to manage the */ | |
6 /* Voice Memorization AMR play task. */ | |
7 /* */ | |
8 /* Version 0.1 */ | |
9 /* */ | |
10 /* Date Modification */ | |
11 /* ------------------------------------ */ | |
12 /* ?? ?? 2002 Create */ | |
13 /* */ | |
14 /* Author */ | |
15 /* Stephanie Gerthoux */ | |
16 /* */ | |
17 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/ | |
18 /****************************************************************************/ | |
19 | |
20 #include "rv/rv_defined_swe.h" | |
21 #ifdef RVM_AUDIO_MAIN_SWE | |
22 #ifndef _WINDOWS | |
23 #include "config/swconfig.cfg" | |
24 #include "config/sys.cfg" | |
25 #include "config/chipset.cfg" | |
26 #endif | |
27 | |
28 /* include the usefull L1 header */ | |
29 #include "l1_confg.h" | |
30 | |
31 #if (L1_VOICE_MEMO_AMR) | |
32 #include "rv/rv_general.h" | |
33 #include "rvm/rvm_gen.h" | |
34 #include "audio/audio_features_i.h" | |
35 #include "audio/audio_ffs_i.h" | |
36 #include "audio/audio_api.h" | |
37 #include "audio/audio_structs_i.h" | |
38 #include "audio/audio_var_i.h" | |
39 #include "audio/audio_messages_i.h" | |
40 #include "rvf/rvf_target.h" | |
41 #include "audio/audio_const_i.h" | |
42 #include "audio/audio_error_hdlr_i.h" | |
43 #include "audio/audio_features_i.h" | |
44 | |
45 /* include the usefull L1 header */ | |
46 #define BOOL_FLAG | |
47 #define CHAR_FLAG | |
48 #include "l1_types.h" | |
49 #include "l1audio_cust.h" | |
50 #include "l1audio_msgty.h" | |
51 #include "l1audio_signa.h" | |
52 | |
53 #include "audio/audio_macro_i.h" | |
54 | |
55 /********************************************************************************/ | |
56 /* */ | |
57 /* Function Name: audio_vm_amr_play_send_status */ | |
58 /* */ | |
59 /* Purpose: This function sends the voice memorization AMR play status */ | |
60 /* to the entity. */ | |
61 /* */ | |
62 /* Input Parameters: */ | |
63 /* status, */ | |
64 /* return path */ | |
65 /* */ | |
66 /* Output Parameters: */ | |
67 /* None. */ | |
68 /* */ | |
69 /* Note: */ | |
70 /* None. */ | |
71 /* */ | |
72 /* Revision History: */ | |
73 /* None. */ | |
74 /* */ | |
75 /********************************************************************************/ | |
76 #if (AUDIO_MEM_MANAGER) | |
77 void audio_vm_amr_play_send_status (T_AUDIO_RET status, T_RV_RETURN return_path) | |
78 { | |
79 T_AUDIO_AMR_PLAY_STATUS *p_send_message; | |
80 T_RVF_MB_STATUS mb_status = RVF_RED; | |
81 | |
82 /* allocate the message buffer */ | |
83 while (mb_status == RVF_RED) | |
84 { | |
85 mb_status = rvf_get_buf (p_audio_gbl_var->mb_external, | |
86 sizeof (T_AUDIO_AMR_PLAY_STATUS), | |
87 (T_RVF_BUFFER **) (&p_send_message)); | |
88 | |
89 /* If insufficient resources, then report a memory error and abort. */ | |
90 /* and wait until more ressource is given */ | |
91 if (mb_status == RVF_RED) | |
92 { | |
93 audio_voice_memo_amr_error_trace(AUDIO_ENTITY_NO_MEMORY); | |
94 rvf_delay(RVF_MS_TO_TICKS(1000)); | |
95 } | |
96 } | |
97 | |
98 /*fill the header of the message */ | |
99 p_send_message->os_hdr.msg_id = AUDIO_AMR_PLAY_FROM_MEM_STATUS_MSG; | |
100 | |
101 /* fill the status parameters */ | |
102 p_send_message->status = status; | |
103 | |
104 /* send message or call callback */ | |
105 if (return_path.callback_func == NULL) | |
106 rvf_send_msg (return_path.addr_id, p_send_message); | |
107 else | |
108 { | |
109 (*return_path.callback_func)((void *)(p_send_message)); | |
110 rvf_free_buf((T_RVF_BUFFER *)p_send_message); | |
111 } | |
112 } | |
113 | |
114 /********************************************************************************/ | |
115 /* */ | |
116 /* Function Name: audio_vm_amr_play_from_memory_manager */ | |
117 /* */ | |
118 /* Purpose: This function is called to manage a voice memorization play */ | |
119 /* manager */ | |
120 /* */ | |
121 /* Input Parameters: */ | |
122 /* Message to the audio entity */ | |
123 /* */ | |
124 /* Output Parameters: */ | |
125 /* None. */ | |
126 /* */ | |
127 /* Note: */ | |
128 /* None. */ | |
129 /* */ | |
130 /* Revision History: */ | |
131 /* None. */ | |
132 /* */ | |
133 /********************************************************************************/ | |
134 void audio_vm_amr_play_from_memory_manager (T_RV_HDR *p_message) | |
135 { | |
136 /* Declare local variables. */ | |
137 T_RV_HDR *p_send_message; | |
138 T_RVF_MB_STATUS mb_status; | |
139 T_RV_RETURN return_path; | |
140 | |
141 /**************** audio_vm_amr_play_from_memory_manager function begins ***********************/ | |
142 switch(p_audio_gbl_var->audio_vm_amr_play.state) | |
143 { | |
144 case AUDIO_IDLE: | |
145 { | |
146 switch(p_message->msg_id) | |
147 { | |
148 case AUDIO_VM_AMR_PLAY_FROM_FFS_START_REQ: | |
149 case AUDIO_VM_AMR_PLAY_FROM_RAM_START_REQ: | |
150 { | |
151 T_AUDIO_DRIVER_PARAMETER driver_parameter; | |
152 | |
153 switch (p_message->msg_id) | |
154 { | |
155 case AUDIO_VM_AMR_PLAY_FROM_FFS_START_REQ: | |
156 { | |
157 /* save the return path + ffs_fd */ | |
158 #if (AUDIO_RAM_MANAGER) | |
159 p_audio_gbl_var->audio_vm_amr_play.audio_ram_fd = NULL; | |
160 #endif | |
161 p_audio_gbl_var->audio_vm_amr_play.return_path.callback_func = | |
162 ((T_AUDIO_VM_AMR_PLAY_FROM_FFS_START *)p_message)->return_path.callback_func; | |
163 p_audio_gbl_var->audio_vm_amr_play.return_path.addr_id = | |
164 ((T_AUDIO_VM_AMR_PLAY_FROM_FFS_START*)p_message)->return_path.addr_id; | |
165 #if (AUDIO_NEW_FFS_MANAGER) | |
166 p_audio_gbl_var->audio_vm_amr_play.ffs_fd = | |
167 ((T_AUDIO_VM_AMR_PLAY_FROM_FFS_START *)p_message)->audio_ffs_fd; | |
168 #endif | |
169 } | |
170 break; | |
171 case AUDIO_VM_AMR_PLAY_FROM_RAM_START_REQ: | |
172 { | |
173 /* save the return path + ffs_fd */ | |
174 #if (AUDIO_NEW_FFS_MANAGER) | |
175 p_audio_gbl_var->audio_vm_amr_play.ffs_fd = NULL; | |
176 #endif | |
177 p_audio_gbl_var->audio_vm_amr_play.return_path.callback_func = | |
178 ((T_AUDIO_VM_AMR_PLAY_FROM_RAM_START *)p_message)->return_path.callback_func; | |
179 p_audio_gbl_var->audio_vm_amr_play.return_path.addr_id = | |
180 ((T_AUDIO_VM_AMR_PLAY_FROM_RAM_START*)p_message)->return_path.addr_id; | |
181 #if (AUDIO_RAM_MANAGER) | |
182 p_audio_gbl_var->audio_vm_amr_play.audio_ram_fd = | |
183 ((T_AUDIO_VM_AMR_PLAY_FROM_RAM_START *)p_message)->p_buffer; | |
184 p_audio_gbl_var->audio_vm_amr_play.audio_ram_size = | |
185 ((T_AUDIO_VM_AMR_PLAY_FROM_RAM_START *)p_message)->buffer_size; | |
186 #endif | |
187 } | |
188 break; | |
189 } | |
190 | |
191 /* driver parameters */ | |
192 driver_parameter.nb_buffer = AUDIO_VM_AMR_PLAY_NB_BUFFER; | |
193 driver_parameter.buffer_size = AUDIO_VM_AMR_PLAY_SIZE;// 16 bit words | |
194 | |
195 /* return_path for driver */ | |
196 return_path.callback_func = NULL; | |
197 return_path.addr_id = p_audio_gbl_var->addrId; | |
198 | |
199 /* Init driver */ | |
200 audio_driver_init_vm_amr_play_session(&driver_parameter, return_path); | |
201 | |
202 p_audio_gbl_var->audio_vm_amr_play.state = AUDIO_WAIT_CHANNEL_ID; | |
203 } | |
204 break; | |
205 case AUDIO_VM_AMR_PLAY_FROM_FFS_STOP_REQ: | |
206 case AUDIO_VM_AMR_PLAY_FROM_RAM_STOP_REQ: | |
207 { | |
208 audio_voice_memo_amr_error_trace(AUDIO_ERROR_STOP_EVENT); | |
209 /* do not send a status message because of pre-emption issues | |
210 An automatic stop can pre-empt a stop request. A status is sent + back in state idle | |
211 then the stop request is received and another status is sent, which can be misinterpreted */ | |
212 } | |
213 break; | |
214 } | |
215 } | |
216 break; | |
217 | |
218 case AUDIO_WAIT_CHANNEL_ID: | |
219 { | |
220 switch(p_message->msg_id) | |
221 { | |
222 case AUDIO_DRIVER_INIT_STATUS_MSG: | |
223 { | |
224 /* check init is successfull otherwise, send status AUDIO_ERROR */ | |
225 if (((T_AUDIO_DRIVER_INIT_STATUS *)p_message)->status == AUDIO_OK) | |
226 { | |
227 /* get channel id */ | |
228 p_audio_gbl_var->audio_vm_amr_play.channel_id = ((T_AUDIO_DRIVER_INIT_STATUS *)p_message)->channel_id; | |
229 | |
230 /* Send the Start message to MEM */ | |
231 mb_status = rvf_get_buf (p_audio_gbl_var->mb_internal, | |
232 sizeof (T_AUDIO_MEM_START), | |
233 (T_RVF_BUFFER **) (&p_send_message)); | |
234 | |
235 /* If insufficient resources, then report a memory error and abort. */ | |
236 if (mb_status == RVF_RED) | |
237 { | |
238 audio_voice_memo_amr_error_trace(AUDIO_ENTITY_NO_MEMORY); | |
239 // TODO: use blocking function from GSP | |
240 return; | |
241 } | |
242 | |
243 /* fill the header of the message */ | |
244 ((T_AUDIO_MEM_START *)p_send_message)->os_hdr.msg_id = AUDIO_MEM_START_REQ; | |
245 | |
246 /* fill the parameters */ | |
247 ((T_AUDIO_MEM_START *)p_send_message)->session_id = AUDIO_VM_AMR_PLAY_SESSION_ID; | |
248 ((T_AUDIO_MEM_START *)p_send_message)->channel_id = p_audio_gbl_var->audio_vm_amr_play.channel_id; | |
249 ((T_AUDIO_MEM_START *)p_send_message)->size = AUDIO_VM_AMR_PLAY_SIZE*2;// 8-bit | |
250 #if (AUDIO_NEW_FFS_MANAGER) | |
251 ((T_AUDIO_MEM_START *)p_send_message)->audio_ffs_fd = p_audio_gbl_var->audio_vm_amr_play.ffs_fd; | |
252 #endif | |
253 #if (AUDIO_RAM_MANAGER) | |
254 ((T_AUDIO_MEM_START *)p_send_message)->audio_ram_fd = p_audio_gbl_var->audio_vm_amr_play.audio_ram_fd; | |
255 ((T_AUDIO_MEM_START *)p_send_message)->audio_ram_size = p_audio_gbl_var->audio_vm_amr_play.audio_ram_size; | |
256 #endif | |
257 | |
258 /* send the message to the entity */ | |
259 rvf_send_msg (p_audio_gbl_var->audio_ffs_addrId, p_send_message); | |
260 | |
261 /* change state */ | |
262 p_audio_gbl_var->audio_vm_amr_play.state = AUDIO_WAIT_STOP; | |
263 } | |
264 else | |
265 { | |
266 audio_voice_memo_amr_error_trace(AUDIO_ERROR_START_EVENT); | |
267 audio_vm_amr_play_send_status (AUDIO_ERROR, | |
268 p_audio_gbl_var->audio_vm_amr_play.return_path); | |
269 /* change state */ | |
270 p_audio_gbl_var->audio_vm_amr_play.state = AUDIO_IDLE; | |
271 } | |
272 } | |
273 break; | |
274 case AUDIO_VM_AMR_PLAY_FROM_FFS_STOP_REQ: | |
275 #if (AUDIO_RAM_MANAGER) | |
276 if (p_audio_gbl_var->audio_vm_amr_play.audio_ram_fd != NULL) | |
277 { | |
278 audio_voice_memo_amr_error_trace(AUDIO_ERROR_STOP_EVENT); | |
279 return; | |
280 } | |
281 #endif | |
282 /* change state */ | |
283 p_audio_gbl_var->audio_vm_amr_play.state = AUDIO_WAIT_CHANNEL_ID_TO_STOP; | |
284 break; | |
285 case AUDIO_VM_AMR_PLAY_FROM_RAM_STOP_REQ: | |
286 #if (AUDIO_NEW_FFS_MANAGER) | |
287 if (p_audio_gbl_var->audio_vm_amr_play.ffs_fd != NULL) | |
288 { | |
289 audio_voice_memo_amr_error_trace(AUDIO_ERROR_STOP_EVENT); | |
290 return; | |
291 } | |
292 #endif | |
293 /* change state */ | |
294 p_audio_gbl_var->audio_vm_amr_play.state = AUDIO_WAIT_CHANNEL_ID_TO_STOP; | |
295 break; | |
296 } | |
297 } // case AUDIO_WAIT_CHANNEL_ID: | |
298 break; | |
299 | |
300 case AUDIO_WAIT_STOP: | |
301 { | |
302 switch (p_message->msg_id) | |
303 { | |
304 case AUDIO_VM_AMR_PLAY_FROM_FFS_STOP_REQ: | |
305 case AUDIO_VM_AMR_PLAY_FROM_RAM_STOP_REQ: | |
306 { | |
307 // we handle a RAM stop when New_ffs is running as an error | |
308 #if (AUDIO_NEW_FFS_MANAGER) | |
309 if ((p_message->msg_id == AUDIO_VM_AMR_PLAY_FROM_RAM_STOP_REQ)&& | |
310 (p_audio_gbl_var->audio_vm_amr_play.ffs_fd != NULL)) | |
311 { | |
312 audio_voice_memo_amr_error_trace(AUDIO_ERROR_STOP_EVENT); | |
313 return; | |
314 } | |
315 #endif | |
316 // we handle a New_ffs stop when RAM is running as an error | |
317 #if (AUDIO_RAM_MANAGER) | |
318 if ((p_message->msg_id == AUDIO_VM_AMR_PLAY_FROM_FFS_STOP_REQ)&& | |
319 (p_audio_gbl_var->audio_vm_amr_play.audio_ram_fd != NULL)) | |
320 { | |
321 audio_voice_memo_amr_error_trace(AUDIO_ERROR_STOP_EVENT); | |
322 return; | |
323 } | |
324 #endif | |
325 /* Send the Stop message to the FFS */ | |
326 mb_status = rvf_get_buf (p_audio_gbl_var->mb_internal, | |
327 sizeof (T_AUDIO_MEM_STOP), | |
328 (T_RVF_BUFFER **) (&p_send_message)); | |
329 | |
330 /* If insufficient resources, then report a memory error and abort. */ | |
331 if (mb_status == RVF_RED) | |
332 { | |
333 audio_voice_memo_amr_error_trace(AUDIO_ENTITY_NO_MEMORY); | |
334 return; | |
335 } | |
336 | |
337 /* fill message */ | |
338 ((T_AUDIO_MEM_STOP *)p_send_message)->os_hdr.msg_id = AUDIO_MEM_STOP_REQ; | |
339 ((T_AUDIO_MEM_STOP *)p_send_message)->channel_id = p_audio_gbl_var->audio_vm_amr_play.channel_id; | |
340 | |
341 /* send the message to the entity */ | |
342 rvf_send_msg (p_audio_gbl_var->audio_ffs_addrId, p_send_message); | |
343 | |
344 p_audio_gbl_var->audio_vm_amr_play.state = AUDIO_WAIT_STOP_CON; | |
345 } | |
346 break; | |
347 case AUDIO_MEM_STATUS_MSG: | |
348 { | |
349 if (((T_AUDIO_MEM_STATUS *)p_message)->status_type == AUDIO_STOP_STATUS) | |
350 { | |
351 /* should be useless as it is an automatic stop so AUDIO_OK */ | |
352 if (((T_AUDIO_MEM_STATUS *)p_message)->status == AUDIO_OK) | |
353 { | |
354 audio_vm_amr_play_send_status (AUDIO_OK, | |
355 p_audio_gbl_var->audio_vm_amr_play.return_path); | |
356 p_audio_gbl_var->audio_vm_amr_play.state = AUDIO_IDLE; | |
357 } | |
358 } | |
359 if (((T_AUDIO_MEM_STATUS *)p_message)->status_type == AUDIO_START_STATUS) | |
360 { | |
361 /* MEM could not find a free mem channel */ | |
362 if (((T_AUDIO_MEM_STATUS *)p_message)->status == AUDIO_ERROR) | |
363 { | |
364 audio_vm_amr_play_send_status (AUDIO_ERROR, | |
365 p_audio_gbl_var->audio_vm_amr_play.return_path); | |
366 p_audio_gbl_var->audio_vm_amr_play.state = AUDIO_IDLE; | |
367 } | |
368 } | |
369 } | |
370 break; | |
371 } | |
372 } | |
373 break; | |
374 case AUDIO_WAIT_STOP_CON: | |
375 { | |
376 switch (p_message->msg_id) | |
377 { | |
378 case AUDIO_MEM_STATUS_MSG: | |
379 { | |
380 if (((T_AUDIO_MEM_STATUS *)p_message)->status_type == AUDIO_STOP_STATUS) | |
381 { | |
382 audio_vm_amr_play_send_status (AUDIO_OK, | |
383 p_audio_gbl_var->audio_vm_amr_play.return_path); | |
384 p_audio_gbl_var->audio_vm_amr_play.state = AUDIO_IDLE; | |
385 } | |
386 } | |
387 break; | |
388 case AUDIO_VM_AMR_PLAY_FROM_FFS_STOP_REQ: | |
389 case AUDIO_VM_AMR_PLAY_FROM_RAM_STOP_REQ: | |
390 audio_voice_memo_amr_error_trace(AUDIO_ERROR_STOP_EVENT); | |
391 break; | |
392 } | |
393 } | |
394 break; | |
395 case AUDIO_WAIT_CHANNEL_ID_TO_STOP: | |
396 { | |
397 switch (p_message->msg_id) | |
398 { | |
399 case AUDIO_DRIVER_INIT_STATUS_MSG: | |
400 { | |
401 if (((T_AUDIO_DRIVER_INIT_STATUS *)p_message)->status == AUDIO_OK) | |
402 { | |
403 /* get channel_id */ | |
404 p_audio_gbl_var->audio_vm_amr_play.channel_id = ((T_AUDIO_DRIVER_INIT_STATUS *)p_message)->channel_id; | |
405 | |
406 audio_driver_stop_session(p_audio_gbl_var->audio_vm_amr_play.channel_id); | |
407 | |
408 /* change state */ | |
409 p_audio_gbl_var->audio_vm_amr_play.state = AUDIO_WAIT_DRIVER_STOP_CON; | |
410 } | |
411 else | |
412 { | |
413 /* close file */ | |
414 #if (AUDIO_NEW_FFS_MANAGER) | |
415 if (p_audio_gbl_var->audio_vm_amr_play.ffs_fd != NULL) | |
416 { | |
417 if ( ffs_close(p_audio_gbl_var->audio_vm_amr_play.ffs_fd) != EFFS_OK ) | |
418 { | |
419 audio_ffs_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
420 } | |
421 AUDIO_SEND_TRACE("AUDIO VM AMR PLAY: close FFS file:", RV_TRACE_LEVEL_DEBUG_LOW); | |
422 } | |
423 #endif | |
424 | |
425 audio_vm_amr_play_send_status (AUDIO_OK, | |
426 p_audio_gbl_var->audio_vm_amr_play.return_path); | |
427 | |
428 /* change state */ | |
429 p_audio_gbl_var->audio_vm_amr_play.state = AUDIO_IDLE; | |
430 } | |
431 } | |
432 break; | |
433 case AUDIO_VM_AMR_PLAY_FROM_FFS_STOP_REQ: | |
434 case AUDIO_VM_AMR_PLAY_FROM_RAM_STOP_REQ: | |
435 audio_voice_memo_amr_error_trace(AUDIO_ERROR_STOP_EVENT); | |
436 break; | |
437 } | |
438 } // case AUDIO_WAIT_CHANNEL_ID_TO_STOP: | |
439 break; | |
440 case AUDIO_WAIT_DRIVER_STOP_CON: | |
441 { | |
442 switch (p_message->msg_id) | |
443 { | |
444 case AUDIO_DRIVER_STATUS_MSG: | |
445 { | |
446 if (((T_AUDIO_DRIVER_STATUS *)p_message)->status_type == AUDIO_STOP_STATUS) | |
447 { | |
448 /* close file */ | |
449 #if (AUDIO_NEW_FFS_MANAGER) | |
450 if (p_audio_gbl_var->audio_vm_amr_play.ffs_fd != NULL) | |
451 { | |
452 if ( ffs_close(p_audio_gbl_var->audio_vm_amr_play.ffs_fd) != EFFS_OK ) | |
453 { | |
454 audio_ffs_error_trace(AUDIO_ENTITY_FILE_NO_CLOSE); | |
455 } | |
456 AUDIO_SEND_TRACE("AUDIO VM AMR PLAY: close FFS file", RV_TRACE_LEVEL_DEBUG_LOW); | |
457 } | |
458 #endif | |
459 | |
460 audio_vm_amr_play_send_status (((T_AUDIO_DRIVER_STATUS *)p_message)->status, | |
461 p_audio_gbl_var->audio_vm_amr_play.return_path); | |
462 p_audio_gbl_var->audio_vm_amr_play.state = AUDIO_IDLE; | |
463 } | |
464 } | |
465 break; | |
466 case AUDIO_VM_AMR_PLAY_FROM_FFS_STOP_REQ: | |
467 case AUDIO_VM_AMR_PLAY_FROM_RAM_STOP_REQ: | |
468 audio_voice_memo_amr_error_trace(AUDIO_ERROR_STOP_EVENT); | |
469 break; | |
470 } | |
471 } //case AUDIO_WAIT_DRIVER_STOP_CON: | |
472 break; | |
473 } | |
474 } /*********************** End of audio_vm_amr_play_from_memory_manager function **********************/ | |
475 #endif // AUDIO_MEM_MANAGER | |
476 | |
477 /********************************************************************************/ | |
478 /* */ | |
479 /* Function Name: audio_driver_vm_amr_play_manager */ | |
480 /* */ | |
481 /* Purpose: This function is called to manage a voice memorization AMR play */ | |
482 /* manager */ | |
483 /* */ | |
484 /* Input Parameters: */ | |
485 /* Message to the audio entity */ | |
486 /* */ | |
487 /* Output Parameters: */ | |
488 /* None. */ | |
489 /* */ | |
490 /* Note: */ | |
491 /* None. */ | |
492 /* */ | |
493 /* Revision History: */ | |
494 /* None. */ | |
495 /* */ | |
496 /********************************************************************************/ | |
497 T_AUDIO_RET audio_driver_vm_amr_play_manager (T_RV_HDR *p_message, T_AUDIO_DRIVER_SESSION *p_session) | |
498 { | |
499 /**************** audio_driver_vm_amr_play_manager function begins ***********************/ | |
500 switch(p_session->session_info.state) | |
501 { | |
502 case AUDIO_DRIVER_CHANNEL_WAIT_INIT: | |
503 { | |
504 /* init buffer index, layer1 not valid until 1st buffer is filled */ | |
505 /* index_l1 will be set to 0 when get_play_buffer() is called in WAIT_START state */ | |
506 p_session->session_info.index_l1 = 0xFF; | |
507 p_session->session_info.index_appli = 0; | |
508 p_session->session_info.play_api_state = AUDIO_PLAY_API_STATE_GET_BUF; | |
509 | |
510 /* allocate the buffer for the message to the L1 */ | |
511 p_session->session_req.p_l1_send_message = | |
512 audio_allocate_l1_message(sizeof(T_MMI_VM_AMR_PLAY_REQ)); | |
513 ((T_MMI_VM_AMR_PLAY_REQ *)(p_session->session_req.p_l1_send_message))->session_id = | |
514 AUDIO_VM_AMR_PLAY_SESSION_ID; | |
515 | |
516 if (p_session->session_req.p_l1_send_message != NULL ) | |
517 return (AUDIO_OK); | |
518 else | |
519 return (AUDIO_ERROR); | |
520 } | |
521 break; | |
522 | |
523 case AUDIO_DRIVER_CHANNEL_WAIT_START: | |
524 { | |
525 /* send the start voice memo play message to the L1 */ | |
526 audio_send_l1_message(MMI_VM_AMR_PLAY_START_REQ, | |
527 p_session->session_req.p_l1_send_message); | |
528 return (AUDIO_OK); | |
529 } | |
530 break; | |
531 | |
532 case AUDIO_DRIVER_CHANNEL_WAIT_STOP: | |
533 { | |
534 /* send the stop command to the audio L1 */ | |
535 void *p_send_message = audio_allocate_l1_message(0); | |
536 if ( p_send_message != NULL) | |
537 { | |
538 /* send the stop command to the audio L1 */ | |
539 audio_send_l1_message(MMI_VM_AMR_PLAY_STOP_REQ, p_send_message); | |
540 return (AUDIO_OK); | |
541 } | |
542 return (AUDIO_ERROR); | |
543 } | |
544 break; | |
545 case AUDIO_DRIVER_CHANNEL_WAIT_START_CON_TO_STOP: | |
546 { | |
547 /* send the stop command to the audio L1 */ | |
548 void *p_send_message = audio_allocate_l1_message(0); | |
549 if ( p_send_message != NULL) | |
550 { | |
551 /* send the stop command to the audio L1 */ | |
552 audio_send_l1_message(MMI_VM_AMR_PLAY_STOP_REQ, p_send_message); | |
553 return (AUDIO_OK); | |
554 } | |
555 return (AUDIO_ERROR); | |
556 } | |
557 break; | |
558 } | |
559 } /*********************** End of audio_vm_play_manager function **********************/ | |
560 | |
561 #endif /* VM_AMR_PLAY */ | |
562 #endif /* RVM_AUDIO_MAIN_SWE */ |