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.
20 #ifndef MMFDEVSOUNDADAPTATION_H
21 #define MMFDEVSOUNDADAPTATION_H
24 #include <mmf/server/sounddevice.h>
25 #include <a3f/a3f_trace_utils.h>
28 class MGlobalProperties;
30 const TInt KCallbackNone = 0;
31 const TInt KCallbackProcessingFinished = 1;
32 const TInt KCallbackProcessingUnitError = 2;
33 const TInt KCallbackRecordPauseComplete = 3;
34 const TInt KCallbackAutoPauseResume = 4;
35 const TInt KCallbackFlushComplete = 5;
43 An interface to a set of DevSound adaptation observer callback functions.
45 This serves as the method of communication between the client and the
48 The class is a mixin and is intended to be inherited by the client class
49 that is interested in observing the DevSound operation. The functions
50 encapsulated by this class are called when specific events occur in the
51 process of initializing and playing/recording an audio sample or playing
54 class MDevSoundAdaptationObserver
58 Handles initialization completion event.
60 A derived class must provide an implementation to handle the initialization
63 CMMFDevSound object calls this function when its InitializeL() function
67 Error code. KErrNone if successful. Other values are possible
68 indicating a problem initializing CMMFDevSound object.
70 virtual void InitializeComplete(TInt aError)=0;
73 Handles tone play completion event.
75 A derived class must provide an implementation to handle the tone play
78 CMMFDevSound object calls this function when an attempt to play tone has
79 completed, successfully or otherwise.
81 The following are the play tone functions; PlayToneL(), PlayDMTFStringL(),
82 PlayToneSequenceL(), and PlayFixedSequenceL().
85 Error code. The status of tone playback. KErrUnderflow playing of
86 the tone is complete. KErrAccessDenied the sound device is in use by
87 another higher priority client. KErrCancel playing of the audio
88 sample is stopped by DevSound client another higher priority client.
90 virtual void ToneFinished(TInt aError)=0;
93 Handles CMMFDevSound object's data request event.
95 A derived class must provide an implementation to supply CMMFDevSound
96 object the data that it needs to play.
98 CMMFDevSound object calls this function when and where it needs data for
99 playing. The observer should notify CMMFDevSound object as
100 quickly as possible after the data is read into buffer, aBuffer by calling
101 PlayData(), otherwise the implementation might callback function PlayError()
102 on derived class object with error code KErrUnderflow.
103 This does not apply to the very first call to PlayData(), however.
104 It is possible for a user of DevSound to hold the first buffer sent in
105 BufferToBeFilled() until ready to play.
106 The use case for this is if a low latency audio response
107 is required, as at this point all the resources used to play audio are open.
108 If used in this way then it is important to be aware that when when the
109 resources for audio are ready at the BufferToBeFilled() callback, a Devsound
110 on a real device will be running at increased power consumption as the audio
111 hw and any required DSPs will be powered up etc.
114 Buffer into which data should be read. The amount of data that is
115 needed is specified in CMMFBuffer::RequestSize().
117 virtual void BufferToBeFilled(CMMFBuffer* aBuffer)=0;
120 Handles play completion or cancel event.
122 A derived class must provide an implementation to handle the play
123 completion or cancel request.
125 CMMFDevSound object calls this function when an attempt to play audio sample
126 has completed, successfully or otherwise.
129 Error code. The status of playback. KErrUnderflow playing of the
130 audio sample is complete. KErrAccessDenied the sound device is in
131 use by another higher priority client.
133 virtual void PlayError(TInt aError)=0;
136 Handles CMMFDevSound object's data request event.
138 A derived class must provide an implementation to process the data
139 supplied by CMMFDevSound object while recording.
141 CMMFDevSound object calls this function when the buffer, aBuffer gets filled
142 while recording. The observer should notify CMMFDevSound
143 object as quickly as possible after data in the buffer is processed by
144 calling RecordData(), otherwise the implementation might callback
145 the function RecordError() on derived class object with error code KErrOverflow.
148 Buffer containing processed (recorded) data. The amount
149 of data that is available is specified in CMMFBuffer::RequestSize().
151 virtual void BufferToBeEmptied(CMMFBuffer* aBuffer)=0;
154 Handles record completion or cancel event.
156 A derived class must provide an implementation to handle the record
157 completion or cancel request.
159 CMMFDevSound object calls this function when an attempt to record audio sample
160 has completed, successfully or otherwise.
163 Error code. The status of recording. KErrOverflow audio devices
164 runs out of internal buffer. KErrAccessDenied the sound device is
165 in use by another higher priority client.
167 virtual void RecordError(TInt aError)=0;
170 Handles device event.
172 A derived class must provide an implementtion to handle the messages from
173 audio hardware device.
175 CMMFDevSound object calls this function when a message is received from the
176 audio hardware device.
179 Defines the type of message. Used to determine how to
180 interpret the contents of aMsg.
182 Message that is packed in the Descriptor format.
184 virtual void DeviceMessage(TUid aMessageType, const TDesC8& aMsg)=0;
187 A derived class must provide an implementation to handle the low layer operation completion
188 @param aError The status of operation in progress
189 @param aCanStartNewOperation If EFalse indicates that the operation has more than a cycle
191 virtual void AsynchronousOperationComplete(TInt aError, TBool aCanStartNewOperation) = 0;
195 Underlying interface has been (or is about to be) deleted.
196 Implementations will generally cancel outstanding messages
198 @param aInterfaceId Uid of the Interface which has been deleted
200 virtual void InterfaceDeleted(TUid aInterfaceId) = 0;
203 Underlying physical adaptation has sent a callback that will result either on a commit
204 and need to scheduled or in the case of RecordPauseComplete, completes the message.
206 @param aType the callback type
207 @param aError KErrNone if successful, else corresponding error
210 virtual void CallbackFromAdaptorReceived(TInt aType, TInt aError) = 0;
213 Underlying physical adaptation has sent a callback indicating that a preemption process
214 has started, any incomming commands will be queued during the preemption.
216 virtual void PreemptionStartedCallbackReceived() = 0;
219 Underlying physical adaptation has sent a callback indicating that a preemption process
220 has finished. Queued commands during preemption can now be processed.
222 @param aCanStartNewOperation If EFalse indicates that the operation has more than a cycle
224 virtual void PreemptionFinishedCallbackReceived(TBool aCanStartNewOperation) = 0;
227 * The adaptor has control of the context.
228 * @return returns True if the adaptor is the entity responsible for calling Commit()
230 virtual TBool AdaptorControlsContext() const = 0;
233 * Callback indicating that a clash with pre-emption has occurred during the commit cycle
234 * and to push the current request that was being processed onto front of queue.
237 virtual void PreemptionClash() = 0;
240 * Callback indicating the clash with pre-emption during the commit cycle was with state change,
241 * so the current request that was previously pushed onto the front of queue should be removed
242 * without processing.
245 virtual void PreemptionClashWithStateChange() = 0;
248 * Callback to indicate an error has been noticed. This is to be cached until subsequent
249 * AsynchronousOperationComplete(), and handled then if needs.
251 virtual void NotifyError(TInt aError) = 0;
260 * This class implements DevSound behavior in a hardware independent way.
262 * @lib MmfDevSoundAdaptation.lib
265 class CMMFDevSoundAdaptation : public CBase
268 public: // Constructors and destructor
271 * Constructs, and returns a pointer to, a new CMMFDevSoundAdaptation
273 * Leaves on failure..
274 * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to DevSound
276 * @param MGlobalPrpoerties a reference to Audio Server global properties
277 * @return CMMFDevSoundAdaptation* A pointer to newly created object.
279 IMPORT_C static CMMFDevSoundAdaptation* NewL(MDevSoundAdaptationObserver& aDevSoundObserver,
280 MGlobalProperties& aGlobalProperties);
285 IMPORT_C virtual ~CMMFDevSoundAdaptation();
287 public: // New functions
291 Async open - if returns successfully, then will result in AsynchronousOperationComplete()
293 IMPORT_C void PostOpenL();
296 * Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz.
297 * On completion of Initialization, calls InitializeComplete() on
301 * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to DevSound
303 * @param TMMFState aMode Mode for which this object will be used.
306 IMPORT_C void InitializeL(TMMFState aMode);
309 * Initializes DevSound object for the mode aMode for processing audio
310 * data with hardware device aHWDev.
311 * On completion of Initialization, calls InitializeComplete() on
315 * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to DevSound
317 * @param TUid aHWDev The CMMFHwDevice implementation identifier.
318 * @param TMMFState aMode The mode for which this object will be used
321 IMPORT_C void InitializeL(TUid aHWDev,
325 * Initializes DevSound object for the mode aMode for processing audio
326 * data with hardware device supporting FourCC aDesiredFourCC.
329 * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to DevSound
331 * @param TFourCC aDesiredFourCC The CMMFHwDevice implementation FourCC
333 * @param TMMFState aMode The mode for which this object will be used
334 * @return KErrNone if successfull, else corresponding error code
337 IMPORT_C void InitializeL(TFourCC aDesiredFourCC,
341 * Cancels the initialization of a DevSound object.
343 * @return An error code indicating if the function call was successful.
344 * KErrNone on success,
345 * KerrNotReady if this is called before InitializeL() call or after
346 * the object has been initialized,
348 IMPORT_C TInt CancelInitialize();
351 * Returns the supported Audio settings ie. encoding, sample rates,
352 * mono/stereo operation, buffer size etc..
354 * @return TMMFCapabilities The device settings.
356 IMPORT_C TInt Capabilities(TMMFCapabilities& aCap);
359 * Returns the current device configuration.
361 * @return TMMFCapabilities The device settings.
363 IMPORT_C TMMFCapabilities Config() const;
366 * Configure CMMFDevSound object with the settings in aConfig. Use this
367 * to set sampling rate, encoding and mono/stereo.
370 * @param const TMMFCapabilities& aConfig The attribute values to which
371 * CMMFDevSound object will be configured to.
374 IMPORT_C void SetConfigL(const TMMFCapabilities& aCaps);
377 * Returns an integer representing the maximum volume device supports.
378 * This is the maximum value which can be passed to
379 * CMMFDevSound::SetVolume.
381 * @return TInt The maximum volume. This value is platform dependent but
382 * is always greater than or equal to one.
384 IMPORT_C TInt MaxVolume();
387 * Returns an integer representing the current volume.
389 * @return TInt The current volume level.
391 IMPORT_C TInt Volume();
394 * Changes the current playback volume to a specified value. The volume
395 * can be changed before or during playback and is effective immediately.
397 * @param TInt aVolume The volume setting. This can be any value from 0
398 * to the value returned by a call to
399 * CMMFDevSound::MaxVolume(). If the volume is not
400 * within this range, the volume is automatically set
401 * to minimum or maximum value based on the value
402 * that is being passed. Setting a zero value mutes
403 * the sound. Setting the maximum value results in
404 * the loudest possible sound.
405 * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent
406 * to AsynchronousOperationComplete()
407 * @return KErrNone if successful, otherwise system-wide error code
409 IMPORT_C TInt SetVolume(TInt aVolume, TBool& aAyncCompletion);
412 * Returns an integer representing the maximum gain the device supports.
413 * This is the maximum value which can be passed to CMMFDevSound::SetGain
415 * @return TInt The maximum gain. This value is platform dependent but is
416 * always greater than or equal to one.
418 IMPORT_C TInt MaxGain();
421 * Returns an integer representing the current gain.
423 * @return TInt The current gain level.
425 IMPORT_C TInt Gain();
428 * Changes the current recording gain to a specified value. The gain can
429 * be changed before or during recording and is effective immediately.
431 * @param TInt aGain The gain setting. This can be any value from zero to
432 * the value returned by a call to
433 * CMMFDevSound::MaxGain(). If the volume
434 * is not within this range, the gain is automatically
435 * set to minimum or maximum value based on the value
436 * that is being passed. Setting a zero value mutes the
437 * sound. Setting the maximum value results in the
438 * loudest possible sound.
439 * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent
440 * to AsynchronousOperationComplete()
441 * @return KErrNone if successful, otherwise system-wide error code
443 IMPORT_C TInt SetGain(TInt aGain, TBool& aAyncCompletion);
446 * Returns the speaker balance set for playing.
449 * @param TInt &aLeftPercentage On return contains the left speaker
451 * @param TInt &aRightPercentage On return contains the right speaker
455 IMPORT_C void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
458 * Sets the speaker balance for playing. The speaker balance can be
459 * changed before or during playback and is effective immediately.
462 * @param TInt aLeftPercentage The left speaker volume percentage. This
463 * can be any value from zero to 100. Setting
464 * a zero value mutes the sound on left
466 * @param TInt aRightPercentage The right speaker volume percentage.
467 * This can be any value from zero to 100.
468 * Setting a zero value mutes the sound on
470 * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent
471 * to AsynchronousOperationComplete()
474 IMPORT_C void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage, TBool& aAyncCompletion);
477 * Returns the microphone gain balance set for recording.
480 * @param TInt &aLeftPercentage On return contains the left microphone
482 * @param TInt &aRightPercentage On return contains the right microphone
486 IMPORT_C void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
489 * Sets the microphone balance for recording. The microphone balance can
490 * be changed before or during recording and is effective immediately.
493 * @param TInt aLeftPercentage The left microphone gain percentage. This
494 * can be any value from zero to 100. Setting
495 * a zero value mutes the sound from left
497 * @param TInt aRightPercentage The right microphone gain percentage.
498 * This can be any value from zero to 100.
499 * Setting a zero value mutes the sound from
501 * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent
502 * to AsynchronousOperationComplete()
505 IMPORT_C void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage, TBool& aAyncCompletion);
508 * Initializes the audio device and starts the play process. This
509 * function queries and acquires the audio policy before initializing
510 * audio device. If there was an error during policy initialization,
511 * PlayError() function will be called on the observer with error code
512 * KErrAccessDenied, otherwise BufferToBeFilled() function will be called
513 * with a buffer reference. After reading data into the buffer reference
514 * passed, the client should call PlayData() to play data.
515 * The amount of data that can be played is specified in
516 * CMMFBuffer::RequestSize(). Any data that is read into buffer beyond
517 * this size will be ignored.
522 IMPORT_C void PlayInitL();
525 * Initializes the audio device and starts the record process. This
526 * function queries and acquires the audio policy before initializing
527 * audio device. If there was an error during policy initialization,
528 * RecordError() function will be called on the observer with error code
529 * KErrAccessDenied, otherwise BufferToBeEmptied() function will be called
530 * with a buffer reference. This buffer contains recorded or encoded
531 * data. After processing data in the buffer reference passed, the client
532 * should call RecordData() to continue recording process.
533 * The amount of data that is available is specified in
534 * CMMFBuffer::RequestSize().
539 IMPORT_C void RecordInitL();
542 * Plays data in the buffer at the current volume.
543 * The client should fill the buffer with audio data before calling this
544 * function. The observer gets a reference to the buffer along with the
545 * callback function BufferToBeFilled(). When playing of the audio sample
546 * is complete, successfully or otherwise, the function PlayError() on
547 * the observer is called.
548 * The last buffer of the audio stream being played should have the last
549 * buffer flag set using CMMFBuffer::SetLastBuffer(TBool). If a
550 * subsequent attempt to play the clip is made, this flag will need
551 * resetting by the client.
554 IMPORT_C void PlayData();
557 * Contine the process of recording.
558 * Once the buffer is filled with recorded data, the Observer gets a
559 * reference to the buffer along with the callback function
560 * BufferToBeEmptied(). After processing the buffer (copying over to a
561 * different buffer or writing to file) the client should call this
562 * function to continue the recording process.
565 IMPORT_C void RecordData();
568 * Stops the ongoing operation (Play, Record, TonePlay).
570 * @return KErrNone if successful, system wide error otherwise
572 IMPORT_C TBool Stop();
575 * Temporarily Stops the ongoing operation (Play, Record, TonePlay).
577 * @return KErrNone if successful, system wide error otherwise
579 IMPORT_C TInt Pause();
582 * Returns the Sample recorded so far
584 * @return TInt Returns the samples recorded.
586 IMPORT_C TInt SamplesRecorded();
589 * Returns the Sample played so far
591 * @return TInt Returns the samples played.
593 IMPORT_C TInt SamplesPlayed();
596 * Initializes the audio device and starts playing a tone. The tone is
597 * played with the frequency and duration specified.
600 * @param TInt aFrequency The frequency at which the tone will be played.
601 * @param const TTimeIntervalMicroSeconds &aDuration The period over
602 * which the tone will be played. A zero value causes the no tone
606 IMPORT_C void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
609 * Initializes audio device and starts playing a dual tone. Dual Tone is
610 * played with the specified frequencies and for the specified duration.
613 * @param TInt aFrequencyOne The first frequency of dual tone.
614 * @param TInt aFrequencyTwo The second frequency of dual tone.
615 * @param const TTimeIntervalMicroSeconds &aDuration The period over
616 * which the tone will be played. A zero value causes the no tone
620 IMPORT_C void PlayDualToneL(TInt aFrequencyOne,
622 const TTimeIntervalMicroSeconds& aDuration);
625 * Initializes the audio device and starts playing the DTMF string
629 * @param const TDesC &aDTMFString The DTMF sequence in a descriptor.
632 IMPORT_C void PlayDTMFStringL(const TDesC& aDTMFString);
635 * Initializes the audio device and starts playing a tone sequence.
638 * @param const TDesC8 &aData The tone sequence in a descriptor.
641 IMPORT_C void PlayToneSequenceL(const TDesC8& aData);
644 * Initializes the audio device and starts playing the specified
645 * pre-defined tone sequence.
648 * @param TInt aSequenceNumber The index identifying the specific
649 * pre-defined tone sequence. Index values are relative to zero.
650 * This can be any value from zero to the value returned by a call
651 * to FixedSequenceCount() - 1. The function raises a panic if the
652 * sequence number is not within this range.
655 IMPORT_C void PlayFixedSequenceL(TInt aSequenceNumber);
658 * Defines the number of times the audio is to be repeated during the
659 * tone playback operation. A period of silence can follow each playing
660 * of a tone. The tone playing can be repeated indefinitely
662 * @param TInt aRepeatCount The number of times the tone, together with
663 * the trailing silence, is to be repeated. If this is set to
664 * KMdaRepeatForever, then the tone, together with the trailing
665 * silence, is repeated indefinitely or until Stop() is called.
666 * If this is set to zero, then the tone is not repeated.
667 * @param const TTimeIntervalMicroSeconds &aRepeatTrailingSilence An
668 * interval of silence which will be played after each tone.
669 * Supported only during tone playing.
670 * @return KErrNone if successful, system wide error otherwise
672 IMPORT_C TInt SetToneRepeats(TInt aRepeatCount,
673 const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
676 * Defines the duration of tone on, tone off and tone pause to be used
677 * during the DTMF tone playback operation.
678 * Supported only during tone playing.
680 * @param TTimeIntervalMicroSeconds32 &aToneOnLength The period over
681 * which the tone will be played. If this is set to zero, then the
682 * tone is not played.
683 * @param TTimeIntervalMicroSeconds32 &aToneOffLength The period over
684 * which the no tone will be played.
685 * @param TTimeIntervalMicroSeconds32 &aPauseLength The period over which
686 * the tone playing will be paused.
687 * @return KErrNone if successful, system wide error otherwise
689 IMPORT_C TInt SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
690 TTimeIntervalMicroSeconds32& aToneOffLength,
691 TTimeIntervalMicroSeconds32& aPauseLength);
694 * Defines the period over which the volume level is to rise smoothly
695 * from nothing to the normal volume level.
696 * The function is only available before playing.
698 * @param const TTimeIntervalMicroSeconds &aRampDuration The period over
699 * which the volume is to rise. A zero value causes the tone
700 * sample to be played at the normal level for the full duration
701 * of the playback. A value, which is longer than the duration of
702 * the tone sample means that the sample never reaches its normal
704 * @return KErrNone if successful, system wide error otherwise
706 IMPORT_C TInt SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
709 * Defines the priority settings that should be used for this instance.
711 * @param const TMMFPrioritySettings &aPrioritySettings A class type
712 * representing the client's priority, priority preference and
714 * @return KErrNone if successful, system wide error otherwise
716 IMPORT_C TInt SetPrioritySettings(
717 const TMMFPrioritySettings& aPrioritySettings);
720 * Retrieves a custom interface to the device.
722 * @param TUid aInterfaceId The interface UID, defined with the custom
724 * @return TAny* A pointer to the interface implementation, or NULL if
725 * the device does not implement the interface requested. The
726 * return value must be cast to the correct type by the user.
728 IMPORT_C TAny* CustomInterface(TUid aInterfaceId);
731 * Returns the number of available pre-defined tone sequences.
732 * This is the number of fixed sequence supported by DevSound by default.
734 * @return TInt The fixed sequence count. This value is implementation
737 IMPORT_C TInt FixedSequenceCount();
740 * Returns the name assigned to a specific pre-defined tone sequence.
741 * This is the number of the fixed sequence supported by DevSound by
743 * The function raises a panic if sequence number specified is invalid.
745 * @param TInt aSequenceNumber The index identifying the specific
746 * pre-defined tone sequence. Index values are relative to zero.
747 * This can be any value from zero to the value returned by a call
748 * to CMdaAudioPlayerUtility::FixedSequenceCount() - 1. The
749 * function raises a panic if sequence number is not within this
751 * @return const TDesC & A reference to a Descriptor containing the fixed
752 * sequence name indexed by aSequenceNumber.
754 IMPORT_C const TDesC& FixedSequenceName(TInt aSequenceNumber);
757 * Returns a list of the supported input datatypes that can be sent to
758 * DevSound for playing audio. The datatypes returned are those that the
759 * DevSound supports given the priority settings passed in
760 * aPrioritySettings. Note that if no supported data types are found this
761 * does not constitute failure, the function will return normally with no
762 * entries in aSupportedDataTypes.
764 * @param RArray< TFourCC > &aSupportedDataTypes The array of supported
765 * data types that will be filled in by this function. The
766 * supported data types of the DevSound are in the form of an
767 * array of TFourCC codes. Any existing entries in the array will
768 * be overwritten on calling this function. If no supported data
769 * types are found given the priority settings, then the
770 * aSupportedDatatypes array will have zero entries.
771 * @param const TMMFPrioritySettings &aPrioritySettings The priority
772 * settings used to determine the supported datatypes. Note this
773 * does not set the priority settings. For input datatypes the
774 * iState member of the priority settings would be expected to be
775 * either EMMFStatePlaying or EMMFStatePlayingRecording. The
776 * priority settings may effect the supported datatypes depending
777 * on the audio routing.
780 IMPORT_C void GetSupportedInputDataTypesL(
781 RArray<TFourCC>& aSupportedDataTypesconst,
782 const TMMFPrioritySettings& aPrioritySettings) const;
785 * Returns a list of the supported output dataypes that can be received
786 * from DevSound for recording audio. The datatypes returned are those
787 * that the DevSound supports given the priority settings passed in
788 * aPrioritySettings. Note that if no supported data types are found this
789 * does not constitute failure, the function will return normally with no
790 * entries in aSupportedDataTypes.
792 * @param RArray< TFourCC > &aSupportedDataTypes The array of supported
793 * data types that will be filled in by this function. The
794 * supported datatypes of the DevSound are in the form of an array
795 * of TFourCC codes. Any existing entries in the array will be
796 * overwritten on calling this function. If no supported datatypes
797 * are found given the priority settings, then the
798 * aSupportedDatatypes array will have zero entries.
799 * @param const TMMFPrioritySettings &aPrioritySettings The priority
800 * settings used to determine the supported data types. Note this
801 * does not set the priority settings. For output data types the
802 * iState member of the priority settings would expected to be
803 * either EMMFStateRecording or EMMFStatePlayingRecording. The
804 * priority settings may effect the supported datatypes depending
805 * on the audio routing.
808 IMPORT_C void GetSupportedOutputDataTypesL(
809 RArray<TFourCC>& aSupportedDataTypes,
810 const TMMFPrioritySettings& aPrioritySettings) const;
813 * Sets client configuration
815 * @param aActualProcessId the effective devsound client (supplied with SetClientThreadInfo)
816 * @param aProcessId the client of DevSound
817 * @return KErrNone if successful, system wide error otherwise
819 IMPORT_C TInt SetClientConfig(const TProcessId& aProcessId);
820 IMPORT_C TInt SetClientConfig(const TProcessId& aActualProcessId, const TProcessId& aProcessId);
823 * Empties the buffers below DevSound without deleting the codec.
825 * @return KErrNone if successful, otherwise system-wide error code.
827 IMPORT_C TInt EmptyBuffers();
830 * Make sure any deletions is commited
835 IMPORT_C TBool CloseDevSound();
838 * Called when a ProcessingFinished callback is received
840 * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent
841 * to AsynchronousOperationComplete()
842 * @return an error code KErrNone if successful
844 IMPORT_C TInt ProcessingFinishedReceived(TBool& aAyncCompletion);
846 IMPORT_C TInt ProcessingError(TBool& aAyncCompletion);
848 //provides interface for register a notification event
849 IMPORT_C TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
850 //provides interface to cancel the registered notification
851 IMPORT_C TInt CancelRegisterAsClient(TUid aEventType);
852 //Gets the notification data for client to resume
853 IMPORT_C TInt GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData);
854 //waits for the client to resume playback even after the timeout expires
855 IMPORT_C TInt WillResumePlay();
858 * Gets the current play time from the audio renderer
860 * @param TTimeIntervalMicroSeconds& aTime On return contains the current play time
861 * @return an error code KErrNone if successful
863 IMPORT_C TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime);
866 * Queries if the low layers does support resume operation.
868 * @return TBool ETrue if Resume is supported
871 IMPORT_C TBool IsResumeSupported();
874 * Resume the operation (Play, Record, TonePlay) temporarily paused .
876 * @return TInt KErrNone if succesful
877 * KErrNotSupported if the operation is not supported by this implementation
879 IMPORT_C TInt Resume();
882 Used to send a stop call when error in buffer
884 IMPORT_C void BufferErrorEvent();
887 * Used rollback the adapror active state to the previous state prior a Commit call
890 IMPORT_C void RollbackAdaptorActiveStateToBeforeCommit();
894 // So that nobody can extend
895 CMMFDevSoundAdaptation();
897 // Second phase constructor
898 void ConstructL(MDevSoundAdaptationObserver& aDevSoundObserver,
899 MGlobalProperties& aGlobalProperties);
902 // Actual implementation class.
905 //DevSoundAdaptation body implementation
909 #endif // MMFDEVSOUNDADAPTATION