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
35 #define MM_AUDIO_EFFECT_SQUARE_VALUE_MAX 4
36 #define MM_AUDIO_EFFECT_SQUARE_VALUE_MIN 0
39 @addtogroup PLAYER_INTERNAL
44 * Enumerations of Audio Effect Preset Type
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;
75 * Enumerations of Audio Effect Custom Type
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;
88 * Enumerations of Audio Effect Type
91 MM_AUDIO_EFFECT_TYPE_NONE,
92 MM_AUDIO_EFFECT_TYPE_PRESET,
93 MM_AUDIO_EFFECT_TYPE_CUSTOM,
94 MM_AUDIO_EFFECT_TYPE_SQUARE,
99 * Enumerations of Output Mode
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;
115 * Structure of AudioEffectInfo
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*/
129 * @brief Called to get each supported audio effect.
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.
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()
138 typedef bool (*mmplayer_supported_audio_effect_cb)(int effect_type, int type, void *user_data);
141 * This function is to get supported effect type.
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.
148 * @return This function returns zero on success, or negative value with error code.
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);
157 * This function is to bypass audio effect.
159 * @param hplayer [in] Handle of player.
161 * @return This function returns zero on success, or negative value with error code.
167 int mm_player_audio_effect_bypass(MMHandleType hplayer);
170 * This function is to apply custom effect(Equalizer and Extension effects).
172 * @param hplayer [in] Handle of player.
174 * @return This function returns zero on success, or negative value with error code.
180 int mm_player_audio_effect_custom_apply(MMHandleType hplayer);
183 * This function is to clear Equalizer custom effect.
185 * @param hplayer [in] Handle of player.
187 * @return This function returns zero on success, or negative value with error code.
193 int mm_player_audio_effect_custom_clear_eq_all(MMHandleType hplayer);
196 * This function is to clear Extension custom effects.
198 * @param hplayer [in] Handle of player.
200 * @return This function returns zero on success, or negative value with error code.
206 int mm_player_audio_effect_custom_clear_ext_all(MMHandleType hplayer);
209 * This function is to get the number of equalizer bands.
211 * @param hplayer [in] Handle of player.
212 * @param bands [out] The number of bands.
214 * @return This function returns zero on success, or negative value with error code.
220 int mm_player_audio_effect_custom_get_eq_bands_number(MMHandleType hplayer, int *bands);
223 * This function is to get width of equalizer band of each index.
225 * @param hplayer [in] Handle of player.
226 * @param band_idx [in] Index of band.
227 * @param width [out] Value of width.
229 * @return This function returns zero on success, or negative value with error code.
235 int mm_player_audio_effect_custom_get_eq_bands_width(MMHandleType hplayer, int band_idx, int *width);
238 * This function is to get frequency of equalizer band of each index.
240 * @param hplayer [in] Handle of player.
241 * @param band_idx [in] Index of band.
242 * @param freq [out] Value of frequency.
244 * @return This function returns zero on success, or negative value with error code.
250 int mm_player_audio_effect_custom_get_eq_bands_freq(MMHandleType hplayer, int band_idx, int *freq);
253 * This function is to get the level of the custom effect.
255 * @param hplayer [in] Handle of player.
256 * @param type [in] Custom type effect.
257 * @param eq_index [in] Equalizer band index. This parameter is available only when the type is MM_AUDIO_EFFECT_CUSTOM_EQ.
258 * @param level [out] The level of the custom effect.
260 * @return This function returns zero on success, or negative value with error code.
263 * @see MMAudioEffectCustomType
266 int mm_player_audio_effect_custom_get_level(MMHandleType hplayer, MMAudioEffectCustomType type, int eq_index, int *level);
269 * This function is to get range of the level of the custom effect.
271 * @param hplayer [in] Handle of player.
272 * @param type [in] Custom type effect.
273 * @param min [out] Minimal value of level.
274 * @param max [out] Maximum value of level.
276 * @return This function returns zero on success, or negative value with error code.
279 * @see MMAudioEffectCustomType
282 int mm_player_audio_effect_custom_get_level_range(MMHandleType hplayer, MMAudioEffectCustomType type, int *min, int *max);
285 * This function is to set the level of the custom effect.
287 * @param hplayer [in] Handle of player.
288 * @param type [in] Custom type effect.
289 * @param eq_index [in] Equalizer band index. This parameter is available only when the type is MM_AUDIO_EFFECT_CUSTOM_EQ.
290 * @param level [in] The level of the custom effect.
292 * @return This function returns zero on success, or negative value with error code.
295 * @see MMAudioEffectCustomType
298 int mm_player_audio_effect_custom_set_level(MMHandleType hplayer, MMAudioEffectCustomType effect_custom_type, int eq_index, int level);
301 * This function is to set the bands level of equalizer custom effect using input list.
303 * @param hplayer [in] Handle of player.
304 * @param level_list [in] list of bands level of equalizer custom audio_effect want to set.
305 * @param size [in] size of level_list.
307 * @return This function returns zero on success, or negative value with error code.
313 int mm_player_audio_effect_custom_set_level_eq_from_list(MMHandleType hplayer, int *level_list, int size);
316 * This function is to decide if the preset type effect is supported or not
318 * @param hplayer [in] Handle of player.
319 * @param effect [in] Preset type effect.
321 * @return This function returns zero on success, or negative value with error code.
327 int mm_player_is_supported_preset_effect_type(MMHandleType hplayer, MMAudioEffectPresetType effect);
330 * This function is to decide if the custom type effect is supported or not
332 * @param hplayer [in] Handle of player.
333 * @param effect [in] Custom type effect.
335 * @return This function returns zero on success, or negative value with error code.
341 int mm_player_is_supported_custom_effect_type(MMHandleType hplayer, MMAudioEffectCustomType effect);
351 #endif /* __MM_PLAYER_AUDIOEFFECT_H__ */