Week 23 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE task
PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task xml:lang="en" id="GUID-12A754EE-7D90-56C8-BDA7-3293F34BE456"><title>Playing a Tone Sequence</title><shortdesc>This tutorial describes how to play a sequence of tones. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody><context id="GUID-AF70F5DC-DF94-56FB-AA54-3FEE4C54E15E"><p>You have to configure DevSound for playing a tone sequence. </p> <p>The following settings can be configured before or during tone play: </p> <ul><li id="GUID-3CC1E36E-B934-5920-A4CC-B3DB5A0F3715"><p>To change the volume of the audio device to a specific value, use the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-C93E8531-F569-3F6B-AE65-A36749FCE7DF"><apiname>CMMFDevSound::SetVolume()</apiname></xref> function. The volume can be set to any value from 0 to <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-1BFCB3CB-17C7-399B-9089-3ADFF43044BA"><apiname>CMMFDevSound::MaxVolume()</apiname></xref>. </p> <p>To define a period over which the volume rises from 0 to the normal volume level, use the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-AF47B65D-DEFA-3D11-B6AB-2DC876D25EF7"><apiname>CMMFDevSound::SetVolumeRamp()</apiname></xref> function. </p> <p> <b>Note:</b> The <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-AF47B65D-DEFA-3D11-B6AB-2DC876D25EF7"><apiname>CMMFDevSound::SetVolumeRamp()</apiname></xref> function is only available during tone play. </p> </li> <li id="GUID-1C82D0A6-6D44-56F0-970B-4CF1FF8F9401"><p>To set the speaker balance, use the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-0D55BCC4-9882-3F49-B1AD-922B48264F79"><apiname>CMMFDevSound::SetPlayBalanceL()</apiname></xref> function. This function has two parameters: </p> <ul><li id="GUID-4468CBE6-AD40-5B56-94BA-F070A0A45B64"><p> <codeph>aLeftPercentage</codeph> - the left speaker volume percentage. </p> </li> <li id="GUID-A3C8E4FD-F7AE-595C-9CD5-8950C14221E3"><p> <codeph>aRightPercentage</codeph> - the right speaker volume percentage. </p> </li> </ul> </li> <li id="GUID-B2CC953C-CC77-54D2-B710-EA3EC10824DC"><p>To set the priority setting for this instance of DevSound to access the audio device, use the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-1B3B1694-EED8-3B33-B424-C48DDAFBE75A"><apiname>CMMFDevSound::SetPrioritySettings()</apiname></xref> method. Priority settings are used by the Audio Policy component to resolve multiple requests to access the audio hardware. </p> </li> </ul> </context> <steps-unordered id="GUID-6080B137-1DF1-50E1-BA7B-659114F628FA"><step id="GUID-E7AE6985-7474-5302-8568-45492F65810F"><cmd/><info>Call the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-2B48CD01-DBD9-3669-8F79-0812FA03B0D3"><apiname>CMMFDevSound::PlayToneSequenceL(const TDesC8
&)</apiname></xref> function to start playing a tone sequence. </info> <info>This method has one parameter, <codeph>&aData</codeph>, the tone sequence that is to be played. </info> </step> <step id="GUID-3F5A56CC-89E1-5335-B24C-FFA099C571D5"><cmd/><info>Call the <xref href="GUID-D0F3F385-68C9-331D-865F-DA36589BE9FD.dita#GUID-D0F3F385-68C9-331D-865F-DA36589BE9FD/GUID-8AD3FCA2-84C3-3BFC-B0A9-CEAF132D0BF5"><apiname>MDevSoundObserver::ToneFinished(TInt)</apiname></xref> function to complete successfully a tone sequence playing. If a tone sequence is not valid, <codeph>MDevSoundObserver::ToneFinished(TInt)</codeph> returns with an error of <codeph>KErrCorrupt</codeph>. </info> <info> Note: Further calls to <codeph>CMMFDevSound::PlayToneSequenceL(const TDesC8 &)</codeph> can be made both before and after the <codeph>MDevSoundObserver::ToneFinished(TInt)</codeph> callback is received. </info> </step> </steps-unordered> </taskbody><related-links><link href="GUID-DD8BFFF1-15C7-59B0-A107-C5CC90DBF4CC.dita"><linktext>Pausing and
Resuming a Tone</linktext> </link> </related-links></task>