* @brief Enumeration of error codes for wav player.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
-typedef enum
-{
- TONE_PLAYER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
- TONE_PLAYER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
- TONE_PLAYER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
- TONE_PLAYER_ERROR_NOT_SUPPORTED_TYPE = TIZEN_ERROR_TONE_PLAYER | 0x01 /**< Not supported (Since 3.0) */
+typedef enum {
+ TONE_PLAYER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ TONE_PLAYER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ TONE_PLAYER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */
+ TONE_PLAYER_ERROR_NOT_SUPPORTED_TYPE = TIZEN_ERROR_TONE_PLAYER | 0x01 /**< Not supported (Since 3.0) */
} tone_player_error_e;
/**
* @brief Enumeration of tone.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
-typedef enum
-{
+typedef enum {
TONE_TYPE_DEFAULT = 0, /**< The default tone */
TONE_TYPE_DTMF_0 = 0, /**< Predefined DTMF 0 */
- TONE_TYPE_DTMF_1, /**< Predefined DTMF 1 */
+ TONE_TYPE_DTMF_1, /**< Predefined DTMF 1 */
TONE_TYPE_DTMF_2, /**< Predefined DTMF 2 */
TONE_TYPE_DTMF_3, /**< Predefined DTMF 3 */
TONE_TYPE_DTMF_4, /**< Predefined DTMF 4 */
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*
* @remarks Sound can be mixed with other sounds if you don't control the sound session in sound-manager module since 3.0.\n
- * You can refer to @ref CAPI_MEDIA_SUOND_MANAGER_MODULE.
+ * You can refer to @ref CAPI_MEDIA_SUOND_MANAGER_MODULE.
*
* @param[in] tone The tone type to play
* @param[in] type The sound type
#include <dlog.h>
-static int __convert_tone_player_error_code(const char *func, int code){
+static int __convert_tone_player_error_code(const char *func, int code)
+{
int ret = TONE_PLAYER_ERROR_NONE;
char *errorstr = NULL;
- switch(code)
- {
- case MM_ERROR_NONE:
- ret = TONE_PLAYER_ERROR_NONE;
- errorstr = "ERROR_NONE";
- break;
- case TONE_PLAYER_ERROR_INVALID_PARAMETER:
- case MM_ERROR_INVALID_ARGUMENT:
- case MM_ERROR_SOUND_INVALID_POINTER:
- ret = TONE_PLAYER_ERROR_INVALID_PARAMETER;
- errorstr = "INVALID_PARAMETER";
- break;
- case MM_ERROR_SOUND_INTERNAL:
- ret = TONE_PLAYER_ERROR_INVALID_OPERATION;
- errorstr = "INVALID_OPERATION";
- break;
+ switch (code) {
+ case MM_ERROR_NONE:
+ ret = TONE_PLAYER_ERROR_NONE;
+ errorstr = "ERROR_NONE";
+ break;
+ case TONE_PLAYER_ERROR_INVALID_PARAMETER:
+ case MM_ERROR_INVALID_ARGUMENT:
+ case MM_ERROR_SOUND_INVALID_POINTER:
+ ret = TONE_PLAYER_ERROR_INVALID_PARAMETER;
+ errorstr = "INVALID_PARAMETER";
+ break;
+ case MM_ERROR_SOUND_INTERNAL:
+ ret = TONE_PLAYER_ERROR_INVALID_OPERATION;
+ errorstr = "INVALID_OPERATION";
+ break;
}
- LOGE( "[%s] %s(0x%08x) : core frameworks error code(0x%08x)",func, errorstr, ret, code);
+ LOGE("[%s] %s(0x%08x) : core frameworks error code(0x%08x)", func, errorstr, ret, code);
return ret;
}
-int tone_player_start(tone_type_e tone, sound_type_e type, int duration, int *id){
- int ret;
- int player;
- if( tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE )
- return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_INVALID_PARAMETER);
+int tone_player_start(tone_type_e tone, sound_type_e type, int duration, int *id)
+{
+ int ret;
+ int player;
+ if (tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE)
+ return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_INVALID_PARAMETER);
- ret = mm_sound_play_tone(tone, type , 1, duration, &player);
+ ret = mm_sound_play_tone(tone, type , 1, duration, &player);
- if( ret == 0 && id != NULL)
- *id = player;
- return __convert_tone_player_error_code(__func__, ret);
+ if (ret == 0 && id != NULL)
+ *id = player;
+ return __convert_tone_player_error_code(__func__, ret);
}
-int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h stream_info, int duration, int * id){
+int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h stream_info, int duration, int * id)
+{
int ret;
int player;
double vol = 1.0;
int stream_id;
bool result = false;
- if( tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE || stream_info == NULL)
+ if (tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE || stream_info == NULL)
return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_INVALID_PARAMETER);
ret = sound_manager_is_available_stream_information(stream_info, NATIVE_API_TONE_PLAYER, &result);
- if ( !result )
+ if (!result)
return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_NOT_SUPPORTED_TYPE);
ret = sound_manager_get_type_from_stream_information(stream_info, &stream_type);
- if( ret )
+ if (ret)
return __convert_tone_player_error_code(__func__, ret);
ret = sound_manager_get_index_from_stream_information(stream_info, &stream_id);
- if( ret )
+ if (ret)
return __convert_tone_player_error_code(__func__, ret);
ret = mm_sound_play_tone_with_stream_info(tone, stream_type, stream_id, vol, duration, &player);
- if( ret == 0 && id != NULL)
+ if (ret == 0 && id != NULL)
*id = player;
return __convert_tone_player_error_code(__func__, ret);
}
-int tone_player_stop(int id){
+int tone_player_stop(int id)
+{
return __convert_tone_player_error_code(__func__, mm_sound_stop_sound(id));
}