Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



How to play audio

To play audio data, 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 audio. 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 audio play:

[Top]


Playing

To start the play process, use the CMMFDevSound::PlayInitL() method:

IMPORT_C void PlayInitL();

Once started, audio data is played incrementally from a buffer. When there is data in the buffer, use the CMMFDevSound::PlayData() method to play the data:

IMPORT_C void PlayData();

When more data is needed for playing, DevSound calls the MDevSoundObserver::BufferToBeFilled() function. When the new data has been read into the buffer, again use the CMMFDevSound::PlayData() method. The client must supply audio data through the buffers at a sufficient rate to avoid buffer underflow.

Note: The CMMFDevSound::PlayInitL() and CMMFDevSound::PlayData() methods are pseudo-asynchronous. They result in an MDevSoundObserver callback that can occur in context (before the method has returned) or out of context (after the method has returned).