sl@0: /* sl@0: * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: Effects console test implementation sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: #include "EffectConsoleTest.h" sl@0: sl@0: _LIT(KNewLine,"\n"); sl@0: sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // -----> CmyActiveScheduler (implementation) sl@0: // sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: void CmyActiveScheduler::Error(TInt aError) const sl@0: { sl@0: _LIT(KMsgSchedErr,"CmyActiveScheduler-error"); sl@0: User::Panic(KMsgSchedErr,aError); sl@0: } sl@0: sl@0: sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // -----> CActiveConsole (implementation) sl@0: // sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: CActiveConsole::CActiveConsole( CConsoleBase* aConsole) sl@0: : CActive(CActive::EPriorityStandard) sl@0: // Construct high-priority active object sl@0: { sl@0: iConsole = aConsole; sl@0: } sl@0: sl@0: void CActiveConsole::ConstructL() sl@0: { sl@0: // Add to active scheduler sl@0: CActiveScheduler::Add(this); sl@0: } sl@0: sl@0: CActiveConsole::~CActiveConsole() sl@0: { sl@0: // Make sure we're cancelled sl@0: Cancel(); sl@0: } sl@0: sl@0: void CActiveConsole::DoCancel() sl@0: { sl@0: iConsole->ReadCancel(); sl@0: } sl@0: sl@0: void CActiveConsole::RunL() sl@0: { sl@0: // Handle completed request sl@0: ProcessKeyPress(TChar(iConsole->KeyCode())); sl@0: } sl@0: sl@0: void CActiveConsole::RequestCharacter() sl@0: { sl@0: // A request is issued to the CConsoleBase to accept a sl@0: // character from the keyboard. sl@0: iConsole->Read(iStatus); sl@0: SetActive(); sl@0: } sl@0: sl@0: sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // -----> CWriteKeyProcessor (implementation) sl@0: // sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: CConsoleTest::CConsoleTest(CConsoleBase* aConsole) sl@0: : CActiveConsole(aConsole), sl@0: iMenu(EMain) sl@0: { sl@0: iEqualizer = NULL; sl@0: iEnvironmentalReverb = NULL; sl@0: iStereoWidening = NULL; sl@0: iInitStatus = -1; sl@0: }; sl@0: sl@0: CConsoleTest::~CConsoleTest() sl@0: { sl@0: RDebug::Print(_L("CConsoleTest::~CConsoleTest\n")); sl@0: // Make sure we're cancelled sl@0: Cancel(); sl@0: sl@0: delete iPlayerAudioEqualizer; sl@0: delete iPlayerEnvironmentalReverb; sl@0: delete iPlayerStereoWidening; sl@0: delete iRecorderAudioEqualizer; sl@0: delete iRecorderEnvironmentalReverb; sl@0: delete iRecorderStereoWidening; sl@0: sl@0: delete iCIUtility; sl@0: sl@0: delete iAudioPlayer; sl@0: delete iAudioRecorder; sl@0: delete iAudioConverter; sl@0: sl@0: iGoodData.Close(); sl@0: iBadData.Close(); sl@0: sl@0: iFs.Close(); sl@0: sl@0: } sl@0: sl@0: void CConsoleTest::ConstructL() sl@0: { sl@0: User::LeaveIfError(iFs.Connect()); sl@0: sl@0: iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL(KAMRTestFile, *this); sl@0: //iAudioRecorder = CMdaAudioRecorderUtility::NewL(*this); sl@0: //iAudioConverter = CMdaAudioConvertUtility::NewL(*this); sl@0: sl@0: //iAudioPlayer->OpenFileL(KWAVTestFile); sl@0: sl@0: // Add to active scheduler sl@0: CActiveScheduler::Add(this); sl@0: InitializeTestData(); sl@0: } sl@0: sl@0: CConsoleTest* CConsoleTest::NewLC(CConsoleBase* aConsole) sl@0: { sl@0: CConsoleTest* self=new (ELeave) CConsoleTest(aConsole); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: return self; sl@0: } sl@0: sl@0: CConsoleTest* CConsoleTest::NewL(CConsoleBase* aConsole) sl@0: { sl@0: CConsoleTest* self=NewLC(aConsole); sl@0: CleanupStack::Pop(); sl@0: return self; sl@0: } sl@0: sl@0: sl@0: sl@0: void CConsoleTest::ProcessKeyPress(TChar aChar) sl@0: { sl@0: // iConsole->Printf(_L("You pressed: %d\n"), (TUint) aChar); sl@0: sl@0: // if key is ESC sl@0: // cancel any outstanding request sl@0: // stop the scheduler sl@0: TInt err(KErrNone); sl@0: #ifdef __WINS__ sl@0: if (aChar == EKeyEscape) sl@0: #else sl@0: if (aChar == ' ') sl@0: #endif sl@0: { sl@0: Cancel(); sl@0: CActiveScheduler::Stop(); sl@0: return; sl@0: } sl@0: sl@0: if (aChar == EKeyEnter) sl@0: { sl@0: iConsole->Printf(KNewLine); sl@0: // Issue another request sl@0: RequestCharacter(); sl@0: return; sl@0: } sl@0: sl@0: #ifdef __WINS__ sl@0: if (aChar == '?') sl@0: #else sl@0: if (aChar == '7') sl@0: #endif sl@0: { sl@0: ShowMenu(); sl@0: // Issue another request sl@0: RequestCharacter(); sl@0: return; sl@0: } sl@0: sl@0: switch (iMenu) sl@0: { sl@0: case EMain: sl@0: ProcessMain(aChar); sl@0: break; sl@0: sl@0: case EPlay: sl@0: TRAP(err,ProcessPlayL(aChar)); sl@0: break; sl@0: sl@0: case ERecord: sl@0: //ProcessRecord(aChar); sl@0: break; sl@0: sl@0: case EEqualizer: sl@0: TRAP(err,ProcessEqualizerL(aChar)); sl@0: break; sl@0: sl@0: case EBandId: sl@0: ProcessBandId(aChar); sl@0: break; sl@0: sl@0: case EBandLevel: sl@0: TRAP(err,ProcessBandLevelL(aChar)); sl@0: break; sl@0: sl@0: case EEnvironmentalReverb1: sl@0: TRAP(err,ProcessEnvironmentalReverbL(aChar)); sl@0: break; sl@0: sl@0: case EEnvironmentalReverb2: sl@0: break; sl@0: sl@0: case EStereoWideningLevel: sl@0: TRAP(err,ProcessStereoWideningLevelL(aChar)); sl@0: break; sl@0: sl@0: case EStereoWidening: sl@0: TRAP(err,ProcessStereoWideningL(aChar)); sl@0: break; sl@0: sl@0: sl@0: default: sl@0: iConsole->Printf(_L("ProcessKeyPress - Unknown function\n")); sl@0: // Issue another request sl@0: RequestCharacter(); sl@0: break; sl@0: } sl@0: } sl@0: sl@0: sl@0: void CConsoleTest::ShowMenu() sl@0: { sl@0: iConsole->ClearScreen(); sl@0: switch (iMenu) sl@0: { sl@0: case EMain: sl@0: iConsole->Printf(_L("1: Player\n")); sl@0: iConsole->Printf(_L("2: Recorder\n")); sl@0: iConsole->Printf(_L("3: Converter\n")); sl@0: iConsole->Printf(_L("9: Exit\n")); sl@0: break; sl@0: sl@0: case EPlay: sl@0: case ERecord: sl@0: case EConvert: sl@0: iConsole->Printf(_L("0: Main Menu\n")); sl@0: iConsole->Printf(_L("1: Equalizer\n")); sl@0: iConsole->Printf(_L("2: Env Reverb\n")); sl@0: iConsole->Printf(_L("3: StereoWidening\n")); sl@0: sl@0: break; sl@0: sl@0: case EEqualizer: sl@0: iConsole->Printf(_L("0: Main Menu\n")); sl@0: iConsole->Printf(_L("1: Enable/Disable\n")); sl@0: iConsole->Printf(_L("2: Toggle Enforce\n")); sl@0: iConsole->Printf(_L("3: Set Band Level\n")); sl@0: iConsole->Printf(_L("4: Show Equalizer info\n")); sl@0: iConsole->Printf(_L("5: Show Band info\n")); sl@0: iConsole->Printf(_L("6: Apply Settings\n")); sl@0: iConsole->Printf(_L("9: Delete Equalizer\n")); sl@0: break; sl@0: sl@0: case EBandLevel: sl@0: iConsole->Printf(_L("0: Equalizer Menu\n")); sl@0: iConsole->Printf(_L("1: Band Level Up\n")); sl@0: iConsole->Printf(_L("2: Band Level Down\n")); sl@0: iConsole->Printf(_L("3: Show Band info\n")); sl@0: break; sl@0: sl@0: case EEnvironmentalReverb1: sl@0: iConsole->Printf(_L("0: Main Menu\n")); sl@0: iConsole->Printf(_L("1: Enable/Disable\n")); sl@0: iConsole->Printf(_L("2: Toggle Enforce\n")); sl@0: iConsole->Printf(_L("3: Test Case 1\n")); sl@0: iConsole->Printf(_L("4: Test Case 2\n")); sl@0: iConsole->Printf(_L("5: Test Case 3\n")); sl@0: iConsole->Printf(_L("6: Undef\n")); sl@0: iConsole->Printf(_L("7: Undef\n")); sl@0: iConsole->Printf(_L("8: Apply Settings\n")); sl@0: iConsole->Printf(_L("9: Del Env Reverb\n")); sl@0: break; sl@0: case EEnvironmentalReverb2: sl@0: iConsole->Printf(_L("0: Main Menu\n")); sl@0: iConsole->Printf(_L("1: \n")); sl@0: iConsole->Printf(_L("2: \n")); sl@0: iConsole->Printf(_L("3: \n")); sl@0: iConsole->Printf(_L("4: \n")); sl@0: iConsole->Printf(_L("5: \n")); sl@0: iConsole->Printf(_L("6: \n")); sl@0: iConsole->Printf(_L("7: More\n")); sl@0: iConsole->Printf(_L("8: Apply Settings\n")); sl@0: iConsole->Printf(_L("9: Del Env Reverb\n")); sl@0: break; sl@0: sl@0: case EStereoWidening: sl@0: iConsole->Printf(_L("0: Main Menu\n")); sl@0: iConsole->Printf(_L("1: Enable/Disable\n")); sl@0: iConsole->Printf(_L("2: Toggle Enforce\n")); sl@0: iConsole->Printf(_L("3: Set Widening Level\n")); sl@0: iConsole->Printf(_L("4: Apply Settings\n")); sl@0: iConsole->Printf(_L("9: Delete Effect\n")); sl@0: break; sl@0: sl@0: sl@0: case EStereoWideningLevel: sl@0: iConsole->Printf(_L("0: StereoWidening Menu\n")); sl@0: iConsole->Printf(_L("1: Level Up\n")); sl@0: iConsole->Printf(_L("2: Level Down\n")); sl@0: iConsole->Printf(_L("3: Show Effect info\n")); sl@0: iConsole->Printf(_L("9: Go Back\n")); sl@0: break; sl@0: sl@0: sl@0: sl@0: default: sl@0: // Do nothing sl@0: break; sl@0: } sl@0: iConsole->Printf(KNewLine); sl@0: } sl@0: sl@0: sl@0: sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // -----> MAIN sl@0: // sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: void CConsoleTest::ProcessMain(TChar aChar) sl@0: { sl@0: sl@0: if ( !iInitStatus ) sl@0: { sl@0: switch (aChar) sl@0: { sl@0: case '1': sl@0: iMenu = iParentMenu = EPlay; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: case '2': sl@0: iMenu = iParentMenu = EPlay; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: case '3': sl@0: iMenu = iParentMenu = EPlay; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: case '9': sl@0: iConsole->Printf(_L("Stopping Scheduler...\n")); sl@0: CActiveScheduler::Stop(); sl@0: iConsole->Printf(_L("Exiting...\n")); sl@0: break; sl@0: sl@0: sl@0: default: sl@0: iConsole->Printf(_L("ProcessMain - Unknown command\n")); sl@0: break; sl@0: }; sl@0: } sl@0: else sl@0: iConsole->Printf(_L("Not Ready!\n")); sl@0: sl@0: sl@0: sl@0: // Issue another request sl@0: RequestCharacter(); sl@0: } sl@0: sl@0: sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // -----> Play menu sl@0: // sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: void CConsoleTest::ProcessPlayL(TChar aChar) sl@0: { sl@0: switch (aChar) sl@0: { sl@0: case '0': // Main Menu sl@0: iMenu = EMain; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: case '1': // Equalizer sl@0: iMenu = EEqualizer; sl@0: if (!iPlayerAudioEqualizer) sl@0: { sl@0: iPlayerAudioEqualizer = CAudioEqualizer::NewL(*iAudioPlayer); sl@0: iPlayerAudioEqualizer->RegisterObserverL(*this); sl@0: } sl@0: iAudioEqualizer = iPlayerAudioEqualizer; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: case '2': // Environmental Reverb sl@0: iMenu = EEnvironmentalReverb1; sl@0: if (!iPlayerEnvironmentalReverb) sl@0: { sl@0: iPlayerEnvironmentalReverb = CEnvironmentalReverb::NewL(*iAudioPlayer); sl@0: iPlayerEnvironmentalReverb->RegisterObserverL(*this); sl@0: } sl@0: iEnvironmentalReverb = iPlayerEnvironmentalReverb; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: sl@0: case '3': // Stereo Widening sl@0: iMenu = EStereoWidening; sl@0: if (!iPlayerStereoWidening) sl@0: { sl@0: iPlayerStereoWidening = CStereoWidening::NewL(*iAudioPlayer,EFalse,5); sl@0: iPlayerStereoWidening->RegisterObserverL(*this); sl@0: } sl@0: iStereoWidening = iPlayerStereoWidening; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: sl@0: sl@0: default: sl@0: iConsole->Printf(_L("Play Menu - Unknown command\n")); sl@0: break; sl@0: }; sl@0: sl@0: // Issue another request sl@0: RequestCharacter(); sl@0: } sl@0: sl@0: sl@0: sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // -----> Equalizer Menu sl@0: // sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: sl@0: void CConsoleTest::ProcessEqualizerL(TChar aChar) sl@0: { sl@0: TInt32 min, max; sl@0: sl@0: switch (aChar) sl@0: { sl@0: case '0': // Main Menu sl@0: iMenu = EMain; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: case '1': // Enable / disable sl@0: if ( iAudioEqualizer->IsEnabled() ) sl@0: iAudioEqualizer->DisableL(); sl@0: else sl@0: iAudioEqualizer->EnableL(); sl@0: sl@0: break; sl@0: sl@0: case '2': // Enforce sl@0: if ( iAudioEqualizer->IsEnforced() ) sl@0: iAudioEqualizer->EnforceL(EFalse); sl@0: else sl@0: iAudioEqualizer->EnforceL(ETrue); sl@0: break; sl@0: sl@0: case '3': // Set Band Level sl@0: iMenu = EBandId; sl@0: iConsole->Printf(_L("Enter Band ID: ")); sl@0: break; sl@0: sl@0: case '4': // Print Equalizer information sl@0: iConsole->Printf(_L("Enabled: %d\n"), iAudioEqualizer->IsEnabled()); sl@0: iConsole->Printf(_L("Enforced: %d\n"), iAudioEqualizer->IsEnforced()); sl@0: iConsole->Printf(_L("Number Of Bands: %d\n"), iAudioEqualizer->NumberOfBands()); sl@0: iAudioEqualizer->DbLevelLimits(min,max); sl@0: iConsole->Printf(_L("Db Min %d, Max %d\n"), min, max ); sl@0: break; sl@0: sl@0: case '5': // Print Band Info sl@0: iMenu = EBandId; sl@0: iConsole->Printf(_L("Enter Band ID: ")); sl@0: break; sl@0: sl@0: case '6': // Apply Settings sl@0: iAudioEqualizer->ApplyL(); sl@0: break; sl@0: sl@0: case '9': // Delete volume object sl@0: if (iParentMenu == EPlay) sl@0: { sl@0: delete iAudioEqualizer; sl@0: iAudioEqualizer = NULL; sl@0: iPlayerAudioEqualizer = NULL; sl@0: } sl@0: sl@0: if (iParentMenu == ERecord) sl@0: { sl@0: delete iAudioEqualizer; sl@0: iAudioEqualizer = NULL; sl@0: iRecorderAudioEqualizer = NULL; sl@0: } sl@0: break; sl@0: sl@0: default: sl@0: iConsole->Printf(_L("ProcessEqualizerL - Unknown command\n")); sl@0: break; sl@0: }; sl@0: sl@0: // Issue another request sl@0: RequestCharacter(); sl@0: } sl@0: sl@0: sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // -----> Band Menu sl@0: // sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: sl@0: void CConsoleTest::ProcessBandId(TChar aChar) sl@0: { sl@0: iBandId = aChar.GetNumericValue(); sl@0: iMenu = EBandLevel; sl@0: ShowMenu(); sl@0: RequestCharacter(); sl@0: sl@0: } sl@0: sl@0: sl@0: void CConsoleTest::ProcessBandLevelL(TChar aChar) sl@0: { sl@0: switch (aChar) sl@0: { sl@0: case '0': // Main Menu sl@0: iMenu = EEqualizer; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: case '1': // Level UP sl@0: ShowMenu(); sl@0: iAudioEqualizer->SetBandLevelL(iBandId, iAudioEqualizer->BandLevel(iBandId) + 1); sl@0: iConsole->Printf(_L("Band[%d] Level[%d]\n"), iBandId, iAudioEqualizer->BandLevel(iBandId) ); sl@0: //iAudioEqualizer->ApplyL(); sl@0: break; sl@0: sl@0: case '2': // Level Down sl@0: ShowMenu(); sl@0: iAudioEqualizer->SetBandLevelL(iBandId, iAudioEqualizer->BandLevel(iBandId) - 1); sl@0: iConsole->Printf(_L("Band[%d] Level[%d]\n"), iBandId, iAudioEqualizer->BandLevel(iBandId) ); sl@0: //iAudioEqualizer->ApplyL(); sl@0: break; sl@0: sl@0: case '3': // Print Band information sl@0: iConsole->Printf(_L("Band Number: %d\n"), iBandId); sl@0: iConsole->Printf(_L("BandLevel: %d\n"), iAudioEqualizer->BandLevel(iBandId)); sl@0: iConsole->Printf(_L("BandWidth: %d\n"), iAudioEqualizer->BandWidth(iBandId)); sl@0: iConsole->Printf(_L("Crossover Fequency %d\n"), iAudioEqualizer->CrossoverFrequency(iBandId)); sl@0: iConsole->Printf(_L("Center Fequency %d\n"), iAudioEqualizer->CenterFrequency(iBandId)); sl@0: break; sl@0: sl@0: default: sl@0: iConsole->Printf(_L("ProcessEqualizerL - Unknown command\n")); sl@0: break; sl@0: }; sl@0: sl@0: // Issue another request sl@0: RequestCharacter(); sl@0: } sl@0: sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // -----> Stereo Widening Menu sl@0: // sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: sl@0: void CConsoleTest::ProcessStereoWideningL(TChar aChar) sl@0: { sl@0: sl@0: switch (aChar) sl@0: { sl@0: case '0': // Main Menu sl@0: iMenu = EMain; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: case '1': // Enable / disable sl@0: if ( iStereoWidening->IsEnabled() ) sl@0: iStereoWidening->DisableL(); sl@0: else sl@0: iStereoWidening->EnableL(); sl@0: sl@0: break; sl@0: sl@0: case '2': // Enforce sl@0: if ( iStereoWidening->IsEnforced() ) sl@0: iStereoWidening->EnforceL(EFalse); sl@0: else sl@0: iStereoWidening->EnforceL(ETrue); sl@0: break; sl@0: sl@0: case '3': // Set Stereo Widening Level sl@0: iMenu = EStereoWideningLevel; sl@0: break; sl@0: sl@0: case '4': // Apply Settings sl@0: iStereoWidening->ApplyL(); sl@0: break; sl@0: sl@0: case '9': // Delete volume object sl@0: if (iParentMenu == EPlay) sl@0: { sl@0: delete iStereoWidening; sl@0: iStereoWidening = NULL; sl@0: iPlayerStereoWidening = NULL; sl@0: } sl@0: if (iParentMenu == ERecord) sl@0: { sl@0: delete iStereoWidening; sl@0: iStereoWidening = NULL; sl@0: iRecorderStereoWidening = NULL; sl@0: } sl@0: sl@0: iMenu = EMain; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: default: sl@0: iConsole->Printf(_L("ProcessStereoWideningL - Unknown command\n")); sl@0: break; sl@0: }; sl@0: sl@0: // Issue another request sl@0: RequestCharacter(); sl@0: } sl@0: sl@0: void CConsoleTest::ProcessStereoWideningLevelL(TChar aChar) sl@0: { sl@0: sl@0: ShowMenu(); sl@0: switch (aChar) sl@0: { sl@0: sl@0: case '1': // Level UP sl@0: ShowMenu(); sl@0: iStereoWidening->SetStereoWideningLevelL(iStereoWidening->StereoWideningLevel() + 1); sl@0: iConsole->Printf(_L("Level[%d]\n"), iStereoWidening->StereoWideningLevel() ); sl@0: break; sl@0: sl@0: case '2': // Level Down sl@0: ShowMenu(); sl@0: iStereoWidening->SetStereoWideningLevelL(iStereoWidening->StereoWideningLevel() - 1); sl@0: iConsole->Printf(_L("Level[%d]\n"), iStereoWidening->StereoWideningLevel() ); sl@0: break; sl@0: sl@0: case '3': // Print Level information sl@0: iConsole->Printf(_L("Level: %d\n"), iStereoWidening->StereoWideningLevel()); sl@0: iConsole->Printf(_L("Continuous Level %d\n"), iStereoWidening->IsContinuousLevelSupported()); sl@0: break; sl@0: case '9': // Main Menu sl@0: iMenu = EStereoWidening; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: default: sl@0: iConsole->Printf(_L("ProcessStereoWideningL - Unknown command\n")); sl@0: break; sl@0: }; sl@0: sl@0: // Issue another request sl@0: RequestCharacter(); sl@0: } sl@0: sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // -----> Environmental reverb Menu sl@0: // sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: sl@0: void CConsoleTest::InitializeTestData() sl@0: { sl@0: iGoodData.Append(1000); // Decay HF Ratio sl@0: iGoodData.Append(1000); // Decay Time sl@0: iGoodData.Append(1000); // Density sl@0: iGoodData.Append(1000); // Diffusion sl@0: iGoodData.Append(1000); // Reflections Delay sl@0: iGoodData.Append(1000); // Reflections Level sl@0: iGoodData.Append(1000); // Reverb Delay sl@0: iGoodData.Append(1000); // Reverb Level sl@0: iGoodData.Append(1000); // Room HF Level sl@0: iGoodData.Append(1000); // Room Level sl@0: sl@0: iBadData.Append(50000); // Decay HF Ratio sl@0: iBadData.Append(300000); // Decay Time sl@0: iBadData.Append(10005); // Density sl@0: iBadData.Append(10005); // Diffusion sl@0: iBadData.Append(300000); // Reflections Delay sl@0: iBadData.Append(2000); // Reflections Level sl@0: iBadData.Append(300000); // Reverb Delay sl@0: iBadData.Append(2000); // Reverb Level sl@0: iBadData.Append(2000); // Room HF Level sl@0: iBadData.Append(2000); // Room Level sl@0: sl@0: } sl@0: sl@0: void CConsoleTest::ProcessEnvironmentalReverbL(TChar aChar) sl@0: { sl@0: sl@0: switch (aChar) sl@0: { sl@0: case '0': // Main Menu sl@0: iMenu = EMain; sl@0: ShowMenu(); sl@0: break; sl@0: sl@0: case '1': // Enable / disable sl@0: if ( iEnvironmentalReverb->IsEnabled() ) sl@0: iEnvironmentalReverb->DisableL(); sl@0: else sl@0: iEnvironmentalReverb->EnableL(); sl@0: sl@0: break; sl@0: sl@0: case '2': // Enforce sl@0: if ( iEnvironmentalReverb->IsEnforced() ) sl@0: iEnvironmentalReverb->EnforceL(EFalse); sl@0: else sl@0: iEnvironmentalReverb->EnforceL(ETrue); sl@0: break; sl@0: sl@0: case '3': // Test 1: Setters normal case sl@0: TestCase1(); sl@0: break; sl@0: sl@0: case '4': // Test 2: Setters abnormal case sl@0: TestCase2(); sl@0: break; sl@0: sl@0: case '5': // Test 3: Getters abnormal case sl@0: TestCase3(); sl@0: break; sl@0: sl@0: case '8': // Apply Settings sl@0: iEnvironmentalReverb->ApplyL(); sl@0: break; sl@0: sl@0: case '9': // Delete environmental reverb object sl@0: if (iParentMenu == EPlay) sl@0: { sl@0: delete iEnvironmentalReverb; sl@0: iEnvironmentalReverb = NULL; sl@0: iPlayerEnvironmentalReverb = NULL; sl@0: } sl@0: sl@0: if (iParentMenu == ERecord) sl@0: { sl@0: delete iEnvironmentalReverb; sl@0: iEnvironmentalReverb = NULL; sl@0: iRecorderEnvironmentalReverb = NULL; sl@0: } sl@0: break; sl@0: sl@0: default: sl@0: iConsole->Printf(_L("ProcessEnvironmentalReverbL - Unknown command\n")); sl@0: break; sl@0: }; sl@0: sl@0: // Issue another request sl@0: RequestCharacter(); sl@0: } sl@0: sl@0: void CConsoleTest::TestCase1() sl@0: { sl@0: TRAPD(err1, iEnvironmentalReverb->SetDecayHFRatioL(iGoodData[0])); sl@0: iConsole->Printf(_L("Result 1.1 - %d\n"),err1); sl@0: TRAPD(err2, iEnvironmentalReverb->SetDecayTimeL(iGoodData[1])); sl@0: iConsole->Printf(_L("Result 1.2 - %d\n"),err2); sl@0: TRAPD(err3, iEnvironmentalReverb->SetDensityL(iGoodData[2])); sl@0: iConsole->Printf(_L("Result 1.3 - %d\n"),err3); sl@0: TRAPD(err4, iEnvironmentalReverb->SetDiffusionL(iGoodData[3])); sl@0: iConsole->Printf(_L("Result 1.4 - %d\n"),err4); sl@0: TRAPD(err5, iEnvironmentalReverb->SetReflectionsDelayL(iGoodData[4])); sl@0: iConsole->Printf(_L("Result 1.5 - %d\n"),err5); sl@0: TRAPD(err6, iEnvironmentalReverb->SetReverbDelayL(iGoodData[6])); sl@0: iConsole->Printf(_L("Result 1.6 - %d\n"),err6); sl@0: TRAPD(err7, iEnvironmentalReverb->SetReverbLevelL(iGoodData[7])); sl@0: iConsole->Printf(_L("Result 1.7 - %d\n"),err7); sl@0: TRAPD(err8, iEnvironmentalReverb->SetRoomHFLevelL(iGoodData[8])); sl@0: iConsole->Printf(_L("Result 1.8 - %d\n"),err8); sl@0: TRAPD(err9, iEnvironmentalReverb->SetRoomLevelL(iGoodData[9])); sl@0: iConsole->Printf(_L("Result 1.9 - %d\n"),err9); sl@0: TRAPD(err10, iEnvironmentalReverb->SetReflectionsLevelL(iGoodData[5])); sl@0: iConsole->Printf(_L("Result 1.10 - %d\n"),err10); sl@0: } sl@0: sl@0: void CConsoleTest::TestCase2() sl@0: { sl@0: TRAPD(err1, iEnvironmentalReverb->SetDecayHFRatioL(iBadData[0])); sl@0: iConsole->Printf(_L("Result 1.1 - %d\n"),err1); sl@0: TRAPD(err2, iEnvironmentalReverb->SetDecayTimeL(iBadData[1])); sl@0: iConsole->Printf(_L("Result 1.2 - %d\n"),err2); sl@0: TRAPD(err3, iEnvironmentalReverb->SetDensityL(iBadData[2])); sl@0: iConsole->Printf(_L("Result 1.3 - %d\n"),err3); sl@0: TRAPD(err4, iEnvironmentalReverb->SetDiffusionL(iBadData[3])); sl@0: iConsole->Printf(_L("Result 1.4 - %d\n"),err4); sl@0: TRAPD(err5, iEnvironmentalReverb->SetReflectionsDelayL(iBadData[4])); sl@0: iConsole->Printf(_L("Result 1.5 - %d\n"),err5); sl@0: TRAPD(err6, iEnvironmentalReverb->SetReverbDelayL(iBadData[6])); sl@0: iConsole->Printf(_L("Result 1.6 - %d\n"),err6); sl@0: TRAPD(err7, iEnvironmentalReverb->SetReverbLevelL(iBadData[7])); sl@0: iConsole->Printf(_L("Result 1.7 - %d\n"),err7); sl@0: TRAPD(err8, iEnvironmentalReverb->SetRoomHFLevelL(iBadData[8])); sl@0: iConsole->Printf(_L("Result 1.8 - %d\n"),err8); sl@0: TRAPD(err9, iEnvironmentalReverb->SetRoomLevelL(iBadData[9])); sl@0: iConsole->Printf(_L("Result 1.9 - %d\n"),err9); sl@0: TRAPD(err10, iEnvironmentalReverb->SetReflectionsLevelL(iBadData[5])); sl@0: iConsole->Printf(_L("Result 1.10 - %d\n"),err10); sl@0: } sl@0: sl@0: void CConsoleTest::TestCase3() sl@0: { sl@0: if ( iEnvironmentalReverb->DecayHFRatio() == iGoodData[0] ) sl@0: iConsole->Printf(_L("Result 3.1 - 1\n")); sl@0: else sl@0: iConsole->Printf(_L("Result 3.1 - 0\n")); sl@0: sl@0: if ( iEnvironmentalReverb->DecayTime() == iGoodData[1] ) sl@0: iConsole->Printf(_L("Result 3.2 - 1\n")); sl@0: else sl@0: iConsole->Printf(_L("Result 3.2 - 0\n")); sl@0: sl@0: if ( iEnvironmentalReverb->Density() == iGoodData[2] ) sl@0: iConsole->Printf(_L("Result 3.3 - 1\n")); sl@0: else sl@0: iConsole->Printf(_L("Result 3.3 - 0\n")); sl@0: sl@0: if ( iEnvironmentalReverb->Diffusion() == iGoodData[3] ) sl@0: iConsole->Printf(_L("Result 3.4 - 1\n")); sl@0: else sl@0: iConsole->Printf(_L("Result 3.4 - 0\n")); sl@0: sl@0: if ( iEnvironmentalReverb->ReflectionsDelay() == iGoodData[4] ) sl@0: iConsole->Printf(_L("Result 3.5 - 1\n")); sl@0: else sl@0: iConsole->Printf(_L("Result 3.5 - 0\n")); sl@0: sl@0: if ( iEnvironmentalReverb->ReflectionsLevel() == iGoodData[5] ) sl@0: iConsole->Printf(_L("Result 3.6 - 1\n")); sl@0: else sl@0: iConsole->Printf(_L("Result 3.6 - 0\n")); sl@0: sl@0: if ( iEnvironmentalReverb->ReverbDelay() == iGoodData[6] ) sl@0: iConsole->Printf(_L("Result 3.7 - 1\n")); sl@0: else sl@0: iConsole->Printf(_L("Result 3.7 - 0\n")); sl@0: sl@0: if ( iEnvironmentalReverb->ReverbLevel() == iGoodData[7] ) sl@0: iConsole->Printf(_L("Result 3.8 - 1\n")); sl@0: else sl@0: iConsole->Printf(_L("Result 3.8 - 0\n")); sl@0: sl@0: if ( iEnvironmentalReverb->RoomHFLevel() == iGoodData[8] ) sl@0: iConsole->Printf(_L("Result 3.9 - 1\n")); sl@0: else sl@0: iConsole->Printf(_L("Result 3.9 - 0\n")); sl@0: sl@0: if ( iEnvironmentalReverb->RoomLevel() == iGoodData[9] ) sl@0: iConsole->Printf(_L("Result 3.10 - 1\n")); sl@0: else sl@0: iConsole->Printf(_L("Result 3.10 - 0\n")); sl@0: } sl@0: sl@0: /************************************************************************************************************/ sl@0: sl@0: sl@0: sl@0: sl@0: void CConsoleTest::MapcInitComplete(TInt aStatus, const TTimeIntervalMicroSeconds& aDuration) sl@0: { sl@0: iConsole->Printf(_L("MapcInit: %d\n"), aStatus); sl@0: iInitStatus = aStatus; sl@0: TInt d = I64INT(aDuration.Int64()); sl@0: RDebug::Print(_L("CConsoleTest::MapcInitComplete :-> Status[%d] Duration[%d]"), aStatus, d); sl@0: } sl@0: sl@0: void CConsoleTest::MapcPlayComplete(TInt aErr) sl@0: { sl@0: iConsole->Printf(_L("MapcPlay: %d"), aErr); sl@0: RDebug::Print(_L("CConsoleTest::MapcPlayComplete :-> Error[%d]"), aErr); sl@0: } sl@0: sl@0: void CConsoleTest::EffectChanged( const CAudioEffect* aAudioEffect, TUint8 aEvent ) sl@0: { sl@0: RDebug::Print(_L("CConsoleTest::EffectChanged, Event = %d "), aEvent); sl@0: sl@0: if ( aAudioEffect->Uid() == KUidAudioEqualizerEffect ) sl@0: { sl@0: if ( aEvent == KEnabled ) sl@0: { sl@0: iConsole->Printf(_L("Equalizer state: %d"), ((CAudioEqualizer*)aAudioEffect)->IsEnabled()); sl@0: RDebug::Print(_L("CConsoleTest::EffectChanged :-> Enabled[%d]"), ((CAudioEqualizer*)aAudioEffect)->IsEnabled()); sl@0: } sl@0: } sl@0: else if ( aAudioEffect->Uid() == KUidStereoWideningEffect ) sl@0: { sl@0: if ( aEvent == KEnabled ) sl@0: { sl@0: iConsole->Printf(_L("StereoWidening state: %d"), ((CStereoWidening*)aAudioEffect)->IsEnabled()); sl@0: RDebug::Print(_L("CConsoleTest::EffectChanged :-> Enabled[%d]"), ((CStereoWidening*)aAudioEffect)->IsEnabled()); sl@0: } sl@0: else sl@0: { sl@0: iConsole->Printf(_L("StereoWidening state: %d"), ((CStereoWidening*)aAudioEffect)->IsEnabled()); sl@0: RDebug::Print(_L("CConsoleTest::EffectChanged :-> Enabled[%d]"), ((CStereoWidening*)aAudioEffect)->IsEnabled()); sl@0: } sl@0: } sl@0: sl@0: sl@0: } sl@0: sl@0: void CConsoleTest::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode) sl@0: { sl@0: RDebug::Print(_L("aPreviousState[%d], aCurrentState[%d], aErrorCode[%d]"), aPreviousState, aCurrentState, aErrorCode); sl@0: iInitStatus = aErrorCode; sl@0: iConsole->Printf(_L("Mosco: %d\n"), aErrorCode); sl@0: } sl@0: sl@0: sl@0: sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: // sl@0: // Do the testing sl@0: // sl@0: ////////////////////////////////////////////////////////////////////////////// sl@0: LOCAL_C void doTestL() sl@0: { sl@0: sl@0: CConsoleBase* console = Console::NewL(KTxtDBTest,TSize(KConsFullScreen,KConsFullScreen)); sl@0: CleanupStack::PushL(console); sl@0: sl@0: CmyActiveScheduler* myScheduler = new (ELeave) CmyActiveScheduler; sl@0: CleanupStack::PushL(myScheduler); sl@0: CActiveScheduler::Install(myScheduler); sl@0: sl@0: // Create a CConsoleTest active object sl@0: CConsoleTest* consoleTest = CConsoleTest::NewLC(console); sl@0: consoleTest->ShowMenu(); sl@0: // Issue the first request sl@0: consoleTest->RequestCharacter(); sl@0: sl@0: #ifdef __WINS__ sl@0: _LIT(KTitleMsg,"Ready!\nPress ESC to end.\n\n"); sl@0: #else sl@0: _LIT(KTitleMsg,"Press SPACE(0) to end.\n"); sl@0: #endif sl@0: console->Printf(KTitleMsg); sl@0: // test.Title(); sl@0: sl@0: // Main part of program is a wait loop sl@0: // This function completes when the scheduler stops sl@0: CActiveScheduler::Start(); sl@0: sl@0: _LIT(KTxtPressAnyKey," [press any key]"); sl@0: console->Printf(KTxtPressAnyKey); sl@0: console->Getch(); // get and ignore character sl@0: sl@0: // Remove from the cleanup stack and destroy: sl@0: // 1. consoleTest sl@0: // 2. myScheduler sl@0: // 3. console sl@0: CleanupStack::PopAndDestroy(3); sl@0: } sl@0: