Symbian3/SDK/Source/GUID-769CD1E7-8545-5223-A195-43E72AAF5DDC.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
parent 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

<?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 concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-769CD1E7-8545-5223-A195-43E72AAF5DDC"><title>Starting Audio Record </title><shortdesc>This document describes how to start recording audio data. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody><section id="GUID-85C74D40-680A-53B4-B4FF-04EAF246E903"><title>Introduction</title> <p>To record audio data, do the following: </p> <ul><li id="GUID-6D97CCB8-64E9-5654-AFCB-1C78D8EB28AC"><p><xref href="GUID-769CD1E7-8545-5223-A195-43E72AAF5DDC.dita#GUID-769CD1E7-8545-5223-A195-43E72AAF5DDC/GUID-E3F29A89-2FBC-59DC-970E-6507CF970F8A">Constructing and initializing</xref>  </p> </li> <li id="GUID-5F77CB18-512B-5C9C-A91F-4057E516ADD4"><p><xref href="GUID-769CD1E7-8545-5223-A195-43E72AAF5DDC.dita#GUID-769CD1E7-8545-5223-A195-43E72AAF5DDC/GUID-24F9ED80-AA8D-5F74-9EFB-905BD6F9F0BC">Configuring</xref> </p> </li> </ul> <p><b>Constructing and initializing</b> </p> <p>Use the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-088CC167-C46D-3A2B-BE00-D7AEB98254AE"><apiname>CMMFDevSound::NewL()</apiname></xref> method to construct a new instance of DevSound. </p> <p>After construction, use an <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-CBBB4A4E-0705-37E2-9832-A55861ACF299"><apiname>CMMFDevSound::InitializeL()</apiname></xref> method to initialize DevSound to record audio. This method requires that you specify the DevSound observer class to handle callbacks. </p> <p>Once initialization has completed, successfully or otherwise, DevSound calls the <xref href="GUID-D0F3F385-68C9-331D-865F-DA36589BE9FD.dita#GUID-D0F3F385-68C9-331D-865F-DA36589BE9FD/GUID-089CF9C1-92EF-3F40-8669-A5EF5C064AD4"><apiname>MDevSoundObserver::InitializeComplete()</apiname></xref> function. </p> <p><b>Configuring</b> </p> <p>The following settings can be configured before or during recording: </p> <ul><li id="GUID-CB735E74-53A2-54C5-94B6-FC9CA95B0B66"><p>To set the gain of the recording device to a specific value, use the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-039E5508-8205-31FA-9D9B-37E1753F2018"><apiname>CMMFDevSound::SetGain()</apiname></xref> function. The gain 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-60B1493B-90E8-3E26-B744-7FD95DB0E910"><apiname>CMMFDevSound::MaxGain()</apiname></xref>. </p> </li> <li id="GUID-99B40B9A-3C39-5607-AD8F-E30A004AFD6C"><p>To set the microphone gain balance, use the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-F36461AE-6774-3E13-9BED-E871789895AB"><apiname>CMMFDevSound::SetRecordBalanceL()</apiname></xref> function. This function has two parameters: </p> <ul><li id="GUID-DA8BB066-587A-56C5-B8F9-A9030F917D6C"><p> <codeph>aLeftPercentage</codeph> - the left microphone gain percentage. </p> </li> <li id="GUID-90A89BE3-5485-526D-8BF8-334BDF73F026"><p> <codeph>aRightPercentage</codeph> - the right microphone gain percentage. </p> </li> </ul> </li> <li id="GUID-37000BA6-D486-595C-A8D8-00B092DC8229"><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> </section> <section><title>Procedure</title> <ul id="GUID-54ADBD8A-7482-543F-BD5D-85F234CEEB93"><li id="GUID-9A5E2779-ED37-576C-BF8A-CCF53351CB18"><p>Call the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-ECC978D1-B45A-35E4-9A40-F285152023FE"><apiname>CMMFDevSound::RecordInitL()</apiname></xref> function to start audio recording. </p> <p>Once started, audio data is recorded incrementally into a buffer. When there is data in the buffer, use the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-C6E50479-4E8F-33EE-B298-C5D8DE7E3879"><apiname>CMMFDevSound::RecordData()</apiname></xref> method to record the data: </p> <p>Once the buffer is filled with recorded data, DevSound calls the <xref href="GUID-D0F3F385-68C9-331D-865F-DA36589BE9FD.dita#GUID-D0F3F385-68C9-331D-865F-DA36589BE9FD/GUID-0E4EB9DB-B802-3CE0-979A-F41767BFD017"><apiname>MDevSoundObserver::BufferToBeEmptied()</apiname></xref> function. When the recorded data has been read from the buffer, again use the <xref href="GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD.dita#GUID-B3E9B015-1413-35A6-A316-D1C01C1001AD/GUID-C6E50479-4E8F-33EE-B298-C5D8DE7E3879"><apiname>CMMFDevSound::RecordData()</apiname></xref> method. The client must accept audio data through the buffers at a sufficient rate to avoid buffer overflow. </p> </li> </ul> </section> </conbody><related-links><link href="GUID-96B8657D-FC07-5D5C-8ADE-3B2167A9229E.dita"><linktext>Pausing and
                Resuming Audio Record</linktext> </link> <link href="GUID-D67D6147-ECE1-576C-A64C-120F32AE2AA2.dita"><linktext>Stopping Audio
                Record</linktext> </link> <link href="GUID-D0CD890F-36DB-5265-B2C1-8D632EAF736B.dita"><linktext>Retrieving Audio
                Record Samples</linktext> </link> </related-links></concept>