javauis/amms_qt/mmacontrol/inc.emc/cammsemcreverbcontrol.h
branchRCL_3
changeset 24 0fd27995241b
equal deleted inserted replaced
20:f9bb0fca356a 24:0fd27995241b
       
     1 /*
       
     2 * Copyright (c) 2005 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 settings of an audio effect called reverb.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CAMMSEMCREVERBCONTROL_H
       
    21 #define CAMMSEMCREVERBCONTROL_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <EnvironmentalReverbBase.h>
       
    26 #include <EnvironmentalReverbUtility.h>
       
    27 #include "cammseffectcontrol.h"
       
    28 #include "cammseffectcontrolgroup.h"
       
    29 
       
    30 //EMC
       
    31 #include <EffectControl.h>
       
    32 #include <ReverbControl.h>
       
    33 #include <cammsbasereverbcontrol.h>
       
    34 #include <cmmaemcaudioplayer.h>
       
    35 //Utility for getting EnvironmentalReverb
       
    36 #include "cammsemcreverbenvironmentalpresetutility.h"
       
    37 
       
    38 
       
    39 using multimedia :: KReverbEffectControl;
       
    40 using multimedia :: MReverbControl;
       
    41 
       
    42 // CONSTANTS
       
    43 _LIT(KAMMSEMCReverbControl, "ReverbControl");
       
    44 _LIT(KAMMSEMCDefaultReverbPreset, "smallroom");
       
    45 
       
    46 // CLASS DECLARATION
       
    47 
       
    48 /**
       
    49 *
       
    50 *  Controls for the Reverb effect.
       
    51 *  This class delegates Reverb effect method calls to CReverb.
       
    52 *
       
    53 *
       
    54 *  @since 5.1
       
    55 */
       
    56 NONSHARABLE_CLASS(CAMMSEMCReverbControl): public CAMMSBaseReverbControl
       
    57 {
       
    58 public:  // Constructors and destructor
       
    59 
       
    60     /**
       
    61     * Two-phased constructor.
       
    62     * @param aPlayer Player that has this control.
       
    63     */
       
    64     static CAMMSEMCReverbControl* NewLC(CMMAPlayer* aPlayer);
       
    65 
       
    66     /**
       
    67     * Destructor.
       
    68     */
       
    69     ~CAMMSEMCReverbControl();
       
    70 
       
    71 public:  // New functions
       
    72 
       
    73     /**
       
    74     * Sets the gain level of the reverberation. The value defines what is
       
    75     * the relative level of the first reflections compared to the sound
       
    76     * source without possible distance attenuations, directivities or
       
    77     * obstructions taken into account.
       
    78     *
       
    79     * @param aLevel The new level of the reverberation in millibels.
       
    80     *
       
    81     * @return The value that was actually set.
       
    82     *
       
    83     * @par Leaving:
       
    84     * @li \c KErrArgument - \a aLevel is greater than 0
       
    85     */
       
    86     TInt SetReverbLevelL(TInt aLevel);
       
    87 
       
    88     /**
       
    89     * Sets the reverberation time of the reverb. The reverberation time is
       
    90     * the time taken for the reverberant sound to attenuate by 60 dB from
       
    91     * its initial level. Typical values are in the range from 100 to 20000
       
    92     * milliseconds.
       
    93     * The implementation might not support long reverberation times.
       
    94     * Therefore, the actual time used might be shorter than the time
       
    95     * specified with this method.
       
    96     *
       
    97     * @param aTime The new reverberation time in milliseconds.
       
    98     *
       
    99     * @return The value that was actually set.
       
   100     *
       
   101     * @par Leaving:
       
   102     * @li \c KErrArgument - \a aTime is negative.
       
   103     * From Java API more leave codes are:
       
   104     * - java.lang.IllegalArgumentException - when the given time is
       
   105     * negative
       
   106     * - javax.microedition.media.MediaException - when the changing of the
       
   107     * reverb time is not supported
       
   108     */
       
   109     void SetReverbTimeL(TInt aTime);
       
   110 
       
   111     /**
       
   112     * Gets the gain level of the reverberation.
       
   113     *
       
   114     * @return The level of the reverberation in millibels.
       
   115     */
       
   116     TInt ReverbLevel();
       
   117 
       
   118     /**
       
   119     * Gets the reverberation time.
       
   120     *
       
   121     * @return The time of the reverberation in milliseconds.
       
   122     */
       
   123     TInt ReverbTime();
       
   124 
       
   125     /**
       
   126     * Gets the minimum level of the reverberation.
       
   127     *
       
   128     * @return The minimum level of the reverberation in millibels.
       
   129     */
       
   130     TInt MinReverbLevel();
       
   131 
       
   132     /**
       
   133     * Gets the maximum level of the reverberation.
       
   134     *
       
   135     * @return The maximum level of the reverberation in millibels.
       
   136     */
       
   137     TInt MaxReverbLevel();
       
   138 
       
   139 public: // Functions from base classes
       
   140     /**
       
   141     * Sets the effect according to the given preset.
       
   142     *
       
   143     * @param aPreset The new preset that will be taken into use.
       
   144     *
       
   145     * @par Leaving:
       
   146     * @li \c KErrArgument - \a aPreset is not available or it is null.
       
   147     */
       
   148     void SetPresetL(const TDesC& aPreset);
       
   149 
       
   150     /**
       
   151     * Gets the available preset names.
       
   152     *
       
   153     * @return The names of all the available preset modes.
       
   154     */
       
   155     const CDesCArray& PresetNamesL();
       
   156 
       
   157     /**
       
   158     * Gets the current preset.
       
   159     *
       
   160     * @return The preset that is set at the moment. If none of the presets
       
   161     * is set, null will be returned.
       
   162     */
       
   163     const TDesC& PresetL();
       
   164 
       
   165     /**
       
   166     * Enables/disables the effect.
       
   167     *
       
   168     * @param aEnabled The boolean value, true=enabled, false=disabled.
       
   169     *
       
   170     * @par Leaving:
       
   171     * From Java API the leave codes are:
       
   172     * - java.lang.IllegalStateException - if the effect cannot be enabled
       
   173     * in this state of the player.
       
   174     * - javax.microedition.media.MediaException - if enabling is not
       
   175     * supported (with the scope set).
       
   176     */
       
   177     void SetEnabledL(TBool aEnable);
       
   178 
       
   179     const TDesC& ClassName() const;
       
   180 
       
   181     /**
       
   182     * Prepares the Control.
       
   183     */
       
   184     void PrepareControlL();
       
   185 
       
   186     /**
       
   187     * Deallocates the Control.
       
   188     */
       
   189     void DeallocateControl();
       
   190 
       
   191 public:  // Functions needed by reverb source control
       
   192     /**
       
   193     * Returns the Reverb Control.
       
   194     * CAMMSEMCReverbSourceControl has to use the same instance.
       
   195     * The function creates the instance if they do not exist yet.
       
   196     */
       
   197     MReverbControl * GetReverbControlL();
       
   198 
       
   199 
       
   200     /**
       
   201      * Returns the Current Preset Index.
       
   202      * CAMMSEMCReverbSourceControl has to use it.
       
   203      */
       
   204 
       
   205     TInt CurrentPresetIndex();
       
   206 
       
   207 public: // override the virtual functions from base class CAMMSEffectControl
       
   208 
       
   209     void SetEnforcedL(TBool aEnforced);
       
   210     TBool Enforced();
       
   211     void SetScopeL(TInt aScope);
       
   212     TInt Scope();
       
   213     void ApplySettingsL();
       
   214 
       
   215 private:
       
   216     /**
       
   217     * C++ constructor.
       
   218     * @param aPlayer Player that has this control.
       
   219     */
       
   220     CAMMSEMCReverbControl(CMMAPlayer* aPlayer);
       
   221 
       
   222     /**
       
   223     * By default Symbian 2nd phase constructor is private.
       
   224     */
       
   225     void ConstructL();
       
   226 
       
   227 private:  // Data
       
   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     /* Reverb utility to get Environmental Reverb*/
       
   238     CAMMSEMCReverbEnvironmentalPresetUtility *iAMMSEMCReverbEnvironmentalPresetUtility;
       
   239 private:
       
   240 
       
   241     CMMAPlayer *iMMAPlayer;
       
   242     /**
       
   243     * EMC Reverb Control
       
   244     */
       
   245 
       
   246     CMultimediaFactory* iFactory;
       
   247     MStreamControl* iStreamControl;
       
   248     MReverbControl *iMReverbControl;
       
   249     TInt iEnvReverbLevel;
       
   250 
       
   251 };
       
   252 
       
   253 #endif // CAMMSEMCREVERBCONTROL_H
       
   254 
       
   255