0
|
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 implementation
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
#include "EffectConsoleTest.h"
|
|
21 |
|
|
22 |
_LIT(KNewLine,"\n");
|
|
23 |
|
|
24 |
//////////////////////////////////////////////////////////////////////////////
|
|
25 |
//
|
|
26 |
// -----> CmyActiveScheduler (implementation)
|
|
27 |
//
|
|
28 |
//////////////////////////////////////////////////////////////////////////////
|
|
29 |
void CmyActiveScheduler::Error(TInt aError) const
|
|
30 |
{
|
|
31 |
_LIT(KMsgSchedErr,"CmyActiveScheduler-error");
|
|
32 |
User::Panic(KMsgSchedErr,aError);
|
|
33 |
}
|
|
34 |
|
|
35 |
|
|
36 |
//////////////////////////////////////////////////////////////////////////////
|
|
37 |
//
|
|
38 |
// -----> CActiveConsole (implementation)
|
|
39 |
//
|
|
40 |
//////////////////////////////////////////////////////////////////////////////
|
|
41 |
CActiveConsole::CActiveConsole( CConsoleBase* aConsole)
|
|
42 |
: CActive(CActive::EPriorityStandard)
|
|
43 |
// Construct high-priority active object
|
|
44 |
{
|
|
45 |
iConsole = aConsole;
|
|
46 |
}
|
|
47 |
|
|
48 |
void CActiveConsole::ConstructL()
|
|
49 |
{
|
|
50 |
// Add to active scheduler
|
|
51 |
CActiveScheduler::Add(this);
|
|
52 |
}
|
|
53 |
|
|
54 |
CActiveConsole::~CActiveConsole()
|
|
55 |
{
|
|
56 |
// Make sure we're cancelled
|
|
57 |
Cancel();
|
|
58 |
}
|
|
59 |
|
|
60 |
void CActiveConsole::DoCancel()
|
|
61 |
{
|
|
62 |
iConsole->ReadCancel();
|
|
63 |
}
|
|
64 |
|
|
65 |
void CActiveConsole::RunL()
|
|
66 |
{
|
|
67 |
// Handle completed request
|
|
68 |
ProcessKeyPress(TChar(iConsole->KeyCode()));
|
|
69 |
}
|
|
70 |
|
|
71 |
void CActiveConsole::RequestCharacter()
|
|
72 |
{
|
|
73 |
// A request is issued to the CConsoleBase to accept a
|
|
74 |
// character from the keyboard.
|
|
75 |
iConsole->Read(iStatus);
|
|
76 |
SetActive();
|
|
77 |
}
|
|
78 |
|
|
79 |
|
|
80 |
//////////////////////////////////////////////////////////////////////////////
|
|
81 |
//
|
|
82 |
// -----> CWriteKeyProcessor (implementation)
|
|
83 |
//
|
|
84 |
//////////////////////////////////////////////////////////////////////////////
|
|
85 |
CConsoleTest::CConsoleTest(CConsoleBase* aConsole)
|
|
86 |
: CActiveConsole(aConsole),
|
|
87 |
iMenu(EMain)
|
|
88 |
{
|
|
89 |
iEqualizer = NULL;
|
|
90 |
iEnvironmentalReverb = NULL;
|
|
91 |
iStereoWidening = NULL;
|
|
92 |
iInitStatus = -1;
|
|
93 |
};
|
|
94 |
|
|
95 |
CConsoleTest::~CConsoleTest()
|
|
96 |
{
|
|
97 |
RDebug::Print(_L("CConsoleTest::~CConsoleTest\n"));
|
|
98 |
// Make sure we're cancelled
|
|
99 |
Cancel();
|
|
100 |
|
|
101 |
delete iPlayerAudioEqualizer;
|
|
102 |
delete iPlayerEnvironmentalReverb;
|
|
103 |
delete iPlayerStereoWidening;
|
|
104 |
delete iRecorderAudioEqualizer;
|
|
105 |
delete iRecorderEnvironmentalReverb;
|
|
106 |
delete iRecorderStereoWidening;
|
|
107 |
|
|
108 |
delete iCIUtility;
|
|
109 |
|
|
110 |
delete iAudioPlayer;
|
|
111 |
delete iAudioRecorder;
|
|
112 |
delete iAudioConverter;
|
|
113 |
|
|
114 |
iGoodData.Close();
|
|
115 |
iBadData.Close();
|
|
116 |
|
|
117 |
iFs.Close();
|
|
118 |
|
|
119 |
}
|
|
120 |
|
|
121 |
void CConsoleTest::ConstructL()
|
|
122 |
{
|
|
123 |
User::LeaveIfError(iFs.Connect());
|
|
124 |
|
|
125 |
iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(KAMRTestFile, *this);
|
|
126 |
//iAudioRecorder = CMdaAudioRecorderUtility::NewL(*this);
|
|
127 |
//iAudioConverter = CMdaAudioConvertUtility::NewL(*this);
|
|
128 |
|
|
129 |
//iAudioPlayer->OpenFileL(KWAVTestFile);
|
|
130 |
|
|
131 |
// Add to active scheduler
|
|
132 |
CActiveScheduler::Add(this);
|
|
133 |
InitializeTestData();
|
|
134 |
}
|
|
135 |
|
|
136 |
CConsoleTest* CConsoleTest::NewLC(CConsoleBase* aConsole)
|
|
137 |
{
|
|
138 |
CConsoleTest* self=new (ELeave) CConsoleTest(aConsole);
|
|
139 |
CleanupStack::PushL(self);
|
|
140 |
self->ConstructL();
|
|
141 |
return self;
|
|
142 |
}
|
|
143 |
|
|
144 |
CConsoleTest* CConsoleTest::NewL(CConsoleBase* aConsole)
|
|
145 |
{
|
|
146 |
CConsoleTest* self=NewLC(aConsole);
|
|
147 |
CleanupStack::Pop();
|
|
148 |
return self;
|
|
149 |
}
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
void CConsoleTest::ProcessKeyPress(TChar aChar)
|
|
154 |
{
|
|
155 |
// iConsole->Printf(_L("You pressed: %d\n"), (TUint) aChar);
|
|
156 |
|
|
157 |
// if key is ESC
|
|
158 |
// cancel any outstanding request
|
|
159 |
// stop the scheduler
|
|
160 |
TInt err(KErrNone);
|
|
161 |
#ifdef __WINS__
|
|
162 |
if (aChar == EKeyEscape)
|
|
163 |
#else
|
|
164 |
if (aChar == ' ')
|
|
165 |
#endif
|
|
166 |
{
|
|
167 |
Cancel();
|
|
168 |
CActiveScheduler::Stop();
|
|
169 |
return;
|
|
170 |
}
|
|
171 |
|
|
172 |
if (aChar == EKeyEnter)
|
|
173 |
{
|
|
174 |
iConsole->Printf(KNewLine);
|
|
175 |
// Issue another request
|
|
176 |
RequestCharacter();
|
|
177 |
return;
|
|
178 |
}
|
|
179 |
|
|
180 |
#ifdef __WINS__
|
|
181 |
if (aChar == '?')
|
|
182 |
#else
|
|
183 |
if (aChar == '7')
|
|
184 |
#endif
|
|
185 |
{
|
|
186 |
ShowMenu();
|
|
187 |
// Issue another request
|
|
188 |
RequestCharacter();
|
|
189 |
return;
|
|
190 |
}
|
|
191 |
|
|
192 |
switch (iMenu)
|
|
193 |
{
|
|
194 |
case EMain:
|
|
195 |
ProcessMain(aChar);
|
|
196 |
break;
|
|
197 |
|
|
198 |
case EPlay:
|
|
199 |
TRAP(err,ProcessPlayL(aChar));
|
|
200 |
break;
|
|
201 |
|
|
202 |
case ERecord:
|
|
203 |
//ProcessRecord(aChar);
|
|
204 |
break;
|
|
205 |
|
|
206 |
case EEqualizer:
|
|
207 |
TRAP(err,ProcessEqualizerL(aChar));
|
|
208 |
break;
|
|
209 |
|
|
210 |
case EBandId:
|
|
211 |
ProcessBandId(aChar);
|
|
212 |
break;
|
|
213 |
|
|
214 |
case EBandLevel:
|
|
215 |
TRAP(err,ProcessBandLevelL(aChar));
|
|
216 |
break;
|
|
217 |
|
|
218 |
case EEnvironmentalReverb1:
|
|
219 |
TRAP(err,ProcessEnvironmentalReverbL(aChar));
|
|
220 |
break;
|
|
221 |
|
|
222 |
case EEnvironmentalReverb2:
|
|
223 |
break;
|
|
224 |
|
|
225 |
case EStereoWideningLevel:
|
|
226 |
TRAP(err,ProcessStereoWideningLevelL(aChar));
|
|
227 |
break;
|
|
228 |
|
|
229 |
case EStereoWidening:
|
|
230 |
TRAP(err,ProcessStereoWideningL(aChar));
|
|
231 |
break;
|
|
232 |
|
|
233 |
|
|
234 |
default:
|
|
235 |
iConsole->Printf(_L("ProcessKeyPress - Unknown function\n"));
|
|
236 |
// Issue another request
|
|
237 |
RequestCharacter();
|
|
238 |
break;
|
|
239 |
}
|
|
240 |
}
|
|
241 |
|
|
242 |
|
|
243 |
void CConsoleTest::ShowMenu()
|
|
244 |
{
|
|
245 |
iConsole->ClearScreen();
|
|
246 |
switch (iMenu)
|
|
247 |
{
|
|
248 |
case EMain:
|
|
249 |
iConsole->Printf(_L("1: Player\n"));
|
|
250 |
iConsole->Printf(_L("2: Recorder\n"));
|
|
251 |
iConsole->Printf(_L("3: Converter\n"));
|
|
252 |
iConsole->Printf(_L("9: Exit\n"));
|
|
253 |
break;
|
|
254 |
|
|
255 |
case EPlay:
|
|
256 |
case ERecord:
|
|
257 |
case EConvert:
|
|
258 |
iConsole->Printf(_L("0: Main Menu\n"));
|
|
259 |
iConsole->Printf(_L("1: Equalizer\n"));
|
|
260 |
iConsole->Printf(_L("2: Env Reverb\n"));
|
|
261 |
iConsole->Printf(_L("3: StereoWidening\n"));
|
|
262 |
|
|
263 |
break;
|
|
264 |
|
|
265 |
case EEqualizer:
|
|
266 |
iConsole->Printf(_L("0: Main Menu\n"));
|
|
267 |
iConsole->Printf(_L("1: Enable/Disable\n"));
|
|
268 |
iConsole->Printf(_L("2: Toggle Enforce\n"));
|
|
269 |
iConsole->Printf(_L("3: Set Band Level\n"));
|
|
270 |
iConsole->Printf(_L("4: Show Equalizer info\n"));
|
|
271 |
iConsole->Printf(_L("5: Show Band info\n"));
|
|
272 |
iConsole->Printf(_L("6: Apply Settings\n"));
|
|
273 |
iConsole->Printf(_L("9: Delete Equalizer\n"));
|
|
274 |
break;
|
|
275 |
|
|
276 |
case EBandLevel:
|
|
277 |
iConsole->Printf(_L("0: Equalizer Menu\n"));
|
|
278 |
iConsole->Printf(_L("1: Band Level Up\n"));
|
|
279 |
iConsole->Printf(_L("2: Band Level Down\n"));
|
|
280 |
iConsole->Printf(_L("3: Show Band info\n"));
|
|
281 |
break;
|
|
282 |
|
|
283 |
case EEnvironmentalReverb1:
|
|
284 |
iConsole->Printf(_L("0: Main Menu\n"));
|
|
285 |
iConsole->Printf(_L("1: Enable/Disable\n"));
|
|
286 |
iConsole->Printf(_L("2: Toggle Enforce\n"));
|
|
287 |
iConsole->Printf(_L("3: Test Case 1\n"));
|
|
288 |
iConsole->Printf(_L("4: Test Case 2\n"));
|
|
289 |
iConsole->Printf(_L("5: Test Case 3\n"));
|
|
290 |
iConsole->Printf(_L("6: Undef\n"));
|
|
291 |
iConsole->Printf(_L("7: Undef\n"));
|
|
292 |
iConsole->Printf(_L("8: Apply Settings\n"));
|
|
293 |
iConsole->Printf(_L("9: Del Env Reverb\n"));
|
|
294 |
break;
|
|
295 |
case EEnvironmentalReverb2:
|
|
296 |
iConsole->Printf(_L("0: Main Menu\n"));
|
|
297 |
iConsole->Printf(_L("1: \n"));
|
|
298 |
iConsole->Printf(_L("2: \n"));
|
|
299 |
iConsole->Printf(_L("3: \n"));
|
|
300 |
iConsole->Printf(_L("4: \n"));
|
|
301 |
iConsole->Printf(_L("5: \n"));
|
|
302 |
iConsole->Printf(_L("6: \n"));
|
|
303 |
iConsole->Printf(_L("7: More\n"));
|
|
304 |
iConsole->Printf(_L("8: Apply Settings\n"));
|
|
305 |
iConsole->Printf(_L("9: Del Env Reverb\n"));
|
|
306 |
break;
|
|
307 |
|
|
308 |
case EStereoWidening:
|
|
309 |
iConsole->Printf(_L("0: Main Menu\n"));
|
|
310 |
iConsole->Printf(_L("1: Enable/Disable\n"));
|
|
311 |
iConsole->Printf(_L("2: Toggle Enforce\n"));
|
|
312 |
iConsole->Printf(_L("3: Set Widening Level\n"));
|
|
313 |
iConsole->Printf(_L("4: Apply Settings\n"));
|
|
314 |
iConsole->Printf(_L("9: Delete Effect\n"));
|
|
315 |
break;
|
|
316 |
|
|
317 |
|
|
318 |
case EStereoWideningLevel:
|
|
319 |
iConsole->Printf(_L("0: StereoWidening Menu\n"));
|
|
320 |
iConsole->Printf(_L("1: Level Up\n"));
|
|
321 |
iConsole->Printf(_L("2: Level Down\n"));
|
|
322 |
iConsole->Printf(_L("3: Show Effect info\n"));
|
|
323 |
iConsole->Printf(_L("9: Go Back\n"));
|
|
324 |
break;
|
|
325 |
|
|
326 |
|
|
327 |
|
|
328 |
default:
|
|
329 |
// Do nothing
|
|
330 |
break;
|
|
331 |
}
|
|
332 |
iConsole->Printf(KNewLine);
|
|
333 |
}
|
|
334 |
|
|
335 |
|
|
336 |
|
|
337 |
//////////////////////////////////////////////////////////////////////////////
|
|
338 |
//
|
|
339 |
// -----> MAIN
|
|
340 |
//
|
|
341 |
//////////////////////////////////////////////////////////////////////////////
|
|
342 |
|
|
343 |
void CConsoleTest::ProcessMain(TChar aChar)
|
|
344 |
{
|
|
345 |
|
|
346 |
if ( !iInitStatus )
|
|
347 |
{
|
|
348 |
switch (aChar)
|
|
349 |
{
|
|
350 |
case '1':
|
|
351 |
iMenu = iParentMenu = EPlay;
|
|
352 |
ShowMenu();
|
|
353 |
break;
|
|
354 |
|
|
355 |
case '2':
|
|
356 |
iMenu = iParentMenu = EPlay;
|
|
357 |
ShowMenu();
|
|
358 |
break;
|
|
359 |
|
|
360 |
case '3':
|
|
361 |
iMenu = iParentMenu = EPlay;
|
|
362 |
ShowMenu();
|
|
363 |
break;
|
|
364 |
|
|
365 |
case '9':
|
|
366 |
iConsole->Printf(_L("Stopping Scheduler...\n"));
|
|
367 |
CActiveScheduler::Stop();
|
|
368 |
iConsole->Printf(_L("Exiting...\n"));
|
|
369 |
break;
|
|
370 |
|
|
371 |
|
|
372 |
default:
|
|
373 |
iConsole->Printf(_L("ProcessMain - Unknown command\n"));
|
|
374 |
break;
|
|
375 |
};
|
|
376 |
}
|
|
377 |
else
|
|
378 |
iConsole->Printf(_L("Not Ready!\n"));
|
|
379 |
|
|
380 |
|
|
381 |
|
|
382 |
// Issue another request
|
|
383 |
RequestCharacter();
|
|
384 |
}
|
|
385 |
|
|
386 |
|
|
387 |
//////////////////////////////////////////////////////////////////////////////
|
|
388 |
//
|
|
389 |
// -----> Play menu
|
|
390 |
//
|
|
391 |
//////////////////////////////////////////////////////////////////////////////
|
|
392 |
|
|
393 |
void CConsoleTest::ProcessPlayL(TChar aChar)
|
|
394 |
{
|
|
395 |
switch (aChar)
|
|
396 |
{
|
|
397 |
case '0': // Main Menu
|
|
398 |
iMenu = EMain;
|
|
399 |
ShowMenu();
|
|
400 |
break;
|
|
401 |
|
|
402 |
case '1': // Equalizer
|
|
403 |
iMenu = EEqualizer;
|
|
404 |
if (!iPlayerAudioEqualizer)
|
|
405 |
{
|
|
406 |
iPlayerAudioEqualizer = CAudioEqualizer::NewL(*iAudioPlayer);
|
|
407 |
iPlayerAudioEqualizer->RegisterObserverL(*this);
|
|
408 |
}
|
|
409 |
iAudioEqualizer = iPlayerAudioEqualizer;
|
|
410 |
ShowMenu();
|
|
411 |
break;
|
|
412 |
|
|
413 |
case '2': // Environmental Reverb
|
|
414 |
iMenu = EEnvironmentalReverb1;
|
|
415 |
if (!iPlayerEnvironmentalReverb)
|
|
416 |
{
|
|
417 |
iPlayerEnvironmentalReverb = CEnvironmentalReverb::NewL(*iAudioPlayer);
|
|
418 |
iPlayerEnvironmentalReverb->RegisterObserverL(*this);
|
|
419 |
}
|
|
420 |
iEnvironmentalReverb = iPlayerEnvironmentalReverb;
|
|
421 |
ShowMenu();
|
|
422 |
break;
|
|
423 |
|
|
424 |
|
|
425 |
case '3': // Stereo Widening
|
|
426 |
iMenu = EStereoWidening;
|
|
427 |
if (!iPlayerStereoWidening)
|
|
428 |
{
|
|
429 |
iPlayerStereoWidening = CStereoWidening::NewL(*iAudioPlayer,EFalse,5);
|
|
430 |
iPlayerStereoWidening->RegisterObserverL(*this);
|
|
431 |
}
|
|
432 |
iStereoWidening = iPlayerStereoWidening;
|
|
433 |
ShowMenu();
|
|
434 |
break;
|
|
435 |
|
|
436 |
|
|
437 |
|
|
438 |
default:
|
|
439 |
iConsole->Printf(_L("Play Menu - Unknown command\n"));
|
|
440 |
break;
|
|
441 |
};
|
|
442 |
|
|
443 |
// Issue another request
|
|
444 |
RequestCharacter();
|
|
445 |
}
|
|
446 |
|
|
447 |
|
|
448 |
|
|
449 |
//////////////////////////////////////////////////////////////////////////////
|
|
450 |
//
|
|
451 |
// -----> Equalizer Menu
|
|
452 |
//
|
|
453 |
//////////////////////////////////////////////////////////////////////////////
|
|
454 |
|
|
455 |
|
|
456 |
void CConsoleTest::ProcessEqualizerL(TChar aChar)
|
|
457 |
{
|
|
458 |
TInt32 min, max;
|
|
459 |
|
|
460 |
switch (aChar)
|
|
461 |
{
|
|
462 |
case '0': // Main Menu
|
|
463 |
iMenu = EMain;
|
|
464 |
ShowMenu();
|
|
465 |
break;
|
|
466 |
|
|
467 |
case '1': // Enable / disable
|
|
468 |
if ( iAudioEqualizer->IsEnabled() )
|
|
469 |
iAudioEqualizer->DisableL();
|
|
470 |
else
|
|
471 |
iAudioEqualizer->EnableL();
|
|
472 |
|
|
473 |
break;
|
|
474 |
|
|
475 |
case '2': // Enforce
|
|
476 |
if ( iAudioEqualizer->IsEnforced() )
|
|
477 |
iAudioEqualizer->EnforceL(EFalse);
|
|
478 |
else
|
|
479 |
iAudioEqualizer->EnforceL(ETrue);
|
|
480 |
break;
|
|
481 |
|
|
482 |
case '3': // Set Band Level
|
|
483 |
iMenu = EBandId;
|
|
484 |
iConsole->Printf(_L("Enter Band ID: "));
|
|
485 |
break;
|
|
486 |
|
|
487 |
case '4': // Print Equalizer information
|
|
488 |
iConsole->Printf(_L("Enabled: %d\n"), iAudioEqualizer->IsEnabled());
|
|
489 |
iConsole->Printf(_L("Enforced: %d\n"), iAudioEqualizer->IsEnforced());
|
|
490 |
iConsole->Printf(_L("Number Of Bands: %d\n"), iAudioEqualizer->NumberOfBands());
|
|
491 |
iAudioEqualizer->DbLevelLimits(min,max);
|
|
492 |
iConsole->Printf(_L("Db Min %d, Max %d\n"), min, max );
|
|
493 |
break;
|
|
494 |
|
|
495 |
case '5': // Print Band Info
|
|
496 |
iMenu = EBandId;
|
|
497 |
iConsole->Printf(_L("Enter Band ID: "));
|
|
498 |
break;
|
|
499 |
|
|
500 |
case '6': // Apply Settings
|
|
501 |
iAudioEqualizer->ApplyL();
|
|
502 |
break;
|
|
503 |
|
|
504 |
case '9': // Delete volume object
|
|
505 |
if (iParentMenu == EPlay)
|
|
506 |
{
|
|
507 |
delete iAudioEqualizer;
|
|
508 |
iAudioEqualizer = NULL;
|
|
509 |
iPlayerAudioEqualizer = NULL;
|
|
510 |
}
|
|
511 |
|
|
512 |
if (iParentMenu == ERecord)
|
|
513 |
{
|
|
514 |
delete iAudioEqualizer;
|
|
515 |
iAudioEqualizer = NULL;
|
|
516 |
iRecorderAudioEqualizer = NULL;
|
|
517 |
}
|
|
518 |
break;
|
|
519 |
|
|
520 |
default:
|
|
521 |
iConsole->Printf(_L("ProcessEqualizerL - Unknown command\n"));
|
|
522 |
break;
|
|
523 |
};
|
|
524 |
|
|
525 |
// Issue another request
|
|
526 |
RequestCharacter();
|
|
527 |
}
|
|
528 |
|
|
529 |
|
|
530 |
//////////////////////////////////////////////////////////////////////////////
|
|
531 |
//
|
|
532 |
// -----> Band Menu
|
|
533 |
//
|
|
534 |
//////////////////////////////////////////////////////////////////////////////
|
|
535 |
|
|
536 |
|
|
537 |
void CConsoleTest::ProcessBandId(TChar aChar)
|
|
538 |
{
|
|
539 |
iBandId = aChar.GetNumericValue();
|
|
540 |
iMenu = EBandLevel;
|
|
541 |
ShowMenu();
|
|
542 |
RequestCharacter();
|
|
543 |
|
|
544 |
}
|
|
545 |
|
|
546 |
|
|
547 |
void CConsoleTest::ProcessBandLevelL(TChar aChar)
|
|
548 |
{
|
|
549 |
switch (aChar)
|
|
550 |
{
|
|
551 |
case '0': // Main Menu
|
|
552 |
iMenu = EEqualizer;
|
|
553 |
ShowMenu();
|
|
554 |
break;
|
|
555 |
|
|
556 |
case '1': // Level UP
|
|
557 |
ShowMenu();
|
|
558 |
iAudioEqualizer->SetBandLevelL(iBandId, iAudioEqualizer->BandLevel(iBandId) + 1);
|
|
559 |
iConsole->Printf(_L("Band[%d] Level[%d]\n"), iBandId, iAudioEqualizer->BandLevel(iBandId) );
|
|
560 |
//iAudioEqualizer->ApplyL();
|
|
561 |
break;
|
|
562 |
|
|
563 |
case '2': // Level Down
|
|
564 |
ShowMenu();
|
|
565 |
iAudioEqualizer->SetBandLevelL(iBandId, iAudioEqualizer->BandLevel(iBandId) - 1);
|
|
566 |
iConsole->Printf(_L("Band[%d] Level[%d]\n"), iBandId, iAudioEqualizer->BandLevel(iBandId) );
|
|
567 |
//iAudioEqualizer->ApplyL();
|
|
568 |
break;
|
|
569 |
|
|
570 |
case '3': // Print Band information
|
|
571 |
iConsole->Printf(_L("Band Number: %d\n"), iBandId);
|
|
572 |
iConsole->Printf(_L("BandLevel: %d\n"), iAudioEqualizer->BandLevel(iBandId));
|
|
573 |
iConsole->Printf(_L("BandWidth: %d\n"), iAudioEqualizer->BandWidth(iBandId));
|
|
574 |
iConsole->Printf(_L("Crossover Fequency %d\n"), iAudioEqualizer->CrossoverFrequency(iBandId));
|
|
575 |
iConsole->Printf(_L("Center Fequency %d\n"), iAudioEqualizer->CenterFrequency(iBandId));
|
|
576 |
break;
|
|
577 |
|
|
578 |
default:
|
|
579 |
iConsole->Printf(_L("ProcessEqualizerL - Unknown command\n"));
|
|
580 |
break;
|
|
581 |
};
|
|
582 |
|
|
583 |
// Issue another request
|
|
584 |
RequestCharacter();
|
|
585 |
}
|
|
586 |
|
|
587 |
//////////////////////////////////////////////////////////////////////////////
|
|
588 |
//
|
|
589 |
// -----> Stereo Widening Menu
|
|
590 |
//
|
|
591 |
//////////////////////////////////////////////////////////////////////////////
|
|
592 |
|
|
593 |
|
|
594 |
void CConsoleTest::ProcessStereoWideningL(TChar aChar)
|
|
595 |
{
|
|
596 |
|
|
597 |
switch (aChar)
|
|
598 |
{
|
|
599 |
case '0': // Main Menu
|
|
600 |
iMenu = EMain;
|
|
601 |
ShowMenu();
|
|
602 |
break;
|
|
603 |
|
|
604 |
case '1': // Enable / disable
|
|
605 |
if ( iStereoWidening->IsEnabled() )
|
|
606 |
iStereoWidening->DisableL();
|
|
607 |
else
|
|
608 |
iStereoWidening->EnableL();
|
|
609 |
|
|
610 |
break;
|
|
611 |
|
|
612 |
case '2': // Enforce
|
|
613 |
if ( iStereoWidening->IsEnforced() )
|
|
614 |
iStereoWidening->EnforceL(EFalse);
|
|
615 |
else
|
|
616 |
iStereoWidening->EnforceL(ETrue);
|
|
617 |
break;
|
|
618 |
|
|
619 |
case '3': // Set Stereo Widening Level
|
|
620 |
iMenu = EStereoWideningLevel;
|
|
621 |
break;
|
|
622 |
|
|
623 |
case '4': // Apply Settings
|
|
624 |
iStereoWidening->ApplyL();
|
|
625 |
break;
|
|
626 |
|
|
627 |
case '9': // Delete volume object
|
|
628 |
if (iParentMenu == EPlay)
|
|
629 |
{
|
|
630 |
delete iStereoWidening;
|
|
631 |
iStereoWidening = NULL;
|
|
632 |
iPlayerStereoWidening = NULL;
|
|
633 |
}
|
|
634 |
if (iParentMenu == ERecord)
|
|
635 |
{
|
|
636 |
delete iStereoWidening;
|
|
637 |
iStereoWidening = NULL;
|
|
638 |
iRecorderStereoWidening = NULL;
|
|
639 |
}
|
|
640 |
|
|
641 |
iMenu = EMain;
|
|
642 |
ShowMenu();
|
|
643 |
break;
|
|
644 |
|
|
645 |
default:
|
|
646 |
iConsole->Printf(_L("ProcessStereoWideningL - Unknown command\n"));
|
|
647 |
break;
|
|
648 |
};
|
|
649 |
|
|
650 |
// Issue another request
|
|
651 |
RequestCharacter();
|
|
652 |
}
|
|
653 |
|
|
654 |
void CConsoleTest::ProcessStereoWideningLevelL(TChar aChar)
|
|
655 |
{
|
|
656 |
|
|
657 |
ShowMenu();
|
|
658 |
switch (aChar)
|
|
659 |
{
|
|
660 |
|
|
661 |
case '1': // Level UP
|
|
662 |
ShowMenu();
|
|
663 |
iStereoWidening->SetStereoWideningLevelL(iStereoWidening->StereoWideningLevel() + 1);
|
|
664 |
iConsole->Printf(_L("Level[%d]\n"), iStereoWidening->StereoWideningLevel() );
|
|
665 |
break;
|
|
666 |
|
|
667 |
case '2': // Level Down
|
|
668 |
ShowMenu();
|
|
669 |
iStereoWidening->SetStereoWideningLevelL(iStereoWidening->StereoWideningLevel() - 1);
|
|
670 |
iConsole->Printf(_L("Level[%d]\n"), iStereoWidening->StereoWideningLevel() );
|
|
671 |
break;
|
|
672 |
|
|
673 |
case '3': // Print Level information
|
|
674 |
iConsole->Printf(_L("Level: %d\n"), iStereoWidening->StereoWideningLevel());
|
|
675 |
iConsole->Printf(_L("Continuous Level %d\n"), iStereoWidening->IsContinuousLevelSupported());
|
|
676 |
break;
|
|
677 |
case '9': // Main Menu
|
|
678 |
iMenu = EStereoWidening;
|
|
679 |
ShowMenu();
|
|
680 |
break;
|
|
681 |
|
|
682 |
default:
|
|
683 |
iConsole->Printf(_L("ProcessStereoWideningL - Unknown command\n"));
|
|
684 |
break;
|
|
685 |
};
|
|
686 |
|
|
687 |
// Issue another request
|
|
688 |
RequestCharacter();
|
|
689 |
}
|
|
690 |
|
|
691 |
//////////////////////////////////////////////////////////////////////////////
|
|
692 |
//
|
|
693 |
// -----> Environmental reverb Menu
|
|
694 |
//
|
|
695 |
//////////////////////////////////////////////////////////////////////////////
|
|
696 |
|
|
697 |
void CConsoleTest::InitializeTestData()
|
|
698 |
{
|
|
699 |
iGoodData.Append(1000); // Decay HF Ratio
|
|
700 |
iGoodData.Append(1000); // Decay Time
|
|
701 |
iGoodData.Append(1000); // Density
|
|
702 |
iGoodData.Append(1000); // Diffusion
|
|
703 |
iGoodData.Append(1000); // Reflections Delay
|
|
704 |
iGoodData.Append(1000); // Reflections Level
|
|
705 |
iGoodData.Append(1000); // Reverb Delay
|
|
706 |
iGoodData.Append(1000); // Reverb Level
|
|
707 |
iGoodData.Append(1000); // Room HF Level
|
|
708 |
iGoodData.Append(1000); // Room Level
|
|
709 |
|
|
710 |
iBadData.Append(50000); // Decay HF Ratio
|
|
711 |
iBadData.Append(300000); // Decay Time
|
|
712 |
iBadData.Append(10005); // Density
|
|
713 |
iBadData.Append(10005); // Diffusion
|
|
714 |
iBadData.Append(300000); // Reflections Delay
|
|
715 |
iBadData.Append(2000); // Reflections Level
|
|
716 |
iBadData.Append(300000); // Reverb Delay
|
|
717 |
iBadData.Append(2000); // Reverb Level
|
|
718 |
iBadData.Append(2000); // Room HF Level
|
|
719 |
iBadData.Append(2000); // Room Level
|
|
720 |
|
|
721 |
}
|
|
722 |
|
|
723 |
void CConsoleTest::ProcessEnvironmentalReverbL(TChar aChar)
|
|
724 |
{
|
|
725 |
|
|
726 |
switch (aChar)
|
|
727 |
{
|
|
728 |
case '0': // Main Menu
|
|
729 |
iMenu = EMain;
|
|
730 |
ShowMenu();
|
|
731 |
break;
|
|
732 |
|
|
733 |
case '1': // Enable / disable
|
|
734 |
if ( iEnvironmentalReverb->IsEnabled() )
|
|
735 |
iEnvironmentalReverb->DisableL();
|
|
736 |
else
|
|
737 |
iEnvironmentalReverb->EnableL();
|
|
738 |
|
|
739 |
break;
|
|
740 |
|
|
741 |
case '2': // Enforce
|
|
742 |
if ( iEnvironmentalReverb->IsEnforced() )
|
|
743 |
iEnvironmentalReverb->EnforceL(EFalse);
|
|
744 |
else
|
|
745 |
iEnvironmentalReverb->EnforceL(ETrue);
|
|
746 |
break;
|
|
747 |
|
|
748 |
case '3': // Test 1: Setters normal case
|
|
749 |
TestCase1();
|
|
750 |
break;
|
|
751 |
|
|
752 |
case '4': // Test 2: Setters abnormal case
|
|
753 |
TestCase2();
|
|
754 |
break;
|
|
755 |
|
|
756 |
case '5': // Test 3: Getters abnormal case
|
|
757 |
TestCase3();
|
|
758 |
break;
|
|
759 |
|
|
760 |
case '8': // Apply Settings
|
|
761 |
iEnvironmentalReverb->ApplyL();
|
|
762 |
break;
|
|
763 |
|
|
764 |
case '9': // Delete environmental reverb object
|
|
765 |
if (iParentMenu == EPlay)
|
|
766 |
{
|
|
767 |
delete iEnvironmentalReverb;
|
|
768 |
iEnvironmentalReverb = NULL;
|
|
769 |
iPlayerEnvironmentalReverb = NULL;
|
|
770 |
}
|
|
771 |
|
|
772 |
if (iParentMenu == ERecord)
|
|
773 |
{
|
|
774 |
delete iEnvironmentalReverb;
|
|
775 |
iEnvironmentalReverb = NULL;
|
|
776 |
iRecorderEnvironmentalReverb = NULL;
|
|
777 |
}
|
|
778 |
break;
|
|
779 |
|
|
780 |
default:
|
|
781 |
iConsole->Printf(_L("ProcessEnvironmentalReverbL - Unknown command\n"));
|
|
782 |
break;
|
|
783 |
};
|
|
784 |
|
|
785 |
// Issue another request
|
|
786 |
RequestCharacter();
|
|
787 |
}
|
|
788 |
|
|
789 |
void CConsoleTest::TestCase1()
|
|
790 |
{
|
|
791 |
TRAPD(err1, iEnvironmentalReverb->SetDecayHFRatioL(iGoodData[0]));
|
|
792 |
iConsole->Printf(_L("Result 1.1 - %d\n"),err1);
|
|
793 |
TRAPD(err2, iEnvironmentalReverb->SetDecayTimeL(iGoodData[1]));
|
|
794 |
iConsole->Printf(_L("Result 1.2 - %d\n"),err2);
|
|
795 |
TRAPD(err3, iEnvironmentalReverb->SetDensityL(iGoodData[2]));
|
|
796 |
iConsole->Printf(_L("Result 1.3 - %d\n"),err3);
|
|
797 |
TRAPD(err4, iEnvironmentalReverb->SetDiffusionL(iGoodData[3]));
|
|
798 |
iConsole->Printf(_L("Result 1.4 - %d\n"),err4);
|
|
799 |
TRAPD(err5, iEnvironmentalReverb->SetReflectionsDelayL(iGoodData[4]));
|
|
800 |
iConsole->Printf(_L("Result 1.5 - %d\n"),err5);
|
|
801 |
TRAPD(err6, iEnvironmentalReverb->SetReverbDelayL(iGoodData[6]));
|
|
802 |
iConsole->Printf(_L("Result 1.6 - %d\n"),err6);
|
|
803 |
TRAPD(err7, iEnvironmentalReverb->SetReverbLevelL(iGoodData[7]));
|
|
804 |
iConsole->Printf(_L("Result 1.7 - %d\n"),err7);
|
|
805 |
TRAPD(err8, iEnvironmentalReverb->SetRoomHFLevelL(iGoodData[8]));
|
|
806 |
iConsole->Printf(_L("Result 1.8 - %d\n"),err8);
|
|
807 |
TRAPD(err9, iEnvironmentalReverb->SetRoomLevelL(iGoodData[9]));
|
|
808 |
iConsole->Printf(_L("Result 1.9 - %d\n"),err9);
|
|
809 |
TRAPD(err10, iEnvironmentalReverb->SetReflectionsLevelL(iGoodData[5]));
|
|
810 |
iConsole->Printf(_L("Result 1.10 - %d\n"),err10);
|
|
811 |
}
|
|
812 |
|
|
813 |
void CConsoleTest::TestCase2()
|
|
814 |
{
|
|
815 |
TRAPD(err1, iEnvironmentalReverb->SetDecayHFRatioL(iBadData[0]));
|
|
816 |
iConsole->Printf(_L("Result 1.1 - %d\n"),err1);
|
|
817 |
TRAPD(err2, iEnvironmentalReverb->SetDecayTimeL(iBadData[1]));
|
|
818 |
iConsole->Printf(_L("Result 1.2 - %d\n"),err2);
|
|
819 |
TRAPD(err3, iEnvironmentalReverb->SetDensityL(iBadData[2]));
|
|
820 |
iConsole->Printf(_L("Result 1.3 - %d\n"),err3);
|
|
821 |
TRAPD(err4, iEnvironmentalReverb->SetDiffusionL(iBadData[3]));
|
|
822 |
iConsole->Printf(_L("Result 1.4 - %d\n"),err4);
|
|
823 |
TRAPD(err5, iEnvironmentalReverb->SetReflectionsDelayL(iBadData[4]));
|
|
824 |
iConsole->Printf(_L("Result 1.5 - %d\n"),err5);
|
|
825 |
TRAPD(err6, iEnvironmentalReverb->SetReverbDelayL(iBadData[6]));
|
|
826 |
iConsole->Printf(_L("Result 1.6 - %d\n"),err6);
|
|
827 |
TRAPD(err7, iEnvironmentalReverb->SetReverbLevelL(iBadData[7]));
|
|
828 |
iConsole->Printf(_L("Result 1.7 - %d\n"),err7);
|
|
829 |
TRAPD(err8, iEnvironmentalReverb->SetRoomHFLevelL(iBadData[8]));
|
|
830 |
iConsole->Printf(_L("Result 1.8 - %d\n"),err8);
|
|
831 |
TRAPD(err9, iEnvironmentalReverb->SetRoomLevelL(iBadData[9]));
|
|
832 |
iConsole->Printf(_L("Result 1.9 - %d\n"),err9);
|
|
833 |
TRAPD(err10, iEnvironmentalReverb->SetReflectionsLevelL(iBadData[5]));
|
|
834 |
iConsole->Printf(_L("Result 1.10 - %d\n"),err10);
|
|
835 |
}
|
|
836 |
|
|
837 |
void CConsoleTest::TestCase3()
|
|
838 |
{
|
|
839 |
if ( iEnvironmentalReverb->DecayHFRatio() == iGoodData[0] )
|
|
840 |
iConsole->Printf(_L("Result 3.1 - 1\n"));
|
|
841 |
else
|
|
842 |
iConsole->Printf(_L("Result 3.1 - 0\n"));
|
|
843 |
|
|
844 |
if ( iEnvironmentalReverb->DecayTime() == iGoodData[1] )
|
|
845 |
iConsole->Printf(_L("Result 3.2 - 1\n"));
|
|
846 |
else
|
|
847 |
iConsole->Printf(_L("Result 3.2 - 0\n"));
|
|
848 |
|
|
849 |
if ( iEnvironmentalReverb->Density() == iGoodData[2] )
|
|
850 |
iConsole->Printf(_L("Result 3.3 - 1\n"));
|
|
851 |
else
|
|
852 |
iConsole->Printf(_L("Result 3.3 - 0\n"));
|
|
853 |
|
|
854 |
if ( iEnvironmentalReverb->Diffusion() == iGoodData[3] )
|
|
855 |
iConsole->Printf(_L("Result 3.4 - 1\n"));
|
|
856 |
else
|
|
857 |
iConsole->Printf(_L("Result 3.4 - 0\n"));
|
|
858 |
|
|
859 |
if ( iEnvironmentalReverb->ReflectionsDelay() == iGoodData[4] )
|
|
860 |
iConsole->Printf(_L("Result 3.5 - 1\n"));
|
|
861 |
else
|
|
862 |
iConsole->Printf(_L("Result 3.5 - 0\n"));
|
|
863 |
|
|
864 |
if ( iEnvironmentalReverb->ReflectionsLevel() == iGoodData[5] )
|
|
865 |
iConsole->Printf(_L("Result 3.6 - 1\n"));
|
|
866 |
else
|
|
867 |
iConsole->Printf(_L("Result 3.6 - 0\n"));
|
|
868 |
|
|
869 |
if ( iEnvironmentalReverb->ReverbDelay() == iGoodData[6] )
|
|
870 |
iConsole->Printf(_L("Result 3.7 - 1\n"));
|
|
871 |
else
|
|
872 |
iConsole->Printf(_L("Result 3.7 - 0\n"));
|
|
873 |
|
|
874 |
if ( iEnvironmentalReverb->ReverbLevel() == iGoodData[7] )
|
|
875 |
iConsole->Printf(_L("Result 3.8 - 1\n"));
|
|
876 |
else
|
|
877 |
iConsole->Printf(_L("Result 3.8 - 0\n"));
|
|
878 |
|
|
879 |
if ( iEnvironmentalReverb->RoomHFLevel() == iGoodData[8] )
|
|
880 |
iConsole->Printf(_L("Result 3.9 - 1\n"));
|
|
881 |
else
|
|
882 |
iConsole->Printf(_L("Result 3.9 - 0\n"));
|
|
883 |
|
|
884 |
if ( iEnvironmentalReverb->RoomLevel() == iGoodData[9] )
|
|
885 |
iConsole->Printf(_L("Result 3.10 - 1\n"));
|
|
886 |
else
|
|
887 |
iConsole->Printf(_L("Result 3.10 - 0\n"));
|
|
888 |
}
|
|
889 |
|
|
890 |
/************************************************************************************************************/
|
|
891 |
|
|
892 |
|
|
893 |
|
|
894 |
|
|
895 |
void CConsoleTest::MapcInitComplete(TInt aStatus, const TTimeIntervalMicroSeconds& aDuration)
|
|
896 |
{
|
|
897 |
iConsole->Printf(_L("MapcInit: %d\n"), aStatus);
|
|
898 |
iInitStatus = aStatus;
|
|
899 |
TInt d = I64INT(aDuration.Int64());
|
|
900 |
RDebug::Print(_L("CConsoleTest::MapcInitComplete :-> Status[%d] Duration[%d]"), aStatus, d);
|
|
901 |
}
|
|
902 |
|
|
903 |
void CConsoleTest::MapcPlayComplete(TInt aErr)
|
|
904 |
{
|
|
905 |
iConsole->Printf(_L("MapcPlay: %d"), aErr);
|
|
906 |
RDebug::Print(_L("CConsoleTest::MapcPlayComplete :-> Error[%d]"), aErr);
|
|
907 |
}
|
|
908 |
|
|
909 |
void CConsoleTest::EffectChanged( const CAudioEffect* aAudioEffect, TUint8 aEvent )
|
|
910 |
{
|
|
911 |
RDebug::Print(_L("CConsoleTest::EffectChanged, Event = %d "), aEvent);
|
|
912 |
|
|
913 |
if ( aAudioEffect->Uid() == KUidAudioEqualizerEffect )
|
|
914 |
{
|
|
915 |
if ( aEvent == KEnabled )
|
|
916 |
{
|
|
917 |
iConsole->Printf(_L("Equalizer state: %d"), ((CAudioEqualizer*)aAudioEffect)->IsEnabled());
|
|
918 |
RDebug::Print(_L("CConsoleTest::EffectChanged :-> Enabled[%d]"), ((CAudioEqualizer*)aAudioEffect)->IsEnabled());
|
|
919 |
}
|
|
920 |
}
|
|
921 |
else if ( aAudioEffect->Uid() == KUidStereoWideningEffect )
|
|
922 |
{
|
|
923 |
if ( aEvent == KEnabled )
|
|
924 |
{
|
|
925 |
iConsole->Printf(_L("StereoWidening state: %d"), ((CStereoWidening*)aAudioEffect)->IsEnabled());
|
|
926 |
RDebug::Print(_L("CConsoleTest::EffectChanged :-> Enabled[%d]"), ((CStereoWidening*)aAudioEffect)->IsEnabled());
|
|
927 |
}
|
|
928 |
else
|
|
929 |
{
|
|
930 |
iConsole->Printf(_L("StereoWidening state: %d"), ((CStereoWidening*)aAudioEffect)->IsEnabled());
|
|
931 |
RDebug::Print(_L("CConsoleTest::EffectChanged :-> Enabled[%d]"), ((CStereoWidening*)aAudioEffect)->IsEnabled());
|
|
932 |
}
|
|
933 |
}
|
|
934 |
|
|
935 |
|
|
936 |
}
|
|
937 |
|
|
938 |
void CConsoleTest::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
|
|
939 |
{
|
|
940 |
RDebug::Print(_L("aPreviousState[%d], aCurrentState[%d], aErrorCode[%d]"), aPreviousState, aCurrentState, aErrorCode);
|
|
941 |
iInitStatus = aErrorCode;
|
|
942 |
iConsole->Printf(_L("Mosco: %d\n"), aErrorCode);
|
|
943 |
}
|
|
944 |
|
|
945 |
|
|
946 |
|
|
947 |
//////////////////////////////////////////////////////////////////////////////
|
|
948 |
//
|
|
949 |
// Do the testing
|
|
950 |
//
|
|
951 |
//////////////////////////////////////////////////////////////////////////////
|
|
952 |
LOCAL_C void doTestL()
|
|
953 |
{
|
|
954 |
|
|
955 |
CConsoleBase* console = Console::NewL(KTxtDBTest,TSize(KConsFullScreen,KConsFullScreen));
|
|
956 |
CleanupStack::PushL(console);
|
|
957 |
|
|
958 |
CmyActiveScheduler* myScheduler = new (ELeave) CmyActiveScheduler;
|
|
959 |
CleanupStack::PushL(myScheduler);
|
|
960 |
CActiveScheduler::Install(myScheduler);
|
|
961 |
|
|
962 |
// Create a CConsoleTest active object
|
|
963 |
CConsoleTest* consoleTest = CConsoleTest::NewLC(console);
|
|
964 |
consoleTest->ShowMenu();
|
|
965 |
// Issue the first request
|
|
966 |
consoleTest->RequestCharacter();
|
|
967 |
|
|
968 |
#ifdef __WINS__
|
|
969 |
_LIT(KTitleMsg,"Ready!\nPress ESC to end.\n\n");
|
|
970 |
#else
|
|
971 |
_LIT(KTitleMsg,"Press SPACE(0) to end.\n");
|
|
972 |
#endif
|
|
973 |
console->Printf(KTitleMsg);
|
|
974 |
// test.Title();
|
|
975 |
|
|
976 |
// Main part of program is a wait loop
|
|
977 |
// This function completes when the scheduler stops
|
|
978 |
CActiveScheduler::Start();
|
|
979 |
|
|
980 |
_LIT(KTxtPressAnyKey," [press any key]");
|
|
981 |
console->Printf(KTxtPressAnyKey);
|
|
982 |
console->Getch(); // get and ignore character
|
|
983 |
|
|
984 |
// Remove from the cleanup stack and destroy:
|
|
985 |
// 1. consoleTest
|
|
986 |
// 2. myScheduler
|
|
987 |
// 3. console
|
|
988 |
CleanupStack::PopAndDestroy(3);
|
|
989 |
}
|
|
990 |
|