mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/AdvancedAudioController/Inc/AdvancedAudioOutput.h
changeset 0 71ca22bcf22a
child 18 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 *                output classes are derived. This class encapsulates common
       
    16 *                behavior for all audio outputs. An audio output class serves as
       
    17 *                the interface between the controller and the lower-level sound
       
    18 *                producing interface.
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 
       
    24 #ifndef CADVANCEDAUDIOOUTPUT_H
       
    25 #define CADVANCEDAUDIOOUTPUT_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 "AdvancedAudioDecoder.h"
       
    35 #include "DataSourceAdapter.h"
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40 * Mixin observer class to define an object capable of handling a callback from
       
    41 * AdvancedAudioOutput.
       
    42 *
       
    43 * @lib AdvancedAudioOutput.lib
       
    44 * @since 3.0
       
    45 */
       
    46 class MAdvancedAudioOutputObserver
       
    47     {
       
    48     public:
       
    49         /**
       
    50         *
       
    51         * Callback function from CAdvaincedAudioOuput when the given buffer needs to
       
    52         * be refilled (read to external storage)
       
    53         * @param   refillBuffer  data buffer to be filled with new data
       
    54         * @return  errCode  KErrNone (0)
       
    55         *
       
    56         */
       
    57         virtual TInt RefillBuffer( CMMFBuffer* aRefillBuffer/*, TBool aDoSynchronousRead = EFalse */) = 0;
       
    58 
       
    59         /**
       
    60         *
       
    61         * Callback function from CAdvancedAudioOuput to indicate playback is completed
       
    62         * @param   none
       
    63         * @return  void
       
    64         *
       
    65         */
       
    66         virtual void PlaybackComplete() = 0;
       
    67 
       
    68         /**
       
    69         *
       
    70         * Callback function from CDevSoundAudioInput to handle specified event
       
    71         * @param   aEvent  the event to be handled
       
    72         * @return  void
       
    73         *
       
    74         */
       
    75         virtual void SendEvent( const TMMFEvent& aEvent ) = 0;
       
    76 
       
    77         /**
       
    78         *
       
    79         * Callback function from CAdvancedAudioOuput when lastbuffer is sent 
       
    80         * during a loopplay by setting the Last Buffer flag to EFalse
       
    81         * @param   none
       
    82         * @return  void
       
    83         *
       
    84         */
       
    85         virtual void LastBufferSent() = 0;
       
    86     };
       
    87 
       
    88 
       
    89 /**
       
    90 *  This is the base class for all audio output classes, used for playback.
       
    91 *  It contains common behaviour for all audio outputs. The audio output class
       
    92 *  provides the interface between the Controller and the sound output device.
       
    93 *
       
    94 *  @lib AdvancedAudioController.lib
       
    95 *  @since 3.0
       
    96 */
       
    97 class CAdvancedAudioOutput : public CBase,
       
    98 							 public MAdvancedAudioDecoderObserver
       
    99     {
       
   100     public: // New functions
       
   101 
       
   102         /**
       
   103         * Prepares the resources for playback.
       
   104         * @since 3.0
       
   105         * @param none
       
   106         * @return void
       
   107         */
       
   108         IMPORT_C virtual void PrimeL() = 0;
       
   109 
       
   110         /**
       
   111         * Pauses the playback.
       
   112         * @since 3.0
       
   113         * @param none
       
   114         * @return void
       
   115         */
       
   116         IMPORT_C virtual void PauseL() = 0;
       
   117 
       
   118         /**
       
   119         * Initiates playback.
       
   120         * @since 3.0
       
   121         * @param aBuffer buffer to be played
       
   122         *        aIndex index of the buffer to be played
       
   123         * @return void
       
   124         */
       
   125         IMPORT_C virtual void PlayL( TAny* aBuffer, TInt aIndex ) = 0;
       
   126 
       
   127         /**
       
   128         * Stops playback.
       
   129         * @since 3.0
       
   130         * @param none
       
   131         * @return void
       
   132         */
       
   133         IMPORT_C virtual void StopL(TBool aStopDevsound=ETrue) = 0;
       
   134 
       
   135         /**
       
   136         * Returns the max volume.
       
   137         * @since 3.0
       
   138         * @param none
       
   139         * @return max volume
       
   140         */
       
   141 		IMPORT_C virtual TInt MaxVolumeL() = 0;
       
   142 
       
   143         /**
       
   144         * Sets the volume.
       
   145         * @since 3.0
       
   146         * @param aVolume volume to be set
       
   147         * @return void
       
   148         */
       
   149         IMPORT_C virtual void SetVolumeL( TInt /*aVolume*/ ) = 0;
       
   150 
       
   151         /**
       
   152         * Returns the current volume.
       
   153         * @since 3.0
       
   154         * @param none
       
   155         * @return current volume
       
   156         */
       
   157         IMPORT_C virtual TInt VolumeL() = 0;
       
   158 
       
   159         /**
       
   160 		* Sets the source priority settings if a priority mechanism is required
       
   161 		* to arbitrate between multiple clients trying to access the same resource.
       
   162 		* Sets the priority for the source and the sink (provided they are defined).
       
   163 		* @since 3.0
       
   164         * @param aPrioritySettings priority settings
       
   165         * @return void
       
   166         */
       
   167         IMPORT_C virtual void SetPrioritySettingsL( const TMMFPrioritySettings& /*aPrioritySettings*/ ) = 0;
       
   168 
       
   169         /**
       
   170         * Returns the audio output position in microseconds.
       
   171         * @since 3.0
       
   172         * @param none
       
   173         * @return input output
       
   174         */
       
   175         IMPORT_C virtual TInt64 CalculateAudioOutputPositionL() const = 0;
       
   176 
       
   177         /**
       
   178         * Returns the currently configured rates.
       
   179         * @since 3.0
       
   180         * @param aRates on return, configured rates
       
   181         * @return void
       
   182         */
       
   183         IMPORT_C virtual void ConfigRatesL( RArray<TUint>& aRates ) = 0;
       
   184 
       
   185         /**
       
   186         * Returns the currently configured channels.
       
   187         * @since 3.0
       
   188         * @param aChannels on return, configured channels
       
   189         * @return void
       
   190         */
       
   191         IMPORT_C virtual void ConfigChannelsL( RArray<TUint>& aChannels ) = 0;
       
   192 
       
   193         /**
       
   194         * Returns the currently configured data types.
       
   195         * @since 3.0
       
   196         * @param aDataTypes on return, configured data types
       
   197         * @return void
       
   198         */
       
   199         IMPORT_C virtual void ConfigDataTypesL( RArray<TFourCC>& aDataTypes ) = 0;
       
   200 
       
   201         /**
       
   202         * Returns the supported rates.
       
   203         * @since 3.0
       
   204         * @param aRates on return, supported rates
       
   205         * @return void
       
   206         */
       
   207         IMPORT_C virtual void CapabilitiesRatesL( RArray<TUint>& aRates ) = 0;
       
   208 
       
   209         /**
       
   210         * Returns the supported channels.
       
   211         * @since 3.0
       
   212         * @param aChannels on return, supported channels
       
   213         * @return void
       
   214         */
       
   215         IMPORT_C virtual void CapabilitiesChannelsL( RArray<TUint>& aChannels ) = 0;
       
   216 
       
   217         /**
       
   218         * Returns the supported data types.
       
   219         * @since 3.0
       
   220         * @param aDataTypes on return, supported data types
       
   221         * @return void
       
   222         */
       
   223         IMPORT_C virtual void CapabilitiesDataTypesL( RArray<TFourCC>& aDataTypes ) = 0;
       
   224 
       
   225         /**
       
   226         * Sets the volume ramp.
       
   227         * @since 3.0
       
   228         * @param aRampDuration duration over which the volume is to be increased in microseconds
       
   229         * @return void
       
   230         */
       
   231         IMPORT_C virtual void SetVolumeRampL( const TTimeIntervalMicroSeconds& aRampDuration ) = 0;
       
   232 
       
   233         /**
       
   234         * Sets the balance.
       
   235         * @since 3.0
       
   236         * @param aLeftPercentage percentage of balance to be played on left
       
   237         * @param aRightPercentage percentage of balance to be played on right
       
   238         * @return void
       
   239         */
       
   240         IMPORT_C virtual void SetPlayBalanceL( TInt aLeftPercentage, TInt aRightPercentage ) = 0;
       
   241 
       
   242         /**
       
   243         * Returns the current balance percentages.
       
   244         * @since 3.0
       
   245         * @param aLeftPercentage on return, percentage of balance to be played on left
       
   246         * @param aRightPercentage on return, percentage of balance to be played on right
       
   247         * @return void
       
   248         */
       
   249         IMPORT_C virtual void GetPlayBalanceL( TInt& aLeftPercentage, TInt& aRightPercentage ) = 0;
       
   250 
       
   251         /**
       
   252         * Sets the configuration parameters for recording.
       
   253         * @since 3.0
       
   254         * @param aSampleRate sample rate
       
   255         * @param aNumChannel number of channels
       
   256         * @param aFourCC data type
       
   257         * @param aCodecConfigData codec configuration data
       
   258         * @return void
       
   259         */
       
   260         IMPORT_C virtual void ConfigureL( TUint aSampleRate, TUint aNumChannel, TFourCC aFourCC,
       
   261                                           const RArray<TInt>& aCodecConfigData ) = 0;
       
   262 
       
   263         /**
       
   264         * Sets the Decoder instance to be used by the audio output.
       
   265         * @since 3.0
       
   266         * @param aDecoder Decoder instance
       
   267         * @return void
       
   268         */
       
   269         IMPORT_C virtual void SetDecoder( CAdvancedAudioDecoder* aDecoder ) = 0;
       
   270         IMPORT_C virtual void Resume(TInt aBufferIndex = -1) = 0;
       
   271         IMPORT_C virtual void IsLoopPlayEnabled(const TBool aLoopPlayEnabled) = 0;
       
   272         IMPORT_C virtual void UnSetLastBuffer(const TBool aUnSetLastBuffer) = 0;
       
   273         IMPORT_C virtual TBool IsDSStopped() = 0;
       
   274         
       
   275         /**
       
   276         * Sets the DataAdapter instance to be used by the audio output.
       
   277         * @param aDataSourceAdapter DataSourceAdapter instance
       
   278         * @return void
       
   279         */
       
   280         IMPORT_C virtual void SetDataSourceAdapter(CDataSourceAdapter* aDataSourceAdapter) = 0;
       
   281 
       
   282 
       
   283 	protected: // Data
       
   284 
       
   285         // pointer to AdvancedAudioOutput observer
       
   286         MAdvancedAudioOutputObserver* iObserver;
       
   287 
       
   288         // pointer to an audio decoder
       
   289         CAdvancedAudioDecoder* iAdvancedAudioDecoder;
       
   290         CDataSourceAdapter* iDataSourceAdapter;
       
   291         CMMFBuffer* iSavedBufferPtr;
       
   292 	};
       
   293 
       
   294 #endif		// CADVANCEDAUDIOOUTPUT_H