×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Mar 2004
    Posts
    154

    Recording Audio in file using CMdaAudioRecordUtility in S60 V3

    Hi

    Has anybody got success in recording audio file on S60 V3 ? I am using Nokia
    3250.

    I am trying to record audio in a file using CMdaAudioRecordUtility::RecordL
    function, but it does not record. This is how i use the APIs


    void CHelloWorldBasicAppUi::ConstructL()
    {
    // Initialise app UI with standard value.
    BaseConstructL(CAknAppUi::EAknEnableSkin);

    // Create view object
    iAppView = CHelloWorldBasicAppView::NewL( ClientRect() );

    iRecorder = CMdaAudioRecorderUtility::NewL(*this);
    iState = EInvalid;
    }

    void CHelloWorldBasicAppUi::RecordL()
    {
    if (iRecorder->State() != iRecorder->ENotReady)
    iRecorder->Close();

    iState = ERecordRequest;
    iRecorder->OpenFileL(_L("C:\\Test.wav"));
    }

    void CHelloWorldBasicAppUi::StopL()
    {
    iRecorder->Stop();
    iRecorder->Close();
    }

    void CHelloWorldBasicAppUi::MoscoStateChangeEvent(CBase* aObject, TInt
    aPreviousState,
    TInt aCurrentState, TInt aErrorCode)
    {
    if(aObject == iRecorder)
    {
    CMdaAudioRecorderUtility::TState state = iRecorder->State();
    if(state == CMdaAudioRecorderUtility::ENotReady)
    {
    iRecorder->Close();
    return;
    }

    if(state == CMdaAudioRecorderUtility::EOpen)
    {
    switch (iState)
    {
    case ERecordRequest:
    {
    iRecorder->SetAudioDeviceMode( CMdaAudioRecorderUtility::ELocal );
    iRecorder->SetGain( iRecorder->MaxGain() );
    iRecorder->SetPosition( TTimeIntervalMicroSeconds(0) );
    iRecorder->CropL();
    iRecorder->RecordL();
    iState = ERecording;
    }
    break;


    default:
    break;
    }
    }
    }
    }

    I observed that MoscoStateChangeEvent is called properly and and all the
    functions from iRecorder->SetAudioDeviceMode(
    CMdaAudioRecorderUtility::ELocal ) to iRecorder->RecordL(); are
    called properly.

    I can also see a C:\\Test.wav file being created with 44 bytes of length
    ( The length remains constant always) ,

    When i call StopL fucntion, the file gets deleted.

    Do i need to use any particular capability for this ? Also is there any
    API/Class which can record audio in a file ...and can work only with the user
    granted capabilities ?

    Kind Regards
    Gaurav Palv

  2. #2
    Super Contributor
    Join Date
    Jun 2006
    Location
    Moscow, Russia
    Posts
    803

    Re: Recording Audio in file using CMdaAudioRecordUtility in S60 V3

    Hi,

    below is a working example. I omitted all UI related code and error checking for clarity.

    void CHelloWorldBasicAppUi::ConstructL()
    {
    iRecorder = CMdaAudioRecorderUtility::NewL(*this, 0, 80, EMdaPriorityPreferenceQuality);
    }

    void CHelloWorldBasicAppUi::RecordL()
    {
    iFs.Connect();
    iAudioFile.Create(iFs, _L("C:\\Test.wav"), EFileShareExclusive | EFileWrite);
    iRecorder->OpenFileL(iAudioFile)
    iRecorder->SetGain(iRecorder->MaxGain());
    iRecorder->SetPosition(TTimeIntervalMicroSeconds(0));
    }

    void CHelloWorldBasicAppUi::MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
    {
    if (aCurrentState == CMdaAudioRecorderUtility::EOpen
    && aPreviousState == CMdaAudioRecorderUtility::ENotReady)
    {
    iRecorder->SetGain(iAudioRecorder->MaxGain());
    iRecorder->SetPosition(TTimeIntervalMicroSeconds(0));
    TRAPD(err, iRecorder->SetDestinationDataTypeL(KMMFFourCCCodePCM16));
    TRAP(err, iRecorder->RecordL());
    }
    }

    void CHelloWorldBasicAppUi::StopL()
    {
    iRecorder->Stop();
    iRecorder->Close();
    iFs.Close();
    }
    Regards,
    ivey

  3. #3
    Regular Contributor
    Join Date
    Mar 2004
    Posts
    154

    Re: Recording Audio in file using CMdaAudioRecordUtility in S60 V3

    Hi,
    i tried it. It does not seem to work at my end. Basically it always creates this Test.wav file but of 0 bytes.
    Can you please guide me if i am missing anything ? Also what would be the destimation type if we want to record in amr format ?


    Kind Regards
    Gaurav Palvia

  4. #4
    Super Contributor
    Join Date
    Jun 2006
    Location
    Moscow, Russia
    Posts
    803

    Re: Recording Audio in file using CMdaAudioRecordUtility in S60 V3

    What SDK are you using? My code works on UIQ 3. You can also look at the SDK example in \examples\multimedia\audio.

    For possible formats please refer to \epoc32\include\mmf\common\MmfFourCC.h.
    Regards,
    ivey

  5. #5
    Registered User
    Join Date
    Jul 2006
    Posts
    7

    Re: Recording Audio in file using CMdaAudioRecordUtility in S60 V3

    Dear Ivey

    I am new to C++.
    Could you please teach me to write frm line by line and step to step ?

    I heard that during recording there will be beep sound in every minute.
    Could you solve this ?

    Thanks a lot
    Nukool

  6. #6
    Regular Contributor
    Join Date
    May 2005
    Location
    Sweden
    Posts
    272

    Re: Recording Audio in file using CMdaAudioRecordUtility in S60 V3

    I think I've seen this one mentioned on the forums before, and the problem is that you need some capability to access the microphone on s60 3rd ed devices. Not sure, as I haven't tried it myself, but do a search and see if you find anything.

  7. #7
    Registered User
    Join Date
    Jul 2006
    Posts
    7

    Re: Recording Audio in file using CMdaAudioRecordUtility in S60 V3

    Dear Ivey

    I am new to C++.
    Could you please teach me to write frm line by line and step to step ?

    I heard that during recording there will be beep sound in every minute.
    Could you solve this ?

    Thanks a lot
    Nukool

Similar Threads

  1. could not find thread.mbg and thread.rsg
    By deercrane in forum Symbian
    Replies: 3
    Last Post: 2006-04-18, 09:44
  2. Replies: 1
    Last Post: 2005-05-26, 14:22
  3. Replies: 0
    Last Post: 2002-06-10, 12:24
  4. Mixing and Matching of existing audio file?
    By hiteshw in forum Symbian
    Replies: 0
    Last Post: 2002-02-20, 02:28

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×