Symbian3/SDK/Source/GUID-A748041F-5925-54F8-AA21-C1CE8E0473AA.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?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-A748041F-5925-54F8-AA21-C1CE8E0473AA"><title>Playing a Tone </title><shortdesc>This tutorial introduces you to play a single tone. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody><context id="GUID-57A12D2A-A008-587A-A2B0-FFC53146638D"><p>You have to configure DevSound in order to play a tone. The following settings can be configured before or during tone play: </p> <ul><li id="GUID-1FE5CE6D-2F97-502E-852A-593636201148"><p>To set the number of times a tone is to be repeated during playback use the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-080489F4-4182-326D-816C-900E8DE6E384"><apiname>CMMFDevSound::SetToneRepeats(TInt,const
                TTimeIntervalMicroSeconds &amp;)</apiname></xref> method. </p> </li> <li id="GUID-30873992-AA8A-5F7A-B787-BBA44F6E0580"><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-3E55CE57-AACB-3CCF-ABD8-FB50A02FC155"><apiname>CMMFDevSound::SetVolume(TInt)</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-8CC8138A-9FD5-3879-81EC-26DADBAF9BD8"><apiname>CMMFDevSound::SetVolumeRamp(const
                TTimeIntervalMicroSeconds &amp;)</apiname></xref> function. </p> <p> <b>Note:</b> The <codeph>CMMFDevSound::SetVolumeRamp()</codeph> function is only available during tone play. </p> </li> <li id="GUID-4E4CBDD6-33B4-57FB-AA3A-BD5D1847FAD8"><p>To set the speaker balance, use the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-AF5037CC-D04C-312F-B821-9DF46D5DBBDE"><apiname>CMMFDevSound::SetPlayBalanceL(TInt,TInt)</apiname></xref> function. </p> </li> <li id="GUID-112F1BC7-7D12-539C-BA9A-2A5B889DDD3E"><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-5401CF97-E5A0-5AC7-9BCD-8733CC69C9CA"><step id="GUID-03077308-77F3-5A4C-B3BA-664BFDB0EEF1"><cmd>Call <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-0849016F-D457-3521-A53A-85023D8561B8"><apiname>CMMFDevSound::PlayToneL(TInt,const
                TTimeIntervalMicroSeconds &amp;)</apiname></xref> to start playing a tone. </cmd> <info>When an attempt to play a tone has completed, successfully or otherwise, DevSound calls the <xref href="GUID-D0F3F385-68C9-331D-865F-DA36589BE9FD.dita#GUID-D0F3F385-68C9-331D-865F-DA36589BE9FD/GUID-F89960BE-A51C-3148-AF19-58303BF5250F"><apiname>MDevSoundObserver::ToneFinished()</apiname></xref> function. </info> <info> Note: Further calls to <codeph>CMMFDevSound::PlayToneL()</codeph> can be made both before and after the <codeph>MDevSoundObserver::ToneFinished()</codeph> call back is received. If subsequent calls are made to <codeph>CMMFDevSound::PlayToneL()</codeph>, only one <codeph>MDevSoundObserver::ToneFinished()</codeph> call back is received. </info> </step> </steps-unordered> <result id="GUID-E5AFA3FF-EC73-58F9-A49F-4721CAD8BD3B"><p>The result of this tutorial is you can play a single tone successfully. </p> </result> <postreq id="GUID-076D021D-12F2-5521-AE1F-F70C5E91062A"><p>When you want to play two tones simultaneously, the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-D2C197B2-BB55-3B46-8F4D-FEDEE846B166"><apiname>CMMFDevSound::PlayDualToneL(TInt,TInt,const TTimeIntervalMicroSeconds
          &amp;)</apiname></xref> function is called instead of <codeph>PlayToneL()</codeph>. <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-AD5A51B8-9A32-39CE-92DE-59D75FD848B3"><apiname>CMMFDevSound::PlayDualToneL</apiname></xref> has an extra parameter, <codeph>aFrequencyTwo</codeph>, to specify the frequency at which the second tone is to be played. </p> </postreq> </taskbody><related-links><link href="GUID-12A754EE-7D90-56C8-BDA7-3293F34BE456.dita"><linktext>Playing a Tone
                Sequence</linktext> </link> <link href="GUID-93EF4862-2395-5ED7-8446-A7FDA60535B1.dita"><linktext>Playing a Fixed Tone
                Sequence</linktext> </link> <link href="GUID-DD8BFFF1-15C7-59B0-A107-C5CC90DBF4CC.dita"><linktext>Pausing and
                Resuming a Tone</linktext> </link> </related-links></task>