CMdaAudioToneUtility Class Reference

#include <mdaaudiotoneplayer.h>

Link against: mediaclientaudio.lib

class CMdaAudioToneUtility : public CBase

Inherits from

  • CMdaAudioToneUtility
    Protected Attributes
    CMMFMdaAudioToneUtility *iProperties
    Public Member Functions
    ~CMdaAudioToneUtility()
    virtual voidCancelPlay()
    virtual voidCancelPrepare()
    IMPORT_C TAny *CustomInterface(TUid)
    virtual TInt FixedSequenceCount()
    virtual const TDesC &FixedSequenceName(TInt)
    IMPORT_C TIntGetBalanceL()
    virtual TInt MaxVolume()
    IMPORT_C CMdaAudioToneUtility *NewL(MMdaAudioToneObserver &, CMdaServer *)
    IMPORT_C CMdaAudioToneUtility *NewL(MMdaAudioToneObserver &, CMdaServer *, TInt, TInt)
    IMPORT_C TIntPause()
    virtual voidPlay()
    virtual voidPrepareToPlayDTMFString(const TDesC &)
    virtual voidPrepareToPlayDesSequence(const TDesC8 &)
    IMPORT_C voidPrepareToPlayDualTone(TInt, TInt, const TTimeIntervalMicroSeconds &)
    virtual voidPrepareToPlayFileSequence(const TDesC &)
    IMPORT_C voidPrepareToPlayFileSequence(RFile &)
    virtual voidPrepareToPlayFixedSequence(TInt)
    virtual voidPrepareToPlayTone(TInt, const TTimeIntervalMicroSeconds &)
    IMPORT_C voidRegisterPlayStartCallback(MMdaAudioTonePlayStartObserver &)
    IMPORT_C TIntResume()
    IMPORT_C voidSetBalanceL(TInt)
    virtual voidSetDTMFLengths(TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32)
    virtual voidSetPriority(TInt, TInt)
    virtual voidSetRepeats(TInt, const TTimeIntervalMicroSeconds &)
    virtual voidSetVolume(TInt)
    virtual voidSetVolumeRamp(const TTimeIntervalMicroSeconds &)
    virtual TMdaAudioToneUtilityState State()
    virtual TInt Volume()
    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()

    Detailed Description

    Generates tones on an audio capable EPOC device.

    The class offers an interface for generating tones on all audio capable EPOC devices.

    To use the tone utility:

    1. Create an instance by calling NewL().

    2. Call the appropriate PrepareToPlay variant for the required tone type and wait for the callback indicating success.

    3. Call Play and either wait for the callback to indicate completion, or call CancelPlay to end playback early.

    4. Delete the instance.

    It is possible to call Play before calling any PrepareToPlay variant. This will result in a default fixed sequence tone being played.

    Since
    5.0

    Member Attribute Documentation

    iProperties

    CMMFMdaAudioToneUtility *iProperties[protected]

    This member is internal and not intended for use.

    Constructor & Destructor Documentation

    ~CMdaAudioToneUtility ( )

    ~CMdaAudioToneUtility()

    Destructor. Frees any resources held by the tone player

    Since
    5.0

    Member Function Documentation

    CancelPlay ( )

    voidCancelPlay()[virtual]

    Cancels the tone playing operation.

    The observer callback function MMdaAudioToneObserver::MatoPlayComplete() is not called.

    Since
    5.0

    CancelPrepare ( )

    voidCancelPrepare()[virtual]

    Cancels the configuration operation.

    The observer callback function MMdaAudioToneObserver::MatoPrepareComplete() is not called.

    Since
    5.0

    CustomInterface ( TUid )

    IMPORT_C TAny *CustomInterface(TUidaInterfaceId)

    Retrieves a custom interface to the underlying device.

    ParameterDescription
    aInterfaceIdThe interface UID, defined with the custom interface.

    Returns: A pointer to the interface implementation, or NULL if the device does not implement the interface requested. The return value must be cast to the correct type by the user.

    FixedSequenceCount ( )

    TInt FixedSequenceCount()[virtual]

    Returns the number of available pre-defined tone sequences.

    Since
    5.0

    Returns: The number of tone sequences. This value is implementation dependent but is always greater than or equal to zero.

    FixedSequenceName ( TInt )

    const TDesC &FixedSequenceName(TIntaSequenceNumber)[virtual]

    Returns the name assigned to a specific pre-defined tone sequence.

    See also: CMMFDevSound::FixedSequenceName(TInt aSequenceNumber) FixedSequenceCount()

    Since
    5.0
    ParameterDescription
    aSequenceNumberThe index identifying the specific pre-defined tone sequence. Index values are relative to zero. This can be any value from zero to the value returned by a call to FixedSequenceCount() - 1. The function raises a panic if sequence number is not within this range.

    Returns: The name assigned to the tone sequence.

    GetBalanceL ( )

    IMPORT_C TIntGetBalanceL()

    Returns The current playback balance.This function may not return the same value as passed to SetBalanceL depending on the internal implementation in the underlying components.

    Since
    7.0s

    Returns: The balance. Should be between KMMFBalanceMaxLeft and KMMFBalanceMaxRight.

    MaxVolume ( )

    TInt MaxVolume()[virtual]

    Returns the maximum volume supported by the device. This is the maximum value which can be passed to CMdaAudioToneUtility::SetVolume().

    Since
    5.0

    Returns: The maximum volume. This value is platform dependent but is always greater than or equal to one.

    NewL ( MMdaAudioToneObserver &, CMdaServer * )

    IMPORT_C CMdaAudioToneUtility *NewL(MMdaAudioToneObserver &aObserver,
    CMdaServer *aServer = NULL
    )[static]

    Creates a new instance of the tone player utility. The default volume is set to MaxVolume() / 2.

    Since
    5.0
    ParameterDescription
    aObserverA class to receive notifications from the tone player.
    aServerThis parameter is no longer used and should be NULL.

    Returns: A pointer to the new audio tone player utility object.

    NewL ( MMdaAudioToneObserver &, CMdaServer *, TInt, TInt )

    IMPORT_C CMdaAudioToneUtility *NewL(MMdaAudioToneObserver &aObserver,
    CMdaServer *aServer,
    TIntaPriority,
    TIntaPref = EMdaPriorityPreferenceTimeAndQuality
    )[static]

    Creates a new instance of the tone player utility. The default volume is set to MaxVolume() / 2.

    Since
    5.0
    Note: The Priority Value and Priority Preference are used primarily when deciding what to do when several audio clients attempt to play or record simultaneously. In addition to the Priority Value and Preference, the adaptation may consider other parameters such as the SecureId and Capabilities of the client process. Whatever, the decision as to what to do in such situations is up to the audio adaptation, and may vary between different phones. Portable applications are advised not to assume any specific behaviour.
    ParameterDescription
    aObserverA class to receive notifications from the tone player
    aServerThis parameter is no longer used and should be NULL
    aPriorityThe Priority Value - this client's relative priority. This is a value between EMdaPriorityMin and EMdaPriorityMax and represents a relative priority. A higher value indicates a more important request.
    aPrefThe Priority Preference - an additional audio policy parameter. The suggested default is EMdaPriorityPreferenceNone. Further values are given by TMdaPriorityPreference, and additional values may be supported by given phones and/or platforms, but should not be depended upon by portable code.

    Returns: A pointer to the new audio tone player utility object.

    Pause ( )

    IMPORT_C TIntPause()

    Play ( )

    voidPlay()[virtual]

    Plays the tone.

    The tone played depends on the current configuration.This function is asynchronous. On completion, the observer callback function MMdaAudioToneObserver::MatoPlayComplete() is called, indicating the success or failure of the play operation.The play operation can be cancelled by calling CMdaAudioToneUtility::CancelPlay().

    Since
    5.0

    PrepareToPlayDTMFString ( const TDesC & )

    voidPrepareToPlayDTMFString(const TDesC &aDTMF)[virtual]

    Configures the audio tone utility player to play a DTMF (Dual-Tone Multi-Frequency) string.

    This function is asynchronous. On completion, the observer callback function MMdaAudioToneObserver::MatoPrepareComplete() is called, indicating the success or failure of the configuration operation. The configuration operation can be cancelled by calling CMdaAudioToneUtility::CancelPrepare(). The configuration operation cannot be started if a play operation is in progress.

    Since
    5.0
    ParameterDescription
    aDTMFA descriptor containing the DTMF string.

    PrepareToPlayDesSequence ( const TDesC8 & )

    voidPrepareToPlayDesSequence(const TDesC8 &aSequence)[virtual]

    Configures the audio tone player utility to play a tone sequence contained in a descriptor.

    This function is asynchronous. On completion, the observer callback function MMdaAudioToneObserver::MatoPrepareComplete() is called, indicating the success or failure of the configuration operation. The configuration operation can be cancelled by calling CMdaAudioToneUtility::CancelPrepare(). The configuration operation cannot be started if a play operation is in progress.

    Since
    5.0
    ParameterDescription
    aSequenceThe descriptor containing the tone sequence. The format of the data is unspecified but is expected to be platform dependent. A device might support more than one form of sequence data.

    PrepareToPlayDualTone ( TInt, TInt, const TTimeIntervalMicroSeconds & )

    IMPORT_C voidPrepareToPlayDualTone(TIntaFrequencyOne,
    TIntaFrequencyTwo,
    const TTimeIntervalMicroSeconds &aDuration
    )

    Configures the audio tone player utility to play a dual tone. The generated tone consists of two sine waves of different frequencies summed together.

    This function is asynchronous. On completion, the observer callback function MMdaAudioToneObserver::MatoPrepareComplete() is called, indicating the success or failure of the configuration operation. The configuration operation can be cancelled by calling CMdaAudioToneUtility::CancelPrepare(). The configuration operation cannot be started if a play operation is in progress.

    Since
    7.0sy
    ParameterDescription
    aFrequencyOneThe first frequency (pitch) of the tone.
    aFrequencyTwoThe second frequency (pitch) of the tone.
    aDurationThe duration of the tone in microseconds.

    PrepareToPlayFileSequence ( const TDesC & )

    voidPrepareToPlayFileSequence(const TDesC &aFileName)[virtual]

    Configures the audio tone player utility to play a tone sequence contained in a file.

    This function is asynchronous. On completion, the observer callback function MMdaAudioToneObserver::MatoPrepareComplete() is called, indicating the success or failure of the configuration operation. The configuration operation can be cancelled by calling CMdaAudioToneUtility::CancelPrepare(). The configuration operation cannot be started if a play operation is in progress.

    Since
    5.0
    ParameterDescription
    aFileNameThe full path name of the file containing the tone sequence. The format of the data is unspecified but is expected to be platform dependent. A device might support more than one form of sequence data.

    PrepareToPlayFileSequence ( RFile & )

    IMPORT_C voidPrepareToPlayFileSequence(RFile &aFile)

    Configures the audio tone player utility to play a tone sequence contained in a file.

    This function is asynchronous. On completion, the observer callback function MMdaAudioToneObserver::MatoPrepareComplete() is called, indicating the success or failure of the configuration operation. The configuration operation can be cancelled by calling CMdaAudioToneUtility::CancelPrepare(). The configuration operation cannot be started if a play operation is in progress.

    Since
    5.0
    ParameterDescription
    aFileA handle to an open file containing the tone sequence. The format of the data is unspecified but is expected to be platform dependent. A device might support more than one form of sequence data.

    PrepareToPlayFixedSequence ( TInt )

    voidPrepareToPlayFixedSequence(TIntaSequenceNumber)[virtual]

    Configures the audio tone player utility to play the specified pre-defined tone sequence.

    This function is asynchronous. On completion, the observer callback function MMdaAudioToneObserver::MatoPrepareComplete() is called, indicating the success or failure of the configuration operation. The configuration operation can be cancelled by calling CMdaAudioToneUtility::CancelPrepare(). The configuration operation cannot be started if a play operation is in progress.

    See also: FixedSequenceCount() CMMFDevSound::PlayFixedSequenceL(TInt aSequenceNumber)

    Since
    5.0
    ParameterDescription
    aSequenceNumberAn index into the set of pre-defined tone sequences. This can be any value from zero to the value returned by a call to FixedSequenceCount() - 1. If the sequence number is not within this range, a panic will be raised when Play() is called later.

    PrepareToPlayTone ( TInt, const TTimeIntervalMicroSeconds & )

    voidPrepareToPlayTone(TIntaFrequency,
    const TTimeIntervalMicroSeconds &aDuration
    )[virtual]

    Configures the audio tone player utility to play a single tone.

    This function is asynchronous. On completion, the observer callback function MMdaAudioToneObserver::MatoPrepareComplete() is called, indicating the success or failure of the configuration operation.The configuration operation can be cancelled by calling CMdaAudioToneUtility::CancelPrepare(). The configuration operation cannot be started if a play operation is in progress.

    Since
    5.0
    ParameterDescription
    aFrequencyThe frequency (pitch) of the tone in Hz.
    aDurationThe duration of the tone in microseconds.

    RegisterPlayStartCallback ( MMdaAudioTonePlayStartObserver & )

    IMPORT_C voidRegisterPlayStartCallback(MMdaAudioTonePlayStartObserver &aObserver)

    Resume ( )

    IMPORT_C TIntResume()

    SetBalanceL ( TInt )

    IMPORT_C voidSetBalanceL(TIntaBalance =  KMMFBalanceCenter )

    Sets the stereo balance for playback.

    Since
    7.0s
    ParameterDescription
    aBalanceThe balance. Should be between KMMFBalanceMaxLeft and KMMFBalanceMaxRight.

    Returns: An error code indicating if the function call was successful. KErrNone on success, otherwise another of the system-wide error codes.

    SetDTMFLengths ( TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32, TTimeIntervalMicroSeconds32 )

    voidSetDTMFLengths(TTimeIntervalMicroSeconds32aToneLength,
    TTimeIntervalMicroSeconds32aToneOffLength,
    TTimeIntervalMicroSeconds32aPauseLength
    )[virtual]

    Changes the duration of DTMF tones, the gaps between DTMF tones and the pauses.

    ParameterDescription
    aToneLengthThe duration of the DTMF tone in microseconds.
    aToneOffLengthThe gap between DTFM tones in microseconds.
    aPauseLengthPauses in microseconds

    SetPriority ( TInt, TInt )

    voidSetPriority(TIntaPriority,
    TIntaPref
    )[virtual]

    Changes the clients priority.

    See also: CMdaAudioToneUtility::NewL()

    Since
    5.0
    ParameterDescription
    aPriorityThe Priority Value.
    aPrefThe Priority Preference.

    SetRepeats ( TInt, const TTimeIntervalMicroSeconds & )

    voidSetRepeats(TIntaRepeatNumberOfTimes,
    const TTimeIntervalMicroSeconds &aTrailingSilence
    )[virtual]

    Sets the number of times the tone sequence is to be repeated during the play operation.

    A period of silence can follow each playing of the tone sequence. The tone sequence can be repeated indefinitely.

    Since
    5.0
    ParameterDescription
    aRepeatNumberOfTimesThe number of times the tone sequence, together with the trailing silence, is to be repeated. If this is set to KMdaRepeatForever, then the tone sequence, together with the trailing silence, is repeated indefinitely. The behaviour is undefined for values other than KMdaRepeatForever, zero and positive.
    aTrailingSilenceThe time interval of the training silence. The behaviour is undefined for values other than zero and positive.

    SetVolume ( TInt )

    voidSetVolume(TIntaVolume)[virtual]

    Changes the volume of the audio device.

    The volume can be changed before or during play and is effective immediately.

    Since
    5.0
    ParameterDescription
    aVolumeThe volume setting. This can be any value from zero to the value returned by a call to CMdaAudioToneUtility::MaxVolume(). Setting a zero value mutes the sound. Setting the maximum value results in the loudest possible sound.

    SetVolumeRamp ( const TTimeIntervalMicroSeconds & )

    voidSetVolumeRamp(const TTimeIntervalMicroSeconds &aRampDuration)[virtual]

    Defines the period over which the volume level is to rise smoothly from nothing to the normal volume level.

    Since
    5.0
    ParameterDescription
    aRampDurationThe period over which the volume is to rise. A zero value causes the tone 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 sequence means that the tone never reaches its normal volume level.

    State ( )

    TMdaAudioToneUtilityState State()[virtual]

    Returns the current state of the audio tone utility.

    Since
    5.0

    Returns: The state of the audio tone utility.

    Volume ( )

    TInt Volume()[virtual]

    Returns an integer representing the current volume of the audio device.

    Since
    5.0

    Returns: The current volume.