comparison src/ui3/bmi/mmiSounds.c @ 421:6a4d9f47793e

src/ui3/bmi: file renames to make the case consistent
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 21 Jan 2018 03:28:53 +0000
parents src/ui3/bmi/MmiSounds.c@e8ddbb0837ed
children
comparison
equal deleted inserted replaced
420:e8ddbb0837ed 421:6a4d9f47793e
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: Sounds
15 $File: MmiSounds.c
16 $Revision: 1.0
17
18 $Author: Condat(UK)
19 $Date: 25/10/00
20
21 ********************************************************************************
22
23 Description:
24
25 This provides the implementation of the sounds for the basic MMI
26
27 1. Playing various system sounds such as the paging ring,
28 new sms message etc.
29 2. The menus used to enable or disable the system sounds
30 3. The menu used to select the paging ring tone
31 4. The menu used to select the volume.
32 5. The menu used to select the key press tone or dtmf
33
34 The mmi should play system sounds by calling soundExec with the appropriate
35 SoundsXXXX message it is possible to go directly to the audio driver to play
36 a sound but this will bypass any user settings to turn sounds on or off.
37
38 The MelodySelect and SettingXXXX messages are used to control the key events
39 during menu handling, entry to the sounds menus is through the soundsXXXX
40 functions. These display the appropriate menu and handle the keypad events.
41
42 The settings are read from PCM on startup and saved whenever a setting menu
43 is selected.
44
45 ********************************************************************************
46 $History: MmiSounds.c
47
48 Apr 09, 2008 DRT: OMAPS00163752 including changes from OMAPS00151417 x0086292
49 Description: Rapid Scrolling of Ringer melodies will lockup phone
50 Solution: Board froze when sending to many messages to AS task to stop audio, which froze
51 the board whenever there were too many messages in queue. Instead we can check if
52 audio is being played internally before sending stop message.
53
54 Nov 06, 2007 DRT: OMAPS00151698 x0056422
55 Description: BMI requirments needed to support Bluetooth AVRCP in Locosto 5.x
56 Solution : In mfw_audResume, Pause, Stop functions, if BT is connected, send a callback.
57 In the case of audio play, handle the callback of START_IND from audio task and
58 post a callback to BT if expected.
59
60 August 01, 2007 DR: OMAPS00137399 x0080701 (Bharat)
61 Description: COMBO PLUS: Voice can not be heard in a call when MP3 tone was set
62 Have an MP3 tone set as Ringer. Make a call to the target.
63 Accept the same, no voice can be heard from the calling
64 device or from the board that received
65 Issue: Timing Synchronization Issue between BMI-ACI-L1.
66 BMI calls sAT_A to accept the call. ACI then sends the RING_OFF signal
67 to BMI, wherein BMI does a Ringer Stop. After this, ACI calls Vocoder
68 Enable. However, the Ringer Stop goes to L1 much later after Vocoder
69 Enable reaches L1 due to which the Vocoder eventually gets disabled.
70 Solution: The Vocoder Enable Implementation is removed from ACI and
71 shall be called by BMI on receipt of AS_STOP_IND
72 (AS_STOP_IND is the message sent by AS to BMI when BMI invokes
73 as_stop for ringer_stop). This way, it is assured that the Vocoder
74 Enable Request reaches L1 only after Ringer Stop is completely done
75
76 April 25, 2007 DVT: OMAPS128828 x0061088(Prachi)
77 Description: E1 Melody support
78 Solution: Now E1 Melody will be supported through ringer.
79
80 Mar 30, 2007 REF: OMAPS00122691 x0039928
81 Description: COMBO: No melody heard on parsing over different volums in tones menu
82 Solution: Filename is passed with complete path to the audio service api.
83
84 Dec 05, 2006 ERT: OMAPS00101906 x0039928
85 Description: WAV format support on Locosto
86 Solution: .wav files are populated.
87
88 Nov 23, 2006 ERT: OMAPS00101348 x0039928
89 Description: Open BAE support for SMS for Nokia Smart Messaging melody
90 Solution: .sms files are populated.
91
92 Nov 07, 2006 ER: OMAPS00102732 x0pleela
93 Description: FFS Support for Intel Sibley Flash - Intel 256+64 non-ADMUX (PF38F4050M0Y0C0Q)
94 Solution: Closing the opened directory if readdir is not successful and the new code
95 is under the compilation flag FF_MMI_RELIANCE_FFS
96
97 25/10/00 Original Condat(UK) BMI version.
98
99 Sep 26, 2006 DR: OMAPS00096365 x0pleela
100 Description: Play All Files option does not play all the midi files second time
101 Solution:Reset the index to -1 to avoid playing only the last file in function sounds_midi_player_start_cb()
102
103 Sep 11, 2006 DR: OMAPS00094182 xrashmic
104 Description: midi and mp3 files is not being populated on accessing corresponding menu, but only during bootup
105 Solution: Populate files on accessing the "browse files" list
106
107 Aug 08, 2006 REF:DRT OMAPS00085889 x0039928
108 Description: no sound when played voice memo just after listening a midi file
109 Solution: stereo path is unset after reaching end of the file.
110
111 Jun 06, 2006 REF:ER OMAPS00080844 xdeepadh
112 Description: duplication of midi files in ffs area
113 Solution: The code to create and load the midi files from FFS to LFS is
114 removed.
115
116 Nov 23, 2005 REF : DR OMAPS00057378 x0039928
117 Bug: All MIDI files are not displayed in MMI in locosto-lite
118 Fix: Buffer memory allocated to copy the file contents is freed
119 properly and copying file from FFS to LFS is not terminated if error is
120 returned for just any one file, instead it tries to copy other files.
121
122 Nov 21, 2005 REF:ER OMAPS00057430 nekkareb
123 Description: AAC Ringer Implementation
124 Solution: The Midi Ringer application has been enhanced to support AAC as ringer.
125
126 Nov 04, 2005 REF:DRT OMAPS00053737 xdeepadh
127 Description: MIDI Ringer Linear Flash Support.
128 Solution: The Midi Ringer application has been enhanced to loadand play the midi files from LFS.
129
130 Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh
131 Description: Mp3 Ringer Implementation
132 Solution: The Midi Ringer application has been enhanced to support mp3 as ringer.
133 The interface function names have been modified.
134
135 Sep 12, 2005 REF: SPR 33977 xdeepadh
136 Description: Midi Application does not support Mobile XMF file formats
137 Solution: Mobile XMF format has been supported
138
139 Aug 30, 2005 REF: SPR 34018 xdeepadh
140 Description: Silent Mode: Silent mode is not activated with the sequence, 'Menu, '#''
141 Solution: When the silent mode is set through the key sequence, the volume is set to silent.
142
143
144 Jul 20, 2005 REF: SPR 30772 xdeepadh
145 Description: Midi File formats to be supported by different variants of locosto program
146 Solution: The supported midi file formats for a particular variant will be loaded.
147
148 Aug 05, 2005 xdeepadh
149 Description: Configuring the audio path for midi
150
151 Apr 05, 2005 REF: ENH 29994 xdeepadh
152 Description: Implementation of Generic Midi Ringer and Modification of existing Midi Test Application
153 Solution: Generic Midi Ringer and Midi Test Application were implemented.
154
155 Nov 29, 2004 REF: CRR 25051 xkundadu
156 Description: INCALL SCREEN ?ADJUSTING THE VOLUME
157 Fix: Added volume level list linked to up/down keys.
158 User can select the speaker volume among those levels.
159 Dec 23, 2005 REF: SR13873 x0020906
160 Description: Selection configurable ring tones. Added for NEPTUNE
161 Fix: When moving cursor in menu, stop old and play new ringtone.
162 When press of back / clear / hang up stop playing the ringtone.
163 Initially when the get into list, start playing first ringtone - As cursor is positioned.
164
165 $End
166
167 *******************************************************************************/
168
169
170 /*******************************************************************************
171
172 Include Files
173
174 *******************************************************************************/
175
176 #define ENTITY_MFW
177
178 /* includes */
179 #include <string.h>
180 #include <stdio.h>
181 #include <stdlib.h>
182
183 #if defined (NEW_FRAME)
184
185 #include "typedefs.h"
186 #include "vsi.h"
187 #include "pei.h"
188 #include "custom.h"
189 #include "gsm.h"
190
191 #else
192
193 #include "STDDEFS.H"
194 #include "custom.h"
195 #include "gsm.h"
196 #include "vsi.h"
197
198 #endif
199 #include "mfw_sys.h"
200
201 #include "mfw_mfw.h"
202 #include "mfw_kbd.h"
203 #include "mfw_tim.h"
204 #include "mfw_lng.h"
205 #include "mfw_win.h"
206 #include "mfw_icn.h"
207 #include "mfw_sim.h"
208 #include "mfw_nm.h"
209 /* SPR#1428 - SH - New Editor changes */
210 #ifndef NEW_EDITOR
211 #include "mfw_edt.h"
212 #endif
213 #include "mfw_mnu.h"
214 #include "mfw_phb.h"
215 #include "mfw_sms.h"
216
217 //Apr 05, 2005 REF: ENH 29994 xdeepadh
218 #ifdef FF_MIDI_RINGER
219 #include "mfw_midi.h"
220
221 #ifdef FF_MMI_MIDI_FORMAT
222 #include "bae/bae_options.h" //Jul 20, 2005 REF: SPR 30772 xdeepadh
223 #endif
224
225 #endif
226
227 #include "dspl.h"
228
229
230 #include "p_mmi.h"
231 #include "message.h"
232 #include "prim.h"
233 #include "aci_cmh.h"
234 #include "mfw_mme.h"
235
236 #include "MmiMmi.h"
237
238 #include "Mmiicons.h"
239 #include "MmiPins.h"
240 #include "MmiMain.h"
241 #include "MmiDialogs.h"
242 #include "MmiIdle.h"
243 #include "MmiStart.h"
244 #include "mmiCall.h"
245 #include "MmiSimToolkit.h"
246 #include "gdi.h"
247 #include "audio.h"
248 #include "MmiLists.h"
249 #include "MmiSounds.h"
250 #include "MmiResources.h"
251 #include "MmiTimeDate.h"
252
253 #include "cus_aci.h"
254 #include "prim.h"
255 #ifndef PCM_2_FFS
256 #include "pcm.h"
257 #endif
258
259 #include "MmiTimers.h"
260
261 #include "mmiColours.h"
262 //Apr 05, 2005 REF: ENH 29994 xdeepadh
263 #ifdef FF_MIDI_RINGER
264 #include "mmisamplemidifiles.h"
265 #endif
266
267 /* OMAPS00151698, x0056422 */
268 #ifdef FF_MMI_A2DP_AVRCP
269 #include "mfw_bt_api.h"
270 #include "mfw_bt_private.h"
271 #endif
272 /* OMAPS00151698, x0056422 */
273
274 extern char* MelodyTable[];
275 extern T_call call_data;
276
277 // Aug 05, 2005 xdeepadh
278 #ifdef FF_MMI_AUDIO_PROFILE
279 extern UBYTE mfwAudPlay;//flag for audio
280 #endif
281
282 /*August 01, 2007 DR: OMAPS00137399 x0080701 (Bharat) -- Start */
283
284 #include "mfw_aud.h"
285
286 /*August 01, 2007 DR: OMAPS00137399 x0080701 (Bharat) -- End */
287
288
289 /* OMAPS00151698, x0056422 */
290 #ifdef FF_MMI_A2DP_AVRCP
291 extern BMI_BT_STRUCTTYPE tGlobalBmiBtStruct;
292 #endif //FF_MMI_A2DP_AVRCP
293 /* OMAPS00151698, x0056422 */
294
295 /*******************************************************************************
296
297 Constant Definitions
298
299 *******************************************************************************/
300
301
302 /* Control FLUSH mechanism to PCM
303 */
304 #define FLUSH 1
305 #define NO_FLUSH 0
306
307
308 /* Timer constants, pretty self explanatory
309 */
310 #define TIMHALFSECOND 500
311 #define TIMSECOND 1000
312 #define TIM4SECOND 4000
313
314 #define VIBRATOR_TIME 2000 /* two second timer on the vibrator*/
315
316 /* Define a generic trace mechanism
317 */
318 #define PTRACE(prn) { char buf[64]; ## prn ## TRACE_EVENT(buf); }
319
320
321 /* Define maximum counter for vibrator
322 */
323 #define VIBRATOR_COUNTER_MAX 4
324 #define NOT_VIBRATING 0
325
326 #ifdef NEPTUNE_BOARD
327 /* RAVI - 20-1-2005 */
328 /* Volume Control Definition */
329 #define SILENT_SETTING 0
330 #define MAX_VOLUME_SETTING 4
331 /* END - RAVI - 20-1-2005 */
332 #endif
333
334 #define SILENT_VOLUME 0
335 #define LOW_VOLUME 5
336 #define MEDIUM_VOLUME 25
337 #define HIGH_VOLUME 175
338 #define INCREASE_VOLUME 5
339
340
341 /* define an invalid tone marker
342 */
343 #define INVALID_TONE -1
344
345 //Define to indicate the Size of the file where the melody must start
346 #ifdef FF_MP3_RINGER
347 #define MP3_PLAY_FROM_START 0
348 #endif //FF_MP3_RINGER
349
350 //Nov 22, 2005 REF: ENH OMAPS00057430 nekkareb
351 //Define to indicate the Size of the file where the melody must start
352 #ifdef FF_AAC_RINGER
353 #define AAC_PLAY_FROM_START 0
354 #endif //FF_AAC_RINGER
355
356
357 //Apr 05, 2005 REF: ENH 29994 xdeepadh
358 #ifdef FF_MIDI_RINGER
359
360 extern UBYTE mfw_player_exit_flag;//Flag to check the playall option
361 extern int mfw_player_currently_playing_idx;//The current playing file index
362 #define MT_INFO_SCRN_TIMEOUT 1500//Timeout for InfoDialog
363 int selected_tone=0;
364
365 /* ADDED BY RAVI - 28-11-2005 */
366 int resource_GetListCount(res_ResourceID_type res);
367 /* END RAVI - 28-11-2005 */
368
369 static int playCurrentMelody( MfwEvt e, MfwTim *tc );
370 static void soundsPlayMidiPlayer( int melody_id );
371 void startPlayerTimer();
372 static void stopPlayerTimer( void );
373 static int playCurrentVolumeTone( MfwEvt e, MfwTim *tc );
374 void startVolumeTimer();
375 void stopVolumeTimer(void);
376 static void soundsPlayVolumeMelody();
377 #endif
378
379 /*Defintion for First tone being played - RAVI - 23-12-2005 */
380 #ifdef NEPTUNE_BOARD
381 #define FIRST_TONE_PLAYED 1
382 #endif
383 /*END RAVI */
384
385 /*******************************************************************************
386
387 Local Function prototypes
388
389 *******************************************************************************/
390
391 static int winEvent( MfwEvt e, MfwWin *w );
392 static int keyEvent( MfwEvt e, MfwKbd *kc );
393 static int keyEventLong( MfwEvt e, MfwKbd *kc );
394
395 /* x0039928 - Lint warning fix
396 static void ( *show )( void ); */
397
398 //Apr 05, 2005 REF: ENH 29994 xdeepadh
399 #ifndef FF_MIDI_RINGER
400 static int playCurrentSound( MfwEvt e, MfwTim *tc );
401 #endif
402 static int getCallingMenu( MfwEvt e, MfwTim *tc );
403 static int setSelection( MfwEvt e, MfwWin *w );
404 #ifndef FF_MIDI_RINGER
405 static void delayThenPlayMelody( void );
406 #endif
407 static void stopPlayingMelody( void );
408
409 static void readSettingsFromPCM( void );
410 static void writeSettingsToPCM( UBYTE flush );
411
412 static void soundsCreate( MfwHnd parent );
413 static int VibratorTimerEvent( MfwEvt e, MfwTim *t );
414
415
416 void sounds (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
417 void sounds_dialog_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason);
418 static void sounds_dialog(void);
419 static int sounds_win_cb (T_MFW_EVENT event, T_MFW_WIN * win);
420 static int melody_win_cb (MfwEvt e, MfwWin *w);
421 void melody_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter);
422 void sounds_destroy (T_MFW_HND own_window);
423 T_MFW_HND sounds_create (T_MFW_HND parent_window);
424 void sounds_Exit (T_MFW_HND own_window);
425 T_MFW_HND sounds_Init (T_MFW_HND parent_window);
426 void MelodyList_cb(T_MFW_HND * Parent, ListMenuData * ListData);
427 static void melody_destroy(MfwHnd own_window);
428 static MfwHnd sounds_show_info(T_MFW_HND parent, int str1, int str2, T_VOID_FUNC callback);
429
430 #define SHOW_CONFIRM 3
431 #define ACTIVATE_CONFIRM 4
432 #define DEACTIVATE_CONFIRM 5
433
434 /*******************************************************************************
435
436 Local typedefs
437
438 *******************************************************************************/
439
440 /* Define the types of volume we cater for
441 */
442 typedef enum {
443 silent = (UBYTE)0,
444 volLow,
445 volMedium,
446 volHigh,
447 increasing
448 } VOL_ENUM;
449
450
451 /* And the key tones
452 */
453 typedef enum
454 {
455 KEYTONE_NONE,
456 KEYTONE_BEEP,
457 KEYTONE_DTMF
458 } SoundsKeyTones;
459
460
461 /* The following definition provides a structure to control the
462 ringing operation
463 */
464
465 typedef struct MMI_CURRENT_RINGER_STRUCT {
466 /* variable to browse a list */
467 UBYTE ringer; // index of permanent active tune in soundlist and ringerItem
468 UBYTE vibrator; // vibrator
469 UBYTE volumeSetting; // values (0 = silent, 4= loud, 5 = increasing)
470 UBYTE keypadOn; // on/off values
471 UBYTE AlarmOn;
472 UBYTE OrganiserAlert;
473 UBYTE CreditLow;
474 UBYTE SMSTone;
475 UBYTE VoiceTone; /*CQ 10586 - API - 19/06/03 - Add this ID*/
476 UBYTE SMSBroadcast;
477 UBYTE battLow;
478 UBYTE earpiece;
479 UBYTE language;
480 UBYTE Equalizer;
481 } RINGER_STRUCT_BROWSER;
482
483 /* ------------- Variables --------------- */
484
485 static SoundSettingState soundReason=SoundsNone;
486 // Change behavior of menu scroll up/down, meni item selected on scrolling.
487 static BOOL scrollSelectMenuItem= FALSE;
488 #ifndef FF_MIDI_RINGER /* x0039928 - Lint warning removal */
489 static BOOL volumeSetting2Pcm =FALSE;
490 #endif
491 static RINGER_STRUCT_BROWSER current =
492 { // default settings.
493 AUDIO_MEL_TUNES, // ringer
494 0, // vibrator - off by default
495 volMedium, // volumeSetting
496 2, // keypadOn dtmf
497 1, // AlarmOn
498 1, // OrganiserAlert
499 1, // CreditLow
500 1, // SMSTone
501 1, // SMSBroadcast
502 1, // battLow
503 3, // earpiece
504 1, // language
505 1 // Equalizer
506 };
507
508 typedef enum
509 {
510 E_INIT = 0x0801,
511 E_BACK,
512 E_ABORT,
513 E_EXIT,
514 E_RETURN,
515 E_OK
516 } e_M_events;
517
518 T_MELODY_INFO sounds_data;
519
520
521
522 /*******************************************************************************
523
524 Module local variables
525
526 *******************************************************************************/
527 /* RAVI - 20-1-2006 */
528 /* Store the volume settings */
529 #ifdef NEPTUNE_BOARD
530 static UBYTE lastVolumeSetting;
531 static UBYTE scrollVolumeSetting;
532 #endif
533 /* END RAVI */
534 static UBYTE oldVolumeSetting; /* Previous setting of the volume */
535
536 /* static MfwHnd kbd; // our keyboard handler x0039928 - Lint warning fix */
537 /* static MfwHnd kbdLong; // our keyboard handler for Long pressed x0039928 - Lint warning fix */
538 #ifndef FF_MIDI_RINGER
539 static MfwHnd hRingerStartTimer; /* timeout till start of melody */
540 #endif
541 //Apr 05, 2005 REF: ENH 29994 xdeepadh
542 #ifdef FF_MIDI_RINGER
543 MfwHnd hPlayerStartTimer; /* timeout till start of midi file */
544 #endif
545 static MfwHnd hRingerVolSettingTimeOut; /* 4 second timeout for volume setting menu */
546
547
548 /* static MfwHnd hWinDispTimer; // timer to show result windows x0039928 - Lint warning fix */
549
550 /* Maintain vibrator state information here
551 */
552
553 /* x0039928 - Lint warning removal
554 static MfwHnd VibratorTimer;
555 static UBYTE Vibrating = NOT_VIBRATING;
556 static UBYTE vibrator_counter=0; */
557
558 /* General state information
559 */
560
561 /* x0039928 - Lint warning removal
562 static MmiState nextState;
563 static MfwHnd lastFocus;
564 */
565
566
567 /* Tune details
568 */
569 static int CurrentTune = 0;
570 #ifndef FF_MIDI_RINGER
571 static int LastTune = 0;
572 #endif
573
574 static const MfwMnuAttr melody_menuAttrib =
575 {
576 &melody_menuArea,
577 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */
578 (U8) -1, /* use default font */
579 NULL, /* with these items */
580 0, /* number of items */
581 COLOUR_LIST_XX, TxtNull, NULL, MNUATTRSPARE
582
583 };
584
585
586 /*******************************************************************************
587
588 Private Methods
589
590 *******************************************************************************/
591
592 /******************************************************************************
593 *$Function: setDefaultSound
594 *
595 *$Description: This function will read from Flash during boot up and updated the
596 * current ringer structure. So after reset the stored tones will get
597 * played.
598 *
599 *$Returns: none
600 *
601 *$Arguments: none
602 *$Author : RAVI - 23-12-2005
603 ******************************************************************************/
604 #ifdef NEPTUNE_BOARD
605 void setDefaultSound(void)
606 {
607 if (flash_read() >= EFFS_OK)
608 {
609 /* Assign the current structure with FFS stored value */
610 current.ringer = FFS_flashData.ringer;
611 current.SMSTone = FFS_flashData.SMSTone;
612 current.AlarmOn = FFS_flashData.AlarmOn;
613 current.volumeSetting = FFS_flashData.volumeSetting;
614 }
615 /* RAVI - 20-1-2006 */
616 /* Store the initial volume settings done by user */
617 lastVolumeSetting = current.volumeSetting;
618 scrollVolumeSetting = 0;
619 /* END RAVI */
620 }
621 #endif
622
623 USHORT getSoundsReason(void)
624 {
625 return soundReason;
626 }
627 /*******************************************************************************
628
629 $Function: setSoundsReason
630
631 $Description: Set the reason why the volume settings was invoked. Called to indicated
632 that the volume settings is being invoked from Idle or from the incoming
633 call screens.
634
635 $Returns: none
636
637 $Arguments: none
638
639 *******************************************************************************/
640 void setSoundsReason(USHORT reason)
641 {
642
643 switch(reason)
644 {
645 case SettingVolume:
646 soundReason = SettingVolume;
647 break;
648 case SoundsNone:
649 default:
650 soundReason = SoundsNone;
651 break;
652 }
653 }
654 /*******************************************************************************
655
656 $Function: volMenuItemSelected
657
658 $Description: A volume menu item has been selected, store the setting into PCM.
659
660 $Returns: none
661
662 $Arguments: none
663
664 *******************************************************************************/
665 void volMenuItemSelected(void)
666 {
667
668 TRACE_FUNCTION("volMenuItemSelected");
669
670 /* Apr 05, 2005 REF: ENH 29994 xdeepadh */
671 #ifdef FF_MIDI_RINGER
672 /* Save the volume for a given ringer mode */
673 TRACE_EVENT_P1("Volume set is %d",current.volumeSetting);
674 mfw_ringer_set_volume(get_ringer_mode(),(T_AS_VOLUME)getCurrentVoulmeSettings());
675 #else
676 volumeSetting2Pcm =TRUE; /* x0039928 - Lint warning removal */
677 #endif
678 }
679 /*******************************************************************************
680
681 $Function: getScrollSelectMenuItem
682
683 $Description: get the scroll/select menu status.
684
685 $Returns: Status
686
687 $Arguments: none
688
689 *******************************************************************************/
690 BOOL getScrollSelectMenuItem(void)
691 {
692 TRACE_FUNCTION("getScrollSelectMenuItem");
693 if (scrollSelectMenuItem == TRUE)
694 return TRUE;
695 else
696 return FALSE;
697 }
698 /*******************************************************************************
699
700 $Function: clearScrollSelectMenuItem
701
702 $Description: Reset the scroll/select menu behavior.
703
704 $Returns: none
705
706 $Arguments: none
707
708 *******************************************************************************/
709 void clearScrollSelectMenuItem(void)
710 {
711 TRACE_FUNCTION("clearScrollSelectMenuItem");
712 scrollSelectMenuItem=FALSE;
713 // soundReason = SoundsNone; MZ this flag cleared when user exits the melody/Volume menu.
714 //Apr 05, 2005 REF: ENH 29994 xdeepadh
715 #ifdef FF_MIDI_RINGER
716 mfw_player_stop(sounds_midi_player_stop_cb);
717 #else
718 stopPlayingMelody();
719 #endif
720 }
721
722 /*******************************************************************************
723
724 $Function: soundsSetVolume
725
726 $Description: Function determines if user is in the Melody/SMS/Alarm ringer menu
727 and has selected the vloume settings option.
728
729 $Returns: none
730
731 $Arguments: none
732
733 *******************************************************************************/
734 void soundsSetVolume(void)
735 {
736
737 TRACE_FUNCTION("soundsSetVolume");
738 //Apr 05, 2005 REF: ENH 29994 xdeepadh
739 #ifdef FF_MIDI_RINGER
740 //Create 0.5 second ringer delay timer.
741 hPlayerStartTimer = timCreate( 0, TIMHALFSECOND, (MfwCb)playCurrentVolumeTone);
742 //Set the audiopath to speaker.
743 mfw_ringer_set_audiopath();
744 //Set the voice limit to 32 and channel to stereo in idle mode
745 mfw_player_midi_set_params(FF_MIDI_VOICE_LIMIT,MIDI_CHANNEL_STEREO);
746 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh
747 //Set the Mp3 Parameters .Size of the file where the melody must start is set 0(from beginning)
748 //and channel is set to stereo.
749 #ifdef FF_MP3_RINGER
750 mfw_player_mp3_set_params(MP3_PLAY_FROM_START,MP3_CHANNEL_STEREO);
751 #endif //FF_MP3_RINGER
752
753 //Nov 21, 2005 REF:ER OMAPS00057430 nekkareb
754 //Set the AAC Parameters .Size of the file where the melody must start is set 0(from beginning)
755 //and channel is set to stereo.
756 #ifdef FF_AAC_RINGER
757 mfw_player_aac_set_params(AAC_PLAY_FROM_START,AAC_CHANNEL_STEREO);
758 #endif //FF_AAC_RINGER
759
760 #endif
761
762 if(soundReason == MelodySelect || soundReason == SettingSMSTone ||
763 soundReason == SettingAlarm || soundReason == SettingVolume)
764 {
765 // Menu items will be selected on scrolling.
766 scrollSelectMenuItem = TRUE;
767 // store the setting to PCM if volume setting is selected.
768 #ifndef FF_MIDI_RINGER
769 volumeSetting2Pcm=FALSE;
770 #endif
771 }
772 else
773 {
774 scrollSelectMenuItem = FALSE;
775 }
776
777 }
778
779
780
781 /*******************************************************************************
782
783 $Function: IdleScreenVolumeTimer
784
785 $Description: Function creates the volume timer for idle screen.
786
787 $Returns: none
788
789 $Arguments: none
790
791 *******************************************************************************/
792
793 void IdleScreenVolumeTimer()
794 {
795 TRACE_FUNCTION("IdleScreenVolumeTimer");
796 //Apr 05, 2005 REF: ENH 29994 xdeepadh
797 #ifdef FF_MIDI_RINGER
798 //Create 0.5 second ringer delay timer.
799 hPlayerStartTimer = timCreate( 0, TIMHALFSECOND, (MfwCb)playCurrentVolumeTone);
800 //Set the audiopath to speaker.
801 mfw_ringer_set_audiopath();
802 //Set the voice limit to 32 and channel to stereo in idle mode
803 mfw_player_midi_set_params(FF_MIDI_VOICE_LIMIT,MIDI_CHANNEL_MONO);
804 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh
805 //Set the Mp3 Parameters .Size of the file where the melody must start is set 0(from beginning)
806 //and channel is set to Mono.
807 #ifdef FF_MP3_RINGER
808 mfw_player_mp3_set_params(MP3_PLAY_FROM_START,MP3_CHANNEL_MONO);
809 #endif //FF_MP3_RINGER
810
811 //Nov 21, 2005 REF:ER OMAPS00057430 nekkareb
812 //Set the AAC Parameters .Size of the file where the melody must start is set 0(from beginning)
813 //and channel is set to Mono.
814 #ifdef FF_AAC_RINGER
815 mfw_player_aac_set_params(AAC_PLAY_FROM_START,AAC_CHANNEL_MONO);
816 #endif //FF_AAC_RINGER
817
818 #endif
819 }
820
821 /*******************************************************************************
822
823 $Function: setSilentModeVolumeOn
824
825 $Description:
826
827 $Returns: none
828
829 $Arguments: none
830
831 *******************************************************************************/
832 void setSilentModeVolume(void)
833 {
834
835 // Aug 30, 2005 REF: SPR 34018 xdeepadh
836 #ifdef FF_MIDI_RINGER
837
838 T_AS_RINGER_INFO * ringer_info;
839 T_AS_RINGER_INFO temp_ringer_info;
840 TRACE_FUNCTION("setSilentModeVolume");
841
842 memset(&temp_ringer_info,'\0',sizeof(T_AS_RINGER_INFO)); /* x0039928 - Lint warning fix */
843 // Save the volume for incoming call
844 ringer_info = mfw_ringer_get_info(AS_RINGER_MODE_IC,&temp_ringer_info);
845 oldVolumeSetting = ringer_info->volume ;
846 TRACE_EVENT_P1("Volume set in silent mode is %d",oldVolumeSetting);
847 //Set the volume to silent
848 current.volumeSetting = (UBYTE)AS_VOLUME_SILENT;
849 TRACE_EVENT_P1("Volume set is %d",current.volumeSetting);
850 mfw_ringer_set_volume(AS_RINGER_MODE_IC,(T_AS_VOLUME)getCurrentVoulmeSettings());
851 #else
852 stopPlayingMelody();
853 oldVolumeSetting = current.volumeSetting;
854 current.volumeSetting = SILENT_VOLUME;
855 audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
856 #endif
857 }
858
859 /*******************************************************************************
860
861 $Function: setSilentModeVolumeOn
862
863 $Description:
864
865 $Returns: none
866
867 $Arguments: none
868
869 *******************************************************************************/
870 void restoreSilentModeVolume(void)
871 {
872
873 TRACE_FUNCTION("restoreSilentModeVolume");
874 // Aug 30, 2005 REF: SPR 34018 xdeepadh
875 #ifdef FF_MIDI_RINGER
876 //Set the volume back to the old one
877 TRACE_EVENT_P1("oldVolumeSetting set is %d",oldVolumeSetting);
878 mfw_ringer_set_volume(AS_RINGER_MODE_IC,(T_AS_VOLUME)oldVolumeSetting);
879 #else
880 stopPlayingMelody();
881 current.volumeSetting =oldVolumeSetting;
882 audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
883 #endif
884 }
885
886 /*******************************************************************************
887
888 $Function: soundsVolSilent
889
890 $Description: set voulme level to silent.
891
892 $Returns: none
893
894 $Arguments: none
895
896 *******************************************************************************/
897 void soundsVolSilent(void)
898 {
899 //Apr 05, 2005 REF: ENH 29994 xdeepadh
900 #ifdef FF_MIDI_RINGER
901 //Display silent mode in the idle screen only for the incoming call volume.
902 if(soundReason == MelodySelect || soundReason == SettingVolume)
903 {
904 FFS_flashData.settings_status |= SettingsSilentMode;
905 flash_write();
906 }
907 #else
908 FFS_flashData.settings_status |= SettingsSilentMode;
909 flash_write();
910 #endif
911
912 TRACE_EVENT("soundsVolSilent");
913 //Apr 05, 2005 REF: ENH 29994 xdeepadh
914 #ifdef FF_MIDI_RINGER
915 current.volumeSetting =(UBYTE)AS_VOLUME_SILENT;
916 stopVolumeTimer();
917 startVolumeTimer();
918 #else
919 /* RAVI - 20-1-2006 */
920 #ifdef NEPTUNE_BOARD
921 current.volumeSetting =SILENT_VOLUME;
922 #endif
923 /* END - RAVI */
924 stopPlayingMelody();
925
926 if(volumeSetting2Pcm != TRUE)
927 {
928 current.volumeSetting =SILENT_VOLUME;
929 audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
930
931 #ifdef FF_MMI_RINGTONE /* MSL Ring tone play */
932 audio_PlaySoundID(AUDIO_BUZZER, CALLTONE_SELECT, 0, AUDIO_PLAY_ONCE);
933 #else
934
935 /* RAVI - 20-1-2006 */
936 #ifdef NEPTUNE_BOARD
937 /* Store the currently stored volume content */
938 audio_PlaySoundID(AUDIO_BUZZER, current.ringer, current.volumeSetting, AUDIO_PLAY_ONCE);
939 #else
940 /* API - 04/09/03 - SPR2447 - Remove the call to AUDIO_PLAY_INFINITE and replace with AUDIO_PLAY_ONCE*/
941 audio_PlaySoundID(AUDIO_BUZZER, current.ringer, 0, AUDIO_PLAY_ONCE);
942 /* API - 04/09/03 - SPR2447 - END*/
943 #endif
944 /* END RAVI */
945 #endif
946
947 }
948 else
949 {
950 //store setting into PCM
951 volumeSetting2Pcm=FALSE;
952 }
953 #endif
954
955
956 }
957 /*******************************************************************************
958
959 $Function: soundsVolLow
960
961 $Description: set voulme level to low.
962
963 $Returns: none
964
965 $Arguments: none
966
967 *******************************************************************************/
968 void soundsVolLow(void)
969 {
970
971 FFS_flashData.settings_status &= ~SettingsSilentMode;
972 flash_write();
973 TRACE_EVENT("soundsVolLow");
974 //Apr 05, 2005 REF: ENH 29994 xdeepadh
975 #ifdef FF_MIDI_RINGER
976 current.volumeSetting =(UBYTE)AS_VOLUME_LOW;
977 stopVolumeTimer();
978 startVolumeTimer();
979 #else
980 /* RAVI - 20-1-2006 */
981 #ifdef NEPTUNE_BOARD
982 current.volumeSetting = LOW_VOLUME;
983 #endif
984 /*END RAVI */
985 stopPlayingMelody();
986 if(volumeSetting2Pcm != TRUE)
987 {
988 current.volumeSetting = LOW_VOLUME;
989 audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
990
991 #ifdef FF_MMI_RINGTONE /* MSL Ring tone play */
992 audio_PlaySoundID(AUDIO_BUZZER, CALLTONE_SELECT, 0, AUDIO_PLAY_ONCE);
993 #else
994
995 /* RAVI - 20-1-2006 */
996 #ifdef NEPTUNE_BOARD
997 audio_PlaySoundID(AUDIO_BUZZER, current.ringer, current.volumeSetting, AUDIO_PLAY_ONCE);
998 #else
999 /* API - 04/09/03 - SPR2447 - Remove the call to AUDIO_PLAY_INFINITE and replace with AUDIO_PLAY_ONCE*/
1000 audio_PlaySoundID(AUDIO_BUZZER, current.ringer, 0, AUDIO_PLAY_ONCE);
1001 /* API - 04/09/03 - SPR2447 - END*/
1002 #endif
1003 /* END RAVI */
1004 #endif
1005
1006 }
1007 else
1008 {
1009 //store setting into PCM
1010 volumeSetting2Pcm=FALSE;
1011 }
1012 #endif
1013
1014
1015 }
1016 /*******************************************************************************
1017
1018 $Function: soundsVolMedium
1019
1020 $Description: set voulme level to Medium
1021
1022 $Returns: none
1023
1024 $Arguments: none
1025
1026 *******************************************************************************/
1027 void soundsVolMedium(void)
1028 {
1029
1030 FFS_flashData.settings_status &= ~SettingsSilentMode;
1031 flash_write();
1032 TRACE_EVENT("soundsVolMedium");
1033 //Apr 05, 2005 REF: ENH 29994 xdeepadh
1034 #ifdef FF_MIDI_RINGER
1035 current.volumeSetting =(UBYTE)AS_VOLUME_MEDIUM;
1036 stopVolumeTimer();
1037 startVolumeTimer();
1038 #else
1039 /* RAVI - 20-1-2006 */
1040 #ifdef NEPTUNE_BOARD
1041 current.volumeSetting = MEDIUM_VOLUME;
1042 #endif
1043 /* END RAVI */
1044 stopPlayingMelody();
1045 if(volumeSetting2Pcm != TRUE)
1046 {
1047 current.volumeSetting = MEDIUM_VOLUME;
1048 audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
1049
1050 #ifdef FF_MMI_RINGTONE /* MSL Ring Tone Play */
1051 audio_PlaySoundID(AUDIO_BUZZER, CALLTONE_SELECT, 0, AUDIO_PLAY_ONCE);
1052 #else
1053
1054 /* RAVI - 20-1-2006 */
1055 #ifdef NEPTUNE_BOARD
1056 audio_PlaySoundID(AUDIO_BUZZER, current.ringer, current.volumeSetting, AUDIO_PLAY_ONCE);
1057 #else
1058 /* API - 04/09/03 - SPR2447 - Remove the call to AUDIO_PLAY_INFINITE and replace with AUDIO_PLAY_ONCE*/
1059 audio_PlaySoundID(AUDIO_BUZZER, current.ringer, 0, AUDIO_PLAY_ONCE);
1060 /* API - 04/09/03 - SPR2447 - END*/
1061 #endif
1062 /* END RAVI */
1063 #endif
1064
1065 }
1066 else
1067 {
1068 //store setting into PCM
1069 volumeSetting2Pcm=FALSE;
1070 }
1071 #endif
1072
1073
1074
1075 }
1076 /*******************************************************************************
1077
1078 $Function: soundsVolHigh
1079
1080 $Description: set voulme level to High
1081
1082 $Returns: none
1083
1084 $Arguments: none
1085
1086 *******************************************************************************/
1087 void soundsVolHigh(void)
1088 {
1089
1090 FFS_flashData.settings_status &= ~SettingsSilentMode;
1091 flash_write();
1092
1093 TRACE_EVENT("soundsVolHigh");
1094 //Apr 05, 2005 REF: ENH 29994 xdeepadh
1095 #ifdef FF_MIDI_RINGER
1096 current.volumeSetting =(UBYTE)AS_VOLUME_HIGH;
1097 stopVolumeTimer();
1098 startVolumeTimer();
1099
1100 #else
1101 /* RAVI - 20-1-2006 */
1102 #ifdef NEPTUNE_BOARD
1103 current.volumeSetting = HIGH_VOLUME;
1104 #endif
1105
1106 stopPlayingMelody();
1107 if(volumeSetting2Pcm != TRUE)
1108 {
1109 current.volumeSetting =HIGH_VOLUME;
1110 audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
1111
1112 #ifdef FF_MMI_RINGTONE /* MSL Ring Tone Play */
1113 audio_PlaySoundID(AUDIO_BUZZER, CALLTONE_SELECT, 0, AUDIO_PLAY_ONCE);
1114 #else
1115
1116 /* RAVI - 20-1-2006 */
1117 #ifdef NEPTUNE_BOARD
1118 audio_PlaySoundID(AUDIO_BUZZER, current.ringer, current.volumeSetting, AUDIO_PLAY_ONCE);
1119 #else
1120 /* API - 04/09/03 - SPR2447 - Remove the call to AUDIO_PLAY_INFINITE and replace with AUDIO_PLAY_ONCE*/
1121 audio_PlaySoundID(AUDIO_BUZZER, current.ringer, 0, AUDIO_PLAY_ONCE);
1122 /* API - 04/09/03 - SPR2447 - END*/
1123 #endif
1124 /* END RAVI */
1125 #endif
1126
1127 }
1128 else
1129 {
1130 //store setting into PCM
1131 volumeSetting2Pcm=FALSE;
1132 }
1133 #endif
1134
1135
1136 }
1137 /*******************************************************************************
1138
1139 $Function: soundsVolInc
1140
1141 $Description: set voulme level to increasing
1142
1143 $Returns: none
1144
1145 $Arguments: none
1146
1147 *******************************************************************************/
1148 //Apr 05, 2005 REF: ENH 29994 xdeepadh
1149 #ifndef FF_MIDI_RINGER
1150 void soundsVolInc(void)
1151 {
1152 FFS_flashData.settings_status &= ~SettingsSilentMode;
1153 flash_write();
1154 /* RAVI - 20-1-2006 */
1155 #ifdef NEPTUNE_BOARD
1156 current.volumeSetting = INCREASE_VOLUME;
1157 #endif
1158 /* END RAVI */
1159 stopPlayingMelody();
1160 if(volumeSetting2Pcm != TRUE)
1161 {
1162 current.volumeSetting = INCREASE_VOLUME;
1163 audio_SetAmplf (AUDIO_BUZZER, current.volumeSetting);
1164
1165 #ifdef FF_MMI_RINGTONE /* MSL Ring Tone Play */
1166 audio_PlaySoundID(AUDIO_BUZZER, CALLTONE_SELECT, 0, AUDIO_PLAY_ONCE);
1167 #else
1168
1169 /* RAVI - 20-1-2006 */
1170 #ifdef NEPTUNE_BOARD
1171 audio_PlaySoundID(AUDIO_BUZZER, current.ringer, current.volumeSetting, AUDIO_PLAY_ONCE);
1172 #else
1173 /* API - 04/09/03 - SPR2447 - Remove the call to AUDIO_PLAY_INFINITE and replace with AUDIO_PLAY_ONCE*/
1174 audio_PlaySoundID(AUDIO_BUZZER, current.ringer, 0, AUDIO_PLAY_ONCE);
1175 /* API - 04/09/03 - SPR2447 - END*/
1176 #endif
1177 /* END RAVI */
1178 #endif
1179
1180 }
1181 else
1182 {
1183 //store setting into PCM
1184 volumeSetting2Pcm=FALSE;
1185
1186 }
1187
1188
1189 }
1190
1191 #endif
1192 /*******************************************************************************
1193
1194 $Function: soundReasonRinger
1195
1196 $Description: setup the soundReason to be Ringer Melody settings.
1197
1198 $Returns: none
1199
1200 $Arguments: none
1201
1202 *******************************************************************************/
1203 void soundReasonRinger(void)
1204 {
1205 soundReason = MelodySelect;
1206 }
1207 /*******************************************************************************
1208
1209 $Function: soundReasonSmsTone
1210
1211 $Description: Setup the soundReason to be SMS tones settings.
1212
1213 $Returns: none
1214
1215 $Arguments: none
1216
1217 *******************************************************************************/
1218 void soundReasonSmsTone(void)
1219 {
1220 soundReason = SettingSMSTone;
1221 }
1222 /*******************************************************************************
1223
1224 $Function: soundReasonAlarm
1225
1226 $Description: Setup the soundReason to be Alarm settings.
1227
1228 $Returns: none
1229
1230 $Arguments: none
1231
1232 *******************************************************************************/
1233 void soundReasonAlarm(void)
1234 {
1235 soundReason = SettingAlarm;
1236 }
1237 /*******************************************************************************
1238
1239 $Function: getcurrentSMSTone
1240
1241 $Description: Access function for the current SMS Tone.
1242 $Returns: Tone Id
1243
1244 $Arguments: None
1245
1246 *******************************************************************************/
1247 UBYTE getcurrentSMSTone(void)
1248 {
1249 return current.SMSTone;
1250 }/*******************************************************************************
1251
1252 $Function: getcurrentVoiceTone
1253
1254 $Description: Access function for the current SMS Tone.
1255 $Returns: Tone Id
1256
1257 $Arguments: None
1258
1259 *******************************************************************************/
1260 /*CQ 10586 - API - 19/06/03 - Add this function to return the curret sound for Voice mail notification*/
1261 UBYTE getcurrentVoiceTone(void)
1262 {
1263 return current.SMSTone; // At present return the SMS tone untill settings have been updated
1264 }
1265 /*******************************************************************************
1266
1267 $Function: getcurrentSMSTone
1268
1269 $Description: Access function for the current SMS Tone.
1270 $Returns: Tone Id
1271
1272 $Arguments: None
1273
1274 *******************************************************************************/
1275 UBYTE getcurrentAlarmTone(void)
1276 {
1277 return current.AlarmOn;
1278 }
1279 /*******************************************************************************
1280
1281 $Function: getCurrentRingerSettings
1282
1283 $Description: Access function for the current ringer settings data.
1284 $Returns: Ringer Id.
1285
1286 $Arguments: None
1287
1288 *******************************************************************************/
1289 UBYTE getCurrentRingerSettings(void)
1290 {
1291 return current.ringer;
1292 }
1293 /*******************************************************************************
1294
1295 $Function: getCurrentVoulmeSettings
1296
1297 $Description: Access function for the current ringer volume settings data.
1298 $Returns: volume
1299
1300 $Arguments: None
1301
1302 *******************************************************************************/
1303 UBYTE getCurrentVoulmeSettings(void)
1304 {
1305 TRACE_EVENT_P1("getCurrentVoulmeSettings is %d",current.volumeSetting);
1306 return current.volumeSetting;
1307 }
1308 /*******************************************************************************
1309
1310 $Function: getMelodyListStatus
1311
1312 $Description: Status flag indicating if a melody selection menu is active.
1313 $Returns: status
1314
1315 $Arguments: None
1316
1317 *******************************************************************************/
1318 BOOL getMelodyListStatus(void)
1319 {
1320 if(soundReason == MelodySelect ||
1321 soundReason == SettingSMSTone ||
1322 soundReason == SettingAlarm )
1323 return TRUE;
1324 else
1325 return FALSE;
1326 }
1327
1328 #ifndef FF_MIDI_RINGER
1329 /*******************************************************************************
1330
1331 $Function: stopPlayingMelody
1332
1333 $Description: stop currently played ringer melody
1334
1335 $Returns: None
1336
1337 $Arguments: None
1338
1339 *******************************************************************************/
1340 static void stopPlayingMelody( void )
1341 {
1342 TRACE_FUNCTION( "stopPlayingMelody" );
1343
1344 /* If a timer event is running we want to stop that as well,
1345 since we don't really want to turn the tune off and have
1346 it start again when the timer expires
1347 */
1348 if ( hRingerStartTimer != NULL )
1349 timStop( hRingerStartTimer );
1350
1351 /* Are we playing a tune
1352 */
1353 if ( LastTune )
1354 {
1355 /* To stop playing the previous ring tone - RAVI - 23-12-2005 */
1356 #ifdef NEPTUNE_BOARD
1357 #ifdef FF_MMI_RINGTONE /*MSL Stop */
1358 audio_StopSoundbyID( AUDIO_BUZZER, CALLTONE_SELECT);
1359 #else
1360 audio_StopSoundbyID( AUDIO_BUZZER, LastTune - 1 );
1361 #endif
1362 #else
1363 audio_StopSoundbyID( AUDIO_BUZZER, LastTune );
1364 #endif
1365 }
1366
1367 /* Need to wait for the tune to stop before trying to
1368 set up the next tune, so wait always
1369 */
1370 vsi_t_sleep( 0, 5 );
1371 }
1372
1373 #endif
1374
1375 /*******************************************************************************
1376
1377 $Function: startPlayingMelody
1378
1379 $Description: Start played the ringer melody
1380
1381 $Returns: None
1382
1383 $Arguments: Melody_id
1384
1385 *******************************************************************************/
1386 //Apr 05, 2005 REF: ENH 29994 xdeepadh
1387 #ifndef FF_MIDI_RINGER
1388 static void startPlayingMelody(UBYTE melody_id)
1389 {
1390 #ifdef NEPTUNE_BOARD
1391 BYTE bVolumeSetting;
1392 #endif
1393
1394 if ( hRingerStartTimer != NULL )
1395 timStop( hRingerStartTimer );
1396
1397 #ifdef FF_MMI_RINGTONE /* MSL Ring tone play */
1398 audio_PlaySoundID(AUDIO_BUZZER, CALLTONE_SELECT, (BYTE)current.volumeSetting, AUDIO_PLAY_ONCE);
1399 #else
1400
1401 /* RAVI - 20-1-2006 */
1402 #ifdef NEPTUNE_BOARD
1403 if (soundReason == SettingVolume)
1404 {
1405 switch (scrollVolumeSetting)
1406 {
1407 case 0:
1408 bVolumeSetting = SILENT_VOLUME;
1409 break;
1410 case 1:
1411 bVolumeSetting = LOW_VOLUME;
1412 break;
1413 case 2:
1414 bVolumeSetting = MEDIUM_VOLUME;
1415 break;
1416 case 3:
1417 bVolumeSetting = HIGH_VOLUME;
1418 break;
1419 case 4:
1420 bVolumeSetting = INCREASE_VOLUME;
1421 break;
1422 default:
1423 bVolumeSetting = LOW_VOLUME;
1424 break;
1425 }
1426 audio_PlaySoundID(AUDIO_BUZZER, melody_id, (BYTE)bVolumeSetting,
1427 AUDIO_PLAY_ONCE);
1428 }
1429 else
1430 {
1431 audio_PlaySoundID(AUDIO_BUZZER, melody_id, (BYTE)current.volumeSetting,
1432 AUDIO_PLAY_ONCE);
1433 }
1434 #else
1435 audio_PlaySoundID(AUDIO_BUZZER, melody_id, (BYTE)current.volumeSetting,
1436 AUDIO_PLAY_ONCE);
1437 #endif
1438 /* END - RAVI - 20-1-2006 */
1439 #endif
1440
1441 }
1442 #endif
1443
1444 /*******************************************************************************
1445
1446 $Function: soundsPlayRinger
1447
1448 $Description: Play the tune selected by melody_id, stopping any currently
1449 playing tunes if necessary. Remember to take into account the
1450 volume setting and provide a crescendo if requested
1451
1452 $Returns: None
1453
1454 $Arguments: melody_id, selects the melody to be played
1455
1456 *******************************************************************************/
1457 //Apr 05, 2005 REF: ENH 29994 xdeepadh
1458 #ifndef FF_MIDI_RINGER
1459 static void soundsPlayRinger( int melody_id )
1460 {
1461 CurrentTune = melody_id;
1462 if (LastTune)
1463 {
1464 #ifdef FF_MMI_RINGTONE /*MSL Stop */
1465 audio_StopSoundbyID( AUDIO_BUZZER, CALLTONE_SELECT);
1466 #else
1467 audio_StopSoundbyID (AUDIO_BUZZER,LastTune );
1468 #endif
1469 }
1470 vsi_t_sleep(0, 5);
1471
1472 if (current.volumeSetting == increasing)
1473 {
1474
1475 #ifdef FF_MMI_RINGTONE /* MSL Ring Tone Play */
1476 audio_PlaySoundID ( AUDIO_BUZZER, CALLTONE_SELECT, 0 , AUDIO_PLAY_CRESCENDO );
1477 #else
1478
1479 /* RAVI - 20-1-2006 */
1480 #ifdef NEPTUNE_BOARD
1481 audio_PlaySoundID(AUDIO_BUZZER, CurrentTune, current.volumeSetting, AUDIO_PLAY_ONCE);
1482 #else
1483 audio_PlaySoundID ( AUDIO_BUZZER,CurrentTune, 0 , AUDIO_PLAY_CRESCENDO );
1484 #endif
1485 /* END RAVI */
1486 #endif
1487
1488 }
1489 else
1490 {
1491
1492 #ifdef FF_MMI_RINGTONE /* MSL Ring Tone Play */
1493 audio_PlaySoundID ( AUDIO_BUZZER, CALLTONE_SELECT, 0, AUDIO_PLAY_ONCE );
1494 #else
1495
1496 /* RAVI - 20-1-2006 */
1497 #ifdef NEPTUNE_BOARD
1498 audio_PlaySoundID(AUDIO_BUZZER, CurrentTune, current.volumeSetting, AUDIO_PLAY_ONCE);
1499 #else
1500 audio_PlaySoundID ( AUDIO_BUZZER,CurrentTune, 0, AUDIO_PLAY_ONCE );
1501 #endif
1502 /* END RAVI */
1503 #endif
1504
1505 }
1506 LastTune = CurrentTune;
1507 }
1508 #endif
1509
1510 #if(0) /* x0039928 - Lint warning removal */
1511 /*******************************************************************************
1512
1513 $Function: destroyDynaMenu
1514
1515 $Description: frees the memory allocated to a dynamenu (Refer to the
1516 buildMelodyMenu routine below
1517
1518 $Returns: None.
1519
1520 $Arguments: None.
1521
1522 *******************************************************************************/
1523
1524 static void destroyDynaMenu( void )
1525 {
1526
1527 }
1528
1529 #endif
1530 /*******************************************************************************
1531
1532 $Function: buildMelodyMenu
1533
1534 $Description: Builds the melody menu dynamenu from the melodies supplied
1535 by the resource manager
1536
1537 $Returns: None
1538
1539 $Arguments: None
1540
1541 *******************************************************************************/
1542 static T_MFW_HND buildMelodyMenu( MfwHnd parent_window)
1543 {
1544 T_MELODY_INFO * data = (T_MELODY_INFO *)ALLOC_MEMORY (sizeof (T_MELODY_INFO));
1545 T_MFW_WIN * win;
1546
1547 TRACE_FUNCTION (">>>> buildMelodyMenu()");
1548
1549 /*
1550 * Create window handler
1551 */
1552
1553 data->sounds_win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)melody_win_cb);
1554 if (data->sounds_win EQ NULL)
1555 {
1556 return NULL;
1557 }
1558
1559 TRACE_EVENT(">>>> Melody window created: " );
1560 /*
1561 * connect the dialog data to the MFW-window
1562 */
1563
1564 data->mmi_control.dialog = (T_DIALOG_FUNC)melody_exec_cb;
1565 data->mmi_control.data = data;
1566 win = ((T_MFW_HDR *)data->sounds_win)->data;
1567 win->user = (void *)data;
1568 data->parent = parent_window;
1569 winShow(data->sounds_win);
1570 /*
1571 * return window handle
1572 */
1573
1574 return data->sounds_win;
1575 }
1576
1577 /*******************************************************************************
1578
1579 $Function: melody_exec_cb
1580
1581 $Description: Exec callback function of the SMS read window (dynamic list of
1582 all the SMS)
1583
1584 $Returns: none
1585
1586 $Arguments: win - window handler
1587 event - mfw event
1588 parameter - optional data.
1589
1590 *******************************************************************************/
1591 void melody_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
1592 {
1593 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data;
1594 T_MELODY_INFO * data = (T_MELODY_INFO *)win_data->user;
1595 UBYTE i;
1596 UBYTE numberOfMelodies=0;
1597 #ifdef FF_MIDI_RINGER
1598 UBYTE file_count=0;
1599 #endif
1600 ListWinInfo * mnu_data = (ListWinInfo *)parameter;
1601
1602 TRACE_FUNCTION (">>>>> melody_exec_cb()");
1603
1604 switch (event)
1605 {
1606 case E_INIT:
1607
1608 TRACE_EVENT(">>>> melody_exec_cb() Event:E_INIT");
1609
1610 /* initialization of administrative data */
1611
1612 data->menu_list_data = (ListMenuData *)ALLOC_MEMORY(sizeof(ListMenuData));
1613
1614 if(data->menu_list_data == 0)
1615 {
1616 TRACE_EVENT("Failed memory alloc 1 ");
1617 return;
1618 }
1619 /*Apr 05, 2005 REF: ENH 29994 xdeepadh */
1620 #ifdef FF_MIDI_RINGER
1621 numberOfMelodies = sounds_midi_return_file_number();
1622 TRACE_EVENT_P1("numberOfMelodies is %d",numberOfMelodies);
1623 /*In case no files have been loaded display info message */
1624 if(numberOfMelodies <= 0)
1625 {
1626 sounds_show_info(0, TxtMidiFileNotLoaded, TxtNull, NULL);
1627 return;
1628
1629 }
1630 #else
1631 numberOfMelodies = resource_GetListCount(RES_MELODY);
1632 #endif
1633
1634 data->menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( numberOfMelodies * sizeof(T_MFW_MNU_ITEM) );
1635
1636 if(data->menu_list_data->List == 0)
1637 {
1638 TRACE_EVENT("Failed memory alloc 2");
1639 return;
1640 }
1641
1642 for (i = 0; i < numberOfMelodies ; i++)
1643 {
1644 mnuInitDataItem(&data->menu_list_data->List[i]);
1645 data->menu_list_data->List[i].flagFunc = item_flag_none;
1646
1647 /* Display the midi file names in the list */
1648 /*Apr 05, 2005 REF: ENH 29994 xdeepadh */
1649 #ifdef FF_MIDI_RINGER
1650 data->menu_list_data->List[i].str = (char *)sounds_midi_return_file_name(file_count++);
1651 #else
1652 data->menu_list_data->List[i].str = (char *)MelodyTable[i];
1653 #endif
1654 }
1655
1656 data->menu_list_data->ListLength =numberOfMelodies;
1657 data->menu_list_data->ListPosition = 1;
1658 data->menu_list_data->CursorPosition = 1;
1659 data->menu_list_data->SnapshotSize = numberOfMelodies;
1660 data->menu_list_data->Font = 0;
1661 data->menu_list_data->LeftSoftKey = TxtSoftSelect;
1662 data->menu_list_data->RightSoftKey = TxtSoftBack;
1663 data->menu_list_data->KeyEvents = KEY_ALL;
1664 data->menu_list_data->Reason = 0;
1665 data->menu_list_data->Strings = TRUE;
1666 data->menu_list_data->Attr = (MfwMnuAttr*)&melody_menuAttrib;
1667 /* Apr 05, 2005 REF: ENH 29994 xdeepadh */
1668 #ifdef FF_MIDI_RINGER
1669 data->menu_list_data->Attr->hdrId = TxtMidiFileTitle;
1670 #endif
1671 data->menu_list_data->autoDestroy = FALSE;
1672 listDisplayListMenu(win, data->menu_list_data,(ListCbFunc)MelodyList_cb,0);
1673
1674 #ifdef FF_MIDI_RINGER
1675 selected_tone=data->menu_list_data->ListPosition-1;
1676 stopPlayerTimer();
1677 startPlayerTimer();
1678 #endif
1679
1680 /* Start playing first ringtone on initial list display - RAVI - 23-12-2005 */
1681 #ifdef NEPTUNE_BOARD
1682 if(getMelodyListStatus()== TRUE)
1683 {
1684 stopPlayingMelody ();
1685 startPlayingMelody(0); /* Play the first menu item which is being selected */
1686 LastTune = FIRST_TONE_PLAYED; /* First Menu Item - Ringer is selected */
1687 }
1688 #endif
1689 /* RAVI - 23-12-2005 */
1690
1691 break;
1692
1693 case E_START_MELODY:
1694 /* Apr 05, 2005 REF: ENH 29994 xdeepadh */
1695 /* Play the midi file when the user has scrolled */
1696 #ifdef FF_MIDI_RINGER
1697 selected_tone=mnu_data->MenuData.ListPosition;
1698 stopPlayerTimer();
1699 startPlayerTimer();
1700 #else
1701
1702 /* When cursor moved - Stop playing old and start playing new - RAVI - 23-12-2005 */
1703 #ifndef NEPTUNE_BOARD
1704 startPlayingMelody(mnu_data->MenuData.ListPosition);
1705 #else
1706 stopPlayingMelody();
1707 startPlayingMelody(mnu_data->MenuData.ListPosition);
1708 LastTune = mnu_data->MenuData.ListPosition+1; /* Store the late tune in global variable */
1709 #endif /* END RAVI */
1710 #endif
1711
1712 break;
1713
1714 case E_RETURN:
1715 break;
1716 default:
1717 break;
1718 }
1719 }
1720 /*******************************************************************************
1721
1722 $Function: MelodyList_cb
1723
1724 $Description: Callback function for the melody list.
1725
1726 $Returns: none
1727
1728 $Arguments: Parent - parent window.
1729 ListData - Menu item list
1730 *******************************************************************************/
1731
1732 void MelodyList_cb(T_MFW_HND * Parent, ListMenuData * ListData)
1733 {
1734 T_MFW_WIN * win_data = ((T_MFW_HDR *)Parent)->data;
1735 T_MELODY_INFO * data = (T_MELODY_INFO *)win_data->user;
1736 /*Apr 05, 2005 REF: ENH 29994 xdeepadh */
1737 #ifdef FF_MIDI_RINGER
1738 T_AS_PLAYER_TYPE player_type;
1739
1740 #ifdef FF_MIDI_LOAD_FROM_MEM
1741 T_MELODY memory_pointer;
1742 #else
1743 char * filename;
1744 #endif
1745 #endif
1746
1747 if ((ListData->Reason EQ LISTS_REASON_BACK) || (ListData->Reason EQ LISTS_REASON_CLEAR)
1748 || (ListData->Reason EQ LISTS_REASON_HANGUP)) /* sbh - added hangup key */
1749 {
1750
1751 /*Stop playing ringtone on press of BACK/ CLEAR/ HANGUP - RAVI - 23-12-2005 - SR 13873 */
1752 #ifdef NEPTUNE_BOARD
1753 stopPlayingMelody();
1754 #endif
1755 /* END RAVI - 23-12-2005 */
1756
1757 }
1758 else if(ListData->Reason EQ LISTS_REASON_SELECT)
1759 {
1760 switch(soundReason)
1761 {
1762 case MelodySelect:
1763 TRACE_EVENT("selecting file");
1764 #ifdef FF_MIDI_RINGER /*Use Midi Player*/
1765 #ifdef FF_MIDI_LOAD_FROM_MEM/*If Loc ULC */
1766 memory_pointer=sounds_midi_return_memory_location(ListData->ListPosition);
1767 player_type=mfw_ringer_deduce_player_type(memory_pointer.melody_name);
1768 mfw_ringer_set_memory(player_type,AS_RINGER_MODE_IC,(UINT32*)memory_pointer.melody,(UINT32)memory_pointer.melody_size);
1769 #else
1770 filename =sounds_midi_return_file_name(ListData->ListPosition);
1771 player_type=mfw_ringer_deduce_player_type(filename);
1772 mfw_ringer_set_file(player_type,AS_RINGER_MODE_IC,filename);
1773 #endif
1774
1775 #else //Use Buzzer
1776 stopPlayingMelody();
1777 current.ringer = ListData->ListPosition;
1778 #endif
1779
1780 break;
1781
1782 case SettingSMSTone:
1783
1784 #ifdef FF_MIDI_RINGER //Use Midi Player
1785 #ifdef FF_MIDI_LOAD_FROM_MEM //If ULC
1786 memory_pointer=sounds_midi_return_memory_location(ListData->ListPosition);
1787 player_type=mfw_ringer_deduce_player_type(memory_pointer.melody_name);
1788 mfw_ringer_set_memory(player_type,AS_RINGER_MODE_SMS,(UINT32*)memory_pointer.melody,(UINT32)memory_pointer.melody_size);
1789 #else
1790 filename =sounds_midi_return_file_name(ListData->ListPosition);
1791 player_type=mfw_ringer_deduce_player_type(filename);
1792 mfw_ringer_set_file(player_type,AS_RINGER_MODE_SMS,filename);
1793 #endif
1794 #else/*Use Buzzer*/
1795 stopPlayingMelody();
1796 current.SMSTone = ListData->ListPosition; /* For SMS tones - starting from 40 */
1797 /* Store in FFS - RAVI - 23-12-2005 - SR 13873 */
1798 #ifdef NEPTUNE_BOARD
1799 FFS_flashData.SMSTone= current.SMSTone;
1800 flash_write();
1801 #endif
1802 /* END RAVI - 23-12-2005 */
1803 #endif
1804
1805 break;
1806
1807 case SettingAlarm:
1808 #ifdef FF_MIDI_RINGER /* Use Midi Player */
1809 #ifdef FF_MIDI_LOAD_FROM_MEM
1810 memory_pointer=sounds_midi_return_memory_location(ListData->ListPosition);
1811 player_type=mfw_ringer_deduce_player_type(memory_pointer.melody_name);
1812 mfw_ringer_set_memory(player_type,AS_RINGER_MODE_ALARM,(UINT32*)memory_pointer.melody,(UINT32)memory_pointer.melody_size);
1813 #else
1814 filename =sounds_midi_return_file_name(ListData->ListPosition);
1815 player_type=mfw_ringer_deduce_player_type(filename);
1816 mfw_ringer_set_file(player_type,AS_RINGER_MODE_ALARM,filename);
1817 #endif
1818 #else/*Use Buzzer*/
1819 // need to check alarm status MZ.
1820 current.AlarmOn = ListData->ListPosition;
1821 /* Store in FFS - RAVI - 23-12-2005 - SR 13873 */
1822 #ifdef NEPTUNE_BOARD
1823 FFS_flashData.AlarmOn= current.AlarmOn;
1824 flash_write();
1825 #endif
1826 /* END RAVI - 23-12-2005 */
1827 #endif
1828
1829 default:
1830 break;
1831 }
1832 /* Apr 05, 2005 REF: ENH 29994 xdeepadh */
1833 /* Store selected melody in PCM storage. */
1834 #ifdef FF_MIDI_RINGER
1835 sounds_show_info(0, TxtSelected, TxtNull, NULL);
1836 #endif
1837 }
1838
1839 #ifdef FF_MIDI_RINGER
1840 stopPlayerTimer();
1841 // DRT:OMAPS00163752 including changes from OMAPS00151417 (x0086292)
1842 //mfw_player_stop(sounds_midi_player_stop_cb);
1843 #else
1844 stopPlayingMelody();
1845 #endif
1846 listsDestroy(ListData->win);
1847 melody_destroy(data->sounds_win);
1848
1849 }
1850
1851 /*******************************************************************************
1852
1853 $Function: melody_destroy
1854
1855 $Description: Destroy the melody window.
1856
1857 $Returns: none
1858
1859 $Arguments: own_window- current window
1860 *******************************************************************************/
1861
1862 static void melody_destroy(MfwHnd own_window)
1863 {
1864 T_MFW_WIN * win_data;
1865 T_MELODY_INFO * data;
1866 UBYTE numberOfMelodies;
1867
1868 TRACE_FUNCTION ("melody_destroy()");
1869
1870 if (own_window)
1871 {
1872 win_data = ((T_MFW_HDR *)own_window)->data;
1873 data = (T_MELODY_INFO *)win_data->user;
1874
1875 if (data)
1876 {
1877 /*
1878 * Delete WIN handler
1879 */
1880 win_delete (data->sounds_win);
1881
1882 /*
1883 * Free Memory
1884 */
1885 //Apr 05, 2005 REF: ENH 29994 xdeepadh
1886 #ifdef FF_MIDI_RINGER
1887 numberOfMelodies = sounds_midi_return_file_number();
1888 #else
1889 numberOfMelodies = resource_GetListCount(RES_MELODY);
1890 #endif
1891
1892 if (data->menu_list_data != NULL)
1893 {
1894 FREE_MEMORY ((void *)data->menu_list_data->List, numberOfMelodies * sizeof (T_MFW_MNU_ITEM));
1895 FREE_MEMORY ((void *)data->menu_list_data, sizeof (ListMenuData));
1896 }
1897 FREE_MEMORY ((void *)data, sizeof (T_MELODY_INFO));
1898 //Apr 05, 2005 REF: ENH 29994 xdeepadh
1899 #ifdef FF_MIDI_RINGER
1900 //Delete the timer used for scrolling
1901 if(hPlayerStartTimer!=NULL)
1902 timDelete(hPlayerStartTimer);
1903 #endif
1904
1905 }
1906 else
1907 {
1908 TRACE_EVENT ("melody_destroy() called twice");
1909 }
1910 }
1911 }
1912
1913 /*******************************************************************************
1914
1915 $Function: melody_win_cb
1916
1917 $Description: Window callback function for the melody window.
1918
1919 $Returns: none
1920
1921 $Arguments: w - mfw window handler
1922 e - mfw event
1923
1924 *******************************************************************************/
1925
1926 static int melody_win_cb (MfwEvt e, MfwWin *w) /* yyy window event handler */
1927 {
1928 TRACE_FUNCTION ("melody_win_cb()");
1929 switch (e)
1930 {
1931 case MfwWinVisible: /* window is visible */
1932 break;
1933 case MfwWinFocussed: /* input focus / selected */
1934 case MfwWinDelete: /* window will be deleted */
1935
1936 default:
1937 return MFW_EVENT_REJECTED;
1938 }
1939 return MFW_EVENT_CONSUMED;
1940 }
1941
1942 #if(0) /* x0039928 - Lint warning removal */
1943 /*******************************************************************************
1944
1945 $Function: melody_menu_cb
1946
1947 $Description: Call back function for the melody menu.
1948
1949 $Returns:
1950
1951 $Arguments:
1952 *******************************************************************************/
1953
1954 static int melody_menu_cb (MfwEvt e, MfwMnu *m){
1955
1956 /* T_MFW_HND win = mfwParent(mfw_header()); */ /* RAVI */
1957 /* T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data; */ /* RAVI */
1958
1959 switch (e)
1960 {
1961 case E_MNU_ESCAPE:
1962 break;
1963 default:
1964 return 0;
1965 }
1966 return 1;
1967 }
1968 #endif
1969 /*******************************************************************************
1970
1971 $Function: resource_GetListCount
1972
1973 $Description: Returns the number of entries in resource table.
1974
1975 $Returns: Number of entries in Melody table.
1976
1977 $Arguments: res - Resource Id.
1978
1979 *******************************************************************************/
1980 int resource_GetListCount(res_ResourceID_type res)
1981 // Returns the number of the resource type available in the phone.
1982 {
1983 int index=0;
1984 switch (res)
1985 {
1986 case RES_MELODY:
1987 while(MelodyTable[index] !=0)
1988 index++;
1989 return index;
1990 /* break; */ /* RAVI */
1991
1992 case RES_LANGUAGE:
1993
1994 break;
1995 case RES_STRING:
1996
1997 break;
1998 default:
1999
2000 break;
2001
2002 }
2003 return index;
2004 }
2005
2006 #if(0) /* x0039928 - Lint warning removal */
2007 /*******************************************************************************
2008
2009 $Function: buildOnOffMenu
2010
2011 $Description: builds an on/off menu and associates it with a context
2012
2013 $Returns: None
2014
2015 $Arguments: count, number of elements in menu
2016 id3, prompt string
2017 active, context into which the menu should be associated
2018
2019 *******************************************************************************/
2020
2021 static void buildOnOffMenu( int count, int id3, int active )
2022 {
2023 }
2024
2025 /*******************************************************************************
2026
2027 $Function: buildVolumeMenu
2028
2029 $Description: builds the volume menu and associates it with the volume
2030 context
2031
2032 $Returns: None
2033
2034 $Arguments: volume, the context to be associated with
2035
2036 *******************************************************************************/
2037
2038 static void buildVolumeMenu( VOL_ENUM volume )
2039 {
2040 }
2041
2042 /*******************************************************************************
2043
2044 $Function: displayDynaMenu
2045
2046 $Description: show one page of the ringer list, determined by item.
2047
2048 $Returns: None
2049
2050 $Arguments: None
2051
2052 *******************************************************************************/
2053
2054 static void displayDynamenu( void )
2055 {
2056
2057 }
2058
2059 /*******************************************************************************
2060
2061 $Function: displayRingerVolume
2062
2063 $Description: shows the volume setting determined by cVolume
2064
2065 $Returns: None
2066
2067 $Arguments: None
2068
2069 *******************************************************************************/
2070
2071 static void displayRingerVolume( void )
2072 {
2073 }
2074
2075 /*******************************************************************************
2076
2077 $Function: displayOnOffList
2078
2079 $Description: show the On Off (3rd) list, determined by item.
2080
2081 $Returns: None
2082
2083 $Arguments: None
2084
2085 *******************************************************************************/
2086
2087 static void displayOnOffList( void )
2088 {
2089 }
2090
2091 /*******************************************************************************
2092
2093 $Function: buildLanguageMenu
2094
2095 $Description: builds the dynamenu for the RES_LANGUAGE resource type
2096
2097 $Returns: None
2098
2099 $Arguments: None
2100
2101 *******************************************************************************/
2102
2103 static void buildLanguageMenu(void)
2104 {
2105
2106 }
2107
2108 #endif
2109
2110 #ifndef FF_MIDI_RINGER /* x0039928 - Lint warning removal */
2111 /*******************************************************************************
2112
2113 $Function: delayThenPlayMelody
2114
2115 $Description: play selected ringer melody after short delay
2116
2117 $Returns: None
2118
2119 $Arguments: None
2120
2121 *******************************************************************************/
2122
2123 static void delayThenPlayMelody( void )
2124 {
2125
2126 /* start timer for half a second and on timeout start everlasting play
2127 */
2128 timStart( hRingerStartTimer );
2129 }
2130 #endif
2131
2132 /*******************************************************************************
2133
2134 $Function: playCurrentSound
2135
2136 $Description: play tune which is temporarily selected, this event handler
2137 is invoked when the hRingerStartTimer event completes
2138
2139 $Returns: MFW_EVENT_CONSUMED always
2140
2141 $Arguments: e, event, tc timer context
2142
2143 *******************************************************************************/
2144 //Apr 05, 2005 REF: ENH 29994 xdeepadh
2145 #ifndef FF_MIDI_RINGER
2146 static int playCurrentSound( MfwEvt e, MfwTim *tc )
2147 {
2148 soundsPlayRinger(current.ringer);
2149
2150 // stop running timer (One shot mode only)
2151 if (hRingerStartTimer != NULL ) {
2152 timStop(hRingerStartTimer);
2153 }
2154
2155 return MFW_EVENT_CONSUMED;
2156 }
2157
2158 #endif
2159 #ifdef MMI_LINT_WARNING_REMOVAL /* x0039928 - Lint warning removal */
2160 /*******************************************************************************
2161
2162 $Function: setSelection
2163
2164 $Description: reactivates calling menu after confirming setting
2165
2166 $Returns: MFW_EVENT_PASSED always
2167
2168 $Arguments: e, event, m, window handle
2169
2170 *******************************************************************************/
2171
2172 static int setSelection( MfwEvt e, MfwWin *m )
2173 {
2174 //int UpdatePCM = 0; // RAVI
2175 // int SoundToPlay = -1; // RAVI
2176
2177 TRACE_FUNCTION("setSelection");
2178
2179 /* This implements a state machine, the next setting depends
2180 on the reason we have been invoked
2181
2182 Note the following is still pending implementation
2183 USSD TONE, SVC TONE, MANPLMN TONE
2184 */
2185 switch (soundReason)
2186 {
2187 case MelodySelect:
2188 {
2189 }
2190 break;
2191
2192 case SettingVolume:
2193 {
2194 }
2195 break;
2196
2197 default:
2198 {
2199 /* No action required
2200 */
2201 }
2202 break;
2203 }
2204
2205
2206 /* redisplay sub menu showing changed position of active marker.
2207 */
2208 winShow( win );
2209
2210 return MFW_EVENT_PASSED;
2211 }
2212
2213
2214 /*******************************************************************************
2215
2216 $Function: writeSettingsToPCM
2217
2218 $Description: writes contents of global vars of sounds to PCM or
2219 sets default values
2220
2221 $Returns: None
2222
2223 $Arguments: flush, dictates whether or not flushing should be
2224 performed on the write operation
2225
2226 *******************************************************************************/
2227 static void writeSettingsToPCM( U8 flush )
2228 {
2229 }
2230 /*******************************************************************************
2231
2232 $Function: readSettingsFromPCM
2233
2234 $Description: inits global vars of sounds from PCM or
2235 sets default values
2236
2237 $Returns: None
2238
2239 $Arguments: None
2240
2241 *******************************************************************************/
2242
2243 static void readSettingsFromPCM(void)
2244 {
2245 }
2246
2247 /*******************************************************************************
2248
2249 $Function: soundsCreate
2250
2251 $Description: Create a sounds context, with a window, keyboards, timers
2252 etc.
2253
2254 $Returns: None
2255
2256 $Arguments: parent, handle of the parent window
2257
2258 *******************************************************************************/
2259
2260 static void soundsCreate(MfwHnd parent)
2261 {
2262
2263 }
2264
2265
2266 /*******************************************************************************
2267
2268 $Function: soundsDestroy
2269
2270 $Description: cleans up a context
2271
2272 $Returns: None
2273
2274 $Arguments: None
2275
2276 *******************************************************************************/
2277
2278 static void soundsDestroy(void)
2279 {
2280
2281 }
2282
2283
2284 /*******************************************************************************
2285
2286 $Function: getCallingMenu
2287
2288 $Description: handles transition to calling menu
2289 a) on timeout,
2290 b) during running timer when Clear, SoftKeyLeft
2291 or SoftKeyRight is pressed
2292
2293 $Returns: MFW_EVENT_PASSED
2294
2295 $Arguments: e, event, tc, timer context
2296
2297 *******************************************************************************/
2298
2299 static int getCallingMenu(MfwEvt e, MfwTim *tc)
2300 {
2301 TRACE_FUNCTION( "BACK to invocating Menu" );
2302
2303 return 0;
2304 }
2305
2306
2307 /*******************************************************************************
2308
2309 $Function: winEvent
2310
2311 $Description: window event handler, only deals with the win visible
2312 event, all others are ignored
2313
2314 $Returns: MFW_EVENT_PASSED or MFW_EVENT_CONSUMED depending on the
2315 event
2316
2317 $Arguments: e, event, w, window handle
2318
2319 *******************************************************************************/
2320
2321 static int winEvent (MfwEvt e, MfwWin *w)
2322 {
2323 return MFW_EVENT_CONSUMED;
2324 }
2325
2326
2327 /*******************************************************************************
2328
2329 $Function: keyEventLong
2330
2331 $Description: keyboard event handler Long press
2332
2333 $Returns: MFW_EVENT_PASSED or MFW_EVENT_CONSUMED depending on the
2334 event
2335
2336 $Arguments: e, event, k, keyboard handle
2337
2338 *******************************************************************************/
2339
2340 static int keyEventLong (MfwEvt e, MfwKbd *k)
2341 {
2342 PTRACE( sprintf( buf, "keycode in SOUND keyEvtLong %d", (int) k->code ); )
2343 PTRACE( sprintf( buf, "mfwEvt in SOUND Long 0x%10x", e ); )
2344
2345
2346 return MFW_EVENT_PASSED; /* give other handlers a chance */
2347 }
2348
2349 /*******************************************************************************
2350
2351 $Function: keyEvent
2352
2353 $Description: keyboard event handler
2354
2355 $Returns: MFW_EVENT_PASSED or MFW_EVENT_CONSUMED depending on the
2356 event
2357
2358 $Arguments: e, event, k, keyboard handle
2359
2360 *******************************************************************************/
2361
2362 static int keyEvent (MfwEvt e, MfwKbd *k)
2363 {
2364
2365 PTRACE( sprintf( buf, "keycode in SOUND keyEvt %d", (int) k->code ); )
2366 PTRACE( sprintf( buf, "mfwEvt in SOUND 0x%10x", e ); )
2367
2368 return MFW_EVENT_CONSUMED;
2369 }
2370
2371
2372 /*******************************************************************************
2373
2374 $Function: stepVibrator
2375
2376 $Description: Changes the state of the vibrator from vibrating to
2377 not vibrating and then restarts the vibration timer
2378
2379 $Returns: None
2380
2381 $Arguments: None
2382
2383 *******************************************************************************/
2384
2385 static void stepVibrator( void )
2386 {
2387 TRACE_FUNCTION("Vibrator Ringing");
2388
2389 }
2390
2391
2392 /*******************************************************************************
2393
2394 $Function: ringVibrator
2395
2396 $Description: generates the ringing vibrations as configured
2397
2398 $Returns: New setting of the vibrator counter
2399
2400 $Arguments: c, pointer to a vibrator counter
2401
2402 *******************************************************************************/
2403
2404 static int ringVibrator( UBYTE *c )
2405 {
2406 return 0;
2407 }
2408
2409
2410 /*******************************************************************************
2411
2412 $Function: VibratorTimerEvent
2413
2414 $Description: Vibrator timer event
2415
2416 $Returns: Event consumed, always
2417
2418 $Arguments: e, event, t, timer
2419
2420 *******************************************************************************/
2421
2422 static int VibratorTimerEvent ( MfwEvt e, MfwTim *t )
2423 {
2424
2425 return MFW_EVENT_CONSUMED;
2426 }
2427
2428 #endif
2429 /*******************************************************************************
2430
2431 $Function: volumeSettingTimeOut
2432
2433 $Description: The Ringer volume settings time out has occured and used has not selected
2434 a volume setting.
2435
2436 $Returns: MFW_EVENT_CONSUMED always
2437
2438 $Arguments: e, event, tc timer context
2439
2440 *******************************************************************************/
2441 static int volumeSettingTimeOut( MfwEvt e, MfwTim *tc )
2442 {
2443 T_MFW_HND win = mfw_parent(mfw_header());
2444 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
2445 T_idle * idle_data = (T_idle *)win_data->user;
2446
2447 TRACE_EVENT(">>>> volumeSettingTimeOut(), Vol Setiing Time out. ");
2448
2449 // stop running timer.
2450 if (hRingerVolSettingTimeOut != NULL ) {
2451 timStop(hRingerVolSettingTimeOut);
2452 }
2453 //When the timer times out, stop the song and the timer.
2454 #ifdef FF_MIDI_RINGER //Use Midi Player
2455 if(soundReason==SettingVolume)
2456 {
2457 // Are we playing a tune
2458 if ( hPlayerStartTimer!= NULL )
2459 timStop( hPlayerStartTimer );
2460 mfw_player_stop(sounds_midi_player_stop_cb);
2461 }
2462 #endif
2463
2464 if(call_data.win_menu !=NULL && (call_data.call_direction == MFW_CM_MTC))
2465 {
2466 bookMenuDestroy(call_data.win_menu);
2467 /*
2468 If volume settings dialog timed out while in the incoming call, allow the
2469 ringer to continue ringing. MZ 9/4/01
2470 */
2471 #ifdef FF_MIDI_RINGER
2472 mfw_ringer_start(AS_RINGER_MODE_IC,true,sounds_midi_ringer_start_cb);
2473 #else
2474 /* Volume Setting for Silent */
2475 startPlayingMelody(getCurrentRingerSettings());
2476 #endif
2477
2478
2479 }
2480 else if (idle_data->info_win != NULL )
2481 {
2482 bookMenuDestroy(idle_data->info_win);
2483 }
2484
2485 return MFW_EVENT_CONSUMED;
2486 }
2487
2488 /*******************************************************************************
2489
2490 Public Methods
2491
2492 *******************************************************************************/
2493 /* RAVI - 20-1-2006 */
2494 #ifdef NEPTUNE_BOARD
2495 /* ===========================================================*/
2496 /**
2497 * restorePreviousVolumeSetting () will restore the previous volume setting once the menu has
2498 * been scrolled.
2499 *
2500 * @param None.
2501 *
2502 * @return None
2503 *
2504 * @see
2505 */
2506 /* =========================================================== */
2507
2508 void restorePreviousVolumeSetting(void)
2509 {
2510 current.volumeSetting = lastVolumeSetting;
2511 }
2512
2513 /* ===========================================================*/
2514 /**
2515 * volumeMenuScrollUp () when menu button is moved up then this function will get called which
2516 * decrements value for the global variable used to maintain the volume setting while scrolling
2517 * through the menu.
2518 *
2519 * @param None.
2520 *
2521 * @return None
2522 *
2523 * @see
2524 */
2525 /* =========================================================== */
2526 void volumeMenuScrollUp (void)
2527 {
2528 /* Decrement Volume setting when scroll up */
2529 scrollVolumeSetting = scrollVolumeSetting - 1 ;
2530
2531 if (scrollVolumeSetting < SILENT_SETTING)
2532 {
2533 scrollVolumeSetting = MAX_VOLUME_SETTING;
2534 }
2535
2536 /* current.volumeSetting = scrollVolumeSetting; */
2537 vsi_t_sleep(0,20);
2538 }
2539
2540
2541 /* ===========================================================*/
2542 /**
2543 * volumeMenuScrollDown () when menu button is moved down then this function will get called which
2544 * increments value for the global variable used to maintain the volume setting while scrolling
2545 * through the menu.
2546 *
2547 * @param None.
2548 *
2549 * @return None
2550 *
2551 * @see
2552 */
2553 /* =========================================================== */
2554 void volumeMenuScrollDown (void)
2555 {
2556 /* Increment Volume setting when scroll down */
2557 scrollVolumeSetting = scrollVolumeSetting + 1;
2558
2559 if (scrollVolumeSetting > MAX_VOLUME_SETTING)
2560 {
2561 scrollVolumeSetting = SILENT_SETTING;
2562 }
2563
2564 /* current.volumeSetting = scrollVolumeSetting; */
2565 vsi_t_sleep(0,20);
2566 }
2567
2568 /* ===========================================================*/
2569 /**
2570 * volumeMenuStartPlaying () Will start playing the default melody with the specified volume
2571 * control.
2572 *
2573 * @param None.
2574 *
2575 * @return None
2576 *
2577 * @see
2578 */
2579 /* =========================================================== */
2580 void volumeMenuStartPlaying(void)
2581 {
2582 if(soundReason == SettingVolume)
2583 {
2584 stopPlayingMelody ();
2585 startPlayingMelody(current.ringer); /* Play the first menu item which is being selected */
2586 }
2587 }
2588
2589 /* ===========================================================*/
2590 /**
2591 * volumeMenuStopPlaying () Will stop playing the default melody with the specified volume
2592 * control.
2593 *
2594 * @param None.
2595 *
2596 * @return None
2597 *
2598 * @see
2599 */
2600 /* =========================================================== */
2601 void volumeMenuStopPlaying()
2602 {
2603 if(soundReason == SettingVolume)
2604 {
2605 stopPlayingMelody ();
2606 }
2607 }
2608 #endif
2609 /* END RAVI */
2610
2611 /*******************************************************************************
2612
2613 $Function: restartVolSettingInactivityTimer
2614
2615 $Description: Restart the Volume settings timer.
2616
2617 $Returns: none
2618
2619 $Arguments: none
2620
2621 *******************************************************************************/
2622 void restartVolSettingInactivityTimer(void)
2623 {
2624 if ( hRingerVolSettingTimeOut != NULL )
2625 timStop( hRingerVolSettingTimeOut );
2626
2627 timStart(hRingerVolSettingTimeOut);
2628
2629 }
2630 /*******************************************************************************
2631
2632 $Function: stopRingerVolTimeOut
2633
2634 $Description: Stop the ringer volume settings timer.
2635
2636 $Returns: none
2637
2638 $Arguments: none
2639
2640 *******************************************************************************/
2641 void stopRingerVolSettingInactivityTimer(void)
2642 {
2643
2644 if ( hRingerVolSettingTimeOut != NULL )
2645 timStop( hRingerVolSettingTimeOut );
2646 //Apr 05, 2005 REF: ENH 29994 xdeepadh
2647 #ifdef FF_MIDI_RINGER //Use Midi Player
2648 //Stop the Timer and stop the song before timeout
2649 if ( hPlayerStartTimer!= NULL )
2650 timStop( hPlayerStartTimer );
2651 mfw_player_stop(sounds_midi_player_stop_cb);
2652 #endif
2653 }
2654 /*******************************************************************************
2655
2656 $Function: startRingerVolumeSettingTimer
2657
2658 $Description: Create and start the ringer voulme inactivity timer.
2659
2660 $Returns: none
2661
2662 $Arguments: none
2663
2664 *******************************************************************************/
2665 void startRingerVolSettingInactivityTimer(T_MFW_HND parent_win)
2666 {
2667 T_MFW_HND win = mfw_parent(mfw_header());
2668 T_MFW_WIN * win_data = ((T_MFW_HDR *)win)->data;
2669 T_idle * idle_data = (T_idle *)win_data->user;
2670
2671 TRACE_FUNCTION(">>>> startRingerVolSettingInactivityTime, Create and Start Vol timer ");
2672 //Create 4 second ringer delay timer.
2673 if(hRingerVolSettingTimeOut == NULL )
2674 {
2675 if(call_data.call_direction == MFW_CM_MTC)
2676 {
2677 /* RAVI - 20-1-2006 */
2678 #ifdef NEPTUNE_BOARD
2679 ; /* do nothing */
2680 #else
2681 hRingerVolSettingTimeOut = timCreate(call_data.win, TIM4SECOND, (MfwCb)volumeSettingTimeOut);
2682 #endif
2683 /* END RAVI */
2684 }
2685 else
2686 {
2687 #ifdef NEPTUNE_BOARD
2688 ; /* do nothing */
2689 #else
2690 hRingerVolSettingTimeOut = timCreate(idle_data->win, TIM4SECOND, (MfwCb)volumeSettingTimeOut);
2691 #endif
2692 }
2693 }
2694
2695 if ( hRingerVolSettingTimeOut != NULL )
2696 timStop( hRingerVolSettingTimeOut );
2697
2698 #ifdef NEPTUNE_BOARD
2699 /* RAVI - 20-1-2006 */
2700 /* Initialize the scrolling variable - When volume menu is activated */
2701 scrollVolumeSetting = 0;
2702 lastVolumeSetting = current.volumeSetting;
2703 #endif
2704
2705
2706 #ifndef NEPTUNE_BOARD
2707 timStart(hRingerVolSettingTimeOut);
2708 #endif
2709 /* END RAVI */
2710
2711
2712 }
2713 /*******************************************************************************
2714
2715 $Function: soundsRinger
2716
2717 $Description: prepares Ringer setting screen
2718
2719 $Returns: MFW_EVENT_CONSUMED always
2720
2721 $Arguments: m, menu, i, item
2722
2723 *******************************************************************************/
2724
2725 int soundsRinger( MfwMnu *m, MfwMnuItem *i )
2726 {
2727 T_MFW_HND win;
2728 T_MFW_HND parent_win = mfw_parent(mfw_header());
2729 /*Apr 05, 2005 REF: ENH 29994 xdeepadh */
2730 #ifdef FF_MIDI_RINGER
2731 int numberOfMelodies=0;
2732
2733 TRACE_EVENT("soundsRinger");
2734 //Sep 11, 2006 DR: OMAPS00094182 xrashmic
2735 TRACE_EVENT("populating files");
2736 sounds_midi_init();
2737
2738
2739
2740 numberOfMelodies = sounds_midi_return_file_number();
2741 TRACE_EVENT_P1("numberOfMelodies is %d",numberOfMelodies);
2742
2743 if(numberOfMelodies <= 0)
2744 {
2745 sounds_show_info(0, TxtMidiFileNotLoaded, TxtNull, NULL);
2746 return MFW_EVENT_CONSUMED;
2747 }
2748 else
2749 {
2750 //Set the voice limit to 32 and channel to stereo in idle mode
2751 //Set the audiopath to speaker.
2752 mfw_ringer_set_audiopath();
2753 mfw_player_midi_set_params(FF_MIDI_VOICE_LIMIT,MIDI_CHANNEL_STEREO);
2754 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh
2755 //Set the Mp3 Parameters .Size of the file where the melody must start is set 0(from beginning)
2756 //and channel is set to stereo.
2757 #ifdef FF_MP3_RINGER
2758 mfw_player_mp3_set_params(MP3_PLAY_FROM_START,MP3_CHANNEL_STEREO);
2759 #endif //FF_MP3_RINGER
2760
2761 //Nov 21, 2005 REF:ER OMAPS00057430 nekkareb
2762 //Set the AAC Parameters .Size of the file where the melody must start is set 0(from beginning)
2763 //and channel is set to stereo.
2764 #ifdef FF_AAC_RINGER
2765 mfw_player_aac_set_params(AAC_PLAY_FROM_START,AAC_CHANNEL_STEREO);
2766 #endif //FF_AAC_RINGER
2767
2768
2769 hPlayerStartTimer = timCreate( 0, TIMHALFSECOND, (MfwCb)playCurrentMelody);
2770 win = buildMelodyMenu(parent_win);
2771
2772 if (win NEQ NULL)
2773 {
2774 SEND_EVENT (win, E_INIT, 0, 0);
2775 }
2776 return MFW_EVENT_CONSUMED;
2777 }
2778 #else
2779 /*recources_Init (win);*/
2780
2781 /* Timer not requried for Neptune - RAVI 23-12-2005 */
2782 #ifndef NEPTUNE_BOARD
2783 /* Create 0.5 second ringer delay timer. */
2784 hRingerStartTimer = timCreate( 0, TIMHALFSECOND, (MfwCb)playCurrentSound);
2785 #endif
2786 /* END ADD BY RAVI - 23-12-2005 */
2787
2788 win = buildMelodyMenu(parent_win);
2789
2790 if (win NEQ NULL)
2791 {
2792 SEND_EVENT (win, E_INIT, 0, 0);
2793 }
2794
2795 /* For Neptune Not Required - RAVI - 23-12-2005 */
2796 #ifndef NEPTUNE_BOARD
2797 /* Start the 0.5 second ringer delay timer. */
2798 delayThenPlayMelody();
2799 #endif
2800 /* END ADD BY RAVI - 23-12-2005 */
2801
2802 return MFW_EVENT_CONSUMED;
2803 #endif
2804 }
2805
2806
2807 /*******************************************************************************
2808
2809 $Function: soundsVolume
2810
2811 $Description: prepares Volume setting screen
2812
2813 $Returns: MFW_EVENT_CONSUMED always
2814
2815 $Arguments: m, menu, i, item
2816
2817 *******************************************************************************/
2818
2819 int soundsVolume( MfwMnu *m, MfwMnuItem *i )
2820 {
2821
2822 return MFW_EVENT_CONSUMED;
2823 }
2824
2825
2826 /*******************************************************************************
2827
2828 $Function: settingsVibrator
2829
2830 $Description: prepares Vibrator settings screen
2831
2832 $Returns: MFW_EVENT_CONSUMED always
2833
2834 $Arguments: m, menu, i, item
2835
2836 *******************************************************************************/
2837
2838 int settingsVibrator( MfwMnu *m, MfwMnuItem *i )
2839 {
2840
2841 return MFW_EVENT_CONSUMED;
2842 }
2843 /*******************************************************************************
2844
2845 $Function: settingsLanguages
2846
2847 $Description: prepares languages screen
2848
2849 $Returns: MFW_EVENT_CONSUMED always
2850
2851 $Arguments: m, menu, i, item
2852
2853 *******************************************************************************/
2854
2855 int settingsLanguages( MfwMnu *m, MfwMnuItem *i )
2856 {
2857 return MFW_EVENT_CONSUMED;
2858 }
2859
2860 /*******************************************************************************
2861
2862 $Function: soundsNewMessage
2863
2864 $Description: prepares NewMessage setting screen
2865
2866 $Returns: MFW_EVENT_CONSUMED always
2867
2868 $Arguments: m, menu, i, item
2869
2870 *******************************************************************************/
2871
2872 int soundsNewMessage( MfwMnu *m, MfwMnuItem *i )
2873 {
2874
2875 return MFW_EVENT_CONSUMED;
2876 }
2877
2878 /*******************************************************************************
2879
2880 $Function: soundsNewBroadcast
2881
2882 $Description: prepares Broadcast setting screen
2883
2884 $Returns: MFW_EVENT_CONSUMED always
2885
2886 $Arguments: m, menu, i, item
2887
2888 *******************************************************************************/
2889
2890 int soundsNewBroadcast( MfwMnu *m, MfwMnuItem *i )
2891 {
2892
2893 return MFW_EVENT_CONSUMED;
2894 }
2895
2896 /*******************************************************************************
2897
2898 $Function: soundsBatteryLow
2899
2900 $Description: prepares BatteryLow setting screen
2901
2902 $Returns: MFW_EVENT_CONSUMED always
2903
2904 $Arguments: m, menu, i, item
2905
2906 *******************************************************************************/
2907
2908 int soundsBatteryLow( MfwMnu *m, MfwMnuItem *i )
2909 {
2910
2911 return MFW_EVENT_CONSUMED;
2912 }
2913
2914
2915 /*******************************************************************************
2916
2917 $Function: soundsCreditLow
2918
2919 $Description: prepares Credit setting screen
2920
2921 $Returns: MFW_EVENT_CONSUMED always
2922
2923 $Arguments: m, menu, i, item
2924
2925 *******************************************************************************/
2926
2927 int soundsCreditLow( MfwMnu *m, MfwMnuItem *i )
2928 {
2929
2930 return MFW_EVENT_CONSUMED;
2931 }
2932 /*******************************************************************************
2933
2934 $Function: soundsOrganiser
2935
2936 $Description: prepares Organiser setting screen
2937
2938 $Returns: MFW_EVENT_CONSUMED always
2939
2940 $Arguments: m, menu, i, item
2941
2942 *******************************************************************************/
2943
2944 int soundsOrganiser( MfwMnu *m, MfwMnuItem *i )
2945 {
2946
2947 return MFW_EVENT_CONSUMED;
2948 }
2949
2950 /*******************************************************************************
2951
2952 $Function: soundsAlarm
2953
2954 $Description: prepares Alarm setting screen
2955
2956 $Returns: MFW_EVENT_CONSUMED always
2957
2958 $Arguments: m, menu, i, item
2959
2960 *******************************************************************************/
2961
2962 int soundsAlarm( MfwMnu *m, MfwMnuItem *i )
2963 {
2964
2965 return MFW_EVENT_CONSUMED;
2966 }
2967
2968
2969 /*******************************************************************************
2970
2971 $Function: soundInit
2972
2973 $Description: init sounds handling
2974
2975 $Returns: None
2976
2977 $Arguments: parent, handle of parent window
2978
2979 *******************************************************************************/
2980
2981 void soundInit( MfwHnd parent )
2982 {
2983
2984
2985 }
2986
2987
2988 /*******************************************************************************
2989
2990 $Function: soundExit
2991
2992 $Description: exit sounds handling
2993
2994 $Returns: None
2995
2996 $Arguments: None
2997
2998 *******************************************************************************/
2999
3000 void soundExit (void)
3001 {
3002
3003 }
3004
3005
3006 /*******************************************************************************
3007
3008 $Function: soundExec
3009
3010 $Description: sends messages to soundExec to get the various melodies to play
3011
3012 $Returns: None
3013
3014 $Arguments: reason, for invocation, next, state
3015
3016 *******************************************************************************/
3017
3018 void soundExec (int reason, MmiState next)
3019
3020 {
3021
3022 }
3023
3024
3025 /*******************************************************************************
3026
3027 $Function: soundsKeypadSilent
3028
3029 $Description: prepares KeypadTones setting screen
3030
3031 $Returns: MFW_EVENT_CONSUMED always
3032
3033 $Arguments: m, menu, i, item
3034
3035 *******************************************************************************/
3036
3037 int soundsKeypadSilent(MfwMnu* m, MfwMnuItem* i)
3038 {
3039
3040 T_MFW_HND win = mfw_parent(mfw_header());
3041
3042 sounds_Init(win);
3043
3044 if (FFS_flashData.settings_status & SettingsKeypadClick)
3045 {
3046 FFS_flashData.settings_status &= ~SettingsKeypadClick;
3047 }
3048 else if (FFS_flashData.settings_status & SettingsKeypadDTMF)
3049 {
3050 FFS_flashData.settings_status &= ~SettingsKeypadDTMF;
3051 }
3052 flash_write();
3053 sounds_data.local_status = ACTIVATE_CONFIRM;
3054
3055 SEND_EVENT (sounds_data.sounds_win, SHOW_CONFIRM, 0, 0);
3056
3057 return 0;
3058 }
3059 /*******************************************************************************
3060
3061 $Function: soundsKeypadClick
3062
3063 $Description: prepares KeypadTones setting screen
3064
3065 $Returns: MFW_EVENT_CONSUMED always
3066
3067 $Arguments: m, menu, i, item
3068
3069 *******************************************************************************/
3070 int soundsKeypadClick(MfwMnu* m, MfwMnuItem* i)
3071 {
3072
3073 T_MFW_HND win = mfw_parent(mfw_header());
3074
3075 sounds_Init(win);
3076
3077
3078
3079 if (FFS_flashData.settings_status & SettingsKeypadDTMF)
3080 {
3081 FFS_flashData.settings_status &= ~SettingsKeypadDTMF;
3082 }
3083
3084 FFS_flashData.settings_status |= SettingsKeypadClick;
3085
3086 /* RAVI - 20-1-2006 */
3087 /* play KeypadClick */
3088 #ifdef NEPTUNE_BOARD
3089 audio_PlaySoundID(0, TONES_KEYBEEP, current.volumeSetting, AUDIO_PLAY_ONCE);
3090 #else
3091 audio_PlaySoundID(0, TONES_KEYBEEP, 5, AUDIO_PLAY_ONCE ); /* GW#2355 /CQ11341 */
3092 #endif
3093 /* END RAVI */
3094
3095 sounds_data.local_status = ACTIVATE_CONFIRM;
3096
3097 SEND_EVENT (sounds_data.sounds_win, SHOW_CONFIRM, 0, 0);
3098 flash_write();
3099 return 0;
3100 }
3101
3102 /*******************************************************************************
3103
3104 $Function: soundsKeypadDTMF
3105
3106 $Description: prepares KeypadTones setting screen
3107
3108 $Returns: MFW_EVENT_CONSUMED always
3109
3110 $Arguments: m, menu, i, item
3111
3112 *******************************************************************************/
3113 int soundsKeypadDTMF(MfwMnu* m, MfwMnuItem* i)
3114 {
3115
3116 T_MFW_HND win = mfw_parent(mfw_header());
3117
3118 sounds_Init(win);
3119
3120 if (FFS_flashData.settings_status & SettingsKeypadClick)
3121 {
3122 FFS_flashData.settings_status &= ~SettingsKeypadClick;
3123 }
3124
3125
3126
3127 FFS_flashData.settings_status |= SettingsKeypadDTMF;
3128 flash_write();
3129
3130 sounds_data.local_status = ACTIVATE_CONFIRM;
3131
3132 SEND_EVENT (sounds_data.sounds_win, SHOW_CONFIRM, 0, 0);
3133
3134 return 0;
3135 }
3136
3137
3138
3139 /*******************************************************************************
3140
3141 $Function: sounds_Init
3142
3143 $Description:
3144
3145 $Returns:
3146
3147 $Arguments:
3148
3149 *******************************************************************************/
3150 T_MFW_HND sounds_Init (T_MFW_HND parent_window)
3151 {
3152 return (sounds_create (parent_window));
3153 }
3154 /*******************************************************************************
3155
3156 $Function: confirm_Exit
3157
3158 $Description:
3159
3160 $Returns:
3161
3162 $Arguments:
3163
3164 *******************************************************************************/
3165 void sounds_Exit (T_MFW_HND own_window)
3166 {
3167
3168 T_MFW_WIN * win_data = ((T_MFW_HDR *)own_window)->data;
3169 T_MELODY_INFO * data = (T_MELODY_INFO *)win_data->user;
3170
3171 sounds_destroy (data->sounds_win);
3172 }
3173
3174 /*******************************************************************************
3175
3176 $Function: sounds_create
3177
3178 $Description:
3179
3180 $Returns:
3181
3182 $Arguments:
3183
3184 *******************************************************************************/
3185 T_MFW_HND sounds_create (T_MFW_HND parent_window)
3186 {
3187 T_MELODY_INFO * data = &sounds_data;
3188 T_MFW_WIN * win;
3189
3190 TRACE_FUNCTION ("sounds_create()");
3191
3192 data->sounds_win = win_create (parent_window, 0, 0, (T_MFW_CB)sounds_win_cb);
3193
3194 if (data->sounds_win EQ 0)
3195 return 0;
3196
3197 /*
3198 * Create window handler
3199 */
3200 data->mmi_control.dialog = (T_DIALOG_FUNC)sounds;
3201 data->mmi_control.data = data;
3202 win = ((T_MFW_HDR *)data->sounds_win)->data;
3203 win->user = (void *) data;
3204
3205
3206 winShow(data->sounds_win);
3207 /*
3208 * return window handle
3209 */
3210 return data->sounds_win;
3211 }
3212
3213 /*******************************************************************************
3214
3215 $Function: sounds_destroy
3216
3217 $Description:
3218
3219 $Returns:
3220
3221 $Arguments:
3222
3223 *******************************************************************************/
3224 void sounds_destroy (T_MFW_HND own_window)
3225 {
3226 T_MFW_WIN * win;
3227 T_MELODY_INFO * data;
3228
3229 TRACE_FUNCTION ("sounds_destroy()");
3230
3231 if (own_window)
3232 {
3233 win = ((T_MFW_HDR *)own_window)->data;
3234 data = (T_MELODY_INFO *)win->user;
3235
3236 if (data)
3237 {
3238
3239 /*
3240 * Delete WIN handler
3241 */
3242 win_delete (data->sounds_win);
3243 data->sounds_win = 0;
3244 }
3245 }
3246 }
3247 /*******************************************************************************
3248
3249 $Function: sounds_win_cb
3250
3251 $Description:
3252
3253 $Returns:
3254
3255 $Arguments:
3256
3257 *******************************************************************************/
3258 static int sounds_win_cb (T_MFW_EVENT event, T_MFW_WIN * win)
3259 {
3260 /*
3261 * Top Window has no output
3262 */
3263 return 1;
3264 }
3265
3266
3267 /*******************************************************************************
3268
3269 $Function: sounds_dialog
3270
3271 $Description:
3272
3273 $Returns:
3274
3275 $Arguments:
3276
3277 *******************************************************************************/
3278 static void sounds_dialog(void)
3279 {
3280 T_DISPLAY_DATA display_info;
3281
3282 TRACE_FUNCTION ("sounds_dialog()");
3283
3284 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, TxtNull, TxtNull , COLOUR_STATUS);
3285 dlg_initDisplayData_events( &display_info, (T_VOID_FUNC)sounds_dialog_cb, THREE_SECS, KEY_CLEAR | KEY_RIGHT );
3286 if (sounds_data.local_status EQ ACTIVATE_CONFIRM)
3287 {
3288 display_info.TextId = TxtActivated;
3289 }
3290 else
3291 {
3292 display_info.TextId = TxtDeActivated;
3293 }
3294
3295 /*
3296 * Call Info Screen
3297 */
3298 info_dialog (sounds_data.sounds_win, &display_info);
3299
3300 }
3301 /*******************************************************************************
3302
3303 $Function: confirm_dialog_cb
3304
3305 $Description:
3306
3307 $Returns:
3308
3309 $Arguments:
3310
3311 *******************************************************************************/
3312 void sounds_dialog_cb(T_MFW_HND win, UBYTE identifier, UBYTE reason)
3313 {
3314 TRACE_FUNCTION ("sounds_dialog_cb()");
3315
3316 switch (reason)
3317 {
3318 case INFO_TIMEOUT:
3319 /* no break; */
3320 case INFO_KCD_HUP:
3321 /* no break; */
3322 case INFO_KCD_LEFT:
3323 /* no break; */
3324 case INFO_KCD_RIGHT:
3325 /* no break; */
3326 case INFO_KCD_CLEAR:
3327 sounds_Exit(win);
3328 break;
3329 }
3330 }
3331
3332 /*******************************************************************************
3333
3334 $Function: sounds
3335
3336 $Description:
3337
3338 $Returns:
3339
3340 $Arguments:
3341
3342 *******************************************************************************/
3343 void sounds (T_MFW_HND win, USHORT event, SHORT value, void * parameter)
3344 {
3345 // T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; // RAVI
3346 // T_MELODY_INFO * data = (T_MELODY_INFO *)win_data->user; // RAVI
3347
3348 TRACE_FUNCTION("sounds()");
3349
3350 switch (event)
3351 {
3352 case SHOW_CONFIRM:
3353 sounds_dialog();
3354 break;
3355 }
3356
3357 }
3358
3359 // Nov 29, 2004 REF: CRR 25051 xkundadu
3360 // Description: INCALL SCREEN ?ADJUSTING THE VOLUME
3361 // Fix: Added these functions to set the speaker volume to various levels.
3362
3363 void SetVolumeLevel1(void)
3364 {
3365
3366
3367 FFS_flashData.output_volume = OutVolumeLevel1;
3368 // Set the volume
3369 mmeSetVolume (1, FFS_flashData.output_volume);
3370 //write the value to the FFS
3371 flash_write();
3372
3373 }
3374 void SetVolumeLevel2(void)
3375 {
3376
3377
3378 FFS_flashData.output_volume = OutVolumeLevel2;
3379 // Set the volume
3380 mmeSetVolume (1, FFS_flashData.output_volume);
3381 //write the value to the FFS
3382 flash_write();
3383
3384 }
3385 void SetVolumeLevel3(void)
3386 {
3387
3388
3389 FFS_flashData.output_volume = OutVolumeLevel3;
3390 // Set the volume
3391 mmeSetVolume (1, FFS_flashData.output_volume);
3392 //write the value to the FFS
3393 flash_write();
3394
3395 }
3396 void SetVolumeLevel4(void)
3397 {
3398
3399
3400 FFS_flashData.output_volume = OutVolumeLevel4;
3401 // Set the volume
3402 mmeSetVolume (1, FFS_flashData.output_volume);
3403 //write the value to the FFS
3404 flash_write();
3405
3406 }
3407 void SetVolumeLevel5(void)
3408 {
3409
3410
3411 FFS_flashData.output_volume = OutVolumeLevel5;
3412 // Set the volume
3413 mmeSetVolume (1, FFS_flashData.output_volume);
3414 //write the value to the FFS
3415 flash_write();
3416
3417 }
3418 //Apr 05, 2005 REF: ENH 29994 xdeepadh
3419 #ifdef FF_MIDI_RINGER
3420 /*******************************************************************************
3421
3422 $Function: sounds_midi_init
3423
3424 $Description:Function to initialise the Midi files.
3425
3426 $Returns: None
3427
3428 $Arguments: None
3429
3430 *******************************************************************************/
3431 void sounds_midi_init(void)
3432 {
3433 TRACE_FUNCTION("sounds_init");
3434 #ifdef FF_MIDI_RINGER
3435 #ifdef FF_MIDI_LOAD_FROM_MEM
3436 midi_files_count=MIDI_MAX_FILES;
3437 #else
3438 //Nov 04, 2005 REF:DRT OMAPS00053737 xdeepadh
3439 #ifdef FF_MIDI_LOAD_FROM_LFS
3440 //Populate midi files from LFS
3441 TRACE_EVENT("LFS");
3442 //Populate the list of midi files from LFS
3443 midi_files_count=sounds_populate_midi_files(midi_file_names,MIDI_MAX_FILES,LFS_CONTENT_DIR);
3444 #else
3445 TRACE_EVENT("FFS");
3446 midi_files_count=sounds_populate_midi_files(midi_file_names,MIDI_MAX_FILES,RINGER_CONTENT_DIR);
3447 #endif //FF_MIDI_LOAD_FROM_LFS
3448 #endif //FF_MIDI_LOAD_FROM_MEM
3449 #endif //FF_MIDI_RINGER
3450 }
3451
3452 /*******************************************************************************
3453
3454 $Function: sounds_midi_exit
3455
3456 $Description:Function to uninitialise the Midi files.
3457
3458 $Returns: None
3459
3460 $Arguments: None
3461
3462 *******************************************************************************/
3463
3464 void sounds_midi_exit(void)
3465 {
3466 TRACE_FUNCTION("sounds_exit");
3467 #ifndef FF_MIDI_LOAD_FROM_MEM
3468 sounds_unpopulate_midi_files(midi_file_names);
3469 #endif
3470 }
3471
3472 /*******************************************************************************
3473
3474 $Function: sounds_populate_midi_files
3475
3476 $Description:Populates the MIDI file names into the array
3477
3478 $Returns: The count of the files in the directory
3479
3480 $Arguments: file_names:Pointer to the arrayto store file names
3481 max_files_count:Max file counts to be stored in array
3482 *******************************************************************************/
3483
3484 int sounds_populate_midi_files(char **file_names, int max_files_count,char* dir_name_p)
3485 {
3486
3487 T_FFS_DIR dir = {0};
3488 char dest_name_p[100] = "";
3489 int i, files_count = 0;
3490 char *fileExt;
3491
3492 TRACE_FUNCTION("sounds_populate_midi_files");
3493
3494 if (ffs_opendir (dir_name_p, &dir) <= 0)
3495 {
3496 files_count = 0;
3497 }
3498 //Sep 11, 2006 DR: OMAPS00094182 xrashmic
3499 //Release previous allocated memory before allocating again
3500 sounds_unpopulate_midi_files(midi_file_names);
3501 //read the file names
3502 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh
3503 //file_count will be used to populate the array index
3504 for (i = 0; ffs_readdir (&dir, dest_name_p, 100) > 0x0; i++)
3505 {
3506
3507 (file_names[files_count]) = (char*)mfwAlloc(strlen(dest_name_p) + 1);
3508 if(file_names[files_count] != NULL)
3509 {
3510 //Jul 20, 2005 REF: SPR 30772 xdeepadh
3511 //Retrieve file extension.Store only the supported file formats in array
3512 fileExt =sounds_midi_GetExtension(dest_name_p);
3513 //Oct 25, 2005 MP3 Ringer xdeepadh
3514 //List the MP3 files also.Mp3 files hsould not be listed or ULC
3515 #ifdef FF_MP3_RINGER
3516 if ( (strcmp(fileExt, "mp3") == 0))
3517 {
3518 strcpy (file_names[files_count], dest_name_p);
3519 files_count++;
3520 }
3521 else
3522 #endif //FF_MP3_RINGER
3523
3524 //Nov 21, 2005 ER: OMAPS00057430, AAC Ringer support nekkareb
3525 //List the AAC files also.
3526 #ifdef FF_AAC_RINGER
3527 if ( (strcmp(fileExt, "aac") == 0))
3528 {
3529 strcpy (file_names[files_count], dest_name_p);
3530 files_count++;
3531 }
3532 else
3533 #endif //FF_AAC_RINGER
3534
3535 #ifdef FF_MMI_MIDI_FORMAT
3536
3537 //If XMF is supported
3538 #ifdef PAL_ENABLE_XMF
3539 if ( (strcmp(fileExt, "xmf") == 0))
3540 {
3541 strcpy (file_names[files_count], dest_name_p);
3542 files_count++;
3543 }
3544 else
3545 #endif //PAL_ENABLE_XMF
3546
3547 //If IMELODY is supported
3548 #ifdef PAL_ENABLE_IMELODY
3549 if ( (strcmp(fileExt, "imy") == 0))
3550 {
3551 strcpy (file_names[files_count], dest_name_p);
3552 files_count++;
3553 }
3554 else
3555 #endif //PAL_ENABLE_IMELODY
3556
3557 //If SMAF is supported
3558 #ifdef PAL_ENABLE_SMAF_MA3
3559 if ( (strcmp(fileExt, "mmf") == 0))
3560 {
3561 strcpy (file_names[files_count], dest_name_p);
3562 files_count++;
3563 }
3564 else
3565 #endif ////PAL_ENABLE_SMAF_MA3
3566
3567 //If MIDI is supported
3568 #ifdef PAL_ENABLE_MIDI_NORMALIZER
3569 if ( (strcmp(fileExt, "mid") == 0))
3570 {
3571 strcpy (file_names[files_count], dest_name_p);
3572 files_count++;
3573 }
3574 else
3575 #endif ////PAL_ENABLE_MIDI_NORMALIZER
3576 //Sep 12, 2005 REF: SPR 33977 xdeepadh
3577 //mxmf file format has been supported
3578 #ifdef PAL_ENABLE_XMF
3579 if ( (strcmp(fileExt, "mxmf") == 0))
3580 {
3581 strcpy (file_names[files_count], dest_name_p);
3582 files_count++;
3583 }
3584 else
3585 #endif //PAL_ENABLE_XMF
3586 /* Nov 23, 2006 ERT: OMAPS00101348 x0039928
3587 Fix: .sms files are populated */
3588 #ifdef PAL_ENABLE_SMS
3589 if ( (strcmp(fileExt, "sms") == 0))
3590 {
3591 strcpy (file_names[files_count], dest_name_p);
3592 files_count++;
3593 }
3594 else
3595 #endif //PAL_ENABLE_SMS
3596 /* Dec 05, 2006 ERT: OMAPS00101906 x0039928
3597 Fix: .wav files are populated */
3598 #ifdef PAL_ENABLE_DIGITAL_AUDIO
3599 if ( (strcmp(fileExt, "wav") == 0))
3600 {
3601 strcpy (file_names[files_count], dest_name_p);
3602 files_count++;
3603 }
3604 else
3605 #endif //PAL_ENABLE_DIGITAL_AUDIO
3606
3607 #endif
3608 ;
3609 if(files_count >= max_files_count)
3610 break;
3611 }
3612 else
3613 {
3614 //files_count = 0;
3615 }
3616
3617 }
3618
3619 //x0pleela 07 Nov, 2006 DVT: OMAPS00102732
3620 //Adding the MMI compilation flag FF_MMI_RELIANCE_FFS
3621 //x0pleela 31 Oct, 2006
3622 //Closing the directory aa per the new FFS logic
3623 #ifdef FF_MMI_RELIANCE_FFS
3624 ffs_closedir(dir);
3625 #endif
3626 TRACE_EVENT_P1("read files_count is %d",files_count);
3627 return files_count;
3628 }
3629
3630 /*******************************************************************************
3631
3632 $Function: sounds_unpopulate_midi_files
3633
3634 $Description:Frees the memory allocated for the array
3635 $Returns: None
3636
3637 $Arguments: file_names:Pointer to the arrayto store file names
3638
3639 *******************************************************************************/
3640 void sounds_unpopulate_midi_files(char **file_names)
3641 {
3642 int i;
3643 TRACE_FUNCTION("sounds_unpopulate_midi_files");
3644 //Sep 11, 2006 DR: OMAPS00094182 xrashmic
3645 //Free the allocated memory for file names
3646 for (i = 0; i<MIDI_MAX_FILES; i++)
3647 {
3648 if(file_names[i])
3649 {
3650 mfwFree((U8 *)file_names[i],(U16)strlen(file_names[i]) + 1);
3651 }
3652 file_names[i]=NULL;
3653 }
3654
3655 }
3656
3657 /*******************************************************************************
3658
3659 $Function: sounds_midi_return_file_number
3660
3661 $Description: returns the file count
3662
3663 $Returns: Count of the Midi files
3664
3665 $Arguments: None
3666
3667 *******************************************************************************/
3668 int sounds_midi_return_file_number(void)
3669 {
3670 TRACE_FUNCTION("sounds_midi_return_file_number");
3671
3672 if(midi_files_count<=0)
3673 return 0;
3674 else
3675 return midi_files_count;
3676
3677 }
3678 /*******************************************************************************
3679
3680 $Function: sounds_midi_return_file_name
3681
3682 $Description: Returns the file name
3683
3684 $Returns: Name of the file
3685
3686 $Arguments: index:The index of the file, whose name has to be retrieved
3687
3688 *******************************************************************************/
3689
3690 char* sounds_midi_return_file_name(UBYTE index)
3691 {
3692
3693 TRACE_FUNCTION("sounds_midi_return_file_name");
3694
3695 #ifdef FF_MIDI_LOAD_FROM_MEM
3696 return (char *)mmi_midi_files[index].melody_name;
3697 #else
3698 TRACE_EVENT_P2("midi_file_names[%d] is %s",index,(char *)midi_file_names[index]);
3699 return (char *) midi_file_names[index];
3700 #endif
3701
3702
3703 }
3704
3705 /*******************************************************************************
3706
3707 $Function: sounds_midi_ringer_start_cb
3708
3709 $Description: Callback function for ringer_start
3710
3711 $Returns: None
3712
3713 $Arguments:
3714
3715 *******************************************************************************/
3716
3717 void sounds_midi_ringer_start_cb(void *parameter)
3718 {
3719 TRACE_EVENT("sounds_midi_ringer_start_cb");
3720
3721 /* OMAPS00151698, x0056422 */
3722 #ifdef FF_MMI_A2DP_AVRCP
3723 if (((T_AS_START_IND *)parameter)->header.msg_id == AS_START_IND )
3724 {
3725 tGlobalBmiBtStruct.tAudioState = FM_AUD_PLAY;
3726 if(tGlobalBmiBtStruct.bConnected != BMI_BT_NOTCONNECTED)
3727 {
3728 if( NULL != tGlobalBmiBtStruct.BmiEventCallback)
3729 tGlobalBmiBtStruct.BmiEventCallback(BMI_EVENT_USER_PLAY);
3730 tGlobalBmiBtStruct.tCmdSrc == BMI_BT_COMMAND_NONE;
3731 }
3732 }
3733 #endif//FF_MMI_A2DP_AVRCP
3734 /* OMAPS00151698, x0056422 */
3735
3736 if (((T_AS_STOP_IND *)parameter)->header.msg_id == AS_STOP_IND )
3737 {
3738
3739 /* OMAPS00151698, x0056422 */
3740 #ifdef FF_MMI_A2DP_AVRCP
3741 tGlobalBmiBtStruct.tAudioState = FM_AUD_NONE;
3742 if(tGlobalBmiBtStruct.bConnected != BMI_BT_NOTCONNECTED)
3743 {
3744 if( NULL != tGlobalBmiBtStruct.BmiEventCallback)
3745 tGlobalBmiBtStruct.BmiEventCallback(BMI_EVENT_USER_STOP);
3746 tGlobalBmiBtStruct.tCmdSrc == BMI_BT_COMMAND_NONE;
3747 }
3748 #endif//FF_MMI_A2DP_AVRCP
3749 /* OMAPS00151698, x0056422 */
3750 // Aug 05, 2005 xdeepadh
3751 #ifdef FF_MMI_AUDIO_PROFILE
3752 //configure the audio to voice path.
3753 mfwAudPlay = FALSE;
3754 mfw_unset_stereo_path(mfw_get_current_audioDevice());
3755 #endif
3756 }
3757
3758 }
3759
3760 /*******************************************************************************
3761
3762 $Function: sounds_midi_ringer_stop_cb
3763
3764 $Description: Callback function for ringer_stop
3765
3766 $Returns: None
3767
3768 $Arguments:
3769
3770 *******************************************************************************/
3771
3772 void sounds_midi_ringer_stop_cb(void *parameter)
3773 {
3774
3775 /*August 01, 2007 DR: OMAPS00137399 x0080701 (Bharat) -- Start */
3776
3777 E_IN_CALL_RINGER_STATUS eStatus = 0;
3778
3779 TRACE_EVENT("sounds_midi_ringer_stop_cb");
3780
3781 /* Retrieve the Incoming Call -- Ringer Status */
3782 bmi_incomingcall_get_ringer_status(&eStatus);
3783
3784 /* If a Ringer Stop had been done during an Incoming Call, then, enable the */
3785 /* Vocoder for the Voice to be heard */
3786 if ( eStatus == BMI_INCOMING_CALL_RINGERSTOPPED )
3787 {
3788 /* Vocoder Enable */
3789 mfw_aud_l1_enable_vocoder();
3790
3791 bmi_incomingcall_set_ringer_status(BMI_INCOMING_CALL_NONE);
3792 }
3793
3794 /*August 01, 2007 DR: OMAPS00137399 x0080701 (Bharat) -- End */
3795
3796 // Aug 05, 2005 xdeepadh
3797 #ifdef FF_MMI_AUDIO_PROFILE
3798 //configure the audio to voice path
3799 mfwAudPlay = FALSE;
3800 mfw_unset_stereo_path(mfw_get_current_audioDevice());
3801 #endif
3802 }
3803
3804 /*******************************************************************************
3805
3806 $Function: sounds_midi_player_start_cb
3807
3808 $Description: Callback function for player_start
3809
3810 $Returns: None
3811
3812 $Arguments:
3813
3814 *******************************************************************************/
3815
3816 void sounds_midi_player_start_cb(void *parameter)
3817 {
3818
3819 #ifdef FF_MMI_TEST_MIDI
3820 T_AS_PLAYER_TYPE player_type;
3821 #if FF_MIDI_LOAD_FROM_MEM
3822 T_MELODY melody_data;
3823 #else
3824 char* midi_file;
3825 #ifdef FF_MMI_FILEMANAGER
3826 char temp[FILENAME_MAX_LEN];
3827 UINT16 midi_file_uc[FILENAME_MAX_LEN];
3828 #endif
3829 #endif
3830
3831 TRACE_EVENT("sounds_midi_player_start_cb");
3832 if (((T_AS_STOP_IND *)parameter)->header.msg_id == AS_STOP_IND )
3833 {
3834 if(mfw_player_exit_flag == PLAYER_EXIT_FLAG_FALSE)
3835 {
3836
3837 //if we didn't reach the last file
3838 if(mfw_player_currently_playing_idx<(midi_files_count-1))
3839 {
3840 mfw_player_currently_playing_idx++;
3841 TRACE_EVENT_P1("mfw_player_currently_playing_idx is %d",mfw_player_currently_playing_idx);
3842 mfw_player_save_selected_file_idx(mfw_player_currently_playing_idx);
3843 #ifdef FF_MIDI_RINGER
3844 #ifdef FF_MIDI_LOAD_FROM_MEM
3845 melody_data=sounds_midi_return_memory_location(mfw_player_currently_playing_idx);
3846 player_type=mfw_ringer_deduce_player_type(melody_data.melody_name);
3847 mfw_player_start_memory(player_type,(UINT32*)melody_data.melody,melody_data.melody_size,(UBYTE)AS_VOLUME_HIGH,FALSE,sounds_midi_player_start_cb);
3848 #else
3849 midi_file=sounds_midi_return_file_name(mfw_player_currently_playing_idx);
3850 strcpy(temp, "/FFS/mmi/tones/");
3851 strcat(temp, midi_file);
3852 player_type=mfw_ringer_deduce_player_type(midi_file);
3853 #ifdef FF_MMI_FILEMANAGER
3854 convert_u8_to_unicode(temp, midi_file_uc);
3855 mfw_player_start_file(player_type,midi_file_uc,(UBYTE)AS_VOLUME_HIGH,FALSE,sounds_midi_player_start_cb);
3856 #else
3857 mfw_player_start_file(player_type,midi_file,(UBYTE)AS_VOLUME_HIGH,FALSE,sounds_midi_player_start_cb);
3858 #endif
3859 #endif
3860 #endif
3861 }
3862 else
3863 {
3864 //x0pleela 26 Sep, 2006 DR: OMAPS00096365
3865 //Reset the index to -1 to avoid playing only the last file.
3866 mfw_player_currently_playing_idx = -1;
3867 //flag set to 1 means we only play the currently selected file
3868 mfw_player_exit_flag = PLAYER_EXIT_FLAG_TRUE;
3869 // Aug 05, 2005 xdeepadh
3870 #ifdef FF_MMI_AUDIO_PROFILE
3871 //configure the audio to voice path
3872 mfwAudPlay = FALSE;
3873 mfw_unset_stereo_path(mfw_get_current_audioDevice());
3874 #endif
3875 }
3876 }
3877 else
3878 {
3879 // Aug 08, 2006 REF:DRT OMAPS00085889 x0039928
3880 // Fix: stereo path is unset after reaching the end of file.
3881 #ifdef FF_MMI_AUDIO_PROFILE
3882 //configure the audio to voice path
3883 mfwAudPlay = FALSE;
3884 mfw_unset_stereo_path(mfw_get_current_audioDevice());
3885 #endif
3886 }
3887
3888 }
3889 #endif//#ifdef FF_MMI_TEST_MIDI
3890 }
3891
3892 /*******************************************************************************
3893
3894 $Function: sounds_midi_player_stop_cb
3895
3896 $Description: Callback function for player_stop
3897
3898 $Returns: None
3899
3900 $Arguments:
3901
3902 *******************************************************************************/
3903
3904 void sounds_midi_player_stop_cb(void *parameter)
3905 {
3906 TRACE_EVENT("sounds_midi_player_stop_cb");
3907 // Aug 05, 2005 xdeepadh
3908 #ifdef FF_MMI_AUDIO_PROFILE
3909 //configure the audio to voice path
3910 mfwAudPlay = FALSE;
3911 mfw_unset_stereo_path(mfw_get_current_audioDevice());
3912 #endif
3913 }
3914
3915
3916 /*******************************************************************************
3917
3918 $Function: sounds_show_info
3919
3920 $Description:Displays a dialog
3921
3922 $Returns:
3923
3924 $Arguments:
3925 *******************************************************************************/
3926 static MfwHnd sounds_show_info(T_MFW_HND parent, int str1, int str2, T_VOID_FUNC callback)
3927 {
3928 T_DISPLAY_DATA display_info;
3929 TRACE_FUNCTION ("sounds_show_info()");
3930
3931 /*
3932 ** Create a timed dialog to display the Message "Failed"
3933 */
3934 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, str1, str2, COLOUR_STATUS);
3935 dlg_initDisplayData_events( &display_info, callback, MT_INFO_SCRN_TIMEOUT, KEY_LEFT | KEY_CLEAR | KEY_HUP);
3936 return info_dialog(parent, &display_info);
3937 }
3938
3939
3940 /*******************************************************************************
3941
3942 $Function: get_ringer_mode
3943
3944 $Description: Returns the current ringer mode based on soundsreason (CALL/SMS/ALARM/Volume setting)
3945 $Returns: the current ringer_mode
3946
3947 $Arguments: None
3948
3949 *******************************************************************************/
3950
3951 int get_ringer_mode(void)
3952 {
3953 T_AS_RINGER_MODE current_mode = NULL; /* x0039928 - Lint warning fix */
3954
3955 TRACE_FUNCTION("get_ringer_mode");
3956
3957 switch(getSoundsReason())
3958 {
3959 case MelodySelect:
3960 current_mode=AS_RINGER_MODE_IC;
3961 break;
3962
3963 case SettingSMSTone:
3964 current_mode=AS_RINGER_MODE_SMS;
3965 break;
3966
3967 case SettingAlarm:
3968 current_mode=AS_RINGER_MODE_ALARM;
3969 break;
3970
3971 case SettingVolume:
3972 current_mode=AS_RINGER_MODE_IC;
3973 break;
3974
3975 }
3976 return current_mode;
3977 }
3978
3979 /*******************************************************************************
3980
3981 $Function: playCurrentMelody
3982
3983 $Description: play midi file which is temporarily selected, this event handler
3984 is invoked when the hPlayerStartTimer event completes
3985
3986 $Returns: MFW_EVENT_CONSUMED always
3987
3988 $Arguments: e, event, tc timer context
3989
3990 *******************************************************************************/
3991
3992 static int playCurrentMelody( MfwEvt e, MfwTim *tc )
3993 {
3994
3995 TRACE_EVENT_P1("playCurrentMelody. The selected tone is %d",selected_tone);
3996 /* DRT OMAPS00163752 including changes from OMAPS00151417 . Apr 09, 2008. x0086292 - Start */
3997
3998 // stop running timer
3999 if (hPlayerStartTimer != NULL )
4000 {
4001 timStop(hPlayerStartTimer);
4002 }
4003
4004 // wait for AS to stop playing file before starting to play new one
4005 if (mfwAudPlay == TRUE)
4006 {
4007 startPlayerTimer();
4008 }
4009 else
4010 {
4011 soundsPlayMidiPlayer(selected_tone);
4012 }
4013 /* DRT OMAPS00163752 including changes from OMAPS00151417 . Apr 09, 2008. x0086292 - End */
4014
4015 return MFW_EVENT_CONSUMED;
4016 }
4017
4018
4019 /*******************************************************************************
4020
4021 $Function: soundsPlayMidiPlayer
4022
4023 $Description: Play the tune selected by melody_id, stopping any currently
4024 playing tunes if necessary.
4025 $Returns: None
4026
4027 $Arguments: melody_id, selects the melody to be played
4028
4029 *******************************************************************************/
4030 static void soundsPlayMidiPlayer( int melody_id )
4031 {
4032
4033 #ifdef FF_MIDI_RINGER
4034 T_AS_RINGER_INFO * ringer_info;
4035 T_AS_RINGER_INFO temp_ringer_info;
4036 T_AS_PLAYER_TYPE player_type;
4037 #ifdef FF_MIDI_LOAD_FROM_MEM
4038 T_MELODY melody_data;
4039 #else
4040 char* midi_file;
4041 #ifdef FF_MMI_FILEMANAGER
4042 char temp[FILENAME_MAX_LEN];
4043 UINT16 midi_file_uc[FILENAME_MAX_LEN];
4044 #endif
4045 #endif
4046 #endif
4047
4048 TRACE_EVENT_P1("soundsPlayMidiPlayer.The melody_id is %d",melody_id);
4049 CurrentTune = melody_id;
4050 memset(&temp_ringer_info,'\0',sizeof(T_AS_RINGER_INFO)); /* x0039928 - Lint warning fix */
4051 ringer_info=mfw_ringer_get_info(get_ringer_mode(),&temp_ringer_info);
4052 TRACE_EVENT_P1("ringer_info details volume are %d ",ringer_info->volume);
4053 #ifdef FF_MIDI_LOAD_FROM_MEM
4054 melody_data=sounds_midi_return_memory_location(CurrentTune);
4055 player_type=mfw_ringer_deduce_player_type(melody_data.melody_name);
4056 mfw_player_start_memory(player_type,(UINT32*)melody_data.melody,melody_data.melody_size,ringer_info->volume,FALSE,sounds_midi_player_start_cb);
4057 #else
4058 midi_file=sounds_midi_return_file_name(CurrentTune);
4059 TRACE_EVENT_P1("midi_file is %s",midi_file);
4060 player_type=mfw_ringer_deduce_player_type(midi_file);
4061 #ifdef FF_MMI_FILEMANAGER
4062 strcpy(temp, "/FFS/mmi/tones/");
4063 strcat(temp, midi_file);
4064 convert_u8_to_unicode(temp, midi_file_uc);
4065 mfw_player_start_file(player_type,midi_file_uc,ringer_info->volume,FALSE,sounds_midi_player_start_cb);
4066 #else
4067 mfw_player_start_file(player_type,midi_file,ringer_info->volume,FALSE,sounds_midi_player_start_cb);
4068 #endif
4069 #endif
4070
4071
4072 }
4073
4074 /*******************************************************************************
4075
4076 $Function: startPlayerTimer
4077
4078 $Description: Start the timer for Scrolling of Midi files
4079 $Returns: None
4080
4081 $Arguments: None
4082
4083 *******************************************************************************/
4084
4085 void startPlayerTimer()
4086
4087 {
4088 // start timer for 5 milli second and on timeout play the file
4089 timStart( hPlayerStartTimer );
4090 }
4091
4092 /*******************************************************************************
4093
4094 $Function: stopPlayerTimer
4095
4096 $Description: Stop the timer for Scrolling of Midi files.Stop the melody, if anything is playing.
4097 $Returns: None
4098
4099 $Arguments: None
4100
4101 *******************************************************************************/
4102
4103 static void stopPlayerTimer( void )
4104 {
4105 TRACE_FUNCTION( "stopPlayerTimer" );
4106
4107 /* If a timer event is running we want to stop that as well.
4108 since we want to turn the tune off and have
4109 it start again when the timer expires*/
4110
4111 if ( hPlayerStartTimer != NULL )
4112 timStop( hPlayerStartTimer );
4113 // Stop the tone
4114
4115 /* DRT OMAPS00163752 including changes from OMAPS00151417. Apr 09, 2008. x0086292 */
4116 if (mfwAudPlay == TRUE)
4117 mfw_player_stop(sounds_midi_player_stop_cb);
4118 }
4119
4120
4121 /*******************************************************************************
4122
4123 $Function: playCurrentVolumeTone
4124
4125 $Description: play midi file with the volume which is temporarily selected, this event handler
4126 is invoked when the hPlayerStartTimer event completes
4127
4128 $Returns: MFW_EVENT_CONSUMED always
4129
4130 $Arguments: e, event, tc timer context
4131
4132 *******************************************************************************/
4133
4134 static int playCurrentVolumeTone( MfwEvt e, MfwTim *tc )
4135 {
4136
4137 TRACE_EVENT("playCurrentVolumeTone");
4138 soundsPlayVolumeMelody();
4139 // stop running timer
4140 if (hPlayerStartTimer != NULL )
4141 {
4142 timStop(hPlayerStartTimer);
4143 }
4144 return MFW_EVENT_CONSUMED;
4145 }
4146
4147 /*******************************************************************************
4148
4149 $Function: startVolumeTimer
4150
4151 $Description: Start the timer for modifying the volume of Midi files
4152 $Returns: None
4153
4154 $Arguments: None
4155
4156 *******************************************************************************/
4157
4158 void startVolumeTimer()
4159
4160 {
4161 TRACE_EVENT("startVolumeTimer");
4162 // start timer for 5 milli second and on timeout play the file
4163 timStart( hPlayerStartTimer );
4164 }
4165
4166 /*******************************************************************************
4167
4168 $Function: stopVolumeTimer
4169
4170 $Description: Stop the timer for chnaging volume of Midi files.Stop the melody, if anything is playing.
4171 $Returns: None
4172
4173 $Arguments: None
4174
4175 *******************************************************************************/
4176
4177 void stopVolumeTimer(void)
4178 {
4179 TRACE_EVENT("stopVolumeTimer");
4180 if ( hPlayerStartTimer != NULL )
4181 timStop( hPlayerStartTimer );
4182 // Are we playing a tune
4183 /* DRT OMAPS00163752 including changes from OMAPS00151417 . Apr 09, 2008. x0086292 */
4184 if (mfwAudPlay == TRUE)
4185 mfw_player_stop(sounds_midi_player_stop_cb);
4186 }
4187
4188 /*******************************************************************************
4189
4190 $Function: soundsPlayVolumeMelody
4191
4192 $Description: Play the ringer tune with the selected volume, stopping any currently
4193 playing tunes if necessary.
4194 $Returns: None
4195
4196 $Arguments: melody_id, selects the melody to be played
4197
4198 *******************************************************************************/
4199
4200 static void soundsPlayVolumeMelody()
4201 {
4202
4203 T_AS_RINGER_INFO * ringer_info;
4204 T_AS_RINGER_INFO temp_ringer_info;
4205
4206 TRACE_EVENT("soundsPlayVolumeMelody");
4207 TRACE_EVENT_P1("the current volume now is %d",current.volumeSetting);
4208 #ifdef FF_MIDI_RINGER
4209 //If going to the volume screen from Idle screen,change the incoming call volume.
4210 //mfw_player_stop(sounds_midi_player_stop_cb);
4211 memset(&temp_ringer_info, 0x0,sizeof(temp_ringer_info)); /* x0039928 - Lint warning removal */
4212 ringer_info=mfw_ringer_get_info(get_ringer_mode(),&temp_ringer_info);
4213 #ifdef FF_MIDI_LOAD_FROM_MEM
4214 mfw_player_start_memory(ringer_info->player_type,ringer_info->data.memory.address,ringer_info->data.memory.size,current.volumeSetting,FALSE,sounds_midi_player_start_cb);
4215 #else
4216 mfw_player_start_file(ringer_info->player_type,ringer_info->data.filename,(T_AS_VOLUME)current.volumeSetting,FALSE,sounds_midi_player_start_cb);
4217 #endif
4218 #endif
4219
4220 }
4221
4222 /*******************************************************************************
4223
4224 $Function: sounds_midi_return_memory_location
4225
4226 $Description: Returns the Melody structure
4227
4228 $Returns: Structure containing the memory location, size and filename
4229
4230 $Arguments: index :index whose memory location has to be retrieved
4231
4232 *******************************************************************************/
4233 /*a0393213 warnings removal-the entire function put under FF_MIDI_LOAD_FROM_MEM flag*/
4234 #ifdef FF_MIDI_LOAD_FROM_MEM
4235 T_MELODY sounds_midi_return_memory_location(UBYTE index)
4236 {
4237 TRACE_FUNCTION("sounds_midi_return_memory_location");
4238 return mmi_midi_files[index];
4239 }
4240 #endif
4241 //Jul 20, 2005 REF: SPR 30772 xdeepadh
4242 /*******************************************************************************
4243
4244 $Function: sounds_midi_GetExtension
4245
4246 $Description: public function to retrieve the extension of a file
4247
4248 $Returns:Extention of the filename
4249
4250 $Arguments: scr- Filename
4251
4252 *******************************************************************************/
4253 char *sounds_midi_GetExtension(char *src)
4254 {
4255 int i,len;
4256
4257 TRACE_FUNCTION("sounds_midi_GetExtension");
4258 len = strlen(src); /* x0039928 - Lint warning fix */
4259 for(i = 0; i < len; i++){
4260 if(src[i] == '.'){
4261 return (src+i+1);
4262 }
4263 }
4264 return (src+i);
4265 }
4266
4267 #endif
4268
4269 /*******************************************************************************
4270
4271 End Of File
4272
4273 *******************************************************************************/