mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Inc/AdvancedAudioInput.h
changeset 0 71ca22bcf22a
child 12 2eb3b066cc7d
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  This file contains the base class from which specific audio
       
    15 *                input classes are derived. This class encapsulates common
       
    16 *                behavior for all audio inputs. An audio input class serves as
       
    17 *                the interface between the controller and the lower-level sound
       
    18 *                gathering interface.
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 #ifndef CADVANCEDAUDIOINPUT_H
       
    25 #define CADVANCEDAUDIOINPUT_H
       
    26 
       
    27 //  INCLUDES
       
    28 #include <e32base.h>
       
    29 //#include <e32std.h>
       
    30 //#include <MmfControllerFrameworkBase.h>
       
    31 //#include <MmfControllerFramework.h>
       
    32 //#include <MmfBase.h>
       
    33 //#include <MmfPanicCodes.h>
       
    34 #include "AdvancedAudioEncoder.h"
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 * Mixin observer class to define an object capable of handling a callback from
       
    40 * AdvancedAudioInput.
       
    41 *
       
    42 * @lib AdvancedAudioInput.lib
       
    43 * @since 3.0
       
    44 */
       
    45 class MAdvancedAudioInputObserver
       
    46     {
       
    47     public:
       
    48         /**
       
    49         * Callback function from CDevSoundAudioInput when the given buffer needs to
       
    50         * be emptied (written to external storage)
       
    51         * @param   aBuffer  data buffer to be emptied
       
    52         * @return  errCode  KErrNone (0)
       
    53         */
       
    54         virtual TInt EmptyBufferL( CMMFBuffer* aBuffer ) = 0;
       
    55 
       
    56         /**
       
    57         * Callback function from CDevSoundAudioInput to indicate recording is completed
       
    58         * @param   none
       
    59         * @return  void
       
    60         */
       
    61         virtual void RecordComplete() = 0;
       
    62 
       
    63         /**
       
    64         * Callback function from CDevSoundAudioInput to handle specified event
       
    65         * @param   aEvent  the event to be handled
       
    66         * @return  void
       
    67         */
       
    68         virtual void SendEvent( const TMMFEvent& aEvent ) = 0;
       
    69     };
       
    70 
       
    71 /**
       
    72 *  This is the base class for all audio input classes used for recording.
       
    73 *  It contains common behaviour for all audio Inputs. The audio Input class
       
    74 *  provides the interface between the Controller and audio input device.
       
    75 *
       
    76 *  @lib AdvancedAudioController.lib
       
    77 *  @since 3.0
       
    78 */
       
    79 class CAdvancedAudioInput : public CBase,
       
    80 							public MAdvancedAudioEncoderObserver
       
    81     {
       
    82     public: // New functions
       
    83 
       
    84         /**
       
    85         * Prepares DevSound Audio Input for recording
       
    86         * @since 3.0
       
    87         * @param   none
       
    88         * @return  none
       
    89         */
       
    90         IMPORT_C virtual void PrimeL() = 0;
       
    91 
       
    92         /**
       
    93         * Handles request to pause recording. Sends pause command to DevSound.
       
    94         * @since 3.0
       
    95         * @param   none
       
    96         * @return  none
       
    97         */
       
    98         IMPORT_C virtual void PauseL() = 0;
       
    99 
       
   100         /**
       
   101         * Handles request to start recording. Configures and initializes DevSound and
       
   102         * sends first buffer of audio data to DevSound,
       
   103         * @since 3.0
       
   104         * @param   none
       
   105         * @return  none
       
   106         */
       
   107         IMPORT_C virtual void RecordL( TAny* aBuffer ) = 0;
       
   108 
       
   109         /**
       
   110         * Handles request to stop recording. Sends stop command to DevSound.
       
   111         * @since 3.0
       
   112         * @param   none
       
   113         * @return  none
       
   114         */
       
   115         IMPORT_C virtual void StopL() = 0;
       
   116 
       
   117         /**
       
   118         * Handles request to set the maximum gain. The new value is sent to DevSound.
       
   119         * @since 3.0
       
   120         * @param   none
       
   121         * @return  the maximum gain value
       
   122         */
       
   123         IMPORT_C virtual TInt MaxGainL() = 0;
       
   124 
       
   125         /**
       
   126         * Handles request to set gain. The new value is sent to DevSound.
       
   127         * @since 3.0
       
   128         * @param   @param   aGain  new gain value
       
   129         * @return  void
       
   130         */
       
   131         IMPORT_C virtual void SetGainL( TInt aGain ) = 0;
       
   132 
       
   133         /**
       
   134         * Handles request to get the current gain. The current gain is obtained from DevSound.
       
   135         * @since 3.0
       
   136         * @param   void
       
   137         * @return  the current gain value
       
   138         */
       
   139         IMPORT_C virtual TInt GainL() = 0;
       
   140 
       
   141         /**
       
   142         * Handles request to get all configured sampling rates from DevSound.
       
   143         * This is a request for all sampling rates that DevSound is currently
       
   144         * configured with.
       
   145         * @since 3.0
       
   146         * @param   aRates  array to hold the retrieved sampling rates
       
   147         * @return  void
       
   148         */
       
   149         IMPORT_C virtual void ConfigRatesL( RArray<TUint>& aRates ) = 0;
       
   150 
       
   151         /**
       
   152         * Handles request to get all configured channels from DevSound.
       
   153         * This is a request for all channels that DevSound is currently
       
   154         * configured with.
       
   155         * @since 3.0
       
   156         * @param   aChannels  array to hold the retrieved channels
       
   157         * @return  void
       
   158         */
       
   159         IMPORT_C virtual void ConfigChannelsL( RArray<TUint>& aChannels ) = 0;
       
   160 
       
   161         /**
       
   162         * Handles request to get all configured data types (FourCC) from DevSound.
       
   163         * This is a request for all data types that DevSound is currently
       
   164         * configured with.
       
   165         * @since 3.0
       
   166         * @param   aDataTypes  array to hold the retrieved data types
       
   167         * @return  void
       
   168         */
       
   169         IMPORT_C virtual void ConfigDataTypesL( RArray<TFourCC>& aDataTypes ) = 0;
       
   170 
       
   171         /**
       
   172         * Handles request to get all capablities sampling rates from DevSound.
       
   173         * This contains all sampling rates DevSound is capable of supporting
       
   174         * @since 3.0
       
   175         * @param   aRates  array to hold the retrieved sampling rates
       
   176         * @return  void
       
   177         */
       
   178         IMPORT_C virtual void CapabilitiesRatesL( RArray<TUint>& aRates ) = 0;
       
   179 
       
   180         /**
       
   181         * Handles request to get all capabilities channels from DevSound.
       
   182         * This is a request for all channels that DevSound is capable of
       
   183         * supporting.
       
   184         * @since 3.0
       
   185         * @param   aChannels  array to hold the retrieved channels
       
   186         * @return  void
       
   187         */
       
   188         IMPORT_C virtual void CapabilitiesChannelsL( RArray<TUint>& aChannels ) = 0;
       
   189 
       
   190         /**
       
   191         * Handles request to get all capabilities data types (FourCC) from DevSound.
       
   192         * This is a request for all data types that DevSound is capable of
       
   193         * supporting.
       
   194         * @since 3.0
       
   195         * @param   aDataTypes  array to hold the retrieved channels
       
   196         * @return  void
       
   197         */
       
   198         IMPORT_C virtual void CapabilitiesDataTypesL( RArray<TFourCC>& aDataTypes ) = 0;
       
   199 
       
   200         /**
       
   201         *
       
   202         * Handles request to calculate current record position in terms to micro seconds
       
   203         * @since 3.0
       
   204         * @param   none
       
   205         * @return  Current position in microseconds
       
   206         */
       
   207         IMPORT_C virtual TInt64 CalculateAudioInputPositionL() const = 0;
       
   208 
       
   209         /**
       
   210         * Handles request to configure DevSound with the given parameters.
       
   211         * @since 3.0
       
   212         * @param   aSampleRate       recording sampling rate
       
   213         * @param   aNumChannel       required number of channels (mono/stereo indication)
       
   214         * @param   aFourCC           FourCC of required recording format
       
   215         * @param   aCodecConfigData  specific codec configuration data
       
   216         * @return  void
       
   217         *
       
   218         */
       
   219         IMPORT_C virtual void ConfigureL( TUint aSampleRate, TUint aNumChannel, TFourCC aFourCC,
       
   220                                           const RArray<TInt>& aCodecConfigData ) = 0;
       
   221 
       
   222         /**
       
   223         * Sets the Encoder instance to be used by the audio input.
       
   224         * @since 3.0
       
   225         * @param aEncoder Encoder instance
       
   226         * @return void
       
   227         */
       
   228         IMPORT_C virtual void SetEncoder( CAdvancedAudioEncoder* aEncoder ) = 0;
       
   229 
       
   230         /**
       
   231         * Sets the bit rate to be used by the audio input.
       
   232         * @since 3.0
       
   233         * @param   aBitRate          recording bit rate
       
   234         * @param   aCodecConfigData  specific codec configuration data
       
   235         * @return void
       
   236         */
       
   237         IMPORT_C virtual void SetBitRateL( TUint aBitRate, const RArray<TInt>& aCodecConfigData ) = 0;
       
   238 
       
   239 	protected: // Data
       
   240 
       
   241         // pointer to AdvancedAudioInput observer
       
   242         MAdvancedAudioInputObserver* iObserver;
       
   243 
       
   244         // pointer to an audio encoder
       
   245         CAdvancedAudioEncoder* iAdvancedAudioEncoder;
       
   246 	};
       
   247 
       
   248 #endif		// CADVANCEDAUDIOINPUT_H