comparison src/ui3/mfw/mfw_aud.c @ 420:e8ddbb0837ed

src/ui3: initial import of TCS3/LoCosto BMI & MFW code
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 Jan 2018 03:09:00 +0000
parents
children b66631a0b632
comparison
equal deleted inserted replaced
419:59143cd42ec7 420:e8ddbb0837ed
1 /*
2 +--------------------------------------------------------------------+
3 | PROJECT: MMI-Framework (8417) $Workfile:: mfw_aud.c $|
4 | $Author:: NDH $Revision:: 1 $|
5 | CREATED: 04.02.03 $Modtime:: 10.04.00 14:58 $|
6 | STATE : code |
7 +--------------------------------------------------------------------+
8
9 MODULE : MFW_AUD
10
11 PURPOSE : This module contains Audio Riveria Interface functions.
12
13 HISTORY:
14
15 Mar 28, 2007 DR: OMAPS00122762 x0039928
16 Description: MM: Deleting a PCM Voice Memo message in one particular memory,
17 delete them in all memories
18 Solution: voice memo position and pcm voice memo position is provided for all the devices.
19
20 July 03,2006 REF :OMAPS00083150 x0047075
21 Description :Audio muted on call swap / hold
22 Solution :Function call hl_drv_enable_vocoder() and hl_drv_disable_vocoder() are replaced with hl_drv_set_vocoder_state()
23 Mar 15, 2006 ER: OMAPS00067709 x0pleela
24 Description: Voice Buffering implementation on C+ for PTT via PCM API
25 Solution: Defined new macros of folder and file names for PCM voice memo and Voice buffering
26 Defined new macros for Microphone and network gain of PCM VM and Voice buffering
27 Defined new functions set_voice_memo_type, get_voice_memo_type, set_voice_buffering_rec_stop_reason
28 Function: mfw_aud_vm_delete_file
29 Changes:Handling file deletion forPCM voice memo also
30
31 Function: mfw_aud_vm_start_playback, mfw_aud_vm_stop_playback, mfw_aud_vm_start_record,
32 mfw_aud_vm_stop_record, mfw_aud_vm_get_duration, mfw_aud_vm_set_duration
33 Changes: Added code to call respective audio APIs for PCM voice memo and voice buffering
34
35 Feb 24, 2006 ER: OMAPS00067709 x0pleela
36 Description: Voice Buffering implementation on C+ for PTT via PCM API
37 Solution: Defined a global variable gPcm_voice_Memo which indicates which Voice memo is active
38 and corresponding audio APIs will be invoked and duplication of code is avoided
39
40 Feb 24, 2006 ER: OMAPS00067709 x0pleela
41 Description: Voice Buffering implementation on C+ for PTT via PCM API
42 Solution: Adding new macros PCM_VM_FILE_NAME, PCM_VM_FOLDER to define new files for PCM voice memo
43 Following functions are implemented to support PCM voice memo feature
44 mfw_aud_vm_pcm_delete_file: Delete the file which held the PCM Voice Memo
45 mfw_aud_vm_pcm_start_playback: Start playback of a previously recorded PCM Voice Memo
46 mfw_aud_vm_pcm_stop_playback: Stop playback of a previously recorded PCM Voice Memo
47 mfw_aud_vm_pcm_start_record: Configure Riviera and start recording a PCM Voice Memo
48 mfw_aud_vm_pcm_stop_record: Stop recording a PCM Voice Memo
49 mfw_aud_vm_pcm_get_duration: Get the duration of the previously recorded PCM Voice Memo
50 mfw_aud_vm_pcm_set_duration: Set the duration of the previously recorded PCM Voice Memo
51
52 Apr 06, 2006 ERT: OMAPS00070660 x0039928(sumanth)
53 Description: Need to reduce flash foot-print for Locosto Lite
54 Solution: Voice Memo feature is put under the flag #ifndef FF_NO_VOICE_MEMO to compile
55 out voice memo feature if the above flag is enabled.
56
57 Mar 03, 2005 REF: CRR MMI-ENH-28950 xnkulkar
58 Description: RE: Vocoder interface change
59 Solution: Function call 'enable_tch_vocoder()' is replaced with new functions 'hl_drv_enable_vocoder()'
60 and 'hl_drv_disable_vocoder()'
61
62 Aug 25, 2004 REF: CRR 20655 xnkulkar
63 Description: Voice Memo functionality not working
64 Solution: The voice recording functionality was failing because
65 " mmi" folder is not present. As a solution, we create the
66 "mmi" folder and then proceed with recording.
67 */
68
69
70 /*
71 ** Include Files
72 */
73
74 #define ENTITY_MFW
75
76 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */
77 #ifndef NEPTUNE_BOARD
78 /* END ADD: Req ID: : Sumit : 14-Mar-05 */
79
80 /* includes */
81 #include <string.h>
82
83 #include "typedefs.h"
84 #include "vsi.h"
85 #include "pei.h"
86 #include "custom.h"
87 #include "gsm.h"
88
89 #include "mfw_ffs.h"
90 #include "mfw_aud.h"
91 #include "mfw_fm.h"
92 #ifndef FF_NO_VOICE_MEMO
93 #include "Audio/audio_api.h"
94 #endif
95
96 // Mar 03, 2005 REF: CRR MMI-ENH-28950 xnkulkar
97 #include "hl_audio_drv.h"
98
99 //x0pleela 06 Jul, 2006 DR: OMAPS00067709
100 //fix from AS team
101 #ifdef FF_PCM_VM_VB
102 #include "l1audio_cust.h"
103 #endif
104 /*
105 ** Local Variable Definitions
106 */
107
108 #ifndef FF_NO_VOICE_MEMO
109 static T_RV_RETURN_PATH voice_memo_return_path;
110
111
112 /*
113 ** Local Macro Definitions
114 */
115
116 #define VM_FILE_NAME "vmfile" // FFS File Name
117 #define VM_FOLDER "/mmi/vm"
118
119 //x0pleela 24 Feb, 2006 ER OMAPS00067709
120 #ifdef FF_PCM_VM_VB
121 #define PCM_VM_FILE_NAME "pcmvm" // FFS PCM voice memo File Name
122 #define PCM_VM_FOLDER "/mmi/pcmvm" //PCM oice memo folder
123
124 //x0pleela 09 Mar, 2006 ER OMAPS00067709
125 #define VOICE_BUFF_FILE_NAME "vbfile" // FFS Voice buffering File Name
126 #define VOICE_BUFF_FOLDER "/mmi/vb" //Voice buffering folder
127
128 //x0pleela 01 Mar, 2006 ER OMAPS00067709
129 //Microphone and network gain for PCM VM and Voice buffering
130 #define PCM_VM_MICROPHONE_GAIN (0x20) // Enable recording from microphone
131 #define PCM_VM_NETWORK_GAIN (0x20) // Enable recording from network
132 #endif
133
134 #define VM_MICROPHONE_GAIN (0x0100) // Default Gain of 1
135 #define VM_NETWORK_GAIN (0x0100) // Default Gain of 1
136
137 #define VM_TONE_DURATION (50)
138 #define VM_TONE_INTERVAL (50)
139 #define VM_TONE_AMPLITUDE (-24) // Default Amplitude of -24dB
140
141 //x0pleela 27 Feb, 2006 ER:OMAPS00067709
142 #ifdef FF_PCM_VM_VB
143 static T_VOICEMEMO VoiceMemoType; /* Voice memo type*/
144
145 //x0pleela 09 Mar, 2006 ER OMAPS00067709
146 GLOBAL T_voice_buffering voice_buffering_data; /* Voice buffering data */
147 #endif
148
149
150 /*
151 ** Local Function Prototypes
152 */
153
154 static void mfw_aud_vm_create_file(const char *folder, const char *fname, UBYTE index);
155 static void configure_callback_fn(void (*callback_fn)(void *));
156 #ifdef FF_MMI_FILEMANAGER
157 static void configure_vm_filename(UINT16 *vm_filename, const char *folder, const char *fname, UBYTE index);
158 #else
159 static void configure_vm_filename(char *vm_filename, const char *folder, const char *fname, UBYTE index);
160 #endif
161
162 /*
163 ** Public function Definitions
164 */
165
166 #ifdef FF_PCM_VM_VB
167 /*
168 +--------------------------------------------------------------------+
169 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
170 | STATE : code ROUTINE: set_voice_memo_type |
171 +--------------------------------------------------------------------+
172
173 PURPOSE : Function to set the type of voice memo
174 */
175 //x0pleela 09 Mar, 2006 ER:OMAPS00067709
176
177 void set_voice_memo_type( T_VOICEMEMO voice_memo_type)
178 {
179 TRACE_FUNCTION("set_voice_memo_type()");
180 VoiceMemoType = voice_memo_type;
181 }
182
183 /*
184 +--------------------------------------------------------------------+
185 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
186 | STATE : code ROUTINE: get_voice_memo_type |
187 +--------------------------------------------------------------------+
188
189 PURPOSE : Function to get the type of voice memo
190 */
191 //x0pleela 08 Mar, 2006 ER:OMAPS00067709
192
193 GLOBAL T_VOICEMEMO get_voice_memo_type( void)
194 {
195 TRACE_FUNCTION("get_voice_memo_type()");
196 return VoiceMemoType;
197 }
198
199 /*
200 +--------------------------------------------------------------------+
201 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
202 | STATE : code ROUTINE: set_voice_buffering_rec_stop_reason |
203 +--------------------------------------------------------------------+
204
205 PURPOSE : Function to set the reason to call record stop
206 */
207 //x0pleela 07 Mar, 2006 ER:OMAPS00067709
208 GLOBAL void set_voice_buffering_rec_stop_reason( T_VOICE_BUFFERING_STATUS reason)
209 {
210 TRACE_FUNCTION("set_voice_memo_type()");
211 voice_buffering_data.rec_stop_reason = reason;
212 }
213 #endif
214
215 /*
216 +--------------------------------------------------------------------+
217 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
218 | STATE : code ROUTINE: mfw_aud_vm_delete_file |
219 +--------------------------------------------------------------------+
220
221
222 PURPOSE : Delete the file which held the Voice Memo
223
224 */
225 SHORT mfw_aud_vm_delete_file(void)
226 {
227 #ifdef FF_MMI_FILEMANAGER
228 UINT16 tmpFile[AUDIO_PATH_NAME_MAX_SIZE];
229 char path[AUDIO_PATH_NAME_MAX_SIZE];
230 #else
231 char tmpFile[AUDIO_PATH_NAME_MAX_SIZE];
232 #endif
233
234 TRACE_FUNCTION("mfw_aud_vm_delete_file");
235 memset(tmpFile, 0x00, AUDIO_PATH_NAME_MAX_SIZE);
236 #ifdef FF_PCM_VM_VB
237 //x0pleela 06 Mar, 2006 ER:OMAPS00067709
238 //deleting PCM Voice memo file
239 if( get_voice_memo_type() EQ PCM_VOICE_MEMO)
240 #ifdef FF_MMI_FILEMANAGER
241 {
242 switch(FFS_flashData.PCM_voicememo_storage)
243 {
244 case SNAP_STG_FFS:
245 strcpy(path, "/FFS");
246 break;
247
248 case SNAP_STG_NORMS:
249 strcpy(path, "/NOR");
250 break;
251
252 case SNAP_STG_NAND:
253 strcpy(path, "/NAND");
254 break;
255
256 case SNAP_STG_MMC:
257 strcpy(path, "/MMC");
258 break;
259 }
260
261 strcat(path, PCM_VM_FOLDER);
262 configure_vm_filename(tmpFile, path, PCM_VM_FILE_NAME, 0);
263 }
264 #else
265 configure_vm_filename(tmpFile, PCM_VM_FOLDER, PCM_VM_FILE_NAME, 0);
266 #endif
267 else
268 {
269 if (get_voice_memo_type() EQ AMR_VOICE_MEMO)
270 #endif
271 #ifdef FF_MMI_FILEMANAGER
272 {
273 switch(FFS_flashData.voicememo_storage)
274 {
275 case SNAP_STG_FFS:
276 strcpy(path, "/FFS");
277 break;
278
279 case SNAP_STG_NORMS:
280 strcpy(path, "/NOR");
281 break;
282
283 case SNAP_STG_NAND:
284 strcpy(path, "/NAND");
285 break;
286
287 case SNAP_STG_MMC:
288 strcpy(path, "/MMC");
289 break;
290 }
291
292 strcat(path, VM_FOLDER);
293 configure_vm_filename(tmpFile, path, VM_FILE_NAME, 0);
294 }
295 #else
296 configure_vm_filename(tmpFile, VM_FOLDER, VM_FILE_NAME, 0);
297 #endif
298
299 #ifdef FF_PCM_VM_VB
300 }
301 #endif
302 #ifdef FF_MMI_FILEMANAGER
303 rfs_remove(tmpFile);
304 #else
305 ffs_remove(tmpFile);
306 #endif
307
308 return MFW_AUD_VM_OK;
309 }
310
311
312 /*
313 +--------------------------------------------------------------------+
314 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
315 | STATE : code ROUTINE: mfw_aud_vm_start_playback |
316 +--------------------------------------------------------------------+
317
318
319 PURPOSE : Start playback of a previously recorded Voice Memo
320
321 */
322 SHORT mfw_aud_vm_start_playback(void (*callback_fn)(void *))
323 {
324 T_AUDIO_RET audio_riv_retVal=AUDIO_ERROR;
325 T_AUDIO_VM_PLAY_PARAMETER mfw_vm_play_param;
326
327 #ifdef FF_MMI_FILEMANAGER
328 char path[AUDIO_PATH_NAME_MAX_SIZE];
329 T_RFS_STAT fstat; /* Mar 28, 2007 DR: OMAPS00122762 x0039928 */
330 #endif
331 //x0pleela 01 Mar, 2006 ER:OMAPS00067709
332 #ifdef FF_PCM_VM_VB
333 T_AUDIO_VM_PCM_PLAY_PARAMETER mfw_vm_pcm_play_param; /* Defined new variable for pcm VM */
334 T_AUDIO_VBUF_PCM_PLAY_PARAMETER mfw_vbuf_pcm_play_param; /* Defined new variable for voice buffering*/
335 UBYTE vm_type; /*to store voice memo type */
336 #endif
337
338 TRACE_FUNCTION("mfw_aud_vm_start_playback");
339 #ifndef FF_MMI_FILEMANAGER /* Mar 28, 2007 DR: OMAPS00122762 x0039928*/
340 #ifdef FF_PCM_VM_VB
341 //x0pleela 23 Mar, 2006 ER:OMAPS00067709
342 switch( get_voice_memo_type() )
343 {
344 case AMR_VOICE_MEMO:
345 #endif /* FF_PCM_VM_VB */
346 if (FFS_flashData.voice_memo_position EQ 0)
347 {
348 return MFW_AUD_VM_MEM_EMPTY;
349 }
350 #ifdef FF_PCM_VM_VB
351 break;
352
353 case PCM_VOICE_MEMO:
354 if (FFS_flashData.pcm_voice_memo_position EQ 0)
355 {
356 return MFW_AUD_VM_MEM_EMPTY;
357 }
358 break;
359 default:
360 break;
361 }
362 #endif /* FF_PCM_VM_VB */
363 #endif
364
365 //x0pleela 27 Feb, 2006 ER:OMAPS00067709
366 //Set up the PCM Voice Memo filename in FFS
367 #ifdef FF_PCM_VM_VB
368 //get the voice memo type
369 vm_type = get_voice_memo_type();
370 if( vm_type EQ PCM_VOICE_MEMO )
371 #ifdef FF_MMI_FILEMANAGER
372 {
373 switch(FFS_flashData.PCM_voicememo_storage)
374 {
375 case SNAP_STG_FFS:
376 strcpy(path, "/FFS");
377 break;
378
379 case SNAP_STG_NORMS:
380 strcpy(path, "/NOR");
381 break;
382
383 case SNAP_STG_NAND:
384 strcpy(path, "/NAND");
385 break;
386
387 case SNAP_STG_MMC:
388 strcpy(path, "/MMC");
389 break;
390 }
391
392 strcat(path, PCM_VM_FOLDER);
393 configure_vm_filename(mfw_vm_pcm_play_param.memo_name, path, PCM_VM_FILE_NAME, 0);
394 /* Mar 28, 2007 DR: OMAPS00122762 x0039928 */
395 /* Fix: File empty is returned if the file desnot exist */
396 #ifdef FF_MMI_FILEMANAGER
397 if(rfs_stat(mfw_vm_pcm_play_param.memo_name,&fstat) != RFS_EOK)
398 {
399 return MFW_AUD_VM_MEM_EMPTY;
400 }
401 #endif
402 }
403 #else
404 configure_vm_filename(mfw_vm_pcm_play_param.memo_name, PCM_VM_FOLDER, PCM_VM_FILE_NAME, 0);
405 #endif
406 //x0pleela 09 Mar, 2006 ER:OMAPS00067709
407 //Set up the Voice buffering filename in FFS
408 else if (vm_type EQ VOICE_BUFFERING )
409 #ifdef FF_MMI_FILEMANAGER
410 {
411 switch(FFS_flashData.voicebuffer_storage)
412 {
413 case SNAP_STG_FFS:
414 strcpy(path, "/FFS");
415 break;
416
417 case SNAP_STG_NORMS:
418 strcpy(path, "/NOR");
419 break;
420
421 case SNAP_STG_NAND:
422 strcpy(path, "/NAND");
423 break;
424
425 case SNAP_STG_MMC:
426 strcpy(path, "/MMC");
427 break;
428 }
429
430 strcat(path, VOICE_BUFF_FOLDER);
431 configure_vm_filename(mfw_vbuf_pcm_play_param.memo_name, path, VOICE_BUFF_FILE_NAME, 0);
432 }
433 #else
434 configure_vm_filename(mfw_vbuf_pcm_play_param.memo_name, VOICE_BUFF_FOLDER, VOICE_BUFF_FILE_NAME, 0);
435 #endif
436 else
437 {
438 if (vm_type EQ AMR_VOICE_MEMO)
439 #endif
440 #ifdef FF_MMI_FILEMANAGER
441 {
442 switch(FFS_flashData.voicememo_storage)
443 {
444 case SNAP_STG_FFS:
445 strcpy(path, "/FFS");
446 break;
447
448 case SNAP_STG_NORMS:
449 strcpy(path, "/NOR");
450 break;
451
452 case SNAP_STG_NAND:
453 strcpy(path, "/NAND");
454 break;
455
456 case SNAP_STG_MMC:
457 strcpy(path, "/MMC");
458 break;
459 }
460
461 strcat(path, VM_FOLDER);
462 configure_vm_filename(mfw_vm_play_param.memo_name, path, VM_FILE_NAME, 0);
463 /* Mar 28, 2007 DR: OMAPS00122762 x0039928 */
464 /* Fix: File empty is returned if the file desnot exist */
465 #ifdef FF_MMI_FILEMANAGER
466 if(rfs_stat(mfw_vm_play_param.memo_name,&fstat) != RFS_EOK)
467 {
468 return MFW_AUD_VM_MEM_EMPTY;
469 }
470 #endif
471 }
472 #else
473 //Set up the Voice Memo filename in FFS
474 configure_vm_filename(mfw_vm_play_param.memo_name, VM_FOLDER, VM_FILE_NAME, 0);
475 #endif
476 #ifdef FF_PCM_VM_VB
477 }
478 #endif
479 // Call Riviera function to start playback.
480 #ifndef WIN32 // only if not in Windows
481 //x0pleela 27 Feb, 2006 ER:OMAPS00067709
482
483 configure_callback_fn(callback_fn);
484 #ifdef FF_PCM_VM_VB
485 //x0pleela 06 Mar, 2006 ER:OMAPS00067709
486 if( vm_type EQ PCM_VOICE_MEMO )
487 {
488 //update mfw_vm_pcm_play_param
489 mfw_vm_pcm_play_param.memo_duration = mfw_aud_vm_get_duration();
490 mfw_vm_pcm_play_param.speaker_gain = PCM_VM_MICROPHONE_GAIN;
491 mfw_vm_pcm_play_param.network_gain= 0;
492
493 //Start playing PCM Voice memo
494 audio_riv_retVal = audio_vm_pcm_play_start(&mfw_vm_pcm_play_param,
495 voice_memo_return_path);
496 }
497 else if ( vm_type EQ VOICE_BUFFERING )
498 {
499 //update mfw_vbuf_pcm_play_param
500 mfw_vbuf_pcm_play_param.memo_duration = PCM_VOICE_MEMO_MAX_DURATION;
501 mfw_vbuf_pcm_play_param.speaker_gain = 0;
502 mfw_vbuf_pcm_play_param.network_gain= PCM_VM_NETWORK_GAIN;
503
504 //x0pleela 06 Jul, 2006 DR: OMAPS00067709
505 //Fix from AS team
506 vocoder_mute_ul(1);
507
508 //Set up the Voice buffering filename in FFS
509 audio_riv_retVal = audio_voice_buffering_pcm_play_start (&mfw_vbuf_pcm_play_param,
510 voice_memo_return_path);
511 }
512 else
513 {
514 if (vm_type EQ AMR_VOICE_MEMO)
515 #endif
516 audio_riv_retVal = audio_vm_play_start(&mfw_vm_play_param,
517 voice_memo_return_path);
518 #ifdef FF_PCM_VM_VB
519 }
520 #endif
521 // If the Riviera call failed
522 if (audio_riv_retVal != RV_OK)
523 return MFW_AUD_VM_RIVIERA_FAILED;
524 #endif
525 return MFW_AUD_VM_OK;
526 }
527
528
529 /*
530 +--------------------------------------------------------------------+
531 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
532 | STATE : code ROUTINE: mfw_aud_vm_stop_playback |
533 +--------------------------------------------------------------------+
534
535
536 PURPOSE : Stop playback of a previously recorded Voice Memo
537
538 */
539 SHORT mfw_aud_vm_stop_playback(void (*callback_fn)(void *))
540 {
541 T_AUDIO_RET audio_riv_retVal=AUDIO_ERROR;
542 //x0pleela 06 Mar, 2006 ER:OMAPS00067709
543 #ifdef FF_PCM_VM_VB
544 UBYTE vm_type; //to store voice memo type
545 #endif
546
547 TRACE_FUNCTION("mfw_aud_vm_stop_playback");
548 configure_callback_fn(callback_fn);
549
550 #ifndef WIN32 // only if not in Windows
551 #ifdef FF_PCM_VM_VB
552 //x0pleela 06 Mar, 2006 ER:OMAPS00067709
553 //get the voice memo type
554 vm_type = get_voice_memo_type();
555
556 //x0pleela 27 Feb, 2006 ER:OMAPS00067709
557 //Stop playing PCM Voice memo
558 if( vm_type EQ PCM_VOICE_MEMO )
559 audio_riv_retVal = audio_vm_pcm_play_stop(voice_memo_return_path);
560 //Stop playing
561 else if ( vm_type EQ VOICE_BUFFERING )
562 {
563 audio_riv_retVal = audio_voice_buffering_pcm_play_stop (voice_memo_return_path);
564 //x0pleela 06 Jul, 2006 DR: OMAPS00067709
565 //Fix from AS team
566 vocoder_mute_ul(0);
567 }
568 else
569 {
570 if (vm_type EQ AMR_VOICE_MEMO)
571 #endif
572 audio_riv_retVal = audio_vm_play_stop(voice_memo_return_path);
573 #ifdef FF_PCM_VM_VB
574 }
575 #endif
576 // If the Riviera call failed
577 if (audio_riv_retVal != RV_OK)
578 return MFW_AUD_VM_RIVIERA_FAILED;
579
580 #endif
581
582 return MFW_AUD_VM_OK;
583 }
584
585
586 #ifdef FF_MMI_FILEMANAGER
587 void path_init(UBYTE vmtype)
588 {
589 T_RFS_RET ffsResult;
590 T_RFS_DIR f_dir, f_dir1;
591 char dir_path[FM_MAX_DIR_PATH_LENGTH];
592 UINT16 dir_path_uc[FM_MAX_DIR_PATH_LENGTH];
593
594 memset(dir_path, 0, FM_MAX_DIR_PATH_LENGTH);
595 switch(vmtype)
596 {
597 case AMR_VOICE_MEMO:
598 switch(FFS_flashData.voicememo_storage)
599 {
600 case SNAP_STG_FFS:
601 strcpy(dir_path, "/FFS/mmi");
602 break;
603
604 case SNAP_STG_NORMS:
605 strcpy(dir_path, "/NOR/mmi");
606 break;
607
608 case SNAP_STG_NAND:
609 strcpy(dir_path, "/NAND/mmi");
610 break;
611
612 case SNAP_STG_MMC:
613 strcpy(dir_path, "/MMC/mmi");
614 break;
615 }
616 convert_u8_to_unicode(dir_path, dir_path_uc);
617 ffsResult = rfs_opendir(dir_path_uc,&f_dir);
618 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path);
619
620 if(RFS_ENOENT == ffsResult)
621 {
622 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU);
623 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path);
624 if(ffsResult == 0)
625 {
626 strcat(dir_path, "/vm");
627 convert_u8_to_unicode(dir_path, dir_path_uc);
628 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU);
629 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path);
630 }
631 }
632 else if(ffsResult > 0)
633 {
634 strcat(dir_path, "/vm");
635 convert_u8_to_unicode(dir_path, dir_path_uc);
636 ffsResult = rfs_opendir(dir_path_uc,&f_dir1);
637 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path);
638
639 if(RFS_ENOENT == ffsResult)
640 {
641 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU);
642 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path);
643 }
644 else if (ffsResult > 0)
645 rfs_closedir(&f_dir1);
646
647 rfs_closedir(&f_dir);
648 }
649 break;
650
651 case PCM_VOICE_MEMO:
652 switch(FFS_flashData.PCM_voicememo_storage)
653 {
654 case SNAP_STG_FFS:
655 strcpy(dir_path, "/FFS/mmi");
656 break;
657
658 case SNAP_STG_NORMS:
659 strcpy(dir_path, "/NOR/mmi");
660 break;
661
662 case SNAP_STG_NAND:
663 strcpy(dir_path, "/NAND/mmi");
664 break;
665
666 case SNAP_STG_MMC:
667 strcpy(dir_path, "/MMC/mmi");
668 break;
669 }
670 convert_u8_to_unicode(dir_path, dir_path_uc);
671 ffsResult = rfs_opendir(dir_path_uc,&f_dir);
672 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path);
673
674 if(RFS_ENOENT == ffsResult)
675 {
676 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU);
677 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path);
678 if(ffsResult == 0)
679 {
680 strcat(dir_path, "/pcmvm");
681 convert_u8_to_unicode(dir_path, dir_path_uc);
682 ffsResult = rfs_opendir(dir_path_uc,&f_dir1);
683 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path);
684
685 if(RFS_ENOENT == ffsResult)
686 {
687 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU);
688 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path);
689 }
690 else if (ffsResult > 0)
691 rfs_closedir(&f_dir1);
692
693 rfs_closedir(&f_dir);
694 }
695
696 }
697 else if(ffsResult > 0)
698 {
699 strcat(dir_path, "/pcmvm");
700 convert_u8_to_unicode(dir_path, dir_path_uc);
701 ffsResult = rfs_opendir(dir_path_uc,&f_dir1);
702 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path);
703
704 if(RFS_ENOENT == ffsResult)
705 {
706 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU);
707 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path);
708 }
709 }
710
711 break;
712
713 case VOICE_BUFFERING:
714 switch(FFS_flashData.voicebuffer_storage)
715 {
716 case SNAP_STG_FFS:
717 strcpy(dir_path, "/FFS/mmi");
718 break;
719
720 case SNAP_STG_NORMS:
721 strcpy(dir_path, "/NOR/mmi");
722 break;
723
724 case SNAP_STG_NAND:
725 strcpy(dir_path, "/NAND/mmi");
726 break;
727
728 case SNAP_STG_MMC:
729 strcpy(dir_path, "/MMC/mmi");
730 break;
731 }
732 convert_u8_to_unicode(dir_path, dir_path_uc);
733 ffsResult = rfs_opendir(dir_path_uc,&f_dir);
734 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path);
735
736 if(RFS_ENOENT == ffsResult)
737 {
738 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU);
739 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path);
740
741 if(ffsResult == 0)
742 {
743 strcat(dir_path, "/vb");
744 convert_u8_to_unicode(dir_path, dir_path_uc);
745 ffsResult = rfs_opendir(dir_path_uc,&f_dir1);
746 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path);
747
748 if(RFS_ENOENT == ffsResult)
749 {
750 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU);
751 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path);
752 }
753 }
754 }
755 else if(ffsResult > 0)
756 {
757 strcat(dir_path, "/vb");
758 convert_u8_to_unicode(dir_path, dir_path_uc);
759 ffsResult = rfs_opendir(dir_path_uc,&f_dir1);
760 TRACE_EVENT_P2("Opendir - ffsResult %d Dir path %s", ffsResult,dir_path);
761
762 if(RFS_ENOENT == ffsResult)
763 {
764 ffsResult = rfs_mkdir(dir_path_uc, RFS_IRWXU);
765 TRACE_EVENT_P2("Makedir - ffsResult %d Dir path %s", ffsResult,dir_path);
766 }
767 else if (ffsResult > 0)
768 rfs_closedir(&f_dir1);
769
770 rfs_closedir(&f_dir);
771 }
772 break;
773 }
774 }
775 #endif
776
777 /*
778 +--------------------------------------------------------------------+
779 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
780 | STATE : code ROUTINE: mfw_aud_vm_start_record |
781 +--------------------------------------------------------------------+
782
783
784 PURPOSE : Configure Riviera and start recording a Voice Memo
785
786 */
787 SHORT mfw_aud_vm_start_record(UBYTE max_duration, void (*callback_fn)(void *))
788 {
789 T_AUDIO_RET audio_riv_retVal=AUDIO_ERROR;
790 T_AUDIO_VM_RECORD_PARAMETER mfw_vm_record_param;
791 T_AUDIO_TONES_PARAMETER mfw_vm_tones_param;
792
793 #ifdef FF_MMI_FILEMANAGER
794 char path[FM_MAX_DIR_PATH_LENGTH];
795 #else
796 char * mmiDir = "/mmi"; // Aug 25, 2004 REF: CRR 20655 xnkulkar
797 #endif
798
799 //x0pleela 27 Feb, 2006 ER:OMAPS00067709
800 //defining new variable for PCM recording
801 #ifdef FF_PCM_VM_VB
802 T_AUDIO_VM_PCM_RECORD_PARAMETER mfw_vm_pcm_record_param;
803 T_AUDIO_VBUF_PCM_RECORD_PARAMETER mfw_vbuf_pcm_record_param;
804 UBYTE vm_type; //to store voice memo type
805 #endif
806 TRACE_FUNCTION("mfw_aud_vm_start_record");
807 configure_callback_fn(callback_fn);
808
809 memset(path, 0, FM_MAX_DIR_PATH_LENGTH);
810 //x0pleela 27 Feb, 2006 ER:OMAPS00067709
811 #ifdef FF_PCM_VM_VB
812 //x0pleela 06 Mar, 2006 ER:OMAPS00067709
813 //get the voice memo type
814 vm_type = get_voice_memo_type();
815
816 // We now create the "mmi" folder and then proceed with recording.
817 #ifdef FF_MMI_FILEMANAGER
818 path_init(vm_type);
819 #else
820 flash_makedir(mmiDir);
821 #endif
822
823 if( vm_type EQ PCM_VOICE_MEMO )
824 #ifdef FF_MMI_FILEMANAGER
825 {
826 switch(FFS_flashData.PCM_voicememo_storage)
827 {
828 case SNAP_STG_FFS:
829 strcpy(path, "/FFS");
830 break;
831
832 case SNAP_STG_NORMS:
833 strcpy(path, "/NOR");
834 break;
835
836 case SNAP_STG_NAND:
837 strcpy(path, "/NAND");
838 break;
839
840 case SNAP_STG_MMC:
841 strcpy(path, "/MMC");
842 break;
843 }
844 strcat(path, PCM_VM_FOLDER);
845 configure_vm_filename(mfw_vm_pcm_record_param.memo_name, path, PCM_VM_FILE_NAME, 0);
846 }
847 #else
848 //Set up, and create, the PCM Voice Memo filename in FFS
849 configure_vm_filename(mfw_vm_pcm_record_param.memo_name, PCM_VM_FOLDER, PCM_VM_FILE_NAME, 0);
850 #endif
851 //x0pleela 09 Mar, 2006 ER:OMAPS00067709
852 else if( vm_type EQ VOICE_BUFFERING)
853 #ifdef FF_MMI_FILEMANAGER
854 {
855 switch(FFS_flashData.voicebuffer_storage)
856 {
857 case SNAP_STG_FFS:
858 strcpy(path, "/FFS");
859 break;
860
861 case SNAP_STG_NORMS:
862 strcpy(path, "/NOR");
863 break;
864
865 case SNAP_STG_NAND:
866 strcpy(path, "/NAND");
867 break;
868
869 case SNAP_STG_MMC:
870 strcpy(path, "/MMC");
871 break;
872 }
873
874 strcat(path, VOICE_BUFF_FOLDER);
875 configure_vm_filename(mfw_vbuf_pcm_record_param.memo_name, path, VOICE_BUFF_FILE_NAME, 0);
876 }
877 #else
878 //Set up, and create, the Voice Buffering filename in FFS
879 configure_vm_filename(mfw_vbuf_pcm_record_param.memo_name, VOICE_BUFF_FOLDER, VOICE_BUFF_FILE_NAME, 0);
880 #endif
881 else
882 {
883 if (vm_type EQ AMR_VOICE_MEMO)
884 #endif /* FF_PCM_VM_VB */
885 #ifdef FF_MMI_FILEMANAGER
886 {
887 switch(FFS_flashData.voicememo_storage)
888 {
889 case SNAP_STG_FFS:
890 strcpy(path, "/FFS");
891 break;
892
893 case SNAP_STG_NORMS:
894 strcpy(path, "/NOR");
895 break;
896
897 case SNAP_STG_NAND:
898 strcpy(path, "/NAND");
899 break;
900
901 case SNAP_STG_MMC:
902 strcpy(path, "/MMC");
903 break;
904 }
905
906 strcat(path, VM_FOLDER);
907 configure_vm_filename(mfw_vm_record_param.memo_name, path, VM_FILE_NAME, 0);
908 }
909 #else
910 //Set up, and create, the Voice Memo filename in FFS
911 configure_vm_filename(mfw_vm_record_param.memo_name, VM_FOLDER, VM_FILE_NAME, 0);
912 #endif
913 #ifdef FF_PCM_VM_VB
914 }
915 #endif /* FF_PCM_VM_VB */
916 //Aug 25, 2004 REF: CRR 20655 xnkulkar
917
918
919 //x0pleela 27 Feb, 2006 ER:OMAPS00067709
920 #ifdef FF_PCM_VM_VB
921 if( vm_type EQ PCM_VOICE_MEMO )
922 //create PCM Voice memo file
923 #ifdef FF_MMI_FILEMANAGER
924 mfw_aud_vm_create_file(path, PCM_VM_FILE_NAME, 0);
925 #else
926 mfw_aud_vm_create_file(PCM_VM_FOLDER, PCM_VM_FILE_NAME, 0);
927 #endif
928 //x0pleela 09 Mar, 2006 ER:OMAPS00067709
929 else if( vm_type EQ VOICE_BUFFERING )
930 //create Voice Buffering file
931 #ifdef FF_MMI_FILEMANAGER
932 mfw_aud_vm_create_file(path, VOICE_BUFF_FILE_NAME, 0);
933 #else
934 mfw_aud_vm_create_file(VOICE_BUFF_FOLDER, VOICE_BUFF_FILE_NAME, 0);
935 #endif
936 else
937 {
938 if (vm_type EQ AMR_VOICE_MEMO)
939 #endif /* FF_PCM_VM_VB */
940 #ifdef FF_MMI_FILEMANAGER
941 mfw_aud_vm_create_file(path, VM_FILE_NAME, 0);
942 #else
943 mfw_aud_vm_create_file(VM_FOLDER, VM_FILE_NAME, 0);
944 #endif
945 #ifdef FF_PCM_VM_VB
946 }
947 #endif /* FF_PCM_VM_VB */
948
949 #ifndef WIN32 // only if not in Windows
950 //x0pleela 27 Feb, 2006 ER:OMAPS00067709
951 //updating fields of structure T_AUDIO_VM_PCM_RECORD_PARAMETER for PCM VM recording
952 #ifdef FF_PCM_VM_VB
953 if( vm_type EQ PCM_VOICE_MEMO )
954 {
955 mfw_vm_pcm_record_param.memo_duration = (UINT32)max_duration;
956 mfw_vm_pcm_record_param.microphone_gain = PCM_VM_MICROPHONE_GAIN;
957 mfw_vm_pcm_record_param.network_gain = 0;
958
959 audio_riv_retVal = audio_vm_pcm_record_start(&mfw_vm_pcm_record_param,
960 voice_memo_return_path);
961 }
962 else if( vm_type EQ VOICE_BUFFERING )
963 {
964 mfw_vbuf_pcm_record_param.memo_duration = (UINT32)max_duration;
965 mfw_vbuf_pcm_record_param.microphone_gain = PCM_VM_MICROPHONE_GAIN;
966 mfw_vbuf_pcm_record_param.network_gain = 0;
967
968 audio_riv_retVal = audio_voice_buffering_pcm_record_start( &mfw_vbuf_pcm_record_param,
969 voice_memo_return_path);
970 }
971 else
972 {
973 if (vm_type EQ AMR_VOICE_MEMO )
974 {
975 #endif /* FF_PCM_VM_VB */
976
977 // Setup the Voice Memo Tones
978 mfw_vm_record_param.memo_duration = (UINT32)max_duration;
979 mfw_vm_record_param.compression_mode = FALSE; // No Compression
980 mfw_vm_record_param.microphone_gain = VM_MICROPHONE_GAIN;
981 mfw_vm_record_param.network_gain = VM_NETWORK_GAIN;
982
983 mfw_vm_tones_param.tones[0].start_tone = 0;
984 mfw_vm_tones_param.tones[0].stop_tone = VM_TONE_DURATION;
985 mfw_vm_tones_param.tones[0].frequency_tone = 520; // Tone 1 Frequecny in Hz
986 mfw_vm_tones_param.tones[0].amplitude_tone = VM_TONE_AMPLITUDE;
987
988 mfw_vm_tones_param.tones[1].start_tone = mfw_vm_tones_param.tones[0].stop_tone + VM_TONE_INTERVAL;
989 mfw_vm_tones_param.tones[1].stop_tone = mfw_vm_tones_param.tones[1].start_tone + VM_TONE_DURATION;
990 mfw_vm_tones_param.tones[1].frequency_tone = 643; // Tone 2 Frequecny in Hz
991 mfw_vm_tones_param.tones[1].amplitude_tone = VM_TONE_AMPLITUDE;
992
993 mfw_vm_tones_param.tones[2].start_tone = mfw_vm_tones_param.tones[1].stop_tone + VM_TONE_INTERVAL;
994 mfw_vm_tones_param.tones[2].stop_tone = mfw_vm_tones_param.tones[2].start_tone + VM_TONE_DURATION;
995 mfw_vm_tones_param.tones[2].frequency_tone = 775; // Tone 3 Frequecny in Hz
996 mfw_vm_tones_param.tones[2].amplitude_tone = VM_TONE_AMPLITUDE;
997
998 mfw_vm_tones_param.frame_duration = mfw_vm_tones_param.tones[2].stop_tone * 2;
999 mfw_vm_tones_param.sequence_duration = mfw_vm_tones_param.frame_duration * 2;
1000 mfw_vm_tones_param.period_duration = mfw_vm_tones_param.sequence_duration;
1001 mfw_vm_tones_param.repetition = TONE_INFINITE;
1002 // Call Riviera function to start recording.
1003 // If the Riviera call failed
1004 audio_riv_retVal = audio_vm_record_start(&mfw_vm_record_param,
1005 &mfw_vm_tones_param,
1006 voice_memo_return_path);
1007 #ifdef FF_PCM_VM_VB
1008 }
1009 }
1010 #endif /* FF_PCM_VM_VB */
1011 if (audio_riv_retVal != RV_OK)
1012 return MFW_AUD_VM_RIVIERA_FAILED;
1013
1014 #endif
1015
1016 return MFW_AUD_VM_OK;
1017 }
1018
1019
1020 /*
1021 +--------------------------------------------------------------------+
1022 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
1023 | STATE : code ROUTINE: mfw_aud_vm_stop_record |
1024 +--------------------------------------------------------------------+
1025
1026
1027 PURPOSE : Stop recording a Voice Memo
1028
1029 */
1030 SHORT mfw_aud_vm_stop_record(void (*callback_fn)(void *))
1031 {
1032 T_AUDIO_RET audio_riv_retVal=AUDIO_ERROR;
1033
1034 //x0pleela 06 Mar, 2006 ER:OMAPS00067709
1035 #ifdef FF_PCM_VM_VB
1036 UBYTE vm_type; //to store voice memo type
1037 #endif
1038 TRACE_FUNCTION("mfw_aud_vm_stop_record");
1039 configure_callback_fn(callback_fn);
1040
1041 #ifndef WIN32 // only if not in Windows
1042 //x0pleela 27 Feb, 2006 ER:OMAPS00067709
1043 #ifdef FF_PCM_VM_VB
1044 //x0pleela 06 Mar, 2006 ER:OMAPS00067709
1045 //get the voice memo type
1046 vm_type = get_voice_memo_type();
1047
1048 if( vm_type EQ PCM_VOICE_MEMO )
1049 audio_riv_retVal = audio_vm_pcm_record_stop (voice_memo_return_path);
1050 //x0pleela 09 Mar, 2006 ER:OMAPS00067709
1051 else if( vm_type EQ VOICE_BUFFERING)
1052 audio_riv_retVal = audio_voice_buffering_pcm_record_stop (voice_memo_return_path);
1053 else
1054 {
1055 if (vm_type EQ AMR_VOICE_MEMO)
1056 #endif
1057 audio_riv_retVal = audio_vm_record_stop(voice_memo_return_path);
1058 #ifdef FF_PCM_VM_VB
1059 }
1060 #endif
1061 // If the Riviera call failed
1062 if (audio_riv_retVal != RV_OK)
1063 return MFW_AUD_VM_RIVIERA_FAILED;
1064 #endif
1065
1066 return MFW_AUD_VM_OK;
1067 }
1068
1069
1070 /*
1071 +--------------------------------------------------------------------+
1072 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
1073 | STATE : code ROUTINE: mfw_aud_vm_get_duration |
1074 +--------------------------------------------------------------------+
1075
1076
1077 PURPOSE : Get the duration of the previously recorded Voice Memo
1078
1079 */
1080 UBYTE mfw_aud_vm_get_duration(void)
1081 {
1082 TRACE_FUNCTION("mfw_aud_vm_get_duration");
1083 //x0pleela 06 Mar, 2006 ER:OMAPS00067709
1084 #ifdef FF_PCM_VM_VB
1085 //x0pleela 27 Feb, 2006 ER:OMAPS00067709
1086 if( get_voice_memo_type() EQ PCM_VOICE_MEMO )
1087 //get PCM Voice memo recorded duration
1088 #ifdef FF_MMI_FILEMANAGER
1089 /* Mar 28, 2007 DR: OMAPS00122762 x0039928 */
1090 return FFS_flashData.pcm_voice_memo_position[FFS_flashData.PCM_voicememo_storage];
1091 #else
1092 return FFS_flashData.pcm_voice_memo_position;
1093 #endif
1094 else
1095 {
1096 if (get_voice_memo_type() EQ AMR_VOICE_MEMO)
1097 #endif
1098 #ifdef FF_MMI_FILEMANAGER
1099 /* Mar 28, 2007 DR: OMAPS00122762 x0039928 */
1100 return FFS_flashData.voice_memo_position[FFS_flashData.voicememo_storage];
1101 #else
1102 return FFS_flashData.voice_memo_position;
1103 #endif
1104 #ifdef FF_PCM_VM_VB
1105 }
1106 return 0;
1107 #endif
1108 }
1109
1110
1111 /*
1112 +--------------------------------------------------------------------+
1113 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
1114 | STATE : code ROUTINE: mfw_aud_vm_get_duration |
1115 +--------------------------------------------------------------------+
1116
1117
1118 PURPOSE : Set the duration of the previously recorded Voice Memo
1119
1120 */
1121 void mfw_aud_vm_set_duration(UBYTE duration)
1122 {
1123 TRACE_FUNCTION("mfw_aud_vm_set_duration");
1124 //x0pleela 06 Mar, 2006 ER:OMAPS00067709
1125 #ifdef FF_PCM_VM_VB
1126 if( get_voice_memo_type() EQ PCM_VOICE_MEMO )
1127 //Set PCM Voice memo recorded duration
1128 #ifdef FF_MMI_FILEMANAGER
1129 /* Mar 28, 2007 DR: OMAPS00122762 x0039928 */
1130 FFS_flashData.pcm_voice_memo_position[FFS_flashData.PCM_voicememo_storage] = duration;
1131 #else
1132 FFS_flashData.pcm_voice_memo_position = duration;
1133 #endif
1134 else
1135 {
1136 if ( get_voice_memo_type() EQ AMR_VOICE_MEMO)
1137 #endif
1138 #ifdef FF_MMI_FILEMANAGER
1139 /* Mar 28, 2007 DR: OMAPS00122762 x0039928 */
1140 FFS_flashData.voice_memo_position[FFS_flashData.voicememo_storage] = duration;
1141 #else
1142 FFS_flashData.voice_memo_position = duration;
1143 #endif
1144 #ifdef FF_PCM_VM_VB
1145 }
1146 #endif
1147
1148 flash_write();
1149 return;
1150 }
1151
1152 void rfs_data_write(const char* dir_name, const char* file_name, void* data_pointer, int data_size)
1153 {
1154 T_RFS_FD fd;
1155 char file[FM_MAX_DIR_PATH_LENGTH];
1156 UINT16 file_uc[FM_MAX_DIR_PATH_LENGTH];
1157 // Need to check if already flash is formatted
1158
1159 sprintf(file, "%s/%s", dir_name, file_name);
1160 convert_u8_to_unicode(file, file_uc);
1161 fd = rfs_open(file_uc,
1162 RFS_O_CREAT | RFS_O_WRONLY | RFS_O_TRUNC | RFS_O_APPEND, 0x777);
1163 rfs_write(fd, data_pointer, data_size);
1164
1165 rfs_close(fd);
1166 return;
1167 }
1168
1169 /*
1170 ** Local Function Definitions
1171 */
1172
1173 /*
1174 +--------------------------------------------------------------------+
1175 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
1176 | STATE : code ROUTINE: mfw_aud_vm_create_file |
1177 +--------------------------------------------------------------------+
1178
1179
1180 PURPOSE : Create the FFS file required for the Riviera Voice Memo
1181
1182 */
1183 static void mfw_aud_vm_create_file(const char *folder, const char *fname, UBYTE index)
1184 {
1185
1186 #ifdef FF_MMI_FILEMANAGER
1187 UINT16 dummy = 0x00;
1188 rfs_data_write(folder,fname, &dummy,sizeof(dummy));
1189 #else
1190 UBYTE dummy = 0x00;
1191 flash_data_write(folder, fname, &dummy, sizeof(dummy));
1192 #endif
1193 TRACE_FUNCTION("mfw_aud_vm_create_file");
1194 return;
1195 }
1196
1197
1198 /*
1199 +--------------------------------------------------------------------+
1200 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
1201 | STATE : code ROUTINE: configure_callback_fn |
1202 +--------------------------------------------------------------------+
1203
1204
1205 PURPOSE : Configure the Riviera Return PAth
1206
1207 */
1208 static void configure_callback_fn(void (*callback_fn)(void *))
1209 {
1210 TRACE_FUNCTION("configure_callback_fn");
1211 voice_memo_return_path.addr_id = 0;
1212 voice_memo_return_path.callback_func = callback_fn;
1213
1214 return;
1215 }
1216
1217
1218
1219 /*
1220 +--------------------------------------------------------------------+
1221 | PROJECT: MMI-Framework (8417) MODULE: MFW_AUD |
1222 | STATE : code ROUTINE: configure_vm_filename |
1223 +--------------------------------------------------------------------+
1224
1225
1226 PURPOSE : Create the Voice memo filename from the incoming parameters
1227
1228 */
1229 #ifdef FF_MMI_FILEMANAGER
1230 static void configure_vm_filename(UINT16 *vm_filename, const char *folder, const char *fname, UBYTE index)
1231 #else
1232 static void configure_vm_filename(char *vm_filename, const char *folder, const char *fname, UBYTE index)
1233 #endif
1234 {
1235 #ifdef FF_MMI_FILEMANAGER
1236 char vm_filename_ascii[FM_MAX_DIR_PATH_LENGTH];
1237 // convert_unicode_to_u8(vm_filename, vm_filename_ascii);
1238 // memset(vm_filename_ascii, 0x00, AUDIO_PATH_NAME_MAX_SIZE);
1239 strcpy(vm_filename_ascii, folder);
1240 strcat(vm_filename_ascii, "/");
1241 strcat(vm_filename_ascii, fname);
1242 convert_u8_to_unicode(vm_filename_ascii, vm_filename);
1243 #else
1244 TRACE_FUNCTION("configure_vm_filename");
1245 memset(vm_filename, 0x00, AUDIO_PATH_NAME_MAX_SIZE);
1246 strcpy(vm_filename, folder);
1247 strcat(vm_filename, "/");
1248 strcat(vm_filename, fname);
1249 #endif
1250 return;
1251 }
1252 #endif
1253
1254 // Mar 03, 2005 REF: CRR MMI-ENH-28950 xnkulkar
1255 // Commented as we are no more using 'enable_tch_vocoder()' from MFW
1256 /*
1257 #ifndef _SIMULATION_
1258 void enable_tch_vocoder(BOOL enabled);
1259 #endif
1260 */
1261
1262 /**********************************************************************
1263 **
1264 ** MFW Riviera Vocoder Interface functions
1265 **
1266 **********************************************************************/
1267
1268 void mfw_aud_l1_enable_vocoder ( void )
1269 {
1270 #ifndef _SIMULATION_
1271 // Mar 03, 2005 REF: CRR MMI-ENH-28950 xnkulkar
1272 // Call 'hl_drv_enable_vocoder()' instead of 'enable_tch_vocoder(TRUE)'
1273 // enable_tch_vocoder(TRUE);
1274
1275 // July 03, 2006 REF:DR OMAPS00083150 x0047075
1276 //Fix:Use hl_drv_set_vocoder_state(TRUE) function instead of hl_drv_enable_vocoder() to enable the vocoder
1277 hl_drv_set_vocoder_state(TRUE);
1278 #endif
1279 return;
1280 }
1281
1282 void mfw_aud_l1_disable_vocoder ( void )
1283 {
1284 #ifndef _SIMULATION_
1285 // Mar 03, 2005 REF: CRR MMI-ENH-28950 xnkulkar
1286 // Call 'hl_drv_disable_vocoder()' instead of 'enable_tch_vocoder(FALSE)'
1287 // enable_tch_vocoder(FALSE);
1288
1289 //July 03, 2006 REF:DR OMAPS00083150 x0047075
1290 //Fix:Use hl_drv_set_vocoder_state(FALSE) instead of hl_drv_disable_vocoder() to disable the vocoder
1291 hl_drv_set_vocoder_state(FALSE);
1292 #endif
1293 return;
1294 }
1295
1296 /****************************************************************/
1297 /* NEPTUNE DEFINITIONS START HERE */
1298 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */
1299 #else /* NEPTUNE_BOARD */
1300 #include "typedefs.h"
1301 #include "mfw_aud.h"
1302
1303 SHORT mfw_aud_vm_delete_file(void)
1304 {
1305 return MFW_AUD_VM_OK;
1306 }
1307
1308 SHORT mfw_aud_vm_start_playback(void (*callback_fn)(void *))
1309 {
1310 return MFW_AUD_VM_OK;
1311 }
1312
1313 SHORT mfw_aud_vm_stop_playback(void (*callback_fn)(void *))
1314 {
1315 return MFW_AUD_VM_OK;
1316 }
1317
1318 SHORT mfw_aud_vm_start_record(UBYTE max_duration, void (*callback_fn)(void *))
1319 {
1320 return MFW_AUD_VM_OK;
1321 }
1322
1323 SHORT mfw_aud_vm_stop_record(void (*callback_fn)(void *))
1324 {
1325 return MFW_AUD_VM_OK;
1326 }
1327
1328 UBYTE mfw_aud_vm_get_duration(void)
1329 {
1330 return 0;
1331 }
1332
1333 void mfw_aud_vm_set_duration(UBYTE duration)
1334 {
1335 return;
1336 }
1337
1338 /*
1339 ** Layer1 Audio interface functions
1340 */
1341 void mfw_aud_l1_enable_vocoder ( void )
1342 {
1343 }
1344
1345 void mfw_aud_l1_disable_vocoder ( void )
1346 {
1347 }
1348
1349 #endif /* NEPTUNE_BOARD*/
1350 /* END ADD: Req ID: : Sumit : 14-Mar-05 */
1351