/*
* 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.
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;
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