CMMFDevSound::CBody Class Reference

class CMMFDevSound::CBody : public CBase

This is the Body for CMMFDevSound .

MMFDevSound.lib

Inherits from

Public Member Functions
~CBody ()
void AsyncCustomCommand ( TUid , TRequestStatus &, const TDesC8 &, const TDesC8 &, TDes8 *)
TInt CancelInitialize ()
TInt CancelRegisterAsClient ( TUid )
TMMFCapabilities Capabilities ()
void CloseCustomInterface ( TInt )
TMMFCapabilities Config ()
TAny * CustomInterface ( TUid )
TInt EmptyBuffers ()
TInt Gain ()
void GetPlayBalanceL ( TInt &, TInt &)
void GetRecordBalanceL ( TInt &, TInt &)
TInt GetResourceNotificationData ( TUid , TDes8 &)
void GetSupportedInputDataTypesL ( RArray < TFourCC > &, const TMMFPrioritySettings &)
void GetSupportedOutputDataTypesL ( RArray < TFourCC > &, const TMMFPrioritySettings &)
TInt GetTimePlayed ( TTimeIntervalMicroSeconds &)
void InitializeL ( MDevSoundObserver &, TMMFState )
void InitializeL ( MDevSoundObserver &, TFourCC , TMMFState )
TBool IsResumeSupported ()
TInt MaxGain ()
TInt MaxVolume ()
CBody * NewL ()
void Pause ()
void PlayDTMFStringL (const TDesC &)
void PlayData ()
void PlayDualToneL ( TInt , TInt , const TTimeIntervalMicroSeconds &)
void PlayInitL ()
void PlayToneL ( TInt , const TTimeIntervalMicroSeconds &)
void PlayToneSequenceL (const TDesC8 &)
TBool QueryIgnoresUnderflow ()
void RecordData ()
void RecordInitL ()
TInt RegisterAsClient ( TUid , const TDesC8 &)
TInt Resume ()
TInt SamplesPlayed ()
TInt SamplesRecorded ()
TInt SetClientThreadInfo ( TThreadId )
void SetConfigL (const TMMFCapabilities &)
void SetDTMFLengths ( TTimeIntervalMicroSeconds32 &, TTimeIntervalMicroSeconds32 &, TTimeIntervalMicroSeconds32 &)
void SetGain ( TInt )
void SetPlayBalanceL ( TInt , TInt )
void SetPrioritySettings (const TMMFPrioritySettings &)
void SetRecordBalanceL ( TInt , TInt )
void SetToneRepeats ( TInt , const TTimeIntervalMicroSeconds &)
void SetVolume ( TInt )
void SetVolumeRamp (const TTimeIntervalMicroSeconds &)
void Stop ()
TInt SyncCustomCommand ( TUid , const TDesC8 &, const TDesC8 &, TDes8 *)
TInt Volume ()
TInt WillResumePlay ()
Protected Member Functions
CBody ()
void ConstructL ()
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 *)

void AsyncCustomCommand ( TUid aUid,
TRequestStatus & aStatus,
const TDesC8 & aParam1,
const TDesC8 & aParam2,
TDes8 * aOutParam
) [inline]

Implements an asynchronous custom command

Parameters

TUid aUid The UID of the custom command
TRequestStatus & aStatus The request status of the active object that will be called upon the completion of the request
const TDesC8 & aParam1 A buffer of data to be supplied to the receiver
const TDesC8 & aParam2 A buffer of data to be supplied to the receiver
TDes8 * aOutParam A 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 ( TUid aEventType ) [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)

void CloseCustomInterface ( TInt aInterfaceId )

Parameters

TInt aInterfaceId

Config()

TMMFCapabilities Config ( ) const [inline]

Returns the current device configuration.

ConstructL()

void ConstructL ( ) [protected]

Symbian constructor

CustomInterface(TUid)

TAny * CustomInterface ( TUid aInterfaceId )

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 ( TUid aInterfaceId ) [protected]

Parameters

TUid aInterfaceId

Gain()

TInt Gain ( ) [inline]

Returns an integer representing the current gain.

GetPlayBalanceL(TInt &, TInt &)

void GetPlayBalanceL ( TInt & aLeftPercentage,
TInt & aRightPercentage
) [inline]

Returns the speaker balance set for playing.

Parameters

TInt & aLeftPercentage
TInt & aRightPercentage

GetRecordBalanceL(TInt &, TInt &)

void GetRecordBalanceL ( TInt & aLeftPercentage,
TInt & aRightPercentage
) [inline]

Returns the microphone gain balance set for recording.

Parameters

TInt & aLeftPercentage On return contains the left microphone gain percentage.
TInt & aRightPercentage On return contains the right microphone gain percentage.

GetResourceNotificationData(TUid, TDes8 &)

TInt GetResourceNotificationData ( TUid aEventType,
TDes8 & aNotificationData
) [inline]

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

Parameters

TUid aEventType
TDes8 & aNotificationData The 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 &)

void GetSupportedInputDataTypesL ( 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 & aPrioritySettings The 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 &)

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

void InitializeL ( MDevSoundObserver & aDevSoundObserver,
TMMFState aMode
)

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)

void InitializeL ( MDevSoundObserver & aDevSoundObserver,
TFourCC aDesiredFourCC,
TMMFState aMode
)

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

void Pause ( ) [inline]

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

PlayDTMFStringL(const TDesC &)

void PlayDTMFStringL ( const TDesC & aDTMFString ) [inline]

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

Parameters

const TDesC & aDTMFString The DTMF sequence in a descriptor.

PlayData()

void PlayData ( ) [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 &)

void PlayDualToneL ( TInt aFrequencyOne,
TInt aFrequencyTwo,
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 aFrequencyOne The first frequency of dual tone.
TInt aFrequencyTwo The second frequency of dual tone.
const TTimeIntervalMicroSeconds & aDuration The period over which the tone will be played. A zero value causes the no tone to be played.

PlayInitL()

void PlayInitL ( ) [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 &)

void PlayToneL ( TInt aFrequency,
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 &)

void PlayToneSequenceL ( const TDesC8 & aData ) [inline]

Initializes the audio device and starts playing a tone sequence.

Parameters

const TDesC8 & aData The tone sequence in a descriptor.

QueryIgnoresUnderflow()

TBool QueryIgnoresUnderflow ( )

RecordData()

void RecordData ( ) [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()

void RecordInitL ( ) [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 ( TUid aEventType,
const TDesC8 & aNotificationRegistrationData =  KNullDesC8
) [inline]

Registers the client for notification of resource avalibility.

Parameters

TUid aEventType The 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 ( TThreadId aTid )

Parameters

TThreadId aTid

SetConfigL(const TMMFCapabilities &)

void SetConfigL ( 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 &)

void SetDTMFLengths ( 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 & aToneOnLength The period over which the tone will be played. If this is set to zero, then the tone is not played.
TTimeIntervalMicroSeconds32 & aToneOffLength The period over which the no tone will be played.
TTimeIntervalMicroSeconds32 & aPauseLength The period over which the tone playing will be paused.

SetGain(TInt)

void SetGain ( TInt aGain ) [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)

void SetPlayBalanceL ( TInt aLeftPercentage,
TInt aRightPercentage
) [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 &)

void SetPrioritySettings ( const TMMFPrioritySettings & aPrioritySettings ) [inline]

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

Parameters

const TMMFPrioritySettings & aPrioritySettings

SetRecordBalanceL(TInt, TInt)

void SetRecordBalanceL ( TInt aLeftPercentage,
TInt aRightPercentage
) [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 &)

void SetToneRepeats ( TInt aRepeatCount,
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 & aRepeatTrailingSilence An interval of silence which will be played after each tone. Supported only during tone playing.

SetVolume(TInt)

void SetVolume ( TInt aVolume ) [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 &)

void SetVolumeRamp ( 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 & aRampDuration The 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()

void Stop ( ) [inline]

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

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

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

Implements a synchronous custom command

Parameters

TUid aUid The UID of the custom command
const TDesC8 & aParam1 A buffer of data to be supplied to the receiver
const TDesC8 & aParam2 A buffer of data to be supplied to the receiver
TDes8 * aOutParam A 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]