update audio effect (change file name, API naming, ini parsing. add new preset type...
[platform/core/multimedia/libmm-player.git] / src / include / mm_player_audioeffect.h
1 /*
2  * libmm-player
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: JongHyuk Choi <jhchoi.choi@samsung.com>, YeJin Cho <cho.yejin@samsung.com>,
7  * Seungbae Shin <seungbae.shin@samsung.com>, YoungHwan An <younghwan_.an@samsung.com>
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 #ifndef __MM_PLAYER_AUDIOEFFECT_H__
24 #define __MM_PLAYER_AUDIOEFFECT_H__
25
26 #include <mm_types.h>
27
28 #ifdef __cplusplus
29         extern "C" {
30 #endif
31
32 #define MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX         10
33 #define MM_AUDIO_EFFECT_CUSTOM_LEVEL_INIT       0
34
35 /**
36         @addtogroup PLAYER_INTERNAL
37
38 */
39
40 /**
41  * Enumerations of Audio Effect Preset Type
42  */
43 typedef enum {
44         MM_AUDIO_EFFECT_PRESET_AUTO = 0,     /**<  Preset type Auto */
45         MM_AUDIO_EFFECT_PRESET_NORMAL,       /**<  Preset type Normal */
46         MM_AUDIO_EFFECT_PRESET_POP,          /**<  Preset type Pop */
47         MM_AUDIO_EFFECT_PRESET_ROCK,         /**<  Preset type Rock */
48         MM_AUDIO_EFFECT_PRESET_DANCE,        /**<  Preset type Dance */
49         MM_AUDIO_EFFECT_PRESET_JAZZ,         /**<  Preset type Jazz */
50         MM_AUDIO_EFFECT_PRESET_CLASSIC,      /**<  Preset type Classic */
51         MM_AUDIO_EFFECT_PRESET_VOCAL,        /**<  Preset type Vocal */
52         MM_AUDIO_EFFECT_PRESET_BASS_BOOST,   /**<  Preset type Bass Boost */
53         MM_AUDIO_EFFECT_PRESET_TREBLE_BOOST, /**<  Preset type Treble Boost */
54         MM_AUDIO_EFFECT_PRESET_MTHEATER,     /**<  Preset type MTheater */
55         MM_AUDIO_EFFECT_PRESET_EXT,          /**<  Preset type Externalization */
56         MM_AUDIO_EFFECT_PRESET_CAFE,         /**<  Preset type Cafe */
57         MM_AUDIO_EFFECT_PRESET_CONCERT_HALL, /**<  Preset type Concert Hall */
58         MM_AUDIO_EFFECT_PRESET_VOICE,        /**<  Preset type Voice */
59         MM_AUDIO_EFFECT_PRESET_MOVIE,        /**<  Preset type Movie */
60         MM_AUDIO_EFFECT_PRESET_VIRT51,       /**<  Preset type Virtual 5.1 */
61         MM_AUDIO_EFFECT_PRESET_HIPHOP,       /**<  Preset type HipHop */
62         MM_AUDIO_EFFECT_PRESET_RNB,          /**<  Preset type R&B */
63         MM_AUDIO_EFFECT_PRESET_FLAT,         /**<  Preset type Flat */
64         MM_AUDIO_EFFECT_PRESET_NUM,          /**<  Number of Preset type */
65 } MMAudioEffectPresetType;
66
67 /**
68  * Enumerations of Audio Effect Custom Type
69  */
70 typedef enum {
71         MM_AUDIO_EFFECT_CUSTOM_EQ = 0,       /**<  Custom type Equalizer */
72         MM_AUDIO_EFFECT_CUSTOM_3D,           /**<  Custom type 3D */
73         MM_AUDIO_EFFECT_CUSTOM_BASS,         /**<  Custom type Bass */
74         MM_AUDIO_EFFECT_CUSTOM_ROOM_SIZE,    /**<  Custom type Room Size */
75         MM_AUDIO_EFFECT_CUSTOM_REVERB_LEVEL, /**<  Custom type Reverb Level */
76         MM_AUDIO_EFFECT_CUSTOM_CLARITY,      /**<  Custom type Clarity */
77         MM_AUDIO_EFFECT_CUSTOM_NUM,          /**<  Number of Custom type */
78 } MMAudioEffectCustomType;
79
80 /**
81  * Enumerations of Audio Effect Type
82  */
83 typedef enum {
84         MM_AUDIO_EFFECT_TYPE_NONE,
85         MM_AUDIO_EFFECT_TYPE_PRESET,
86         MM_AUDIO_EFFECT_TYPE_CUSTOM,
87 } MMAudioEffectType;
88
89
90 /**
91  * Enumerations of Output Mode
92  */
93 typedef enum {
94         MM_AUDIO_EFFECT_OUTPUT_SPK,    /**< Speaker out */
95         MM_AUDIO_EFFECT_OUTPUT_EAR     /**< Earjack out */
96 } MMAudioEffectOutputMode;
97
98
99 /**
100  * Structure of AudioEffectInfo
101  */
102 typedef struct {
103         MMAudioEffectType effect_type;      /**< effect type, (NONE,PRESET,CUSTOM)*/
104         MMAudioEffectPresetType preset;     /**< for preset type*/
105         int *custom_ext_level_for_plugin;   /**< for custom type, level value list of Extension effects*/
106         int custom_eq_level[MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX];   /**< for custom type, EQ info*/
107         int custom_ext_level[MM_AUDIO_EFFECT_CUSTOM_NUM-1];     /**< for custom type, Extension effect info*/
108 } MMAudioEffectInfo;
109
110
111 /**
112  * @brief Called to get each supported audio effect.
113  *
114  * @param       effect_type     [in]    Type of effect (preset effect or custom effect).
115  * @param       effect          [in]    Supported audio effect.
116  * @param       user_data       [in]    Pointer of user data.
117  *
118  * @return      True to continue with the next iteration of the loop, False to break out of the loop.
119  * @see         mm_player_get_foreach_present_supported_effect_type()
120  */
121 typedef bool (*mmplayer_supported_audio_effect_cb) (int effect_type, int type, void *user_data);
122
123 /**
124  * This function is to get supported effect type.
125  *
126  * @param       hplayer         [in]    Handle of player.
127  * @param       effect_type     [in]    Type of effect.
128  * @param       foreach_cb      [in]    Callback function to be passed the result.
129  * @param       user_data       [in]    Pointer of user data.
130  *
131  * @return      This function returns zero on success, or negative value with error code.
132  *
133  * @remark
134  * @see
135  * @since
136  */
137 int mm_player_get_foreach_present_supported_effect_type(MMHandleType player, MMAudioEffectType effect_type, mmplayer_supported_audio_effect_cb foreach_cb, void *user_data);
138
139 /**
140  * This function is to bypass audio effect.
141  *
142  * @param       hplayer         [in]    Handle of player.
143  *
144  * @return      This function returns zero on success, or negative value with error code.
145  *
146  * @remark
147  * @see
148  * @since
149  */
150 int mm_player_audio_effect_bypass (MMHandleType hplayer);
151
152 /**
153  * This function is to apply preset effect.
154  *
155  * @param       hplayer         [in]    Handle of player.
156  * @param       type            [in]    Preset type effect.
157  *
158  * @return      This function returns zero on success, or negative value with error code.
159  *
160  * @remark
161  * @see         MMAudioEffectPresetType
162  * @since
163  */
164 int mm_player_audio_effect_preset_apply(MMHandleType hplayer, MMAudioEffectPresetType type);
165
166 /**
167  * This function is to apply custom effect(Equalizer and Extension effects).
168  *
169  * @param       hplayer         [in]    Handle of player.
170  *
171  * @return      This function returns zero on success, or negative value with error code.
172  *
173  * @remark
174  * @see
175  * @since
176  */
177 int mm_player_audio_effect_custom_apply(MMHandleType hplayer);
178
179 /**
180  * This function is to clear Equalizer custom effect.
181  *
182  * @param       hplayer         [in]    Handle of player.
183  *
184  * @return      This function returns zero on success, or negative value with error code.
185  *
186  * @remark
187  * @see
188  * @since
189  */
190 int mm_player_audio_effect_custom_clear_eq_all(MMHandleType hplayer);
191
192 /**
193  * This function is to clear Extension custom effects.
194  *
195  * @param       hplayer         [in]    Handle of player.
196  *
197  * @return      This function returns zero on success, or negative value with error code.
198  *
199  * @remark
200  * @see
201  * @since
202  */
203 int mm_player_audio_effect_custom_clear_ext_all(MMHandleType hplayer);
204
205 /**
206  * This function is to get the number of equalizer bands.
207  *
208  * @param       hplayer         [in]    Handle of player.
209  * @param       bands           [out]   The number of bands.
210  *
211  * @return      This function returns zero on success, or negative value with error code.
212  *
213  * @remark
214  * @see
215  * @since
216  */
217 int mm_player_audio_effect_custom_get_eq_bands_number(MMHandleType hplayer, int *bands);
218
219 /**
220  * This function is to get width of equalizer band of each index.
221  *
222  * @param       hplayer         [in]    Handle of player.
223  * @param       band_idx        [in]    Index of band.
224  * @param       width           [out]   Value of width.
225  *
226  * @return      This function returns zero on success, or negative value with error code.
227  *
228  * @remark
229  * @see
230  * @since
231  */
232 int mm_player_audio_effect_custom_get_eq_bands_width(MMHandleType hplayer, int band_idx, int *width);
233
234 /**
235  * This function is to get frequency of equalizer band of each index.
236  *
237  * @param       hplayer         [in]    Handle of player.
238  * @param       band_idx        [in]    Index of band.
239  * @param       freq            [out]   Value of frequency.
240  *
241  * @return      This function returns zero on success, or negative value with error code.
242  *
243  * @remark
244  * @see
245  * @since
246  */
247 int mm_player_audio_effect_custom_get_eq_bands_freq(MMHandleType hplayer, int band_idx, int *freq);
248
249 /**
250  * This function is to get the level of the custom effect.
251  *
252  * @param       hplayer         [in]    Handle of player.
253  * @param       type            [in]    Custom type effect.
254  * @param       eq_index        [in]    Equalizer band index. This parameter is available only when the type is MM_AUDIO_EFFECT_CUSTOM_EQ.
255  * @param       level           [out]   The level of the custom effect.
256  *
257  * @return      This function returns zero on success, or negative value with error code.
258  *
259  * @remark
260  * @see         MMAudioEffectCustomType
261  * @since
262  */
263 int mm_player_audio_effect_custom_get_level(MMHandleType hplayer, MMAudioEffectCustomType type, int eq_index, int *level);
264
265 /**
266  * This function is to get range of the level of the custom effect.
267  *
268  * @param       hplayer         [in]    Handle of player.
269  * @param       type            [in]    Custom type effect.
270  * @param       min             [out]   Minimal value of level.
271  * @param       max             [out]   Maximum value of level.
272  *
273  * @return      This function returns zero on success, or negative value with error code.
274  *
275  * @remark
276  * @see         MMAudioEffectCustomType
277  * @since
278  */
279 int mm_player_audio_effect_custom_get_level_range(MMHandleType hplayer, MMAudioEffectCustomType type, int *min, int *max);
280
281 /**
282  * This function is to set the level of the custom effect.
283  *
284  * @param       hplayer         [in]    Handle of player.
285  * @param       type            [in]    Custom type effect.
286  * @param       eq_index        [in]    Equalizer band index. This parameter is available only when the type is MM_AUDIO_EFFECT_CUSTOM_EQ.
287  * @param       level           [in]    The level of the custom effect.
288  *
289  * @return      This function returns zero on success, or negative value with error code.
290  *
291  * @remark
292  * @see         MMAudioEffectCustomType
293  * @since
294  */
295 int mm_player_audio_effect_custom_set_level(MMHandleType hplayer, MMAudioEffectCustomType effect_custom_type, int eq_index, int level);
296
297 /**
298  * This function is to set the bands level of equalizer custom effect using input list.
299  *
300  * @param       hplayer         [in]    Handle of player.
301  * @param       level_list      [in]    list of bands level of equalizer custom audio_effect want to set.
302  * @param       size            [in]    size of level_list.
303  *
304  * @return      This function returns zero on success, or negative value with error code.
305  *
306  * @remark
307  * @see
308  * @since
309  */
310 int mm_player_audio_effect_custom_set_level_eq_from_list(MMHandleType hplayer, int *level_list, int size);
311
312 /**
313  * This function is to decide if the preset type effect is supported or not
314  *
315  * @param       hplayer         [in]    Handle of player.
316  * @param       effect          [in]    Preset type effect.
317  *
318  * @return      This function returns zero on success, or negative value with error code.
319  *
320  * @remark
321  * @see
322  * @since
323  */
324 int mm_player_is_supported_preset_effect_type(MMHandleType hplayer, MMAudioEffectPresetType effect);
325
326 /**
327  * This function is to decide if the custom type effect is supported or not
328  *
329  * @param       hplayer         [in]    Handle of player.
330  * @param       effect          [in]    Custom type effect.
331  *
332  * @return      This function returns zero on success, or negative value with error code.
333  *
334  * @remark
335  * @see
336  * @since
337  */
338 int mm_player_is_supported_custom_effect_type(MMHandleType hplayer, MMAudioEffectCustomType effect);
339
340 /**
341         @}
342  */
343
344 #ifdef __cplusplus
345         }
346 #endif
347
348 #endif  /* __MM_PLAYER_AUDIOEFFECT_H__ */