increase version up
[framework/multimedia/libmm-player.git] / src / include / mm_player_sndeffect.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_SNDEFFECT_H__
24 #define __MM_PLAYER_SNDEFFECT_H__
25
26 #include <mm_types.h>
27
28 #ifdef __cplusplus
29         extern "C" {
30 #endif
31
32 #define MM_AUDIO_FILTER_EQ_BAND_MAX             8
33 #define MM_AUDIO_FILTER_CUSTOM_LEVEL_INIT       0
34
35 /**
36         @addtogroup PLAYER_INTERNAL
37
38 */
39
40 /**
41  * Enumerations of Preset Filter Type
42  */
43 typedef enum {
44         MM_AUDIO_FILTER_PRESET_AUTO = 0,        /**<  Filter Preset type Auto */
45         MM_AUDIO_FILTER_PRESET_NORMAL,          /**<  Filter Preset type Normal */
46         MM_AUDIO_FILTER_PRESET_POP,             /**<  Filter Preset type Pop */
47         MM_AUDIO_FILTER_PRESET_ROCK,            /**<  Filter Preset type Rock */
48         MM_AUDIO_FILTER_PRESET_DANCE,           /**<  Filter Preset type Dance */
49         MM_AUDIO_FILTER_PRESET_JAZZ,            /**<  Filter Preset type Jazz */
50         MM_AUDIO_FILTER_PRESET_CLASSIC,         /**<  Filter Preset type Classic */
51         MM_AUDIO_FILTER_PRESET_VOCAL,           /**<  Filter Preset type Vocal */
52         MM_AUDIO_FILTER_PRESET_BASS_BOOST,      /**<  Filter Preset type Bass Boost */
53         MM_AUDIO_FILTER_PRESET_TREBLE_BOOST,    /**<  Filter Preset type Treble Boost */
54         MM_AUDIO_FILTER_PRESET_MTHEATER,        /**<  Filter Preset type MTheater */
55         MM_AUDIO_FILTER_PRESET_EXT,             /**<  Filter Preset type Externalization */
56         MM_AUDIO_FILTER_PRESET_CAFE,            /**<  Filter Preset type Cafe */
57         MM_AUDIO_FILTER_PRESET_CONCERT_HALL,    /**<  Filter Preset type Concert Hall */
58         MM_AUDIO_FILTER_PRESET_VOICE,           /**<  Filter Preset type Voice */
59         MM_AUDIO_FILTER_PRESET_MOVIE,           /**<  Filter Preset type Movie */
60         MM_AUDIO_FILTER_PRESET_VIRT51,          /**<  Filter Preset type Virtual 5.1 */
61         MM_AUDIO_FILTER_PRESET_NUM,             /**<  Number of Filter Preset type */
62 } MMAudioFilterPresetType;
63
64 /**
65  * Enumerations of Custom Filter Type
66  */
67 typedef enum {
68         MM_AUDIO_FILTER_CUSTOM_EQ = 0,          /**<  Filter Custom type Equalizer */
69         MM_AUDIO_FILTER_CUSTOM_3D,              /**<  Filter Custom type 3D */
70         MM_AUDIO_FILTER_CUSTOM_BASS,            /**<  Filter Custom type Bass */
71         MM_AUDIO_FILTER_CUSTOM_ROOM_SIZE,       /**<  Filter Custom type Room Size */
72         MM_AUDIO_FILTER_CUSTOM_REVERB_LEVEL,    /**<  Filter Custom type Reverb Level */
73         MM_AUDIO_FILTER_CUSTOM_CLARITY,         /**<  Filter Custom type Clarity */
74         MM_AUDIO_FILTER_CUSTOM_NUM,             /**<  Number of Filter Custom type */
75 } MMAudioFilterCustomType;
76
77 /**
78  * Enumerations of Filter Type
79  */
80 typedef enum {
81         MM_AUDIO_FILTER_TYPE_NONE,
82         MM_AUDIO_FILTER_TYPE_PRESET,
83         MM_AUDIO_FILTER_TYPE_CUSTOM,
84 } MMAudioFilterType;
85
86
87 /**
88  * Enumerations of Output Mode
89  */
90 typedef enum {
91         MM_AUDIO_FILTER_OUTPUT_SPK,             /**< Speaker out */
92         MM_AUDIO_FILTER_OUTPUT_EAR                      /**< Earjack out */
93 } MMAudioFilterOutputMode;
94
95
96 /**
97  * Structure of FilterInfo
98  */
99 typedef struct {
100         MMAudioFilterType filter_type;          /**< Filter type, (NONE,PRESET,CUSTOM)*/
101         MMAudioFilterPresetType preset;         /**< for preset type*/
102         int *custom_ext_level_for_plugin;       /**< for custom type, level value list of extension filters*/
103         int custom_eq_level[MM_AUDIO_FILTER_EQ_BAND_MAX];       /**< for custom type, EQ info*/
104         int custom_ext_level[MM_AUDIO_FILTER_CUSTOM_NUM-1];     /**< for custom type, extension filter info*/
105 } MMAudioFilterInfo;
106
107
108 /**
109  * @brief Called to get each supported sound filter.
110  *
111  * @param       filter_type     [in]    Type of filter (preset filter or custom filter).
112  * @param       filter          [in]    Supported sound filter.
113  * @param       user_data       [in]    Pointer of user data.
114  *
115  * @return      True to continue with the next iteration of the loop, False to break outsp of the loop.
116  * @see         mm_player_get_foreach_present_supported_filter_type()
117  */
118 typedef bool (*mmplayer_supported_sound_filter_cb) (int filter_type, int type, void *user_data);
119
120 /**
121  * This function is to get supported filter type.
122  *
123  * @param       hplayer         [in]    Handle of player.
124  * @param       filter_type     [in]    Type of filter.
125  * @param       foreach_cb      [in]    Callback function to be passed the result.
126  * @param       user_data       [in]    Pointer of user data.
127  *
128  * @return      This function returns zero on success, or negative value with error code.
129  *
130  * @remark
131  * @see
132  * @since
133  */
134 int mm_player_get_foreach_present_supported_filter_type(MMHandleType player, MMAudioFilterType filter_type, mmplayer_supported_sound_filter_cb foreach_cb, void *user_data);
135
136 /**
137  * This function is to bypass sound effect.
138  *
139  * @param       hplayer         [in]    Handle of player.
140  *
141  * @return      This function returns zero on success, or negative value with error code.
142  *
143  * @remark
144  * @see
145  * @since
146  */
147 int mm_player_sound_filter_bypass (MMHandleType hplayer);
148
149 /**
150  * This function is to apply preset filter.
151  *
152  * @param       hplayer         [in]    Handle of player.
153  * @param       type            [in]    Preset type filter.
154  *
155  * @return      This function returns zero on success, or negative value with error code.
156  *
157  * @remark
158  * @see         MMAudioFilterPresetType
159  * @since
160  */
161 int mm_player_sound_filter_preset_apply(MMHandleType hplayer, MMAudioFilterPresetType type);
162
163 /**
164  * This function is to apply custom filter(Equalizer and Extension filters).
165  *
166  * @param       hplayer         [in]    Handle of player.
167  *
168  * @return      This function returns zero on success, or negative value with error code.
169  *
170  * @remark
171  * @see
172  * @since
173  */
174 int mm_player_sound_filter_custom_apply(MMHandleType hplayer);
175
176 /**
177  * This function is to clear Equalizer custom filter.
178  *
179  * @param       hplayer         [in]    Handle of player.
180  *
181  * @return      This function returns zero on success, or negative value with error code.
182  *
183  * @remark
184  * @see
185  * @since
186  */
187 int mm_player_sound_filter_custom_clear_eq_all(MMHandleType hplayer);
188
189 /**
190  * This function is to clear Extension custom filters.
191  *
192  * @param       hplayer         [in]    Handle of player.
193  *
194  * @return      This function returns zero on success, or negative value with error code.
195  *
196  * @remark
197  * @see
198  * @since
199  */
200 int mm_player_sound_filter_custom_clear_ext_all(MMHandleType hplayer);
201
202 /**
203  * This function is to get the number of equalizer bands.
204  *
205  * @param       hplayer         [in]    Handle of player.
206  * @param       bands           [out]   The number of bands.
207  *
208  * @return      This function returns zero on success, or negative value with error code.
209  *
210  * @remark
211  * @see
212  * @since
213  */
214 int mm_player_sound_filter_custom_get_eq_bands_number(MMHandleType hplayer, int *bands);
215
216 /**
217  * This function is to get the level of the custom filter.
218  *
219  * @param       hplayer         [in]    Handle of player.
220  * @param       type            [in]    Custom type filter.
221  * @param       eq_index        [in]    Equalizer band index. This parameter is available only when the type is MM_AUDIO_FILTER_CUSTOM_EQ.
222  * @param       level           [out]   The level of the custom filter.
223  *
224  * @return      This function returns zero on success, or negative value with error code.
225  *
226  * @remark
227  * @see         MMAudioFilterCustomType
228  * @since
229  */
230 int mm_player_sound_filter_custom_get_level(MMHandleType hplayer, MMAudioFilterCustomType type, int eq_index, int *level);
231
232 /**
233  * This function is to get range of the level of the custom filter.
234  *
235  * @param       hplayer         [in]    Handle of player.
236  * @param       type            [in]    Custom type filter.
237  * @param       min             [out]   Minimal value of level.
238  * @param       max             [out]   Maximum value of level.
239  *
240  * @return      This function returns zero on success, or negative value with error code.
241  *
242  * @remark
243  * @see         MMAudioFilterCustomType
244  * @since
245  */
246 int mm_player_sound_filter_custom_get_level_range(MMHandleType hplayer, MMAudioFilterCustomType type, int *min, int *max);
247
248 /**
249  * This function is to set the level of the custom filter.
250  *
251  * @param       hplayer         [in]    Handle of player.
252  * @param       type            [in]    Custom type filter.
253  * @param       eq_index        [in]    Equalizer band index. This parameter is available only when the type is MM_AUDIO_FILTER_CUSTOM_EQ.
254  * @param       level           [in]    The level of the custom filter.
255  *
256  * @return      This function returns zero on success, or negative value with error code.
257  *
258  * @remark
259  * @see         MMAudioFilterCustomType
260  * @since
261  */
262 int mm_player_sound_filter_custom_set_level(MMHandleType hplayer, MMAudioFilterCustomType filter_custom_type, int eq_index, int level);
263
264 /**
265  * This function is to set the bands level of equalizer custom filter using input list.
266  *
267  * @param       hplayer         [in]    Handle of player.
268  * @param       level_list      [in]    list of bands level of equalizer custom filter want to set.
269  * @param       size            [in]    size of level_list.
270  *
271  * @return      This function returns zero on success, or negative value with error code.
272  *
273  * @remark
274  * @see
275  * @since
276  */
277 int mm_player_sound_filter_custom_set_level_eq_from_list(MMHandleType hplayer, int *level_list, int size);
278
279 /**
280  * This function is to decide if the preset type filter is supported or not
281  *
282  * @param       hplayer         [in]    Handle of player.
283  * @param       filter          [in]    Preset type filter.
284  *
285  * @return      This function returns zero on success, or negative value with error code.
286  *
287  * @remark
288  * @see
289  * @since
290  */
291 int mm_player_is_supported_preset_filter_type(MMHandleType hplayer, MMAudioFilterPresetType filter);
292
293 /**
294  * This function is to decide if the custom type filter is supported or not
295  *
296  * @param       hplayer         [in]    Handle of player.
297  * @param       filter          [in]    Custom type filter.
298  *
299  * @return      This function returns zero on success, or negative value with error code.
300  *
301  * @remark
302  * @see
303  * @since
304  */
305 int mm_player_is_supported_custom_filter_type(MMHandleType hplayer, MMAudioFilterCustomType filter);
306
307 /**
308         @}
309  */
310
311 #ifdef __cplusplus
312         }
313 #endif
314
315 #endif  /* __MM_PLAYER_SNDEFFECT_H__ */