0
|
1 |
// Copyright (c) 2005-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 TestRecorder.cpp
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "mmfwavformat.h"
|
|
23 |
#include <hal.h>
|
|
24 |
#include "TestRecorder.h"
|
|
25 |
|
|
26 |
//copy util
|
|
27 |
TInt CopyFile(TPtrC aFileNameSrc, TPtrC aFileNameDst)
|
|
28 |
{
|
|
29 |
TInt theErr = KErrNone;
|
|
30 |
|
|
31 |
RFs fs;
|
|
32 |
fs.Connect();
|
|
33 |
RFile theFileNew;
|
|
34 |
RFile theFile;
|
|
35 |
|
|
36 |
fs.MkDirAll(aFileNameDst);
|
|
37 |
theFile.Open(fs, aFileNameSrc, EFileShareReadersOnly);
|
|
38 |
TInt theSize;
|
|
39 |
theFile.Size(theSize);
|
|
40 |
|
|
41 |
TBuf8<KSizeBuf> theBuf;
|
|
42 |
TInt theStep = KSizeBuf;
|
|
43 |
if(theStep > theSize)
|
|
44 |
{
|
|
45 |
theStep = theSize;
|
|
46 |
}
|
|
47 |
|
|
48 |
TInt theRes = theFileNew.Create(fs, aFileNameDst, EFileShareAny);
|
|
49 |
if(theRes == KErrAlreadyExists)
|
|
50 |
{
|
|
51 |
theRes = theFileNew.Replace(fs, aFileNameDst, EFileShareAny);
|
|
52 |
}
|
|
53 |
|
|
54 |
|
|
55 |
if(theRes != KErrNone)
|
|
56 |
{
|
|
57 |
return theRes;
|
|
58 |
}
|
|
59 |
|
|
60 |
|
|
61 |
TInt theCurLength = 0;
|
|
62 |
while(theCurLength < theSize)
|
|
63 |
{
|
|
64 |
theFile.Read(theBuf, theStep);
|
|
65 |
theFileNew.Write(theBuf, theStep);
|
|
66 |
theCurLength += theStep;
|
|
67 |
|
|
68 |
if(theCurLength + theStep > theSize )
|
|
69 |
{
|
|
70 |
theStep = theSize - theCurLength;
|
|
71 |
}
|
|
72 |
}
|
|
73 |
|
|
74 |
theFileNew.Close();
|
|
75 |
theFile.Close();
|
|
76 |
fs.Close();
|
|
77 |
|
|
78 |
return theErr;
|
|
79 |
}
|
|
80 |
|
|
81 |
|
|
82 |
CTestMmfAclntRecord::CTestMmfAclntRecord(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative) :
|
|
83 |
iNegative(aNegative)
|
|
84 |
{
|
|
85 |
// store the name of this test case
|
|
86 |
// this is the name that is used by the script file
|
|
87 |
// Each test step initialises it's own name
|
|
88 |
iTestStepName = aTestName;
|
|
89 |
iSectName = aSectName;
|
|
90 |
}
|
|
91 |
|
|
92 |
void CTestMmfAclntRecord::MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
|
|
93 |
{
|
|
94 |
iError = aErrorCode;
|
|
95 |
iObject = aObject;
|
|
96 |
iPreviousState = aPreviousState;
|
|
97 |
iCurrentState = aCurrentState;
|
|
98 |
INFO_PRINTF1( _L("CTestMmfAclntRecord : MMdaObjectStateChangeObserver Callback for CMdaAudioRecorderUtility complete"));
|
|
99 |
INFO_PRINTF4( _L("iError %d iPreviousState %d iCurrentState %d"), iError, iPreviousState, iCurrentState);
|
|
100 |
CActiveScheduler::Stop();
|
|
101 |
}
|
|
102 |
|
|
103 |
TVerdict CTestMmfAclntRecord::DoTestStepL( void )
|
|
104 |
{
|
|
105 |
INFO_PRINTF1( _L("TestRecorder"));
|
|
106 |
TVerdict ret = EFail;
|
|
107 |
|
|
108 |
iError = KErrTimedOut;
|
|
109 |
|
|
110 |
TBuf<KSizeBuf> filename;
|
|
111 |
TPtrC filename1;
|
|
112 |
TPtrC filename2;
|
|
113 |
|
|
114 |
if(!GetStringFromConfig(iSectName, _L("cropAudioFile"), filename1))
|
|
115 |
{
|
|
116 |
return EInconclusive;
|
|
117 |
}
|
|
118 |
|
|
119 |
|
|
120 |
if(!GetStringFromConfig(iSectName, _L("playerAudioFile"), filename2))
|
|
121 |
{
|
|
122 |
return EInconclusive;
|
|
123 |
}
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
GetDriveName(filename);
|
|
128 |
filename.Append(filename1);
|
|
129 |
|
|
130 |
CopyFile(filename2, filename);
|
|
131 |
|
|
132 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
133 |
CleanupStack::PushL(recUtil);
|
|
134 |
recUtil->OpenFileL(filename);
|
|
135 |
// wait
|
|
136 |
INFO_PRINTF1(_L("Initialise CMdaAudioRecorderUtility"));
|
|
137 |
CActiveScheduler::Start();
|
|
138 |
|
|
139 |
|
|
140 |
if(iError == KErrNone)
|
|
141 |
{
|
|
142 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility->OpenFileL(%S)"), &filename);
|
|
143 |
ret = DoTestL(recUtil);
|
|
144 |
}
|
|
145 |
|
|
146 |
CleanupStack::PopAndDestroy(recUtil);
|
|
147 |
User::After(KTwoSeconds);
|
|
148 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility completed with error %d"),iError );
|
|
149 |
return ret;
|
|
150 |
}
|
|
151 |
|
|
152 |
CTestMmfAclntRecGain::CTestMmfAclntRecGain(const TDesC& aTestName, const TDesC& aSectName, const TInt aGain, TBool aNegative)
|
|
153 |
:CTestMmfAclntRecord(aTestName, aSectName, aNegative)
|
|
154 |
, iGain (aGain)
|
|
155 |
{}
|
|
156 |
|
|
157 |
CTestMmfAclntRecGain* CTestMmfAclntRecGain::NewL(const TDesC& aTestName, const TDesC& aSectName,const TInt aGain, TBool aNegative)
|
|
158 |
{
|
|
159 |
CTestMmfAclntRecGain* self = new (ELeave) CTestMmfAclntRecGain(aTestName, aSectName, aGain, aNegative);
|
|
160 |
return self;
|
|
161 |
}
|
|
162 |
|
|
163 |
/**
|
|
164 |
* RecordUtils test: Set gain to maximum and enquire gain.
|
|
165 |
*/
|
|
166 |
TVerdict CTestMmfAclntRecGain::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
167 |
{
|
|
168 |
INFO_PRINTF2( _L("TestRecorder : Gain - (%d)"), iGain);
|
|
169 |
|
|
170 |
TVerdict ret = EFail;
|
|
171 |
|
|
172 |
// Set up a file to record to
|
|
173 |
TPtrC filename;
|
|
174 |
if (!GetStringFromConfig(iSectName, _L("outputAudioFile"), filename))
|
|
175 |
{
|
|
176 |
INFO_PRINTF1(_L("Error getting filename from INI file"));
|
|
177 |
return EInconclusive;
|
|
178 |
}
|
|
179 |
|
|
180 |
RFs fs;
|
|
181 |
TInt err = fs.Connect();
|
|
182 |
if (err != KErrNone)
|
|
183 |
{
|
|
184 |
INFO_PRINTF2(_L("Error connecting file session"), err);
|
|
185 |
fs.Close();
|
|
186 |
return EInconclusive;
|
|
187 |
}
|
|
188 |
|
|
189 |
err = fs.Delete(filename);
|
|
190 |
|
|
191 |
if (!((err == KErrNone) || (err == KErrNotFound)))
|
|
192 |
{
|
|
193 |
INFO_PRINTF2(_L("Error deleting output file"), err);
|
|
194 |
return EInconclusive;
|
|
195 |
}
|
|
196 |
|
|
197 |
// Add create file for Ogg-tests
|
|
198 |
if(iSectName == _L("SectionOggRec"))
|
|
199 |
{
|
|
200 |
RFs fs;
|
|
201 |
User::LeaveIfError(fs.Connect());
|
|
202 |
RFile file;
|
|
203 |
User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
|
|
204 |
file.Close();
|
|
205 |
fs.Close();
|
|
206 |
}
|
|
207 |
|
|
208 |
aRecUtil->OpenFileL(filename);
|
|
209 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility->OpenFileL(%S)"), &filename);
|
|
210 |
CActiveScheduler::Start();
|
|
211 |
|
|
212 |
if (iError != KErrNone)
|
|
213 |
{
|
|
214 |
INFO_PRINTF2(_L("Error opening file for recording"), iError);
|
|
215 |
return EInconclusive;
|
|
216 |
}
|
|
217 |
|
|
218 |
// Set gain
|
|
219 |
if(iGain == 0)
|
|
220 |
{
|
|
221 |
iGain = aRecUtil->MaxGain();
|
|
222 |
}
|
|
223 |
|
|
224 |
aRecUtil->SetGain(iGain);
|
|
225 |
|
|
226 |
// Set expected value
|
|
227 |
TInt expectedGain = 0;
|
|
228 |
if (iGain > aRecUtil->MaxGain())
|
|
229 |
{
|
|
230 |
expectedGain = aRecUtil->MaxGain();
|
|
231 |
}
|
|
232 |
|
|
233 |
else if (iGain < 0)
|
|
234 |
{
|
|
235 |
expectedGain = 0;
|
|
236 |
}
|
|
237 |
|
|
238 |
else
|
|
239 |
{
|
|
240 |
expectedGain = iGain;
|
|
241 |
}
|
|
242 |
|
|
243 |
|
|
244 |
aRecUtil->SetDestinationSampleRateL(8000);
|
|
245 |
|
|
246 |
// Start recording
|
|
247 |
aRecUtil->RecordL();
|
|
248 |
CActiveScheduler::Start();
|
|
249 |
User::After(1000000);
|
|
250 |
|
|
251 |
// Get gain
|
|
252 |
TInt gain;
|
|
253 |
aRecUtil->GetGain(gain);
|
|
254 |
|
|
255 |
// The gain should be not be more than max gain
|
|
256 |
if (gain > aRecUtil->MaxGain())
|
|
257 |
{
|
|
258 |
INFO_PRINTF3(_L("ERROR: GetGain value greater than MaxGain (%d > %d)"), gain, aRecUtil->MaxGain());
|
|
259 |
ret = EFail;
|
|
260 |
}
|
|
261 |
// The gain should not be less than 0
|
|
262 |
else if (gain < 0)
|
|
263 |
{
|
|
264 |
INFO_PRINTF3(_L("ERROR: GetGain value less than minimum gain (%d < %d)"), gain, 0);
|
|
265 |
ret = EFail;
|
|
266 |
}
|
|
267 |
else if (gain != expectedGain)
|
|
268 |
{
|
|
269 |
ERR_PRINTF3(_L("ERROR: GetGain value not equal to expected value (%d != %d)"), gain, expectedGain);
|
|
270 |
ret = EFail;
|
|
271 |
}
|
|
272 |
else
|
|
273 |
{
|
|
274 |
ret = EPass;
|
|
275 |
}
|
|
276 |
|
|
277 |
// stop the recording - only necessary if anyone wanted to look at the output file
|
|
278 |
aRecUtil->Stop();
|
|
279 |
|
|
280 |
return ret;
|
|
281 |
}
|
|
282 |
|
|
283 |
//------------------------------------------------------------------
|
|
284 |
|
|
285 |
CTestMmfAclntRecStateTran::CTestMmfAclntRecStateTran(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
286 |
:CTestMmfAclntRecord(aTestName, aSectName, aNegative)
|
|
287 |
{}
|
|
288 |
|
|
289 |
CTestMmfAclntRecStateTran* CTestMmfAclntRecStateTran::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
290 |
{
|
|
291 |
CTestMmfAclntRecStateTran* self = new (ELeave) CTestMmfAclntRecStateTran(aTestName, aSectName, aNegative);
|
|
292 |
return self;
|
|
293 |
}
|
|
294 |
|
|
295 |
TVerdict CTestMmfAclntRecStateTran::DoTestStepL()
|
|
296 |
{
|
|
297 |
INFO_PRINTF1( _L("TestRecorder : Transition"));
|
|
298 |
TVerdict ret = EFail;
|
|
299 |
|
|
300 |
iError = KErrTimedOut;
|
|
301 |
|
|
302 |
TPtrC filename;
|
|
303 |
|
|
304 |
|
|
305 |
if(!GetStringFromConfig(iSectName, _L("outputAudioFile"), filename))
|
|
306 |
{
|
|
307 |
return EInconclusive;
|
|
308 |
}
|
|
309 |
|
|
310 |
RFs fs;
|
|
311 |
fs.Connect();
|
|
312 |
fs.Delete(filename);
|
|
313 |
fs.Close();
|
|
314 |
|
|
315 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
316 |
CleanupStack::PushL(recUtil);
|
|
317 |
|
|
318 |
// Add create file for Ogg-tests
|
|
319 |
if(iSectName == _L("SectionOggRecState"))
|
|
320 |
{
|
|
321 |
RFs fs;
|
|
322 |
User::LeaveIfError(fs.Connect());
|
|
323 |
RFile file;
|
|
324 |
User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
|
|
325 |
file.Close();
|
|
326 |
fs.Close();
|
|
327 |
}
|
|
328 |
|
|
329 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility->OpenFileL(%S)"), &filename);
|
|
330 |
recUtil->OpenFileL(filename);
|
|
331 |
// wait
|
|
332 |
INFO_PRINTF1(_L("Initialise CMdaAudioRecorderUtility"));
|
|
333 |
CActiveScheduler::Start();
|
|
334 |
|
|
335 |
if(iError == KErrNone)
|
|
336 |
{
|
|
337 |
ret = DoTestL(recUtil);
|
|
338 |
}
|
|
339 |
|
|
340 |
|
|
341 |
CleanupStack::PopAndDestroy(recUtil);
|
|
342 |
User::After(KTwoSeconds);
|
|
343 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility completed with error %d"),iError );
|
|
344 |
return ret;
|
|
345 |
}
|
|
346 |
|
|
347 |
/**
|
|
348 |
* Enquire state at each state transition.
|
|
349 |
*/
|
|
350 |
TVerdict CTestMmfAclntRecStateTran::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
351 |
{
|
|
352 |
INFO_PRINTF1( _L("TestRecorder : State Transition"));
|
|
353 |
|
|
354 |
TVerdict ret= EFail;
|
|
355 |
|
|
356 |
iReportedState = aRecUtil->State();
|
|
357 |
if( iReportedState == CMdaAudioClipUtility::EOpen )
|
|
358 |
{
|
|
359 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
360 |
aRecUtil->RecordL();
|
|
361 |
CActiveScheduler::Start(); // wait for open -> record
|
|
362 |
if (iError != KErrNone)
|
|
363 |
{
|
|
364 |
return EFail;
|
|
365 |
}
|
|
366 |
|
|
367 |
iReportedState = aRecUtil->State();
|
|
368 |
if(iReportedState == CMdaAudioClipUtility::ERecording )
|
|
369 |
{
|
|
370 |
ret = EPass;
|
|
371 |
}
|
|
372 |
|
|
373 |
User::After(KTwoSeconds);
|
|
374 |
aRecUtil->Stop();
|
|
375 |
|
|
376 |
iReportedState = aRecUtil->State();
|
|
377 |
if(iReportedState != CMdaAudioClipUtility::EOpen )
|
|
378 |
{
|
|
379 |
return EFail;
|
|
380 |
}
|
|
381 |
|
|
382 |
aRecUtil->PlayL();
|
|
383 |
CActiveScheduler::Start(); // wait for open -> play
|
|
384 |
if (iError != KErrNone)
|
|
385 |
{
|
|
386 |
return EFail;
|
|
387 |
}
|
|
388 |
|
|
389 |
iReportedState = aRecUtil->State();
|
|
390 |
if( iReportedState == CMdaAudioClipUtility::EPlaying )
|
|
391 |
{
|
|
392 |
// Wait for play to complete
|
|
393 |
CActiveScheduler::Start();
|
|
394 |
if (iError != KErrNone)
|
|
395 |
{
|
|
396 |
return EFail;
|
|
397 |
}
|
|
398 |
|
|
399 |
//copy file
|
|
400 |
}
|
|
401 |
}
|
|
402 |
return ret;
|
|
403 |
}
|
|
404 |
|
|
405 |
//---------------------------------------------------------------------------------
|
|
406 |
|
|
407 |
CTestMmfFormatRead::CTestMmfFormatRead(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
408 |
:CTestMmfAclntRecord(aTestName, aSectName, aNegative)
|
|
409 |
{
|
|
410 |
}
|
|
411 |
|
|
412 |
CTestMmfFormatRead* CTestMmfFormatRead::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
413 |
{
|
|
414 |
CTestMmfFormatRead* self = new (ELeave) CTestMmfFormatRead(aTestName, aSectName, aNegative);
|
|
415 |
return self;
|
|
416 |
}
|
|
417 |
|
|
418 |
_LIT(KFileXyz, "\\AclntITestData\\Test.xyz");
|
|
419 |
_LIT(KFileAbc, "\\AclntITestData\\Test.abc");
|
|
420 |
|
|
421 |
TVerdict CTestMmfFormatRead::DoTestStepL()
|
|
422 |
{
|
|
423 |
INFO_PRINTF1( _L("CTestMmfFormatRead : Opening the test files"));
|
|
424 |
TVerdict ret = EPass;
|
|
425 |
|
|
426 |
INFO_PRINTF1( _L("Opening the test file test.xyz"));
|
|
427 |
|
|
428 |
TPtrC fileXyz(KFileXyz);
|
|
429 |
|
|
430 |
// File with extension .xyz does not have a plugin and hence opening this file should fail.
|
|
431 |
CMdaAudioRecorderUtility* recUtilXyz = CMdaAudioRecorderUtility::NewL(*this);
|
|
432 |
CleanupStack::PushL(recUtilXyz);
|
|
433 |
TRAP_IGNORE(recUtilXyz->OpenFileL(fileXyz));
|
|
434 |
CActiveScheduler::Start();
|
|
435 |
|
|
436 |
if (recUtilXyz->State() == CMdaAudioClipUtility::EOpen)
|
|
437 |
{
|
|
438 |
INFO_PRINTF1( _L("Opening the test file test.xyz failed"));
|
|
439 |
ret = EFail;
|
|
440 |
}
|
|
441 |
|
|
442 |
CleanupStack::PopAndDestroy(recUtilXyz);
|
|
443 |
|
|
444 |
INFO_PRINTF1( _L("Opening the test file test.abc"));
|
|
445 |
TPtrC fileAbc(KFileAbc);
|
|
446 |
|
|
447 |
// File with extension .abc does have a plugin and hence opening this file should pass.
|
|
448 |
CMdaAudioRecorderUtility* recUtilAbc = CMdaAudioRecorderUtility::NewL(*this);
|
|
449 |
CleanupStack::PushL(recUtilAbc);
|
|
450 |
TRAP_IGNORE(recUtilAbc->OpenFileL(fileAbc));
|
|
451 |
CActiveScheduler::Start();
|
|
452 |
|
|
453 |
if (recUtilAbc->State() != CMdaAudioClipUtility::EOpen)
|
|
454 |
{
|
|
455 |
INFO_PRINTF1( _L("Opening the test file test.abc failed"));
|
|
456 |
ret = EFail;
|
|
457 |
}
|
|
458 |
|
|
459 |
CleanupStack::PopAndDestroy(recUtilAbc);
|
|
460 |
|
|
461 |
return ret;
|
|
462 |
}
|
|
463 |
|
|
464 |
/**
|
|
465 |
* Enquire state at each state transition.
|
|
466 |
*/
|
|
467 |
|
|
468 |
TVerdict CTestMmfFormatRead::DoTestL(CMdaAudioRecorderUtility* /*aRecUtil*/)
|
|
469 |
{
|
|
470 |
INFO_PRINTF1( _L("CTestMmfFormatRead::DoTestL"));
|
|
471 |
return (TVerdict(EPass));
|
|
472 |
}
|
|
473 |
|
|
474 |
//------------------------------------------------------------------
|
|
475 |
|
|
476 |
/**
|
|
477 |
* Constructor
|
|
478 |
*/
|
|
479 |
CTestMmfAclntCrop::CTestMmfAclntCrop(const TDesC& aTestName, const TDesC& aSectName, const TBool aCropToEnd, TBool aNegative)
|
|
480 |
:CTestMmfAclntRecord(aTestName, aSectName, aNegative)
|
|
481 |
{
|
|
482 |
iCropToEnd = aCropToEnd;
|
|
483 |
}
|
|
484 |
|
|
485 |
CTestMmfAclntCrop* CTestMmfAclntCrop::NewL(const TDesC& aTestName, const TDesC& aSectName, const TBool aCropToEnd, TBool aNegative)
|
|
486 |
{
|
|
487 |
CTestMmfAclntCrop* self = new (ELeave) CTestMmfAclntCrop(aTestName, aSectName, aCropToEnd, aNegative);
|
|
488 |
return self;
|
|
489 |
}
|
|
490 |
|
|
491 |
|
|
492 |
|
|
493 |
/**
|
|
494 |
* Audio croping.
|
|
495 |
*/
|
|
496 |
TVerdict CTestMmfAclntCrop::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
497 |
{
|
|
498 |
TTimeIntervalMicroSeconds expectedDuration(KPcm16FrameInterval * 5), duration;
|
|
499 |
|
|
500 |
duration = aRecUtil->Duration();
|
|
501 |
INFO_PRINTF3(_L("Duration of Original file, expected = %f, actual: %f"),
|
|
502 |
I64REAL(expectedDuration.Int64()), I64REAL(duration.Int64()));
|
|
503 |
|
|
504 |
if(expectedDuration == duration)
|
|
505 |
{
|
|
506 |
return EInconclusive;
|
|
507 |
}
|
|
508 |
|
|
509 |
if(duration > expectedDuration)
|
|
510 |
{
|
|
511 |
aRecUtil->SetPosition(expectedDuration);
|
|
512 |
|
|
513 |
if(iCropToEnd)
|
|
514 |
{
|
|
515 |
TRAP(iError, aRecUtil->CropL());
|
|
516 |
}
|
|
517 |
else
|
|
518 |
{
|
|
519 |
TRAP(iError, aRecUtil->CropFromBeginningL());
|
|
520 |
}
|
|
521 |
if(iError != KErrNone)
|
|
522 |
{
|
|
523 |
ERR_PRINTF2(_L("Crop left with error = %d"),iError);
|
|
524 |
return EFail;
|
|
525 |
}
|
|
526 |
if(iCropToEnd)
|
|
527 |
{
|
|
528 |
TTimeIntervalMicroSeconds actualDuration = aRecUtil->Duration();
|
|
529 |
if (TimeComparison(I64INT(actualDuration.Int64()), I64INT(expectedDuration.Int64()), KExpectedDurationDeviation))
|
|
530 |
{
|
|
531 |
INFO_PRINTF1(_L("Duration within expected deviation"));
|
|
532 |
return EPass;
|
|
533 |
}
|
|
534 |
else
|
|
535 |
{
|
|
536 |
ERR_PRINTF3(_L("Duration cropped file, expected = %f, actual: %f"),
|
|
537 |
I64REAL(expectedDuration.Int64()), I64REAL(actualDuration.Int64()));
|
|
538 |
}
|
|
539 |
}
|
|
540 |
if(!iCropToEnd)
|
|
541 |
{
|
|
542 |
TInt64 theDelta = duration.Int64() - expectedDuration.Int64();
|
|
543 |
|
|
544 |
TTimeIntervalMicroSeconds actualDuration = aRecUtil->Duration();
|
|
545 |
if (TimeComparison(I64INT(actualDuration.Int64()), I64INT(theDelta), KExpectedDurationDeviation))
|
|
546 |
{
|
|
547 |
INFO_PRINTF1(_L("Duration within expected deviation"));
|
|
548 |
return EPass;
|
|
549 |
}
|
|
550 |
else
|
|
551 |
{
|
|
552 |
ERR_PRINTF3(_L("Duration cropped file, expected = %f, actual: %f"),
|
|
553 |
I64REAL(theDelta),
|
|
554 |
I64REAL(aRecUtil->Duration().Int64()));
|
|
555 |
}
|
|
556 |
}
|
|
557 |
}
|
|
558 |
return EFail ;
|
|
559 |
}
|
|
560 |
|
|
561 |
|
|
562 |
//------------------------------------------------------------------
|
|
563 |
|
|
564 |
CTestMmfAclntRecCloseOpen::CTestMmfAclntRecCloseOpen(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
565 |
:CTestMmfAclntRecord(aTestName, aSectName, aNegative)
|
|
566 |
{
|
|
567 |
}
|
|
568 |
|
|
569 |
CTestMmfAclntRecCloseOpen* CTestMmfAclntRecCloseOpen::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
570 |
{
|
|
571 |
CTestMmfAclntRecCloseOpen* self = new (ELeave) CTestMmfAclntRecCloseOpen(aTestName, aSectName, aNegative);
|
|
572 |
return self;
|
|
573 |
}
|
|
574 |
|
|
575 |
TVerdict CTestMmfAclntRecCloseOpen::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
576 |
/**
|
|
577 |
* Open, Close and open a new audio clip.
|
|
578 |
*/
|
|
579 |
{
|
|
580 |
INFO_PRINTF1( _L("TestRecorder : Close/Open"));
|
|
581 |
|
|
582 |
TBuf<KSizeBuf> filename;
|
|
583 |
TPtrC filename1;
|
|
584 |
|
|
585 |
if(!GetStringFromConfig(iSectName, _L("playerAudioFile"), filename1))
|
|
586 |
{
|
|
587 |
return EInconclusive;
|
|
588 |
}
|
|
589 |
|
|
590 |
GetDriveName(filename);
|
|
591 |
filename.Append(filename1);
|
|
592 |
|
|
593 |
iError = KErrTimedOut;
|
|
594 |
|
|
595 |
|
|
596 |
aRecUtil->Close();
|
|
597 |
aRecUtil->OpenFileL(filename);
|
|
598 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
599 |
//wait
|
|
600 |
CActiveScheduler::Start();
|
|
601 |
if(iError == KErrNone)
|
|
602 |
{
|
|
603 |
return EPass;
|
|
604 |
}
|
|
605 |
|
|
606 |
return EFail ;
|
|
607 |
}
|
|
608 |
|
|
609 |
|
|
610 |
//------------------------------------------------------------------
|
|
611 |
|
|
612 |
/**
|
|
613 |
* Constructor
|
|
614 |
*/
|
|
615 |
CTestMmfAclntRecFile::CTestMmfAclntRecFile(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat, const TBool aCreateFile)
|
|
616 |
|
|
617 |
{
|
|
618 |
iTestStepName = aTestName;
|
|
619 |
iHeapSize = 200000; // playback part of test loads whole sound file into buffer, so need large heap
|
|
620 |
iSectName = aSectName;
|
|
621 |
iKeyName = aKeyName;
|
|
622 |
iTestFormat = aFormat;
|
|
623 |
iCreateFile = aCreateFile;
|
|
624 |
}
|
|
625 |
|
|
626 |
CTestMmfAclntRecFile* CTestMmfAclntRecFile::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat, const TBool aCreateFile)
|
|
627 |
{
|
|
628 |
CTestMmfAclntRecFile* self = new (ELeave) CTestMmfAclntRecFile(aTestName,aSectName,aKeyName,aFormat,aCreateFile);
|
|
629 |
return self;
|
|
630 |
}
|
|
631 |
|
|
632 |
CTestMmfAclntRecFile* CTestMmfAclntRecFile::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat, const TBool aCreateFile)
|
|
633 |
{
|
|
634 |
CTestMmfAclntRecFile* self = CTestMmfAclntRecFile::NewLC(aTestName,aSectName,aKeyName,aFormat,aCreateFile);
|
|
635 |
CleanupStack::PushL(self);
|
|
636 |
return self;
|
|
637 |
}
|
|
638 |
|
|
639 |
void CTestMmfAclntRecFile::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt aCurrentState, TInt aErrorCode)
|
|
640 |
{
|
|
641 |
iError = aErrorCode;
|
|
642 |
INFO_PRINTF1( _L("CTestMmfAclntRecFile : MMdaObjectStateChangeObserver Callback for CMdaAudioRecorderUtility complete"));
|
|
643 |
INFO_PRINTF2( _L("iError %d "), iError);
|
|
644 |
|
|
645 |
if(aCurrentState == CMdaAudioClipUtility::ERecording)
|
|
646 |
{
|
|
647 |
User::After(KFiveSeconds);
|
|
648 |
}
|
|
649 |
CActiveScheduler::Stop();
|
|
650 |
}
|
|
651 |
|
|
652 |
// Audio utility callbacks
|
|
653 |
void CTestMmfAclntRecFile::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)
|
|
654 |
{
|
|
655 |
iError = aError;
|
|
656 |
CActiveScheduler::Stop();
|
|
657 |
}
|
|
658 |
|
|
659 |
void CTestMmfAclntRecFile::MapcPlayComplete(TInt aError)
|
|
660 |
{
|
|
661 |
iError = aError;
|
|
662 |
CActiveScheduler::Stop();
|
|
663 |
}
|
|
664 |
|
|
665 |
// Audio output stream callbacks
|
|
666 |
void CTestMmfAclntRecFile::MaoscOpenComplete(TInt aError)
|
|
667 |
{
|
|
668 |
iError = aError;
|
|
669 |
CActiveScheduler::Stop();
|
|
670 |
}
|
|
671 |
|
|
672 |
void CTestMmfAclntRecFile::MaoscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/)
|
|
673 |
{
|
|
674 |
iError = aError;
|
|
675 |
CActiveScheduler::Stop();
|
|
676 |
}
|
|
677 |
|
|
678 |
void CTestMmfAclntRecFile::MaoscPlayComplete(TInt aError)
|
|
679 |
{
|
|
680 |
iError = aError;
|
|
681 |
CActiveScheduler::Stop();
|
|
682 |
}
|
|
683 |
|
|
684 |
|
|
685 |
TVerdict CTestMmfAclntRecFile::DoTestStepPreambleL()
|
|
686 |
{
|
|
687 |
TVerdict ret = EPass;
|
|
688 |
|
|
689 |
SetupFormatL(iTestFormat);
|
|
690 |
|
|
691 |
if(iCreateFile)
|
|
692 |
{
|
|
693 |
// Make sure file doesn't exist (maybe from a previous test)
|
|
694 |
TParse fullFileName;
|
|
695 |
TBuf<KSizeBuf> filename;
|
|
696 |
TPtrC filename1;
|
|
697 |
|
|
698 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
699 |
{
|
|
700 |
return EInconclusive;
|
|
701 |
}
|
|
702 |
|
|
703 |
GetDriveName(filename);
|
|
704 |
filename.Append(filename1);
|
|
705 |
|
|
706 |
|
|
707 |
// parse the filenames
|
|
708 |
if(!fullFileName.Set(filename, &KDefault, NULL))
|
|
709 |
{
|
|
710 |
RFs fs;
|
|
711 |
User::LeaveIfError(fs.Connect());
|
|
712 |
fs.SetAtt(fullFileName.FullName(), 0, KEntryAttReadOnly);
|
|
713 |
TInt error = fs.Delete(fullFileName.FullName());
|
|
714 |
|
|
715 |
if(error == KErrPathNotFound)
|
|
716 |
{
|
|
717 |
error = fs.MkDirAll(fullFileName.DriveAndPath());
|
|
718 |
INFO_PRINTF2(_L("Path for file %S was been created"), &fullFileName.FullName());
|
|
719 |
}
|
|
720 |
else if(error == KErrNotFound)
|
|
721 |
INFO_PRINTF2(_L("No need to delete %S"), &fullFileName.FullName());
|
|
722 |
else if(error==KErrNone)
|
|
723 |
INFO_PRINTF2(_L("Deleted %S"), &fullFileName.FullName());
|
|
724 |
else
|
|
725 |
{
|
|
726 |
ret = EInconclusive;
|
|
727 |
}
|
|
728 |
fs.Close();
|
|
729 |
}
|
|
730 |
|
|
731 |
}
|
|
732 |
|
|
733 |
if((ret == EInconclusive) || (ret == EFail))
|
|
734 |
{
|
|
735 |
return ret;
|
|
736 |
}
|
|
737 |
|
|
738 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
|
739 |
}
|
|
740 |
|
|
741 |
/**
|
|
742 |
* Open a file based clip and record
|
|
743 |
*/
|
|
744 |
TVerdict CTestMmfAclntRecFile::DoTestStepL()
|
|
745 |
{
|
|
746 |
INFO_PRINTF1( _L("TestRecorder : Record File"));
|
|
747 |
TVerdict ret = EFail;
|
|
748 |
iError = KErrTimedOut;
|
|
749 |
|
|
750 |
TPtrC filename;
|
|
751 |
if(!GetStringFromConfig(iSectName, iKeyName, filename))
|
|
752 |
{
|
|
753 |
return EInconclusive;
|
|
754 |
}
|
|
755 |
|
|
756 |
|
|
757 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
758 |
CleanupStack::PushL(recUtil);
|
|
759 |
|
|
760 |
TMdaFileClipLocation location(filename);
|
|
761 |
|
|
762 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility->OpenFileL(%S)"), &filename);
|
|
763 |
if(!iCreateFile)
|
|
764 |
{
|
|
765 |
if(iSectName == _L("SectionOggRec")) // - Added to use OpenFileL only as OpenL parameters are deprected.
|
|
766 |
{
|
|
767 |
TPtrC filename2;
|
|
768 |
|
|
769 |
if(!GetStringFromConfig(iSectName, _L("playerAudioFile"), filename2))
|
|
770 |
{
|
|
771 |
return EInconclusive;
|
|
772 |
}
|
|
773 |
|
|
774 |
CopyFile(filename2, filename);
|
|
775 |
}
|
|
776 |
recUtil->OpenFileL(filename);
|
|
777 |
}
|
|
778 |
else
|
|
779 |
{
|
|
780 |
RFs fs;
|
|
781 |
fs.Connect();
|
|
782 |
fs.Delete(filename);
|
|
783 |
fs.Close();
|
|
784 |
if(iSectName == _L("SectionOggRec")) // - Added to use OpenFileL only as OpenL parameters are deprected.
|
|
785 |
{
|
|
786 |
recUtil->OpenFileL(filename); // - Should create the file internally
|
|
787 |
}
|
|
788 |
else
|
|
789 |
{
|
|
790 |
recUtil->OpenL(&location,iFormat,iCodec,&iAudioSettings);
|
|
791 |
}
|
|
792 |
}
|
|
793 |
|
|
794 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
795 |
CActiveScheduler::Start();
|
|
796 |
|
|
797 |
if(iError == KErrNone)
|
|
798 |
{
|
|
799 |
iError = KErrTimedOut;
|
|
800 |
recUtil->RecordL();
|
|
801 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
802 |
CActiveScheduler::Start(); // open -> record
|
|
803 |
|
|
804 |
recUtil->Stop();
|
|
805 |
}
|
|
806 |
|
|
807 |
|
|
808 |
CleanupStack::PopAndDestroy(recUtil);
|
|
809 |
recUtil = NULL;
|
|
810 |
|
|
811 |
// Playback the file
|
|
812 |
if (iError == KErrNone)
|
|
813 |
{
|
|
814 |
if (filename.Right(4).Compare(_L(".raw"))==0)
|
|
815 |
{
|
|
816 |
// Raw file playback
|
|
817 |
CMdaAudioOutputStream* outputStream = CMdaAudioOutputStream::NewL(*this);
|
|
818 |
CleanupStack::PushL(outputStream);
|
|
819 |
|
|
820 |
outputStream->Open(NULL);
|
|
821 |
CActiveScheduler::Start();
|
|
822 |
if (iError != KErrNone)
|
|
823 |
{
|
|
824 |
INFO_PRINTF2(_L("Error opening output stream for playback = %d"), iError);
|
|
825 |
CleanupStack::PopAndDestroy(outputStream);
|
|
826 |
return EFail;
|
|
827 |
}
|
|
828 |
|
|
829 |
// Connect file session
|
|
830 |
RFs fs;
|
|
831 |
TInt err = fs.Connect();
|
|
832 |
if (err != KErrNone)
|
|
833 |
{
|
|
834 |
INFO_PRINTF2(_L("Error connecting to file session = %d"), err);
|
|
835 |
return EFail;
|
|
836 |
}
|
|
837 |
CleanupClosePushL(fs);
|
|
838 |
|
|
839 |
// Open file
|
|
840 |
RFile file;
|
|
841 |
err = file.Open(fs, filename, EFileRead);
|
|
842 |
if (err != KErrNone)
|
|
843 |
{
|
|
844 |
INFO_PRINTF2(_L("Error opening file = %d"), err);
|
|
845 |
CleanupStack::PopAndDestroy(2, outputStream); // fs, outputStream
|
|
846 |
return EFail;
|
|
847 |
}
|
|
848 |
CleanupClosePushL(file);
|
|
849 |
|
|
850 |
// Get size of file
|
|
851 |
TInt fileSize = 0;
|
|
852 |
err = file.Size(fileSize);
|
|
853 |
if (err != KErrNone)
|
|
854 |
{
|
|
855 |
INFO_PRINTF2(_L("Error getting size of file = %d"), err);
|
|
856 |
CleanupStack::PopAndDestroy(3, outputStream); // file, fs, outputStream
|
|
857 |
return EFail;
|
|
858 |
}
|
|
859 |
|
|
860 |
// Read file
|
|
861 |
HBufC8* buf = HBufC8::NewLC(fileSize);
|
|
862 |
TPtr8 ptr(buf->Des());
|
|
863 |
err = file.Read(ptr);
|
|
864 |
if (err != KErrNone)
|
|
865 |
{
|
|
866 |
INFO_PRINTF2(_L("Error reading file %d"), err);
|
|
867 |
}
|
|
868 |
else
|
|
869 |
{
|
|
870 |
outputStream->WriteL(ptr);
|
|
871 |
CActiveScheduler::Start();
|
|
872 |
if (iError != KErrNone)
|
|
873 |
INFO_PRINTF2(_L("Error writing file on audio output stream %d"), iError);
|
|
874 |
}
|
|
875 |
|
|
876 |
CleanupStack::PopAndDestroy(4, outputStream); // buf, file, fs, outputStream
|
|
877 |
}
|
|
878 |
else
|
|
879 |
{
|
|
880 |
// Wav file playback
|
|
881 |
CMdaAudioPlayerUtility* playUtil = CMdaAudioPlayerUtility::NewL(*this);
|
|
882 |
CleanupStack::PushL(playUtil);
|
|
883 |
TRAPD(err, playUtil->OpenFileL(filename));
|
|
884 |
if (err != KErrNone)
|
|
885 |
{
|
|
886 |
INFO_PRINTF2(_L("Error opening file for playback err = %d"), err);
|
|
887 |
CleanupStack::PopAndDestroy(playUtil);
|
|
888 |
return EFail;
|
|
889 |
}
|
|
890 |
CActiveScheduler::Start();
|
|
891 |
if (iError != KErrNone)
|
|
892 |
{
|
|
893 |
INFO_PRINTF2(_L("Error opening file for playback iError = %d"), iError);
|
|
894 |
CleanupStack::PopAndDestroy(playUtil);
|
|
895 |
return EFail;
|
|
896 |
}
|
|
897 |
playUtil->Play();
|
|
898 |
CActiveScheduler::Start();
|
|
899 |
CleanupStack::PopAndDestroy(playUtil);
|
|
900 |
if (iError != KErrNone)
|
|
901 |
{
|
|
902 |
INFO_PRINTF2(_L("Error during playback of recorded file iError=%d"), iError);
|
|
903 |
return EFail;
|
|
904 |
}
|
|
905 |
}
|
|
906 |
}
|
|
907 |
// DEF127335
|
|
908 |
// OggRecordController does not support recording into an already existing file.
|
|
909 |
// This is due to unavailability of APIs at the level of Ogg Vorbis C libraries.
|
|
910 |
else if (iTestStepName == _L("MM-MMF-ACLNTOGG-I-0102-CP") && iError == KErrNotSupported)
|
|
911 |
{
|
|
912 |
INFO_PRINTF1(_L("Expected Result: OggRecordController returned KErrNotSupported(-5)"));
|
|
913 |
return EPass;
|
|
914 |
}
|
|
915 |
|
|
916 |
if( iError == KErrNone )
|
|
917 |
{
|
|
918 |
RFs fs;
|
|
919 |
RFile file;
|
|
920 |
TInt size = 0;
|
|
921 |
User::LeaveIfError(fs.Connect());
|
|
922 |
User::LeaveIfError(file.Open(fs,filename,EFileRead));
|
|
923 |
CleanupClosePushL(file);
|
|
924 |
User::LeaveIfError(file.Size(size));
|
|
925 |
|
|
926 |
if(size > 0)
|
|
927 |
{
|
|
928 |
ret = EPass;
|
|
929 |
}
|
|
930 |
|
|
931 |
CleanupStack::PopAndDestroy(); //file
|
|
932 |
}
|
|
933 |
|
|
934 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility completed with error %d"),iError );
|
|
935 |
User::After(KOneSecond);
|
|
936 |
return ret;
|
|
937 |
}
|
|
938 |
|
|
939 |
|
|
940 |
|
|
941 |
//------------------------------------------------------------------
|
|
942 |
|
|
943 |
/**
|
|
944 |
* Constructor
|
|
945 |
*/
|
|
946 |
CTestMmfAclntRecFileForceFormat::CTestMmfAclntRecFileForceFormat(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
947 |
{
|
|
948 |
// store the name of this test case
|
|
949 |
// this is the name that is used by the script file
|
|
950 |
// Each test step initialises it's own name
|
|
951 |
iTestStepName = aTestName;
|
|
952 |
iSectName = aSectName;
|
|
953 |
iKeyName = aKeyName;
|
|
954 |
iFormat = aFormat;
|
|
955 |
}
|
|
956 |
|
|
957 |
CTestMmfAclntRecFileForceFormat* CTestMmfAclntRecFileForceFormat::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
958 |
{
|
|
959 |
CTestMmfAclntRecFileForceFormat* self = new (ELeave) CTestMmfAclntRecFileForceFormat(aTestName,aSectName,aKeyName,aFormat);
|
|
960 |
return self;
|
|
961 |
}
|
|
962 |
|
|
963 |
CTestMmfAclntRecFileForceFormat* CTestMmfAclntRecFileForceFormat::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
964 |
{
|
|
965 |
CTestMmfAclntRecFileForceFormat* self = CTestMmfAclntRecFileForceFormat::NewLC(aTestName,aSectName,aKeyName,aFormat);
|
|
966 |
CleanupStack::PushL(self);
|
|
967 |
return self;
|
|
968 |
}
|
|
969 |
|
|
970 |
void CTestMmfAclntRecFileForceFormat::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt aCurrentState, TInt aErrorCode)
|
|
971 |
{
|
|
972 |
iError = aErrorCode;
|
|
973 |
INFO_PRINTF1( _L("CTestMmfAclntRecFile : MMdaObjectStateChangeObserver Callback for CMdaAudioRecorderUtility complete"));
|
|
974 |
INFO_PRINTF2( _L("iError %d "), iError);
|
|
975 |
|
|
976 |
//dont stop the playing track
|
|
977 |
if (aCurrentState != CMdaAudioClipUtility::EPlaying || iError != KErrNone)
|
|
978 |
{
|
|
979 |
CActiveScheduler::Stop();
|
|
980 |
}
|
|
981 |
}
|
|
982 |
|
|
983 |
|
|
984 |
TVerdict CTestMmfAclntRecFileForceFormat::DoTestStepPreambleL()
|
|
985 |
{
|
|
986 |
TVerdict ret = EPass;
|
|
987 |
|
|
988 |
// Make sure file doesn't exist (maybe from a previous test)
|
|
989 |
TParse fullFileName;
|
|
990 |
TBuf<KSizeBuf> filename;
|
|
991 |
TPtrC filename1;
|
|
992 |
|
|
993 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
994 |
{
|
|
995 |
return EInconclusive;
|
|
996 |
}
|
|
997 |
|
|
998 |
|
|
999 |
GetDriveName(filename);
|
|
1000 |
filename.Append(filename1);
|
|
1001 |
|
|
1002 |
|
|
1003 |
// parse the filenames
|
|
1004 |
if(!fullFileName.Set(filename, &KDefault, NULL))
|
|
1005 |
{
|
|
1006 |
RFs fs;
|
|
1007 |
User::LeaveIfError(fs.Connect());
|
|
1008 |
fs.SetAtt(fullFileName.FullName(), 0, KEntryAttReadOnly);
|
|
1009 |
TInt error = fs.Delete(fullFileName.FullName());
|
|
1010 |
|
|
1011 |
if(error == KErrPathNotFound)
|
|
1012 |
{
|
|
1013 |
error = fs.MkDirAll(fullFileName.DriveAndPath());
|
|
1014 |
INFO_PRINTF2(_L("Path for file %S was been created"), &fullFileName.FullName());
|
|
1015 |
}
|
|
1016 |
else if(error == KErrNotFound)
|
|
1017 |
INFO_PRINTF2(_L("No need to delete %S"), &fullFileName.FullName());
|
|
1018 |
else if(error==KErrNone)
|
|
1019 |
INFO_PRINTF2(_L("Deleted %S"), &fullFileName.FullName());
|
|
1020 |
else
|
|
1021 |
{
|
|
1022 |
ret = EInconclusive;
|
|
1023 |
}
|
|
1024 |
fs.Close();
|
|
1025 |
}
|
|
1026 |
|
|
1027 |
if((ret == EInconclusive) || (ret == EFail))
|
|
1028 |
{
|
|
1029 |
return ret;
|
|
1030 |
}
|
|
1031 |
|
|
1032 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
|
1033 |
}
|
|
1034 |
|
|
1035 |
/**
|
|
1036 |
* Open a file based clip and record
|
|
1037 |
*/
|
|
1038 |
|
|
1039 |
|
|
1040 |
TVerdict CTestMmfAclntRecFileForceFormat::DoTestStepL()
|
|
1041 |
{
|
|
1042 |
INFO_PRINTF1( _L("TestRecorder : Record File"));
|
|
1043 |
TVerdict ret = EFail;
|
|
1044 |
iError = KErrTimedOut;
|
|
1045 |
|
|
1046 |
TPtrC filename;
|
|
1047 |
if(!GetStringFromConfig(iSectName, iKeyName, filename))
|
|
1048 |
{
|
|
1049 |
return EInconclusive;
|
|
1050 |
}
|
|
1051 |
|
|
1052 |
|
|
1053 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
1054 |
CleanupStack::PushL(recUtil);
|
|
1055 |
|
|
1056 |
TMdaFileClipLocation location(filename);
|
|
1057 |
|
|
1058 |
RFs fs;
|
|
1059 |
fs.Connect();
|
|
1060 |
fs.Delete(filename);
|
|
1061 |
fs.Close();
|
|
1062 |
|
|
1063 |
recUtil->OpenL(&location,&iFormat);
|
|
1064 |
|
|
1065 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
1066 |
CActiveScheduler::Start();
|
|
1067 |
|
|
1068 |
if(iError == KErrNone)
|
|
1069 |
{
|
|
1070 |
iError = KErrTimedOut;
|
|
1071 |
recUtil->RecordL();
|
|
1072 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
1073 |
CActiveScheduler::Start(); // open -> record
|
|
1074 |
|
|
1075 |
User::After(KTwoSeconds);
|
|
1076 |
recUtil->Stop();
|
|
1077 |
|
|
1078 |
//now try to play the file as a check that it recorded correctly
|
|
1079 |
recUtil->PlayL();
|
|
1080 |
CActiveScheduler::Start();
|
|
1081 |
|
|
1082 |
recUtil->Close();
|
|
1083 |
|
|
1084 |
|
|
1085 |
if(iError == KErrNone)
|
|
1086 |
{
|
|
1087 |
RFs fs;
|
|
1088 |
RFile file;
|
|
1089 |
TInt size = 0;
|
|
1090 |
|
|
1091 |
User::LeaveIfError(fs.Connect());
|
|
1092 |
User::LeaveIfError(file.Open(fs,filename,EFileRead));
|
|
1093 |
CleanupClosePushL(file);
|
|
1094 |
User::LeaveIfError(file.Size(size));
|
|
1095 |
|
|
1096 |
if(size > 0)
|
|
1097 |
{
|
|
1098 |
ret = EPass;
|
|
1099 |
}
|
|
1100 |
|
|
1101 |
CleanupStack::PopAndDestroy(); //file
|
|
1102 |
}
|
|
1103 |
}
|
|
1104 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility completed with error %d"),iError );
|
|
1105 |
CleanupStack::PopAndDestroy(recUtil);
|
|
1106 |
User::After(KOneSecond);
|
|
1107 |
return ret;
|
|
1108 |
}
|
|
1109 |
|
|
1110 |
|
|
1111 |
//------------------------------------------------------------------
|
|
1112 |
|
|
1113 |
/**
|
|
1114 |
* Constructor
|
|
1115 |
*/
|
|
1116 |
CTestMmfAclntRecDes::CTestMmfAclntRecDes(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat, const TBool aCreateDes):
|
|
1117 |
iAudioPtr(NULL,0,0)
|
|
1118 |
{
|
|
1119 |
// store the name of this test case
|
|
1120 |
// this is the name that is used by the script file
|
|
1121 |
// Each test step initialises it's own name
|
|
1122 |
iTestStepName = aTestName;
|
|
1123 |
iSectName = aSectName;
|
|
1124 |
iKeyName = aKeyName;
|
|
1125 |
iTestFormat = aFormat;
|
|
1126 |
iCreateDes = aCreateDes;
|
|
1127 |
iSize = 0;
|
|
1128 |
iAudio = NULL;
|
|
1129 |
iHeapSize = 100000;
|
|
1130 |
}
|
|
1131 |
|
|
1132 |
CTestMmfAclntRecDes* CTestMmfAclntRecDes::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat,const TBool aCreateDes)
|
|
1133 |
{
|
|
1134 |
CTestMmfAclntRecDes* self = new (ELeave) CTestMmfAclntRecDes(aTestName,aSectName,aKeyName,aFormat,aCreateDes);
|
|
1135 |
return self;
|
|
1136 |
}
|
|
1137 |
|
|
1138 |
CTestMmfAclntRecDes* CTestMmfAclntRecDes::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat, const TBool aCreateDes)
|
|
1139 |
{
|
|
1140 |
CTestMmfAclntRecDes* self = CTestMmfAclntRecDes::NewLC(aTestName,aSectName,aKeyName,aFormat,aCreateDes);
|
|
1141 |
CleanupStack::PushL(self);
|
|
1142 |
return self;
|
|
1143 |
}
|
|
1144 |
|
|
1145 |
void CTestMmfAclntRecDes::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
|
|
1146 |
{
|
|
1147 |
iError = aErrorCode;
|
|
1148 |
INFO_PRINTF4( _L("MMdaObjectStateChangeObserver: previous state: %d current state: %d error: %d"),aPreviousState, aCurrentState, aErrorCode);
|
|
1149 |
CActiveScheduler::Stop();
|
|
1150 |
}
|
|
1151 |
|
|
1152 |
TVerdict CTestMmfAclntRecDes::DoTestStepPreambleL()
|
|
1153 |
{
|
|
1154 |
SetupFormatL(iTestFormat);
|
|
1155 |
|
|
1156 |
switch (iTestFormat)
|
|
1157 |
{
|
|
1158 |
case EPcm16Wav:
|
|
1159 |
case EAlawWav:
|
|
1160 |
case EPcm8:
|
|
1161 |
iHeaderSize = KWavFileUncompressedDataHeaderSize; //(see mmfwavformat.cpp, CreateSinkBufferOfSizeL())
|
|
1162 |
iFrameSize = 4096;
|
|
1163 |
break;
|
|
1164 |
case EImaAdpcmWav:
|
|
1165 |
case EImasPcmWav:
|
|
1166 |
iHeaderSize = KWavFileCompressedDataHeaderSize + KImaAdpcmFactChunkSize;
|
|
1167 |
iFrameSize = 4096;
|
|
1168 |
break;
|
|
1169 |
case EMulawRaw:
|
|
1170 |
case EPcmU8:
|
|
1171 |
case EPcmU16:
|
|
1172 |
iHeaderSize = 0;
|
|
1173 |
iFrameSize = 4096;
|
|
1174 |
break;
|
|
1175 |
case EGsmWav:
|
|
1176 |
iHeaderSize = KWavFileCompressedDataHeaderSize + KGSMFactChunkSize;
|
|
1177 |
iFrameSize = 4095;
|
|
1178 |
break;
|
|
1179 |
default:
|
|
1180 |
/*skip*/ ;
|
|
1181 |
}
|
|
1182 |
|
|
1183 |
if(!iCreateDes)
|
|
1184 |
{
|
|
1185 |
RFs fs;
|
|
1186 |
RFile file;
|
|
1187 |
|
|
1188 |
TBuf<KSizeBuf> filename;
|
|
1189 |
TPtrC filename1;
|
|
1190 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
1191 |
{
|
|
1192 |
return EInconclusive;
|
|
1193 |
}
|
|
1194 |
|
|
1195 |
GetDriveName(filename);
|
|
1196 |
filename.Append(filename1);
|
|
1197 |
INFO_PRINTF2(_L("File for test - %S"), &filename);
|
|
1198 |
|
|
1199 |
User::LeaveIfError(fs.Connect());
|
|
1200 |
User::LeaveIfError(file.Open(fs,filename,EFileRead));
|
|
1201 |
CleanupClosePushL(file);
|
|
1202 |
|
|
1203 |
User::LeaveIfError(file.Size(iSize));
|
|
1204 |
INFO_PRINTF2(_L("size of file = %d\n"),iSize);//Statement Changed under DEF105143
|
|
1205 |
iAudio = HBufC8::NewMaxL(iSize);
|
|
1206 |
|
|
1207 |
// Read a file into a descriptor
|
|
1208 |
iAudioPtr.Set(iAudio->Des());
|
|
1209 |
User::LeaveIfError(file.Read(iAudioPtr));
|
|
1210 |
|
|
1211 |
CleanupStack::PopAndDestroy(); //file
|
|
1212 |
}
|
|
1213 |
else
|
|
1214 |
{
|
|
1215 |
INFO_PRINTF1(_L("Recording to New Descriptor for test"));
|
|
1216 |
iSize = KRecSize; // value is not been set yet.
|
|
1217 |
iAudio = HBufC8::NewMaxL(iSize);
|
|
1218 |
iAudioPtr.Set(iAudio->Des());
|
|
1219 |
iAudioPtr.SetLength(0);
|
|
1220 |
}
|
|
1221 |
|
|
1222 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
|
1223 |
}
|
|
1224 |
|
|
1225 |
TVerdict CTestMmfAclntRecDes::DoTestStepPostambleL()
|
|
1226 |
{
|
|
1227 |
delete iAudio;
|
|
1228 |
return CTestMmfAclntCodecTest::DoTestStepPostambleL();
|
|
1229 |
}
|
|
1230 |
|
|
1231 |
/**
|
|
1232 |
* Open a descriptor and record
|
|
1233 |
*/
|
|
1234 |
TVerdict CTestMmfAclntRecDes::DoTestStepL( void )
|
|
1235 |
{
|
|
1236 |
INFO_PRINTF1( _L("TestRecorder : Record Des"));
|
|
1237 |
TVerdict ret = EFail;
|
|
1238 |
TMdaDesClipLocation* location = NULL;
|
|
1239 |
|
|
1240 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
1241 |
CleanupStack::PushL(recUtil);
|
|
1242 |
|
|
1243 |
if(!iCreateDes)
|
|
1244 |
{
|
|
1245 |
recUtil->OpenDesL(iAudioPtr);
|
|
1246 |
}
|
|
1247 |
else
|
|
1248 |
{
|
|
1249 |
location = new (ELeave) TMdaDesClipLocation(iAudioPtr);
|
|
1250 |
CleanupStack::PushL(location);
|
|
1251 |
recUtil->OpenL(location,iFormat,iCodec,&iAudioSettings);
|
|
1252 |
CleanupStack::PopAndDestroy(location);
|
|
1253 |
}
|
|
1254 |
|
|
1255 |
iError = KErrTimedOut;
|
|
1256 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
1257 |
CActiveScheduler::Start();
|
|
1258 |
|
|
1259 |
if(iError == KErrNone)
|
|
1260 |
{
|
|
1261 |
// set the sample rate to 8K, otherwise the default value of 44.1Kh will be used
|
|
1262 |
// resulting in very large buffers (11K)
|
|
1263 |
recUtil->SetDestinationSampleRateL(8000);
|
|
1264 |
|
|
1265 |
iError = KErrTimedOut;
|
|
1266 |
recUtil->RecordL();
|
|
1267 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
1268 |
CActiveScheduler::Start(); // open->record
|
|
1269 |
if (iError != KErrNone)
|
|
1270 |
{
|
|
1271 |
// DEF127335
|
|
1272 |
// OggRecordController does not support recording into an already existing descriptor.
|
|
1273 |
// This is due to unavailability of APIs at the level of Ogg Vorbis C libraries.
|
|
1274 |
if (iTestStepName == _L("MM-MMF-ACLNTOGG-I-0103-CP") && iError == KErrNotSupported)
|
|
1275 |
{
|
|
1276 |
INFO_PRINTF1(_L("Expected Result: OggRecordController returned KErrNotSupported(-5)"));
|
|
1277 |
ret = EPass;
|
|
1278 |
}
|
|
1279 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility failed with error %d"),iError );
|
|
1280 |
CleanupStack::PopAndDestroy(recUtil);
|
|
1281 |
User::After(KOneSecond);
|
|
1282 |
return ret;
|
|
1283 |
}
|
|
1284 |
// wait to run out of space recording
|
|
1285 |
CActiveScheduler::Start(); // record -> open
|
|
1286 |
|
|
1287 |
if (iError != KErrOverflow)
|
|
1288 |
{
|
|
1289 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility failed with error %d"),iError );
|
|
1290 |
CleanupStack::PopAndDestroy(recUtil);
|
|
1291 |
User::After(KOneSecond);
|
|
1292 |
return ret;
|
|
1293 |
}
|
|
1294 |
|
|
1295 |
TInt expectedLength=0;
|
|
1296 |
TInt actualLength = iAudio->Length();
|
|
1297 |
if(iCreateDes)
|
|
1298 |
{
|
|
1299 |
// Calculuate the frame size which is now dynamic.
|
|
1300 |
// This is more or less a duplicate of the calculation in
|
|
1301 |
// CMMFAudioInput::NegotiateSourceL()
|
|
1302 |
expectedLength = iSize;
|
|
1303 |
TUint sampleRate = recUtil->DestinationSampleRateL();
|
|
1304 |
TUint bitRate = recUtil->DestinationBitRateL();
|
|
1305 |
|
|
1306 |
//xxx work around for GSM which returns zero as the bit rate because internally
|
|
1307 |
// BitsPerSample is zero
|
|
1308 |
if (bitRate==0)
|
|
1309 |
{
|
|
1310 |
bitRate = sampleRate * 8;
|
|
1311 |
}
|
|
1312 |
|
|
1313 |
TUint numberOfChannels = recUtil->DestinationNumberOfChannelsL();
|
|
1314 |
iFrameSize = (bitRate * numberOfChannels / 8) / 4;
|
|
1315 |
iFrameSize = (iFrameSize + (KAudioInputDeltaFrameSize-1)) &~ (KAudioInputDeltaFrameSize-1);
|
|
1316 |
if(iFrameSize < KAudioInputMinFrameSize)
|
|
1317 |
{
|
|
1318 |
iFrameSize = KAudioInputMinFrameSize;
|
|
1319 |
}
|
|
1320 |
|
|
1321 |
else if(iFrameSize > KAudioInputMaxFrameSize)
|
|
1322 |
{
|
|
1323 |
iFrameSize = KAudioInputMaxFrameSize;
|
|
1324 |
}
|
|
1325 |
|
|
1326 |
// GSM will onlt write out an integral number of GSM frames
|
|
1327 |
// which are 65 bytes long..
|
|
1328 |
if (iTestFormat == EGsmWav)
|
|
1329 |
{
|
|
1330 |
iFrameSize = (iFrameSize / KGsmEncodedFrameSize) * KGsmEncodedFrameSize;
|
|
1331 |
}
|
|
1332 |
|
|
1333 |
|
|
1334 |
expectedLength = ((iSize-iHeaderSize) / iFrameSize)* iFrameSize + iHeaderSize;
|
|
1335 |
|
|
1336 |
INFO_PRINTF2(_L("sampleRate = %d"), sampleRate);
|
|
1337 |
INFO_PRINTF2(_L("bitRate = %d"), bitRate);
|
|
1338 |
INFO_PRINTF2(_L("numberOfChannels = %d"), numberOfChannels);
|
|
1339 |
INFO_PRINTF2(_L("iFrameSize = %d"), iFrameSize);
|
|
1340 |
INFO_PRINTF2(_L("Duration = %d"), I64LOW(recUtil->Duration().Int64()));
|
|
1341 |
INFO_PRINTF3(_L("Expected length %d, actual length %d"), expectedLength, actualLength);
|
|
1342 |
|
|
1343 |
|
|
1344 |
#if defined __WRITE_CONVERSION_TO_FILE
|
|
1345 |
{
|
|
1346 |
_LIT(KFileOut, "\\TEST.WAV");
|
|
1347 |
RFs fs;
|
|
1348 |
|
|
1349 |
fs.Connect();
|
|
1350 |
RFile file;
|
|
1351 |
file.Replace(fs, KFileOut(), EFileWrite);
|
|
1352 |
file.Write(iAudio->Des());
|
|
1353 |
TInt len = iAudio->Length();
|
|
1354 |
file.Size(len);
|
|
1355 |
file.Close();
|
|
1356 |
fs.Close();
|
|
1357 |
}
|
|
1358 |
#endif
|
|
1359 |
|
|
1360 |
// a more forgiving test would be :
|
|
1361 |
//if ((actualLength <= expectedLength) &&
|
|
1362 |
// (actualLength >= (expectedLength - iFrameSize)))
|
|
1363 |
|
|
1364 |
// if test is GSM then we expect it to be between
|
|
1365 |
// expected Length and (iSize - iHeaderSize)
|
|
1366 |
if ((iTestFormat == EGsmWav) &&
|
|
1367 |
(actualLength <= (iSize - iHeaderSize)) &&
|
|
1368 |
(actualLength >= expectedLength) )
|
|
1369 |
{
|
|
1370 |
ret = EPass;
|
|
1371 |
}
|
|
1372 |
else if (iAudio->Length() == expectedLength)
|
|
1373 |
{
|
|
1374 |
ret = EPass;
|
|
1375 |
}
|
|
1376 |
else
|
|
1377 |
{
|
|
1378 |
INFO_PRINTF3(_L("Expected length %d, actual length %d"), expectedLength, actualLength);
|
|
1379 |
|
|
1380 |
TInt machineType;
|
|
1381 |
TInt err = HAL::Get(HALData::EMachineUid, machineType);
|
|
1382 |
if (err)
|
|
1383 |
{
|
|
1384 |
ERR_PRINTF1(_L("Error Getting Device information"));
|
|
1385 |
iTestStepResult = EFail;
|
|
1386 |
CActiveScheduler::Stop();
|
|
1387 |
}
|
|
1388 |
else
|
|
1389 |
{
|
|
1390 |
if ((machineType == 0x102864F7) && (sampleRate == 8000))
|
|
1391 |
{
|
|
1392 |
// If test is running on a NaviEngine and uses 8K sample rate
|
|
1393 |
// then apply a tollerance when checking duration as we will
|
|
1394 |
// have applied conversion function.
|
|
1395 |
if ((iAudio->Length() >= expectedLength - 1000) &&
|
|
1396 |
(iAudio->Length() <= expectedLength + 1000))
|
|
1397 |
{
|
|
1398 |
ret = EPass;
|
|
1399 |
}
|
|
1400 |
}
|
|
1401 |
}
|
|
1402 |
}
|
|
1403 |
}
|
|
1404 |
else
|
|
1405 |
{
|
|
1406 |
expectedLength = iSize;
|
|
1407 |
|
|
1408 |
if(iAudio->Length() == expectedLength)
|
|
1409 |
{
|
|
1410 |
ret = EPass;
|
|
1411 |
}
|
|
1412 |
|
|
1413 |
else
|
|
1414 |
{
|
|
1415 |
INFO_PRINTF3(_L("Expected length %d, actual length %d"), expectedLength, actualLength);
|
5
|
1416 |
if (iError == KErrOverflow )
|
|
1417 |
{
|
|
1418 |
ret = EPass;
|
|
1419 |
}
|
0
|
1420 |
}
|
|
1421 |
|
|
1422 |
}
|
|
1423 |
}
|
5
|
1424 |
|
|
1425 |
if (iError == KErrOverflow)
|
|
1426 |
{
|
|
1427 |
INFO_PRINTF2(_L("Overflow happened and ignored = %d"), ret);
|
|
1428 |
ret = EPass;
|
|
1429 |
}
|
0
|
1430 |
|
|
1431 |
if (ret != EPass)
|
|
1432 |
{
|
|
1433 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility failed with error %d"),iError );
|
|
1434 |
}
|
|
1435 |
|
|
1436 |
|
|
1437 |
CleanupStack::PopAndDestroy(recUtil);
|
|
1438 |
User::After(KOneSecond);
|
|
1439 |
return ret;
|
|
1440 |
}
|
|
1441 |
|
|
1442 |
//------------------------------------------------------------------
|
|
1443 |
|
|
1444 |
/**
|
|
1445 |
* Constructor
|
|
1446 |
*/
|
|
1447 |
CTestMmfAclntRecUrl::CTestMmfAclntRecUrl(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
1448 |
{
|
|
1449 |
// store the name of this test case
|
|
1450 |
// this is the name that is used by the script file
|
|
1451 |
// Each test step initialises it's own name
|
|
1452 |
iTestStepName = aTestName;
|
|
1453 |
iSectName = aSectName;
|
|
1454 |
iKeyName = aKeyName;
|
|
1455 |
}
|
|
1456 |
|
|
1457 |
CTestMmfAclntRecUrl* CTestMmfAclntRecUrl::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
1458 |
{
|
|
1459 |
CTestMmfAclntRecUrl* self = new (ELeave) CTestMmfAclntRecUrl(aTestName,aSectName,aKeyName);
|
|
1460 |
return self;
|
|
1461 |
}
|
|
1462 |
|
|
1463 |
CTestMmfAclntRecUrl* CTestMmfAclntRecUrl::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
1464 |
{
|
|
1465 |
CTestMmfAclntRecUrl* self = CTestMmfAclntRecUrl::NewLC(aTestName,aSectName,aKeyName);
|
|
1466 |
CleanupStack::PushL(self);
|
|
1467 |
return self;
|
|
1468 |
};
|
|
1469 |
|
|
1470 |
void CTestMmfAclntRecUrl::MoscoStateChangeEvent(CBase* /*aObject*/,
|
|
1471 |
TInt /*aPreviousState*/,
|
|
1472 |
TInt /*aCurrentState*/,
|
|
1473 |
TInt aErrorCode)
|
|
1474 |
{
|
|
1475 |
iError = aErrorCode;
|
|
1476 |
INFO_PRINTF1( _L("CTestMmfAclntRecUrl : MMdaObjectStateChangeObserver Callback for CMdaAudioRecorderUtility complete"));
|
|
1477 |
INFO_PRINTF2( _L("iError %d"), iError);
|
|
1478 |
CActiveScheduler::Stop();
|
|
1479 |
}
|
|
1480 |
|
|
1481 |
/**
|
|
1482 |
* Open a URL
|
|
1483 |
*/
|
|
1484 |
TVerdict CTestMmfAclntRecUrl::DoTestStepL( void )
|
|
1485 |
{
|
|
1486 |
INFO_PRINTF1( _L("TestRecorder : Record URL"));
|
|
1487 |
TPtrC url;
|
|
1488 |
if(!GetStringFromConfig(iSectName, iKeyName, url))
|
|
1489 |
{
|
|
1490 |
return EInconclusive;
|
|
1491 |
}
|
|
1492 |
|
|
1493 |
|
|
1494 |
TVerdict ret = EFail;
|
|
1495 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
1496 |
CleanupStack::PushL(recUtil);
|
|
1497 |
|
|
1498 |
TRAP_IGNORE(recUtil->OpenUrlL(url, KUseDefaultIap, _L8("Audio/Wav")));
|
|
1499 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
1500 |
CActiveScheduler::Start();
|
|
1501 |
|
|
1502 |
if(iError == KErrNotSupported)
|
|
1503 |
{
|
|
1504 |
ret = EPass;
|
|
1505 |
}
|
|
1506 |
|
|
1507 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility completed with error %d"),iError );
|
|
1508 |
CleanupStack::PopAndDestroy(recUtil);
|
|
1509 |
return ret;
|
|
1510 |
}
|
|
1511 |
|
|
1512 |
//------------------------------------------------------------------
|
|
1513 |
|
|
1514 |
CTestMmfAclntRecPosition::CTestMmfAclntRecPosition(const TDesC& aTestName, const TDesC& aSectName, const TTimeIntervalMicroSeconds& aPosition, TBool aNegative)
|
|
1515 |
:CTestMmfAclntRecord(aTestName, aSectName, aNegative), iPosition(aPosition)
|
|
1516 |
{
|
|
1517 |
}
|
|
1518 |
|
|
1519 |
CTestMmfAclntRecPosition* CTestMmfAclntRecPosition::NewL(const TDesC& aTestName, const TDesC& aSectName, const TTimeIntervalMicroSeconds& aPosition, TBool aNegative)
|
|
1520 |
{
|
|
1521 |
CTestMmfAclntRecPosition* self = new (ELeave) CTestMmfAclntRecPosition(aTestName, aSectName, aPosition, aNegative);
|
|
1522 |
return self;
|
|
1523 |
}
|
|
1524 |
|
|
1525 |
TVerdict CTestMmfAclntRecPosition::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
1526 |
{
|
|
1527 |
INFO_PRINTF1( _L("TestRecorder : Position"));
|
|
1528 |
TVerdict ret = EFail;
|
|
1529 |
TBool validPosition = EFalse;
|
|
1530 |
|
|
1531 |
// Set position: middle of clip.
|
|
1532 |
if (I64INT(iPosition.Int64()) == 0)
|
|
1533 |
{
|
|
1534 |
iPosition = I64INT(aRecUtil->Duration().Int64())/2;
|
|
1535 |
}
|
|
1536 |
|
|
1537 |
// Set position: end of clip.
|
|
1538 |
if (I64INT(iPosition.Int64()) == -1)
|
|
1539 |
{
|
|
1540 |
iPosition = aRecUtil->Duration();
|
|
1541 |
}
|
|
1542 |
|
|
1543 |
aRecUtil->PlayL(); //Begin to Play otherwise position can not be set.
|
|
1544 |
// Position is beyond the end of the clips duration.
|
|
1545 |
// so check that the value is clipped.
|
|
1546 |
if(aRecUtil->Duration() < iPosition)
|
|
1547 |
{
|
|
1548 |
aRecUtil->SetPosition(iPosition);
|
|
1549 |
|
|
1550 |
TInt64 temp = (aRecUtil->Duration().Int64() / KPcm16FrameInterval) - 1; // -1 for DevSound
|
|
1551 |
if(aRecUtil->Position().Int64() == (temp * KPcm16FrameInterval))
|
|
1552 |
{
|
|
1553 |
validPosition = ETrue;
|
|
1554 |
}
|
|
1555 |
|
|
1556 |
}
|
|
1557 |
else
|
|
1558 |
{
|
|
1559 |
aRecUtil->SetPosition(iPosition);
|
|
1560 |
//CActiveScheduler::Start();
|
|
1561 |
|
|
1562 |
TInt64 temp = (iPosition.Int64() / KPcm16FrameInterval) - 1; // -1 for DevSound
|
|
1563 |
TInt64 thePosActual = aRecUtil->Position().Int64();
|
|
1564 |
TInt64 thePosExpected = temp * KPcm16FrameInterval;
|
|
1565 |
aRecUtil->Stop();
|
|
1566 |
|
|
1567 |
if (TimeComparison(I64INT(thePosActual), I64INT(thePosExpected), KExpectedDeviation))
|
|
1568 |
{
|
|
1569 |
validPosition = ETrue;
|
|
1570 |
}
|
|
1571 |
}
|
|
1572 |
|
|
1573 |
if ((iNegative) && (!validPosition))
|
|
1574 |
{
|
|
1575 |
ret = EPass;
|
|
1576 |
}
|
|
1577 |
|
|
1578 |
// Postion was set to a valid value.
|
|
1579 |
if(validPosition)
|
|
1580 |
{
|
|
1581 |
ret = EPass;
|
|
1582 |
}
|
|
1583 |
return ret;
|
|
1584 |
}
|
|
1585 |
|
|
1586 |
//------------------------------------------------------------------
|
|
1587 |
|
|
1588 |
CTestMmfAclntRecDuration::CTestMmfAclntRecDuration(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
1589 |
:CTestMmfAclntRecord(aTestName, aSectName, aNegative)
|
|
1590 |
{
|
|
1591 |
}
|
|
1592 |
|
|
1593 |
CTestMmfAclntRecDuration* CTestMmfAclntRecDuration::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
1594 |
{
|
|
1595 |
CTestMmfAclntRecDuration* self = new (ELeave) CTestMmfAclntRecDuration(aTestName, aSectName, aNegative);
|
|
1596 |
return self;
|
|
1597 |
}
|
|
1598 |
|
|
1599 |
TVerdict CTestMmfAclntRecDuration::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
1600 |
{
|
|
1601 |
INFO_PRINTF1( _L("TestRecorder : Duration"));
|
|
1602 |
TVerdict ret = EFail;
|
|
1603 |
|
|
1604 |
if(iSectName == _L("SectionOggRec"))
|
|
1605 |
{
|
|
1606 |
if (I64INT(aRecUtil->Duration().Int64()) == KSoundFileLength)
|
|
1607 |
ret = EPass;
|
|
1608 |
}
|
|
1609 |
else if (TimeComparison(I64INT(aRecUtil->Duration().Int64()), KSoundFileLength, KExpectedDeviation))
|
|
1610 |
{
|
|
1611 |
ret = EPass;
|
|
1612 |
}
|
|
1613 |
|
|
1614 |
else
|
|
1615 |
INFO_PRINTF3(_L("unexpected duration = %u, expected = %u"), I64INT(aRecUtil->Duration().Int64()), KSoundFileLength);
|
|
1616 |
return ret;
|
|
1617 |
}
|
|
1618 |
|
|
1619 |
//------------------------------------------------------------------
|
|
1620 |
|
|
1621 |
CTestMmfAclntRecSetMeta::CTestMmfAclntRecSetMeta(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
1622 |
:CTestMmfAclntRecord(aTestName, aSectName, aNegative)
|
|
1623 |
{
|
|
1624 |
}
|
|
1625 |
|
|
1626 |
CTestMmfAclntRecSetMeta* CTestMmfAclntRecSetMeta::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
1627 |
{
|
|
1628 |
CTestMmfAclntRecSetMeta* self = new (ELeave) CTestMmfAclntRecSetMeta(aTestName, aSectName, aNegative);
|
|
1629 |
return self;
|
|
1630 |
}
|
|
1631 |
|
|
1632 |
_LIT(name,"<Copyright>");
|
|
1633 |
_LIT(data,"<Symbian (c) 2002>");
|
|
1634 |
_LIT(name2,"Artist");
|
|
1635 |
_LIT(data2,"Test");
|
|
1636 |
/**
|
|
1637 |
* Set meta-information
|
|
1638 |
*/
|
|
1639 |
TVerdict CTestMmfAclntRecSetMeta::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
1640 |
{
|
|
1641 |
INFO_PRINTF1( _L("TestRecorder : Set Metadata"));
|
|
1642 |
TVerdict ret = EFail;
|
|
1643 |
|
|
1644 |
// build a meta daat object
|
|
1645 |
CMMFMetaDataEntry* metaData[2];
|
|
1646 |
metaData[0] = CMMFMetaDataEntry::NewL(name,data);
|
|
1647 |
CleanupStack::PushL(metaData[0]);
|
|
1648 |
metaData[1] = CMMFMetaDataEntry::NewL(name2,data2);
|
|
1649 |
CleanupStack::PushL(metaData[1]);
|
|
1650 |
|
|
1651 |
TInt numEntries;
|
|
1652 |
TInt err = aRecUtil->GetNumberOfMetaDataEntries(numEntries);
|
|
1653 |
if(err != KErrNone)
|
|
1654 |
{
|
|
1655 |
INFO_PRINTF2(_L("GetNumberOfMetaDataEntries() returned error %d"), err);
|
|
1656 |
numEntries = 0; // so we don't try and remove anything
|
|
1657 |
}
|
|
1658 |
|
|
1659 |
// *** JW adapted test - remove any existing metadata
|
|
1660 |
// this means that a modified test file will not cause inconclusive
|
|
1661 |
if(numEntries != 0)
|
|
1662 |
{
|
|
1663 |
INFO_PRINTF2(_L("Removing %d existing entries..."), numEntries);
|
|
1664 |
for(TInt i = numEntries - 1; i >= 0; i--)
|
|
1665 |
{
|
|
1666 |
err = aRecUtil->RemoveMetaDataEntry(i);
|
|
1667 |
if(err != KErrNone)
|
|
1668 |
{
|
|
1669 |
INFO_PRINTF3(_L("RemoveMetaDataEntry(%d) returned error %d"), i, err);
|
|
1670 |
}
|
|
1671 |
}
|
|
1672 |
aRecUtil->GetNumberOfMetaDataEntries(numEntries);
|
|
1673 |
}
|
|
1674 |
|
|
1675 |
if(numEntries == 0)
|
|
1676 |
{
|
|
1677 |
TRAPD(err, aRecUtil->AddMetaDataEntryL(*metaData[0]));
|
|
1678 |
if(err != KErrNone)
|
|
1679 |
{
|
|
1680 |
INFO_PRINTF2(_L("AddMetaDataEntryL(*metaData[0]) left with error %d"), err);
|
|
1681 |
}
|
|
1682 |
|
|
1683 |
|
|
1684 |
TRAP(err, aRecUtil->AddMetaDataEntryL(*metaData[1]));
|
|
1685 |
if(err != KErrNone)
|
|
1686 |
{
|
|
1687 |
INFO_PRINTF2(_L("AddMetaDataEntryL(*metaData[1]) left with error %d"), err);
|
|
1688 |
}
|
|
1689 |
|
|
1690 |
CleanupStack::PopAndDestroy(metaData[1]);
|
|
1691 |
CleanupStack::PopAndDestroy(metaData[0]);
|
|
1692 |
|
|
1693 |
if(err)
|
|
1694 |
{
|
|
1695 |
if(err == KErrNotSupported) // Audio Controller doesn't support - this is ok
|
|
1696 |
{
|
|
1697 |
//
|
|
1698 |
// C-COVER Reports the following methods are not being called
|
|
1699 |
// Remove when metaData is supported
|
|
1700 |
TRAP(err,aRecUtil->GetNumberOfMetaDataEntries(numEntries));
|
|
1701 |
CMMFMetaDataEntry* testData=NULL;
|
|
1702 |
for(TInt i=0;i<numEntries;i++)
|
|
1703 |
{
|
|
1704 |
TRAP(err,testData = aRecUtil->GetMetaDataEntryL(0));
|
|
1705 |
//REPLACE WITH ITSELF??
|
|
1706 |
TRAP(err,aRecUtil->ReplaceMetaDataEntryL(i,*testData));
|
|
1707 |
TRAP(err,aRecUtil->RemoveMetaDataEntry(i));//@@@
|
|
1708 |
}
|
|
1709 |
|
|
1710 |
//
|
|
1711 |
|
|
1712 |
INFO_PRINTF1(_L("Note : Audio Controller does not support metadata"));
|
|
1713 |
return EPass;
|
|
1714 |
}
|
|
1715 |
else
|
|
1716 |
{
|
|
1717 |
ERR_PRINTF1(_L("Unexpected error (expected KErrNotSupported)"));
|
|
1718 |
return EFail;
|
|
1719 |
}
|
|
1720 |
}
|
|
1721 |
|
|
1722 |
aRecUtil->GetNumberOfMetaDataEntries(numEntries);
|
|
1723 |
|
|
1724 |
if(numEntries == 2)
|
|
1725 |
{
|
|
1726 |
CMMFMetaDataEntry* testData;
|
|
1727 |
|
|
1728 |
testData = aRecUtil->GetMetaDataEntryL(0);
|
|
1729 |
|
|
1730 |
if((testData->Name() == name) && (testData->Value() == data))
|
|
1731 |
{
|
|
1732 |
ret = EPass;
|
|
1733 |
}
|
|
1734 |
|
|
1735 |
testData = aRecUtil->GetMetaDataEntryL(1);
|
|
1736 |
|
|
1737 |
if(!((testData->Name() == name2) && (testData->Value() == data2)))
|
|
1738 |
{
|
|
1739 |
ret = EFail;
|
|
1740 |
}
|
|
1741 |
}
|
|
1742 |
return ret;
|
|
1743 |
}
|
|
1744 |
|
|
1745 |
// Audio file already contains meta data, and we couldn't remove it.
|
|
1746 |
ERR_PRINTF1(_L("Audio file still contains metadata"));
|
|
1747 |
CleanupStack::PopAndDestroy(metaData[1]);
|
|
1748 |
CleanupStack::PopAndDestroy(metaData[0]);
|
|
1749 |
return EInconclusive;
|
|
1750 |
}
|
|
1751 |
|
|
1752 |
//------------------------------------------------------------------
|
|
1753 |
|
|
1754 |
/**
|
|
1755 |
* Constructor
|
|
1756 |
*/
|
|
1757 |
CTestMmfAclntRecPriority::CTestMmfAclntRecPriority(const TDesC& aTestName,const TDesC& aSectName)
|
|
1758 |
|
|
1759 |
{
|
|
1760 |
// store the name of this test case
|
|
1761 |
// this is the name that is used by the script file
|
|
1762 |
// Each test step initialises it's own name
|
|
1763 |
iTestStepName = aTestName;
|
|
1764 |
iSectName = aSectName;
|
|
1765 |
}
|
|
1766 |
|
|
1767 |
void CTestMmfAclntRecPriority::MchoComplete(TInt aID, TInt aError)
|
|
1768 |
{
|
|
1769 |
INFO_PRINTF1( _L("CTestMmfAclntRecPriority : MMdaObjectStateChangeObserver Callback for CMdaAudioRecorderUtility called"));
|
|
1770 |
if (iError != KErrNone)
|
|
1771 |
{
|
|
1772 |
iError = aError;
|
|
1773 |
}
|
|
1774 |
|
|
1775 |
INFO_PRINTF3( _L("iError %d ID %d"), iError, aID);
|
|
1776 |
|
|
1777 |
if(iFirstCallback == -1)
|
|
1778 |
{
|
|
1779 |
iFirstCallback = aID;
|
|
1780 |
}
|
|
1781 |
|
|
1782 |
|
|
1783 |
if((--iCallbackCount) == 0)
|
|
1784 |
{
|
|
1785 |
CActiveScheduler::Stop();
|
|
1786 |
}
|
|
1787 |
}
|
|
1788 |
|
|
1789 |
//------------------------------------------------------------------
|
|
1790 |
|
|
1791 |
/**
|
|
1792 |
* Set Record priority
|
|
1793 |
*/
|
|
1794 |
TVerdict CTestMmfAclntRecPriority::DoTestStepL( void )
|
|
1795 |
{
|
|
1796 |
INFO_PRINTF1( _L("TestRecorder : Priority"));
|
|
1797 |
iError = KErrTimedOut;
|
|
1798 |
|
|
1799 |
TBuf<KSizeBuf> filename;
|
|
1800 |
TPtrC filename1;
|
|
1801 |
if(!GetStringFromConfig(iSectName, _L("playerAudioFile"), filename1))
|
|
1802 |
{
|
|
1803 |
return EInconclusive;
|
|
1804 |
}
|
|
1805 |
|
|
1806 |
GetDriveName(filename);
|
|
1807 |
filename.Append(filename1);
|
|
1808 |
|
|
1809 |
|
|
1810 |
CMdaAudioRecorderUtility* recUtil[2];
|
|
1811 |
CStateCallbackHandler* callback[2];
|
|
1812 |
|
|
1813 |
for(TInt i=0; i<2; i++)
|
|
1814 |
{
|
|
1815 |
callback[i] = new (ELeave) CStateCallbackHandler(i,this);
|
|
1816 |
CleanupStack::PushL(callback[i]);
|
|
1817 |
}
|
|
1818 |
|
|
1819 |
recUtil[0] = CMdaAudioRecorderUtility::NewL(*callback[0],NULL,EMdaPriorityNormal,EMdaPriorityPreferenceTimeAndQuality);
|
|
1820 |
CleanupStack::PushL(recUtil[0]);
|
|
1821 |
recUtil[1] = CMdaAudioRecorderUtility::NewL(*callback[1],NULL,EMdaPriorityMin,EMdaPriorityPreferenceNone);
|
|
1822 |
CleanupStack::PushL(recUtil[1]);
|
|
1823 |
|
|
1824 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility[0]->OpenFileL(%S)"), &filename);
|
|
1825 |
recUtil[0]->OpenFileL(filename);
|
|
1826 |
// wait for initilisation callback #1
|
|
1827 |
iCallbackCount = 1;
|
|
1828 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility #1"));
|
|
1829 |
CActiveScheduler::Start();
|
|
1830 |
|
|
1831 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility[1]->OpenFileL(%S)"), &filename);
|
|
1832 |
recUtil[1]->OpenFileL(filename);
|
|
1833 |
// wait for initilisation callback #2
|
|
1834 |
iCallbackCount = 1;
|
|
1835 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility #2"));
|
|
1836 |
CActiveScheduler::Start();
|
|
1837 |
|
|
1838 |
|
|
1839 |
if(iError == KErrNone)
|
|
1840 |
{
|
|
1841 |
iError = KErrTimedOut;
|
|
1842 |
|
|
1843 |
recUtil[0]->PlayL();
|
|
1844 |
recUtil[1]->PlayL();
|
|
1845 |
|
|
1846 |
INFO_PRINTF1( _L("Play CMdaAudioRecorderUtility"));
|
|
1847 |
INFO_PRINTF1( _L("Play CMdaAudioRecorderUtility"));
|
|
1848 |
// wait for play to complete
|
|
1849 |
iCallbackCount = 2;
|
|
1850 |
iFirstCallback = -1;
|
|
1851 |
CActiveScheduler::Start();
|
|
1852 |
|
|
1853 |
if((iError == KErrNone) && (iFirstCallback == 0))
|
|
1854 |
{
|
|
1855 |
CleanupStack::PopAndDestroy(4); // recUtil, callback
|
|
1856 |
return EPass;
|
|
1857 |
}
|
|
1858 |
}
|
|
1859 |
|
|
1860 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility completed with error %d"),iError );
|
|
1861 |
|
|
1862 |
CleanupStack::PopAndDestroy(4);
|
|
1863 |
return EFail;
|
|
1864 |
}
|
|
1865 |
|
|
1866 |
//------------------------------------------------------------------
|
|
1867 |
|
|
1868 |
CTestMmfAclntRecBalance::CTestMmfAclntRecBalance(const TDesC& aTestName, const TDesC& aSectName, const TInt aBalance, TBool aNegative)
|
|
1869 |
:CTestMmfAclntRecord(aTestName, aSectName, aNegative), iBalance(aBalance)
|
|
1870 |
{
|
|
1871 |
}
|
|
1872 |
|
|
1873 |
CTestMmfAclntRecBalance* CTestMmfAclntRecBalance::NewL(const TDesC& aTestName, const TDesC& aSectName,const TInt aBalance, TBool aNegative)
|
|
1874 |
{
|
|
1875 |
CTestMmfAclntRecBalance* self = new (ELeave) CTestMmfAclntRecBalance(aTestName, aSectName, aBalance, aNegative);
|
|
1876 |
return self;
|
|
1877 |
}
|
|
1878 |
|
|
1879 |
/**
|
|
1880 |
* Set recorder balance
|
|
1881 |
*/
|
|
1882 |
TVerdict CTestMmfAclntRecBalance::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
1883 |
{
|
|
1884 |
INFO_PRINTF2(_L("TestRecorder : Balance - (%d)"), iBalance);
|
|
1885 |
|
|
1886 |
TInt savedBalance = iBalance;
|
|
1887 |
if (CheckPlaybackBalance(aRecUtil) == EPass)
|
|
1888 |
{
|
|
1889 |
iBalance = savedBalance;
|
|
1890 |
if (CheckRecordBalance(aRecUtil) == EPass)
|
|
1891 |
return EPass;
|
|
1892 |
}
|
|
1893 |
|
|
1894 |
return EFail;
|
|
1895 |
}
|
|
1896 |
|
|
1897 |
TVerdict CTestMmfAclntRecBalance::CheckPlaybackBalance(CMdaAudioRecorderUtility* aRecUtil)
|
|
1898 |
{
|
|
1899 |
TInt err = 0;
|
|
1900 |
TUint theNumChanel = 0;
|
|
1901 |
TRAP(err, theNumChanel = aRecUtil->DestinationNumberOfChannelsL());
|
|
1902 |
if(err != KErrNone)
|
|
1903 |
{
|
|
1904 |
return EFail;
|
|
1905 |
}
|
|
1906 |
|
|
1907 |
|
|
1908 |
TInt balance;
|
|
1909 |
|
|
1910 |
if (iBalance < KMinBalance)
|
|
1911 |
{
|
|
1912 |
err = aRecUtil->SetPlaybackBalance(iBalance);
|
|
1913 |
|
|
1914 |
if ((err == KErrArgument) && (iNegative))
|
|
1915 |
{
|
|
1916 |
return EPass;
|
|
1917 |
}
|
|
1918 |
else if ((err == KErrArgument) && (!iNegative))
|
|
1919 |
{
|
|
1920 |
return EFail;
|
|
1921 |
}
|
|
1922 |
|
|
1923 |
aRecUtil->GetPlaybackBalance(iBalance);
|
|
1924 |
if(iBalance == KMinBalance)
|
|
1925 |
{
|
|
1926 |
return EPass;
|
|
1927 |
}
|
|
1928 |
}
|
|
1929 |
else if (iBalance > KMaxBalance)
|
|
1930 |
{
|
|
1931 |
err = aRecUtil->SetPlaybackBalance(iBalance);
|
|
1932 |
|
|
1933 |
if ((err == KErrArgument) && (iNegative))
|
|
1934 |
{
|
|
1935 |
return EPass;
|
|
1936 |
}
|
|
1937 |
else if ((err == KErrArgument) && (!iNegative))
|
|
1938 |
{
|
|
1939 |
return EFail;
|
|
1940 |
}
|
|
1941 |
|
|
1942 |
aRecUtil->GetPlaybackBalance(iBalance);
|
|
1943 |
if(iBalance == KMaxBalance)
|
|
1944 |
{
|
|
1945 |
return EPass;
|
|
1946 |
}
|
|
1947 |
|
|
1948 |
}
|
|
1949 |
else
|
|
1950 |
{
|
|
1951 |
err = aRecUtil->SetPlaybackBalance(iBalance);
|
|
1952 |
if(theNumChanel <= 1)
|
|
1953 |
{
|
|
1954 |
if(err != KErrNone) // this is now supported
|
|
1955 |
return EFail;
|
|
1956 |
}
|
|
1957 |
if ((err == KErrArgument) && (iNegative))
|
|
1958 |
{
|
|
1959 |
return EPass;
|
|
1960 |
}
|
|
1961 |
else if ((err == KErrArgument) && (!iNegative))
|
|
1962 |
{
|
|
1963 |
return EFail;
|
|
1964 |
}
|
|
1965 |
else if(err != KErrNone)
|
|
1966 |
{
|
|
1967 |
return EFail;
|
|
1968 |
}
|
|
1969 |
|
|
1970 |
|
|
1971 |
TInt theRes = aRecUtil->GetPlaybackBalance(balance);
|
|
1972 |
if((theRes == KErrNone) && (balance == iBalance))
|
|
1973 |
{
|
|
1974 |
return EPass;
|
|
1975 |
}
|
|
1976 |
}
|
|
1977 |
|
|
1978 |
return EFail;
|
|
1979 |
}
|
|
1980 |
|
|
1981 |
TVerdict CTestMmfAclntRecBalance::CheckRecordBalance(CMdaAudioRecorderUtility* aRecUtil)
|
|
1982 |
{
|
|
1983 |
TInt err = 0;
|
|
1984 |
TUint theNumChanel = 0;
|
|
1985 |
TRAP(err, theNumChanel = aRecUtil->DestinationNumberOfChannelsL());
|
|
1986 |
if(err != KErrNone)
|
|
1987 |
{
|
|
1988 |
return EFail;
|
|
1989 |
}
|
|
1990 |
|
|
1991 |
if (iBalance < KMinBalance)
|
|
1992 |
{
|
|
1993 |
err = aRecUtil->SetRecordBalance(iBalance);
|
|
1994 |
|
|
1995 |
if ((err == KErrArgument) && (iNegative))
|
|
1996 |
{
|
|
1997 |
return EPass;
|
|
1998 |
}
|
|
1999 |
else if ((err == KErrArgument) && (!iNegative))
|
|
2000 |
{
|
|
2001 |
return EFail;
|
|
2002 |
}
|
|
2003 |
|
|
2004 |
aRecUtil->GetRecordBalance(iBalance);
|
|
2005 |
if(iBalance == KMinBalance)
|
|
2006 |
{
|
|
2007 |
return EPass;
|
|
2008 |
}
|
|
2009 |
|
|
2010 |
}
|
|
2011 |
else if (iBalance > KMaxBalance)
|
|
2012 |
{
|
|
2013 |
err = aRecUtil->SetRecordBalance(iBalance);
|
|
2014 |
|
|
2015 |
if ((err == KErrArgument) && (iNegative))
|
|
2016 |
{
|
|
2017 |
return EPass;
|
|
2018 |
}
|
|
2019 |
else if ((err == KErrArgument) && (!iNegative))
|
|
2020 |
{
|
|
2021 |
return EFail;
|
|
2022 |
}
|
|
2023 |
|
|
2024 |
aRecUtil->GetRecordBalance(iBalance);
|
|
2025 |
if(iBalance == KMaxBalance)
|
|
2026 |
{
|
|
2027 |
return EPass;
|
|
2028 |
}
|
|
2029 |
|
|
2030 |
}
|
|
2031 |
else
|
|
2032 |
{
|
|
2033 |
TInt balance;
|
|
2034 |
err = aRecUtil->SetRecordBalance(iBalance);
|
|
2035 |
if(theNumChanel <= 1)
|
|
2036 |
{
|
|
2037 |
if(err != KErrNone) // this is now supported
|
|
2038 |
return EFail;
|
|
2039 |
}
|
|
2040 |
|
|
2041 |
if ((err == KErrArgument) && (iNegative))
|
|
2042 |
{
|
|
2043 |
return EPass;
|
|
2044 |
}
|
|
2045 |
else if ((err == KErrArgument) && (!iNegative))
|
|
2046 |
{
|
|
2047 |
return EFail;
|
|
2048 |
}
|
|
2049 |
|
|
2050 |
aRecUtil->GetRecordBalance(balance);
|
|
2051 |
if(balance == iBalance)
|
|
2052 |
{
|
|
2053 |
return EPass;
|
|
2054 |
}
|
|
2055 |
}
|
|
2056 |
|
|
2057 |
return EFail;
|
|
2058 |
}
|
|
2059 |
|
|
2060 |
//------------------------------------------------------------------
|
|
2061 |
|
|
2062 |
CTestMmfAclntRecLength::CTestMmfAclntRecLength(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
2063 |
:CTestMmfAclntRecord(aTestName, aSectName, aNegative)
|
|
2064 |
{
|
|
2065 |
}
|
|
2066 |
|
|
2067 |
CTestMmfAclntRecLength* CTestMmfAclntRecLength::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
2068 |
{
|
|
2069 |
CTestMmfAclntRecLength* self = new (ELeave) CTestMmfAclntRecLength(aTestName, aSectName, aNegative);
|
|
2070 |
return self;
|
|
2071 |
}
|
|
2072 |
|
|
2073 |
/**
|
|
2074 |
*Set maximum length of file in bytes and record
|
|
2075 |
*/
|
|
2076 |
TVerdict CTestMmfAclntRecLength::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
2077 |
{
|
|
2078 |
INFO_PRINTF1( _L("TestRecorder : SetMaxWriteLength"));
|
|
2079 |
|
|
2080 |
TVerdict ret = EFail;
|
|
2081 |
TTimeIntervalMicroSeconds recTime(aRecUtil->RecordTimeAvailable());
|
|
2082 |
|
|
2083 |
aRecUtil->SetMaxWriteLength(800);
|
|
2084 |
|
|
2085 |
if(aRecUtil->RecordTimeAvailable() != recTime)
|
|
2086 |
{
|
|
2087 |
ret = EPass;
|
|
2088 |
}
|
|
2089 |
|
|
2090 |
return ret;
|
|
2091 |
}
|
|
2092 |
|
|
2093 |
//------------------------------------------------------------------
|
|
2094 |
|
|
2095 |
CTestMmfAclntRecFormats::CTestMmfAclntRecFormats(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
2096 |
:CTestMmfAclntRecord(aTestName, aSectName, aNegative)
|
|
2097 |
{
|
|
2098 |
}
|
|
2099 |
|
|
2100 |
CTestMmfAclntRecFormats* CTestMmfAclntRecFormats::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
2101 |
{
|
|
2102 |
CTestMmfAclntRecFormats* self = new (ELeave) CTestMmfAclntRecFormats(aTestName, aSectName, aNegative);
|
|
2103 |
return self;
|
|
2104 |
}
|
|
2105 |
|
|
2106 |
/**
|
|
2107 |
* Get recordable formats.Test for supported mimetypes.
|
|
2108 |
*/
|
|
2109 |
TVerdict CTestMmfAclntRecFormats::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
2110 |
{
|
|
2111 |
INFO_PRINTF1( _L("TestRecorder : Formats"));
|
|
2112 |
|
|
2113 |
TVerdict ret = EPass;
|
|
2114 |
|
|
2115 |
TInt recauMatches = 0;
|
|
2116 |
TInt playauMatches = 0;
|
|
2117 |
TInt recwavMatches = 0;
|
|
2118 |
TInt playwavMathces = 0;
|
|
2119 |
|
|
2120 |
const TInt KControllerAudioRecAuMatches = 4;
|
|
2121 |
const TInt KControllerAudioPlayAuMatches = 4;
|
|
2122 |
const TInt KControllerAudioRecWavMatches = 2;
|
|
2123 |
// there are 2 .wav play plugins - the standard .WAV plugin and
|
|
2124 |
// the test MmfMp3Format plugin with 2 mime types each :
|
|
2125 |
const TInt KControllerAudioPlayWavMatches = 2;
|
|
2126 |
|
|
2127 |
RArray<TFourCC> codecs;
|
|
2128 |
aRecUtil->GetSupportedDestinationDataTypesL(codecs);
|
|
2129 |
TInt numCodecs = codecs.Count();
|
|
2130 |
|
|
2131 |
INFO_PRINTF2(_L("GetSupportedDestinationDataTypesL found %d codecs"), numCodecs);
|
|
2132 |
|
|
2133 |
// enhanced - to use CMMFControllerPluginSelectionParameters
|
|
2134 |
|
|
2135 |
INFO_PRINTF1(_L("Querying record formats..."));
|
|
2136 |
|
|
2137 |
CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC();
|
|
2138 |
CMMFFormatSelectionParameters* recFSelect = CMMFFormatSelectionParameters::NewLC();
|
|
2139 |
CMMFFormatSelectionParameters* playFSelect = CMMFFormatSelectionParameters::NewLC();
|
|
2140 |
|
|
2141 |
RArray<TUid> mediaIds;
|
|
2142 |
mediaIds.Append(KUidMediaTypeAudio);
|
|
2143 |
cSelect->SetMediaIdsL(mediaIds, CMMFPluginSelectionParameters::EAllowOtherMediaIds);
|
|
2144 |
cSelect->SetRequiredRecordFormatSupportL(*recFSelect);
|
|
2145 |
cSelect->SetRequiredPlayFormatSupportL(*playFSelect);
|
|
2146 |
|
|
2147 |
RMMFControllerImplInfoArray controllers; // Array to hold all the controllers support the match data
|
|
2148 |
CleanupResetAndDestroyPushL(controllers);
|
|
2149 |
cSelect->ListImplementationsL(controllers); // Populates the array with all the suitable controllers
|
|
2150 |
TInt numControllers = controllers.Count();
|
|
2151 |
if(!numControllers)
|
|
2152 |
{
|
|
2153 |
ERR_PRINTF1(_L("Could not find any controllers"));
|
|
2154 |
}
|
|
2155 |
else
|
|
2156 |
{
|
|
2157 |
INFO_PRINTF2(_L("Found %d controllers"), numControllers);
|
|
2158 |
for(int i = 0; i < numControllers; i++)
|
|
2159 |
{
|
|
2160 |
INFO_PRINTF4(_L("- Controller: %d Uid: 0x%X %S"),i, controllers[i]->Uid(), &controllers[i]->DisplayName());
|
|
2161 |
const RMMFFormatImplInfoArray& recFormats = controllers[i]->RecordFormats();
|
|
2162 |
const RMMFFormatImplInfoArray& playFormats = controllers[i]->PlayFormats();
|
|
2163 |
|
|
2164 |
const CDesC8Array* fileExtensions = NULL;
|
|
2165 |
const CDesC8Array* mimeTypes = NULL;
|
|
2166 |
|
|
2167 |
_LIT(KMimeTypeAudioBasic, "audio/basic");
|
|
2168 |
_LIT(KMimeTypeAudioXAu, "audio/x-au");
|
|
2169 |
_LIT(KMimeTypeAudioAu, "audio/au");
|
|
2170 |
_LIT(KMimeTypeAudioXBasic, "audio/x-basic");
|
|
2171 |
_LIT(KMimeTypeAudioWav, "audio/wav");
|
|
2172 |
_LIT(KMimeTypeAudioXWav, "audio/x-wav");
|
|
2173 |
|
|
2174 |
_LIT(KWavFileExtension, ".wav");
|
|
2175 |
_LIT(KAuFileExtension, ".au");
|
|
2176 |
|
|
2177 |
|
|
2178 |
for(int recFormat = 0; recFormat < recFormats.Count(); recFormat++)
|
|
2179 |
{
|
|
2180 |
INFO_PRINTF2(_L("Record Format 0x%x"), recFormats[recFormat]->Uid());
|
|
2181 |
fileExtensions = &recFormats[recFormat]->SupportedFileExtensions();
|
|
2182 |
INFO_PRINTF2(_L("File Extensions %d"), (fileExtensions ? fileExtensions->MdcaCount() : 0));
|
|
2183 |
TBuf<24> fileType;
|
|
2184 |
for(int fileExtn = 0; fileExtn < (fileExtensions ? fileExtensions->MdcaCount() : 0); fileExtn++)
|
|
2185 |
{
|
|
2186 |
fileType.Copy(fileExtensions->MdcaPoint(fileExtn));
|
|
2187 |
INFO_PRINTF2(_L("-- %S"), &fileType);
|
|
2188 |
}
|
|
2189 |
|
|
2190 |
mimeTypes = &recFormats[recFormat]->SupportedMimeTypes();
|
|
2191 |
INFO_PRINTF2(_L("Mime Types: %d"), (mimeTypes ? mimeTypes->MdcaCount() : 0));
|
|
2192 |
for(int mimeType = 0; mimeType < (mimeTypes ? mimeTypes->MdcaCount() : 0); mimeType++)
|
|
2193 |
{
|
|
2194 |
TBuf<24> ext16;
|
|
2195 |
ext16.Copy(mimeTypes->MdcaPoint(mimeType));
|
|
2196 |
if(fileType.Compare(KAuFileExtension)== KErrNone)
|
|
2197 |
{
|
|
2198 |
switch (mimeType)
|
|
2199 |
{
|
|
2200 |
case 0:
|
|
2201 |
if (ext16 == KMimeTypeAudioBasic)
|
|
2202 |
{
|
|
2203 |
recauMatches++;
|
|
2204 |
}
|
|
2205 |
|
|
2206 |
else
|
|
2207 |
{
|
|
2208 |
ret = EFail;
|
|
2209 |
}
|
|
2210 |
|
|
2211 |
break;
|
|
2212 |
case 1:
|
|
2213 |
if (ext16 == KMimeTypeAudioXAu)
|
|
2214 |
{
|
|
2215 |
recauMatches++;
|
|
2216 |
}
|
|
2217 |
|
|
2218 |
else
|
|
2219 |
{
|
|
2220 |
ret = EFail;
|
|
2221 |
}
|
|
2222 |
|
|
2223 |
break;
|
|
2224 |
case 2:
|
|
2225 |
if(ext16 == KMimeTypeAudioAu)
|
|
2226 |
{
|
|
2227 |
recauMatches++;
|
|
2228 |
}
|
|
2229 |
|
|
2230 |
else
|
|
2231 |
{
|
|
2232 |
ret = EFail;
|
|
2233 |
}
|
|
2234 |
break;
|
|
2235 |
|
|
2236 |
case 3:
|
|
2237 |
if(ext16 == KMimeTypeAudioXBasic)
|
|
2238 |
{
|
|
2239 |
recauMatches++;
|
|
2240 |
}
|
|
2241 |
|
|
2242 |
else
|
|
2243 |
{
|
|
2244 |
ret = EFail;
|
|
2245 |
}
|
|
2246 |
|
|
2247 |
break;
|
|
2248 |
default:
|
|
2249 |
break;
|
|
2250 |
}
|
|
2251 |
INFO_PRINTF2(_L("-- %S"), &ext16);
|
|
2252 |
}
|
|
2253 |
if(fileType.Compare(KWavFileExtension) == KErrNone)
|
|
2254 |
{
|
|
2255 |
switch (mimeType)
|
|
2256 |
{
|
|
2257 |
case 0:
|
|
2258 |
if(ext16 == KMimeTypeAudioWav)
|
|
2259 |
{
|
|
2260 |
recwavMatches++;
|
|
2261 |
}
|
|
2262 |
|
|
2263 |
else
|
|
2264 |
{
|
|
2265 |
ret = EFail;
|
|
2266 |
}
|
|
2267 |
|
|
2268 |
break;
|
|
2269 |
case 1:
|
|
2270 |
if(ext16 == KMimeTypeAudioXWav)
|
|
2271 |
{
|
|
2272 |
recwavMatches++;
|
|
2273 |
}
|
|
2274 |
|
|
2275 |
else
|
|
2276 |
{
|
|
2277 |
ret = EFail;
|
|
2278 |
}
|
|
2279 |
|
|
2280 |
break;
|
|
2281 |
|
|
2282 |
default:
|
|
2283 |
break;
|
|
2284 |
}
|
|
2285 |
INFO_PRINTF2(_L("-- %S"), &ext16);
|
|
2286 |
}
|
|
2287 |
} //mimetype
|
|
2288 |
} //recFormat
|
|
2289 |
|
|
2290 |
for(int playFormat = 0; playFormat < playFormats.Count(); playFormat++)
|
|
2291 |
{
|
|
2292 |
INFO_PRINTF2(_L("Play Format 0x%x"), playFormats[playFormat]->Uid());
|
|
2293 |
fileExtensions = &playFormats[playFormat]->SupportedFileExtensions();
|
|
2294 |
INFO_PRINTF2(_L("File Extensions %d"), (fileExtensions ? fileExtensions->MdcaCount() : 0));
|
|
2295 |
TBuf<24> fileType;
|
|
2296 |
for(int fileExtn = 0; fileExtn < (fileExtensions ? fileExtensions->MdcaCount() : 0); fileExtn++)
|
|
2297 |
{
|
|
2298 |
fileType.Copy(fileExtensions->MdcaPoint(fileExtn));
|
|
2299 |
INFO_PRINTF2(_L("-- %S"), &fileType);
|
|
2300 |
}
|
|
2301 |
mimeTypes = &playFormats[playFormat]->SupportedMimeTypes();
|
|
2302 |
INFO_PRINTF2(_L("Mime Types: %d"), (mimeTypes ? mimeTypes->MdcaCount() : 0));
|
|
2303 |
for(int mimeType = 0; mimeType < (mimeTypes ? mimeTypes->MdcaCount() : 0); mimeType++)
|
|
2304 |
{
|
|
2305 |
TBuf<24> ext16;
|
|
2306 |
ext16.Copy(mimeTypes->MdcaPoint(mimeType));
|
|
2307 |
if(fileType.Compare(KAuFileExtension) == KErrNone)
|
|
2308 |
{
|
|
2309 |
switch (mimeType)
|
|
2310 |
{
|
|
2311 |
case 0:
|
|
2312 |
if (ext16 == KMimeTypeAudioBasic)
|
|
2313 |
{
|
|
2314 |
playauMatches++;
|
|
2315 |
}
|
|
2316 |
|
|
2317 |
else
|
|
2318 |
{
|
|
2319 |
ret = EFail;
|
|
2320 |
}
|
|
2321 |
|
|
2322 |
break;
|
|
2323 |
case 1:
|
|
2324 |
if (ext16 == KMimeTypeAudioXAu)
|
|
2325 |
{
|
|
2326 |
playauMatches++;
|
|
2327 |
}
|
|
2328 |
|
|
2329 |
else
|
|
2330 |
ret = EFail;
|
|
2331 |
break;
|
|
2332 |
case 2:
|
|
2333 |
if(ext16 == KMimeTypeAudioAu)
|
|
2334 |
playauMatches++;
|
|
2335 |
else
|
|
2336 |
ret = EFail;
|
|
2337 |
break;
|
|
2338 |
case 3:
|
|
2339 |
if(ext16 == KMimeTypeAudioXBasic)
|
|
2340 |
{
|
|
2341 |
playauMatches++;
|
|
2342 |
}
|
|
2343 |
else
|
|
2344 |
ret = EFail;
|
|
2345 |
break;
|
|
2346 |
default:
|
|
2347 |
break;
|
|
2348 |
}
|
|
2349 |
INFO_PRINTF2(_L("-- %S"), &ext16);
|
|
2350 |
}
|
|
2351 |
if(fileType.Compare(KWavFileExtension)== KErrNone)
|
|
2352 |
{
|
|
2353 |
switch (mimeType)
|
|
2354 |
{
|
|
2355 |
case 0:
|
|
2356 |
if(ext16 == KMimeTypeAudioWav)
|
|
2357 |
{
|
|
2358 |
playwavMathces++;
|
|
2359 |
}
|
|
2360 |
|
|
2361 |
else
|
|
2362 |
ret = EFail;
|
|
2363 |
break;
|
|
2364 |
case 1:
|
|
2365 |
if(ext16 == KMimeTypeAudioXWav)
|
|
2366 |
{
|
|
2367 |
playwavMathces++;
|
|
2368 |
}
|
|
2369 |
|
|
2370 |
else
|
|
2371 |
ret = EFail;
|
|
2372 |
break;
|
|
2373 |
default:
|
|
2374 |
break;
|
|
2375 |
}
|
|
2376 |
INFO_PRINTF2(_L("-- %S"), &ext16);
|
|
2377 |
}
|
|
2378 |
}//mimetype
|
|
2379 |
} //playFormat
|
|
2380 |
} //controllers
|
|
2381 |
}//else condition
|
|
2382 |
|
|
2383 |
CleanupStack::PopAndDestroy(4);//controllers, recFSelect, playFSelect cSelect
|
|
2384 |
|
|
2385 |
if((recauMatches != KControllerAudioRecAuMatches || playauMatches != KControllerAudioPlayAuMatches) ||
|
|
2386 |
(recwavMatches != KControllerAudioRecWavMatches || playwavMathces != KControllerAudioPlayWavMatches))
|
|
2387 |
{
|
|
2388 |
ret = EFail;
|
|
2389 |
}
|
|
2390 |
|
|
2391 |
else
|
|
2392 |
ret = EPass;
|
|
2393 |
|
|
2394 |
return ret;
|
|
2395 |
} //end of function
|
|
2396 |
|
|
2397 |
|
|
2398 |
//------------------------------------------------------------------
|
|
2399 |
|
|
2400 |
// Negative tests
|
|
2401 |
|
|
2402 |
//------------------------------------------------------------------
|
|
2403 |
|
|
2404 |
/**
|
|
2405 |
* Constructor
|
|
2406 |
*/
|
|
2407 |
CTestMmfAclntRecDelete::CTestMmfAclntRecDelete(const TDesC& aTestName, const TDesC& aSectName)
|
|
2408 |
{
|
|
2409 |
// store the name of this test case
|
|
2410 |
// this is the name that is used by the script file
|
|
2411 |
// Each test step initialises it's own name
|
|
2412 |
iTestStepName = aTestName;
|
|
2413 |
iSectName = aSectName;
|
|
2414 |
}
|
|
2415 |
|
|
2416 |
void CTestMmfAclntRecDelete::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt /*aCurrentState*/, TInt aErrorCode)
|
|
2417 |
{
|
|
2418 |
iError = aErrorCode;
|
|
2419 |
INFO_PRINTF1( _L("CTestMmfAclntRecDelete : MMdaObjectStateChangeObserver Callback for CMdaAudioRecorderUtility complete"));
|
|
2420 |
INFO_PRINTF2( _L("iError %d "), iError);
|
|
2421 |
CActiveScheduler::Stop();
|
|
2422 |
}
|
|
2423 |
|
|
2424 |
TVerdict CTestMmfAclntRecDelete::DoTestStepPreambleL()
|
|
2425 |
{
|
|
2426 |
TVerdict verdict = EPass;
|
|
2427 |
|
|
2428 |
// Delete the output file (will probably have been used by other tests)
|
|
2429 |
RFs fs;
|
|
2430 |
TInt err = fs.Connect();
|
|
2431 |
if (err != KErrNone)
|
|
2432 |
{
|
|
2433 |
verdict = EFail;
|
|
2434 |
}
|
|
2435 |
else
|
|
2436 |
{
|
|
2437 |
TBuf<KSizeBuf> filename;
|
|
2438 |
TPtrC filename1;
|
|
2439 |
if (!GetStringFromConfig(iSectName, _L("outputAudioFile"), filename1))
|
|
2440 |
{
|
|
2441 |
verdict = EInconclusive;
|
|
2442 |
}
|
|
2443 |
else
|
|
2444 |
{
|
|
2445 |
GetDriveName(filename);
|
|
2446 |
filename.Append(filename1);
|
|
2447 |
err = fs.Delete(filename);
|
|
2448 |
if (!((err == KErrNone) || (err == KErrNotFound)))
|
|
2449 |
{
|
|
2450 |
verdict = EInconclusive;
|
|
2451 |
}
|
|
2452 |
|
|
2453 |
}
|
|
2454 |
fs.Close();
|
|
2455 |
}
|
|
2456 |
|
|
2457 |
if (verdict == EPass)
|
|
2458 |
{
|
|
2459 |
verdict = CTestMmfAclntStep::DoTestStepPreambleL();
|
|
2460 |
}
|
|
2461 |
|
|
2462 |
|
|
2463 |
return verdict;
|
|
2464 |
}
|
|
2465 |
|
|
2466 |
/**
|
|
2467 |
* Record utility - Delete object before record operation has completed.
|
|
2468 |
*/
|
|
2469 |
TVerdict CTestMmfAclntRecDelete::DoTestStepL( void )
|
|
2470 |
{
|
|
2471 |
INFO_PRINTF1( _L("TestRecorder : Delete"));
|
|
2472 |
iError = KErrTimedOut;
|
|
2473 |
|
|
2474 |
TBuf<KSizeBuf> filename;
|
|
2475 |
TPtrC filename1;
|
|
2476 |
if(!GetStringFromConfig(iSectName, _L("outputAudioFile"), filename1))
|
|
2477 |
{
|
|
2478 |
return EInconclusive;
|
|
2479 |
}
|
|
2480 |
|
|
2481 |
GetDriveName(filename);
|
|
2482 |
filename.Append(filename1);
|
|
2483 |
|
|
2484 |
__MM_HEAP_MARK;
|
|
2485 |
|
|
2486 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
2487 |
CleanupStack::PushL(recUtil);
|
|
2488 |
|
|
2489 |
// Add create file for Ogg-tests
|
|
2490 |
if(iSectName == _L("SectionOggRec"))
|
|
2491 |
{
|
|
2492 |
RFs fs;
|
|
2493 |
User::LeaveIfError(fs.Connect());
|
|
2494 |
RFile file;
|
|
2495 |
User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
|
|
2496 |
file.Close();
|
|
2497 |
fs.Close();
|
|
2498 |
}
|
|
2499 |
|
|
2500 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility->OpenFileL(%S)"), &filename);
|
|
2501 |
recUtil->OpenFileL(filename);
|
|
2502 |
// wait
|
|
2503 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
2504 |
CActiveScheduler::Start();
|
|
2505 |
|
|
2506 |
if (iError == KErrNone)
|
|
2507 |
{
|
|
2508 |
TVerdict ret = EPass;
|
|
2509 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
2510 |
recUtil->RecordL();
|
|
2511 |
INFO_PRINTF1( _L("Destroy CMdaAudioRecorderUtility"));
|
|
2512 |
CleanupStack::PopAndDestroy(recUtil);
|
|
2513 |
|
|
2514 |
// Check that the file no longer exists
|
|
2515 |
RFs fs;
|
|
2516 |
TInt err = fs.Connect();
|
|
2517 |
if (err != KErrNone)
|
|
2518 |
{
|
|
2519 |
INFO_PRINTF2(_L("Error connecting to file server %d"), err);
|
|
2520 |
ret = EInconclusive;
|
|
2521 |
}
|
|
2522 |
else
|
|
2523 |
{
|
|
2524 |
TEntry entry;
|
|
2525 |
if ((fs.Entry(filename, entry) == KErrNone) && (entry.iSize > 0))
|
|
2526 |
{
|
|
2527 |
ERR_PRINTF1(_L("ERROR: File exists and size is greater than ZERO"));
|
|
2528 |
ret = EFail; // file exists - test fails
|
|
2529 |
}
|
|
2530 |
else
|
|
2531 |
{
|
|
2532 |
ret = EPass;
|
|
2533 |
}
|
|
2534 |
fs.Close();
|
|
2535 |
}
|
|
2536 |
|
|
2537 |
__MM_HEAP_MARKEND;
|
|
2538 |
User::Heap().Check();
|
|
2539 |
|
|
2540 |
return ret;
|
|
2541 |
}
|
|
2542 |
CleanupStack::PopAndDestroy(recUtil);
|
|
2543 |
return EFail;
|
|
2544 |
}
|
|
2545 |
|
|
2546 |
|
|
2547 |
//------------------------------------------------------------------
|
|
2548 |
|
|
2549 |
CTestMmfAclntAudioRecordVolume::CTestMmfAclntAudioRecordVolume(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative, const TInt aVolume)
|
|
2550 |
: CTestMmfAclntRecord(aTestName, aSectName,aNegative), iVolume(aVolume)
|
|
2551 |
{}
|
|
2552 |
|
|
2553 |
CTestMmfAclntAudioRecordVolume* CTestMmfAclntAudioRecordVolume::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative, const TInt aVolume)
|
|
2554 |
{
|
|
2555 |
CTestMmfAclntAudioRecordVolume* self = new (ELeave) CTestMmfAclntAudioRecordVolume(aTestName, aSectName,aNegative,aVolume);
|
|
2556 |
return self;
|
|
2557 |
}
|
|
2558 |
|
|
2559 |
|
|
2560 |
TVerdict CTestMmfAclntAudioRecordVolume::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
2561 |
{
|
|
2562 |
INFO_PRINTF1( _L("TestRecordUtils : Audio Record Volume"));
|
|
2563 |
TVerdict ret = EFail;
|
|
2564 |
|
|
2565 |
|
|
2566 |
// Check maxvolume function
|
|
2567 |
if(iVolume == -1)
|
|
2568 |
{
|
|
2569 |
iVolume = aRecUtil->MaxVolume();
|
|
2570 |
}
|
|
2571 |
// Volume is truncated to maxvolume
|
|
2572 |
if(iVolume > aRecUtil->MaxVolume())
|
|
2573 |
{
|
|
2574 |
TInt volume;
|
|
2575 |
aRecUtil->SetVolume(iVolume);
|
|
2576 |
aRecUtil->GetVolume(volume);
|
|
2577 |
if(volume == aRecUtil->MaxVolume())
|
|
2578 |
{
|
|
2579 |
ret = EPass;
|
|
2580 |
}
|
|
2581 |
}
|
|
2582 |
// Volume is truncated to 0
|
|
2583 |
else if(iVolume < 0)
|
|
2584 |
{
|
|
2585 |
TInt volume;
|
|
2586 |
|
|
2587 |
aRecUtil->SetVolume(iVolume);
|
|
2588 |
aRecUtil->GetVolume(volume);
|
|
2589 |
if(volume == 0)
|
|
2590 |
{
|
|
2591 |
ret = EPass;
|
|
2592 |
}
|
|
2593 |
}
|
|
2594 |
// Set volume and check
|
|
2595 |
else
|
|
2596 |
{
|
|
2597 |
TInt volume;
|
|
2598 |
aRecUtil->SetVolume(iVolume);
|
|
2599 |
aRecUtil->GetVolume(volume);
|
|
2600 |
if(volume == iVolume)
|
|
2601 |
{
|
|
2602 |
ret = EPass;
|
|
2603 |
}
|
|
2604 |
|
|
2605 |
else
|
|
2606 |
{
|
|
2607 |
INFO_PRINTF3( _L("Expected volume: %d, received volume : %d"), iVolume, volume);
|
|
2608 |
}
|
|
2609 |
}
|
|
2610 |
|
|
2611 |
return ret;
|
|
2612 |
}
|
|
2613 |
|
|
2614 |
|
|
2615 |
CTestMmfAclntAudioRecordRamp::CTestMmfAclntAudioRecordRamp(const TDesC& aTestName, const TDesC& aSectName,TBool aNegative)
|
|
2616 |
: CTestMmfAclntRecord(aTestName, aSectName,aNegative)
|
|
2617 |
{}
|
|
2618 |
|
|
2619 |
CTestMmfAclntAudioRecordRamp* CTestMmfAclntAudioRecordRamp::NewL(const TDesC& aTestName, const TDesC& aSectName,TBool aNegative)
|
|
2620 |
{
|
|
2621 |
CTestMmfAclntAudioRecordRamp* self = new (ELeave) CTestMmfAclntAudioRecordRamp(aTestName, aSectName,aNegative);
|
|
2622 |
return self;
|
|
2623 |
}
|
|
2624 |
|
|
2625 |
TVerdict CTestMmfAclntAudioRecordRamp::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
2626 |
{
|
|
2627 |
INFO_PRINTF1( _L("TestRecordUtils : Audio Ramp"));
|
|
2628 |
TVerdict ret = EFail;
|
|
2629 |
TTimeIntervalMicroSeconds ramp(100);
|
|
2630 |
aRecUtil->SetVolumeRamp(ramp);
|
|
2631 |
|
|
2632 |
aRecUtil->RecordL();
|
|
2633 |
CActiveScheduler::Start(); // wait for open -> record
|
|
2634 |
if (iError != KErrNone)
|
|
2635 |
{
|
|
2636 |
// DEF127335
|
|
2637 |
// OggRecordController does not support recording into an already existing file.
|
|
2638 |
// This is due to unavailability of APIs at the level of Ogg Vorbis C libraries.
|
|
2639 |
if (iTestStepName == _L("MM-MMF-ACLNTOGG-I-0123-HP") && iError == KErrNotSupported)
|
|
2640 |
{
|
|
2641 |
INFO_PRINTF1(_L("Expected Result: OggRecordController returned KErrNotSupported(-5)"));
|
|
2642 |
return EPass;
|
|
2643 |
}
|
|
2644 |
else
|
|
2645 |
{
|
|
2646 |
return EFail;
|
|
2647 |
}
|
|
2648 |
}
|
|
2649 |
|
|
2650 |
iReportedState = aRecUtil->State();
|
|
2651 |
if(iReportedState == CMdaAudioClipUtility::ERecording )
|
|
2652 |
{
|
|
2653 |
ret = EPass;
|
|
2654 |
}
|
|
2655 |
|
|
2656 |
User::After(KOneSecond);
|
|
2657 |
aRecUtil->Stop();
|
|
2658 |
|
|
2659 |
return ret;
|
|
2660 |
}
|
|
2661 |
|
|
2662 |
|
|
2663 |
//------------------------------------------------------------------
|
|
2664 |
|
|
2665 |
|
|
2666 |
CTestMmfAclntRecordDestChannels::CTestMmfAclntRecordDestChannels(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aNumberOfChannels,const TTestFormat aFormat, const TBool aCreateDes)
|
|
2667 |
{
|
|
2668 |
// store the name of this test case
|
|
2669 |
// this is the name that is used by the script file
|
|
2670 |
// Each test step initialises it's own name
|
|
2671 |
iTestStepName = aTestName;
|
|
2672 |
iSectName = aSectName;
|
|
2673 |
iKeyName = aKeyName;
|
|
2674 |
iTestFormat = aFormat;
|
|
2675 |
iCreateDes = aCreateDes;
|
|
2676 |
iNumberOfChannels=aNumberOfChannels;
|
|
2677 |
|
|
2678 |
iSize = 0;
|
|
2679 |
iAudio = NULL;
|
|
2680 |
}
|
|
2681 |
|
|
2682 |
CTestMmfAclntRecordDestChannels* CTestMmfAclntRecordDestChannels::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aNumberOfChannels, const TTestFormat aFormat,const TBool aCreateDes)
|
|
2683 |
{
|
|
2684 |
CTestMmfAclntRecordDestChannels* self = new (ELeave) CTestMmfAclntRecordDestChannels(aTestName,aSectName,aKeyName,aNumberOfChannels,aFormat,aCreateDes);
|
|
2685 |
return self;
|
|
2686 |
}
|
|
2687 |
|
|
2688 |
CTestMmfAclntRecordDestChannels* CTestMmfAclntRecordDestChannels::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TInt aNumberOfChannels, const TTestFormat aFormat, const TBool aCreateDes)
|
|
2689 |
{
|
|
2690 |
CTestMmfAclntRecordDestChannels* self = CTestMmfAclntRecordDestChannels::NewLC(aTestName,aSectName,aKeyName,aNumberOfChannels,aFormat,aCreateDes);
|
|
2691 |
CleanupStack::PushL(self);
|
|
2692 |
return self;
|
|
2693 |
}
|
|
2694 |
|
|
2695 |
void CTestMmfAclntRecordDestChannels::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
|
|
2696 |
{
|
|
2697 |
iError = aErrorCode;
|
|
2698 |
INFO_PRINTF4( _L("MMdaObjectStateChangeObserver: previous state: %d current state: %d error: %d"),aPreviousState, aCurrentState, aErrorCode);
|
|
2699 |
CActiveScheduler::Stop();
|
|
2700 |
}
|
|
2701 |
|
|
2702 |
TVerdict CTestMmfAclntRecordDestChannels::DoTestStepPreambleL()
|
|
2703 |
{
|
|
2704 |
SetupFormatL(iTestFormat);
|
|
2705 |
|
|
2706 |
switch (iTestFormat)
|
|
2707 |
{
|
|
2708 |
case EPcm16Wav:
|
|
2709 |
case EAlawWav:
|
|
2710 |
case EPcm8:
|
|
2711 |
iHeaderSize = KWavFileUncompressedDataHeaderSize; //(see mmfwavformat.cpp, CreateSinkBufferOfSizeL())
|
|
2712 |
iFrameSize = 4096;
|
|
2713 |
break;
|
|
2714 |
case EImaAdpcmWav:
|
|
2715 |
case EImasPcmWav:
|
|
2716 |
iHeaderSize = KWavFileCompressedDataHeaderSize + KImaAdpcmFactChunkSize;
|
|
2717 |
iFrameSize = 4096;
|
|
2718 |
break;
|
|
2719 |
case EMulawRaw:
|
|
2720 |
case EPcmU8:
|
|
2721 |
case EPcmU16:
|
|
2722 |
iHeaderSize = 0;
|
|
2723 |
iFrameSize = 4096;
|
|
2724 |
break;
|
|
2725 |
case EGsmWav:
|
|
2726 |
iHeaderSize = KWavFileCompressedDataHeaderSize + KGSMFactChunkSize;
|
|
2727 |
iFrameSize = 4096;
|
|
2728 |
break;
|
|
2729 |
default:
|
|
2730 |
/*skip*/ ;
|
|
2731 |
}
|
|
2732 |
|
|
2733 |
if(!iCreateDes)
|
|
2734 |
{
|
|
2735 |
RFs fs;
|
|
2736 |
RFile file;
|
|
2737 |
|
|
2738 |
TBuf<KSizeBuf> filename;
|
|
2739 |
TPtrC filename1;
|
|
2740 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
2741 |
return EInconclusive;
|
|
2742 |
GetDriveName(filename);
|
|
2743 |
filename.Append(filename1);
|
|
2744 |
INFO_PRINTF2(_L("File for test - %S"), &filename);
|
|
2745 |
|
|
2746 |
User::LeaveIfError(fs.Connect());
|
|
2747 |
User::LeaveIfError(file.Open(fs,filename,EFileRead));
|
|
2748 |
CleanupClosePushL(file);
|
|
2749 |
|
|
2750 |
User::LeaveIfError(file.Size(iSize));
|
|
2751 |
INFO_PRINTF2(_L("size of file = %d\n"),iSize);//Statement Changed under DEF105143
|
|
2752 |
iAudio = HBufC8::NewMaxL(iSize);
|
|
2753 |
|
|
2754 |
// Read a file into a descriptor
|
|
2755 |
TPtr8 bufferDes(iAudio->Des());
|
|
2756 |
User::LeaveIfError(file.Read(bufferDes));
|
|
2757 |
|
|
2758 |
CleanupStack::PopAndDestroy(); //file
|
|
2759 |
}
|
|
2760 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
|
2761 |
}
|
|
2762 |
|
|
2763 |
TVerdict CTestMmfAclntRecordDestChannels::DoTestStepPostambleL()
|
|
2764 |
{
|
|
2765 |
delete iAudio;
|
|
2766 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
2767 |
}
|
|
2768 |
|
|
2769 |
/**
|
|
2770 |
* Open a descriptor and record
|
|
2771 |
*/
|
|
2772 |
TVerdict CTestMmfAclntRecordDestChannels::DoTestStepL( void )
|
|
2773 |
{
|
|
2774 |
INFO_PRINTF1( _L("TestRecorder : Record Des"));
|
|
2775 |
TVerdict ret = EFail;
|
|
2776 |
HBufC8* audio = NULL;
|
|
2777 |
TMdaDesClipLocation* location = NULL;
|
|
2778 |
TInt err = KErrNone;
|
|
2779 |
RArray<TUint> channels;
|
|
2780 |
|
|
2781 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
2782 |
CleanupStack::PushL(recUtil);
|
|
2783 |
|
|
2784 |
// Add create file for Ogg-tests
|
|
2785 |
if(iSectName == _L("SectionOggRec"))
|
|
2786 |
{
|
|
2787 |
TBuf<KSizeBuf> filename;
|
|
2788 |
TPtrC filename1;
|
|
2789 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
2790 |
{
|
|
2791 |
return EInconclusive;
|
|
2792 |
}
|
|
2793 |
|
|
2794 |
GetDriveName(filename);
|
|
2795 |
filename.Append(filename1);
|
|
2796 |
|
|
2797 |
RFs fs;
|
|
2798 |
User::LeaveIfError(fs.Connect());
|
|
2799 |
RFile file;
|
|
2800 |
User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
|
|
2801 |
file.Close();
|
|
2802 |
fs.Close();
|
|
2803 |
recUtil->OpenFileL(filename);
|
|
2804 |
}
|
|
2805 |
else if(!iCreateDes)
|
|
2806 |
{
|
|
2807 |
audio=iAudio;
|
|
2808 |
TPtr8 bufferDes(iAudio->Des());
|
|
2809 |
recUtil->OpenDesL(bufferDes);
|
|
2810 |
}
|
|
2811 |
else
|
|
2812 |
{
|
|
2813 |
iSize = KRecSize; // value is not been set yet.
|
|
2814 |
audio = HBufC8::NewMaxLC(iSize);
|
|
2815 |
TPtr8 bufferDes(audio->Des());
|
|
2816 |
bufferDes.SetLength(0);
|
|
2817 |
location = new (ELeave) TMdaDesClipLocation(bufferDes);
|
|
2818 |
recUtil->OpenL(location,iFormat,iCodec,&iAudioSettings);
|
|
2819 |
|
|
2820 |
delete location;
|
|
2821 |
}
|
|
2822 |
|
|
2823 |
iError = KErrTimedOut;
|
|
2824 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
2825 |
CActiveScheduler::Start();
|
|
2826 |
TInt numChannels=-1;
|
|
2827 |
if(iError == KErrNone)
|
|
2828 |
{
|
|
2829 |
TRAP(err,recUtil->GetSupportedNumberOfChannelsL(channels));
|
|
2830 |
if(err!=KErrNone)
|
|
2831 |
{
|
|
2832 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::GetSupportedNumberOfChannelsL leave with error %d"),err);
|
|
2833 |
if(iCreateDes)
|
|
2834 |
{
|
|
2835 |
CleanupStack::PopAndDestroy(audio);
|
|
2836 |
}
|
|
2837 |
|
|
2838 |
CleanupStack::PopAndDestroy(recUtil);
|
|
2839 |
User::After(KOneSecond);
|
|
2840 |
return ret;
|
|
2841 |
}
|
|
2842 |
TRAP(err,recUtil->SetDestinationNumberOfChannelsL(1));//@@@
|
|
2843 |
if(err!=KErrNone)
|
|
2844 |
{
|
|
2845 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::SetDestinationNumberOfChannelsL leave with error %d"),err);
|
|
2846 |
if(iCreateDes)
|
|
2847 |
{
|
|
2848 |
CleanupStack::PopAndDestroy(audio);
|
|
2849 |
}
|
|
2850 |
|
|
2851 |
CleanupStack::PopAndDestroy(recUtil);
|
|
2852 |
User::After(KOneSecond);
|
|
2853 |
return ret;
|
|
2854 |
}
|
|
2855 |
TRAP(err,numChannels = recUtil->DestinationNumberOfChannelsL());
|
|
2856 |
if(err!=KErrNone)
|
|
2857 |
{
|
|
2858 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::DestinationNumberOfChannelsL leave with error %d"),err);
|
|
2859 |
if(iCreateDes)
|
|
2860 |
{
|
|
2861 |
CleanupStack::PopAndDestroy(audio);
|
|
2862 |
}
|
|
2863 |
|
|
2864 |
CleanupStack::PopAndDestroy(recUtil);
|
|
2865 |
User::After(KOneSecond);
|
|
2866 |
return ret;
|
|
2867 |
}
|
|
2868 |
}
|
|
2869 |
|
|
2870 |
if(numChannels==iNumberOfChannels)
|
|
2871 |
{
|
|
2872 |
ret = EPass;
|
|
2873 |
}
|
|
2874 |
|
|
2875 |
|
|
2876 |
if (ret != EPass)
|
|
2877 |
{
|
|
2878 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility failed with error %d"),iError );
|
|
2879 |
}
|
|
2880 |
|
|
2881 |
if(iCreateDes)
|
|
2882 |
{
|
|
2883 |
CleanupStack::PopAndDestroy(audio);
|
|
2884 |
}
|
|
2885 |
|
|
2886 |
CleanupStack::PopAndDestroy(recUtil);
|
|
2887 |
User::After(KOneSecond);
|
|
2888 |
return ret;
|
|
2889 |
}
|
|
2890 |
|
|
2891 |
|
|
2892 |
|
|
2893 |
//------------------------------------------------------------------
|
|
2894 |
|
|
2895 |
CTestMmfAclntRecordSetPriority::CTestMmfAclntRecordSetPriority(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
2896 |
: CTestMmfAclntRecord(aTestName, aSectName,aNegative)
|
|
2897 |
{}
|
|
2898 |
|
|
2899 |
CTestMmfAclntRecordSetPriority* CTestMmfAclntRecordSetPriority::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
2900 |
{
|
|
2901 |
CTestMmfAclntRecordSetPriority* self = new (ELeave) CTestMmfAclntRecordSetPriority(aTestName, aSectName,aNegative);
|
|
2902 |
return self;
|
|
2903 |
}
|
|
2904 |
|
|
2905 |
|
|
2906 |
TVerdict CTestMmfAclntRecordSetPriority::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
2907 |
{
|
|
2908 |
INFO_PRINTF1( _L("TestRecordUtils : SetPriority"));
|
|
2909 |
TVerdict ret = EPass;
|
|
2910 |
TInt err = KErrNone;
|
|
2911 |
TRAP(err,aRecUtil->SetPriority(EMdaPriorityMin,EMdaPriorityPreferenceNone));
|
|
2912 |
if(err!=KErrNone)
|
|
2913 |
{
|
|
2914 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::SetPriority (1st call) leave with error %d"),err);
|
|
2915 |
ret = EFail;
|
|
2916 |
}
|
|
2917 |
|
|
2918 |
TRAP(err,aRecUtil->SetPriority(EMdaPriorityNormal,EMdaPriorityPreferenceTime));
|
|
2919 |
if(err!=KErrNone)
|
|
2920 |
{
|
|
2921 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::SetPriority (2nd call) leave with error %d"),err);
|
|
2922 |
ret = EFail;
|
|
2923 |
}
|
|
2924 |
|
|
2925 |
TRAP(err,aRecUtil->SetPriority(EMdaPriorityMax,EMdaPriorityPreferenceTimeAndQuality));
|
|
2926 |
if(err!=KErrNone)
|
|
2927 |
{
|
|
2928 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::SetPriority (3rd call) leave with error %d"),err);
|
|
2929 |
ret = EFail;
|
|
2930 |
}
|
|
2931 |
return ret;
|
|
2932 |
}
|
|
2933 |
|
|
2934 |
|
|
2935 |
//------------------------------------------------------------------
|
|
2936 |
|
|
2937 |
CTestMmfAclntRecordDestSampleRate::CTestMmfAclntRecordDestSampleRate(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName,const TTestFormat aFormat, const TBool aCreateDes)
|
|
2938 |
{
|
|
2939 |
// store the name of this test case
|
|
2940 |
// this is the name that is used by the script file
|
|
2941 |
// Each test step initialises it's own name
|
|
2942 |
iTestStepName = aTestName;
|
|
2943 |
iSectName = aSectName;
|
|
2944 |
iKeyName = aKeyName;
|
|
2945 |
iTestFormat = aFormat;
|
|
2946 |
iCreateDes = aCreateDes;
|
|
2947 |
|
|
2948 |
iSize = 0;
|
|
2949 |
iAudio = NULL;
|
|
2950 |
}
|
|
2951 |
|
|
2952 |
CTestMmfAclntRecordDestSampleRate* CTestMmfAclntRecordDestSampleRate::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat,const TBool aCreateDes)
|
|
2953 |
{
|
|
2954 |
CTestMmfAclntRecordDestSampleRate* self = new (ELeave) CTestMmfAclntRecordDestSampleRate(aTestName,aSectName,aKeyName,aFormat,aCreateDes);
|
|
2955 |
return self;
|
|
2956 |
}
|
|
2957 |
|
|
2958 |
CTestMmfAclntRecordDestSampleRate* CTestMmfAclntRecordDestSampleRate::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat, const TBool aCreateDes)
|
|
2959 |
{
|
|
2960 |
CTestMmfAclntRecordDestSampleRate* self = CTestMmfAclntRecordDestSampleRate::NewLC(aTestName,aSectName,aKeyName,aFormat,aCreateDes);
|
|
2961 |
CleanupStack::PushL(self);
|
|
2962 |
return self;
|
|
2963 |
}
|
|
2964 |
|
|
2965 |
void CTestMmfAclntRecordDestSampleRate::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
|
|
2966 |
{
|
|
2967 |
iError = aErrorCode;
|
|
2968 |
INFO_PRINTF4( _L("MMdaObjectStateChangeObserver: previous state: %d current state: %d error: %d"),aPreviousState, aCurrentState, aErrorCode);
|
|
2969 |
CActiveScheduler::Stop();
|
|
2970 |
}
|
|
2971 |
|
|
2972 |
TVerdict CTestMmfAclntRecordDestSampleRate::DoTestStepPreambleL()
|
|
2973 |
{
|
|
2974 |
SetupFormatL(iTestFormat);
|
|
2975 |
|
|
2976 |
switch (iTestFormat)
|
|
2977 |
{
|
|
2978 |
case EPcm16Wav:
|
|
2979 |
case EAlawWav:
|
|
2980 |
case EPcm8:
|
|
2981 |
iHeaderSize = KWavFileUncompressedDataHeaderSize; //(see mmfwavformat.cpp, CreateSinkBufferOfSizeL())
|
|
2982 |
iFrameSize = 4096;
|
|
2983 |
break;
|
|
2984 |
case EImaAdpcmWav:
|
|
2985 |
case EImasPcmWav:
|
|
2986 |
iHeaderSize = KWavFileCompressedDataHeaderSize + KImaAdpcmFactChunkSize;
|
|
2987 |
iFrameSize = 4096;
|
|
2988 |
break;
|
|
2989 |
case EMulawRaw:
|
|
2990 |
case EPcmU8:
|
|
2991 |
case EPcmU16:
|
|
2992 |
iHeaderSize = 0;
|
|
2993 |
iFrameSize = 4096;
|
|
2994 |
break;
|
|
2995 |
case EGsmWav:
|
|
2996 |
iHeaderSize = KWavFileCompressedDataHeaderSize + KGSMFactChunkSize;
|
|
2997 |
iFrameSize = 4096;
|
|
2998 |
break;
|
|
2999 |
default:
|
|
3000 |
/*skip*/ ;
|
|
3001 |
}
|
|
3002 |
|
|
3003 |
if(!iCreateDes)
|
|
3004 |
{
|
|
3005 |
RFs fs;
|
|
3006 |
RFile file;
|
|
3007 |
|
|
3008 |
TBuf<KSizeBuf> filename;
|
|
3009 |
TPtrC filename1;
|
|
3010 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
3011 |
return EInconclusive;
|
|
3012 |
GetDriveName(filename);
|
|
3013 |
filename.Append(filename1);
|
|
3014 |
INFO_PRINTF2(_L("File for test - %S"), &filename);
|
|
3015 |
|
|
3016 |
User::LeaveIfError(fs.Connect());
|
|
3017 |
User::LeaveIfError(file.Open(fs,filename,EFileRead));
|
|
3018 |
CleanupClosePushL(file);
|
|
3019 |
|
|
3020 |
User::LeaveIfError(file.Size(iSize));
|
|
3021 |
INFO_PRINTF2(_L("size of file = %d\n"),iSize);//Statement Changed under DEF105143
|
|
3022 |
iAudio = HBufC8::NewMaxL(iSize);
|
|
3023 |
|
|
3024 |
// Read a file into a descriptor
|
|
3025 |
TPtr8 bufferDes(iAudio->Des());
|
|
3026 |
User::LeaveIfError(file.Read(bufferDes));
|
|
3027 |
|
|
3028 |
CleanupStack::PopAndDestroy(); //file
|
|
3029 |
}
|
|
3030 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
|
3031 |
}
|
|
3032 |
|
|
3033 |
TVerdict CTestMmfAclntRecordDestSampleRate::DoTestStepPostambleL()
|
|
3034 |
{
|
|
3035 |
delete iAudio;
|
|
3036 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
3037 |
}
|
|
3038 |
|
|
3039 |
/**
|
|
3040 |
* Open a descriptor and record
|
|
3041 |
*/
|
|
3042 |
TVerdict CTestMmfAclntRecordDestSampleRate::DoTestStepL( void )
|
|
3043 |
{
|
|
3044 |
INFO_PRINTF1( _L("TestRecorder : Destination SampleRate"));
|
|
3045 |
TVerdict ret = EPass;
|
|
3046 |
HBufC8* audio = NULL;
|
|
3047 |
TMdaDesClipLocation* location = NULL;
|
|
3048 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
3049 |
CleanupStack::PushL(recUtil);
|
|
3050 |
|
|
3051 |
// Add create file for Ogg-tests
|
|
3052 |
if(iSectName == _L("SectionOggRec"))
|
|
3053 |
{
|
|
3054 |
TBuf<KSizeBuf> filename;
|
|
3055 |
TPtrC filename1;
|
|
3056 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
3057 |
return EInconclusive;
|
|
3058 |
GetDriveName(filename);
|
|
3059 |
filename.Append(filename1);
|
|
3060 |
|
|
3061 |
RFs fs;
|
|
3062 |
User::LeaveIfError(fs.Connect());
|
|
3063 |
RFile file;
|
|
3064 |
User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
|
|
3065 |
file.Close();
|
|
3066 |
fs.Close();
|
|
3067 |
recUtil->OpenFileL(filename);
|
|
3068 |
}
|
|
3069 |
else if(!iCreateDes)
|
|
3070 |
{
|
|
3071 |
audio=iAudio;
|
|
3072 |
TPtr8 bufferDes(iAudio->Des());
|
|
3073 |
recUtil->OpenDesL(bufferDes);
|
|
3074 |
}
|
|
3075 |
else
|
|
3076 |
{
|
|
3077 |
iSize = KRecSize; // value is not been set yet.
|
|
3078 |
audio = HBufC8::NewMaxLC(iSize);
|
|
3079 |
TPtr8 bufferDes(audio->Des());
|
|
3080 |
bufferDes.SetLength(0);
|
|
3081 |
location = new (ELeave) TMdaDesClipLocation(bufferDes);
|
|
3082 |
recUtil->OpenL(location,iFormat,iCodec,&iAudioSettings);
|
|
3083 |
|
|
3084 |
delete location;
|
|
3085 |
}
|
|
3086 |
CActiveScheduler::Start();
|
|
3087 |
|
|
3088 |
iError = KErrTimedOut;
|
|
3089 |
TInt err = KErrNone;
|
|
3090 |
RArray<TUint> rates;
|
|
3091 |
TRAP(err,recUtil->GetSupportedSampleRatesL(rates));
|
|
3092 |
if(err!=KErrNone)
|
|
3093 |
{
|
|
3094 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::GetSupportedSampleRatesL leave with error %d"),err);
|
|
3095 |
ret = EFail;
|
|
3096 |
if(iCreateDes)
|
|
3097 |
CleanupStack::PopAndDestroy(audio);
|
|
3098 |
CleanupStack::PopAndDestroy(recUtil);
|
|
3099 |
User::After(KOneSecond);
|
|
3100 |
return ret;
|
|
3101 |
}
|
|
3102 |
|
|
3103 |
TInt numRates = rates.Count();
|
|
3104 |
for(TInt i=0;i<numRates;i++)
|
|
3105 |
{
|
|
3106 |
|
|
3107 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::SetDestinationSampleRateL(%d)"),rates[i]);
|
|
3108 |
TUint sr = rates[i];
|
|
3109 |
TRAP(err,recUtil->SetDestinationSampleRateL(sr));
|
|
3110 |
if(err!=KErrNone)
|
|
3111 |
{
|
|
3112 |
INFO_PRINTF3(_L("CMdaAudioRecorderUtility::SetDestinationSampleRateL(%d) leave with error : %d"),sr,err);
|
|
3113 |
ret = EFail;
|
|
3114 |
break;
|
|
3115 |
}
|
|
3116 |
|
|
3117 |
TUint rate=0;
|
|
3118 |
TRAP(err,rate = recUtil->DestinationSampleRateL());
|
|
3119 |
if(err!=KErrNone)
|
|
3120 |
{
|
|
3121 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::DestinationSampleRateL leave with error %d"),err);
|
|
3122 |
ret = EFail;
|
|
3123 |
}
|
|
3124 |
else
|
|
3125 |
{
|
|
3126 |
if(rate!=rates[i])
|
|
3127 |
{
|
|
3128 |
ret = EFail;
|
|
3129 |
INFO_PRINTF1(_L("Rate mismatch"));
|
|
3130 |
}
|
|
3131 |
else
|
|
3132 |
{
|
|
3133 |
INFO_PRINTF1(_L("Rates match"));
|
|
3134 |
}
|
|
3135 |
}
|
|
3136 |
|
|
3137 |
}
|
|
3138 |
if(iCreateDes)
|
|
3139 |
CleanupStack::PopAndDestroy(audio);
|
|
3140 |
CleanupStack::PopAndDestroy(recUtil);
|
|
3141 |
User::After(KOneSecond);
|
|
3142 |
return ret;
|
|
3143 |
}
|
|
3144 |
//------------------------------------------------------------------
|
|
3145 |
|
|
3146 |
CTestMmfAclntRecordDestBitRate::CTestMmfAclntRecordDestBitRate(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
3147 |
: CTestMmfAclntRecord(aTestName, aSectName, aNegative)
|
|
3148 |
{}
|
|
3149 |
|
|
3150 |
CTestMmfAclntRecordDestBitRate* CTestMmfAclntRecordDestBitRate::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
3151 |
{
|
|
3152 |
CTestMmfAclntRecordDestBitRate* self = new (ELeave) CTestMmfAclntRecordDestBitRate(aTestName, aSectName, aNegative);
|
|
3153 |
return self;
|
|
3154 |
}
|
|
3155 |
|
|
3156 |
|
|
3157 |
TVerdict CTestMmfAclntRecordDestBitRate::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
3158 |
{
|
|
3159 |
INFO_PRINTF1( _L("TestRecordUtils : Destination Bit Rate"));
|
|
3160 |
TVerdict ret = EPass;
|
|
3161 |
TInt err = KErrNone;
|
|
3162 |
|
|
3163 |
// Add create file for Ogg-tests
|
|
3164 |
if(iSectName == _L("SectionOggRec"))
|
|
3165 |
{
|
|
3166 |
TPtrC filename;
|
|
3167 |
if (!GetStringFromConfig(iSectName, _L("outputAudioFile"), filename))
|
|
3168 |
{
|
|
3169 |
INFO_PRINTF1(_L("Error getting filename from INI file"));
|
|
3170 |
return EInconclusive;
|
|
3171 |
}
|
|
3172 |
RFs fs;
|
|
3173 |
User::LeaveIfError(fs.Connect());
|
|
3174 |
RFile file;
|
|
3175 |
User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
|
|
3176 |
file.Close();
|
|
3177 |
fs.Close();
|
|
3178 |
// Open the file
|
|
3179 |
aRecUtil->OpenFileL(filename);
|
|
3180 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility->OpenFileL(%S)"), &filename);
|
|
3181 |
CActiveScheduler::Start();
|
|
3182 |
if (iError != KErrNone)
|
|
3183 |
{
|
|
3184 |
INFO_PRINTF2(_L("Error opening file for recording"), iError);
|
|
3185 |
return EInconclusive;
|
|
3186 |
}
|
|
3187 |
}
|
|
3188 |
|
|
3189 |
RArray<TUint> rates;
|
|
3190 |
TRAP(err,aRecUtil->GetSupportedBitRatesL(rates));
|
|
3191 |
// in Typhoon KErrNotSupported is expected
|
|
3192 |
if(err==KErrNotSupported)
|
|
3193 |
{
|
|
3194 |
//test the other bitrate functions for code coverage (and behaviour)
|
|
3195 |
TRAP(err,aRecUtil->SetDestinationBitRateL(100)); // arbitrary value since KErrNotSupported is expected anyway
|
|
3196 |
if (err != KErrNotSupported)
|
|
3197 |
{
|
|
3198 |
return EFail;
|
|
3199 |
}
|
|
3200 |
|
|
3201 |
TInt rate=0;
|
|
3202 |
TRAP(err, rate=aRecUtil->DestinationBitRateL());
|
|
3203 |
if (err != KErrNone)
|
|
3204 |
{
|
|
3205 |
return EFail;
|
|
3206 |
}
|
|
3207 |
|
|
3208 |
INFO_PRINTF3(_L("CMdaAudioRecorderUtility::GetSupportedBitRatesL() leave with error %d bitrate of %d"),err, rate);
|
|
3209 |
ret = EPass;
|
|
3210 |
return ret;
|
|
3211 |
}
|
|
3212 |
if(err!=KErrNone)
|
|
3213 |
{
|
|
3214 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::GetSupportedBitRatesL leave with error %d"),err);
|
|
3215 |
ret = EFail;
|
|
3216 |
return ret;
|
|
3217 |
}
|
|
3218 |
|
|
3219 |
TInt numRates = rates.Count();
|
|
3220 |
for(TInt i=0;i<numRates;i++)
|
|
3221 |
{
|
|
3222 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::SetDestinationBitRateL (%d)"),rates[i]);
|
|
3223 |
TRAP(err,aRecUtil->SetDestinationBitRateL(rates[i]));
|
|
3224 |
if(err!=KErrNone)
|
|
3225 |
{
|
|
3226 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::SetDestinationBitRateL leave with error %d"),err);
|
|
3227 |
ret = EFail;
|
|
3228 |
}
|
|
3229 |
else// no error, get rate
|
|
3230 |
{
|
|
3231 |
TUint rate=0;
|
|
3232 |
TRAP(err,rate = aRecUtil->DestinationBitRateL());
|
|
3233 |
if(err!=KErrNone)
|
|
3234 |
{
|
|
3235 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::DestinationBitRateL leave with error %d"),err);
|
|
3236 |
ret = EFail;
|
|
3237 |
}
|
|
3238 |
else
|
|
3239 |
{
|
|
3240 |
if(rate!=rates[i])
|
|
3241 |
{
|
|
3242 |
ret = EFail;
|
|
3243 |
INFO_PRINTF1(_L("Rate mismatch"));
|
|
3244 |
}
|
|
3245 |
else
|
|
3246 |
{
|
|
3247 |
INFO_PRINTF1(_L("Rates match"));
|
|
3248 |
}
|
|
3249 |
}
|
|
3250 |
}
|
|
3251 |
}
|
|
3252 |
return ret;
|
|
3253 |
}
|
|
3254 |
|
|
3255 |
|
|
3256 |
//------------------------------------------------------------------
|
|
3257 |
|
|
3258 |
|
|
3259 |
|
|
3260 |
CTestMmfAclntRecordDestDataType::CTestMmfAclntRecordDestDataType(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat, const TBool aCreateDes)
|
|
3261 |
{
|
|
3262 |
// store the name of this test case
|
|
3263 |
// this is the name that is used by the script file
|
|
3264 |
// Each test step initialises it's own name
|
|
3265 |
iTestStepName = aTestName;
|
|
3266 |
iSectName = aSectName;
|
|
3267 |
iKeyName = aKeyName;
|
|
3268 |
iTestFormat = aFormat;
|
|
3269 |
iCreateDes = aCreateDes;
|
|
3270 |
iSize = 0;
|
|
3271 |
iAudio = NULL;
|
|
3272 |
}
|
|
3273 |
|
|
3274 |
CTestMmfAclntRecordDestDataType* CTestMmfAclntRecordDestDataType::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat,const TBool aCreateDes)
|
|
3275 |
{
|
|
3276 |
CTestMmfAclntRecordDestDataType* self = new (ELeave) CTestMmfAclntRecordDestDataType(aTestName,aSectName,aKeyName,aFormat,aCreateDes);
|
|
3277 |
return self;
|
|
3278 |
}
|
|
3279 |
|
|
3280 |
CTestMmfAclntRecordDestDataType* CTestMmfAclntRecordDestDataType::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TTestFormat aFormat, const TBool aCreateDes)
|
|
3281 |
{
|
|
3282 |
CTestMmfAclntRecordDestDataType* self = CTestMmfAclntRecordDestDataType::NewLC(aTestName,aSectName,aKeyName,aFormat,aCreateDes);
|
|
3283 |
CleanupStack::PushL(self);
|
|
3284 |
return self;
|
|
3285 |
}
|
|
3286 |
|
|
3287 |
void CTestMmfAclntRecordDestDataType::MoscoStateChangeEvent(CBase* /*aObject*/, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
|
|
3288 |
{
|
|
3289 |
iError = aErrorCode;
|
|
3290 |
INFO_PRINTF4( _L("MMdaObjectStateChangeObserver: previous state: %d current state: %d error: %d"),aPreviousState, aCurrentState, aErrorCode);
|
|
3291 |
CActiveScheduler::Stop();
|
|
3292 |
}
|
|
3293 |
|
|
3294 |
TVerdict CTestMmfAclntRecordDestDataType::DoTestStepPreambleL()
|
|
3295 |
{
|
|
3296 |
SetupFormatL(iTestFormat);
|
|
3297 |
|
|
3298 |
switch (iTestFormat)
|
|
3299 |
{
|
|
3300 |
case EPcm16Wav:
|
|
3301 |
case EAlawWav:
|
|
3302 |
case EPcm8:
|
|
3303 |
iHeaderSize = KWavFileUncompressedDataHeaderSize; //(see mmfwavformat.cpp, CreateSinkBufferOfSizeL())
|
|
3304 |
iFrameSize = 4096;
|
|
3305 |
break;
|
|
3306 |
case EImaAdpcmWav:
|
|
3307 |
case EImasPcmWav:
|
|
3308 |
iHeaderSize = KWavFileCompressedDataHeaderSize + KImaAdpcmFactChunkSize;
|
|
3309 |
iFrameSize = 4096;
|
|
3310 |
break;
|
|
3311 |
case EMulawRaw:
|
|
3312 |
case EPcmU8:
|
|
3313 |
case EPcmU16:
|
|
3314 |
iHeaderSize = 0;
|
|
3315 |
iFrameSize = 4096;
|
|
3316 |
break;
|
|
3317 |
case EGsmWav:
|
|
3318 |
iHeaderSize = KWavFileCompressedDataHeaderSize + KGSMFactChunkSize;
|
|
3319 |
iFrameSize = 4096;
|
|
3320 |
break;
|
|
3321 |
default:
|
|
3322 |
/*skip*/ ;
|
|
3323 |
}
|
|
3324 |
|
|
3325 |
if(!iCreateDes)
|
|
3326 |
{
|
|
3327 |
RFs fs;
|
|
3328 |
RFile file;
|
|
3329 |
|
|
3330 |
TBuf<KSizeBuf> filename;
|
|
3331 |
TPtrC filename1;
|
|
3332 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
3333 |
{
|
|
3334 |
return EInconclusive;
|
|
3335 |
}
|
|
3336 |
|
|
3337 |
GetDriveName(filename);
|
|
3338 |
filename.Append(filename1);
|
|
3339 |
INFO_PRINTF2(_L("File for test - %S"), &filename);
|
|
3340 |
|
|
3341 |
User::LeaveIfError(fs.Connect());
|
|
3342 |
User::LeaveIfError(file.Open(fs,filename,EFileRead));
|
|
3343 |
CleanupClosePushL(file);
|
|
3344 |
|
|
3345 |
User::LeaveIfError(file.Size(iSize));
|
|
3346 |
INFO_PRINTF2(_L("size of file = %d\n"),iSize);//Statement Changed under DEF105143
|
|
3347 |
iAudio = HBufC8::NewMaxL(iSize);
|
|
3348 |
|
|
3349 |
// Read a file into a descriptor
|
|
3350 |
TPtr8 bufferDes(iAudio->Des());
|
|
3351 |
User::LeaveIfError(file.Read(bufferDes));
|
|
3352 |
|
|
3353 |
CleanupStack::PopAndDestroy(); //file
|
|
3354 |
}
|
|
3355 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
|
3356 |
}
|
|
3357 |
|
|
3358 |
TVerdict CTestMmfAclntRecordDestDataType::DoTestStepPostambleL()
|
|
3359 |
{
|
|
3360 |
delete iAudio;
|
|
3361 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
3362 |
}
|
|
3363 |
|
|
3364 |
/**
|
|
3365 |
* Open a descriptor and record
|
|
3366 |
*/
|
|
3367 |
TVerdict CTestMmfAclntRecordDestDataType::DoTestStepL( void )
|
|
3368 |
{
|
|
3369 |
HBufC8* audio = NULL;
|
|
3370 |
TMdaDesClipLocation* location = NULL;
|
|
3371 |
TInt err = KErrNone;
|
|
3372 |
|
|
3373 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
3374 |
CleanupStack::PushL(recUtil);
|
|
3375 |
|
|
3376 |
// Add create file for Ogg-tests
|
|
3377 |
if(iSectName == _L("SectionOggRec"))
|
|
3378 |
{
|
|
3379 |
TBuf<KSizeBuf> filename;
|
|
3380 |
TPtrC filename1;
|
|
3381 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
3382 |
{
|
|
3383 |
return EInconclusive;
|
|
3384 |
}
|
|
3385 |
|
|
3386 |
GetDriveName(filename);
|
|
3387 |
filename.Append(filename1);
|
|
3388 |
|
|
3389 |
RFs fs;
|
|
3390 |
User::LeaveIfError(fs.Connect());
|
|
3391 |
RFile file;
|
|
3392 |
User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
|
|
3393 |
file.Close();
|
|
3394 |
fs.Close();
|
|
3395 |
recUtil->OpenFileL(filename);
|
|
3396 |
}
|
|
3397 |
else if(!iCreateDes)
|
|
3398 |
{
|
|
3399 |
audio=iAudio;
|
|
3400 |
TPtr8 bufferDes(iAudio->Des());
|
|
3401 |
recUtil->OpenDesL(bufferDes);
|
|
3402 |
}
|
|
3403 |
else
|
|
3404 |
{
|
|
3405 |
iSize = KRecSize; // value is not been set yet.
|
|
3406 |
audio = HBufC8::NewMaxLC(iSize);
|
|
3407 |
TPtr8 bufferDes(audio->Des());
|
|
3408 |
bufferDes.SetLength(0);
|
|
3409 |
location = new (ELeave) TMdaDesClipLocation(bufferDes);
|
|
3410 |
recUtil->OpenL(location,iFormat,iCodec,&iAudioSettings);
|
|
3411 |
|
|
3412 |
delete location;
|
|
3413 |
}
|
|
3414 |
CActiveScheduler::Start();
|
|
3415 |
|
|
3416 |
iError = KErrTimedOut;
|
|
3417 |
INFO_PRINTF1( _L("TestRecordUtils : Destination data type"));
|
|
3418 |
|
|
3419 |
RArray<TFourCC> codecs;
|
|
3420 |
recUtil->GetSupportedDestinationDataTypesL(codecs);
|
|
3421 |
TInt numCodecs = codecs.Count();
|
|
3422 |
TVerdict ret = EPass;
|
|
3423 |
for(TInt i=0;i<numCodecs;i++)
|
|
3424 |
{
|
|
3425 |
TRAP(err,recUtil->SetDestinationDataTypeL(codecs[i]));
|
|
3426 |
if(err!=KErrNone)
|
|
3427 |
{
|
|
3428 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::SetDestinationDataTypeL leave with error %d"),err);
|
|
3429 |
if(iCreateDes)
|
|
3430 |
CleanupStack::PopAndDestroy(audio);
|
|
3431 |
CleanupStack::PopAndDestroy(recUtil);
|
|
3432 |
User::After(KOneSecond);
|
|
3433 |
return ret;
|
|
3434 |
}
|
|
3435 |
TFourCC dataType;
|
|
3436 |
TRAP(err,dataType = recUtil->DestinationDataTypeL());
|
|
3437 |
if(err!=KErrNone)
|
|
3438 |
{
|
|
3439 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::DestinationDataTypeL leave with error %d"),err);
|
|
3440 |
if(iCreateDes)
|
|
3441 |
CleanupStack::PopAndDestroy(audio);
|
|
3442 |
CleanupStack::PopAndDestroy(recUtil);
|
|
3443 |
User::After(KOneSecond);
|
|
3444 |
return ret;
|
|
3445 |
}
|
|
3446 |
if(dataType!=codecs[i])
|
|
3447 |
{
|
|
3448 |
ret = EFail;
|
|
3449 |
}
|
|
3450 |
else
|
|
3451 |
{
|
|
3452 |
INFO_PRINTF1(_L("CMdaAudioRecorderUtility::DestinationDataType set-get OK"));
|
|
3453 |
}
|
|
3454 |
}
|
|
3455 |
if(iCreateDes)
|
|
3456 |
{
|
|
3457 |
CleanupStack::PopAndDestroy(audio);
|
|
3458 |
}
|
|
3459 |
|
|
3460 |
CleanupStack::PopAndDestroy(recUtil);
|
|
3461 |
User::After(KOneSecond);
|
|
3462 |
return ret;
|
|
3463 |
}
|
|
3464 |
|
|
3465 |
|
|
3466 |
|
|
3467 |
|
|
3468 |
//------------------------------------------------------------------
|
|
3469 |
|
|
3470 |
CTestMmfAclntRecordDestFormat::CTestMmfAclntRecordDestFormat(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative, const TUid aFormat)
|
|
3471 |
: CTestMmfAclntRecord(aTestName, aSectName, aNegative), iFormat(aFormat)
|
|
3472 |
{}
|
|
3473 |
|
|
3474 |
CTestMmfAclntRecordDestFormat* CTestMmfAclntRecordDestFormat::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative, const TUid aFormat)
|
|
3475 |
{
|
|
3476 |
CTestMmfAclntRecordDestFormat* self = new (ELeave) CTestMmfAclntRecordDestFormat(aTestName, aSectName, aNegative, aFormat);
|
|
3477 |
return self;
|
|
3478 |
}
|
|
3479 |
|
|
3480 |
|
|
3481 |
TVerdict CTestMmfAclntRecordDestFormat::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
3482 |
{
|
|
3483 |
// GET --> SET --> GET
|
|
3484 |
INFO_PRINTF1( _L("TestRecordUtils : Destination format"));
|
|
3485 |
TVerdict ret = EFail;
|
|
3486 |
TInt err = KErrNone;
|
|
3487 |
TRAP(err,iFormat = aRecUtil->DestinationFormatL());
|
|
3488 |
if(err!=KErrNone)
|
|
3489 |
{
|
|
3490 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::DestinationFormatL leave with error %d"),err);
|
|
3491 |
return ret;
|
|
3492 |
}
|
|
3493 |
TRAP(err,aRecUtil->SetDestinationFormatL(iFormat));
|
|
3494 |
if(err!=KErrNone)
|
|
3495 |
{
|
|
3496 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::SetDestinationFormatL leave with error %d"),err);
|
|
3497 |
return ret;
|
|
3498 |
}
|
|
3499 |
TUid format;
|
|
3500 |
TRAP(err,format = aRecUtil->DestinationFormatL());
|
|
3501 |
if(err!=KErrNone)
|
|
3502 |
{
|
|
3503 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility::DestinationFormatL leave with error %d"),err);
|
|
3504 |
return ret;
|
|
3505 |
}
|
|
3506 |
if(format==iFormat)
|
|
3507 |
{
|
|
3508 |
ret = EPass;
|
|
3509 |
}
|
|
3510 |
|
|
3511 |
return ret;
|
|
3512 |
}
|
|
3513 |
|
|
3514 |
|
|
3515 |
//------------------------------------------------------------------
|
|
3516 |
|
|
3517 |
CTestMmfAclntRecordAudioDeviceMode::CTestMmfAclntRecordAudioDeviceMode(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
3518 |
: CTestMmfAclntRecord(aTestName, aSectName, aNegative)
|
|
3519 |
{}
|
|
3520 |
|
|
3521 |
CTestMmfAclntRecordAudioDeviceMode* CTestMmfAclntRecordAudioDeviceMode::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
3522 |
{
|
|
3523 |
CTestMmfAclntRecordAudioDeviceMode* self = new (ELeave) CTestMmfAclntRecordAudioDeviceMode(aTestName, aSectName, aNegative);
|
|
3524 |
return self;
|
|
3525 |
}
|
|
3526 |
|
|
3527 |
|
|
3528 |
TVerdict CTestMmfAclntRecordAudioDeviceMode::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
3529 |
{
|
|
3530 |
INFO_PRINTF1( _L("TestRecordUtils : SetAudioDeviceMode"));
|
|
3531 |
INFO_PRINTF1( _L("This function is provided for binary compatibility, but does not have any effect from 7.0s"));
|
|
3532 |
|
|
3533 |
// Set the audio device mode. This function is provided for binary compatibility, but
|
|
3534 |
// does not have any effect from 7.0s
|
|
3535 |
aRecUtil->SetAudioDeviceMode(CMdaAudioRecorderUtility::EDefault);
|
|
3536 |
aRecUtil->SetAudioDeviceMode(CMdaAudioRecorderUtility::ETelephonyOrLocal);
|
|
3537 |
aRecUtil->SetAudioDeviceMode(CMdaAudioRecorderUtility::ETelephonyMixed);
|
|
3538 |
aRecUtil->SetAudioDeviceMode(CMdaAudioRecorderUtility::ETelephonyNonMixed);
|
|
3539 |
aRecUtil->SetAudioDeviceMode(CMdaAudioRecorderUtility::ELocal);
|
|
3540 |
TVerdict ret = EPass;
|
|
3541 |
return ret;
|
|
3542 |
}
|
|
3543 |
|
|
3544 |
|
|
3545 |
|
|
3546 |
|
|
3547 |
|
|
3548 |
|
|
3549 |
|
|
3550 |
|
|
3551 |
//
|
|
3552 |
//
|
|
3553 |
// CMdaAudioInputStream Integration Tests //
|
|
3554 |
//
|
|
3555 |
//
|
|
3556 |
|
|
3557 |
/**
|
|
3558 |
* Standard static NewL() taking a callback function
|
|
3559 |
*/
|
|
3560 |
CCallBackTimer* CCallBackTimer::NewL(TCallBack aCallBack, TPriority aPriority)
|
|
3561 |
{
|
|
3562 |
CCallBackTimer* self = new(ELeave) CCallBackTimer(aCallBack, aPriority);
|
|
3563 |
CleanupStack::PushL(self);
|
|
3564 |
self->ConstructL();
|
|
3565 |
CleanupStack::Pop(); // self
|
|
3566 |
return self;
|
|
3567 |
}
|
|
3568 |
|
|
3569 |
/**
|
|
3570 |
* Private c'tor
|
|
3571 |
*/
|
|
3572 |
CCallBackTimer::CCallBackTimer(TCallBack aCallBack, TPriority aPriority)
|
|
3573 |
: CTimer(aPriority),
|
|
3574 |
iCallBack(aCallBack)
|
|
3575 |
{
|
|
3576 |
CActiveScheduler::Add(this);
|
|
3577 |
}
|
|
3578 |
|
|
3579 |
/*
|
|
3580 |
* Callback on timer complete
|
|
3581 |
*/
|
|
3582 |
void CCallBackTimer::RunL()
|
|
3583 |
{
|
|
3584 |
iCallBack.CallBack();
|
|
3585 |
}
|
|
3586 |
|
|
3587 |
|
|
3588 |
_LIT(KStreamRawFile,"c:\\AclntITestData\\test.raw");
|
|
3589 |
_LIT(KRecordStreamRawFile,"c:\\AclntITestData\\streamrecorded.raw");
|
|
3590 |
CTestStepAudInStream* CTestStepAudInStream::NewL()
|
|
3591 |
{
|
|
3592 |
CTestStepAudInStream* s = new(ELeave) CTestStepAudInStream();
|
|
3593 |
CleanupStack::PushL(s);
|
|
3594 |
s->ConstructL();
|
|
3595 |
CleanupStack::Pop();
|
|
3596 |
return s;
|
|
3597 |
}
|
|
3598 |
|
|
3599 |
CTestStepAudInStream::CTestStepAudInStream() : iError(KErrNone), iState(EStopped)
|
|
3600 |
{
|
|
3601 |
|
|
3602 |
}
|
|
3603 |
|
|
3604 |
void CTestStepAudInStream::ConstructL()
|
|
3605 |
{
|
|
3606 |
// reset the buffer
|
|
3607 |
for(TInt i=0; i<KRecNumBuffer; i++)
|
|
3608 |
{
|
|
3609 |
iBufferList[i] = KNullDesC8;
|
|
3610 |
}
|
|
3611 |
iStartBuf=iEndBuf=0;
|
|
3612 |
}
|
|
3613 |
|
|
3614 |
CTestStepAudInStream::~CTestStepAudInStream()
|
|
3615 |
{
|
|
3616 |
}
|
|
3617 |
|
|
3618 |
void CTestStepAudInStream::MaiscOpenComplete(TInt aError)
|
|
3619 |
{
|
|
3620 |
iError = aError;
|
|
3621 |
CActiveScheduler::Stop();
|
|
3622 |
}
|
|
3623 |
|
|
3624 |
void CTestStepAudInStream::MaiscRecordComplete(TInt aError)
|
|
3625 |
{
|
|
3626 |
iError = aError;
|
|
3627 |
|
|
3628 |
iWriteBufferActive->Cancel();
|
|
3629 |
TInt filePosition=0;
|
|
3630 |
iFile.Seek(ESeekStart, filePosition);
|
|
3631 |
iFile.Close();
|
|
3632 |
CActiveScheduler::Stop();
|
|
3633 |
}
|
|
3634 |
|
|
3635 |
void CTestStepAudInStream::MaiscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/)
|
|
3636 |
{
|
|
3637 |
iError = aError;
|
|
3638 |
if(aError != KErrNone)
|
|
3639 |
{
|
|
3640 |
return;
|
|
3641 |
}
|
|
3642 |
// Assume aBuffer == iBufferList[iEndBuf]
|
|
3643 |
|
|
3644 |
// Increment iEndBuf
|
|
3645 |
if(iEndBuf==KRecNumBuffer-1)
|
|
3646 |
{
|
|
3647 |
iEndBuf = 0;
|
|
3648 |
}
|
|
3649 |
|
|
3650 |
else
|
|
3651 |
iEndBuf++;
|
|
3652 |
|
|
3653 |
// Starting writing out the buffers if we're not already
|
|
3654 |
if(!iWriteBufferActive->IsActive())
|
|
3655 |
{
|
|
3656 |
iWriteBufferActive->Write(iBufferList[iStartBuf]);
|
|
3657 |
}
|
|
3658 |
}
|
|
3659 |
|
|
3660 |
void CTestStepAudInStream::StartReadL()
|
|
3661 |
{
|
|
3662 |
// Issue reads on all available buffers
|
|
3663 |
for (TInt ii=0; ii<KRecNumBuffer; ii++)
|
|
3664 |
{
|
|
3665 |
iAudInStream->ReadL(iBufferList[ii]);
|
|
3666 |
}
|
|
3667 |
}
|
|
3668 |
|
|
3669 |
void CTestStepAudInStream::Read1BufL()
|
|
3670 |
{
|
|
3671 |
// Issue reads on 1 available buffer
|
|
3672 |
iAudInStream->ReadL(iBufferList[0]);
|
|
3673 |
}
|
|
3674 |
|
|
3675 |
|
|
3676 |
CTestStepAudInStream::CWriteBufferActive::CWriteBufferActive() : CActive(0)
|
|
3677 |
{
|
|
3678 |
CActiveScheduler::Add(this);
|
|
3679 |
}
|
|
3680 |
|
|
3681 |
CTestStepAudInStream::CWriteBufferActive::~CWriteBufferActive()
|
|
3682 |
{
|
|
3683 |
Cancel();
|
|
3684 |
}
|
|
3685 |
|
|
3686 |
void CTestStepAudInStream::CWriteBufferActive::RunL()
|
|
3687 |
{
|
|
3688 |
//ASSERT it wrote OK
|
|
3689 |
iParent->ProcessDataL();
|
|
3690 |
}
|
|
3691 |
|
|
3692 |
TInt CTestStepAudInStream::CWriteBufferActive::RunError(TInt aError)
|
|
3693 |
{
|
|
3694 |
iParent->iError = aError;
|
|
3695 |
CActiveScheduler::Stop();
|
|
3696 |
|
|
3697 |
return KErrNone;
|
|
3698 |
}
|
|
3699 |
|
|
3700 |
|
|
3701 |
void CTestStepAudInStream::CWriteBufferActive::DoCancel()
|
|
3702 |
{
|
|
3703 |
// do nothing
|
|
3704 |
}
|
|
3705 |
|
|
3706 |
void CTestStepAudInStream::CWriteBufferActive::Write(const TDesC8& aBuffer)
|
|
3707 |
{
|
|
3708 |
iParent->iFile.Write(aBuffer, iStatus); // read the 1st data trunk
|
|
3709 |
SetActive();
|
|
3710 |
}
|
|
3711 |
|
|
3712 |
|
|
3713 |
void CTestStepAudInStream::ProcessDataL()
|
|
3714 |
{
|
|
3715 |
// Set the next buffer to handle
|
|
3716 |
iBufferList[iStartBuf] = KNullDesC8; // done with that one
|
|
3717 |
// Issue another read to input stream
|
|
3718 |
iAudInStream->ReadL(iBufferList[iStartBuf]);
|
|
3719 |
|
|
3720 |
// Increment iStartBuf
|
|
3721 |
if(iStartBuf==KRecNumBuffer-1)
|
|
3722 |
{
|
|
3723 |
iStartBuf=0;
|
|
3724 |
}
|
|
3725 |
|
|
3726 |
else
|
|
3727 |
iStartBuf++;
|
|
3728 |
|
|
3729 |
if (iBufferList[iStartBuf] != KNullDesC8)
|
|
3730 |
{
|
|
3731 |
// Still more to write
|
|
3732 |
iWriteBufferActive->Write(iBufferList[iStartBuf]);
|
|
3733 |
}
|
|
3734 |
else
|
|
3735 |
CActiveScheduler::Stop();
|
|
3736 |
|
|
3737 |
// else just wait for more recorded data to come through
|
|
3738 |
}
|
|
3739 |
|
|
3740 |
/**
|
|
3741 |
*
|
|
3742 |
* Test step Preamble.
|
|
3743 |
*
|
|
3744 |
* @xxxx
|
|
3745 |
*
|
|
3746 |
*/
|
|
3747 |
enum TVerdict CTestStepAudInStream::DoTestStepPreambleL(void)
|
|
3748 |
{
|
|
3749 |
enum TVerdict verdict;
|
|
3750 |
|
|
3751 |
// reset the buffer [in case new test reuses previous object]
|
|
3752 |
for(TInt i=0; i<KRecNumBuffer; i++)
|
|
3753 |
{
|
|
3754 |
iBufferList[i] = KNullDesC8;
|
|
3755 |
}
|
|
3756 |
iStartBuf=iEndBuf=0;
|
|
3757 |
|
|
3758 |
// this installs the scheduler
|
|
3759 |
verdict = CTestMmfAclntStep::DoTestStepPreambleL();
|
|
3760 |
|
|
3761 |
// create the active object
|
|
3762 |
iWriteBufferActive = new(ELeave) CWriteBufferActive();
|
|
3763 |
iWriteBufferActive->iParent = this;
|
|
3764 |
iFs.Connect();
|
|
3765 |
|
|
3766 |
TRAPD(err, iAudInStream = CMdaAudioInputStream::NewL(*this) );
|
|
3767 |
|
|
3768 |
if (err != KErrNone ||
|
|
3769 |
iAudInStream == NULL )
|
|
3770 |
{
|
|
3771 |
return EInconclusive;
|
|
3772 |
}
|
|
3773 |
|
|
3774 |
|
|
3775 |
return verdict;
|
|
3776 |
}
|
|
3777 |
|
|
3778 |
/**
|
|
3779 |
*
|
|
3780 |
* Test step Postamble.
|
|
3781 |
*
|
|
3782 |
* @xxxx
|
|
3783 |
*
|
|
3784 |
*/
|
|
3785 |
enum TVerdict CTestStepAudInStream::DoTestStepPostambleL(void)
|
|
3786 |
{
|
|
3787 |
iFs.Close();
|
|
3788 |
|
|
3789 |
delete iAudInStream;
|
|
3790 |
iAudInStream = NULL;
|
|
3791 |
delete iWriteBufferActive;
|
|
3792 |
iWriteBufferActive = NULL;
|
|
3793 |
//[ Destroy the scheduler ]
|
|
3794 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
3795 |
}
|
|
3796 |
|
|
3797 |
/**
|
|
3798 |
*
|
|
3799 |
* Do the test step.
|
|
3800 |
* Each test step must supply an implementation for DoTestStepL.
|
|
3801 |
*
|
|
3802 |
* @return "TVerdict"
|
|
3803 |
* The result of the test step
|
|
3804 |
*
|
|
3805 |
* @xxxx
|
|
3806 |
*
|
|
3807 |
*/
|
|
3808 |
TVerdict CTestStepAudInStream::DoTestStepL()
|
|
3809 |
{
|
|
3810 |
iTestStepResult = EPass;
|
|
3811 |
TInt err = KErrNone;
|
|
3812 |
|
|
3813 |
if (iError != KErrNone )
|
|
3814 |
return EFail;
|
|
3815 |
|
|
3816 |
err = iFile.Replace( iFs, KRecordStreamRawFile, EFileWrite ) ;
|
|
3817 |
if (err != KErrNone)
|
|
3818 |
return EFail;
|
|
3819 |
|
|
3820 |
StartReadL();
|
|
3821 |
CActiveScheduler::Start();
|
|
3822 |
|
|
3823 |
iFile.Close();
|
|
3824 |
|
|
3825 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
3826 |
// test steps return a result
|
|
3827 |
return iTestStepResult;
|
|
3828 |
}
|
|
3829 |
|
|
3830 |
|
|
3831 |
|
|
3832 |
CTestStepAudInStreamNoUECap* CTestStepAudInStreamNoUECap::NewL(const TDesC& aTestName)
|
|
3833 |
{
|
|
3834 |
CTestStepAudInStreamNoUECap* self = new(ELeave) CTestStepAudInStreamNoUECap(aTestName);
|
|
3835 |
return self;
|
|
3836 |
}
|
|
3837 |
|
|
3838 |
|
|
3839 |
CTestStepAudInStreamNoUECap::CTestStepAudInStreamNoUECap(const TDesC& aTestName)
|
|
3840 |
{
|
|
3841 |
iTestStepResult = EFail;
|
|
3842 |
// store the name of this test case
|
|
3843 |
// this is the name that is used by the script file
|
|
3844 |
iTestStepName = aTestName;
|
|
3845 |
}
|
|
3846 |
|
|
3847 |
|
|
3848 |
|
|
3849 |
CTestStepAudInStreamNoUECap::~CTestStepAudInStreamNoUECap()
|
|
3850 |
{
|
|
3851 |
}
|
|
3852 |
|
|
3853 |
|
|
3854 |
void CTestStepAudInStreamNoUECap::MaiscOpenComplete(TInt aError)
|
|
3855 |
{
|
|
3856 |
iError = aError;
|
|
3857 |
CActiveScheduler::Stop();
|
|
3858 |
}
|
|
3859 |
|
|
3860 |
void CTestStepAudInStreamNoUECap::MaiscBufferCopied(TInt /*aError*/, const TDesC8& /*aBuffer*/)
|
|
3861 |
{
|
|
3862 |
INFO_PRINTF1(_L("MMdaAudioInputStreamCallback::MaiscBufferCopied was not supposed to be called"));
|
|
3863 |
iTestStepResult = EFail;
|
|
3864 |
CActiveScheduler::Stop();
|
|
3865 |
}
|
|
3866 |
void CTestStepAudInStreamNoUECap::MaiscRecordComplete(TInt aError)
|
|
3867 |
{
|
|
3868 |
INFO_PRINTF2(_L("MMdaAudioInputStreamCallback::MaiscRecordComplete was called with aError = %d"),aError);
|
|
3869 |
iMaiscRecordCompleteError = aError;
|
|
3870 |
CActiveScheduler::Stop();
|
|
3871 |
}
|
|
3872 |
|
|
3873 |
TVerdict CTestStepAudInStreamNoUECap::DoTestStepL()
|
|
3874 |
{
|
|
3875 |
TInt err = KErrNone;
|
|
3876 |
iTestStepResult = EFail;
|
|
3877 |
|
|
3878 |
// Printing to the console and log file
|
|
3879 |
INFO_PRINTF1(_L("this test calls MediaAudioClientInputStream::ReadL func with NO UserEnvironment capability"));
|
|
3880 |
|
|
3881 |
iAudInStream->Open(NULL);
|
|
3882 |
CActiveScheduler::Start();
|
|
3883 |
|
|
3884 |
if (iError != KErrNone)
|
|
3885 |
{
|
|
3886 |
INFO_PRINTF2(_L("DEBUG LEAVE 1: error = %d"),iError);
|
|
3887 |
return EInconclusive;
|
|
3888 |
}
|
|
3889 |
|
|
3890 |
iFile.Replace( iFs, KRecordStreamRawFile, EFileWrite ) ;
|
|
3891 |
if (err != KErrNone)
|
|
3892 |
{
|
|
3893 |
INFO_PRINTF2(_L("DEBUG LEAVE 2: error = %d"),err);
|
|
3894 |
return EInconclusive;
|
|
3895 |
}
|
|
3896 |
|
|
3897 |
iState=ERecording;
|
|
3898 |
|
|
3899 |
// start feeding the input stream
|
|
3900 |
TRAP(err, Read1BufL());
|
|
3901 |
CActiveScheduler::Start();
|
|
3902 |
if ( (err == KErrNone && iMaiscRecordCompleteError == KErrPermissionDenied) || err == KErrPermissionDenied )
|
|
3903 |
{
|
|
3904 |
INFO_PRINTF2(_L("Feeding input stream without UserEnvironent cap left with expected error = %d"),err);
|
|
3905 |
iTestStepResult = EPass;
|
|
3906 |
}
|
|
3907 |
else
|
|
3908 |
{
|
|
3909 |
INFO_PRINTF1(_L("Failed this test step with error %d"));
|
|
3910 |
INFO_PRINTF2(_L("Expected error = %d"),KErrPermissionDenied);
|
|
3911 |
INFO_PRINTF1(_L("The requesting client should not have the UserEnvironment cap in this test"));
|
|
3912 |
iTestStepResult = EFail;
|
|
3913 |
}
|
|
3914 |
// test steps return a result
|
|
3915 |
|
|
3916 |
return iTestStepResult;
|
|
3917 |
}
|
|
3918 |
|
|
3919 |
CTestStepAudInStreamWithUECap* CTestStepAudInStreamWithUECap::NewL(const TDesC& aTestName)
|
|
3920 |
{
|
|
3921 |
CTestStepAudInStreamWithUECap* self = new(ELeave) CTestStepAudInStreamWithUECap(aTestName);
|
|
3922 |
return self;
|
|
3923 |
}
|
|
3924 |
|
|
3925 |
|
|
3926 |
CTestStepAudInStreamWithUECap::CTestStepAudInStreamWithUECap(const TDesC& aTestName)
|
|
3927 |
{
|
|
3928 |
iTestStepResult = EFail;
|
|
3929 |
// store the name of this test case
|
|
3930 |
// this is the name that is used by the script file
|
|
3931 |
iTestStepName = aTestName;
|
|
3932 |
}
|
|
3933 |
|
|
3934 |
|
|
3935 |
|
|
3936 |
CTestStepAudInStreamWithUECap::~CTestStepAudInStreamWithUECap()
|
|
3937 |
{
|
|
3938 |
}
|
|
3939 |
|
|
3940 |
|
|
3941 |
void CTestStepAudInStreamWithUECap::MaiscOpenComplete(TInt aError)
|
|
3942 |
{
|
|
3943 |
iError = aError;
|
|
3944 |
CActiveScheduler::Stop();
|
|
3945 |
}
|
|
3946 |
|
|
3947 |
|
|
3948 |
void CTestStepAudInStreamWithUECap::MaiscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/)
|
|
3949 |
{
|
|
3950 |
//if weve stopped recording, each unused buffer will be returned with KErrAbort
|
|
3951 |
if(iState == EStopped && aError == KErrAbort)
|
|
3952 |
{
|
|
3953 |
return;
|
|
3954 |
}
|
|
3955 |
|
|
3956 |
iError = aError;
|
|
3957 |
}
|
|
3958 |
|
|
3959 |
void CTestStepAudInStreamWithUECap::MaiscRecordComplete(TInt aError)
|
|
3960 |
{
|
|
3961 |
iError = aError;
|
|
3962 |
CActiveScheduler::Stop();
|
|
3963 |
}
|
|
3964 |
|
|
3965 |
TVerdict CTestStepAudInStreamWithUECap::DoTestStepL()
|
|
3966 |
{
|
|
3967 |
// Printing to the console and log file
|
|
3968 |
INFO_PRINTF1(_L("This test calls MediaAudioClientInputStream::ReadL func with at list the UserEnvironment capability"));
|
|
3969 |
|
|
3970 |
iAudInStream->Open(NULL);
|
|
3971 |
CActiveScheduler::Start();
|
|
3972 |
|
|
3973 |
if (iError != KErrNone)
|
|
3974 |
{
|
|
3975 |
INFO_PRINTF2(_L("DEBUG LEAVE 1: error = %d"),iError);
|
|
3976 |
return EInconclusive;
|
|
3977 |
}
|
|
3978 |
|
|
3979 |
TInt err = iFile.Replace( iFs, KRecordStreamRawFile, EFileWrite ) ;
|
|
3980 |
if (err != KErrNone)
|
|
3981 |
{
|
|
3982 |
INFO_PRINTF2(_L("DEBUG LEAVE 2: error = %d"),err);
|
|
3983 |
return EInconclusive;
|
|
3984 |
}
|
|
3985 |
|
|
3986 |
|
|
3987 |
iState=ERecording;
|
|
3988 |
|
|
3989 |
// start feeding the input stream
|
|
3990 |
TRAP(err, Read1BufL());
|
|
3991 |
CActiveScheduler::Start();
|
|
3992 |
|
|
3993 |
if (err != KErrNone)
|
|
3994 |
{
|
|
3995 |
INFO_PRINTF2(_L("Test Failed with: error = %d"),iError);
|
|
3996 |
return EFail;
|
|
3997 |
}
|
|
3998 |
|
|
3999 |
return EPass;
|
|
4000 |
}
|
|
4001 |
|
|
4002 |
|
|
4003 |
CTestStepAudInStreamSetGain* CTestStepAudInStreamSetGain::NewL(const TDesC& aTestName)
|
|
4004 |
{
|
|
4005 |
CTestStepAudInStreamSetGain* self = new(ELeave) CTestStepAudInStreamSetGain(aTestName);
|
|
4006 |
return self;
|
|
4007 |
}
|
|
4008 |
|
|
4009 |
CTestStepAudInStreamSetGain::CTestStepAudInStreamSetGain(const TDesC& aTestName)
|
|
4010 |
{
|
|
4011 |
iTestStepResult = EPass;
|
|
4012 |
// store the name of this test case
|
|
4013 |
// this is the name that is used by the script file
|
|
4014 |
iTestStepName = aTestName;
|
|
4015 |
}
|
|
4016 |
|
|
4017 |
CTestStepAudInStreamSetGain::~CTestStepAudInStreamSetGain()
|
|
4018 |
{
|
|
4019 |
}
|
|
4020 |
|
|
4021 |
void CTestStepAudInStreamSetGain::MaiscOpenComplete(TInt /*aError*/)
|
|
4022 |
{
|
|
4023 |
}
|
|
4024 |
void CTestStepAudInStreamSetGain::MaiscBufferCopied(TInt /*aError*/, const TDesC8& /*aBuffer*/)
|
|
4025 |
{
|
|
4026 |
}
|
|
4027 |
void CTestStepAudInStreamSetGain::MaiscRecordComplete(TInt /*aError*/)
|
|
4028 |
{
|
|
4029 |
}
|
|
4030 |
|
|
4031 |
enum TVerdict CTestStepAudInStreamSetGain::DoTestStepPreambleL(void)
|
|
4032 |
{
|
|
4033 |
enum TVerdict verdict;
|
|
4034 |
// this installs the scheduler
|
|
4035 |
verdict = CTestMmfAclntStep::DoTestStepPreambleL();
|
|
4036 |
INFO_PRINTF2(_L("Test step %S DoTestStepPreambleL"),&iTestStepName);
|
|
4037 |
TInt err = KErrNone;
|
|
4038 |
TRAP(err, iAudInStream = CMdaAudioInputStream::NewL(*this));
|
|
4039 |
if (err != KErrNone || iAudInStream == NULL )
|
|
4040 |
{
|
|
4041 |
return EInconclusive;
|
|
4042 |
}
|
|
4043 |
|
|
4044 |
return verdict;
|
|
4045 |
}
|
|
4046 |
|
|
4047 |
enum TVerdict CTestStepAudInStreamSetGain::DoTestStepPostambleL(void)
|
|
4048 |
{
|
|
4049 |
delete iAudInStream;
|
|
4050 |
iAudInStream = NULL;
|
|
4051 |
//[ Destroy the scheduler ]
|
|
4052 |
INFO_PRINTF2(_L("Test step %S DoTestStepPostambleL"),&iTestStepName);
|
|
4053 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
4054 |
}
|
|
4055 |
|
|
4056 |
TVerdict CTestStepAudInStreamSetGain::DoTestStepL()
|
|
4057 |
{
|
|
4058 |
INFO_PRINTF1( _L("TestAudioInputStream : Gain"));
|
|
4059 |
INFO_PRINTF2( _L("TestAudioInputStream : MaxGain()(%d)"),iAudInStream->MaxGain());
|
|
4060 |
TInt gain = iAudInStream->MaxGain()/2;
|
|
4061 |
if (gain < 0)
|
|
4062 |
{
|
|
4063 |
return EFail;
|
|
4064 |
}
|
|
4065 |
|
|
4066 |
//set the volume
|
|
4067 |
INFO_PRINTF2( _L("TestAudioInputStream : SetGain(%d)"),gain);
|
|
4068 |
iAudInStream->SetGain(gain);
|
|
4069 |
|
|
4070 |
//get the volume
|
|
4071 |
TInt rgain = iAudInStream->Gain();
|
|
4072 |
if (gain != rgain )
|
|
4073 |
{
|
|
4074 |
return EFail;
|
|
4075 |
}
|
|
4076 |
|
|
4077 |
INFO_PRINTF2( _L("TestAudioInputStream : Gain() returned %d"),rgain);
|
|
4078 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
4079 |
// test steps return a result
|
|
4080 |
return iTestStepResult;
|
|
4081 |
}
|
|
4082 |
|
|
4083 |
|
|
4084 |
//
|
|
4085 |
//
|
|
4086 |
//
|
|
4087 |
CTestStepAudInStreamSetPriority* CTestStepAudInStreamSetPriority::NewL(const TDesC& aTestName)
|
|
4088 |
{
|
|
4089 |
CTestStepAudInStreamSetPriority* self = new(ELeave) CTestStepAudInStreamSetPriority(aTestName);
|
|
4090 |
return self;
|
|
4091 |
}
|
|
4092 |
|
|
4093 |
CTestStepAudInStreamSetPriority::CTestStepAudInStreamSetPriority(const TDesC& aTestName)
|
|
4094 |
{
|
|
4095 |
iTestStepResult = EPass;
|
|
4096 |
// store the name of this test case
|
|
4097 |
// this is the name that is used by the script file
|
|
4098 |
iTestStepName = aTestName;
|
|
4099 |
}
|
|
4100 |
|
|
4101 |
CTestStepAudInStreamSetPriority::~CTestStepAudInStreamSetPriority()
|
|
4102 |
{
|
|
4103 |
}
|
|
4104 |
|
|
4105 |
void CTestStepAudInStreamSetPriority::MaiscOpenComplete(TInt aError)
|
|
4106 |
{
|
|
4107 |
iError = aError;
|
|
4108 |
}
|
|
4109 |
void CTestStepAudInStreamSetPriority::MaiscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/)
|
|
4110 |
{
|
|
4111 |
iError = aError;
|
|
4112 |
}
|
|
4113 |
void CTestStepAudInStreamSetPriority::MaiscRecordComplete(TInt aError)
|
|
4114 |
{
|
|
4115 |
iError = aError;
|
|
4116 |
}
|
|
4117 |
|
|
4118 |
enum TVerdict CTestStepAudInStreamSetPriority::DoTestStepPreambleL(void)
|
|
4119 |
{
|
|
4120 |
enum TVerdict verdict;
|
|
4121 |
// this installs the scheduler
|
|
4122 |
verdict = CTestMmfAclntStep::DoTestStepPreambleL();
|
|
4123 |
|
|
4124 |
TInt err = KErrNone;
|
|
4125 |
TRAP(err, iAudInStream = CMdaAudioInputStream::NewL(*this));
|
|
4126 |
if (err != KErrNone || iAudInStream == NULL )
|
|
4127 |
{
|
|
4128 |
return EInconclusive;
|
|
4129 |
}
|
|
4130 |
|
|
4131 |
return verdict;
|
|
4132 |
}
|
|
4133 |
|
|
4134 |
enum TVerdict CTestStepAudInStreamSetPriority::DoTestStepPostambleL(void)
|
|
4135 |
{
|
|
4136 |
delete iAudInStream;
|
|
4137 |
iAudInStream = NULL;
|
|
4138 |
//[ Destroy the scheduler ]
|
|
4139 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
4140 |
}
|
|
4141 |
|
|
4142 |
TVerdict CTestStepAudInStreamSetPriority::DoTestStepL()
|
|
4143 |
{
|
|
4144 |
INFO_PRINTF1( _L("TestAudioInputStream : Priority"));
|
|
4145 |
iAudInStream->SetPriority(EMdaPriorityMin, EMdaPriorityPreferenceTime);
|
|
4146 |
iAudInStream->SetPriority(EMdaPriorityMax, EMdaPriorityPreferenceQuality);
|
|
4147 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
4148 |
// test steps return a result
|
|
4149 |
return iTestStepResult;
|
|
4150 |
}
|
|
4151 |
|
|
4152 |
|
|
4153 |
//
|
|
4154 |
//
|
|
4155 |
//
|
|
4156 |
CTestStepAudInStreamSetBalance* CTestStepAudInStreamSetBalance::NewL(const TDesC& aTestName)
|
|
4157 |
{
|
|
4158 |
CTestStepAudInStreamSetBalance* self = new(ELeave) CTestStepAudInStreamSetBalance(aTestName);
|
|
4159 |
return self;
|
|
4160 |
}
|
|
4161 |
|
|
4162 |
CTestStepAudInStreamSetBalance::CTestStepAudInStreamSetBalance(const TDesC& aTestName)
|
|
4163 |
{
|
|
4164 |
iTestStepResult = EPass;
|
|
4165 |
// store the name of this test case
|
|
4166 |
// this is the name that is used by the script file
|
|
4167 |
iTestStepName = aTestName;
|
|
4168 |
}
|
|
4169 |
|
|
4170 |
CTestStepAudInStreamSetBalance::~CTestStepAudInStreamSetBalance()
|
|
4171 |
{
|
|
4172 |
}
|
|
4173 |
|
|
4174 |
void CTestStepAudInStreamSetBalance::MaiscOpenComplete(TInt /*aError*/)
|
|
4175 |
{
|
|
4176 |
}
|
|
4177 |
void CTestStepAudInStreamSetBalance::MaiscBufferCopied(TInt /*aError*/, const TDesC8& /*aBuffer*/)
|
|
4178 |
{
|
|
4179 |
}
|
|
4180 |
void CTestStepAudInStreamSetBalance::MaiscRecordComplete(TInt /*aError*/)
|
|
4181 |
{
|
|
4182 |
}
|
|
4183 |
|
|
4184 |
enum TVerdict CTestStepAudInStreamSetBalance::DoTestStepPreambleL(void)
|
|
4185 |
{
|
|
4186 |
enum TVerdict verdict;
|
|
4187 |
// this installs the scheduler
|
|
4188 |
verdict = CTestMmfAclntStep::DoTestStepPreambleL();
|
|
4189 |
|
|
4190 |
TInt err = KErrNone;
|
|
4191 |
TRAP(err, iAudInStream = CMdaAudioInputStream::NewL(*this));
|
|
4192 |
if (err != KErrNone || iAudInStream == NULL )
|
|
4193 |
{
|
|
4194 |
return EInconclusive;
|
|
4195 |
}
|
|
4196 |
|
|
4197 |
return verdict;
|
|
4198 |
}
|
|
4199 |
|
|
4200 |
enum TVerdict CTestStepAudInStreamSetBalance::DoTestStepPostambleL(void)
|
|
4201 |
{
|
|
4202 |
delete iAudInStream;
|
|
4203 |
iAudInStream = NULL;
|
|
4204 |
//[ Destroy the scheduler ]
|
|
4205 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
4206 |
}
|
|
4207 |
|
|
4208 |
TVerdict CTestStepAudInStreamSetBalance::DoTestStepL()
|
|
4209 |
{
|
|
4210 |
TInt bal=0;
|
|
4211 |
|
|
4212 |
TRAPD(err, iAudInStream->SetBalanceL()); // default KMMFBalanceCenter
|
|
4213 |
if (err != KErrNone)
|
|
4214 |
{
|
|
4215 |
return EFail; // we expect this _will_ be supported for Typhoon
|
|
4216 |
}
|
|
4217 |
|
|
4218 |
//get the balance
|
|
4219 |
TRAP(err, bal = iAudInStream->GetBalanceL());
|
|
4220 |
if (err != KErrNone)
|
|
4221 |
{
|
|
4222 |
return EFail; // we expect this _will_ be supported for Typhoon
|
|
4223 |
}
|
|
4224 |
|
|
4225 |
if (bal != KMMFBalanceCenter )
|
|
4226 |
{
|
|
4227 |
return EFail;
|
|
4228 |
}
|
|
4229 |
|
|
4230 |
TRAP(err, iAudInStream->SetBalanceL(KMMFBalanceMaxRight));
|
|
4231 |
if (err != KErrNone)
|
|
4232 |
{
|
|
4233 |
return EFail; // we expect this _will_ be supported for Typhoon
|
|
4234 |
}
|
|
4235 |
|
|
4236 |
//get the balance
|
|
4237 |
TRAP(err, bal = iAudInStream->GetBalanceL());
|
|
4238 |
if (err != KErrNone)
|
|
4239 |
{
|
|
4240 |
return EFail; // we expect this _will_ be supported for Typhoon
|
|
4241 |
}
|
|
4242 |
|
|
4243 |
|
|
4244 |
if (bal != KMMFBalanceMaxRight)
|
|
4245 |
{
|
|
4246 |
return EFail;
|
|
4247 |
}
|
|
4248 |
|
|
4249 |
TRAP(err, iAudInStream->SetBalanceL(KMMFBalanceMaxLeft));
|
|
4250 |
if (err != KErrNone)
|
|
4251 |
{
|
|
4252 |
return EFail; // we expect this _will_ be supported for Typhoon
|
|
4253 |
}
|
|
4254 |
|
|
4255 |
//get the balance
|
|
4256 |
TRAP(err, bal = iAudInStream->GetBalanceL());
|
|
4257 |
if (err != KErrNone)
|
|
4258 |
{
|
|
4259 |
return EFail; // we expect this _will_ be supported for Typhoon
|
|
4260 |
}
|
|
4261 |
|
|
4262 |
if (bal != KMMFBalanceMaxLeft )
|
|
4263 |
{
|
|
4264 |
return EFail;
|
|
4265 |
}
|
|
4266 |
|
|
4267 |
// In of bounds
|
|
4268 |
/*
|
|
4269 |
iAudInStream->SetBalance(KMMFBalanceMaxLeft+10);
|
|
4270 |
//check condition
|
|
4271 |
*/
|
|
4272 |
|
|
4273 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
4274 |
// test steps return a result
|
|
4275 |
return iTestStepResult;
|
|
4276 |
}
|
|
4277 |
|
|
4278 |
//
|
|
4279 |
//
|
|
4280 |
//
|
|
4281 |
|
|
4282 |
LOCAL_C TInt stopActiveScheduler(TAny*)
|
|
4283 |
{
|
|
4284 |
CActiveScheduler::Stop();
|
|
4285 |
return FALSE;
|
|
4286 |
}
|
|
4287 |
|
|
4288 |
CTestStepAudInStreamGetBytes* CTestStepAudInStreamGetBytes::NewL(const TDesC& aTestName)
|
|
4289 |
{
|
|
4290 |
CTestStepAudInStreamGetBytes* self = new(ELeave) CTestStepAudInStreamGetBytes(aTestName);
|
|
4291 |
return self;
|
|
4292 |
}
|
|
4293 |
|
|
4294 |
CTestStepAudInStreamGetBytes::CTestStepAudInStreamGetBytes(const TDesC& aTestName)
|
|
4295 |
{
|
|
4296 |
iTestStepResult = EPass;
|
|
4297 |
// store the name of this test case
|
|
4298 |
// this is the name that is used by the script file
|
|
4299 |
iTestStepName = aTestName;
|
|
4300 |
}
|
|
4301 |
|
|
4302 |
CTestStepAudInStreamGetBytes::~CTestStepAudInStreamGetBytes()
|
|
4303 |
{
|
|
4304 |
}
|
|
4305 |
|
|
4306 |
void CTestStepAudInStreamGetBytes::MaiscOpenComplete(TInt aError)
|
|
4307 |
{
|
|
4308 |
iError = aError;
|
|
4309 |
CActiveScheduler::Stop();
|
|
4310 |
}
|
|
4311 |
void CTestStepAudInStreamGetBytes::MaiscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/)
|
|
4312 |
{
|
|
4313 |
//if weve stopped recording, each unused buffer will be returned with KErrAbort
|
|
4314 |
if(iState == EStopped && aError == KErrAbort)
|
|
4315 |
{
|
|
4316 |
return;
|
|
4317 |
}
|
|
4318 |
|
|
4319 |
iError = aError;
|
|
4320 |
++iBuffersUsed;
|
|
4321 |
}
|
|
4322 |
|
|
4323 |
void CTestStepAudInStreamGetBytes::MaiscRecordComplete(TInt aError)
|
|
4324 |
{
|
|
4325 |
|
|
4326 |
if(aError != KErrNone)
|
|
4327 |
{
|
|
4328 |
iError = aError;
|
|
4329 |
CActiveScheduler::Stop();
|
|
4330 |
return;
|
|
4331 |
}
|
|
4332 |
// Assume aBuffer == iBufferList[iEndBuf]
|
|
4333 |
|
|
4334 |
// Increment iEndBuf
|
|
4335 |
if(iEndBuf==KRecNumBuffer-1)
|
|
4336 |
{
|
|
4337 |
iEndBuf = 0;
|
|
4338 |
}
|
|
4339 |
|
|
4340 |
else
|
|
4341 |
iEndBuf++;
|
|
4342 |
|
|
4343 |
// Starting writing out the buffers if we're not already
|
|
4344 |
if(!iWriteBufferActive->IsActive())
|
|
4345 |
iWriteBufferActive->Write(iBufferList[iStartBuf]);
|
|
4346 |
}
|
|
4347 |
|
|
4348 |
enum TVerdict CTestStepAudInStreamGetBytes::DoTestStepPreambleL(void)
|
|
4349 |
{
|
|
4350 |
iTestStepResult = EPass;
|
|
4351 |
enum TVerdict verdict;
|
|
4352 |
// this installs the scheduler
|
|
4353 |
verdict = CTestStepAudInStream::DoTestStepPreambleL();
|
|
4354 |
|
|
4355 |
// Printing to the console and log file
|
|
4356 |
INFO_PRINTF1(_L("this test gets the bytes rendered by the H/W until this moment: GetBytes()"));
|
|
4357 |
|
|
4358 |
iAudInStream->Open(NULL);
|
|
4359 |
CActiveScheduler::Start();
|
|
4360 |
|
|
4361 |
if (iError != KErrNone)
|
|
4362 |
{
|
|
4363 |
INFO_PRINTF2(_L("DEBUG LEAVE 1: error = %d"),iError);
|
|
4364 |
return EInconclusive;
|
|
4365 |
}
|
|
4366 |
|
|
4367 |
TInt err = iFile.Replace( iFs, KRecordStreamRawFile, EFileWrite ) ;
|
|
4368 |
if (err != KErrNone)
|
|
4369 |
{
|
|
4370 |
INFO_PRINTF2(_L("DEBUG LEAVE 2: error = %d"),err);
|
|
4371 |
return EInconclusive;
|
|
4372 |
}
|
|
4373 |
|
|
4374 |
|
|
4375 |
iState=ERecording;
|
|
4376 |
|
|
4377 |
// start feeding the input stream
|
|
4378 |
StartReadL();
|
|
4379 |
CIdle* idleStopper = CIdle::NewL(CActive::EPriorityStandard);
|
|
4380 |
idleStopper->Start(TCallBack(stopActiveScheduler));
|
|
4381 |
CActiveScheduler::Start();
|
|
4382 |
delete idleStopper;
|
|
4383 |
if (iError != KErrNone)
|
|
4384 |
{
|
|
4385 |
INFO_PRINTF2(_L("DEBUG LEAVE 3: error = %d"),iError);
|
|
4386 |
return EInconclusive;
|
|
4387 |
}
|
|
4388 |
|
|
4389 |
return verdict;
|
|
4390 |
}
|
|
4391 |
|
|
4392 |
enum TVerdict CTestStepAudInStreamGetBytes::DoTestStepPostambleL(void)
|
|
4393 |
{
|
|
4394 |
iFile.Close();
|
|
4395 |
delete iAudInStream;
|
|
4396 |
iAudInStream = NULL;
|
|
4397 |
//[ Destroy the scheduler ]
|
|
4398 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
4399 |
}
|
|
4400 |
|
|
4401 |
TVerdict CTestStepAudInStreamGetBytes::DoTestStepL()
|
|
4402 |
{
|
|
4403 |
TInt bytes1 = iAudInStream->GetBytes();
|
|
4404 |
INFO_PRINTF2(_L("bytes1 = %d"), bytes1);
|
|
4405 |
|
|
4406 |
CCallBackTimer* callBackTimer = CCallBackTimer::NewL(TCallBack(stopActiveScheduler));
|
|
4407 |
callBackTimer->After(1000000);
|
|
4408 |
CActiveScheduler::Start();
|
|
4409 |
callBackTimer->Cancel(); // in case something else stopped the AS
|
|
4410 |
|
|
4411 |
if (iError != KErrNone)
|
|
4412 |
{
|
|
4413 |
ERR_PRINTF2(_L("First call to GetBytes() returned error %d"), iError);
|
|
4414 |
delete callBackTimer;
|
|
4415 |
return EFail;
|
|
4416 |
}
|
|
4417 |
|
|
4418 |
TInt bytes2 = iAudInStream->GetBytes();
|
|
4419 |
INFO_PRINTF2(_L("bytes2 = %d"), bytes2);
|
|
4420 |
|
|
4421 |
callBackTimer->After(1000000);
|
|
4422 |
CActiveScheduler::Start();
|
|
4423 |
callBackTimer->Cancel();
|
|
4424 |
|
|
4425 |
if (iError != KErrNone)
|
|
4426 |
{
|
|
4427 |
ERR_PRINTF2(_L("Second call to GetBytes() returned error %d"), iError);
|
|
4428 |
delete callBackTimer;
|
|
4429 |
return EFail;
|
|
4430 |
}
|
|
4431 |
|
|
4432 |
delete callBackTimer;
|
|
4433 |
|
|
4434 |
//Stop will kick off the write of the data to file through CWriteBufferActive, which will stop
|
|
4435 |
//ActiveSheduler when written
|
|
4436 |
iState=EStopped; //required so that acceptable KErrAbort in MaiscBufferCopied are handled properly
|
|
4437 |
iAudInStream->Stop();
|
|
4438 |
|
|
4439 |
// Starting writing out the buffers if we're not already
|
|
4440 |
if(!iWriteBufferActive->IsActive())
|
|
4441 |
{
|
|
4442 |
iWriteBufferActive->Write(iBufferList[iStartBuf]);
|
|
4443 |
}
|
|
4444 |
|
|
4445 |
CActiveScheduler::Start();
|
|
4446 |
|
|
4447 |
TInt bytes3 = iAudInStream->GetBytes();
|
|
4448 |
INFO_PRINTF2(_L("bytes3 = %d"), bytes3);
|
|
4449 |
if (iError != KErrNone)
|
|
4450 |
{
|
|
4451 |
ERR_PRINTF2(_L("Third call to GetBytes() returned error %d"), iError);
|
|
4452 |
return EFail;
|
|
4453 |
}
|
|
4454 |
|
|
4455 |
TInt fileSize;
|
|
4456 |
User::LeaveIfError(iFile.Size(fileSize));
|
|
4457 |
ERR_PRINTF2(_L("filesize %d"), fileSize);
|
|
4458 |
INFO_PRINTF4(_L("GetBytes returned sizes %d, %d, %d"), bytes1, bytes2, bytes3);
|
|
4459 |
|
|
4460 |
INFO_PRINTF3(_L("Recording Complete used %d of the %d buffers available"),iBuffersUsed,KRecNumBuffer);
|
|
4461 |
|
|
4462 |
if (bytes1 > bytes2 || bytes2 > bytes3)
|
|
4463 |
{
|
|
4464 |
return EFail;
|
|
4465 |
}
|
|
4466 |
|
|
4467 |
|
|
4468 |
if (bytes3 != fileSize)
|
|
4469 |
{
|
|
4470 |
ERR_PRINTF3(_L("Error : bytes3 %d != filesize %d"), bytes3, fileSize);
|
|
4471 |
return EFail;
|
|
4472 |
}
|
|
4473 |
|
|
4474 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
4475 |
// test steps return a result
|
|
4476 |
return iTestStepResult;
|
|
4477 |
}
|
|
4478 |
|
|
4479 |
//
|
|
4480 |
//
|
|
4481 |
//
|
|
4482 |
|
|
4483 |
CTestStepAudInStreamSglBuf* CTestStepAudInStreamSglBuf::NewL(const TDesC& aTestName)
|
|
4484 |
{
|
|
4485 |
CTestStepAudInStreamSglBuf* self = new(ELeave) CTestStepAudInStreamSglBuf(aTestName);
|
|
4486 |
return self;
|
|
4487 |
}
|
|
4488 |
|
|
4489 |
CTestStepAudInStreamSglBuf::CTestStepAudInStreamSglBuf(const TDesC& aTestName)
|
|
4490 |
: CTestStepAudInStreamGetBytes(aTestName),
|
|
4491 |
iBufferPtr(NULL, 0)
|
|
4492 |
{
|
|
4493 |
iTestStepResult = EFail;
|
|
4494 |
// store the name of this test case
|
|
4495 |
// this is the name that is used by the script file
|
|
4496 |
iTestStepName = aTestName;
|
|
4497 |
}
|
|
4498 |
|
|
4499 |
CTestStepAudInStreamSglBuf::~CTestStepAudInStreamSglBuf()
|
|
4500 |
{
|
|
4501 |
}
|
|
4502 |
|
|
4503 |
/**
|
|
4504 |
*
|
|
4505 |
* Test step Preamble.
|
|
4506 |
*
|
|
4507 |
* @xxxx
|
|
4508 |
*
|
|
4509 |
*/
|
|
4510 |
enum TVerdict CTestStepAudInStreamSglBuf::DoTestStepPreambleL(void)
|
|
4511 |
{
|
|
4512 |
iTestStepResult = EPass;
|
|
4513 |
|
|
4514 |
// this installs the scheduler
|
|
4515 |
iTestStepResult = CTestStepAudInStream::DoTestStepPreambleL();
|
|
4516 |
|
|
4517 |
// Printing to the console and log file
|
|
4518 |
INFO_PRINTF1(_L("this test gets the bytes rendered by the H/W until this moment: GetBytes()"));
|
|
4519 |
|
|
4520 |
iAudInStream->SetSingleBufferMode(ETrue);
|
|
4521 |
iAudInStream->Open(NULL);
|
|
4522 |
CActiveScheduler::Start();
|
|
4523 |
|
|
4524 |
if (iError != KErrNone)
|
|
4525 |
{
|
|
4526 |
INFO_PRINTF2(_L("DEBUG LEAVE 1: error = %d"),iError);
|
|
4527 |
return EInconclusive;
|
|
4528 |
}
|
|
4529 |
|
|
4530 |
iError = iFile.Replace( iFs, KRecordStreamRawFile, EFileWrite ) ;
|
|
4531 |
if (iError != KErrNone)
|
|
4532 |
{
|
|
4533 |
INFO_PRINTF2(_L("DEBUG LEAVE 2: error = %d"),iError);
|
|
4534 |
return EInconclusive;
|
|
4535 |
}
|
|
4536 |
|
|
4537 |
iState=ERecording;
|
|
4538 |
|
|
4539 |
// start feeding the input stream
|
|
4540 |
Read1BufL(); // single buffer
|
|
4541 |
CIdle* idleStopper = CIdle::NewL(CActive::EPriorityStandard);
|
|
4542 |
idleStopper->Start(TCallBack(stopActiveScheduler));
|
|
4543 |
CActiveScheduler::Start();
|
|
4544 |
delete idleStopper;
|
|
4545 |
if (iError != KErrNone)
|
|
4546 |
{
|
|
4547 |
INFO_PRINTF2(_L("DEBUG LEAVE 3: error = %d"),iError);
|
|
4548 |
return EInconclusive;
|
|
4549 |
}
|
|
4550 |
|
|
4551 |
return iTestStepResult;
|
|
4552 |
}
|
|
4553 |
|
|
4554 |
|
|
4555 |
void CTestStepAudInStreamSglBuf::Read1BufL()
|
|
4556 |
{
|
|
4557 |
// Issue reads on 1 available buffer
|
|
4558 |
iBufferPtr.Set(const_cast<TUint8*>(iSingleBuffer.Ptr()), 0, iSingleBuffer.MaxLength());
|
|
4559 |
iAudInStream->ReadL(iBufferPtr);
|
|
4560 |
}
|
|
4561 |
|
|
4562 |
|
|
4563 |
void CTestStepAudInStreamSglBuf::MaiscBufferCopied(TInt aError, const TDesC8& aBuffer)
|
|
4564 |
{
|
|
4565 |
CTestStepAudInStreamGetBytes::MaiscBufferCopied(aError, aBuffer);
|
|
4566 |
|
|
4567 |
TInt lengthRecorded = iSingleBuffer.Length()+aBuffer.Length();
|
|
4568 |
iSingleBuffer.SetLength(lengthRecorded);
|
|
4569 |
}
|
|
4570 |
|
|
4571 |
|
|
4572 |
void CTestStepAudInStreamSglBuf::MaiscRecordComplete(TInt aError)
|
|
4573 |
{
|
|
4574 |
// Starting writing out the buffer if we're not already
|
|
4575 |
if(!iWriteBufferActive->IsActive())
|
|
4576 |
{
|
|
4577 |
iWriteBufferActive->Write(iSingleBuffer);
|
|
4578 |
}
|
|
4579 |
|
|
4580 |
CTestStepAudInStreamGetBytes::MaiscRecordComplete(aError);
|
|
4581 |
}
|
|
4582 |
|
|
4583 |
|
|
4584 |
TVerdict CTestStepAudInStreamSglBuf::DoTestStepL()
|
|
4585 |
{
|
|
4586 |
TInt bytes1 = iAudInStream->GetBytes();
|
|
4587 |
INFO_PRINTF2(_L("bytes1 = %d"), bytes1);
|
|
4588 |
|
|
4589 |
CCallBackTimer* callBackTimer = CCallBackTimer::NewL(TCallBack(stopActiveScheduler));
|
|
4590 |
callBackTimer->After(1000000);
|
|
4591 |
CActiveScheduler::Start();
|
|
4592 |
callBackTimer->Cancel(); // in case something else stopped the AS
|
|
4593 |
|
|
4594 |
if (iError != KErrNone)
|
|
4595 |
{
|
|
4596 |
ERR_PRINTF2(_L("First call to GetBytes() returned error %d"), iError);
|
|
4597 |
delete callBackTimer;
|
|
4598 |
return EFail;
|
|
4599 |
}
|
|
4600 |
|
|
4601 |
TInt bytes2 = iAudInStream->GetBytes();
|
|
4602 |
INFO_PRINTF2(_L("bytes2 = %d"), bytes2);
|
|
4603 |
|
|
4604 |
callBackTimer->After(1000000);
|
|
4605 |
CActiveScheduler::Start();
|
|
4606 |
callBackTimer->Cancel();
|
|
4607 |
|
|
4608 |
if (iError != KErrNone)
|
|
4609 |
{
|
|
4610 |
ERR_PRINTF2(_L("Second call to GetBytes() returned error %d"), iError);
|
|
4611 |
delete callBackTimer;
|
|
4612 |
return EFail;
|
|
4613 |
}
|
|
4614 |
|
|
4615 |
delete callBackTimer;
|
|
4616 |
|
|
4617 |
//Stop will kick off the write of the data to file through CWriteBufferActive, which will stop
|
|
4618 |
//ActiveSheduler when written
|
|
4619 |
iState=EStopped; //required so that acceptable KErrAbort in MaiscBufferCopied are handled properly
|
|
4620 |
iAudInStream->Stop();
|
|
4621 |
|
|
4622 |
// Starting writing out the buffers if we're not already
|
|
4623 |
if(!iWriteBufferActive->IsActive())
|
|
4624 |
{
|
|
4625 |
iWriteBufferActive->Write(iSingleBuffer);
|
|
4626 |
}
|
|
4627 |
|
|
4628 |
CActiveScheduler::Start();
|
|
4629 |
|
|
4630 |
TInt bytes3 = iAudInStream->GetBytes();
|
|
4631 |
INFO_PRINTF2(_L("bytes3 = %d"), bytes3);
|
|
4632 |
if (iError != KErrNone)
|
|
4633 |
{
|
|
4634 |
ERR_PRINTF2(_L("Third call to GetBytes() returned error %d"), iError);
|
|
4635 |
return EFail;
|
|
4636 |
}
|
|
4637 |
|
|
4638 |
TInt fileSize;
|
|
4639 |
User::LeaveIfError(iFile.Size(fileSize));
|
|
4640 |
ERR_PRINTF2(_L("filesize %d"), fileSize);
|
|
4641 |
INFO_PRINTF4(_L("GetBytes returned sizes %d, %d, %d"), bytes1, bytes2, bytes3);
|
|
4642 |
|
|
4643 |
INFO_PRINTF2(_L("Recording Complete using a single buffer of size %d bytes"), KRecBufferSglBufSize);
|
|
4644 |
|
|
4645 |
if (bytes1 > bytes2 || bytes2 > bytes3)
|
|
4646 |
{
|
|
4647 |
return EFail;
|
|
4648 |
}
|
|
4649 |
|
|
4650 |
if (bytes3 != fileSize)
|
|
4651 |
{
|
|
4652 |
ERR_PRINTF3(_L("Error : bytes3 %d != filesize %d"), bytes3, fileSize);
|
|
4653 |
return EFail;
|
|
4654 |
}
|
|
4655 |
|
|
4656 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
4657 |
// test steps return a result
|
|
4658 |
return iTestStepResult;
|
|
4659 |
}
|
|
4660 |
|
|
4661 |
|
|
4662 |
void CTestStepAudInStreamSglBuf::ProcessDataL()
|
|
4663 |
{
|
|
4664 |
// wait for more recorded data to come through
|
|
4665 |
CActiveScheduler::Stop();
|
|
4666 |
}
|
|
4667 |
|
|
4668 |
//
|
|
4669 |
//
|
|
4670 |
//
|
|
4671 |
|
|
4672 |
CTestStepAudInStreamSetProp* CTestStepAudInStreamSetProp::NewL(const TDesC& aTestName)
|
|
4673 |
{
|
|
4674 |
CTestStepAudInStreamSetProp* self = new(ELeave) CTestStepAudInStreamSetProp(aTestName);
|
|
4675 |
return self;
|
|
4676 |
}
|
|
4677 |
|
|
4678 |
CTestStepAudInStreamSetProp::CTestStepAudInStreamSetProp(const TDesC& aTestName)
|
|
4679 |
{
|
|
4680 |
iTestStepResult = EPass;
|
|
4681 |
// store the name of this test case
|
|
4682 |
// this is the name that is used by the script file
|
|
4683 |
iTestStepName = aTestName;
|
|
4684 |
}
|
|
4685 |
|
|
4686 |
CTestStepAudInStreamSetProp::~CTestStepAudInStreamSetProp()
|
|
4687 |
{
|
|
4688 |
}
|
|
4689 |
|
|
4690 |
void CTestStepAudInStreamSetProp::MaiscOpenComplete(TInt aError)
|
|
4691 |
{
|
|
4692 |
iError = aError;
|
|
4693 |
}
|
|
4694 |
void CTestStepAudInStreamSetProp::MaiscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/)
|
|
4695 |
{
|
|
4696 |
iError = aError;
|
|
4697 |
}
|
|
4698 |
void CTestStepAudInStreamSetProp::MaiscRecordComplete(TInt aError)
|
|
4699 |
{
|
|
4700 |
iError = aError;
|
|
4701 |
}
|
|
4702 |
|
|
4703 |
enum TVerdict CTestStepAudInStreamSetProp::DoTestStepPreambleL(void)
|
|
4704 |
{
|
|
4705 |
enum TVerdict verdict;
|
|
4706 |
// this installs the scheduler
|
|
4707 |
verdict = CTestMmfAclntStep::DoTestStepPreambleL();
|
|
4708 |
|
|
4709 |
TInt err = KErrNone;
|
|
4710 |
TRAP(err, iAudInStream = CMdaAudioInputStream::NewL(*this));
|
|
4711 |
if (err != KErrNone || iAudInStream == NULL )
|
|
4712 |
{
|
|
4713 |
return EInconclusive;
|
|
4714 |
}
|
|
4715 |
|
|
4716 |
return verdict;
|
|
4717 |
}
|
|
4718 |
|
|
4719 |
enum TVerdict CTestStepAudInStreamSetProp::DoTestStepPostambleL(void)
|
|
4720 |
{
|
|
4721 |
delete iAudInStream;
|
|
4722 |
iAudInStream = NULL;
|
|
4723 |
//[ Destroy the scheduler ]
|
|
4724 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
4725 |
}
|
|
4726 |
|
|
4727 |
TVerdict CTestStepAudInStreamSetProp::DoTestStepL()
|
|
4728 |
{
|
|
4729 |
INFO_PRINTF1( _L("TestAudioInputStream : SetAudioProperties"));
|
|
4730 |
iTestStepResult = EPass;
|
|
4731 |
TInt err = KErrNone;
|
|
4732 |
|
|
4733 |
// test 1
|
|
4734 |
TRAP(err, iAudInStream->SetAudioPropertiesL(TMdaAudioDataSettings::ESampleRate8000Hz,TMdaAudioDataSettings::EChannelsMono) );
|
|
4735 |
|
|
4736 |
if (!(err == KErrNone ||
|
|
4737 |
err == KErrNotSupported) )
|
|
4738 |
{
|
|
4739 |
return EFail;
|
|
4740 |
}
|
|
4741 |
|
|
4742 |
|
|
4743 |
// test2
|
|
4744 |
TRAP(err, iAudInStream->SetAudioPropertiesL(TMdaAudioDataSettings::ESampleRate44100Hz,TMdaAudioDataSettings::EChannelsStereo) );
|
|
4745 |
|
|
4746 |
if (!(err == KErrNone ||
|
|
4747 |
err == KErrNotSupported) )
|
|
4748 |
{
|
|
4749 |
return EFail;
|
|
4750 |
}
|
|
4751 |
|
|
4752 |
|
|
4753 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
4754 |
// test steps return a result
|
|
4755 |
return iTestStepResult;
|
|
4756 |
}
|
|
4757 |
|
|
4758 |
|
|
4759 |
|
|
4760 |
//
|
|
4761 |
//
|
|
4762 |
// CMdaAudioOutputStream Integration Tests //
|
|
4763 |
//
|
|
4764 |
//
|
|
4765 |
|
|
4766 |
// base class for some audio Ouput stream tests
|
|
4767 |
CTestStepAudOutStream* CTestStepAudOutStream::NewL()
|
|
4768 |
{
|
|
4769 |
CTestStepAudOutStream* s = new(ELeave) CTestStepAudOutStream();
|
|
4770 |
CleanupStack::PushL(s);
|
|
4771 |
s->ConstructL();
|
|
4772 |
CleanupStack::Pop();
|
|
4773 |
return s;
|
|
4774 |
}
|
|
4775 |
|
|
4776 |
CTestStepAudOutStream::CTestStepAudOutStream() : iError(KErrNone)
|
|
4777 |
{
|
|
4778 |
iIsAllDataRead = EFalse;
|
|
4779 |
iIsAllDataWritten = EFalse;
|
|
4780 |
}
|
|
4781 |
|
|
4782 |
void CTestStepAudOutStream::ConstructL()
|
|
4783 |
{
|
|
4784 |
// reset the buffer
|
|
4785 |
for(TInt i=0; i<KNumBuffer; i++)
|
|
4786 |
{
|
|
4787 |
iBufferList[i] = KNullDesC8;
|
|
4788 |
}
|
|
4789 |
iStartBuf=iEndBuf=0;
|
|
4790 |
}
|
|
4791 |
|
|
4792 |
CTestStepAudOutStream::~CTestStepAudOutStream()
|
|
4793 |
{
|
|
4794 |
}
|
|
4795 |
|
|
4796 |
void CTestStepAudOutStream::MaoscOpenComplete(TInt aError)
|
|
4797 |
{
|
|
4798 |
iError = aError;
|
|
4799 |
CActiveScheduler::Stop();
|
|
4800 |
}
|
|
4801 |
|
|
4802 |
void CTestStepAudOutStream::MaoscPlayComplete(TInt aError)
|
|
4803 |
{
|
|
4804 |
if (iIsAllDataWritten && (aError == KErrNone || aError == KErrUnderflow))
|
|
4805 |
{
|
|
4806 |
iError = KErrNone;
|
|
4807 |
}
|
|
4808 |
|
|
4809 |
else
|
|
4810 |
iError = aError;
|
|
4811 |
|
|
4812 |
iReadBufferActive->Cancel();
|
|
4813 |
TInt filePosition=0;
|
|
4814 |
iFile.Seek(ESeekStart, filePosition);
|
|
4815 |
iFile.Close();
|
|
4816 |
CActiveScheduler::Stop();
|
|
4817 |
}
|
|
4818 |
|
|
4819 |
void CTestStepAudOutStream::MaoscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/)
|
|
4820 |
{
|
|
4821 |
iError = aError;
|
|
4822 |
if(aError)
|
|
4823 |
{
|
|
4824 |
//need add for deal with exception
|
|
4825 |
return;
|
|
4826 |
}
|
|
4827 |
|
|
4828 |
|
|
4829 |
// adjust the buffer
|
|
4830 |
iBufferList[iStartBuf] = KNullDesC8;
|
|
4831 |
if(iStartBuf==KNumBuffer-1)
|
|
4832 |
iStartBuf = 0;
|
|
4833 |
else
|
|
4834 |
iStartBuf++;
|
|
4835 |
|
|
4836 |
if (iIsAllDataRead && iStartBuf == iEndBuf)
|
|
4837 |
{
|
|
4838 |
iIsAllDataWritten = ETrue;
|
|
4839 |
}
|
|
4840 |
else if(!iReadBufferActive->IsActive())
|
|
4841 |
iReadBufferActive->Read();
|
|
4842 |
}
|
|
4843 |
|
|
4844 |
|
|
4845 |
CTestStepAudOutStream::CReadBufferActive::CReadBufferActive() : CActive(0)
|
|
4846 |
{
|
|
4847 |
CActiveScheduler::Add(this);
|
|
4848 |
}
|
|
4849 |
|
|
4850 |
CTestStepAudOutStream::CReadBufferActive::~CReadBufferActive()
|
|
4851 |
{
|
|
4852 |
Cancel();
|
|
4853 |
}
|
|
4854 |
|
|
4855 |
void CTestStepAudOutStream::CReadBufferActive::RunL()
|
|
4856 |
{
|
|
4857 |
iParent->ProcessDataL(iBuffer);
|
|
4858 |
}
|
|
4859 |
|
|
4860 |
TInt CTestStepAudOutStream::CReadBufferActive::RunError(TInt aError)
|
|
4861 |
{
|
|
4862 |
iParent->iError = aError;
|
|
4863 |
CActiveScheduler::Stop();
|
|
4864 |
|
|
4865 |
return KErrNone;
|
|
4866 |
}
|
|
4867 |
|
|
4868 |
void CTestStepAudOutStream::CReadBufferActive::DoCancel()
|
|
4869 |
{
|
|
4870 |
// do nothing
|
|
4871 |
}
|
|
4872 |
|
|
4873 |
void CTestStepAudOutStream::CReadBufferActive::Read()
|
|
4874 |
{
|
|
4875 |
iParent->iFile.Read(iBuffer, iStatus); // read the 1st data trunk
|
|
4876 |
SetActive();
|
|
4877 |
}
|
|
4878 |
|
|
4879 |
|
|
4880 |
void CTestStepAudOutStream::ProcessDataL(TBuf8<KBufferSize>& aData)
|
|
4881 |
{
|
|
4882 |
if(aData.Length())
|
|
4883 |
{
|
|
4884 |
if(iBufferList[iEndBuf]==KNullDesC8)
|
|
4885 |
{
|
|
4886 |
iBufferList[iEndBuf] = aData;
|
|
4887 |
iAudOutStream->WriteL(iBufferList[iEndBuf]);
|
|
4888 |
|
|
4889 |
// adjust the buffer
|
|
4890 |
if(iEndBuf==KNumBuffer-1)
|
|
4891 |
{
|
|
4892 |
iEndBuf=0;
|
|
4893 |
}
|
|
4894 |
|
|
4895 |
else
|
|
4896 |
{
|
|
4897 |
iEndBuf++;
|
|
4898 |
}
|
|
4899 |
}
|
|
4900 |
|
|
4901 |
if(iBufferList[iEndBuf]==KNullDesC8)
|
|
4902 |
{
|
|
4903 |
iReadBufferActive->Read();
|
|
4904 |
}
|
|
4905 |
// else all our buffers are full
|
|
4906 |
}
|
|
4907 |
else
|
|
4908 |
iIsAllDataRead = ETrue;
|
|
4909 |
}
|
|
4910 |
|
|
4911 |
/**
|
|
4912 |
*
|
|
4913 |
* Test step Preamble.
|
|
4914 |
*
|
|
4915 |
* @xxxx
|
|
4916 |
*
|
|
4917 |
*/
|
|
4918 |
enum TVerdict CTestStepAudOutStream::DoTestStepPreambleL(void)
|
|
4919 |
{
|
|
4920 |
enum TVerdict verdict;
|
|
4921 |
|
|
4922 |
// reset the buffer [incase new test reuses previous object]
|
|
4923 |
for(TInt i=0; i<KNumBuffer; i++)
|
|
4924 |
{
|
|
4925 |
iBufferList[i] = KNullDesC8;
|
|
4926 |
}
|
|
4927 |
iStartBuf=iEndBuf=0;
|
|
4928 |
|
|
4929 |
// this installs the scheduler
|
|
4930 |
verdict = CTestMmfAclntStep::DoTestStepPreambleL();
|
|
4931 |
|
|
4932 |
// create the active object
|
|
4933 |
iReadBufferActive = new(ELeave) CReadBufferActive();
|
|
4934 |
iReadBufferActive->iParent = this;
|
|
4935 |
iFs.Connect();
|
|
4936 |
|
|
4937 |
TRAPD(err, iAudOutStream = CMdaAudioOutputStream::NewL(*this) );
|
|
4938 |
|
|
4939 |
if (err != KErrNone ||
|
|
4940 |
iAudOutStream == NULL )
|
|
4941 |
{
|
|
4942 |
return EInconclusive;
|
|
4943 |
}
|
|
4944 |
|
|
4945 |
return verdict;
|
|
4946 |
}
|
|
4947 |
|
|
4948 |
/**
|
|
4949 |
*
|
|
4950 |
* Test step Postamble.
|
|
4951 |
*
|
|
4952 |
* @xxxx
|
|
4953 |
*
|
|
4954 |
*/
|
|
4955 |
enum TVerdict CTestStepAudOutStream::DoTestStepPostambleL(void)
|
|
4956 |
{
|
|
4957 |
iFs.Close();
|
|
4958 |
|
|
4959 |
delete iAudOutStream;
|
|
4960 |
iAudOutStream = NULL;
|
|
4961 |
delete iReadBufferActive;
|
|
4962 |
iReadBufferActive = NULL;
|
|
4963 |
//[ Destroy the scheduler ]
|
|
4964 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
4965 |
}
|
|
4966 |
|
|
4967 |
/**
|
|
4968 |
*
|
|
4969 |
* Do the test step.
|
|
4970 |
* Each test step must supply an implementation for DoTestStepL.
|
|
4971 |
*
|
|
4972 |
* @return "TVerdict"
|
|
4973 |
* The result of the test step
|
|
4974 |
*
|
|
4975 |
* @xxxx
|
|
4976 |
*
|
|
4977 |
*/
|
|
4978 |
TVerdict CTestStepAudOutStream::DoTestStepL()
|
|
4979 |
{
|
|
4980 |
iTestStepResult = EPass;
|
|
4981 |
//TInt err = KErrNone;
|
|
4982 |
|
|
4983 |
iAudOutStream->Open(NULL);
|
|
4984 |
CActiveScheduler::Start();
|
|
4985 |
iAudOutStream->SetVolume(iAudOutStream->MaxVolume()>>1); // half volume
|
|
4986 |
|
|
4987 |
if (iError != KErrNone )
|
|
4988 |
{
|
|
4989 |
return EFail;
|
|
4990 |
}
|
|
4991 |
|
|
4992 |
|
|
4993 |
TInt err = KErrNone;
|
|
4994 |
err = iFile.Open(iFs, KStreamRawFile, EFileRead);
|
|
4995 |
if (err != KErrNone)
|
|
4996 |
{
|
|
4997 |
return EFail;
|
|
4998 |
}
|
|
4999 |
|
|
5000 |
iReadBufferActive->Read();
|
|
5001 |
CActiveScheduler::Start();
|
|
5002 |
|
|
5003 |
// wait sometime to finish and then close the file
|
|
5004 |
User::After(1200000);
|
|
5005 |
iFile.Close();
|
|
5006 |
|
|
5007 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
5008 |
// test steps return a result
|
|
5009 |
return iTestStepResult;
|
|
5010 |
}
|
|
5011 |
|
|
5012 |
|
|
5013 |
|
|
5014 |
|
|
5015 |
|
|
5016 |
|
|
5017 |
CTestStepAudOutStreamSetProp* CTestStepAudOutStreamSetProp::NewL(const TDesC& aTestName)
|
|
5018 |
{
|
|
5019 |
CTestStepAudOutStreamSetProp* self = new(ELeave) CTestStepAudOutStreamSetProp(aTestName);
|
|
5020 |
return self;
|
|
5021 |
}
|
|
5022 |
|
|
5023 |
CTestStepAudOutStreamSetProp::CTestStepAudOutStreamSetProp(const TDesC& aTestName)
|
|
5024 |
{
|
|
5025 |
iTestStepResult = EPass;
|
|
5026 |
// store the name of this test case
|
|
5027 |
// this is the name that is used by the script file
|
|
5028 |
iTestStepName = aTestName;
|
|
5029 |
}
|
|
5030 |
|
|
5031 |
CTestStepAudOutStreamSetProp::~CTestStepAudOutStreamSetProp()
|
|
5032 |
{
|
|
5033 |
}
|
|
5034 |
|
|
5035 |
enum TVerdict CTestStepAudOutStreamSetProp::DoTestStepPreambleL(void)
|
|
5036 |
{
|
|
5037 |
enum TVerdict verdict;
|
|
5038 |
// this installs the scheduler
|
|
5039 |
verdict = CTestStepAudOutStream::DoTestStepPreambleL();
|
|
5040 |
|
|
5041 |
// if the parent preamble fails, we must fail too
|
|
5042 |
if (verdict != EPass)
|
|
5043 |
{
|
|
5044 |
return verdict;
|
|
5045 |
}
|
|
5046 |
|
|
5047 |
// Printing to the console and log file
|
|
5048 |
INFO_PRINTF1(_L("this test is setting the audio properties of an Audio Output Stream Utility Class"));
|
|
5049 |
|
|
5050 |
iAudOutStream->Open(NULL);
|
|
5051 |
CActiveScheduler::Start();
|
|
5052 |
|
|
5053 |
return verdict;
|
|
5054 |
}
|
|
5055 |
|
|
5056 |
TVerdict CTestStepAudOutStreamSetProp::DoTestStepL()
|
|
5057 |
{
|
|
5058 |
TInt err = KErrNone;
|
|
5059 |
|
|
5060 |
// test 1
|
|
5061 |
TRAP(err, iAudOutStream->SetAudioPropertiesL(TMdaAudioDataSettings::ESampleRate8000Hz,TMdaAudioDataSettings::EChannelsMono) );
|
|
5062 |
if (!(err == KErrNone ||
|
|
5063 |
err == KErrNotSupported) )
|
|
5064 |
{
|
|
5065 |
return EFail;
|
|
5066 |
}
|
|
5067 |
|
|
5068 |
|
|
5069 |
// test2
|
|
5070 |
// fails with the enum values, correct?
|
|
5071 |
TRAP(err, iAudOutStream->SetAudioPropertiesL(TMdaAudioDataSettings::ESampleRate44100Hz,TMdaAudioDataSettings::EChannelsStereo) );
|
|
5072 |
|
|
5073 |
if (!(err == KErrNone ||
|
|
5074 |
err == KErrNotSupported) )
|
|
5075 |
{
|
|
5076 |
return EFail;
|
|
5077 |
}
|
|
5078 |
|
|
5079 |
else
|
|
5080 |
return EPass;
|
|
5081 |
}
|
|
5082 |
|
|
5083 |
|
|
5084 |
|
|
5085 |
|
|
5086 |
|
|
5087 |
|
|
5088 |
|
|
5089 |
CTestStepAudOutStreamOpen* CTestStepAudOutStreamOpen::NewL(const TDesC& aTestName)
|
|
5090 |
{
|
|
5091 |
CTestStepAudOutStreamOpen* self = new(ELeave) CTestStepAudOutStreamOpen(aTestName);
|
|
5092 |
return self;
|
|
5093 |
}
|
|
5094 |
|
|
5095 |
CTestStepAudOutStreamOpen::CTestStepAudOutStreamOpen(const TDesC& aTestName)
|
|
5096 |
{
|
|
5097 |
iTestStepResult = EPass;
|
|
5098 |
// store the name of this test case
|
|
5099 |
// this is the name that is used by the script file
|
|
5100 |
iTestStepName = aTestName;
|
|
5101 |
}
|
|
5102 |
|
|
5103 |
enum TVerdict CTestStepAudOutStreamOpen::DoTestStepPreambleL(void)
|
|
5104 |
{
|
|
5105 |
enum TVerdict verdict;
|
|
5106 |
// this installs the scheduler and initialises the iAudOutStream
|
|
5107 |
verdict = CTestStepAudOutStream::DoTestStepPreambleL();
|
|
5108 |
INFO_PRINTF1(_L("this test is openning an Audio Output Stream Utility Class"));
|
|
5109 |
return verdict;
|
|
5110 |
}
|
|
5111 |
|
|
5112 |
TVerdict CTestStepAudOutStreamOpen::DoTestStepL()
|
|
5113 |
{
|
|
5114 |
TInt err = KErrNone;
|
|
5115 |
|
|
5116 |
TMdaAudioDataSettings settings;
|
|
5117 |
settings.Query();
|
|
5118 |
settings.iSampleRate = TMdaAudioDataSettings::ESampleRate8000Hz; // ESampleRateAnyInRange
|
|
5119 |
settings.iChannels = TMdaAudioDataSettings::EChannelsStereo;
|
|
5120 |
settings.iFlags = TMdaAudioDataSettings::ENoNetworkRouting;
|
|
5121 |
settings.iVolume = 0;
|
|
5122 |
|
|
5123 |
iAudOutStream->Open(&settings);
|
|
5124 |
CActiveScheduler::Start();
|
|
5125 |
|
|
5126 |
if (iAudOutStream == NULL)
|
|
5127 |
{
|
|
5128 |
err = KErrNotReady;
|
|
5129 |
}
|
|
5130 |
|
|
5131 |
if (iError != KErrNone ||
|
|
5132 |
err != KErrNone)
|
|
5133 |
{
|
|
5134 |
return EFail;
|
|
5135 |
}
|
|
5136 |
|
|
5137 |
else
|
|
5138 |
{
|
|
5139 |
return EPass;
|
|
5140 |
}
|
|
5141 |
}
|
|
5142 |
|
|
5143 |
|
|
5144 |
|
|
5145 |
CTestStepAudOutStreamSetVol* CTestStepAudOutStreamSetVol::NewL(const TDesC& aTestName)
|
|
5146 |
{
|
|
5147 |
CTestStepAudOutStreamSetVol* self = new(ELeave) CTestStepAudOutStreamSetVol(aTestName);
|
|
5148 |
return self;
|
|
5149 |
}
|
|
5150 |
|
|
5151 |
CTestStepAudOutStreamSetVol::CTestStepAudOutStreamSetVol(const TDesC& aTestName)
|
|
5152 |
{
|
|
5153 |
iTestStepResult = EPass;
|
|
5154 |
// store the name of this test case
|
|
5155 |
// this is the name that is used by the script file
|
|
5156 |
iTestStepName = aTestName;
|
|
5157 |
}
|
|
5158 |
|
|
5159 |
CTestStepAudOutStreamSetVol::~CTestStepAudOutStreamSetVol()
|
|
5160 |
{
|
|
5161 |
}
|
|
5162 |
|
|
5163 |
/**
|
|
5164 |
* Implementation of the MMdaAudioOuputStreamCallback interface functions
|
|
5165 |
**/
|
|
5166 |
void CTestStepAudOutStreamSetVol::MaoscOpenComplete(TInt /*aError*/)
|
|
5167 |
{
|
|
5168 |
}
|
|
5169 |
void CTestStepAudOutStreamSetVol::MaoscBufferCopied(TInt /*aError*/, const TDesC8& /*aBuffer*/)
|
|
5170 |
{
|
|
5171 |
}
|
|
5172 |
void CTestStepAudOutStreamSetVol::MaoscPlayComplete(TInt /*aError*/)
|
|
5173 |
{
|
|
5174 |
}
|
|
5175 |
|
|
5176 |
enum TVerdict CTestStepAudOutStreamSetVol::DoTestStepPreambleL(void)
|
|
5177 |
{
|
|
5178 |
enum TVerdict verdict;
|
|
5179 |
// this installs the scheduler
|
|
5180 |
verdict = CTestMmfAclntStep::DoTestStepPreambleL();
|
|
5181 |
// Printing to the console and log file
|
|
5182 |
INFO_PRINTF1(_L("this test is setting the volume of an Audio Output Stream Utility Class"));
|
|
5183 |
|
|
5184 |
TRAPD(err, iAudOutStream = CMdaAudioOutputStream::NewL(*this) );
|
|
5185 |
|
|
5186 |
if (err != KErrNone ||
|
|
5187 |
iAudOutStream == NULL)
|
|
5188 |
{
|
|
5189 |
return EInconclusive;
|
|
5190 |
}
|
|
5191 |
|
|
5192 |
return verdict;
|
|
5193 |
}
|
|
5194 |
|
|
5195 |
enum TVerdict CTestStepAudOutStreamSetVol::DoTestStepPostambleL(void)
|
|
5196 |
{
|
|
5197 |
delete iAudOutStream;
|
|
5198 |
iAudOutStream = NULL;
|
|
5199 |
//[ Destroy the scheduler ]
|
|
5200 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
5201 |
}
|
|
5202 |
|
|
5203 |
|
|
5204 |
TVerdict CTestStepAudOutStreamSetVol::DoTestStepL()
|
|
5205 |
{
|
|
5206 |
TInt vol = iAudOutStream->MaxVolume()/2;
|
|
5207 |
if (vol < 0)
|
|
5208 |
{
|
|
5209 |
return EFail;
|
|
5210 |
}
|
|
5211 |
|
|
5212 |
//set the volume
|
|
5213 |
iAudOutStream->SetVolume(vol);
|
|
5214 |
|
|
5215 |
//get the volume
|
|
5216 |
TInt rvol = iAudOutStream->Volume();
|
|
5217 |
if (vol != rvol )
|
|
5218 |
{
|
|
5219 |
return EFail;
|
|
5220 |
}
|
|
5221 |
|
|
5222 |
else
|
|
5223 |
{
|
|
5224 |
iTestStepResult = EPass;
|
|
5225 |
}
|
|
5226 |
|
|
5227 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
5228 |
// test steps return a result
|
|
5229 |
return iTestStepResult;
|
|
5230 |
}
|
|
5231 |
|
|
5232 |
|
|
5233 |
|
|
5234 |
|
|
5235 |
CTestStepAudOutStreamSetBalance* CTestStepAudOutStreamSetBalance::NewL(const TDesC& aTestName)
|
|
5236 |
{
|
|
5237 |
CTestStepAudOutStreamSetBalance* self = new(ELeave) CTestStepAudOutStreamSetBalance(aTestName);
|
|
5238 |
return self;
|
|
5239 |
}
|
|
5240 |
|
|
5241 |
CTestStepAudOutStreamSetBalance::CTestStepAudOutStreamSetBalance(const TDesC& aTestName)
|
|
5242 |
{
|
|
5243 |
iTestStepResult = EPass;
|
|
5244 |
// store the name of this test case
|
|
5245 |
// this is the name that is used by the script file
|
|
5246 |
iTestStepName = aTestName;
|
|
5247 |
}
|
|
5248 |
|
|
5249 |
|
|
5250 |
CTestStepAudOutStreamSetBalance::~CTestStepAudOutStreamSetBalance()
|
|
5251 |
{
|
|
5252 |
}
|
|
5253 |
|
|
5254 |
void CTestStepAudOutStreamSetBalance::MaoscOpenComplete(TInt /*aError*/)
|
|
5255 |
{
|
|
5256 |
}
|
|
5257 |
void CTestStepAudOutStreamSetBalance::MaoscBufferCopied(TInt /*aError*/, const TDesC8& /*aBuffer*/)
|
|
5258 |
{
|
|
5259 |
}
|
|
5260 |
void CTestStepAudOutStreamSetBalance::MaoscPlayComplete(TInt /*aError*/)
|
|
5261 |
{
|
|
5262 |
}
|
|
5263 |
|
|
5264 |
enum TVerdict CTestStepAudOutStreamSetBalance::DoTestStepPreambleL(void)
|
|
5265 |
{
|
|
5266 |
enum TVerdict verdict;
|
|
5267 |
// this installs the scheduler
|
|
5268 |
verdict = CTestMmfAclntStep::DoTestStepPreambleL();
|
|
5269 |
|
|
5270 |
// Printing to the console and log file
|
|
5271 |
INFO_PRINTF1(_L("this test is setting and getting the balance of an Audio Output Stream Utility Class"));
|
|
5272 |
|
|
5273 |
TRAPD(err, iAudOutStream = CMdaAudioOutputStream::NewL(*this) );
|
|
5274 |
|
|
5275 |
if (err != KErrNone ||
|
|
5276 |
iAudOutStream == NULL )
|
|
5277 |
{
|
|
5278 |
return EInconclusive;
|
|
5279 |
}
|
|
5280 |
|
|
5281 |
|
|
5282 |
return verdict;
|
|
5283 |
}
|
|
5284 |
|
|
5285 |
enum TVerdict CTestStepAudOutStreamSetBalance::DoTestStepPostambleL(void)
|
|
5286 |
{
|
|
5287 |
delete iAudOutStream;
|
|
5288 |
iAudOutStream = NULL;
|
|
5289 |
|
|
5290 |
//[ Destroy the scheduler ]
|
|
5291 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
5292 |
}
|
|
5293 |
|
|
5294 |
|
|
5295 |
TVerdict CTestStepAudOutStreamSetBalance::DoTestStepL()
|
|
5296 |
{
|
|
5297 |
TInt bal = 0;
|
|
5298 |
|
|
5299 |
TRAPD(err, iAudOutStream->SetBalanceL()); // default KMMFBalanceCenter
|
|
5300 |
if (err != KErrNone)
|
|
5301 |
{
|
|
5302 |
return EFail; // we expect this _will_ be supported for Typhoon
|
|
5303 |
}
|
|
5304 |
|
|
5305 |
//get the balance
|
|
5306 |
TRAP(err, bal = iAudOutStream->GetBalanceL());
|
|
5307 |
if (err != KErrNone)
|
|
5308 |
{
|
|
5309 |
return EFail; // we expect this _will_ be supported for Typhoon
|
|
5310 |
}
|
|
5311 |
|
|
5312 |
if (bal != KMMFBalanceCenter)
|
|
5313 |
{
|
|
5314 |
return EFail;
|
|
5315 |
}
|
|
5316 |
|
|
5317 |
TRAP(err, iAudOutStream->SetBalanceL(KMMFBalanceMaxRight));
|
|
5318 |
if (err != KErrNone)
|
|
5319 |
{
|
|
5320 |
return EFail; // we expect this _will_ be supported for Typhoon
|
|
5321 |
}
|
|
5322 |
|
|
5323 |
//get the balance
|
|
5324 |
TRAP(err, bal = iAudOutStream->GetBalanceL());
|
|
5325 |
if (err != KErrNone)
|
|
5326 |
{
|
|
5327 |
return EFail; // we expect this _will_ be supported for Typhoon
|
|
5328 |
}
|
|
5329 |
|
|
5330 |
if (bal != KMMFBalanceMaxRight)
|
|
5331 |
{
|
|
5332 |
return EFail;
|
|
5333 |
}
|
|
5334 |
|
|
5335 |
TRAP(err, iAudOutStream->SetBalanceL(KMMFBalanceMaxLeft));
|
|
5336 |
if (err != KErrNone)
|
|
5337 |
{
|
|
5338 |
return EFail; // we expect this _will_ be supported for Typhoon
|
|
5339 |
}
|
|
5340 |
|
|
5341 |
//get the balance
|
|
5342 |
TRAP(err, bal = iAudOutStream->GetBalanceL());
|
|
5343 |
if (err != KErrNone)
|
|
5344 |
{
|
|
5345 |
return EFail; // we expect this _will_ be supported for Typhoon
|
|
5346 |
}
|
|
5347 |
|
|
5348 |
if (bal != KMMFBalanceMaxLeft)
|
|
5349 |
{
|
|
5350 |
return EFail;
|
|
5351 |
}
|
|
5352 |
|
|
5353 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
5354 |
// test steps return a result
|
|
5355 |
return iTestStepResult;
|
|
5356 |
}
|
|
5357 |
|
|
5358 |
|
|
5359 |
|
|
5360 |
|
|
5361 |
|
|
5362 |
|
|
5363 |
CTestStepAudOutStreamSetPrior* CTestStepAudOutStreamSetPrior::NewL(const TDesC& aTestName)
|
|
5364 |
{
|
|
5365 |
CTestStepAudOutStreamSetPrior* self = new(ELeave) CTestStepAudOutStreamSetPrior(aTestName);
|
|
5366 |
return self;
|
|
5367 |
}
|
|
5368 |
|
|
5369 |
CTestStepAudOutStreamSetPrior::CTestStepAudOutStreamSetPrior(const TDesC& aTestName)
|
|
5370 |
{
|
|
5371 |
iTestStepResult = EPass;
|
|
5372 |
// store the name of this test case
|
|
5373 |
// this is the name that is used by the script file
|
|
5374 |
iTestStepName = aTestName;
|
|
5375 |
}
|
|
5376 |
|
|
5377 |
CTestStepAudOutStreamSetPrior::~CTestStepAudOutStreamSetPrior()
|
|
5378 |
{
|
|
5379 |
}
|
|
5380 |
|
|
5381 |
enum TVerdict CTestStepAudOutStreamSetPrior::DoTestStepPreambleL(void)
|
|
5382 |
{
|
|
5383 |
enum TVerdict verdict;
|
|
5384 |
// this installs the scheduler
|
|
5385 |
verdict = CTestStepAudOutStream::DoTestStepPreambleL();
|
|
5386 |
// Printing to the console and log file
|
|
5387 |
INFO_PRINTF1(_L("this test is setting the audio priorities of an Audio Output Stream Utility Class"));
|
|
5388 |
|
|
5389 |
// if the parent preamble fails, we must fail too
|
|
5390 |
if (verdict != EPass)
|
|
5391 |
{
|
|
5392 |
return verdict;
|
|
5393 |
}
|
|
5394 |
|
|
5395 |
iAudOutStream->Open(NULL);
|
|
5396 |
CActiveScheduler::Start();
|
|
5397 |
|
|
5398 |
TInt err = KErrNone;
|
|
5399 |
if(iAudOutStream==NULL)
|
|
5400 |
{
|
|
5401 |
err = KErrNotReady;
|
|
5402 |
}
|
|
5403 |
|
|
5404 |
if (iError != KErrNone ||
|
|
5405 |
err != KErrNone)
|
|
5406 |
{
|
|
5407 |
return EInconclusive;
|
|
5408 |
}
|
|
5409 |
|
|
5410 |
|
|
5411 |
return verdict;
|
|
5412 |
}
|
|
5413 |
|
|
5414 |
enum TVerdict CTestStepAudOutStreamSetPrior::DoTestStepPostambleL(void)
|
|
5415 |
{
|
|
5416 |
//[ Destroy the scheduler ]
|
|
5417 |
return CTestStepAudOutStream::DoTestStepPostambleL();
|
|
5418 |
}
|
|
5419 |
|
|
5420 |
TVerdict CTestStepAudOutStreamSetPrior::DoTestStepL()
|
|
5421 |
{
|
|
5422 |
// test 1
|
|
5423 |
iAudOutStream->SetPriority(EMdaPriorityMin, EMdaPriorityPreferenceTime);
|
|
5424 |
|
|
5425 |
// test2
|
|
5426 |
iAudOutStream->SetPriority(EMdaPriorityMax, EMdaPriorityPreferenceQuality);
|
|
5427 |
|
|
5428 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
5429 |
// test steps return a result
|
|
5430 |
return iTestStepResult;
|
|
5431 |
}
|
|
5432 |
|
|
5433 |
|
|
5434 |
|
|
5435 |
|
|
5436 |
|
|
5437 |
CTestStepAudOutStreamStop* CTestStepAudOutStreamStop::NewL(const TDesC& aTestName)
|
|
5438 |
{
|
|
5439 |
CTestStepAudOutStreamStop* self = new(ELeave) CTestStepAudOutStreamStop(aTestName);
|
|
5440 |
return self;
|
|
5441 |
}
|
|
5442 |
|
|
5443 |
CTestStepAudOutStreamStop::CTestStepAudOutStreamStop(const TDesC& aTestName)
|
|
5444 |
{
|
|
5445 |
iTestStepResult = EPass;
|
|
5446 |
// store the name of this test case
|
|
5447 |
// this is the name that is used by the script file
|
|
5448 |
iTestStepName = aTestName;
|
|
5449 |
}
|
|
5450 |
|
|
5451 |
CTestStepAudOutStreamStop::~CTestStepAudOutStreamStop()
|
|
5452 |
{
|
|
5453 |
}
|
|
5454 |
|
|
5455 |
enum TVerdict CTestStepAudOutStreamStop::DoTestStepPreambleL(void)
|
|
5456 |
{
|
|
5457 |
iTestStepResult = EPass;
|
|
5458 |
enum TVerdict verdict;
|
|
5459 |
// this installs the scheduler
|
|
5460 |
verdict = CTestStepAudOutStream::DoTestStepPreambleL();
|
|
5461 |
|
|
5462 |
// if the parent preamble fails, we must fail too
|
|
5463 |
if (verdict != EPass)
|
|
5464 |
{
|
|
5465 |
return verdict;
|
|
5466 |
}
|
|
5467 |
|
|
5468 |
// Printing to the console and log file
|
|
5469 |
INFO_PRINTF1(_L("this test is stopping a playing Audio Output Stream Utility Class: Stop()"));
|
|
5470 |
|
|
5471 |
iAudOutStream->Open(NULL);
|
|
5472 |
CActiveScheduler::Start();
|
|
5473 |
iAudOutStream->SetVolume(iAudOutStream->MaxVolume()>>1); // half volume
|
|
5474 |
|
|
5475 |
|
|
5476 |
TInt err = KErrNone;
|
|
5477 |
if(iAudOutStream==NULL)
|
|
5478 |
{
|
|
5479 |
err=KErrNotReady;
|
|
5480 |
}
|
|
5481 |
|
|
5482 |
if (iError != KErrNone ||
|
|
5483 |
err != KErrNone)
|
|
5484 |
{
|
|
5485 |
return EInconclusive;
|
|
5486 |
}
|
|
5487 |
|
|
5488 |
err = iFile.Open(iFs, KStreamRawFile, EFileRead);
|
|
5489 |
if (err != KErrNone)
|
|
5490 |
{
|
|
5491 |
return EInconclusive;
|
|
5492 |
}
|
|
5493 |
|
|
5494 |
// start feeding the outputStream
|
|
5495 |
iReadBufferActive->Read(); // finally calls CMdaAudioOutputStream::WriteL(...)
|
|
5496 |
CIdle* idleStopper = CIdle::NewL(CActive::EPriorityStandard);
|
|
5497 |
idleStopper->Start(TCallBack(stopActiveScheduler));
|
|
5498 |
CActiveScheduler::Start();
|
|
5499 |
delete idleStopper;
|
|
5500 |
|
|
5501 |
if(iAudOutStream==NULL)
|
|
5502 |
{
|
|
5503 |
err = KErrNotReady;
|
|
5504 |
}
|
|
5505 |
|
|
5506 |
if (err != KErrNone)
|
|
5507 |
{
|
|
5508 |
return EInconclusive;
|
|
5509 |
}
|
|
5510 |
|
|
5511 |
return verdict;
|
|
5512 |
}
|
|
5513 |
|
|
5514 |
enum TVerdict CTestStepAudOutStreamStop::DoTestStepPostambleL(void)
|
|
5515 |
{
|
|
5516 |
iFile.Close();
|
|
5517 |
|
|
5518 |
//[ Destroy the scheduler, delete the iAudOutStream, close the file system
|
|
5519 |
return CTestStepAudOutStream::DoTestStepPostambleL();
|
|
5520 |
}
|
|
5521 |
|
|
5522 |
TInt StopAudOutStream(TAny* aAudOutStream)
|
|
5523 |
{
|
|
5524 |
REINTERPRET_CAST(CMdaAudioOutputStream*, aAudOutStream)->Stop();
|
|
5525 |
return FALSE;
|
|
5526 |
}
|
|
5527 |
|
|
5528 |
|
|
5529 |
TVerdict CTestStepAudOutStreamStop::DoTestStepL()
|
|
5530 |
{
|
|
5531 |
TInt err = KErrNone;
|
|
5532 |
// stream is playing now from preamble
|
|
5533 |
// wait a fraction of the stream duration before stopping
|
|
5534 |
CCallBackTimer* callBackTimer = CCallBackTimer::NewL(TCallBack(StopAudOutStream, iAudOutStream));
|
|
5535 |
callBackTimer->After(1000000);
|
|
5536 |
CActiveScheduler::Start();
|
|
5537 |
|
|
5538 |
if(iAudOutStream==NULL)
|
|
5539 |
{
|
|
5540 |
err=KErrNotReady;
|
|
5541 |
}
|
|
5542 |
|
|
5543 |
if (iError != KErrCancel || // KErrAbort(?KErrCancel seems to be what is returned) is supposed to be returned ny the MaoscBufferCopied
|
|
5544 |
err != KErrNone)
|
|
5545 |
{
|
|
5546 |
INFO_PRINTF2(_L("Test failed with error %d"), iError);
|
|
5547 |
return EFail;
|
|
5548 |
}
|
|
5549 |
|
|
5550 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
5551 |
// test steps return a result
|
|
5552 |
return iTestStepResult;
|
|
5553 |
}
|
|
5554 |
|
|
5555 |
|
|
5556 |
|
|
5557 |
|
|
5558 |
|
|
5559 |
CTestStepAudOutStreamPosition* CTestStepAudOutStreamPosition::NewL(const TDesC& aTestName)
|
|
5560 |
{
|
|
5561 |
CTestStepAudOutStreamPosition* self = new(ELeave) CTestStepAudOutStreamPosition(aTestName);
|
|
5562 |
return self;
|
|
5563 |
}
|
|
5564 |
|
|
5565 |
CTestStepAudOutStreamPosition::CTestStepAudOutStreamPosition(const TDesC& aTestName)
|
|
5566 |
{
|
|
5567 |
iTestStepResult = EPass;
|
|
5568 |
// store the name of this test case
|
|
5569 |
// this is the name that is used by the script file
|
|
5570 |
iTestStepName = aTestName;
|
|
5571 |
}
|
|
5572 |
|
|
5573 |
CTestStepAudOutStreamPosition::~CTestStepAudOutStreamPosition()
|
|
5574 |
{
|
|
5575 |
}
|
|
5576 |
|
|
5577 |
enum TVerdict CTestStepAudOutStreamPosition::DoTestStepPreambleL(void)
|
|
5578 |
{
|
|
5579 |
iTestStepResult = EPass;
|
|
5580 |
enum TVerdict verdict;
|
|
5581 |
// this installs the scheduler
|
|
5582 |
verdict = CTestStepAudOutStream::DoTestStepPreambleL();
|
|
5583 |
|
|
5584 |
// if the parent preamble fails, we must fail too
|
|
5585 |
if (verdict != EPass)
|
|
5586 |
{
|
|
5587 |
return verdict;
|
|
5588 |
}
|
|
5589 |
|
|
5590 |
|
|
5591 |
// Printing to the console and log file
|
|
5592 |
INFO_PRINTF1(_L("this test is getting the position of a playing Audio Output Stream Utility Class: Position()"));
|
|
5593 |
|
|
5594 |
iAudOutStream->Open(NULL);
|
|
5595 |
CActiveScheduler::Start();
|
|
5596 |
iAudOutStream->SetVolume(iAudOutStream->MaxVolume()>>1); // half volume
|
|
5597 |
TInt err = KErrNone;
|
|
5598 |
if(iAudOutStream==NULL)
|
|
5599 |
{
|
|
5600 |
err = KErrNotReady;
|
|
5601 |
}
|
|
5602 |
|
|
5603 |
if (iError != KErrNone ||
|
|
5604 |
err != KErrNone )
|
|
5605 |
{
|
|
5606 |
return EInconclusive;
|
|
5607 |
}
|
|
5608 |
|
|
5609 |
err = iFile.Open(iFs, KStreamRawFile, EFileRead);
|
|
5610 |
if (err != KErrNone)
|
|
5611 |
{
|
|
5612 |
return EInconclusive;
|
|
5613 |
}
|
|
5614 |
|
|
5615 |
// start feeding the outputStream
|
|
5616 |
iReadBufferActive->Read(); // finally calls CMdaAudioOutputStream::WriteL(...)
|
|
5617 |
CIdle* idleStopper = CIdle::NewL(CActive::EPriorityStandard);
|
|
5618 |
idleStopper->Start(TCallBack(stopActiveScheduler));
|
|
5619 |
CActiveScheduler::Start();
|
|
5620 |
delete idleStopper;
|
|
5621 |
|
|
5622 |
if(iAudOutStream==NULL)
|
|
5623 |
{
|
|
5624 |
err = KErrNotReady;
|
|
5625 |
}
|
|
5626 |
|
|
5627 |
if (err != KErrNone)
|
|
5628 |
{
|
|
5629 |
return EInconclusive;
|
|
5630 |
}
|
|
5631 |
|
|
5632 |
return verdict;
|
|
5633 |
}
|
|
5634 |
|
|
5635 |
|
|
5636 |
enum TVerdict CTestStepAudOutStreamPosition::DoTestStepPostambleL(void)
|
|
5637 |
{
|
|
5638 |
iFile.Close();
|
|
5639 |
|
|
5640 |
//[ Destroy the scheduler, delete the iAudOutStream, close the file system
|
|
5641 |
return CTestStepAudOutStream::DoTestStepPostambleL();
|
|
5642 |
}
|
|
5643 |
|
|
5644 |
TVerdict CTestStepAudOutStreamPosition::DoTestStepL()
|
|
5645 |
{
|
|
5646 |
if(iAudOutStream==NULL)
|
|
5647 |
{
|
|
5648 |
return EFail;
|
|
5649 |
}
|
|
5650 |
|
|
5651 |
// Get the position before and after a 5s play;
|
|
5652 |
// We are asking for a two seconds play window, but due to scheduling issues etc,
|
|
5653 |
// we may not get exactly what we want. However we can more accurately find out
|
|
5654 |
// what we got by asking for the elapsed clock ticks during that time.
|
|
5655 |
// This test fails if waittime < 5 seconds, needs more wait time to calculate accuractely
|
|
5656 |
const TInt KWaitTime = 5000000; // 5s
|
|
5657 |
CCallBackTimer* callBackTimer = CCallBackTimer::NewL(TCallBack(stopActiveScheduler), CActive::EPriorityStandard);
|
|
5658 |
callBackTimer->After(KWaitTime);
|
|
5659 |
const TTimeIntervalMicroSeconds pos1 = iAudOutStream->Position();
|
|
5660 |
const TInt tick1 = User::TickCount();
|
|
5661 |
CActiveScheduler::Start();
|
|
5662 |
delete callBackTimer;
|
|
5663 |
const TTimeIntervalMicroSeconds pos2 = iAudOutStream->Position();
|
|
5664 |
const TInt tick2 = User::TickCount();
|
|
5665 |
|
|
5666 |
// How much did the postion move by, and in how much time?
|
|
5667 |
TInt tickPeriod = 0;
|
|
5668 |
if (HAL::Get(HALData::ESystemTickPeriod, tickPeriod) != KErrNone)
|
|
5669 |
{
|
|
5670 |
return EInconclusive;
|
|
5671 |
}
|
|
5672 |
|
|
5673 |
const TInt64 KDiffPosition = pos2.Int64() - pos1.Int64();
|
|
5674 |
const TInt KElapsedTime = (tick2 - tick1) * tickPeriod;
|
|
5675 |
|
|
5676 |
// Is the position diff inside an acceptable range?
|
|
5677 |
const TReal KTolerance = 0.2; // 20%
|
|
5678 |
const TInt KDelta = static_cast<TInt>(static_cast<TReal>(KElapsedTime) * KTolerance); // yuk
|
|
5679 |
const TInt KMin = KElapsedTime - KDelta;
|
|
5680 |
const TInt KMax = KElapsedTime + KDelta;
|
|
5681 |
INFO_PRINTF5 (_L("Step One:\tActual: %ld, Expected: %d, Min: %d, Max: %d"), KDiffPosition, KElapsedTime, KMin, KMax);
|
|
5682 |
if ((KDiffPosition < KMin) || (KDiffPosition > KMax))
|
|
5683 |
{
|
|
5684 |
return EFail;
|
|
5685 |
}
|
|
5686 |
|
|
5687 |
|
|
5688 |
CIdle* idleStopper = CIdle::NewL(CActive::EPriorityStandard);
|
|
5689 |
idleStopper->Start(TCallBack(StopAudOutStream, iAudOutStream));
|
|
5690 |
CActiveScheduler::Start();
|
|
5691 |
delete idleStopper;
|
|
5692 |
|
|
5693 |
if (iError != KErrCancel)
|
|
5694 |
{
|
|
5695 |
// KErrCancel (KErrAbort is supposed to be returned ny the MaoscBufferCopied??)
|
|
5696 |
INFO_PRINTF2(_L("Test failed with error %d"), iError);
|
|
5697 |
return EFail;
|
|
5698 |
}
|
|
5699 |
|
|
5700 |
|
|
5701 |
// Get the position. For a stopped stream, this should always be zero.
|
|
5702 |
TTimeIntervalMicroSeconds pos = iAudOutStream->Position();
|
|
5703 |
INFO_PRINTF2(_L("Step Two:\tActual: %ld, Expected: 0"), pos.Int64());
|
|
5704 |
if (pos.Int64() != 0)
|
|
5705 |
{
|
|
5706 |
return EFail;
|
|
5707 |
}
|
|
5708 |
|
|
5709 |
|
|
5710 |
//xxx try cotinuing playing and get positions while playing if there is more time.
|
|
5711 |
|
|
5712 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
5713 |
// test steps return a result
|
|
5714 |
return EPass;
|
|
5715 |
}
|
|
5716 |
|
|
5717 |
|
|
5718 |
|
|
5719 |
CTestStepAudOutStreamGetBytes* CTestStepAudOutStreamGetBytes::NewL(const TDesC& aTestName)
|
|
5720 |
{
|
|
5721 |
CTestStepAudOutStreamGetBytes* self = new(ELeave) CTestStepAudOutStreamGetBytes(aTestName);
|
|
5722 |
return self;
|
|
5723 |
}
|
|
5724 |
|
|
5725 |
CTestStepAudOutStreamGetBytes::CTestStepAudOutStreamGetBytes(const TDesC& aTestName)
|
|
5726 |
{
|
|
5727 |
iTestStepResult = EPass;
|
|
5728 |
// store the name of this test case
|
|
5729 |
// this is the name that is used by the script file
|
|
5730 |
iTestStepName = aTestName;
|
|
5731 |
}
|
|
5732 |
|
|
5733 |
CTestStepAudOutStreamGetBytes::~CTestStepAudOutStreamGetBytes()
|
|
5734 |
{
|
|
5735 |
}
|
|
5736 |
|
|
5737 |
enum TVerdict CTestStepAudOutStreamGetBytes::DoTestStepPreambleL(void)
|
|
5738 |
{
|
|
5739 |
iTestStepResult = EPass;
|
|
5740 |
enum TVerdict verdict;
|
|
5741 |
// this installs the scheduler
|
|
5742 |
verdict = CTestStepAudOutStream::DoTestStepPreambleL();
|
|
5743 |
|
|
5744 |
// if the parent preamble fails, we must fail too
|
|
5745 |
if (verdict != EPass)
|
|
5746 |
{
|
|
5747 |
return verdict;
|
|
5748 |
}
|
|
5749 |
|
|
5750 |
|
|
5751 |
// Printing to the console and log file
|
|
5752 |
INFO_PRINTF1(_L("this test gets the bytes rendered by the H/W until this moment: GetBytes()"));
|
|
5753 |
|
|
5754 |
iAudOutStream->Open(NULL);
|
|
5755 |
CActiveScheduler::Start();
|
|
5756 |
iAudOutStream->SetVolume(iAudOutStream->MaxVolume()>>1); // half volume
|
|
5757 |
|
|
5758 |
TInt err = KErrNone;
|
|
5759 |
if(iAudOutStream==NULL)
|
|
5760 |
{
|
|
5761 |
err = KErrNotReady;
|
|
5762 |
}
|
|
5763 |
|
|
5764 |
if (iError != KErrNone ||
|
|
5765 |
err != KErrNone)
|
|
5766 |
{
|
|
5767 |
return EInconclusive;
|
|
5768 |
}
|
|
5769 |
|
|
5770 |
err = iFile.Open(iFs, KStreamRawFile, EFileRead);
|
|
5771 |
if (err != KErrNone)
|
|
5772 |
{
|
|
5773 |
return EInconclusive;
|
|
5774 |
}
|
|
5775 |
|
|
5776 |
|
|
5777 |
// start feeding the outputStream
|
|
5778 |
iReadBufferActive->Read(); // finally calls CMdaAudioOutputStream::WriteL(...)
|
|
5779 |
CIdle* idleStopper = CIdle::NewL(CActive::EPriorityStandard);
|
|
5780 |
idleStopper->Start(TCallBack(stopActiveScheduler));
|
|
5781 |
CActiveScheduler::Start();
|
|
5782 |
delete idleStopper;
|
|
5783 |
|
|
5784 |
if(iAudOutStream==NULL)
|
|
5785 |
{
|
|
5786 |
err = KErrNotReady;
|
|
5787 |
}
|
|
5788 |
|
|
5789 |
if (err != KErrNone)
|
|
5790 |
{
|
|
5791 |
return EInconclusive;
|
|
5792 |
}
|
|
5793 |
|
|
5794 |
return verdict;
|
|
5795 |
}
|
|
5796 |
|
|
5797 |
enum TVerdict CTestStepAudOutStreamGetBytes::DoTestStepPostambleL(void)
|
|
5798 |
{
|
|
5799 |
iFile.Close();
|
|
5800 |
|
|
5801 |
//[ Destroy the scheduler, delete the iAudOutStream, close the file system
|
|
5802 |
return CTestStepAudOutStream::DoTestStepPostambleL();
|
|
5803 |
}
|
|
5804 |
|
|
5805 |
TVerdict CTestStepAudOutStreamGetBytes::DoTestStepL()
|
|
5806 |
{
|
|
5807 |
TInt bytes1 = iAudOutStream->GetBytes();
|
|
5808 |
CCallBackTimer* callBackTimer = CCallBackTimer::NewL(TCallBack(stopActiveScheduler));
|
|
5809 |
callBackTimer->After(2000000);
|
|
5810 |
CActiveScheduler::Start();
|
|
5811 |
if (iError != KErrNone)
|
|
5812 |
{
|
|
5813 |
INFO_PRINTF2(_L("Test failed with error %d"), iError);
|
|
5814 |
return EFail;
|
|
5815 |
}
|
|
5816 |
callBackTimer->Cancel(); // in case something else stopped the AS
|
|
5817 |
TInt bytes2 = iAudOutStream->GetBytes();
|
|
5818 |
callBackTimer->After(2000000);
|
|
5819 |
CActiveScheduler::Start();
|
|
5820 |
if (iError != KErrNone)
|
|
5821 |
{
|
|
5822 |
INFO_PRINTF2(_L("Test failed with error %d"), iError);
|
|
5823 |
return EFail;
|
|
5824 |
}
|
|
5825 |
delete callBackTimer;
|
|
5826 |
TInt bytes3 = iAudOutStream->GetBytes();
|
|
5827 |
|
|
5828 |
TInt fileSize;
|
|
5829 |
User::LeaveIfError(iFile.Size(fileSize));
|
|
5830 |
CActiveScheduler::Start(); // wait for sample to finish
|
|
5831 |
TInt bytes4 = iAudOutStream->GetBytes();
|
|
5832 |
if (bytes1 >= bytes2 || bytes2 >= bytes3 || bytes3 >= bytes4)
|
|
5833 |
{
|
|
5834 |
return EFail;
|
|
5835 |
}
|
|
5836 |
|
|
5837 |
if (bytes4 != fileSize)
|
|
5838 |
{
|
|
5839 |
return EFail;
|
|
5840 |
}
|
|
5841 |
|
|
5842 |
|
|
5843 |
INFO_PRINTF1(_L("finished with this test step"));
|
|
5844 |
// test steps return a result
|
|
5845 |
return iTestStepResult;
|
|
5846 |
}
|
|
5847 |
|
|
5848 |
|
|
5849 |
|
|
5850 |
|
|
5851 |
|
|
5852 |
//------------------------------------------------------------------
|
|
5853 |
|
|
5854 |
/**
|
|
5855 |
* Constructor baseclass
|
|
5856 |
*/
|
|
5857 |
CTestMmfAclntRecNoPlayback::CTestMmfAclntRecNoPlayback(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
5858 |
{
|
|
5859 |
// store the name of this test case
|
|
5860 |
// this is the name that is used by the script file
|
|
5861 |
// Each test step initialises it's own name
|
|
5862 |
iTestStepName = aTestName;
|
|
5863 |
iSectName = aSectName;
|
|
5864 |
iKeyName = aKeyName;
|
|
5865 |
}
|
|
5866 |
|
|
5867 |
void CTestMmfAclntRecNoPlayback::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt aCurrentState, TInt aErrorCode)
|
|
5868 |
{
|
|
5869 |
iError = aErrorCode;
|
|
5870 |
INFO_PRINTF1( _L("CTestMmfAclntRecNoPlayback : MMdaObjectStateChangeObserver Callback for CMdaAudioRecorderUtility complete"));
|
|
5871 |
INFO_PRINTF2( _L("iError %d "), iError);
|
|
5872 |
|
|
5873 |
//dont stop the playing track
|
|
5874 |
if (aCurrentState != CMdaAudioClipUtility::EPlaying || iError != KErrNone)
|
|
5875 |
{
|
|
5876 |
CActiveScheduler::Stop();
|
|
5877 |
}
|
|
5878 |
|
|
5879 |
}
|
|
5880 |
|
|
5881 |
|
|
5882 |
TVerdict CTestMmfAclntRecNoPlayback::DoTestStepPreambleL()
|
|
5883 |
{
|
|
5884 |
TVerdict ret = EPass;
|
|
5885 |
|
|
5886 |
// Make sure file doesn't exist (maybe from a previous test)
|
|
5887 |
TParse fullFileName;
|
|
5888 |
TBuf<KSizeBuf> filename;
|
|
5889 |
TPtrC filename1;
|
|
5890 |
|
|
5891 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
5892 |
{
|
|
5893 |
return EInconclusive;
|
|
5894 |
}
|
|
5895 |
|
|
5896 |
GetDriveName(filename);
|
|
5897 |
filename.Append(filename1);
|
|
5898 |
|
|
5899 |
|
|
5900 |
// parse the filenames
|
|
5901 |
if(!fullFileName.Set(filename, &KDefault, NULL))
|
|
5902 |
{
|
|
5903 |
RFs fs;
|
|
5904 |
User::LeaveIfError(fs.Connect());
|
|
5905 |
fs.SetAtt(fullFileName.FullName(), 0, KEntryAttReadOnly);
|
|
5906 |
TInt error = fs.Delete(fullFileName.FullName());
|
|
5907 |
|
|
5908 |
if(error == KErrPathNotFound)
|
|
5909 |
{
|
|
5910 |
error = fs.MkDirAll(fullFileName.DriveAndPath());
|
|
5911 |
INFO_PRINTF2(_L("Path for file %S was been created"), &fullFileName.FullName());
|
|
5912 |
}
|
|
5913 |
else if(error == KErrNotFound)
|
|
5914 |
INFO_PRINTF2(_L("No need to delete %S"), &fullFileName.FullName());
|
|
5915 |
else if(error==KErrNone)
|
|
5916 |
INFO_PRINTF2(_L("Deleted %S"), &fullFileName.FullName());
|
|
5917 |
else
|
|
5918 |
{
|
|
5919 |
ret = EInconclusive;
|
|
5920 |
}
|
|
5921 |
fs.Close();
|
|
5922 |
}
|
|
5923 |
|
|
5924 |
if((ret == EInconclusive) || (ret == EFail))
|
|
5925 |
{
|
|
5926 |
return ret;
|
|
5927 |
}
|
|
5928 |
|
|
5929 |
|
|
5930 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
|
5931 |
}
|
|
5932 |
|
|
5933 |
|
|
5934 |
TVerdict CTestMmfAclntRecNoPlayback::DoTestStepPostambleL()
|
|
5935 |
{
|
|
5936 |
if(IsFileTest())
|
|
5937 |
{
|
|
5938 |
// Cleanup after the test
|
|
5939 |
TParse fullFileName;
|
|
5940 |
TBuf<KSizeBuf> filename;
|
|
5941 |
TPtrC filename1;
|
|
5942 |
|
|
5943 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
5944 |
{
|
|
5945 |
return EInconclusive;
|
|
5946 |
}
|
|
5947 |
|
|
5948 |
|
|
5949 |
GetDriveName(filename);
|
|
5950 |
filename.Append(filename1);
|
|
5951 |
|
|
5952 |
|
|
5953 |
// parse the filenames
|
|
5954 |
if(!fullFileName.Set(filename, &KDefault, NULL))
|
|
5955 |
{
|
|
5956 |
RFs fs;
|
|
5957 |
User::LeaveIfError(fs.Connect());
|
|
5958 |
fs.SetAtt(fullFileName.FullName(), 0, KEntryAttReadOnly);
|
|
5959 |
TInt error = fs.Delete(fullFileName.FullName());
|
|
5960 |
|
|
5961 |
if(error != KErrNone)
|
|
5962 |
{
|
|
5963 |
INFO_PRINTF2(_L("Failed to delete %S"), &fullFileName.FullName());
|
|
5964 |
}
|
|
5965 |
}
|
|
5966 |
}
|
|
5967 |
|
|
5968 |
return CTestMmfAclntStep::DoTestStepPostambleL();
|
|
5969 |
}
|
|
5970 |
|
|
5971 |
|
|
5972 |
|
|
5973 |
|
|
5974 |
TVerdict CTestMmfAclntRecNoPlayback::DoTestStepL()
|
|
5975 |
{
|
|
5976 |
TVerdict testStatus = EPass;
|
|
5977 |
TInt trapRet = KErrNone;
|
|
5978 |
TInt ret = KErrNone;
|
|
5979 |
|
|
5980 |
const TInt durError = 2000000; //2 second
|
|
5981 |
const TInt posnError = 250000; //1/4 second
|
|
5982 |
const TInt cropError = 250000; //1/4 second
|
|
5983 |
|
|
5984 |
iRecorder = CMdaAudioRecorderUtilityLC();
|
|
5985 |
|
|
5986 |
if(!iRecorder)
|
|
5987 |
{
|
|
5988 |
testStatus = EFail;
|
|
5989 |
}
|
|
5990 |
|
|
5991 |
//Should always work, must be done before play or record to ensure in EPrimed state
|
|
5992 |
if(testStatus == EPass)
|
|
5993 |
{
|
|
5994 |
TRAP(trapRet,iRecorder->SetPriority(EMdaPriorityMin,EMdaPriorityPreferenceNone));
|
|
5995 |
if(trapRet != KErrNone)
|
|
5996 |
{
|
|
5997 |
INFO_PRINTF2(_L("SetPriority leave with error %d"),trapRet);
|
|
5998 |
testStatus = EFail;
|
|
5999 |
}
|
|
6000 |
}
|
|
6001 |
|
|
6002 |
|
|
6003 |
|
|
6004 |
if(testStatus == EPass)
|
|
6005 |
{
|
|
6006 |
iError = KErrTimedOut;
|
|
6007 |
iRecorder->RecordL();
|
|
6008 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
6009 |
CActiveScheduler::Start(); // open -> record
|
|
6010 |
|
|
6011 |
User::After(KTenSeconds);
|
|
6012 |
iRecorder->Stop();
|
|
6013 |
|
|
6014 |
testStatus = RecordSuccessfull();
|
|
6015 |
}
|
|
6016 |
|
|
6017 |
|
|
6018 |
//Can't detect difference in these interfaces with no play controller
|
|
6019 |
//void ClearPlayWindow();
|
|
6020 |
//void SetRepeats(....);
|
|
6021 |
//void Pause();
|
|
6022 |
//void SetMaxWriteLength(TInt aMaxWriteLength /*= KMdaClipLocationMaxWriteLengthNone*/);
|
|
6023 |
//void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
|
|
6024 |
//void SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, const TTimeIntervalMicroSeconds& aEnd);
|
|
6025 |
|
|
6026 |
|
|
6027 |
|
|
6028 |
|
|
6029 |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
6030 |
//These interfaces should always WORK if there is a record or playback controller
|
|
6031 |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
6032 |
|
|
6033 |
if(testStatus == EPass)
|
|
6034 |
{
|
|
6035 |
TTimeIntervalMicroSeconds setPosn(KTwoSeconds);
|
|
6036 |
|
|
6037 |
iRecorder->SetPosition(setPosn);
|
|
6038 |
TTimeIntervalMicroSeconds getPosn = iRecorder->Position();
|
|
6039 |
INFO_PRINTF3(_L("got position %d should be %d"),I64LOW(getPosn.Int64()), KTwoSeconds);
|
|
6040 |
|
|
6041 |
if((getPosn.Int64() < setPosn.Int64()-posnError) &&
|
|
6042 |
(getPosn.Int64() > setPosn.Int64()+posnError))
|
|
6043 |
{
|
|
6044 |
INFO_PRINTF1(_L("Position fail"));
|
|
6045 |
testStatus = EFail;
|
|
6046 |
}
|
|
6047 |
}
|
|
6048 |
|
|
6049 |
if(testStatus == EPass)
|
|
6050 |
{
|
|
6051 |
TTimeIntervalMicroSeconds duration = iRecorder->Duration();
|
|
6052 |
INFO_PRINTF3(_L("got duration %d should be %d"),I64LOW(duration.Int64()), KTenSeconds);
|
|
6053 |
|
|
6054 |
if((duration.Int64() > KTenSeconds+durError) ||
|
|
6055 |
(duration.Int64() < KTenSeconds-durError))
|
|
6056 |
{
|
|
6057 |
INFO_PRINTF1(_L("Duration fail"));
|
|
6058 |
}
|
|
6059 |
}
|
|
6060 |
|
|
6061 |
|
|
6062 |
|
|
6063 |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
6064 |
//These interfaces should WORK if there is a record controller but no playback controller
|
|
6065 |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
6066 |
|
|
6067 |
if(testStatus == EPass)
|
|
6068 |
{
|
|
6069 |
TInt gain;
|
|
6070 |
iRecorder->SetGain(2);
|
|
6071 |
|
|
6072 |
ret = iRecorder->GetGain(gain);
|
|
6073 |
if((ret != KErrNone) || (gain != 2))
|
|
6074 |
{
|
|
6075 |
INFO_PRINTF1(_L("Gain fail"));
|
|
6076 |
testStatus = EFail;
|
|
6077 |
}
|
|
6078 |
}
|
|
6079 |
if(testStatus == EPass)
|
|
6080 |
{
|
|
6081 |
TTimeIntervalMicroSeconds croppedDuration;
|
|
6082 |
TTimeIntervalMicroSeconds originalDuration;
|
|
6083 |
TTimeIntervalMicroSeconds setPosn(KTwoSeconds);
|
|
6084 |
iRecorder->SetPosition(setPosn);
|
|
6085 |
|
|
6086 |
originalDuration = iRecorder->Duration();
|
|
6087 |
|
|
6088 |
if((originalDuration.Int64() > KTenSeconds+durError) ||
|
|
6089 |
(originalDuration.Int64() < KTenSeconds-durError))
|
|
6090 |
{
|
|
6091 |
INFO_PRINTF1(_L("getting Duration for CropL fail"));
|
|
6092 |
testStatus = EFail;
|
|
6093 |
}
|
|
6094 |
else
|
|
6095 |
{
|
|
6096 |
TRAP(trapRet, iRecorder->CropFromBeginningL());
|
|
6097 |
if(trapRet == KErrNone)
|
|
6098 |
{
|
|
6099 |
croppedDuration = iRecorder->Duration();
|
|
6100 |
INFO_PRINTF3(_L("got duration %d should be %d"),I64LOW(croppedDuration.Int64()), originalDuration.Int64()-KTwoSeconds);
|
|
6101 |
}
|
|
6102 |
if((trapRet != KErrNone) ||
|
|
6103 |
((croppedDuration.Int64() > originalDuration.Int64()-KTwoSeconds+cropError) ||
|
|
6104 |
(croppedDuration.Int64() < originalDuration.Int64()-KTwoSeconds-cropError)))
|
|
6105 |
{
|
|
6106 |
INFO_PRINTF1(_L("Crop fail"));
|
|
6107 |
testStatus = EFail;
|
|
6108 |
}
|
|
6109 |
}
|
|
6110 |
}
|
|
6111 |
|
|
6112 |
if(testStatus == EPass)
|
|
6113 |
{
|
|
6114 |
TTimeIntervalMicroSeconds zero(0);
|
|
6115 |
|
|
6116 |
TTimeIntervalMicroSeconds recTimeAvail = iRecorder->RecordTimeAvailable();
|
|
6117 |
if(recTimeAvail == zero)
|
|
6118 |
{
|
|
6119 |
INFO_PRINTF1(_L("RecordTimeAvailable fail"));
|
|
6120 |
testStatus = EFail;
|
|
6121 |
}
|
|
6122 |
}
|
|
6123 |
|
|
6124 |
|
|
6125 |
if(testStatus == EPass)
|
|
6126 |
{
|
|
6127 |
TInt bal = KMMFBalanceMaxRight;
|
|
6128 |
ret = iRecorder->SetRecordBalance(KMMFBalanceMaxLeft);
|
|
6129 |
if(ret == KErrNone)
|
|
6130 |
{
|
|
6131 |
bal = KMMFBalanceMaxRight;
|
|
6132 |
ret = iRecorder->GetRecordBalance(bal);
|
|
6133 |
}
|
|
6134 |
if((bal != KMMFBalanceMaxLeft) || (ret != KErrNone))
|
|
6135 |
{
|
|
6136 |
INFO_PRINTF1(_L("Balance tests fail"));
|
|
6137 |
testStatus = EFail;
|
|
6138 |
}
|
|
6139 |
}
|
|
6140 |
|
|
6141 |
//Haven't got a format that supports these - trace into code.
|
|
6142 |
/*
|
|
6143 |
if(testStatus == EPass)
|
|
6144 |
{
|
|
6145 |
TInt metaEntries;
|
|
6146 |
CMMFMetaDataEntry* metaEntry = NULL;
|
|
6147 |
CMMFMetaDataEntry* newMetaEntry = CMMFMetaDataEntry::NewL(_L("dummy meta"), _L("dummy val"));
|
|
6148 |
|
|
6149 |
iRecorder->GetNumberOfMetaDataEntries(metaEntries);
|
|
6150 |
TRAP(trapRet, metaEntry = iRecorder->GetMetaDataEntryL(1));
|
|
6151 |
TRAP(trapRet, iRecorder->AddMetaDataEntryL(*newMetaEntry));
|
|
6152 |
TRAP(trapRet, iRecorder->ReplaceMetaDataEntryL(1, *newMetaEntry));
|
|
6153 |
iRecorder->RemoveMetaDataEntry(1);
|
|
6154 |
}
|
|
6155 |
*/
|
|
6156 |
|
|
6157 |
|
|
6158 |
if(testStatus == EPass)
|
|
6159 |
{
|
|
6160 |
RArray<TFourCC> codecs;
|
|
6161 |
TRAP(trapRet, iRecorder->GetSupportedDestinationDataTypesL(codecs));
|
|
6162 |
if((trapRet == KErrNone) && (codecs.Count() > 0) && IsFileTest())
|
|
6163 |
{
|
|
6164 |
TRAP(trapRet, iRecorder->SetDestinationDataTypeL(codecs[0]));
|
|
6165 |
}
|
|
6166 |
|
|
6167 |
if((trapRet == KErrNone) && (codecs.Count() > 0))
|
|
6168 |
{
|
|
6169 |
TFourCC dataType;
|
|
6170 |
TRAP(trapRet, dataType = iRecorder->DestinationDataTypeL());
|
|
6171 |
if((trapRet != KErrNone) || (IsFileTest() && (dataType != codecs[0])))
|
|
6172 |
testStatus = EFail;
|
|
6173 |
}
|
|
6174 |
|
|
6175 |
if((trapRet != KErrNone) || (testStatus == EFail))
|
|
6176 |
{
|
|
6177 |
INFO_PRINTF1(_L("DestinationDataTypes fail"));
|
|
6178 |
testStatus = EFail;
|
|
6179 |
}
|
|
6180 |
}
|
|
6181 |
|
|
6182 |
|
|
6183 |
//These methods are not available for our formats and will therefore always fail - trace into code
|
|
6184 |
/*
|
|
6185 |
if(testStatus == EPass)
|
|
6186 |
{
|
|
6187 |
RArray<TUint> bitRates;
|
|
6188 |
TUint bitRate = 0;
|
|
6189 |
|
|
6190 |
TRAP(trapRet, iRecorder->GetSupportedBitRatesL(bitRates));
|
|
6191 |
if((trapRet == KErrNone) && (bitRates.Count() >0))
|
|
6192 |
TRAP(trapRet, iRecorder->SetDestinationBitRateL(bitRates[0]));
|
|
6193 |
if((trapRet == KErrNone) && (bitRates.Count() >0))
|
|
6194 |
TRAP(trapRet, bitRate = iRecorder->DestinationBitRateL());
|
|
6195 |
|
|
6196 |
if((trapRet != KErrNone) || (bitRate != bitRates[0]))
|
|
6197 |
{
|
|
6198 |
INFO_PRINTF1(_L("BitRates fail"));
|
|
6199 |
testStatus = EFail;
|
|
6200 |
}
|
|
6201 |
}
|
|
6202 |
*/
|
|
6203 |
|
|
6204 |
if(testStatus == EPass)
|
|
6205 |
{
|
|
6206 |
RArray<TUint> sampleRates;
|
|
6207 |
TUint sampleRate = 0;
|
|
6208 |
|
|
6209 |
TRAP(trapRet, iRecorder->GetSupportedSampleRatesL(sampleRates));
|
|
6210 |
if((trapRet == KErrNone) && (sampleRates.Count() >0))
|
|
6211 |
{
|
|
6212 |
TRAP(trapRet, iRecorder->SetDestinationSampleRateL(sampleRates[0]));
|
|
6213 |
}
|
|
6214 |
|
|
6215 |
if((trapRet == KErrNone) && (sampleRates.Count() >0))
|
|
6216 |
{
|
|
6217 |
TRAP(trapRet, sampleRate = iRecorder->DestinationSampleRateL());
|
|
6218 |
}
|
|
6219 |
|
|
6220 |
if((trapRet != KErrNone) || (sampleRate != sampleRates[0]))
|
|
6221 |
{
|
|
6222 |
INFO_PRINTF1(_L("SampleRates fail"));
|
|
6223 |
testStatus = EFail;
|
|
6224 |
}
|
|
6225 |
}
|
|
6226 |
|
|
6227 |
|
|
6228 |
|
|
6229 |
if(testStatus == EPass)
|
|
6230 |
{
|
|
6231 |
RArray<TUint> channels;
|
|
6232 |
TUint channel = 0;
|
|
6233 |
|
|
6234 |
TRAP(trapRet, iRecorder->GetSupportedNumberOfChannelsL(channels));
|
|
6235 |
if((trapRet == KErrNone) && (channels.Count() >0))
|
|
6236 |
{
|
|
6237 |
TRAP(trapRet, iRecorder->SetDestinationNumberOfChannelsL(channels[0]));
|
|
6238 |
}
|
|
6239 |
|
|
6240 |
if((trapRet == KErrNone) && (channels.Count() >0))
|
|
6241 |
{
|
|
6242 |
TRAP(trapRet, channel = iRecorder->DestinationNumberOfChannelsL());
|
|
6243 |
}
|
|
6244 |
|
|
6245 |
if((trapRet != KErrNone) || (channel != channels[0]))
|
|
6246 |
{
|
|
6247 |
INFO_PRINTF1(_L("channels fail"));
|
|
6248 |
testStatus = EFail;
|
|
6249 |
}
|
|
6250 |
}
|
|
6251 |
|
|
6252 |
|
|
6253 |
if(testStatus == EPass)
|
|
6254 |
{
|
|
6255 |
TUid currentFormat = KNullUid;
|
|
6256 |
|
|
6257 |
TRAP(trapRet, currentFormat = iRecorder->DestinationFormatL());
|
|
6258 |
|
|
6259 |
/*can't do this, causes segmentation violation - trace into code
|
|
6260 |
TUid newFormat = {KMmfUidFormatRAWWrite};
|
|
6261 |
if(trapRet == KErrNone)
|
|
6262 |
TRAP(trapRet, iRecorder->SetDestinationFormatL(newFormat));
|
|
6263 |
if(trapRet == KErrNone)
|
|
6264 |
TRAP(trapRet, iRecorder->SetDestinationFormatL(currentFormat));
|
|
6265 |
*/
|
|
6266 |
|
|
6267 |
if(trapRet != KErrNone)
|
|
6268 |
{
|
|
6269 |
INFO_PRINTF1(_L("format fail"));
|
|
6270 |
testStatus = EFail;
|
|
6271 |
}
|
|
6272 |
}
|
|
6273 |
|
|
6274 |
|
|
6275 |
// These would pass when a record controller is present, also need test controller - trace into code
|
|
6276 |
// TInt RecordControllerCustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
|
|
6277 |
// TInt RecordControllerCustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
|
|
6278 |
// void RecordControllerCustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
|
|
6279 |
// void RecordControllerCustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
|
|
6280 |
|
|
6281 |
|
|
6282 |
|
|
6283 |
|
|
6284 |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
6285 |
//These interfaces should FAIL if there is a record controller but no playback controller
|
|
6286 |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
6287 |
|
|
6288 |
if(testStatus == EPass)
|
|
6289 |
{
|
|
6290 |
TRAP(trapRet, iRecorder->PlayL())
|
|
6291 |
if(trapRet != KErrNotSupported)
|
|
6292 |
{
|
|
6293 |
INFO_PRINTF1(_L("Play fail"));
|
|
6294 |
testStatus = EFail;
|
|
6295 |
}
|
|
6296 |
}
|
|
6297 |
|
|
6298 |
|
|
6299 |
if(testStatus == EPass)
|
|
6300 |
{
|
|
6301 |
TInt maxVol = iRecorder->MaxVolume();
|
|
6302 |
if(maxVol != 0)
|
|
6303 |
{
|
|
6304 |
INFO_PRINTF1(_L("MaxVolume fail"));
|
|
6305 |
testStatus = EFail;
|
|
6306 |
}
|
|
6307 |
}
|
|
6308 |
|
|
6309 |
|
|
6310 |
if(testStatus == EPass)
|
|
6311 |
{
|
|
6312 |
iRecorder->SetVolume(1);
|
|
6313 |
|
|
6314 |
TInt vol;
|
|
6315 |
ret = iRecorder->GetVolume(vol);
|
|
6316 |
if(ret != KErrNotSupported)
|
|
6317 |
{
|
|
6318 |
INFO_PRINTF1(_L("GetVolume fail"));
|
|
6319 |
testStatus = EFail;
|
|
6320 |
}
|
|
6321 |
}
|
|
6322 |
|
|
6323 |
if(testStatus == EPass)
|
|
6324 |
{
|
|
6325 |
TInt bal;
|
|
6326 |
TInt ret = iRecorder->SetPlaybackBalance(KMMFBalanceMaxRight);
|
|
6327 |
if(ret != KErrNotSupported)
|
|
6328 |
{
|
|
6329 |
INFO_PRINTF1(_L("SetPlaybackBalance fail"));
|
|
6330 |
testStatus = EFail;
|
|
6331 |
}
|
|
6332 |
|
|
6333 |
ret = iRecorder->GetPlaybackBalance(bal);
|
|
6334 |
if(ret != KErrNotSupported)
|
|
6335 |
{
|
|
6336 |
INFO_PRINTF1(_L("GetPlaybackBalance fail"));
|
|
6337 |
testStatus = EFail;
|
|
6338 |
}
|
|
6339 |
}
|
|
6340 |
|
|
6341 |
|
|
6342 |
|
|
6343 |
if(testStatus == EPass)
|
|
6344 |
{
|
|
6345 |
TMMFMessageDestinationPckg dummyPckg;
|
|
6346 |
TInt dummyFunc = 100;
|
|
6347 |
TBuf8<8> dummyBuff;
|
|
6348 |
|
|
6349 |
ret = iRecorder->PlayControllerCustomCommandSync(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff);
|
|
6350 |
if(ret != KErrNotSupported)
|
|
6351 |
{
|
|
6352 |
INFO_PRINTF1(_L("PlayControllerCustomCommandSync - 1 fail"));
|
|
6353 |
testStatus = EFail;
|
|
6354 |
}
|
|
6355 |
|
|
6356 |
ret = iRecorder->PlayControllerCustomCommandSync(dummyPckg, dummyFunc, dummyBuff, dummyBuff);
|
|
6357 |
if(ret != KErrNotSupported)
|
|
6358 |
{
|
|
6359 |
INFO_PRINTF1(_L("PlayControllerCustomCommandSync -2 fail"));
|
|
6360 |
testStatus = EFail;
|
|
6361 |
}
|
|
6362 |
|
|
6363 |
CTestMmfAclntAOCallback* aoCallback = new CTestMmfAclntAOCallback(this);
|
|
6364 |
CleanupStack::PushL(aoCallback);
|
|
6365 |
aoCallback->PublicSetActive();
|
|
6366 |
|
|
6367 |
|
|
6368 |
iRecorder->PlayControllerCustomCommandAsync(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff, aoCallback->iStatus);
|
|
6369 |
CActiveScheduler::Start();
|
|
6370 |
|
|
6371 |
if(iError != KErrNotSupported)
|
|
6372 |
{
|
|
6373 |
INFO_PRINTF1(_L("PlayControllerCustomCommandAsync -1 fail"));
|
|
6374 |
testStatus = EFail;
|
|
6375 |
}
|
|
6376 |
|
|
6377 |
aoCallback->PublicSetActive();
|
|
6378 |
iRecorder->PlayControllerCustomCommandAsync(dummyPckg, dummyFunc, dummyBuff, dummyBuff, aoCallback->iStatus);
|
|
6379 |
CActiveScheduler::Start();
|
|
6380 |
|
|
6381 |
if(iError != KErrNotSupported)
|
|
6382 |
{
|
|
6383 |
INFO_PRINTF1(_L("PlayControllerCustomCommandAsync -2 fail"));
|
|
6384 |
testStatus = EFail;
|
|
6385 |
}
|
|
6386 |
|
|
6387 |
CleanupStack::Pop(aoCallback);
|
|
6388 |
}
|
|
6389 |
|
|
6390 |
|
|
6391 |
|
|
6392 |
|
|
6393 |
CleanupStack::PopAndDestroy(iRecorder);
|
|
6394 |
User::After(KOneSecond);
|
|
6395 |
return testStatus;
|
|
6396 |
}
|
|
6397 |
|
|
6398 |
|
|
6399 |
|
|
6400 |
|
|
6401 |
|
|
6402 |
|
|
6403 |
|
|
6404 |
|
|
6405 |
|
|
6406 |
|
|
6407 |
|
|
6408 |
|
|
6409 |
|
|
6410 |
|
|
6411 |
|
|
6412 |
//------------------------------------------------------------------
|
|
6413 |
|
|
6414 |
/**
|
|
6415 |
* Constructor
|
|
6416 |
*/
|
|
6417 |
CTestMmfAclntRecNoPlaybackForceFormat::CTestMmfAclntRecNoPlaybackForceFormat(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
6418 |
: CTestMmfAclntRecNoPlayback(aTestName, aSectName, aKeyName)
|
|
6419 |
{
|
|
6420 |
iFormat = aFormat;
|
|
6421 |
}
|
|
6422 |
|
|
6423 |
CTestMmfAclntRecNoPlaybackForceFormat* CTestMmfAclntRecNoPlaybackForceFormat::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
6424 |
{
|
|
6425 |
CTestMmfAclntRecNoPlaybackForceFormat* self = new (ELeave) CTestMmfAclntRecNoPlaybackForceFormat(aTestName,aSectName,aKeyName,aFormat);
|
|
6426 |
return self;
|
|
6427 |
}
|
|
6428 |
|
|
6429 |
CTestMmfAclntRecNoPlaybackForceFormat* CTestMmfAclntRecNoPlaybackForceFormat::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
6430 |
{
|
|
6431 |
CTestMmfAclntRecNoPlaybackForceFormat* self = CTestMmfAclntRecNoPlaybackForceFormat::NewLC(aTestName,aSectName,aKeyName,aFormat);
|
|
6432 |
CleanupStack::PushL(self);
|
|
6433 |
return self;
|
|
6434 |
}
|
|
6435 |
|
|
6436 |
|
|
6437 |
CMdaAudioRecorderUtility* CTestMmfAclntRecNoPlaybackForceFormat::CMdaAudioRecorderUtilityLC()
|
|
6438 |
{
|
|
6439 |
INFO_PRINTF1( _L("Create CMdaAudioRecorderUtility with a file and forcing format"));
|
|
6440 |
|
|
6441 |
if(!GetStringFromConfig(iSectName, iKeyName, iFilename))
|
|
6442 |
return NULL;
|
|
6443 |
|
|
6444 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
6445 |
CleanupStack::PushL(recUtil);
|
|
6446 |
|
|
6447 |
TMdaFileClipLocation location(iFilename);
|
|
6448 |
|
|
6449 |
recUtil->OpenL(&location,&iFormat);
|
|
6450 |
|
|
6451 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
6452 |
CActiveScheduler::Start();
|
|
6453 |
|
|
6454 |
if(iError != KErrNone)
|
|
6455 |
{
|
|
6456 |
CleanupStack::PopAndDestroy(recUtil);
|
|
6457 |
recUtil = NULL;
|
|
6458 |
}
|
|
6459 |
|
|
6460 |
return recUtil;
|
|
6461 |
}
|
|
6462 |
|
|
6463 |
TVerdict CTestMmfAclntRecNoPlaybackForceFormat::RecordSuccessfull()
|
|
6464 |
{
|
|
6465 |
TVerdict testStatus = EPass;
|
|
6466 |
|
|
6467 |
if(iError == KErrNone)
|
|
6468 |
{
|
|
6469 |
RFs fs;
|
|
6470 |
RFile file;
|
|
6471 |
TInt size = 0;
|
|
6472 |
|
|
6473 |
iError = fs.Connect();
|
|
6474 |
if (iError == KErrNone)
|
|
6475 |
{
|
|
6476 |
iError = file.Open(fs,iFilename,EFileRead);
|
|
6477 |
|
|
6478 |
if (iError == KErrNone)
|
|
6479 |
{
|
|
6480 |
iError = file.Size(size);
|
|
6481 |
|
|
6482 |
if (iError != KErrNone)
|
|
6483 |
{
|
|
6484 |
INFO_PRINTF1(_L("Unable to get size of file!"));
|
|
6485 |
}
|
|
6486 |
}
|
|
6487 |
else
|
|
6488 |
{
|
|
6489 |
INFO_PRINTF1(_L("Unable to open file."));
|
|
6490 |
return EInconclusive;
|
|
6491 |
}
|
|
6492 |
|
|
6493 |
}
|
|
6494 |
else
|
|
6495 |
{
|
|
6496 |
INFO_PRINTF1(_L("Unable to connect to file system."));
|
|
6497 |
return EInconclusive;
|
|
6498 |
}
|
|
6499 |
|
|
6500 |
if(size == 0)
|
|
6501 |
{
|
|
6502 |
testStatus = EFail;
|
|
6503 |
}
|
|
6504 |
|
|
6505 |
|
|
6506 |
file.Close();
|
|
6507 |
fs.Close();
|
|
6508 |
CleanupStack::PopAndDestroy(); //file
|
|
6509 |
}
|
|
6510 |
else
|
|
6511 |
testStatus = EFail;
|
|
6512 |
|
|
6513 |
return testStatus;
|
|
6514 |
}
|
|
6515 |
|
|
6516 |
|
|
6517 |
|
|
6518 |
CTestMmfAclntRecNoPlaybackForceFormatDesc* CTestMmfAclntRecNoPlaybackForceFormatDesc::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
6519 |
{
|
|
6520 |
CTestMmfAclntRecNoPlaybackForceFormatDesc* self = new (ELeave) CTestMmfAclntRecNoPlaybackForceFormatDesc(aTestName,aSectName,aKeyName,aFormat);
|
|
6521 |
return self;
|
|
6522 |
}
|
|
6523 |
|
|
6524 |
CTestMmfAclntRecNoPlaybackForceFormatDesc* CTestMmfAclntRecNoPlaybackForceFormatDesc::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
6525 |
{
|
|
6526 |
CTestMmfAclntRecNoPlaybackForceFormatDesc* self = CTestMmfAclntRecNoPlaybackForceFormatDesc::NewLC(aTestName,aSectName,aKeyName,aFormat);
|
|
6527 |
CleanupStack::PushL(self);
|
|
6528 |
return self;
|
|
6529 |
}
|
|
6530 |
|
|
6531 |
|
|
6532 |
CMdaAudioRecorderUtility* CTestMmfAclntRecNoPlaybackForceFormatDesc::CMdaAudioRecorderUtilityLC()
|
|
6533 |
{
|
|
6534 |
const TInt KMaxFileSize = 200000;
|
|
6535 |
INFO_PRINTF1( _L("Create CMdaAudioRecorderUtility with a descriptor and forcing format"));
|
|
6536 |
|
|
6537 |
if(!GetStringFromConfig(iSectName, iKeyName, iFilename))
|
|
6538 |
User::Leave(KErrNotFound);
|
|
6539 |
|
|
6540 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
6541 |
CleanupStack::PushL(recUtil);
|
|
6542 |
|
|
6543 |
|
|
6544 |
HBufC8* iBuf = HBufC8::NewL( KMaxFileSize );
|
|
6545 |
CleanupStack::PushL(iBuf);
|
|
6546 |
|
|
6547 |
iFileDesc = new (ELeave) TPtr8( NULL, 0 );
|
|
6548 |
CleanupStack::PushL(iFileDesc);
|
|
6549 |
|
|
6550 |
iFileDesc->Set( iBuf->Des());
|
|
6551 |
|
|
6552 |
|
|
6553 |
TMdaDesClipLocation location(*iFileDesc);
|
|
6554 |
|
|
6555 |
recUtil->OpenL(&location,&iFormat);
|
|
6556 |
|
|
6557 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
6558 |
CActiveScheduler::Start();
|
|
6559 |
|
|
6560 |
if(iError != KErrNone)
|
|
6561 |
{
|
|
6562 |
User::Leave(KErrNotFound);
|
|
6563 |
}
|
|
6564 |
|
|
6565 |
CleanupStack::Pop(iFileDesc);
|
|
6566 |
CleanupStack::Pop(iBuf);
|
|
6567 |
return recUtil;
|
|
6568 |
}
|
|
6569 |
|
|
6570 |
TVerdict CTestMmfAclntRecNoPlaybackForceFormatDesc::RecordSuccessfull()
|
|
6571 |
{
|
|
6572 |
TVerdict testStatus = EPass;
|
|
6573 |
|
|
6574 |
TInt len = iFileDesc->Length();
|
|
6575 |
|
|
6576 |
if(len == 0)
|
|
6577 |
{
|
|
6578 |
testStatus = EFail;
|
|
6579 |
}
|
|
6580 |
|
|
6581 |
return testStatus;
|
|
6582 |
}
|
|
6583 |
|
|
6584 |
|
|
6585 |
|
|
6586 |
|
|
6587 |
//------------------------------------------------------------------
|
|
6588 |
|
|
6589 |
|
|
6590 |
CTestMmfAclntRecNoPlaybackFile* CTestMmfAclntRecNoPlaybackFile::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
6591 |
{
|
|
6592 |
CTestMmfAclntRecNoPlaybackFile* self = new (ELeave) CTestMmfAclntRecNoPlaybackFile(aTestName,aSectName,aKeyName);
|
|
6593 |
return self;
|
|
6594 |
}
|
|
6595 |
|
|
6596 |
CTestMmfAclntRecNoPlaybackFile* CTestMmfAclntRecNoPlaybackFile::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
6597 |
{
|
|
6598 |
CTestMmfAclntRecNoPlaybackFile* self = CTestMmfAclntRecNoPlaybackFile::NewLC(aTestName,aSectName,aKeyName);
|
|
6599 |
CleanupStack::PushL(self);
|
|
6600 |
return self;
|
|
6601 |
}
|
|
6602 |
|
|
6603 |
|
|
6604 |
CMdaAudioRecorderUtility* CTestMmfAclntRecNoPlaybackFile::CMdaAudioRecorderUtilityLC()
|
|
6605 |
{
|
|
6606 |
INFO_PRINTF1( _L("Create CMdaAudioRecorderUtility with a file"));
|
|
6607 |
|
|
6608 |
if(!GetStringFromConfig(iSectName, iKeyName, iFilename))
|
|
6609 |
{
|
|
6610 |
return NULL;
|
|
6611 |
}
|
|
6612 |
|
|
6613 |
|
|
6614 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
6615 |
CleanupStack::PushL(recUtil);
|
|
6616 |
|
|
6617 |
recUtil->OpenFileL(iFilename);
|
|
6618 |
|
|
6619 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
6620 |
CActiveScheduler::Start();
|
|
6621 |
|
|
6622 |
if(iError != KErrNone)
|
|
6623 |
{
|
|
6624 |
CleanupStack::PopAndDestroy(recUtil);
|
|
6625 |
recUtil = NULL;
|
|
6626 |
}
|
|
6627 |
|
|
6628 |
return recUtil;
|
|
6629 |
}
|
|
6630 |
|
|
6631 |
TVerdict CTestMmfAclntRecNoPlaybackFile::RecordSuccessfull()
|
|
6632 |
{
|
|
6633 |
TVerdict testStatus = EPass;
|
|
6634 |
|
|
6635 |
if(iError == KErrNone)
|
|
6636 |
{
|
|
6637 |
RFs fs;
|
|
6638 |
RFile file;
|
|
6639 |
TInt size = 0;
|
|
6640 |
|
|
6641 |
iError = fs.Connect();
|
|
6642 |
if (iError == KErrNone)
|
|
6643 |
{
|
|
6644 |
iError = file.Open(fs,iFilename,EFileRead);
|
|
6645 |
|
|
6646 |
if (iError == KErrNone)
|
|
6647 |
{
|
|
6648 |
iError = file.Size(size);
|
|
6649 |
|
|
6650 |
if (iError != KErrNone)
|
|
6651 |
{
|
|
6652 |
INFO_PRINTF1(_L("Unable to get size of file!"));
|
|
6653 |
}
|
|
6654 |
}
|
|
6655 |
else
|
|
6656 |
{
|
|
6657 |
INFO_PRINTF1(_L("Unable to open file."));
|
|
6658 |
return EInconclusive;
|
|
6659 |
}
|
|
6660 |
|
|
6661 |
}
|
|
6662 |
else
|
|
6663 |
{
|
|
6664 |
INFO_PRINTF1(_L("Unable to connect to file system."));
|
|
6665 |
return EInconclusive;
|
|
6666 |
}
|
|
6667 |
|
|
6668 |
if(size == 0)
|
|
6669 |
{
|
|
6670 |
testStatus = EFail;
|
|
6671 |
}
|
|
6672 |
|
|
6673 |
|
|
6674 |
file.Close();
|
|
6675 |
fs.Close();
|
|
6676 |
CleanupStack::PopAndDestroy(); //file
|
|
6677 |
}
|
|
6678 |
|
|
6679 |
else
|
|
6680 |
testStatus = EFail;
|
|
6681 |
|
|
6682 |
return testStatus;
|
|
6683 |
}
|
|
6684 |
|
|
6685 |
|
|
6686 |
|
|
6687 |
|
|
6688 |
CTestMmfAclntRecNoPlaybackDesc* CTestMmfAclntRecNoPlaybackDesc::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
6689 |
{
|
|
6690 |
CTestMmfAclntRecNoPlaybackDesc* self = new (ELeave) CTestMmfAclntRecNoPlaybackDesc(aTestName,aSectName,aKeyName);
|
|
6691 |
return self;
|
|
6692 |
}
|
|
6693 |
|
|
6694 |
CTestMmfAclntRecNoPlaybackDesc* CTestMmfAclntRecNoPlaybackDesc::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
6695 |
{
|
|
6696 |
CTestMmfAclntRecNoPlaybackDesc* self = CTestMmfAclntRecNoPlaybackDesc::NewLC(aTestName,aSectName,aKeyName);
|
|
6697 |
CleanupStack::PushL(self);
|
|
6698 |
return self;
|
|
6699 |
}
|
|
6700 |
|
|
6701 |
|
|
6702 |
CMdaAudioRecorderUtility* CTestMmfAclntRecNoPlaybackDesc::CMdaAudioRecorderUtilityLC()
|
|
6703 |
{
|
|
6704 |
const TInt KMaxFileSize = 200000;
|
|
6705 |
INFO_PRINTF1( _L("Create CMdaAudioRecorderUtility with a descriptor"));
|
|
6706 |
|
|
6707 |
if(!GetStringFromConfig(iSectName, iKeyName, iFilename))
|
|
6708 |
{
|
|
6709 |
User::Leave(KErrNotFound);
|
|
6710 |
}
|
|
6711 |
|
|
6712 |
|
|
6713 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
6714 |
CleanupStack::PushL(recUtil);
|
|
6715 |
|
|
6716 |
|
|
6717 |
HBufC8* iBuf = HBufC8::NewL( KMaxFileSize );
|
|
6718 |
CleanupStack::PushL(iBuf);
|
|
6719 |
|
|
6720 |
iFileDesc = new (ELeave) TPtr8( NULL, 0 );
|
|
6721 |
CleanupStack::PushL(iFileDesc);
|
|
6722 |
|
|
6723 |
iFileDesc->Set( iBuf->Des());
|
|
6724 |
|
|
6725 |
//Put some contents (one sample wav file) into the descriptor
|
|
6726 |
TPtrC oneSampleFileName;
|
|
6727 |
if(!GetStringFromConfig(iSectName, _L("OneSampleFile"), oneSampleFileName))
|
|
6728 |
{
|
|
6729 |
User::Leave(KErrNotFound);
|
|
6730 |
}
|
|
6731 |
|
|
6732 |
RFs fs;
|
|
6733 |
RFile file;
|
|
6734 |
User::LeaveIfError(fs.Connect());
|
|
6735 |
User::LeaveIfError(file.Open(fs,oneSampleFileName,EFileRead));
|
|
6736 |
CleanupClosePushL(file);
|
|
6737 |
if(file.Read(*iFileDesc) != KErrNone)
|
|
6738 |
{
|
|
6739 |
User::Leave(KErrNotFound);
|
|
6740 |
}
|
|
6741 |
CleanupStack::PopAndDestroy(&file);
|
|
6742 |
|
|
6743 |
|
|
6744 |
recUtil->OpenDesL(*iFileDesc);
|
|
6745 |
|
|
6746 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
6747 |
CActiveScheduler::Start();
|
|
6748 |
|
|
6749 |
if(iError != KErrNone)
|
|
6750 |
{
|
|
6751 |
User::Leave(KErrNotFound);
|
|
6752 |
}
|
|
6753 |
|
|
6754 |
CleanupStack::Pop(iFileDesc);
|
|
6755 |
CleanupStack::Pop(iBuf);
|
|
6756 |
return recUtil;
|
|
6757 |
}
|
|
6758 |
|
|
6759 |
TVerdict CTestMmfAclntRecNoPlaybackDesc::RecordSuccessfull()
|
|
6760 |
{
|
|
6761 |
TVerdict testStatus = EPass;
|
|
6762 |
|
|
6763 |
TInt len = iFileDesc->Length();
|
|
6764 |
|
|
6765 |
if(len == 0)
|
|
6766 |
{
|
|
6767 |
testStatus = EFail;
|
|
6768 |
}
|
|
6769 |
|
|
6770 |
return testStatus;
|
|
6771 |
}
|
|
6772 |
|
|
6773 |
|
|
6774 |
|
|
6775 |
|
|
6776 |
CTestMmfAclntRecNoPlaybackFileForceController* CTestMmfAclntRecNoPlaybackFileForceController::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TUid aController)
|
|
6777 |
{
|
|
6778 |
CTestMmfAclntRecNoPlaybackFileForceController* self = new (ELeave) CTestMmfAclntRecNoPlaybackFileForceController(aTestName,aSectName,aKeyName, aController);
|
|
6779 |
return self;
|
|
6780 |
}
|
|
6781 |
|
|
6782 |
CTestMmfAclntRecNoPlaybackFileForceController* CTestMmfAclntRecNoPlaybackFileForceController::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TUid aController)
|
|
6783 |
{
|
|
6784 |
CTestMmfAclntRecNoPlaybackFileForceController* self = CTestMmfAclntRecNoPlaybackFileForceController::NewLC(aTestName,aSectName,aKeyName,aController);
|
|
6785 |
CleanupStack::PushL(self);
|
|
6786 |
return self;
|
|
6787 |
}
|
|
6788 |
|
|
6789 |
|
|
6790 |
CMdaAudioRecorderUtility* CTestMmfAclntRecNoPlaybackFileForceController::CMdaAudioRecorderUtilityLC()
|
|
6791 |
{
|
|
6792 |
INFO_PRINTF1( _L("Create CMdaAudioRecorderUtility with a file, forcing record controller"));
|
|
6793 |
|
|
6794 |
if(!GetStringFromConfig(iSectName, iKeyName, iFilename))
|
|
6795 |
{
|
|
6796 |
return NULL;
|
|
6797 |
}
|
|
6798 |
|
|
6799 |
|
|
6800 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
6801 |
CleanupStack::PushL(recUtil);
|
|
6802 |
|
|
6803 |
recUtil->OpenFileL(iFilename,iController);
|
|
6804 |
|
|
6805 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
6806 |
CActiveScheduler::Start();
|
|
6807 |
|
|
6808 |
if(iError != KErrNone)
|
|
6809 |
{
|
|
6810 |
CleanupStack::PopAndDestroy(recUtil);
|
|
6811 |
recUtil = NULL;
|
|
6812 |
}
|
|
6813 |
|
|
6814 |
return recUtil;
|
|
6815 |
}
|
|
6816 |
|
|
6817 |
TVerdict CTestMmfAclntRecNoPlaybackFileForceController::RecordSuccessfull()
|
|
6818 |
{
|
|
6819 |
TVerdict testStatus = EPass;
|
|
6820 |
|
|
6821 |
if(iError == KErrNone)
|
|
6822 |
{
|
|
6823 |
RFs fs;
|
|
6824 |
RFile file;
|
|
6825 |
TInt size = 0;
|
|
6826 |
|
|
6827 |
iError = fs.Connect();
|
|
6828 |
if (iError == KErrNone)
|
|
6829 |
{
|
|
6830 |
iError = file.Open(fs,iFilename,EFileRead);
|
|
6831 |
|
|
6832 |
if (iError == KErrNone)
|
|
6833 |
{
|
|
6834 |
iError = file.Size(size);
|
|
6835 |
|
|
6836 |
if (iError != KErrNone)
|
|
6837 |
{
|
|
6838 |
INFO_PRINTF1(_L("Unable to get size of file!"));
|
|
6839 |
}
|
|
6840 |
}
|
|
6841 |
else
|
|
6842 |
{
|
|
6843 |
INFO_PRINTF1(_L("Unable to open file."));
|
|
6844 |
return EInconclusive;
|
|
6845 |
}
|
|
6846 |
|
|
6847 |
}
|
|
6848 |
else
|
|
6849 |
{
|
|
6850 |
INFO_PRINTF1(_L("Unable to connect to file system."));
|
|
6851 |
return EInconclusive;
|
|
6852 |
}
|
|
6853 |
|
|
6854 |
if(size == 0)
|
|
6855 |
{
|
|
6856 |
testStatus = EFail;
|
|
6857 |
}
|
|
6858 |
|
|
6859 |
file.Close();
|
|
6860 |
fs.Close();
|
|
6861 |
CleanupStack::PopAndDestroy(); //file
|
|
6862 |
}
|
|
6863 |
else
|
|
6864 |
testStatus = EFail;
|
|
6865 |
|
|
6866 |
return testStatus;
|
|
6867 |
}
|
|
6868 |
|
|
6869 |
|
|
6870 |
|
|
6871 |
|
|
6872 |
CTestMmfAclntRecNoPlaybackDescForceController* CTestMmfAclntRecNoPlaybackDescForceController::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TUid aController)
|
|
6873 |
{
|
|
6874 |
CTestMmfAclntRecNoPlaybackDescForceController* self = new (ELeave) CTestMmfAclntRecNoPlaybackDescForceController(aTestName,aSectName,aKeyName,aController);
|
|
6875 |
return self;
|
|
6876 |
}
|
|
6877 |
|
|
6878 |
CTestMmfAclntRecNoPlaybackDescForceController* CTestMmfAclntRecNoPlaybackDescForceController::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TUid aController)
|
|
6879 |
{
|
|
6880 |
CTestMmfAclntRecNoPlaybackDescForceController* self = CTestMmfAclntRecNoPlaybackDescForceController::NewLC(aTestName,aSectName,aKeyName,aController);
|
|
6881 |
CleanupStack::PushL(self);
|
|
6882 |
return self;
|
|
6883 |
}
|
|
6884 |
|
|
6885 |
|
|
6886 |
CMdaAudioRecorderUtility* CTestMmfAclntRecNoPlaybackDescForceController::CMdaAudioRecorderUtilityLC()
|
|
6887 |
{
|
|
6888 |
const TInt KMaxFileSize = 200000;
|
|
6889 |
|
|
6890 |
INFO_PRINTF1( _L("Create CMdaAudioRecorderUtility with a descriptor, forcing record controller"));
|
|
6891 |
|
|
6892 |
if(!GetStringFromConfig(iSectName, iKeyName, iFilename))
|
|
6893 |
{
|
|
6894 |
User::Leave(KErrNotFound);
|
|
6895 |
}
|
|
6896 |
|
|
6897 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
6898 |
CleanupStack::PushL(recUtil);
|
|
6899 |
|
|
6900 |
|
|
6901 |
HBufC8* iBuf = HBufC8::NewL( KMaxFileSize );
|
|
6902 |
CleanupStack::PushL(iBuf);
|
|
6903 |
|
|
6904 |
iFileDesc = new (ELeave) TPtr8( NULL, 0 );
|
|
6905 |
CleanupStack::PushL(iFileDesc);
|
|
6906 |
|
|
6907 |
iFileDesc->Set( iBuf->Des());
|
|
6908 |
|
|
6909 |
|
|
6910 |
//Put some contents (one sample wav file) into the descriptor
|
|
6911 |
TPtrC oneSampleFileName;
|
|
6912 |
if(!GetStringFromConfig(iSectName, _L("OneSampleFile"), oneSampleFileName))
|
|
6913 |
{
|
|
6914 |
User::Leave(KErrNotFound);
|
|
6915 |
}
|
|
6916 |
|
|
6917 |
RFs fs;
|
|
6918 |
RFile file;
|
|
6919 |
User::LeaveIfError(fs.Connect());
|
|
6920 |
User::LeaveIfError(file.Open(fs,oneSampleFileName,EFileRead));
|
|
6921 |
CleanupClosePushL(file);
|
|
6922 |
if(file.Read(*iFileDesc) != KErrNone)
|
|
6923 |
{
|
|
6924 |
User::Leave(KErrNotFound);
|
|
6925 |
}
|
|
6926 |
CleanupStack::PopAndDestroy(&file);
|
|
6927 |
|
|
6928 |
|
|
6929 |
recUtil->OpenDesL(*iFileDesc, iController);
|
|
6930 |
|
|
6931 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
6932 |
CActiveScheduler::Start();
|
|
6933 |
|
|
6934 |
if(iError != KErrNone)
|
|
6935 |
{
|
|
6936 |
User::Leave(KErrNotFound);
|
|
6937 |
}
|
|
6938 |
|
|
6939 |
CleanupStack::Pop(iFileDesc);
|
|
6940 |
CleanupStack::Pop(iBuf);
|
|
6941 |
return recUtil;
|
|
6942 |
}
|
|
6943 |
|
|
6944 |
TVerdict CTestMmfAclntRecNoPlaybackDescForceController::RecordSuccessfull()
|
|
6945 |
{
|
|
6946 |
TVerdict testStatus = EPass;
|
|
6947 |
|
|
6948 |
TInt len = iFileDesc->Length();
|
|
6949 |
|
|
6950 |
if(len == 0)
|
|
6951 |
{
|
|
6952 |
testStatus = EFail;
|
|
6953 |
}
|
|
6954 |
|
|
6955 |
return testStatus;
|
|
6956 |
}
|
|
6957 |
|
|
6958 |
|
|
6959 |
|
|
6960 |
|
|
6961 |
|
|
6962 |
|
|
6963 |
|
|
6964 |
|
|
6965 |
//------------------------------------------------------------------
|
|
6966 |
/**
|
|
6967 |
* Constructor baseclass
|
|
6968 |
*/
|
|
6969 |
CTestMmfAclntRecNoRecord::CTestMmfAclntRecNoRecord(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
6970 |
{
|
|
6971 |
// store the name of this test case
|
|
6972 |
// this is the name that is used by the script file
|
|
6973 |
// Each test step initialises it's own name
|
|
6974 |
iTestStepName = aTestName;
|
|
6975 |
iSectName = aSectName;
|
|
6976 |
iKeyName = aKeyName;
|
|
6977 |
}
|
|
6978 |
|
|
6979 |
void CTestMmfAclntRecNoRecord::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt aCurrentState, TInt aErrorCode)
|
|
6980 |
{
|
|
6981 |
iError = aErrorCode;
|
|
6982 |
INFO_PRINTF1( _L("CTestMmfAclntRecNoRecord : MMdaObjectStateChangeObserver Callback for CMdaAudioRecorderUtility complete"));
|
|
6983 |
INFO_PRINTF2( _L("iError %d "), iError);
|
|
6984 |
|
|
6985 |
//dont stop the playing track
|
|
6986 |
if (aCurrentState != CMdaAudioClipUtility::EPlaying || iError != KErrNone)
|
|
6987 |
{
|
|
6988 |
CActiveScheduler::Stop();
|
|
6989 |
}
|
|
6990 |
}
|
|
6991 |
|
|
6992 |
TVerdict CTestMmfAclntRecNoRecord::DoTestStepPreambleL()
|
|
6993 |
{
|
|
6994 |
// Make sure file exists
|
|
6995 |
TParse fullFileName;
|
|
6996 |
TBuf<KSizeBuf> filename;
|
|
6997 |
TPtrC filename1;
|
|
6998 |
|
|
6999 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
7000 |
{
|
|
7001 |
return EInconclusive;
|
|
7002 |
}
|
|
7003 |
|
|
7004 |
GetDriveName(filename);
|
|
7005 |
filename.Append(filename1);
|
|
7006 |
|
|
7007 |
|
|
7008 |
// parse the filenames
|
|
7009 |
if(!fullFileName.Set(filename, &KDefault, NULL))
|
|
7010 |
{
|
|
7011 |
RFs fs;
|
|
7012 |
User::LeaveIfError(fs.Connect());
|
|
7013 |
RFile file;
|
|
7014 |
User::LeaveIfError(file.Open(fs,filename1,EFileRead));
|
|
7015 |
file.Close();
|
|
7016 |
fs.Close();
|
|
7017 |
}
|
|
7018 |
|
|
7019 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
|
7020 |
}
|
|
7021 |
|
|
7022 |
|
|
7023 |
|
|
7024 |
|
|
7025 |
TVerdict CTestMmfAclntRecNoRecord::DoTestStepL()
|
|
7026 |
{
|
|
7027 |
TVerdict testStatus = EPass;
|
|
7028 |
TInt trapRet = KErrNone;
|
|
7029 |
TInt ret = KErrNone;
|
|
7030 |
|
|
7031 |
const TInt durError = 2500; //As best as could be read from Goldwave
|
|
7032 |
const TInt posError = 250;
|
|
7033 |
const TInt MainTst_KDur = 8359100; //MainTst.wav = 8.3591 sec from GoldWave
|
|
7034 |
|
|
7035 |
iRecorder = CMdaAudioRecorderUtilityLC();
|
|
7036 |
|
|
7037 |
if(!iRecorder)
|
|
7038 |
{
|
|
7039 |
testStatus = EFail;
|
|
7040 |
}
|
|
7041 |
|
|
7042 |
|
|
7043 |
//Should always work, must be done before play or record to ensure in EPrimed state
|
|
7044 |
if(testStatus == EPass)
|
|
7045 |
{
|
|
7046 |
TRAP(trapRet,iRecorder->SetPriority(EMdaPriorityMin,EMdaPriorityPreferenceNone));
|
|
7047 |
if(trapRet != KErrNone)
|
|
7048 |
{
|
|
7049 |
INFO_PRINTF2(_L("SetPriority leave with error %d"),trapRet);
|
|
7050 |
testStatus = EFail;
|
|
7051 |
}
|
|
7052 |
}
|
|
7053 |
|
|
7054 |
|
|
7055 |
|
|
7056 |
if(testStatus == EPass)
|
|
7057 |
{
|
|
7058 |
iError = KErrTimedOut;
|
|
7059 |
iRecorder->PlayL();
|
|
7060 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
7061 |
CActiveScheduler::Start(); // open -> record
|
|
7062 |
|
|
7063 |
testStatus = PlaySuccessfull();
|
|
7064 |
}
|
|
7065 |
|
|
7066 |
|
|
7067 |
//Can't detect difference in these interfaces
|
|
7068 |
//void ClearPlayWindow();
|
|
7069 |
//void SetRepeats(....);
|
|
7070 |
//void Pause();
|
|
7071 |
//void SetMaxWriteLength(TInt aMaxWriteLength /*= KMdaClipLocationMaxWriteLengthNone*/);
|
|
7072 |
//void SetVolume(TInt aVolume);
|
|
7073 |
//void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
|
|
7074 |
|
|
7075 |
|
|
7076 |
|
|
7077 |
|
|
7078 |
|
|
7079 |
|
|
7080 |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
7081 |
//These interfaces should always WORK if there is a record or playback controller
|
|
7082 |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
7083 |
|
|
7084 |
|
|
7085 |
//if no rec controller, report playback duration.
|
|
7086 |
if(testStatus == EPass)
|
|
7087 |
{
|
|
7088 |
TTimeIntervalMicroSeconds duration = iRecorder->Duration();
|
|
7089 |
|
|
7090 |
if((duration.Int64() > MainTst_KDur + durError) ||
|
|
7091 |
(duration.Int64() < MainTst_KDur - durError))
|
|
7092 |
{
|
|
7093 |
INFO_PRINTF1(_L("Duration fail"));
|
|
7094 |
testStatus = EFail;
|
|
7095 |
}
|
|
7096 |
}
|
|
7097 |
|
|
7098 |
|
|
7099 |
//returns rec values if rec controller, else playback values
|
|
7100 |
if(testStatus == EPass)
|
|
7101 |
{
|
|
7102 |
TTimeIntervalMicroSeconds setPosn(KTwoSeconds);
|
|
7103 |
|
|
7104 |
iRecorder->SetPosition(setPosn);
|
|
7105 |
TTimeIntervalMicroSeconds getPosn = iRecorder->Position();
|
|
7106 |
INFO_PRINTF3(_L("got position %d should be %d"),I64LOW(getPosn.Int64()), KTwoSeconds);
|
|
7107 |
|
|
7108 |
if((getPosn.Int64() > KTwoSeconds+posError) ||
|
|
7109 |
(getPosn.Int64() < KTwoSeconds-posError))
|
|
7110 |
{
|
|
7111 |
INFO_PRINTF1(_L("Position fail"));
|
|
7112 |
testStatus = EFail;
|
|
7113 |
}
|
|
7114 |
}
|
|
7115 |
|
|
7116 |
|
|
7117 |
|
|
7118 |
|
|
7119 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
7120 |
//These interfaces should FAIL if there is a playback controller, but no record controller
|
|
7121 |
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
7122 |
|
|
7123 |
|
|
7124 |
if(testStatus == EPass)
|
|
7125 |
{
|
|
7126 |
TInt gain;
|
|
7127 |
iRecorder->SetGain(1);
|
|
7128 |
|
|
7129 |
ret = iRecorder->GetGain(gain);
|
|
7130 |
if(ret != KErrNotSupported)
|
|
7131 |
{
|
|
7132 |
INFO_PRINTF1(_L("Gain fail"));
|
|
7133 |
testStatus = EFail;
|
|
7134 |
}
|
|
7135 |
}
|
|
7136 |
|
|
7137 |
if(testStatus == EPass)
|
|
7138 |
{
|
|
7139 |
TTimeIntervalMicroSeconds setPosn(KTwoSeconds);
|
|
7140 |
iRecorder->SetPosition(setPosn);
|
|
7141 |
|
|
7142 |
TRAP(trapRet, iRecorder->CropFromBeginningL());
|
|
7143 |
if(trapRet != KErrNotSupported)
|
|
7144 |
{
|
|
7145 |
INFO_PRINTF1(_L("Crop fail"));
|
|
7146 |
testStatus = EFail;
|
|
7147 |
}
|
|
7148 |
}
|
|
7149 |
|
|
7150 |
if(testStatus == EPass)
|
|
7151 |
{
|
|
7152 |
TTimeIntervalMicroSeconds zero(0);
|
|
7153 |
|
|
7154 |
TTimeIntervalMicroSeconds recTimeAvail = iRecorder->RecordTimeAvailable();
|
|
7155 |
if(recTimeAvail != zero)
|
|
7156 |
{
|
|
7157 |
INFO_PRINTF1(_L("RecordTimeAvailable fail"));
|
|
7158 |
testStatus = EFail;
|
|
7159 |
}
|
|
7160 |
}
|
|
7161 |
|
|
7162 |
|
|
7163 |
if(testStatus == EPass)
|
|
7164 |
{
|
|
7165 |
TInt bal = KMMFBalanceMaxRight;
|
|
7166 |
ret = iRecorder->SetRecordBalance(KMMFBalanceMaxLeft);
|
|
7167 |
if(ret != KErrNotSupported)
|
|
7168 |
{
|
|
7169 |
INFO_PRINTF1(_L("SetRecordBalance test failed"));
|
|
7170 |
testStatus = EFail;
|
|
7171 |
}
|
|
7172 |
|
|
7173 |
ret = iRecorder->GetRecordBalance(bal);
|
|
7174 |
if(ret != KErrNotSupported)
|
|
7175 |
{
|
|
7176 |
INFO_PRINTF1(_L("GetRecordBalance test failed"));
|
|
7177 |
testStatus = EFail;
|
|
7178 |
}
|
|
7179 |
}
|
|
7180 |
|
|
7181 |
|
|
7182 |
//Haven't got a format that supports these - trace into code.
|
|
7183 |
/*
|
|
7184 |
if(testStatus == EPass)
|
|
7185 |
{
|
|
7186 |
TInt metaEntries;
|
|
7187 |
CMMFMetaDataEntry* metaEntry = NULL;
|
|
7188 |
CMMFMetaDataEntry* newMetaEntry = CMMFMetaDataEntry::NewL(_L("dummy meta"), _L("dummy val"));
|
|
7189 |
|
|
7190 |
iRecorder->GetNumberOfMetaDataEntries(metaEntries);
|
|
7191 |
TRAP(trapRet, metaEntry = iRecorder->GetMetaDataEntryL(1));
|
|
7192 |
TRAP(trapRet, iRecorder->AddMetaDataEntryL(*newMetaEntry));
|
|
7193 |
TRAP(trapRet, iRecorder->ReplaceMetaDataEntryL(1, *newMetaEntry));
|
|
7194 |
iRecorder->RemoveMetaDataEntry(1);
|
|
7195 |
}
|
|
7196 |
*/
|
|
7197 |
|
|
7198 |
|
|
7199 |
if(testStatus == EPass)
|
|
7200 |
{
|
|
7201 |
RArray<TFourCC> codecs;
|
|
7202 |
TRAP(trapRet, iRecorder->GetSupportedDestinationDataTypesL(codecs));
|
|
7203 |
if(trapRet != KErrNotSupported)
|
|
7204 |
{
|
|
7205 |
INFO_PRINTF1(_L("GetSupportedDestinationDataTypesL test failed"));
|
|
7206 |
testStatus = EFail;
|
|
7207 |
}
|
|
7208 |
|
|
7209 |
TFourCC dataType;
|
|
7210 |
TRAP(trapRet, iRecorder->SetDestinationDataTypeL(dataType));
|
|
7211 |
if(trapRet != KErrNotSupported)
|
|
7212 |
{
|
|
7213 |
INFO_PRINTF1(_L("SetDestinationDataTypeL test failed"));
|
|
7214 |
testStatus = EFail;
|
|
7215 |
}
|
|
7216 |
|
|
7217 |
TRAP(trapRet, dataType = iRecorder->DestinationDataTypeL());
|
|
7218 |
if(trapRet != KErrNotSupported)
|
|
7219 |
{
|
|
7220 |
INFO_PRINTF1(_L("DestinationDataTypeL test failed"));
|
|
7221 |
testStatus = EFail;
|
|
7222 |
}
|
|
7223 |
}
|
|
7224 |
|
|
7225 |
|
|
7226 |
//These methods are not available for our formats and will therefore always fail - trace into code.
|
|
7227 |
/*
|
|
7228 |
if(testStatus == EPass)
|
|
7229 |
{
|
|
7230 |
RArray<TUint> bitRates;
|
|
7231 |
TUint bitRate = 0;
|
|
7232 |
|
|
7233 |
TRAP(trapRet, iRecorder->GetSupportedBitRatesL(bitRates));
|
|
7234 |
if((trapRet == KErrNone) && (bitRates.Count() >0))
|
|
7235 |
TRAP(trapRet, iRecorder->SetDestinationBitRateL(bitRates[0]));
|
|
7236 |
if((trapRet == KErrNone) && (bitRates.Count() >0))
|
|
7237 |
TRAP(trapRet, bitRate = iRecorder->DestinationBitRateL());
|
|
7238 |
|
|
7239 |
if((trapRet != KErrNone) || (bitRate != bitRates[0]))
|
|
7240 |
{
|
|
7241 |
INFO_PRINTF1(_L("BitRates fail"));
|
|
7242 |
testStatus = EFail;
|
|
7243 |
}
|
|
7244 |
}
|
|
7245 |
*/
|
|
7246 |
|
|
7247 |
if(testStatus == EPass)
|
|
7248 |
{
|
|
7249 |
RArray<TUint> sampleRates;
|
|
7250 |
TUint sampleRate = 0;
|
|
7251 |
|
|
7252 |
TRAP(trapRet, iRecorder->GetSupportedSampleRatesL(sampleRates));
|
|
7253 |
if(trapRet != KErrNotSupported)
|
|
7254 |
{
|
|
7255 |
INFO_PRINTF1(_L("GetSupportedSampleRatesL test failed"));
|
|
7256 |
testStatus = EFail;
|
|
7257 |
}
|
|
7258 |
|
|
7259 |
sampleRate = 8000;
|
|
7260 |
TRAP(trapRet, iRecorder->SetDestinationSampleRateL(sampleRate));
|
|
7261 |
if(trapRet != KErrNotSupported)
|
|
7262 |
{
|
|
7263 |
INFO_PRINTF1(_L("SetDestinationSampleRateL test failed"));
|
|
7264 |
testStatus = EFail;
|
|
7265 |
}
|
|
7266 |
|
|
7267 |
TRAP(trapRet, sampleRate = iRecorder->DestinationSampleRateL());
|
|
7268 |
if(trapRet != KErrNotSupported)
|
|
7269 |
{
|
|
7270 |
INFO_PRINTF1(_L("DestinationSampleRateL test failed"));
|
|
7271 |
testStatus = EFail;
|
|
7272 |
}
|
|
7273 |
}
|
|
7274 |
|
|
7275 |
|
|
7276 |
|
|
7277 |
if(testStatus == EPass)
|
|
7278 |
{
|
|
7279 |
RArray<TUint> channels;
|
|
7280 |
TUint channel = 0;
|
|
7281 |
|
|
7282 |
TRAP(trapRet, iRecorder->GetSupportedNumberOfChannelsL(channels));
|
|
7283 |
if(trapRet != KErrNotSupported)
|
|
7284 |
{
|
|
7285 |
INFO_PRINTF1(_L("GetSupportedNumberOfChannelsL test failed"));
|
|
7286 |
testStatus = EFail;
|
|
7287 |
}
|
|
7288 |
|
|
7289 |
|
|
7290 |
TRAP(trapRet, iRecorder->SetDestinationNumberOfChannelsL(1));
|
|
7291 |
if(trapRet != KErrNotSupported)
|
|
7292 |
{
|
|
7293 |
INFO_PRINTF1(_L("SetDestinationNumberOfChannelsL test failed"));
|
|
7294 |
testStatus = EFail;
|
|
7295 |
}
|
|
7296 |
|
|
7297 |
TRAP(trapRet, channel=iRecorder->DestinationNumberOfChannelsL());
|
|
7298 |
if(trapRet != KErrNotSupported)
|
|
7299 |
{
|
|
7300 |
INFO_PRINTF2(_L("DestinationNumberOfChannelsL test failed with channel %d"), channel);
|
|
7301 |
testStatus = EFail;
|
|
7302 |
}
|
|
7303 |
}
|
|
7304 |
|
|
7305 |
|
|
7306 |
if(testStatus == EPass)
|
|
7307 |
{
|
|
7308 |
TUid currentFormat = KNullUid;
|
|
7309 |
|
|
7310 |
TRAP(trapRet, currentFormat = iRecorder->DestinationFormatL());
|
|
7311 |
if(trapRet != KErrNotSupported)
|
|
7312 |
{
|
|
7313 |
INFO_PRINTF1(_L("DestinationFormatL test failed"));
|
|
7314 |
testStatus = EFail;
|
|
7315 |
}
|
|
7316 |
|
|
7317 |
//NB: Can't do this test here, as it causes seg violation - trace into code
|
|
7318 |
/*
|
|
7319 |
TUid newFormat = {KMmfUidFormatRAWWrite};
|
|
7320 |
if(trapRet == KErrNone)
|
|
7321 |
TRAP(trapRet, iRecorder->SetDestinationFormatL(newFormat));
|
|
7322 |
if(trapRet == KErrNone)
|
|
7323 |
TRAP(trapRet, iRecorder->SetDestinationFormatL(currentFormat));
|
|
7324 |
*/
|
|
7325 |
}
|
|
7326 |
|
|
7327 |
|
|
7328 |
|
|
7329 |
if(testStatus == EPass)
|
|
7330 |
{
|
|
7331 |
TMMFMessageDestinationPckg dummyPckg;
|
|
7332 |
TInt dummyFunc = 100;
|
|
7333 |
TBuf8<8> dummyBuff;
|
|
7334 |
|
|
7335 |
ret = iRecorder->RecordControllerCustomCommandSync(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff);
|
|
7336 |
if(ret != KErrNotSupported)
|
|
7337 |
{
|
|
7338 |
INFO_PRINTF1(_L("RecordControllerCustomCommandSync - 1 fail"));
|
|
7339 |
testStatus = EFail;
|
|
7340 |
}
|
|
7341 |
|
|
7342 |
ret = iRecorder->RecordControllerCustomCommandSync(dummyPckg, dummyFunc, dummyBuff, dummyBuff);
|
|
7343 |
if(ret != KErrNotSupported)
|
|
7344 |
{
|
|
7345 |
INFO_PRINTF1(_L("RecordControllerCustomCommandSync -2 fail"));
|
|
7346 |
testStatus = EFail;
|
|
7347 |
}
|
|
7348 |
|
|
7349 |
CTestMmfAclntAOCallback* aoCallback = new CTestMmfAclntAOCallback(this);
|
|
7350 |
CleanupStack::PushL(aoCallback);
|
|
7351 |
|
|
7352 |
aoCallback->PublicSetActive();
|
|
7353 |
iRecorder->RecordControllerCustomCommandAsync(dummyPckg, dummyFunc, dummyBuff, dummyBuff, dummyBuff, aoCallback->iStatus);
|
|
7354 |
CActiveScheduler::Start();
|
|
7355 |
|
|
7356 |
if(iError != KErrNotSupported)
|
|
7357 |
{
|
|
7358 |
INFO_PRINTF1(_L("RecordControllerCustomCommandAsync -1 fail"));
|
|
7359 |
testStatus = EFail;
|
|
7360 |
}
|
|
7361 |
|
|
7362 |
aoCallback->PublicSetActive();
|
|
7363 |
iRecorder->RecordControllerCustomCommandAsync(dummyPckg, dummyFunc, dummyBuff, dummyBuff, aoCallback->iStatus);
|
|
7364 |
CActiveScheduler::Start();
|
|
7365 |
|
|
7366 |
if(iError != KErrNotSupported)
|
|
7367 |
{
|
|
7368 |
INFO_PRINTF1(_L("RecordControllerCustomCommandAsync -2 fail"));
|
|
7369 |
testStatus = EFail;
|
|
7370 |
}
|
|
7371 |
|
|
7372 |
CleanupStack::Pop(aoCallback);
|
|
7373 |
}
|
|
7374 |
|
|
7375 |
|
|
7376 |
|
|
7377 |
|
|
7378 |
|
|
7379 |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
7380 |
//These interfaces should PASS if there is a playback controller, but no record controller
|
|
7381 |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
7382 |
|
|
7383 |
|
|
7384 |
if(testStatus == EPass)
|
|
7385 |
{
|
|
7386 |
const TUint KPlayError = 500000; //1/2 second in play duration
|
|
7387 |
|
|
7388 |
TTimeIntervalMicroSeconds duration = iRecorder->Duration();
|
|
7389 |
|
|
7390 |
iRecorder->SetPlayWindow(duration.Int64()/2, duration);
|
|
7391 |
|
|
7392 |
iError = KErrTimedOut;
|
|
7393 |
iRecorder->PlayL();
|
|
7394 |
|
|
7395 |
TTime startTime; startTime.UniversalTime();
|
|
7396 |
|
|
7397 |
CActiveScheduler::Start();
|
|
7398 |
|
|
7399 |
TTime endTime; endTime.UniversalTime();
|
|
7400 |
|
|
7401 |
TInt64 playTime = endTime.Int64() - startTime.Int64();
|
|
7402 |
|
|
7403 |
INFO_PRINTF3(_L("Expected to play for %d Usec, played for %d Usec"), I64LOW(duration.Int64()/2), I64LOW(playTime));
|
|
7404 |
|
|
7405 |
if((I64LOW(playTime) > I64LOW(duration.Int64()/2 + KPlayError)) ||
|
|
7406 |
(I64LOW(playTime) < I64LOW(duration.Int64()/2 - KPlayError)))
|
|
7407 |
{
|
|
7408 |
INFO_PRINTF1(_L("SetPlayWindow fail"));
|
|
7409 |
testStatus = EFail;
|
|
7410 |
}
|
|
7411 |
else
|
|
7412 |
{
|
|
7413 |
testStatus = PlaySuccessfull();
|
|
7414 |
}
|
|
7415 |
}
|
|
7416 |
|
|
7417 |
if(testStatus == EPass)
|
|
7418 |
{
|
|
7419 |
TInt maxVol = iRecorder->MaxVolume();
|
|
7420 |
if(maxVol > 0)
|
|
7421 |
{
|
|
7422 |
iRecorder->SetVolume(maxVol/2);
|
|
7423 |
TInt vol;
|
|
7424 |
ret = iRecorder->GetVolume(vol);
|
|
7425 |
if((ret != KErrNone) || (vol != maxVol/2))
|
|
7426 |
{
|
|
7427 |
INFO_PRINTF1(_L("GetVolume fail"));
|
|
7428 |
testStatus = EFail;
|
|
7429 |
}
|
|
7430 |
}
|
|
7431 |
else
|
|
7432 |
{
|
|
7433 |
INFO_PRINTF1(_L("MaxVolume fail"));
|
|
7434 |
testStatus = EFail;
|
|
7435 |
}
|
|
7436 |
|
|
7437 |
}
|
|
7438 |
|
|
7439 |
if(testStatus == EPass)
|
|
7440 |
{
|
|
7441 |
TInt bal;
|
|
7442 |
TInt ret = iRecorder->SetPlaybackBalance(KMMFBalanceMaxRight);
|
|
7443 |
if(ret == KErrNone)
|
|
7444 |
{
|
|
7445 |
ret = iRecorder->GetPlaybackBalance(bal);
|
|
7446 |
if((ret != KErrNone) || (bal != KMMFBalanceMaxRight))
|
|
7447 |
{
|
|
7448 |
INFO_PRINTF1(_L("GetPlaybackBalance fail"));
|
|
7449 |
testStatus = EFail;
|
|
7450 |
}
|
|
7451 |
}
|
|
7452 |
else
|
|
7453 |
{
|
|
7454 |
INFO_PRINTF1(_L("SetPlaybackBalance fail"));
|
|
7455 |
testStatus = EFail;
|
|
7456 |
}
|
|
7457 |
}
|
|
7458 |
|
|
7459 |
|
|
7460 |
|
|
7461 |
// These would pass when a playback controller is present, also need test controller
|
|
7462 |
// TInt PlayControllerCustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom);
|
|
7463 |
// TInt PlayControllerCustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2);
|
|
7464 |
// void PlayControllerCustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus);
|
|
7465 |
// void PlayControllerCustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus);
|
|
7466 |
|
|
7467 |
CleanupStack::PopAndDestroy(iRecorder);
|
|
7468 |
User::After(KOneSecond);
|
|
7469 |
return testStatus;
|
|
7470 |
}
|
|
7471 |
|
|
7472 |
|
|
7473 |
|
|
7474 |
|
|
7475 |
|
|
7476 |
|
|
7477 |
|
|
7478 |
|
|
7479 |
|
|
7480 |
|
|
7481 |
|
|
7482 |
|
|
7483 |
|
|
7484 |
|
|
7485 |
//------------------------------------------------------------------
|
|
7486 |
|
|
7487 |
/**
|
|
7488 |
* Constructor
|
|
7489 |
*/
|
|
7490 |
|
|
7491 |
CTestMmfAclntRecNoRecordForceFormat::CTestMmfAclntRecNoRecordForceFormat(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
7492 |
: CTestMmfAclntRecNoRecord(aTestName, aSectName, aKeyName)
|
|
7493 |
{
|
|
7494 |
iFormat = aFormat;
|
|
7495 |
}
|
|
7496 |
|
|
7497 |
CTestMmfAclntRecNoRecordForceFormat* CTestMmfAclntRecNoRecordForceFormat::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
7498 |
{
|
|
7499 |
CTestMmfAclntRecNoRecordForceFormat* self = new (ELeave) CTestMmfAclntRecNoRecordForceFormat(aTestName,aSectName,aKeyName,aFormat);
|
|
7500 |
return self;
|
|
7501 |
}
|
|
7502 |
|
|
7503 |
CTestMmfAclntRecNoRecordForceFormat* CTestMmfAclntRecNoRecordForceFormat::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
7504 |
{
|
|
7505 |
CTestMmfAclntRecNoRecordForceFormat* self = CTestMmfAclntRecNoRecordForceFormat::NewLC(aTestName,aSectName,aKeyName,aFormat);
|
|
7506 |
CleanupStack::PushL(self);
|
|
7507 |
return self;
|
|
7508 |
}
|
|
7509 |
|
|
7510 |
|
|
7511 |
|
|
7512 |
|
|
7513 |
CMdaAudioRecorderUtility* CTestMmfAclntRecNoRecordForceFormat::CMdaAudioRecorderUtilityLC()
|
|
7514 |
{
|
|
7515 |
if(!GetStringFromConfig(iSectName, iKeyName, iFilename))
|
|
7516 |
return NULL;
|
|
7517 |
|
|
7518 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
7519 |
CleanupStack::PushL(recUtil);
|
|
7520 |
|
|
7521 |
TMdaFileClipLocation location(iFilename);
|
|
7522 |
|
|
7523 |
recUtil->OpenL(&location,&iFormat);
|
|
7524 |
|
|
7525 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
7526 |
CActiveScheduler::Start();
|
|
7527 |
|
|
7528 |
if(iError != KErrNone)
|
|
7529 |
{
|
|
7530 |
CleanupStack::PopAndDestroy(recUtil);
|
|
7531 |
recUtil = NULL;
|
|
7532 |
}
|
|
7533 |
|
|
7534 |
return recUtil;
|
|
7535 |
}
|
|
7536 |
|
|
7537 |
TVerdict CTestMmfAclntRecNoRecordForceFormat::PlaySuccessfull()
|
|
7538 |
{
|
|
7539 |
TVerdict testStatus = EPass;
|
|
7540 |
|
|
7541 |
if(iError != KErrNone)
|
|
7542 |
{
|
|
7543 |
testStatus = EFail;
|
|
7544 |
}
|
|
7545 |
|
|
7546 |
return testStatus;
|
|
7547 |
}
|
|
7548 |
|
|
7549 |
|
|
7550 |
|
|
7551 |
|
|
7552 |
CTestMmfAclntRecNoRecordForceFormatDesc* CTestMmfAclntRecNoRecordForceFormatDesc::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
7553 |
{
|
|
7554 |
CTestMmfAclntRecNoRecordForceFormatDesc* self = new (ELeave) CTestMmfAclntRecNoRecordForceFormatDesc(aTestName,aSectName,aKeyName,aFormat);
|
|
7555 |
return self;
|
|
7556 |
}
|
|
7557 |
|
|
7558 |
CTestMmfAclntRecNoRecordForceFormatDesc* CTestMmfAclntRecNoRecordForceFormatDesc::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TMdaClipFormat& aFormat)
|
|
7559 |
{
|
|
7560 |
CTestMmfAclntRecNoRecordForceFormatDesc* self = CTestMmfAclntRecNoRecordForceFormatDesc::NewLC(aTestName,aSectName,aKeyName,aFormat);
|
|
7561 |
CleanupStack::PushL(self);
|
|
7562 |
return self;
|
|
7563 |
}
|
|
7564 |
|
|
7565 |
|
|
7566 |
CMdaAudioRecorderUtility* CTestMmfAclntRecNoRecordForceFormatDesc::CMdaAudioRecorderUtilityLC()
|
|
7567 |
{
|
|
7568 |
if(!GetStringFromConfig(iSectName, iKeyName, iFilename))
|
|
7569 |
{
|
|
7570 |
User::Leave(KErrNotFound);
|
|
7571 |
}
|
|
7572 |
|
|
7573 |
|
|
7574 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
7575 |
CleanupStack::PushL(recUtil);
|
|
7576 |
|
|
7577 |
|
|
7578 |
RFs fs;
|
|
7579 |
RFile file;
|
|
7580 |
TInt size = 0;
|
|
7581 |
|
|
7582 |
User::LeaveIfError(fs.Connect());
|
|
7583 |
User::LeaveIfError(file.Open(fs,iFilename,EFileRead));
|
|
7584 |
CleanupClosePushL(file);
|
|
7585 |
User::LeaveIfError(file.Size(size));
|
|
7586 |
|
|
7587 |
if(size == 0)
|
|
7588 |
{
|
|
7589 |
User::Leave(KErrNotFound);
|
|
7590 |
}
|
|
7591 |
|
|
7592 |
HBufC8* iBuf = HBufC8::NewL( size );
|
|
7593 |
CleanupStack::PushL(iBuf);
|
|
7594 |
|
|
7595 |
iFileDesc = new (ELeave) TPtr8( NULL, 0 );
|
|
7596 |
CleanupStack::PushL(iFileDesc);
|
|
7597 |
|
|
7598 |
iFileDesc->Set( iBuf->Des());
|
|
7599 |
|
|
7600 |
if(file.Read(*iFileDesc) != KErrNone)
|
|
7601 |
{
|
|
7602 |
User::Leave(KErrNotFound);
|
|
7603 |
}
|
|
7604 |
|
|
7605 |
TMdaDesClipLocation location(*iFileDesc);
|
|
7606 |
|
|
7607 |
recUtil->OpenL(&location,&iFormat);
|
|
7608 |
|
|
7609 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
7610 |
CActiveScheduler::Start();
|
|
7611 |
|
|
7612 |
if(iError != KErrNone)
|
|
7613 |
{
|
|
7614 |
User::Leave(KErrNotFound);
|
|
7615 |
}
|
|
7616 |
|
|
7617 |
CleanupStack::Pop(iFileDesc);
|
|
7618 |
CleanupStack::Pop(iBuf);
|
|
7619 |
CleanupStack::PopAndDestroy(&file);
|
|
7620 |
return recUtil;
|
|
7621 |
}
|
|
7622 |
|
|
7623 |
|
|
7624 |
TVerdict CTestMmfAclntRecNoRecordForceFormatDesc::PlaySuccessfull()
|
|
7625 |
{
|
|
7626 |
TVerdict testStatus = EPass;
|
|
7627 |
|
|
7628 |
if(iError != KErrNone)
|
|
7629 |
{
|
|
7630 |
testStatus = EFail;
|
|
7631 |
}
|
|
7632 |
|
|
7633 |
return testStatus;
|
|
7634 |
}
|
|
7635 |
|
|
7636 |
|
|
7637 |
//------------------------------------------------------------------
|
|
7638 |
|
|
7639 |
|
|
7640 |
CTestMmfAclntRecNoRecordFile* CTestMmfAclntRecNoRecordFile::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
7641 |
{
|
|
7642 |
CTestMmfAclntRecNoRecordFile* self = new (ELeave) CTestMmfAclntRecNoRecordFile(aTestName,aSectName,aKeyName);
|
|
7643 |
return self;
|
|
7644 |
}
|
|
7645 |
|
|
7646 |
CTestMmfAclntRecNoRecordFile* CTestMmfAclntRecNoRecordFile::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
7647 |
{
|
|
7648 |
CTestMmfAclntRecNoRecordFile* self = CTestMmfAclntRecNoRecordFile::NewLC(aTestName,aSectName,aKeyName);
|
|
7649 |
CleanupStack::PushL(self);
|
|
7650 |
return self;
|
|
7651 |
}
|
|
7652 |
|
|
7653 |
|
|
7654 |
CMdaAudioRecorderUtility* CTestMmfAclntRecNoRecordFile::CMdaAudioRecorderUtilityLC()
|
|
7655 |
{
|
|
7656 |
INFO_PRINTF1( _L("Create CMdaAudioRecorderUtility with a file"));
|
|
7657 |
|
|
7658 |
if(!GetStringFromConfig(iSectName, iKeyName, iFilename))
|
|
7659 |
{
|
|
7660 |
return NULL;
|
|
7661 |
}
|
|
7662 |
|
|
7663 |
|
|
7664 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
7665 |
CleanupStack::PushL(recUtil);
|
|
7666 |
|
|
7667 |
recUtil->OpenFileL(iFilename);
|
|
7668 |
|
|
7669 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
7670 |
CActiveScheduler::Start();
|
|
7671 |
|
|
7672 |
if(iError != KErrNone)
|
|
7673 |
{
|
|
7674 |
CleanupStack::PopAndDestroy(recUtil);
|
|
7675 |
recUtil = NULL;
|
|
7676 |
}
|
|
7677 |
|
|
7678 |
return recUtil;
|
|
7679 |
}
|
|
7680 |
|
|
7681 |
TVerdict CTestMmfAclntRecNoRecordFile::PlaySuccessfull()
|
|
7682 |
{
|
|
7683 |
TVerdict testStatus = EPass;
|
|
7684 |
|
|
7685 |
if(iError != KErrNone)
|
|
7686 |
{
|
|
7687 |
testStatus = EFail;
|
|
7688 |
}
|
|
7689 |
|
|
7690 |
return testStatus;
|
|
7691 |
}
|
|
7692 |
|
|
7693 |
|
|
7694 |
|
|
7695 |
|
|
7696 |
CTestMmfAclntRecNoRecordDesc* CTestMmfAclntRecNoRecordDesc::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
7697 |
{
|
|
7698 |
CTestMmfAclntRecNoRecordDesc* self = new (ELeave) CTestMmfAclntRecNoRecordDesc(aTestName,aSectName,aKeyName);
|
|
7699 |
return self;
|
|
7700 |
}
|
|
7701 |
|
|
7702 |
CTestMmfAclntRecNoRecordDesc* CTestMmfAclntRecNoRecordDesc::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName)
|
|
7703 |
{
|
|
7704 |
CTestMmfAclntRecNoRecordDesc* self = CTestMmfAclntRecNoRecordDesc::NewLC(aTestName,aSectName,aKeyName);
|
|
7705 |
CleanupStack::PushL(self);
|
|
7706 |
return self;
|
|
7707 |
}
|
|
7708 |
|
|
7709 |
|
|
7710 |
CMdaAudioRecorderUtility* CTestMmfAclntRecNoRecordDesc::CMdaAudioRecorderUtilityLC()
|
|
7711 |
{
|
|
7712 |
INFO_PRINTF1( _L("Create CMdaAudioRecorderUtility with a descriptor"));
|
|
7713 |
|
|
7714 |
if(!GetStringFromConfig(iSectName, iKeyName, iFilename))
|
|
7715 |
{
|
|
7716 |
User::Leave(KErrNotFound);
|
|
7717 |
}
|
|
7718 |
|
|
7719 |
|
|
7720 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
7721 |
CleanupStack::PushL(recUtil);
|
|
7722 |
|
|
7723 |
|
|
7724 |
RFs fs;
|
|
7725 |
RFile file;
|
|
7726 |
User::LeaveIfError(fs.Connect());
|
|
7727 |
User::LeaveIfError(file.Open(fs,iFilename,EFileRead));
|
|
7728 |
CleanupClosePushL(file);
|
|
7729 |
|
|
7730 |
TInt size;
|
|
7731 |
User::LeaveIfError(file.Size(size));
|
|
7732 |
|
|
7733 |
if(size == 0)
|
|
7734 |
{
|
|
7735 |
User::Leave(KErrNotFound);
|
|
7736 |
}
|
|
7737 |
|
|
7738 |
|
|
7739 |
HBufC8* iBuf = HBufC8::NewL( size );
|
|
7740 |
CleanupStack::PushL(iBuf);
|
|
7741 |
|
|
7742 |
iFileDesc = new (ELeave) TPtr8( NULL, 0 );
|
|
7743 |
CleanupStack::PushL(iFileDesc);
|
|
7744 |
|
|
7745 |
iFileDesc->Set( iBuf->Des());
|
|
7746 |
|
|
7747 |
if(file.Read(*iFileDesc) != KErrNone)
|
|
7748 |
{
|
|
7749 |
User::Leave(KErrNotFound);
|
|
7750 |
}
|
|
7751 |
|
|
7752 |
|
|
7753 |
recUtil->OpenDesL(*iFileDesc);
|
|
7754 |
|
|
7755 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
7756 |
CActiveScheduler::Start();
|
|
7757 |
|
|
7758 |
if(iError != KErrNone)
|
|
7759 |
{
|
|
7760 |
User::Leave(KErrNotFound);
|
|
7761 |
}
|
|
7762 |
|
|
7763 |
CleanupStack::Pop(iFileDesc);
|
|
7764 |
CleanupStack::Pop(iBuf);
|
|
7765 |
CleanupStack::PopAndDestroy(&file);
|
|
7766 |
return recUtil;
|
|
7767 |
}
|
|
7768 |
|
|
7769 |
TVerdict CTestMmfAclntRecNoRecordDesc::PlaySuccessfull()
|
|
7770 |
{
|
|
7771 |
TVerdict testStatus = EPass;
|
|
7772 |
|
|
7773 |
if(iError != KErrNone)
|
|
7774 |
{
|
|
7775 |
testStatus = EFail;
|
|
7776 |
}
|
|
7777 |
|
|
7778 |
return testStatus;
|
|
7779 |
}
|
|
7780 |
|
|
7781 |
|
|
7782 |
|
|
7783 |
|
|
7784 |
CTestMmfAclntRecNoRecordFileForceController* CTestMmfAclntRecNoRecordFileForceController::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TUid aController)
|
|
7785 |
{
|
|
7786 |
CTestMmfAclntRecNoRecordFileForceController* self = new (ELeave) CTestMmfAclntRecNoRecordFileForceController(aTestName,aSectName,aKeyName, aController);
|
|
7787 |
return self;
|
|
7788 |
}
|
|
7789 |
|
|
7790 |
CTestMmfAclntRecNoRecordFileForceController* CTestMmfAclntRecNoRecordFileForceController::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TUid aController)
|
|
7791 |
{
|
|
7792 |
CTestMmfAclntRecNoRecordFileForceController* self = CTestMmfAclntRecNoRecordFileForceController::NewLC(aTestName,aSectName,aKeyName,aController);
|
|
7793 |
CleanupStack::PushL(self);
|
|
7794 |
return self;
|
|
7795 |
}
|
|
7796 |
|
|
7797 |
|
|
7798 |
CMdaAudioRecorderUtility* CTestMmfAclntRecNoRecordFileForceController::CMdaAudioRecorderUtilityLC()
|
|
7799 |
{
|
|
7800 |
INFO_PRINTF1( _L("Create CMdaAudioRecorderUtility with a file, forcing record controller"));
|
|
7801 |
|
|
7802 |
if(!GetStringFromConfig(iSectName, iKeyName, iFilename))
|
|
7803 |
{
|
|
7804 |
return NULL;
|
|
7805 |
}
|
|
7806 |
|
|
7807 |
|
|
7808 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
7809 |
CleanupStack::PushL(recUtil);
|
|
7810 |
|
|
7811 |
recUtil->OpenFileL(iFilename, KNullUid, iController);
|
|
7812 |
|
|
7813 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
7814 |
CActiveScheduler::Start();
|
|
7815 |
|
|
7816 |
if(iError != KErrNone)
|
|
7817 |
{
|
|
7818 |
CleanupStack::PopAndDestroy(recUtil);
|
|
7819 |
recUtil = NULL;
|
|
7820 |
}
|
|
7821 |
|
|
7822 |
return recUtil;
|
|
7823 |
}
|
|
7824 |
|
|
7825 |
TVerdict CTestMmfAclntRecNoRecordFileForceController::PlaySuccessfull()
|
|
7826 |
{
|
|
7827 |
TVerdict testStatus = EPass;
|
|
7828 |
|
|
7829 |
if(iError != KErrNone)
|
|
7830 |
{
|
|
7831 |
testStatus = EFail;
|
|
7832 |
}
|
|
7833 |
|
|
7834 |
|
|
7835 |
return testStatus;
|
|
7836 |
}
|
|
7837 |
|
|
7838 |
|
|
7839 |
CTestMmfAclntRecNoRecordDescForceController* CTestMmfAclntRecNoRecordDescForceController::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TUid aController)
|
|
7840 |
{
|
|
7841 |
CTestMmfAclntRecNoRecordDescForceController* self = new (ELeave) CTestMmfAclntRecNoRecordDescForceController(aTestName,aSectName,aKeyName,aController);
|
|
7842 |
return self;
|
|
7843 |
}
|
|
7844 |
|
|
7845 |
CTestMmfAclntRecNoRecordDescForceController* CTestMmfAclntRecNoRecordDescForceController::NewLC(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, const TUid aController)
|
|
7846 |
{
|
|
7847 |
CTestMmfAclntRecNoRecordDescForceController* self = CTestMmfAclntRecNoRecordDescForceController::NewLC(aTestName,aSectName,aKeyName,aController);
|
|
7848 |
CleanupStack::PushL(self);
|
|
7849 |
return self;
|
|
7850 |
}
|
|
7851 |
|
|
7852 |
|
|
7853 |
CMdaAudioRecorderUtility* CTestMmfAclntRecNoRecordDescForceController::CMdaAudioRecorderUtilityLC()
|
|
7854 |
{
|
|
7855 |
INFO_PRINTF1( _L("Create CMdaAudioRecorderUtility with a descriptor, forcing record controller"));
|
|
7856 |
|
|
7857 |
if(!GetStringFromConfig(iSectName, iKeyName, iFilename))
|
|
7858 |
{
|
|
7859 |
User::Leave(KErrNotFound);
|
|
7860 |
}
|
|
7861 |
|
|
7862 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
7863 |
CleanupStack::PushL(recUtil);
|
|
7864 |
|
|
7865 |
|
|
7866 |
RFs fs;
|
|
7867 |
RFile file;
|
|
7868 |
User::LeaveIfError(fs.Connect());
|
|
7869 |
User::LeaveIfError(file.Open(fs,iFilename,EFileRead));
|
|
7870 |
CleanupClosePushL(file);
|
|
7871 |
|
|
7872 |
TInt size;
|
|
7873 |
User::LeaveIfError(file.Size(size));
|
|
7874 |
|
|
7875 |
if(size == 0)
|
|
7876 |
{
|
|
7877 |
User::Leave(KErrNotFound);
|
|
7878 |
}
|
|
7879 |
|
|
7880 |
|
|
7881 |
|
|
7882 |
HBufC8* iBuf = HBufC8::NewL( size );
|
|
7883 |
CleanupStack::PushL(iBuf);
|
|
7884 |
|
|
7885 |
iFileDesc = new (ELeave) TPtr8( NULL, 0 );
|
|
7886 |
CleanupStack::PushL(iFileDesc);
|
|
7887 |
|
|
7888 |
iFileDesc->Set( iBuf->Des());
|
|
7889 |
|
|
7890 |
if(file.Read(*iFileDesc) != KErrNone)
|
|
7891 |
{
|
|
7892 |
User::Leave(KErrNotFound);
|
|
7893 |
}
|
|
7894 |
|
|
7895 |
|
|
7896 |
recUtil->OpenDesL(*iFileDesc, KNullUid, iController);
|
|
7897 |
|
|
7898 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
7899 |
CActiveScheduler::Start();
|
|
7900 |
|
|
7901 |
if(iError != KErrNone)
|
|
7902 |
{
|
|
7903 |
User::Leave(KErrNotFound);
|
|
7904 |
}
|
|
7905 |
|
|
7906 |
CleanupStack::Pop(iFileDesc);
|
|
7907 |
CleanupStack::Pop(iBuf);
|
|
7908 |
CleanupStack::PopAndDestroy(&file);
|
|
7909 |
return recUtil;
|
|
7910 |
}
|
|
7911 |
|
|
7912 |
TVerdict CTestMmfAclntRecNoRecordDescForceController::PlaySuccessfull()
|
|
7913 |
{
|
|
7914 |
TVerdict testStatus = EPass;
|
|
7915 |
|
|
7916 |
if(iError != KErrNone)
|
|
7917 |
{
|
|
7918 |
testStatus = EFail;
|
|
7919 |
}
|
|
7920 |
|
|
7921 |
return testStatus;
|
|
7922 |
}
|
|
7923 |
|
|
7924 |
|
|
7925 |
|
|
7926 |
//------------------------------------------------------------------
|
|
7927 |
|
|
7928 |
/**
|
|
7929 |
* Constructor
|
|
7930 |
*/
|
|
7931 |
CTestMmfAclntRecFileAppend::CTestMmfAclntRecFileAppend(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TFormatType aFormatType, TCodecType aCodecType, TBool aDiffSampleRate)
|
|
7932 |
{
|
|
7933 |
// store the name of this test case
|
|
7934 |
// this is the name that is used by the script file
|
|
7935 |
// Each test step initialises it's own name
|
|
7936 |
iTestStepName = aTestName;
|
|
7937 |
iSectName = aSectName;
|
|
7938 |
iKeyName = aKeyName;
|
|
7939 |
iFormatType = aFormatType;
|
|
7940 |
iCodecType = aCodecType;
|
|
7941 |
iDiffSampleRate = aDiffSampleRate;
|
|
7942 |
}
|
|
7943 |
|
|
7944 |
CTestMmfAclntRecFileAppend* CTestMmfAclntRecFileAppend::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TFormatType aFormatType, TCodecType aCodecType, TBool aDiffSampleRate)
|
|
7945 |
{
|
|
7946 |
CTestMmfAclntRecFileAppend* self = new (ELeave) CTestMmfAclntRecFileAppend(aTestName, aSectName, aKeyName, aFormatType, aCodecType, aDiffSampleRate);
|
|
7947 |
return self;
|
|
7948 |
}
|
|
7949 |
|
|
7950 |
void CTestMmfAclntRecFileAppend::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt aCurrentState, TInt aErrorCode)
|
|
7951 |
{
|
|
7952 |
iError = aErrorCode;
|
|
7953 |
iCurrentState = aCurrentState;
|
|
7954 |
INFO_PRINTF3( _L("MoscoStateChangeEvent: aCurrentState = %d, iError %d "), iCurrentState, iError);
|
|
7955 |
|
|
7956 |
CActiveScheduler::Stop();
|
|
7957 |
}
|
|
7958 |
|
|
7959 |
|
|
7960 |
TVerdict CTestMmfAclntRecFileAppend::DoTestStepPreambleL()
|
|
7961 |
{
|
|
7962 |
TVerdict ret = EPass;
|
|
7963 |
|
|
7964 |
// Make sure file doesn't exist (maybe from a previous test)
|
|
7965 |
TParse fullFileName;
|
|
7966 |
TBuf<KSizeBuf> filename;
|
|
7967 |
TPtrC filename1;
|
|
7968 |
|
|
7969 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
7970 |
{
|
|
7971 |
return EInconclusive;
|
|
7972 |
}
|
|
7973 |
|
|
7974 |
|
|
7975 |
GetDriveName(filename);
|
|
7976 |
filename.Append(filename1);
|
|
7977 |
|
|
7978 |
|
|
7979 |
// parse the filenames
|
|
7980 |
if(!fullFileName.Set(filename, &KDefault, NULL))
|
|
7981 |
{
|
|
7982 |
RFs fs;
|
|
7983 |
User::LeaveIfError(fs.Connect());
|
|
7984 |
fs.SetAtt(fullFileName.FullName(), 0, KEntryAttReadOnly);
|
|
7985 |
TInt error = fs.Delete(fullFileName.FullName());
|
|
7986 |
|
|
7987 |
if(error == KErrPathNotFound)
|
|
7988 |
{
|
|
7989 |
error = fs.MkDirAll(fullFileName.DriveAndPath());
|
|
7990 |
INFO_PRINTF2(_L("Path for file %S was been created"), &fullFileName.FullName());
|
|
7991 |
}
|
|
7992 |
else if(error == KErrNotFound)
|
|
7993 |
INFO_PRINTF2(_L("No need to delete %S"), &fullFileName.FullName());
|
|
7994 |
else if(error==KErrNone)
|
|
7995 |
INFO_PRINTF2(_L("Deleted %S"), &fullFileName.FullName());
|
|
7996 |
else
|
|
7997 |
{
|
|
7998 |
ret = EInconclusive;
|
|
7999 |
}
|
|
8000 |
fs.Close();
|
|
8001 |
}
|
|
8002 |
|
|
8003 |
if((ret == EInconclusive) || (ret == EFail))
|
|
8004 |
return ret;
|
|
8005 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
|
8006 |
}
|
|
8007 |
|
|
8008 |
|
|
8009 |
const TInt KSeventyFive = 75;
|
|
8010 |
const TInt KTwentyFive = 25;
|
|
8011 |
const TInt KOneHundred = 100;
|
|
8012 |
|
|
8013 |
/**
|
|
8014 |
* Open a file based clip and record, stop & then record again
|
|
8015 |
*/
|
|
8016 |
|
|
8017 |
|
|
8018 |
TVerdict CTestMmfAclntRecFileAppend::DoTestStepL()
|
|
8019 |
{
|
|
8020 |
INFO_PRINTF1( _L("TestRecorder : Record File"));
|
|
8021 |
TVerdict ret = EPass;
|
|
8022 |
iError = KErrGeneral; // set error to ensure callback takes place
|
|
8023 |
|
|
8024 |
TInt size1 = 0; // size of file after first record
|
|
8025 |
TInt size2 = 0; // size of file after append
|
|
8026 |
|
|
8027 |
TPtrC filename;
|
|
8028 |
if(!GetStringFromConfig(iSectName, iKeyName, filename))
|
|
8029 |
return EInconclusive;
|
|
8030 |
|
|
8031 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
8032 |
CleanupStack::PushL(recUtil);
|
|
8033 |
|
|
8034 |
TMdaFileClipLocation location(filename);
|
|
8035 |
|
|
8036 |
RFs fs;
|
|
8037 |
fs.Connect();
|
|
8038 |
fs.Delete(filename);
|
|
8039 |
fs.Close();
|
|
8040 |
|
|
8041 |
for (TInt index=0; index<2; index++)
|
|
8042 |
{
|
|
8043 |
if (index == 0)
|
|
8044 |
INFO_PRINTF1(_L("Recording to file..."));
|
|
8045 |
else
|
|
8046 |
INFO_PRINTF1(_L("Appending to file..."));
|
|
8047 |
|
|
8048 |
TMdaWavClipFormat mdaWavFormat;
|
|
8049 |
TMdaAuClipFormat mdaAuFormat;
|
|
8050 |
TMdaClipFormat* format = NULL;
|
|
8051 |
|
|
8052 |
TMdaImaAdpcmWavCodec wavImadCodec;
|
|
8053 |
TMdaPcmWavCodec wav8PcmCodec;
|
|
8054 |
TMdaPcm8BitAuCodec au8PcmCodec;
|
|
8055 |
|
|
8056 |
TMdaPackage* codec = NULL;
|
|
8057 |
|
|
8058 |
switch (iFormatType)
|
|
8059 |
{
|
|
8060 |
case EWavFormat:
|
|
8061 |
format = &mdaWavFormat;
|
|
8062 |
switch (iCodecType)
|
|
8063 |
{
|
|
8064 |
case EAdpcmCodec:
|
|
8065 |
codec = &wavImadCodec;
|
|
8066 |
break;
|
|
8067 |
case EPcmCodec:
|
|
8068 |
codec = &wav8PcmCodec;
|
|
8069 |
break;
|
|
8070 |
}
|
|
8071 |
break;
|
|
8072 |
case EAuFormat:
|
|
8073 |
format = &mdaAuFormat;
|
|
8074 |
switch (iCodecType)
|
|
8075 |
{
|
|
8076 |
case EPcmCodec:
|
|
8077 |
codec = &au8PcmCodec;
|
|
8078 |
break;
|
|
8079 |
default:
|
|
8080 |
break;
|
|
8081 |
}
|
|
8082 |
break;
|
|
8083 |
}
|
|
8084 |
|
|
8085 |
if (format == NULL || codec == NULL)
|
|
8086 |
{
|
|
8087 |
ret = EInconclusive;
|
|
8088 |
break;
|
|
8089 |
}
|
|
8090 |
|
|
8091 |
TMdaAudioDataSettings audioSettings;
|
|
8092 |
audioSettings.iCaps =
|
|
8093 |
TMdaAudioDataSettings::ESampleRateFixed |
|
|
8094 |
TMdaAudioDataSettings::EChannelsMono |
|
|
8095 |
TMdaAudioDataSettings::ESampleRate8000Hz |
|
|
8096 |
TMdaAudioDataSettings::ESampleRate11025Hz;
|
|
8097 |
|
|
8098 |
audioSettings.iSampleRate = KSampleRate8K;
|
|
8099 |
audioSettings.iChannels = 1;
|
|
8100 |
audioSettings.iFlags = TMdaAudioDataSettings::ENoNetworkRouting;
|
|
8101 |
if (index == 1 && iDiffSampleRate)
|
|
8102 |
{
|
|
8103 |
audioSettings.iSampleRate = KSampleRate11K;
|
|
8104 |
}
|
|
8105 |
|
|
8106 |
|
|
8107 |
recUtil->OpenL(&location, format, codec, &audioSettings);
|
|
8108 |
|
|
8109 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
8110 |
CActiveScheduler::Start(); // idle -> open
|
|
8111 |
|
|
8112 |
if(iError != KErrNone)
|
|
8113 |
{
|
|
8114 |
break;
|
|
8115 |
}
|
|
8116 |
|
|
8117 |
iError = KErrTimedOut;
|
|
8118 |
recUtil->RecordL();
|
|
8119 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
8120 |
CActiveScheduler::Start(); // open -> record
|
|
8121 |
|
|
8122 |
User::After(KTwoSeconds);
|
|
8123 |
|
|
8124 |
if (iCurrentState != CMdaAudioClipUtility::ERecording)
|
|
8125 |
{
|
|
8126 |
INFO_PRINTF1( _L("CMdaAudioRecorderUtility is not recording"));
|
|
8127 |
ret = EFail;
|
|
8128 |
break;
|
|
8129 |
}
|
|
8130 |
|
|
8131 |
recUtil->Stop();
|
|
8132 |
|
|
8133 |
|
|
8134 |
if (index == 1)
|
|
8135 |
{
|
|
8136 |
TTimeIntervalMicroSeconds actualDuration;
|
|
8137 |
TTimeIntervalMicroSeconds expectedDuration(KFourSeconds);
|
|
8138 |
actualDuration = recUtil->Duration();
|
|
8139 |
INFO_PRINTF3(_L("Duration recorded file, expected = %f, actual: %f"),
|
|
8140 |
I64REAL(expectedDuration.Int64()), I64REAL(actualDuration.Int64()));
|
|
8141 |
// allow a deviation of 25%
|
|
8142 |
if (actualDuration.Int64() < expectedDuration.Int64() * KSeventyFive / KOneHundred)
|
|
8143 |
{
|
|
8144 |
ERR_PRINTF1(_L("Appended duration is too short"));
|
|
8145 |
ret = EFail;
|
|
8146 |
}
|
|
8147 |
else if (actualDuration.Int64() > expectedDuration.Int64() * (KOneHundred+KTwentyFive) / KOneHundred)
|
|
8148 |
{
|
|
8149 |
ERR_PRINTF1(_L("Appended duration is too long"));
|
|
8150 |
ret = EFail;
|
|
8151 |
}
|
|
8152 |
}
|
|
8153 |
|
|
8154 |
|
|
8155 |
|
|
8156 |
recUtil->Close();
|
|
8157 |
|
|
8158 |
if(iError == KErrNone)
|
|
8159 |
{
|
|
8160 |
RFs fs;
|
|
8161 |
RFile file;
|
|
8162 |
TInt size = 0;
|
|
8163 |
|
|
8164 |
User::LeaveIfError(fs.Connect());
|
|
8165 |
User::LeaveIfError(file.Open(fs,filename,EFileRead));
|
|
8166 |
CleanupClosePushL(file);
|
|
8167 |
User::LeaveIfError(file.Size(size));
|
|
8168 |
INFO_PRINTF2(_L("File size = %d"), size);
|
|
8169 |
|
|
8170 |
if(size <= 0)
|
|
8171 |
{
|
|
8172 |
ret = EFail;
|
|
8173 |
}
|
|
8174 |
|
|
8175 |
CleanupStack::PopAndDestroy(&file);
|
|
8176 |
|
|
8177 |
if (index == 0)
|
|
8178 |
{
|
|
8179 |
size1 = size;
|
|
8180 |
}
|
|
8181 |
|
|
8182 |
else
|
|
8183 |
{
|
|
8184 |
size2 = size;
|
|
8185 |
}
|
|
8186 |
|
|
8187 |
}
|
|
8188 |
}
|
|
8189 |
|
|
8190 |
if (iError != KErrNone)
|
|
8191 |
{
|
|
8192 |
ret = EFail;
|
|
8193 |
}
|
|
8194 |
|
|
8195 |
|
|
8196 |
// the appended size should be double the original size
|
|
8197 |
// but to allow a little deviation, ensure it's at least 1.5 times bigger
|
|
8198 |
if (ret == EPass)
|
|
8199 |
{
|
|
8200 |
if (size2 < (size1*(KOneHundred+KSeventyFive)/KOneHundred))
|
|
8201 |
{
|
|
8202 |
ERR_PRINTF1(_L("Appended file size is too short"));
|
|
8203 |
ret = EFail;
|
|
8204 |
}
|
|
8205 |
else if (size2 > (size1*(KOneHundred+KOneHundred+KTwentyFive)/KOneHundred))
|
|
8206 |
{
|
|
8207 |
ERR_PRINTF1(_L("Appended file size is too long"));
|
|
8208 |
ret = EFail;
|
|
8209 |
}
|
|
8210 |
}
|
|
8211 |
|
|
8212 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility completed with error %d"),iError );
|
|
8213 |
CleanupStack::PopAndDestroy(recUtil);
|
|
8214 |
User::After(KOneSecond);
|
|
8215 |
return ret;
|
|
8216 |
}
|
|
8217 |
|
|
8218 |
|
|
8219 |
/**
|
|
8220 |
* Constructor
|
|
8221 |
*/
|
|
8222 |
CTestMmfAclntRecFilePlay::CTestMmfAclntRecFilePlay(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TFormatType aFormatType, TCodecType aCodecType)
|
|
8223 |
{
|
|
8224 |
// store the name of this test case
|
|
8225 |
// this is the name that is used by the script file
|
|
8226 |
// Each test step initialises it's own name
|
|
8227 |
iTestStepName = aTestName;
|
|
8228 |
iSectName = aSectName;
|
|
8229 |
iKeyName = aKeyName;
|
|
8230 |
iFormatType = aFormatType;
|
|
8231 |
iCodecType = aCodecType;
|
|
8232 |
}
|
|
8233 |
|
|
8234 |
CTestMmfAclntRecFilePlay* CTestMmfAclntRecFilePlay::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TFormatType aFormatType, TCodecType aCodecType)
|
|
8235 |
{
|
|
8236 |
CTestMmfAclntRecFilePlay* self = new (ELeave) CTestMmfAclntRecFilePlay(aTestName, aSectName, aKeyName, aFormatType, aCodecType);
|
|
8237 |
return self;
|
|
8238 |
}
|
|
8239 |
|
|
8240 |
void CTestMmfAclntRecFilePlay::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt aCurrentState, TInt aErrorCode)
|
|
8241 |
{
|
|
8242 |
iError = aErrorCode;
|
|
8243 |
iCurrentState = aCurrentState;
|
|
8244 |
INFO_PRINTF3( _L("MoscoStateChangeEvent: aCurrentState = %d, iError %d "), iCurrentState, iError);
|
|
8245 |
|
|
8246 |
CActiveScheduler::Stop();
|
|
8247 |
}
|
|
8248 |
|
|
8249 |
|
|
8250 |
TVerdict CTestMmfAclntRecFilePlay::DoTestStepPreambleL()
|
|
8251 |
{
|
|
8252 |
TVerdict ret = EPass;
|
|
8253 |
|
|
8254 |
// Make sure file doesn't exist (maybe from a previous test)
|
|
8255 |
TParse fullFileName;
|
|
8256 |
TBuf<KSizeBuf> filename;
|
|
8257 |
TPtrC filename1;
|
|
8258 |
|
|
8259 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
8260 |
return EInconclusive;
|
|
8261 |
|
|
8262 |
GetDriveName(filename);
|
|
8263 |
filename.Append(filename1);
|
|
8264 |
|
|
8265 |
|
|
8266 |
// parse the filenames
|
|
8267 |
if(!fullFileName.Set(filename, &KDefault, NULL))
|
|
8268 |
{
|
|
8269 |
RFs fs;
|
|
8270 |
User::LeaveIfError(fs.Connect());
|
|
8271 |
fs.SetAtt(fullFileName.FullName(), 0, KEntryAttReadOnly);
|
|
8272 |
TInt error = fs.Delete(fullFileName.FullName());
|
|
8273 |
|
|
8274 |
if(error == KErrPathNotFound)
|
|
8275 |
{
|
|
8276 |
error = fs.MkDirAll(fullFileName.DriveAndPath());
|
|
8277 |
INFO_PRINTF2(_L("Path for file %S was been created"), &fullFileName.FullName());
|
|
8278 |
}
|
|
8279 |
else if(error == KErrNotFound)
|
|
8280 |
INFO_PRINTF2(_L("No need to delete %S"), &fullFileName.FullName());
|
|
8281 |
else if(error==KErrNone)
|
|
8282 |
INFO_PRINTF2(_L("Deleted %S"), &fullFileName.FullName());
|
|
8283 |
else
|
|
8284 |
{
|
|
8285 |
ret = EInconclusive;
|
|
8286 |
}
|
|
8287 |
fs.Close();
|
|
8288 |
}
|
|
8289 |
|
|
8290 |
if((ret == EInconclusive) || (ret == EFail))
|
|
8291 |
return ret;
|
|
8292 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
|
8293 |
}
|
|
8294 |
|
|
8295 |
/**
|
|
8296 |
* Open a file based clip and record, stop & then play
|
|
8297 |
* specifying a different sample rate / number of channels
|
|
8298 |
*/
|
|
8299 |
|
|
8300 |
|
|
8301 |
TVerdict CTestMmfAclntRecFilePlay::DoTestStepL()
|
|
8302 |
{
|
|
8303 |
INFO_PRINTF1( _L("TestRecorder : Record File & play with diff sample rate/num of channels"));
|
|
8304 |
TVerdict ret = EPass;
|
|
8305 |
iError = KErrGeneral; // set error to ensure callback takes place
|
|
8306 |
|
|
8307 |
TPtrC filename;
|
|
8308 |
if(!GetStringFromConfig(iSectName, iKeyName, filename))
|
|
8309 |
return EInconclusive;
|
|
8310 |
|
|
8311 |
CMdaAudioRecorderUtility* recUtil = NULL;
|
|
8312 |
|
|
8313 |
TMdaFileClipLocation location(filename);
|
|
8314 |
|
|
8315 |
RFs fs;
|
|
8316 |
fs.Connect();
|
|
8317 |
fs.Delete(filename);
|
|
8318 |
fs.Close();
|
|
8319 |
|
|
8320 |
for (TInt index=0; index<2; index++)
|
|
8321 |
{
|
|
8322 |
if (recUtil)
|
|
8323 |
{
|
|
8324 |
CleanupStack::PopAndDestroy(recUtil);
|
|
8325 |
recUtil = NULL;
|
|
8326 |
}
|
|
8327 |
|
|
8328 |
recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
8329 |
CleanupStack::PushL(recUtil);
|
|
8330 |
|
|
8331 |
if (index == 0)
|
|
8332 |
INFO_PRINTF1(_L("Recording to file..."));
|
|
8333 |
else
|
|
8334 |
INFO_PRINTF1(_L("Playing recorded file"));
|
|
8335 |
|
|
8336 |
TMdaWavClipFormat mdaWavFormat;
|
|
8337 |
TMdaAuClipFormat mdaAuFormat;
|
|
8338 |
TMdaClipFormat* format = NULL;
|
|
8339 |
|
|
8340 |
TMdaImaAdpcmWavCodec wavImadCodec;
|
|
8341 |
TMdaPcmWavCodec wav8PcmCodec;
|
|
8342 |
TMdaPcm8BitAuCodec au8PcmCodec;
|
|
8343 |
|
|
8344 |
TMdaPackage* codec = NULL;
|
|
8345 |
|
|
8346 |
switch (iFormatType)
|
|
8347 |
{
|
|
8348 |
case EWavFormat:
|
|
8349 |
format = &mdaWavFormat;
|
|
8350 |
switch (iCodecType)
|
|
8351 |
{
|
|
8352 |
case EAdpcmCodec:
|
|
8353 |
codec = &wavImadCodec;
|
|
8354 |
break;
|
|
8355 |
case EPcmCodec:
|
|
8356 |
codec = &wav8PcmCodec;
|
|
8357 |
break;
|
|
8358 |
}
|
|
8359 |
break;
|
|
8360 |
case EAuFormat:
|
|
8361 |
format = &mdaAuFormat;
|
|
8362 |
switch (iCodecType)
|
|
8363 |
{
|
|
8364 |
case EPcmCodec:
|
|
8365 |
codec = &au8PcmCodec;
|
|
8366 |
break;
|
|
8367 |
default:
|
|
8368 |
break;
|
|
8369 |
}
|
|
8370 |
break;
|
|
8371 |
}
|
|
8372 |
|
|
8373 |
if (format == NULL || codec == NULL)
|
|
8374 |
{
|
|
8375 |
ret = EInconclusive;
|
|
8376 |
break;
|
|
8377 |
}
|
|
8378 |
|
|
8379 |
TMdaAudioDataSettings audioSettings;
|
|
8380 |
audioSettings.iCaps =
|
|
8381 |
TMdaAudioDataSettings::ESampleRateFixed |
|
|
8382 |
TMdaAudioDataSettings::EChannelsMono |
|
|
8383 |
TMdaAudioDataSettings::EChannelsStereo |
|
|
8384 |
TMdaAudioDataSettings::ESampleRate8000Hz |
|
|
8385 |
TMdaAudioDataSettings::ESampleRate11025Hz;
|
|
8386 |
|
|
8387 |
audioSettings.iFlags = TMdaAudioDataSettings::ENoNetworkRouting;
|
|
8388 |
|
|
8389 |
// record in stereo at 8KHz, playback in mono at 11KHz
|
|
8390 |
if (index == 0) // record
|
|
8391 |
{
|
|
8392 |
audioSettings.iSampleRate = KSampleRate8K;
|
|
8393 |
audioSettings.iChannels = 2;
|
|
8394 |
}
|
|
8395 |
else // play
|
|
8396 |
{
|
|
8397 |
audioSettings.iSampleRate = KSampleRate11K;
|
|
8398 |
audioSettings.iChannels = 1;
|
|
8399 |
}
|
|
8400 |
|
|
8401 |
|
|
8402 |
recUtil->OpenL(&location, format, codec, &audioSettings);
|
|
8403 |
|
|
8404 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
8405 |
CActiveScheduler::Start(); // idle -> open
|
|
8406 |
|
|
8407 |
if(iError != KErrNone)
|
|
8408 |
break;
|
|
8409 |
|
|
8410 |
iError = KErrTimedOut;
|
|
8411 |
|
|
8412 |
if (index == 0) // record
|
|
8413 |
{
|
|
8414 |
recUtil->RecordL();
|
|
8415 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
8416 |
CActiveScheduler::Start(); // open -> record
|
|
8417 |
|
|
8418 |
User::After(KTwoSeconds);
|
|
8419 |
|
|
8420 |
if (iCurrentState != CMdaAudioClipUtility::ERecording)
|
|
8421 |
{
|
|
8422 |
INFO_PRINTF1( _L("CMdaAudioRecorderUtility is not recording"));
|
|
8423 |
ret = EFail;
|
|
8424 |
break;
|
|
8425 |
}
|
|
8426 |
|
|
8427 |
recUtil->Stop();
|
|
8428 |
|
|
8429 |
}
|
|
8430 |
else // play
|
|
8431 |
{
|
|
8432 |
recUtil->PlayL();
|
|
8433 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
8434 |
CActiveScheduler::Start(); // open -> play
|
|
8435 |
CActiveScheduler::Start(); // play -> open
|
|
8436 |
}
|
|
8437 |
|
|
8438 |
recUtil->Close();
|
|
8439 |
|
|
8440 |
|
|
8441 |
}
|
|
8442 |
|
|
8443 |
if (iError != KErrNone)
|
|
8444 |
ret = EFail;
|
|
8445 |
|
|
8446 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility completed with error %d"),iError );
|
|
8447 |
if (recUtil)
|
|
8448 |
{
|
|
8449 |
CleanupStack::PopAndDestroy(recUtil);
|
|
8450 |
recUtil = NULL;
|
|
8451 |
}
|
|
8452 |
|
|
8453 |
User::After(KOneSecond);
|
|
8454 |
return ret;
|
|
8455 |
}
|
|
8456 |
|
|
8457 |
|
|
8458 |
/**
|
|
8459 |
* DEF039893
|
|
8460 |
* Gets balance prior to setting balance
|
|
8461 |
* @class CTestMmfAclntRecord
|
|
8462 |
*/
|
|
8463 |
CTestMmfAclntRecordGetBalance::CTestMmfAclntRecordGetBalance(const TDesC& aTestName)
|
|
8464 |
{
|
|
8465 |
// store the name of this test case
|
|
8466 |
// this is the name that is used by the script file
|
|
8467 |
// Each test step initialises it's own name
|
|
8468 |
iTestStepName = aTestName;
|
|
8469 |
}
|
|
8470 |
|
|
8471 |
CTestMmfAclntRecordGetBalance* CTestMmfAclntRecordGetBalance::NewL(const TDesC& aTestName)
|
|
8472 |
{
|
|
8473 |
CTestMmfAclntRecordGetBalance* self = new (ELeave) CTestMmfAclntRecordGetBalance(aTestName);
|
|
8474 |
return self;
|
|
8475 |
}
|
|
8476 |
|
|
8477 |
void CTestMmfAclntRecordGetBalance::MoscoStateChangeEvent(CBase* aObject,TInt aPreviousState,TInt aCurrentState, TInt aErrorCode)
|
|
8478 |
{
|
|
8479 |
iObject = aObject;
|
|
8480 |
iPreviousState = aPreviousState;
|
|
8481 |
iCurrentState = aCurrentState;
|
|
8482 |
iError = aErrorCode;
|
|
8483 |
CActiveScheduler::Stop();
|
|
8484 |
}
|
|
8485 |
|
|
8486 |
TVerdict CTestMmfAclntRecordGetBalance::DoTestStepL()
|
|
8487 |
{
|
|
8488 |
// Set up a file to record to
|
|
8489 |
TVerdict verdict = EPass;
|
|
8490 |
|
|
8491 |
TPtrC filename;
|
|
8492 |
if (!GetStringFromConfig(_L("SectionThree"), _L("outputAudioFile"), filename))
|
|
8493 |
{
|
|
8494 |
INFO_PRINTF1(_L("Error getting filename from INI file"));
|
|
8495 |
return EInconclusive;
|
|
8496 |
}
|
|
8497 |
|
|
8498 |
RFs fs;
|
|
8499 |
TInt err = fs.Connect();
|
|
8500 |
if (err != KErrNone)
|
|
8501 |
{
|
|
8502 |
INFO_PRINTF2(_L("Error connecting file session"), err);
|
|
8503 |
return EInconclusive;
|
|
8504 |
}
|
|
8505 |
|
|
8506 |
err = fs.Delete(filename);
|
|
8507 |
if (!((err == KErrNone) || (err == KErrNotFound)))
|
|
8508 |
{
|
|
8509 |
INFO_PRINTF2(_L("Error deleting output file"), err);
|
|
8510 |
return EInconclusive;
|
|
8511 |
}
|
|
8512 |
|
|
8513 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
8514 |
|
|
8515 |
TInt balance;
|
|
8516 |
err = recUtil->GetPlaybackBalance(balance);
|
|
8517 |
|
|
8518 |
if (err != KErrNotSupported)
|
|
8519 |
{//would have thought KErrNotReady would be a more logical error
|
|
8520 |
verdict = EFail;
|
|
8521 |
}
|
|
8522 |
|
|
8523 |
TRAP(err,recUtil->OpenFileL(filename));
|
|
8524 |
CActiveScheduler::Start();
|
|
8525 |
|
|
8526 |
if (err)
|
|
8527 |
{
|
|
8528 |
INFO_PRINTF2(_L("Error opening output file"), err);
|
|
8529 |
verdict = EInconclusive;
|
|
8530 |
}
|
|
8531 |
else
|
|
8532 |
{
|
|
8533 |
err = recUtil->GetPlaybackBalance(balance);
|
|
8534 |
|
|
8535 |
if ((err)||(balance))
|
|
8536 |
{//there should be no errors and balance should be 0
|
|
8537 |
verdict = EFail;
|
|
8538 |
}
|
|
8539 |
|
|
8540 |
recUtil->Close();
|
|
8541 |
|
|
8542 |
err = recUtil->GetPlaybackBalance(balance);
|
|
8543 |
if (err != KErrNotSupported)
|
|
8544 |
{
|
|
8545 |
verdict = EFail;
|
|
8546 |
}
|
|
8547 |
}
|
|
8548 |
|
|
8549 |
delete recUtil;
|
|
8550 |
|
|
8551 |
return verdict;
|
|
8552 |
}
|
|
8553 |
/*
|
|
8554 |
DEF039308 - No integration test to test playback of recorded raw file
|
|
8555 |
The tmfad record test option b + 4 to record an alaw raw file and then play it back: this uncovered a defect that was not picked up by the integration tests suggesting there are no integration tests to record and playback a recorded raw file.
|
|
8556 |
Not clear whether this applies to just recording raw alaw or recorded raw in general- this needs checking as part of the 'under investigation' phase.
|
|
8557 |
*/
|
|
8558 |
|
|
8559 |
/**
|
|
8560 |
* Constructor
|
|
8561 |
*/
|
|
8562 |
CTestMmfAclntRecRawFilePlay::CTestMmfAclntRecRawFilePlay(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TFormatType aFormatType, TCodecType aCodecType)
|
|
8563 |
{
|
|
8564 |
// store the name of this test case
|
|
8565 |
// this is the name that is used by the script file
|
|
8566 |
// Each test step initialises it's own name
|
|
8567 |
iTestStepName = aTestName;
|
|
8568 |
iSectName = aSectName;
|
|
8569 |
iKeyName = aKeyName;
|
|
8570 |
iFormatType = aFormatType;
|
|
8571 |
iCodecType = aCodecType;
|
|
8572 |
}
|
|
8573 |
|
|
8574 |
CTestMmfAclntRecRawFilePlay* CTestMmfAclntRecRawFilePlay::NewL(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName, TFormatType aFormatType, TCodecType aCodecType)
|
|
8575 |
{
|
|
8576 |
CTestMmfAclntRecRawFilePlay* self = new (ELeave) CTestMmfAclntRecRawFilePlay(aTestName, aSectName, aKeyName, aFormatType, aCodecType);
|
|
8577 |
return self;
|
|
8578 |
}
|
|
8579 |
|
|
8580 |
void CTestMmfAclntRecRawFilePlay::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt aCurrentState, TInt aErrorCode)
|
|
8581 |
{
|
|
8582 |
iError = aErrorCode;
|
|
8583 |
iCurrentState = aCurrentState;
|
|
8584 |
INFO_PRINTF3( _L("MoscoStateChangeEvent: aCurrentState = %d, iError %d "), iCurrentState, iError);
|
|
8585 |
|
|
8586 |
CActiveScheduler::Stop();
|
|
8587 |
}
|
|
8588 |
|
|
8589 |
|
|
8590 |
TVerdict CTestMmfAclntRecRawFilePlay::DoTestStepPreambleL()
|
|
8591 |
{
|
|
8592 |
TVerdict ret = EPass;
|
|
8593 |
|
|
8594 |
// Make sure file doesn't exist (maybe from a previous test)
|
|
8595 |
TParse fullFileName;
|
|
8596 |
TBuf<KSizeBuf> filename;
|
|
8597 |
TPtrC filename1;
|
|
8598 |
|
|
8599 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
8600 |
return EInconclusive;
|
|
8601 |
|
|
8602 |
GetDriveName(filename);
|
|
8603 |
filename.Append(filename1);
|
|
8604 |
|
|
8605 |
|
|
8606 |
// parse the filenames
|
|
8607 |
if(!fullFileName.Set(filename, &KDefault, NULL))
|
|
8608 |
{
|
|
8609 |
RFs fs;
|
|
8610 |
User::LeaveIfError(fs.Connect());
|
|
8611 |
fs.SetAtt(fullFileName.FullName(), 0, KEntryAttReadOnly);
|
|
8612 |
TInt error = fs.Delete(fullFileName.FullName());
|
|
8613 |
|
|
8614 |
if(error == KErrPathNotFound)
|
|
8615 |
{
|
|
8616 |
error = fs.MkDirAll(fullFileName.DriveAndPath());
|
|
8617 |
INFO_PRINTF2(_L("Path for file %S was been created"), &fullFileName.FullName());
|
|
8618 |
}
|
|
8619 |
else if(error == KErrNotFound)
|
|
8620 |
INFO_PRINTF2(_L("No need to delete %S"), &fullFileName.FullName());
|
|
8621 |
else if(error==KErrNone)
|
|
8622 |
INFO_PRINTF2(_L("Deleted %S"), &fullFileName.FullName());
|
|
8623 |
else
|
|
8624 |
{
|
|
8625 |
ret = EInconclusive;
|
|
8626 |
}
|
|
8627 |
fs.Close();
|
|
8628 |
}
|
|
8629 |
|
|
8630 |
if((ret == EInconclusive) || (ret == EFail))
|
|
8631 |
return ret;
|
|
8632 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
|
8633 |
}
|
|
8634 |
|
|
8635 |
/**
|
|
8636 |
* Open a file based clip and record, stop & then play
|
|
8637 |
* specifying a different sample rate / number of channels
|
|
8638 |
*/
|
|
8639 |
|
|
8640 |
|
|
8641 |
TVerdict CTestMmfAclntRecRawFilePlay::DoTestStepL()
|
|
8642 |
{
|
|
8643 |
INFO_PRINTF1( _L("TestRecorder : Record RAW File & play with diff sample rate/num of channels"));
|
|
8644 |
TVerdict ret = EPass;
|
|
8645 |
iError = KErrGeneral; // set error to ensure callback takes place
|
|
8646 |
|
|
8647 |
TPtrC filename;
|
|
8648 |
if(!GetStringFromConfig(iSectName, iKeyName, filename))
|
|
8649 |
return EInconclusive;
|
|
8650 |
|
|
8651 |
CMdaAudioRecorderUtility* recUtil = NULL;
|
|
8652 |
|
|
8653 |
TMdaFileClipLocation location(filename);
|
|
8654 |
|
|
8655 |
RFs fs;
|
|
8656 |
fs.Connect();
|
|
8657 |
fs.Delete(filename);
|
|
8658 |
fs.Close();
|
|
8659 |
|
|
8660 |
for (TInt index=0; index<2; index++)
|
|
8661 |
{
|
|
8662 |
if (recUtil)
|
|
8663 |
{
|
|
8664 |
CleanupStack::PopAndDestroy(recUtil);
|
|
8665 |
recUtil = NULL;
|
|
8666 |
}
|
|
8667 |
|
|
8668 |
recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
8669 |
CleanupStack::PushL(recUtil);
|
|
8670 |
|
|
8671 |
if (index == 0)
|
|
8672 |
INFO_PRINTF1(_L("Recording to file..."));
|
|
8673 |
else
|
|
8674 |
INFO_PRINTF1(_L("Playing recorded file"));
|
|
8675 |
|
|
8676 |
TMdaRawAudioClipFormat mdaRawFormat;
|
|
8677 |
TMdaClipFormat* format = NULL;
|
|
8678 |
|
|
8679 |
TMdaAlawRawAudioCodec rawAlawCodec;
|
|
8680 |
|
|
8681 |
TMdaPackage* codec = NULL;
|
|
8682 |
|
|
8683 |
switch (iFormatType)
|
|
8684 |
{
|
|
8685 |
case ERawFormat:
|
|
8686 |
format = &mdaRawFormat;
|
|
8687 |
switch (iCodecType)
|
|
8688 |
{
|
|
8689 |
case EAlawCodec:
|
|
8690 |
codec = &rawAlawCodec;
|
|
8691 |
break;
|
|
8692 |
default:
|
|
8693 |
break;
|
|
8694 |
}
|
|
8695 |
break;
|
|
8696 |
}
|
|
8697 |
|
|
8698 |
if (format == NULL || codec == NULL)
|
|
8699 |
{
|
|
8700 |
ret = EInconclusive;
|
|
8701 |
break;
|
|
8702 |
}
|
|
8703 |
|
|
8704 |
TMdaAudioDataSettings audioSettings;
|
|
8705 |
audioSettings.iCaps =
|
|
8706 |
TMdaAudioDataSettings::ESampleRateFixed |
|
|
8707 |
TMdaAudioDataSettings::EChannelsMono |
|
|
8708 |
TMdaAudioDataSettings::EChannelsStereo |
|
|
8709 |
TMdaAudioDataSettings::ESampleRate8000Hz |
|
|
8710 |
TMdaAudioDataSettings::ESampleRate11025Hz;
|
|
8711 |
|
|
8712 |
audioSettings.iFlags = TMdaAudioDataSettings::ENoNetworkRouting;
|
|
8713 |
|
|
8714 |
// record in stereo at 8KHz, playback in mono at 11KHz
|
|
8715 |
if (index == 0) // record
|
|
8716 |
{
|
|
8717 |
audioSettings.iSampleRate = KSampleRate8K;
|
|
8718 |
audioSettings.iChannels = 2;
|
|
8719 |
}
|
|
8720 |
else // play
|
|
8721 |
{
|
|
8722 |
audioSettings.iSampleRate = KSampleRate11K;
|
|
8723 |
audioSettings.iChannels = 1;
|
|
8724 |
}
|
|
8725 |
|
|
8726 |
|
|
8727 |
recUtil->OpenL(&location, format, codec, &audioSettings);
|
|
8728 |
|
|
8729 |
INFO_PRINTF1( _L("Initialise CMdaAudioRecorderUtility"));
|
|
8730 |
CActiveScheduler::Start(); // idle -> open
|
|
8731 |
|
|
8732 |
if(iError != KErrNone)
|
|
8733 |
break;
|
|
8734 |
|
|
8735 |
iError = KErrTimedOut;
|
|
8736 |
|
|
8737 |
if (index == 0) // record
|
|
8738 |
{
|
|
8739 |
recUtil->RecordL();
|
|
8740 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
8741 |
CActiveScheduler::Start(); // open -> record
|
|
8742 |
|
|
8743 |
User::After(KTwoSeconds);
|
|
8744 |
|
|
8745 |
if (iCurrentState != CMdaAudioClipUtility::ERecording)
|
|
8746 |
{
|
|
8747 |
INFO_PRINTF1( _L("CMdaAudioRecorderUtility is not recording"));
|
|
8748 |
ret = EFail;
|
|
8749 |
break;
|
|
8750 |
}
|
|
8751 |
|
|
8752 |
recUtil->Stop();
|
|
8753 |
|
|
8754 |
}
|
|
8755 |
else // play
|
|
8756 |
{
|
|
8757 |
recUtil->PlayL();
|
|
8758 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
8759 |
CActiveScheduler::Start(); // open -> play
|
|
8760 |
CActiveScheduler::Start(); // play -> open
|
|
8761 |
}
|
|
8762 |
|
|
8763 |
recUtil->Close();
|
|
8764 |
|
|
8765 |
|
|
8766 |
}
|
|
8767 |
|
|
8768 |
if (iError != KErrNone)
|
|
8769 |
ret = EFail;
|
|
8770 |
|
|
8771 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility completed with error %d"),iError );
|
|
8772 |
if (recUtil)
|
|
8773 |
{
|
|
8774 |
CleanupStack::PopAndDestroy(recUtil);
|
|
8775 |
recUtil = NULL;
|
|
8776 |
}
|
|
8777 |
|
|
8778 |
User::After(KOneSecond);
|
|
8779 |
return ret;
|
|
8780 |
}
|
|
8781 |
|
|
8782 |
|
|
8783 |
/**
|
|
8784 |
* REQ2870
|
|
8785 |
* Sierra: AudioRecorderUtility to get AudioBitrare
|
|
8786 |
* @class CTestMmfAclntRecSrcAuBitrate
|
|
8787 |
*/
|
|
8788 |
CTestMmfAclntRecSrcAuBitrate::CTestMmfAclntRecSrcAuBitrate(const TDesC& aTestName, const TDesC& aSectName,const TDesC& aKeyName1, const TDesC& aKeyName2)
|
|
8789 |
{
|
|
8790 |
// store the name of this test case
|
|
8791 |
// this is the name that is used by the script file
|
|
8792 |
// Each test step initialises it's own name
|
|
8793 |
iTestStepName = aTestName;
|
|
8794 |
iSectName = aSectName;
|
|
8795 |
iKeyFileName = aKeyName1;
|
|
8796 |
iKeyBitRateName = aKeyName2;
|
|
8797 |
}
|
|
8798 |
|
|
8799 |
CTestMmfAclntRecSrcAuBitrate* CTestMmfAclntRecSrcAuBitrate::NewL(const TDesC& aTestName,
|
|
8800 |
const TDesC& aSectName,
|
|
8801 |
const TDesC& aKeyName1,
|
|
8802 |
const TDesC& aKeyName2)
|
|
8803 |
{
|
|
8804 |
CTestMmfAclntRecSrcAuBitrate* self = new (ELeave) CTestMmfAclntRecSrcAuBitrate(aTestName,
|
|
8805 |
aSectName,
|
|
8806 |
aKeyName1,
|
|
8807 |
aKeyName2);
|
|
8808 |
return self;
|
|
8809 |
}
|
|
8810 |
|
|
8811 |
void CTestMmfAclntRecSrcAuBitrate::MoscoStateChangeEvent(CBase* aObject,
|
|
8812 |
TInt aPreviousState,
|
|
8813 |
TInt aCurrentState,
|
|
8814 |
TInt aErrorCode)
|
|
8815 |
{
|
|
8816 |
iError = aErrorCode;
|
|
8817 |
iObject = aObject;
|
|
8818 |
iPreviousState = aPreviousState;
|
|
8819 |
iCurrentState = aCurrentState;
|
|
8820 |
INFO_PRINTF1( _L("CTestMmfAclntRecSrcAuBitrate : MMdaObjectStateChangeObserver Callback for CMdaAudioRecorderUtility complete"));
|
|
8821 |
INFO_PRINTF4( _L("iError %d iPreviousState %d iCurrentState %d"), iError, iPreviousState, iCurrentState);
|
|
8822 |
CActiveScheduler::Stop();
|
|
8823 |
}
|
|
8824 |
|
|
8825 |
TVerdict CTestMmfAclntRecSrcAuBitrate::DoTestStepL()
|
|
8826 |
{
|
|
8827 |
INFO_PRINTF1( _L("TestRecorder : Audio Bit Rate"));
|
|
8828 |
TVerdict verdict = EPass;
|
|
8829 |
|
|
8830 |
TPtrC filename;
|
|
8831 |
TInt bitRate = 0;
|
|
8832 |
TInt err = 0;
|
|
8833 |
|
|
8834 |
if(!GetStringFromConfig(iSectName,iKeyFileName,filename))
|
|
8835 |
{
|
|
8836 |
INFO_PRINTF1(_L("Error getting filename from INI file"));
|
|
8837 |
return EInconclusive;
|
|
8838 |
}
|
|
8839 |
if(!GetIntFromConfig(iSectName, iKeyBitRateName, iExpectedBitRate))
|
|
8840 |
{
|
|
8841 |
INFO_PRINTF1(_L("Error getting bitrate from INI file"));
|
|
8842 |
return EInconclusive;
|
|
8843 |
}
|
|
8844 |
|
|
8845 |
|
|
8846 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
8847 |
if (recUtil == NULL ||
|
|
8848 |
iError != KErrNone)
|
|
8849 |
{
|
|
8850 |
INFO_PRINTF1(_L("Error to create a recUtil object"));
|
|
8851 |
return EFail;
|
|
8852 |
}
|
|
8853 |
CleanupStack::PushL(recUtil);
|
|
8854 |
|
|
8855 |
|
|
8856 |
INFO_PRINTF2(_L("Opening file = %S"), &filename);
|
|
8857 |
TRAP(err, recUtil->OpenFileL(filename));
|
|
8858 |
CActiveScheduler::Start();
|
|
8859 |
|
|
8860 |
if (err != KErrNone ||
|
|
8861 |
iError != KErrNone)
|
|
8862 |
{
|
|
8863 |
INFO_PRINTF2(_L("Opening file error: %d"), err);
|
|
8864 |
CleanupStack::PopAndDestroy(recUtil);
|
|
8865 |
verdict = EFail;
|
|
8866 |
}
|
|
8867 |
else
|
|
8868 |
{
|
|
8869 |
recUtil->PlayL();
|
|
8870 |
CActiveScheduler::Start(); // wait for open -> play
|
|
8871 |
if (iError != KErrNone)
|
|
8872 |
{
|
|
8873 |
INFO_PRINTF2(_L("Error to play the file: %d"), iError);
|
|
8874 |
verdict = EFail;
|
|
8875 |
}
|
|
8876 |
|
|
8877 |
TRAP(err, bitRate = recUtil->SourceBitRateL());
|
|
8878 |
if (err != KErrNone ||
|
|
8879 |
iError != KErrNone)
|
|
8880 |
{
|
|
8881 |
INFO_PRINTF2(_L("Error to query the bitrate: %d"), err);
|
|
8882 |
verdict = EFail;
|
|
8883 |
}
|
|
8884 |
|
|
8885 |
if (bitRate != iExpectedBitRate)
|
|
8886 |
{
|
|
8887 |
verdict = EFail;
|
|
8888 |
}
|
|
8889 |
INFO_PRINTF2(_L("Expected bit rate: %d"), iExpectedBitRate);
|
|
8890 |
INFO_PRINTF2(_L("Queried Bitrate: %d"), bitRate);
|
|
8891 |
recUtil->Close();
|
|
8892 |
CleanupStack::PopAndDestroy(recUtil);
|
|
8893 |
}
|
|
8894 |
|
|
8895 |
return verdict;
|
|
8896 |
}
|
|
8897 |
|
|
8898 |
|
|
8899 |
/**
|
|
8900 |
* REQ2870
|
|
8901 |
* Sierra: AudioRecorderUtility to get AudioBitrare from a recorded file
|
|
8902 |
* @class CTestMmfAclntRecBitrateRecordedFile
|
|
8903 |
*/
|
|
8904 |
CTestMmfAclntRecBitrateRecordedFile::CTestMmfAclntRecBitrateRecordedFile(const TDesC& aTestName,
|
|
8905 |
const TDesC& aSectName,
|
|
8906 |
const TDesC& aKeyName,
|
|
8907 |
const TTestFormat aFormat,
|
|
8908 |
const TBool aCreateFile)
|
|
8909 |
|
|
8910 |
{
|
|
8911 |
// store the name of this test case
|
|
8912 |
// this is the name that is used by the script file
|
|
8913 |
// Each test step initialises it's own name
|
|
8914 |
iTestStepName = aTestName;
|
|
8915 |
iHeapSize = 200000; // playback part of test loads whole sound file into buffer, so need large heap
|
|
8916 |
iSectName = aSectName;
|
|
8917 |
iKeyName = aKeyName;
|
|
8918 |
iTestFormat = aFormat;
|
|
8919 |
iCreateFile = aCreateFile;
|
|
8920 |
}
|
|
8921 |
|
|
8922 |
CTestMmfAclntRecBitrateRecordedFile* CTestMmfAclntRecBitrateRecordedFile::NewL(const TDesC& aTestName,
|
|
8923 |
const TDesC& aSectName,
|
|
8924 |
const TDesC& aKeyName,
|
|
8925 |
const TTestFormat aFormat,
|
|
8926 |
const TBool aCreateFile)
|
|
8927 |
{
|
|
8928 |
CTestMmfAclntRecBitrateRecordedFile* self = new (ELeave) CTestMmfAclntRecBitrateRecordedFile(aTestName,
|
|
8929 |
aSectName,
|
|
8930 |
aKeyName,
|
|
8931 |
aFormat,
|
|
8932 |
aCreateFile);
|
|
8933 |
return self;
|
|
8934 |
}
|
|
8935 |
|
|
8936 |
void CTestMmfAclntRecBitrateRecordedFile::MoscoStateChangeEvent(CBase* /*aObject*/, TInt /*aPreviousState*/, TInt /*aCurrentState*/, TInt aErrorCode)
|
|
8937 |
{
|
|
8938 |
iError = aErrorCode;
|
|
8939 |
INFO_PRINTF1( _L("CTestMmfAclntRecBitrateRecordedFile : MMdaObjectStateChangeObserver Callback for CMdaAudioRecorderUtility complete"));
|
|
8940 |
INFO_PRINTF2( _L("iError %d "), iError);
|
|
8941 |
|
|
8942 |
CActiveScheduler::Stop();
|
|
8943 |
}
|
|
8944 |
|
|
8945 |
|
|
8946 |
TVerdict CTestMmfAclntRecBitrateRecordedFile::DoTestStepPreambleL()
|
|
8947 |
{
|
|
8948 |
TVerdict ret = EPass;
|
|
8949 |
|
|
8950 |
//Setup codec and format to test (CTestMmfAclntCodecTest)
|
|
8951 |
SetupFormatL(iTestFormat);
|
|
8952 |
|
|
8953 |
if(iCreateFile)
|
|
8954 |
{
|
|
8955 |
// Make sure file doesn't exist (maybe from a previous test)
|
|
8956 |
TParse fullFileName;
|
|
8957 |
TBuf<KSizeBuf> filename;
|
|
8958 |
TPtrC filename1;
|
|
8959 |
|
|
8960 |
if(!GetStringFromConfig(iSectName, iKeyName, filename1))
|
|
8961 |
{
|
|
8962 |
return EInconclusive;
|
|
8963 |
}
|
|
8964 |
GetDriveName(filename);
|
|
8965 |
filename.Append(filename1);
|
|
8966 |
|
|
8967 |
// parse the filenames
|
|
8968 |
if(!fullFileName.Set(filename, &KDefault, NULL))
|
|
8969 |
{
|
|
8970 |
RFs fs;
|
|
8971 |
User::LeaveIfError(fs.Connect());
|
|
8972 |
fs.SetAtt(fullFileName.FullName(), 0, KEntryAttReadOnly);
|
|
8973 |
TInt error = fs.Delete(fullFileName.FullName());
|
|
8974 |
|
|
8975 |
if(error == KErrPathNotFound)
|
|
8976 |
{
|
|
8977 |
error = fs.MkDirAll(fullFileName.DriveAndPath());
|
|
8978 |
INFO_PRINTF2(_L("Path for file %S was been created"), &fullFileName.FullName());
|
|
8979 |
}
|
|
8980 |
else if(error == KErrNotFound)
|
|
8981 |
{
|
|
8982 |
INFO_PRINTF2(_L("No need to delete %S"), &fullFileName.FullName());
|
|
8983 |
}
|
|
8984 |
else if(error==KErrNone)
|
|
8985 |
{
|
|
8986 |
INFO_PRINTF2(_L("Deleted %S"), &fullFileName.FullName());
|
|
8987 |
}
|
|
8988 |
else
|
|
8989 |
{
|
|
8990 |
ret = EInconclusive;
|
|
8991 |
}
|
|
8992 |
fs.Close();
|
|
8993 |
}
|
|
8994 |
}
|
|
8995 |
|
|
8996 |
if(ret == EInconclusive)
|
|
8997 |
{
|
|
8998 |
return ret;
|
|
8999 |
}
|
|
9000 |
|
|
9001 |
return CTestMmfAclntStep::DoTestStepPreambleL();
|
|
9002 |
}
|
|
9003 |
|
|
9004 |
|
|
9005 |
TVerdict CTestMmfAclntRecBitrateRecordedFile::DoTestStepL()
|
|
9006 |
{
|
|
9007 |
INFO_PRINTF1( _L("TestRecorder : Query bitrate from a recorded file"));
|
|
9008 |
TVerdict verdict = EPass;
|
|
9009 |
iError = KErrTimedOut;
|
|
9010 |
|
|
9011 |
TPtrC filename;
|
|
9012 |
if(!GetStringFromConfig(iSectName, iKeyName, filename))
|
|
9013 |
{
|
|
9014 |
return EInconclusive;
|
|
9015 |
}
|
|
9016 |
|
|
9017 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
9018 |
CleanupStack::PushL(recUtil);
|
|
9019 |
|
|
9020 |
TMdaFileClipLocation location(filename);
|
|
9021 |
|
|
9022 |
recUtil->OpenL(&location,iFormat,iCodec,&iAudioSettings);
|
|
9023 |
CActiveScheduler::Start();
|
|
9024 |
INFO_PRINTF1( _L("Open a new file for recording"));
|
|
9025 |
|
|
9026 |
if (iError != KErrNone)
|
|
9027 |
{
|
|
9028 |
INFO_PRINTF2(_L("Error opening file for recording iError = %d"), iError);
|
|
9029 |
CleanupStack::PopAndDestroy(recUtil);
|
|
9030 |
return EFail;
|
|
9031 |
}
|
|
9032 |
|
|
9033 |
iError = KErrTimedOut;
|
|
9034 |
recUtil->RecordL();
|
|
9035 |
CActiveScheduler::Start(); // open -> record
|
|
9036 |
INFO_PRINTF1( _L("Recording"));
|
|
9037 |
User::After(KFiveSeconds);
|
|
9038 |
|
|
9039 |
if(iError != KErrNone)
|
|
9040 |
{
|
|
9041 |
INFO_PRINTF2( _L("Fail to do recording with error: %d"), iError);
|
|
9042 |
verdict = EFail;
|
|
9043 |
}
|
|
9044 |
|
|
9045 |
recUtil->Stop();
|
|
9046 |
User::After(KOneSecond);
|
|
9047 |
|
|
9048 |
|
|
9049 |
TRAPD(err, recUtil->OpenFileL(filename));
|
|
9050 |
CActiveScheduler::Start();
|
|
9051 |
INFO_PRINTF1( _L("Open the recorded file"));
|
|
9052 |
|
|
9053 |
if (err != KErrNone)
|
|
9054 |
{
|
|
9055 |
INFO_PRINTF2(_L("Error opening file for playback err = %d"), err);
|
|
9056 |
CleanupStack::PopAndDestroy(recUtil);
|
|
9057 |
return EFail;
|
|
9058 |
}
|
|
9059 |
|
|
9060 |
if (iError != KErrNone)
|
|
9061 |
{
|
|
9062 |
INFO_PRINTF2(_L("Error opening file for playback iError = %d"), iError);
|
|
9063 |
CleanupStack::PopAndDestroy(recUtil);
|
|
9064 |
return EFail;
|
|
9065 |
}
|
|
9066 |
|
|
9067 |
recUtil->PlayL();
|
|
9068 |
CActiveScheduler::Start();
|
|
9069 |
INFO_PRINTF1( _L("Play the recorded file"));
|
|
9070 |
|
|
9071 |
if (iError != KErrNone)
|
|
9072 |
{
|
|
9073 |
INFO_PRINTF2(_L("Error during playback of recorded file iError=%d"), iError);
|
|
9074 |
verdict = EFail;
|
|
9075 |
}
|
|
9076 |
User::After(KFiveSeconds);
|
|
9077 |
|
|
9078 |
TInt bitRate = 0;
|
|
9079 |
|
|
9080 |
TRAP(err, bitRate = recUtil->SourceBitRateL());
|
|
9081 |
INFO_PRINTF1( _L("Query bitrate from the recorded file"));
|
|
9082 |
|
|
9083 |
if (err != KErrNone ||
|
|
9084 |
iError != KErrNone)
|
|
9085 |
{
|
|
9086 |
INFO_PRINTF2(_L("Error to query the bitrate: %d"), err);
|
|
9087 |
verdict = EFail;
|
|
9088 |
}
|
|
9089 |
|
|
9090 |
INFO_PRINTF2(_L("Queried Bitrate: %d"), bitRate);
|
|
9091 |
|
|
9092 |
recUtil->Close();
|
|
9093 |
|
|
9094 |
CleanupStack::PopAndDestroy(recUtil);
|
|
9095 |
recUtil = NULL;
|
|
9096 |
|
|
9097 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility completed with error %d"),iError );
|
|
9098 |
User::After(KOneSecond);
|
|
9099 |
return verdict;
|
|
9100 |
}
|
|
9101 |
|
|
9102 |
//Record-Stop-Record test. Added for CR1566
|
|
9103 |
|
|
9104 |
CTestMmfAclntRecStopRec::CTestMmfAclntRecStopRec(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
9105 |
:CTestMmfAclntRecord(aTestName, aSectName, aNegative)
|
|
9106 |
{}
|
|
9107 |
|
|
9108 |
CTestMmfAclntRecStopRec* CTestMmfAclntRecStopRec::NewL(const TDesC& aTestName, const TDesC& aSectName, TBool aNegative)
|
|
9109 |
{
|
|
9110 |
CTestMmfAclntRecStopRec* self = new (ELeave) CTestMmfAclntRecStopRec(aTestName, aSectName, aNegative);
|
|
9111 |
return self;
|
|
9112 |
}
|
|
9113 |
|
|
9114 |
TVerdict CTestMmfAclntRecStopRec::DoTestStepL()
|
|
9115 |
{
|
|
9116 |
INFO_PRINTF1( _L("TestRecorder : Record-Stop-Record"));
|
|
9117 |
TVerdict ret = EFail;
|
|
9118 |
|
|
9119 |
iError = KErrTimedOut;
|
|
9120 |
|
|
9121 |
TPtrC filename;
|
|
9122 |
|
|
9123 |
|
|
9124 |
if(!GetStringFromConfig(iSectName, _L("outputAudioFile"), filename))
|
|
9125 |
{
|
|
9126 |
return EInconclusive;
|
|
9127 |
}
|
|
9128 |
|
|
9129 |
RFs fs;
|
|
9130 |
fs.Connect();
|
|
9131 |
fs.Delete(filename);
|
|
9132 |
fs.Close();
|
|
9133 |
|
|
9134 |
CMdaAudioRecorderUtility* recUtil = CMdaAudioRecorderUtility::NewL(*this);
|
|
9135 |
CleanupStack::PushL(recUtil);
|
|
9136 |
|
|
9137 |
// Add create file for Ogg-tests
|
|
9138 |
if(iSectName == _L("SectionOggRecState"))
|
|
9139 |
{
|
|
9140 |
RFs fs;
|
|
9141 |
User::LeaveIfError(fs.Connect());
|
|
9142 |
RFile file;
|
|
9143 |
User::LeaveIfError(file.Replace(fs,filename,EFileWrite));
|
|
9144 |
file.Close();
|
|
9145 |
fs.Close();
|
|
9146 |
}
|
|
9147 |
|
|
9148 |
INFO_PRINTF2(_L("CMdaAudioRecorderUtility->OpenFileL(%S)"), &filename);
|
|
9149 |
recUtil->OpenFileL(filename);
|
|
9150 |
// wait
|
|
9151 |
INFO_PRINTF1(_L("Initialise CMdaAudioRecorderUtility"));
|
|
9152 |
CActiveScheduler::Start();
|
|
9153 |
|
|
9154 |
if(iError == KErrNone)
|
|
9155 |
{
|
|
9156 |
ret = DoTestL(recUtil);
|
|
9157 |
}
|
|
9158 |
|
|
9159 |
|
|
9160 |
CleanupStack::PopAndDestroy(recUtil);
|
|
9161 |
User::After(KTwoSeconds);
|
|
9162 |
ERR_PRINTF2( _L("CMdaAudioRecorderUtility completed with error %d"),iError );
|
|
9163 |
return ret;
|
|
9164 |
}
|
|
9165 |
|
|
9166 |
/**
|
|
9167 |
* Enquire state at each state transition.
|
|
9168 |
*/
|
|
9169 |
TVerdict CTestMmfAclntRecStopRec::DoTestL(CMdaAudioRecorderUtility* aRecUtil)
|
|
9170 |
{
|
|
9171 |
INFO_PRINTF1( _L("TestRecorder : State Transition"));
|
|
9172 |
|
|
9173 |
TVerdict ret= EFail;
|
|
9174 |
|
|
9175 |
iReportedState = aRecUtil->State();
|
|
9176 |
if( iReportedState == CMdaAudioClipUtility::EOpen )
|
|
9177 |
{
|
|
9178 |
INFO_PRINTF1( _L("Record CMdaAudioRecorderUtility"));
|
|
9179 |
aRecUtil->RecordL();
|
|
9180 |
CActiveScheduler::Start(); // wait for open -> record
|
|
9181 |
if (iError != KErrNone)
|
|
9182 |
{
|
|
9183 |
return EFail;
|
|
9184 |
}
|
|
9185 |
|
|
9186 |
iReportedState = aRecUtil->State();
|
|
9187 |
if(iReportedState == CMdaAudioClipUtility::ERecording )
|
|
9188 |
{
|
|
9189 |
ret = EPass;
|
|
9190 |
}
|
|
9191 |
|
|
9192 |
User::After(KTwoSeconds);
|
|
9193 |
aRecUtil->Stop();
|
|
9194 |
|
|
9195 |
iReportedState = aRecUtil->State();
|
|
9196 |
if(iReportedState != CMdaAudioClipUtility::EOpen ) //Check that record returns to open
|
|
9197 |
{
|
|
9198 |
return EFail;
|
|
9199 |
}
|
|
9200 |
|
|
9201 |
aRecUtil->RecordL();
|
|
9202 |
CActiveScheduler::Start(); // wait for open -> record again
|
|
9203 |
if (iError != KErrNone)
|
|
9204 |
{
|
|
9205 |
return EFail;
|
|
9206 |
}
|
|
9207 |
|
|
9208 |
iReportedState = aRecUtil->State();
|
|
9209 |
if( iReportedState == CMdaAudioClipUtility::ERecording )
|
|
9210 |
{
|
|
9211 |
aRecUtil->Close();
|
|
9212 |
ret = EPass;
|
|
9213 |
}
|
|
9214 |
}
|
|
9215 |
return ret;
|
|
9216 |
}
|
|
9217 |
|