Problem with Audio Recording

Login to reply to this topic.
Fri, 2005-08-26 13:23
Joined: 2004-10-01
Forum posts: 35
Hi All,
I am trying to record the audio pcm data using following code, but After the preparation is complete the MoscoStateChangeEvent is getting called with an error code -5(KErrNotSupported). I am not getting why is this happening.

1.       _LIT(KFileName, "C:\\recorded.pcm");
      TPtrC temp(KFileName);
      RecordL(temp);

2.            void CExampleAppUi::RecordL(const TDesC &aFile)
   {
   RDebug::Printf("RecordL");
   __ASSERT_DEBUG(iState == CExampleAppUi::EIdle, Panic(CExampleAppUi::EInProgress));
   
   // Set up file to record to, the recording format, codec, and settings
   iAudioRecorderUtility = CMdaAudioRecorderUtility::NewL(*this);
   iAudioRecorderUtility -> OpenFileL(aFile);
   iState = ERecordPrepare;
   // This will call back MoscoStateChangeEvent() when preparation is complete
   }

3.            void CExampleAppUi::MoscoStateChangeEvent(CBase* aObject,
      TInt /*aPreviousState*/, TInt aCurrentState, TInt aErrorCode)
   {
      RDebug::Printf("MoscoStateChangeEvent");

   __ASSERT_ALWAYS(aObject == iAudioRecorderUtility , Panic(CExampleAppUi::EWrongState));
   if (aObject == iAudioRecorderUtility)
      {

      RDebug::Printf("aObject == iAudioRecorderUtility");

      __ASSERT_DEBUG(iState == CExampleAppUi::ERecordPrepare || iState == CExampleAppUi::ERecording,
         Panic(CExampleAppUi::EWrongState));

      RDebug::Printf("aErrorCode %d", aErrorCode);

      if (aErrorCode)
         RecordCleanup();
      else if (aCurrentState == CMdaAudioClipUtility::EOpen)
         Record2L();
      }
   // Handle converter event

   }
Before Runnign the code i am creating a file named recorded.pcm in the C: drive. Ideally after the successful preparation (happing in RecordL) MoscoStateChangeEvent should get called with 0 errorcode.

Please help me in this regard.
Thanks in Advance
Pinky

Tue, 2005-08-30 14:20
Joined: 2005-07-25
Forum posts: 31
Re: Problem with Audio Recording
Gives the impression that you are mistaken with the aPreviousState, aCurrentState,
are you sure what you are passing in your code ?

Regards
Ranjeet Gupta
  • Login to reply to this topic.