CMdaAudioConvertUtility
provides features to convert
audio clips between different formats. For the purposes of this description,
the conversion process has been broken down into the following sections.
Opening - describes the options available for opening audio sources and sinks.
Configuration - describes the various configuration settings that can be queried or set such as source and destination volume settings, bit rates and so on.
Converting - describes the methods available for converting audio clips.
MMF can automatically detect the file format and codec of most audio
clips with the exception of raw audio. When opening a raw audio file, the codec
and audio settings must be specified; this is reflected in the range of open
statements available in CMdaAudioConvertUtility
.
The following open statements are provided:
Open statement for converting audio data from the format of the input file and appending it to the secondary file in the secondary file format. The secondary file must already exist and contain some audio data so that MMF can determine the format and codec to use.
void OpenL(const TDesC& aPrimaryFile, const TDesC& aSecondaryFile);
The formats and codecs to use are determined by reading the headers
of the specified primary and secondary files. If either of the files are empty
or if they contain raw audio, MMF will fail to determine the correct format and
codec and the OpenL()
will fail.
Open statements for converting audio data from one file and writing the converted data to a second file that may or may not already exist.
void OpenL(const TDesC& aPrimaryFile, TMdaClipLocation* aLocation, TMdaClipFormat* aFormat, TMdaPackage* aArg1=NULL, TMdaPackage* aArg2=NULL);
void OpenL(TMdaClipLocation* aPriLocation, TMdaClipLocation* aSecLocation, TUid aControllerUid, TUid aDestFormatUid, TFourCC aDestDataType);
Use these OpenL()
methods when the destination file is
empty or does not already exist. The first method enables you to specify the
format and codec to use when converting from the format and codec used in the
source file.
The second method enables you to specify the controller UID, format and codec to use when converting.
Open statement for converting audio data from one file and writing the converted data to a second file when neither the source or destination format and codecs are known.
void OpenL(TMdaClipLocation* aPriLocation, TMdaClipLocation* aSecLocation, TMdaClipFormat* aPriFormat, TMdaClipFormat* aSecFormat, TMdaPackage* aPriArg1=NULL, TMdaPackage* aPriArg2=NULL, TMdaPackage* aSecArg1=NULL, TMdaPackage* aSecArg2=NULL);
Following the opening of the file or descriptor to convert the audio data, configuration adjustments can be made using the methods described below.
There are five categories of configuration methods that can be used to retrieve and set various parameters. These categories are:
General - covers just the setting of the maximum size
of a recorded file. This is handled by SetMaxWriteLength()
that sets the maximum number of bytes that can be written to a recorded audio
clip. If this limit is reached, MMF stops recording and notifies the client
application. Notification is caused by
MMdaObjectStateChangeObserver::MoscoStateChangeEvent()
with
the error code KErrEof
.
Formats and codecs - covers the reporting and setting of formats and codecs for audio data that is already open. The four methods relating to DataTypes (codecs) enable you to retrieve a list of supported codecs for the current data format, set a new codec to use or determine which codec is currently in use. A further three methods are provided to query and set the audio format to use.
Codec related actions are
DestinationDataTypeL()
,
SetDestinationDataTypeL()
,
GetSupportedDestinationDataTypesL()
and
SourceDataTypeL()
.
Data format related actions are
DestinationFormatL()
,
SetDestinationFormatL()
and
SourceFormatL()
.
Note: It is only possible to report the format and codec used by the source audio; it is not possible to change those values.
Bit and sample rates - covers the reporting and setting of bit and sample rates as required by specific codecs.
Methods for controlling the bit rate of audio data are
GetSupportedConversionBitRatesL()
,
DestinationBitRateL()
,
SetDestinationBitRateL()
and
SourceBitRateL()
.
Note: None of the default codecs provided in the MMF support the use of bit rates. These methods are provided to enable the creation of additional codecs that might require bit rate information, such as the audio format MP3.
Methods for controlling the sampling rate of audio data are
GetSupportedConversionSampleRatesL()
,
DestinationSampleRateL()
,
SetDestinationSampleRateL()
and
SourceSampleRateL()
.
Note: It is only possible to report the bit rate or sample rate used by the source audio; it is not possible to change those values.
Balance - covers the reporting and setting of audio mode (that is, mono or stereo).
Methods for determining the number of audio channels (playback or
recording) are GetSupportedConversionNumberOfChannelsL()
,
DestinationNumberOfChannelsL()
,
SetDestinationNumberOfChannelsL()
and
SourceNumberOfChannelsL()
.
Note: It is only possible to report the number of supported channels for the source audio; it is not possible to change that value.
Methods are provided in CMdaAudioConvertUtility
to
enable the conversion of audio data. However, due to binary compatibility
issues, three of the methods do not actually provide any unique functionality.
These methods are marked as such in the list below.
The conversion related methods are:
ConvertL()
- start converting audio data from
the current position within the audio source writing the converted data to a
play window within the destination file.
RecordL()
- only provided for binary
compatibility.
PlayL()
- only provided for binary
compatibility.
Stop()
enables you to stop audio conversion;
the positions within the audio source and destination are maintained in case
ConvertL()
are subsequently used again.
Close()
stops audio conversion and closes all
related controllers.
CropL()
and
CropFromBeginningL()
deletes all audio data after the
current position or from the beginning of the destination audio clip.
Position()
and
SetPosition()
retrieves or sets the current position
within the destination audio clip.
RecordTimeAvailable()
- determine the amount
of time left before the maximum size of the audio clip is reached.
SetPlayWindow()
and
ClearPlayWindow()
- set and clear the start and end
position within the source audio clip from where to start and stop converting
audio data.
SetRepeats()
- only provided for binary
compatibility.
Duration()
- determine the duration of the
source audio clip in microseconds.
Multi Media Framework Client Overview - general overview of the various components of the MMF Client API and the functionality they provide.
Audio Recording, Conversion and Playing - advanced audio file manipulation features; specifically, the ability to record, convert and playback sound clips as well as to manipulate meta data.
Audio Recording - introduction to the audio recording class.
Audio Conversion - introduction to the audio conversion class.
Audio Playing - introduction to the audio playing class.
Audio Streaming - the interface to streaming sampled audio.
Audio Tone Player - a simple interface for tone generation (synthesized sounds) that is supported on all audio-capable devices.
Video Recording and Playing - video manipulation features; specifically, the ability to record and playback video clips as well as to manipulate meta data.
Video Recording - introduction to the video recording class.
Video Playing - introduction to the video playing class.