os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/CapTestServer/src/CapTestStep0012.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2003-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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include "CapTestStep0012.h"
    17 
    18 CAudPlayUtilTS0012* CAudPlayUtilTS0012::NewL()
    19 	{
    20 	CAudPlayUtilTS0012* self = new (ELeave) CAudPlayUtilTS0012;
    21 	CleanupStack::PushL(self);
    22 	self->ConstructL();
    23 	CleanupStack::Pop();
    24 	return self;
    25 	}
    26 	
    27 void CAudPlayUtilTS0012::ConstructL()
    28 	{
    29 	// Create the audio player
    30 	iPlayer = CMdaAudioRecorderUtility::NewL(*this, NULL, EMdaPriorityMax);
    31 	}
    32 	
    33 
    34 void CAudPlayUtilTS0012::StartProcessing(TRequestStatus& aStatus)
    35 	{
    36 	iStatus = &aStatus;
    37 	
    38 	iPlayer->OpenFileL(_L("\\AclntITestData\\8bitmPcm.wav"));
    39 	CActiveScheduler::Start();
    40 	}
    41 		
    42 		
    43 TVerdict CAudPlayUtilTS0012::EndProcessingAndReturnResult(TDes8& aMessage)
    44 	{
    45 	iPlayer->Close();
    46 	aMessage.Copy(_L("Done"));
    47 	return EPass;
    48 	}
    49 	
    50 void CAudPlayUtilTS0012::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
    51 	{
    52 	if (aErrorCode == KErrNone)
    53 		{
    54 		if (aPreviousState == CMdaAudioClipUtility::ENotReady && aCurrentState==CMdaAudioClipUtility::EOpen)
    55 			{
    56 			iPlayer->PlayL();
    57 			}
    58 		else if (aPreviousState == CMdaAudioClipUtility::EOpen && aCurrentState==CMdaAudioClipUtility::EPlaying)
    59 			{
    60 			User::RequestComplete(iStatus, KErrNone);
    61 			}
    62 		else if (aPreviousState == CMdaAudioClipUtility::EPlaying && aCurrentState==CMdaAudioClipUtility::EOpen)
    63 			{
    64 			iVerdict = EPass;
    65 			CActiveScheduler::Stop();
    66 			}
    67 		}
    68 	else 
    69 		{
    70 		iVerdict = EFail;
    71 		CActiveScheduler::Stop();
    72 		}
    73 		
    74 	}
    75 
    76 
    77 CAudPlayUtilTS0012::~CAudPlayUtilTS0012()
    78 	{
    79 	delete iPlayer;
    80 	}