sl@0: /* sl@0: * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: sl@0: #ifndef CDEVTONECONTROL_H sl@0: #define CDEVTONECONTROL_H sl@0: sl@0: #include sl@0: sl@0: #include "cdevcommoncontrol.h" sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: class MMMFBufferSource; sl@0: sl@0: /** sl@0: * CDevToneControl. sl@0: * sl@0: * ?description sl@0: * sl@0: * @lib mmfdevsoundadaptation.lib sl@0: */ sl@0: sl@0: NONSHARABLE_CLASS(CDevToneControl) :public CDevCommonControl, sl@0: public MMMFAudioDataSupplier sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: * Destructor. sl@0: * Releases all resources and deletes all objects owned by this instance. sl@0: */ sl@0: ~CDevToneControl(); sl@0: sl@0: static CDevToneControl* NewL(CDevAudio* aDevAudio, MDevSoundAdaptationObserver& aDevSoundObserver); sl@0: sl@0: void ConstructL(CDevAudio* aDevAudio, MDevSoundAdaptationObserver& aDevSoundObserver); sl@0: sl@0: // from base class CDevAudioControl sl@0: sl@0: /** sl@0: * Initialize playing state control components sl@0: * @since sl@0: * @return error code sl@0: */ sl@0: virtual TInt Initialize(TUid aFormat); sl@0: sl@0: /** sl@0: * Initializes and starts the wanted operation (Play, Record, TonePlay). sl@0: * @since sl@0: * @return error code sl@0: */ sl@0: virtual TInt ProcessInit(); sl@0: sl@0: /** sl@0: * Processes the data (PlayData, RecordData). sl@0: * @since sl@0: * @return void sl@0: */ sl@0: virtual void ProcessData(); sl@0: sl@0: // from base class MMMFAudioDataSupplier sl@0: /** sl@0: * Request a buffer to be filled with audio data by the data supplier. sl@0: * sl@0: * The supplier should fill the buffer as quickly as possible and then call sl@0: * MBufferSource::BufferFilled() passing the filled buffer as a parameter. sl@0: * sl@0: * @param aSource a pointer to the source requesting the buffer sl@0: * @param aBuffer a pointer to the buffer to fill sl@0: */ sl@0: virtual void BufferToBeFilled(MMMFBufferSource* aSource, CMMFBuffer* aBuffer); sl@0: sl@0: /** sl@0: * Indicates that all buffers previously requested by this source have become sl@0: * invalid and must not be used. sl@0: * sl@0: * @param aSource the source whose previous buffer requests should be ignored. sl@0: */ sl@0: virtual void DiscardBuffers(MMMFBufferSource* aSource); sl@0: sl@0: /** sl@0: * Indicates that last buffer has been processed sl@0: * sl@0: * @since sl@0: * @param aSource the source sl@0: */ sl@0: sl@0: void ProcessingFinished(MAudioStream& /*aStream*/); sl@0: sl@0: /** sl@0: * Saves tonedata for later use sl@0: * This includes information about tone type, data, length, etc. sl@0: * sl@0: * @since sl@0: * @param aToneData sl@0: * @return error code sl@0: */ sl@0: TInt SetToneData(TToneData& aToneData); sl@0: sl@0: sl@0: // from CDevCommonControl sl@0: void FinishWithError(TInt aError); sl@0: sl@0: /** sl@0: * Called when a ProcessingFinished callback is received sl@0: * sl@0: * @since sl@0: * @param TBool& aAyncCompletion sl@0: * @return an error code KErrNone if successful sl@0: */ sl@0: virtual TInt ProcessingFinishedReceived(TBool& aAyncCompletion); sl@0: sl@0: virtual TInt ProcessingError(TBool& aAyncCompletion); sl@0: sl@0: private: sl@0: CDevToneControl(); sl@0: sl@0: private: // data sl@0: sl@0: /** sl@0: * Casted convenience pointer to DevAudio::iAudioSource sl@0: * Not own. sl@0: */ sl@0: MMMFBufferSource *iBufferSource; sl@0: sl@0: /** sl@0: * Information about tone. sl@0: */ sl@0: TToneData iToneData; sl@0: sl@0: }; sl@0: sl@0: #endif // CDEVTONECONTROL_H