FreeCalypso > hg > fc-tourmaline
comparison src/ui/mfw/mfw_midi.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 | PROJECT: MMI-Framework (8417) $Workfile:: mfw_midi.c $| | |
4 | $Author:: NDH $Revision:: 1 $| | |
5 | CREATED: 21.05.04 $Modtime:: 21.05.04 14:58 $| | |
6 | STATE : code | | |
7 +--------------------------------------------------------------------+ | |
8 | |
9 MODULE : MFW_MIDI | |
10 | |
11 PURPOSE : This module contains Midi Riveria Interface functions. | |
12 | |
13 HISTORY : | |
14 | |
15 Aug 27, 2007 REF:DRT OMAPS00137370 x0045876 | |
16 Description: MM: MIDI/IMY file is not played correctly after listening a | |
17 MP3 in the Browse Midi list. | |
18 Solution: Param Voice_Limit is changed when MP3 or AAC file is played. So before | |
19 playing MP3 or AAC file, Voice_Limit should be saved. | |
20 Apr 10, 2007 DRT: OMAPS00125309 x0039928 | |
21 Description: MM - Mono option does not work => MMI changes required | |
22 Solution: Selected Output channel from the settings menu is set for all the players. | |
23 | |
24 Mar 20, 2007 REF:DRT OMAPS00120135 x0039928 | |
25 Description: Midi/MP3/AAC Ringer alert failed with N5.23 pre release | |
26 Solution: The parameter to as_deduce_player_type is corrected. | |
27 | |
28 Jun 06, 2006 REF:ER OMAPS00080844 xdeepadh | |
29 Description: duplication of midi files in ffs area | |
30 Solution: The code to create and load the midi files from FFS to LFS is | |
31 removed. | |
32 | |
33 Nov 21, 2005 REF:ER OMAPS00057430 nekkareb | |
34 Description: AAC Ringer Implementation | |
35 Solution: The Midi Ringer application has been enhanced to support AAC as ringer. | |
36 | |
37 Nov 23, 2005 REF : DR OMAPS00057378 x0039928 | |
38 Bug: All MIDI files are not displayed in MMI in locosto-lite | |
39 Fix: Buffer memory allocated to copy the file contents is freed | |
40 properly and copying file from FFS to LFS is not terminated if error is | |
41 returned for just any one file, instead it tries to copy other files. | |
42 | |
43 Nov 09, 2005 REF:DR OMAPS00049167 x0039928 | |
44 Description: The midi files cannot be heard if the audio channel selected is 'Mono' | |
45 Solution: Midi Player params are made global so that settings are retained across. | |
46 | |
47 Nov 04, 2005 REF:DRT OMAPS00053737 xdeepadh | |
48 Description: MIDI Ringer Linear Flash Support. | |
49 Solution: The Midi Ringer application has been enhanced to loadand play the midi files from LFS. | |
50 | |
51 Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | |
52 Description: Mp3 Ringer Implementation | |
53 Solution: The Midi Ringer application has been enhanced to support mp3 as ringer. | |
54 The interface function names have been modified. | |
55 | |
56 Aug 17, 2005 REF: CHG 33822 xdeepadh | |
57 Description: Configuring the Audio path from Midi Test Application Menu | |
58 Solution: Loading the audio profile for headset and handheld. | |
59 | |
60 Aug 05, 2005 xdeepadh | |
61 Description: Configuring the audio path for midi | |
62 | |
63 Apr 05, 2005 REF: ENH 29994 xdeepadh | |
64 Description: Implementation of Generic Midi Ringer and Modification of existing Midi Test Application | |
65 Solution: Generic Midi Ringer and Midi Test Application were implemented. | |
66 | |
67 */ | |
68 | |
69 #define ENTITY_MFW | |
70 /* | |
71 ** Include Files | |
72 */ | |
73 | |
74 #include "rv_swe.h" | |
75 | |
76 /* includes */ | |
77 #include <string.h> | |
78 #include "typedefs.h" | |
79 #include "mfw_midi.h" | |
80 #include "mfw_mfw.h" | |
81 #include "mfw_sys.h" | |
82 #ifdef FF_MMI_AUDIO_PROFILE | |
83 #include "mfw_mme.h" | |
84 #endif | |
85 //Nov 04, 2005 REF:DRT OMAPS00053737 xdeepadh | |
86 #ifdef FF_MIDI_LOAD_FROM_LFS | |
87 #include "ffs/ffs_api.h" | |
88 #endif //FF_MIDI_LOAD_FROM_LFS | |
89 | |
90 | |
91 | |
92 /*Local defines*/ | |
93 | |
94 #define MIDI_FIRST_FILE_INDEX 0 | |
95 #define MIDI_MAX_FILES 10 | |
96 /// Maximum length of the audio data filename (excluded EOS character). | |
97 | |
98 /* | |
99 ** Local Variable Definitions | |
100 */ | |
101 static T_RV_RETURN_PATH midi_return_path; | |
102 | |
103 /* Global variables*/ | |
104 INT16 player_channel = MIDI_CHANNEL_STEREO; | |
105 int mfw_player_currently_playing_idx=-1; | |
106 UBYTE mfw_player_exit_flag=PLAYER_EXIT_FLAG_TRUE; | |
107 UBYTE mfw_player_playback_loop_flag=FALSE; | |
108 //Aug 05, 2005 xdeepadh | |
109 #ifdef FF_MMI_AUDIO_PROFILE | |
110 //Flag to indicate whether audio media is being played. | |
111 extern UBYTE mfwAudPlay; | |
112 extern void mfw_audio_set_device(int type); | |
113 #endif //FF_MMI_AUDIO_PROFILE | |
114 | |
115 // Nov 09, 2005 REF:DR OMAPS00049167 x0039928 | |
116 // Fix : Declare player_para as global variable. | |
117 #ifdef FF_MMI_TEST_MIDI | |
118 T_AS_PLAYER_PARAMS player_para; | |
119 #endif | |
120 | |
121 /* Aug 27, 2007 DRT: OMAPS00137370 x0045876 */ | |
122 /* Voice Limit parameter should be saved to a temp var before playing | |
123 MP3 or AAC file */ | |
124 static INT16 temp_voice_limit = FF_MIDI_VOICE_LIMIT; | |
125 /* | |
126 ** Public function Definitions | |
127 */ | |
128 | |
129 /******************************************************************************* | |
130 | |
131 $Function: mfw_player_init | |
132 | |
133 $Description: initialize global variables | |
134 | |
135 $Returns: | |
136 | |
137 $Arguments: | |
138 | |
139 *******************************************************************************/ | |
140 void mfw_player_init(void) | |
141 { | |
142 // Nov 09, 2005 REF:DR OMAPS00049167 x0039928 | |
143 // Fix : Initialize the player parameter to the default values. | |
144 #ifdef FF_MMI_TEST_MIDI | |
145 TRACE_FUNCTION("mfw_player_init"); | |
146 player_para.midi.output_channels = MIDI_CHANNEL_MONO; | |
147 player_para.midi.voice_limit = FF_MIDI_VOICE_LIMIT; | |
148 as_player_set_params(AS_PLAYER_TYPE_MIDI,&player_para); | |
149 #endif | |
150 } | |
151 | |
152 /* | |
153 ** Public function Definitions | |
154 */ | |
155 | |
156 /******************************************************************************* | |
157 | |
158 $Function: mfw_player_set_loop_on | |
159 | |
160 $Description: Sets the playback of the midi file in loop on mode(repeat). | |
161 | |
162 $Returns: MFW_PLAYER_TEST_OK | |
163 | |
164 $Arguments: None | |
165 | |
166 *******************************************************************************/ | |
167 SHORT mfw_player_set_loop_on(void) | |
168 { | |
169 TRACE_FUNCTION("mfw_player_set_loop_on"); | |
170 mfw_player_playback_loop_flag = TRUE; | |
171 return MFW_PLAYER_TEST_OK; | |
172 } | |
173 | |
174 | |
175 /******************************************************************************* | |
176 | |
177 $Function: mfw_player_set_loop_off | |
178 | |
179 $Description: Sets the playback of the midi file in loop off mode(once) | |
180 | |
181 $Returns: MFW_PLAYER_TEST_OK | |
182 | |
183 $Arguments: None | |
184 | |
185 *******************************************************************************/ | |
186 SHORT mfw_player_set_loop_off(void) | |
187 { | |
188 TRACE_FUNCTION("mfw_player_set_loop_off"); | |
189 mfw_player_playback_loop_flag = FALSE; | |
190 return MFW_PLAYER_TEST_OK; | |
191 } | |
192 | |
193 | |
194 | |
195 /******************************************************************************* | |
196 | |
197 $Function: mfw_player_set_channel_mono | |
198 | |
199 $Description:Sets the channel to mono | |
200 | |
201 $Returns: MFW_PLAYER_TEST_OK | |
202 | |
203 $Arguments: None | |
204 | |
205 *******************************************************************************/ | |
206 SHORT mfw_player_set_channel_mono(void) | |
207 { | |
208 #ifdef FF_MMI_TEST_MIDI | |
209 TRACE_EVENT("mfw_player_set_channel_mono"); | |
210 /* Apr 10, 2007 DRT: OMAPS00125309 x0039928 */ | |
211 player_channel = MIDI_CHANNEL_MONO; | |
212 return MFW_PLAYER_TEST_OK; | |
213 #else | |
214 return MFW_PLAYER_TEST_OK; | |
215 #endif | |
216 } | |
217 | |
218 | |
219 /******************************************************************************* | |
220 | |
221 $Function: mfw_player_set_channel_stereo | |
222 | |
223 $Description:Sets channel to stereo | |
224 | |
225 $Returns: MFW_PLAYER_TEST_OK | |
226 | |
227 $Arguments: None | |
228 | |
229 *******************************************************************************/ | |
230 SHORT mfw_player_set_channel_stereo(void) | |
231 { | |
232 #ifdef FF_MMI_TEST_MIDI | |
233 TRACE_EVENT("mfw_player_set_channel_stereo"); | |
234 /* Apr 10, 2007 DRT: OMAPS00125309 x0039928 */ | |
235 player_channel = MIDI_CHANNEL_STEREO; | |
236 return MFW_PLAYER_TEST_OK; | |
237 #else | |
238 return MFW_PLAYER_TEST_OK; | |
239 #endif | |
240 } | |
241 | |
242 /* Aug 27, 2007 DRT: OMAPS00137370 x0045876 */ | |
243 /* Voice Limit parameter should be saved to a temp var before playing | |
244 MP3 or AAC file */ | |
245 /******************************************************************************* | |
246 | |
247 $Function: mfw_player_midi_get_voice_limit | |
248 | |
249 $Description: gets the voicelimit | |
250 | |
251 $Returns: Value of Voice Limit between 0 & 32 | |
252 | |
253 $Arguments: None | |
254 | |
255 *******************************************************************************/ | |
256 INT16 mfw_player_midi_get_voice_limit(void) | |
257 { | |
258 return temp_voice_limit; | |
259 } | |
260 | |
261 /******************************************************************************* | |
262 | |
263 $Function: mfw_player_set_voice_limit | |
264 | |
265 $Description: sets the voicelimit | |
266 | |
267 $Returns: None | |
268 | |
269 $Arguments: voice_limit:The voice limit to be set | |
270 | |
271 *******************************************************************************/ | |
272 void mfw_player_set_voice_limit(INT16 voice_lmt) | |
273 { | |
274 temp_voice_limit = voice_lmt; | |
275 } | |
276 | |
277 /******************************************************************************* | |
278 | |
279 $Function: mfw_player_midi_set_voice_limit | |
280 | |
281 $Description: Sets the voicelimit | |
282 | |
283 $Returns: MFW_PLAYER_TEST_OK | |
284 | |
285 $Arguments: voice_limit:The voice limit to be set | |
286 | |
287 *******************************************************************************/ | |
288 SHORT mfw_player_midi_set_voice_limit(int voice_limit) | |
289 { | |
290 #ifdef FF_MMI_TEST_MIDI | |
291 T_AS_RET player_return; | |
292 TRACE_EVENT_P1("mfw_player_midi_set_voice_limit is %d",voice_limit); | |
293 player_para.midi.voice_limit=voice_limit; | |
294 | |
295 /* Aug 27, 2007 DRT: OMAPS00137370 x0045876 */ | |
296 /* Voice Limit parameter should be saved to a temp var before playing | |
297 MP3 or AAC file */ | |
298 mfw_player_set_voice_limit(voice_limit); | |
299 TRACE_EVENT_P1("Temp Voice Limit %d", temp_voice_limit); | |
300 | |
301 player_return=as_player_set_params(AS_PLAYER_TYPE_MIDI,&player_para); | |
302 if(player_return==AS_OK) | |
303 return MFW_PLAYER_TEST_OK; | |
304 else | |
305 return MFW_PLAYER_TEST_ERROR; | |
306 #else | |
307 return MFW_PLAYER_TEST_OK; | |
308 #endif | |
309 } | |
310 | |
311 /******************************************************************************* | |
312 | |
313 $Function: mfw_player_save_selected_file_idx | |
314 | |
315 $Description: save index of file which have been selected | |
316 | |
317 $Returns: MFW_PLAYER_TEST_OK | |
318 | |
319 $Arguments: index: index to be saved | |
320 | |
321 *******************************************************************************/ | |
322 SHORT mfw_player_save_selected_file_idx(int index) | |
323 { | |
324 //default index is set to 0 and inputFileName to NULL at global initialisation | |
325 //save current index of selected file | |
326 TRACE_EVENT_P1("mfw_player_save_selected_file_idx is %d",index); | |
327 mfw_player_currently_playing_idx = index; | |
328 return MFW_PLAYER_TEST_OK; | |
329 | |
330 } | |
331 | |
332 /******************************************************************************* | |
333 | |
334 $Function: mfw_player_set_speaker | |
335 | |
336 $Description:Sets the player_device to Speaker | |
337 | |
338 | |
339 $Returns: MFW_PLAYER_TEST_OK | |
340 | |
341 $Arguments: None | |
342 | |
343 *******************************************************************************/ | |
344 SHORT mfw_player_set_speaker() | |
345 { | |
346 #ifdef FF_MMI_TEST_MIDI | |
347 // Aug 17, 2005 REF: CHG 33822 xdeepadh | |
348 //Load the profile for the Handheld. | |
349 #ifdef FF_MMI_AUDIO_PROFILE | |
350 mfw_audio_set_device(MFW_AUD_HANDHELD); | |
351 return MFW_PLAYER_TEST_OK ; | |
352 #else | |
353 T_AS_RET player_return; | |
354 TRACE_EVENT("mfw_player_set_speaker"); | |
355 player_para.common.output_device=AS_DEVICE_SPEAKER; | |
356 player_return=as_player_set_params(AS_PLAYER_TYPE_COMMON,&player_para); | |
357 if(player_return==AS_OK) | |
358 return MFW_PLAYER_TEST_OK ; | |
359 | |
360 #endif //FF_MMI_AUDIO_PROFILE | |
361 | |
362 #else | |
363 return MFW_PLAYER_TEST_OK; | |
364 | |
365 #endif //FF_MMI_TEST_MIDI | |
366 } | |
367 /******************************************************************************* | |
368 | |
369 $Function: mfw_player_set_headset | |
370 | |
371 $Description:Sets the player_device to Headset | |
372 | |
373 $Returns: MFW_PLAYER_TEST_OK | |
374 | |
375 $Arguments: None | |
376 | |
377 *******************************************************************************/ | |
378 SHORT mfw_player_set_headset() | |
379 { | |
380 #ifdef FF_MMI_TEST_MIDI | |
381 // Aug 17, 2005 REF: CHG 33822 xdeepadh | |
382 //Load the profile for the Headset. | |
383 #ifdef FF_MMI_AUDIO_PROFILE | |
384 mfw_audio_set_device(MFW_AUD_HEADSET); | |
385 return MFW_PLAYER_TEST_OK ; | |
386 #else | |
387 T_AS_RET player_return; | |
388 TRACE_EVENT("mfw_player_set_headset"); | |
389 player_para.common.output_device=AS_DEVICE_HEADSET; | |
390 player_return=as_player_set_params(AS_PLAYER_TYPE_COMMON,&player_para); | |
391 if(player_return==AS_OK) | |
392 return MFW_PLAYER_TEST_OK ; | |
393 #endif //FF_MMI_AUDIO_PROFILE | |
394 #else | |
395 return MFW_PLAYER_TEST_OK; | |
396 | |
397 #endif //FF_MMI_TEST_MIDI | |
398 } | |
399 | |
400 #ifdef FF_MIDI_RINGER | |
401 //Nov 02, 2005 REF:ER OMAPS00039044 xdeepadh | |
402 //The function names have been modified to be generic | |
403 /******************************************************************************* | |
404 | |
405 $Function: mfw_ringer_set_audiopath | |
406 | |
407 $Description:Sets the player_device to Speaker | |
408 | |
409 | |
410 $Returns: MFW_PLAYER_TEST_OK | |
411 | |
412 $Arguments: None | |
413 | |
414 *******************************************************************************/ | |
415 SHORT mfw_ringer_set_audiopath() | |
416 { | |
417 #ifdef FF_MMI_TEST_MIDI | |
418 T_AS_RET player_return; | |
419 TRACE_EVENT("mfw_ringer_set_audiopath"); | |
420 player_para.common.output_device=AS_DEVICE_SPEAKER; | |
421 player_return=as_player_set_params(AS_PLAYER_TYPE_COMMON,&player_para); | |
422 if(player_return==AS_OK) | |
423 return MFW_PLAYER_TEST_OK ; | |
424 else | |
425 return MFW_PLAYER_TEST_ERROR; | |
426 #else | |
427 return MFW_PLAYER_TEST_OK; | |
428 | |
429 #endif | |
430 } | |
431 /******************************************************************************* | |
432 | |
433 $Function: mfw_ringer_set_memory | |
434 | |
435 $Description:Set the ringer memory address for the given ringer mode. | |
436 | |
437 $Returns: | |
438 AS_OK The call is successful. | |
439 AS_INVALID_PARAM The player_type,ringer_mode parameter value is invalid. | |
440 AS_INTERNAL_ERROR Not able to send the message request. | |
441 | |
442 $Arguments: player_type:Type of the player based on the file. | |
443 ringer_mode: ringer mode | |
444 memory_pointer:pointer to midi file location | |
445 size:size of the midi file | |
446 | |
447 *******************************************************************************/ | |
448 | |
449 SHORT mfw_ringer_set_memory(T_AS_PLAYER_TYPE player_type,T_AS_RINGER_MODE ringer_mode,UINT32 *memory_pointer,UINT32 size) | |
450 { | |
451 T_AS_RET ringer_return; | |
452 TRACE_FUNCTION("mfw_ringer_set_memory"); | |
453 TRACE_EVENT_P1("player_type is %d",player_type); | |
454 ringer_return=as_ringer_set_memory(ringer_mode,player_type,memory_pointer, size); | |
455 return ringer_return; | |
456 } | |
457 | |
458 /******************************************************************************* | |
459 | |
460 $Function: mfw_ringer_set_file | |
461 | |
462 $Description:Set the ringer filename for the given ringer mode. | |
463 | |
464 $Returns: | |
465 AS_OK The call is successful. | |
466 AS_INVALID_PARAM The player_type or ringer_mode parameter value is invalid. | |
467 AS_INTERNAL_ERROR Not able to send the message request. | |
468 | |
469 $Arguments: | |
470 player_type:Type of the player based on the file. | |
471 ringer_mode: ringer mode | |
472 filename:Name of the midi file | |
473 | |
474 *******************************************************************************/ | |
475 SHORT mfw_ringer_set_file(T_AS_PLAYER_TYPE player_type,T_AS_RINGER_MODE ringer_mode, const char* filename) | |
476 { | |
477 T_AS_RET ringer_return; | |
478 char temp_file_name[FILENAME_MAX_LEN]; | |
479 #ifdef FF_MMI_FILEMANAGER | |
480 UINT16 temp_file_name_uc[FILENAME_MAX_LEN]; | |
481 #endif | |
482 TRACE_FUNCTION("mfw_ringer_set_file"); | |
483 | |
484 //Nov 04, 2005 REF:DRT OMAPS00053737 xdeepadh | |
485 #ifdef FF_MIDI_LOAD_FROM_LFS //Set the linear file for Ringer | |
486 | |
487 //Provide the complete path of the file | |
488 strcpy(temp_file_name, LFS_CONTENT_DIR); | |
489 strcat(temp_file_name, filename ); | |
490 TRACE_EVENT_P1(" linear temp_filename %s",temp_file_name); | |
491 ringer_return=as_ringer_set_linear_file(ringer_mode,player_type,temp_file_name); | |
492 | |
493 #else //Set the FFS file for Ringer | |
494 //Provide the complete path of the file | |
495 strcpy(temp_file_name, "/FFS"); | |
496 strcat(temp_file_name, RINGER_CONTENT_DIR); | |
497 strcat(temp_file_name, "/"); | |
498 strcat(temp_file_name, filename ); | |
499 TRACE_EVENT_P1(" ffs temp_filename %s",temp_file_name); | |
500 #ifdef FF_MMI_FILEMANAGER | |
501 convert_u8_to_unicode(temp_file_name, temp_file_name_uc); | |
502 ringer_return=as_ringer_set_file(ringer_mode,player_type,temp_file_name_uc); | |
503 #else | |
504 ringer_return=as_ringer_set_file(ringer_mode,player_type,temp_file_name); | |
505 #endif | |
506 #endif //FF_MIDI_LOAD_FROM_LFS | |
507 return ringer_return; | |
508 } | |
509 | |
510 /******************************************************************************* | |
511 | |
512 $Function: mfw_ringer_set_volume | |
513 | |
514 $Description:Set the ringer volume for the given ringer mode. | |
515 | |
516 $Returns: | |
517 AS_OK The call is successful. | |
518 AS_INVALID_PARAM The ringer_mode or volume parameter value is invalid. | |
519 AS_INTERNAL_ERROR Not able to send the message request. | |
520 | |
521 $Arguments: ringer_mode: ringer mode | |
522 volume:Volume which has to be set for the given ringer mode | |
523 | |
524 *******************************************************************************/ | |
525 | |
526 SHORT mfw_ringer_set_volume(T_AS_RINGER_MODE ringer_mode,T_AS_VOLUME volume) | |
527 { | |
528 T_AS_RET ringer_return; | |
529 TRACE_FUNCTION("mfw_ringer_set_volume"); | |
530 TRACE_EVENT_P1("the volume to be set is %d",volume); | |
531 ringer_return=as_ringer_set_volume(ringer_mode,volume); | |
532 return ringer_return; | |
533 } | |
534 | |
535 /******************************************************************************* | |
536 | |
537 $Function: mfw_ringer_start | |
538 | |
539 $Description: Play a particular ringer file | |
540 | |
541 $Returns: | |
542 AS_OK The call is successful. | |
543 AS_INVALID_PARAM The ringer_mode parameter value is invalid. | |
544 AS_INTERNAL_ERROR Not able to send the message request. | |
545 | |
546 $Arguments: | |
547 ringer_mode: ringer mode | |
548 loop:playback in loop | |
549 callback_fn:callback function | |
550 | |
551 *******************************************************************************/ | |
552 | |
553 SHORT mfw_ringer_start(T_AS_RINGER_MODE ringer_mode,BOOLEAN loop,void (*callback_fn)(void *)) | |
554 { | |
555 T_AS_RET ringer_return; | |
556 TRACE_EVENT("mfw_ringer_start"); | |
557 //Aug 05, 2005 xdeepadh | |
558 #ifdef FF_MMI_AUDIO_PROFILE | |
559 //Configure the audio path to current Audio device. | |
560 mfw_set_stereo_path(mfw_get_current_audioDevice()); | |
561 mfwAudPlay = TRUE; //File is playing | |
562 #endif //FF_MMI_AUDIO_PROFILE | |
563 mfw_ringer_configure_callback_fn(callback_fn); | |
564 ringer_return=as_ring(ringer_mode,loop,&midi_return_path); | |
565 return ringer_return; | |
566 } | |
567 | |
568 /******************************************************************************* | |
569 | |
570 $Function: mfw_ringer_stop | |
571 | |
572 $Description:Stop the current ringer melody playback. | |
573 | |
574 $Returns: | |
575 AS_OK The call is successful. | |
576 AS_INTERNAL_ERROR Not able to send the message request. | |
577 | |
578 $Arguments: callback_fn:callback function | |
579 | |
580 *******************************************************************************/ | |
581 | |
582 SHORT mfw_ringer_stop(void (*callback_fn)(void *)) | |
583 { | |
584 T_AS_RET ringer_return; | |
585 TRACE_EVENT("mfw_ringer_stop"); | |
586 mfw_ringer_configure_callback_fn(callback_fn); | |
587 ringer_return=as_stop(&midi_return_path); | |
588 return ringer_return; | |
589 } | |
590 | |
591 /******************************************************************************* | |
592 | |
593 $Function: mfw_ringer_get_info | |
594 | |
595 $Description: Gets the ringer information for the given ringer mode. | |
596 | |
597 $Returns: | |
598 pointer to T_AS_RINGER_INFO | |
599 $Arguments: ringer_mode: ringer mode | |
600 ringer_info: The ringer details will be stored here. | |
601 | |
602 *******************************************************************************/ | |
603 T_AS_RINGER_INFO* mfw_ringer_get_info(T_AS_RINGER_MODE ringer_mode,const T_AS_RINGER_INFO* ringer_info) | |
604 { | |
605 T_AS_RET ringer_return; | |
606 TRACE_FUNCTION("mfw_ringer_get_info"); | |
607 ringer_return=as_ringer_get(ringer_mode,&ringer_info); | |
608 TRACE_EVENT_P1("ringer_info volume is %d",ringer_info->volume); | |
609 TRACE_EVENT_P1("ringer info name is %s",ringer_info->data.filename); | |
610 if(ringer_return==AS_OK) | |
611 return (T_AS_RINGER_INFO*)ringer_info; | |
612 else | |
613 return NULL; | |
614 } | |
615 | |
616 /******************************************************************************* | |
617 | |
618 $Function: mfw_ringer_configure_callback_fn | |
619 | |
620 $Description: Configure the Riviera Return Path | |
621 | |
622 $Returns:None | |
623 | |
624 $Arguments: Callback function | |
625 | |
626 *******************************************************************************/ | |
627 | |
628 static void mfw_ringer_configure_callback_fn(void (*callback_fn)(void *)) | |
629 { | |
630 | |
631 TRACE_EVENT("mfw_ringer_configure_callback_fn"); | |
632 midi_return_path.addr_id = 0; | |
633 midi_return_path.callback_func = callback_fn; | |
634 | |
635 return; | |
636 } | |
637 | |
638 /******************************************************************************* | |
639 | |
640 $Function: mfw_player_start_memory | |
641 | |
642 $Description:Start the playback melody stored in the given memory location according to the given player type. | |
643 | |
644 $Returns: | |
645 AS_OK The call is successful. | |
646 AS_INVALID_PARAM The player_type or volume parameter value is invalid. | |
647 AS_INTERNAL_ERROR Not able to send the message request. | |
648 | |
649 $Arguments: player_type:Type of the player based on the file. | |
650 address:pointer to midi file location to be played | |
651 size:size of the midi file | |
652 volume:Volume with which to play the midi file | |
653 loop:playback in loop | |
654 callback_fn:callback function | |
655 | |
656 *******************************************************************************/ | |
657 | |
658 SHORT mfw_player_start_memory(T_AS_PLAYER_TYPE player_type,const UINT32 * address, UINT32 size,T_AS_VOLUME volume,BOOLEAN loop,void (*callback_fn)(void *)) | |
659 { | |
660 T_AS_RET player_return; | |
661 TRACE_EVENT("mfw_player_start_memory"); | |
662 //Aug 05, 2005 xdeepadh | |
663 #ifdef FF_MMI_AUDIO_PROFILE | |
664 //Configure the audio path to current Audio device. | |
665 mfw_set_stereo_path(mfw_get_current_audioDevice()); | |
666 mfwAudPlay = TRUE; //File is playing | |
667 #endif //FF_MMI_AUDIO_PROFILE | |
668 mfw_ringer_configure_callback_fn(callback_fn); | |
669 player_return=as_play_memory(player_type,address,size,volume,loop,&midi_return_path); | |
670 return player_return; | |
671 | |
672 } | |
673 | |
674 /******************************************************************************* | |
675 | |
676 $Function: mfw_player_start_file | |
677 | |
678 $Description:Start the playback melody stored in the given file according to the given player type. | |
679 | |
680 $Returns: | |
681 AS_OK The call is successful. | |
682 AS_INVALID_PARAM The player_type or volume parameter value is invalid. | |
683 AS_FILE_ERROR The melody file can not be accessed, or contain unrecognized data. | |
684 AS_INTERNAL_ERROR Not able to send the message request. | |
685 | |
686 | |
687 $Arguments: player_type:Type of the player based on the file. | |
688 filename:Name of the midi file to be played | |
689 volume:Volume with which to play the midi file | |
690 loop:playback in loop | |
691 callback_fn:callback function | |
692 | |
693 *******************************************************************************/ | |
694 | |
695 #ifdef FF_MMI_FILEMANAGER | |
696 SHORT mfw_player_start_file(T_AS_PLAYER_TYPE player_type, UINT16 * filename,T_AS_VOLUME volume, BOOLEAN loop,void (*callback_fn)(void *)) | |
697 #else | |
698 SHORT mfw_player_start_file(T_AS_PLAYER_TYPE player_type,const char * filename,T_AS_VOLUME volume, BOOLEAN loop,void (*callback_fn)(void *)) | |
699 #endif | |
700 { | |
701 T_AS_RET player_return; | |
702 char temp_file_name[FILENAME_MAX_LEN]; | |
703 #ifdef FF_MMI_FILEMANAGER | |
704 char filename_ascii[FILENAME_MAX_LEN]; | |
705 #endif | |
706 TRACE_EVENT("mfw_player_start_file"); | |
707 //Aug 05, 2005 xdeepadh | |
708 #ifdef FF_MMI_AUDIO_PROFILE | |
709 //Configure the audio path to current Audio device. | |
710 mfw_set_stereo_path(mfw_get_current_audioDevice()); | |
711 mfwAudPlay = TRUE; //File is playing | |
712 #endif //FF_MMI_AUDIO_PROFILE | |
713 mfw_ringer_configure_callback_fn(callback_fn); | |
714 | |
715 //Nov 04, 2005 REF:DRT OMAPS00053737 xdeepadh | |
716 #ifdef FF_MIDI_LOAD_FROM_LFS //Play the linear file for Player | |
717 | |
718 //Since, the file can be with or without the full path , | |
719 //Verify the file for full path , else provide the complete path. | |
720 strcpy(temp_file_name, LFS_CONTENT_DIR); | |
721 | |
722 //The complete path is provided | |
723 if(strncmp(filename,temp_file_name,strlen(temp_file_name))==0) | |
724 { | |
725 player_return=as_play_linear_file(player_type,filename,volume,loop,&midi_return_path); | |
726 } | |
727 //Provide the complete path | |
728 else | |
729 { | |
730 strcat(temp_file_name, filename ); | |
731 player_return=as_play_linear_file(player_type,temp_file_name,volume,loop,&midi_return_path); | |
732 } | |
733 | |
734 #else //Play the FFS file for Player | |
735 | |
736 //Since, the file can be with or without the full path , | |
737 //Verify the file for full path , else provide the complete path. | |
738 //The complete path is provided | |
739 #ifdef FF_MMI_FILEMANAGER | |
740 strcpy(temp_file_name, "/FFS"); | |
741 strcat(temp_file_name, RINGER_CONTENT_DIR); | |
742 convert_unicode_to_u8(filename, filename_ascii); | |
743 if(strncmp(filename_ascii,temp_file_name,strlen(temp_file_name))==0) | |
744 #else | |
745 strcpy(temp_file_name, RINGER_CONTENT_DIR); | |
746 if(strncmp(filename,temp_file_name,strlen(temp_file_name))==0) | |
747 #endif | |
748 { | |
749 #ifdef FF_MMI_FILEMANAGER | |
750 player_return=as_play_file(player_type,filename,volume,loop,0,&midi_return_path); | |
751 #else | |
752 player_return=as_play_file(player_type,filename,volume,loop,&midi_return_path); | |
753 #endif | |
754 } | |
755 //Provide the complete path | |
756 else | |
757 { | |
758 strcat(temp_file_name, "/"); | |
759 #ifdef FF_MMI_FILEMANAGER | |
760 strcat(temp_file_name, filename_ascii); | |
761 convert_u8_to_unicode(temp_file_name, filename); | |
762 player_return=as_play_file(player_type,filename,volume,loop,0,&midi_return_path); | |
763 #else | |
764 strcat(temp_file_name, filename ); | |
765 player_return=as_play_file(player_type,temp_file_name,volume,loop,&midi_return_path); | |
766 #endif | |
767 } | |
768 #endif //FF_MIDI_LOAD_FROM_LFS | |
769 | |
770 return player_return; | |
771 } | |
772 | |
773 /******************************************************************************* | |
774 | |
775 $Function: mfw_ringer_deduce_player_type | |
776 | |
777 $Description: Deduces the player type | |
778 | |
779 $Returns: T_AS_PLAYER_TYPE | |
780 | |
781 | |
782 $Arguments: filename:Name of the midi file | |
783 | |
784 *******************************************************************************/ | |
785 | |
786 T_AS_PLAYER_TYPE mfw_ringer_deduce_player_type(const char * filename) | |
787 { | |
788 T_AS_PLAYER_TYPE player_type; | |
789 #ifdef FF_MMI_FILEMANAGER | |
790 char temp_file_name[FILENAME_MAX_LEN]; | |
791 UINT16 * filename_uc; | |
792 /* Mar 20, 2007 REF:DRT OMAPS00120135 x0039928 */ | |
793 /* Fix: filename_uc is a pointer now instead of array */ | |
794 filename_uc = (UINT16 *)mfwAlloc(sizeof(UINT16) * FILENAME_MAX_LEN); | |
795 strcpy(temp_file_name, "/FFS"); | |
796 strcat(temp_file_name, RINGER_CONTENT_DIR); | |
797 strcat(temp_file_name, "/"); | |
798 strcat(temp_file_name, filename ); | |
799 convert_u8_to_unicode(temp_file_name, filename_uc); | |
800 as_deduce_player_type(filename_uc,&player_type); | |
801 mfwFree((U8 *) filename_uc, sizeof(UINT16) * FILENAME_MAX_LEN); | |
802 #else | |
803 as_deduce_player_type(filename,&player_type); | |
804 #endif | |
805 TRACE_EVENT("mfw_ringer_deduce_player_type"); | |
806 return player_type; | |
807 } | |
808 | |
809 | |
810 /******************************************************************************* | |
811 | |
812 $Function: mfw_player_stop | |
813 | |
814 $Description:Stop the current melody player | |
815 | |
816 $Returns: | |
817 AS_OK The call is successful. | |
818 AS_INTERNAL_ERROR Not able to send the message request. | |
819 | |
820 | |
821 $Arguments: callback_fn:callback function | |
822 | |
823 *******************************************************************************/ | |
824 | |
825 SHORT mfw_player_stop(void (*callback_fn)(void *)) | |
826 { | |
827 T_AS_RET player_return; | |
828 TRACE_EVENT("mfw_player_stop"); | |
829 mfw_ringer_configure_callback_fn(callback_fn); | |
830 player_return=as_stop(&midi_return_path); | |
831 return player_return; | |
832 } | |
833 | |
834 /******************************************************************************* | |
835 | |
836 $Function: mfw_player_midi_set_params | |
837 | |
838 $Description:Set the specific parameters for the player of given player_type. | |
839 | |
840 $Returns: AS_OK if call is succesfull. | |
841 AS_INVALID_PARAM if the player_type parameter value is invalid. | |
842 | |
843 $Arguments: Voicelimit:Voice limit to be set | |
844 channel:channel to be set | |
845 | |
846 *******************************************************************************/ | |
847 | |
848 SHORT mfw_player_midi_set_params(INT16 voicelimit,INT16 channel) | |
849 { | |
850 T_AS_PLAYER_PARAMS player_para; | |
851 T_AS_RET player_return; | |
852 TRACE_FUNCTION("mfw_player_midi_set_params"); | |
853 //Set the Voice limit and channel for Idle mode | |
854 player_para.midi.voice_limit=voicelimit ; | |
855 player_para.midi.output_channels=channel; | |
856 player_return=as_player_set_params(AS_PLAYER_TYPE_MIDI,&player_para); | |
857 return player_return; | |
858 } | |
859 | |
860 /******************************************************************************* | |
861 | |
862 $Function: mfw_player_mp3_set_params | |
863 | |
864 $Description:Set the specific parameters for the player of given player_type.(mp3) | |
865 | |
866 $Returns: AS_OK if call is succesfull. | |
867 AS_INVALID_PARAM if the player_type parameter value is invalid. | |
868 | |
869 $Arguments: size_file_start:size of the file where the melody must start | |
870 mono_stereo:channel to be set | |
871 | |
872 *******************************************************************************/ | |
873 #ifdef FF_MP3_RINGER | |
874 SHORT mfw_player_mp3_set_params(UINT32 size_file_start,BOOLEAN mono_stereo) | |
875 { | |
876 T_AS_PLAYER_PARAMS player_para; | |
877 T_AS_RET player_return; | |
878 TRACE_FUNCTION("mfw_player_mp3_set_params"); | |
879 //Set the Voice limit and channel for Idle mode | |
880 player_para.mp3.mono_stereo = mono_stereo ; | |
881 player_para.mp3.size_file_start = size_file_start; | |
882 player_return=as_player_set_params(AS_PLAYER_TYPE_MP3,&player_para); | |
883 return player_return; | |
884 } | |
885 #endif //FF_MP3_RINGER | |
886 | |
887 | |
888 //Nov 22, 2005 ER: OMAPS00057430, AAC Ringer support, nekkareb | |
889 /******************************************************************************* | |
890 | |
891 $Function: mfw_player_aac_set_params | |
892 | |
893 $Description:Set the specific parameters for the player of given player_type.(aac) | |
894 | |
895 $Returns: AS_OK if call is succesfull. | |
896 AS_INVALID_PARAM if the player_type parameter value is invalid. | |
897 | |
898 $Arguments: size_file_start:size of the file where the melody must start | |
899 mono_stereo:channel to be set | |
900 | |
901 *******************************************************************************/ | |
902 #ifdef FF_AAC_RINGER | |
903 SHORT mfw_player_aac_set_params(UINT32 size_file_start,BOOLEAN mono_stereo) | |
904 { | |
905 T_AS_PLAYER_PARAMS player_para; | |
906 T_AS_RET player_return; | |
907 | |
908 TRACE_FUNCTION("mfw_player_aac_set_params"); | |
909 | |
910 //Set the Voice limit and channel for Idle mode | |
911 player_para.aac.mono_stereo = mono_stereo ; | |
912 player_para.aac.size_file_start = size_file_start; | |
913 | |
914 player_return=as_player_set_params(AS_PLAYER_TYPE_AAC,&player_para); | |
915 return player_return; | |
916 } | |
917 #endif //FF_AAC_RINGER | |
918 | |
919 | |
920 /******************************************************************************* | |
921 | |
922 $Function: mfw_player_get_params | |
923 | |
924 $Description:gets the specific parametersfor the player of given player_type. | |
925 | |
926 $Returns: AS_OK if call is succesfull. | |
927 AS_INVALID_PARAM if the player_type parameter value is invalid. | |
928 | |
929 $Arguments: player_type:Type of the player based on the file. | |
930 player_para:The structure containing current parameters for the player type | |
931 | |
932 *******************************************************************************/ | |
933 | |
934 SHORT mfw_player_get_params(T_AS_PLAYER_TYPE player_type,const T_AS_PLAYER_PARAMS* player_para) | |
935 { | |
936 T_AS_RET player_return; | |
937 TRACE_FUNCTION("mfw_player_get_params"); | |
938 player_return=as_player_get_params(player_type,&player_para); | |
939 return player_return; | |
940 } | |
941 | |
942 | |
943 #endif |