Configuring CMMFCodec for encoding audio to AMR
Article Metadata
Compatibility
Platform(s): S60 2nd Edition, FP2 and FP3, S60 3rd Edition
Article
Keywords: CMMFCodec, AMR
Created: User:Technical writer 2
(19 Oct 2006)
Last edited: hamishwillee
(14 Jun 2012)
Overview
Configuring CMMFCodec for encoding audio to AMR.
Description
On S60 2nd Edition, Feature Pack 2 and 3, manual conversion from PCM16-format audio to AMR-NB can be done via the CMMFCodec interface. CMMFCodec also provides a method for configuring the encoder — in this case, specifying the AMR encoding mode (bitrate).
Solution
#include <mmf\plugin\mmfCodecImplementationUIDs.hrh>
const TUid KMMFCodecAMREncode = {KAdvancedUidCodecPCM16ToAMR}; // 0x101FAF68
const TUid KUidConfig = {KUidMmfCodecAudioSettings}; // 0x10203622
CMMFCodec* codec = CMMFCodec::NewL(KMMFCodecAMREncode);
TAmrEncParams iEncoderParams;
iEncoderParams.iMode = mode; // AMR-NB mode between 0...7
iEncoderParams.iDTX = EFalse;
// DTX mode
codec->ConfigureL(KUidConfig, (const TDesC8&)iEncoderParams);
// proceed to call CMMFCodec::ProcessL()
// see CMMFCodec documentation on SDK Help for more info
The TAmrEncParams class definition is no longer in the SDK. The following definition can be used:
class TAmrEncParams
{
public:
inline TAmrEncParams();
public:
// encoding mode 0-7 (0=MR475,1=MR515,...,7=MR122, default 7)
TInt iMode;
// DTX (discontinuous transmission) flag (true/false)
TInt iDTX;
};
TAmrEncParams::TAmrEncParams() :
iMode(7), iDTX(0) {}
Note:
- On most current S60 devices, recording/playback and streaming is already done with more efficient hardware (DSP) codecs. These codecs can be taken into use with high-level audio APIs (CMdaAudio[Player|Recorder]Utility, CMdaAudio[Input|Output]Stream), but they cannot be used via the CMMFCodec interface. For some codecs (e.g., AMR-NB) a CMMFCodec implementation is also included for maintaining backward compatibility.}}
- S60 3rd Edition: The above definition for TAmrEncParams works for S60 3rd Edition as well, however the required AMR-NB MMF codec is not included in all S60 3rd Edition phones. The following phone models do include this codec:
- Nokia 3250
- Nokia E62
- Nokia N71
- Nokia N73
- Nokia N75
- Nokia N80
- Nokia N92
- Nokia N93
- Nokia N95
- Nokia 6290


(no comments yet)