comparison src/ui/mfw/mfw_aud.c @ 3:67bfe9f274f6

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