MDevSoundObserver Class Reference

class MDevSoundObserver

An interface to a set of DevSound callback functions.

This serves as the method of communication between the client and the DevSound.

The class is a mixin and is intended to be inherited by the client class that is interested in observing the DevSound operation. The functions encapsulated by this class are called when specific events occur in the process of initializing and playing/recording an audio sample or playing tones.

Member Functions Documentation

BufferToBeEmptied(CMMFBuffer *)

void BufferToBeEmptied ( CMMFBuffer * aBuffer ) [pure virtual]

Handles CMMFDevSound object's data request event.

A derived class must provide an implementation to process the data supplied by CMMFDevSound object while recording or converting.

CMMFDevSound object calls this function when the buffer, aBuffer gets filled while recording or converting. The observer should notify CMMFDevSound object as quickly as possible after data in the buffer is processed by calling RecordData(), otherwise the implementation might callback the function RecordError() on derived class object with error code KErrOverflow.

Parameters

CMMFBuffer * aBuffer Buffer containing processed (recorded or converted) data. The amount of data that is available is specified in CMMFBuffer::RequestSize().

BufferToBeFilled(CMMFBuffer *)

void BufferToBeFilled ( CMMFBuffer * aBuffer ) [pure virtual]

Handles CMMFDevSound object's data request event.

A derived class must provide an implementation to supply CMMFDevSound object the data that it needs to play or convert.

CMMFDevSound object calls this function when and where it needs data for playing or converting. The observer should notify CMMFDevSound object as quickly as possible after the data is read into buffer, aBuffer by calling PlayData(), otherwise the implementation might callback function PlayError() on derived class object with error code KErrUnderflow. This does not apply to the very first call to PlayData(), however. It is possible for a user of DevSound to hold the first buffer sent in BufferToBeFilled() until ready to play. The use case for this is if a low latency audio response is required, as at this point all the resources used to play audio are open. If used in this way then it is important to be aware that when when the resources for audio are ready at the BufferToBeFilled() callback, a Devsound on a real device will be running at increased power consumption as the audio hw and any required DSPs will be powered up etc.

Parameters

CMMFBuffer * aBuffer Buffer into which data should be read. The amount of data that is needed is specified in CMMFBuffer::RequestSize().

ConvertError(TInt)

void ConvertError ( TInt aError ) [pure virtual]

Handles conversion completion or cancel event.

A derived class must provide an implementation to handle the conversion completion or cancel request.

CMMFDevSound object calls this function when an attempt to convert data from source format to destination format has completed, successfully or otherwise.

Parameters

TInt aError Error code. KErrCancel conversion operation is cancelled. KErrNone conversion is complete. Other values are possible indicating a problem converting data.

DeviceMessage(TUid, const TDesC8 &)

void DeviceMessage ( TUid aMessageType,
const TDesC8 & aMsg
) [pure virtual]

Handles device event.

A derived class must provide an implementtion to handle the messages from audio hardware device.

CMMFDevSound object calls this function when a message is received from the audio hardware device.

Parameters

TUid aMessageType Defines the type of message. Used to determine how to interpret the contents of aMsg.
const TDesC8 & aMsg Message that is packed in the Descriptor format.

InitializeComplete(TInt)

void InitializeComplete ( TInt aError ) [pure virtual]

Handles initialization completion event.

A derived class must provide an implementation to handle the initialization request.

CMMFDevSound object calls this function when its InitializeL() function completes.

Parameters

TInt aError Error code. KErrNone if successful. Other values are possible indicating a problem initializing CMMFDevSound object.

PlayError(TInt)

void PlayError ( TInt aError ) [pure virtual]

Handles play completion or cancel event.

A derived class must provide an implementation to handle the play completion or cancel request.

CMMFDevSound object calls this function when an attempt to play audio sample has completed, successfully or otherwise.

Parameters

TInt aError Error code. The status of playback. KErrUnderflow playing of the audio sample is complete. KErrAccessDenied the sound device is in use by another higher priority client.

RecordError(TInt)

void RecordError ( TInt aError ) [pure virtual]

Handles record completion or cancel event.

A derived class must provide an implementation to handle the record completion or cancel request.

CMMFDevSound object calls this function when an attempt to record audio sample has completed, successfully or otherwise.

Parameters

TInt aError Error code. The status of recording. KErrOverflow audio devices runs out of internal buffer. KErrAccessDenied the sound device is in use by another higher priority client.

SendEventToClient(const TMMFEvent &)

void SendEventToClient ( const TMMFEvent & aEvent ) [inline, virtual]

Handles policy request completion event.

A derived class must provide an implementation to handle the policy request completion event.

CMMFDevSound object calls this function when an attempt to acquire sound device is rejected by audio policy server.

Parameters

const TMMFEvent & aEvent Not used

ToneFinished(TInt)

void ToneFinished ( TInt aError ) [pure virtual]

Handles tone play completion event.

A derived class must provide an implementation to handle the tone play completion request.

CMMFDevSound object calls this function when an attempt to play tone has completed, successfully or otherwise.

The following are the play tone functions; PlayToneL(), PlayDMTFStringL(), PlayToneSequenceL(), and PlayFixedSequenceL().

Parameters

TInt aError Error code. The status of tone playback. KErrUnderflow playing of the tone is complete. KErrAccessDenied the sound device is in use by another higher priority client. KErrCancel playing of the audio sample is stopped by DevSound client another higher priority client.