|
1 /* |
|
2 * Copyright (c) 2004 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: Effects console test |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef EFFECTSCONSOLETEST |
|
22 #define EFFECTSCONSOLETEST |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32svr.h> |
|
26 #include <e32base.h> |
|
27 #include <e32cons.h> |
|
28 #include <mdaaudiosampleplayer.h> |
|
29 #include <MdaAudioSampleEditor.h> |
|
30 |
|
31 #include <AudioEffectBase.h> |
|
32 #include <MAudioEffectObserver.h> |
|
33 #include <AudioEqualizerBase.h> |
|
34 #include <MAudioEqualizerObserver.h> |
|
35 #include <EnvironmentalReverbBase.h> |
|
36 #include <MEnvironmentalReverbObserver.h> |
|
37 #include <StereoWideningBase.h> |
|
38 #include <MStereoWideningObserver.h> |
|
39 |
|
40 #include <customInterfaceUtility.h> |
|
41 |
|
42 _LIT(KAMRTestFile,"c:\\test.amr"); |
|
43 _LIT(KWAVTestFile,"c:\\test.wav"); |
|
44 |
|
45 |
|
46 ////////////////////////////////////////////////////////////////////////////// |
|
47 // |
|
48 // -----> CmyActiveScheduler (definition) |
|
49 // |
|
50 ////////////////////////////////////////////////////////////////////////////// |
|
51 class CmyActiveScheduler : public CActiveScheduler |
|
52 { |
|
53 public: |
|
54 void Error (TInt aError) const; |
|
55 }; |
|
56 |
|
57 |
|
58 ////////////////////////////////////////////////////////////////////////////// |
|
59 // |
|
60 // -----> CActiveConsole (definition) |
|
61 // |
|
62 // An abstract class which provides the facility to issue key requests. |
|
63 // |
|
64 ////////////////////////////////////////////////////////////////////////////// |
|
65 class CActiveConsole : public CActive |
|
66 { |
|
67 public: |
|
68 // Construction |
|
69 CActiveConsole(CConsoleBase* aConsole); |
|
70 void ConstructL(); |
|
71 static CActiveConsole* NewLC(CConsoleBase* aConsole) ; |
|
72 ~CActiveConsole(); |
|
73 |
|
74 // Issue request |
|
75 void RequestCharacter(); |
|
76 |
|
77 // Cancel request. |
|
78 // Defined as pure virtual by CActive; |
|
79 // implementation provided by this class. |
|
80 void DoCancel(); |
|
81 |
|
82 // Service completed request. |
|
83 // Defined as pure virtual by CActive; |
|
84 // implementation provided by this class, |
|
85 void RunL(); |
|
86 |
|
87 // Called from RunL() - an implementation must be provided |
|
88 // by derived classes to handle the completed request |
|
89 virtual void ProcessKeyPress(TChar aChar) = 0; |
|
90 |
|
91 protected: |
|
92 // Data members defined by this class |
|
93 CConsoleBase* iConsole; // A console for reading from |
|
94 }; |
|
95 |
|
96 ////////////////////////////////////////////////////////////////////////////// |
|
97 // |
|
98 // -----> CConsoleTest (definition) |
|
99 // |
|
100 // This class is derived from CActiveConsole. |
|
101 // Request handling: accepts input from the keyboard and outputs the |
|
102 // test result through test harness. |
|
103 // |
|
104 ////////////////////////////////////////////////////////////////////////////// |
|
105 class CConsoleTest : public CActiveConsole, |
|
106 public MMdaAudioPlayerCallback, |
|
107 public MMdaObjectStateChangeObserver, |
|
108 public MAudioEffectObserver |
|
109 //public MAudioEqualizerObserver |
|
110 { |
|
111 public: |
|
112 |
|
113 enum TMenu |
|
114 { |
|
115 EMain, |
|
116 EPlay, |
|
117 ERecord, |
|
118 EConvert, |
|
119 EEqualizer, |
|
120 EBandId, |
|
121 EBandLevel, |
|
122 EEnvironmentalReverb1, |
|
123 EEnvironmentalReverb2, |
|
124 EStereoWidening, |
|
125 EStereoWideningLevel |
|
126 |
|
127 }; |
|
128 |
|
129 // Destruction |
|
130 ~CConsoleTest(); |
|
131 |
|
132 public: |
|
133 // Static constuction |
|
134 static CConsoleTest *NewLC (CConsoleBase* aConsole); |
|
135 static CConsoleTest *NewL(CConsoleBase* aConsole); |
|
136 |
|
137 virtual void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); |
|
138 virtual void MapcPlayComplete(TInt aError); |
|
139 virtual void MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorcCode); |
|
140 virtual void EffectChanged( const CAudioEffect* aAudioEffect, TUint8 aEvent ); |
|
141 |
|
142 public: |
|
143 // Service request |
|
144 void ProcessKeyPress(TChar aChar); |
|
145 void ShowMenu(); |
|
146 |
|
147 private: |
|
148 |
|
149 void ConstructL(); |
|
150 CConsoleTest(CConsoleBase* aConsole); |
|
151 void ProcessMain(TChar aChar); |
|
152 void ProcessPlayL(TChar aChar); |
|
153 void ProcessEqualizerL(TChar aChar); |
|
154 void ProcessBandId(TChar aChar); |
|
155 void ProcessBandLevelL(TChar aChar); |
|
156 void InitializeTestData(); |
|
157 void ProcessEnvironmentalReverbL(TChar aChar); |
|
158 void TestCase1(); |
|
159 void TestCase2(); |
|
160 void TestCase3(); |
|
161 void ProcessStereoWideningL(TChar aChar); |
|
162 void ProcessStereoWideningLevelL(TChar aChar); |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 private: |
|
168 |
|
169 TInt iInitStatus; |
|
170 |
|
171 TMenu iMenu; |
|
172 TMenu iParentMenu; |
|
173 TUint32 iBandId; |
|
174 CCustomInterfaceUtility* iCIUtility; |
|
175 |
|
176 CMdaAudioPlayerUtility* iAudioPlayer; |
|
177 CAudioEqualizer* iPlayerAudioEqualizer; |
|
178 CEnvironmentalReverb* iPlayerEnvironmentalReverb; |
|
179 CStereoWidening* iPlayerStereoWidening; |
|
180 |
|
181 CMdaAudioRecorderUtility* iAudioRecorder; |
|
182 CAudioEqualizer* iRecorderAudioEqualizer; |
|
183 CEnvironmentalReverb* iRecorderEnvironmentalReverb; |
|
184 CStereoWidening* iRecorderStereoWidening; |
|
185 |
|
186 CMdaAudioConvertUtility* iAudioConverter; |
|
187 |
|
188 CAudioEqualizer* iEqualizer; |
|
189 CEnvironmentalReverb* iEnvironmentalReverb; |
|
190 CStereoWidening* iStereoWidening; |
|
191 |
|
192 |
|
193 CAudioEqualizer* iAudioEqualizer; |
|
194 |
|
195 TBuf<100> iSampleFilePath; |
|
196 |
|
197 RFs iFs; |
|
198 |
|
199 RArray<TInt> iGoodData; |
|
200 RArray<TInt> iBadData; |
|
201 |
|
202 }; |
|
203 |
|
204 ////////////////////////////////////////////////////////////////////////////// |
|
205 // |
|
206 // Main |
|
207 // |
|
208 ////////////////////////////////////////////////////////////////////////////// |
|
209 |
|
210 _LIT(KTxtDBTest, "Effects Console Test"); |
|
211 |
|
212 LOCAL_C void doTestL(); |
|
213 |
|
214 GLDEF_C TInt E32Main() // main function called by E32 |
|
215 { |
|
216 __UHEAP_MARK; |
|
217 CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack |
|
218 TRAPD(error, doTestL()); |
|
219 __ASSERT_ALWAYS(!error,User::Panic(KTxtDBTest, error)); |
|
220 delete cleanup; // destroy clean-up stack |
|
221 __UHEAP_MARKEND; |
|
222 return 0; // and return |
|
223 } |
|
224 |
|
225 #endif |