1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/a3fdevsound/src/devsoundadaptor/cdevtonecontrol.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,154 @@
1.4 +/*
1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +
1.23 +
1.24 +#ifndef CDEVTONECONTROL_H
1.25 +#define CDEVTONECONTROL_H
1.26 +
1.27 +#include <e32base.h>
1.28 +
1.29 +#include "cdevcommoncontrol.h"
1.30 +
1.31 +#include <a3f/maudiodatasupplier.h>
1.32 +#include <a3f/maudioprocessingunitobserver.h>
1.33 +#include <a3f/tonedata.h>
1.34 +#include <a3f/a3f_trace_utils.h>
1.35 +
1.36 +
1.37 +class MMMFBufferSource;
1.38 +
1.39 +/**
1.40 + * CDevToneControl.
1.41 + *
1.42 + * ?description
1.43 + *
1.44 + * @lib mmfdevsoundadaptation.lib
1.45 + */
1.46 +
1.47 +NONSHARABLE_CLASS(CDevToneControl) :public CDevCommonControl,
1.48 + public MMMFAudioDataSupplier
1.49 + {
1.50 +public:
1.51 +
1.52 + /**
1.53 + * Destructor.
1.54 + * Releases all resources and deletes all objects owned by this instance.
1.55 + */
1.56 + ~CDevToneControl();
1.57 +
1.58 + static CDevToneControl* NewL(CDevAudio* aDevAudio, MDevSoundAdaptationObserver& aDevSoundObserver);
1.59 +
1.60 + void ConstructL(CDevAudio* aDevAudio, MDevSoundAdaptationObserver& aDevSoundObserver);
1.61 +
1.62 +// from base class CDevAudioControl
1.63 +
1.64 + /**
1.65 + * Initialize playing state control components
1.66 + * @since
1.67 + * @return error code
1.68 + */
1.69 + virtual TInt Initialize(TUid aFormat);
1.70 +
1.71 + /**
1.72 + * Initializes and starts the wanted operation (Play, Record, TonePlay).
1.73 + * @since
1.74 + * @return error code
1.75 + */
1.76 + virtual TInt ProcessInit();
1.77 +
1.78 + /**
1.79 + * Processes the data (PlayData, RecordData).
1.80 + * @since
1.81 + * @return void
1.82 + */
1.83 + virtual void ProcessData();
1.84 +
1.85 + // from base class MMMFAudioDataSupplier
1.86 + /**
1.87 + * Request a buffer to be filled with audio data by the data supplier.
1.88 + *
1.89 + * The supplier should fill the buffer as quickly as possible and then call
1.90 + * MBufferSource::BufferFilled() passing the filled buffer as a parameter.
1.91 + *
1.92 + * @param aSource a pointer to the source requesting the buffer
1.93 + * @param aBuffer a pointer to the buffer to fill
1.94 + */
1.95 + virtual void BufferToBeFilled(MMMFBufferSource* aSource, CMMFBuffer* aBuffer);
1.96 +
1.97 + /**
1.98 + * Indicates that all buffers previously requested by this source have become
1.99 + * invalid and must not be used.
1.100 + *
1.101 + * @param aSource the source whose previous buffer requests should be ignored.
1.102 + */
1.103 + virtual void DiscardBuffers(MMMFBufferSource* aSource);
1.104 +
1.105 + /**
1.106 + * Indicates that last buffer has been processed
1.107 + *
1.108 + * @since
1.109 + * @param aSource the source
1.110 + */
1.111 +
1.112 + void ProcessingFinished(MAudioStream& /*aStream*/);
1.113 +
1.114 + /**
1.115 + * Saves tonedata for later use
1.116 + * This includes information about tone type, data, length, etc.
1.117 + *
1.118 + * @since
1.119 + * @param aToneData
1.120 + * @return error code
1.121 + */
1.122 + TInt SetToneData(TToneData& aToneData);
1.123 +
1.124 +
1.125 + // from CDevCommonControl
1.126 + void FinishWithError(TInt aError);
1.127 +
1.128 + /**
1.129 + * Called when a ProcessingFinished callback is received
1.130 + *
1.131 + * @since
1.132 + * @param TBool& aAyncCompletion
1.133 + * @return an error code KErrNone if successful
1.134 + */
1.135 + virtual TInt ProcessingFinishedReceived(TBool& aAyncCompletion);
1.136 +
1.137 + virtual TInt ProcessingError(TBool& aAyncCompletion);
1.138 +
1.139 +private:
1.140 + CDevToneControl();
1.141 +
1.142 +private: // data
1.143 +
1.144 + /**
1.145 + * Casted convenience pointer to DevAudio::iAudioSource
1.146 + * Not own.
1.147 + */
1.148 + MMMFBufferSource *iBufferSource;
1.149 +
1.150 + /**
1.151 + * Information about tone.
1.152 + */
1.153 + TToneData iToneData;
1.154 +
1.155 + };
1.156 +
1.157 +#endif // CDEVTONECONTROL_H