sl@0: // Copyright (c) 2003-2009 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: sl@0: // sl@0: sl@0: #include "CapTestStep0012.h" sl@0: sl@0: CAudPlayUtilTS0012* CAudPlayUtilTS0012::NewL() sl@0: { sl@0: CAudPlayUtilTS0012* self = new (ELeave) CAudPlayUtilTS0012; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(); sl@0: return self; sl@0: } sl@0: sl@0: void CAudPlayUtilTS0012::ConstructL() sl@0: { sl@0: // Create the audio player sl@0: iPlayer = CMdaAudioRecorderUtility::NewL(*this, NULL, EMdaPriorityMax); sl@0: } sl@0: sl@0: sl@0: void CAudPlayUtilTS0012::StartProcessing(TRequestStatus& aStatus) sl@0: { sl@0: iStatus = &aStatus; sl@0: sl@0: iPlayer->OpenFileL(_L("\\AclntITestData\\8bitmPcm.wav")); sl@0: CActiveScheduler::Start(); sl@0: } sl@0: sl@0: sl@0: TVerdict CAudPlayUtilTS0012::EndProcessingAndReturnResult(TDes8& aMessage) sl@0: { sl@0: iPlayer->Close(); sl@0: aMessage.Copy(_L("Done")); sl@0: return EPass; sl@0: } sl@0: sl@0: void CAudPlayUtilTS0012::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode) sl@0: { sl@0: if (aErrorCode == KErrNone) sl@0: { sl@0: if (aPreviousState == CMdaAudioClipUtility::ENotReady && aCurrentState==CMdaAudioClipUtility::EOpen) sl@0: { sl@0: iPlayer->PlayL(); sl@0: } sl@0: else if (aPreviousState == CMdaAudioClipUtility::EOpen && aCurrentState==CMdaAudioClipUtility::EPlaying) sl@0: { sl@0: User::RequestComplete(iStatus, KErrNone); sl@0: } sl@0: else if (aPreviousState == CMdaAudioClipUtility::EPlaying && aCurrentState==CMdaAudioClipUtility::EOpen) sl@0: { sl@0: iVerdict = EPass; sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: iVerdict = EFail; sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: sl@0: } sl@0: sl@0: sl@0: CAudPlayUtilTS0012::~CAudPlayUtilTS0012() sl@0: { sl@0: delete iPlayer; sl@0: }