Fix noise when unmuting radio volume
[platform/adaptation/spreadtrum/audio-hal-sc7727.git] / tizen-audio-stream.c
1 /*
2  * audio-hal
3  *
4  * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifdef HAVE_CONFIG_H
21 #include <config.h>
22 #endif
23
24 #include "tizen-audio-internal.h"
25
26 audio_return_t _audio_stream_init(audio_hal_t *ah)
27 {
28     AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
29
30     return AUDIO_RET_OK;
31 }
32
33 audio_return_t _audio_stream_deinit(audio_hal_t *ah)
34 {
35     AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
36
37     return AUDIO_RET_OK;
38 }
39
40 audio_return_t audio_notify_stream_connection_changed(void *audio_handle, audio_stream_info_t *info, uint32_t is_connected)
41 {
42     audio_return_t audio_ret = AUDIO_RET_OK;
43     audio_hal_t *ah = (audio_hal_t *)audio_handle;
44
45     AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
46     AUDIO_RETURN_VAL_IF_FAIL(info, AUDIO_ERR_PARAMETER);
47     AUDIO_RETURN_VAL_IF_FAIL(info->role, AUDIO_ERR_PARAMETER);
48     AUDIO_RETURN_VAL_IF_FAIL((info->direction <= AUDIO_DIRECTION_OUT), AUDIO_ERR_PARAMETER);
49
50     AUDIO_LOG_INFO("role:%s, direction:%u, idx:%u, is_connected:%d", info->role, info->direction, info->idx, is_connected);
51     if (streq(info->role, "radio")) {
52         if (is_connected)
53             ah->device.is_radio_on = 1;
54         else
55             ah->device.is_radio_on = 0;
56     }
57
58     return audio_ret;
59 }
60