Tizen Native API
5.0
|
The Device API provides functions to query the information of sound devices.
#include <sound_manager.h>
The Sound Manager Device API allows you to:
The list of currently connected sound device can be obtained by calling sound_manager_get_device_list(). To get the handle of each sound device, call sound_manager_get_next_device() and sound_manager_get_prev_device().
Device information, such as "type", "IO direction", "ID", "name", can be obtained by calling corresponding APIs.
Functions | |
int | sound_manager_get_device_list (int device_mask, sound_device_list_h *device_list) |
Gets the list consisting of connected devices. | |
int | sound_manager_free_device_list (sound_device_list_h device_list) |
Frees device list and each item of list. | |
int | sound_manager_get_next_device (sound_device_list_h device_list, sound_device_h *device) |
Gets the next item of the device list. | |
int | sound_manager_get_prev_device (sound_device_list_h device_list, sound_device_h *device) |
Gets the previous item of the device list. | |
int | sound_manager_get_device_type (sound_device_h device, sound_device_type_e *type) |
Gets the type of the device. | |
int | sound_manager_get_device_io_direction (sound_device_h device, sound_device_io_direction_e *io_direction) |
Gets the io direction of the device. | |
int | sound_manager_get_device_id (sound_device_h device, int *id) |
Gets the id of the device. | |
int | sound_manager_get_device_name (sound_device_h device, char **name) |
Gets the name of the device. | |
int | sound_manager_is_device_running (sound_device_h device, bool *is_running) |
Checks if the device is running. | |
int | sound_manager_get_device_state (sound_device_h device, sound_device_state_e *state) TIZEN_DEPRECATED_API |
Gets the state of the device. | |
int | sound_manager_get_supported_sample_formats (sound_device_h device, sound_sample_format_e **formats, unsigned int *num_of_elems) |
Gets the device's supported sample formats. | |
int | sound_manager_set_sample_format (sound_device_h device, sound_sample_format_e format) |
Sets the device's sample format. | |
int | sound_manager_get_sample_format (sound_device_h device, sound_sample_format_e *format) |
Gets the device's sample format. | |
int | sound_manager_get_supported_sample_rates (sound_device_h device, sound_sample_rate_e **rates, unsigned int *num_of_elems) |
Gets the device's supported sample rates. | |
int | sound_manager_set_sample_rate (sound_device_h device, sound_sample_rate_e rate) |
Sets the device's sample rate. | |
int | sound_manager_get_sample_rate (sound_device_h device, sound_sample_rate_e *rate) |
Gets the device's sample rate. | |
int | sound_manager_set_avoid_resampling (sound_device_h device, bool enable) |
Sets the device's 'avoid resampling' property. | |
int | sound_manager_get_avoid_resampling (sound_device_h device, bool *enabled) |
Gets the device's 'avoid resampling' property. | |
int | sound_manager_set_media_stream_only (sound_device_h device, bool enable) |
Sets the restriction of stream type only for media. | |
int | sound_manager_get_media_stream_only (sound_device_h device, bool *enabled) |
Gets the restriction of stream type only for media. | |
int | sound_manager_add_device_connection_changed_cb (int device_mask, sound_device_connection_changed_cb callback, void *user_data, int *id) |
Adds a callback function to be invoked when the connection state of a sound device was changed. | |
int | sound_manager_remove_device_connection_changed_cb (int id) |
Removes a callback function invoked when the connection of a sound device was changed. | |
int | sound_manager_add_device_running_changed_cb (int device_mask, sound_device_running_changed_cb callback, void *user_data, int *id) |
Adds a callback function to be invoked when the state of a sound device was changed. | |
int | sound_manager_remove_device_running_changed_cb (int id) |
Removes a callback function invoked when the state of a sound device was changed. | |
int | sound_manager_add_device_state_changed_cb (int device_mask, sound_device_state_changed_cb callback, void *user_data, int *id) TIZEN_DEPRECATED_API |
Adds a callback function to be invoked when the state of a sound device was changed. | |
int | sound_manager_remove_device_state_changed_cb (int id) TIZEN_DEPRECATED_API |
Removes a callback function invoked when the state of a sound device was changed. | |
Typedefs | |
typedef void * | sound_device_h |
Sound device handle. | |
typedef void * | sound_device_list_h |
Sound device list handle. | |
typedef void(* | sound_device_connection_changed_cb )(sound_device_h device, bool is_connected, void *user_data) |
Called when the connection state of a sound device was changed. | |
typedef void(* | sound_device_running_changed_cb )(sound_device_h device, bool is_running, void *user_data) |
Called when the state of a sound device was changed. | |
typedef void(* | sound_device_state_changed_cb )(sound_device_h device, sound_device_state_e state, void *user_data) |
Called when the state of a sound device was changed. |
typedef void(* sound_device_connection_changed_cb)(sound_device_h device, bool is_connected, void *user_data) |
Called when the connection state of a sound device was changed.
[in] | device | The sound_device |
[in] | is_connected | The state of device connection: (true = connected, false = disconnected) |
[in] | user_data | The user data passed from the callback registration function |
typedef void* sound_device_h |
Sound device handle.
typedef void* sound_device_list_h |
Sound device list handle.
typedef void(* sound_device_running_changed_cb)(sound_device_h device, bool is_running, void *user_data) |
Called when the state of a sound device was changed.
[in] | device | The sound_device |
[in] | is_running | The state of the device: (true = running, false = not running) |
[in] | user_data | The user data passed from the callback registration function |
typedef void(* sound_device_state_changed_cb)(sound_device_h device, sound_device_state_e state, void *user_data) |
Called when the state of a sound device was changed.
[in] | device | The sound_device |
[in] | state | The state of the device |
[in] | user_data | The user data passed from the callback registration function |
enum sound_device_mask_e |
Enumeration for sound device mask.
enum sound_device_state_e |
enum sound_device_type_e |
Enumeration for sound device type.
enum sound_sample_rate_e |
Enumeration for sound sample rate.
int sound_manager_add_device_connection_changed_cb | ( | int | device_mask, |
sound_device_connection_changed_cb | callback, | ||
void * | user_data, | ||
int * | id | ||
) |
Adds a callback function to be invoked when the connection state of a sound device was changed.
[in] | device_mask | Devices for which changes should be tracked, values of sound_device_mask_e combined with bitwise 'or' |
[in] | callback | The device connection state changed callback function |
[in] | user_data | The user data to be passed to the callback function |
[out] | id | The callback id |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_add_device_running_changed_cb | ( | int | device_mask, |
sound_device_running_changed_cb | callback, | ||
void * | user_data, | ||
int * | id | ||
) |
Adds a callback function to be invoked when the state of a sound device was changed.
[in] | device_mask | Devices for which changes should be tracked, values of sound_device_mask_e combined with bitwise 'or' |
[in] | callback | The device state changed callback function |
[in] | user_data | The user data to be passed to the callback function |
[out] | id | The callback id |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_add_device_state_changed_cb | ( | int | device_mask, |
sound_device_state_changed_cb | callback, | ||
void * | user_data, | ||
int * | id | ||
) |
Adds a callback function to be invoked when the state of a sound device was changed.
[in] | device_mask | Devices for which changes should be tracked, values of sound_device_mask_e combined with bitwise 'or' |
[in] | callback | The device state changed callback function |
[in] | user_data | The user data to be passed to the callback function |
[out] | id | The callback id |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_free_device_list | ( | sound_device_list_h | device_list | ) |
Frees device list and each item of list.
[in] | device_list | The device list got with sound_manager_get_device_list(). |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
int sound_manager_get_avoid_resampling | ( | sound_device_h | device, |
bool * | enabled | ||
) |
Gets the device's 'avoid resampling' property.
[in] | device | The device item |
[in] | enabled | The value of 'avoid resampling' property: (true = enabled, false = disabled) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_get_device_id | ( | sound_device_h | device, |
int * | id | ||
) |
Gets the id of the device.
[in] | device | The device item |
[out] | id | The id of the device |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
int sound_manager_get_device_io_direction | ( | sound_device_h | device, |
sound_device_io_direction_e * | io_direction | ||
) |
Gets the io direction of the device.
[in] | device | The device item |
[out] | io_direction | The io direction of the device |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
int sound_manager_get_device_list | ( | int | device_mask, |
sound_device_list_h * | device_list | ||
) |
Gets the list consisting of connected devices.
[in] | device_mask | The mask values of sound_device_mask_e combined with bitwise 'or' |
[out] | device_list | The list of connected devices |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_NO_DATA | No data |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_get_device_name | ( | sound_device_h | device, |
char ** | name | ||
) |
Gets the name of the device.
[in] | device | The device item |
[out] | name | The name of the device |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_get_device_state | ( | sound_device_h | device, |
sound_device_state_e * | state | ||
) |
Gets the state of the device.
[in] | device | The device item |
[out] | state | The state of the device |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
int sound_manager_get_device_type | ( | sound_device_h | device, |
sound_device_type_e * | type | ||
) |
Gets the type of the device.
[in] | device | The device item |
[out] | type | The type of the device |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
int sound_manager_get_media_stream_only | ( | sound_device_h | device, |
bool * | enabled | ||
) |
Gets the restriction of stream type only for media.
[in] | device | The device item |
[out] | enabled | The value of 'media stream only' property: (true = enabled, false = disabled) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_get_next_device | ( | sound_device_list_h | device_list, |
sound_device_h * | device | ||
) |
Gets the next item of the device list.
[in] | device_list | The list of connected devices |
[out] | device | The device item |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_NO_DATA | No data |
int sound_manager_get_prev_device | ( | sound_device_list_h | device_list, |
sound_device_h * | device | ||
) |
Gets the previous item of the device list.
[in] | device_list | The list of connected devices |
[out] | device | The device item |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_NO_DATA | No data |
int sound_manager_get_sample_format | ( | sound_device_h | device, |
sound_sample_format_e * | format | ||
) |
Gets the device's sample format.
[in] | device | The device item |
[out] | format | The sample format |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_get_sample_rate | ( | sound_device_h | device, |
sound_sample_rate_e * | rate | ||
) |
Gets the device's sample rate.
[in] | device | The device item |
[out] | rate | The sample rate |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_get_supported_sample_formats | ( | sound_device_h | device, |
sound_sample_format_e ** | formats, | ||
unsigned int * | num_of_elems | ||
) |
Gets the device's supported sample formats.
[in] | device | The device item |
[out] | formats | The supported sample format list |
[out] | num_of_elems | The number of elements in the sample format list |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_get_supported_sample_rates | ( | sound_device_h | device, |
sound_sample_rate_e ** | rates, | ||
unsigned int * | num_of_elems | ||
) |
Gets the device's supported sample rates.
[in] | device | The device item |
[out] | rates | The supported sample rate list |
[out] | num_of_elems | The number of elements in the sample rate list |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_is_device_running | ( | sound_device_h | device, |
bool * | is_running | ||
) |
Checks if the device is running.
[in] | device | The device item |
[out] | is_running | Whether the device is running or not: (true = running, false = not running) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
int sound_manager_remove_device_connection_changed_cb | ( | int | id | ) |
Removes a callback function invoked when the connection of a sound device was changed.
[in] | id | The id of the callback to remove |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_remove_device_running_changed_cb | ( | int | id | ) |
Removes a callback function invoked when the state of a sound device was changed.
[in] | id | The id of the callback to remove |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_remove_device_state_changed_cb | ( | int | id | ) |
Removes a callback function invoked when the state of a sound device was changed.
[in] | id | The id of the callback to remove |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_set_avoid_resampling | ( | sound_device_h | device, |
bool | enable | ||
) |
Sets the device's 'avoid resampling' property.
[in] | device | The device item |
[in] | enable | The 'avoid resampling' property value to set: (true = enable, false = disable) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_set_media_stream_only | ( | sound_device_h | device, |
bool | enable | ||
) |
Sets the restriction of stream type only for media.
[in] | device | The device item |
[in] | enable | The 'media stream only' property value to set: (true = enable, false = disable) |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_set_sample_format | ( | sound_device_h | device, |
sound_sample_format_e | format | ||
) |
Sets the device's sample format.
[in] | device | The device item |
[in] | format | The sample format |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |
int sound_manager_set_sample_rate | ( | sound_device_h | device, |
sound_sample_rate_e | rate | ||
) |
Sets the device's sample rate.
[in] | device | The device item |
[in] | rate | The sample rate |
0
on success, otherwise a negative error value SOUND_MANAGER_ERROR_NONE | Success |
SOUND_MANAGER_ERROR_INVALID_PARAMETER | Invalid parameter |
SOUND_MANAGER_ERROR_INVALID_OPERATION | Invalid operation |
SOUND_MANAGER_ERROR_INTERNAL | Internal error inside the sound system |