diff -r 80ef3a206772 -r 48780e181b38 Symbian3/SDK/Source/GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB.dita --- a/Symbian3/SDK/Source/GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB.dita Fri Jul 16 17:23:46 2010 +0100 +++ b/Symbian3/SDK/Source/GUID-1C499E7D-8099-5BE4-AE46-6143388E6ACB.dita Tue Jul 20 12:00:49 2010 +0100 @@ -9,7 +9,7 @@ --> -Audio Input Streaming Tutorial

This tutorial describes how to use Audio Input Streaming.

Purpose

The purpose of this tutorial is to show you how to open, read and then close an audio input stream.

Required Background

The Audio Input Streaming Overview provides an introduction to Audio Input Streaming.

Introduction

The audio input stream interface class, CMdaAudioInputStream, enables MMF client applications to:

  • 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).

  • specify the priority of the audio stream relative to other clients trying to use the same audio hardware

  • set the sample rate and the number of channels to use for recording.

  • change the gain and channel balance of the input stream.

The low level audio controller stores the audio data in buffers. CMdaAudioInputStream reads these buffers incrementally and does not have to wait until capture is complete.

Using Audio Input Streaming

Typically, using an audio input stream involves the following steps as shown in the sequence diagram below:

The following tasks will be covered in this tutorial:

  • Constructing an audio input stream

  • Opening an audio input stream

  • Getting and setting the stream properties

  • Reading an audio input stream

  • Stopping an audio input stream

Basic Procedure to Construct an Audio Input Stream

The high level step to construct an audio input stream is shown here:

  • The client application creates an audio input stream object using the static function CMdaAudioInputStream::NewL(). 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 MMdaAudioInputStreamCallback to notify it about audio input streaming progress.

    The following code constructs an audio input stream:

    CMdaAudioInputStream* aInputStream; +Audio Input Streaming Tutorial

    This tutorial describes how to use Audio Input Streaming.

    Purpose

    The purpose of this tutorial is to show you how to open, read and then close an audio input stream.

    Required Background

    The Audio Input Streaming Overview provides an introduction to Audio Input Streaming.

    Introduction

    The audio input stream interface class, CMdaAudioInputStream, enables MMF client applications to:

    • 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).

    • specify the priority of the audio stream relative to other clients trying to use the same audio hardware

    • set the sample rate and the number of channels to use for recording.

    • change the gain and channel balance of the input stream.

    The low level audio controller stores the audio data in buffers. CMdaAudioInputStream reads these buffers incrementally and does not have to wait until capture is complete.

    Using Audio Input Streaming

    Typically, using an audio input stream involves the following steps as shown in the sequence diagram below:

    The following tasks will be covered in this tutorial:

    • Constructing an audio input stream

    • Opening an audio input stream

    • Getting and setting the stream properties

    • Reading an audio input stream

    • Stopping an audio input stream

    Basic Procedure to Construct an Audio Input Stream

    The high level step to construct an audio input stream is shown here:

    • The client application creates an audio input stream object using the static function CMdaAudioInputStream::NewL(). 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 MMdaAudioInputStreamCallback to notify it about audio input streaming progress.

      The following code constructs an audio input stream:

      CMdaAudioInputStream* aInputStream; aInputStream = CMdaAudioInputStream::NewL(aCallback, EMdaPriorityNormal, EMdaPriorityPreferenceTimeAndQuality);

      where, aCallback is an MMdaAudioInputStreamCallback object.

    Basic Procedure to Open an Audio Input Stream

    The high level steps to open an audio input stream are shown here:

    1. To open an input stream, use the Open() member function, which provides a pointer to the TMdaPackage object with the required audio settings. You can also open the stream without the audio settings. For example:

      aInputStream->Open(NULL);
    2. Once the stream is open, a MMdaAudioInputStreamCallback::MaiscOpenComplete() is issued to indicate that the stream is ready for use.

      void CIOStreamAudio::MaiscOpenComplete(TInt aError) { ASSERT(iState==EStateOpeningInput);