author | Dominic Pinkman <Dominic.Pinkman@Nokia.com> |
Thu, 21 Jan 2010 18:18:20 +0000 | |
changeset 0 | 89d6a7a84779 |
permissions | -rw-r--r-- |
0
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
1 |
<?xml version="1.0" encoding="utf-8"?> |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
2 |
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
3 |
<!-- This component and the accompanying materials are made available under the terms of the License |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
4 |
"Eclipse Public License v1.0" which accompanies this distribution, |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
5 |
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
6 |
<!-- Initial Contributors: |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
7 |
Nokia Corporation - initial contribution. |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
8 |
Contributors: |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
9 |
--> |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
10 |
<!DOCTYPE concept |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
11 |
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
12 |
<concept xml:lang="en" id="GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB"><title>Audio Input Streaming Tutorial</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This tutorial describes how to use Audio Input Streaming. </p> <section><title>Purpose</title> <p>The purpose of this tutorial is to show you how to open, read and then close an audio input stream. </p> <p><b>Required Background</b> </p> <p>The <xref href="GUID-715E0EA4-8B3D-5DDF-B773-922E367B114F.dita">Audio Input Streaming Overview</xref> provides an introduction to Audio Input Streaming. </p> <p><b>Introduction</b> </p> <p>The audio input stream interface class, <xref href="GUID-92BDB3AF-D9DB-35E2-AC6F-6435D3D1A4D8.dita"><apiname>CMdaAudioInputStream</apiname></xref>, enables MMF client applications to: </p> <ul><li id="GUID-577E976A-11CC-5054-ABDE-522A30B5FDCF"><p>stream audio data from the low level audio controller (which has collected it from a hardware device, such as a microphone) to specified buffers (record audio). </p> </li> <li id="GUID-71E21858-E184-5B07-AE02-EFBE8F823B6E"><p>specify the priority of the audio stream relative to other clients trying to use the same audio hardware </p> </li> <li id="GUID-BA394ADC-BC3F-5896-BAD0-EB24759DBD36"><p>set the sample rate and the number of channels to use for recording. </p> </li> <li id="GUID-1CEAC638-A49F-5A21-91FC-90B6B56522EA"><p>change the gain and channel balance of the input stream. </p> </li> </ul> <p>The low level audio controller stores the audio data in buffers. <xref href="GUID-92BDB3AF-D9DB-35E2-AC6F-6435D3D1A4D8.dita"><apiname>CMdaAudioInputStream</apiname></xref> reads these buffers incrementally and does not have to wait until capture is complete. </p> </section> <section><title>Using Audio Input Streaming </title> <p>Typically, using an audio input stream involves the following steps as shown in the sequence diagram below: </p> <fig id="GUID-FC960A5D-EDE5-5245-A736-6A6C00A0AC33"><image href="GUID-65885916-0242-5DDB-9D88-EB214096C4DF_d0e289206_href.png" placement="inline"/></fig> <p>The following tasks will be covered in this tutorial: </p> <ul><li id="GUID-1E1A247E-3740-5CAB-AEB7-171F455EE429"><p><xref href="GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB.dita#GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB/GUID-196AFBAE-8264-5DE2-994D-F2F06CF5CF3A"> Constructing an audio input stream</xref> </p> </li> <li id="GUID-2744A8AE-A82C-5DAC-8C12-87D9B5ADCA6F"><p><xref href="GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB.dita#GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB/GUID-51B28404-61E7-54E8-9F4E-730315308EA2">Opening an audio input stream</xref> </p> </li> <li id="GUID-98480431-5F02-57D0-9564-7F0FFF2782C8"><p><xref href="GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB.dita#GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB/GUID-4EAC65E0-E108-5BAA-B338-5B19B82D5057"> Getting and setting the stream properties</xref> </p> </li> <li id="GUID-C03B920D-396F-5A44-9A76-77709CE45D2B"><p><xref href="GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB.dita#GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB/GUID-BD91C4E9-9BBA-5442-A72E-01B42160DBDA"> Reading an audio input stream</xref> </p> </li> <li id="GUID-91F3BEEE-52D7-504C-B74D-5C2FB8D59004"><p><xref href="GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB.dita#GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB/GUID-5811A2A0-5793-5FBB-B01A-AD94590955A8">Stopping an audio input stream</xref> </p> </li> </ul> <p id="GUID-196AFBAE-8264-5DE2-994D-F2F06CF5CF3A"><b>Basic Procedure to Construct an Audio Input Stream</b> </p> <p>The high level step to construct an audio input stream is shown here: </p> <ul><li id="GUID-DDD98263-FD3A-5057-8E35-72D237807343"><p>The client application creates an audio input stream object using the static function <xref href="GUID-92BDB3AF-D9DB-35E2-AC6F-6435D3D1A4D8.dita#GUID-92BDB3AF-D9DB-35E2-AC6F-6435D3D1A4D8/GUID-D534A585-D2B7-3906-AD82-E14A5FC1D501"><apiname>CMdaAudioInputStream::NewL()</apiname></xref>. The input stream class provides two versions of the constructor: one with the default priority and preferences, and another with specified priority and preferences. The client application must also implement the observer class <xref href="GUID-6A1EAD31-95CA-3CAC-8897-791E9D522DF0.dita"><apiname>MMdaAudioInputStreamCallback</apiname></xref> to notify it about audio input streaming progress. </p> <p>The following code constructs an audio input stream: </p> <codeblock id="GUID-0749EB33-33FA-5B58-856B-99F96AB9E3A2" xml:space="preserve">CMdaAudioInputStream* aInputStream; |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
13 |
aInputStream = CMdaAudioInputStream::NewL(aCallback, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);</codeblock> <p>where, <codeph>aCallback</codeph> is an <xref href="GUID-6A1EAD31-95CA-3CAC-8897-791E9D522DF0.dita"><apiname>MMdaAudioInputStreamCallback</apiname></xref> object. </p> </li> </ul> <p id="GUID-51B28404-61E7-54E8-9F4E-730315308EA2"><b>Basic Procedure to Open an Audio Input Stream</b> </p> <p>The high level steps to open an audio input stream are shown here: </p> <ol id="GUID-67E0F7C7-E2E3-5882-A21F-254CB2EEBDA3"><li id="GUID-B3AE7481-9750-5352-B10B-D51D1A220F97"><p>To open an input stream, use the <xref href="GUID-20D0D10F-3401-3F72-8AF6-DC35F6025DC2.dita"><apiname>Open()</apiname></xref> member function, which provides a pointer to the <xref href="GUID-06892E22-2EAC-305A-9D3A-F24E7F903427.dita"><apiname>TMdaPackage</apiname></xref> object with the required audio settings. You can also open the stream without the audio settings. For example: </p> <codeblock id="GUID-96065C5F-54F6-59D7-B6F1-BDE71EF46303" xml:space="preserve">aInputStream->Open(NULL);</codeblock> </li> <li id="GUID-8D443EF2-2FD1-5DBD-BEB3-21C5B7855978"><p>Once the stream is open, a <xref href="GUID-6A1EAD31-95CA-3CAC-8897-791E9D522DF0.dita#GUID-6A1EAD31-95CA-3CAC-8897-791E9D522DF0/GUID-1F9A4EAF-EE58-3FA4-8707-D8C5EDFC0664"><apiname>MMdaAudioInputStreamCallback::MaiscOpenComplete()</apiname></xref> is issued to indicate that the stream is ready for use. </p> <codeblock id="GUID-20F93B48-6662-59F1-A61B-374565A2FCB2" xml:space="preserve">void CIOStreamAudio::MaiscOpenComplete(TInt aError) |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
14 |
{ |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
15 |
ASSERT(iState==EStateOpeningInput); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
16 |
if (aError!=KErrNone) |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
17 |
{ |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
18 |
Complete(aError); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
19 |
} |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
20 |
else |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
21 |
{ |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
22 |
iMainBuffer.Zero(); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
23 |
iState = EStateReading; |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
24 |
ReadNextBlock(KNullDesC8); // kick off a new read - KNullDesC8 for first buffer |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
25 |
} |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
26 |
}</codeblock> </li> </ol> <p id="GUID-4EAC65E0-E108-5BAA-B338-5B19B82D5057"><b>Basic Procedure to Get and Set Stream Properties </b> </p> <p>The high level steps to get and set stream properties are shown here: </p> <ol id="GUID-98A49133-59B7-5681-9EC0-C19B1D71E9DD"><li id="GUID-DD84E50F-B44A-5ADC-ADF5-5DDE561D9AFD"><p>To set the sampling rate and number of audio channels, use the <xref href="GUID-38034819-8999-3EBE-9833-479D96D5DAB6.dita"><apiname>SetAudioPropertiesL()</apiname></xref> member function. You can do this only if the stream is open and if data is not being streamed. Values must be specified as enum values. For example, <xref href="GUID-CF54F882-E290-3C68-9352-79C6B7303FDF.dita#GUID-CF54F882-E290-3C68-9352-79C6B7303FDF/GUID-681C1220-0CDD-34BF-848F-9DC82CB001DB"><apiname>TMdaAudioDataSettings::ESampleRate8000Hz</apiname></xref> and not <codeph>8000</codeph> (Hz). The following code sets the sampling rate to 8000Hz and audio channel to mono: </p> <codeblock id="GUID-EBC071A0-A461-5000-80E5-D3579E690D18" xml:space="preserve">aInputStream->SetAudioPropertiesL(TMdaAudioDataSettings::ESampleRate8000Hz,TMdaAudioDataSettings::EChannelsMono));</codeblock> </li> <li id="GUID-EE508886-465A-581D-9FAF-76B5C522433F"><p>The <xref href="GUID-F4CC52C5-414A-3CA9-8472-A5C5298AC412.dita"><apiname>Gain()</apiname></xref> and <xref href="GUID-C2B76645-A50F-3DFF-943B-4F3D5A33ED31.dita"><apiname>GetBalanceL()</apiname></xref> member functions let you determine the current gain and balance settings. </p> </li> <li id="GUID-AEABCD16-7828-5DA1-B234-58BF44FB9C0E"><p>The <xref href="GUID-54851704-F44B-3C2C-B3C9-2B4537AD1472.dita"><apiname>SetGain()</apiname></xref> and <xref href="GUID-D1856981-6A17-3CD9-80B5-65781A803BA4.dita"><apiname>SetBalanceL()</apiname></xref> member functions let you set the gain and balance respectively. You can use them while the stream is open, with the new settings taking immediate effect. </p> </li> </ol> <p id="GUID-BD91C4E9-9BBA-5442-A72E-01B42160DBDA"><b>Basic Procedure to Read an Audio Input Stream</b> </p> <p>The high level steps to read an audio input stream are shown here: </p> <ol id="GUID-D78033B0-4918-51B8-8DC0-8B55F0172AC3"><li id="GUID-47C7BE03-0EAA-5C19-8FBB-7723B2AA9DEC"><p>To record the audio stream, use the <xref href="GUID-D7A48ABE-33F7-333E-8F57-0E673DA4B6F5.dita"><apiname>ReadL()</apiname></xref> member function, specifying the buffer to use. The first <xref href="GUID-D7A48ABE-33F7-333E-8F57-0E673DA4B6F5.dita"><apiname>ReadL()</apiname></xref> after a successful <xref href="GUID-20D0D10F-3401-3F72-8AF6-DC35F6025DC2.dita"><apiname>Open()</apiname></xref>, starts audio recording. Once the buffer is successfully recorded, a pointer to it is returned by <xref href="GUID-6A1EAD31-95CA-3CAC-8897-791E9D522DF0.dita#GUID-6A1EAD31-95CA-3CAC-8897-791E9D522DF0/GUID-FB4EC66A-4B6D-331B-B5A1-4605084343B0"><apiname>MMdaAudioInputStreamCallback::MaiscBufferCopied()</apiname></xref> callback. </p> <codeblock id="GUID-362E4E39-294E-57B9-912D-D0EB2C7B0B9B" xml:space="preserve">void CIOStreamAudio::MaiscBufferCopied(TInt aError, const TDesC8& aBuffer) |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
27 |
{ |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
28 |
ASSERT(iState==EStateReading); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
29 |
if (aError!=KErrNone) |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
30 |
{ |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
31 |
if (aError!=KErrAbort) // aborts happen on Stop as buffers are recovered, need to ignore |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
32 |
{ |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
33 |
Complete(aError); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
34 |
} |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
35 |
} |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
36 |
else |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
37 |
{ |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
38 |
ReadNextBlock(aBuffer); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
39 |
} |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
40 |
}</codeblock> </li> <li id="GUID-CD08610E-0AFE-5730-BC3A-8F112FF54EE5"><p>The following code reads the next audio block into the buffer in an array of descriptors: </p> <codeblock id="GUID-7E4D79D2-34DC-5691-865A-6C472B766BF8" xml:space="preserve">void CIOStreamAudio::ReadNextBlock(const TDesC8& aBuffer) |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
41 |
{ |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
42 |
ASSERT(iState==EStateReading); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
43 |
// buffer will be tail of iMainBuffer. Shift latter's length and get the next bit |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
44 |
TInt lengthRecorded = iMainBuffer.Length()+aBuffer.Length(); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
45 |
iMainBuffer.SetLength(lengthRecorded); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
46 |
iBufferPtr.Set(const_cast<TUint8*>(iMainBuffer.Ptr())+lengthRecorded, 0, iMainBuffer.MaxLength()-lengthRecorded); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
47 |
TRAPD(error, iInputStream->ReadL(iBufferPtr)); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
48 |
if (error!=KErrNone) |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
49 |
{ |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
50 |
Complete(error); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
51 |
} |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
52 |
}</codeblock> </li> </ol> <p id="GUID-5811A2A0-5793-5FBB-B01A-AD94590955A8"><b>Basic Procedure to Stop an Audio Input Stream</b> </p> <p>The high level steps to stop an audio input stream are shown here: </p> <ul><li id="GUID-43677A50-198B-59D5-8F58-39C96CFAC5A4"><p>To stop recording the audio stream, use the <xref href="GUID-7CBDCF0D-1D11-34D1-BF5C-1E5B50DA75B5.dita"><apiname>Stop()</apiname></xref> member function. Two callbacks are issued after a <codeph>Stop()</codeph>. </p> <ol id="GUID-591B7B4E-899D-5D28-B33D-3EFC2DE1B4D6"><li id="GUID-EE9F9106-E0E8-5C20-8D8E-CB2A9FCCD0C4"><p>An <xref href="GUID-6A1EAD31-95CA-3CAC-8897-791E9D522DF0.dita#GUID-6A1EAD31-95CA-3CAC-8897-791E9D522DF0/GUID-FB4EC66A-4B6D-331B-B5A1-4605084343B0"><apiname>MMdaAudioInputStreamCallback::MaiscBufferCopied()</apiname></xref> pointing to a buffer that contains the last of the recorded audio data (and an <codeph>aError</codeph> value of <codeph>KErrAbort</codeph>). </p> </li> <li id="GUID-E3EBC7BE-C12C-527C-BF33-3EF787D8F9F4"><p>An <xref href="GUID-6A1EAD31-95CA-3CAC-8897-791E9D522DF0.dita#GUID-6A1EAD31-95CA-3CAC-8897-791E9D522DF0/GUID-23F823E5-46A4-34D1-A7DD-DF6B18C37445"><apiname>MMdaAudioInputStreamCallback::MaiscRecordComplete()</apiname></xref>, indicating successful closure of the audio stream. </p> <codeblock id="GUID-A9CE4580-E981-56E8-B98B-05C84E3C746E" xml:space="preserve">void CIOStreamAudio::MaiscRecordComplete(TInt aError) |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
53 |
{ |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
54 |
ASSERT(iState==EStateReading && aError!=KErrNone); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
55 |
Complete(aError); |
89d6a7a84779
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff
changeset
|
56 |
}</codeblock> </li> </ol> </li> </ul> </section> <section><title>See Also</title> <p><xref href="GUID-ECBA6331-2187-52C9-A5DF-20CD1EEFE781.dita">Audio Output Streaming Tutorial</xref> </p> </section> </conbody></concept> |