Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



Audio Tone Player Overview


Purpose

Provides a simple interface for tone generation (synthesized sounds) that enables the playing of tone sequences and DTMF (Dual-Tone Multi-Frequency) strings. The tone player functionality is provided by the CMdaAudioToneUtility class and using this class you can play:

[Top]


Architectural relationships

How the tone player class interacts with other components of MMF is shown below.

Audio tone player overview

Audio tone player overview

The playing of sounds is handled by MMF (Multi-Media framework) and this, in turn, is responsible for managing the interface to audio hardware. On some devices, this may be implemented as a device driver; on others it may be implemented as a connection to a lower level hardware server.

Clients using this API must have an active scheduler running in their thread because the implementation of the API uses active objects and callbacks.

[Top]


Using the tone utility

CMdaAudioToneUtility provides a simple interface to generate single and multiple tones. The tone data can be supplied in a number of ways depending on whether it is a single tone, a DTMF string or a string of non-DTMF tones. Once the tone utility object has been constructed, multiple tones and tone sequences can be played without having to create new instances of the object.

For the purposes of this description, the use of the tone utility has been broken down into the following sections.

[Top]


Construction and preparation

The initial construction of the CMdaAudioToneUtility is performed using NewL(). There are two variants of this function, one creates the tone utility with default priority settings, the second enables you to specify your own settings. The two NewL() functions are shown below:

static CMdaAudioToneUtility* NewL(MMdaAudioToneObserver& aObserver, CMdaServer* aServer=NULL);

static CMdaAudioToneUtility* NewL(MMdaAudioToneObserver& aObserver, CMdaServer* aServer, TInt aPriority, TMdaPriorityPreference aPref=EMdaPriorityPreferenceTimeAndQuality);

Both functions require that you specify an observer class to use to handle the callbacks issued by the prepare, play and cancel play methods.

Note: The CMdaServer* parameters are not used within v7.0s, they are only provided for binary compatibility with previous versions.

Following successful creation of the tone utility, use one of the following prepare methods:

All of the prepare methods are asynchronous. On completion of a prepare, the observer callback function MMdaAudioToneObserver::MatoPrepareComplete() is called, indicating the success or failure of the prepare operation.

Any of the prepare operations can be cancelled by using CancelPrepare().

[Top]


Configuration

Following construction and preparation, configuration adjustments can be made using the methods described below.

[Top]


Playing

Once the tone utility object is created, any type of tone or sequence can be played by first issuing the correct prepare statement and then using Play(). To play another tone or sequence, either wait for MMdaAudioToneObserver::MatoPlayComplete() to be issued after completion of playing the previous tone or sequence, or use CancelPlay() and then issue the relevant prepare statement. Once the prepare has completed successfully, use Play().

The following methods are provided to enable playing of tones and sequences:

[Top]


See also