Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: SoundDevice.h

This item is not part of the S60 3rd Edition SDK for Symbian OS, Feature Pack 2.

Class MDevSoundObserver

class MDevSoundObserver;

Description

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.

Members

Defined in MDevSoundObserver:
BufferToBeEmptied(), BufferToBeFilled(), ConvertError(), DeviceMessage(), InitializeComplete(), PlayError(), RecordError(), SendEventToClient(), ToneFinished()


Member functions


InitializeComplete()

virtual void InitializeComplete(TInt aError)=0;

Description

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.


ToneFinished()

virtual void ToneFinished(TInt aError)=0;

Description

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.


BufferToBeFilled()

virtual void BufferToBeFilled(CMMFBuffer *aBuffer)=0;

Description

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().


PlayError()

virtual void PlayError(TInt aError)=0;

Description

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.


BufferToBeEmptied()

virtual void BufferToBeEmptied(CMMFBuffer *aBuffer)=0;

Description

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().


RecordError()

virtual void RecordError(TInt aError)=0;

Description

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.


ConvertError()

virtual void ConvertError(TInt aError)=0;

Description

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()

virtual void DeviceMessage(TUid aMessageType, const TDesC8 &aMsg)=0;

Description

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.


SendEventToClient()

inline virtual void SendEventToClient(const TMMFEvent &aEvent);

Description

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