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