|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: AudioRecorder Test |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "RecordTimeAvailable.h" |
|
19 |
|
20 ////////////////////////////////////////////////////////////////////// |
|
21 // Construction/Destruction |
|
22 ////////////////////////////////////////////////////////////////////// |
|
23 |
|
24 CRecordTimeAvailable::CRecordTimeAvailable(CTestModuleIf *aConsole, CStifLogger *aLogger):CRecordingBase(aConsole,aLogger) |
|
25 { |
|
26 errorRange = TInt64(KDefaultErrorRange); |
|
27 timeAvailable = 0; |
|
28 } |
|
29 |
|
30 CRecordTimeAvailable::~CRecordTimeAvailable() |
|
31 { |
|
32 |
|
33 } |
|
34 |
|
35 CRecordingBase* CRecordTimeAvailable::CreateObjectL(CTestModuleIf *aConsole, CStifLogger *aLogger) |
|
36 { |
|
37 //aLogger->Log(_L("CRecordTimeAvailable::CreateObjectL")); |
|
38 return (new (ELeave) CRecordTimeAvailable(aConsole, aLogger)); |
|
39 } |
|
40 |
|
41 TInt CRecordTimeAvailable::RunTestL(CTestModuleIf *aConsole, CStifLogger *aLogger, CStifSectionParser *aParser, TInt* clipCounter) |
|
42 { |
|
43 return CRecordingBase::RunTestL(aConsole,aLogger,aParser,clipCounter,CRecordTimeAvailable::CreateObjectL); |
|
44 } |
|
45 |
|
46 TInt CRecordTimeAvailable::PreProcess(CStifSectionParser *aParser) |
|
47 { |
|
48 if (recorder) |
|
49 { |
|
50 // recorder->SetAudioDeviceMode(CMdaAudioRecorderUtility::ELocal); |
|
51 // recorder->SetGain(recorder->MaxGain()); |
|
52 // recorder->SetPosition(TTimeIntervalMicroSeconds(TInt64(0))); |
|
53 // Crop delete the whole file. This made the new content is not attached in the end. |
|
54 // It over write the previous file. |
|
55 // TRAPD(err,recorder->CropL()); |
|
56 // if (err != KErrNone) logger->Log(_L("Error cropping file: %d"),err); |
|
57 |
|
58 //Get error range |
|
59 CStifItemParser* item = aParser->GetItemLineL(KErrorRange, ENoTag); |
|
60 CleanupStack::PushL(item); |
|
61 errorRange = CRecordingBase::ParseTime(item); |
|
62 CleanupStack::PopAndDestroy(); |
|
63 LogTime(_L("Error range:"),errorRange); |
|
64 |
|
65 // timeAvailable = recorder->RecordTimeAvailable(); |
|
66 // LogTime(_L("Record time available:"),timeAvailable); |
|
67 } |
|
68 return KErrNone; |
|
69 } |
|
70 |
|
71 TInt CRecordTimeAvailable::PostProcess(CStifSectionParser* /*aParser*/) |
|
72 { |
|
73 TTimeIntervalMicroSeconds newTimeAvailable = recorder->RecordTimeAvailable(); |
|
74 LogTime(_L("Clip duration:"),fileDuration); |
|
75 LogTime(_L("New record time available:"),newTimeAvailable); |
|
76 |
|
77 TInt64 val = newTimeAvailable.Int64(); |
|
78 |
|
79 if ((val = Abs(timeAvailable.Int64() - newTimeAvailable.Int64() - fileDuration.Int64())) > errorRange.Int64()) |
|
80 { |
|
81 LogTime(_L("Time available difference is out of specified range:"),val); |
|
82 return KErrOutOfRange; |
|
83 } |
|
84 |
|
85 return KErrNone; |
|
86 } |