Are you bothering by the AMR problem in MMF? The MMF is really annoying for developers.
In SDK 0.9 or 1.2, you may use CAmrToPcmDecoder and CPcmToAmrEncoder to convert between PCM and AMR with ease. But in SDK 2.x, this feature is erased. SDK announces that a new MMF framework can do this instead now!!! But it seems all developers encounter big problem when handle AMR using MMF!!!! Maybe MMF is not designed for more clear interface but more complexity!
In fact, we can handle AMR using AMR codec library in MMF server directly. Like the following code:
// Uid of PCM16toAMR codec is 0x101FAF68
CMMFCodec* codec = CMMFCodec::NewL(TUid::Uid(0x101FAF68));
CMMFDescriptorBuffer* srcbuf = CMMFDescriptorBuffer::NewL(320);
// Copy your PCM frame data into srcbuf, for example: srcbuf->Data().Copy(pcmbuf);
CMMFDescriptorBuffer* dstbuf = CMMFDescriptorBuffer::NewL(32);
TCodecProcessResult result = codec->ProcessL(*srcbuf, *dstbuf):
// now the dstbuf contains an AMR frame data
If you want to convert AMR to PCM16, just change the UID to 0x101FAF67.
Notice: In SDK 2.1 and 2nd Edition, you may use CMMFPtrBuffer to reduce memory copy actions.
Notice: The codec works in synchronous manner, so don't use encode/decode large buffer in CActive::RunL().
BUT, I CAN'T SOLVE THE FOLLOWING PROBLEM!!!!!!!!!!!!!!!!!!!!!!
When convert PCM to AMR, the default mode is MR475 and I don't know how to change it!!!! CMMFCodec provides a function ConfigureL to configure codec-specific attributes, but no document provides the format the attribute string!!!! Can anybody help me to solve this problem?