|
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: Group for effect controls |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <logger.h> |
|
21 #include "cammsemcaudiovirtualizerenvironmentalpresetutility.h" |
|
22 |
|
23 const TInt KAMMSEMCPresetGranularity = 5; |
|
24 |
|
25 |
|
26 |
|
27 // ============================ MEMBER FUNCTIONS =============================== |
|
28 // Constructors |
|
29 |
|
30 CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility() |
|
31 { |
|
32 LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility:: constructor"); |
|
33 } |
|
34 |
|
35 // Destructor |
|
36 CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::~CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility() |
|
37 { |
|
38 delete iPresetNames; |
|
39 if (iEmptyStereoWideningUtility) |
|
40 { |
|
41 delete iEmptyStereoWideningUtility; |
|
42 iEmptyStereoWideningUtility = NULL; |
|
43 } |
|
44 LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::~ "); |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetAtIndexL |
|
49 // Gets the current preset. |
|
50 // (other items were commented in a header). |
|
51 // ----------------------------------------------------------------------------- |
|
52 void CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetAtIndexL(TDes& aPreset ,TInt iIndex) |
|
53 { |
|
54 LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetAtIndexL +"); |
|
55 // Return KNullDesC if no preset is set. |
|
56 if (iIndex >= 0) |
|
57 { |
|
58 |
|
59 TArray< TEfStereoWideningUtilityPreset > presetNames = |
|
60 iEmptyStereoWideningUtility->Presets(); |
|
61 aPreset = presetNames[ iIndex ].iPresetName ; |
|
62 |
|
63 } |
|
64 else |
|
65 { |
|
66 aPreset = KNullDesC; |
|
67 } |
|
68 |
|
69 LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetAtIndexL -"); |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::PrepareEmptyStereoWideningUtilitiesL |
|
74 // Creates utilities that can be used to obtain preset names and preset data. |
|
75 // (other items were commented in a header). |
|
76 // ----------------------------------------------------------------------------- |
|
77 void CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::PrepareEmptyStereoWideningUtilitiesL() |
|
78 { |
|
79 LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::PrepareEmptyStereoWideningUtilitiesL +"); |
|
80 //Calling base class function to create and initialize the CMMFDevSound |
|
81 CreateAndInitializeDevSoundL(); |
|
82 if (!iEmptyStereoWideningUtility) |
|
83 { |
|
84 iEmptyStereoWideningUtility = |
|
85 CStereoWideningUtility::NewL(*iMMFDevSound); |
|
86 } |
|
87 |
|
88 LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::PrepareEmptyStereoWideningUtilitiesL -"); |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::DeleteEmptyStereoWideningUtilities |
|
93 // Deletes utilities that are used to obtain preset names and preset data. |
|
94 // (other items were commented in a header). |
|
95 // ----------------------------------------------------------------------------- |
|
96 void CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::DeleteEmptyStereoWideningUtilities() |
|
97 { |
|
98 LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::DeleteEmptyStereoWideningUtilities +"); |
|
99 |
|
100 if (iEmptyStereoWideningUtility) |
|
101 { |
|
102 delete iEmptyStereoWideningUtility; |
|
103 iEmptyStereoWideningUtility = NULL; |
|
104 } |
|
105 //Calling base class function to delete CMMFDevSound object to free memory |
|
106 DeleteDevSound(); |
|
107 LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::DeleteEmptyStereoWideningUtilities -"); |
|
108 } |
|
109 |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetNamesL |
|
113 // Gets list of preset names available. |
|
114 // (other items were commented in a header). |
|
115 // ----------------------------------------------------------------------------- |
|
116 void CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetNamesL( |
|
117 CDesCArray& aPresetNames) |
|
118 { |
|
119 LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetNamesL +"); |
|
120 TArray< TEfStereoWideningUtilityPreset > presetNames = |
|
121 iEmptyStereoWideningUtility->Presets(); |
|
122 TInt presetCount = presetNames.Count(); |
|
123 for (TInt i = 0; i < presetCount; i++) |
|
124 { |
|
125 aPresetNames.AppendL(presetNames[ i ].iPresetName); |
|
126 } |
|
127 LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetPresetNamesL -"); |
|
128 } |
|
129 |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetEnvironmentalStereoWideningAtPresetIndexL |
|
133 // Gets list of preset names available. |
|
134 // (other items were commented in a header). |
|
135 // ----------------------------------------------------------------------------- |
|
136 CStereoWidening * CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetStereoWideningAtPresetIndexL(TInt iIndex) |
|
137 { |
|
138 LOG1( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::GetStereoWideningAtPresetIndexL, index=%d", |
|
139 iIndex); |
|
140 |
|
141 __ASSERT_DEBUG(iIndex >= 0, User::Invariant()); |
|
142 |
|
143 // Set the preset to the empty Environmental Reverb utility. |
|
144 iEmptyStereoWideningUtility->GetPresetL(iIndex); |
|
145 return &(iEmptyStereoWideningUtility->StereoWidening()); |
|
146 } |
|
147 |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::ConstructL |
|
151 // Symbian 2nd phase constructor can leave. |
|
152 // (other items were commented in a header). |
|
153 // ----------------------------------------------------------------------------- |
|
154 void CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::ConstructL() |
|
155 { |
|
156 iPresetNames = new(ELeave)CDesCArrayFlat(KAMMSEMCPresetGranularity); |
|
157 CAMMSEMCBaseMMFDevSound ::ConstructL(); |
|
158 LOG( EJavaAMMS, EInfo, "AMMS::CAMMSEMCAudioVirtualizerEnvironmentalPresetUtility::ConstructL"); |
|
159 } |
|
160 |
|
161 // End of File |