|
1 /* |
|
2 * Copyright (c) 2002 - 2006 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: |
|
15 * This class represents a voice memo. It is able to create new files, |
|
16 * rename and delete existing files, and to save them to permanent storage. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 #include <eikapp.h> |
|
24 #include <eikappui.h> |
|
25 #include <eikenv.h> |
|
26 #include <AknWaitDialog.h> |
|
27 #include <AknQueryDialog.h> |
|
28 #include <StringLoader.h> |
|
29 #include <bautils.h> |
|
30 #include <AknGlobalNote.h> |
|
31 #include <sysutil.h> |
|
32 #include <pathinfo.h> |
|
33 #include <systemwarninglevels.hrh> |
|
34 #include <AknNotifyStd.h> |
|
35 #include <coeutils.h> |
|
36 |
|
37 #include <voicerecorder.rsg> |
|
38 #include <VoiceRecorderUID.h> |
|
39 #include "CVRMemo.h" |
|
40 #include "VRConsts.h" |
|
41 #include "TVRRename.h" |
|
42 #include "VRUtils.h" |
|
43 |
|
44 // CONSTANTS |
|
45 // Max length is 300 millisecs over one minute so possible cropping |
|
46 // of the file after stop doesn't drop the length under one minute |
|
47 const TInt KVRMMSMemoMaxRecordLength( 60300000 ); |
|
48 const TInt KVREstimateDelayDuration( 10000000 ); |
|
49 |
|
50 |
|
51 // ================= MEMBER FUNCTIONS ======================================== |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // CVRMemo::CVRMemo |
|
55 // |
|
56 // --------------------------------------------------------------------------- |
|
57 // |
|
58 CVRMemo::CVRMemo() |
|
59 : iDuration( 0 ), iPosition( 0 ), iMaxDuration( KVRDefaultMaxLength ), |
|
60 iQuality( EQualityMMSOptimized ),iIsRecorded( EFalse ) |
|
61 { |
|
62 #ifndef RD_MULTIPLE_DRIVE |
|
63 iStoragePlace = EMemoStorePhoneMemory; |
|
64 #else |
|
65 TRAP_IGNORE(iStorageDrive = VRUtils::DefaultMemoDriveL()); |
|
66 #endif |
|
67 } |
|
68 |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // CVRMemo::~CVRMemo |
|
72 // |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 CVRMemo::~CVRMemo() |
|
76 { |
|
77 DeleteEmptyFile(); |
|
78 |
|
79 // Close the file handle and file server session |
|
80 iFile.Close(); |
|
81 iFs.Close(); |
|
82 |
|
83 delete iFileMan; |
|
84 } |
|
85 |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // CVRMemo::ConstructL |
|
89 // |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 void CVRMemo::ConstructL(TInt aDefaultAudioFormat) |
|
93 { |
|
94 User::LeaveIfError( iFs.Connect() ); |
|
95 iFs.ShareProtected(); |
|
96 |
|
97 iFileMan = CFileMan::NewL( iFs ); |
|
98 |
|
99 iVRAudioFormat = aDefaultAudioFormat; |
|
100 |
|
101 iQuality = VRUtils::QualityL(); |
|
102 if ( !VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) |
|
103 || iEmbedded ) |
|
104 { |
|
105 iMaxDuration = KVRMMSMemoMaxRecordLength; |
|
106 iQuality = EQualityMMSOptimized; |
|
107 } |
|
108 else |
|
109 { |
|
110 TInt64 max( VRUtils::MaxLengthL() ); |
|
111 max = max * KVRMinuteAsMicroSeconds; |
|
112 iMaxDuration = max; |
|
113 } |
|
114 |
|
115 // Current storage place |
|
116 #ifndef RD_MULTIPLE_DRIVE |
|
117 iStoragePlace = VRUtils::MemoStoreL(); |
|
118 #else |
|
119 iStorageDrive = VRUtils::MemoDriveL(); |
|
120 #endif |
|
121 |
|
122 } |
|
123 |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // CVRMemo::SetName |
|
127 // |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 void CVRMemo::SetName( const TDesC& aFilename ) |
|
131 { |
|
132 iFilename.Copy( aFilename ); |
|
133 TParsePtrC parse( iFilename ); |
|
134 iNamePtr.Set( parse.Name().Left( VRMEMONAMEMAXLENGTH ) ); |
|
135 } |
|
136 |
|
137 |
|
138 // --------------------------------------------------------------------------- |
|
139 // CVRMemo::SetTemporaryNameL |
|
140 // |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 void CVRMemo::SetTemporaryNameL( TBool aEmbedded ) |
|
144 { |
|
145 iEmbedded = aEmbedded; |
|
146 |
|
147 // We can use the same handle, no need to create new name |
|
148 // Empty the file so it can be overwritten with new memo |
|
149 if ( iEmbedded && !iExternalFileHandle ) |
|
150 { |
|
151 if ( iFile.SubSessionHandle() ) |
|
152 { |
|
153 iFile.SetSize( 0 ); |
|
154 return; |
|
155 } |
|
156 } |
|
157 |
|
158 // Checks if the file handle can be found i.e if file is created |
|
159 if ( iFile.SubSessionHandle() ) |
|
160 { |
|
161 // Retrieving new settings |
|
162 TVRQuality newQuality( VRUtils::QualityL() ); |
|
163 |
|
164 #ifndef RD_MULTIPLE_DRIVE |
|
165 TVRMemoStore newStoragePlace ( VRUtils::MemoStoreL() ); |
|
166 |
|
167 // If the current file is empty, we can reuse it if quality or |
|
168 // the storage place hasn't changed |
|
169 if ( iQuality == newQuality && iStoragePlace == newStoragePlace ) |
|
170 { |
|
171 TInt size( 0 ); |
|
172 iFile.Size( size ); |
|
173 |
|
174 // If current file has already been recorded to, a new file has |
|
175 // to be generated |
|
176 if ( !IsRecorded() ) |
|
177 { |
|
178 iFile.SetSize( 0 ); |
|
179 return; |
|
180 } |
|
181 } |
|
182 // The file has been created but the settings have been changed |
|
183 // before using the file -> delete file and create a new one |
|
184 else |
|
185 { |
|
186 DeleteEmptyFile(); |
|
187 } |
|
188 |
|
189 #else |
|
190 // for Multiple drives |
|
191 TInt newStorageDrive ( VRUtils::MemoDriveL() ); |
|
192 |
|
193 // If the current file is empty, we can reuse it if quality or |
|
194 // the storage place hasn't changed |
|
195 if ( iQuality == newQuality && iStorageDrive == newStorageDrive ) |
|
196 { |
|
197 TInt size( 0 ); |
|
198 iFile.Size( size ); |
|
199 |
|
200 // If current file has already been recorded to, a new file has |
|
201 // to be generated |
|
202 if ( !IsRecorded() ) |
|
203 { |
|
204 iFile.SetSize( 0 ); |
|
205 return; |
|
206 } |
|
207 } |
|
208 // The file has been created but the settings have been changed |
|
209 // before using the file -> delete file and create a new one |
|
210 else |
|
211 { |
|
212 DeleteEmptyFile(); |
|
213 } |
|
214 |
|
215 |
|
216 #endif |
|
217 } |
|
218 |
|
219 TFileName memoName; |
|
220 // Retrieve storage path |
|
221 if ( iSavingLocation.Length() > 0 ) |
|
222 { |
|
223 memoName = iSavingLocation; |
|
224 } |
|
225 else |
|
226 { |
|
227 VRUtils::MemoStoreDirectoryL( memoName ); |
|
228 } |
|
229 |
|
230 // Recheck the quality before naming memo |
|
231 if ( !VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) |
|
232 || iEmbedded ) |
|
233 { |
|
234 iQuality = EQualityMMSOptimized; |
|
235 } |
|
236 else |
|
237 { |
|
238 iQuality = VRUtils::QualityL(); |
|
239 } |
|
240 |
|
241 // Current storage place |
|
242 #ifndef RD_MULTIPLE_DRIVE |
|
243 iStoragePlace = VRUtils::MemoStoreL(); |
|
244 #else |
|
245 iStorageDrive = VRUtils::MemoDriveL(); |
|
246 #endif |
|
247 |
|
248 // Choose the file type |
|
249 // Use amr if quality is MMS Optimized or we are recording |
|
250 // in embedded mode, wav otherwise |
|
251 TVRFiletype type( EVRFileAmr ); |
|
252 if( iEmbedded || iQuality == EQualityMMSOptimized ) |
|
253 { |
|
254 type = EVRFileAmr; |
|
255 } |
|
256 |
|
257 // **** updated for new CR, if it QualitySetting is Normal, save as WAV |
|
258 |
|
259 #ifdef __AAC_ENCODER_PLUGIN |
|
260 else if (iQuality == EQualityNormal) |
|
261 { |
|
262 type = EVRFileWav; |
|
263 } |
|
264 |
|
265 // **** the following are updated for new CR, if it QualitySetting is High, save as mp4 |
|
266 else if (iQuality == EQualityHigh) |
|
267 { |
|
268 type = EVRFileAAC_LC; |
|
269 } |
|
270 #else |
|
271 |
|
272 else |
|
273 { |
|
274 type = EVRFileWav; |
|
275 } |
|
276 |
|
277 #endif |
|
278 |
|
279 TFileName memoNameTemp; |
|
280 memoNameTemp = memoName; |
|
281 memoNameTemp.Delete(memoName.Length()-1, 1); |
|
282 |
|
283 TBool boolTemp = EFalse; |
|
284 |
|
285 TInt intTemp = BaflUtils::IsFolder( iFs, memoNameTemp, boolTemp ); |
|
286 |
|
287 if( ! boolTemp ) |
|
288 { |
|
289 if( BaflUtils::FileExists( iFs, memoNameTemp ) ) |
|
290 { |
|
291 if( intTemp != KErrNone ) |
|
292 { |
|
293 User::LeaveIfError(intTemp); |
|
294 } |
|
295 else |
|
296 { |
|
297 User::LeaveIfError(iFs.Delete( memoNameTemp )); |
|
298 } |
|
299 } |
|
300 } |
|
301 |
|
302 // Generate unique final file name |
|
303 VRUtils::GenerateUniqueFilenameL( iFs, memoName, type ); |
|
304 |
|
305 // Make sure that file handles are not leaked |
|
306 if ( iFile.SubSessionHandle() ) |
|
307 { |
|
308 iFile.Close(); |
|
309 } |
|
310 |
|
311 // Ensure that path exists |
|
312 BaflUtils::EnsurePathExistsL( iFs, memoName ); |
|
313 |
|
314 // Open the memo file |
|
315 |
|
316 #ifdef __AAC_ENCODER_PLUGIN |
|
317 if((iQuality == EQualityHigh)) //for mp4 format , 3gplib does not support EFileShareExclusive so EFileShareAny is used here |
|
318 { |
|
319 User::LeaveIfError( iFile.Create( iFs, memoName, EFileWrite|EFileShareAny) ); |
|
320 } |
|
321 else // for other formats |
|
322 { |
|
323 User::LeaveIfError( iFile.Create( iFs, memoName, EFileShareExclusive|EFileWrite ) ); |
|
324 |
|
325 } |
|
326 #else // it is not mp4, so still use the old flag |
|
327 User::LeaveIfError( iFile.Create( iFs, memoName, EFileShareExclusive|EFileWrite ) ); |
|
328 |
|
329 #endif |
|
330 |
|
331 TInt error = iFile.SetAtt(KEntryAttHidden, KEntryAttNormal ); |
|
332 SetName( memoName ); |
|
333 } |
|
334 |
|
335 |
|
336 // --------------------------------------------------------------------------- |
|
337 // CVRMemo::QueryAndDeleteL |
|
338 // |
|
339 // --------------------------------------------------------------------------- |
|
340 // |
|
341 TBool CVRMemo::QueryAndDeleteL() |
|
342 { |
|
343 //Delete?\n%U" �qtn.query.common.conf.delete� |
|
344 TParsePtrC parse( iFilename ); |
|
345 HBufC* text = StringLoader::LoadLC( R_QTN_QUERY_COMMON_CONF_DELETE, |
|
346 parse.Name() ); |
|
347 |
|
348 // Show confirm note |
|
349 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
350 TInt result( dlg->ExecuteLD( R_VR_CONFIRMATION_QUERY, *text ) ); |
|
351 CleanupStack::PopAndDestroy( text ); |
|
352 |
|
353 if ( result ) |
|
354 { |
|
355 DeleteL(); |
|
356 return ETrue; |
|
357 } |
|
358 |
|
359 return EFalse; |
|
360 } |
|
361 |
|
362 |
|
363 // --------------------------------------------------------------------------- |
|
364 // CVRMemo::DeleteL |
|
365 // |
|
366 // --------------------------------------------------------------------------- |
|
367 // |
|
368 void CVRMemo::DeleteL() |
|
369 { |
|
370 if ( iFile.SubSessionHandle() ) |
|
371 { |
|
372 if ( iExternalFileHandle ) |
|
373 { |
|
374 // We shouldn't delete the file handle, so let's |
|
375 // just empty the file |
|
376 iFile.SetSize( 0 ); |
|
377 } |
|
378 else |
|
379 { |
|
380 TFileName fileName( KNullDesC ); |
|
381 iFile.FullName( fileName ); |
|
382 iFile.Close(); |
|
383 |
|
384 TInt err( iFileMan->Delete( fileName ) ); |
|
385 if ( err != KErrNone && err != KErrNotFound ) |
|
386 { |
|
387 // Try to open the file again so we wont end up |
|
388 // in goofy state without open file |
|
389 User::LeaveIfError( iFile.Open( iFs, fileName, |
|
390 EFileShareReadersOnly ) ); |
|
391 User::LeaveIfError( err ); |
|
392 } |
|
393 } |
|
394 } |
|
395 SetName( KNullDesC ); |
|
396 } |
|
397 |
|
398 |
|
399 // --------------------------------------------------------------------------- |
|
400 // CVRMemo::QueryAndRenameL |
|
401 // |
|
402 // --------------------------------------------------------------------------- |
|
403 // |
|
404 TBool CVRMemo::QueryAndRenameL() |
|
405 { |
|
406 TVRRename renamer( iFs ); |
|
407 if ( renamer.RenameL( iFile, R_QTN_FLDR_ITEM_NAME_PRMPT ) ) |
|
408 { |
|
409 TFileName name( KNullDesC ); |
|
410 iFile.FullName( name ); |
|
411 SetName( name ); |
|
412 |
|
413 return ETrue; |
|
414 } |
|
415 return EFalse; |
|
416 } |
|
417 |
|
418 |
|
419 // --------------------------------------------------------------------------- |
|
420 // CVRMemo::SavePermanentlyL |
|
421 // |
|
422 // --------------------------------------------------------------------------- |
|
423 // |
|
424 void CVRMemo::SavePermanentlyL( CAknGlobalNote* /*aWaitNote*/, |
|
425 TInt& /*aNoteId*/, |
|
426 const TDesC& /*aLabel*/, |
|
427 TBool /*aProduceCopy*/ ) |
|
428 |
|
429 { |
|
430 // Don't do anything if recording to external file handle |
|
431 if ( iExternalFileHandle ) |
|
432 { |
|
433 return; |
|
434 } |
|
435 |
|
436 // Change file open mode to read |
|
437 TFileName name( KNullDesC ); |
|
438 iFile.FullName( name ); |
|
439 iFile.Close(); |
|
440 User::LeaveIfError( iFile.Open( iFs, |
|
441 name, |
|
442 EFileRead|EFileShareReadersOnly) ); |
|
443 } |
|
444 |
|
445 |
|
446 // --------------------------------------------------------------------------- |
|
447 // CVRMemo::IsValid |
|
448 // |
|
449 // --------------------------------------------------------------------------- |
|
450 // |
|
451 TBool CVRMemo::IsValid() const |
|
452 { |
|
453 return iFile.SubSessionHandle() == 0 ? EFalse : ETrue; |
|
454 } |
|
455 |
|
456 |
|
457 // --------------------------------------------------------------------------- |
|
458 // CVRMemo::UpdateModifiedDate |
|
459 // |
|
460 // --------------------------------------------------------------------------- |
|
461 // |
|
462 void CVRMemo::UpdateModifiedDate() |
|
463 { |
|
464 if ( IsValid() ) |
|
465 { |
|
466 TLocale locale; |
|
467 iFile.Modified( iDateCreated ); |
|
468 iDateCreated += locale.UniversalTimeOffset(); |
|
469 } |
|
470 } |
|
471 |
|
472 |
|
473 // --------------------------------------------------------------------------- |
|
474 // CVRMemo::SetSavingLocationL |
|
475 // |
|
476 // --------------------------------------------------------------------------- |
|
477 // |
|
478 void CVRMemo::SetSavingLocationL( const TDesC& aPath ) |
|
479 { |
|
480 iSavingLocation = aPath; |
|
481 } |
|
482 |
|
483 |
|
484 // --------------------------------------------------------------------------- |
|
485 // CVRMemo::DeleteEmptyFile |
|
486 // Deletes an empty file that hasn't been recorded into. After deleting |
|
487 // also decreases central repository's memo count value |
|
488 // --------------------------------------------------------------------------- |
|
489 // |
|
490 TBool CVRMemo::DeleteEmptyFile() |
|
491 { |
|
492 if ( iFile.SubSessionHandle() != 0 ) |
|
493 { |
|
494 TInt size( 0 ); |
|
495 |
|
496 // Error code ignored |
|
497 iFile.Size( size ); |
|
498 |
|
499 if ( !iIsRecorded ) |
|
500 { |
|
501 TFileName name( KNullDesC ); |
|
502 iFile.FullName( name ); |
|
503 |
|
504 iFile.Close(); |
|
505 iFileMan->Delete( name ); |
|
506 |
|
507 // Central repository value has to be decreased by one because it |
|
508 // was increased earlier, when current filename was generated |
|
509 VRUtils::SetMemoCount( VRUtils::MemoCount() - 1 ); |
|
510 |
|
511 return ETrue; |
|
512 } |
|
513 } |
|
514 return EFalse; |
|
515 } |
|
516 |
|
517 |
|
518 // --------------------------------------------------------------------------- |
|
519 // CVRMemo::SetFileHandle |
|
520 // |
|
521 // --------------------------------------------------------------------------- |
|
522 // |
|
523 void CVRMemo::SetFileHandle( RFile& aFile, const TBool aEmbedded ) |
|
524 { |
|
525 iEmbedded = aEmbedded; |
|
526 iExternalFileHandle = ETrue; |
|
527 |
|
528 iFile = aFile; |
|
529 |
|
530 // Set the correct name for UI |
|
531 TFileName name( KNullDesC ); |
|
532 iFile.FullName( name ); |
|
533 SetName( name ); |
|
534 } |
|
535 |
|
536 |
|
537 // --------------------------------------------------------------------------- |
|
538 // CVRMemo::MaxDuration |
|
539 // Returns in microseconds the maximum time that can be still recorded with |
|
540 // current settings (codecs and mem storage place) |
|
541 // --------------------------------------------------------------------------- |
|
542 // |
|
543 const TTimeIntervalMicroSeconds& CVRMemo::MaxDuration() |
|
544 { |
|
545 if ( iEmbedded || |
|
546 !VRUtils::FeatureEnabled( EVRFeatureShowQualitySetting ) || |
|
547 iQuality == EQualityMMSOptimized ) |
|
548 { |
|
549 //Voice Recorder change to remove 1 Min. limit for AMR for Stand alone recording |
|
550 //if embedded allow 1 min recording for EQualityMMSOptimized(AMR) |
|
551 //else allow 1 hour recording |
|
552 if(iEmbedded) |
|
553 { |
|
554 iMaxDuration = KVRMMSMemoMaxRecordLength; |
|
555 return iMaxDuration; |
|
556 } |
|
557 } |
|
558 |
|
559 // Make the first estimate after KVRFirstEstimateTime seconds recording |
|
560 if ( Duration() < KVRFirstEstimateTime ) |
|
561 { |
|
562 // Fetch the setting for high quality max length |
|
563 TInt64 max( 0 ); |
|
564 TRAPD( err, max = VRUtils::MaxLengthL() ); |
|
565 if ( err != KErrNone ) |
|
566 { |
|
567 max = KVRMMSMemoMaxRecordLength; |
|
568 } |
|
569 |
|
570 max = max * KVRMinuteAsMicroSeconds; |
|
571 iMaxDuration = max; |
|
572 |
|
573 // Reset the time of last estimate |
|
574 TDateTime date; |
|
575 date.SetYear( -1 ); |
|
576 iLastEstimate = date; // invalid |
|
577 |
|
578 return iMaxDuration; |
|
579 } |
|
580 |
|
581 // Make new estimate if there's no last estimate or if 10 secs have passed |
|
582 // from the previous estimate |
|
583 TTime currentTime; |
|
584 currentTime.HomeTime(); |
|
585 if ( iLastEstimate.DateTime().Year() == -1 || |
|
586 currentTime.MicroSecondsFrom( iLastEstimate ) >= |
|
587 TTimeIntervalMicroSeconds( KVREstimateDelayDuration ) ) |
|
588 { |
|
589 iLastEstimate = currentTime; |
|
590 |
|
591 TEntry fileEntry; |
|
592 TFileName name( KNullDesC ); |
|
593 iFile.FullName( name ); |
|
594 |
|
595 TInt err = iFs.Entry( name, fileEntry ); |
|
596 if( err != KErrNone ) |
|
597 { |
|
598 return iMaxDuration; |
|
599 } |
|
600 |
|
601 // Retrieve free space |
|
602 TVolumeInfo volInfo; |
|
603 |
|
604 // old storage |
|
605 #ifndef RD_MULTIPLE_DRIVE |
|
606 TVRMemoStore memoStore( EMemoStorePhoneMemory ); |
|
607 TRAP( err, memoStore = VRUtils::MemoStoreL() ); |
|
608 if ( err != KErrNone ) |
|
609 { |
|
610 memoStore = EMemoStorePhoneMemory; |
|
611 } |
|
612 |
|
613 if ( memoStore == EMemoStorePhoneMemory ) |
|
614 { |
|
615 err = iFs.Volume( volInfo, EDriveC ); |
|
616 } |
|
617 else // memostore is MMC |
|
618 { |
|
619 err = iFs.Volume( volInfo, EDriveE ); |
|
620 } |
|
621 |
|
622 // multiple drive |
|
623 #else |
|
624 |
|
625 TInt drive = 0; |
|
626 TRAP_IGNORE(drive = VRUtils::DefaultMemoDriveL()); |
|
627 TRAP( err, drive = VRUtils::MemoDriveL() ); |
|
628 if ( err != KErrNone ) |
|
629 { |
|
630 TRAP_IGNORE(drive = VRUtils::DefaultMemoDriveL()); |
|
631 } |
|
632 err = iFs.Volume( volInfo, drive ); |
|
633 |
|
634 #endif |
|
635 |
|
636 if( err != KErrNone ) |
|
637 { |
|
638 |
|
639 return iMaxDuration; |
|
640 } |
|
641 |
|
642 // Calculate the current disk consumption "speed" of the memo |
|
643 TReal speed( fileEntry.iSize / ( Duration().Int64() / |
|
644 KVRSecondAsMicroSeconds ) ); |
|
645 |
|
646 // The total free memory |
|
647 TInt64 freeSpace(volInfo.iFree); |
|
648 // Free memory if Critical Memory isn't taken into account |
|
649 TInt64 freeSpaceMinusCrlevel( freeSpace - KDRIVECCRITICALTHRESHOLD); |
|
650 |
|
651 // Estimate the time left |
|
652 TInt64 value( freeSpaceMinusCrlevel / speed ); |
|
653 TTimeIntervalMicroSeconds estimate( value * KVRSecondAsMicroSeconds ); |
|
654 |
|
655 // Estimate should include also the length of clip |
|
656 estimate = TTimeIntervalMicroSeconds( estimate.Int64() |
|
657 + Duration().Int64() ); |
|
658 if ( estimate < iMaxDuration) |
|
659 { |
|
660 iMaxDuration = estimate; |
|
661 } |
|
662 } |
|
663 |
|
664 return iMaxDuration; |
|
665 } |
|
666 |
|
667 |
|
668 // --------------------------------------------------------------------------- |
|
669 // CVRMemo::IsRecorded |
|
670 // Returns the attribute iIsRecorded value that indicates if the recording of |
|
671 // the clip currently open is started or not |
|
672 // --------------------------------------------------------------------------- |
|
673 // |
|
674 TBool CVRMemo::IsRecorded() const |
|
675 { |
|
676 return iIsRecorded; |
|
677 } |
|
678 |
|
679 |
|
680 // --------------------------------------------------------------------------- |
|
681 // CVRMemo::SetRecorded |
|
682 // Sets the value of iIsRecorded attribute |
|
683 // --------------------------------------------------------------------------- |
|
684 // |
|
685 void CVRMemo::SetRecorded( TBool aRecorded ) |
|
686 { |
|
687 iIsRecorded = aRecorded; |
|
688 } |
|
689 |
|
690 // End of file |