Get device by id
[platform/core/multimedia/libmm-sound.git] / include / mm_sound.h
1 /*
2  * libmm-sound
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Seungbae Shin <seungbae.shin@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 /**
23  * @file                mm_sound.h
24  * @brief               Application interface library for sound module.
25  * @date
26  * @version             Release
27  *
28  * Application interface library for sound module.
29  */
30
31 #ifndef __MM_SOUND_H__
32 #define __MM_SOUND_H__
33
34 #include <mm_types.h>
35 #include <mm_error.h>
36 #include <mm_message.h>
37
38 #ifdef __cplusplus
39         extern "C" {
40 #endif
41
42 /**
43         @addtogroup SOUND
44         @{
45         @par
46         This part is describes the sound module of multimedia framework. Sound
47         module provides APIs to implement play wav file with simple api, to handle volume information,
48         to handle audio route policy.
49
50         @par
51         There is six different volume type for normal usage. application should set proper volume type to multimedia playback APIs.
52         <div> <table>
53         <tr>
54         <td><B>Type</B></td>
55         <td><B>Description</B></td>
56         </tr>
57         <tr>
58         <td>VOLUME_TYPE_SYSTEM</td>
59         <td>volume for normal system sound (e.g. keysound, camera shutter)</td>
60         </tr>
61         <tr>
62         <td>VOLUME_TYPE_NOTIFICATION</td>
63         <td>volume for notification (e.g. message, email notification)</td>
64         </tr>
65         <tr>
66         <td>VOLUME_TYPE_RINGTONE</td>
67         <td>volume for incoming call ring</td>
68         </tr>
69         <tr>
70         <td>VOLUME_TYPE_MEDIA</td>
71         <td>volume for media playback (e.g. music, video playback)</td>
72         </tr>
73         <tr>
74         <td>VOLUME_TYPE_CALL</td>
75         <td>volume for call</td>
76         </tr>
77         </table> </div>
78
79         @par
80         application can change audio route policy with mm-sound API.
81         Audio route is input and output of audio stream.
82
83         @par
84         @image html             audio_device.png        "Figure1. Audio Devices of mobile phone"        width=12cm
85         @image latex    audio_device.png        "Figure1. Audio Devices of mobile phone"        width=12cm
86
87         @par
88         Default audio route policy is like follows
89         @par
90         for playback
91         <div><table>
92         <tr>
93         <td><B>Bluetooth headset</B></td>
94         <td><B>Wired headset</B></td>
95         <td><B>Playback Device</B></td>
96         </tr>
97         <tr>
98         <td>connected</td>
99         <td>plugged</td>
100         <td>Bluetooth headset</td>
101         </tr>
102         <tr>
103         <td>connected</td>
104         <td>unplugged</td>
105         <td>Bluetooth headset</td>
106         </tr>
107         <tr>
108         <td>disconnected</td>
109         <td>plugged</td>
110         <td>Wired headset</td>
111         </tr>
112         <tr>
113         <td>disconnected</td>
114         <td>unplugged</td>
115         <td>Loud speaker</td>
116         </tr>
117         </table></div>
118
119         @par
120         for capture (bluetooth headset mic used only in call mode)
121         <div><table>
122         <tr>
123         <td><B>Bluetooth headset mic</B></td>
124         <td><B>Wired headset mic</B></td>
125         <td><B>Capture Device</B></td>
126         </tr>
127         <tr>
128         <td>connected</td>
129         <td>plugged</td>
130         <td>Wired headset mic</td>
131         </tr>
132         <tr>
133         <td>connected</td>
134         <td>unplugged</td>
135         <td>microphone</td>
136         </tr>
137         <tr>
138         <td>disconnected</td>
139         <td>plugged</td>
140         <td>Wired headset mic</td>
141         </tr>
142         <tr>
143         <td>disconnected</td>
144         <td>unplugged</td>
145         <td>Wired headset mic</td>
146         </tr>
147         </table></div>
148
149         @par
150         If application changes routing policy to SYSTEM_AUDIO_ROUTE_POLICY_IGNORE_A2DP with mm_sound_route_set_system_policy
151         audio routing policy has changed to ignore bluetooth headset connection.
152         @par
153         for playback
154         <div><table>
155         <tr>
156         <td><B>Bluetooth headset</B></td>
157         <td><B>Wired headset</B></td>
158         <td><B>Playback Device</B></td>
159         </tr>
160         <tr>
161         <td>connected</td>
162         <td>plugged</td>
163         <td>Wired headset</td>
164         </tr>
165         <tr>
166         <td>connected</td>
167         <td>unplugged</td>
168         <td>Loud speaker</td>
169         </tr>
170         <tr>
171         <td>disconnected</td>
172         <td>plugged</td>
173         <td>Wired headset</td>
174         </tr>
175         <tr>
176         <td>disconnected</td>
177         <td>unplugged</td>
178         <td>Loud speaker</td>
179         </tr>
180         </table></div>
181
182         @par
183         for capture (bluetooth headset mic used only in call mode)
184         <div><table>
185         <tr>
186         <td><B>Bluetooth headset mic</B></td>
187         <td><B>Wired headset mic</B></td>
188         <td><B>Capture Device</B></td>
189         </tr>
190         <tr>
191         <td>connected</td>
192         <td>plugged</td>
193         <td>Wired headset mic</td>
194         </tr>
195         <tr>
196         <td>connected</td>
197         <td>unplugged</td>
198         <td>microphone</td>
199         </tr>
200         <tr>
201         <td>disconnected</td>
202         <td>plugged</td>
203         <td>Wired headset mic</td>
204         </tr>
205         <tr>
206         <td>disconnected</td>
207         <td>unplugged</td>
208         <td>Wired headset mic</td>
209         </tr>
210         </table></div>
211
212         @par
213         If application changes routing policy to SYSTEM_AUDIO_ROUTE_POLICY_HANDSET_ONLY with mm_sound_route_set_system_policy
214         audio routing policy has changed to use only loud speaker and microphone.
215         @par
216         for playback
217         <div><table>
218         <tr>
219         <td><B>Bluetooth headset</B></td>
220         <td><B>Wired headset</B></td>
221         <td><B>Playback Device</B></td>
222         </tr>
223         <tr>
224         <td>connected</td>
225         <td>plugged</td>
226         <td>Loud speaker</td>
227         </tr>
228         <tr>
229         <td>connected</td>
230         <td>unplugged</td>
231         <td>Loud speaker</td>
232         </tr>
233         <tr>
234         <td>disconnected</td>
235         <td>plugged</td>
236         <td>Loud speaker</td>
237         </tr>
238         <tr>
239         <td>disconnected</td>
240         <td>unplugged</td>
241         <td>Loud speaker</td>
242         </tr>
243         </table></div>
244
245         @par
246         for capture (bluetooth headset mic used only in call mode)
247         <div><table>
248         <tr>
249         <td><B>Bluetooth headset mic</B></td>
250         <td><B>Wired headset mic</B></td>
251         <td><B>Capture Device</B></td>
252         </tr>
253         <tr>
254         <td>connected</td>
255         <td>plugged</td>
256         <td>microphone</td>
257         </tr>
258         <tr>
259         <td>connected</td>
260         <td>unplugged</td>
261         <td>microphone</td>
262         </tr>
263         <tr>
264         <td>disconnected</td>
265         <td>plugged</td>
266         <td>microphone</td>
267         </tr>
268         <tr>
269         <td>disconnected</td>
270         <td>unplugged</td>
271         <td>microphone</td>
272         </tr>
273         </table></div>
274
275  */
276
277 /*
278  * MMSound Volume APIs
279  */
280
281 /**
282  * Enumerations of Volume type.
283  */
284
285 typedef enum {
286         VOLUME_TYPE_SYSTEM,                             /**< System volume type */
287         VOLUME_TYPE_NOTIFICATION,               /**< Notification volume type */
288         VOLUME_TYPE_ALARM,                              /**< Alarm volume type */
289         VOLUME_TYPE_RINGTONE,                   /**< Ringtone volume type */
290         VOLUME_TYPE_MEDIA,                              /**< Media volume type */
291         VOLUME_TYPE_CALL,                               /**< Call volume type */
292         VOLUME_TYPE_VOIP,                               /**< VOIP volume type */
293         VOLUME_TYPE_VOICE,                              /**< VOICE volume type */
294         VOLUME_TYPE_FIXED,                              /**< Volume type for fixed acoustic level */
295         VOLUME_TYPE_MAX,                                /**< Volume type count */
296         VOLUME_TYPE_UNKNOWN = -1,       /**< volume type is not determined */
297 } volume_type_t;
298
299 typedef enum {
300         VOLUME_GAIN_DEFAULT             = 0,
301         VOLUME_GAIN_DIALER              = 1<<8,
302         VOLUME_GAIN_TOUCH               = 2<<8,
303         VOLUME_GAIN_AF                  = 3<<8,
304         VOLUME_GAIN_SHUTTER1    = 4<<8,
305         VOLUME_GAIN_SHUTTER2    = 5<<8,
306         VOLUME_GAIN_CAMCORDING  = 6<<8,
307         VOLUME_GAIN_MIDI                = 7<<8,
308         VOLUME_GAIN_BOOTING             = 8<<8,
309         VOLUME_GAIN_VIDEO               = 9<<8,
310         VOLUME_GAIN_TTS                 = 10<<8,
311 } volume_gain_t;
312
313 /**
314  * @brief Enumerations of supporting source_type
315  */
316 typedef enum {
317     SUPPORT_SOURCE_TYPE_DEFAULT,
318     SUPPORT_SOURCE_TYPE_MIRRORING,
319     SUPPORT_SOURCE_TYPE_VOICECONTROL,
320     SUPPORT_SOURCE_TYPE_SVR,
321     SUPPORT_SOURCE_TYPE_VIDEOCALL,
322     SUPPORT_SOURCE_TYPE_VOICERECORDING,
323     SUPPORT_SOURCE_TYPE_VOIP, /* Supporting VoIP source*/
324     SUPPORT_SOURCE_TYPE_CALL_FORWARDING,
325     SUPPORT_SOURCE_TYPE_FMRADIO,
326     SUPPORT_SOURCE_TYPE_LOOPBACK,
327 } mm_sound_source_type_e;
328
329 /**
330  * Active volume change callback function type.
331  *
332  * @param       type                    [in]    The sound type of changed volume
333  * @param       volume                  [in]    The new volume value
334  * @param       user_data               [in]    Argument passed when callback has called
335  *
336  * @return      No return value
337  * @remark      None.
338  * @see         mm_sound_add_volume_changed_callback mm_sound_remove_volume_changed_callback
339  */
340 typedef void (*mm_sound_volume_changed_cb) (volume_type_t type, unsigned int volume, void *user_data);
341
342
343
344
345 int mm_sound_add_volume_changed_callback(mm_sound_volume_changed_cb func, void* user_data, unsigned int *id);
346
347
348 /**
349  * This function is to remove volume changed callback.
350  *
351  * @param       type                    [in]    volume type to set change callback function
352  *
353  * @return      This function returns MM_ERROR_NONE on success, or negative value
354  *                      with error code.
355  * @remark      None.
356  * @pre         Callback function should be registered previously for given volume type.
357  * @post        Callback function will not be called anymore.
358  * @see         volume_type_t
359  * @par Example
360  * @code
361 void _volume_callback(void *data)
362 {
363         printf("Callback function\n");
364 }
365
366 int volume_callback()
367 {
368         int ret = 0;
369         int vol_type = VOLUME_TYPE_MEDIA;
370
371         mm_sound_volume_add_callback(vol_type, _volume_callback, NULL);
372
373         ret = mm_sound_volume_remove_callback(vol_type);
374         if ( MM_ERROR_NONE == ret)
375         {
376                 printf("Remove callback success\n");
377         }
378         else
379         {
380                 printf("Remove callback failed\n");
381         }
382
383         return ret;
384 }
385
386  * @endcode
387  */
388 int mm_sound_volume_remove_callback(volume_type_t type);
389
390 /**
391  * This function is to remove volume change callback.
392  *
393  * @return      This function returns MM_ERROR_NONE on success, or negative value
394  *                      with error code.
395  **/
396 int mm_sound_remove_volume_changed_callback(unsigned int id);
397
398 /**
399  * This function is to set volume level of certain volume type.
400  *
401  * @param       type                    [in]    volume type to set value.
402  * @param       value                   [in]    volume value.
403  *
404  * @return      This function returns MM_ERROR_NONE on success, or negative value
405  *                      with error code.
406  * @remark      value should be 0 ~ MAX
407  * @see         mm_sound_volume_get_value volume_type_t
408  * @pre         None.
409  * @post        Volume value will be changed to given value for given volume type.
410  * @par Example
411  */
412 int mm_sound_volume_set_value(volume_type_t type, const unsigned int volume_level);
413
414
415 /**
416  * This function is to get volume level of certain volume type.
417  *
418  * @param       type                    [in]    volume type to get value.
419  * @param       value                   [out]   volume value.
420  *
421  * @return      This function returns MM_ERROR_NONE on success, or negative value
422  *                      with error code.
423  * @remark      None.
424  * @pre         None.
425  * @post        None.
426  * @see         volume_type_t mm_sound_volume_set_value
427  * @par Example
428  * @code
429 int value = 0;
430 int ret = 0;
431
432 ret = mm_sound_volume_get_value(VOLUME_TYPE_SYSTEM, &value);
433 if(ret < 0)
434 {
435         printf("Can not get volume\n");
436 }
437 else
438 {
439         printf("System type volume is %d\n", value);
440 }
441  * @endcode
442  * @see         mm_sound_volume_set_value
443  */
444 int mm_sound_volume_get_value(volume_type_t type, unsigned int *value);
445
446
447
448 /**
449  * This function is to set primary volume type.
450  *
451  * @param       type                    [in]    volume type to set as primary volume type.
452  *
453  * @return      This function returns MM_ERROR_NONE on success, or negative value
454  *                      with error code.
455  * @remark      Application should use this function during foreground.
456  * @pre         None.
457  * @post        Volume app. will be update given volume type when H/W volume control key pressed.
458  * @see         volume_type_t
459  * @par Example
460  * @code
461 static int _resume(void *data)
462 {
463         int ret = 0;
464
465         ret = mm_sound_volume_primary_type_set(VOLUME_TYPE_MEDIA);
466         if(ret < 0)
467         {
468                 printf("Can not set primary volume type\n");
469         }
470         ...
471 }
472
473 static int _pause(void* data)
474 {
475         int ret = 0;
476
477         ret = mm_sound_volume_primary_type_set(VOLUME_TYPE_UNKNOWN);
478         if(ret < 0)
479         {
480                 printf("Can not clear primary volume type\n");
481         }
482         ...
483 }
484
485 int main()
486 {
487         ...
488         struct appcore_ops ops = {
489                 .create = _create,
490                 .terminate = _terminate,
491                 .pause = _pause,
492                 .resume = _resume,
493                 .reset = _reset,
494         };
495         ...
496         return appcore_efl_main(PACKAGE, ..., &ops);
497 }
498  * @endcode
499  */
500 int mm_sound_volume_primary_type_set(volume_type_t type);
501 int mm_sound_volume_primary_type_get(volume_type_t *type);
502
503 /**
504  * This function is to set sound filter and apply to selected stream type.
505  *
506  * @param       stream_type                     [in]    stream type to apply
507  * @param       filter_name                     [in]    name of filter module to apply
508  * @param       filter_parameters       [in]    extra filter parameters(optional)
509  * @param       filter_group            [in]    extra filter group(optional)
510  *
511  * @return      This function returns MM_ERROR_NONE on success, or negative value
512  *                      with error code.
513  * @remark      None
514  * @pre         None
515  * @post        None
516  * @see         None
517  */
518 int mm_sound_set_filter(const char *stream_type, const char *filter_name, const char *filter_parameters, const char *filter_group);
519
520 /**
521  * This function is to unset sound filter and remove from selected stream type.
522  *
523  * @param       stream_type                     [in]    stream type to remove
524  *
525  * @return      This function returns MM_ERROR_NONE on success, or negative value
526  *                      with error code.
527  * @remark      None
528  * @pre         None
529  * @post        None
530  * @see         None
531  */
532 int mm_sound_unset_filter(const char *stream_type);
533
534 /**
535  * This function is to control filter configurations to selected stream type.
536  *
537  * @param       stream_type                     [in]    stream type to apply
538  * @param       filter_name                     [in]    specify filter module to apply
539  * @param       filter_controls         [in]    filter control parameters(e.g, "0.0, 0.1, 3.0")
540  *
541  * @return      This function returns MM_ERROR_NONE on success, or negative value
542  *                      with error code.
543  * @remark      None
544  * @pre         None
545  * @post        None
546  * @see         None
547  */
548 int mm_sound_control_filter(const char *stream_type, const char *filter_name, const char *filter_controls);
549
550 /**
551  * Terminate callback function type.
552  *
553  * @param       data            [in]    Argument passed when callback was set
554  * @param       id              [in]    handle which has completed playing
555  *
556  * @return      No return value
557  * @remark      It is not allowed to call MMSound API recursively or do time-consuming
558  *                      task in this callback because this callback is called synchronously.
559  * @see         mm_sound_play_sound
560  */
561 typedef void (*mm_sound_stop_callback_func) (void *data, int id);
562
563 /*
564  * MMSound Play APIs
565  */
566
567 /**
568  * This function is to play system sound.
569  *
570  * @param       filename                [in] Sound filename to play
571  * @param       volume config   [in] Volume type & volume gain
572  * @param       callback                [in] Callback function pointer when playing is terminated.
573  * @param       data                    [in] Pointer to user data when callback is called.
574  * @param       handle                  [out] Handle of sound play.
575  *
576  * @return      This function returns MM_ERROR_NONE on success, or negative value
577  *                      with error code.
578  * @remark      When the stop callback is set, it will be called when system sound is
579  *                      terminated. If mm_sound_stop_sound() is called apparently before
580  *                      system sound is terminated, stop_callback will not be called.
581  * @see         mm_sound_stop_sound mm_sound_stop_callback_func volume_type_t volume_gain_t
582  * @pre         None.
583  * @post        Sound will be generated with given filename.
584  * @par Example
585  * @code
586 int g_stop=0;
587 void _stop_callback(void* data)
588 {
589         printf("Stop callback\n");
590         g_stop = 1;
591 }
592
593 int play_file()
594 {
595         char filename[] ="testfile.wav";
596         volume_type_t volume = VOLUME_TYPE_SYSTEM;
597         int ret = 0;
598         int handle = -1;
599
600         ret = mm_sound_play_sound(filename, volume, _stop_callback, NULL, &handle);
601         if(ret < 0)
602         {
603                 printf("play file failed\n");
604         }
605         else
606         {
607                 printf("play file success\n");
608         }
609         while(g_stop == 0)
610         {
611                 sleep(1);
612         }
613         printf("play stopped\n");
614         return 0;
615 }
616  * @endcode
617  */
618 int mm_sound_play_sound(const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data, int *handle);
619
620 /**
621  * This function is to play system sound. And other audio stream will be mute during playing time
622  *
623  * @param       filename                [in] Sound filename to play
624  * @param       volume config   [in] Volume type & volume gain
625  * @param       callback                [in] Callback function pointer when playing is terminated.
626  * @param       data                    [in] Pointer to user data when callback is called.
627  * @param       handle                  [out] Handle of sound play.
628  *
629  * @return      This function returns MM_ERROR_NONE on success, or negative value
630  *                      with error code.
631  * @remark      This function is almost same with mm_sound_play_sound,
632  *                      but this make other audio playback stream to mute during playing time.
633  * @see         mm_sound_stop_sound mm_sound_stop_callback_func volume_type_t volume_gain_t
634  * @pre         None.
635  * @post        Sound will be generated with given filename.
636  * @par Example
637  * @code
638 int g_stop=0;
639 void _stop_callback(void* data)
640 {
641         printf("Stop callback\n");
642         g_stop = 1;
643 }
644
645 int play_file()
646 {
647         char filename[] ="testfile.wav";
648         volume_type_t volume = VOLUME_TYPE_SYSTEM;
649         int ret = 0;
650         int handle = -1;
651
652         ret = mm_sound_play_loud_solo_sound(filename, volume, _stop_callback, NULL, &handle);
653         if(ret < 0)
654         {
655                 printf("play file failed\n");
656         }
657         else
658         {
659                 printf("play file success\n");
660         }
661         while(g_stop == 0)
662         {
663                 sleep(1);
664         }
665         printf("play stopped\n");
666         return 0;
667 }
668  * @endcode
669  */
670 int mm_sound_play_loud_solo_sound(const char *filename, int volume_config, mm_sound_stop_callback_func callback, void *data, int *handle);
671
672 /**
673  * This function is to stop playing system sound.
674  *
675  * @param       handle  [in] Handle of mm_sound_play_sound
676  *
677  * @return      This function returns MM_ERROR_NONE on success, or negative value
678  *                      with error code.
679  *
680  * @remark      When system sound is terminated with this function call, it does not
681  *                      call stop callback which was set when start playing system sound.
682  * @see         mm_sound_play_sound
683  * @pre         An sound play handle should be valid.
684  * @post        Playing sound file will be stopped.
685  * @par Example
686  * @code
687 int g_stop=0;
688 void _stop_callback(void* data)
689 {
690         printf("Stop callback\n");
691         g_stop = 1;
692 }
693
694 int play_file_one_second()
695 {
696         char filename[] ="testfile.wav";
697         volume_type_t volume = VOLUME_TYPE_SYSTEM;
698         int ret = 0;
699         int handle = -1;
700
701         ret = mm_sound_play_sound(filename, volume, _stop_callback, NULL, &handle);
702         if(ret < 0)
703         {
704                 printf("play file failed\n");
705         }
706         else
707         {
708                 printf("play file success\n");
709         }
710
711         sleep(1); //wait 1 second
712
713         ret = mm_sound_stop_sound(handle);
714         if(ret < 0)
715         {
716                 printf("stop failed\n");
717         }
718         else
719         {
720                 printf("play stopped\n");
721         }
722         return 0;
723 }
724  * @endcode
725  */
726 int mm_sound_stop_sound(int handle);
727
728
729 /**
730  * Enumerations for TONE
731  */
732
733 typedef enum  {
734         MM_SOUND_TONE_DTMF_0 = 0,                       /**< Predefined DTMF 0 */
735         MM_SOUND_TONE_DTMF_1,                           /**< Predefined DTMF 1 */
736         MM_SOUND_TONE_DTMF_2,                           /**< Predefined DTMF 2 */
737         MM_SOUND_TONE_DTMF_3,                           /**< Predefined DTMF 3 */
738         MM_SOUND_TONE_DTMF_4,                           /**< Predefined DTMF 4 */
739         MM_SOUND_TONE_DTMF_5,                           /**< Predefined DTMF 5 */
740         MM_SOUND_TONE_DTMF_6,                           /**< Predefined DTMF 6 */
741         MM_SOUND_TONE_DTMF_7,                           /**< Predefined DTMF 7 */
742         MM_SOUND_TONE_DTMF_8,                           /**< Predefined DTMF 8 */
743         MM_SOUND_TONE_DTMF_9,                           /**< Predefined DTMF 9 */
744         MM_SOUND_TONE_DTMF_S,                           /**< Predefined DTMF Star - Asterisk (*) */
745         MM_SOUND_TONE_DTMF_P,                           /**< Predefined DTMF sharP (#) */
746         MM_SOUND_TONE_DTMF_A,                           /**< Predefined DTMF A (A) */
747         MM_SOUND_TONE_DTMF_B,                           /**< Predefined DTMF B (B) */
748         MM_SOUND_TONE_DTMF_C,                           /**< Predefined DTMF C (C) */
749         MM_SOUND_TONE_DTMF_D,                           /**< Predefined DTMF D (D) */
750
751         /**< Pre-defined TONE */
752         MM_SOUND_TONE_SUP_DIAL,                                 /**Call supervisory tone, Dial tone: CEPT: 425Hz, continuous */
753         MM_SOUND_TONE_ANSI_DIAL,                                /**Call supervisory tone, Dial tone: ANSI (IS-95): 350Hz+440Hz, continuous */
754         MM_SOUND_TONE_JAPAN_DIAL,                               /**Call supervisory tone, Dial tone: JAPAN: 400Hz, continuous*/
755         MM_SOUND_TONE_SUP_BUSY,                         /**Call supervisory tone, Busy: CEPT: 425Hz, 500ms ON, 500ms OFF... */
756         MM_SOUND_TONE_ANSI_BUSY,                                /**Call supervisory tone, Busy: ANSI (IS-95): 480Hz+620Hz, 500ms ON, 500ms OFF... */
757         MM_SOUND_TONE_JAPAN_BUSY,                               /**Call supervisory tone, Busy: JAPAN: 400Hz, 500ms ON, 500ms OFF...*/
758         MM_SOUND_TONE_SUP_CONGESTION,           /**Call supervisory tone, Congestion: CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF */
759         MM_SOUND_TONE_ANSI_CONGESTION,          /**Call supervisory tone, Congestion: ANSI (IS-95): 480Hz+620Hz, 250ms ON, 250ms OFF... */
760         MM_SOUND_TONE_SUP_RADIO_ACK,                    /**Call supervisory tone, Radio path acknowlegment : CEPT, ANSI: 425Hz, 200ms ON  */
761         MM_SOUND_TONE_JAPAN_RADIO_ACK,          /**Call supervisory tone, Radio path acknowlegment : JAPAN: 400Hz, 1s ON, 2s OFF...*/
762         MM_SOUND_TONE_SUP_RADIO_NOTAVAIL,               /**Call supervisory tone, Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts */
763         MM_SOUND_TONE_SUP_ERROR,                                /**Call supervisory tone, Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF... */
764         MM_SOUND_TONE_SUP_CALL_WAITING,         /**Call supervisory tone, Call Waiting: CEPT, JAPAN: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF...  */
765         MM_SOUND_TONE_ANSI_CALL_WAITING,                /**Call supervisory tone, Call Waiting: ANSI (IS-95): 440 Hz, 300 ms ON, 9.7 s OFF, (100 ms ON, 100 ms OFF, 100 ms ON, 9.7s OFF ...) */
766         MM_SOUND_TONE_SUP_RINGTONE,                     /**Call supervisory tone, Ring Tone: CEPT, JAPAN: 425Hz, 1s ON, 4s OFF... */
767         MM_SOUND_TONE_ANSI_RINGTONE,                    /**Call supervisory tone, Ring Tone: ANSI (IS-95): 440Hz + 480Hz, 2s ON, 4s OFF... */
768         MM_SOUND_TONE_PROP_BEEP,                                /**General beep: 400Hz+1200Hz, 35ms ON */
769         MM_SOUND_TONE_PROP_ACK,                                 /**Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts */
770         MM_SOUND_TONE_PROP_NACK,                                /**Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON */
771         MM_SOUND_TONE_PROP_PROMPT,                      /**Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON         */
772         MM_SOUND_TONE_PROP_BEEP2,                               /**Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON */
773         MM_SOUND_TONE_SUP_INTERCEPT,                                            /**Call supervisory tone (IS-95), intercept tone: alternating 440 Hz and 620 Hz tones, each on for 250 ms */
774         MM_SOUND_TONE_SUP_INTERCEPT_ABBREV,                             /**Call supervisory tone (IS-95), abbreviated intercept: intercept tone limited to 4 seconds */
775         MM_SOUND_TONE_SUP_CONGESTION_ABBREV,                            /**Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds */
776         MM_SOUND_TONE_SUP_CONFIRM,                                              /**Call supervisory tone (IS-95), confirm tone: a 350 Hz tone added to a 440 Hz tone repeated 3 times in a 100 ms on, 100 ms off cycle */
777         MM_SOUND_TONE_SUP_PIP,                                                  /**Call supervisory tone (IS-95), pip tone: four bursts of 480 Hz tone (0.1 s on, 0.1 s off). */
778         MM_SOUND_TONE_CDMA_DIAL_TONE_LITE,                              /**425Hz continuous */
779         MM_SOUND_TONE_CDMA_NETWORK_USA_RINGBACK,                /**CDMA USA Ringback: 440Hz+480Hz 2s ON, 4000 OFF ...*/
780         MM_SOUND_TONE_CDMA_INTERCEPT,                                   /**CDMA Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON ...*/
781         MM_SOUND_TONE_CDMA_ABBR_INTERCEPT,                              /**CDMA Abbr Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON */
782         MM_SOUND_TONE_CDMA_REORDER,                                             /**CDMA Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF... */
783         MM_SOUND_TONE_CDMA_ABBR_REORDER,                                /**CDMA Abbr Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF repeated for 8 times */
784         MM_SOUND_TONE_CDMA_NETWORK_BUSY,                                /**CDMA Network Busy tone: 480Hz+620Hz 500ms ON, 500ms OFF continuous */
785         MM_SOUND_TONE_CDMA_CONFIRM,                                             /**CDMA Confirm tone: 350Hz+440Hz 100ms ON, 100ms OFF repeated for 3 times */
786         MM_SOUND_TONE_CDMA_ANSWER,                                              /**CDMA answer tone: silent tone - defintion Frequency 0, 0ms ON, 0ms OFF */
787         MM_SOUND_TONE_CDMA_NETWORK_CALLWAITING,                         /**CDMA Network Callwaiting tone: 440Hz 300ms ON */
788         MM_SOUND_TONE_CDMA_PIP,                                                         /**CDMA PIP tone: 480Hz 100ms ON, 100ms OFF repeated for 4 times */
789         MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL,             /**ISDN Call Signal Normal tone: {2091Hz 32ms ON, 2556 64ms ON} 20 times, 2091 32ms ON, 2556 48ms ON, 4s OFF */
790         MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP,         /**ISDN Call Signal Intergroup tone: {2091Hz 32ms ON, 2556 64ms ON} 8 times, 2091Hz 32ms ON, 400ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 8times, 2091Hz 32ms ON, 4s OFF.*/
791         MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI,             /**ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 2091Hz 16ms ON, 200ms OFF */
792         MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT3,               /**SDN Call sign PAT3 tone: silent tone */
793         MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING,  /**ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON */
794         MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT5,               /**ISDN Pat5 tone: silent tone */
795         MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT6,               /**ISDN Pat6 tone: silent tone */
796         MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT7,               /**ISDN Pat7 tone: silent tone */
797         MM_SOUND_TONE_CDMA_HIGH_L,                                              /**TONE_CDMA_HIGH_L tone: {3700Hz 25ms, 4000Hz 25ms} 40 times 4000ms OFF, Repeat .... */
798         MM_SOUND_TONE_CDMA_MED_L,                                               /**TONE_CDMA_MED_L tone: {2600Hz 25ms, 2900Hz 25ms} 40 times 4000ms OFF, Repeat .... */
799         MM_SOUND_TONE_CDMA_LOW_L,                                               /**TONE_CDMA_LOW_L tone: {1300Hz 25ms, 1450Hz 25ms} 40 times, 4000ms OFF, Repeat .... */
800         MM_SOUND_TONE_CDMA_HIGH_SS,                                             /**CDMA HIGH SS tone: {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
801         MM_SOUND_TONE_CDMA_MED_SS,                                              /**CDMA MED SS tone: {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
802         MM_SOUND_TONE_CDMA_LOW_SS,                                              /**CDMA LOW SS tone: {1300z 25ms, 1450Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
803         MM_SOUND_TONE_CDMA_HIGH_SSL,                                            /**CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
804         MM_SOUND_TONE_CDMA_MED_SSL,                                             /**CDMA MED SSL tone: {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
805         MM_SOUND_TONE_CDMA_LOW_SSL,                                             /**CDMA LOW SSL tone: {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
806         MM_SOUND_TONE_CDMA_HIGH_SS_2,                                   /**CDMA HIGH SS2 tone: {3700Hz 25ms, 4000Hz 25ms} 20 times, 1000ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 3000ms OFF, repeat .... */
807         MM_SOUND_TONE_CDMA_MED_SS_2,                                            /**CDMA MED SS2 tone: {2600Hz 25ms, 2900Hz 25ms} 20 times, 1000ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 3000ms OFF, repeat .... */
808         MM_SOUND_TONE_CDMA_LOW_SS_2,                                            /**CDMA LOW SS2 tone: {1300Hz 25ms, 1450Hz 25ms} 20 times, 1000ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 3000ms OFF, repeat .... */
809         MM_SOUND_TONE_CDMA_HIGH_SLS,                                            /**CDMA HIGH SLS tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 3000ms OFF, REPEAT */
810         MM_SOUND_TONE_CDMA_MED_SLS,                                             /**CDMA MED SLS tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 3000ms OFF, REPEAT */
811         MM_SOUND_TONE_CDMA_LOW_SLS,                                             /**CDMA LOW SLS tone: {1300Hz 25ms, 1450Hz 25ms} 10 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 10 times, 3000ms OFF, REPEAT */
812         MM_SOUND_TONE_CDMA_HIGH_S_X4,                                   /**CDMA HIGH S X4 tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 2500ms OFF, REPEAT.... */
813         MM_SOUND_TONE_CDMA_MED_S_X4,                                            /**CDMA MED S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT.... */
814         MM_SOUND_TONE_CDMA_LOW_S_X4,                                            /**CDMA LOW S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT....*/
815         MM_SOUND_TONE_CDMA_HIGH_PBX_L,                                  /**CDMA HIGH PBX L: {3700Hz 25ms, 4000Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
816         MM_SOUND_TONE_CDMA_MED_PBX_L,                                   /**CDMA MED PBX L: {2600Hz 25ms, 2900Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
817         MM_SOUND_TONE_CDMA_LOW_PBX_L,                                   /**CDMA LOW PBX L: {1300Hz 25ms,1450Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
818         MM_SOUND_TONE_CDMA_HIGH_PBX_SS,                                         /**CDMA HIGH PBX SS tone: {3700Hz 25ms, 4000Hz 25ms} 8 times 200 ms OFF, {3700Hz 25ms 4000Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
819         MM_SOUND_TONE_CDMA_MED_PBX_SS,                                  /**CDMA MED PBX SS tone: {2600Hz 25ms, 2900Hz 25ms} 8 times 200 ms OFF, {2600Hz 25ms 2900Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
820         MM_SOUND_TONE_CDMA_LOW_PBX_SS,                                  /**CDMA LOW PBX SS tone: {1300Hz 25ms, 1450Hz 25ms} 8 times 200 ms OFF, {1300Hz 25ms 1450Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
821         MM_SOUND_TONE_CDMA_HIGH_PBX_SSL,                                        /**CDMA HIGH PBX SSL tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
822         MM_SOUND_TONE_CDMA_MED_PBX_SSL,                                         /**CDMA MED PBX SSL tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
823         MM_SOUND_TONE_CDMA_LOW_PBX_SSL,                                         /**CDMA LOW PBX SSL tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
824         MM_SOUND_TONE_CDMA_HIGH_PBX_SLS,                                        /**CDMA HIGH PBX SLS tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 1000ms OFF, REPEAT....  */
825         MM_SOUND_TONE_CDMA_MED_PBX_SLS,                                         /**CDMA MED PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
826         MM_SOUND_TONE_CDMA_LOW_PBX_SLS,                                         /**CDMA LOW PBX SLS tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
827         MM_SOUND_TONE_CDMA_HIGH_PBX_S_X4,                               /**CDMA HIGH PBX X S4 tone: {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 800ms OFF, REPEAT... */
828         MM_SOUND_TONE_CDMA_MED_PBX_S_X4,                                        /**CDMA MED PBX X S4 tone: {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 800ms OFF, REPEAT... */
829         MM_SOUND_TONE_CDMA_LOW_PBX_S_X4,                                        /**CDMA LOW PBX X S4 tone: {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 800ms OFF, REPEAT... */
830         MM_SOUND_TONE_CDMA_ALERT_NETWORK_LITE,                  /**CDMA Alert Network Lite tone: 1109Hz 62ms ON, 784Hz 62ms ON, 740Hz 62ms ON 622Hz 62ms ON, 1109Hz 62ms ON */
831         MM_SOUND_TONE_CDMA_ALERT_AUTOREDIAL_LITE,               /**CDMA Alert Auto Redial tone: {1245Hz 62ms ON, 659Hz 62ms ON} 3 times, 1245 62ms ON */
832         MM_SOUND_TONE_CDMA_ONE_MIN_BEEP,                                        /**CDMA One Min Beep tone: 1150Hz+770Hz 400ms ON */
833         MM_SOUND_TONE_CDMA_KEYPAD_VOLUME_KEY_LITE,              /**CDMA KEYPAD Volume key lite tone: 941Hz+1477Hz 120ms ON */
834         MM_SOUND_TONE_CDMA_PRESSHOLDKEY_LITE,                   /**CDMA PRESSHOLDKEY LITE tone: 587Hz 375ms ON, 1175Hz 125ms ON */
835         MM_SOUND_TONE_CDMA_ALERT_INCALL_LITE,                           /**CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms*/
836         MM_SOUND_TONE_CDMA_EMERGENCY_RINGBACK,                  /**CDMA EMERGENCY RINGBACK tone: {941Hz 125ms ON, 10ms OFF} 3times 4990ms OFF, REPEAT... */
837         MM_SOUND_TONE_CDMA_ALERT_CALL_GUARD,                    /**CDMA ALERT CALL GUARD tone: {1319Hz 125ms ON, 125ms OFF} 3 times */
838         MM_SOUND_TONE_CDMA_SOFT_ERROR_LITE,                             /**CDMA SOFT ERROR LITE tone: 1047Hz 125ms ON, 370Hz 125ms */
839         MM_SOUND_TONE_CDMA_CALLDROP_LITE,                               /**CDMA CALLDROP LITE tone: 1480Hz 125ms, 1397Hz 125ms, 784Hz 125ms */
840         MM_SOUND_TONE_CDMA_NETWORK_BUSY_ONE_SHOT,               /**CDMA_NETWORK_BUSY_ONE_SHOT tone: 425Hz 500ms ON, 500ms OFF. */
841         MM_SOUND_TONE_CDMA_ABBR_ALERT,                                  /**CDMA_ABBR_ALERT tone: 1150Hz+770Hz 400ms ON */
842         MM_SOUND_TONE_CDMA_SIGNAL_OFF,                                  /**CDMA_SIGNAL_OFF - silent tone */
843         MM_SOUND_TONE_LOW_FRE,                                  /**100Hz continuous */
844         MM_SOUND_TONE_MED_FRE,                                  /**200Hz continuous */
845         MM_SOUND_TONE_HIGH_FRE,                                 /**300Hz continuous */
846         MM_SOUND_TONE_NUM,
847 }MMSoundTone_t;
848
849 typedef unsigned long sound_time_msec_t;                /**< millisecond unit */
850
851 /**
852  * This function is to play tone sound.
853  *
854  * @param       num                             [in] predefined tone type (MMSoundTone_t)
855  *                      volume config   [in] volume type & volume gain
856  *                      volume                  [in] volume ratio (0.0 ~1.0)
857  *                      duration                [in] millisecond (-1 for infinite)
858  *                      handle                  [in] Handle of mm_sound_play_tone
859  *                      enable_session  [in] set enable/unable session
860  *
861  * @return      This function returns MM_ERROR_NONE on success, or negative value
862  *                      with error code.
863  *
864  * @remark      It doesn't provide stop
865  * @see volume_type_t volume_gain_t MMSoundTone_t
866  * @pre         None.
867  * @post        TONE sound will be played.
868  * @par Example
869  * @code
870 int ret = 0;
871
872 ret = mm_sound_play_tone_ex(MM_SOUND_TONE_DTMF_9, VOLUME_TYPE_SYSTEM, 1.0, 1000, &handle, TRUE); //play 1 second with volume ratio 1.0
873 if(ret < 0)
874 {
875         printf("play tone failed\n");
876 }
877 else
878 {
879         printf("play tone success\n");
880 }
881  * @endcode
882  */
883 int mm_sound_play_tone_ex (MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle, bool enable_session);
884
885 /**
886  * This function is to play tone sound.
887  *
888  * @param       num                             [in] predefined tone type (MMSoundTone_t)
889  *                      volume config   [in] volume type & volume gain
890  *                      volume                  [in] volume ratio (0.0 ~1.0)
891  *                      duration                [in] millisecond (-1 for infinite)
892  *                      handle                  [in] Handle of mm_sound_play_tone
893  *
894  * @return      This function returns MM_ERROR_NONE on success, or negative value
895  *                      with error code.
896  *
897  * @remark      It doesn't provide stop
898  * @see volume_type_t volume_gain_t MMSoundTone_t
899  * @pre         None.
900  * @post        TONE sound will be played.
901  * @par Example
902  * @code
903 int ret = 0;
904
905 ret = mm_sound_play_tone(MM_SOUND_TONE_DTMF_9, VOLUME_TYPE_SYSTEM, 1.0, 1000, &handle); //play 1 second with volume ratio 1.0
906 if(ret < 0)
907 {
908         printf("play tone failed\n");
909 }
910 else
911 {
912         printf("play tone success\n");
913 }
914  * @endcode
915  */
916 int mm_sound_play_tone (MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle);
917
918 int mm_sound_play_tone_with_stream_info(MMSoundTone_t tone, char *stream_type, int stream_id, const double volume, const int duration, int *handle);
919
920 /*
921  * Enumerations of device & route
922  */
923
924 typedef enum{
925         MM_SOUND_DIRECTION_NONE,
926         MM_SOUND_DIRECTION_IN,                                                  /**< Capture */
927         MM_SOUND_DIRECTION_OUT,                                                 /**< Playback */
928 } mm_sound_direction;
929
930 typedef enum{
931         MM_SOUND_DEVICE_IN_NONE                         = 0x00,
932         MM_SOUND_DEVICE_IN_MIC                          = 0x01,         /**< Device builtin mic. */
933         MM_SOUND_DEVICE_IN_WIRED_ACCESSORY      = 0x02,         /**< Wired input devices */
934         MM_SOUND_DEVICE_IN_BT_SCO       = 0x08,         /**< Bluetooth SCO device */
935 } mm_sound_device_in;
936
937 typedef enum{
938         MM_SOUND_DEVICE_OUT_NONE                        = 0x000,
939         MM_SOUND_DEVICE_OUT_SPEAKER             = 0x001<<8,     /**< Device builtin speaker */
940         MM_SOUND_DEVICE_OUT_RECEIVER            = 0x002<<8,     /**< Device builtin receiver */
941         MM_SOUND_DEVICE_OUT_WIRED_ACCESSORY     = 0x004<<8,     /**< Wired output devices such as headphone, headset, and so on. */
942         MM_SOUND_DEVICE_OUT_BT_SCO                      = 0x008<<8,     /**< Bluetooth SCO device */
943         MM_SOUND_DEVICE_OUT_BT_A2DP             = 0x010<<8,     /**< Bluetooth A2DP device */
944         MM_SOUND_DEVICE_OUT_DOCK                        = 0x020<<8,     /**< DOCK device */
945         MM_SOUND_DEVICE_OUT_HDMI                        = 0x040<<8,     /**< HDMI device */
946         MM_SOUND_DEVICE_OUT_MIRRORING           = 0x080<<8, /**< MIRRORING device */
947         MM_SOUND_DEVICE_OUT_USB_AUDIO           = 0x100<<8,     /**< USB Audio device */
948         MM_SOUND_DEVICE_OUT_MULTIMEDIA_DOCK     = 0x200<<8,     /**< Multimedia DOCK device */
949 } mm_sound_device_out;
950
951 typedef enum {
952         MM_SOUND_VOLUME_DEVICE_OUT_SPEAKER,                             /**< Device builtin speaker */
953         MM_SOUND_VOLUME_DEVICE_OUT_RECEIVER,                    /**< Device builtin receiver */
954         MM_SOUND_VOLUME_DEVICE_OUT_WIRED_ACCESSORY,             /**< Wired output devices such as headphone, headset, and so on. */
955         MM_SOUND_VOLUME_DEVICE_OUT_BT_SCO,                              /**< Bluetooth SCO device */
956         MM_SOUND_VOLUME_DEVICE_OUT_BT_A2DP,                             /**< Bluetooth A2DP device */
957         MM_SOUND_VOLUME_DEVICE_OUT_DOCK,                                /**< DOCK device */
958         MM_SOUND_VOLUME_DEVICE_OUT_HDMI,                                /**< HDMI device */
959         MM_SOUND_VOLUME_DEVICE_OUT_MIRRORING,                   /**< MIRRORING device */
960         MM_SOUND_VOLUME_DEVICE_OUT_USB_AUDIO,                   /**< USB Audio device */
961         MM_SOUND_VOLUME_DEVICE_OUT_MULTIMEDIA_DOCK,             /**< Multimedia DOCK device */
962 } mm_sound_volume_device_out_t;
963
964 #define MM_SOUND_ROUTE_NUM 16
965 #define MM_SOUND_NAME_NUM 32
966
967 /*
968  * MMSound Device APIs
969  */
970
971 typedef enum {
972         MM_SOUND_DEVICE_IO_DIRECTION_IN_FLAG      = 0x0001,  /**< Flag for input devices */
973         MM_SOUND_DEVICE_IO_DIRECTION_OUT_FLAG     = 0x0002,  /**< Flag for output devices */
974         MM_SOUND_DEVICE_IO_DIRECTION_BOTH_FLAG    = 0x0004,  /**< Flag for input/output devices (both directions are available) */
975         MM_SOUND_DEVICE_TYPE_INTERNAL_FLAG        = 0x0010,  /**< Flag for built-in devices */
976         MM_SOUND_DEVICE_TYPE_EXTERNAL_FLAG        = 0x0020,  /**< Flag for external devices */
977         MM_SOUND_DEVICE_STATE_DEACTIVATED_FLAG    = 0x1000,  /**< Flag for deactivated devices */
978         MM_SOUND_DEVICE_STATE_ACTIVATED_FLAG      = 0x2000,  /**< Flag for activated devices */
979         MM_SOUND_DEVICE_ALL_FLAG                  = 0xFFFF,  /**< Flag for all devices */
980 } mm_sound_device_flags_e;
981
982 typedef enum {
983         MM_SOUND_DEVICE_IO_DIRECTION_IN           = 0x1,
984         MM_SOUND_DEVICE_IO_DIRECTION_OUT          = 0x2,
985         MM_SOUND_DEVICE_IO_DIRECTION_BOTH         = MM_SOUND_DEVICE_IO_DIRECTION_IN | MM_SOUND_DEVICE_IO_DIRECTION_OUT,
986 } mm_sound_device_io_direction_e;
987
988 typedef enum {
989         MM_SOUND_DEVICE_STATE_DEACTIVATED,
990         MM_SOUND_DEVICE_STATE_ACTIVATED,
991 } mm_sound_device_state_e;
992
993 typedef enum
994 {
995         MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER,   /**< Built-in speaker. */
996         MM_SOUND_DEVICE_TYPE_BUILTIN_RECEIVER,  /**< Built-in receiver. */
997         MM_SOUND_DEVICE_TYPE_BUILTIN_MIC,       /**< Built-in mic. */
998         MM_SOUND_DEVICE_TYPE_AUDIOJACK,         /**< Audio jack such as headphone, headset, and so on. */
999         MM_SOUND_DEVICE_TYPE_BLUETOOTH,         /**< Bluetooth */
1000         MM_SOUND_DEVICE_TYPE_BLUETOOTH_A2DP = MM_SOUND_DEVICE_TYPE_BLUETOOTH,    /**< Bluetooth A2DP */
1001         MM_SOUND_DEVICE_TYPE_HDMI,              /**< HDMI. */
1002         MM_SOUND_DEVICE_TYPE_MIRRORING,         /**< MIRRORING. */
1003         MM_SOUND_DEVICE_TYPE_USB_AUDIO,         /**< USB Audio. */
1004         MM_SOUND_DEVICE_TYPE_BLUETOOTH_SCO,     /**< Bluetooth SCO */
1005 } mm_sound_device_type_e;
1006
1007 typedef void *MMSoundDevice_t;          /**< MMsound Device handle */
1008 typedef void *MMSoundDeviceList_t;      /**< MMsound Device list handle */
1009 typedef void (*mm_sound_device_connected_cb) (MMSoundDevice_t device_h, bool is_connected, void *user_data);
1010 typedef void (*mm_sound_device_info_changed_cb) (MMSoundDevice_t device_h, int changed_info_type, void *user_data);
1011 typedef void (*mm_sound_device_state_changed_cb) (MMSoundDevice_t device_h, mm_sound_device_state_e state, void *user_data);
1012
1013 int mm_sound_add_device_connected_callback(int flags, mm_sound_device_connected_cb func, void *user_data, unsigned int *id);
1014 int mm_sound_remove_device_connected_callback(unsigned int id);
1015 int mm_sound_add_device_information_changed_callback(int flags, mm_sound_device_info_changed_cb func, void *user_data, unsigned int *id);
1016 int mm_sound_remove_device_information_changed_callback(unsigned int id);
1017 int mm_sound_add_device_state_changed_callback(int flags, mm_sound_device_state_changed_cb func, void *user_data, unsigned int *id);
1018 int mm_sound_remove_device_state_changed_callback(unsigned int id);
1019
1020 int mm_sound_get_current_device_list(mm_sound_device_flags_e device_mask, MMSoundDeviceList_t *device_list);
1021 int mm_sound_get_device_list(int device_mask, MMSoundDeviceList_t *device_list);
1022 int mm_sound_get_device_by_id(int device_id, MMSoundDevice_t **device);
1023 int mm_sound_free_device_list(MMSoundDeviceList_t device_list);
1024 int mm_sound_free_device(MMSoundDevice_t *device);
1025 int mm_sound_get_next_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device);
1026 int mm_sound_get_prev_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device);
1027 int mm_sound_get_device_type(MMSoundDevice_t device_h, mm_sound_device_type_e *type);
1028 int mm_sound_get_device_io_direction(MMSoundDevice_t device_h, mm_sound_device_io_direction_e *io_direction);
1029 int mm_sound_get_device_id(MMSoundDevice_t device_h, int *id);
1030 int mm_sound_get_device_state(MMSoundDevice_t device_h, mm_sound_device_state_e *state);
1031 int mm_sound_get_device_name(MMSoundDevice_t device_h, char **name);
1032
1033 /**
1034  * Active device changed callback function type.
1035  *
1036  * @param       user_data               [in]    Argument passed when callback has called
1037  *
1038  * @return      No return value
1039  * @remark      None.
1040  * @see         mm_sound_add_active_device_changed_callback mm_sound_remove_active_device_changed_callback
1041  */
1042 typedef void (*mm_sound_active_device_changed_cb) (mm_sound_device_in device_in, mm_sound_device_out device_out, void *user_data);
1043
1044 typedef void (*mm_sound_test_cb) (int a, void *user_data);
1045 int mm_sound_test(int a, int b, int* get);
1046 int mm_sound_add_test_callback(mm_sound_test_cb func, void *user_data, unsigned int *id);
1047 int mm_sound_remove_test_callback(unsigned int sub_id);
1048
1049 void mm_sound_convert_volume_type_to_stream_type(int volume_type, char *stream_type);
1050
1051 typedef enum {
1052         MM_SOUND_SIGNAL_RELEASE_INTERNAL_FOCUS,
1053         MM_SOUND_SIGNAL_MAX,
1054 } mm_sound_signal_name_t;
1055
1056 typedef void (*mm_sound_signal_callback) (mm_sound_signal_name_t signal_type, int value, void *user_data);
1057 int mm_sound_subscribe_signal(mm_sound_signal_name_t signal_type, unsigned int *subscribe_id, mm_sound_signal_callback callback, void *user_data);
1058 int mm_sound_subscribe_signal_for_daemon(mm_sound_signal_name_t signal_type, int client_pid, unsigned int *subscribe_id, mm_sound_signal_callback callback, void *user_data);
1059 void mm_sound_unsubscribe_signal(unsigned int subscribe_id);
1060 int mm_sound_send_signal(mm_sound_signal_name_t signal_type, int value);
1061 int mm_sound_get_signal_value(mm_sound_signal_name_t signal_type, int *value);
1062 int mm_sound_is_stream_on_device(int stream_id, MMSoundDevice_t device_h, bool *is_on);
1063
1064 /**
1065         @}
1066  */
1067
1068 #ifdef __cplusplus
1069 }
1070 #endif
1071
1072 #endif  /* __MM_SOUND_H__ */
1073