4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
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>
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 #ifndef __MM_PLAYER_AUDIOEFFECT_H__
24 #define __MM_PLAYER_AUDIOEFFECT_H__
32 #define MM_AUDIO_EFFECT_EQ_BAND_NUM_MAX 10
33 #define MM_AUDIO_EFFECT_CUSTOM_LEVEL_INIT 0
36 @addtogroup PLAYER_INTERNAL
41 * Enumerations of Audio Effect Preset Type
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;
68 * Enumerations of Audio Effect Custom Type
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;
81 * Enumerations of Audio Effect Type
84 MM_AUDIO_EFFECT_TYPE_NONE,
85 MM_AUDIO_EFFECT_TYPE_PRESET,
86 MM_AUDIO_EFFECT_TYPE_CUSTOM,
91 * Enumerations of Output Mode
94 MM_AUDIO_EFFECT_OUTPUT_SPK, /**< Speaker out */
95 MM_AUDIO_EFFECT_OUTPUT_EAR /**< Earjack out */
96 } MMAudioEffectOutputMode;
100 * Structure of AudioEffectInfo
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*/
112 * @brief Called to get each supported audio effect.
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.
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()
121 typedef bool (*mmplayer_supported_audio_effect_cb) (int effect_type, int type, void *user_data);
124 * This function is to get supported effect type.
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.
131 * @return This function returns zero on success, or negative value with error code.
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);
140 * This function is to bypass audio effect.
142 * @param hplayer [in] Handle of player.
144 * @return This function returns zero on success, or negative value with error code.
150 int mm_player_audio_effect_bypass (MMHandleType hplayer);
153 * This function is to apply preset effect.
155 * @param hplayer [in] Handle of player.
156 * @param type [in] Preset type effect.
158 * @return This function returns zero on success, or negative value with error code.
161 * @see MMAudioEffectPresetType
164 int mm_player_audio_effect_preset_apply(MMHandleType hplayer, MMAudioEffectPresetType type);
167 * This function is to apply custom effect(Equalizer and Extension effects).
169 * @param hplayer [in] Handle of player.
171 * @return This function returns zero on success, or negative value with error code.
177 int mm_player_audio_effect_custom_apply(MMHandleType hplayer);
180 * This function is to clear Equalizer custom effect.
182 * @param hplayer [in] Handle of player.
184 * @return This function returns zero on success, or negative value with error code.
190 int mm_player_audio_effect_custom_clear_eq_all(MMHandleType hplayer);
193 * This function is to clear Extension custom effects.
195 * @param hplayer [in] Handle of player.
197 * @return This function returns zero on success, or negative value with error code.
203 int mm_player_audio_effect_custom_clear_ext_all(MMHandleType hplayer);
206 * This function is to get the number of equalizer bands.
208 * @param hplayer [in] Handle of player.
209 * @param bands [out] The number of bands.
211 * @return This function returns zero on success, or negative value with error code.
217 int mm_player_audio_effect_custom_get_eq_bands_number(MMHandleType hplayer, int *bands);
220 * This function is to get width of equalizer band of each index.
222 * @param hplayer [in] Handle of player.
223 * @param band_idx [in] Index of band.
224 * @param width [out] Value of width.
226 * @return This function returns zero on success, or negative value with error code.
232 int mm_player_audio_effect_custom_get_eq_bands_width(MMHandleType hplayer, int band_idx, int *width);
235 * This function is to get frequency of equalizer band of each index.
237 * @param hplayer [in] Handle of player.
238 * @param band_idx [in] Index of band.
239 * @param freq [out] Value of frequency.
241 * @return This function returns zero on success, or negative value with error code.
247 int mm_player_audio_effect_custom_get_eq_bands_freq(MMHandleType hplayer, int band_idx, int *freq);
250 * This function is to get the level of the custom effect.
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.
257 * @return This function returns zero on success, or negative value with error code.
260 * @see MMAudioEffectCustomType
263 int mm_player_audio_effect_custom_get_level(MMHandleType hplayer, MMAudioEffectCustomType type, int eq_index, int *level);
266 * This function is to get range of the level of the custom effect.
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.
273 * @return This function returns zero on success, or negative value with error code.
276 * @see MMAudioEffectCustomType
279 int mm_player_audio_effect_custom_get_level_range(MMHandleType hplayer, MMAudioEffectCustomType type, int *min, int *max);
282 * This function is to set the level of the custom effect.
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.
289 * @return This function returns zero on success, or negative value with error code.
292 * @see MMAudioEffectCustomType
295 int mm_player_audio_effect_custom_set_level(MMHandleType hplayer, MMAudioEffectCustomType effect_custom_type, int eq_index, int level);
298 * This function is to set the bands level of equalizer custom effect using input list.
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.
304 * @return This function returns zero on success, or negative value with error code.
310 int mm_player_audio_effect_custom_set_level_eq_from_list(MMHandleType hplayer, int *level_list, int size);
313 * This function is to decide if the preset type effect is supported or not
315 * @param hplayer [in] Handle of player.
316 * @param effect [in] Preset type effect.
318 * @return This function returns zero on success, or negative value with error code.
324 int mm_player_is_supported_preset_effect_type(MMHandleType hplayer, MMAudioEffectPresetType effect);
327 * This function is to decide if the custom type effect is supported or not
329 * @param hplayer [in] Handle of player.
330 * @param effect [in] Custom type effect.
332 * @return This function returns zero on success, or negative value with error code.
338 int mm_player_is_supported_custom_effect_type(MMHandleType hplayer, MMAudioEffectCustomType effect);
348 #endif /* __MM_PLAYER_AUDIOEFFECT_H__ */