FreeCalypso > hg > fc-magnetite
comparison src/ui3/bmi/MmiVoiceMemo.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 |
comparison
equal
deleted
inserted
replaced
| 419:59143cd42ec7 | 420:e8ddbb0837ed |
|---|---|
| 1 /******************************************************************************* | |
| 2 | |
| 3 CONDAT (UK) | |
| 4 | |
| 5 ******************************************************************************** | |
| 6 | |
| 7 This software product is the property of Condat (UK) Ltd and may not be | |
| 8 disclosed to any third party without the express permission of the owner. | |
| 9 | |
| 10 ******************************************************************************** | |
| 11 | |
| 12 $Project name: Basic MMI | |
| 13 $Project code: BMI (6349) | |
| 14 $Module: VOICEMEMO | |
| 15 $File: MmiVoiceMemo.c | |
| 16 $Revision: 1.0 | |
| 17 | |
| 18 $Author: Condat(UK) | |
| 19 $Date: 09/04/01 | |
| 20 | |
| 21 ******************************************************************************** | |
| 22 | |
| 23 Description: | |
| 24 | |
| 25 This provides the start code for the MMI | |
| 26 | |
| 27 ******************************************************************************** | |
| 28 $History: MmiVoiceMemo.c | |
| 29 | |
| 30 Mar 28, 2007 DR: OMAPS00122762 x0039928 | |
| 31 Description: MM: Deleting a PCM Voice Memo message in one particular memory, | |
| 32 delete them in all memories | |
| 33 Solution: voice memo position and pcm voice memo position is provided for all the devices. | |
| 34 | |
| 35 Mar 31, 2006 ER: OMAPS00067709 x0pleela | |
| 36 Description: Voice Buffering implementation on C+ for PTT via PCM API | |
| 37 Solution: Added prototype for voice_buffering_stop_recording | |
| 38 Updating voicebuffering data for play stopped in play callback | |
| 39 | |
| 40 Mar 15, 2006 ER: OMAPS00067709 x0pleela | |
| 41 Description: Voice Buffering implementation on C+ for PTT via PCM API | |
| 42 Solution: Defined new macro "PCM_VOICE_MEMO_MAX_DURATION" to restrict the recording | |
| 43 timeout to 20 secs for PCM voice memo and voice buffering | |
| 44 Added prototypes of new functions inputVoiceMemoNumberEditor, voiceMemoNumberCB, | |
| 45 voice_buffering_tim_cb, voice_buffering_data_reset | |
| 46 Added following new functions: | |
| 47 pcm_voice_memo_play: Sets voice memo type to PCM_VOICE_MEMO which indicates | |
| 48 PCM voice memo is active and start playing the voice | |
| 49 pcm_voice_memo_record: Sets voice memo type to PCM_VOICE_MEMO which indicates | |
| 50 PCM voice memo is active and start recording the voice | |
| 51 voice_buffering_edit_num: Opens an edtor for the user to enter PTT number. Also resets | |
| 52 voice buffering data with default values | |
| 53 voiceMemoNumberCB: call back for number entry | |
| 54 inputVoiceMemoNumberEditor: Settings of Editor | |
| 55 voice_buffering_record_start: Starts recording voice and conects to the PTT number if the | |
| 56 call is not active. If in call, then start playing the voice | |
| 57 voice_buffering_record_stop: Stops the timer and recording. If call is not active the | |
| 58 disconnects the call | |
| 59 voice_buffering_playback_start: Starts playing the voice. If any error while playing, | |
| 60 stops timer and recording | |
| 61 voice_buffering_stop_recording: A wrapper function for record stop to invoke from other | |
| 62 modules. Stops the timer and recording | |
| 63 voice_buffering_stop_playing: A wrapper function for play stop to invoke from other modules | |
| 64 voice_buffering_tim_cb: Timer callback. Stops the timer. If PTT call is not setup disconnect | |
| 65 the call, else call record stop | |
| 66 voice_buffering_data_reset: Resets voice buffering data to default values | |
| 67 | |
| 68 Function: voice_memo_play, voice_memo_record, voice_memo_destroy | |
| 69 Changes: Added code to set voice memo type | |
| 70 | |
| 71 Function: voice_memo | |
| 72 Changes: Added code to handle record start, play start for PCM voice memo | |
| 73 | |
| 74 Function: voice_memo_tim_cb | |
| 75 Changes: Added code to handle record stop, play stop for PCM voice memo | |
| 76 | |
| 77 Function: voice_memo_riv_play_cb | |
| 78 Changes: Added code to allow user to accept ant incoming call after the buffering phase | |
| 79 | |
| 80 Feb 27, 2006 ER: OMAPS00067709 x0pleela | |
| 81 Description: Voice Buffering implementation on C+ for PTT via PCM API | |
| 82 Solution: Defined a global variable gPcm_voice_Memo which indicates which Voice memo is active | |
| 83 and corresponding audio APIs will be invoked and duplication of code is avoided | |
| 84 | |
| 85 Feb 24, 2006 ER: OMAPS00067709 x0pleela | |
| 86 Description: Voice Buffering implementation on C+ for PTT via PCM API | |
| 87 Solution: Defined new macro PCM_VOICE_MEMO_MAX_DURATION which defines maximum | |
| 88 recording and playing duration for PCM voice memo and voice buffering | |
| 89 Implemented following functions to support PCM voice memo feature | |
| 90 pcm_voice_memo_init: Initialization of PCM voice memo | |
| 91 pcm_voice_memo_exit:Termination of PCM voice memo | |
| 92 pcm_voice_memo_play:Starts PCM voice memo play functionality | |
| 93 pcm_voice_memo_record:Starts PCM voice memo record functionality | |
| 94 pcm_voice_memo_start: create a new voicememo dialog | |
| 95 pcm_voice_memo_create: Creation of window | |
| 96 pcm_voice_memo_destroy: Destruction of an dialog | |
| 97 pcm_voice_memo: Dialog function for PCM voice memo dialog | |
| 98 pcm_voice_memo_win_cb:Callback function for information dialog | |
| 99 pcm_voice_memo_tim_cb: Callback function for the PCM voice_memo timer. | |
| 100 pcm_voice_memo_kbd_cb: Keyboard event handler | |
| 101 pcm_voice_memo_riv_record_cb: Callback that handles the return status for PCM voice memo recording | |
| 102 pcm_voice_memo_riv_play_cb:Callback that handles the return status for PCM voice memo palying | |
| 103 | |
| 104 09/04/01 Original Condat(UK) BMI version. | |
| 105 | |
| 106 $End | |
| 107 | |
| 108 *******************************************************************************/ | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 /******************************************************************************* | |
| 114 | |
| 115 Include files | |
| 116 | |
| 117 *******************************************************************************/ | |
| 118 #define ENTITY_MFW | |
| 119 | |
| 120 /* includes */ | |
| 121 #include <string.h> | |
| 122 #include <stdio.h> | |
| 123 #include <stdlib.h> | |
| 124 | |
| 125 #include "typedefs.h" | |
| 126 #include "vsi.h" | |
| 127 #include "pei.h" | |
| 128 #include "custom.h" | |
| 129 #include "gsm.h" | |
| 130 | |
| 131 #include "mfw_sys.h" | |
| 132 | |
| 133 #include "prim.h" | |
| 134 | |
| 135 #include "cus_aci.h" | |
| 136 | |
| 137 #include "mfw_mfw.h" | |
| 138 #include "mfw_win.h" | |
| 139 #include "mfw_kbd.h" | |
| 140 /* SPR#1428 - SH - New Editor changes */ | |
| 141 #ifndef NEW_EDITOR | |
| 142 #include "mfw_edt.h" | |
| 143 #endif | |
| 144 #include "mfw_lng.h" | |
| 145 #include "mfw_tim.h" | |
| 146 #include "mfw_icn.h" | |
| 147 #include "mfw_mnu.h" | |
| 148 #include "mfw_phb.h" | |
| 149 #include "mfw_cm.h" | |
| 150 #include "mfw_sim.h" | |
| 151 #include "mfw_nm.h" | |
| 152 #include "mfw_sat.h" | |
| 153 #include "mfw_phb.h" | |
| 154 #include "ksd.h" | |
| 155 #include "psa.h" | |
| 156 #include "mfw_sms.h" | |
| 157 #include "mfw_cphs.h" | |
| 158 #include "mfw_sat.h" | |
| 159 | |
| 160 #include "dspl.h" | |
| 161 | |
| 162 | |
| 163 #include "MmiMmi.h" | |
| 164 #include "MmiDummy.h" | |
| 165 #include "MmiDialogs.h" | |
| 166 #include "MmiLists.h" | |
| 167 #include "MmiIdle.h" | |
| 168 #include "MmiSoftKeys.h" | |
| 169 #include "Mmiicons.h" | |
| 170 #include "MmiMenu.h" | |
| 171 #include "MmiMain.h" | |
| 172 #include "MmiStart.h" | |
| 173 #include "MmiPins.h" | |
| 174 #include "MmiSettings.h" | |
| 175 | |
| 176 #include "gdi.h" | |
| 177 #include "audio.h" | |
| 178 #include "MmiSounds.h" | |
| 179 #include "MmiResources.h" | |
| 180 #include "mmiColours.h" | |
| 181 | |
| 182 //#include "vmd.h" | |
| 183 #include "MmiVoiceMemo.h" | |
| 184 #include "mfw_ffs.h" | |
| 185 | |
| 186 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */ | |
| 187 #ifndef NEPTUNE_BOARD | |
| 188 /* END ADD: Req ID: : Sumit : 14-Mar-05 */ | |
| 189 #include "Audio/audio_api.h" | |
| 190 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */ | |
| 191 #endif /* NEPTUNE_BOARD*/ | |
| 192 /* END ADD: Req ID: : Sumit : 14-Mar-05 */ | |
| 193 | |
| 194 #include "mfw_aud.h" | |
| 195 | |
| 196 //x0pleela 09 Mar, 2006 ER:OMAPS00067709 | |
| 197 //Including this header to support number editor | |
| 198 #ifdef FF_PCM_VM_VB | |
| 199 #include "MmiBookshared.h" | |
| 200 #endif | |
| 201 /******************************************************************************* | |
| 202 | |
| 203 internal data | |
| 204 | |
| 205 *******************************************************************************/ | |
| 206 | |
| 207 /* | |
| 208 * Internal events | |
| 209 */ | |
| 210 #define VM_INIT 500 | |
| 211 #define VM_DESTROY 501 | |
| 212 #define VM_PLAY 502 | |
| 213 #define VM_RECORD 503 | |
| 214 #define VM_DELETE_BUFFER 504 | |
| 215 | |
| 216 #define VOICE_MEMO_MAX_DURATION 10 // 10 Secs | |
| 217 | |
| 218 typedef struct | |
| 219 { | |
| 220 T_MMI_CONTROL mmi_control; | |
| 221 T_MFW_HND parent_win; | |
| 222 T_MFW_HND info_win; | |
| 223 T_MFW_HND info_tim; | |
| 224 T_MFW_HND info_kbd; | |
| 225 USHORT Identifier; | |
| 226 USHORT time; | |
| 227 char elapsed_time[7]; | |
| 228 int play_sk2; | |
| 229 } T_voice_memo; | |
| 230 | |
| 231 //x0pleela 09 Mar, 2006 ER:OMAPS00067709 | |
| 232 #ifdef FF_PCM_VM_VB | |
| 233 EXTERN T_voice_buffering voice_buffering_data; | |
| 234 EXTERN T_call call_data; | |
| 235 #endif | |
| 236 /******************************************************************************* | |
| 237 | |
| 238 Local prototypes | |
| 239 | |
| 240 *******************************************************************************/ | |
| 241 | |
| 242 | |
| 243 T_MFW_HND voice_memo_start (T_MFW_HND parent_win, SHORT ID); | |
| 244 static T_MFW_HND voice_memo_create (T_MFW_HND parent_win); | |
| 245 static void voice_memo_destroy (T_MFW_HND own_window); | |
| 246 static void voice_memo (T_MFW_HND win, USHORT event, SHORT value, void * parameter); | |
| 247 static int voice_memo_win_cb (T_MFW_EVENT event, T_MFW_WIN * win); | |
| 248 static T_MFW_CB voice_memo_tim_cb (T_MFW_EVENT event, T_MFW_TIM * tc); | |
| 249 static int voice_memo_kbd_cb (T_MFW_EVENT event, T_MFW_KBD * keyboard); | |
| 250 static void voice_memo_dialog_create(T_MFW_HND win, int str1, int str2); | |
| 251 void voice_memo_dialog_cb (T_MFW_HND win, UBYTE identifier, UBYTE reason); | |
| 252 GLOBAL void voice_buffering_playback_start(void ); | |
| 253 /* | |
| 254 ** Rivera Callback functions | |
| 255 */ | |
| 256 static void voice_memo_riv_record_cb(void *parameter); | |
| 257 static void voice_memo_riv_play_cb(void *parameter); | |
| 258 | |
| 259 //x0pleela 02 Mar, 2006 ER:OMAPS00067709 | |
| 260 //Including this header to support number editor | |
| 261 #ifdef FF_PCM_VM_VB | |
| 262 MfwHnd inputVoiceMemoNumberEditor( MfwHnd parent, void *buffer ); | |
| 263 void voiceMemoNumberCB( T_MFW_HND win, USHORT Identifier, UBYTE reason ); | |
| 264 static int voice_buffering_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc); | |
| 265 static void voice_buffering_data_reset( void ); | |
| 266 GLOBAL void voice_buffering_stop_recording(void ); | |
| 267 #endif | |
| 268 /******************************************************************************* | |
| 269 | |
| 270 $Function: voice_memo_init | |
| 271 | |
| 272 $Description: | |
| 273 | |
| 274 $Returns: | |
| 275 | |
| 276 $Arguments: | |
| 277 | |
| 278 *******************************************************************************/ | |
| 279 GLOBAL void voice_memo_init (void) | |
| 280 { | |
| 281 TRACE_FUNCTION ("voice_memo_init()"); | |
| 282 | |
| 283 #ifdef FF_PCM_VM_VB | |
| 284 voice_buffering_data_reset(); | |
| 285 #endif | |
| 286 | |
| 287 } | |
| 288 | |
| 289 /******************************************************************************* | |
| 290 | |
| 291 $Function: voice_memo_exit | |
| 292 | |
| 293 $Description: | |
| 294 | |
| 295 | |
| 296 $Returns: | |
| 297 | |
| 298 $Arguments: | |
| 299 | |
| 300 *******************************************************************************/ | |
| 301 GLOBAL void voice_memo_exit (void) | |
| 302 { | |
| 303 TRACE_FUNCTION ("voice_memo_exit()"); | |
| 304 | |
| 305 } | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 /******************************************************************************* | |
| 311 | |
| 312 $Function: voice_memo_play | |
| 313 | |
| 314 $Description: | |
| 315 | |
| 316 $Returns: | |
| 317 | |
| 318 $Arguments: | |
| 319 | |
| 320 *******************************************************************************/ | |
| 321 GLOBAL int voice_memo_play (MfwMnu* m, MfwMnuItem* i) | |
| 322 { | |
| 323 T_MFW_HND win = mfw_parent(mfw_header()); | |
| 324 | |
| 325 TRACE_FUNCTION ("voice_memo_play()"); | |
| 326 | |
| 327 //x0pleela 27 Feb, 2006 ER: OMAPA00067709 | |
| 328 //Set this variable to VOICE_MEMOwhich indicates voice memo is active | |
| 329 #ifdef FF_PCM_VM_VB | |
| 330 set_voice_memo_type( AMR_VOICE_MEMO); | |
| 331 #endif | |
| 332 | |
| 333 //create a new voice memo dialog | |
| 334 voice_memo_start (win, VM_PLAY); | |
| 335 return 1; // ADDED BY RAVI - 29-11-2005 | |
| 336 } | |
| 337 | |
| 338 /******************************************************************************* | |
| 339 | |
| 340 $Function: voice_memo_storeage | |
| 341 | |
| 342 $Description: | |
| 343 | |
| 344 | |
| 345 $Returns: | |
| 346 | |
| 347 $Arguments: | |
| 348 | |
| 349 *******************************************************************************/ | |
| 350 GLOBAL int PCM_voice_memo_storeage (MfwMnu* m, MfwMnuItem* i) | |
| 351 { | |
| 352 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
| 353 int txtId = TxtFFS; | |
| 354 | |
| 355 TRACE_FUNCTION("mmi_camera_set_storage()"); | |
| 356 | |
| 357 switch (m->lCursor[m->level]) | |
| 358 { | |
| 359 case 0: | |
| 360 txtId = TxtFFS; | |
| 361 FFS_flashData.PCM_voicememo_storage = SNAP_STG_FFS; | |
| 362 break; | |
| 363 | |
| 364 case 1: | |
| 365 txtId = TxtNORMS; | |
| 366 FFS_flashData.PCM_voicememo_storage = SNAP_STG_NORMS; | |
| 367 break; | |
| 368 | |
| 369 case 2: | |
| 370 txtId = TxtNAND; | |
| 371 FFS_flashData.PCM_voicememo_storage = SNAP_STG_NAND; | |
| 372 break; | |
| 373 | |
| 374 case 3: | |
| 375 txtId = TxtTflash; | |
| 376 FFS_flashData.PCM_voicememo_storage = SNAP_STG_MMC; | |
| 377 break; | |
| 378 } | |
| 379 | |
| 380 flash_write(); | |
| 381 //Set the Quality Factor. | |
| 382 TRACE_EVENT_P1("STorage set to %d ", FFS_flashData.PCM_voicememo_storage); | |
| 383 //Display the dialgbox to the user. | |
| 384 voice_memo_dialog_create(parent_win,txtId,TxtSelected); | |
| 385 return MFW_EVENT_CONSUMED; | |
| 386 } | |
| 387 | |
| 388 /******************************************************************************* | |
| 389 | |
| 390 $Function: voice_memo_storeage | |
| 391 | |
| 392 $Description: | |
| 393 | |
| 394 | |
| 395 $Returns: | |
| 396 | |
| 397 $Arguments: | |
| 398 | |
| 399 *******************************************************************************/ | |
| 400 GLOBAL int voice_buffer_storeage (MfwMnu* m, MfwMnuItem* i) | |
| 401 { | |
| 402 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
| 403 int txtId = TxtFFS; | |
| 404 | |
| 405 TRACE_FUNCTION("mmi_camera_set_storage()"); | |
| 406 | |
| 407 switch (m->lCursor[m->level]) | |
| 408 { | |
| 409 case 0: | |
| 410 txtId = TxtFFS; | |
| 411 FFS_flashData.voicebuffer_storage = SNAP_STG_FFS; | |
| 412 break; | |
| 413 | |
| 414 case 1: | |
| 415 txtId = TxtNORMS; | |
| 416 FFS_flashData.voicebuffer_storage = SNAP_STG_NORMS; | |
| 417 break; | |
| 418 | |
| 419 case 2: | |
| 420 txtId = TxtNAND; | |
| 421 FFS_flashData.voicebuffer_storage = SNAP_STG_NAND; | |
| 422 break; | |
| 423 | |
| 424 case 3: | |
| 425 txtId = TxtTflash; | |
| 426 FFS_flashData.voicebuffer_storage = SNAP_STG_MMC; | |
| 427 break; | |
| 428 } | |
| 429 | |
| 430 flash_write(); | |
| 431 //Set the Quality Factor. | |
| 432 TRACE_EVENT_P1("STorage set to %d ", FFS_flashData.voicebuffer_storage); | |
| 433 //Display the dialgbox to the user. | |
| 434 voice_memo_dialog_create(parent_win,txtId,TxtSelected); | |
| 435 return MFW_EVENT_CONSUMED; | |
| 436 } | |
| 437 | |
| 438 /******************************************************************************* | |
| 439 | |
| 440 $Function: voice_memo_storeage | |
| 441 | |
| 442 $Description: | |
| 443 | |
| 444 | |
| 445 $Returns: | |
| 446 | |
| 447 $Arguments: | |
| 448 | |
| 449 *******************************************************************************/ | |
| 450 GLOBAL int voice_memo_storeage (MfwMnu* m, MfwMnuItem* i) | |
| 451 { | |
| 452 T_MFW_HND parent_win = mfwParent(mfw_header()); | |
| 453 int txtId = TxtFFS; | |
| 454 | |
| 455 TRACE_FUNCTION("mmi_camera_set_storage()"); | |
| 456 | |
| 457 switch (m->lCursor[m->level]) | |
| 458 { | |
| 459 case 0: | |
| 460 txtId = TxtFFS; | |
| 461 FFS_flashData.voicememo_storage = SNAP_STG_FFS; | |
| 462 break; | |
| 463 | |
| 464 case 1: | |
| 465 txtId = TxtNORMS; | |
| 466 FFS_flashData.voicememo_storage = SNAP_STG_NORMS; | |
| 467 break; | |
| 468 | |
| 469 case 2: | |
| 470 txtId = TxtNAND; | |
| 471 FFS_flashData.voicememo_storage = SNAP_STG_NAND; | |
| 472 break; | |
| 473 | |
| 474 case 3: | |
| 475 txtId = TxtTflash; | |
| 476 FFS_flashData.voicememo_storage = SNAP_STG_MMC; | |
| 477 break; | |
| 478 } | |
| 479 | |
| 480 flash_write(); | |
| 481 //Set the Quality Factor. | |
| 482 TRACE_EVENT_P1("STorage set to %d ", FFS_flashData.voicememo_storage); | |
| 483 //Display the dialgbox to the user. | |
| 484 voice_memo_dialog_create(parent_win,txtId,TxtSelected); | |
| 485 return MFW_EVENT_CONSUMED; | |
| 486 } | |
| 487 | |
| 488 | |
| 489 /******************************************************************************* | |
| 490 | |
| 491 $Function: voice_memo_record | |
| 492 | |
| 493 $Description: | |
| 494 | |
| 495 | |
| 496 $Returns: | |
| 497 | |
| 498 $Arguments: | |
| 499 | |
| 500 *******************************************************************************/ | |
| 501 GLOBAL int voice_memo_record (MfwMnu* m, MfwMnuItem* i) | |
| 502 { | |
| 503 | |
| 504 T_MFW_HND win = mfw_parent(mfw_header()); | |
| 505 | |
| 506 TRACE_FUNCTION ("voice_memo_record()"); | |
| 507 | |
| 508 //x0pleela 27 Feb, 2006 ER: OMAPA00067709 | |
| 509 //Set this variable to VOICE_MEMOwhich indicates voice memo is active | |
| 510 #ifdef FF_PCM_VM_VB | |
| 511 set_voice_memo_type( AMR_VOICE_MEMO); | |
| 512 #endif | |
| 513 //create a new voice memo dialog | |
| 514 voice_memo_start (win, VM_RECORD); | |
| 515 return 1; // RAVI - 29-11-2005 | |
| 516 } | |
| 517 | |
| 518 | |
| 519 /******************************************************************************* | |
| 520 | |
| 521 $Function: voice_memo_start | |
| 522 | |
| 523 $Description: create a new voicememo dialog | |
| 524 | |
| 525 $Returns: Dialogue info win | |
| 526 | |
| 527 $Arguments: parent win, display info | |
| 528 | |
| 529 *******************************************************************************/ | |
| 530 T_MFW_HND voice_memo_start (T_MFW_HND parent_win, SHORT ID) | |
| 531 { | |
| 532 T_MFW_HND win; | |
| 533 | |
| 534 win = voice_memo_create (parent_win); | |
| 535 | |
| 536 if (win NEQ NULL) | |
| 537 { | |
| 538 SEND_EVENT (win, VM_INIT, ID, 0); | |
| 539 } | |
| 540 return win; | |
| 541 } | |
| 542 | |
| 543 | |
| 544 | |
| 545 /******************************************************************************* | |
| 546 | |
| 547 $Function: vocie_memo_create | |
| 548 | |
| 549 $Description: Creation of window | |
| 550 | |
| 551 $Returns: Dialogue info win | |
| 552 | |
| 553 $Arguments: parent win | |
| 554 | |
| 555 *******************************************************************************/ | |
| 556 static T_MFW_HND voice_memo_create (T_MFW_HND parent_win) | |
| 557 { | |
| 558 T_MFW_WIN * win_data; | |
| 559 T_voice_memo * data = (T_voice_memo *)ALLOC_MEMORY (sizeof (T_voice_memo)); | |
| 560 | |
| 561 TRACE_FUNCTION ("vocie_memo_create()"); | |
| 562 | |
| 563 data->info_win = win_create (parent_win, 0, E_WIN_VISIBLE, (T_MFW_CB)voice_memo_win_cb); | |
| 564 | |
| 565 if (data->info_win EQ 0) | |
| 566 return 0; | |
| 567 | |
| 568 /* | |
| 569 * Create window handler | |
| 570 */ | |
| 571 data->mmi_control.dialog = (T_DIALOG_FUNC)voice_memo; | |
| 572 data->mmi_control.data = data; | |
| 573 data->parent_win = parent_win; | |
| 574 win_data = ((T_MFW_HDR *)data->info_win)->data; | |
| 575 win_data->user = (void *)data; | |
| 576 | |
| 577 /* | |
| 578 ** Initialise values to safe defualts | |
| 579 */ | |
| 580 data->play_sk2 = TxtSoftBack; | |
| 581 | |
| 582 /* | |
| 583 * return window handle | |
| 584 */ | |
| 585 return data->info_win; | |
| 586 } | |
| 587 | |
| 588 | |
| 589 /******************************************************************************* | |
| 590 | |
| 591 $Function: voice_memo_destroy | |
| 592 | |
| 593 $Description: Destruction of an dialog | |
| 594 | |
| 595 $Returns: void | |
| 596 | |
| 597 $Arguments: win | |
| 598 | |
| 599 *******************************************************************************/ | |
| 600 void voice_memo_destroy (T_MFW_HND own_window) | |
| 601 { | |
| 602 T_MFW_WIN * win = ((T_MFW_HDR *)own_window)->data; | |
| 603 T_voice_memo * data = (T_voice_memo *)win->user; | |
| 604 | |
| 605 TRACE_FUNCTION ("voice_memo_destroy()"); | |
| 606 | |
| 607 if (own_window == NULL) | |
| 608 { | |
| 609 TRACE_EVENT ("Error : Called with NULL Pointer"); | |
| 610 return; | |
| 611 } | |
| 612 | |
| 613 if (data) | |
| 614 { | |
| 615 /* | |
| 616 * Exit TIMER & KEYBOARD Handle | |
| 617 */ | |
| 618 kbd_delete (data->info_kbd); | |
| 619 tim_delete (data->info_tim); | |
| 620 | |
| 621 /* | |
| 622 * Delete WIN Handler | |
| 623 */ | |
| 624 win_delete (data->info_win); | |
| 625 /* | |
| 626 * Free Memory | |
| 627 */ | |
| 628 FREE_MEMORY ((void *)data, sizeof (T_voice_memo)); | |
| 629 } | |
| 630 | |
| 631 //x0pleela 27 Feb, 2006 ER: OMAPA00067709 | |
| 632 //Set gVoiceMemo to NONE while destroying voice memo dialog | |
| 633 #ifdef FF_PCM_VM_VB | |
| 634 set_voice_memo_type( NONE); | |
| 635 #endif | |
| 636 } | |
| 637 | |
| 638 | |
| 639 | |
| 640 /******************************************************************************* | |
| 641 | |
| 642 $Function: voice_memo | |
| 643 | |
| 644 $Description: Dialog function for voice memo dialog | |
| 645 | |
| 646 $Returns: void | |
| 647 | |
| 648 $Arguments: win, window handle event, value, parameter | |
| 649 | |
| 650 *******************************************************************************/ | |
| 651 void voice_memo (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
| 652 { | |
| 653 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
| 654 T_voice_memo * data = (T_voice_memo *)win_data->user; | |
| 655 | |
| 656 // T_DISPLAY_DATA display_info; // RAVI | |
| 657 | |
| 658 SHORT mfw_aud_retVal = 0; /* x0039928 - Lint warning fix */ | |
| 659 #ifdef FF_PCM_VM_VB | |
| 660 UBYTE vm_type; //to store voice memo type | |
| 661 #endif | |
| 662 | |
| 663 | |
| 664 data->Identifier = value; | |
| 665 | |
| 666 TRACE_FUNCTION ("voice_memo()"); | |
| 667 | |
| 668 switch (event) | |
| 669 { | |
| 670 case VM_INIT: | |
| 671 TRACE_EVENT ("VM_INIT()"); | |
| 672 /* | |
| 673 * Initialize dialog | |
| 674 */ | |
| 675 | |
| 676 /* | |
| 677 * Create timer and keyboard handler | |
| 678 */ | |
| 679 data->info_tim = tim_create (win, 1000, (T_MFW_CB)voice_memo_tim_cb); | |
| 680 data->info_kbd = kbd_create (win, KEY_ALL, (T_MFW_CB)voice_memo_kbd_cb); | |
| 681 | |
| 682 | |
| 683 if (value EQ VM_PLAY) | |
| 684 { | |
| 685 TRACE_EVENT ("VM_PLAY()"); | |
| 686 | |
| 687 mfw_aud_retVal = mfw_aud_vm_start_playback(voice_memo_riv_play_cb); | |
| 688 | |
| 689 if (mfw_aud_retVal == MFW_AUD_VM_OK) | |
| 690 { | |
| 691 //start the second timer | |
| 692 data->time = 0; | |
| 693 tim_start (data->info_tim); | |
| 694 | |
| 695 //Set the Right Softkey Id | |
| 696 data->play_sk2 = TxtStop; | |
| 697 } | |
| 698 else | |
| 699 { | |
| 700 if (mfw_aud_retVal == MFW_AUD_VM_MEM_EMPTY) | |
| 701 { | |
| 702 voice_memo_dialog_create(win, TxtRecording, TxtEmpty); | |
| 703 } | |
| 704 else | |
| 705 { | |
| 706 //Display a dialog and exit | |
| 707 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_start_playback failed with return value : %d", mfw_aud_retVal); | |
| 708 | |
| 709 voice_memo_dialog_create( win, TxtPlayback, TxtFailed); | |
| 710 } | |
| 711 } | |
| 712 } | |
| 713 else if (value EQ VM_RECORD) | |
| 714 { | |
| 715 TRACE_FUNCTION ("VM_RECORD()"); | |
| 716 //x0pleela 27 Feb, 2006 ER: OMAPA00067709 | |
| 717 //Pass 20 secs time out for PCM voice memo and 10 secs for AMR Voice memo | |
| 718 #ifdef FF_PCM_VM_VB | |
| 719 //get the voice memo type | |
| 720 vm_type = get_voice_memo_type(); | |
| 721 | |
| 722 if(vm_type EQ PCM_VOICE_MEMO) | |
| 723 mfw_aud_retVal = mfw_aud_vm_start_record(PCM_VOICE_MEMO_MAX_DURATION, | |
| 724 voice_memo_riv_record_cb); | |
| 725 else | |
| 726 { | |
| 727 if(vm_type EQ AMR_VOICE_MEMO ) | |
| 728 #endif | |
| 729 mfw_aud_retVal = mfw_aud_vm_start_record(VOICE_MEMO_MAX_DURATION, voice_memo_riv_record_cb); | |
| 730 #ifdef FF_PCM_VM_VB | |
| 731 } | |
| 732 #endif | |
| 733 | |
| 734 // If the Riviera call failed | |
| 735 if (mfw_aud_retVal == MFW_AUD_VM_OK) | |
| 736 { | |
| 737 //start the second timer | |
| 738 data->time = 0; | |
| 739 tim_start (data->info_tim); | |
| 740 } | |
| 741 else | |
| 742 { | |
| 743 if (mfw_aud_retVal == MFW_AUD_VM_MEM_FULL) | |
| 744 { | |
| 745 TRACE_EVENT ("memory full "); | |
| 746 /* RAVI - 20-1-2006 */ | |
| 747 /* Silent Implementation */ | |
| 748 #ifdef NEPTUNE_BOARD | |
| 749 audio_PlaySoundID(0, TONES_KEYBEEP, getCurrentVoulmeSettings(), | |
| 750 AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
| 751 #else | |
| 752 /* play Keybeep */ | |
| 753 audio_PlaySoundID(0, TONES_KEYBEEP, 200, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
| 754 #endif | |
| 755 /* END RAVI */ | |
| 756 | |
| 757 voice_memo_dialog_create( win, TxtRecording, TxtFull ); | |
| 758 } | |
| 759 else | |
| 760 { | |
| 761 //Display a dialog and exit | |
| 762 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_start_record failed with return value : %d", mfw_aud_retVal); | |
| 763 | |
| 764 voice_memo_dialog_create( win, TxtRecording, TxtFailed ); | |
| 765 } | |
| 766 } | |
| 767 } | |
| 768 win_show (win); | |
| 769 break; | |
| 770 | |
| 771 | |
| 772 //if the user selected to clear the Voicememo buffer | |
| 773 case VM_DELETE_BUFFER: | |
| 774 voice_memo_dialog_create( win, TxtDeleted, TxtNull ); | |
| 775 | |
| 776 /* | |
| 777 ** Delete the voice memo file | |
| 778 */ | |
| 779 mfw_aud_vm_delete_file(); | |
| 780 break; | |
| 781 | |
| 782 case VM_DESTROY: | |
| 783 voice_memo_destroy(win); | |
| 784 break; | |
| 785 } | |
| 786 return; | |
| 787 } | |
| 788 | |
| 789 /******************************************************************************* | |
| 790 | |
| 791 $Function: voice_memo_win_cb | |
| 792 | |
| 793 $Description: Callback function for information dialog | |
| 794 | |
| 795 $Returns: void | |
| 796 | |
| 797 $Arguments: window handle event, win | |
| 798 *******************************************************************************/ | |
| 799 static int voice_memo_win_cb (T_MFW_EVENT event, T_MFW_WIN * win) | |
| 800 { | |
| 801 T_voice_memo * data = (T_voice_memo *)win->user; | |
| 802 | |
| 803 TRACE_FUNCTION ("voice_memo_win_cb()"); | |
| 804 | |
| 805 if (data EQ 0) | |
| 806 return 1; | |
| 807 | |
| 808 switch (event) | |
| 809 { | |
| 810 case E_WIN_VISIBLE: | |
| 811 if (win->flags & E_WIN_VISIBLE) | |
| 812 { | |
| 813 /* | |
| 814 * Clear Screen | |
| 815 */ | |
| 816 dspl_ClearAll(); | |
| 817 | |
| 818 switch (data->Identifier) | |
| 819 { | |
| 820 case VM_PLAY: | |
| 821 /* | |
| 822 * Print the information screen | |
| 823 */ | |
| 824 ALIGNED_PROMPT((T_MMI_ALIGN)LEFT,Mmi_layout_line(1),0, TxtPlayback); | |
| 825 | |
| 826 /* | |
| 827 * Print the elapsed time | |
| 828 */ | |
| 829 displayAlignedText(LEFT, Mmi_layout_line(2), 0, data->elapsed_time); | |
| 830 | |
| 831 /* | |
| 832 * Print softkeys | |
| 833 */ | |
| 834 displaySoftKeys(TxtDelete, data->play_sk2); | |
| 835 break; | |
| 836 | |
| 837 case VM_RECORD: | |
| 838 /* | |
| 839 * Print the information screen | |
| 840 */ | |
| 841 ALIGNED_PROMPT((T_MMI_ALIGN)LEFT,Mmi_layout_line(1),0, TxtRecording); | |
| 842 | |
| 843 /* | |
| 844 * Print the elapsed time | |
| 845 */ | |
| 846 displayAlignedText(LEFT, Mmi_layout_line(2), 0, data->elapsed_time); | |
| 847 | |
| 848 /* | |
| 849 * Print softkeys | |
| 850 */ | |
| 851 displaySoftKeys(TxtStop, '\0'); | |
| 852 break; | |
| 853 } | |
| 854 | |
| 855 } | |
| 856 break; | |
| 857 | |
| 858 default: | |
| 859 return 0; | |
| 860 } | |
| 861 return 1; | |
| 862 } | |
| 863 | |
| 864 | |
| 865 /******************************************************************************* | |
| 866 | |
| 867 $Function: voice_memo_tim_cb | |
| 868 | |
| 869 $Description: Callback function for the voice_memo timer. | |
| 870 | |
| 871 | |
| 872 $Returns: MFW event handler | |
| 873 | |
| 874 $Arguments: window handle event, timer control block | |
| 875 | |
| 876 *******************************************************************************/ | |
| 877 static T_MFW_CB voice_memo_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc) | |
| 878 { | |
| 879 T_MFW_HND win = mfw_parent (mfw_header()); | |
| 880 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
| 881 T_voice_memo * data = (T_voice_memo *)win_data->user; | |
| 882 | |
| 883 SHORT mfw_aud_retVal; | |
| 884 //x0pleela 27 Feb, 2006 ER:OMAPS00067709 | |
| 885 //to store PCM/AMR voice memo record/play duration | |
| 886 USHORT vm_duration = 0; /* x0039928 - Lint warning fix */ | |
| 887 // char buf[40]; // RAVI | |
| 888 | |
| 889 //x0pleela 08 Mar, 2006 ER:OMAPS00067709 | |
| 890 #ifdef FF_PCM_VM_VB | |
| 891 UBYTE vm_type; //to store voice memo type | |
| 892 #endif | |
| 893 | |
| 894 TRACE_FUNCTION ("voice_memo_tim_cb()"); | |
| 895 | |
| 896 //x0pleela 27 Feb, 2006 ER:OMAPS00067709 | |
| 897 #ifdef FF_PCM_VM_VB | |
| 898 //x0pleela 06 Mar, 2006 ER:OMAPS00067709 | |
| 899 //get the voice memo type | |
| 900 vm_type = get_voice_memo_type(); | |
| 901 | |
| 902 if(vm_type EQ PCM_VOICE_MEMO) | |
| 903 vm_duration = PCM_VOICE_MEMO_MAX_DURATION; | |
| 904 else | |
| 905 { | |
| 906 if (vm_type EQ AMR_VOICE_MEMO) | |
| 907 #endif | |
| 908 vm_duration = VOICE_MEMO_MAX_DURATION; | |
| 909 #ifdef FF_PCM_VM_VB | |
| 910 } | |
| 911 #endif | |
| 912 | |
| 913 switch (data->Identifier) | |
| 914 { | |
| 915 case VM_PLAY: | |
| 916 //the max. playback time is 10 second | |
| 917 if (data->time < mfw_aud_vm_get_duration()) | |
| 918 { | |
| 919 TRACE_EVENT ("continue the second timer"); | |
| 920 | |
| 921 data->time ++; | |
| 922 // it shows here the elapsed time | |
| 923 sprintf(data->elapsed_time,"%02d sec", data->time); | |
| 924 | |
| 925 TRACE_EVENT (data->elapsed_time); | |
| 926 | |
| 927 //continue the second timer | |
| 928 tim_start (data->info_tim); | |
| 929 } | |
| 930 else | |
| 931 { | |
| 932 data->play_sk2 = TxtSoftBack; | |
| 933 #ifndef _SIMULATION_ | |
| 934 /* | |
| 935 ** Stop playing the Voice Memo. | |
| 936 */ | |
| 937 mfw_aud_retVal = mfw_aud_vm_stop_playback(voice_memo_riv_play_cb); | |
| 938 | |
| 939 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
| 940 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_stop_playback failed with return value : %d", mfw_aud_retVal); | |
| 941 #else | |
| 942 TRACE_EVENT("call mfw_aud_vm_stop_playback()"); | |
| 943 #endif | |
| 944 } | |
| 945 break; | |
| 946 | |
| 947 | |
| 948 case VM_RECORD: | |
| 949 | |
| 950 data->time++; | |
| 951 | |
| 952 if (data->time < vm_duration) | |
| 953 { | |
| 954 TRACE_EVENT ("continue the second timer"); | |
| 955 //x0pleela 27 Feb, 2006 ER:OMAPS00067709 | |
| 956 //changed from Macro VOICE_MEMO_MAX_DURATION to local variable vm_duration | |
| 957 // it shows here the remainig time | |
| 958 sprintf(data->elapsed_time,"%02d sec", (vm_duration - data->time)); | |
| 959 | |
| 960 TRACE_EVENT (data->elapsed_time); | |
| 961 | |
| 962 //continue the second timer | |
| 963 tim_start (data->info_tim); | |
| 964 } | |
| 965 else | |
| 966 { | |
| 967 //x0pleela 27 Feb, 2006 ER:OMAPS00067709 | |
| 968 //changed from Macro VOICE_MEMO_MAX_DURATION to local variable vm_duration | |
| 969 mfw_aud_vm_set_duration(vm_duration); | |
| 970 | |
| 971 #ifndef _SIMULATION_ | |
| 972 /* | |
| 973 ** Stop recording the Voice Memo. | |
| 974 */ | |
| 975 mfw_aud_retVal = mfw_aud_vm_stop_record(voice_memo_riv_record_cb); | |
| 976 | |
| 977 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
| 978 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_stop_record failed with return value : %d", mfw_aud_retVal); | |
| 979 /* RAVI - 20-1-2006 */ | |
| 980 #ifdef NEPTUNE_BOARD | |
| 981 audio_PlaySoundID(0, TONES_KEYBEEP, getCurrentVoulmeSettings(), | |
| 982 AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
| 983 #else | |
| 984 /*the voice memo is now full, show "memory full" */ | |
| 985 audio_PlaySoundID(0, TONES_KEYBEEP, 200, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
| 986 #endif | |
| 987 /* END RAVI */ | |
| 988 | |
| 989 voice_memo_dialog_create( win, TxtRecording, TxtFull ); | |
| 990 #else | |
| 991 TRACE_EVENT("call mfw_aud_vm_stop_record()"); | |
| 992 #endif | |
| 993 } | |
| 994 break; | |
| 995 } | |
| 996 | |
| 997 //Update the screen | |
| 998 winShow(win); | |
| 999 | |
| 1000 return 0; | |
| 1001 } | |
| 1002 | |
| 1003 | |
| 1004 /******************************************************************************* | |
| 1005 | |
| 1006 $Function: voice_memo_kbd_cb | |
| 1007 | |
| 1008 $Description: Keyboard event handler | |
| 1009 | |
| 1010 $Returns: status int | |
| 1011 | |
| 1012 $Arguments: window handle event, keyboard control block | |
| 1013 | |
| 1014 *******************************************************************************/ | |
| 1015 | |
| 1016 static int voice_memo_kbd_cb (T_MFW_EVENT event, T_MFW_KBD *keyboard) | |
| 1017 { | |
| 1018 T_MFW_HND win = mfw_parent (mfw_header()); | |
| 1019 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
| 1020 T_voice_memo * data = (T_voice_memo *)win_data->user; | |
| 1021 | |
| 1022 USHORT Identifier = data->Identifier; | |
| 1023 SHORT mfw_aud_retVal; | |
| 1024 | |
| 1025 | |
| 1026 TRACE_FUNCTION("voice_memo_kbd_cb"); | |
| 1027 | |
| 1028 switch (keyboard->code) | |
| 1029 { | |
| 1030 case KCD_HUP: | |
| 1031 case KCD_LEFT: | |
| 1032 if (Identifier EQ VM_PLAY) | |
| 1033 { | |
| 1034 #ifndef _SIMULATION_ | |
| 1035 /* | |
| 1036 ** Stop playing the Voice Memo and Delete it. | |
| 1037 */ | |
| 1038 mfw_aud_retVal = mfw_aud_vm_stop_playback(voice_memo_riv_play_cb); | |
| 1039 | |
| 1040 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
| 1041 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_stop_playback failed with return value : %d", mfw_aud_retVal); | |
| 1042 #else | |
| 1043 TRACE_EVENT("call mfw_aud_vm_stop_playback()"); | |
| 1044 #endif | |
| 1045 //delete the voicememo buffer | |
| 1046 /* Mar 28, 2007 DR: OMAPS00122762 x0039928 */ | |
| 1047 /* Fix: Commented duration reset */ | |
| 1048 /* mfw_aud_vm_set_duration(0); */ | |
| 1049 | |
| 1050 //user selected the delete-key | |
| 1051 SEND_EVENT (win, VM_DELETE_BUFFER, 0, 0); | |
| 1052 } | |
| 1053 else if (Identifier EQ VM_RECORD) | |
| 1054 { | |
| 1055 mfw_aud_vm_set_duration(data->time); | |
| 1056 | |
| 1057 #ifndef _SIMULATION_ | |
| 1058 /* | |
| 1059 ** Stop recording the Voice Memo. | |
| 1060 */ | |
| 1061 mfw_aud_retVal = mfw_aud_vm_stop_record(voice_memo_riv_record_cb); | |
| 1062 | |
| 1063 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
| 1064 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_stop_record failed with return value : %d", mfw_aud_retVal); | |
| 1065 | |
| 1066 //go back to the previous dialog | |
| 1067 SEND_EVENT (win, VM_DESTROY, 0, 0); | |
| 1068 #else | |
| 1069 TRACE_EVENT("call mfw_aud_vm_stop_record()"); | |
| 1070 #endif | |
| 1071 } | |
| 1072 break; | |
| 1073 | |
| 1074 case KCD_RIGHT: | |
| 1075 if (Identifier EQ VM_PLAY) | |
| 1076 { | |
| 1077 | |
| 1078 #ifndef _SIMULATION_ | |
| 1079 /* | |
| 1080 ** Stop playing the Voice Memo. | |
| 1081 */ | |
| 1082 mfw_aud_retVal = mfw_aud_vm_stop_playback(voice_memo_riv_play_cb); | |
| 1083 | |
| 1084 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
| 1085 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_stop_playback failed with return value : %d", mfw_aud_retVal); | |
| 1086 #else | |
| 1087 TRACE_EVENT("call mfw_aud_vm_stop_playback()"); | |
| 1088 #endif | |
| 1089 | |
| 1090 //go back to the previous dialog | |
| 1091 SEND_EVENT (win, VM_DESTROY, 0, 0); | |
| 1092 } | |
| 1093 else if (Identifier EQ VM_RECORD) | |
| 1094 { | |
| 1095 //nothing | |
| 1096 } | |
| 1097 break; | |
| 1098 | |
| 1099 default: | |
| 1100 break; | |
| 1101 } | |
| 1102 return MFW_EVENT_CONSUMED; | |
| 1103 } | |
| 1104 | |
| 1105 | |
| 1106 /******************************************************************************* | |
| 1107 | |
| 1108 $Function: voice_memo_dialog_cb | |
| 1109 | |
| 1110 $Description: | |
| 1111 | |
| 1112 $Returns: | |
| 1113 | |
| 1114 $Arguments: | |
| 1115 | |
| 1116 *******************************************************************************/ | |
| 1117 void voice_memo_dialog_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason) | |
| 1118 { | |
| 1119 TRACE_FUNCTION ("voice_memo_dialog_cb()"); | |
| 1120 | |
| 1121 switch (reason) | |
| 1122 { | |
| 1123 case INFO_KCD_LEFT: | |
| 1124 /* no break; */ | |
| 1125 case INFO_TIMEOUT: | |
| 1126 /* no break; */ | |
| 1127 case INFO_KCD_HUP: | |
| 1128 /* no break; */ | |
| 1129 case INFO_KCD_RIGHT: | |
| 1130 /* no break; */ | |
| 1131 case INFO_KCD_CLEAR: | |
| 1132 | |
| 1133 //go back to the previous dialog | |
| 1134 SEND_EVENT (win, VM_DESTROY,0, 0); | |
| 1135 | |
| 1136 break; | |
| 1137 } | |
| 1138 } | |
| 1139 | |
| 1140 | |
| 1141 /******************************************************************************* | |
| 1142 | |
| 1143 $Function: voice_memo_dialog_create | |
| 1144 | |
| 1145 $Description: | |
| 1146 | |
| 1147 $Returns: | |
| 1148 | |
| 1149 $Arguments: | |
| 1150 | |
| 1151 *******************************************************************************/ | |
| 1152 static void voice_memo_dialog_create(T_MFW_HND win, int str1, int str2) | |
| 1153 { | |
| 1154 T_DISPLAY_DATA display_info; | |
| 1155 | |
| 1156 TRACE_FUNCTION ("voice_memo_dialog_create()"); | |
| 1157 | |
| 1158 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, str1, str2, COLOUR_STATUS); | |
| 1159 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)voice_memo_dialog_cb, THREE_SECS, KEY_CLEAR | KEY_RIGHT | KEY_LEFT ); | |
| 1160 /* | |
| 1161 * Call Info Screen | |
| 1162 */ | |
| 1163 info_dialog (win, &display_info); | |
| 1164 } | |
| 1165 | |
| 1166 static void voice_memo_riv_record_cb(void *parameter) | |
| 1167 { | |
| 1168 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */ | |
| 1169 #ifndef NEPTUNE_BOARD | |
| 1170 /* END ADD: Req ID: : Sumit : 14-Mar-05 */ | |
| 1171 | |
| 1172 //x0pleela 16 Mar, 2006 ER:OMAPS00067709 | |
| 1173 #ifdef FF_PCM_VM_VB | |
| 1174 UBYTE vm_type; //to store voice memo type | |
| 1175 #endif | |
| 1176 | |
| 1177 | |
| 1178 //x0pleela 16 Mar, 2006 ER:OMAPS00067709 | |
| 1179 #ifdef FF_PCM_VM_VB | |
| 1180 vm_type = get_voice_memo_type(); | |
| 1181 switch( vm_type ) | |
| 1182 { | |
| 1183 case AMR_VOICE_MEMO: | |
| 1184 { | |
| 1185 #endif /* FF_PCM_VM_VB */ | |
| 1186 T_AUDIO_VM_RECORD_STATUS *record_status; | |
| 1187 record_status = (T_AUDIO_VM_RECORD_STATUS *)parameter; | |
| 1188 if (record_status->status != AUDIO_OK) | |
| 1189 { | |
| 1190 TRACE_EVENT_P1("ERROR : voice_memo_riv_record_cb received AUDIO_ERROR, recorded duration is %d", | |
| 1191 record_status->recorded_duration); | |
| 1192 } | |
| 1193 else | |
| 1194 { | |
| 1195 TRACE_EVENT_P1("INFO : voice_memo_riv_record_cb received AUDIO_OK, recorded duration is %d", | |
| 1196 record_status->recorded_duration); | |
| 1197 mfw_aud_vm_set_duration((UINT8)record_status->recorded_duration); | |
| 1198 } | |
| 1199 #ifdef FF_PCM_VM_VB | |
| 1200 } | |
| 1201 break; | |
| 1202 | |
| 1203 case PCM_VOICE_MEMO: | |
| 1204 { | |
| 1205 T_AUDIO_VM_PCM_RECORD_STATUS *pcm_vm_record_status; | |
| 1206 | |
| 1207 pcm_vm_record_status = (T_AUDIO_VM_PCM_RECORD_STATUS *)parameter; | |
| 1208 if (pcm_vm_record_status->status != AUDIO_OK) | |
| 1209 { | |
| 1210 TRACE_EVENT_P1("ERROR : voice_memo_riv_record_cb received AUDIO_ERROR, recorded duration is %d", | |
| 1211 pcm_vm_record_status->recorded_duration); | |
| 1212 } | |
| 1213 else | |
| 1214 { | |
| 1215 TRACE_EVENT_P1("INFO : voice_memo_riv_record_cb received AUDIO_OK, recorded duration is %d", | |
| 1216 pcm_vm_record_status->recorded_duration); | |
| 1217 mfw_aud_vm_set_duration((UINT8)pcm_vm_record_status->recorded_duration); | |
| 1218 } | |
| 1219 } | |
| 1220 break; | |
| 1221 | |
| 1222 case VOICE_BUFFERING: | |
| 1223 { | |
| 1224 T_AUDIO_VBUF_PCM_RECORD_STATUS *vbuf_pcm_record_status; | |
| 1225 | |
| 1226 vbuf_pcm_record_status = (T_AUDIO_VBUF_PCM_RECORD_STATUS *)parameter; | |
| 1227 | |
| 1228 if (vbuf_pcm_record_status->status != AUDIO_OK) | |
| 1229 { | |
| 1230 TRACE_EVENT_P1("ERROR : voice_memo_riv_record_cb received AUDIO_ERROR, recorded duration is %d", | |
| 1231 vbuf_pcm_record_status->recorded_duration); | |
| 1232 } | |
| 1233 else | |
| 1234 { | |
| 1235 TRACE_EVENT_P1("INFO : voice_memo_riv_record_cb received AUDIO_OK, recorded duration is %d", | |
| 1236 vbuf_pcm_record_status->recorded_duration); | |
| 1237 //x0pleela 13 Mar, 2006 ER:OMAPS00067709 | |
| 1238 //check for reason to call record_stop | |
| 1239 switch( voice_buffering_data.rec_stop_reason) | |
| 1240 { | |
| 1241 case CALLING_PARTY_END_CALL: //calling party hangs up | |
| 1242 case CALLED_PARTY_END_CALL: //called party hangs up | |
| 1243 voice_buffering_data.call_active = FALSE; | |
| 1244 break; | |
| 1245 | |
| 1246 case PLAY_ERROR: //recording timeout while playing | |
| 1247 voice_buffering_data.buffering_phase = FALSE; | |
| 1248 break; | |
| 1249 | |
| 1250 case CALL_END_BEF_SETUP: //calling party hangs up before call setup | |
| 1251 case USER_SEL_STOP: //user selected "STOP" option, then just return | |
| 1252 case RECORDING_TIMEOUT: //recording timeout | |
| 1253 case CALLED_PARTY_NOT_AVAILABLE: //not reachable | |
| 1254 default: | |
| 1255 break; | |
| 1256 } | |
| 1257 voice_buffering_data.recording_possible = TRUE; | |
| 1258 voice_buffering_data.incoming_call_discon = FALSE; | |
| 1259 //destroy timer | |
| 1260 timDelete(voice_buffering_data.voice_buffering_tim); | |
| 1261 } | |
| 1262 //x0pleela 03 Apr, 2006 ER: OMAPS00067709 | |
| 1263 //Set voice memo type to NONE | |
| 1264 set_voice_memo_type(NONE); | |
| 1265 } | |
| 1266 | |
| 1267 break; | |
| 1268 | |
| 1269 default: | |
| 1270 break; | |
| 1271 } | |
| 1272 | |
| 1273 | |
| 1274 | |
| 1275 #endif /* FF_PCM_VM_VB */ | |
| 1276 | |
| 1277 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */ | |
| 1278 #endif /* NEPTUNE_BOARD */ | |
| 1279 /* END ADD: Req ID: : Sumit : 14-Mar-05 */ | |
| 1280 | |
| 1281 } | |
| 1282 | |
| 1283 static void voice_memo_riv_play_cb(void *parameter) | |
| 1284 { | |
| 1285 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */ | |
| 1286 #ifndef NEPTUNE_BOARD | |
| 1287 /* END ADD: Req ID: : Sumit : 14-Mar-05 */ | |
| 1288 | |
| 1289 //x0pleela 16 Mar, 2006 ER:OMAPS00067709 | |
| 1290 #ifdef FF_PCM_VM_VB | |
| 1291 UBYTE vm_type; //to store voice memo type | |
| 1292 #endif | |
| 1293 | |
| 1294 //x0pleela 16 Mar, 2006 ER:OMAPS00067709 | |
| 1295 #ifdef FF_PCM_VM_VB | |
| 1296 vm_type = get_voice_memo_type(); | |
| 1297 switch( vm_type ) | |
| 1298 { | |
| 1299 case AMR_VOICE_MEMO: | |
| 1300 { | |
| 1301 #endif /* FF_PCM_VM_VB */ | |
| 1302 | |
| 1303 T_AUDIO_VM_PLAY_STATUS *play_status; | |
| 1304 play_status = (T_AUDIO_VM_PLAY_STATUS *)parameter; | |
| 1305 if (play_status->status != AUDIO_OK) | |
| 1306 { | |
| 1307 TRACE_EVENT("ERROR : voice_memo_riv_play_cb received AUDIO_ERROR"); | |
| 1308 } | |
| 1309 else | |
| 1310 { | |
| 1311 TRACE_EVENT("INFO : voice_memo_riv_play_cb received AUDIO_OK"); | |
| 1312 } | |
| 1313 | |
| 1314 #ifdef FF_PCM_VM_VB | |
| 1315 } | |
| 1316 break; | |
| 1317 | |
| 1318 case PCM_VOICE_MEMO: | |
| 1319 { | |
| 1320 T_AUDIO_VM_PCM_PLAY_STATUS *pcm_vm_play_status; | |
| 1321 pcm_vm_play_status = (T_AUDIO_VM_PCM_PLAY_STATUS *)parameter; | |
| 1322 if (pcm_vm_play_status->status != AUDIO_OK) | |
| 1323 { | |
| 1324 TRACE_EVENT("ERROR : voice_memo_riv_play_cb received AUDIO_ERROR"); | |
| 1325 } | |
| 1326 else | |
| 1327 { | |
| 1328 TRACE_EVENT("INFO : voice_memo_riv_play_cb received AUDIO_OK"); | |
| 1329 } | |
| 1330 } | |
| 1331 break; | |
| 1332 | |
| 1333 case VOICE_BUFFERING: | |
| 1334 { | |
| 1335 T_AUDIO_VBUF_PCM_PLAY_STATUS *voice_buffering_play_status; | |
| 1336 voice_buffering_play_status = (T_AUDIO_VBUF_PCM_PLAY_STATUS *)parameter; | |
| 1337 | |
| 1338 if (voice_buffering_play_status->status != AUDIO_OK) | |
| 1339 { | |
| 1340 TRACE_EVENT("ERROR : voice_memo_riv_play_cb received AUDIO_ERROR"); | |
| 1341 } | |
| 1342 else | |
| 1343 { | |
| 1344 TRACE_EVENT("INFO : voice_memo_riv_play_cb received AUDIO_OK"); | |
| 1345 voice_buffering_data.buffering_phase = FALSE; | |
| 1346 voice_buffering_data.play_stopped = TRUE; | |
| 1347 } | |
| 1348 | |
| 1349 //x0pleela 06 Jul, 2006 DR: OMAPS00067709 | |
| 1350 //Fix from AS team | |
| 1351 vocoder_mute_ul(0); | |
| 1352 | |
| 1353 //x0pleela 03 Apr, 2006 ER: OMAPS00067709 | |
| 1354 //Set voice memo type to NONE | |
| 1355 set_voice_memo_type(NONE); | |
| 1356 } | |
| 1357 | |
| 1358 break; | |
| 1359 | |
| 1360 default: | |
| 1361 break; | |
| 1362 } | |
| 1363 | |
| 1364 | |
| 1365 | |
| 1366 #endif /* FF_PCM_VM_VB */ | |
| 1367 | |
| 1368 /* BEGIN ADD: Req ID: : Sumit : 14-Mar-05 */ | |
| 1369 #endif /* NEPTUNE_BOARD*/ | |
| 1370 /* END ADD: Req ID: : Sumit : 14-Mar-05 */ | |
| 1371 | |
| 1372 } | |
| 1373 | |
| 1374 //x0pleela 24 Feb, 2006 ER OMAPS00067709 | |
| 1375 #ifdef FF_PCM_VM_VB | |
| 1376 | |
| 1377 /******************************************************************************* | |
| 1378 | |
| 1379 $Function: pcm_voice_memo_play | |
| 1380 | |
| 1381 $Description: Sets voice memo type to PCM_VOICE_MEMO which indicates PCM voice memo is | |
| 1382 active and start playing the voice | |
| 1383 | |
| 1384 $Returns: | |
| 1385 | |
| 1386 $Arguments: | |
| 1387 | |
| 1388 *******************************************************************************/ | |
| 1389 GLOBAL int pcm_voice_memo_play (MfwMnu* m, MfwMnuItem* i) | |
| 1390 { | |
| 1391 T_MFW_HND win = mfw_parent(mfw_header()); | |
| 1392 | |
| 1393 TRACE_FUNCTION ("pcm_voice_memo_play()"); | |
| 1394 | |
| 1395 //x0pleela 27 Feb, 2006 ER: OMAPA00067709 | |
| 1396 //Set this variable to PCM_VOICE_MEMO which indicates PCM voice memo is active | |
| 1397 set_voice_memo_type( PCM_VOICE_MEMO); | |
| 1398 //create a new voice memo dialog | |
| 1399 voice_memo_start (win, VM_PLAY); | |
| 1400 return 1; | |
| 1401 } | |
| 1402 | |
| 1403 /******************************************************************************* | |
| 1404 | |
| 1405 $Function: pcm_voice_memo_record | |
| 1406 | |
| 1407 $Description: Sets voice memo type to PCM_VOICE_MEMO which indicates PCM voice memo is | |
| 1408 active and start recording the voice | |
| 1409 | |
| 1410 | |
| 1411 $Returns: | |
| 1412 | |
| 1413 $Arguments: | |
| 1414 | |
| 1415 *******************************************************************************/ | |
| 1416 GLOBAL int pcm_voice_memo_record (MfwMnu* m, MfwMnuItem* i) | |
| 1417 { | |
| 1418 T_MFW_HND win = mfw_parent(mfw_header()); | |
| 1419 | |
| 1420 TRACE_FUNCTION ("pcm_voice_memo_record()"); | |
| 1421 | |
| 1422 //x0pleela 27 Feb, 2006 ER: OMAPA00067709 | |
| 1423 //Set this variable to PCM_VOICE_MEMO which indicates PCM voice memo is active | |
| 1424 set_voice_memo_type( PCM_VOICE_MEMO); | |
| 1425 //create a new voice memo dialog | |
| 1426 voice_memo_start (win, VM_RECORD); | |
| 1427 return 1; | |
| 1428 } | |
| 1429 | |
| 1430 /******************************************************************************* | |
| 1431 | |
| 1432 $Function: voice_buffering_edit_num | |
| 1433 | |
| 1434 $Description: Opens an edtor for the user to enter PTT number. Also resets voice buffering data | |
| 1435 with default values | |
| 1436 | |
| 1437 $Returns: | |
| 1438 | |
| 1439 $Arguments: | |
| 1440 | |
| 1441 *******************************************************************************/ | |
| 1442 GLOBAL int voice_buffering_edit_num (MfwMnu* m, MfwMnuItem* i) | |
| 1443 { | |
| 1444 T_MFW_HND win = mfw_parent(mfw_header()); | |
| 1445 T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data; | |
| 1446 tBookStandard *data = (tBookStandard *) win_data->user; | |
| 1447 T_phbk *Phbk = data->phbk; | |
| 1448 | |
| 1449 TRACE_FUNCTION ("voice_buffering_edit_num()"); | |
| 1450 | |
| 1451 set_voice_memo_type( VOICE_BUFFERING ); | |
| 1452 | |
| 1453 memset( Phbk->phbk->edt_buf_number, '\0', PHB_MAX_LEN ); | |
| 1454 Phbk->input_number_win = inputVoiceMemoNumberEditor( win, Phbk->edt_buf_number ); | |
| 1455 | |
| 1456 //Reset voice buffering data with default values | |
| 1457 voice_buffering_data_reset(); | |
| 1458 | |
| 1459 /* Always return event consumed */ | |
| 1460 return MFW_EVENT_CONSUMED; | |
| 1461 } | |
| 1462 | |
| 1463 /******************************************************************************* | |
| 1464 | |
| 1465 $Function: voiceMemoNumberCB | |
| 1466 | |
| 1467 $Description: Call back for number entry | |
| 1468 | |
| 1469 $Returns: None | |
| 1470 | |
| 1471 $Arguments: win, parent window, reason, for call back | |
| 1472 | |
| 1473 *******************************************************************************/ | |
| 1474 | |
| 1475 void voiceMemoNumberCB( T_MFW_HND win, USHORT Identifier, UBYTE reason ) | |
| 1476 { | |
| 1477 T_MFW_WIN *win_data = ( (T_MFW_HDR *) win )->data; | |
| 1478 tBookStandard *data = (tBookStandard *) win_data->user; | |
| 1479 | |
| 1480 TRACE_FUNCTION("voiceMemoNumberCB()"); | |
| 1481 | |
| 1482 switch ( reason ) | |
| 1483 { | |
| 1484 case INFO_KCD_LEFT: | |
| 1485 { | |
| 1486 //copy phone number to global | |
| 1487 memset( voice_buffering_data.vb_PTTnum, 0, PHB_MAX_LEN ); | |
| 1488 memcpy( voice_buffering_data.vb_PTTnum, data->phbk->edt_buf_number, strlen(data->phbk->edt_buf_number) ); | |
| 1489 SEND_EVENT( data->phbk->input_number_win, E_ED_DESTROY, 0, 0 ); | |
| 1490 data->phbk->input_number_win = 0; | |
| 1491 } | |
| 1492 break; | |
| 1493 | |
| 1494 case INFO_KCD_RIGHT: | |
| 1495 case INFO_KCD_HUP: | |
| 1496 { | |
| 1497 AUI_edit_Destroy( data->phbk->input_number_win ); | |
| 1498 data->phbk->input_number_win = 0; | |
| 1499 } | |
| 1500 break; | |
| 1501 | |
| 1502 default: | |
| 1503 { | |
| 1504 /* otherwise no action to be performed | |
| 1505 */ | |
| 1506 break; | |
| 1507 } | |
| 1508 } | |
| 1509 } | |
| 1510 /******************************************************************************* | |
| 1511 | |
| 1512 $Function: inputVoiceMemoNumberEditor | |
| 1513 | |
| 1514 $Description: Settings of Editor | |
| 1515 | |
| 1516 $Returns: | |
| 1517 | |
| 1518 $Arguments: | |
| 1519 | |
| 1520 *******************************************************************************/ | |
| 1521 MfwHnd inputVoiceMemoNumberEditor( MfwHnd parent, void *buffer ) | |
| 1522 { | |
| 1523 T_AUI_EDITOR_DATA editor_data; | |
| 1524 | |
| 1525 TRACE_FUNCTION ("inputVoiceMemoNumberEditor()"); | |
| 1526 | |
| 1527 AUI_edit_SetDefault(&editor_data); | |
| 1528 AUI_edit_SetDisplay(&editor_data, NUMBER_EDITOR, COLOUR_EDITOR_XX, EDITOR_FONT); | |
| 1529 AUI_edit_SetEvents(&editor_data, 0, FALSE, FOREVER, (T_AUI_EDIT_CB)voiceMemoNumberCB); | |
| 1530 AUI_edit_SetTextStr(&editor_data, TxtSoftOK, TxtDelete, TxtEnterNumber, NULL); | |
| 1531 AUI_edit_SetAltTextStr(&editor_data, 0, NULL, TRUE, TxtSoftBack); | |
| 1532 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, (UBYTE *)buffer, NUMBER_LENGTH); | |
| 1533 AUI_edit_SetMode(&editor_data, 0, ED_CURSOR_UNDERLINE); | |
| 1534 | |
| 1535 return AUI_edit_Start(parent, &editor_data); | |
| 1536 } | |
| 1537 | |
| 1538 /******************************************************************************* | |
| 1539 $Function: voice_buffering_record_start | |
| 1540 | |
| 1541 $Description: Starts recording voice and conects to the PTT number if the call is not active. | |
| 1542 If in call, then start playing the voice | |
| 1543 | |
| 1544 $Returns: | |
| 1545 | |
| 1546 $Arguments: | |
| 1547 | |
| 1548 *******************************************************************************/ | |
| 1549 GLOBAL int voice_buffering_record_start (MfwMnu* m, MfwMnuItem* i) | |
| 1550 { | |
| 1551 T_MFW_HND win = mfw_parent(mfw_header()); | |
| 1552 SHORT mfw_aud_retVal; | |
| 1553 | |
| 1554 TRACE_FUNCTION ("voice_buffering_record_start()"); | |
| 1555 TRACE_EVENT_P1("PTT#: %s", voice_buffering_data.vb_PTTnum); | |
| 1556 | |
| 1557 set_voice_memo_type( VOICE_BUFFERING ); | |
| 1558 | |
| 1559 //store window handler | |
| 1560 voice_buffering_data.win_hnd = win; | |
| 1561 | |
| 1562 if( voice_buffering_data.recording_possible ) | |
| 1563 { | |
| 1564 //create timer | |
| 1565 voice_buffering_data.voice_buffering_tim= tim_create (win, 20000, | |
| 1566 (T_MFW_CB)voice_buffering_tim_cb); | |
| 1567 //start timer | |
| 1568 timStart(voice_buffering_data.voice_buffering_tim); | |
| 1569 voice_buffering_data.buffering_phase = TRUE; | |
| 1570 voice_buffering_data.recording_possible = FALSE; | |
| 1571 | |
| 1572 mfw_aud_retVal = mfw_aud_vm_start_record(PCM_VOICE_MEMO_MAX_DURATION, | |
| 1573 voice_memo_riv_record_cb); | |
| 1574 if(voice_buffering_data.call_active ) | |
| 1575 { | |
| 1576 //start playing the recorded voice | |
| 1577 voice_buffering_playback_start(); | |
| 1578 } | |
| 1579 else | |
| 1580 { | |
| 1581 //call PTT number | |
| 1582 callNumber((UBYTE*)voice_buffering_data.vb_PTTnum); | |
| 1583 } | |
| 1584 | |
| 1585 // If the Riviera call failed | |
| 1586 if (mfw_aud_retVal EQ MFW_AUD_VM_OK) | |
| 1587 { | |
| 1588 //no action to be performed | |
| 1589 } | |
| 1590 else | |
| 1591 { | |
| 1592 if (mfw_aud_retVal == MFW_AUD_VM_MEM_FULL) | |
| 1593 { | |
| 1594 TRACE_EVENT ("memory full "); | |
| 1595 /* Silent Implementation */ | |
| 1596 /* play Keybeep */ | |
| 1597 audio_PlaySoundID(0, TONES_KEYBEEP, 200, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */ | |
| 1598 | |
| 1599 voice_memo_dialog_create( win, TxtRecording, TxtFull ); | |
| 1600 } | |
| 1601 else | |
| 1602 { | |
| 1603 //Display a dialog and exit | |
| 1604 TRACE_EVENT_P1 ("ERROR : voice_buffering_record_start failed with return value : %d", mfw_aud_retVal); | |
| 1605 | |
| 1606 voice_memo_dialog_create( win, TxtRecording, TxtFailed ); | |
| 1607 } | |
| 1608 } | |
| 1609 } | |
| 1610 else | |
| 1611 { | |
| 1612 //Display a dialog saying "Already Recording" | |
| 1613 voice_memo_dialog_create(win, TxtAlready, TxtRecording); | |
| 1614 } | |
| 1615 win_show (win); | |
| 1616 return 1; | |
| 1617 } | |
| 1618 | |
| 1619 /******************************************************************************* | |
| 1620 | |
| 1621 $Function: voice_buffering_record_stop | |
| 1622 | |
| 1623 $Description: Stops the timer and recording. If call is not active the disconnects the call | |
| 1624 | |
| 1625 $Returns: | |
| 1626 | |
| 1627 $Arguments: | |
| 1628 | |
| 1629 *******************************************************************************/ | |
| 1630 GLOBAL int voice_buffering_record_stop (MfwMnu* m, MfwMnuItem* i) | |
| 1631 { | |
| 1632 T_MFW_HND win = mfw_parent(mfw_header()); | |
| 1633 | |
| 1634 TRACE_FUNCTION ("voice_buffering_record_stop()"); | |
| 1635 | |
| 1636 set_voice_memo_type ( VOICE_BUFFERING ); | |
| 1637 | |
| 1638 //store window handler | |
| 1639 voice_buffering_data.win_hnd = win; | |
| 1640 | |
| 1641 voice_buffering_data.rec_stop_reason = USER_SEL_STOP; | |
| 1642 voice_buffering_data.recording_possible = TRUE; | |
| 1643 | |
| 1644 if(!voice_buffering_data.call_active ) | |
| 1645 { | |
| 1646 //stop the timer, if recording | |
| 1647 timStop(voice_buffering_data.voice_buffering_tim); | |
| 1648 | |
| 1649 /* destroy the redial windows if exit*/ | |
| 1650 cm_redial_abort(); | |
| 1651 cm_disconnect(call_data.outCall); | |
| 1652 | |
| 1653 if (!call_data.calls.numCalls) | |
| 1654 { | |
| 1655 call_data.ignore_disconnect = TRUE; | |
| 1656 call_destroy(call_data.win); | |
| 1657 } | |
| 1658 } | |
| 1659 else | |
| 1660 { | |
| 1661 //Stop recording | |
| 1662 voice_buffering_stop_recording(); | |
| 1663 } | |
| 1664 | |
| 1665 return 1; | |
| 1666 } | |
| 1667 | |
| 1668 /******************************************************************************* | |
| 1669 | |
| 1670 $Function: voice_buffering_playback_start | |
| 1671 | |
| 1672 $Description: Starts playing the voice. If any error while playing, stops timer and recording | |
| 1673 | |
| 1674 $Returns: | |
| 1675 | |
| 1676 $Arguments: | |
| 1677 | |
| 1678 *******************************************************************************/ | |
| 1679 GLOBAL void voice_buffering_playback_start(void ) | |
| 1680 { | |
| 1681 SHORT mfw_aud_retVal; | |
| 1682 | |
| 1683 TRACE_FUNCTION ("voice_buffering_playback_start()"); | |
| 1684 | |
| 1685 voice_buffering_data.buffering_phase = TRUE; | |
| 1686 mfw_aud_retVal = mfw_aud_vm_start_playback(voice_memo_riv_play_cb); | |
| 1687 if (mfw_aud_retVal == MFW_AUD_VM_OK) | |
| 1688 { | |
| 1689 //no action to be performed | |
| 1690 } | |
| 1691 else | |
| 1692 { | |
| 1693 if (mfw_aud_retVal == MFW_AUD_VM_MEM_EMPTY) | |
| 1694 { | |
| 1695 voice_memo_dialog_create(voice_buffering_data.win_hnd, TxtRecording, TxtEmpty); | |
| 1696 } | |
| 1697 else | |
| 1698 { | |
| 1699 //Display a dialog and exit | |
| 1700 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_start_playback failed with return value : %d", mfw_aud_retVal); | |
| 1701 voice_memo_dialog_create( voice_buffering_data.win_hnd, TxtPlayback, TxtFailed); | |
| 1702 | |
| 1703 //update the reason to stop recording | |
| 1704 voice_buffering_data.rec_stop_reason = PLAY_ERROR; | |
| 1705 | |
| 1706 //stop recording | |
| 1707 voice_buffering_stop_recording(); | |
| 1708 } | |
| 1709 } | |
| 1710 return; | |
| 1711 } | |
| 1712 | |
| 1713 /******************************************************************************* | |
| 1714 | |
| 1715 $Function: voice_buffering_stop_recording | |
| 1716 | |
| 1717 $Description: A wrapper function for record stop to invoke from other modules. | |
| 1718 Stops the timer and recording | |
| 1719 | |
| 1720 $Returns: | |
| 1721 | |
| 1722 $Arguments: | |
| 1723 | |
| 1724 *******************************************************************************/ | |
| 1725 GLOBAL void voice_buffering_stop_recording(void ) | |
| 1726 { | |
| 1727 SHORT mfw_aud_retVal; | |
| 1728 | |
| 1729 TRACE_FUNCTION ("voice_buffering_stop_recording()"); | |
| 1730 | |
| 1731 //stop the timer, if recording | |
| 1732 timStop(voice_buffering_data.voice_buffering_tim); | |
| 1733 | |
| 1734 mfw_aud_retVal = mfw_aud_vm_stop_record(voice_memo_riv_record_cb); | |
| 1735 | |
| 1736 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
| 1737 { | |
| 1738 TRACE_EVENT_P1 ("ERROR : voice_buffering_record_stop failed with return value : %d", mfw_aud_retVal); | |
| 1739 | |
| 1740 //display dialog saying "Recording Stop Failed" | |
| 1741 voice_memo_dialog_create( voice_buffering_data.win_hnd, TxtRecord, TxtStopFailed ); | |
| 1742 } | |
| 1743 return; | |
| 1744 } | |
| 1745 | |
| 1746 /******************************************************************************* | |
| 1747 | |
| 1748 $Function: voice_buffering_stop_playing | |
| 1749 | |
| 1750 $Description: A wrapper function for play stop to invoke from other modules. | |
| 1751 | |
| 1752 $Returns: | |
| 1753 | |
| 1754 $Arguments: | |
| 1755 | |
| 1756 *******************************************************************************/ | |
| 1757 GLOBAL void voice_buffering_stop_playing(void ) | |
| 1758 { | |
| 1759 SHORT mfw_aud_retVal; | |
| 1760 | |
| 1761 TRACE_FUNCTION ("voice_buffering_stop_playing()"); | |
| 1762 | |
| 1763 mfw_aud_retVal = mfw_aud_vm_stop_playback(voice_memo_riv_play_cb); | |
| 1764 | |
| 1765 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
| 1766 { | |
| 1767 TRACE_EVENT_P1 ("ERROR : voice_buffering_record_stop failed with return value : %d", mfw_aud_retVal); | |
| 1768 | |
| 1769 //display dialog saying "Recording Stop Failed" | |
| 1770 voice_memo_dialog_create( voice_buffering_data.win_hnd, TxtPlay, TxtStopFailed ); | |
| 1771 } | |
| 1772 return; | |
| 1773 } | |
| 1774 | |
| 1775 | |
| 1776 /******************************************************************************* | |
| 1777 | |
| 1778 $Function: voice_memo_tim_cb | |
| 1779 | |
| 1780 $Description: Timer callback. Stops the timer. If PTT call is not setup disconnect the call, | |
| 1781 else call record stop | |
| 1782 | |
| 1783 $Returns: | |
| 1784 | |
| 1785 $Arguments: | |
| 1786 | |
| 1787 *******************************************************************************/ | |
| 1788 static int voice_buffering_tim_cb (T_MFW_EVENT event, T_MFW_TIM *tc) | |
| 1789 { | |
| 1790 T_MFW_HND win = mfw_parent (mfw_header()); | |
| 1791 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; | |
| 1792 T_voice_buffering * data = (T_voice_buffering *)win_data->user; | |
| 1793 SHORT mfw_aud_retVal; | |
| 1794 | |
| 1795 TRACE_FUNCTION("voice_buffering_tim_cb()"); | |
| 1796 //get the voice memo type | |
| 1797 if( ( get_voice_memo_type() EQ VOICE_BUFFERING ) AND ( data->voice_buffering_tim ) ) | |
| 1798 { | |
| 1799 timStop(voice_buffering_data.voice_buffering_tim); | |
| 1800 } | |
| 1801 voice_buffering_data.rec_stop_reason = RECORDING_TIMEOUT; | |
| 1802 | |
| 1803 if( !voice_buffering_data.call_active ) //timeout before call setup | |
| 1804 { | |
| 1805 cm_disconnect(call_data.outCall); | |
| 1806 | |
| 1807 if (!call_data.calls.numCalls) | |
| 1808 { | |
| 1809 call_data.ignore_disconnect = TRUE; | |
| 1810 call_destroy(call_data.win); | |
| 1811 } | |
| 1812 } | |
| 1813 else //timeout after call setup | |
| 1814 { | |
| 1815 mfw_aud_retVal = mfw_aud_vm_stop_record(voice_memo_riv_record_cb); | |
| 1816 | |
| 1817 if (mfw_aud_retVal != MFW_AUD_VM_OK) | |
| 1818 { | |
| 1819 TRACE_EVENT_P1 ("ERROR : mfw_aud_vm_stop_record failed with return value : %d", mfw_aud_retVal); | |
| 1820 | |
| 1821 //display dialog saying "Recording Stop Failed" | |
| 1822 voice_memo_dialog_create( voice_buffering_data.win_hnd, TxtRecording, TxtStopFailed ); | |
| 1823 } | |
| 1824 } | |
| 1825 | |
| 1826 return MFW_EVENT_CONSUMED; | |
| 1827 } | |
| 1828 | |
| 1829 /******************************************************************************* | |
| 1830 | |
| 1831 $Function: voice_buffering_data_reset | |
| 1832 | |
| 1833 $Description: Resets voice buffering data to default values | |
| 1834 | |
| 1835 $Returns: | |
| 1836 | |
| 1837 $Arguments: | |
| 1838 | |
| 1839 *******************************************************************************/ | |
| 1840 static void voice_buffering_data_reset( void ) | |
| 1841 { | |
| 1842 TRACE_FUNCTION("voice_buffering_data_reset()"); | |
| 1843 | |
| 1844 voice_buffering_data.win_hnd = 0; | |
| 1845 voice_buffering_data.voice_buffering_tim = 0; | |
| 1846 memset( voice_buffering_data.vb_PTTnum, 0, PTT_NUM_LEN ); | |
| 1847 voice_buffering_data.rec_stop_reason = VB_NONE; | |
| 1848 voice_buffering_data.call_active = FALSE; | |
| 1849 voice_buffering_data.recording_possible = TRUE; | |
| 1850 voice_buffering_data.buffering_phase = FALSE; | |
| 1851 voice_buffering_data.incoming_call_discon = FALSE; | |
| 1852 voice_buffering_data.play_stopped = FALSE; | |
| 1853 | |
| 1854 } | |
| 1855 #endif |
