Card and device arguments are added to pcm open API
[platform/adaptation/hawkp/audio-hal-hawkp.git] / tizen-audio-impl.h
1 #ifndef footizenaudioimplfoo
2 #define footizenaudioimplfoo
3
4 /*
5  * audio-hal
6  *
7  * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23 /* PCM */
24 audio_return_t _pcm_open(const char *card, const char *device, uint32_t direction, void *sample_spec, uint32_t period_size, uint32_t periods, void **pcm_handle);
25 audio_return_t _pcm_start(void *pcm_handle);
26 audio_return_t _pcm_stop(void *pcm_handle);
27 audio_return_t _pcm_close(void *pcm_handle);
28 audio_return_t _pcm_avail(void *pcm_handle, uint32_t *avail);
29 audio_return_t _pcm_write(void *pcm_handle, const void *buffer, uint32_t frames);
30 audio_return_t _pcm_read(void *pcm_handle, void *buffer, uint32_t frames);
31 audio_return_t _pcm_get_fd(void *pcm_handle, int *fd);
32 audio_return_t _pcm_recover(void *pcm_handle, int revents);
33 audio_return_t _pcm_get_params(void *pcm_handle, uint32_t direction, void **sample_spec, uint32_t *period_size, uint32_t *periods);
34 audio_return_t _pcm_set_params(void *pcm_handle, uint32_t direction, void *sample_spec, uint32_t period_size, uint32_t periods);
35 audio_return_t _pcm_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min, uint8_t period_event);
36 audio_return_t _pcm_set_hw_params(snd_pcm_t *pcm, audio_pcm_sample_spec_t *sample_spec, uint8_t *use_mmap, snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *buffer_size);
37
38 /* Control */
39 #define AMIXER_SPK_OUT_GAIN "speaker out gain"
40 #define AMIXER_SPK_OUT_MUTE "speaker out mute"
41 #define AMIXER_PCM_GAIN "pcm main pulse gain"
42 #define AMIXER_AMP_MUTE "amp speaker out mute(soft)"
43 #define AMIXER_SPK_OUT_GAIN_DEFAULT 20
44 #define AMIXER_SPK_OUT_MUTE_DEFAULT 0
45 #define AMIXER_PCM_GAIN_DEFAULT 100
46 #define AMIXER_AMP_MUTE_DEFAULT 0
47
48 audio_return_t _control_init(audio_hal_t *ah);
49 audio_return_t _control_deinit(audio_hal_t *ah);
50 audio_return_t _mixer_control_set_param(audio_hal_t *ah, const char* ctl_name, snd_ctl_elem_value_t* value, int size);
51 audio_return_t _mixer_control_set_value(audio_hal_t *ah, const char* card, const char *ctl_name, int val);
52 audio_return_t _mixer_control_set_value_string(audio_hal_t *ah, const char* ctl_name, const char* value);
53 audio_return_t _mixer_control_get_value(audio_hal_t *ah, const char *card, const char *ctl_name, int *val);
54 audio_return_t _mixer_control_get_element(audio_hal_t *ah, const char *ctl_name, snd_hctl_elem_t **elem);
55
56 #endif