FreeCalypso > hg > fc-tourmaline
comparison src/ui/bmi/mmiMidiTest.c @ 3:67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:33:10 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:3a14ee9a9843 | 3:67bfe9f274f6 |
---|---|
1 /******************************************************************************* | |
2 | |
3 Texas Instruments | |
4 | |
5 ******************************************************************************** | |
6 | |
7 This software product is the property of Texas Instruments and may not be | |
8 disclosed to any third party without the express permission of the owner. | |
9 | |
10 ******************************************************************************** | |
11 | |
12 $Project name: Test MMI | |
13 $Module: MIDI TEST | |
14 $File: MmiMidiTest.c | |
15 $Revision: 1.0 | |
16 | |
17 $Author: Elsa Armanet-Said Texas Instruments Nice | |
18 $Date: 17/05/04 | |
19 | |
20 ******************************************************************************** | |
21 | |
22 Description: | |
23 | |
24 This provides the start code for the MMI | |
25 | |
26 ******************************************************************************** | |
27 $History: MmiMidiTest.c | |
28 | |
29 Aug 01, 2007 REF:DRT OMAPS00137370 x0045876 | |
30 Description: MM: MIDI/IMY file is not played correctly after listening a | |
31 MP3 in the Browse Midi list. | |
32 Solution: Param Voice_Limit is changed when MP3 or AAC file is played. So before | |
33 playing MIDI file, Voice_Limit should be initialized properly. | |
34 Mar 30, 2007 REF: OMAPS00122691 x0039928 | |
35 Description: COMBO: No melody heard on parsing over different volums in tones menu | |
36 Solution: Filename is passed with complete path to the audio service api. | |
37 | |
38 Jan 30, 2007 DR: OMAPS00108892 x0pleela | |
39 Description: TCMIDITEST.23(Apps) - Play All File feature fails when different Configurations | |
40 like Mono/Stereo, Loop On/Off are selected | |
41 Solution: When Loop On is enabled, and when user selected to Play all files, an error message | |
42 will be displayed saying Loop ON, cannot play all files. Changes aremade in functions | |
43 midi_test_play_all() and midi_test_set_loop_on() | |
44 | |
45 | |
46 Sep 11, 2006 DR: OMAPS00094182 xrashmic | |
47 Description: midi and mp3 files is not being populated on accessing corresponding menu, but only during bootup | |
48 Solution: Populate files on accessing the "browse files" list | |
49 | |
50 June 19, 2006 REF: DRT OMAPS00076378 x0012849 : Jagannatha | |
51 Description: MIDI files should play while browsing | |
52 Solution: The Menu up and down key event will be handled and the current | |
53 file will be played while browsing the files. | |
54 | |
55 Nov 23, 2005 REF : DR OMAPS00057378 x0039928 | |
56 Bug: All MIDI files are not displayed in MMI in locosto-lite | |
57 Fix: Buffer memory allocated to copy the file contents is freed | |
58 properly and copying file from FFS to LFS is not terminated if error is | |
59 returned for just any one file, instead it tries to copy other files. | |
60 | |
61 Nov 09, 2005 REF:DR OMAPS00049167 x0039928 | |
62 Description: The midi files cannot be heard if the audio channel selected is 'Mono' | |
63 Solution: Midi Player params are made global so that settings are retained across. | |
64 | |
65 Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | |
66 Description: Mp3 Ringer Implementation | |
67 Solution: The Midi Ringer application has been enhanced to support mp3 as ringer. | |
68 The interface function names have been modified. | |
69 | |
70 Sep 29,2005 REF: SPR 34407 xdeepadh | |
71 Bug:Back soft key takes more time to return to the previous screen in Midi application | |
72 Fix:The list creation for Midi files has been modified | |
73 | |
74 Aug 29, 2005 REF: SPR 33999 xdeepadh | |
75 Description:Midi Application - Play all files asks for a file to be selected | |
76 Solution: When the files are not selected, the current playing index is set 0. | |
77 | |
78 Apr 05, 2005 REF: ENH 29994 xdeepadh | |
79 Description: Implementation of Generic Midi Ringer and Modification of existing Midi Test Application | |
80 Solution: Generic Midi Ringer and Midi Test Application were implemented. | |
81 | |
82 Dec 08, 2004 REF: CRR MMI-SPR-27284 | |
83 Description: MIDI Player: Back Key malfunctions in MIDI application. | |
84 Solution: A window is created to hold list window. When the user presses Back key, the newly | |
85 created window is deleted along with list window, bringing the control back to Midi options | |
86 screen. | |
87 | |
88 17/05/04 | |
89 | |
90 $End | |
91 | |
92 *******************************************************************************/ | |
93 | |
94 | |
95 | |
96 | |
97 /******************************************************************************* | |
98 | |
99 Include files | |
100 | |
101 *******************************************************************************/ | |
102 #define ENTITY_MFW | |
103 | |
104 /* includes */ | |
105 | |
106 #include <string.h> | |
107 #include <stdio.h> | |
108 #include <stdlib.h> | |
109 | |
110 #include "typedefs.h" | |
111 #include "vsi.h" | |
112 #include "pei.h" | |
113 #include "custom.h" | |
114 | |
115 #if defined (NEW_FRAME) | |
116 | |
117 #include "typedefs.h" | |
118 #include "vsi.h" | |
119 #include "pei.h" | |
120 #include "custom.h" | |
121 #include "gsm.h" | |
122 #include "prim.h" | |
123 | |
124 #else | |
125 | |
126 #include "STDDEFS.H" | |
127 #include "custom.h" | |
128 #include "gsm.h" | |
129 #include "vsi.h" | |
130 | |
131 #endif | |
132 | |
133 #include "message.h" /* included for aci_cmh.h .... */ | |
134 #include "aci_cmh.h" /* included for mfw_sat.h, included for MmiDummy.h, included for MmiMenu.h */ | |
135 | |
136 #include "mfw_mfw.h" | |
137 #include "mfw_win.h" | |
138 #include "mfw_icn.h" /* included for mfw_mnu.h */ | |
139 #include "mfw_mnu.h" | |
140 #include "mfw_tim.h" | |
141 #include "mfw_kbd.h" | |
142 #include "mfw_sat.h" /* included for MmiDummy.h, included for MmiMenu.h */ | |
143 #include "mfw_midi.h" | |
144 | |
145 #include "kpd/kpd_api.h" | |
146 | |
147 #include "MmiBlkLangDB.h" | |
148 #include "mmiColours.h" | |
149 #include "MmiDialogs.h" | |
150 | |
151 #include "MmiDummy.h" /* included for MmiMenu.h */ | |
152 #include "MmiLists.h" | |
153 #include "MmiMenu.h" | |
154 #include "MmiSoftKeys.h" | |
155 #include "AUIEditor.h" | |
156 #include "MmiMidiTest.h" | |
157 #include "MmiMain.h" | |
158 #include "Mmisounds.h" | |
159 #include "MmiBookShared.h" //Sep 11, 2006 DR: OMAPS00094182 xrashmic | |
160 /******************************************************************************* | |
161 | |
162 internal data | |
163 | |
164 *******************************************************************************/ | |
165 | |
166 /* | |
167 * Internal events | |
168 */ | |
169 #define MT_CREATE_EDITOR 500 | |
170 #define MT_EDITOR_CANCEL 501 | |
171 #define MT_EDITOR_SELECT 502 | |
172 #define MT_NAME_EDITOR 503 | |
173 #define MT_MNU_INIT 504 | |
174 | |
175 /*local defines*/ | |
176 | |
177 #define MT_MAX_EDITOR_LENGTH 4 | |
178 #define MT_INFO_SCRN_TIMEOUT 1500 | |
179 #define MT_MAX_FILES 8 | |
180 | |
181 // Dec 08, 2004 REF: CRR MMI-SPR-27284 | |
182 // Description: MIDI Player: Back Key malfunctions in MIDI application. | |
183 // E_INIT event definition | |
184 #define E_INIT 1 | |
185 | |
186 #define TIME_HALFSECOND 500 | |
187 | |
188 /*editor data structure*/ | |
189 typedef struct{ | |
190 T_MMI_CONTROL mmi_control; | |
191 MfwHnd win; | |
192 MfwHnd mt_win_editor; | |
193 UBYTE mt_buffer[MT_MAX_EDITOR_LENGTH+1]; | |
194 USHORT mt_voice_number; | |
195 } T_MMI_MT_Editor_Data; | |
196 | |
197 /*menu data structure definition*/ | |
198 typedef struct | |
199 { | |
200 T_MMI_CONTROL mmi_control; | |
201 T_MFW_HND win; | |
202 T_MFW_HND kbd; | |
203 T_MFW_HND kbd_long; | |
204 T_MFW_HND mt_menu; | |
205 T_MFW_HND parent; // Dec 08, 2004 REF: CRR MMI-SPR-27284. Member "parent" added | |
206 T_VOID_FUNC func_cb; | |
207 T_VOID_FUNC cancel_cb; | |
208 UBYTE mt_num_file; | |
209 UBYTE mt_file_count; | |
210 ListCbFunc mt_list_cb; | |
211 UBYTE mt_list_idx; | |
212 UBYTE IsMfwInit; | |
213 ListMenuData * menu_list_data; //Sep 29,2005 REF: SPR 34407 xdeepadh | |
214 }T_mt_menu; | |
215 | |
216 /*global menu data*/ | |
217 T_mt_menu mt_menu_data = {0}; | |
218 extern UBYTE mfw_player_exit_flag;//Flag to check playall is selected. | |
219 extern int mfw_player_currently_playing_idx;//Stores the index of the current selected file | |
220 extern UBYTE mfw_player_playback_loop_flag;//Flag to check whether loop is on /off | |
221 // June 19, 2006 REF: DRT OMAPS00076378 x0012849 | |
222 // This timer is created so that a file is played only if the item is | |
223 // selected for more than half a second | |
224 static MfwHnd midiBrowseTimer; | |
225 // This variable is created to know Currently list of MIDI files are showed or not. | |
226 static BOOL isMidiListON = FALSE; | |
227 /******************************************************************************* | |
228 | |
229 Local prototypes | |
230 | |
231 *******************************************************************************/ | |
232 static void midi_mt_menu_list_listmnu_cb(T_MFW_HND Parent, ListMenuData * ListData); | |
233 static void mmi_midi_test_editor_cb(T_MFW_HND win, USHORT identifier, SHORT reason); | |
234 //Sep 29,2005 REF: SPR 34407 xdeepadh | |
235 static T_MFW_HND mmi_midi_test_build_Menu( MfwHnd parent_window); | |
236 | |
237 | |
238 /*default static menu*/ | |
239 static MfwMnuAttr menuMtSearchListAttr = | |
240 { | |
241 &menuArea, | |
242 MNU_LEFT | MNU_LIST | MNU_CUR_LINE, /* centered page menu */ | |
243 (U8)-1, /* use default font */ | |
244 NULL, /* with these items (filled in later) */ | |
245 0, /* number of items (filled in leter) */ | |
246 COLOUR_LIST_XX, /* Colour */ | |
247 TxtNull, /* Hdr Id */ | |
248 NULL, /* Background */ | |
249 MNUATTRSPARE /* unused */ | |
250 }; | |
251 | |
252 /******************************************************************************* | |
253 | |
254 $Function: mmi_midi_test_show_info | |
255 | |
256 $Description: Display the Dialog | |
257 | |
258 $Returns: | |
259 | |
260 $Arguments: | |
261 | |
262 *******************************************************************************/ | |
263 static MfwHnd mmi_midi_test_show_info(T_MFW_HND parent, int str1, int str2, T_VOID_FUNC callback) | |
264 { | |
265 T_DISPLAY_DATA display_info; | |
266 | |
267 TRACE_FUNCTION ("mmi_midi_test_show_info()"); | |
268 | |
269 /* | |
270 ** Create a timed dialog to display the Message "Failed" | |
271 */ | |
272 dlg_initDisplayData_TextId( &display_info, TxtNull, TxtNull, str1, str2, COLOUR_STATUS); | |
273 dlg_initDisplayData_events( &display_info, callback, MT_INFO_SCRN_TIMEOUT, KEY_LEFT | KEY_CLEAR | KEY_HUP); | |
274 | |
275 return info_dialog(parent, &display_info); | |
276 } | |
277 | |
278 | |
279 /******************************************************************************* | |
280 | |
281 $Function: midi_stop_player | |
282 | |
283 $Description:Stops the Midi file playing | |
284 | |
285 $Returns: | |
286 | |
287 $Arguments:m, menu being activated, i, item in menu | |
288 | |
289 *******************************************************************************/ | |
290 GLOBAL int midi_stop_player (MfwMnu* m, MfwMnuItem* i) | |
291 { | |
292 | |
293 TRACE_FUNCTION ("midi_stop_player()"); | |
294 if(mfw_player_exit_flag == PLAYER_EXIT_FLAG_FALSE) | |
295 mfw_player_exit_flag = PLAYER_EXIT_FLAG_TRUE; | |
296 mfw_player_stop(sounds_midi_player_stop_cb); | |
297 return 1; | |
298 } | |
299 | |
300 /******************************************************************************* | |
301 | |
302 $Function: mmi_midi_test_editor_cb | |
303 | |
304 $Description: This function provides the callback functionality to an editor for Midi test | |
305 | |
306 $Returns: None | |
307 | |
308 $Arguments: | |
309 | |
310 *******************************************************************************/ | |
311 | |
312 static void mmi_midi_test_editor_cb(T_MFW_HND win, USHORT identifier, SHORT reason) | |
313 { | |
314 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
315 T_MMI_MT_Editor_Data* dev_name_data = (T_MMI_MT_Editor_Data *)win_data->user; | |
316 UBYTE * editor_buffer = NULL; | |
317 SHORT max_edit_size = 0; | |
318 T_MFW_HND parent; | |
319 | |
320 | |
321 TRACE_FUNCTION ("mmi_midi_test_editor_cb()"); | |
322 | |
323 | |
324 if (identifier == MT_NAME_EDITOR) | |
325 { | |
326 editor_buffer = dev_name_data->mt_buffer; | |
327 max_edit_size = MT_MAX_EDITOR_LENGTH; | |
328 parent = dev_name_data->win; | |
329 } | |
330 else | |
331 { | |
332 TRACE_FUNCTION ("mmi_midi_test_editor_cb() : Unknown Identifier"); | |
333 /* | |
334 ** if this isn't one of the "recognised" editors leave now! | |
335 */ | |
336 return; | |
337 } | |
338 | |
339 switch (reason) | |
340 { | |
341 case INFO_KCD_LEFT: | |
342 { | |
343 /* | |
344 ** If there is no string entered, treat this as if it was a "Cancel" | |
345 */ | |
346 if (editor_buffer[0] == 0x00) | |
347 { | |
348 /* | |
349 ** Send a "Cancel" to the Midi test window | |
350 */ | |
351 SEND_EVENT(parent, MT_EDITOR_CANCEL, identifier, NULL); | |
352 } | |
353 else | |
354 { | |
355 /* | |
356 ** Send a "Select" to the Midi test window | |
357 */ | |
358 SEND_EVENT(parent, MT_EDITOR_SELECT, identifier, NULL); | |
359 } | |
360 } | |
361 break; | |
362 | |
363 case INFO_KCD_RIGHT: | |
364 if (strlen((char *)editor_buffer) == 0) | |
365 { | |
366 | |
367 /* | |
368 ** Send a "Cancel" to the Midi test window | |
369 */ | |
370 SEND_EVENT(parent, MT_EDITOR_CANCEL, identifier, NULL); | |
371 } | |
372 break; | |
373 | |
374 case INFO_KCD_HUP: | |
375 /* | |
376 ** Set the buffer to NULLS | |
377 */ | |
378 memset(editor_buffer, 0x00, max_edit_size); | |
379 | |
380 /* | |
381 ** Send a "Cancel" to the Midi test window | |
382 */ | |
383 SEND_EVENT(parent, MT_EDITOR_CANCEL, identifier, NULL); | |
384 break; | |
385 | |
386 default: | |
387 /* otherwise no action to be performed | |
388 */ | |
389 break; | |
390 } | |
391 } | |
392 | |
393 | |
394 /******************************************************************************* | |
395 | |
396 $Function: mmi_midi_test_editor_destroy | |
397 | |
398 $Description: This function performs the necessary steps to remove the window handling the | |
399 voice number editor, tidying up all allocated resources. | |
400 | |
401 $Returns: MfwResOk : Success | |
402 MfwResIllHnd : Illegal Window Handler provided | |
403 | |
404 $Arguments: win : Window to be destroyed | |
405 | |
406 *******************************************************************************/ | |
407 MfwRes mmi_midi_test_editor_destroy(T_MFW_HND win) | |
408 { | |
409 T_MFW_WIN * win_data; | |
410 T_MMI_MT_Editor_Data * data; | |
411 | |
412 TRACE_FUNCTION ("mmi_midi_test_editor_destroy"); | |
413 | |
414 | |
415 if (win == (void *)0) | |
416 return MfwResIllHnd; | |
417 | |
418 win_data = ((T_MFW_HDR *) win)->data; | |
419 data = (T_MMI_MT_Editor_Data *)win_data->user; | |
420 | |
421 /* | |
422 ** Destroy the Window | |
423 */ | |
424 win_delete(data->win); | |
425 | |
426 /* | |
427 ** Free the dynamically allocated memory | |
428 */ | |
429 mfwFree((U8 *)data, (U16)sizeof(T_MMI_MT_Editor_Data)); | |
430 | |
431 return MfwResOk; | |
432 } | |
433 | |
434 | |
435 /******************************************************************************* | |
436 | |
437 $Function: mmi_midi_test_editor_cntrl | |
438 | |
439 $Description: This is the dialog control function for the voice number selection Window. It | |
440 receives the signals from the MFW and determines what action, if any, to take. | |
441 | |
442 $Returns: None | |
443 | |
444 $Arguments: win : The pointer to the window handler, so the function can reference the | |
445 dynamic user data, if any. | |
446 event : The incoming event | |
447 value : Generic incoming Parameter, it will be 'event' dependant | |
448 parameter : Generic incoming Parameter, it will be 'event' dependant | |
449 | |
450 *******************************************************************************/ | |
451 void mmi_midi_test_editor_cntrl (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
452 { | |
453 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
454 T_MMI_MT_Editor_Data * data = (T_MMI_MT_Editor_Data *)win_data->user; | |
455 T_AUI_EDITOR_DATA editor_data; | |
456 SHORT mfw_midi_retVal; | |
457 int voice_limit; | |
458 | |
459 switch (event) | |
460 { | |
461 case MT_CREATE_EDITOR: | |
462 #ifdef NEW_EDITOR | |
463 //Clear the editor buffer | |
464 memset(&editor_data,'\0',sizeof(editor_data)); | |
465 | |
466 /* | |
467 ** Initialise the editor | |
468 */ | |
469 AUI_edit_SetDefault(&editor_data); | |
470 AUI_edit_SetBuffer(&editor_data, ATB_DCS_ASCII, data->mt_buffer, MT_MAX_EDITOR_LENGTH); | |
471 AUI_edit_SetTextStr(&editor_data, TxtSoftSelect, TxtSoftBack, TxtMidiEnterVoiceNumber, NULL); | |
472 AUI_edit_SetAltTextStr(&editor_data, 1, TxtNull, TRUE, TxtCancel); | |
473 AUI_edit_SetEvents(&editor_data, MT_NAME_EDITOR, TRUE, FOREVER, (T_AUI_EDIT_CB)mmi_midi_test_editor_cb); | |
474 data->mt_win_editor = AUI_edit_Start(data->win, &editor_data); | |
475 #endif | |
476 break; | |
477 | |
478 case MT_EDITOR_CANCEL: | |
479 | |
480 if (value == MT_NAME_EDITOR) | |
481 { | |
482 /* | |
483 ** The editor will have been destroyed. Reset the Window handler | |
484 */ | |
485 data->mt_win_editor = (void *)0; | |
486 } | |
487 else | |
488 { | |
489 TRACE_FUNCTION ("mmi_midi_test_editor_cntrl(), MT_EDITOR_CANCEL event received with unexpected value" ); | |
490 } | |
491 | |
492 /* | |
493 ** Destroy the editor Window | |
494 */ | |
495 TRACE_FUNCTION ("mmi_midi_test_editor_cntrl cancel"); | |
496 mmi_midi_test_editor_destroy(data->win); | |
497 break; | |
498 | |
499 case MT_EDITOR_SELECT: | |
500 if (value == MT_NAME_EDITOR) | |
501 { | |
502 voice_limit=atoi((char*)data->mt_buffer); | |
503 TRACE_EVENT_P1("voice_limit is %d",voice_limit); | |
504 if(voice_limit >32 ||voice_limit <=0) | |
505 { | |
506 mmi_midi_test_show_info(0, TxtError, TxtNull, NULL); | |
507 } | |
508 else | |
509 { | |
510 //translate ASCII format into integer format | |
511 mfw_midi_retVal = mfw_player_midi_set_voice_limit(voice_limit); | |
512 | |
513 /* Aug 01, 2007 DRT: OMAPS00137370 x0045876 */ | |
514 /* To display message, when Voice Limit is changed through Menu */ | |
515 if(mfw_midi_retVal == MFW_PLAYER_TEST_OK) | |
516 { | |
517 mmi_midi_test_show_info(0, TxtChConfigVoiceLimit, TxtSelected, NULL); | |
518 } | |
519 } | |
520 } | |
521 else | |
522 { | |
523 TRACE_FUNCTION ("mmi_midi_test_editor_cntrl(), MT_EDITOR_SELECT event received with unexpected value"); | |
524 } | |
525 TRACE_FUNCTION ("mmi_midi_test_editor_cntrl select"); | |
526 | |
527 /* | |
528 ** Destroy the Editor Window | |
529 */ | |
530 mmi_midi_test_editor_destroy(data->win); | |
531 break; | |
532 | |
533 default: | |
534 TRACE_FUNCTION ("mmi_midi_test_editor_cntrl(), Unexpected Event!"); | |
535 break; | |
536 } | |
537 | |
538 } | |
539 | |
540 | |
541 | |
542 /******************************************************************************* | |
543 | |
544 $Function: midi_test_editor_create | |
545 | |
546 $Description: This function performs the necessary steps to create the a window to enter the number of voices. | |
547 It will be removed, or rather remove itself on returning the | |
548 data to the Mfw. | |
549 | |
550 $Returns: T_MFW_HND : Window Handle to the New Window, Null if failed. | |
551 | |
552 $Arguments: parent : pointer to the parent window. | |
553 | |
554 *******************************************************************************/ | |
555 T_MFW_HND midi_test_editor_create(T_MFW_HND parent) | |
556 { | |
557 T_MMI_MT_Editor_Data *data; | |
558 T_MFW_WIN * win; | |
559 | |
560 TRACE_FUNCTION ("midi_test_editor_create"); | |
561 | |
562 data = (T_MMI_MT_Editor_Data *)mfwAlloc((U16)sizeof(T_MMI_MT_Editor_Data)); | |
563 | |
564 if (data == (void *)0) | |
565 return data; | |
566 | |
567 data->win = winCreate(parent, 0, E_WIN_VISIBLE, NULL); | |
568 | |
569 if (data->win == (void *)0) | |
570 { | |
571 /* | |
572 ** Failed to start : Free Memory, and exit | |
573 */ | |
574 mfwFree((U8 *)data, (U16)sizeof(T_MMI_MT_Editor_Data)); | |
575 data = (void *)0; | |
576 return data; | |
577 } | |
578 else | |
579 { | |
580 /* | |
581 ** Setup the Dialog control functions | |
582 */ | |
583 data->mmi_control.dialog = (T_DIALOG_FUNC)mmi_midi_test_editor_cntrl; | |
584 data->mmi_control.data = data; | |
585 | |
586 win = ((T_MFW_HDR *)data->win)->data; | |
587 win->user = (void *)data; | |
588 } | |
589 | |
590 return data->win; | |
591 | |
592 } | |
593 | |
594 /*a0393213 lint warning removal - This function is not used currently. So it's put under the flag. If it is required just remove the flag.*/ | |
595 #ifdef MMI_LINT_WARNING_REMOVAL | |
596 /******************************************************************************* | |
597 | |
598 $Function: mt_menu_win_cb | |
599 | |
600 $Description: menu window callback (implementation of softkeys) | |
601 | |
602 $Returns: | |
603 | |
604 $Arguments: | |
605 | |
606 *******************************************************************************/ | |
607 static int mt_menu_win_cb (MfwEvt e, MfwWin *w) | |
608 { | |
609 T_mt_menu * data = (T_mt_menu *)w->user; | |
610 MfwMnu * mnu; | |
611 | |
612 TRACE_FUNCTION ("mt_menu_win_cb "); | |
613 | |
614 switch (e) | |
615 { | |
616 case MfwWinVisible: | |
617 mnu = (MfwMnu *)mfwControl(data->mt_menu); | |
618 softKeys_displayId(TxtSoftSelect, TxtSoftBack, 0, mnu->curAttr->mnuColour ); | |
619 break; | |
620 | |
621 default: | |
622 return 0; | |
623 } | |
624 return 1; | |
625 } | |
626 #endif | |
627 | |
628 /******************************************************************************* | |
629 | |
630 $Function: mt_menu_destroy | |
631 | |
632 $Description: destroy menu window | |
633 | |
634 $Returns: | |
635 | |
636 $Arguments: window to be destroyed | |
637 | |
638 *******************************************************************************/ | |
639 static void mt_menu_destroy(MfwHnd window) | |
640 { | |
641 T_MFW_WIN * win_data = ((T_MFW_HDR *)window)->data; | |
642 T_mt_menu * data = (T_mt_menu *)win_data->user; | |
643 | |
644 TRACE_FUNCTION ("mt_menu_destroy"); | |
645 | |
646 if (window == NULL) | |
647 { | |
648 return; | |
649 } | |
650 | |
651 if (data) | |
652 { | |
653 win_delete(data->win); | |
654 | |
655 /* | |
656 ** Free Memory | |
657 */ | |
658 mfwFree((void *)data, sizeof (T_mt_menu)); | |
659 } | |
660 } | |
661 | |
662 | |
663 | |
664 // June 19, 2006 REF: DRT OMAPS00076378 x0012849 | |
665 /******************************************************************************* | |
666 | |
667 $Function: midi_test_menu_status | |
668 | |
669 $Description: Returns TRUE if the list of MIDI files is showed currently on display. | |
670 | |
671 $Returns: TRUE or FALSE | |
672 | |
673 $Arguments: None | |
674 | |
675 *******************************************************************************/ | |
676 BOOL midi_test_menu_status() | |
677 { | |
678 return isMidiListON; | |
679 } | |
680 | |
681 | |
682 | |
683 //Sep 29,2005 REF: SPR 34407 xdeepadh | |
684 /******************************************************************************* | |
685 | |
686 $Function: midi_mt_menu_list_listmnu_cb | |
687 | |
688 $Description: destroy lists and menu in case of back softkey or menu exit | |
689 | |
690 $Returns: | |
691 | |
692 $Arguments: | |
693 | |
694 *******************************************************************************/ | |
695 static void midi_mt_menu_list_listmnu_cb(T_MFW_HND Parent, ListMenuData * ListData) | |
696 { | |
697 T_MFW_WIN *win_data = ((T_MFW_HDR *)Parent)->data; | |
698 T_mt_menu *data = (T_mt_menu *)win_data->user; | |
699 | |
700 TRACE_FUNCTION ("midi_mt_menu_list_listmnu_cb()"); | |
701 | |
702 | |
703 if ((ListData->Reason EQ LISTS_REASON_BACK) || | |
704 (ListData->Reason EQ LISTS_REASON_CLEAR) || | |
705 (ListData->Reason EQ LISTS_REASON_HANGUP)) | |
706 { | |
707 /* | |
708 ** Destroy the window --- Not sure if this is required! ... leave it out for now | |
709 */ | |
710 listsDestroy(ListData->win); | |
711 | |
712 /* | |
713 ** Free the memory set aside for ALL the devices to be listed. | |
714 */ | |
715 if (data->menu_list_data != NULL) | |
716 { | |
717 FREE_MEMORY ((void *)data->menu_list_data->List, (U16)(data->mt_num_file * sizeof (T_MFW_MNU_ITEM))); | |
718 FREE_MEMORY ((void *)data->menu_list_data, sizeof (ListMenuData)); | |
719 } | |
720 | |
721 mt_menu_destroy(data->win); | |
722 // June 19, 2006 REF: DRT OMAPS00076378 x0012849 | |
723 /*At this point the MIDI list is destroyed*/ | |
724 isMidiListON = FALSE; | |
725 /* At this point the play need to be stopped. If user wants the file need to | |
726 be played while going across menu then 'play' or 'play all' need to be selected */ | |
727 midi_stop_player (NULL, NULL); | |
728 if (midiBrowseTimer != NULL) | |
729 { | |
730 // Delete the timer. It's not required any more. | |
731 timDelete (midiBrowseTimer); | |
732 } | |
733 } | |
734 //Sep 29,2005 REF: SPR 34407 xdeepadh | |
735 else if(ListData->Reason EQ LISTS_REASON_SELECT) | |
736 { | |
737 TRACE_EVENT_P1("list position is %d",ListData->ListPosition); | |
738 mt_menu_data.mt_list_idx = ListData->ListPosition; | |
739 //call mfw to save selected index | |
740 mfw_player_save_selected_file_idx(mt_menu_data.mt_list_idx); | |
741 //display a "file selected" text here | |
742 mmi_midi_test_show_info(0, TxtMidiFileSelected, TxtNull, NULL); | |
743 } | |
744 | |
745 return; | |
746 } | |
747 | |
748 | |
749 | |
750 /******************************************************************************* | |
751 | |
752 $Function: midi_test_set_loop_on | |
753 | |
754 $Description: set loop on | |
755 | |
756 $Returns: | |
757 | |
758 $Arguments:menu, menu item | |
759 | |
760 *******************************************************************************/ | |
761 GLOBAL int midi_test_set_loop_on (MfwMnu* m, MfwMnuItem* i) | |
762 { | |
763 SHORT mfw_midi_retVal; | |
764 | |
765 TRACE_FUNCTION ("midi_test_set_loop_on()"); | |
766 | |
767 //x0pleela 29 Jan, 2007 DR: OMAPS00108892 | |
768 //Check if it is playing all files. | |
769 //If playing, and user wants to activate Loop On, display error message. | |
770 //But keep playing all the files | |
771 if( mfw_player_exit_flag == PLAYER_EXIT_FLAG_FALSE ) | |
772 { | |
773 //Display an error message | |
774 mmi_midi_test_show_info(0, TxtLoopOn, TxtCantBeActivated, NULL); | |
775 return 1; | |
776 } | |
777 | |
778 mfw_midi_retVal = mfw_player_set_loop_on(); | |
779 if(mfw_midi_retVal != MFW_PLAYER_TEST_OK) | |
780 { | |
781 TRACE_FUNCTION ("midi_test_set_loop_on(): Riviera Failed"); | |
782 mmi_midi_test_show_info(0, TxtMidiOptionNotImplemented, TxtNull, NULL); | |
783 } | |
784 else | |
785 { | |
786 mmi_midi_test_show_info(0, TxtMidiLoopOn, TxtNull, NULL); | |
787 } | |
788 return 1; | |
789 } | |
790 | |
791 /******************************************************************************* | |
792 | |
793 $Function: midi_test_set_loop_off | |
794 | |
795 $Description: set loop off | |
796 | |
797 $Returns: | |
798 | |
799 $Arguments:menu, menu item | |
800 | |
801 *******************************************************************************/ | |
802 GLOBAL int midi_test_set_loop_off (MfwMnu* m, MfwMnuItem* i) | |
803 { | |
804 SHORT mfw_midi_retVal; | |
805 | |
806 TRACE_FUNCTION ("midi_test_set_loop_off()"); | |
807 | |
808 mfw_midi_retVal = mfw_player_set_loop_off(); | |
809 if(mfw_midi_retVal != MFW_PLAYER_TEST_OK) | |
810 { | |
811 TRACE_FUNCTION ("midi_test_set_loop_off(): Riviera Failed"); | |
812 mmi_midi_test_show_info(0, TxtMidiOptionNotImplemented, TxtNull, NULL); | |
813 } | |
814 else | |
815 { | |
816 mmi_midi_test_show_info(0, TxtMidiLoopOff, TxtNull, NULL); | |
817 } | |
818 return 1; | |
819 } | |
820 | |
821 | |
822 /******************************************************************************* | |
823 | |
824 $Function: midi_test_set_channel_mono | |
825 | |
826 $Description: set channels to mono | |
827 | |
828 $Returns: | |
829 | |
830 $Arguments:menu, menu item | |
831 | |
832 *******************************************************************************/ | |
833 GLOBAL int midi_test_set_channel_mono (MfwMnu* m, MfwMnuItem* i) | |
834 { | |
835 | |
836 SHORT mfw_midi_retVal; | |
837 | |
838 TRACE_FUNCTION ("midi_test_set_channel_mono()"); | |
839 mfw_midi_retVal = mfw_player_set_channel_mono(); | |
840 if(mfw_midi_retVal != MFW_PLAYER_TEST_OK) | |
841 { | |
842 TRACE_FUNCTION ("mfw_player_set_channel_mono(): Riviera Failed"); | |
843 mmi_midi_test_show_info(0, TxtMidiOptionNotImplemented, TxtNull, NULL); | |
844 } | |
845 else | |
846 { | |
847 mmi_midi_test_show_info(0, TxtMidiMonoChannel, TxtNull, NULL); | |
848 } | |
849 | |
850 return 1; | |
851 } | |
852 | |
853 /******************************************************************************* | |
854 | |
855 $Function: midi_test_set_channel_stereo | |
856 | |
857 $Description: set channels to stereo | |
858 | |
859 $Returns: | |
860 | |
861 $Arguments:menu, menu item | |
862 | |
863 *******************************************************************************/ | |
864 GLOBAL int midi_test_set_channel_stereo (MfwMnu* m, MfwMnuItem* i) | |
865 { | |
866 | |
867 SHORT mfw_midi_retVal; | |
868 | |
869 TRACE_FUNCTION ("midi_test_set_channel_stereo()"); | |
870 mfw_midi_retVal = mfw_player_set_channel_stereo(); | |
871 if(mfw_midi_retVal != MFW_PLAYER_TEST_OK) | |
872 { | |
873 TRACE_FUNCTION ("mfw_player_set_channel_stereo(): Riviera Failed"); | |
874 mmi_midi_test_show_info(0, TxtMidiOptionNotImplemented, TxtNull, NULL); | |
875 } | |
876 else | |
877 { | |
878 mmi_midi_test_show_info(0, TxtMidiStereoChannel, TxtNull, NULL); | |
879 } | |
880 | |
881 return 1; | |
882 } | |
883 | |
884 /******************************************************************************* | |
885 | |
886 $Function: midi_test_set_speaker | |
887 | |
888 $Description: set audiopath to speaker | |
889 | |
890 $Returns: | |
891 | |
892 $Arguments: menu, menu item | |
893 | |
894 | |
895 *******************************************************************************/ | |
896 GLOBAL int midi_test_set_speaker (MfwMnu* m, MfwMnuItem* i) | |
897 { | |
898 | |
899 SHORT mfw_midi_retVal; | |
900 TRACE_FUNCTION ("midi_test_set_speaker()"); | |
901 | |
902 mfw_midi_retVal=mfw_player_set_speaker(); | |
903 if(mfw_midi_retVal != MFW_PLAYER_TEST_OK) | |
904 { | |
905 TRACE_FUNCTION ("midi_test_set_speaker(): Failed"); | |
906 mmi_midi_test_show_info(0, TxtMidiOptionNotImplemented, TxtNull, NULL); | |
907 } | |
908 else | |
909 { | |
910 mmi_midi_test_show_info(0, TxtMidiSpeaker, TxtNull, NULL); | |
911 } | |
912 | |
913 return 1; | |
914 } | |
915 | |
916 | |
917 | |
918 /******************************************************************************* | |
919 | |
920 $Function: midi_test_set_headset | |
921 | |
922 $Description: set audiopath to headset | |
923 | |
924 $Returns: | |
925 | |
926 $Arguments:menu, menu item | |
927 | |
928 *******************************************************************************/ | |
929 GLOBAL int midi_test_set_headset (MfwMnu* m, MfwMnuItem* i) | |
930 { | |
931 SHORT mfw_midi_retVal; | |
932 TRACE_FUNCTION ("midi_test_set_headset()"); | |
933 | |
934 mfw_midi_retVal=mfw_player_set_headset(); | |
935 if(mfw_midi_retVal != MFW_PLAYER_TEST_OK) | |
936 { | |
937 TRACE_FUNCTION ("midi_test_set_headset(): Failed"); | |
938 mmi_midi_test_show_info(0, TxtMidiOptionNotImplemented, TxtNull, NULL); | |
939 } | |
940 else | |
941 { | |
942 mmi_midi_test_show_info(0, TxtMidiHeadset, TxtNull, NULL); | |
943 } | |
944 | |
945 return 1; | |
946 } | |
947 | |
948 | |
949 | |
950 /******************************************************************************* | |
951 | |
952 $Function: midi_test_cc_voice_limit | |
953 | |
954 $Description:Creates the Editor for entering the voice limit number | |
955 | |
956 $Returns: | |
957 | |
958 $Arguments:menu, menu item | |
959 | |
960 *******************************************************************************/ | |
961 GLOBAL int midi_test_cc_voice_limit (MfwMnu* m, MfwMnuItem* i) | |
962 { | |
963 | |
964 T_MFW_HND win = mfw_parent(mfw_header()); | |
965 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
966 T_MMI_MT_Editor_Data * data = (T_MMI_MT_Editor_Data *)(win_data->user); | |
967 | |
968 TRACE_FUNCTION ("midi_test_cc_voice_limit()"); | |
969 | |
970 data->mt_win_editor = midi_test_editor_create(win); | |
971 | |
972 if (data->mt_win_editor != (void *)0) | |
973 { | |
974 SEND_EVENT(data->mt_win_editor, MT_CREATE_EDITOR, 0, (void *)NULL); | |
975 } | |
976 else | |
977 { | |
978 TRACE_FUNCTION ("midi_test_cc_voice_limit() : Unable to create Editor Win!"); | |
979 } | |
980 return 1; | |
981 } | |
982 | |
983 /******************************************************************************* | |
984 | |
985 $Function: midi_test_play | |
986 | |
987 $Description:Starts Playing a midi file | |
988 | |
989 $Returns: | |
990 | |
991 $Arguments:menu, menu item | |
992 | |
993 *******************************************************************************/ | |
994 GLOBAL int midi_test_play (MfwMnu* m, MfwMnuItem* i) | |
995 { | |
996 T_AS_PLAYER_TYPE player_type; | |
997 #ifdef FF_MIDI_LOAD_FROM_MEM | |
998 T_MELODY melody_data; | |
999 #else | |
1000 char* midi_file; | |
1001 #ifdef FF_MMI_FILEMANAGER | |
1002 char temp[FILENAME_MAX_LEN]; | |
1003 UINT16 midi_file_uc[FILENAME_MAX_LEN]; | |
1004 #endif | |
1005 #endif | |
1006 TRACE_FUNCTION ("midi_test_play()"); | |
1007 | |
1008 //If no file is selected inform the user | |
1009 if(mfw_player_currently_playing_idx < 0) | |
1010 { | |
1011 mmi_midi_test_show_info(0, TxtMidiSelectFile, TxtNull, NULL); | |
1012 return 1; | |
1013 | |
1014 } | |
1015 //flag set to 1 means we only play the currently selected file | |
1016 mfw_player_exit_flag = PLAYER_EXIT_FLAG_TRUE; | |
1017 //Play the midi player with high volume. | |
1018 #ifdef FF_MIDI_RINGER | |
1019 #ifdef FF_MIDI_LOAD_FROM_MEM | |
1020 melody_data=sounds_midi_return_memory_location(mfw_player_currently_playing_idx); | |
1021 player_type=mfw_ringer_deduce_player_type(melody_data.melody_name); | |
1022 mfw_player_start_memory(player_type,(UINT32*)melody_data.melody,melody_data.melody_size,(UBYTE)AS_VOLUME_HIGH,mfw_player_playback_loop_flag,sounds_midi_player_start_cb); | |
1023 #else | |
1024 midi_file=sounds_midi_return_file_name(mfw_player_currently_playing_idx); | |
1025 strcpy(temp, "/FFS/mmi/tones/"); | |
1026 strcat(temp, midi_file); | |
1027 player_type=mfw_ringer_deduce_player_type(midi_file); | |
1028 #ifdef FF_MMI_FILEMANAGER | |
1029 convert_u8_to_unicode(temp, midi_file_uc); | |
1030 mfw_player_start_file(player_type,midi_file_uc,(UBYTE)AS_VOLUME_HIGH,mfw_player_playback_loop_flag,sounds_midi_player_start_cb); | |
1031 #else | |
1032 mfw_player_start_file(player_type,midi_file,(UBYTE)AS_VOLUME_HIGH,mfw_player_playback_loop_flag,sounds_midi_player_start_cb); | |
1033 #endif | |
1034 #endif | |
1035 #endif | |
1036 return 1; | |
1037 } | |
1038 | |
1039 /******************************************************************************* | |
1040 | |
1041 $Function: midi_test_play_all | |
1042 | |
1043 $Description:Plays all the midi files in the FFS one after the other | |
1044 | |
1045 $Returns: | |
1046 | |
1047 $Arguments:menu, menu item | |
1048 | |
1049 *******************************************************************************/ | |
1050 GLOBAL int midi_test_play_all (MfwMnu* m, MfwMnuItem* i) | |
1051 { | |
1052 T_AS_PLAYER_TYPE player_type; | |
1053 int numberOfMelodies=0; | |
1054 #ifdef FF_MIDI_LOAD_FROM_MEM | |
1055 T_MELODY melody_data; | |
1056 #else | |
1057 char* midi_file; | |
1058 #ifdef FF_MMI_FILEMANAGER | |
1059 char temp[FILENAME_MAX_LEN]; | |
1060 UINT16 midi_file_uc[FILENAME_MAX_LEN]; | |
1061 #endif | |
1062 #endif | |
1063 | |
1064 TRACE_FUNCTION ("midi_test_play_all()"); | |
1065 | |
1066 //x0pleela 31 Jan, 2007 DR: OMAPS00108892 | |
1067 //Reset the index to -1 to avoid playing only the last file. | |
1068 mfw_player_currently_playing_idx = -1; | |
1069 | |
1070 //x0pleela 29 Jan, 2007 DR: OMAPS00108892 | |
1071 //Check if Loop is On. If so, display error message. Else allow playing all files | |
1072 if( mfw_player_playback_loop_flag ) | |
1073 { | |
1074 //Display an error message | |
1075 mmi_midi_test_show_info(0, TxtLoopOn, TxtCantPlayAllFiles, NULL); | |
1076 return 1 ; | |
1077 } | |
1078 //Sep 11, 2006 DR: OMAPS00094182 xrashmic | |
1079 sounds_midi_init(); | |
1080 | |
1081 numberOfMelodies = sounds_midi_return_file_number(); | |
1082 TRACE_EVENT_P1("numberOfMelodies for midi_test_play_all is %d",numberOfMelodies); | |
1083 | |
1084 if(numberOfMelodies <= 0) | |
1085 { | |
1086 mmi_midi_test_show_info(0, TxtMidiFileNotLoaded, TxtNull, NULL); | |
1087 return 1 ; | |
1088 | |
1089 } | |
1090 if(mfw_player_currently_playing_idx < 0) | |
1091 { | |
1092 //Aug 29, 2005 REF: SPR 33999 xdeepadh | |
1093 // When the files are not selected, the current playing index is set 0. | |
1094 mfw_player_currently_playing_idx = 0; | |
1095 } | |
1096 //set exit_flag to 0 to notify that we have to play all files | |
1097 mfw_player_exit_flag = PLAYER_EXIT_FLAG_FALSE; | |
1098 //Play the midi player with high volume. | |
1099 #ifdef FF_MIDI_RINGER | |
1100 #ifdef FF_MIDI_LOAD_FROM_MEM | |
1101 melody_data=sounds_midi_return_memory_location(mfw_player_currently_playing_idx); | |
1102 player_type=mfw_ringer_deduce_player_type(melody_data.melody_name); | |
1103 mfw_player_start_memory(player_type,(UINT32*)melody_data.melody,melody_data.melody_size,(UBYTE)AS_VOLUME_HIGH,FALSE,sounds_midi_player_start_cb); | |
1104 #else | |
1105 midi_file=sounds_midi_return_file_name(mfw_player_currently_playing_idx); | |
1106 strcpy(temp, "/FFS/mmi/tones/"); | |
1107 strcat(temp, midi_file); | |
1108 player_type=mfw_ringer_deduce_player_type(midi_file); | |
1109 #ifdef FF_MMI_FILEMANAGER | |
1110 convert_u8_to_unicode(temp, midi_file_uc); | |
1111 mfw_player_start_file(player_type,midi_file_uc,(UBYTE)AS_VOLUME_HIGH,FALSE,sounds_midi_player_start_cb); | |
1112 #else | |
1113 mfw_player_start_file(player_type,midi_file,(UBYTE)AS_VOLUME_HIGH,FALSE,sounds_midi_player_start_cb); | |
1114 #endif | |
1115 #endif | |
1116 #endif | |
1117 return 1; | |
1118 } | |
1119 | |
1120 | |
1121 | |
1122 // June 19, 2006 REF: DRT OMAPS00076378 x0012849 | |
1123 /******************************************************************************* | |
1124 | |
1125 $Function: midi_test_play_browsing | |
1126 | |
1127 $Description: Play the currently choosen file. | |
1128 | |
1129 $Returns: MFW_EVENT_CONSUMED always | |
1130 | |
1131 $Arguments: e, event, tc timer context | |
1132 *******************************************************************************/ | |
1133 | |
1134 static int midi_test_play_browsing( MfwEvt e, MfwTim *tc ) | |
1135 { | |
1136 midi_test_play(NULL, NULL); | |
1137 if (midiBrowseTimer != NULL ) | |
1138 { | |
1139 timStop(midiBrowseTimer); | |
1140 } | |
1141 return MFW_EVENT_CONSUMED; | |
1142 } | |
1143 | |
1144 | |
1145 | |
1146 // Dec 08, 2004 REF: CRR MMI-SPR-27284 | |
1147 // Description: MIDI Player: Back Key malfunctions in MIDI application. | |
1148 // Solution: A window is created to hold list window. When the user presses Back key, the newly | |
1149 // created window is deleted along with list window, bringing the control back to Midi options | |
1150 // screen. | |
1151 /******************************************************************************* | |
1152 | |
1153 $Function: midi_test_files_exec_cb | |
1154 | |
1155 $Description: Call back function | |
1156 | |
1157 $Returns: none | |
1158 | |
1159 $Arguments: | |
1160 | |
1161 *******************************************************************************/ | |
1162 void midi_test_files_exec_cb (T_MFW_HND win, USHORT event, SHORT value, void * parameter) | |
1163 { | |
1164 T_MFW_WIN * win_data = ((T_MFW_HDR *) win)->data; | |
1165 T_mt_menu * data = (T_mt_menu *)win_data->user; | |
1166 int max_file_number; | |
1167 int i; | |
1168 | |
1169 ListWinInfo * mnu_data = (ListWinInfo *)parameter; | |
1170 | |
1171 TRACE_FUNCTION (">>>>> midi_test_files_exec_cb()"); | |
1172 | |
1173 switch (event) | |
1174 { | |
1175 // June 19, 2006 REF: DRT OMAPS00076378 x0012849 | |
1176 // To know whether the list is created or not. | |
1177 T_MFW MidiListCreationStatus; | |
1178 case E_INIT: | |
1179 | |
1180 TRACE_EVENT(">>>> midi_test_files_exec_cb() Event:E_INIT"); | |
1181 | |
1182 /* initialization of administrative data */ | |
1183 | |
1184 data->menu_list_data = (ListMenuData *)ALLOC_MEMORY(sizeof(ListMenuData)); | |
1185 | |
1186 if(data->menu_list_data == 0) | |
1187 { | |
1188 TRACE_EVENT("Failed memory alloc 1 "); | |
1189 return; | |
1190 } | |
1191 | |
1192 max_file_number = sounds_midi_return_file_number(); | |
1193 //In case no files have been loaded display info message | |
1194 //In case no files have been loaded return info message | |
1195 if(max_file_number == 0) | |
1196 { | |
1197 mmi_midi_test_show_info(0, TxtMidiFileNotLoaded, TxtNull, NULL); | |
1198 return; | |
1199 } | |
1200 | |
1201 | |
1202 data->menu_list_data->List = (T_MFW_MNU_ITEM *)ALLOC_MEMORY( max_file_number * sizeof(T_MFW_MNU_ITEM) ); | |
1203 | |
1204 if(data->menu_list_data->List == 0) | |
1205 { | |
1206 TRACE_EVENT("Failed memory alloc 2"); | |
1207 return; | |
1208 } | |
1209 //Sep 29,2005 REF: SPR 34407 xdeepadh | |
1210 for (i = 0; i < max_file_number ; i++) | |
1211 { | |
1212 mnuInitDataItem(&data->menu_list_data->List[i]); | |
1213 data->menu_list_data->List[i].flagFunc = item_flag_none; | |
1214 //Display the midi file names in the list | |
1215 data->menu_list_data->List[i].str = (char *)sounds_midi_return_file_name(data->mt_file_count++); | |
1216 } | |
1217 | |
1218 data->menu_list_data->ListLength =max_file_number; | |
1219 data->menu_list_data->ListPosition = 1; | |
1220 data->menu_list_data->CursorPosition = 1; | |
1221 data->menu_list_data->SnapshotSize = max_file_number; | |
1222 data->menu_list_data->Font = 0; | |
1223 data->menu_list_data->LeftSoftKey = TxtSoftSelect; | |
1224 data->menu_list_data->RightSoftKey = TxtSoftBack; | |
1225 data->menu_list_data->KeyEvents = KEY_ALL; | |
1226 data->menu_list_data->Reason = 0; | |
1227 data->menu_list_data->Strings = TRUE; | |
1228 data->menu_list_data->Attr = (MfwMnuAttr*)&menuMtSearchListAttr; | |
1229 //Apr 05, 2005 REF: ENH 29994 xdeepadh | |
1230 data->menu_list_data->Attr->hdrId = TxtMidiFileTitle; | |
1231 data->menu_list_data->autoDestroy = FALSE; | |
1232 // June 19, 2006 REF: DRT OMAPS00076378 x0012849 | |
1233 MidiListCreationStatus = | |
1234 listDisplayListMenu (win, data->menu_list_data, | |
1235 (ListCbFunc)midi_mt_menu_list_listmnu_cb,0); | |
1236 if (LISTS_OK == MidiListCreationStatus) | |
1237 { | |
1238 /*If control reached this point then List of files are showed on display*/ | |
1239 isMidiListON = TRUE; | |
1240 /*Create one timer and play the file only if that timer expires*/ | |
1241 /*Play the first file if user hasn't pressed the up and down for half a second */ | |
1242 mfw_player_currently_playing_idx = 0; | |
1243 midiBrowseTimer = timCreate( 0, TIME_HALFSECOND, (MfwCb)midi_test_play_browsing); | |
1244 timStart( midiBrowseTimer ); | |
1245 } | |
1246 break; | |
1247 case E_START_MELODY: | |
1248 // June 19, 2006 REF: DRT OMAPS00076378 x0012849 | |
1249 /*Stop playing the current file*/ | |
1250 midi_stop_player (NULL, NULL); | |
1251 mfw_player_currently_playing_idx = mnu_data->MenuData.ListPosition; | |
1252 if (midiBrowseTimer != NULL ) | |
1253 { | |
1254 timStop(midiBrowseTimer); | |
1255 timStart(midiBrowseTimer); | |
1256 } | |
1257 break; | |
1258 default: | |
1259 break; | |
1260 } | |
1261 | |
1262 } | |
1263 | |
1264 // Dec 08, 2004 REF: CRR MMI-SPR-27284 | |
1265 // Description: MIDI Player: Back Key malfunctions in MIDI application. | |
1266 // Solution: A window is created to hold list window. When the user presses Back key, the newly | |
1267 // created window is deleted along with list window, bringing the control back to Midi options | |
1268 // screen. | |
1269 /******************************************************************************* | |
1270 | |
1271 $Function: midi_test_files_win_cb | |
1272 | |
1273 $Description: Window event handler | |
1274 | |
1275 $Returns: MFW_EVENT_REJECTED: | |
1276 MFW_EVENT_CONSUMED: | |
1277 | |
1278 $Arguments: | |
1279 | |
1280 *******************************************************************************/ | |
1281 static int midi_test_files_win_cb (MfwEvt e, MfwWin *w) | |
1282 { | |
1283 TRACE_FUNCTION ("midi_test_files_win_cb()"); | |
1284 switch (e) | |
1285 { | |
1286 case MfwWinVisible: /* window is visible */ | |
1287 break; | |
1288 case MfwWinFocussed: /* input focus / selected */ | |
1289 case MfwWinDelete: /* window will be deleted */ | |
1290 | |
1291 default: | |
1292 return MFW_EVENT_REJECTED; | |
1293 } | |
1294 return MFW_EVENT_CONSUMED; | |
1295 } | |
1296 | |
1297 | |
1298 // Dec 08, 2004 REF: CRR MMI-SPR-27284 | |
1299 // Description: MIDI Player: Back Key malfunctions in MIDI application. | |
1300 // Solution: A window is created to hold list window. When the user presses Back key, the newly | |
1301 // created window is deleted along with list window, bringing the control back to Midi options | |
1302 // screen. | |
1303 /******************************************************************************* | |
1304 | |
1305 $Function: midi_test_files_browse | |
1306 | |
1307 $Description: This function is called when the user selects "Browse Midi Files" option | |
1308 | |
1309 $Returns: MFW_EVENT_CONSUMED | |
1310 | |
1311 $Arguments: | |
1312 | |
1313 | |
1314 *******************************************************************************/ | |
1315 GLOBAL int midi_test_files_browse( MfwMnu *m, MfwMnuItem *i ) | |
1316 { | |
1317 T_MFW_HND win; | |
1318 T_MFW_HND parent_win = mfw_parent(mfw_header()); | |
1319 int numberOfMelodies=0; | |
1320 | |
1321 TRACE_FUNCTION ("midi_test_files_browse"); | |
1322 //Sep 11, 2006 DR: OMAPS00094182 xrashmic | |
1323 sounds_midi_init(); | |
1324 // Nov 09, 2005 REF:DR OMAPS00049167 x0039928 | |
1325 // Fix : Call the player initialize routine to set the default parameters. | |
1326 mfw_player_init(); | |
1327 | |
1328 numberOfMelodies = sounds_midi_return_file_number(); | |
1329 TRACE_EVENT_P1("numberOfMelodies is %d",numberOfMelodies); | |
1330 | |
1331 if(numberOfMelodies <= 0) | |
1332 { | |
1333 mmi_midi_test_show_info(0, TxtMidiFileNotLoaded, TxtNull, NULL); | |
1334 | |
1335 } | |
1336 else | |
1337 { | |
1338 win = mmi_midi_test_build_Menu(parent_win); | |
1339 if (win NEQ NULL) | |
1340 { | |
1341 SEND_EVENT (win, E_INIT, 0, 0); | |
1342 } | |
1343 | |
1344 } | |
1345 return MFW_EVENT_CONSUMED; | |
1346 } | |
1347 | |
1348 //Sep 29,2005 REF: SPR 34407 xdeepadh | |
1349 /******************************************************************************* | |
1350 | |
1351 $Function: mmi_midi_test_build_Menu | |
1352 | |
1353 $Description: To hold list window | |
1354 | |
1355 $Returns: Window handle | |
1356 | |
1357 $Arguments: | |
1358 *******************************************************************************/ | |
1359 | |
1360 static T_MFW_HND mmi_midi_test_build_Menu( MfwHnd parent_window) | |
1361 { | |
1362 T_mt_menu * data = (T_mt_menu *)mfwAlloc(sizeof (T_mt_menu)); | |
1363 T_MFW_WIN * win; | |
1364 | |
1365 TRACE_FUNCTION ("mmi_midi_test_build_Menu"); | |
1366 | |
1367 /* | |
1368 * Create window handler | |
1369 */ | |
1370 | |
1371 data->win = win_create (parent_window, 0, E_WIN_VISIBLE, (T_MFW_CB)midi_test_files_win_cb); | |
1372 if (data->win EQ NULL) | |
1373 { | |
1374 return NULL; | |
1375 } | |
1376 | |
1377 TRACE_EVENT("list holder window created: " ); | |
1378 /* | |
1379 * connect the dialog data to the MFW-window | |
1380 */ | |
1381 | |
1382 data->mmi_control.dialog = (T_DIALOG_FUNC)midi_test_files_exec_cb; | |
1383 data->mmi_control.data = data; | |
1384 win = ((T_MFW_HDR *)data->win)->data; | |
1385 win->user = (void *)data; | |
1386 data->parent = parent_window; | |
1387 winShow(data->win); | |
1388 /* | |
1389 * return window handle | |
1390 */ | |
1391 | |
1392 return data->win; | |
1393 } | |
1394 //Sep 11, 2006 DR: OMAPS00094182 xrashmic | |
1395 /******************************************************************************* | |
1396 | |
1397 $Function: mmi_midi_test_Application_cb | |
1398 | |
1399 $Description: Callback function called on exiting the midi appilcation | |
1400 | |
1401 $Returns: None | |
1402 | |
1403 $Arguments: parent_win : Parent window | |
1404 identifier : | |
1405 reason: | |
1406 *******************************************************************************/ | |
1407 static void mmi_midi_test_Application_cb(T_MFW_HND parent_win, UBYTE identifier, UBYTE reason) | |
1408 { | |
1409 TRACE_FUNCTION("mmi_midi_test_Application_cb"); | |
1410 sounds_midi_exit(); | |
1411 } | |
1412 | |
1413 /******************************************************************************* | |
1414 | |
1415 $Function: mmi_midi_test_Application | |
1416 | |
1417 $Description: Launcing the Midi application menu | |
1418 | |
1419 $Returns: Always returns MFW_EVENT_CONSUMED (1) | |
1420 | |
1421 $Arguments: m : pointer to the mnu data for the menu which caused this function to be called. | |
1422 i : pointer to the item data from the menu. | |
1423 *******************************************************************************/ | |
1424 GLOBAL int mmi_midi_test_Application (MfwMnu* m, MfwMnuItem* i) | |
1425 { | |
1426 T_MFW_HND win; | |
1427 T_MFW_HND parent_win = mfw_parent(mfw_header()); | |
1428 TRACE_FUNCTION("mmi_midi_test_Application"); | |
1429 win=bookMenuStart(parent_win, MidiTestAppMenuAttributes(),0); | |
1430 SEND_EVENT(win, ADD_CALLBACK, NULL, (void *)mmi_midi_test_Application_cb); | |
1431 return MFW_EVENT_CONSUMED; | |
1432 } |