os/mm/mmlibs/mmfw/tsrc/mmfintegrationtest/ACLNT/TestTone.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2002-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 // This program is designed the test of the MMF_ACLNT.
    15 // 
    16 //
    17 
    18 /**
    19  @file TestTone.cpp
    20 */
    21 
    22 
    23 #include "TestTone.h"
    24 
    25 const TInt KHeapSizeToneTestEKA2 = 128000; // Heapsize for tone tests on EKA2
    26 
    27 /**
    28  * Constructor
    29  */
    30 CTestMmfAclntTone::CTestMmfAclntTone(const TDesC& aTestName, const TInt aExpectedResult)
    31 	{
    32 	// store the name of this test case
    33 	// this is the name that is used by the script file
    34 	// Each test step initialises it's own name
    35 	iTestStepName = aTestName;
    36 	
    37 // need a bigger heap size on EKA2 HW
    38 #if !defined __WINS__
    39 	iHeapSize = KHeapSizeToneTestEKA2;
    40 #endif // EKA2
    41 
    42 	iFrequency = KToneFrequency;
    43 	iDuration = TTimeIntervalMicroSeconds(KOneSecond);
    44 	iExpectedResult = aExpectedResult;
    45 	iStop = ETrue;
    46 	}
    47 
    48 CTestMmfAclntTone* CTestMmfAclntTone::NewL(const TDesC& aTestName, const TInt aExpectedResult)
    49 	{
    50 	CTestMmfAclntTone* self = new (ELeave) CTestMmfAclntTone(aTestName,aExpectedResult);
    51 	return self;
    52 	}
    53 
    54 void CTestMmfAclntTone::MatoPrepareComplete(TInt aError)
    55 	{
    56 	iError = aError;
    57 	INFO_PRINTF1( _L("CTestMmfAclntTone::MatoPrepareComplete MMdaAudioToneObserver Callback for CMdaAudioToneUtility complete"));
    58 	INFO_PRINTF2( _L("iError %d"), iError);
    59 	if(iStop)
    60 		CActiveScheduler::Stop();
    61 	}
    62 
    63 void CTestMmfAclntTone::MatoPlayComplete(TInt aError)
    64 	{
    65 	iError = aError;
    66 	INFO_PRINTF1( _L("CTestMmfAclntTone::MatoPlayComplete MMdaAudioToneObserver Callback for CMdaAudioToneUtility complete"));
    67 	INFO_PRINTF2( _L("iError %d"), iError);
    68 	if(iStop)
    69 		CActiveScheduler::Stop();
    70 	}
    71 
    72 /**
    73  * Play a tone
    74  */
    75 TVerdict CTestMmfAclntTone::DoTestStepL()
    76 	{
    77 	INFO_PRINTF1( _L("TestTone : Play"));
    78 
    79 	iStop = ETrue;
    80 	TVerdict ret = EFail;
    81 	iError = KErrTimedOut;
    82 
    83 	CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
    84 	CleanupStack::PushL(toneUtil);
    85 	toneUtil->PrepareToPlayTone(iFrequency,iDuration);
    86 	// Wait for prepare
    87 	INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
    88 	CActiveScheduler::Start();
    89 
    90 	if(iError == KErrNone)
    91 		ret = DoTestL(toneUtil);
    92 
    93 	//produce another tone to confirm that the configuration is retained over multiple plays
    94 	if(iError == KErrNone)
    95 		ret = DoTestL(toneUtil);
    96 	
    97 	if(ret == EFail)
    98 		ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
    99 
   100 	CleanupStack::PopAndDestroy(toneUtil);
   101 	return	ret;
   102 	}
   103 
   104 TVerdict CTestMmfAclntTone::DoTestL(CMdaAudioToneUtility* aToneUtil)
   105 	{
   106 	TVerdict ret = EFail;
   107 	iError = KErrTimedOut;
   108 		
   109 	aToneUtil->Play();
   110 	// wait for play.
   111 	INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
   112 	CActiveScheduler::Start();
   113 
   114 	if(iError == iExpectedResult)
   115 		ret = EPass;
   116 	
   117 	return ret;
   118 	}
   119 
   120 //------------------------------------------------------------------
   121 
   122 //Play DualTone Test for Sirocco CR
   123 CTestMmfAclntDualTone::CTestMmfAclntDualTone(const TDesC& aTestName) 
   124 	: CTestMmfAclntTone(aTestName) 
   125 	{
   126 	iFreqOne = KToneFrequency;
   127 	iFreqTwo = KToneFrequencyTwo;
   128 	}
   129 
   130 CTestMmfAclntDualTone* CTestMmfAclntDualTone::NewL(const TDesC& aTestName)
   131 	{
   132 	CTestMmfAclntDualTone* self = new (ELeave) CTestMmfAclntDualTone(aTestName);
   133 	return self;
   134 	}
   135 
   136 
   137 /**
   138  * Play a Dual tone
   139  */
   140 
   141 TVerdict CTestMmfAclntDualTone::DoTestStepL()
   142 	{
   143 	INFO_PRINTF1( _L("TestTone : Play Dual Tone"));
   144 
   145 	TVerdict ret = EFail;
   146 	iError = KErrTimedOut;
   147 
   148 	CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
   149 	CleanupStack::PushL(toneUtil);
   150 	toneUtil->PrepareToPlayDualTone(iFreqOne,iFreqTwo,iDuration);
   151 	
   152 	// Wait for prepare
   153 	INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
   154 	CActiveScheduler::Start();
   155 
   156 	if(iError == KErrNone)
   157 		ret = DoTestL(toneUtil);
   158 
   159 	//produce another tone to confirm that the configuration is retained over multiple plays
   160 	if(iError == KErrNone)
   161 		ret = DoTestL(toneUtil);
   162 	
   163 	if(ret == EFail)
   164 		ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
   165 
   166 	CleanupStack::PopAndDestroy(toneUtil);
   167 	return	ret;
   168 	}
   169 
   170 //------------------------------------------------------------------
   171 
   172 
   173 CTestMmfAclntToneDtmf::CTestMmfAclntToneDtmf(const TDesC& aTestName,const TDesC& aDTMF,const TInt aExpectedResult)
   174 	: CTestMmfAclntTone(aTestName,aExpectedResult), iDTMF(aDTMF)
   175 	{}
   176 
   177 CTestMmfAclntToneDtmf* CTestMmfAclntToneDtmf::NewL(const TDesC& aTestName,const TDesC& aDTMF,const TInt aExpectedResult)
   178 	{
   179 	CTestMmfAclntToneDtmf* self = new (ELeave) CTestMmfAclntToneDtmf(aTestName,aDTMF,aExpectedResult);
   180 	return self;
   181 	}
   182 
   183 /**
   184  * Play a DTMF string
   185  */
   186 TVerdict CTestMmfAclntToneDtmf::DoTestStepL()
   187 	{
   188 	INFO_PRINTF1( _L("TestTone : Play DTMF"));
   189 
   190 	TVerdict ret = EFail;
   191 	iError = KErrTimedOut;
   192 
   193 	CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
   194 	CleanupStack::PushL(toneUtil);
   195 	toneUtil->PrepareToPlayDTMFString(iDTMF);
   196 	// Wait for prepare to complete
   197 	INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
   198 	CActiveScheduler::Start();
   199 
   200 	toneUtil->PrepareToPlayDTMFString(iDTMF);
   201 	// Wait for prepare to complete
   202 	INFO_PRINTF1( _L("Reinitialise CMdaAudioToneUtility"));
   203 	CActiveScheduler::Start();
   204 
   205 	if(iError == KErrNone)
   206 		ret = DoTestL(toneUtil);
   207 	else if (iError == iExpectedResult)
   208 		{
   209 		INFO_PRINTF2( _L("Initialisation failed as expected with code %d"), iError);
   210 		ret = EPass;
   211 		iError = KErrNone;
   212 		}
   213 		
   214 	if(ret == EFail)
   215 		ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
   216 
   217 	CleanupStack::PopAndDestroy(toneUtil);
   218 	return ret;
   219 	}
   220 
   221 //------------------------------------------------------------------
   222 
   223 /**
   224  * Constructor
   225  */
   226 CTestMmfAclntToneFile::CTestMmfAclntToneFile(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
   227 	: CTestMmfAclntTone(aTestName)
   228 	{
   229 	// store the name of this test case
   230 	// this is the name that is used by the script file
   231 	// Each test step initialises it's own name
   232 	iSectName = aSectName;
   233 	iKeyName= aKeyName;
   234 	}
   235 
   236 CTestMmfAclntToneFile* CTestMmfAclntToneFile::NewL(const TDesC& aTestName, const TDesC& aSectName, const TDesC& aKeyName)
   237 	{
   238 	CTestMmfAclntToneFile* self = new (ELeave) CTestMmfAclntToneFile(aTestName,aSectName,aKeyName);
   239 	return self;
   240 	}
   241 
   242 TVerdict CTestMmfAclntToneFile::DoTestStepPreambleL()
   243 	{
   244 	TPtrC filename;
   245 	if(!GetStringFromConfig(iSectName, iKeyName, filename))
   246 		return EInconclusive;
   247 
   248 	// Create a sequence file
   249 	TInt length;
   250 	RFs fs;
   251 
   252 	fs.Connect();
   253 	CleanupClosePushL(fs);
   254 #ifdef __IPC_V2_PRESENT__
   255 	User::LeaveIfError(fs.ShareAuto());
   256 #else
   257 	User::LeaveIfError(fs.Share(RSessionBase::EExplicitAttach));
   258 #endif
   259 	RFile file;
   260 	User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
   261 	CleanupClosePushL(file);
   262 	User::LeaveIfError(file.Write(KFixedSequenceData()));
   263 	User::LeaveIfError(file.Size(length));
   264 	CleanupStack::PopAndDestroy(2, &fs);
   265 
   266 	return CTestMmfAclntStep::DoTestStepPreambleL();
   267 	}
   268 
   269 /**
   270  * Play a tone file
   271  */
   272 TVerdict CTestMmfAclntToneFile::DoTestStepL( void )
   273 	{
   274 	INFO_PRINTF1( _L("TestTone : Play File"));
   275 
   276 	TVerdict ret = EFail;
   277 
   278 
   279 	TPtrC filename;
   280 	if(!GetStringFromConfig(iSectName, iKeyName, filename))
   281 		return EInconclusive;
   282 
   283 	iError = KErrTimedOut;
   284 	// perform test using this file
   285 	CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
   286 	CleanupStack::PushL(toneUtil);
   287 	toneUtil->PrepareToPlayFileSequence(filename);
   288 	// Wait for prepare
   289 	INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
   290 	CActiveScheduler::Start();
   291 
   292 	toneUtil->PrepareToPlayFileSequence(filename);
   293 	// Wait for prepare
   294 	INFO_PRINTF1( _L("re-initialise CMdaAudioToneUtility"));
   295 	CActiveScheduler::Start();
   296 
   297 	if(iError == KErrNone)
   298 		ret = DoTestL(toneUtil);
   299 
   300 	if(ret == EFail)
   301 		ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
   302 
   303 	CleanupStack::PopAndDestroy(toneUtil);
   304 	return ret;
   305 	}
   306 
   307 //------------------------------------------------------------------
   308 
   309 /**
   310  * Constructor
   311  */
   312 CTestMmfAclntToneDes::CTestMmfAclntToneDes(const TDesC& aTestName, const TDesC8& aDes, const TInt aExpectedResult)
   313 	: CTestMmfAclntTone(aTestName, aExpectedResult), iDes(aDes)
   314 	{}
   315 
   316 CTestMmfAclntToneDes* CTestMmfAclntToneDes::NewL(const TDesC& aTestName, const TDesC8& aDes, const TInt aExpectedResult)
   317 	{
   318 	CTestMmfAclntToneDes* self = new (ELeave) CTestMmfAclntToneDes(aTestName,aDes, aExpectedResult);
   319 	return self;
   320 	}
   321 
   322 /**
   323  * Play a tone from a descriptor.
   324  */
   325 TVerdict CTestMmfAclntToneDes::DoTestStepL()
   326 	{
   327 	INFO_PRINTF1( _L("TestTone : Play Des"));
   328 
   329 	TVerdict ret = EFail;
   330 	iError = KErrTimedOut;
   331 
   332 	CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
   333 	CleanupStack::PushL(toneUtil);
   334 	toneUtil->PrepareToPlayDesSequence(iDes);
   335 	// Wait for prepare
   336 	INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
   337 	CActiveScheduler::Start();
   338 
   339 	toneUtil->PrepareToPlayDesSequence(iDes);
   340 	// Wait for prepare
   341 	INFO_PRINTF1( _L("re-initialise CMdaAudioToneUtility"));
   342 	CActiveScheduler::Start();
   343 
   344 	if(iError == KErrNone)
   345 		ret = DoTestL(toneUtil);
   346 
   347 	if(ret == EFail)
   348 		ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
   349 
   350 	CleanupStack::PopAndDestroy(toneUtil);
   351 	return ret;
   352 	}
   353 
   354 //------------------------------------------------------------------
   355 
   356 /**
   357  * Constructor
   358  */
   359 CTestMmfAclntToneFixed::CTestMmfAclntToneFixed(const TDesC& aTestName,const TInt aTone)
   360 	:CTestMmfAclntTone(aTestName), iTone(aTone)
   361 	{}
   362 
   363 CTestMmfAclntToneFixed* CTestMmfAclntToneFixed::NewL(const TDesC& aTestName,const TInt aTone)
   364 	{
   365 	CTestMmfAclntToneFixed* self = new (ELeave) CTestMmfAclntToneFixed(aTestName,aTone);
   366 	return self;
   367 	}
   368 
   369 /**
   370  * Play a predefined/fixed tone
   371  */
   372 TVerdict CTestMmfAclntToneFixed::DoTestStepL()
   373 	{
   374 	#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND
   375 		INFO_PRINTF1( _L("TestTone : Play Fixed - no longer supported"));
   376 
   377 		TVerdict ret = EFail;
   378 		iError = KErrTimedOut;
   379 
   380 		CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
   381 		CleanupStack::PushL(toneUtil);
   382 		toneUtil->PrepareToPlayFixedSequence(iTone);
   383 		// Wait for prepare
   384 		INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
   385 		CActiveScheduler::Start();
   386 
   387 		toneUtil->PrepareToPlayFixedSequence(iTone);
   388 		// Wait for prepare
   389 		INFO_PRINTF1( _L("re-initialise CMdaAudioToneUtility"));
   390 		CActiveScheduler::Start();
   391 
   392 		// Has Audio Utility intialisied ?
   393 		TInt sequenceCount = toneUtil->FixedSequenceCount();
   394 		INFO_PRINTF2( _L("FixedSequenceCount() returned %d"),sequenceCount);
   395 		if(sequenceCount <= 0)
   396 			{
   397 			INFO_PRINTF1( _L("Play Fixed Sequence is no longer supported"));
   398 			ret = EPass;
   399 			}
   400 
   401 		if(ret == EFail)
   402 			ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
   403 
   404 		CleanupStack::PopAndDestroy(toneUtil);
   405 		return ret;
   406 		
   407 	#else
   408 		INFO_PRINTF1( _L("TestTone : Play Fixed"));
   409 
   410 		TVerdict ret = EFail;
   411 		iError = KErrTimedOut;
   412 
   413 		CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
   414 		CleanupStack::PushL(toneUtil);
   415 		toneUtil->PrepareToPlayFixedSequence(iTone);
   416 		// Wait for prepare
   417 		INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
   418 		CActiveScheduler::Start();
   419 
   420 		toneUtil->PrepareToPlayFixedSequence(iTone);
   421 		// Wait for prepare
   422 		INFO_PRINTF1( _L("re-initialise CMdaAudioToneUtility"));
   423 		CActiveScheduler::Start();
   424 
   425 		// Has Audio Utility intialisied ?
   426 		TInt sequenceCount = toneUtil->FixedSequenceCount() ;
   427 		if((iError == KErrNone) && (sequenceCount > 0))
   428 			{
   429 			INFO_PRINTF2( _L("FixedSequenceName is %S"), &toneUtil->FixedSequenceName(sequenceCount - 1)) ;
   430 			ret = DoTestL(toneUtil);
   431 			}
   432 
   433 		if(ret == EFail)
   434 			ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
   435 
   436 		CleanupStack::PopAndDestroy(toneUtil);
   437 		return ret;
   438 	#endif
   439 	}
   440 //------------------------------------------------------------------
   441 
   442 /**
   443  * Constructor
   444  */
   445 CTestMmfAclntToneAudio::CTestMmfAclntToneAudio()
   446 	{
   447 	// store the name of this test case
   448 	// this is the name that is used by the script file
   449 	// Each test step initialises it's own name
   450 	iTestStepName = _L("MM-MMF-ACLNT-I-0156-LP");
   451 	
   452 // this test does not inherit from CTestMmfAclntTone
   453 // so we need to make the heap bigger here	
   454 // need a bigger heap size on EKA2 HW
   455 #if !defined __WINS__
   456 	iHeapSize = KHeapSizeToneTestEKA2;
   457 #endif // EKA2
   458 	}
   459 
   460 void CTestMmfAclntToneAudio::MatoPrepareComplete(TInt aError)
   461 	{
   462 	iToneError = aError;
   463 	INFO_PRINTF1( _L("CTestMmfAclntToneAudio::MatoPrepareComplete MMdaAudioToneObserver Callback for CMdaAudioToneUtility complete"));
   464 	INFO_PRINTF2( _L("iToneError %d"), iToneError);
   465 	CActiveScheduler::Stop();
   466 	}
   467 
   468 void CTestMmfAclntToneAudio::MatoPlayComplete(TInt aError)
   469 	{
   470 	INFO_PRINTF1( _L("CTestMmfAclntToneAudio::MatoPlayComplete MMdaAudioToneObserver Callback for CMdaAudioToneUtility called"));
   471 	iToneError = aError;
   472 	INFO_PRINTF2( _L("iToneError %d"), iToneError);
   473 
   474 	if((--iCallbackCount) == 0)
   475 		CActiveScheduler::Stop();
   476 	}
   477 
   478 void CTestMmfAclntToneAudio::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
   479 	{
   480 	iPlayerError = aError;
   481 	CActiveScheduler::Stop();
   482 	}	
   483 
   484 void CTestMmfAclntToneAudio::MapcPlayComplete(TInt aError)
   485 	{
   486 	INFO_PRINTF1( _L("CTestMmfAclntToneAudio::MatcPlayComplete MMdaAudioPlayerCallback for CMdaAudioPlayerUtility called"));
   487 	iPlayerError = aError;
   488 	INFO_PRINTF2( _L("iPlayerError %d"), iPlayerError);
   489 
   490 	if((--iCallbackCount) == 0)
   491 		CActiveScheduler::Stop();
   492 	}
   493 
   494 //------------------------------------------------------------------
   495 
   496 /**
   497  * Playing a tone and playing an audio file.
   498  */
   499 TVerdict CTestMmfAclntToneAudio::DoTestStepL( void )
   500 	{
   501 	INFO_PRINTF1( _L("TestTone : Tone/File"));
   502 
   503 	TBuf<KSizeBuf>	filename;
   504 	TPtrC			filename1; 
   505 	if(!GetStringFromConfig(_L("SectionOne"), _L("playerAudioFile"), filename1))
   506 		return EInconclusive;
   507 
   508 	GetDriveName(filename);
   509 	filename.Append(filename1);
   510 	
   511 	iPlayerError = KErrTimedOut;
   512 	CMdaAudioPlayerUtility* playerUtility = 
   513 		//CMdaAudioPlayerUtility::NewFilePlayerL(filename,*this);//, EPriorityHigh);
   514 		CMdaAudioPlayerUtility::NewFilePlayerL(filename,*this, EPriorityNormal);
   515 
   516 	CleanupStack::PushL(playerUtility);
   517 	
   518 	// Wait for prepare
   519 	INFO_PRINTF1( _L("Initialise CMdaAudioPlayerUtility"));
   520 	CActiveScheduler::Start();
   521 
   522 	if(iPlayerError == KErrNone)
   523 		{
   524 		iToneError = KErrTimedOut;
   525 		INFO_PRINTF1( _L("Create audio tone utility..."));
   526 		CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
   527 		CleanupStack::PushL(toneUtil);
   528 		
   529 		INFO_PRINTF1( _L("Prepare to play tone..."));
   530 		toneUtil->PrepareToPlayTone(KToneFrequency,TTimeIntervalMicroSeconds(KOneSecond));
   531 		// Wait for prepare
   532 		INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
   533 		CActiveScheduler::Start();
   534 
   535 		INFO_PRINTF1( _L("Re-prepare to play tone..."));
   536 		toneUtil->PrepareToPlayTone(KToneFrequency,TTimeIntervalMicroSeconds(KOneSecond));
   537 		// Wait for prepare
   538 		INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
   539 		CActiveScheduler::Start();
   540 
   541 		toneUtil->SetPriority(EPriorityHigh, EMdaPriorityPreferenceNone);
   542 		if(iToneError == KErrNone)
   543 			{
   544 			iPlayerError = KErrTimedOut;
   545 			iToneError = KErrTimedOut;
   546 
   547 			// play files together
   548 			INFO_PRINTF1( _L("Play CMdaAudioPlayerUtility"));
   549 			playerUtility->Play();
   550 			INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
   551 			toneUtil->Play();
   552 
   553 			iCallbackCount = 2;
   554 			CActiveScheduler::Start();
   555 			// Wait for two callbacks
   556 
   557 			//Tone utility is at priority high - should complete normally
   558 			//Player is at priority normal should complete with KErrInUse
   559 			//KErrAccessDenied is OK here, at least until we can do Mixing
   560 			if(iToneError==KErrNone && (iPlayerError==KErrInUse || iPlayerError==KErrNone))
   561 				{
   562 				CleanupStack::PopAndDestroy(2); // playerUtility, toneUtil
   563 				return EPass;
   564 				}
   565 			}
   566 		CleanupStack::PopAndDestroy(toneUtil);
   567 		}
   568 	else
   569 		INFO_PRINTF1( _L("Cannot initialise CMdaAudioPlayerUtility"));
   570 
   571 	ERR_PRINTF2( _L("CMdaAudioToneUtility completed with player error %d"),iPlayerError );
   572 	ERR_PRINTF2( _L("CMdaAudioToneUtility completed with tone error %d"),iToneError );
   573 	CleanupStack::PopAndDestroy(playerUtility);
   574 	return EFail;
   575 	}
   576 
   577 //------------------------------------------------------------------
   578 
   579 /** Constructor
   580  */
   581 CTestMmfAclntToneCancelP::CTestMmfAclntToneCancelP(const TDesC& aTestName)
   582 	:CTestMmfAclntTone(aTestName)
   583 	{}
   584 
   585 CTestMmfAclntToneCancelP* CTestMmfAclntToneCancelP::NewL(const TDesC& aTestName)
   586 	{
   587 	CTestMmfAclntToneCancelP* self = new (ELeave) CTestMmfAclntToneCancelP(aTestName);
   588 	return self;
   589 	}
   590 
   591 /**
   592  * Cancel tone play
   593  */
   594 TVerdict CTestMmfAclntToneCancelP::DoTestL(CMdaAudioToneUtility* aToneUtil)
   595 	{
   596 	INFO_PRINTF1( _L("TestTone : Cancel Play"));
   597 
   598 	iStop = EFalse;
   599 	TVerdict ret = EFail;
   600 
   601 	aToneUtil->Play();
   602 	INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
   603 	if(aToneUtil->State() == EMdaAudioToneUtilityPlaying)
   604 		{
   605 		// cancel play.
   606 		INFO_PRINTF1( _L("Cancel Play CMdaAudioToneUtility"));
   607 		aToneUtil->CancelPlay();
   608 		// make sure tone is no longer playing
   609 		if(aToneUtil->State() != EMdaAudioToneUtilityPlaying)
   610 			ret = EPass;
   611 		}
   612 	return ret;
   613 	}
   614 
   615 //------------------------------------------------------------------
   616 /**
   617  * Constructor
   618  */
   619 CTestMmfAclntToneCancelIni::CTestMmfAclntToneCancelIni(const TDesC& aTestName)
   620 	:CTestMmfAclntTone(aTestName)
   621 	{}
   622 
   623 CTestMmfAclntToneCancelIni* CTestMmfAclntToneCancelIni::NewL(const TDesC& aTestName)
   624 	{
   625 	CTestMmfAclntToneCancelIni* self = new (ELeave) CTestMmfAclntToneCancelIni(aTestName);
   626 	return self;
   627 	}
   628 
   629 /** 
   630  * Cancel tone prepare.
   631  * 
   632  * This fucntion cannot leave
   633  */
   634 TVerdict CTestMmfAclntToneCancelIni::DoTestStepL()
   635 	{
   636 	INFO_PRINTF1( _L("TestTone : Cancel Prepare"));
   637 
   638 	TVerdict ret = EFail;
   639 	iError = KErrTimedOut;
   640 
   641 	CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
   642 	CleanupStack::PushL(toneUtil);
   643 	INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
   644 	toneUtil->PrepareToPlayFixedSequence(0);
   645 	INFO_PRINTF1( _L("Cancel Prep CMdaAudioToneUtility"));
   646 	toneUtil->CancelPrepare();
   647 	// make sure init callback did not complete
   648 	if((iError == KErrTimedOut) && (toneUtil->State() != EMdaAudioToneUtilityPrepared))
   649 		ret = EPass;
   650 
   651 	if(ret == EFail)
   652 		ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
   653 
   654 	CleanupStack::PopAndDestroy(toneUtil);
   655 	return ret;
   656 	}
   657 
   658 //------------------------------------------------------------------
   659 
   660 /**
   661  * Constructor
   662  */
   663 CTestMmfAclntToneNames::CTestMmfAclntToneNames(const TDesC& aTestName)
   664 	:CTestMmfAclntToneFixed(aTestName,1)
   665 	{}
   666 
   667 CTestMmfAclntToneNames* CTestMmfAclntToneNames::NewL(const TDesC& aTestName)
   668 	{
   669 	CTestMmfAclntToneNames* self = new (ELeave) CTestMmfAclntToneNames(aTestName);
   670 	return self;
   671 	}
   672 
   673 /**
   674  * Enquire sequence name
   675  *
   676  * This function cannot leave
   677  */
   678 TVerdict CTestMmfAclntToneNames::DoTestL(CMdaAudioToneUtility* aToneUtil)
   679 	{
   680 	INFO_PRINTF1( _L("TestTone : Seq Name"));
   681 
   682 	TVerdict ret = EPass;
   683 	TBuf<32> seqName;
   684 	TInt count = aToneUtil->FixedSequenceCount();
   685 
   686 	for(TInt i = 0; i < count; i++)
   687 		{
   688 		seqName = aToneUtil->FixedSequenceName(i);
   689 		if(seqName.Length() < 1) 
   690 			{
   691 			ret = EFail;
   692 			break;
   693 			}
   694 		}
   695 	return ret;
   696 	}
   697 
   698 //------------------------------------------------------------------
   699 
   700 /**
   701  * Constructor
   702  */
   703 CTestMmfAclntToneCount::CTestMmfAclntToneCount(const TDesC& aTestName)
   704 	:CTestMmfAclntToneFixed(aTestName,1)
   705 	{}
   706 
   707 CTestMmfAclntToneCount* CTestMmfAclntToneCount::NewL(const TDesC& aTestName)
   708 	{
   709 	CTestMmfAclntToneCount* self = new (ELeave) CTestMmfAclntToneCount(aTestName);
   710 	return self;
   711 	}
   712 
   713 /**
   714  * Enquire sequence count
   715  */
   716 TVerdict CTestMmfAclntToneCount::DoTestL(CMdaAudioToneUtility* aToneUtil)
   717 	{
   718 	INFO_PRINTF1( _L("TestTone : Seq Count"));
   719 
   720 	iError = KErrTimedOut;
   721 
   722 	if(aToneUtil->FixedSequenceCount() == KFixedSequenceCount)
   723 		return EPass;
   724 
   725 	return	EFail ;
   726 	}
   727 
   728 //------------------------------------------------------------------
   729 
   730 /**
   731  * Constructor
   732  */
   733 CTestMmfAclntToneVolume::CTestMmfAclntToneVolume(const TDesC& aTestName,const TInt aVolume)
   734 	:CTestMmfAclntTone(aTestName), iVolume(aVolume)
   735 	{}
   736 
   737 CTestMmfAclntToneVolume* CTestMmfAclntToneVolume::NewL(const TDesC& aTestName,const TInt aVolume)
   738 	{
   739 	CTestMmfAclntToneVolume* self = new (ELeave) CTestMmfAclntToneVolume(aTestName,aVolume);
   740 	return self;
   741 	}
   742 
   743 /**
   744  * Set volume to max and enquire volume
   745  */
   746 TVerdict CTestMmfAclntToneVolume::DoTestL(CMdaAudioToneUtility* aToneUtil)
   747 	{
   748 	INFO_PRINTF1( _L("TestTone : Volume"));
   749 
   750 	TVerdict ret = EFail;
   751 
   752 	// added from CTestMmfAclntTone : we need the device to be open before
   753 	// SetVolume() will function correctly
   754 
   755 	aToneUtil->Play();
   756 	// wait for play.
   757 	INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
   758 
   759 	// don't wait for it to finish - run this test while playing
   760 	// so we know device is open
   761 
   762 	// Check maxvolume function
   763 	if(iVolume == -1)
   764 		{
   765 		iVolume = aToneUtil->MaxVolume();
   766 		aToneUtil->SetVolume(iVolume);
   767 		INFO_PRINTF3(_L("volume = %d iVolume = %d"), aToneUtil->Volume(), iVolume); 
   768 		if(aToneUtil->Volume() == iVolume)
   769 			ret = EPass;
   770 		}
   771 	// Volume is truncated to maxvolume
   772 	if(iVolume > aToneUtil->MaxVolume())
   773 		{
   774 		aToneUtil->SetVolume(iVolume);
   775 		INFO_PRINTF3(_L("volume = %d maxVolume = %d"), aToneUtil->Volume(), aToneUtil->MaxVolume()); 
   776 		if(aToneUtil->Volume() == aToneUtil->MaxVolume())
   777 			ret = EPass;
   778 		}
   779 	// Volume is truncated to 0
   780 	else if(iVolume < 0)
   781 		{
   782 		aToneUtil->SetVolume(iVolume);
   783 		INFO_PRINTF2(_L("volume = %d, expecting 0"), aToneUtil->Volume()); 
   784 		if(aToneUtil->Volume() == 0)
   785 			ret = EPass;
   786 		}
   787 	// Set volume and check
   788 	else
   789 		{
   790 		aToneUtil->SetVolume(iVolume);
   791 		INFO_PRINTF3(_L("volume = %d iVolume = %d"), aToneUtil->Volume(), iVolume); 
   792 		if(aToneUtil->Volume() == iVolume)
   793 			ret = EPass;
   794 		}
   795 
   796 	// let it finish playing
   797 	CActiveScheduler::Start();
   798 
   799 	return ret;
   800 	}
   801 
   802 
   803 //------------------------------------------------------------------
   804 
   805 /**
   806  * Constructor
   807  */
   808 CTestMmfAclntVolumeRamp::CTestMmfAclntVolumeRamp(const TDesC& aTestName, const TInt aRamp)
   809 	:CTestMmfAclntTone(aTestName), iRamp(aRamp)
   810 	{}
   811 
   812 CTestMmfAclntVolumeRamp* CTestMmfAclntVolumeRamp::NewL(const TDesC& aTestName, const TInt aRamp)
   813 	{
   814 	CTestMmfAclntVolumeRamp* self = new (ELeave) CTestMmfAclntVolumeRamp(aTestName,aRamp);
   815 	return self;
   816 	}
   817 
   818 /**
   819  * Set volume ramp
   820  * This function cannot leave
   821  */
   822 TVerdict CTestMmfAclntVolumeRamp::DoTestL(CMdaAudioToneUtility* aToneUtil)
   823 	{
   824 
   825 	INFO_PRINTF1( _L("TestTone : Ramp"));
   826 
   827 	TTimeIntervalMicroSeconds ramp(iRamp);
   828 	aToneUtil->SetVolumeRamp(ramp);
   829 
   830 	// aToneUtil->[Get]VolumeRamp() doesn't exist.
   831 	// For now, if SetVolumeRamp() doesn't panic, we have to return EPass.
   832 	// In future, maybe we can play the clip and get the volume at intervals?
   833 	INFO_PRINTF1(_L("Warning : no API function to get volume ramp"));
   834 
   835 	return EPass;
   836 	}
   837 
   838 //------------------------------------------------------------------
   839 
   840 /**
   841  * Constructor
   842  */
   843 CTestMmfAclntToneRepeat::CTestMmfAclntToneRepeat(const TDesC& aTestName)
   844 	:CTestMmfAclntTone(aTestName)
   845 	{}
   846 
   847 CTestMmfAclntToneRepeat* CTestMmfAclntToneRepeat::NewL(const TDesC& aTestName)
   848 	{
   849 	CTestMmfAclntToneRepeat* self = new (ELeave) CTestMmfAclntToneRepeat(aTestName);
   850 	return self;
   851 	}
   852 
   853 /**
   854  * Set repeats
   855  */
   856 TVerdict CTestMmfAclntToneRepeat::DoTestL(CMdaAudioToneUtility* aToneUtil)
   857 	{
   858 	INFO_PRINTF1( _L("TestTone : Repeats"));
   859 
   860 	iError = KErrTimedOut;
   861 
   862 	TTimeIntervalMicroSeconds silence(0);
   863 	aToneUtil->SetRepeats(NUMBER_OF_REPEATS,silence);
   864 
   865 	TInt duration = I64INT(iDuration.Int64());
   866 
   867 	iError = KErrTimedOut;
   868 	INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
   869 	aToneUtil->Play();
   870 
   871 	TTime start;
   872 	start.HomeTime();
   873 	CActiveScheduler::Start();
   874 	TTime stop;
   875 	stop.HomeTime();
   876 
   877 	TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
   878 
   879 	INFO_PRINTF2(_L("Repeats : %d"), NUMBER_OF_REPEATS);
   880 	INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
   881 		iError, I64INT(start.Int64()), I64INT(stop.Int64()), duration, actualDuration);
   882 
   883 	if((iError == KErrNone) && (TimeComparison(actualDuration, duration * (NUMBER_OF_REPEATS + 1),
   884 											   KExpectedDeviation * NUMBER_OF_REPEATS)))
   885 		return EPass;
   886 
   887 	return	EFail ;
   888 	}
   889 
   890 //------------------------------------------------------------------
   891 
   892 /**
   893  * Constructor
   894  */
   895 CTestMmfAclntToneLength::CTestMmfAclntToneLength(const TDesC& aTestName)
   896 	:CTestMmfAclntToneDtmf(aTestName,KShortDTMFString)
   897 	{}
   898 
   899 CTestMmfAclntToneLength* CTestMmfAclntToneLength::NewL(const TDesC& aTestName)
   900 	{
   901 	CTestMmfAclntToneLength* self = new (ELeave) CTestMmfAclntToneLength(aTestName);
   902 	return self;
   903 	}
   904 
   905 /**
   906  * Configure tone on length, tone off length, pause length of DTMF Tones
   907  */
   908 TVerdict CTestMmfAclntToneLength::DoTestL(CMdaAudioToneUtility* aToneUtil)
   909 	{
   910 	INFO_PRINTF1( _L("TestTone : Length"));
   911 
   912 	iError = KErrTimedOut;
   913 	TTimeIntervalMicroSeconds32 on(KOneSecond), off(KOneSecond), pause(0);
   914 
   915 	aToneUtil->SetDTMFLengths(on, off, pause);
   916 
   917 	iError = KErrTimedOut;
   918 	INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
   919 	aToneUtil->Play();
   920 
   921 	TTime start;
   922 	start.HomeTime();
   923 	CActiveScheduler::Start();
   924 	TTime stop;
   925 	stop.HomeTime();
   926 
   927 	TUint actualDuration = I64INT(stop.MicroSecondsFrom(start).Int64());
   928 
   929 	INFO_PRINTF6(_L("Error : %d Start = %d Stop = %d Duration = %d ActualDuration = %d"),
   930 		iError, I64INT(start.Int64()), I64INT(stop.Int64()), KTwoSeconds, actualDuration);
   931 
   932 	if((iError == KErrNone) && (TimeComparison(actualDuration, KTwoSeconds, KExpectedDeviation)))
   933 		return EPass;
   934 
   935 	return EFail ;
   936 	}
   937 
   938 //------------------------------------------------------------------
   939 
   940 /**
   941  * Constructor
   942  */
   943 CTestMmfAclntPriorityTones::CTestMmfAclntPriorityTones()
   944 	{
   945 	// store the name of this test case
   946 	// this is the name that is used by the script file
   947 	// Each test step initialises it's own name
   948 	iTestStepName = _L("MM-MMF-ACLNT-I-0165-HP");
   949 	}
   950 
   951 void CTestMmfAclntPriorityTones::MchoComplete(TInt aID, TInt aError)
   952 	{
   953 	INFO_PRINTF1( _L("CTestMmfAclntPriorityTones : MMdaAudioToneObserver Callback for CMdaAudioToneUtility called"));
   954 	iError = aError;
   955 	INFO_PRINTF3( _L("iError %d ID %d"), iError, aID);
   956 
   957 	if(iFirstCallback == -1)
   958 		iFirstCallback = aID;
   959 
   960 	if((--iCallbackCount) == 0)
   961 		CActiveScheduler::Stop();
   962 	}
   963 
   964 /**
   965  * Set priorities of tones
   966  */
   967 TVerdict CTestMmfAclntPriorityTones::DoTestStepL()
   968 	{
   969 	INFO_PRINTF1( _L("TestTone : Priorities"));
   970 
   971 	iError = KErrTimedOut;
   972 
   973     CMdaAudioToneUtility* toneUtil[2];
   974 	CToneCallbackHandler* callback[2];
   975 
   976 	for(TInt i=0; i<2; i++)
   977 		{
   978 		callback[i] = new (ELeave) CToneCallbackHandler(i,this);
   979 		CleanupStack::PushL(callback[i]);
   980 		}
   981 	
   982 	toneUtil[0] = CMdaAudioToneUtility::NewL(*callback[0],NULL, -10, EMdaPriorityPreferenceTimeAndQuality);
   983 	CleanupStack::PushL(toneUtil[0]);
   984 	toneUtil[1] = CMdaAudioToneUtility::NewL(*callback[1],NULL,  0, EMdaPriorityPreferenceTimeAndQuality);
   985 	CleanupStack::PushL(toneUtil[1]);
   986 
   987 	toneUtil[0]->PrepareToPlayDTMFString(KDTMFString);
   988 	toneUtil[1]->PrepareToPlayDTMFString(KDTMFString);
   989 	
   990 	// wait for initilisation callback
   991 	iCallbackCount = 2;
   992 	INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
   993 	INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
   994 	CActiveScheduler::Start();
   995 
   996 	if(iError == KErrNone)
   997 		{
   998 		iError = KErrTimedOut;
   999 
  1000 		toneUtil[0]->Play();
  1001 		toneUtil[1]->Play();
  1002 
  1003 		INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
  1004 		INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
  1005 
  1006 		// wait for play to complete
  1007 		iCallbackCount = 2;
  1008 		iFirstCallback = -1;
  1009 		CActiveScheduler::Start();
  1010 
  1011 		if((iError == KErrNone) && (iFirstCallback == 0))
  1012 			{
  1013 			CleanupStack::PopAndDestroy(4);
  1014 			return	EPass;
  1015 			}
  1016 		}
  1017 
  1018 	ERR_PRINTF2( _L("CMdaAudioToneUtility failed with error %d"),iError );
  1019 
  1020 	CleanupStack::PopAndDestroy(4);
  1021 	return	EFail ;
  1022 	}
  1023 
  1024 //------------------------------------------------------------------
  1025 
  1026 /**
  1027  * Constructor
  1028  */
  1029 CTestMmfAclntToneBalance::CTestMmfAclntToneBalance(const TDesC& aTestName,const TInt aBalance)
  1030 	:CTestMmfAclntTone(aTestName) ,iBalance(aBalance)
  1031 	{}
  1032 
  1033 CTestMmfAclntToneBalance* CTestMmfAclntToneBalance::NewL(const TDesC& aTestName,const TInt aBalance)
  1034 	{
  1035 	CTestMmfAclntToneBalance* self = new (ELeave) CTestMmfAclntToneBalance(aTestName,aBalance);
  1036 	return self;
  1037 	}
  1038 
  1039 /**
  1040  * Set balance and enquire balance
  1041  */
  1042 TVerdict CTestMmfAclntToneBalance::DoTestL(CMdaAudioToneUtility* aToneUtil)
  1043 	{
  1044 	INFO_PRINTF1( _L("TestTone : Balance"));
  1045 
  1046 	if (iBalance < KMinBalance)
  1047 		{
  1048 		TRAPD(err, aToneUtil->SetBalanceL(iBalance));
  1049 
  1050 		if (err != KErrNone)
  1051 		{
  1052 			INFO_PRINTF2(_L("SetBalanceL() returned unexpected error %d"), err);
  1053 			return EFail;
  1054 		}
  1055 
  1056 		if(aToneUtil->GetBalanceL() == KMinBalance)
  1057 			return EPass;
  1058 		}
  1059 	else if (iBalance > KMaxBalance)
  1060 		{
  1061 		TRAPD(err, aToneUtil->SetBalanceL(iBalance));
  1062 
  1063 		if (err != KErrNone)
  1064 		{
  1065 			INFO_PRINTF2(_L("SetBalanceL() returned unexpected error %d"), err);
  1066 			return EFail;
  1067 		}
  1068 
  1069 		if(aToneUtil->GetBalanceL() == KMaxBalance)
  1070 			return EPass;
  1071 		}
  1072 	else 
  1073 		{
  1074 		TRAPD(err, aToneUtil->SetBalanceL(iBalance));
  1075 
  1076 		if (err != KErrNone)
  1077 		{
  1078 			INFO_PRINTF2(_L("SetBalanceL() returned unexpected error %d"), err);
  1079 			return EFail;
  1080 		}
  1081 
  1082 		if(aToneUtil->GetBalanceL() == iBalance)
  1083 			return EPass;
  1084 		}
  1085 
  1086 	return EFail;
  1087 	}
  1088 
  1089 //------------------------------------------------------------------
  1090 
  1091 // NEGATIVE TESTING
  1092 
  1093 //------------------------------------------------------------------
  1094 
  1095 
  1096 
  1097 /**
  1098  * Constructor
  1099  */
  1100 CTestMmfAclntOnOffPause::CTestMmfAclntOnOffPause()
  1101 	{
  1102 	// store the name of this test case
  1103 	// this is the name that is used by the script file
  1104 // Each test step initialises it's own name
  1105 	iTestStepName = _L("MM-MMF-ACLNT-I-1155-HP");
  1106 
  1107 // this test does not inherit from CTestMmfAclntTone
  1108 // so we need to make the heap bigger here	
  1109 // need a bigger heap size on EKA2 HW
  1110 #if !defined __WINS__	
  1111 	iHeapSize = KHeapSizeToneTestEKA2;
  1112 #endif // EKA2
  1113 	}
  1114 
  1115 void CTestMmfAclntOnOffPause::MatoPrepareComplete(TInt aError)
  1116 	{
  1117 	iError = aError;
  1118 	INFO_PRINTF1( _L("CTestMmfAclntOnOffPause::MatoPrepareComplete MMdaAudioToneObserver Callback for CMdaAudioToneUtility complete"));
  1119 	INFO_PRINTF2( _L("iError %d"), iError);
  1120 	CActiveScheduler::Stop();
  1121 	}
  1122 
  1123 void CTestMmfAclntOnOffPause::MatoPlayComplete(TInt aError)
  1124 	{
  1125 	iError = aError;
  1126 	INFO_PRINTF1( _L("CTestMmfAclntOnOffPause::MatoPlayComplete MMdaAudioToneObserver Callback for CMdaAudioToneUtility complete"));
  1127 	INFO_PRINTF2( _L("iError %d"), iError);
  1128 	CActiveScheduler::Stop();
  1129 	}
  1130 
  1131 /**
  1132  * Set up tone on, off and pause length to illegal values.
  1133  */
  1134 TVerdict CTestMmfAclntOnOffPause::DoTestStepL( void )
  1135 	{
  1136 	INFO_PRINTF1( _L("TestTone : On/Off/Pause"));
  1137 	TVerdict res = EFail;
  1138 
  1139 	iError = KErrTimedOut;
  1140 
  1141 	CMdaAudioToneUtility* toneUtil = CMdaAudioToneUtility::NewL(*this);
  1142 	CleanupStack::PushL(toneUtil);
  1143 	toneUtil->PrepareToPlayDTMFString(KDTMFString);
  1144 	// Wait for prepare
  1145 	INFO_PRINTF1( _L("Initialise CMdaAudioToneUtility"));
  1146 	CActiveScheduler::Start();
  1147 
  1148 	if(iError == KErrNone)
  1149 		{
  1150 		iError = KErrTimedOut;
  1151 
  1152 		TTimeIntervalMicroSeconds32 on(-4), off(-3), pause(-5);
  1153 		
  1154 		toneUtil->SetDTMFLengths(on, off, pause);
  1155 
  1156 		toneUtil->Play();
  1157 		// wait for play to complete
  1158 		INFO_PRINTF1( _L("Play CMdaAudioToneUtility"));
  1159 		CActiveScheduler::Start();
  1160 
  1161 		// check this worked
  1162 		if(iError == KErrNone)
  1163 			res = EPass;
  1164 		}
  1165 
  1166 	CleanupStack::Pop(); // toneUtil
  1167 	ERR_PRINTF2( _L("CMdaAudioToneUtility completed with error %d"),iError );
  1168 	delete toneUtil;
  1169 	return	res;
  1170 	}
  1171