Update contrib.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
21 #ifndef CDEVPLAYCONTROL_H
22 #define CDEVPLAYCONTROL_H
26 #include "cdevcommoncontrol.h"
28 #include <a3f/maudiodatasupplier.h>
29 #include <a3f/maudioprocessingunitobserver.h>
30 #include <a3f/a3f_trace_utils.h>
33 class MMMFBufferSource;
40 * @lib mmfdevsoundadaptation.lib
44 NONSHARABLE_CLASS(CDevPlayControl) :public CDevCommonControl,
45 public MMMFAudioDataSupplier
51 * Releases all resources and deletes all objects owned by this instance.
55 static CDevPlayControl* NewL(CDevAudio* aDevAudio, MDevSoundAdaptationObserver& aDevSoundObserver);
57 void ConstructL(CDevAudio* aDevAudio, MDevSoundAdaptationObserver& aAdaptationObserver);
59 // from base class CDevAudioControl
62 * Initialize playing state control components
66 virtual TInt Initialize(TUid aFormat);
69 * Initializes the audio device and starts the play process. This
70 * function queries and acquires the audio policy before initializing
71 * audio device. If there was an error during policy initialization,
72 * PlayError() function will be called on the observer with error code
73 * KErrAccessDenied, otherwise BufferToBeFilled() function will be called
74 * with a buffer reference. After reading data into the buffer reference
75 * passed, the client should call PlayData() to play data.
76 * The amount of data that can be played is specified in
77 * CMMFBuffer::RequestSize(). Any data that is read into buffer beyond
78 * this size will be ignored.
83 virtual TInt ProcessInit();
86 * Plays data in the buffer at the current volume.
87 * The client should fill the buffer with audio data before calling this
88 * function. The observer gets a reference to the buffer along with the
89 * callback function BufferToBeFilled(). When playing of the audio sample
90 * is complete, successfully or otherwise, the function PlayError() on
91 * the observer is called.
92 * The last buffer of the audio stream being played should have the last
93 * buffer flag set using CMMFBuffer::SetLastBuffer(TBool). If a
94 * subsequent attempt to play the clip is made, this flag will need
95 * resetting by the client.
98 virtual void ProcessData();
101 Call-back indicating that is the last buffer has been processed
103 virtual void ProcessingFinished (MAudioStream& aStream);
105 // from base class MAudioDataSupplier
108 * Request a buffer to be filled with audio data by the data supplier.
110 * The supplier should fill the buffer as quickly as possible and then call
111 * MBufferSource::BufferFilled() passing the filled buffer as a parameter.
113 * @param aSource a pointer to the source requesting the buffer
114 * @param aBuffer a pointer to the buffer to fill
116 virtual void BufferToBeFilled(MMMFBufferSource* aSource, CMMFBuffer* aBuffer);
119 * Indicates that all buffers previously requested by this source have become
120 * invalid and must not be used.
122 * @param aSource the source whose previous buffer requests should be ignored.
124 virtual void DiscardBuffers(MMMFBufferSource* aSource);
126 // from base class CDevCommonControl
127 void FinishWithError(TInt aError);
130 * Called when a ProcessingFinished callback is received
133 * @param TBool& aAyncCompletion
134 * @return an error code KErrNone if successful
136 virtual TInt ProcessingFinishedReceived(TBool& aAyncCompletion);
139 Used to send a stop call when there is a error in the buffer
141 void BufferErrorEvent();
143 virtual TInt ProcessingError(TBool& aAyncCompletion);
151 * Casted convenience pointer to DevAudio::iAudioSource
154 MMMFBufferSource *iBufferSource;
158 #endif // CDEVPLAYCONTROL_H