CMdaAudioRecorderUtility
provides features to record
audio clips to files, descriptors or URLs. It also provides methods for
creating and manipulating meta data entries in the newly recorded clips.
Methods are provided in CMdaAudioRecorderUtility
for
both the recording and playing of audio data. This class is intended primarily
for recording audio data, the playback methods have been included for
convenience sake. If you just need to play back an audio clip you should use
CMdaAudioPlayerUtility
instead, as it provides more
control over playing and does not include the overheads that are necessary to
support recording functionality.
For the purposes of this description, the recording 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 volume and gain settings, maximum size of a recorded clip and so on.
Plug-in Control - describes the information and commands that can be sent to or retrieved from plug-in controllers.
Meta data control - describes the methods available for meta data manipulation.
Recording - describes the methods available for recording 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 CMdaAudioRecorderUtility
.
The following open statements are provided:
Open statements for playback and recording of audio data using the default recording and playback devices.
void OpenFileL(const TDesC& aFileName);
void OpenDesL(const TDesC8& aDescriptor);
void OpenUrlL(const TDesC& aUrl, TInt aIapId = KUseDefaultIap, const TDesC8& aMimeType);
Use these open statements to open the specified medium (file, descriptor or URL) so that it can be used for recording or play back.
Open statements for recording and playback of audio data, specifying format, codec, recording and playback devices.
void OpenFileL(const TDesC& aFileName, TUid aRecordControllerUid, TUid aPlaybackControllerUid=KNullUid, TUid aFormatUid=KNullUid, TFourCC aCodec=NULL);
void OpenDesL(TDesC8& aDescriptor, TUid aControllerUid, TUid aPlaybackControllerUid=KNullUid, TUid aFormatUid=KNullUid, TFourCC aCodec=NULL);
void OpenUrlL(const TDesC& aUrl, TInt aIapId, TUid aControllerUid, TUid aPlaybackControllerUid=KNullUid, TUid aFormatUid=KNullUid, TFourCC aCodec=NULL);
Use these open statements to open the specified medium (file, descriptor or URL) so that it can used for recording or play back. These methods should be used when MMF cannot automatically determine the format and codec to use from the audio data, such as for example, when using raw audio.
Open statement for audio clips contained in
TMdaClipLocation
packages.
void OpenL(TMdaClipLocation* aLocation, TMdaClipFormat* aFormat, TMdaPackage* aArg1=NULL, TMdaPackage* aArg2=NULL);
This open statement is provided for compatibility with MediaServer
(the predecessor to MMF). Use this open statement to open a
TMdaClipLocation
package of audio data to playback or record to.
Following the opening of the file, descriptor or URL to play or record 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 configuration parameters when playing back or recording audio data. These categories are:
General - covers the setting of modes for the playing/recording devices, setting the maximum size of a recorded file and playback priorities in relation to other applications that may be running. The specific methods are:
SetAudioDeviceMode()
- sets the properties
of the playing and recording devices while in use.
SetMaxWriteLength()
- 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
.
SetPriority()
- sets the priority of the
audio device which is used to arbitrate between multiple objects trying to
access a controller.
Formats and codecs - covers the reporting and setting of formats and codecs for audio data that is already open. The three 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 two methods are provided to query and set the audio format to use.
Codec related actions are
DestinationDataTypeL()
,
SetDestinationDataTypeL()
and
GetSupportedDestinationDataTypesL()
.
Data format related actions are
DestinationFormatL()
and
SetDestinationFormatL()
.
Bit and sample rates - covers the reporting and setting of bit rates for audio sinks, such as the internal speaker and the sample rates used to sample data that is to be saved to a file or descriptor.
Methods for controlling the bit rate of audio sinks are
GetSupportedBitRatesL()
,
DestinationBitRateL()
and
SetDestinationBitRateL()
.
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 for example the audio format MP3.
Methods for controlling the sampling rate of audio data are
GetSupportedSampleRatesL()
,
DestinationSampleRateL()
and
SetDestinationSampleRateL()
.
Volume and gain - covers the reporting and setting of the volume levels for audio playback and gain settings for the recording device.
Methods for controlling volume settings for playback devices
are GetVolume()
, SetVolume()
,
MaxVolume()
and SetVolumeRamp()
.
Methods for controlling gain settings for recording devices are
GetGain()
, SetGain()
and
MaxGain()
.
Balance - covers the reporting and setting of audio mode (that is, mono or stereo) and of playback and recording balance settings.
Methods for determining the number of audio channels (playback
or recording) are DestinationNumberOfChannelsL()
,
GetSupportedNumberOfChannelsL()
and
SetDestinationNumberOfChannelsL()
.
Methods for controlling the balance of audio channels (playback
or recording) are GetPlaybackBalance()
,
SetPlaybackBalance()
,
GetRecordBalance()
and
SetRecordBalance()
.
You can govern the relationship with a video plug-in in various ways:
ControllerImplementationInformationL()
-
allows applications to query implementation information about the controller
plug-in in use.
CustomCommandSync()
- allows applications to
send custom commands to controller plug-ins.
RegisterForAudioLoadingNotification()
-
registers to receive notifications of audio clip loading/rebuffering.
GetAudioLoadingProgressL()
- gets the progress
of audio clip loading/rebuffering.
Some audio formats enable the use of meta data, enabling the creator or player of an audio clip to retrieve or set information that is held within the clip itself. This meta data is usually used to store information such as copyright information, creator, creation date and so on.
CMdaAudioRecorderUtility
provides a set of meta
data methods that enable you to:
Get the number of meta data entries in a clip and retrieve specific
entries using, GetNumberOfMetaDataEntries()
and
GetMetaDataEntryL()
.
Add or replace entries using
AddMetaDataEntryL()
and
ReplaceMetaDataEntryL()
.
Delete specific meta data entries using
RemoveMetaDataEntry()
.
There are three categories of control methods that can be used to record and playback audio data. These categories are:
Recording specific - there are two methods that are applicable to recording only. They are:
RecordL()
- start recording audio data
from the current position within the audio sink.
Note: before starting to record, make sure that the recording
gain is set by calling SetGain()
, as the initial gain is
undefined. The gain might also have been modified by another client
application.
RecordTimeAvailable()
- determine the
amount of time left before the maximum size of the audio clip is reached.
Generic to recording and playback - these methods can be used either while recording an audio clip or playing it back. The methods are:
Stop()
enables you to stop any playback or
recording; the position within the audio clip is maintained in case
RecordL()
or PlayL()
are subsequently used.
Close()
stops any playback or recording in
progress and closes all related controllers.
Position()
and
SetPosition()
retrieves or sets the current playing or
recording position within the audio clip.
CropL()
and
CropFromBeginningL()
deletes all audio data after the
current position or from the beginning of the audio clip.
Playback specific - there are five methods that are applicable to playback only, they are:
PlayL()
- start playback of audio data
from the current position within the audio sink.
SetPlayWindow()
and
ClearPlayWindow()
- set and clear the start and end
position within the audio clip from where to start and stop playing audio data.
SetRepeats()
- set the number of times to
repeat playing back the same piece of audio data.
Duration()
- determine the duration of the
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.