×

Discussion Board

Results 1 to 5 of 5

Hybrid View

  1. #1
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    290

    AMR-NB recording with example where to stop and save content automatically?

    Hi,


    just for testing purposes i want to stop the recording
    1. after a while (fixed length)
    2. when stopped by the user

    i use this function for trying out :

    Code:
    void CAudioStreamEngine::Stop()
        {
        // if input or output streams are active, close them
        if (iInputStatus!=ENotReady) 
            {
            iInputStream->Stop();
            //ShowMessage(_L("\nRecording stopped!"), ETrue);
            iBufferOK = ETrue;
            iInputStatus = ENotReady;
            TInt Err;
            TRAP( Err, SaveAudioFileL() );
            if( Err == KErrNone )
            	{
            	//do something!
            	}
            }       
        if (iOutputStatus!=ENotReady) 
            {
            iOutputStream->Stop();
            iOutputStatus = ENotReady;
            ShowMessage(_L("\nPlayback stopped!"), ETrue);
            }
        }

    if i run the code and let the program run the overall length( fixed ) it writes the file and responses:
    "Recording complete!" in "MaiscBufferCopied".
    But when i stop the recording by stop menu i get an error : recording error : -39 from "MaiscBufferCopied".
    The file seems to be written...

    So where is the best location to put " SaveAudioFileL()"

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,956

    Re: AMR-NB recording with example where to stop and save content automatically?

    in the audio streaming example under the callback fucntion MaiscBufferCopied,
    you must be having a else condition which is:

    else if (aError==KErrAbort)
    {
    // Recording was aborted, due to call to CMdaAudioInputStream::Stop()
    // This KErrAbort will occur each time the Stop() method in this class is executed.
    // Also, MaiscRecordComplete() will be called after exiting this method.
    iStreamEnd = iStreamIdx - 1;
    iBufferOK = ETrue;
    iInputStatus = ENotReady;
    SaveAuidoFileL();//call here for saving

    }


    Also if you interrupt the recording in between then ofcourse everytime it will give a panic code as KErrAbort i.e. -39

  3. #3
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    290

    Re: AMR-NB recording with example where to stop and save content automatically?

    Hi,


    i already inserted the SaveAudioFileL in "MaiscBufferCopied" but i missed:

    Code:
    iStreamEnd = iStreamIdx - 1;
    iBufferOK = ETrue;
    iInputStatus = ENotReady;
    iAudioStream1->iEngine->Stop();

    then i put this to the end of "MaiscBufferCopied"

    CEikonEnv::Static()->AlertWin(_L("aaaabbb") );

    but i never see aaaabbb when i press the stop menu from my view and run:

    iAudioStream1->iEngine->Stop(); which is ...

    Code:
    // ----------------------------------------------------------------------------
    // CAudioStreamEngine::Stop()
    //
    // stops playing/recording
    // ----------------------------------------------------------------------------
    ...
        {
        // if input or output streams are active, close them
        if (iInputStatus!=ENotReady) 
            {
            iInputStream->Stop();
     ...
    my guess if i call ..Stop() then "MaiscBufferCopied" is not called...


    Greetz
    Franky

  4. #4
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    3,956

    Re: AMR-NB recording with example where to stop and save content automatically?

    i think MaiscRecordComplete(TInt aError) is called when you give stop command from menu.

  5. #5
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    290

    Re: AMR-NB recording with example where to stop and save content automatically?

    Hi,


    first of all thanks for your patience. Well i figured out that
    Code:
    if(aError!=KErrNone) 
    ...
    is correctly called first. And Then after that...

    Code:
    if(aError==KErrAbort)
    ...
    so putting the last first and call !=KErNone only after some unexpected!

    So "::MaiscBufferCopied" is called first and then "::Stop()". So thats makes me a little bit nervous but i think this is the AudioStream business as usual.


    Greetz
    Franky

Posting Permissions

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