Skip master volume in set_volume_level 07/108207/1 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable accepted/tizen_3.0_common accepted/tizen_3.0_ivi accepted/tizen_3.0_mobile accepted/tizen_3.0_tv accepted/tizen_3.0_wearable tizen_3.0 tizen_3.0.m2 tizen_3.0_tv accepted/tizen/3.0.m2/mobile/20170104.100127 accepted/tizen/3.0.m2/tv/20170104.100336 accepted/tizen/3.0.m2/wearable/20170104.100939 accepted/tizen/3.0/common/20170103.173104 accepted/tizen/3.0/ivi/20170103.160214 accepted/tizen/3.0/mobile/20170103.160150 accepted/tizen/3.0/tv/20170103.160200 accepted/tizen/3.0/wearable/20170103.160207 submit/tizen_3.0.m2/20170104.093748 submit/tizen_3.0/20170103.121528
authorJeongho Mok <jho.mok@samsung.com>
Tue, 3 Jan 2017 09:46:07 +0000 (18:46 +0900)
committerJeongho Mok <jho.mok@samsung.com>
Tue, 3 Jan 2017 10:21:52 +0000 (19:21 +0900)
[Version] 0.1.8
[Profile] Common
[Issue Type] Code Enhancement

Change-Id: Id892f4393b9c8ac1b1d4f4c43b1ab66478f8cedd

packaging/audio-hal-emul.spec
tizen-audio-volume.c

index 498849c..9f3bf25 100644 (file)
@@ -1,6 +1,6 @@
 Name:       audio-hal-emul
 Summary:    TIZEN Audio HAL for Emulator
-Version:    0.1.7
+Version:    0.1.8
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 48b551a..e645f31 100644 (file)
@@ -35,6 +35,8 @@
 #define VOLUME_VALUE_MAX            (1.0f)
 #define GAIN_VALUE_MAX              (1.0f)
 
+uint32_t g_master_volume_level = 100;
+
 static const char *g_volume_vconf[AUDIO_VOLUME_TYPE_MAX] = {
     "file/private/sound/volume/system",         /* AUDIO_VOLUME_TYPE_SYSTEM */
     "file/private/sound/volume/notification",   /* AUDIO_VOLUME_TYPE_NOTIFICATION */
@@ -326,6 +328,11 @@ audio_return_t audio_get_volume_level(void *audio_handle, audio_volume_info_t *i
     AUDIO_RETURN_VAL_IF_FAIL(info, AUDIO_ERR_PARAMETER);
     AUDIO_RETURN_VAL_IF_FAIL(level, AUDIO_ERR_PARAMETER);
 
+    if (!strncmp(info->type, "master", strlen("master"))) {
+        *level = g_master_volume_level;
+        return AUDIO_RET_OK;
+    }
+
     *level = ah->volume.volume_level[__get_volume_idx_by_string_type(info->type)];
 
     AUDIO_LOG_INFO("get [%s] volume_level: %d, direction(%d)", info->type, *level, info->direction);
@@ -364,6 +371,10 @@ audio_return_t audio_set_volume_level(void *audio_handle, audio_volume_info_t *i
 
     AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
     AUDIO_RETURN_VAL_IF_FAIL(info, AUDIO_ERR_PARAMETER);
+    if (!strncmp(info->type, "master", strlen("master"))) {
+        g_master_volume_level = level;
+        return AUDIO_RET_OK;
+    }
     AUDIO_RETURN_VAL_IF_FAIL((ah->volume.volume_level_max[__get_volume_idx_by_string_type(info->type)] >= level), AUDIO_ERR_PARAMETER);
 
     /* Update volume level */