javauis/amms_qt/mmacontrol/inc.emc/cammsemcequalizercontrol.h
branchRCL_3
changeset 18 9ac0a0a7da70
parent 17 0fd27995241b
child 19 71c436fe3ce0
equal deleted inserted replaced
17:0fd27995241b 18:9ac0a0a7da70
     1 /*
       
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Manipulates the equalization settings of a Player.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAMMSEMCEQUALIZERCONTROL_H
       
    20 #define CAMMSEMCEQUALIZERCONTROL_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "cammseffectcontrolgroup.h"
       
    25 //EMC
       
    26 #include <EffectControl.h>
       
    27 #include <EqualizerControl.h>
       
    28 #include "cammsbaseequalizercontrol.h"
       
    29 #include <cmmaemcaudioplayer.h>
       
    30 //Utility for getting EnvironmentalReverb
       
    31 #include "cammsemcequalizerenvironmentalpresetutility.h"
       
    32 
       
    33 
       
    34 using multimedia :: KEqualizerEffectControl;
       
    35 using multimedia::MEqualizerControl;
       
    36 
       
    37 
       
    38 // CONSTANTS
       
    39 _LIT(KAMMSEMCEqualizerControl, "EqualizerControl");
       
    40 _LIT(KAMMSEMCDefaultEqualizerPreset, "smallroom");
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45 *
       
    46 *  Controls for the Equalizer effect.
       
    47 *  This class delegates Equalizer effect method calls to CAudioEqualizer.
       
    48 *
       
    49 *
       
    50 *  @since 5.1
       
    51 */
       
    52 NONSHARABLE_CLASS(CAMMSEMCEqualizerControl): public CAMMSBaseEqualizerControl
       
    53 {
       
    54 public:
       
    55     /**
       
    56     * Two-phased constructor.
       
    57     * @param aPlayer Player that has this control.
       
    58     */
       
    59     static CAMMSEMCEqualizerControl* NewLC(CMMAPlayer* aPlayer);
       
    60 
       
    61     /**
       
    62     * Destructor.
       
    63     */
       
    64     ~CAMMSEMCEqualizerControl();
       
    65 
       
    66 public: // New functions
       
    67 
       
    68     /**
       
    69     * Gets the gain set for the given equalizer band.
       
    70     *
       
    71     * @param aBand The frequency band whose gain is asked. The numbering of
       
    72     * the bands starts from 0 and ends at (getNumberOfBands() - 1).
       
    73     *
       
    74     * @return The gain set for the given band in millibels.
       
    75     *
       
    76     * @par Leaving:
       
    77     * @li \c KErrArgument - \a aBand is out of range.
       
    78     */
       
    79     TInt BandLevelL(TInt aBand);
       
    80 
       
    81     /**
       
    82     * Returns the maximum band level supported.
       
    83     *
       
    84     * @return The maximum band level in millibels.
       
    85     */
       
    86     TInt MaxBandLevel();
       
    87 
       
    88     /**
       
    89     * Returns the minimum band level supported.
       
    90     *
       
    91     * @return The minimum band level in millibels.
       
    92     */
       
    93     TInt MinBandLevel();
       
    94 
       
    95     /**
       
    96     * Returns the band width in Hz for the specified band.
       
    97     *
       
    98     * @param aBand The frequency band whose band width is asked.
       
    99     * The numbering of the bands starts from 0 and ends at
       
   100     * (getNumberOfBands() - 1).
       
   101     *
       
   102     * @return The band width in Hz for the specified band.
       
   103     */
       
   104     TInt BandWidth(TInt aBand);
       
   105 
       
   106     /**
       
   107     * Returns the center frequency in Hz for a given band.
       
   108     *
       
   109     * @param aBand The frequency band whose center frequency
       
   110     * is asked. The numbering of
       
   111     * the bands starts from 0 and ends at (getNumberOfBands() - 1).
       
   112     *
       
   113     * @return The center frequency in Hz for a given band.
       
   114     */
       
   115     TInt CenterFrequency(TInt aBand);
       
   116 
       
   117     /**
       
   118     * Returns the cross-over frequency between the given frequency
       
   119     * band (aBand) and the next band.
       
   120     *
       
   121     * @param aBand The frequency band whose gain is asked. The numbering of
       
   122     * the bands starts from 0 and ends at (getNumberOfBands() - 1).
       
   123     *
       
   124     * @return Crossover frequency.
       
   125     */
       
   126     TInt CrossoverFrequency(TInt aBand);
       
   127 
       
   128     /**
       
   129     * Gets the number of frequency bands that the equalizer supports.
       
   130     *
       
   131     * @return The number of frequency bands that the equalizer supports.
       
   132     */
       
   133     TInt NumberOfBands();
       
   134 
       
   135     /**
       
   136     * Sets the given equalizer band to the given gain value.
       
   137     *
       
   138     * @param aLevel The new gain in millibels that will be set to the given
       
   139     * band. getMinBandLevel() and getMaxBandLevel() will define the maximum
       
   140     * and minimum values.
       
   141     * @param aBand The frequency band that will have the new gain. The
       
   142     * numbering of the bands starts from 0 and ends at
       
   143     * (getNumberOfBands() - 1).
       
   144     *
       
   145     * @par Leaving:
       
   146     * @li \c KErrArgument - \a aBand or \a aLevel is out of range.
       
   147     */
       
   148     void SetBandLevelL(TInt aLevel, TInt aBand);
       
   149 
       
   150 public: // Functions from base classes
       
   151 
       
   152     /**
       
   153     * Sets the effect according to the given preset.
       
   154     *
       
   155     * @param aPreset The new preset that will be taken into use.
       
   156     *
       
   157     * @par Leaving:
       
   158     * @li \c KErrArgument - \a aPreset is not available or it is null.
       
   159     */
       
   160     void SetPresetL(const TDesC& aPreset);
       
   161 
       
   162     /**
       
   163     * Gets the available preset names.
       
   164     *
       
   165     * @return The names of all the available preset modes.
       
   166     */
       
   167     const CDesCArray& PresetNamesL();
       
   168 
       
   169     /**
       
   170     * Gets the current preset.
       
   171     *
       
   172     * @return The preset that is set at the moment. If none of the presets
       
   173     * is set, null will be returned.
       
   174     */
       
   175     const TDesC& PresetL();
       
   176 
       
   177     /**
       
   178     * Enables/disables the effect.
       
   179     *
       
   180     * @param aEnabled The boolean value, true=enabled, false=disabled.
       
   181     *
       
   182     * @par Leaving:
       
   183     * From Java API the leave codes are:
       
   184     * - java.lang.IllegalStateException - if the effect cannot be enabled
       
   185     * in this state of the player.
       
   186     * - javax.microedition.media.MediaException - if enabling is not
       
   187     * supported (with the scope set).
       
   188     */
       
   189     void SetEnabledL(TBool aEnable);
       
   190 
       
   191     const TDesC& ClassName() const;
       
   192 
       
   193     /**
       
   194     * Prepares the Control.
       
   195     */
       
   196     void PrepareControlL();
       
   197 
       
   198     /**
       
   199     * Deallocates the Control.
       
   200     */
       
   201     void DeallocateControl();
       
   202 
       
   203 public: // override the virtual functions from base class CAMMSEffectControl
       
   204 
       
   205     void SetEnforcedL(TBool aEnforced);
       
   206     TBool Enforced();
       
   207     void SetScopeL(TInt aScope);
       
   208     TInt Scope();
       
   209     void ApplySettingsL();
       
   210 
       
   211 
       
   212 private:
       
   213     /**
       
   214     * C++ constructor.
       
   215     * @param aPlayer Player that has this control.
       
   216     */
       
   217     CAMMSEMCEqualizerControl(CMMAPlayer* aPlayer);
       
   218 
       
   219     /**
       
   220     * By default Symbian 2nd phase constructor is private.
       
   221     */
       
   222     void ConstructL();
       
   223 
       
   224 private:  // Data
       
   225 
       
   226     /** Native audio equalizer */
       
   227     // CAudioEqualizerUtility* iEqualizerUtility;
       
   228 
       
   229     /* Array for querying the preset names, owned */
       
   230     CDesCArray* iPresetNames;
       
   231 
       
   232     TBuf<KAMMSMaxPresetNameLength> iPresetName;
       
   233 
       
   234     /* Index of the current preset */
       
   235     TInt iCurrentPreset;
       
   236 
       
   237     /* Equalizer utility to get preset and data related to that preset*/
       
   238     CAMMSEMCEqualizerEnvironmentalPresetUtility * iAMMSEMCEqualizerEnvironmentalPresetUtility;
       
   239 
       
   240 
       
   241 private:
       
   242 
       
   243     CMMAPlayer *iMMAPlayer;
       
   244     /**
       
   245     * EMC Equalizer Control
       
   246     */
       
   247 
       
   248     CMultimediaFactory* iFactory;
       
   249     MStreamControl* iStreamControl;
       
   250     MEqualizerControl *iMEqualizerControl;
       
   251 
       
   252 };
       
   253 
       
   254 #endif // CAMMSEMCEQUALIZERCONTROL_H
       
   255 
       
   256