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