CMMFDevSound::CBody Class Reference

class CMMFDevSound::CBody : public CBase

This is the Body for CMMFDevSound.

MMFDevSound.lib

Inherits from

Public Member Functions
~CBody()
voidAsyncCustomCommand(TUid, TRequestStatus &, const TDesC8 &, const TDesC8 &, TDes8 *)
TInt CancelInitialize()
TInt CancelRegisterAsClient(TUid)
TMMFCapabilities Capabilities()
voidCloseCustomInterface(TInt)
TMMFCapabilities Config()
TAny *CustomInterface(TUid)
TInt EmptyBuffers()
TInt Gain()
voidGetPlayBalanceL(TInt &, TInt &)
voidGetRecordBalanceL(TInt &, TInt &)
TInt GetResourceNotificationData(TUid, TDes8 &)
voidGetSupportedInputDataTypesL(RArray< TFourCC > &, const TMMFPrioritySettings &)
voidGetSupportedOutputDataTypesL(RArray< TFourCC > &, const TMMFPrioritySettings &)
TInt GetTimePlayed(TTimeIntervalMicroSeconds &)
voidInitializeL(MDevSoundObserver &, TMMFState)
voidInitializeL(MDevSoundObserver &, TFourCC, TMMFState)
TBool IsResumeSupported()
TInt MaxGain()
TInt MaxVolume()
CBody *NewL()
voidPause()
voidPlayDTMFStringL(const TDesC &)
voidPlayData()
voidPlayDualToneL(TInt, TInt, const TTimeIntervalMicroSeconds &)
voidPlayInitL()
voidPlayToneL(TInt, const TTimeIntervalMicroSeconds &)
voidPlayToneSequenceL(const TDesC8 &)
TBool QueryIgnoresUnderflow()
voidRecordData()
voidRecordInitL()
TInt RegisterAsClient(TUid, const TDesC8 &)
TInt Resume()
TInt SamplesPlayed()
TInt SamplesRecorded()
TInt SetClientThreadInfo(TThreadId)
voidSetConfigL(const TMMFCapabilities &)
voidSetDTMFLengths(TTimeIntervalMicroSeconds32 &, TTimeIntervalMicroSeconds32 &, TTimeIntervalMicroSeconds32 &)
voidSetGain(TInt)
voidSetPlayBalanceL(TInt, TInt)
voidSetPrioritySettings(const TMMFPrioritySettings &)
voidSetRecordBalanceL(TInt, TInt)
voidSetToneRepeats(TInt, const TTimeIntervalMicroSeconds &)
voidSetVolume(TInt)
voidSetVolumeRamp(const TTimeIntervalMicroSeconds &)
voidStop()
TInt SyncCustomCommand(TUid, const TDesC8 &, const TDesC8 &, TDes8 *)
TInt Volume()
TInt WillResumePlay()
Protected Member Functions
CBody()
voidConstructL()
TInt FindCustomInterface(TUid)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Protected Attributes
MDevSoundCIClientExtension *iCIExtension
RArray< TMMFDevSoundCustomInterfaceData >iCustomInterfaceArray
RMMFDevSoundProxy *iDevSoundProxy
CMMFDevSoundCIMuxUtility *iMuxUtility

Constructor & Destructor Documentation

CBody()

CBody()[protected]

Constructor

~CBody()

~CBody()

Destructor.

Deletes all objects and releases all resources owned by this instance.

Member Functions Documentation

AsyncCustomCommand(TUid, TRequestStatus &, const TDesC8 &, const TDesC8 &, TDes8 *)

voidAsyncCustomCommand(TUidaUid,
TRequestStatus &aStatus,
const TDesC8 &aParam1,
const TDesC8 &aParam2,
TDes8 *aOutParam
)[inline]

Implements an asynchronous custom command

Parameters

TUid aUidThe UID of the custom command
TRequestStatus & aStatusThe request status of the active object that will be called upon the completion of the request
const TDesC8 & aParam1A buffer of data to be supplied to the receiver
const TDesC8 & aParam2A buffer of data to be supplied to the receiver
TDes8 * aOutParamA buffer that will be written into by the receiver and returned to the client

CancelInitialize()

TInt CancelInitialize()[inline]

Cancels the initialization process of a CMMFDevSound object

CancelRegisterAsClient(TUid)

TInt CancelRegisterAsClient(TUidaEventType)[inline]

Cancels the Registered Notification.

Parameters

TUid aEventType

Capabilities()

TMMFCapabilities Capabilities()[inline]

Returns the supported Audio settings ie. encoding, sample rates, mono/stereo operation, buffer size etc..

CloseCustomInterface(TInt)

voidCloseCustomInterface(TIntaInterfaceId)

Parameters

TInt aInterfaceId

Config()

TMMFCapabilities Config()const [inline]

Returns the current device configuration.

ConstructL()

voidConstructL()[protected]

Symbian constructor

CustomInterface(TUid)

TAny *CustomInterface(TUidaInterfaceId)

Retrieves a custom interface to the device. CMMFDevSound::CBody::CustomInterface

Returns custom interface proxy object created by Proxy Custom Interface Utility.

Parameters

TUid aInterfaceId

EmptyBuffers()

TInt EmptyBuffers()[inline]

Empties the play buffers below DevSound without causing the codec to be deleted.

FindCustomInterface(TUid)

TInt FindCustomInterface(TUidaInterfaceId)[protected]

Parameters

TUid aInterfaceId

Gain()

TInt Gain()[inline]

Returns an integer representing the current gain.

GetPlayBalanceL(TInt &, TInt &)

voidGetPlayBalanceL(TInt &aLeftPercentage,
TInt &aRightPercentage
)[inline]

Returns the speaker balance set for playing.

Parameters

TInt & aLeftPercentage
TInt & aRightPercentage

GetRecordBalanceL(TInt &, TInt &)

voidGetRecordBalanceL(TInt &aLeftPercentage,
TInt &aRightPercentage
)[inline]

Returns the microphone gain balance set for recording.

Parameters

TInt & aLeftPercentageOn return contains the left microphone gain percentage.
TInt & aRightPercentageOn return contains the right microphone gain percentage.

GetResourceNotificationData(TUid, TDes8 &)

TInt GetResourceNotificationData(TUidaEventType,
TDes8 &aNotificationData
)[inline]

Returns the Notification data which the client needs to resume playing.

Parameters

TUid aEventType
TDes8 & aNotificationDataThe reference data for which the client needs to resume the play. The actual data depends on the event type. Note that for the event type 'KMMFEventCategoryAudioResourceAvailable' the package buffer returned is TMMFTimeIntervalMicroSecondsPckg,but the contents should be converted to an integer and interpreted as the data returned is samples played ,but not as a microsecond value.

GetSupportedInputDataTypesL(RArray< TFourCC > &, const TMMFPrioritySettings &)

voidGetSupportedInputDataTypesL(RArray< TFourCC > &aSupportedDataTypesconst,
const TMMFPrioritySettings &aPrioritySettings
)const [inline]

Returns a list of the supported input datatypes that can be sent to DevSound for playing audio. The datatypes returned are those that the DevSound supports given the priority settings passed in aPrioritySettings. Note that if no supported data types are found this does not constitute failure, the function will return normally with no entries in aSupportedDataTypes.

Parameters

RArray< TFourCC > & aSupportedDataTypesconst
const TMMFPrioritySettings & aPrioritySettingsThe priority settings used to determine the supported datatypes. Note this does not set the priority settings. For input datatypes the iState member of the priority settings would be expected to be either EMMFStatePlaying or EMMFStatePlayingRecording. The priority settings may effect the supported datatypes depending on the audio routing.

GetSupportedOutputDataTypesL(RArray< TFourCC > &, const TMMFPrioritySettings &)

voidGetSupportedOutputDataTypesL(RArray< TFourCC > &aSupportedDataTypes,
const TMMFPrioritySettings &aPrioritySettings
)const [inline]

Returns a list of the supported output dataypes that can be received from DevSound for recording audio. The datatypes returned are those that the DevSound supports given the priority settings passed in aPrioritySettings. Note that if no supported data types are found this does not constitute failure, the function will return normally with no entries in aSupportedDataTypes.

Parameters

RArray< TFourCC > & aSupportedDataTypes
const TMMFPrioritySettings & aPrioritySettings

GetTimePlayed(TTimeIntervalMicroSeconds &)

TInt GetTimePlayed(TTimeIntervalMicroSeconds &aTime)

Parameters

TTimeIntervalMicroSeconds & aTime

InitializeL(MDevSoundObserver &, TMMFState)

voidInitializeL(MDevSoundObserver &aDevSoundObserver,
TMMFStateaMode
)

Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz. On completion of Initialization, calls InitializeComplete() on aDevSoundObserver.

Parameters

MDevSoundObserver & aDevSoundObserver
TMMFState aMode

InitializeL(MDevSoundObserver &, TFourCC, TMMFState)

voidInitializeL(MDevSoundObserver &aDevSoundObserver,
TFourCCaDesiredFourCC,
TMMFStateaMode
)

Initializes DevSound object for the mode aMode for processing audio data with hardware device supporting FourCC aDesiredFourCC.

Parameters

MDevSoundObserver & aDevSoundObserver
TFourCC aDesiredFourCC
TMMFState aMode

IsResumeSupported()

TBool IsResumeSupported()[inline]

MaxGain()

TInt MaxGain()[inline]

Returns an integer representing the maximum gain the device supports. This is the maximum value which can be passed to CMMFDevSound::SetGain

MaxVolume()

TInt MaxVolume()[inline]

Returns an integer representing the maximum volume device supports. This is the maximum value which can be passed to CMMFDevSound::SetVolume.

NewL()

CBody *NewL()[static]

Factory function - returning instance of the class.

Pause()

voidPause()[inline]

Temporarily Stops the ongoing operation (Play, Record, TonePlay).

PlayDTMFStringL(const TDesC &)

voidPlayDTMFStringL(const TDesC &aDTMFString)[inline]

Initializes the audio device and starts playing the DTMF string aDTMFString.

Parameters

const TDesC & aDTMFStringThe DTMF sequence in a descriptor.

PlayData()

voidPlayData()[inline]

Plays data in the buffer at the current volume. The client should fill the buffer with audio data before calling this function. The observer gets a reference to the buffer along with the callback function BufferToBeFilled(). When playing of the audio sample is complete, successfully or otherwise, the function PlayError() on the observer is called. The last buffer of the audio stream being played should have the last buffer flag set using CMMFBuffer::SetLastBuffer(TBool). If a subsequent attempt to play the clip is made, this flag will need resetting by the client.

PlayDualToneL(TInt, TInt, const TTimeIntervalMicroSeconds &)

voidPlayDualToneL(TIntaFrequencyOne,
TIntaFrequencyTwo,
const TTimeIntervalMicroSeconds &aDuration
)[inline]

Initializes audio device and starts playing a dual tone. Dual Tone is played with the specified frequencies and for the specified duration.

Parameters

TInt aFrequencyOneThe first frequency of dual tone.
TInt aFrequencyTwoThe second frequency of dual tone.
const TTimeIntervalMicroSeconds & aDurationThe period over which the tone will be played. A zero value causes the no tone to be played.

PlayInitL()

voidPlayInitL()[inline]

Initializes the audio device and starts the play process. This function queries and acquires the audio policy before initializing audio device. If there was an error during policy initialization, PlayError() function will be called on the observer with error code KErrAccessDenied, otherwise BufferToBeFilled() function will be called with a buffer reference. After reading data into the buffer reference passed, the client should call PlayData() to play data. The amount of data that can be played is specified in CMMFBuffer::RequestSize(). Any data that is read into buffer beyond this size will be ignored.

PlayToneL(TInt, const TTimeIntervalMicroSeconds &)

voidPlayToneL(TIntaFrequency,
const TTimeIntervalMicroSeconds &aDuration
)[inline]

Initializes the audio device and starts playing a tone. The tone is played with the frequency and duration specified. Leaves on failure.

Parameters

TInt aFrequency
const TTimeIntervalMicroSeconds & aDuration

PlayToneSequenceL(const TDesC8 &)

voidPlayToneSequenceL(const TDesC8 &aData)[inline]

Initializes the audio device and starts playing a tone sequence.

Parameters

const TDesC8 & aDataThe tone sequence in a descriptor.

QueryIgnoresUnderflow()

TBool QueryIgnoresUnderflow()

RecordData()

voidRecordData()[inline]

Contine the process of recording. Once the buffer is filled with recorded data, the Observer gets a reference to the buffer along with the callback function BufferToBeEmptied(). After processing the buffer (copying over to a different buffer or writing to file) the client should call this function to continue the recording process.

RecordInitL()

voidRecordInitL()[inline]

Initializes the audio device and starts the record process. This function queries and acquires the audio policy before initializing audio device. If there was an error during policy initialization, RecordError() function will be called on the observer with error code KErrAccessDenied, otherwise BufferToBeEmptied() function will be called with a buffer reference. This buffer contains recorded or encoded data. After processing data in the buffer reference passed, the client should call RecordData() to continue recording process. The amount of data that is available is specified in CMMFBuffer::RequestSize().

RegisterAsClient(TUid, const TDesC8 &)

TInt RegisterAsClient(TUidaEventType,
const TDesC8 &aNotificationRegistrationData =  KNullDesC8
)[inline]

Registers the client for notification of resource avalibility.

Parameters

TUid aEventTypeThe Notification event type for which the client needs notification.
const TDesC8 & aNotificationRegistrationData =  KNullDesC8 The Notification Registration data has been reserved for future use and its value should be always NULL

Resume()

TInt Resume()[inline]

SamplesPlayed()

TInt SamplesPlayed()[inline]

Returns the Sample played so far

SamplesRecorded()

TInt SamplesRecorded()[inline]

Returns the Sample recorded so far

SetClientThreadInfo(TThreadId)

TInt SetClientThreadInfo(TThreadIdaTid)

Parameters

TThreadId aTid

SetConfigL(const TMMFCapabilities &)

voidSetConfigL(const TMMFCapabilities &aCaps)[inline]

Configure CMMFDevSound object with the settings in aConfig. Use this to set sampling rate, encoding and mono/stereo.

Parameters

const TMMFCapabilities & aCaps

SetDTMFLengths(TTimeIntervalMicroSeconds32 &, TTimeIntervalMicroSeconds32 &, TTimeIntervalMicroSeconds32 &)

voidSetDTMFLengths(TTimeIntervalMicroSeconds32 &aToneOnLength,
TTimeIntervalMicroSeconds32 &aToneOffLength,
TTimeIntervalMicroSeconds32 &aPauseLength
)[inline]

Defines the duration of tone on, tone off and tone pause to be used during the DTMF tone playback operation. Supported only during tone playing.

Parameters

TTimeIntervalMicroSeconds32 & aToneOnLengthThe period over which the tone will be played. If this is set to zero, then the tone is not played.
TTimeIntervalMicroSeconds32 & aToneOffLengthThe period over which the no tone will be played.
TTimeIntervalMicroSeconds32 & aPauseLengthThe period over which the tone playing will be paused.

SetGain(TInt)

voidSetGain(TIntaGain)[inline]

Changes the current recording gain to a specified value. The gain can be changed before or during recording and is effective immediately.

Parameters

TInt aGain

SetPlayBalanceL(TInt, TInt)

voidSetPlayBalanceL(TIntaLeftPercentage,
TIntaRightPercentage
)[inline]

Sets the speaker balance for playing. The speaker balance can be changed before or during playback and is effective immediately.

Parameters

TInt aLeftPercentage
TInt aRightPercentage

SetPrioritySettings(const TMMFPrioritySettings &)

voidSetPrioritySettings(const TMMFPrioritySettings &aPrioritySettings)[inline]

Defines the priority settings that should be used for this instance.

Parameters

const TMMFPrioritySettings & aPrioritySettings

SetRecordBalanceL(TInt, TInt)

voidSetRecordBalanceL(TIntaLeftPercentage,
TIntaRightPercentage
)[inline]

Sets the microphone balance for recording. The microphone balance can be changed before or during recording and is effective immediately.

Parameters

TInt aLeftPercentage
TInt aRightPercentage

SetToneRepeats(TInt, const TTimeIntervalMicroSeconds &)

voidSetToneRepeats(TIntaRepeatCount,
const TTimeIntervalMicroSeconds &aRepeatTrailingSilence
)[inline]

Defines the number of times the audio is to be repeated during the tone playback operation. A period of silence can follow each playing of a tone. The tone playing can be repeated indefinitely

Parameters

TInt aRepeatCount
const TTimeIntervalMicroSeconds & aRepeatTrailingSilenceAn interval of silence which will be played after each tone. Supported only during tone playing.

SetVolume(TInt)

voidSetVolume(TIntaVolume)[inline]

Changes the current playback volume to a specified value. The volume can be changed before or during playback and is effective immediately.

Parameters

TInt aVolume

SetVolumeRamp(const TTimeIntervalMicroSeconds &)

voidSetVolumeRamp(const TTimeIntervalMicroSeconds &aRampDuration)[inline]

Defines the period over which the volume level is to rise smoothly from nothing to the normal volume level. The function is only available before playing.

Parameters

const TTimeIntervalMicroSeconds & aRampDurationThe period over which the volume is to rise. A zero value causes the tone sample to be played at the normal level for the full duration of the playback. A value, which is longer than the duration of the tone sample means that the sample never reaches its normal volume level.

Stop()

voidStop()[inline]

Stops the ongoing operation (Play, Record, TonePlay).

SyncCustomCommand(TUid, const TDesC8 &, const TDesC8 &, TDes8 *)

TInt SyncCustomCommand(TUidaUid,
const TDesC8 &aParam1,
const TDesC8 &aParam2,
TDes8 *aOutParam
)[inline]

Implements a synchronous custom command

Parameters

TUid aUidThe UID of the custom command
const TDesC8 & aParam1A buffer of data to be supplied to the receiver
const TDesC8 & aParam2A buffer of data to be supplied to the receiver
TDes8 * aOutParamA buffer that will be written into by the receiver and returned to the client

Volume()

TInt Volume()[inline]

Returns an integer representing the current volume.

WillResumePlay()

TInt WillResumePlay()[inline]

Wait for the clients to resume play back even after the default timeout expires. Unless the client cancels the notification request or completes no other client gets notification.

Member Data Documentation

MDevSoundCIClientExtension * iCIExtension

MDevSoundCIClientExtension *iCIExtension[protected]

RArray< TMMFDevSoundCustomInterfaceData > iCustomInterfaceArray

RArray< TMMFDevSoundCustomInterfaceData >iCustomInterfaceArray[protected]

RMMFDevSoundProxy * iDevSoundProxy

RMMFDevSoundProxy *iDevSoundProxy[protected]

CMMFDevSoundCIMuxUtility * iMuxUtility

CMMFDevSoundCIMuxUtility *iMuxUtility[protected]