os/mm/mm_pub/audio_effects_presets_api/inc/AudioEqualizerUtility.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2006 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:  This is the definition of the audio equalizer utility class.
    15 *
    16 */
    17 
    18 
    19 
    20 #ifndef CAUDIOEQUALIZERUTILITY_H
    21 #define CAUDIOEQUALIZERUTILITY_H
    22 
    23 //  INCLUDES
    24 #include <e32base.h>
    25 #include <e32svr.h>
    26 #include <AudioEqualizerBase.h>
    27 #include <BassBoostBase.h>
    28 #include <centralrepository.h>
    29 #include <AudioEqualizerUtilityData.h>
    30 
    31 // FORWARD DECLARATIONS
    32 class TEfAudioEqualizerUtilityPreset;
    33 class CAudioEqualizer;
    34 class CBassBoost;
    35 class CMdaAudioConvertUtility;
    36 class CMdaAudioPlayerUtility;
    37 class CMdaAudioRecorderUtility;
    38 class CMdaAudioInputStream;
    39 class CMdaAudioOutputStream;
    40 class CMdaAudioToneUtility;
    41 class CCustomCommandUtility;
    42 class CCustomInterfaceUtility;
    43 class CMMFDevSound;
    44 class CRepository;
    45 class CMidiClientUtility;
    46 class CDrmPlayerUtility;
    47 class CVideoPlayerUtility;
    48 
    49 // CLASS DECLARATION
    50 
    51 /**
    52 *  This is the Equalizer Utility class for managing audio equalizer presets.
    53 *
    54 *  @lib AudioEqualizerUtility.lib
    55 *  @since 3.0
    56 */
    57 
    58 class CAudioEqualizerUtility : public CBase
    59     {
    60     public:  // Constructors and destructor
    61 
    62 
    63         /**
    64 		* Factory function for creating the audio equalizer utility object.
    65 		* @since 3.0
    66 		* @param aUtility A reference to a Devsound Instance
    67 		* @return pointer to CAudioEqualizerUtility object
    68         */
    69         IMPORT_C static CAudioEqualizerUtility* NewL(CMMFDevSound& aDevSound);
    70 
    71 		/**
    72         * Factory function for creating the audio equalizer utility object.
    73         * @since 3.0
    74         * @param aUtility A reference to a convert utility
    75         * @return pointer to CAudioEqualizerUtility object
    76         */
    77 		IMPORT_C static CAudioEqualizerUtility* NewL(CMdaAudioConvertUtility& aUtility);
    78 
    79 		/**
    80         * Factory function for creating the audio equalizer utility object.
    81         * @since 3.0
    82         * @param aUtility A reference to a audio input stream utility
    83         * @return pointer to CAudioEqualizerUtility object
    84         */
    85 		IMPORT_C static CAudioEqualizerUtility* NewL(CMdaAudioInputStream& aUtility);
    86 
    87 		/**
    88 		* Factory function for creating the audio equalizer utility object.
    89 		* @since 3.0
    90 		* @param aUtility A reference to a audio output stream utility
    91 		* @return pointer to CAudioEqualizerUtility object
    92         */
    93 		IMPORT_C static CAudioEqualizerUtility* NewL(CMdaAudioOutputStream& aUtility);
    94 
    95 		/**
    96 		* Factory function for creating the audio equalizer utility object.
    97 		* @since 3.0
    98 		* @param aUtility A reference to a audio player utility
    99 		* @return pointer to CAudioEqualizerUtility object
   100         */
   101 		IMPORT_C static CAudioEqualizerUtility* NewL(CMdaAudioPlayerUtility& aUtility);
   102 
   103 		/**
   104 		* Factory function for creating the audio equalizer utility object.
   105 		* @since 3.0
   106 		* @param aUtility A reference to a audio recorder utility
   107 		* @return pointer to CAudioEqualizerUtility object
   108         */
   109 		IMPORT_C static CAudioEqualizerUtility* NewL(CMdaAudioRecorderUtility& aUtility);
   110 
   111 		/**
   112 		* Factory function for creating the audio equalizer utility object.
   113 		* @since 3.0
   114 		* @param aUtility A reference to a audio tone utility
   115 		* @return pointer to CAudioEqualizerUtility object
   116         */
   117 		IMPORT_C static CAudioEqualizerUtility* NewL(CMdaAudioToneUtility& aUtility);
   118 
   119 		/**
   120 		* Factory function for creating the audio equalizer utility object.
   121 		* @since 3.0
   122 		* @param aUtility A reference to custom command utility
   123 		* @return pointer to CAudioEqualizerUtility object
   124         */
   125 		IMPORT_C static CAudioEqualizerUtility* NewL(CCustomCommandUtility* aUtility);
   126 
   127 		/**
   128 		* Factory function for creating the audio equalizer utility object.
   129 		* @since 3.0
   130 		* @param aUtility A reference to custom interface utility
   131 		* @return pointer to CAudioEqualizerUtility object
   132         */
   133 		IMPORT_C static CAudioEqualizerUtility* NewL(MCustomInterface& aCustomInterface);
   134 		
   135 		/**
   136 		* Factory function for creating the audio equalizer utility object.
   137 		* @since 3.0
   138 		* @param aUtility A reference to CMidiClientUtility
   139 		* @return pointer to CAudioEqualizerUtility object
   140         */
   141 		IMPORT_C static CAudioEqualizerUtility* NewL(CMidiClientUtility& aUtility);
   142 		
   143 		/**
   144         * Factory function for creating the audio equalizer object.
   145         * @since 3.0
   146         * @param CDrmPlayerUtility A reference to a CDrmPlayerUtility object
   147         * @return pointer to CAudioEqualizer object
   148         */		
   149 		IMPORT_C static CAudioEqualizerUtility* NewL( CDrmPlayerUtility& aUtility );
   150 
   151 		/**
   152         * Factory function for creating the audio equalizer object.
   153         * @since 3.2
   154         * @param CVideoPlayerUtility A reference to a CVideoPlayerUtility object
   155         * @return pointer to CAudioEqualizer object
   156         */		
   157 		IMPORT_C static CAudioEqualizerUtility* NewL( CVideoPlayerUtility& aUtility );
   158 
   159 		 /**
   160         * Destructor.
   161         */
   162         virtual ~CAudioEqualizerUtility();
   163 
   164 		/**
   165         * Apply the Preset Index value
   166         * @since 3.0
   167         * @param aPreset Preset Value
   168         */
   169 		IMPORT_C void ApplyPresetL(TInt aPreset);
   170 
   171 		/**
   172         * Disable the Equalizer
   173         * @since 3.0
   174         */
   175 		IMPORT_C void DisableEqualizerL();
   176 
   177 		/**
   178         * Create a Preset with the given Name and Equalizer Settings
   179         * @since 3.0
   180         * @param aName Name of the Preset
   181         * @param aAudioEqualizer Equalizer Settings for the Preset
   182         */
   183 		IMPORT_C void CreatePresetL(TDesC& aName, CAudioEqualizer& aAudioEqualizerUI);
   184 
   185 		/**
   186         * Delete a Preset with the given index in the Central Repository
   187         * @since 3.0
   188         * @param aPresetIndex Index of the Preset in the Array
   189         */
   190 		IMPORT_C void DeletePresetL(TInt aPresetIndex);
   191 
   192 		/**
   193         * Retrieves a Preset with the given index from the Central Repository
   194         * @since 3.0
   195         * @param aPresetIndex Index of the Preset in the Array
   196         */
   197 		IMPORT_C  const TDesC& GetPresetL(TInt aPresetIndex);
   198 
   199 		/**
   200         * Get the reference to the Equalizer Object
   201         * @since 3.0
   202         * @return Reference to the Equalizer Object.
   203         */
   204 		IMPORT_C CAudioEqualizer& Equalizer();
   205 
   206 		/**
   207 		* Get the reference to the BassBoost Object
   208 		* @since 3.0
   209 		* @return Reference to the CBassBoost Object.
   210 		*/
   211 		IMPORT_C CBassBoost& BassBoost();
   212 
   213 		/**
   214         * Modify a Preset with the given Name and Equalizer Settings
   215         * @since 3.0
   216         * @param aPresetIndex Array Index of the Preset
   217         * @param aName Name of the Preset
   218         * @param aAudioEqualizer Equalizer Settings for the Preset
   219         */
   220 		IMPORT_C void ModifyPresetL(TInt aPresetIndex, TDesC& aName, CAudioEqualizer& aAudioEqualizerUI);
   221 
   222 		/**
   223         * Get the number of Pre Defined Presets
   224         * @since 3.0
   225         * @return Number of Pre Defined Presets
   226         */
   227 		IMPORT_C TUint32 NumberOfPreDefinedPresets() const;
   228 
   229 		/**
   230         * Get all the Presets defined in the Central Repository
   231         * @since 3.0
   232         * @return Array of all Presets.
   233         */
   234 		IMPORT_C TArray<TEfAudioEqualizerUtilityPreset> Presets();
   235 
   236 		/**
   237 		 * Reset a System Defined Preset with the given index in the Array returned from Presets()
   238 		 * @since 3.0
   239 		 * @param aPresetIndex Index of the Preset in the Array
   240 		 */
   241 		IMPORT_C void ResetPresetL(TInt aPresetIndex);
   242 
   243     private:
   244 
   245         /**
   246         * C++ default constructor.
   247         */
   248         CAudioEqualizerUtility();
   249 
   250         /**
   251         * By default Symbian 2nd phase constructor is private.
   252         */
   253 
   254         /**
   255 		* Second Phase Costructor for DevSound Instance
   256 		* @since 3.0
   257 		* @param aDevSound DevSound Referece
   258 		*/
   259         void ConstructL(CMMFDevSound& aDevSound);
   260 
   261 		/**
   262 		* Second Phase Costructor for Audio Convert Utility
   263 		* @since 3.0
   264 		* @param aUtility CMdaAudioConvertUtility Referece
   265 		*/
   266 		void ConstructL(CMdaAudioConvertUtility& aUtility);
   267 
   268 		/**
   269 		* Second Phase Costructor for CMdaAudioInputStream
   270 		* @since 3.0
   271 		* @param aUtility CMdaAudioInputStream Referece
   272 		*/
   273 		void ConstructL(CMdaAudioInputStream& aUtility);
   274 
   275 		/**
   276 		* Second Phase Costructor for CMdaAudioOutputStream
   277 		* @since 3.0
   278 		* @param aUtilityCMdaAudioOutputStream Referece
   279 		*/
   280 		void ConstructL(CMdaAudioOutputStream& aUtility);
   281 
   282 		/**
   283 		* Second Phase Costructor for CMdaAudioPlayerUtility
   284 		* @since 3.0
   285 		* @param aUtility CMdaAudioPlayerUtility Referece
   286 		*/
   287 		void ConstructL(CMdaAudioPlayerUtility& aUtility);
   288 
   289 		/**
   290 		* Second Phase Costructor for CMdaAudioRecordUtility
   291 		* @since 3.0
   292 		* @param aUtility CMdaAudioRecordUtility Referece
   293 		*/
   294 		void ConstructL(CMdaAudioRecorderUtility& aUtility);
   295 
   296 		/**
   297 		* Second Phase Costructor for CMdaAudioToneUtility
   298 		* @since 3.0
   299 		* @param aUtility CMdaAudioToneUtility Referece
   300 		*/
   301 		void ConstructL(CMdaAudioToneUtility& aUtility);
   302 
   303 		/**
   304 		* Second Phase Costructor for MCustomCommand
   305 		* @since 3.0
   306 		* @param aUtility MCustomCommand Referece
   307 		*/
   308 		void ConstructL(CCustomCommandUtility* aUtility);
   309 
   310 		/**
   311 		* Second Phase Costructor for MCustomInterface
   312 		* @since 3.0
   313 		* @param aUtility MCustomInterface Referece
   314 		*/
   315 		void ConstructL(MCustomInterface& aCustomInterface);
   316 
   317 		/**
   318 		* Second Phase Costructor for CMidiClientUtility
   319 		* @since 3.0
   320 		* @param aUtility CMidiClientUtility Referece
   321 		*/
   322 		void ConstructL(CMidiClientUtility& aUtility);
   323 		
   324 		/**
   325 		* Second Phase Costructor for CDrmPlayerUtility
   326 		* @since 3.0
   327 		* @param aUtility CDrmPlayerUtility Referece
   328 		*/
   329 		void ConstructL(CDrmPlayerUtility& aUtility);		
   330 
   331 		/**
   332 		* Second Phase Costructor for CVideoPlayerUtility
   333 		* @since 3.2
   334 		* @param aUtility CVideoPlayerUtility Referece
   335 		*/
   336 		void ConstructL(CVideoPlayerUtility& aUtility);		
   337 
   338 		/**
   339 		* Function for Updating the Array from the Central Repository
   340 		* @since 3.0
   341 		* @param aUtility MCustomInterface Referece
   342 		*/
   343 		void UpdateFullPresetArrayFromCenRep(RArray<TEfAudioEqualizerUtilityPreset> &aFullPresetArray);
   344 
   345 		/**
   346 		* Function of Updating the Preset Array for the User
   347 		* @since 3.0
   348 		* @param aUtility MCustomInterface Referece
   349 		*/
   350 		void UpdatePresetArray(RArray<TEfAudioEqualizerUtilityPreset>& aPresetArray,const RArray<TEfAudioEqualizerUtilityPreset> &aFullPresetArray);
   351 
   352 
   353 	private: // Data
   354 
   355 		// Array for Storing the Current State of the Repository
   356 		// which has been compacted after the transaction
   357 		// with the Central Repository
   358 		RArray<TEfAudioEqualizerUtilityPreset> iPresetArray;
   359 
   360 		// Array Which contains the full information from the
   361 		// Central Repository except the Description Values
   362 		RArray<TEfAudioEqualizerUtilityPreset> iFullPresetArray;
   363 
   364 		// Pointer to the Equalizer Object
   365 		CAudioEqualizer* iAudioEqualizer;
   366 
   367 		// Pointer to the Equalizer Object
   368 		// which is returned to the UI for Manipulation
   369 		CAudioEqualizer* iTransAudioEqualizer;
   370 
   371 		// Pointer to the Bass Boost Ojbect
   372 		CBassBoost* iBassBoost;
   373 
   374 		// Pointer to the Preset Repository
   375 		CRepository* iPresetRepository;
   376    };
   377 
   378 #endif      // CAUDIOEQUALIZERUTILITY_H
   379 
   380 // End of File