×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    224

    How can I play AMR?

    Hello dudes,

    Does anybody know, how I can play amr from file or from des buffer?

    I used CMdaAudioRecorderUtility like following:

    CMdaAudioRecorderUtility *iAmrPlayer;

    void PlayAMR()
    {
    iAmrPlayer = CMdaAudioRecorderUtility::NewL(*this);
    iAmrPlayer->OpenFileL(KAmrFile);
    }

    MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
    {
    iAmrPlayer->PlayL();
    }

    1. current state is not opening state.
    2. It does not play the amr file.

    I tried also putting "iAmrPlayer->PlayL(); "
    in PlayAMR() method, which did not work as well.

    Any help is highly appreciated.

    Thanks.

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037

    LIST OF AMR THREADS

    Please search this forum, there were many threads discussing similar problems before half a year and finally the solution for recording and playing amr files using MMF framework was found:

    http://discussion.forum.nokia.com/fo...amr+stenlik%2A

    or

    http://discussion.forum.nokia.com/fo...amr+stenlik%2A

    or

    http://discussion.forum.nokia.com/fo...amr+stenlik%2A

    or

    http://discussion.forum.nokia.com/fo...%2Aamr+STeN%2A

    or

    http://discussion.forum.nokia.com/fo...%2Aamr+STeN%2A

    Bye
    STeN

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    224

    How can I play AMR?

    Hi stenlik,
    Thanks for your reply. Actually, I already went through those discussion. I tried them in my code but it did not work.

    It would be very helpful for me, if u could give me complete method for playing the AMR codec from file or Descriptor.

    Please include the necessary library and header files.

    I am using SDK 7.0.

    Thanks once again in advance.

  4. #4
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    224

    Playing AMR file.

    It seems that it's quite impossible to play AMR file. I would really appreciate if anybody give me any example code of playing amr file. You can send code to my email:

    shagor.evtek@gmail.com

  5. #5
    Registered User
    Join Date
    Aug 2004
    Location
    Hyderabad,India
    Posts
    808
    ply = CMdaAudioPlayerUtility::NewFilePlayerL(KAudioFileName, *this,EMdaPriorityMax );

    Once player is ready frame work will call MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/)

    If aError is KErrNone then call ply->Play() in MapcInitComplete() function.
    For this Derive a class
    class CAmrPlay : public CBase, public MMdaAudioPlayerCallback
    {
    CMdaAudioPlayerUtility *ply ;
    void MapcInitComplete(.......);
    } and override above call back function MapcInitComplete() in this class

  6. #6
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    224
    CMdaAudioPlayerUtility does not have support for playing AMR file. I have already tested it.

  7. #7
    Super Contributor
    Join Date
    Mar 2004
    Location
    Czech Republic
    Posts
    2,037
    Hi,

    we have fully functional application on Symbian 8.0a, which plays AMR file... I cannot put source code here, because I am not their owner, but base on SDK infrormations, nokia white papers and THREADS!! on this forum it is not so complicated to programm recording and playing AMR files...

    It really works.

    Bye
    STeN

  8. #8
    Registered User
    Join Date
    Aug 2004
    Location
    Hyderabad,India
    Posts
    808
    You are wrong. I am using it.
    CMdaAudioPlayerUtility can be used to play amt, awb, mp3 , wav

    You just re check it

    Regards,
    Sudhakar

  9. #9
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    224
    Could you give me sample code for playing AMR using CMdaAudioPlayerUtility. I really appreciate for this.

    Thanks in advance.

  10. #10
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    224
    Hello STeN,

    You are saying AMR is not difficult to play as such. I read in this forum, there are many kinds of solutions. I tried them all. Unfortunately, none of them work. It would really kind if you share code for only the playing part of the AMR. You could also mail to me "shagor.evtek@gmail.com"

  11. #11
    Registered User
    Join Date
    Aug 2004
    Location
    Hyderabad,India
    Posts
    808
    //##ringtone.h

    class CMyAudio : public CBase, public MMdaAudioPlayerCallback
    {

    private:

    CMdaAudioPlayerUtility* ply;

    enum TState
    {
    ENotReady,
    EReady,
    EPlaying,
    EStop
    };

    TState iState;
    TInt iVolume;


    private:

    void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
    void MapcPlayComplete(TInt aError);

    public:

    CMyAudio();
    ~CMyAudio();
    void Play();
    void Stop();
    void SetVolume(TInt aVol);
    TInt GetVolume();
    void CreatePlayerFileL( const TBuf16<256> &KAudioFileName);
    void DeletePlayerFileL();
    };

    #include "ringtone.h"

    #include "EikonEnvironment.h"
    #include <eikenv.h>

    #include <s32file.h>


    CMyAudio::CMyAudio()
    {
    iVolume = 5;
    }

    CMyAudio::~CMyAudio()
    {
    Stop();
    if(ply)
    delete ply;
    ply = NULL;
    }

    void CMyAudio :: CreatePlayerFileL( const TBuf16<256> &KAudioFileName)
    {
    Stop();
    if(ply)
    delete ply;
    ply = NULL;
    ply = CMdaAudioPlayerUtility::NewFilePlayerL(KAudioFileName, *this,EMdaPriorityMax);
    // ply = CMdaAudioPlayerUtility::NewFilePlayerL(KAudioFileName, *this,80);
    }

    void CMyAudio :: DeletePlayerFileL()
    {
    Stop();
    if(ply)
    delete ply;
    ply = NULL;
    }
    //
    //.. CALLBACK METHOD Called by the frame work. Till this has been called
    //.. the player file is not ready for play
    //
    void CMyAudio::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration)
    {
    iState = aError ? ENotReady : EReady;
    }
    //
    //..Framework will notify you the end of the playback by a call to
    //..to this functionMapcPlayComplete().
    //
    void CMyAudio::MapcPlayComplete(TInt aError)
    {
    if((aError == KErrNone || aError == KErrDied) && iState == EPlaying)
    {
    if( ply )
    ply->Play();
    }
    }

    void CMyAudio::Play()
    {
    if(iState == EReady || iState == EStop)
    {
    iState = EPlaying;
    TInt maxvol = ply->MaxVolume();
    iVolume = maxvol;
    // ply->SetVolume(5);
    ply->SetRepeats(KMdaRepeatForever,TTimeIntervalMicroSeconds(10000));
    ply->Play();
    }
    }

    void CMyAudio::Stop()
    {
    if(ply && iState == EPlaying)
    {
    ply->Stop();
    }
    iState = EStop;
    }

    void CMyAudio::SetVolume(TInt aVol)
    {
    if(!ply) return;
    TInt maxvol = ply->MaxVolume();
    if(aVol > -1 && aVol < maxvol)
    {
    ply->SetVolume(aVol);
    iVolume = aVol;
    }
    }
    TInt CMyAudio::GetVolume()
    {
    return iVolume ;
    }


    CMyAudio iAudio;
    iAudio.setAudioFile(_L("SOMEFILE.AMR"));//FULL PATH OF FILE TO BE GIVEN

    Frame work will call

    MapcInitComplete()

    if error is NONE then u call

    iAudio.Play() which will play the audio.

    I have given pseudo code. do it neatly and i am using the same and it's working and should work with you also

    Regards,
    SSS

  12. #12
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    224
    Hi,

    Thanks Sudhakar.

    I have put your code in my application. Unfortunately it still does not play.

    I can send you my whole application and the AMR file, if you want.

    Please send me an email to "shagor.evtek@gmail.com", so that I get your email and I will send the whole application and the AMR file for your testing.

    Regards,

    Shagor

Posting Permissions

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