1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/a3fdevsound/src/devsoundadaptor/mmfdevsoundadaptationbody.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,724 @@
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 +#ifndef MMFDEVSOUNDADAPTATIONBODY_H
1.24 +#define MMFDEVSOUNDADAPTATIONBODY_H
1.25 +
1.26 +#include <e32base.h>
1.27 +#include <mmf/server/mmfhwdevice.h>
1.28 +#include <a3f/a3f_trace_utils.h>
1.29 +#include "mmfdevsoundadaptation.h"
1.30 +#include <a3f/tonedata.h>
1.31 +#include <a3f/audioprocessingunittypeuids.h>
1.32 +
1.33 +
1.34 +class CDevAudio;
1.35 +class CDevAudioControl;
1.36 +class MGlobalProperties;
1.37 +
1.38 +// CONSTANTS
1.39 +const TInt KDevsoundDefaultMaxGain = 10;
1.40 +const TUint KDevSoundMaxCaps = 0xFFFFFFFF;
1.41 +
1.42 +const TUint KDataForPlay = 0;
1.43 +const TUint KDataForRecord = 1;
1.44 +
1.45 +/**
1.46 + * Class implementing CMMFDevSoundAdaptation behaviour.
1.47 + *
1.48 + * @lib mmfdevsoundadaptation.lib
1.49 + */
1.50 +class CMMFDevSoundAdaptation::CBody : public CBase
1.51 + {
1.52 + friend class CMMFDevSoundAdaptation;
1.53 +
1.54 +public:
1.55 +
1.56 + static CBody* NewL(MDevSoundAdaptationObserver& aDevSoundObserver,
1.57 + MGlobalProperties& aGlobalProperties);
1.58 +
1.59 + ~CBody();
1.60 +
1.61 +public: // New functions
1.62 +
1.63 + /*
1.64 + * 2nd phase async open operation
1.65 + */
1.66 + void PostOpenL();
1.67 +
1.68 + /**
1.69 + * Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz.
1.70 + * On completion of Initialization, calls InitializeComplete() on
1.71 + * aDevSoundObserver.
1.72 + * Leaves on failure.
1.73 + * @since
1.74 + * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to DevSound
1.75 + * Observer instance.
1.76 + * @param TMMFState aMode Mode for which this object will be used.
1.77 + * @return void
1.78 + */
1.79 + void InitializeL(TMMFState aMode);
1.80 +
1.81 + /**
1.82 + * Initializes DevSound object for the mode aMode for processing audio
1.83 + * data with hardware device aHWDev.
1.84 + * On completion of Initialization, calls InitializeComplete() on
1.85 + * aDevSoundObserver.
1.86 + * Leaves on failure.
1.87 + * @since
1.88 + * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to DevSound
1.89 + * Observer instance.
1.90 + * @param TUid aHWDev The CMMFHwDevice implementation identifier.
1.91 + * @param TMMFState aMode The mode for which this object will be used
1.92 + * @return void
1.93 + */
1.94 + void InitializeL(TUid aHWDev, TMMFState aMode);
1.95 +
1.96 + /**
1.97 + * Initializes DevSound object for the mode aMode for processing audio
1.98 + * data with hardware device supporting FourCC aDesiredFourCC.
1.99 + * Leaves on failure.
1.100 + * @since
1.101 + * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to DevSound
1.102 + * Observer instance.
1.103 + * @param TFourCC aDesiredFourCC The CMMFHwDevice implementation FourCC
1.104 + * code.
1.105 + * @param TMMFState aMode The mode for which this object will be used
1.106 + * @return KErrNone if successfull, else corresponding error code
1.107 + * @return void
1.108 + */
1.109 + void InitializeL(TFourCC aDesiredFourCC,
1.110 + TMMFState aMode);
1.111 +
1.112 + /**
1.113 + * Initializes DevSound object with codec format aFormat
1.114 + * Leaves on failure.
1.115 + * @since
1.116 + * @param aDevSoundObserver A reference to DevSound Observer instance.
1.117 + * @param aFormat codec format
1.118 + * @param aMode The mode for which this object will be used
1.119 + */
1.120 + void DoInitializeL(TUid aFormat,
1.121 + TMMFState aMode);
1.122 +
1.123 + /**
1.124 + * Cancels the initialization of a DevSound object.
1.125 + * @since
1.126 + * @return An error code indicating if the function call was successful.
1.127 + * KErrNone on success,
1.128 + * KerrNotReady if this is called before InitializeL() call or after
1.129 + * the object has been initialized,
1.130 + */
1.131 + TInt CancelInitialize();
1.132 +
1.133 + /**
1.134 + * Returns the supported Audio settings ie. encoding, sample rates,
1.135 + * mono/stereo operation, buffer size etc..
1.136 + * @since
1.137 + * @return TMMFCapabilities The device settings.
1.138 + */
1.139 + TInt Capabilities(TMMFCapabilities& aCap);
1.140 +
1.141 + /**
1.142 + * Returns the current device configuration.
1.143 + * @since
1.144 + * @return TMMFCapabilities The device settings.
1.145 + */
1.146 + TMMFCapabilities Config() const;
1.147 +
1.148 + /**
1.149 + * Configure CMMFDevSound object with the settings in aConfig. Use this
1.150 + * to set sampling rate, encoding and mono/stereo.
1.151 + * Leaves on failure.
1.152 + * @since
1.153 + * @param const TMMFCapabilities& aConfig The attribute values to which
1.154 + * CMMFDevSound object will be configured to.
1.155 + * @return void
1.156 + */
1.157 + void SetConfigL(const TMMFCapabilities& aCaps);
1.158 +
1.159 + /**
1.160 + * Returns an integer representing the maximum volume device supports.
1.161 + * This is the maximum value which can be passed to
1.162 + * CMMFDevSound::SetVolume.
1.163 + * @since
1.164 + * @return TInt The maximum volume. This value is platform dependent but
1.165 + * is always greater than or equal to one.
1.166 + */
1.167 + TInt MaxVolume();
1.168 +
1.169 + /**
1.170 + * Returns an integer representing the current volume.
1.171 + * @since
1.172 + * @return TInt The current volume level.
1.173 + */
1.174 + TInt Volume();
1.175 +
1.176 + /**
1.177 + * Changes the current playback volume to a specified value. The volume
1.178 + * can be changed before or during playback and is effective immediately.
1.179 + * @since
1.180 + * @param aVolume The volume setting. This can be any value from 0
1.181 + * to the value returned by a call to
1.182 + * CMMFDevSound::MaxVolume(). If the volume is not
1.183 + * within this range, the volume is automatically set
1.184 + * to minimum or maximum value based on the value
1.185 + * that is being passed. Setting a zero value mutes
1.186 + * the sound. Setting the maximum value results in
1.187 + * the loudest possible sound.
1.188 + * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent
1.189 + * to AsynchronousOperationComplete()
1.190 + * @return KErrNone if successful, otherwise system-wide error code
1.191 + */
1.192 + TInt SetVolume(TInt aVolume, TBool& aAyncCompletion);
1.193 +
1.194 + /**
1.195 + * Gets the maximum gain the device supports.
1.196 + * This is the maximum value which can be passed to CMMFDevSound::SetGain
1.197 + * @since
1.198 + * @return error
1.199 + */
1.200 + TInt MaxGain();
1.201 +
1.202 + /**
1.203 + * Returns an integer representing the current gain.
1.204 + * @since
1.205 + * @return TInt The current gain level.
1.206 + */
1.207 + TInt Gain();
1.208 +
1.209 + /**
1.210 + * Changes the current recording gain to a specified value. The gain can
1.211 + * be changed before or during recording and is effective immediately.
1.212 + * @since
1.213 + * @param TInt aGain The gain setting. This can be any value from zero to
1.214 + * the value returned by a call to
1.215 + * CMMFDevSound::MaxGain(). If the volume
1.216 + * is not within this range, the gain is automatically
1.217 + * set to minimum or maximum value based on the value
1.218 + * that is being passed. Setting a zero value mutes the
1.219 + * sound. Setting the maximum value results in the
1.220 + * loudest possible sound.
1.221 + * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent
1.222 + * to AsynchronousOperationComplete()
1.223 + * @return void
1.224 + */
1.225 + TInt SetGain(TInt aGain, TBool& aAyncCompletion);
1.226 +
1.227 + /**
1.228 + * Returns the speaker balance set for playing.
1.229 + * Leaves on failure.
1.230 + * @since
1.231 + * @param TInt &aLeftPercentage On return contains the left speaker
1.232 + * volume percentage.
1.233 + * @param TInt &aRightPercentage On return contains the right speaker
1.234 + * volume percentage.
1.235 + * @return void
1.236 + */
1.237 + void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
1.238 +
1.239 + /**
1.240 + * Sets the speaker balance for playing. The speaker balance can be
1.241 + * changed before or during playback and is effective immediately.
1.242 + * Leaves on failure.
1.243 + * @since
1.244 + * @param TInt aLeftPercentage The left speaker volume percentage. This
1.245 + * can be any value from zero to 100. Setting
1.246 + * a zero value mutes the sound on left
1.247 + * speaker.
1.248 + * @param TInt aRightPercentage The right speaker volume percentage.
1.249 + * This can be any value from zero to 100.
1.250 + * Setting a zero value mutes the sound on
1.251 + * right speaker.
1.252 + * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent
1.253 + * to AsynchronousOperationComplete()
1.254 + * @return void
1.255 + */
1.256 + void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage, TBool& aAsyncCompletion);
1.257 +
1.258 + /**
1.259 + * Returns the microphone gain balance set for recording.
1.260 + * Leaves on failure.
1.261 + * @since
1.262 + * @param TInt &aLeftPercentage On return contains the left microphone
1.263 + * gain percentage.
1.264 + * @param TInt &aRightPercentage On return contains the right microphone
1.265 + * gain percentage.
1.266 + * @return void
1.267 + */
1.268 + void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
1.269 +
1.270 + /**
1.271 + * Sets the microphone balance for recording. The microphone balance can
1.272 + * be changed before or during recording and is effective immediately.
1.273 + * Leaves on failure.
1.274 + * @since
1.275 + * @param TInt aLeftPercentage The left microphone gain percentage. This
1.276 + * can be any value from zero to 100. Setting
1.277 + * a zero value mutes the sound from left
1.278 + * microphone.
1.279 + * @param TInt aRightPercentage The right microphone gain percentage.
1.280 + * This can be any value from zero to 100.
1.281 + * Setting a zero value mutes the sound from
1.282 + * right microphone.
1.283 + * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent
1.284 + * to AsynchronousOperationComplete()
1.285 + * @return void
1.286 + */
1.287 + void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage, TBool& aAsyncCompletion);
1.288 +
1.289 + /**
1.290 + * Initializes the audio device and starts the play process. This
1.291 + * function queries and acquires the audio policy before initializing
1.292 + * audio device. If there was an error during policy initialization,
1.293 + * PlayError() function will be called on the observer with error code
1.294 + * KErrAccessDenied, otherwise BufferToBeFilled() function will be called
1.295 + * with a buffer reference. After reading data into the buffer reference
1.296 + * passed, the client should call PlayData() to play data.
1.297 + * The amount of data that can be played is specified in
1.298 + * CMMFBuffer::RequestSize(). Any data that is read into buffer beyond
1.299 + * this size will be ignored.
1.300 + * Leaves on failure.
1.301 + * @since
1.302 + * @return void
1.303 + */
1.304 + void PlayInitL();
1.305 +
1.306 + /**
1.307 + * Initializes the audio device and starts the record process. This
1.308 + * function queries and acquires the audio policy before initializing
1.309 + * audio device. If there was an error during policy initialization,
1.310 + * RecordError() function will be called on the observer with error code
1.311 + * KErrAccessDenied, otherwise BufferToBeEmptied() function will be called
1.312 + * with a buffer reference. This buffer contains recorded or encoded
1.313 + * data. After processing data in the buffer reference passed, the client
1.314 + * should call RecordData() to continue recording process.
1.315 + * The amount of data that is available is specified in
1.316 + * CMMFBuffer::RequestSize().
1.317 + * Leaves on failure.
1.318 + * @since
1.319 + * @return void
1.320 + */
1.321 + void RecordInitL();
1.322 +
1.323 + /**
1.324 + * Plays data in the buffer at the current volume.
1.325 + * The client should fill the buffer with audio data before calling this
1.326 + * function. The observer gets a reference to the buffer along with the
1.327 + * callback function BufferToBeFilled(). When playing of the audio sample
1.328 + * is complete, successfully or otherwise, the function PlayError() on
1.329 + * the observer is called.
1.330 + * The last buffer of the audio stream being played should have the last
1.331 + * buffer flag set using CMMFBuffer::SetLastBuffer(TBool). If a
1.332 + * subsequent attempt to play the clip is made, this flag will need
1.333 + * resetting by the client.
1.334 + * @return void
1.335 + */
1.336 + void PlayData();
1.337 +
1.338 + /**
1.339 + * Contine the process of recording.
1.340 + * Once the buffer is filled with recorded data, the Observer gets a
1.341 + * reference to the buffer along with the callback function
1.342 + * BufferToBeEmptied(). After processing the buffer (copying over to a
1.343 + * different buffer or writing to file) the client should call this
1.344 + * function to continue the recording process.
1.345 + * @return void
1.346 + */
1.347 + void RecordData();
1.348 +
1.349 + /**
1.350 + * Stops the ongoing operation (Play, Record, TonePlay).
1.351 + * @since
1.352 + * @return KErrNone if successful, system wide error otherwise
1.353 + */
1.354 + TBool Stop();
1.355 +
1.356 + /**
1.357 + * Temporarily Stops the ongoing operation (Play, Record, TonePlay).
1.358 + * @since
1.359 + * @return KErrNone if successful, system wide error otherwise
1.360 + */
1.361 + TInt Pause();
1.362 +
1.363 + /**
1.364 + * Returns the Sample recorded so far
1.365 + * @since
1.366 + * @return TInt Returns the samples recorded.
1.367 + */
1.368 + TInt SamplesRecorded();
1.369 +
1.370 + /**
1.371 + * Returns the Sample played so far
1.372 + * @since
1.373 + * @return TInt Returns the samples played.
1.374 + */
1.375 + TInt SamplesPlayed();
1.376 +
1.377 + /**
1.378 + * Initializes the audio device and starts playing a tone. The tone is
1.379 + * played with the frequency and duration specified.
1.380 + * Leaves on failure.
1.381 + * @since
1.382 + * @param TInt aFrequency The frequency at which the tone will be played.
1.383 + * @param const TTimeIntervalMicroSeconds &aDuration The period over
1.384 + * which the tone will be played. A zero value causes the no tone
1.385 + * to be played.
1.386 + * @return void
1.387 + */
1.388 + void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
1.389 +
1.390 + /**
1.391 + * Initializes audio device and starts playing a dual tone. Dual Tone is
1.392 + * played with the specified frequencies and for the specified duration.
1.393 + * Leaves on failure.
1.394 + * @since
1.395 + * @param TInt aFrequencyOne The first frequency of dual tone.
1.396 + * @param TInt aFrequencyTwo The second frequency of dual tone.
1.397 + * @param const TTimeIntervalMicroSeconds &aDuration The period over
1.398 + * which the tone will be played. A zero value causes the no tone
1.399 + * to be played.
1.400 + * @return void
1.401 + */
1.402 + void PlayDualToneL(TInt aFrequencyOne,
1.403 + TInt aFrequencyTwo,
1.404 + const TTimeIntervalMicroSeconds& aDuration);
1.405 +
1.406 + /**
1.407 + * Initializes the audio device and starts playing the DTMF string
1.408 + * aDTMFString.
1.409 + * Leaves on failure.
1.410 + * @since
1.411 + * @param const TDesC &aDTMFString The DTMF sequence in a descriptor.
1.412 + * @return void
1.413 + */
1.414 + void PlayDTMFStringL(const TDesC& aDTMFString);
1.415 +
1.416 + /**
1.417 + * Initializes the audio device and starts playing a tone sequence.
1.418 + * Leaves on failure.
1.419 + * @since
1.420 + * @param const TDesC8 &aData The tone sequence in a descriptor.
1.421 + * @return void
1.422 + */
1.423 + void PlayToneSequenceL(const TDesC8& aData);
1.424 +
1.425 + /**
1.426 + * Initializes the audio device and starts playing the specified
1.427 + * pre-defined tone sequence.
1.428 + * Leaves on failure.
1.429 + * @since
1.430 + * @param TInt aSequenceNumber The index identifying the specific
1.431 + * pre-defined tone sequence. Index values are relative to zero.
1.432 + * This can be any value from zero to the value returned by a call
1.433 + * to FixedSequenceCount() - 1. The function raises a panic if the
1.434 + * sequence number is not within this range.
1.435 + * @return void
1.436 + */
1.437 + void PlayFixedSequenceL(TInt aSequenceNumber);
1.438 +
1.439 + /**
1.440 + * Defines the number of times the audio is to be repeated during the
1.441 + * tone playback operation. A period of silence can follow each playing
1.442 + * of a tone. The tone playing can be repeated indefinitely
1.443 + * @since
1.444 + * @param TInt aRepeatCount The number of times the tone, together with
1.445 + * the trailing silence, is to be repeated. If this is set to
1.446 + * KMdaRepeatForever, then the tone, together with the trailing
1.447 + * silence, is repeated indefinitely or until Stop() is called.
1.448 + * If this is set to zero, then the tone is not repeated.
1.449 + * @param const TTimeIntervalMicroSeconds &aRepeatTrailingSilence An
1.450 + * interval of silence which will be played after each tone.
1.451 + * Supported only during tone playing.
1.452 + * @return KErrNone if successful, system wide error otherwise
1.453 + */
1.454 + TInt SetToneRepeats(TInt aRepeatCount,
1.455 + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
1.456 +
1.457 + /**
1.458 + * Defines the duration of tone on, tone off and tone pause to be used
1.459 + * during the DTMF tone playback operation.
1.460 + * Supported only during tone playing.
1.461 + * @since
1.462 + * @param TTimeIntervalMicroSeconds32 &aToneOnLength The period over
1.463 + * which the tone will be played. If this is set to zero, then the
1.464 + * tone is not played.
1.465 + * @param TTimeIntervalMicroSeconds32 &aToneOffLength The period over
1.466 + * which the no tone will be played.
1.467 + * @param TTimeIntervalMicroSeconds32 &aPauseLength The period over which
1.468 + * the tone playing will be paused.
1.469 + * @return KErrNone if successful, system wide error otherwise
1.470 + */
1.471 + TInt SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength,
1.472 + TTimeIntervalMicroSeconds32& aToneOffLength,
1.473 + TTimeIntervalMicroSeconds32& aPauseLength);
1.474 +
1.475 + /**
1.476 + * Defines the period over which the volume level is to rise smoothly
1.477 + * from nothing to the normal volume level.
1.478 + * The function is only available before playing.
1.479 + * @since
1.480 + * @param const TTimeIntervalMicroSeconds &aRampDuration The period over
1.481 + * which the volume is to rise. A zero value causes the tone
1.482 + * sample to be played at the normal level for the full duration
1.483 + * of the playback. A value, which is longer than the duration of
1.484 + * the tone sample means that the sample never reaches its normal
1.485 + * volume level.
1.486 + * @return KErrNone if successful, system wide error otherwise
1.487 + */
1.488 + TInt SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
1.489 +
1.490 + /**
1.491 + * Defines the priority settings that should be used for this instance.
1.492 + * @since
1.493 + * @param const TMMFPrioritySettings &aPrioritySettings A class type
1.494 + * representing the client's priority, priority preference and
1.495 + * state
1.496 + * @return KErrNone if successful, system wide error otherwise
1.497 + */
1.498 + TInt SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
1.499 +
1.500 + /**
1.501 + * Retrieves a custom interface to the device.
1.502 + * @since
1.503 + * @param TUid aInterfaceId The interface UID, defined with the custom
1.504 + * interface.
1.505 + * @return TAny* A pointer to the interface implementation, or NULL if
1.506 + * the device does not implement the interface requested. The
1.507 + * return value must be cast to the correct type by the user.
1.508 + */
1.509 + TAny* CustomInterface(TUid aInterfaceId);
1.510 +
1.511 + /**
1.512 + * Returns the number of available pre-defined tone sequences.
1.513 + * This is the number of fixed sequence supported by DevSound by default.
1.514 + * @since
1.515 + * @return TInt The fixed sequence count. This value is implementation
1.516 + * dependent.
1.517 + */
1.518 + TInt FixedSequenceCount();
1.519 +
1.520 + /**
1.521 + * Returns the name assigned to a specific pre-defined tone sequence.
1.522 + * This is the number of the fixed sequence supported by DevSound by
1.523 + * default.
1.524 + * The function raises a panic if sequence number specified is invalid.
1.525 + * @since
1.526 + * @param TInt aSequenceNumber The index identifying the specific
1.527 + * pre-defined tone sequence. Index values are relative to zero.
1.528 + * This can be any value from zero to the value returned by a call
1.529 + * to CMdaAudioPlayerUtility::FixedSequenceCount() - 1. The
1.530 + * function raises a panic if sequence number is not within this
1.531 + * range.
1.532 + * @return const TDesC & A reference to a Descriptor containing the fixed
1.533 + * sequence name indexed by aSequenceNumber.
1.534 + */
1.535 + const TDesC& FixedSequenceName(TInt aSequenceNumber);
1.536 +
1.537 + /**
1.538 + * Returns a list of the supported input datatypes that can be sent to
1.539 + * DevSound for playing audio. The datatypes returned are those that the
1.540 + * DevSound supports given the priority settings passed in
1.541 + * aPrioritySettings. Note that if no supported data types are found this
1.542 + * does not constitute failure, the function will return normally with no
1.543 + * entries in aSupportedDataTypes.
1.544 + * Leaves on failure.
1.545 + * @since
1.546 + * @param RArray< TFourCC > &aSupportedDataTypes The array of supported
1.547 + * data types that will be filled in by this function. The
1.548 + * supported data types of the DevSound are in the form of an
1.549 + * array of TFourCC codes. Any existing entries in the array will
1.550 + * be overwritten on calling this function. If no supported data
1.551 + * types are found given the priority settings, then the
1.552 + * aSupportedDatatypes array will have zero entries.
1.553 + * @param const TMMFPrioritySettings &aPrioritySettings The priority
1.554 + * settings used to determine the supported datatypes. Note this
1.555 + * does not set the priority settings. For input datatypes the
1.556 + * iState member of the priority settings would be expected to be
1.557 + * either EMMFStatePlaying or EMMFStatePlayingRecording. The
1.558 + * priority settings may effect the supported datatypes depending
1.559 + * on the audio routing.
1.560 + * @return void
1.561 + */
1.562 + void GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypesconst,
1.563 + const TMMFPrioritySettings& aPrioritySettings) const;
1.564 +
1.565 + /**
1.566 + * Returns a list of the supported output dataypes that can be received
1.567 + * from DevSound for recording audio. The datatypes returned are those
1.568 + * that the DevSound supports given the priority settings passed in
1.569 + * aPrioritySettings. Note that if no supported data types are found this
1.570 + * does not constitute failure, the function will return normally with no
1.571 + * entries in aSupportedDataTypes.
1.572 + * Leaves on failure.
1.573 + * @since
1.574 + * @param RArray< TFourCC > &aSupportedDataTypes The array of supported
1.575 + * data types that will be filled in by this function. The
1.576 + * supported datatypes of the DevSound are in the form of an array
1.577 + * of TFourCC codes. Any existing entries in the array will be
1.578 + * overwritten on calling this function. If no supported datatypes
1.579 + * are found given the priority settings, then the
1.580 + * aSupportedDatatypes array will have zero entries.
1.581 + * @param const TMMFPrioritySettings &aPrioritySettings The priority
1.582 + * settings used to determine the supported data types. Note this
1.583 + * does not set the priority settings. For output data types the
1.584 + * iState member of the priority settings would expected to be
1.585 + * either EMMFStateRecording or EMMFStatePlayingRecording. The
1.586 + * priority settings may effect the supported datatypes depending
1.587 + * on the audio routing.
1.588 + * @return void
1.589 + */
1.590 + void GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes,
1.591 + const TMMFPrioritySettings& aPrioritySettings) const;
1.592 +
1.593 + /**
1.594 + * Sets client configuration
1.595 + * @since
1.596 + * @param aActualProcessId the effective devsound client (supplied with SetClientThreadInfo)
1.597 + * @param aProcessId the client of DevSound
1.598 + * @return KErrNone if successful, system wide error otherwise
1.599 + */
1.600 + TInt SetClientConfig(const TProcessId& aProcessId);
1.601 + TInt SetClientConfig(const TProcessId& aActualProcessId, const TProcessId& aProcessId);
1.602 +
1.603 + /**
1.604 + * Return to idle state, preparing for destruction.
1.605 + * @since
1.606 + * @return void
1.607 + */
1.608 + TBool CloseDevSound();
1.609 +
1.610 + /**
1.611 + * Called when a ProcessingFinished callback is received
1.612 + * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent
1.613 + * to AsynchronousOperationComplete()
1.614 + * @return an error code KErrNone if successful
1.615 + */
1.616 + TInt ProcessingFinishedReceived(TBool& aAyncCompletion);
1.617 +
1.618 + TInt ProcessingError(TBool& aAyncCompletion);
1.619 + /**
1.620 + * Empties the buffers below DevSound without deleting the codec
1.621 + * @since
1.622 + * @return KErrNone if successful, otherwise system-wide error code.
1.623 + */
1.624 + TInt EmptyBuffers();
1.625 +
1.626 + //provides interface for register a notification event
1.627 + TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
1.628 + //provides interface to cancel the registered notification
1.629 + TInt CancelRegisterAsClient(TUid aEventType);
1.630 + //Gets the notification data for client to resume
1.631 + TInt GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData);
1.632 + //waits for the client to resume playback even after the timeout expires
1.633 + TInt WillResumePlay();
1.634 +
1.635 + /**
1.636 + * Gets the current play time from the audio renderer
1.637 + * @since
1.638 + * @param TTimeIntervalMicroSeconds& aTime On return contains the current play time
1.639 + * @return an error code KErrNone if successful
1.640 + */
1.641 + TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime);
1.642 +
1.643 + /**
1.644 + * Queries if the low layers does support resume operation.
1.645 + * @since
1.646 + * @return TBool ETrue if Resume is supported
1.647 + * EFalse otherwise
1.648 + */
1.649 + TBool IsResumeSupported();
1.650 +
1.651 + /**
1.652 + * Resume the operation (Play, Record, TonePlay) temporarily paused .
1.653 + * @since
1.654 + * @return TInt KErrNone if succesful
1.655 + * KErrNotSupported if the operation is not supported by this implementation
1.656 + */
1.657 + TInt Resume();
1.658 +
1.659 + /*
1.660 + Used to send a stop call when there is a error in the buffer
1.661 + */
1.662 + void BufferErrorEvent();
1.663 +
1.664 + /**
1.665 + * Used rollback the adapror active state to the previous state prior a Commit call
1.666 + * @return void
1.667 + */
1.668 + void RollbackAdaptorActiveStateToBeforeCommit();
1.669 +
1.670 +private:
1.671 +
1.672 + CBody(MDevSoundAdaptationObserver& aDevSoundObserver,
1.673 + MGlobalProperties& aGlobalProperties);
1.674 +
1.675 + void ConstructL(MGlobalProperties& aGlobalProperties);
1.676 +
1.677 +private: // data
1.678 +
1.679 + /**
1.680 + * pointer to devsound framework for callbacks
1.681 + * Not own.
1.682 + */
1.683 + MDevSoundAdaptationObserver& iDevSoundObserver;
1.684 +
1.685 + /**
1.686 + * holds mode for which current instance is initialized for
1.687 + */
1.688 + TMMFState iMode;
1.689 +
1.690 + /**
1.691 + * holds format for which current instance is initialized for
1.692 + */
1.693 + TUid iFormat;
1.694 +
1.695 + /**
1.696 + * holds information of supported configurations
1.697 + * (channels, sampling rates, buffersize...)
1.698 + */
1.699 + TMMFCapabilities iMmfCapabilities;
1.700 +
1.701 + /**
1.702 + * holds information of current device configuration
1.703 + * (channels, sampling rates, buffersize...)
1.704 + */
1.705 + TMMFCapabilities iMmfConfig;
1.706 +
1.707 + /**
1.708 + * holds client audio type information
1.709 + */
1.710 + TMMFPrioritySettings iPrioritySettings;
1.711 +
1.712 + /**
1.713 + * pointer to devaudio
1.714 + * Own.
1.715 + */
1.716 + CDevAudio *iDevAudio;
1.717 +
1.718 + TToneData iToneData;
1.719 +
1.720 + // Pointer to global properties
1.721 + // Not owned.
1.722 + MGlobalProperties* iGlobalProperties;
1.723 + };
1.724 +
1.725 +#endif // MMFDEVSOUNDADAPTATIONBODY_H
1.726 +
1.727 +// End of File