equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
200 // Pause recording |
200 // Pause recording |
201 // ----------------------------------------------------------------------------- |
201 // ----------------------------------------------------------------------------- |
202 // |
202 // |
203 void CCMRAudioInput::SourcePauseL() |
203 void CCMRAudioInput::SourcePauseL() |
204 { |
204 { |
205 PRINT((_L("CCMRAudioInput::SourcePauseL(), calling iDataSource->SourceStopL"))); |
205 PRINT((_L("CCMRAudioInput::SourcePauseL(), in"))); |
206 iState = EStateStopping; |
206 iState = EStateStopping; |
207 |
207 |
208 // store the latest timestamp - must do it already here, since sending event may reset it and we should not touch it after reset |
208 // store the latest timestamp - must do it already here, since sending event may reset it and we should not touch it after reset |
209 MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFDataSource); |
209 MMMFAudioInput* audioInput = static_cast<MMMFAudioInput*>(iMMFDataSource); |
210 CMMFDevSound* devSound = &audioInput->SoundDevice(); |
210 CMMFDevSound* devSound = &audioInput->SoundDevice(); |
274 else |
274 else |
275 { |
275 { |
276 iTimeStampWhenPaused = iTimeStampWhenPaused.Int64() + (initialDelay*1000); |
276 iTimeStampWhenPaused = iTimeStampWhenPaused.Int64() + (initialDelay*1000); |
277 } |
277 } |
278 } |
278 } |
279 |
279 |
|
280 // Ensure that after resume, if LatestTimeStampL() is called before UpdateTimeL() has been called it will |
|
281 // return a sensible value. |
|
282 iLatestTimeStamp = iTimeStampWhenPaused.Int64(); |
280 // Stop audio. |
283 // Stop audio. |
281 PRINT((_L("CCMRAudioInput::SourceStopL() DevSound SourceStopL()"))); |
284 PRINT((_L("CCMRAudioInput::SourcePauseL() DevSound SourceStopL()"))); |
282 devSound->Stop(); |
285 devSound->Stop(); |
283 |
286 |
284 if ( iOutputFilled->IsEmpty() ) |
287 if ( iOutputFilled->IsEmpty() ) |
285 { |
288 { |
286 PRINT((_L("CCMRAudioInput::SourcePauseL(), no data buffers queued so no chance to signal end of data; sending an event instead"))); |
289 PRINT((_L("CCMRAudioInput::SourcePauseL(), no data buffers queued so no chance to signal end of data; sending an event instead"))); |
881 TInt sampleRate = iCodecData->GetSampleRate(); |
884 TInt sampleRate = iCodecData->GetSampleRate(); |
882 |
885 |
883 if ( sampleRate ) |
886 if ( sampleRate ) |
884 { |
887 { |
885 TInt64 samples = devSound->SamplesRecorded(); |
888 TInt64 samples = devSound->SamplesRecorded(); |
886 PRINT((_L("CCMRAudioInput::UpdateTimeL() samples recorded %d"),I64INT(samples))); |
889 PRINT((_L("CCMRAudioInput::UpdateTimeL() samples recorded %Ld"), samples)); |
887 |
890 |
888 samples = samples * 1000000; |
891 samples = samples * 1000000; |
889 samples = samples / sampleRate; |
892 samples = samples / sampleRate; |
890 iLatestTimeStamp = samples + iTimeStampWhenPaused.Int64(); |
893 iLatestTimeStamp = samples + iTimeStampWhenPaused.Int64(); |
891 } |
894 } |