Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 #include <mmf/common/mmfcontroller.h>
20 #include <mmf/server/mmffile.h>
21 #include <mmf/server/mmfdes.h>
22 #include <mmf/plugin/mmfcontrollerimplementationuids.hrh>
23 #include <mmf/common/mmfstandardcustomcommands.h>
25 //const TInt KPlayDelayNewMail = 100000000; //arbitrary delay
27 // Test system includes
28 #include <testframework.h>
30 #include "ActrlTestUids.h"
32 // Specific includes for this test suite
33 #include "TS_MMF_ACTRL_TestStep.h"
34 #include "TS_MMF_ACTRL_TestSuite.h"
36 // Specific includes for these test steps
37 #include "TestStepsGetSet.h"
41 * Test step constructor.
42 * Each test step initialises its own name.
45 CTestStepGetSetVolumeInPrimed::CTestStepGetSetVolumeInPrimed()
47 // store the name of this test case
48 // this is the name that is used by the script file
49 iTestStepName = _L("MM-MMF-ACTRL-U-0001-HP");
54 * Test step destructor.
57 CTestStepGetSetVolumeInPrimed::~CTestStepGetSetVolumeInPrimed()
64 * Each test step must supply an implementation for DoTestStepL.
65 * This test does nothing more than exercise the rotate & scale code
66 * @return "TVerdict" the status of the test
67 * The result of the test step
69 TVerdict CTestStepGetSetVolumeInPrimed::DoTestStepL( void )
73 TVerdict result = EPass;
75 _LIT( KTestPlay, "Play Test");
78 _LIT( KTestStepPlay, "This test checks getting/setting volume in primed");
81 // [ audio file to play ]
82 _LIT(KTestWavFile, "newmail.wav");
83 SetReadFileNameL( KTestWavFile );
85 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
86 User::LeaveIfError( errorCode );
88 //[ add data source and sink and prime the controller ]
89 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
90 User::LeaveIfError( errorCode );
92 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
93 User::LeaveIfError( errorCode );
95 errorCode = iController.Prime();
96 User::LeaveIfError( errorCode );
98 // [ wait for and process the return event from the audio output ]
100 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
101 result = SearchForEvent( primeEvent );
102 if( result == EFail )
107 //[ set up audio commands utility ]
108 RMMFAudioPlayDeviceCustomCommands theCommander( iController );
110 // [ get the maximum volume ]
112 errorCode =theCommander.GetMaxVolume( maxVolume );
113 User::LeaveIfError( errorCode );
115 //[ set the volume to 1/2 max volume ]
116 TInt theVolume = maxVolume /2;
119 errorCode =theCommander.SetVolume( theVolume );
120 User::LeaveIfError( errorCode );
123 TInt theNewVolume (0);
124 errorCode =theCommander.GetVolume( theNewVolume );
125 User::LeaveIfError( errorCode );
127 // [ if set volume = got volume and
128 // rx'd event was ok then we are fine ]
129 if( theNewVolume == theVolume )
133 //[ ensure the controller is unloaded so that it does
134 // not interfere with the following test ]
135 // There is an error in this code and the stop followed by reset
136 // ensure the controller resources are released.
143 // test steps return a result
153 CTestStepGetSetVolumeInPlay::CTestStepGetSetVolumeInPlay()
155 // store the name of this test case
156 // this is the name that is used by the script file
157 iTestStepName = _L("MM-MMF-ACTRL-U-0002-HP");
162 * ~CTestStepGetSetVolumeInPlay
165 CTestStepGetSetVolumeInPlay::~CTestStepGetSetVolumeInPlay()
174 TVerdict CTestStepGetSetVolumeInPlay::DoTestStepL( void )
178 TVerdict result = EFail;
180 _LIT( KTestPlay, "Play Test");
183 _LIT( KTestStepPlay, "This test checks playing an audio clip");
184 Log( KTestStepPlay );
186 // [ audio file to play ]
187 _LIT(KTestWavFile, "newmail.wav");
188 SetReadFileNameL( KTestWavFile );
190 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
191 User::LeaveIfError( errorCode );
193 //[ add data source and sink and prime the controller ]
194 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
195 User::LeaveIfError( errorCode );
197 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
198 User::LeaveIfError( errorCode );
200 errorCode = iController.Prime();
201 User::LeaveIfError( errorCode );
203 // [ wait for and process the return event from the audio output ]
205 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
206 TVerdict searchResult = SearchForEvent( primeEvent );
207 if( searchResult == EFail )
212 User::LeaveIfError( iController.Play() );
214 // note this test does not wait around
215 // to detect that the audio has been played
216 // [ now process the confirmation event that play has reached audio output
217 // this is the raison detre of the test ]
218 TMMFEvent playEvent( KPlayTestId, KErrNone );
220 searchResult = SearchForEvent( playEvent );
221 if( searchResult == EFail )
226 //[ set up audio commands utility ]
227 RMMFAudioPlayDeviceCustomCommands theCommander( iController );
229 // [ get the maximum volume ]
231 errorCode =theCommander.GetMaxVolume( maxVolume );
232 User::LeaveIfError( errorCode );
234 //[ set the volume to 1/2 max volume ]
235 TInt theVolume = maxVolume /2;
238 errorCode =theCommander.SetVolume( theVolume );
239 User::LeaveIfError( errorCode );
241 TInt theNewVolume (0);
242 errorCode =theCommander.GetVolume( theNewVolume );
243 User::LeaveIfError( errorCode );
245 // [ if set volume = got volume, setVolume2 != got volume
246 // and rx'd event was ok then we are fine ]
247 TInt overVolume = maxVolume+1;
250 TInt overVolumeErrorCode =theCommander.SetVolume( overVolume );
252 TInt overVolumeResult (-100); // arbitrary initial value
253 errorCode =theCommander.GetVolume( overVolumeResult );
254 User::LeaveIfError( errorCode );
256 TInt underVolume = -1;
259 TInt underVolumeErrorCode =theCommander.SetVolume( underVolume );
261 TInt underVolumeResult (0); //arbitrary initial value
262 errorCode =theCommander.GetVolume( underVolumeResult );
263 User::LeaveIfError( errorCode );
265 //[ set the status of the test ]
266 if( ( theVolume == theNewVolume ) && // volume has been set correctly
267 ( overVolumeErrorCode != KErrNone) && // over volume detected
268 (theVolume == overVolumeResult) && // volume remains unchanged
269 (underVolumeErrorCode != KErrNone) && // under volume detected
270 ( theVolume == underVolumeResult)) // volume remains unchanged
275 //[ ensure the controller is unloaded so that it does
276 // not interfere with the following test ]
277 // There is error in this code and the stop followed by reset
278 // ensure the controller resources are released.
285 // test steps return a result
290 CTestStepGetSetVolumeInStopped
293 CTestStepGetSetVolumeInStopped::CTestStepGetSetVolumeInStopped()
295 iTestStepName = _L("MM-MMF-ACTRL-U-0003-HP");
299 ~CTestStepGetSetVolumeInStopped
301 CTestStepGetSetVolumeInStopped::~CTestStepGetSetVolumeInStopped()
310 TVerdict CTestStepGetSetVolumeInStopped::DoTestStepL( void )
313 TVerdict result = EFail;
315 _LIT( KTestPlay, "Get/Set Volume while stopped");
318 _LIT( KTestStepPlay, "This test checks get/set volume while stopped");
319 Log( KTestStepPlay );
321 // [ audio file to play ]
322 _LIT(KTestWavFile, "newmail.wav");
323 SetReadFileNameL( KTestWavFile );
325 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
326 User::LeaveIfError( errorCode );
328 //[ add data source and sink and prime the controller ]
329 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
330 User::LeaveIfError( errorCode );
332 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
333 User::LeaveIfError( errorCode );
335 //[ set up audio commands utility ]
336 RMMFAudioPlayDeviceCustomCommands theCommander( iController );
338 // [ get the maximum volume ]
340 errorCode =theCommander.GetMaxVolume( maxVolume );
341 User::LeaveIfError( errorCode );
343 //[ set the volume to 1/2 max volume ]
344 TInt theVolume = maxVolume /2;
347 errorCode =theCommander.SetVolume( theVolume );
348 User::LeaveIfError( errorCode );
350 TInt theNewVolume (0);
351 errorCode =theCommander.GetVolume( theNewVolume );
352 User::LeaveIfError( errorCode );
354 // [ if set volume = got volume, setVolume2 != got volume
355 // and rx'd event was ok then we are fine ]
356 TInt overVolume = maxVolume+1;
359 TInt overVolumeErrorCode =theCommander.SetVolume( overVolume );
361 TInt overVolumeResult (-100); //arbitrary initial value
362 errorCode =theCommander.GetVolume( overVolumeResult );
363 User::LeaveIfError( errorCode );
365 TInt underVolume = -1; //arbitrary initial value
368 TInt underVolumeErrorCode =theCommander.SetVolume( underVolume );
370 TInt underVolumeResult (0);
371 errorCode =theCommander.GetVolume( underVolumeResult );
372 User::LeaveIfError( errorCode );
374 //[ set the status of the test ]
375 if( ( theVolume == theNewVolume ) && // volume has been set correctly
376 ( overVolumeErrorCode != KErrNone) && // over volume detected
377 (theVolume == overVolumeResult) && // volume remains unchanged
378 (underVolumeErrorCode != KErrNone) && // under volume detected
379 ( theVolume == underVolumeResult)) // volume remains unchanged
384 //[ ensure the controller is unloaded so that it does
385 // not interfere with the following test ]
386 // There is error in this code and the stop followed by reset
387 // ensure the controller resources are released.
398 * CTestStepGetSetBalanceInPrimed
401 CTestStepGetSetBalanceInPrimed::CTestStepGetSetBalanceInPrimed()
403 iTestStepName = _L("MM-MMF-ACTRL-U-0005-HP");
408 * ~CTestStepGetSetBalanceInPrimed
410 CTestStepGetSetBalanceInPrimed::~CTestStepGetSetBalanceInPrimed()
419 TVerdict CTestStepGetSetBalanceInPrimed::DoTestStepL( void )
422 TVerdict result = EFail;
424 _LIT( KTestPlay, "Get/Set Balance while primed");
427 _LIT( KTestStepPlay, "This test checks get/set balance while primed");
428 Log( KTestStepPlay );
430 // [ audio file to play ]
431 _LIT(KTestWavFile, "newmail.wav");
432 SetReadFileNameL( KTestWavFile );
434 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
435 User::LeaveIfError( errorCode );
437 //[ add data source and sink and prime the controller ]
438 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
439 User::LeaveIfError( errorCode );
441 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
442 User::LeaveIfError( errorCode );
444 errorCode = iController.Prime();
445 User::LeaveIfError( errorCode );
447 // [ wait for and process the return event from the audio output ]
449 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
450 TVerdict searchResult = SearchForEvent( primeEvent );
451 if( searchResult == EFail )
456 //[ set up audio commands utility ]
457 RMMFAudioPlayDeviceCustomCommands theCommander( iController );
459 // [ set the balance to an arbitrary value within the range -100 , 100 ]
460 TInt theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft;
461 //[ set the Balance, we are expecting failure ]
462 TInt setErrorCode =theCommander.SetBalance( theBalance );
464 //[ get the balance, we are expecting failure ]
465 TInt theNewBalance (0);
466 TInt getErrorCode =theCommander.GetBalance( theNewBalance );
468 //[ set the status of the test ]
469 if( ( getErrorCode == KErrNone) &&
470 ( setErrorCode == KErrNone) )
475 //[ ensure the controller is unloaded so that it does
476 // not interfere with the following test ]
477 // There is error in this code and the stop followed by reset
478 // ensure the controller resources are released.
489 * CTestStepGetSetBalanceInPlay
491 CTestStepGetSetBalanceInPlay::CTestStepGetSetBalanceInPlay()
493 iTestStepName = _L("MM-MMF-ACTRL-U-0007-HP");
498 * ~CTestStepGetSetBalanceInPlay
500 CTestStepGetSetBalanceInPlay::~CTestStepGetSetBalanceInPlay()
509 TVerdict CTestStepGetSetBalanceInPlay::DoTestStepL( void )
512 TVerdict result = EFail;
514 _LIT( KTestPlay, "Get/Set Balance while in Play");
517 _LIT( KTestStepPlay, "This test checks get/set balance while playing");
518 Log( KTestStepPlay );
520 // [ audio file to play ]
521 _LIT(KTestWavFile, "newmail.wav");
522 SetReadFileNameL( KTestWavFile );
524 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
525 User::LeaveIfError( errorCode );
527 //[ add data source and sink and prime the controller ]
528 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
529 User::LeaveIfError( errorCode );
531 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
532 User::LeaveIfError( errorCode );
534 errorCode = iController.Prime();
535 User::LeaveIfError( errorCode );
537 // [ wait for and process the return event from the audio output ]
539 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
540 TVerdict searchResult = SearchForEvent( primeEvent );
541 if( searchResult == EFail )
546 //[ set the controller to play ]
547 User::LeaveIfError( iController.Play() );
549 //[ set up audio commands utility ]
550 RMMFAudioPlayDeviceCustomCommands theCommander( iController );
552 // [ set the balance to an arbitrary value between 0,100 and map to the range -100,100 ]
553 TInt theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft;;
554 //[ set the Balance ]
555 TInt setErrorCode =theCommander.SetBalance( theBalance );
557 //[ get the balance ]
558 TInt theNewBalance (0);
559 TInt getErrorCode =theCommander.GetBalance( theNewBalance );
561 //[ set the status of the test ]
563 ( getErrorCode != KErrNone) && // under volume detected
564 ( setErrorCode != KErrNone)) // volume remains unchanged
569 TMMFEvent playEvent( KPlayTestId, KErrNone );
570 searchResult = SearchForEvent( playEvent );
571 if( searchResult != EFail )
576 //[ ensure the controller is unloaded so that it does
577 // not interfere with the following test ]
578 // There is error in this code and the stop followed by reset
579 // ensure the controller resources are released.
590 * CTestStepGetSetBalanceInStopped
593 CTestStepGetSetBalanceInStopped::CTestStepGetSetBalanceInStopped()
595 iTestStepName = _L("MM-MMF-ACTRL-U-0006-HP");
600 * CTestStepGetSetBalanceInStopped
603 CTestStepGetSetBalanceInStopped::~CTestStepGetSetBalanceInStopped()
612 TVerdict CTestStepGetSetBalanceInStopped::DoTestStepL( void )
615 TVerdict result = EFail;
617 _LIT( KTestPlay, "Get/Set Balance while stopped");
620 _LIT( KTestStepPlay, "This test checks get/set balance while stopped");
621 Log( KTestStepPlay );
623 // [ audio file to play ]
624 _LIT(KTestWavFile, "newmail.wav");
625 SetReadFileNameL( KTestWavFile );
627 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
628 User::LeaveIfError( errorCode );
630 //[ add data source and sink and prime the controller ]
631 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
632 User::LeaveIfError( errorCode );
634 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
635 User::LeaveIfError( errorCode );
637 //[ set up audio commands utility ]
638 RMMFAudioPlayDeviceCustomCommands theCommander( iController );
640 // [ set the balance ]
641 TInt theBalance = (30 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft;;
642 //[ set the Balance ]
643 errorCode =theCommander.SetBalance( theBalance );
644 User::LeaveIfError( errorCode );
646 //[ get the balance ]
647 TInt theNewBalance (0);
648 errorCode =theCommander.GetBalance( theNewBalance );
649 User::LeaveIfError( errorCode );
651 // [ if set balance = got balance, setbalance2 != got balance
652 // and rx'd event was ok then we are fine
653 // set the balance to an arbitrary value in the range 0..100 and map to the soundev range]
654 TInt overBalance = (300 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft;
657 TInt overBalanceErrorCode =theCommander.SetBalance( overBalance );
659 TInt overBalanceResult (-106); // set to an arbitrary value
660 errorCode =theCommander.GetBalance( overBalanceResult );
661 User::LeaveIfError( errorCode );
663 // [ set the under balance to a value < 0 and map to the correct range]
664 TInt underBalance = (-50 * (KMMFBalanceMaxRight-KMMFBalanceMaxLeft))/100 + KMMFBalanceMaxLeft;
667 TInt underBalanceErrorCode =theCommander.SetBalance( underBalance );
669 TInt underBalanceResult (0);
670 errorCode =theCommander.GetBalance( underBalanceResult );
671 User::LeaveIfError( errorCode );
673 // Set the test result
674 if ((theBalance == theNewBalance) && // balance set correctly
675 (overBalanceErrorCode == KErrNone) && // no error setting over balance
676 (overBalanceResult == KMMFBalanceMaxRight) && // over balance is set to KMMFBalanceMaxRight
677 (underBalanceErrorCode == KErrNone) && // no error setting under balance
678 (underBalanceResult == KMMFBalanceMaxLeft)) // under balance is set to KMMFBalanceMaxLeft
683 //[ ensure the controller is unloaded so that it does
684 // not interfere with the following test ]
685 // There is error in this code and the stop followed by reset
686 // ensure the controller resources are released.
697 * CTestStepGetSetPositionInPaused
700 CTestStepGetSetPositionInPaused::CTestStepGetSetPositionInPaused()
702 iTestStepName = _L("MM-MMF-ACTRL-U-0070-HP");
707 * ~CTestStepGetSetPositionInPaused
710 CTestStepGetSetPositionInPaused::~CTestStepGetSetPositionInPaused()
719 TVerdict CTestStepGetSetPositionInPaused::DoTestStepL( void )
723 TVerdict result = EPass;
724 TTimeIntervalMicroSeconds position(0);
726 _LIT( KTestPause, "Pause Test");
729 _LIT( KTestStepPause, "This test checks set/get position whilst paused: Play->Pause->Rewind->Play (Proper verification requires headphones)");
730 Log( KTestStepPause );
732 // [ audio file to play ]
733 // At time of writing, this file is approx 8s duration.
734 _LIT(KTestWavFile, "mainTst.wav");
735 SetReadFileNameL( KTestWavFile );
737 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
738 User::LeaveIfError( errorCode );
740 //[ add data source and sink and prime the controller ]
741 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
742 User::LeaveIfError( errorCode );
744 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
745 User::LeaveIfError( errorCode );
747 User::LeaveIfError( iController.Prime() );
749 // [ wait for and process the return event from the audio output ]
751 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
752 TVerdict searchResult = SearchForEvent( primeEvent );
753 if( searchResult == EFail )
758 User::LeaveIfError( iController.GetPosition( position ) );
759 INFO_PRINTF2(_L("Position at start is %d"), position.Int64());
762 // note this test does not wait around
763 // to detect that the audio has been played
764 User::LeaveIfError( iController.Play() );
766 // [ now process the confirmation event that play has reached audio output
767 // this is the raison detre of the test ]
768 TMMFEvent playEvent1( KPlayTestId, KErrNone );
769 searchResult = SearchForEvent( playEvent1 );
770 if( searchResult == EFail )
775 // [ play for two seconds ]
776 User::After(2000000);
778 User::LeaveIfError( iController.GetPosition( position ) );
779 INFO_PRINTF2(_L("Position before pause is %d"), position.Int64());
782 // [ The controller is in the play state and
783 // should not return an error if pause is called ]
784 User::LeaveIfError( iController.Pause() );
786 TMMFEvent pauseEvent( KPauseTestId, KErrNone );
787 result = SearchForEvent( pauseEvent );
788 if( result == EFail )
793 User::LeaveIfError( iController.GetPosition( position ) );
794 INFO_PRINTF2(_L("Position after pause is %d"), position.Int64());
796 //[ ok lets reset to the beginning ]
797 User::LeaveIfError( iController.SetPosition( TTimeIntervalMicroSeconds(0) ) );
799 User::LeaveIfError( iController.GetPosition( position ) );
800 INFO_PRINTF2(_L("Position after rewind is %d"), position.Int64());
803 // [ Now let's start to play again ]
805 // note this test does not wait around
806 // to detect that the audio has been played
807 User::LeaveIfError( iController.Play() );
809 // [ now process the confirmation event that play has reached audio output
810 // this is the raison detre of the test ]
811 TMMFEvent playEvent2( KPlayTestId, KErrNone );
812 searchResult = SearchForEvent( playEvent2 );
813 if( searchResult == EFail )
818 // [ play for 10s (approx entire file) ]
819 User::After(10000000);
821 //[ ensure the controller is unloaded so that it does
822 // not interfere with the following test ]
823 // There is error in this code and the stop followed by reset
824 // ensure the controller resources are released.
835 * CTestStepGetSetPositionInPlay
838 CTestStepGetSetPositionInPlay::CTestStepGetSetPositionInPlay()
840 iTestStepName = _L("MM-MMF-ACTRL-U-0008-HP");
845 * ~CTestStepGetSetPositionInPlay
848 CTestStepGetSetPositionInPlay::~CTestStepGetSetPositionInPlay()
857 TVerdict CTestStepGetSetPositionInPlay::DoTestStepL( void )
861 TVerdict result = EPass;
863 _LIT( KTestPlay, "Play Test");
866 _LIT( KTestStepPlay, "This test checks set/get position whilst playing");
867 Log( KTestStepPlay );
869 // [ audio file to play ]
870 _LIT(KTestWavFile, "newmail.wav");
871 SetReadFileNameL( KTestWavFile );
873 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
874 User::LeaveIfError( errorCode );
876 //[ add data source and sink and prime the controller ]
877 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
878 User::LeaveIfError( errorCode );
880 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
881 User::LeaveIfError( errorCode );
883 errorCode = iController.Prime();
884 User::LeaveIfError( errorCode );
886 // [ wait for and process the return event from the audio output ]
888 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
889 TVerdict searchResult = SearchForEvent( primeEvent );
890 if( searchResult == EFail )
895 User::LeaveIfError( iController.Play() );
897 // note this test does not wait around
898 // to detect that the audio has been played
899 // [ now process the confirmation event that play has reached audio output
900 // this is the raison detre of the test ]
901 TMMFEvent playEvent( KPlayTestId, KErrNone );
903 searchResult = SearchForEvent( playEvent );
904 if( searchResult == EFail )
909 //[ ok lets set/get the position ]
910 TTimeIntervalMicroSeconds theStartPosition(0);
911 TInt posSetError = iController.SetPosition( theStartPosition );
913 // [get the position ]
914 TTimeIntervalMicroSeconds theCurrentPosition;
915 TInt posGetError = iController.GetPosition( theCurrentPosition );
917 // [ the test has passed if we have no errors in both cases ]
918 if( (posGetError != KErrNone ) &&
919 (posSetError != KErrNone ) )
924 //[ ensure the controller is unloaded so that it does
925 // not interfere with the following test ]
926 // There is error in this code and the stop followed by reset
927 // ensure the controller resources are released.
939 * CTestStepGetSetPositionInStopped
942 CTestStepGetSetPositionInStopped::CTestStepGetSetPositionInStopped()
944 iTestStepName = _L("MM-MMF-ACTRL-U-0009-HP");
949 * ~CTestStepGetSetPositionInStopped
951 CTestStepGetSetPositionInStopped::~CTestStepGetSetPositionInStopped()
960 TVerdict CTestStepGetSetPositionInStopped::DoTestStepL( void )
963 TVerdict result = EPass ;
964 //[ In this state it should not be possible to set the positio]
966 _LIT( KTestPlay, "Set/Get Position while stopped");
969 _LIT( KTestStepPlay, "This test checks get/set position while stopped");
970 Log( KTestStepPlay );
972 // [ audio file to play ]
973 _LIT(KTestWavFile, "newmail.wav");
974 SetReadFileNameL( KTestWavFile );
976 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
977 User::LeaveIfError( errorCode );
980 //[ add data source and sink and prime the controller ]
981 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
982 User::LeaveIfError( errorCode );
984 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
985 User::LeaveIfError( errorCode );
987 //[ set the position to the start ]
988 TTimeIntervalMicroSeconds theStartPosition(0);
989 TInt posSetError = iController.SetPosition( theStartPosition );
991 // [get the position ]
992 TTimeIntervalMicroSeconds theCurrentPosition;
993 TInt posGetError = iController.GetPosition( theCurrentPosition );
995 // [ the test has passed if we have errors in both cases ]
996 if( (posGetError == KErrNone ) ||
997 (posSetError == KErrNone ) )
1002 //[ ensure the controller is unloaded so that it does
1003 // not interfere with the following test ]
1004 // There is error in this code and the stop followed by reset
1005 // ensure the controller resources are released.
1007 iController.Reset();
1008 iController.Close();
1016 * CTestStepGetSetPositionInPrimed
1018 CTestStepGetSetPositionInPrimed::CTestStepGetSetPositionInPrimed()
1020 iTestStepName = _L("MM-MMF-ACTRL-U-0010-HP");
1025 * ~CTestStepGetSetPositionInStopped
1027 CTestStepGetSetPositionInPrimed::~CTestStepGetSetPositionInPrimed()
1036 TVerdict CTestStepGetSetPositionInPrimed::DoTestStepL( void )
1039 TVerdict result = EPass ;
1041 _LIT( KTestStepPlay, "GetSet Position In Primed");
1042 Log( KTestStepPlay );
1044 // [ audio file to play ]
1045 _LIT(KTestWavFile, "newmail.wav");
1046 SetReadFileNameL( KTestWavFile );
1048 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
1049 User::LeaveIfError( errorCode );
1051 //[ add data source and sink and prime the controller ]
1052 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
1053 User::LeaveIfError( errorCode );
1055 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
1056 User::LeaveIfError( errorCode );
1058 errorCode = iController.Prime();
1059 User::LeaveIfError( errorCode );
1061 // [ wait for and process the return event from the audio output ]
1063 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
1064 TVerdict searchResult = SearchForEvent( primeEvent );
1065 if( searchResult == EFail )
1067 return searchResult;
1070 // [get the duration of the file]
1071 TTimeIntervalMicroSeconds theDuration;
1072 TInt durationError = iController.GetDuration(theDuration);
1073 User::LeaveIfError( durationError );
1075 //[ set the position to the end ]
1076 TInt posError = iController.SetPosition( theDuration );
1077 User::LeaveIfError( posError );
1079 // [get the position ]
1080 TTimeIntervalMicroSeconds theEndPosition;
1081 TInt positionError = iController.GetPosition( theEndPosition );
1082 User::LeaveIfError( positionError );
1084 // [ set the position beyond the end ]
1085 TInt64 beyondTheEnd = theDuration.Int64();
1086 beyondTheEnd *= 1000000;
1087 TTimeIntervalMicroSeconds beyondTheEndPosition( beyondTheEnd);
1089 // [get the position ]
1090 TTimeIntervalMicroSeconds theCurrentPosition;
1091 TInt currentPositionError = iController.GetPosition( theCurrentPosition );
1092 User::LeaveIfError( currentPositionError );
1094 //[ set the position beyond the end ]
1095 TInt beyondEndError = iController.SetPosition( beyondTheEndPosition );
1097 //[ get the position ]
1098 TTimeIntervalMicroSeconds theCurrentPosition2;
1099 currentPositionError = iController.GetPosition( theCurrentPosition2 );
1100 User::LeaveIfError( currentPositionError );
1102 if( (theCurrentPosition2 != theCurrentPosition ) &&
1103 ( beyondEndError == KErrNone ))
1105 // altered position when wrong position was sent
1106 // assumes this violation does not corrupt the current position
1110 // [ set the position before the start ]
1111 currentPositionError = iController.GetPosition( theCurrentPosition );
1112 User::LeaveIfError( currentPositionError );
1114 //[ set the position to a time < 0 ]
1115 TTimeIntervalMicroSeconds beforeTheStart( -10000 );
1116 //[ set the position beyond the end ]
1117 TInt beforeStartError = iController.SetPosition( beforeTheStart );
1119 //[ get the position ]
1120 currentPositionError = iController.GetPosition( theCurrentPosition2 );
1121 User::LeaveIfError( currentPositionError );
1123 // [determine the results of the test]
1124 if( (theCurrentPosition2 != theCurrentPosition ) &&
1125 ( beforeStartError == KErrNone ))
1127 // altered position when wrong position was sent
1128 // assumes this violation does not corrupt the current position
1132 //[ ensure the controller is unloaded so that it does
1133 // not interfere with the following test ]
1134 // There is error in this code and the stop followed by reset
1135 // ensure the controller resources are released.
1137 iController.Reset();
1138 iController.Close();
1146 * CTestStepGetSetNumChannelsOnSource
1149 CTestStepGetSetNumChannelsOnSource::CTestStepGetSetNumChannelsOnSource()
1151 iTestStepName = _L("MM-MMF-ACTRL-U-0021-HP");
1156 * ~CTestStepGetSetNumChannelsOnSource
1159 CTestStepGetSetNumChannelsOnSource::~CTestStepGetSetNumChannelsOnSource()
1168 TVerdict CTestStepGetSetNumChannelsOnSource::DoTestStepL( void )
1171 TVerdict result = EPass;
1173 _LIT( KTestSourceNumChannels, "GetSet Num Channels on the Source");
1174 Log( KTestSourceNumChannels);
1176 _LIT( KTestSinkBitRateReason, "This test checks the set/get num channels on the source");
1177 Log( KTestSinkBitRateReason );
1179 // [ audio file to play ]
1180 _LIT(KTestWavFile, "newmail.wav");
1181 SetReadFileNameL( KTestWavFile );
1183 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
1184 User::LeaveIfError( errorCode );
1186 // [ attempt to get the source num channels ]
1187 RMMFAudioControllerCustomCommands theCommander( iController );
1190 errorCode = theCommander.GetSourceNumChannels(theRate);
1191 if( errorCode == KErrNone )
1197 //[ ok lets add the source and sink ]
1198 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
1199 User::LeaveIfError( errorCode );
1201 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
1202 User::LeaveIfError( errorCode );
1205 errorCode = theCommander.GetSourceNumChannels(theRate);
1206 User::LeaveIfError( errorCode );
1208 //[ get the format ]
1210 errorCode = theCommander.GetSourceFormat(theFormatUID);
1211 User::LeaveIfError( errorCode );
1213 //[ ensure we are in are not a raw format because
1214 // this functionality is only supported in raw format]
1215 if( theFormatUID == KFormatRAWRead )
1221 // lets set the num of channels to 2
1222 errorCode = theCommander.SetSourceNumChannels(theRate);
1223 if( errorCode != KErrNone )
1229 //[ ensure the controller is unloaded so that it does
1230 // not interfere with the following test ]
1231 // There is error in this code and the stop followed by reset
1232 // ensure the controller resources are released.
1234 iController.Reset();
1235 iController.Close();
1243 * CTestStepGetSetNumChannelsOnSink
1246 CTestStepGetSetNumChannelsOnSink::CTestStepGetSetNumChannelsOnSink()
1248 iTestStepName = _L("MM-MMF-ACTRL-U-0022-HP");
1253 * ~CTestStepGetSetNumChannelsOnSink
1256 CTestStepGetSetNumChannelsOnSink::~CTestStepGetSetNumChannelsOnSink()
1265 TVerdict CTestStepGetSetNumChannelsOnSink::DoTestStepL( void )
1268 TVerdict result = EPass;
1270 _LIT( KTestSourceNumChannels, "GetSet Num Channels on the Sink");
1271 Log( KTestSourceNumChannels);
1273 _LIT( KTestSinkBitRateReason, "This test checks the set/get num channels on the sink");
1274 Log( KTestSinkBitRateReason );
1276 // [ audio file to play ]
1277 _LIT(KTestWavFile, "newmail.wav");
1278 SetReadFileNameL( KTestWavFile );
1280 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
1281 User::LeaveIfError( errorCode );
1283 //[ attempt to get the sink num channels ]
1284 RMMFAudioControllerCustomCommands theCommander( iController );
1287 errorCode = theCommander.GetSinkNumChannels(theRate);
1288 if( errorCode == KErrNone )
1294 //[ ok lets add the source and sink ]
1295 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
1296 User::LeaveIfError( errorCode );
1298 //[ add data source and sink and prime the controller ]
1299 errorCode = iController.AddDataSink(KUidMmfFileSink, ReadFileConfig());
1300 User::LeaveIfError( errorCode );
1302 //[ ok lets try to set the sink format to raw]
1303 errorCode = theCommander.SetSinkFormat(KFormatRAWWrite);
1304 User::LeaveIfError( errorCode );
1306 //[ ok lets set the number of channels ]
1307 // lets set the num of channels to 2
1308 TUint theNumChannels = 2;
1309 errorCode = theCommander.SetSinkNumChannels(theNumChannels);
1310 User::LeaveIfError( errorCode );
1312 // [ get the number of channels and see if it is the same ]
1313 TUint theNewNumChannels = 0;
1314 errorCode = theCommander.GetSinkNumChannels(theNewNumChannels);
1315 User::LeaveIfError( errorCode );
1317 if( theNumChannels != theNewNumChannels )
1323 //[ ensure the controller is unloaded so that it does
1324 // not interfere with the following test ]
1325 // There is error in this code and the stop followed by reset
1326 // ensure the controller resources are released.
1328 iController.Reset();
1329 iController.Close();
1337 * CTestStepGetSetSinkFormat
1340 CTestStepGetSetSinkFormat::CTestStepGetSetSinkFormat()
1342 iTestStepName = _L("MM-MMF-ACTRL-U-0023-HP");
1347 * ~CTestStepGetSetSinkFormat
1350 CTestStepGetSetSinkFormat::~CTestStepGetSetSinkFormat()
1359 TVerdict CTestStepGetSetSinkFormat::DoTestStepL( void )
1362 TVerdict result = EPass ;
1364 _LIT( KTestSinkFormat, "Test Step Get/Set sink format");
1365 Log( KTestSinkFormat );
1367 _LIT( KTestStepSinkFormat, "This test checks the set/get sink format");
1368 Log( KTestStepSinkFormat );
1370 // [ audio file to play ]
1371 _LIT(KTestWavFileRecord, "TempW.wav");
1372 SetWriteFileNameL( KTestWavFileRecord );
1374 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
1375 User::LeaveIfError( errorCode );
1377 RMMFAudioControllerCustomCommands theCommander( iController );
1380 //[ add sink format when no sink exists ]
1381 errorCode = theCommander.SetSinkFormat( KFormatWAVWrite );
1382 if( errorCode == KErrNone )
1388 //[ ok lets add the source and sink ]
1389 errorCode = iController.AddDataSource(KUidMmfAudioInput, KNullDesC8);
1390 User::LeaveIfError( errorCode );
1392 errorCode = iController.AddDataSink(KUidMmfFileSink, WriteFileConfig());
1393 User::LeaveIfError( errorCode );
1395 errorCode = theCommander.SetSinkFormat( KFormatWAVWrite );
1396 User::LeaveIfError( errorCode );
1398 // [ add the format where the uid == the uid of the format ]
1399 errorCode = theCommander.SetSinkFormat( KFormatWAVWrite );
1400 User::LeaveIfError( errorCode );
1402 //[ ok lets try to set the sink format to au]
1403 errorCode = theCommander.SetSinkFormat( KFormatAUWrite );
1404 User::LeaveIfError( errorCode );
1406 errorCode = theCommander.SetSinkFormat( KFormatWAVWrite );
1407 User::LeaveIfError( errorCode );
1409 // [ wait for and process the return event from the audio output ]
1410 errorCode = iController.Prime();
1411 User::LeaveIfError( errorCode );
1412 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
1413 result = SearchForEvent( primeEvent );
1414 if( result == EFail )
1419 errorCode = theCommander.SetSinkFormat( KFormatWAVWrite );
1420 if( errorCode == KErrNone )
1426 //[ lets do some recording ]
1427 // note this test does not wait around
1428 // to detect that the audio has been played
1429 // [ now process the confirmation event that play has reached audio output
1430 // this is the raison detre of the test ]
1431 errorCode = iController.Play();
1432 User::LeaveIfError( errorCode );
1433 TMMFEvent playEvent( KPlayTestId, KErrNone );
1434 result = SearchForEvent( playEvent );
1435 if( result == EFail )
1440 // [ check that we cannot set the sink format when
1441 // no data sink has been added to the controller ]
1442 errorCode = theCommander.SetSinkFormat( KFormatWAVWrite );
1443 if( errorCode == KErrNone )
1449 // [ lets wait a few seconds for record to write its data ]
1451 User::LeaveIfError( myTimer.CreateLocal());
1452 TRequestStatus timerStatus ;
1453 const TInt KDelay = 1000000 ; // arbitrary delay
1454 myTimer.After( timerStatus, KDelay );
1455 User::WaitForRequest( timerStatus );
1457 //[ ensure the controller is unloaded so that it does
1458 // not interfere with the following test ]
1459 // There is error in this code and the stop followed by reset
1460 // ensure the controller resources are released.
1462 iController.Reset();
1463 iController.Close();
1471 * CTestStepGetSetSourceFormat
1474 CTestStepGetSetSourceFormat::CTestStepGetSetSourceFormat()
1476 iTestStepName = _L("MM-MMF-ACTRL-U-0024-HP");
1481 * CTestStepGetSetSourceFormat
1484 CTestStepGetSetSourceFormat::~CTestStepGetSetSourceFormat()
1493 TVerdict CTestStepGetSetSourceFormat::DoTestStepL( void )
1496 TVerdict result = EPass;
1498 _LIT( KTestSourceNumChannels, "Test Step GetSet Source Format");
1499 Log( KTestSourceNumChannels);
1501 _LIT( KTestSinkBitRateReason, "This test checks the set/get source format");
1502 Log( KTestSinkBitRateReason );
1504 // [ audio file to play ]
1505 _LIT(KTestWavFile, "newmail.wav");
1506 SetReadFileNameL( KTestWavFile );
1508 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
1509 User::LeaveIfError( errorCode );
1511 RMMFAudioControllerCustomCommands theCommander( iController );
1513 //[ add source format when no source exists ]
1514 errorCode = theCommander.SetSourceFormat( KFormatWAVRead );
1515 if( errorCode == KErrNone )
1521 //[ ok lets add the source and sink ]
1522 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
1523 User::LeaveIfError( errorCode );
1525 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
1526 User::LeaveIfError( errorCode );
1528 //errorCode = theCommander.SetSourceFormat( KWavUid );
1529 errorCode = theCommander.SetSourceFormat( KFormatWAVRead );
1530 User::LeaveIfError( errorCode );
1532 // [ add the format where the uid == the uid of the format ]
1533 errorCode = theCommander.SetSourceFormat( KFormatWAVRead );
1534 User::LeaveIfError( errorCode );
1536 //[ ok lets try to set the source format to raw]
1537 errorCode = theCommander.SetSourceFormat(KFormatRAWRead);
1538 User::LeaveIfError( errorCode );
1540 // [ add the format where the uid == the uid of the format ]
1541 errorCode = theCommander.SetSourceFormat( KFormatWAVRead );
1542 User::LeaveIfError( errorCode );
1545 // [ wait for and process the return event from the audio output ]
1546 errorCode = iController.Prime();
1547 User::LeaveIfError( errorCode );
1548 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
1549 result = SearchForEvent( primeEvent );
1550 if( result == EFail )
1555 // [ check that we cannot set the sink format when
1556 // no data sink has been added to the controller ]
1557 errorCode = theCommander.SetSourceFormat( KFormatWAVRead );
1558 if( errorCode == KErrNone )
1564 // [ lets do some recording ]
1565 // note this test does not wait around
1566 // to detect that the audio has been played
1567 // [ now process the confirmation event that play has reached audio output
1568 // this is the raison detre of the test ]
1569 errorCode = iController.Play();
1570 User::LeaveIfError( errorCode );
1571 TMMFEvent playEvent( KPlayTestId, KErrNone );
1572 result = SearchForEvent( playEvent );
1573 if( result == EFail )
1579 // [ check that we cannot set the sink format when
1580 // no data sink has been added to the controller ]
1581 errorCode = theCommander.SetSourceFormat( KFormatWAVRead );
1582 if( errorCode == KErrNone )
1588 // [ lets wait a few seconds for record to write its data ]
1590 User::LeaveIfError( myTimer.CreateLocal());
1591 TRequestStatus timerStatus ;
1592 const TInt KDelay = 1000000 ; // arbitrary delay
1593 myTimer.After( timerStatus, KDelay );
1594 User::WaitForRequest( timerStatus );
1596 //[ ensure the controller is unloaded so that it does
1597 // not interfere with the following test ]
1598 // There is error in this code and the stop followed by reset
1599 // ensure the controller resources are released.
1601 iController.Reset();
1602 iController.Close();
1610 * CTestStepGetSetSourceSampleRate
1613 CTestStepGetSetSourceSampleRate::CTestStepGetSetSourceSampleRate()
1615 iTestStepName = _L("MM-MMF-ACTRL-U-0025-HP");
1620 * ~CTestStepGetSetSourceSampleRate
1623 CTestStepGetSetSourceSampleRate::~CTestStepGetSetSourceSampleRate()
1629 * CTestStepGetSetSourceSampleRate
1632 TVerdict CTestStepGetSetSourceSampleRate::DoTestStepL( void )
1635 TVerdict result = EPass;
1637 _LIT( KTestSourceNumChannels, "GetSet Source Sample Rate");
1638 Log( KTestSourceNumChannels);
1640 _LIT( KTestSinkBitRateReason, "This test checks the set/get source sample rate");
1641 Log( KTestSinkBitRateReason );
1643 // [ audio file to play ]
1644 _LIT(KTestWavFile, "newmail.wav");
1645 SetReadFileNameL( KTestWavFile );
1647 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
1648 User::LeaveIfError( errorCode );
1650 //[ attempt to get the sink num channels ]
1651 RMMFAudioControllerCustomCommands theCommander( iController );
1653 RArray<TUint> supportedRates;
1654 CleanupClosePushL(supportedRates);
1655 TRAPD(errorCode2, theCommander.GetSupportedSourceSampleRatesL(supportedRates));
1656 if ((errorCode2 == KErrNone ) || supportedRates.Count())
1658 // should have failed with either an error code or non zero supported rates
1664 errorCode = theCommander.GetSourceSampleRate(theRate);
1665 if( errorCode == KErrNone )
1671 //[ ok lets add the source and sink ]
1672 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
1673 User::LeaveIfError( errorCode );
1675 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
1676 User::LeaveIfError( errorCode );
1678 // Store the original sample rate
1680 errorCode = theCommander.GetSourceSampleRate(origRate);
1681 if (errorCode != KErrNone)
1683 INFO_PRINTF2(_L("Error getting original source sample rate %d"), errorCode);
1687 // Ensure the array is empty
1688 supportedRates.Reset();
1689 TRAPD( errorCode3,theCommander.GetSupportedSourceSampleRatesL(supportedRates));
1690 User::LeaveIfError( errorCode3 );
1692 TUint theNewRate = 0;
1694 for (TInt index = 0; index < supportedRates.Count(); index++)
1696 theRate = supportedRates[index];
1697 // SetSourceSampleRate
1698 errorCode = theCommander.SetSourceSampleRate(theRate);
1699 if (theRate == origRate)
1701 if (errorCode != KErrNone)
1703 INFO_PRINTF2(_L("SetSourceSampleRate returned unexpected error %d"), errorCode);
1710 // Setting source sample rate to a different value
1711 // is tolerated (INC038043) to preserve BC with 6.1
1712 if (errorCode != KErrNone)
1714 INFO_PRINTF3(_L("SetSourceDataType returned %d, expecting %d"), errorCode, KErrAlreadyExists);
1719 // GetSourceSampleRate
1720 errorCode = theCommander.GetSourceSampleRate(theNewRate);
1721 if (theNewRate != origRate)
1723 INFO_PRINTF3(_L("GetSourceSampleRate rate %d did not match expected %d"), theNewRate, origRate);
1728 if (errorCode != KErrNone)
1730 INFO_PRINTF3(_L("GetSourceSampleRate returned unexpected error %d, expected %d"), errorCode, KErrNone);
1736 CleanupStack::PopAndDestroy(1); // supportedRates
1738 //[ ensure the controller is unloaded so that it does
1739 // not interfere with the following test ]
1740 // There is error in this code and the stop followed by reset
1741 // ensure the controller resources are released.
1743 iController.Reset();
1744 iController.Close();
1752 * CTestStepGetSetSinkSampleRate
1755 CTestStepGetSetSinkSampleRate::CTestStepGetSetSinkSampleRate()
1757 iTestStepName = _L("MM-MMF-ACTRL-U-0026-HP");
1762 * ~CTestStepGetSetSinkSampleRate
1765 CTestStepGetSetSinkSampleRate::~CTestStepGetSetSinkSampleRate()
1774 TVerdict CTestStepGetSetSinkSampleRate::DoTestStepL( void )
1777 TVerdict result = EPass;
1779 _LIT( KTestSourceNumChannels, "GetSet Sink Sample Rate");
1780 Log( KTestSourceNumChannels);
1782 _LIT( KTestSinkBitRateReason, "This test checks the set/get sink sample rate");
1783 Log( KTestSinkBitRateReason );
1785 // [ audio file to play ]
1786 _LIT(KTestWavFile, "newmail.wav");
1787 SetReadFileNameL( KTestWavFile );
1789 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
1790 User::LeaveIfError( errorCode );
1792 //[ attempt to get the sink num channels ]
1793 RMMFAudioControllerCustomCommands theCommander( iController );
1796 errorCode = theCommander.GetSinkSampleRate(theRate);
1797 if( errorCode == KErrNone )
1802 //[ ok lets add the source and sink ]
1805 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
1806 if(errorCode!=KErrNone)
1814 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
1815 if(errorCode!=KErrNone)
1824 errorCode = theCommander.GetSinkSampleRate(theRate);
1825 if(errorCode!=KErrNotSupported)
1827 INFO_PRINTF2(_L("GetSinkSampleRate returned %d when KErrNotSupported is expected"), errorCode);
1834 //[ set the sample rate ]
1835 errorCode = theCommander.SetSinkSampleRate(theRate);
1836 if(errorCode!=KErrNotSupported)
1838 INFO_PRINTF2(_L("SetSinkSampleRate returned %d when KErrNotSupported is expected"), errorCode);
1845 TUint theSampleRate( 8000); // set sample rate to 8khz arbitrary value
1846 //[ set the sample rate ]
1847 theRate = theSampleRate; // known reasonable value
1848 errorCode = theCommander.SetSinkSampleRate(theRate);
1849 if(errorCode!=KErrNotSupported)
1851 INFO_PRINTF2(_L("SetSinkSampleRate returned %d when KErrNotSupported is expected"), errorCode);
1859 errorCode = theCommander.GetSinkSampleRate(theRate);
1860 if(errorCode!=KErrNotSupported)
1862 INFO_PRINTF2(_L("GetSinkSampleRate returned %d when KErrNotSupported is expected"), errorCode);
1867 //[ ensure the controller is unloaded so that it does
1868 // not interfere with the following test ]
1869 // There is error in this code and the stop followed by reset
1870 // ensure the controller resources are released.
1872 iController.Reset();
1873 iController.Close();
1881 * CTestStepGetSetSourceBitRate
1884 CTestStepGetSetSourceBitRate::CTestStepGetSetSourceBitRate()
1886 iTestStepName = _L("MM-MMF-ACTRL-U-0027-HP");
1891 * ~CTestStepGetSetSourceBitRate
1894 CTestStepGetSetSourceBitRate::~CTestStepGetSetSourceBitRate()
1903 TVerdict CTestStepGetSetSourceBitRate::DoTestStepL( void )
1906 TVerdict result = EPass;
1908 _LIT( KTestSourceNumChannels, "GetSet Source Bit Rate");
1909 Log( KTestSourceNumChannels);
1911 _LIT( KTestSinkBitRateReason, "This test checks the set/get source bit rate");
1912 Log( KTestSinkBitRateReason );
1914 // [ audio file to play ]
1915 _LIT(KTestWavFile, "newmail.wav");
1916 SetReadFileNameL( KTestWavFile );
1918 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
1919 User::LeaveIfError( errorCode );
1921 //[ attempt to get the sink num channels ]
1922 RMMFAudioControllerCustomCommands theCommander( iController );
1925 errorCode = theCommander.GetSourceBitRate(theRate);
1926 if( errorCode == KErrNone )
1932 //[ ok lets add the source and sink ]
1933 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
1934 User::LeaveIfError( errorCode );
1936 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
1937 User::LeaveIfError( errorCode );
1940 errorCode = theCommander.GetSourceBitRate(theRate);
1941 User::LeaveIfError( errorCode );
1943 // check to see if the bitrate is greater than zero
1944 // (it should exactly be samplerate*bitspersample)
1951 //[ this is currently not supported ]
1952 errorCode = theCommander.SetSourceBitRate(theRate);
1953 if( errorCode == KErrNone )
1959 //[ ensure the controller is unloaded so that it does
1960 // not interfere with the following test ]
1961 // There is error in this code and the stop followed by reset
1962 // ensure the controller resources are released.
1964 iController.Reset();
1965 iController.Close();
1973 * CTestStepGetSetSourceDataType
1976 CTestStepGetSetSourceDataType::CTestStepGetSetSourceDataType()
1978 iTestStepName = _L("MM-MMF-ACTRL-U-0028-HP");
1983 * ~CTestStepGetSetSourceDataType
1986 CTestStepGetSetSourceDataType::~CTestStepGetSetSourceDataType()
1995 TVerdict CTestStepGetSetSourceDataType::DoTestStepL( void )
1998 TVerdict result = EPass;
2000 _LIT( KTestSourceNumChannels, "GetSet Source Data type");
2001 Log( KTestSourceNumChannels);
2003 _LIT( KTestSinkBitRateReason, "This test checks the set/get source data type");
2004 Log( KTestSinkBitRateReason );
2006 // [ audio file to play ]
2007 _LIT(KTestWavFile, "newmail.wav");
2008 SetReadFileNameL( KTestWavFile );
2010 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
2011 User::LeaveIfError( errorCode );
2013 //[ attempt to get the sink num channels ]
2014 RMMFAudioControllerCustomCommands theCommander( iController );
2017 errorCode = theCommander.GetSourceDataType( theFCC );
2018 if( errorCode == KErrNone )
2024 //[ ok lets add the source and sink ]
2025 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
2026 User::LeaveIfError( errorCode );
2028 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
2029 User::LeaveIfError( errorCode );
2031 errorCode = theCommander.GetSourceDataType( theFCC );
2032 User::LeaveIfError( errorCode );
2035 errorCode = theCommander.SetSourceDataType( theFCC );
2036 User::LeaveIfError( errorCode );
2038 errorCode = theCommander.GetSourceDataType( theNewFCC );
2039 User::LeaveIfError( errorCode );
2041 if( theNewFCC != theFCC )
2046 //[ ensure the controller is unloaded so that it does
2047 // not interfere with the following test ]
2048 // There is error in this code and the stop followed by reset
2049 // ensure the controller resources are released.
2051 iController.Reset();
2052 iController.Close();
2060 * CTestStepGetSetSinkDataType
2063 CTestStepGetSetSinkDataType::CTestStepGetSetSinkDataType()
2065 iTestStepName = _L("MM-MMF-ACTRL-U-0029-HP");
2070 * ~CTestStepGetSetSinkDataType
2073 CTestStepGetSetSinkDataType::~CTestStepGetSetSinkDataType()
2082 TVerdict CTestStepGetSetSinkDataType::DoTestStepL( void )
2085 TVerdict result = EPass;
2087 _LIT( KTestSourceNumChannels, "GetSet Sink Data type");
2088 Log( KTestSourceNumChannels);
2090 _LIT( KTestSinkBitRateReason, "This test checks the set/get sink data type");
2091 Log( KTestSinkBitRateReason );
2093 // [ audio file to play ]
2094 _LIT(KTestWavFile, "newmail.wav");
2095 SetReadFileNameL( KTestWavFile );
2097 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
2098 User::LeaveIfError( errorCode );
2100 //[ attempt to get the sink num channels ]
2101 RMMFAudioControllerCustomCommands theCommander( iController );
2104 errorCode = theCommander.GetSinkDataType( theFCC );
2105 if( errorCode == KErrNone )
2110 //[ ok lets add the source and sink ]
2113 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
2114 if(errorCode!=KErrNone)
2122 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
2123 if(errorCode!=KErrNone)
2131 errorCode = theCommander.GetSinkDataType( theFCC );
2132 if(errorCode!=KErrNotSupported)
2134 INFO_PRINTF2(_L("GetSinkDataType returned %d when KErrNotSupported is expected"), errorCode);
2141 errorCode = theCommander.SetSinkDataType( theFCC );
2142 if(errorCode!=KErrNotSupported)
2144 INFO_PRINTF2(_L("SetSinkDataType returned %d when KErrNotSupported is expected"), errorCode);
2152 errorCode = theCommander.GetSinkDataType( theNewFCC );
2153 if(errorCode!=KErrNotSupported)
2155 INFO_PRINTF2(_L("GetSinkDataType returned %d when KErrNotSupported is expected"), errorCode);
2160 //[ ensure the controller is unloaded so that it does
2161 // not interfere with the following test ]
2162 // There is error in this code and the stop followed by reset
2163 // ensure the controller resources are released.
2165 iController.Reset();
2166 iController.Close();
2174 * CTestStepGetSetSinkBitRate
2178 CTestStepGetSetSinkBitRate::CTestStepGetSetSinkBitRate()
2180 iTestStepName = _L("MM-MMF-ACTRL-U-0030-HP");
2185 * ~CTestStepGetSetSinkDataType
2189 CTestStepGetSetSinkBitRate::~CTestStepGetSetSinkBitRate()
2199 TVerdict CTestStepGetSetSinkBitRate::DoTestStepL( void )
2202 TVerdict result = EPass;
2204 _LIT( KTestSourceNumChannels, "GetSetSinkBitRate");
2205 Log( KTestSourceNumChannels);
2207 _LIT( KTestSinkBitRateReason, "This test checks setting and getting a sinks bit rate");
2208 Log( KTestSinkBitRateReason );
2210 // [ audio file to play ]
2211 _LIT(KTestWavFile, "newmail.wav");
2212 SetReadFileNameL( KTestWavFile );
2214 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
2215 User::LeaveIfError( errorCode );
2217 // [ attempt to get the bit rate with out a sink]
2218 RMMFAudioControllerCustomCommands theCommander( iController );
2221 errorCode = theCommander.GetSinkBitRate(theRate);
2222 if( errorCode == KErrNone )
2228 //[ add data source and sink and prime the controller ]
2229 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
2230 User::LeaveIfError( errorCode );
2232 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
2233 User::LeaveIfError( errorCode );
2235 errorCode = theCommander.GetSinkBitRate(theRate);
2236 if( errorCode == KErrNone )
2242 errorCode = iController.Prime();
2243 User::LeaveIfError( errorCode );
2245 // [ wait for and process the return event from the audio output ]
2247 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
2248 result = SearchForEvent( primeEvent );
2249 if( result == EFail )
2254 //[ check when we are primed ]
2255 errorCode = theCommander.GetSinkBitRate(theRate);
2256 if( errorCode == KErrNone )
2262 // [ lets reset and add a data sink and source that will
2263 // exercise the happy day scenario ]
2264 errorCode = iController.Reset();
2265 User::LeaveIfError( errorCode );
2267 // [ check when recording ]
2268 _LIT(KTestWavFileRecord, "16bitmpcm.wav");
2270 SetReadFileNameL( KTestWavFileRecord );
2271 // check if record file already exists
2273 TInt fileErr = iFs.Entry(ReadFileConfig()().iPath, fileEntry);
2274 if (fileErr != KErrNotFound)
2276 User::LeaveIfError(fileErr);
2279 //[ add data source and sink and prime the controller ]
2280 errorCode = iController.AddDataSource(KUidMmfAudioInput, KNullDesC8);
2281 User::LeaveIfError( errorCode );
2283 //[ add data source and sink and prime the controller ]
2284 errorCode = iController.AddDataSink(KUidMmfFileSink, ReadFileConfig());
2285 User::LeaveIfError( errorCode );
2287 //[lets get the sink bit rate]
2288 errorCode = theCommander.GetSinkBitRate(theRate);
2289 User::LeaveIfError( errorCode );
2291 // check to see if the bitrate is greater than zero
2292 // (it should exactly be samplerate*bitspersample)
2293 // fail if the bitrate returned is zero and the record file exists
2294 if ((theRate == 0) && (fileErr != KErrNotFound))
2300 const TUint KArbitraryBitRate = 1000; // 1 Khz
2301 //[lets get the sink bit rate]
2302 errorCode = theCommander.SetSinkBitRate( KArbitraryBitRate );
2303 if( errorCode == KErrNone )
2309 errorCode = iController.Prime();
2310 User::LeaveIfError( errorCode );
2312 // [ wait for and process the return event from the audio output ]
2313 result = SearchForEvent( primeEvent );
2314 if( result == EFail )
2319 //[ get the bit rate while playing ]
2320 User::LeaveIfError( iController.Play() );
2321 TMMFEvent playEvent( KPlayTestId, KErrNone );
2323 result = SearchForEvent( playEvent );
2324 if( result == EFail )
2329 //[lets get the sink bit rate]
2330 errorCode = theCommander.GetSinkBitRate(theRate);
2331 User::LeaveIfError( errorCode );
2333 // check to see if the bitrate is greater than zero
2334 // (it should exactly be samplerate*bitspersample)
2341 //[lets get the sink bit rate]
2342 errorCode = theCommander.SetSinkBitRate(1000);
2343 if( errorCode == KErrNone )
2349 //[ ensure the controller is unloaded so that it does
2350 // not interfere with the following test ]
2351 // There is error in this code and the stop followed by reset
2352 // ensure the controller resources are released.
2354 iController.Reset();
2355 iController.Close();
2359 // test steps return a result
2365 * CTestStepGetSetMetaData
2367 CTestStepGetSetMetaData::CTestStepGetSetMetaData()
2369 iTestStepName = _L("MM-MMF-ACTRL-U-0031-HP");
2374 * ~CTestStepGetSetMetaData
2376 CTestStepGetSetMetaData::~CTestStepGetSetMetaData()
2384 TVerdict CTestStepGetSetMetaData::DoTestStepL( void )
2388 TVerdict result = EFail;
2390 _LIT( KTestPlay, "Meta data test with play scenario Test");
2393 _LIT( KTestStepPlay, "This test checks setting/getting meta data");
2394 Log( KTestStepPlay );
2396 // [ audio file to play ]
2397 _LIT(KTestWavFile, "newmail.wav");
2398 SetReadFileNameL( KTestWavFile );
2400 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
2401 User::LeaveIfError( errorCode );
2403 //[ add data source and sink and prime the controller ]
2404 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
2405 User::LeaveIfError( errorCode );
2407 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
2408 User::LeaveIfError( errorCode );
2410 // [ lets get the number of meta data entries
2411 // for this format the meta data is unsupported ]
2412 TInt numEntries = 0;
2413 errorCode = iController.GetNumberOfMetaDataEntries( numEntries );
2414 if( errorCode != KErrNotSupported )
2416 User::LeaveIfError( errorCode );
2419 // [ lets get a meta data entry ]
2420 const TInt KIndex = 0;
2421 TRAP( errorCode, iController.GetMetaDataEntryL( KIndex ));
2422 if( errorCode != KErrNotSupported )
2424 User::LeaveIfError( errorCode );
2427 errorCode = iController.Prime();
2428 User::LeaveIfError( errorCode );
2430 // [ wait for and process the return event from the audio output ]
2432 TMMFEvent primeEvent( KPrimeTestId, KErrNone);
2433 result = SearchForEvent( primeEvent );
2434 if( result == EFail )
2439 // [ lets get the number of meta data entries
2440 // for this format the meta data is unsupported ]
2442 errorCode = iController.GetNumberOfMetaDataEntries( numEntries );
2443 if( errorCode != KErrNotSupported )
2445 User::LeaveIfError( errorCode );
2448 // [ lets get a meta data entry ]
2449 TRAP( errorCode, iController.GetMetaDataEntryL( KIndex ));
2450 if( errorCode != KErrNotSupported )
2452 User::LeaveIfError( errorCode );
2455 User::LeaveIfError( iController.Play() );
2457 // note this test does not wait around
2458 // to detect that the audio has been played
2459 // [ now process the confirmation event that play has reached audio output
2460 // this is the raison detre of the test ]
2461 TMMFEvent playEvent( KPlayTestId, KErrNone );
2463 result = SearchForEvent( playEvent );
2465 // [ lets try to get the meta data when playing ]
2467 errorCode = iController.GetNumberOfMetaDataEntries( numEntries );
2468 if( errorCode != KErrNotReady )
2470 User::LeaveIfError( errorCode );
2473 // [ lets get a meta data entry ]
2474 // This kills the thread and is under investigation
2475 TRAP( errorCode, iController.GetMetaDataEntryL( KIndex ));
2476 if( errorCode != KErrNotReady )
2478 User::LeaveIfError( errorCode );
2481 //[ ensure the controller is unloaded so that it does
2482 // not interfere with the following test ]
2483 // There is error in this code and the stop followed by reset
2484 // ensure the controller resources are released.
2486 iController.Reset();
2487 iController.Close();
2491 // test steps return a result
2497 * CTestStepGetSupportedSinkDataTypes
2500 CTestStepGetSupportedSinkDataTypes::CTestStepGetSupportedSinkDataTypes()
2502 iTestStepName = _L("MM-MMF-ACTRL-U-0034-HP");
2507 * ~CTestStepGetSupportedSinkDataTypes
2510 CTestStepGetSupportedSinkDataTypes::~CTestStepGetSupportedSinkDataTypes()
2517 * This test gets the supported sink data types
2520 TVerdict CTestStepGetSupportedSinkDataTypes::DoTestStepL( void )
2523 TVerdict result = EPass;
2524 _LIT( KTestSourceNumChannels, "GetSupported Sink Data types");
2525 Log( KTestSourceNumChannels);
2527 _LIT( KTestSinkBitRateReason, "This test checks the get supported sink data types method");
2528 Log( KTestSinkBitRateReason );
2530 // [ audio file to play ]
2531 _LIT(KTestWavFile, "newmail.wav");
2532 SetReadFileNameL( KTestWavFile );
2534 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
2535 User::LeaveIfError( errorCode );
2537 //[ attempt to get the sink num channels ]
2538 RMMFAudioControllerCustomCommands theCommander( iController );
2540 RArray<TFourCC> supportedDataTypes;
2541 CleanupClosePushL(supportedDataTypes);
2543 TRAPD( errorCode2, theCommander.GetSupportedSinkDataTypesL( supportedDataTypes ));
2544 if( ( errorCode2 == KErrNone ) || supportedDataTypes.Count() )
2546 //[ should have failed with either an error code or non zero supported types ]
2550 //[ ok lets add the source and sink ]
2553 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
2554 if(errorCode!=KErrNone)
2562 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
2563 if(errorCode!=KErrNone)
2571 //[ ensure the array is empty ]
2572 supportedDataTypes.Reset();
2573 TRAPD( errorCode3,theCommander.GetSupportedSinkDataTypesL( supportedDataTypes ));
2574 if(errorCode3!=KErrNotSupported)
2576 INFO_PRINTF2(_L("GetSupportedSinkDataTypesL left with %d when KErrNotSupported is expected"), errorCode);
2582 //[ pop supportedDataTypes ]
2583 CleanupStack::PopAndDestroy(1);//supportedDataTypes
2585 //[ ensure the controller is unloaded so that it does
2586 // not interfere with the following test ]
2587 // There is error in this code and the stop followed by reset
2588 // ensure the controller resources are released.
2590 iController.Reset();
2591 iController.Close();
2599 * CTestStepGetSupportedSourceDataTypes
2602 CTestStepGetSupportedSourceDataTypes::CTestStepGetSupportedSourceDataTypes()
2604 iTestStepName = _L("MM-MMF-ACTRL-U-0035-HP");
2609 * ~CTestStepGetSupportedSourceDataTypes
2612 CTestStepGetSupportedSourceDataTypes::~CTestStepGetSupportedSourceDataTypes()
2621 TVerdict CTestStepGetSupportedSourceDataTypes::DoTestStepL( void )
2624 TVerdict result = EPass;
2626 _LIT( KTestSourceNumChannels, "GetSupported Source Data types");
2627 Log( KTestSourceNumChannels);
2629 _LIT( KTestSinkBitRateReason, "This test checks the get supported source data types method");
2630 Log( KTestSinkBitRateReason );
2632 // [ audio file to play ]
2633 _LIT(KTestWavFile, "newmail.wav");
2634 SetReadFileNameL( KTestWavFile );
2636 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
2637 User::LeaveIfError( errorCode );
2639 //[ attempt to get the sink num channels ]
2640 RMMFAudioControllerCustomCommands theCommander( iController );
2642 RArray<TFourCC> supportedDataTypes;
2643 CleanupClosePushL(supportedDataTypes);
2645 TRAPD( errorCode2, theCommander.GetSupportedSourceDataTypesL( supportedDataTypes ));
2646 if( ( errorCode2 == KErrNone ) || supportedDataTypes.Count() )
2648 //[ should have failed with either an error code or non zero supported types ]
2653 //[ ok lets add the source and sink ]
2654 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
2655 User::LeaveIfError( errorCode );
2657 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
2658 User::LeaveIfError( errorCode );
2660 //[ ensure the array is empty ]
2661 supportedDataTypes.Reset();
2662 TRAPD( errorCode3,theCommander.GetSupportedSourceDataTypesL( supportedDataTypes ));
2663 User::LeaveIfError( errorCode3 );
2665 // Store the original FCC
2667 errorCode = theCommander.GetSourceDataType(origFCC);
2668 if (errorCode != KErrNone)
2670 INFO_PRINTF2(_L("GetSourceDataType returned error %d"), errorCode);
2677 //[ loop over the possible set of data types that are supported ]
2678 for( TInt index = 0; index < supportedDataTypes.Count(); index++ )
2680 theFCC = supportedDataTypes[ index];
2681 errorCode = theCommander.SetSourceDataType( theFCC );
2683 if (theFCC == origFCC)
2685 // Trying to set the correct FCC
2686 if (errorCode != KErrNone)
2688 INFO_PRINTF2(_L("SetSourceDataType returned unexpected error %d"), errorCode);
2695 if (errorCode != KErrAlreadyExists)
2697 INFO_PRINTF3(_L("SetSourceDataType returned %d, expecting %d"), errorCode, KErrAlreadyExists);
2703 errorCode = theCommander.GetSourceDataType( theNewFCC );
2704 if (theNewFCC != origFCC)
2706 INFO_PRINTF1(_L("GetSourceDataType returned incorrect FCC"));
2711 if (errorCode != KErrNone)
2713 INFO_PRINTF2(_L("GetSourceDataType returned unexpected error %d"), errorCode);
2719 //[ pop supportedDataTypes ]
2720 CleanupStack::PopAndDestroy(1);//supportedDataTypes
2722 //[ ensure the controller is unloaded so that it does
2723 // not interfere with the following test ]
2724 // There is error in this code and the stop followed by reset
2725 // ensure the controller resources are released.
2727 iController.Reset();
2728 iController.Close();
2736 * CTestStepGetSupportedSourceNumChannels
2739 CTestStepGetSupportedSourceNumChannels::CTestStepGetSupportedSourceNumChannels()
2741 iTestStepName = _L("MM-MMF-ACTRL-U-0036-HP");
2746 * ~CTestStepGetSupportedSourceNumChannels
2749 CTestStepGetSupportedSourceNumChannels::~CTestStepGetSupportedSourceNumChannels()
2756 * This test tests the number of channels supported by a source
2759 TVerdict CTestStepGetSupportedSourceNumChannels::DoTestStepL( void )
2762 TVerdict result = EPass;
2764 _LIT( KTestSourceNumChannels, "GetSupported Source Num Channels");
2765 Log( KTestSourceNumChannels);
2767 _LIT( KTestSinkBitRateReason, "This test checks the get supported source channels");
2768 Log( KTestSinkBitRateReason );
2770 // [ audio file to play ]
2771 _LIT(KTestWavFile, "newmail.wav");
2772 SetReadFileNameL( KTestWavFile );
2774 TInt errorCode = iController.Open(KUidCustomTestAudioPlugin, iPriority);
2775 User::LeaveIfError( errorCode );
2777 //[ attempt to get the sink num channels ]
2778 RMMFAudioControllerCustomCommands theCommander( iController );
2780 RArray<TUint> supportedChannels;
2781 CleanupClosePushL(supportedChannels);
2783 TRAPD( errorCode2, theCommander.GetSupportedSourceNumChannelsL( supportedChannels));
2784 if( errorCode2 == KErrNone )
2786 //[ should have failed with either an error code or non zero supported types ]
2791 //[ ok lets add the source and sink ]
2792 errorCode = iController.AddDataSource(KUidMmfFileSource, ReadFileConfig());
2793 User::LeaveIfError( errorCode );
2795 errorCode = iController.AddDataSink(KUidMmfAudioOutput, KNullDesC8);
2796 User::LeaveIfError( errorCode );
2798 //[ ensure the array is empty ]
2799 supportedChannels.Reset();
2800 TRAPD( errorCode3, theCommander.GetSupportedSourceNumChannelsL( supportedChannels));
2801 User::LeaveIfError( errorCode3 );
2803 TUint orgNumChannels = 0;
2804 errorCode = theCommander.GetSourceNumChannels( orgNumChannels);
2805 User::LeaveIfError( errorCode );
2807 //[ loop over the possible set of data types that are supported ]
2808 for( TInt index = 0; index < supportedChannels.Count(); index++ )
2810 TUint oldNumChannels = supportedChannels[ index];
2811 TUint numChannels = 0;
2812 //[ wav files currently do not support a variable num source channels]
2813 errorCode = theCommander.SetSourceNumChannels( oldNumChannels);
2814 if (oldNumChannels == orgNumChannels)
2816 // We tried to set the right number of channels for clip
2817 if (errorCode != KErrNone)
2819 INFO_PRINTF2(_L("Error calling SetSourceNumChannels %d"), errorCode);
2826 // Setting source sample rate to a different value
2827 // is tolerated (INC038043) to preserve BC with 6.1
2828 if (errorCode != KErrNone)
2830 INFO_PRINTF2(_L("Unexpected error code returned by SetSourceNumChannels %d"), errorCode);
2836 //[ check the set operation resulted in no change of the
2837 // number of channels ]
2838 errorCode = theCommander.GetSourceNumChannels( numChannels);
2839 User::LeaveIfError( errorCode );
2840 if( orgNumChannels != numChannels )
2842 INFO_PRINTF3(_L("GetSourceNumChannels returned %d, expecting %d"), numChannels, orgNumChannels);
2848 //[ pop supportedChannels ]
2849 CleanupStack::PopAndDestroy(1);//supportedChannels
2851 //[ ensure the controller is unloaded so that it does
2852 // not interfere with the following test ]
2853 // There is error in this code and the stop followed by reset
2854 // ensure the controller resources are released.
2856 iController.Reset();
2857 iController.Close();