Read-only archive of the All About Symbian forum (2001–2013) · About this archive

plz help..voice recording problem.

2 replies · 3,063 views · Started 08 December 2004

Hi All,
I have created one application to record the voice into one wave file.
Below is the code which is creating the problem.

void CMediaClientEngine::RecordL(const TDesC &aFile)
{
__ASSERT_DEBUG(iState == CMediaClientEngine::EIdle, Panic(CMediaClientEngine::EInProgress));

// Set up file to record to, the recording format, codec, and settings
iLocation.iName = aFile;
iCodec.iBits = TMdaPcmWavCodec::E8BitPcm;
iSettings.iSampleRate=TMdaAudioDataSettings::ESampleRate8000Hz;
iSettings.iChannels=TMdaAudioDataSettings::EChannelsMono;

iAudioRecorderUtility = CMdaAudioRecorderUtility::NewL(*this);
iAudioRecorderUtility -> OpenL(&iLocation, &iFormat, &iCodec, &iSettings);
iState = ERecordPrepare;
iEngineObserver -> HandleEngineState(iState,KErrNone);
// This will call back MoscoStateChangeEvent() when preparation is complete
}

// Audio is now prepared to record a file
// from MMdaObjectStateChangeObserver
void CMediaClientEngine::MoscoStateChangeEvent(CBase* aObject,
TInt /*aPreviousState*/, TInt aCurrentState, TInt aErrorCode)
{
__ASSERT_ALWAYS(aObject == iAudioRecorderUtility, Panic(CMediaClientEngine::EWrongState));
__ASSERT_DEBUG(iState == CMediaClientEngine::ERecordPrepare || iState == CMediaClientEngine::ERecording,
Panic(CMediaClientEngine::EWrongState));

if (aErrorCode)
RecordCleanup();
else if (aCurrentState == CMdaAudioClipUtility::EOpen)
{
// Set the gain
iAudioRecorderUtility -> SetGain(iAudioRecorderUtility -> MaxGain()/iGain);
// And mode
iAudioRecorderUtility -> SetAudioDeviceMode(CMdaAudioRecorderUtility::ELocal);
// and start recording
iAudioRecorderUtility -> RecordL();
iState = ERecording;
}
iEngineObserver -> HandleEngineState(iState,aErrorCode);
}

The problem is that the function �MoscoStateChangeEvent� is getting called with some error code due to which it cleans up the recorder by calling �RecordCleanup� function. Also, this function �MoscoStateChangeEvent� is getting called with �aCurrentState� equal to �ENotReady�. For this application to record �aCurrentState� should be �EOpen�.

The function �MoscoStateChangeEvent� is called by Media Server and it calls this function with �ENotReady� as current state when the media server is not able to open the file to record to. The file is getting created at the specified location so i am not getting that why it is not able to open that file for recording.

Can anyone throw some light on this?

Thanks in advance.
Pinky

This is with reference to your posting in Allabout symbiam.com

In that you have mentioned that the recorder call that MaosStatechange function but leaves with error code
Even I am facing the same problem

Could you find the solution to it if yes it wud be great if you will guide me how did you rectified that

please send your response at

[email][email protected][/email]