Fix for new automake and 64 bit compatibility.
[platform/core/multimedia/avsystem.git] / include / avsys-audio.h
1 /*
2  * avsystem
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jonghyuk Choi <jhchoi.choi@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef __AVSYS_AUDIO_H__
23 #define __AVSYS_AUDIO_H__
24
25 #include "avsys-types.h"
26 #include "avsys-error.h"
27
28 #ifdef __cplusplus
29         extern "C" {
30 #endif
31
32 /**
33         @addtogroup AVSYSTEM
34         @{
35
36         @par
37         This part describes the interface with audio input/output.
38  */
39
40 #define AVSYS_AUDIO_VOLUME_MAX_MULTIMEDIA       16
41 #define AVSYS_AUDIO_VOLUME_MAX_BASIC            8
42 #define AVSYS_AUDIO_VOLUME_MAX_SINGLE           1
43
44 #define AVSYS_AUDIO_VOLUME_CONFIG_TYPE(vol) (vol & 0x00FF)
45 #define AVSYS_AUDIO_VOLUME_CONFIG_GAIN(vol) (vol & 0xFF00)
46 #define AVSYS_AUDIO_VOLUME_GAIN_IDX(gain) ((gain >> 8) - 1)
47
48 #define AVSYS_CHANNEL_MIN       1
49 #define AVSYS_CHANNEL_MAX       6
50
51 /**
52  * Enumerations for audio mode
53  */
54 enum avsys_audio_mode_t {
55         AVSYS_AUDIO_MODE_OUTPUT,                                /**< Output mode of handle */
56         AVSYS_AUDIO_MODE_OUTPUT_CLOCK,                  /**< Output mode of gst audio only mode */
57         AVSYS_AUDIO_MODE_OUTPUT_VIDEO,                  /**< Output mode of gst video mode */
58         AVSYS_AUDIO_MODE_OUTPUT_LOW_LATENCY,    /**< Output mode for low latency play mode. typically for game */
59         AVSYS_AUDIO_MODE_INPUT,                                 /**< Input mode of handle */
60         AVSYS_AUDIO_MODE_INPUT_HIGH_LATENCY,    /**< Input mode for high latency capture mode. */
61         AVSYS_AUDIO_MODE_INPUT_LOW_LATENCY,             /**< Input mode for low latency capture mode. typically for VoIP */
62         AVSYS_AUDIO_MODE_CALL_OUT,                              /**< for voice call establish */
63         AVSYS_AUDIO_MODE_CALL_IN,                               /**< for voice call establish */
64         AVSYS_AUDIO_MODE_OUTPUT_AP_CALL,                /**< for VT call on thin modem */
65         AVSYS_AUDIO_MODE_INPUT_AP_CALL,                 /**< for VT call on thin modem */
66         AVSYS_AUDIO_MODE_NUM,                                   /**< Number of mode */
67 };
68
69 /**
70  * Enumerations for audio format
71  */
72 enum avsys_audio_format_t {
73         AVSYS_AUDIO_FORMAT_UNKNOWN      = -1,                                   /**< Invalid audio format */
74         AVSYS_AUDIO_FORMAT_8BIT,                                                        /**< Unsigned 8Bit */
75         AVSYS_AUDIO_FORMAT_16BIT,                                                       /**< Signed 16bit Little Endian */
76         AVSYS_AUDIO_FORMAT_MIN = AVSYS_AUDIO_FORMAT_8BIT,       /**< Minimum value 8-bit integer per sample */
77         AVSYS_AUDIO_FORMAT_MAX = AVSYS_AUDIO_FORMAT_16BIT,      /**< Maximum value 16-bit integer per sample */
78 };
79
80
81 /*
82  * Enums for volume types
83  */
84 enum avsys_audio_volume_type_t {
85         AVSYS_AUDIO_VOLUME_TYPE_SYSTEM,
86         AVSYS_AUDIO_VOLUME_TYPE_NOTIFICATION,
87         AVSYS_AUDIO_VOLUME_TYPE_ALARM,
88         AVSYS_AUDIO_VOLUME_TYPE_RINGTONE,
89         AVSYS_AUDIO_VOLUME_TYPE_MEDIA,
90         AVSYS_AUDIO_VOLUME_TYPE_CALL,
91         AVSYS_AUDIO_VOLUME_TYPE_VOIP,
92         AVSYS_AUDIO_VOLUME_TYPE_FIXED,
93         AVSYS_AUDIO_VOLUME_TYPE_EXT_SYSTEM_JAVA,
94         AVSYS_AUDIO_VOLUME_TYPE_NUM,
95         AVSYS_AUDIO_VOLUME_TYPE_MAX = AVSYS_AUDIO_VOLUME_TYPE_NUM,
96         AVSYS_AUDIO_VOLUME_TYPE_EXT_SYSTEM_ANDROID = AVSYS_AUDIO_VOLUME_TYPE_FIXED,
97 };
98
99 enum avsys_audio_volume_gain_t {
100         AVSYS_AUDIO_VOLUME_GAIN_DIALER          = 1<<8,
101         AVSYS_AUDIO_VOLUME_GAIN_TOUCH           = 2<<8,
102         AVSYS_AUDIO_VOLUME_GAIN_AF                      = 3<<8,
103         AVSYS_AUDIO_VOLUME_GAIN_SHUTTER1        = 4<<8,
104         AVSYS_AUDIO_VOLUME_GAIN_SHUTTER2        = 5<<8,
105         AVSYS_AUDIO_VOLUME_GAIN_CAMCORDING      = 6<<8,
106         AVSYS_AUDIO_VOLUME_GAIN_MIDI            = 7<<8,
107         AVSYS_AUDIO_VOLUME_GAIN_BOOTING         = 8<<8,
108         AVSYS_AUDIO_VOLUME_GAIN_VIDEO           = 9<<8,
109         AVSYS_AUDIO_VOLUME_GAIN_VIDEO_HDMI      = 10<<8,
110         AVSYS_AUDIO_VOLUME_GAIN_TYPE_MAX,
111 };
112
113 enum avsys_audio_priority_t {
114         AVSYS_AUDIO_PRIORITY_0 = 0,     /*< deprecated. use AVSYS_AUDIO_PRIORITY_NORMAL or AVSYS_AUDIO_PRIORITY_SOLO instead */
115         AVSYS_AUDIO_PRIORITY_NORMAL = AVSYS_AUDIO_PRIORITY_0,
116         AVSYS_AUDIO_PRIORITY_SOLO,
117         AVSYS_AUDIO_PRIORITY_SOLO_WITH_TRANSITION_EFFECT,
118         AVSYS_AUDIO_PRIORITY_MAX,
119 };
120
121 enum avsys_audio_device_t {
122         AVSYS_AUDIO_DEVICE_TYPE_SPK = 0,
123         AVSYS_AUDIO_DEVICE_TYPE_RECV,
124         AVSYS_AUDIO_DEVICE_TYPE_HEADSET,
125         AVSYS_AUDIO_DEVICE_TYPE_HANDSFREE,
126         AVSYS_AUDIO_DEVICE_TYPE_BT,
127         AVSYS_AUDIO_DEVICE_TYPE_NUM,
128         AVSYS_AUDIO_DEVICE_TYPE_MAX = AVSYS_AUDIO_DEVICE_TYPE_NUM,
129 };
130
131 /**
132  * Enumerations for audio channel
133  */
134 enum avsys_audio_channel_t {
135         AVSYS_AUDIO_CHANNEL_LEFT,                       /**< front-left channel */
136         AVSYS_AUDIO_CHANNEL_RIGHT,                      /**< front-righth channel */
137         AVSYS_AUDIO_CHANNEL_NUM,                        /**< Number of channels */
138 };
139
140 /**
141  * Enumerations for audio mute condition
142  */
143 enum avsys_audio_mute_t {
144         AVSYS_AUDIO_UNMUTE = 0,                         /**< Unmute state */
145         AVSYS_AUDIO_MUTE,                                       /**< Mute state */
146         AVSYS_AUDIO_UNMUTE_NOLOCK,                      /** < Unmute without lock */
147         AVSYS_AUDIO_MUTE_NOLOCK,                        /** < Mute without lock */
148 };
149
150 /**
151  * Enumerations for priority command
152  */
153 enum avsys_audio_priority_cmd_t {
154         AVSYS_AUDIO_SET_PRIORITY = 0,           /**< Command set priority */
155         AVSYS_AUDIO_UNSET_PRIORITY,                     /**< Command unset priority */
156 };
157
158 /**
159  * Structure for sound device parameters.
160  */
161 typedef struct {
162         int             mode;                                           /**< Open mode (In/Out) */
163         int             priority;                                       /**< Priority of sound handle */
164         int             channels;                                       /**< Number of channels */
165         int             samplerate;                                     /**< Sampling rate */
166         int             format;                                         /**< Sampling format */
167         int             handle_route;                           /**< Handle route information. refer. avsys_audio_handle_route_t */
168         int             vol_type;                                       /**< volume type */
169         int             allow_mix;
170 } avsys_audio_param_t;
171
172
173 /**
174  * Structure for volume information.
175  */
176 typedef struct {
177         int     level[AVSYS_AUDIO_CHANNEL_NUM]; /**< Array of volume level for each channel */
178 } avsys_audio_volume_t;
179
180 /* NEW PATH DEFINE */
181  /**
182   *
183   */
184 enum avsys_audio_path_ex {
185         AVSYS_AUDIO_PATH_EX_NONE = 0,
186         AVSYS_AUDIO_PATH_EX_SPK,
187         AVSYS_AUDIO_PATH_EX_RECV,
188         AVSYS_AUDIO_PATH_EX_HEADSET,
189         AVSYS_AUDIO_PATH_EX_BTHEADSET,
190         AVSYS_AUDIO_PATH_EX_A2DP,
191         AVSYS_AUDIO_PATH_EX_HANDSFREE,
192         AVSYS_AUDIO_PATH_EX_HDMI,
193         AVSYS_AUDIO_PATH_EX_DOCK,
194         AVSYS_AUDIO_PATH_EX_USBAUDIO,
195         AVSYS_AUDIO_PATH_EX_OUTMAX,
196         AVSYS_AUDIO_PATH_EX_MIC = 1,
197         AVSYS_AUDIO_PATH_EX_HEADSETMIC,
198         AVSYS_AUDIO_PATH_EX_BTMIC,
199         AVSYS_AUDIO_PATH_EX_FMINPUT,
200         AVSYS_AUDIO_PATH_EX_HANDSFREEMIC,
201         AVSYS_AUDIO_PATH_EX_INMAX,
202 };
203
204 enum avsys_audio_gain_ex {
205         AVSYS_AUDIO_GAIN_EX_KEYTONE = 0,
206         AVSYS_AUDIO_GAIN_EX_RINGTONE,
207         AVSYS_AUDIO_GAIN_EX_ALARMTONE,
208         AVSYS_AUDIO_GAIN_EX_CALLTONE,
209         AVSYS_AUDIO_GAIN_EX_AUDIOPLAYER,
210         AVSYS_AUDIO_GAIN_EX_VIDEOPLAYER,
211         AVSYS_AUDIO_GAIN_EX_VOICECALL,
212         AVSYS_AUDIO_GAIN_EX_VIDEOCALL,
213         AVSYS_AUDIO_GAIN_EX_FMRADIO,
214         AVSYS_AUDIO_GAIN_EX_VOICEREC,
215         AVSYS_AUDIO_GAIN_EX_CAMCORDER,
216         AVSYS_AUDIO_GAIN_EX_CAMERA,
217         AVSYS_AUDIO_GAIN_EX_GAME,
218         AVSYS_AUDIO_GAIN_EX_MAX,
219         AVSYS_AUDIO_GAIN_EX_PDA_PLAYBACK = AVSYS_AUDIO_GAIN_EX_KEYTONE,
220 };
221
222 typedef enum {
223         AVSYS_AUDIO_EXT_DEVICE_FMRADIO = 0,
224         AVSYS_AUDIO_EXT_DEVICE_NUM
225 }avsysaudio_ext_device_t;
226
227
228 typedef enum {
229         AVSYS_AUDIO_ROUTE_POLICY_DEFAULT,
230         AVSYS_AUDIO_ROUTE_POLICY_IGNORE_A2DP,
231         AVSYS_AUDIO_ROUTE_POLICY_HANDSET_ONLY,
232         AVSYS_AUDIO_ROUTE_POLICY_MAX,
233 }avsys_audio_route_policy_t; /* system global configuration */
234
235 enum avsys_audio_handle_route_t{
236         AVSYS_AUDIO_HANDLE_ROUTE_FOLLOWING_POLICY,
237         AVSYS_AUDIO_HANDLE_ROUTE_HANDSET_ONLY,
238 }; /* custom routing per handle */
239
240 typedef enum {
241         AVSYS_AUDIO_ROUTE_DEVICE_UNKNOWN = -1,
242         AVSYS_AUDIO_ROUTE_DEVICE_HANDSET,
243         AVSYS_AUDIO_ROUTE_DEVICE_BLUETOOTH,
244         AVSYS_AUDIO_ROUTE_DEVICE_EARPHONE,
245         AVSYS_AUDIO_ROUTE_DEVICE_NUM,
246 }avsys_audio_playing_devcie_t;/* routing device */
247
248 /* path option */
249 #define AVSYS_AUDIO_PATH_OPTION_NONE                    0x00000000      /*!< Sound path option none */
250 #define AVSYS_AUDIO_PATH_OPTION_DUAL_OUT                0x00000002      /*!< SPK or Recv with headset sound path. used for Ringtone or Alarm */
251 #define AVSYS_AUDIO_PATH_OPTION_VOICECALL_REC   0x00000010      /*!< Voice call recording path option */
252 #define AVSYS_AUDIO_PATH_OPTION_USE_SUBMIC              0x00000020      /*!< Use sub-mic when call or recording */
253 #define AVSYS_AUDIO_PATH_OPTION_USE_STEREOMIC   0x00000040      /*!< Use stereo mic when recording */
254 #define AVSYS_AUDIO_PATH_OPTION_FORCED                  0x01000000      /*!< Forced sound path setting. only for booting animation */
255
256
257 /**
258  * This function make instance for audio system, and retreives handle.
259  *
260  * @param       param           [in]    Parameters of audio system.
261  * @param       phandle         [out]   Handle of audio system.
262  * @param       size            [out]   Recomended buffer size.
263  *
264  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
265  *                      value with error code.
266  *                      on failure.
267  * @remark
268  * @see
269  */
270 int avsys_audio_open(avsys_audio_param_t *param, avsys_handle_t *phandle, int *size);
271
272 /**
273  * This function is to close sound handle and release allocated resources.
274  *
275  * @param       handle          [in]    Handle of audio system
276  *
277  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
278  *                      value with error code.
279  * @remark
280  * @see
281  */
282 int avsys_audio_close(avsys_handle_t handle);
283
284 /**
285  * This function is to update volume type & volume gain.
286  *
287  * @param       handle          [in]    Handle of audio system
288  *
289  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
290  *                      value with error code.
291  * @remark
292  * @see
293  */
294 int avsys_audio_update_volume_config(avsys_handle_t handle, int volume_config);
295
296 /**
297  * This function is to stop playback stream immediately. this drops all buffer remaining data.
298  *
299  * @param       handle          [in]    Playback handle of audio system
300  *
301  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
302  *                      value with error code.
303  * @remark
304  * @see
305  */
306 int avsys_audio_flush(avsys_handle_t handle);
307
308 /**
309  * This function is to stop playback stream after all remaining buffer data played.
310  *
311  * @param       handle          [in]    Playback handle of audio system
312  *
313  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
314  *                      value with error code.
315  * @remark
316  * @see
317  */
318 int avsys_audio_drain(avsys_handle_t handle);
319
320 /**
321  * This function is turn on speaker amp.
322  *
323  *
324  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
325  *                      value with error code.
326  * @remark
327  * @see
328  */
329 int avsys_audio_ampon(void) __attribute__((deprecated));
330
331 /**
332  * This function is turn off speaker amp.
333  *
334  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
335  *                      value with error code.
336  * @remark
337  * @see
338  */
339 int avsys_audio_ampoff(void) __attribute__((deprecated));
340
341 /**
342  * This function is to read pcm data from sound handle.
343  *
344  * @param       handle          [in]    Handle of audio system
345  * @param       buf                     [in]    Buffer of audio data to read
346  * @param       size            [in]    Size of buffer
347  *
348  * @return      This function returns number of bytes read, or negative value with
349  *                      error code on failure.
350  * @remark
351  * @see
352  */
353 int avsys_audio_read(avsys_handle_t handle, void *buf, int size);
354
355 /**
356  * This function is to write audio data to sound handle.
357  *
358  * @param       handle          [in]    Handle of audio system
359  * @param       buf                     [in]    Buffer of audio data to write
360  * @param       size            [in]    Size of buffer
361  *
362  * @return      This function returns number of bytes written, or negative value
363  *                      with error code on failure.
364  * @remark
365  * @see
366  */
367 int avsys_audio_write(avsys_handle_t handle, void *buf, int size);
368
369 int avsys_audio_set_volume_table(int volume_type, int dev_type, int step, int lv, int rv);
370 int avsys_audio_get_volume_table(int volume_type, int dev_type, int step, int *lv, int *rv);
371 int avsys_audio_set_volume_gain_table(int volume_gain_idx, int dev_type, float lv, float rv);
372 int avsys_audio_get_volume_gain_table(int volume_gain_idx, int dev_type, float *lv, float *rv);
373
374 int avsys_audio_set_volume_fadeup(avsys_handle_t handle);
375
376 /**
377  * This function is to get volume max.
378  *
379  * @param       vol_type                [in]    Type of volume table
380  * @param       max                     [out]   number of volume steps
381  *
382  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
383  *                      value with error code.
384  * @remark
385  * @see
386  */
387 int avsys_audio_get_volume_max_ex(int volume_table, int *max_step);
388
389 /**
390  * This function is to set relative mute of sound handle.
391  *
392  * @param       handle          [in]    Handle of audio system
393  * @param       mute            [in]    Mute information to set
394  *
395  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
396  *                      value with error code.
397  * @remark
398  *  mute is AVSYS_AUDIO_MUTE : mute
399  *  mute is AVSYS_AUDIO_UNMUTE : unmute
400  * @see
401  */
402 int avsys_audio_set_mute(avsys_handle_t handle, int mute);
403
404
405 /**
406  * This function is to set mute of sound handle with fade out effect.
407  *
408  * @param       handle          [in]    Handle of audio system
409  *
410  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
411  *                      value with error code.
412  * @remark
413  * @see
414  */
415 int avsys_audio_set_mute_fadedown(avsys_handle_t handle);
416
417 /**
418  * This function is to get relative mute of sound handle.
419  *
420  * @param       handle          [in]    Handle of audio system
421  * @param       pmute           [out] Pointer to mute information to retrieve
422  *
423  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
424  *                      value with error code.
425  * @remark
426  *  pmute is AVSYS_AUDIO_MUTE : mute
427  *  pmute is AVSYS_AUDIO_UNMUTE : unmute
428  * @see avsys_audio_mute_t
429  */
430 int avsys_audio_get_mute(avsys_handle_t handle, int* pmute);
431
432
433 /**
434  * This function is to set amp on external device
435  *
436  * @param       device          [in]    External audio device type
437  *
438  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
439  *                      value with error code.
440  * @remark
441  *  mute is AVSYS_AUDIO_MUTE : mute
442  *  mute is AVSYS_AUDIO_UNMUTE : unmute
443  * @see avsysaudio_ext_device_t
444  */
445 int avsys_audio_ext_device_ampon(avsysaudio_ext_device_t device);
446
447 /**
448  * This function is to set amp off external device
449  *
450  * @param       device          [in]    External audio device type
451  *
452  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
453  *                      value with error code.
454  * @remark
455  *  pmute is AVSYS_AUDIO_MUTE : mute
456  *  pmute is AVSYS_AUDIO_UNMUTE : unmute
457  * @see avsysaudio_ext_device_t
458  */
459 int avsys_audio_ext_device_ampoff(avsysaudio_ext_device_t device);
460
461 /**
462  * This function is to set status of external device
463  *
464  * @param       device          [in]    External audio device type
465  * @param       onoff           [in]    1 for on , 0 for off
466  *
467  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
468  *                      value with error code.
469  * @remark
470  * @see avsysaudio_ext_device_t
471  */
472 int avsys_audio_set_ext_device_status(avsysaudio_ext_device_t device_type, int onoff);
473
474 /**
475  * This function is to get status of external device
476  *
477  * @param       device          [in]    External audio device type
478  * @param       onoff           [out]   1 for on , 0 for off
479  *
480  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
481  *                      value with error code.
482  * @remark
483  * @see avsys_audio_set_ext_device_status
484  */
485 int avsys_audio_get_ext_device_status(avsysaudio_ext_device_t device_type, int *onoff);
486 /**
487  * This function is to set sound path of sound device.
488  *
489  * @param       path            [in]    value of sound gain
490  * @param       output          [in]    value of output device
491  * @param       input           [in]    value of input device
492  * @param       option          [in]    value of sound path option
493  *
494  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
495  *                      value with error code.
496  *                      AVSYS_STATE_ERR_RANGE_OVER : input path value is invalid range
497  *                      AVSYS_STATE_ERR_INTERNAL   : internal device error
498  * @remark
499  * @see
500  */
501 int avsys_audio_set_path_ex(int gain, int out, int in, int option);
502
503 /**
504  * This function is to get sound path of sound device.
505  *
506  * @param       path            [out]   value of sound gain
507  * @param       output          [out]   value of output device
508  * @param       input           [out]   value of input device
509  * @param       option          [out]   value of sound path option
510  *
511  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
512  *                      value with error code.
513  *                      AVSYS_STATE_ERR_INTERNAL   : internal device error
514  * @remark
515  * @see
516  */
517 int avsys_audio_get_path_ex(int *gain, int *out, int *in, int *option);
518
519 /**
520  * This function is to set relative global mute of sound device.
521  *
522  * @param       mute            [in]    Global mute information to retreive
523  *
524  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
525  *                      value with error code.
526  * @remark
527  *  mute is avsys_audio_mute_disable : unmute
528  *  mute is avsys_audio_mute_enable  : mute
529  *  others     : ignore
530  * @see avsys_audio_mute_t
531  */
532 int avsys_audio_set_global_mute(int mute);
533
534 /**
535  * This function is to get relative global mute of sound device.
536  *
537  * @param       pmute           [out]   Pointer to global mute information to retreive
538  *
539  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
540  *                      value with error code.
541  * @remark
542  * *pbmute is avsys_audio_mute_disable or avsys_audio_mute_enable
543  * @see
544  */
545 int avsys_audio_get_global_mute(int* pmute);
546
547 /**
548  * This function is to get number of remaining audio frames in hw buffer.
549  *
550  * @param       handle          [in]    handle to get delay frames
551  * @param       frame_delay     [out]   value of number of remaining audio frames
552  *
553  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
554  *                      value with error code.
555  * @remark
556  * @see
557  */
558 int avsys_audio_delay(avsys_handle_t handle, int *frame_delay);
559
560 /**
561  * This function is to reset audio stream. (drops all remaining audio frames in  device buffer)
562  *
563  * @param       handle          [in]    handle to reset
564  *
565  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
566  *                      value with error code.
567  * @remark
568  * @see
569  */
570 int avsys_audio_reset(avsys_handle_t handle);
571
572 /**
573  * This function is to get period time and buffer time of audio stream.
574  *
575  * @param       handle          [in]    handle to get period & buffer time
576  * @param       period_time     [out]   value of period time in microsecond.
577  * @param       buffer_time     [out]   value of buffer time in microsecond.
578  *
579  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
580  *                      value with error code.
581  * @remark
582  * @see
583  */
584 int avsys_audio_get_period_buffer_time(avsys_handle_t handle, unsigned int *period_time, unsigned int *buffer_time);
585
586 /**
587  * This function is to cork stream.
588  *
589  * @param       handle          [in]    handle to cork
590  * @param       cork            [in]    cork=1, uncork=0
591  *
592  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
593  *                      value with error code.
594  * @remark
595  * @see
596  */
597 int avsys_audio_cork (avsys_handle_t handle, int cork);
598
599 /**
600  * This function is to check whether stream is corked or not.
601  *
602  * @param       handle          [in]    handle to cork
603  * @param       is_corked       [out]   corked is 1, otherwise 0
604  *
605  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
606  *                      value with error code.
607  * @remark
608  * @see
609  */
610 int avsys_audio_is_corked (avsys_handle_t handle, int *is_corked);
611
612 /**
613  * This function is to get audio capturing status of system.
614  *
615  * @param       on_capture      [out]   capture status.
616  *                                                              zero if there is no capture instance.
617  *                                                              positive value if there is capture instance
618  *
619  * @return      This function returns AVSYS_STATE_SUCCESS on success, or negative
620  *                      value with error code.
621  * @remark
622  * @see
623  */
624 int avsys_audio_get_capture_status(int *on_capture);
625
626 int avsys_audio_earjack_manager_init(int *earjack_type, int *waitfd);
627 int avsys_audio_earjack_manager_wait(int waitfd, int *current_earjack_type, int *new_earjack_type, int *need_mute);
628 int avsys_audio_earjack_manager_process(int new_earjack_type);
629 int avsys_audio_earjack_manager_deinit(int waitfd);
630 int avsys_audio_earjack_manager_get_type(void);
631 int avsys_audio_earjack_manager_unlock(void);
632
633 int avsys_audio_set_route_policy(avsys_audio_route_policy_t route);
634 int avsys_audio_get_route_policy(avsys_audio_route_policy_t *route);
635 int avsys_audio_get_current_playing_volume_type(int *volume_type);
636 int avsys_audio_set_volume_by_type(const int volume_type, const int volume_value);
637 int avsys_audio_set_primary_volume(const int pid, const int type);
638 int avsys_audio_clear_primary_volume(const int pid);
639 int avsys_audio_hibernation_reset(int *vol);
640 /**
641         @}
642  */
643
644 #ifdef __cplusplus
645         }
646 #endif
647
648 #endif /* __AVSYS_AUDIO_H__ */