mpviewplugins/mpplaybackviewplugin/tsrc/unittest_mpequalizerwrapper/stub/src/audioequalizerutility.cpp
branchGCC_SURGE
changeset 44 eff9df3d9c98
parent 30 b95ddb5a0d10
parent 42 79c49924ae23
equal deleted inserted replaced
30:b95ddb5a0d10 44:eff9df3d9c98
     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:   Stub Utility to Access the Equalizer Effect
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <e32std.h>
       
    22 #include "stub/inc/audioequalizerutility.h"
       
    23 #include "mptrace.h"
       
    24 
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 CAudioEqualizerUtility::CAudioEqualizerUtility()
       
    29 	{
       
    30     }
       
    31 
       
    32 
       
    33 // Destructor
       
    34 CAudioEqualizerUtility::~CAudioEqualizerUtility()
       
    35     {
       
    36 		iPresetArray.Close();
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------------------------
       
    40 // CAudioEqualizerUtility::ConstructL
       
    41 // Symbian 2nd phase constructor can leave.
       
    42 // -----------------------------------------------------------------------------
       
    43 //
       
    44 void CAudioEqualizerUtility::ConstructL(CMdaAudioPlayerUtility& /*aUtility*/)
       
    45     {
       
    46 		UpdatePresetArray(iPresetArray);
       
    47 	}
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CAudioEqualizerUtility::NewL
       
    51 // Two-phased constructor.
       
    52 // -----------------------------------------------------------------------------
       
    53 //
       
    54 CAudioEqualizerUtility* CAudioEqualizerUtility::NewL(CMdaAudioPlayerUtility& aUtility)
       
    55     {
       
    56 		CAudioEqualizerUtility* self = new( ELeave ) CAudioEqualizerUtility;
       
    57 		CleanupStack::PushL( self );
       
    58 		self->ConstructL(aUtility);
       
    59 		CleanupStack::Pop(self);
       
    60 		return self;
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CAudioEqualizerUtility::ApplyPresetL()
       
    65 // Applies the Preset to the Equalizer Object
       
    66 // (other items were commented in a header).
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 void CAudioEqualizerUtility::ApplyPresetL(
       
    70     TInt /*aPresetIndex*/)
       
    71     {
       
    72     }
       
    73 
       
    74 // -----------------------------------------------------------------------------
       
    75 // CAudioEqualizerUtility::GetPresetL()
       
    76 // Gets the Preset from the Central Repository
       
    77 // (other items were commented in a header).
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 const TDesC& CAudioEqualizerUtility::GetPresetL(
       
    81     TInt aPresetIndex)
       
    82     {
       
    83     TX_ENTRY
       
    84 
       
    85 		if(aPresetIndex > (iPresetArray.Count() - 1) || aPresetIndex < 0 )
       
    86 		{
       
    87 			User::Leave(KErrArgument);
       
    88 		}
       
    89 
       
    90 		return iPresetArray[aPresetIndex].iPresetName;
       
    91 
       
    92     TX_EXIT
       
    93     }
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // CAudioEqualizerUtility::DisablePresetL()
       
    97 // Disable the Preset
       
    98 // (other items were commented in a header).
       
    99 // -----------------------------------------------------------------------------
       
   100 //
       
   101 
       
   102 void CAudioEqualizerUtility::DisableEqualizerL()
       
   103 {
       
   104 }
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // CAudioEqualizerUtility::Presets()
       
   108 // Applies the Preset to the Equalizer Object
       
   109 // (other items were commented in a header).
       
   110 // -----------------------------------------------------------------------------
       
   111 //
       
   112 TArray<TEfAudioEqualizerUtilityPreset> CAudioEqualizerUtility::Presets()
       
   113     {
       
   114 		return iPresetArray.Array();
       
   115     }
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // CAudioEqualizerUtility::UpdatePresetArray(RArray<TDesC>& aPresetArray,const RArray<TEfAudioEqualizerUtilityPreset> &aFullPresetArray)
       
   119 // Creates the Descriptor Array of Names of the predifined presets
       
   120 // (other items were commented in a header).
       
   121 // -----------------------------------------------------------------------------
       
   122 //
       
   123 void CAudioEqualizerUtility::UpdatePresetArray(RArray<TEfAudioEqualizerUtilityPreset>& aPresetArray)
       
   124 	{
       
   125 
       
   126 		aPresetArray.Reset();
       
   127 		
       
   128 		TEfAudioEqualizerUtilityPreset	tempPreset1;		
       
   129 		tempPreset1.iPresetDescriptionKey = 0x10;
       
   130 		tempPreset1.iPresetName = _L("Bass");
       
   131 		tempPreset1.iPresetNameKey = 0x0A;
       
   132 		aPresetArray.Append(tempPreset1);
       
   133 		
       
   134         TEfAudioEqualizerUtilityPreset  tempPreset2;        
       
   135         tempPreset2.iPresetDescriptionKey = 0x20;
       
   136         tempPreset2.iPresetName = _L("Classical");
       
   137         tempPreset2.iPresetNameKey = 0x0B;
       
   138         aPresetArray.Append(tempPreset2);
       
   139 
       
   140         TEfAudioEqualizerUtilityPreset  tempPreset3;        
       
   141         tempPreset3.iPresetDescriptionKey = 0x30;
       
   142         tempPreset3.iPresetName = _L("Pop");
       
   143         tempPreset3.iPresetNameKey = 0x0C;
       
   144         aPresetArray.Append(tempPreset3);
       
   145         
       
   146         TEfAudioEqualizerUtilityPreset  tempPreset4;        
       
   147         tempPreset4.iPresetDescriptionKey = 0x40;
       
   148         tempPreset4.iPresetName = _L("Jazz");
       
   149         tempPreset4.iPresetNameKey = 0x0D;
       
   150         aPresetArray.Append(tempPreset4);
       
   151 
       
   152         TEfAudioEqualizerUtilityPreset  tempPreset5;        
       
   153         tempPreset5.iPresetDescriptionKey = 0x50;
       
   154         tempPreset5.iPresetName = _L("Rock");
       
   155         tempPreset5.iPresetNameKey = 0x0E;
       
   156         aPresetArray.Append(tempPreset5);
       
   157 	}
       
   158 
       
   159 //  End of File