4 * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 #include "tizen-audio-internal.h"
26 audio_return_t audio_init(void **audio_handle)
29 audio_return_t ret = AUDIO_RET_OK;
31 AUDIO_RETURN_VAL_IF_FAIL(audio_handle, AUDIO_ERR_PARAMETER);
33 if (!(ah = malloc(sizeof(audio_hal_t)))) {
34 AUDIO_LOG_ERROR("failed to malloc()");
35 return AUDIO_ERR_RESOURCE;
37 if ((ret = _audio_volume_init(ah))) {
38 AUDIO_LOG_ERROR("failed to _audio_volume_init(), ret(0x%x)", ret);
41 if ((ret = _audio_routing_init(ah))) {
42 AUDIO_LOG_ERROR("failed to _audio_routing_init(), ret(0x%x)", ret);
45 if ((ret = _audio_stream_init(ah))) {
46 AUDIO_LOG_ERROR("failed to _audio_stream_init(), ret(0x%x)", ret);
49 if ((ret = _audio_pcm_init(ah))) {
50 AUDIO_LOG_ERROR("failed to _audio_pcm_init(), ret(0x%x)", ret);
53 if ((ret = _audio_comm_init(ah))) {
54 AUDIO_LOG_ERROR("failed to _audio_comm_init(), ret(0x%x)", ret);
58 *audio_handle = (void *)ah;
68 audio_return_t audio_deinit(void *audio_handle)
70 audio_hal_t *ah = (audio_hal_t *)audio_handle;
72 AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
74 _audio_volume_deinit(ah);
75 _audio_routing_deinit(ah);
76 _audio_stream_deinit(ah);
77 _audio_pcm_deinit(ah);
78 _audio_comm_deinit(ah);