} volume_key_type_e;
/**
- * @brief Enumerations of sound route policy
- */
-typedef enum {
- SOUND_ROUTE_DEFAULT, /**< Audio device priority: 1. bluetooth headset, 2. wired headset 3. built-in speaker and microphone. */
- SOUND_ROUTE_IGNORE_A2DP, /**< Audio device priority: 1. wired headset, 2. built-in speaker and microphone. */
- SOUND_ROUTE_HANDSET_ONLY /**< Use only built-in speaker and microphone */
-} sound_route_policy_e;
-
-/**
- * @brief Enumerations of sound device
- */
-typedef enum {
- SOUND_DEVICE_NONE, /**< Abnormal case */
- SOUND_DEVICE_HANDSET, /**< Speaker, Wired headset, Wired earpiece */
- SOUND_DEVICE_BLUETOOTH /**< Bluetooth */
-} sound_device_e;
-
-/**
* @brief error codes for sound manager
*/
typedef enum{
* @brief Enumerations of call session type
*/
typedef enum{
- SOUND_SESSION_TYPE_CALL = 0, /**< call type */
- SOUND_SESSION_TYPE_VOIP, /**< voip type */
+ SOUND_CALL_SESSION_TYPE_CALL = 0, /**< call type */
+ SOUND_CALL_SESSION_TYPE_VOIP = 1, /**< voip type */
+ SOUND_SESSION_TYPE_CALL = 0,
+ SOUND_SESSION_TYPE_VOIP = 1,
} sound_call_session_type_e;
/**
* @brief Enumerations of communication session type
*/
typedef enum{
- SOUND_CALL_SESSION_MODE_VOICE = 0, /**< normal voicecall mode */
+ SOUND_CALL_SESSION_MODE_VOICE = 0, /**< normal talking mode */
SOUND_CALL_SESSION_MODE_RINGTONE, /**< ringtone mode */
- SOUND_CALL_SESSION_MODE_MEDIA, /**< media on call mode */
+ SOUND_CALL_SESSION_MODE_MEDIA, /**< notification sound in call*/
} sound_call_session_mode_e;
/**
typedef void (*sound_manager_volume_changed_cb)(sound_type_e type, unsigned int volume, void *user_data);
/**
- * @brief Called when the sound route policy has changes.
- * @param[in] route The new sound route policy
- * @param[in] user_data The user data passed from the callback registration function
- * @pre sound_manager_set_route_policy() will invoke this callback if you register it using sound_manager_set_route_policy_changed_cb()
- * @see sound_manager_set_route_policy_changed_cb()
- * @see sound_manager_unset_route_policy_changed_cb()
- */
-typedef void (*sound_manager_route_policy_changed_cb)(sound_route_policy_e route, void *user_data);
-
-/**
* @brief Gets the maximum volume level supported for a particular sound type
* @param[in] type The sound type
* @param[out] max The maximum volume level
* @retval #SOUND_MANAGER_ERROR_NONE Success
* @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #SOUND_MANAGER_ERROR_NO_PLAYING_SOUND No playing sound
- * @see sound_manager_get_current_sound_device()
* @see player_set_sound_type()
* @see audio_out_create()
* @see wav_player_start()
int sound_manager_get_current_sound_type(sound_type_e *type);
/**
- * @brief Gets the current device type
- * @param[out] device The current sound device
- * @return 0 on success, otherwise a negative error value.
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SOUND_MANAGER_ERROR_NO_PLAYING_SOUND No playing sound
- * @see sound_manager_get_current_sound_type()
- */
-int sound_manager_get_current_sound_device(sound_device_e *device);
-
-/**
* @brief Registers a callback function to be invoked when the volume level is changed.
* @param[in] callback Callback function to indicate change in volume
* @param[in] user_data The user data to be passed to the callback function
* @}
*/
-__attribute__ ((deprecated)) int sound_manager_set_route_policy (sound_route_policy_e route);
-__attribute__ ((deprecated)) int sound_manager_get_route_policy (sound_route_policy_e *route);
-__attribute__ ((deprecated)) int sound_manager_set_route_policy_changed_cb(sound_manager_route_policy_changed_cb callback, void *user_data);
-__attribute__ ((deprecated)) void sound_manager_unset_route_policy_changed_cb(void);
-
-
#ifdef __cplusplus
}
#endif
}_changed_volume_info_s;
typedef struct {
- void *user_data;
- sound_manager_route_policy_changed_cb user_cb;
-}_changed_policy_info_s;
-
-typedef struct {
int is_registered;
void *user_data;
sound_session_notify_cb user_cb;
}_changed_active_device_info_s;
static _changed_volume_info_s g_volume_changed_cb_table;
-static _changed_policy_info_s g_policy_changed_cb_table;
static _session_notify_info_s g_session_notify_cb_table = {0, NULL, NULL, NULL, NULL};
static void __volume_changed_cb(void *user_data)
(g_volume_changed_cb_table.user_cb)(type, new_volume, g_volume_changed_cb_table.user_data);
}
-static void __policy_changed_cb(void *user_data, system_audio_route_t policy){
- if( g_policy_changed_cb_table.user_cb)
- g_policy_changed_cb_table.user_cb(policy, g_policy_changed_cb_table.user_data);
-}
-
static void __session_notify_cb(session_msg_t msg, session_event_t event, void *user_data){
if(g_session_notify_cb_table.user_cb){
g_session_notify_cb_table.user_cb(msg, g_session_notify_cb_table.user_data);
}
if( g_session_notify_cb_table.interrupted_cb ){
sound_interrupted_code_e e = SOUND_INTERRUPTED_COMPLETED;
- if( msg == MM_SESSION_MSG_STOP )
+ if( msg == MM_SESSION_MSG_RESUME )
e = SOUND_INTERRUPTED_COMPLETED;
else{
switch(event){
return __convert_sound_manager_error_code(__func__, ret);
}
-int sound_manager_set_route_policy (sound_route_policy_e route)
-{
- if( route < 0 || route > SOUND_ROUTE_HANDSET_ONLY)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
-
- int ret;
- ret = mm_sound_route_set_system_policy(route);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_route_policy (sound_route_policy_e *route)
-{
- if( route == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int ret;
- ret= mm_sound_route_get_system_policy((system_audio_route_t *)route);
-
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
int sound_manager_get_current_sound_type(sound_type_e *type)
{
if(type == NULL)
return __convert_sound_manager_error_code(__func__, ret);
}
-int sound_manager_get_current_sound_device(sound_device_e *device)
-{
- if( device == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- int ret;
- ret = mm_sound_route_get_playing_device((system_audio_route_device_t*)device);
- return __convert_sound_manager_error_code(__func__, ret);
-}
-
int sound_manager_set_volume_changed_cb(sound_manager_volume_changed_cb callback, void* user_data)
{
if(callback == NULL)
g_volume_changed_cb_table.user_data = NULL;
}
-int sound_manager_set_route_policy_changed_cb(sound_manager_route_policy_changed_cb callback, void* user_data)
-{
- if( callback == NULL)
- return __convert_sound_manager_error_code(__func__, SOUND_MANAGER_ERROR_INVALID_PARAMETER);
- g_policy_changed_cb_table.user_cb = callback;
- g_policy_changed_cb_table.user_data = user_data;
- mm_sound_route_add_change_callback(__policy_changed_cb, user_data);
- return 0;
-}
-
-void sound_manager_unset_route_policy_changed_cb(void)
-{
- mm_sound_route_remove_change_callback();
- g_policy_changed_cb_table.user_cb = NULL;
- g_policy_changed_cb_table.user_data = NULL;
-}
-
int sound_manager_get_a2dp_status(bool *connected , char** bt_name){
int ret = mm_sound_route_get_a2dp_status((int*)connected , bt_name);