Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



How to play a tone

To play a tone do the following:


Constructing and initializing

Use the CMMFDevSound::NewL() method to construct a new instance of DevSound.

After construction, use an CMMFDevSound::InitializeL() method to initialize DevSound to play tones. This method requires that you specify the DevSound observer class to handle callbacks.

Once initialization has completed, successfully or otherwise, DevSound calls the MDevSoundObserver::InitializeComplete() function.

[Top]


Configuring

The following settings can be configured before or during tone play:

[Top]


Playing

To start playing a tone, use the CMMFDevSound::PlayToneL() method:

IMPORT_C void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds &aDuration);

This method has two parameters:

Tip: If you want to play two tones simultaneously, the CMMFDevSound::PlayDualToneL method can be called instead of CMMFDevSound::PlayToneL(). CMMFDevSound::PlayDualToneL has an extra parameter, aFrequencyTwo, to specify the frequency at which the second tone is to be played.

When an attempt to play a tone has completed, successfully or otherwise, DevSound calls the MDevSoundObserver::ToneFinished() function.

Note: Further calls to CMMFDevSound::PlayToneL() can be made both before and after the MDevSoundObserver::ToneFinished() callback is received. If subsequent calls are made to CMMFDevSound::PlayToneL(), only one MDevSoundObserver::ToneFinished() callback is received.