os/mm/devsound/a3fdevsound/src/devsoundadaptor/cdevtonecontrol.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2006-2009 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:
    15 *
    16 */
    17 
    18 
    19 
    20 
    21 #ifndef CDEVTONECONTROL_H
    22 #define CDEVTONECONTROL_H
    23 
    24 #include <e32base.h>
    25 
    26 #include "cdevcommoncontrol.h"
    27 
    28 #include <a3f/maudiodatasupplier.h>
    29 #include <a3f/maudioprocessingunitobserver.h>
    30 #include <a3f/tonedata.h>
    31 #include <a3f/a3f_trace_utils.h>
    32 
    33 
    34 class MMMFBufferSource;
    35 
    36 /**
    37  * CDevToneControl.
    38  *
    39  * ?description
    40  *
    41  * @lib mmfdevsoundadaptation.lib
    42  */
    43 
    44 NONSHARABLE_CLASS(CDevToneControl) :public CDevCommonControl,
    45 									public MMMFAudioDataSupplier
    46 	{
    47 public:
    48 
    49 	/**
    50 	* Destructor.
    51 	* Releases all resources and deletes all objects owned by this instance.
    52 	*/
    53 	~CDevToneControl();
    54 
    55 	static CDevToneControl* NewL(CDevAudio* aDevAudio, MDevSoundAdaptationObserver& aDevSoundObserver);
    56 
    57 	void ConstructL(CDevAudio* aDevAudio, MDevSoundAdaptationObserver& aDevSoundObserver);
    58 
    59 // from base class CDevAudioControl
    60 
    61 	/**
    62 	* Initialize playing state control components
    63 	* @since
    64 	* @return error code
    65 	*/
    66 	virtual TInt Initialize(TUid aFormat);
    67 
    68 	/**
    69 	* Initializes and starts the wanted operation (Play, Record, TonePlay).
    70 	* @since
    71 	* @return error code
    72 	*/
    73 	virtual TInt ProcessInit();
    74 
    75 	/**
    76 	* Processes the data (PlayData, RecordData).
    77 	* @since
    78 	* @return void
    79 	*/
    80 	virtual void ProcessData();
    81 
    82 	// from base class MMMFAudioDataSupplier
    83 	/**
    84 	* Request a buffer to be filled with audio data by the data supplier.
    85 	*
    86 	* The supplier should fill the buffer as quickly as possible and then call
    87 	* MBufferSource::BufferFilled() passing the filled buffer as a parameter.
    88 	*
    89 	* @param aSource a pointer to the source requesting the buffer
    90 	* @param aBuffer a pointer to the buffer to fill
    91 	*/
    92 	virtual void BufferToBeFilled(MMMFBufferSource* aSource, CMMFBuffer* aBuffer);
    93 
    94 	/**
    95 	* Indicates that all buffers previously requested by this source have become
    96 	* invalid and must not be used.
    97 	*
    98 	* @param aSource the source whose previous buffer requests should be ignored.
    99 	*/
   100 	virtual void DiscardBuffers(MMMFBufferSource* aSource);
   101 
   102 	/**
   103 	* Indicates that last buffer has been processed
   104 	*
   105 	* @since
   106 	* @param aSource the source
   107 	*/
   108 
   109 	void ProcessingFinished(MAudioStream& /*aStream*/);
   110 
   111 	/**
   112 	* Saves tonedata for later use
   113 	* This includes information about tone type, data, length, etc.
   114 	*
   115 	* @since
   116 	* @param aToneData
   117 	* @return error code
   118 	*/
   119 	TInt SetToneData(TToneData& aToneData);
   120 
   121 
   122 	// from CDevCommonControl
   123 	void FinishWithError(TInt aError);
   124 	
   125 	/**
   126 	* Called when a ProcessingFinished callback is received
   127 	*
   128 	* @since
   129 	* @param TBool& aAyncCompletion
   130 	* @return an error code KErrNone if successful
   131 	*/
   132 	virtual TInt ProcessingFinishedReceived(TBool& aAyncCompletion);
   133 	
   134 	virtual TInt ProcessingError(TBool& aAyncCompletion);
   135 
   136 private:
   137 	CDevToneControl();
   138 
   139 private: // data
   140 
   141 	/**
   142 	* Casted convenience pointer to DevAudio::iAudioSource
   143 	* Not own.
   144 	*/
   145 	MMMFBufferSource *iBufferSource;
   146 
   147 	/**
   148 	* Information about tone.
   149 	*/
   150 	TToneData iToneData;
   151 
   152 	};
   153 
   154 #endif // CDEVTONECONTROL_H