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