2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FMediaAudioEqualizer.h
20 * @brief This is the header file for the %AudioEqualizer class.
21 * This header file contains the declarations of the %AudioEqualizer class.
24 #ifndef _FMEDIA_AUDIO_EQUALIZER_H_
25 #define _FMEDIA_AUDIO_EQUALIZER_H_
27 #include <FBaseObject.h>
28 #include <FMediaPlayer.h>
30 namespace Tizen { namespace Media
34 * @class AudioEqualizer
35 * This class is used to apply audio equalizer settings
39 * @final This class is not intended for extension.
43 * @remarks The functionality includes querying and setting the levels of the different frequency bands.
45 * The following example demonstrates how to use the %AudioEqualizer class.
52 * using namespace Tizen::Base;
53 * using namespace Tizen::Media;
55 * class EqualizerSample
56 * : public Tizen::Media::IPlayerEventListener
59 * result Initialize(void);
61 * result Equalize(void);
65 * // IPlayerEventListener
66 * virtual void OnPlayerOpened(result r) {}
67 * virtual void OnPlayerEndOfClip(void) {}
68 * virtual void OnPlayerBuffering(int percent) {}
69 * virtual void OnPlayerErrorOccurred(PlayerErrorReason r) {}
70 * virtual void OnPlayerInterrupted(void) {}
71 * virtual void OnPlayerReleased(void) {}
72 * virtual void OnPlayerSeekCompleted(result r) {}
73 * virtual void OnPlayerAudioFocusChanged (void) {}
78 * AudioEqualizer __audioEqualizer;
82 * EqualizerSample::Initialize(void)
84 * result r = E_SUCCESS;
85 * String filePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/test.mp3";
87 * r = __player.Construct(*this);
93 * __audioEqualizer.Construct(__player)
95 * r = __player.OpenFile(filePath, false);
105 * EqualizerSample::Play(void)
107 * result r = E_SUCCESS;
108 * r = __player.Play();
113 * EqualizerSample::Equalize(void)
115 * result r = E_SUCCESS;
121 * count = __audioEqualizer.GetBandCount();
123 * for (int index = 0; index < count; index++)
125 * r = __audioEqualizer.GetBandLevelRange(index, minValue, maxValue);
130 * level = (minValue + maxValue) / 2;
131 * r = __audioEqualizer.SetBandLevel(index, level);
142 * EqualizerSample::Stop(void)
144 * __audioEqualizer.ResetAllToDefault();
154 class _OSP_EXPORT_ AudioEqualizer
155 : public Tizen::Base::Object
160 * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
164 * @visibility partner
166 * @remarks After creating an instance of this class, the Construct() method must be called explicitly to
167 * initialize this instance.
171 AudioEqualizer(void);
175 * This destructor overrides Tizen::Base::Object::~Object().
179 * @visibility partner
182 virtual ~AudioEqualizer(void);
186 * Initializes this instance of %AudioEqualizer with the given %Player.
190 * @visibility partner
192 * @return An error code
193 * @param[in] player The player instance that the equalizer will be applied.
194 * @exception E_SUCCESS The method is successful.
195 * @exception E_OUT_OF_MEMORY The memory is insufficient.
196 * @exception E_INVALID_ARG The specified input parameter is invalid.
197 * @exception E_UNSUPPORTED_OPERATION This device does not support the audio equalizer feature.
198 * @remarks If player is deleted, then this instance cannot be used properly.
201 result Construct(Player& player);
205 * Gets the count of bands that equalizer supports.
209 * @visibility partner
211 * @return The count of bands, @n
212 else @c -1 if it fails.
213 * @exception E_SUCCESS The method is successful.
214 * @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
215 * @remarks The specific error code can be accessed using the GetLastResult() method.
218 int GetBandCount(void) const;
222 * Gets the level range of the frequency band
226 * @visibility partner
228 * @return An error code
229 * @param[in] index Index of the frequency band. @n
231 * @param[out] minValue Minimum level of the frequency band specified via index
232 * @param[out] maxValue Maximum level of the frequency band specified via index
233 * @exception E_SUCCESS The method is successful
234 * @exception E_INVALID_ARG The specified input parameter is invalid
235 * @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
236 * @see GetBandCount()
239 result GetBandLevelRange(int index, int& minValue, int& maxValue) const;
243 * Sets the level of the frequency band specified by index
247 * @visibility partner
249 * @return An error code
250 * @param[in] index Index of the frequency band. @n
252 * @param[in] level The level to which the frequency band should be set to
253 * @exception E_SUCCESS The method is successful.
254 * @exception E_OUT_OF_RANGE The level value does not lie within minimum and maximum range of frequency band.
255 * @exception E_INVALID_ARG The specified input parameter is invalid
256 * @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
257 * @see GetBandCount()
260 result SetBandLevel(int index, int level);
264 * Sets the level of all the frequency bands
268 * @visibility partner
270 * @return An error code
271 * @param[in] pLevels The pointer of the level array which has settings of all the frequency bands
272 * @exception E_SUCCESS The method is successful
273 * @exception E_OUT_OF_RANGE The level values do not lie within minimum and maximum range of frequency bands
274 * @exception E_INVALID_ARG The specified input parameter is invalid. List is either empty or does not have level settings for all frequeny bands.
275 * @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
278 result SetAllBandsLevel(const Tizen::Base::Collection::IListT<int>* pLevels);
282 * Gets the level of frequency band specified via index
286 * @visibility partner
288 * @return An error code
289 * @param[in] index Index of the frequency band. @n
291 * @param[out] level Level of the frequency band specified via index
292 * @exception E_SUCCESS The method is successful
293 * @exception E_INVALID_ARG The specified input parameter is invalid
294 * @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
297 result GetBandLevel(int index, int& level) const;
301 * Gets the center frequency of the frequency band specified by index
305 * @visibility partner
307 * @return An error code
308 * @param[in] index Index of the frequency band. @n
310 * @param[out] frequency Center frequency in Hz of the frequency band specified by index
311 * @exception E_SUCCESS The method is successful
312 * @exception E_INVALID_ARG The specified input parameter is invalid
313 * @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
316 result GetBandCenterFrequency(int index, int& frequency) const;
320 * Clears the equalizer effect and resets all bands to the default values
324 * @visibility partner
326 * @return An error code
327 * @exception E_SUCCESS The method is successful
328 * @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
331 result ResetAllToDefault(void);
336 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
340 * @visibility private
343 AudioEqualizer(const AudioEqualizer& rhs);
347 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
351 * @visibility private
354 AudioEqualizer& operator =(const AudioEqualizer& rhs);
356 class _AudioEqualizerImpl* __pAudioEqualizerImpl;