How can I play AMR from file or descriptor?

Login to reply to this topic.
Mon, 2005-07-18 07:52
Joined: 2005-07-16
Forum posts: 127
Hi everybody,

I have been trying to solve the problem "how to play amr".

I used CMdaRecorderUtility class for this purpose. I did the following:

//Constant declarations

_LIT(KAmrFile,"\\system\\apps\\AudioPlayer\\sample.amr");
const TUid KMMFExControllerUID = {0x101F5022};
const TUid KMMFExDesFormatUID = {0x101FAF66};
const TUint32 KMMFFourCCCodeAMR = 0x524d4120;

void OpenAmrFile()
{
if(iMdaAudioRecorderUtility->State()==iMdaAudioRecorderUtility->ENotReady)
{
    iMdaAudioRecorderUtility->OpenFileL(KAmrFile,KMMFExControllerUID,                  KMMFExControllerUID,KMMFExDesFormatUID,KMMFFourCCCodeAMR);
}
}

//It does not get the EOpen state, so state is not opened here which should be opened.
void CAudioPlayerEngine::MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
{
//So I can not use any checking condition
PlayL();
}

void PlayL()
{
    // Play through the device speaker
    iMdaAudioRecorderUtility->SetAudioDeviceMode(CMdaAudioRecorderUtility::ELocal);

    // Set maximum volume for playback
    iMdaAudioRecorderUtility->SetVolume(iMdaAudioRecorderUtility->MaxVolume());

    // Set the playback position to the start of the file
    iMdaAudioRecorderUtility->SetPosition(TTimeIntervalMicroSeconds(0));
    //

    iMdaAudioRecorderUtility->PlayL();
}

//** I get error message "Feature not supported" for PlayL()
iMdaAudioRecorderUtility->PlayL();

I would really appreciate, if anybody comments on this.

Wed, 2005-07-20 04:13
Joined: 2003-04-01
Forum posts: 142
Re: How can I play AMR from file or descriptor?
one thing that works nicely at least in all OS 7.0 & 8.0 phones is to use CMMFCodec to convert the AMR data to PCM and then play it with streaming. There are couple of example projects available on forum nokia on streaming and also some nice posts made by sten can be found from nokia forums discussion board on how to use the AMR conversion.

yucca
Wed, 2005-07-20 07:33
Joined: 2005-04-09
Forum posts: 29
Re: How can I play AMR from file or descriptor?
i spent a long time for amr conversion, and still no success,
it's not as easy as you mentioned. is there any example project you know for AMR conversion,
what i tried so far(by looking at the posts on newlc forum) is:

- CAmrToPcmDecoder
- CMMFCodec
- CMdaAudioConvertUtility

none of them worked.

i finally gave up!
any example project, useful link, any code will be appreciated
Wed, 2005-07-20 14:22
Joined: 2003-04-01
Forum posts: 142
Re: How can I play AMR from file or descriptor?
I remember that code working on 6600, but from 7610, nokia removed the AMR support, luckily only partially. So nowadays, with OS 7.0 & 8.0, I would use streaming and convert the AMR to PCM with the converter. Have to say that tried the streaming with very old 3650 (with OS version 2.5) and didn't get it working in first half an hour. Anyway usinf normal recorder class with OS 6.1 phones should work very well, and it is always good to compile different versions for MMF and Non-MMF devices anyway.

yucca
  • Login to reply to this topic.