os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/CapTestServer/src/CapTestStep0014.cpp
Update contrib.
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "CapTestStep0014.h"
18 CAudPlayUtilTS0014* CAudPlayUtilTS0014::NewL()
20 CAudPlayUtilTS0014* self = new (ELeave) CAudPlayUtilTS0014;
21 CleanupStack::PushL(self);
27 void CAudPlayUtilTS0014::ConstructL()
29 // Create the audio player
30 iInternalState = EStateNone;
31 iPlayer = CMdaAudioRecorderUtility::NewL(*this, NULL, EMdaPriorityMax);
35 void CAudPlayUtilTS0014::StartProcessing(TRequestStatus& aStatus)
38 iInternalState = EStatePending;
40 iPlayer->OpenFileL(_L("c:\\rectest1.wav"));
41 CActiveScheduler::Start();
45 TVerdict CAudPlayUtilTS0014::EndProcessingAndReturnResult(TDes8& aMessage)
48 aMessage.Copy(_L("Done"));
53 void CAudPlayUtilTS0014::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
55 if (aErrorCode == KErrNone)
57 if (aPreviousState == CMdaAudioClipUtility::ENotReady && aCurrentState==CMdaAudioClipUtility::EOpen)
61 else if (aPreviousState == CMdaAudioClipUtility::EOpen && aCurrentState==CMdaAudioClipUtility::ERecording)
63 if(iInternalState == EStatePending)
65 User::RequestComplete(iStatus, KErrNone);
66 iInternalState = EStateComplete;
69 else if (aPreviousState == CMdaAudioClipUtility::ERecording && aCurrentState==CMdaAudioClipUtility::EOpen)
71 // this shouldn't happen as record will continue until interrupted
73 CActiveScheduler::Stop();
74 if(iInternalState == EStatePending)
76 User::RequestComplete(iStatus, KErrCancel);
77 iInternalState = EStateComplete;
81 else if (aErrorCode == KErrInUse)
83 // double check state to ensure behaviour is correct
84 if (aPreviousState == CMdaAudioClipUtility::ERecording && aCurrentState==CMdaAudioClipUtility::EOpen)
87 CActiveScheduler::Stop();
88 if(iInternalState == EStatePending)
90 User::RequestComplete(iStatus, KErrNone);
91 iInternalState = EStateComplete;
99 CActiveScheduler::Stop();
100 if(iInternalState == EStatePending)
102 User::RequestComplete(iStatus, aErrorCode);
103 iInternalState = EStateComplete;
110 CAudPlayUtilTS0014::~CAudPlayUtilTS0014()