tizen-audio-volume: Add support for compressed media volume 46/204046/1 accepted/tizen/unified/20190425.014623 submit/tizen/20190423.020435
authorSangchul Lee <sc11.lee@samsung.com>
Fri, 19 Apr 2019 01:41:35 +0000 (10:41 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 19 Apr 2019 01:49:25 +0000 (10:49 +0900)
[Version] 0.1.2
[Issue Type] Enhancement

Change-Id: Ie251fae847adcb28fea799ea8deeb93ea8e849ba
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/audio-hal-exynos9110.spec
tizen-audio-volume.c

index e9e1bca..38f3aff 100644 (file)
@@ -1,6 +1,6 @@
 Name:       audio-hal-exynos9110
 Summary:    TIZEN Audio HAL for Exynos9110(TW3)
-Version:    0.1.1
+Version:    0.1.2
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 449c28d..72d3abb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * audio-hal
  *
- * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2015 - 2019 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -414,6 +414,8 @@ audio_return_t audio_set_volume_mute(void *audio_handle, audio_volume_info_t *in
     return audio_ret;
 }
 
+#define COMPRESS_VOL_CTRL "ComprTx0 Volume"
+#define MAX_VOL_VALUE (8192/4)
 audio_return_t audio_set_volume_ratio(void *audio_handle, audio_stream_info_t *info, double ratio)
 {
     audio_return_t audio_ret = AUDIO_RET_OK;
@@ -424,5 +426,11 @@ audio_return_t audio_set_volume_ratio(void *audio_handle, audio_stream_info_t *i
 
     AUDIO_LOG_INFO("set [%s] volume_ratio: %f, direction(%u), index(%u)", info->role, ratio, info->direction, info->idx);
 
+    /* NOTE: volume ratio can be 0.0~1.0, corresponding mixer control range is
+     0~8192. As the value matching will be part of tunning issue in the future,
+     we just set the value to '8192/4' multiplied by 'ratio' which seems fine */
+    if (!strcmp(info->role, "compressed-media"))
+        _mixer_control_set_value (ah, COMPRESS_VOL_CTRL, (int)(ratio * MAX_VOL_VALUE));
+
     return audio_ret;
 }
\ No newline at end of file