os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/CapTestServer/src/CapTestStep0012.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/CapTestServer/src/CapTestStep0012.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,80 @@
1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include "CapTestStep0012.h"
1.20 +
1.21 +CAudPlayUtilTS0012* CAudPlayUtilTS0012::NewL()
1.22 + {
1.23 + CAudPlayUtilTS0012* self = new (ELeave) CAudPlayUtilTS0012;
1.24 + CleanupStack::PushL(self);
1.25 + self->ConstructL();
1.26 + CleanupStack::Pop();
1.27 + return self;
1.28 + }
1.29 +
1.30 +void CAudPlayUtilTS0012::ConstructL()
1.31 + {
1.32 + // Create the audio player
1.33 + iPlayer = CMdaAudioRecorderUtility::NewL(*this, NULL, EMdaPriorityMax);
1.34 + }
1.35 +
1.36 +
1.37 +void CAudPlayUtilTS0012::StartProcessing(TRequestStatus& aStatus)
1.38 + {
1.39 + iStatus = &aStatus;
1.40 +
1.41 + iPlayer->OpenFileL(_L("\\AclntITestData\\8bitmPcm.wav"));
1.42 + CActiveScheduler::Start();
1.43 + }
1.44 +
1.45 +
1.46 +TVerdict CAudPlayUtilTS0012::EndProcessingAndReturnResult(TDes8& aMessage)
1.47 + {
1.48 + iPlayer->Close();
1.49 + aMessage.Copy(_L("Done"));
1.50 + return EPass;
1.51 + }
1.52 +
1.53 +void CAudPlayUtilTS0012::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
1.54 + {
1.55 + if (aErrorCode == KErrNone)
1.56 + {
1.57 + if (aPreviousState == CMdaAudioClipUtility::ENotReady && aCurrentState==CMdaAudioClipUtility::EOpen)
1.58 + {
1.59 + iPlayer->PlayL();
1.60 + }
1.61 + else if (aPreviousState == CMdaAudioClipUtility::EOpen && aCurrentState==CMdaAudioClipUtility::EPlaying)
1.62 + {
1.63 + User::RequestComplete(iStatus, KErrNone);
1.64 + }
1.65 + else if (aPreviousState == CMdaAudioClipUtility::EPlaying && aCurrentState==CMdaAudioClipUtility::EOpen)
1.66 + {
1.67 + iVerdict = EPass;
1.68 + CActiveScheduler::Stop();
1.69 + }
1.70 + }
1.71 + else
1.72 + {
1.73 + iVerdict = EFail;
1.74 + CActiveScheduler::Stop();
1.75 + }
1.76 +
1.77 + }
1.78 +
1.79 +
1.80 +CAudPlayUtilTS0012::~CAudPlayUtilTS0012()
1.81 + {
1.82 + delete iPlayer;
1.83 + }