Add APIs for master volume for internal usage 36/51236/4 accepted/tizen/mobile/20151107.080037 accepted/tizen/tv/20151107.080201 accepted/tizen/wearable/20151107.080400 submit/tizen/20151106.082107
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 5 Nov 2015 13:57:45 +0000 (22:57 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 6 Nov 2015 07:12:27 +0000 (16:12 +0900)
 - sound_manager_get_max_master_volume()
 - sound_manager_get_master_volume()
 - sound_manager_set_master_volume()

[Version] Release 0.3.25
[profile] Common
[Issue Type] Add feature

Change-Id: I42413b78edc4001739a0b03abb39b94f4c674faa
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/sound_manager_internal.h
include/sound_manager_private.h
packaging/capi-media-sound-manager.spec
src/sound_manager.c
src/sound_manager_internal.c
src/sound_manager_private.c
test/sound_manager_test.c

index 7d5955ed6f0194a93dde52f47cc636f8a4a4b88c..3d581e618f7b8b65727b0d5f57f4de4bae68a65d 100644 (file)
@@ -67,6 +67,51 @@ typedef enum {
        SOUND_STREAM_TYPE_LOOPBACK,            /**< Sound stream type for loopback */
 } sound_stream_type_internal_e;
 
+/**
+ * @internal
+ * @brief Gets the maximum master volume level.
+ * @since_tizen 3.0
+ * @param[out] max_level       The maximum volume level
+ * @return @c 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_INTERNAL Internal error inside the sound system
+ * @see sound_manager_set_master_volume()
+ * @see sound_manager_get_master_volume()
+ */
+int sound_manager_get_max_master_volume(int *max_level);
+
+/**
+ * @internal
+ * @brief Sets the master volume level.
+ * @since_tizen 3.0
+ * @param[in]  level   The volume level to be set
+ * @return @c 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_INTERNAL Internal error inside the sound system
+ * @see sound_manager_get_max_master_volume()
+ * @see sound_manager_get_master_volume()
+ */
+int sound_manager_set_master_volume(int level);
+
+/**
+ * @internal
+ * @brief Gets the master volume level.
+ * @since_tizen 3.0
+ * @param[out] level   The current master volume level
+ * @return @c 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_INTERNAL Internal error inside the sound system
+ * @see sound_manager_get_max_master_volume()
+ * @see sound_manager_set_master_volume()
+ */
+int sound_manager_get_master_volume(int *level);
+
 /**
  * @internal
  * @brief Creates a handle for stream information.
index f17d48fa398773a899502bc6ae066cf992ef3c65..3e80bbd0ddca9a196e5020ba072a68cec64b1b81 100644 (file)
@@ -117,6 +117,9 @@ if (pthread_mutex_unlock(x_mutex)) { \
 #define SOUND_STREAM_DIRECTION_MAX 2
 #define SOUND_DEVICE_TYPE_LEN 64
 
+#define DIRECTION_OUT_STR         "out"
+#define SOUND_TYPE_MASTER_STR     "master"
+
 typedef enum _sound_stream_direction {
        SOUND_STREAM_DIRECTION_OUTPUT = 1,
        SOUND_STREAM_DIRECTION_INPUT
@@ -249,6 +252,10 @@ int _convert_sound_type_to_enum(const char *sound_type, sound_type_e *sound_type
 
 int _get_volume_max_level(const char *direction, const char *volume_type, unsigned int *max_level);
 
+int _get_volume_level(const char *direction, const char *volume_type, unsigned int *level);
+
+int _set_volume_level(const char *direction, const char *volume_type, unsigned int level);
+
 int _get_current_volume_type(const char *direction, char **volume_type);
 
 void _update_focus_status(unsigned int index, unsigned int acquired_focus_status);
index a7cf209135c9cef832deffa2f60fbf183d70260f..bd1e643a803b3f52b0eb0c67c11901085291bfc8 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.24
+Version:    0.3.25
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index cbe8b052cbd32da11f36e7f15bceeba9d9628b57..a57090502b3e973e7c2b805842fade99a96a5e45 100644 (file)
@@ -41,14 +41,13 @@ int sound_manager_get_max_volume(sound_type_e type, int *max)
        unsigned int max_level = 0;
        int ret = MM_ERROR_NONE;
 
-       if (max == NULL)
-               return _convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
-
+       SM_NULL_ARG_CHECK(max);
        if (type >= SOUND_TYPE_NUM || type < 0)
                return _convert_sound_manager_error_code(__func__, MM_ERROR_INVALID_ARGUMENT);
+
        ret = _convert_sound_type(type, &volume_type);
        if (ret == MM_ERROR_NONE) {
-               ret = _get_volume_max_level("out", volume_type, &max_level);
+               ret = _get_volume_max_level(DIRECTION_OUT_STR, volume_type, &max_level);
                if (ret == MM_ERROR_NONE)
                        *max = (int)max_level -1;       /* actual volume step can be max step - 1 */
        }
@@ -115,7 +114,7 @@ int sound_manager_get_current_sound_type(sound_type_e *type)
        if (ret == MM_ERROR_NONE) {
                if (mm_sound_vol_type == VOLUME_TYPE_UNKNOWN) {
                        /* get the volume type of the current playing stream */
-                       ret = _get_current_volume_type("out", &volume_type);
+                       ret = _get_current_volume_type(DIRECTION_OUT_STR, &volume_type);
                        if (ret == MM_ERROR_NONE)
                                ret = _convert_sound_type_to_enum((const char*)volume_type, type);
                } else {
index 7fc38409cfcdea4766ff58305035a4f27fb3fe55..a698bc404bb76ac04cde7a253de5a1c3d19a8195 100644 (file)
 #include <sound_manager_internal.h>
 #include <mm_sound.h>
 
+int sound_manager_get_max_master_volume(int *max_level)
+{
+       int ret = MM_ERROR_NONE;
+       unsigned int volume_level = 0;
+
+       LOGI(">> enter");
+
+       SM_NULL_ARG_CHECK(max_level);
+
+       ret = _get_volume_max_level(DIRECTION_OUT_STR, SOUND_TYPE_MASTER_STR, &volume_level);
+       if (ret == MM_ERROR_NONE)
+               *max_level = (int)volume_level;
+
+       return _convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_set_master_volume(int level)
+{
+       int ret = MM_ERROR_NONE;
+
+       LOGI(">> enter");
+
+       ret = _set_volume_level(DIRECTION_OUT_STR, SOUND_TYPE_MASTER_STR, (unsigned int)level);
+
+       return _convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_master_volume(int *level)
+{
+       int ret = MM_ERROR_NONE;
+       unsigned int volume_level = 0;
+
+       LOGI(">> enter");
+
+       SM_NULL_ARG_CHECK(level);
+
+       ret = _get_volume_level(DIRECTION_OUT_STR, SOUND_TYPE_MASTER_STR, &volume_level);
+       if (ret == MM_ERROR_NONE)
+               *level = (int)volume_level;
+
+       return _convert_sound_manager_error_code(__func__, ret);
+}
+
 int sound_manager_create_stream_information_internal(sound_stream_type_internal_e stream_type, sound_stream_focus_state_changed_cb callback, void *user_data, sound_stream_info_h *stream_info)
 {
        int ret = MM_ERROR_NONE;
@@ -60,8 +103,6 @@ int sound_manager_set_stream_routing_option(sound_stream_info_h stream_info, con
 
        ret = _set_route_option(stream_h->index, name, value);
 
-       LOGI("<< leave : ret(%p)", ret);
-
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
@@ -125,8 +166,6 @@ int sound_manager_create_virtual_stream(sound_stream_info_h stream_info, virtual
        if (ret == MM_ERROR_NONE)
                *virtual_stream = (virtual_sound_stream_h)vstream_h;
 
-       LOGI("<< leave : ret(%p)", ret);
-
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
@@ -139,8 +178,6 @@ int sound_manager_destroy_virtual_stream(virtual_sound_stream_h virtual_stream)
 
        ret = _destroy_virtual_stream(vstream_h);
 
-       LOGI("<< leave : ret(%p)", ret);
-
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
@@ -153,8 +190,6 @@ int sound_manager_start_virtual_stream(virtual_sound_stream_h virtual_stream)
 
        ret = _start_virtual_stream(vstream_h);
 
-       LOGI("<< leave : ret(%p)", ret);
-
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
@@ -167,7 +202,5 @@ int sound_manager_stop_virtual_stream(virtual_sound_stream_h virtual_stream)
 
        ret = _stop_virtual_stream(vstream_h);
 
-       LOGI("<< leave : ret(%p)", ret);
-
        return _convert_sound_manager_error_code(__func__, ret);
 }
index 6de41f8b15081055f7d7fe3406a64a541e9965d6..de3cf8f1caa16ddc5164fc2f73b356fcc4ce451a 100644 (file)
 #define PA_STREAM_MANAGER_INTERFACE                             "org.pulseaudio.StreamManager"
 #define PA_STREAM_MANAGER_METHOD_NAME_GET_STREAM_INFO           "GetStreamInfo"
 #define PA_STREAM_MANAGER_METHOD_NAME_SET_STREAM_ROUTE_DEVICES  "SetStreamRouteDevices"
-#define PA_STREAM_MANAGER_METHOD_NAME_SET_STREAM_ROUTE_OPTION  "SetStreamRouteOption"
+#define PA_STREAM_MANAGER_METHOD_NAME_SET_STREAM_ROUTE_OPTION   "SetStreamRouteOption"
 #define PA_STREAM_MANAGER_METHOD_NAME_GET_VOLUME_MAX_LEVEL      "GetVolumeMaxLevel"
+#define PA_STREAM_MANAGER_METHOD_NAME_GET_VOLUME_LEVEL          "GetVolumeLevel"
+#define PA_STREAM_MANAGER_METHOD_NAME_SET_VOLUME_LEVEL          "SetVolumeLevel"
 #define PA_STREAM_MANAGER_METHOD_NAME_GET_CURRENT_VOLUME_TYPE   "GetCurrentVolumeType"
 #define PA_STREAM_MANAGER_METHOD_NAME_UPDATE_FOCUS_STATUS       "UpdateFocusStatus"
 
@@ -819,6 +821,99 @@ int _get_volume_max_level(const char *direction, const char *volume_type, unsign
        return ret;
 }
 
+int _get_volume_level(const char *direction, const char *volume_type, unsigned int *level)
+{
+       int ret = MM_ERROR_NONE;
+
+       GVariant *result = NULL;
+       GDBusConnection *conn = NULL;
+       GError *err = NULL;
+
+       assert(direction);
+       assert(volume_type);
+       assert(level);
+
+       conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+       if (!conn && err) {
+               LOGE("g_bus_get_sync() error (%s)", err->message);
+               g_error_free(err);
+               return MM_ERROR_SOUND_INTERNAL;
+       }
+
+       result = g_dbus_connection_call_sync(conn,
+                                                       PA_BUS_NAME,
+                                                       PA_STREAM_MANAGER_OBJECT_PATH,
+                                                       PA_STREAM_MANAGER_INTERFACE,
+                                                       PA_STREAM_MANAGER_METHOD_NAME_GET_VOLUME_LEVEL,
+                                                       g_variant_new("(ss)", direction, volume_type),
+                                                       G_VARIANT_TYPE("(us)"),
+                                                       G_DBUS_CALL_FLAGS_NONE,
+                                                       2000,
+                                                       NULL,
+                                                       &err);
+       if (!result && err) {
+               LOGE("g_dbus_connection_call_sync() for GET_VOLUME_LEVEL error (%s)", err->message);
+               g_error_free(err);
+               ret = MM_ERROR_SOUND_INTERNAL;
+       } else {
+               const gchar *dbus_ret = NULL;
+               g_variant_get(result, "(u&s)", level, &dbus_ret);
+               LOGI("g_dbus_connection_call_sync() success, method return value is (%u, %s)", *level, dbus_ret);
+               if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret)))
+                       ret = MM_ERROR_SOUND_INTERNAL;
+
+               g_variant_unref(result);
+       }
+       g_object_unref(conn);
+       return ret;
+}
+
+int _set_volume_level(const char *direction, const char *volume_type, unsigned int level)
+{
+       int ret = MM_ERROR_NONE;
+
+       GVariant *result = NULL;
+       GDBusConnection *conn = NULL;
+       GError *err = NULL;
+
+       assert(direction);
+       assert(volume_type);
+
+       conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+       if (!conn && err) {
+               LOGE("g_bus_get_sync() error (%s)", err->message);
+               g_error_free(err);
+               return MM_ERROR_SOUND_INTERNAL;
+       }
+
+       result = g_dbus_connection_call_sync(conn,
+                                                       PA_BUS_NAME,
+                                                       PA_STREAM_MANAGER_OBJECT_PATH,
+                                                       PA_STREAM_MANAGER_INTERFACE,
+                                                       PA_STREAM_MANAGER_METHOD_NAME_SET_VOLUME_LEVEL,
+                                                       g_variant_new("(ssu)", direction, volume_type, level),
+                                                       G_VARIANT_TYPE("(s)"),
+                                                       G_DBUS_CALL_FLAGS_NONE,
+                                                       2000,
+                                                       NULL,
+                                                       &err);
+       if (!result && err) {
+               LOGE("g_dbus_connection_call_sync() for GET_VOLUME_LEVEL error (%s)", err->message);
+               g_error_free(err);
+               ret = MM_ERROR_SOUND_INTERNAL;
+       } else {
+               const gchar *dbus_ret = NULL;
+               g_variant_get(result, "(&s)", &dbus_ret);
+               LOGI("g_dbus_connection_call_sync() success, method return value is (%s)", dbus_ret);
+               if (strncmp("STREAM_MANAGER_RETURN_OK", dbus_ret, strlen(dbus_ret)))
+                       ret = MM_ERROR_SOUND_INTERNAL;
+
+               g_variant_unref(result);
+       }
+       g_object_unref(conn);
+       return ret;
+}
+
 int _get_current_volume_type(const char *direction, char **volume_type)
 {
        int ret = MM_ERROR_NONE;
index 6a58b742092ad9770ccbdbfa2112e9728db5c6b9..b5fa7d5946f5637810ab6a05699be8f015d6fe9c 100644 (file)
@@ -71,7 +71,10 @@ enum {
        CURRENT_STATUS_CREATE_VIRTUAL_STREAM,
        CURRENT_STATUS_START_VIRTUAL_STREAM,
        CURRENT_STATUS_STOP_VIRTUAL_STREAM,
-       CURRENT_STATUS_DESTROY_VIRTUAL_STREAM
+       CURRENT_STATUS_DESTROY_VIRTUAL_STREAM,
+       CURRENT_STATUS_GET_MAX_MASTER_VOLUME,
+       CURRENT_STATUS_SET_MASTER_VOLUME,
+       CURRENT_STATUS_GET_MASTER_VOLUME,
 };
 
 
@@ -85,7 +88,7 @@ virtual_sound_stream_h g_vstream_h = NULL;
 
 void focus_callback(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *additional_info, void *user_data)
 {
-       int ret = 0;
+       int ret = SOUND_MANAGER_ERROR_NONE;
        sound_stream_focus_state_e playback_focus_state;
        sound_stream_focus_state_e recording_focus_state;
        g_print("*** FOCUS callback is called, stream_info(%p) ***\n", stream_info);
@@ -215,6 +218,12 @@ void _interpret_main_menu(char *cmd)
                g_menu_state = CURRENT_STATUS_STOP_VIRTUAL_STREAM;
        else if (strncmp(cmd, "vdt", 3) == 0)
                g_menu_state = CURRENT_STATUS_DESTROY_VIRTUAL_STREAM;
+       if (strncmp(cmd, "mgx", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_MAX_MASTER_VOLUME;
+       else if (strncmp(cmd, "msv", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_MASTER_VOLUME;
+       else if (strncmp(cmd, "mgv", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_MASTER_VOLUME;
        else if (strncmp(cmd, "q", 3) == 0) {
                g_print("closing the test suite\n");
                quit_program();
@@ -228,16 +237,19 @@ void display_sub_basic()
        g_print("=========================================================================================\n");
        g_print("                          Sound Manager Test (press q to quit) \n");
        g_print("-----------------------------------------------------------------------------------------\n");
-       g_print("                                       VOLUME MODULE \n");
+       g_print("                                    VOLUME MODULE \n");
        g_print("-----------------------------------------------------------------------------------------\n");
-       g_print("gx. Get Max Volume \n");
-       g_print("sv. Set Volume \t");
-       g_print("gv. Get Volume \n");
+       g_print("gx. Get Max Volume \t");
+       g_print("gv. Get Volume \t");
+       g_print("sv. Set Volume \n");
        g_print("st. Set Current Sound Type \t");
        g_print("gt. Get Current Sound Type \t");
        g_print("ut. Unset Current Sound Type \n");
        g_print("vc. Set Volume Changed CB \t");
        g_print("uv. Unset Volume Changed CB \n");
+       g_print("mgx. *Get Max Master Volume \t");
+       g_print("mgv. *Get Master Volume \t");
+       g_print("msv. *Set Master Volume \n");
        g_print("-----------------------------------------------------------------------------------------\n");
        g_print("                                    SESSION MODULE \n");
        g_print("-----------------------------------------------------------------------------------------\n");
@@ -386,6 +398,12 @@ static void displaymenu()
                g_print("*** press enter to stop virtual stream\n");
        else if (g_menu_state == CURRENT_STATUS_DESTROY_VIRTUAL_STREAM)
                g_print("*** press enter to destroy virtual stream\n");
+       else if (g_menu_state == CURRENT_STATUS_GET_MAX_MASTER_VOLUME)
+               g_print("*** press enter to get max master volume level\n");
+       else if (g_menu_state == CURRENT_STATUS_SET_MASTER_VOLUME)
+               g_print("*** input master volume level\n");
+       else if (g_menu_state == CURRENT_STATUS_GET_MASTER_VOLUME)
+               g_print("*** press enter to get master volume level\n");
        else {
                g_print("*** unknown status.\n");
                quit_program();
@@ -536,10 +554,10 @@ static void interpret(char *cmd)
                _interpret_main_menu(cmd);
                break;
        case CURRENT_STATUS_GET_MAX_VOLUME: {
-               static sound_type_e type;
-               static int max;
+               sound_type_e type;
+               int max;
                if (convert_sound_type(&type, cmd) == 1) {
-                       if (sound_manager_get_max_volume(type, &max) != 0)
+                       if (sound_manager_get_max_volume(type, &max) != SOUND_MANAGER_ERROR_NONE)
                                g_print("failt to get max volume\n");
                        else
                                g_print("the max volume of this type(%d) is %d\n", type, max);
@@ -549,8 +567,8 @@ static void interpret(char *cmd)
        }
        case CURRENT_STATUS_SET_VOLUME: {
                static int cnt = 0;
-               static sound_type_e type;
-               static int volume;
+               sound_type_e type;
+               int volume;
                switch (cnt) {
                case 0:
                        if (convert_sound_type(&type, cmd) == 1)
@@ -560,7 +578,7 @@ static void interpret(char *cmd)
                        break;
                case 1:
                        volume = atoi(cmd);
-                       if (sound_manager_set_volume(type, volume) != 0)
+                       if (sound_manager_set_volume(type, volume) != SOUND_MANAGER_ERROR_NONE)
                                g_print("fail to set volume(%d) check sound type(%d)'s available volume level\n", volume, type);
                        else
                                g_print("set volume success : sound type(%d), volume(%d)\n", type, volume);
@@ -573,10 +591,10 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_GET_VOLUME: {
-               static sound_type_e type;
-               static int volume;
+               sound_type_e type;
+               int volume;
                if (convert_sound_type(&type, cmd) == 1) {
-                       if (sound_manager_get_volume(type, &volume) != 0)
+                       if (sound_manager_get_volume(type, &volume) != SOUND_MANAGER_ERROR_NONE)
                                g_print("fail to get volume\n");
                        else
                                g_print("current volume of this type(%d) is : %d\n", type, volume);
@@ -585,9 +603,9 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_SET_CURRENT_SOUND_TYPE: {
-               static sound_type_e type;
+               sound_type_e type;
                if (convert_sound_type(&type, cmd) == 1) {
-                       if (sound_manager_set_current_sound_type(type) != 0)
+                       if (sound_manager_set_current_sound_type(type) != SOUND_MANAGER_ERROR_NONE)
                                g_print("fail to set sound type(%d)\n", type);
                        else
                                g_print("success to set sound type(%d)\n", type);
@@ -596,8 +614,8 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_GET_CURRENT_SOUND_TYPE: {
-               static sound_type_e type;
-               if (sound_manager_get_current_sound_type(&type) != 0)
+               sound_type_e type;
+               if (sound_manager_get_current_sound_type(&type) != SOUND_MANAGER_ERROR_NONE)
                        g_print("fail to get current sound type\n");
                else
                        g_print("current sound type is (%d)\n", type);
@@ -605,7 +623,7 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_UNSET_CURRENT_SOUND_TYPE: {
-               if (sound_manager_unset_current_sound_type() != 0)
+               if (sound_manager_unset_current_sound_type() != SOUND_MANAGER_ERROR_NONE)
                        g_print("fail to unset current sound type\n");
                else
                        g_print("success to unset current sound type\n");
@@ -613,7 +631,7 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_SET_VOLUME_CHANGED_CB: {
-               if (sound_manager_set_volume_changed_cb(_set_volume_changed_cb, NULL) != 0)
+               if (sound_manager_set_volume_changed_cb(_set_volume_changed_cb, NULL) != SOUND_MANAGER_ERROR_NONE)
                        g_print("fail to set volume changed cb\n");
                else
                        g_print("success to set volume changed cb\n");
@@ -621,7 +639,7 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_UNSET_VOLUME_CHANGED_CB: {
-               if (sound_manager_unset_volume_changed_cb() != 0)
+               if (sound_manager_unset_volume_changed_cb() != SOUND_MANAGER_ERROR_NONE)
                        g_print("fail to unset volume changed cb\n");
                else
                        g_print("success to unset volume changed cb\n");
@@ -629,9 +647,9 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_SET_SESSION_TYPE: {
-               static sound_session_type_e type;
+               sound_session_type_e type;
                if (convert_session_type(&type, cmd) == 1) {
-                       if (sound_manager_set_session_type(type) != 0)
+                       if (sound_manager_set_session_type(type) != SOUND_MANAGER_ERROR_NONE)
                                g_print("fail to set session type\n");
                        else
                                g_print("success to set session type(%d)\n", type);
@@ -640,8 +658,8 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_GET_SESSION_TYPE: {
-               static sound_session_type_e type;
-               if (sound_manager_get_session_type(&type) != 0)
+               sound_session_type_e type;
+               if (sound_manager_get_session_type(&type) != SOUND_MANAGER_ERROR_NONE)
                        g_print("fail to get session type\n");
                else
                        g_print("current session type is : %d (0:MEDIA, 1:ALARM, 2:NOTIFICATION, 3:EMERGENCY, 4:VOIP, 5:CALL)\n", type);
@@ -649,11 +667,11 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_SET_MEDIA_SESSION_OPTION: {
-               static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
+               sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
                static sound_session_option_for_starting_e option_s;
                static sound_session_option_for_during_play_e option_d;
                static int cnt = 0;
-               if (sound_manager_set_session_type(type) != 0) {
+               if (sound_manager_set_session_type(type) != SOUND_MANAGER_ERROR_NONE) {
                        g_print("fail to set media session type\n");
                        reset_menu_state();
                } else {
@@ -670,7 +688,7 @@ static void interpret(char *cmd)
                                if (SOUND_SESSION_OPTION_INTERRUPTIBLE_DURING_PLAY > option_d || SOUND_SESSION_OPTION_UNINTERRUPTIBLE_DURING_PLAY < option_d)
                                        g_print("not supported option type\n");
                                else {
-                                       if (sound_manager_set_media_session_option(option_s, option_d) != 0)
+                                       if (sound_manager_set_media_session_option(option_s, option_d) != SOUND_MANAGER_ERROR_NONE)
                                                g_print("fail to set media session option\n");
                                        else
                                                g_print("success to set media session option\n");
@@ -685,13 +703,13 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_GET_MEDIA_SESSION_OPTION: {
-               static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
-               static sound_session_option_for_starting_e option_s;
-               static sound_session_option_for_during_play_e option_d;
-               if (sound_manager_set_session_type(type) != 0)
+               sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
+               sound_session_option_for_starting_e option_s;
+               sound_session_option_for_during_play_e option_d;
+               if (sound_manager_set_session_type(type) != SOUND_MANAGER_ERROR_NONE)
                        g_print("fail to set media session type\n");
                else {
-                       if (sound_manager_get_media_session_option(&option_s, &option_d) != 0)
+                       if (sound_manager_get_media_session_option(&option_s, &option_d) != SOUND_MANAGER_ERROR_NONE)
                                g_print("fail to get media session option\n");
                        else
                                g_print("current media session options are (%d) for starting, (%d) for ongoing\n", option_s, option_d);
@@ -700,16 +718,16 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_SET_MEDIA_SESSION_RESUMPTION_OPTION: {
-               static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
-               static sound_session_option_for_resumption_e option_r;
-               if (sound_manager_set_session_type(type) != 0)
+               sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
+               sound_session_option_for_resumption_e option_r;
+               if (sound_manager_set_session_type(type) != SOUND_MANAGER_ERROR_NONE)
                        g_print("fail to set media session type\n");
                else {
                        option_r = (sound_session_option_for_resumption_e)atoi(cmd);
                        if (SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM > option_r || SOUND_SESSION_OPTION_RESUMPTION_BY_SYSTEM_OR_MEDIA_PAUSED < option_r)
                                g_print("not supported option type\n");
                        else {
-                               if (sound_manager_set_media_session_resumption_option(option_r) != 0)
+                               if (sound_manager_set_media_session_resumption_option(option_r) != SOUND_MANAGER_ERROR_NONE)
                                        g_print("fail to set media session resumption option\n");
                                else
                                        g_print("succese to set media session resumption option\n");
@@ -719,12 +737,12 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_GET_MEDIA_SESSION_RESUMPTION_OPTION: {
-               static sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
-               static sound_session_option_for_resumption_e option_r;
-               if (sound_manager_set_session_type(type) != 0)
+               sound_session_type_e type = SOUND_SESSION_TYPE_MEDIA;
+               sound_session_option_for_resumption_e option_r;
+               if (sound_manager_set_session_type(type) != SOUND_MANAGER_ERROR_NONE)
                        g_print("fail to set media session type\n");
                else {
-                       if (sound_manager_get_media_session_resumption_option(&option_r) != 0)
+                       if (sound_manager_get_media_session_resumption_option(&option_r) != SOUND_MANAGER_ERROR_NONE)
                                g_print("fail to get media session resumption option\n");
                        else
                                g_print("current media session resumption option is : %d\n", option_r);
@@ -756,7 +774,7 @@ static void interpret(char *cmd)
                break;
        }
        case CURRENT_STATUS_SET_SESSION_INTERRUPTED_CB: {
-               if (sound_manager_set_session_interrupted_cb(_set_session_interrupted_cb, NULL) != 0)
+               if (sound_manager_set_session_interrupted_cb(_set_session_interrupted_cb, NULL) != SOUND_MANAGER_ERROR_NONE)
                        g_print("fail to set interrupted changed cb\n");
                else
                        g_print("success to set interrupted changed cb\n");
@@ -1320,6 +1338,37 @@ static void interpret(char *cmd)
                reset_menu_state();
                break;
        }
+       case CURRENT_STATUS_GET_MAX_MASTER_VOLUME: {
+               int max_level;
+               if (sound_manager_get_max_master_volume(&max_level) != SOUND_MANAGER_ERROR_NONE)
+                       g_print("failed to get max master volume\n");
+               else
+                       g_print("the max level of master volume is %d\n", max_level);
+
+               reset_menu_state();
+               break;
+       }
+       case CURRENT_STATUS_SET_MASTER_VOLUME: {
+               int level;
+               level = atoi(cmd);
+               if (sound_manager_set_master_volume(level) != SOUND_MANAGER_ERROR_NONE)
+                       g_print("failed to set master volume(%d)\n", level);
+               else
+                       g_print("set master volume success : level(%d)\n", level);
+
+               reset_menu_state();
+               break;
+       }
+       case CURRENT_STATUS_GET_MASTER_VOLUME: {
+               int level;
+               if (sound_manager_get_master_volume(&level) != SOUND_MANAGER_ERROR_NONE)
+                       g_print("failed to get master volume\n");
+               else
+                       g_print("current master volume is : %d\n", level);
+
+               reset_menu_state();
+               break;
+       }
        }
        g_timeout_add(100, timeout_menu_display, 0);
 }