|
1 /* |
|
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef MMFDEVSOUNDADAPTATIONBODY_H |
|
21 #define MMFDEVSOUNDADAPTATIONBODY_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <mmf/server/mmfhwdevice.h> |
|
25 #include <a3f/a3f_trace_utils.h> |
|
26 #include "mmfdevsoundadaptation.h" |
|
27 #include <a3f/tonedata.h> |
|
28 #include <a3f/audioprocessingunittypeuids.h> |
|
29 |
|
30 |
|
31 class CDevAudio; |
|
32 class CDevAudioControl; |
|
33 class MGlobalProperties; |
|
34 |
|
35 // CONSTANTS |
|
36 const TInt KDevsoundDefaultMaxGain = 10; |
|
37 const TUint KDevSoundMaxCaps = 0xFFFFFFFF; |
|
38 |
|
39 const TUint KDataForPlay = 0; |
|
40 const TUint KDataForRecord = 1; |
|
41 |
|
42 /** |
|
43 * Class implementing CMMFDevSoundAdaptation behaviour. |
|
44 * |
|
45 * @lib mmfdevsoundadaptation.lib |
|
46 */ |
|
47 class CMMFDevSoundAdaptation::CBody : public CBase |
|
48 { |
|
49 friend class CMMFDevSoundAdaptation; |
|
50 |
|
51 public: |
|
52 |
|
53 static CBody* NewL(MDevSoundAdaptationObserver& aDevSoundObserver, |
|
54 MGlobalProperties& aGlobalProperties); |
|
55 |
|
56 ~CBody(); |
|
57 |
|
58 public: // New functions |
|
59 |
|
60 /* |
|
61 * 2nd phase async open operation |
|
62 */ |
|
63 void PostOpenL(); |
|
64 |
|
65 /** |
|
66 * Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz. |
|
67 * On completion of Initialization, calls InitializeComplete() on |
|
68 * aDevSoundObserver. |
|
69 * Leaves on failure. |
|
70 * @since |
|
71 * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to DevSound |
|
72 * Observer instance. |
|
73 * @param TMMFState aMode Mode for which this object will be used. |
|
74 * @return void |
|
75 */ |
|
76 void InitializeL(TMMFState aMode); |
|
77 |
|
78 /** |
|
79 * Initializes DevSound object for the mode aMode for processing audio |
|
80 * data with hardware device aHWDev. |
|
81 * On completion of Initialization, calls InitializeComplete() on |
|
82 * aDevSoundObserver. |
|
83 * Leaves on failure. |
|
84 * @since |
|
85 * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to DevSound |
|
86 * Observer instance. |
|
87 * @param TUid aHWDev The CMMFHwDevice implementation identifier. |
|
88 * @param TMMFState aMode The mode for which this object will be used |
|
89 * @return void |
|
90 */ |
|
91 void InitializeL(TUid aHWDev, TMMFState aMode); |
|
92 |
|
93 /** |
|
94 * Initializes DevSound object for the mode aMode for processing audio |
|
95 * data with hardware device supporting FourCC aDesiredFourCC. |
|
96 * Leaves on failure. |
|
97 * @since |
|
98 * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference to DevSound |
|
99 * Observer instance. |
|
100 * @param TFourCC aDesiredFourCC The CMMFHwDevice implementation FourCC |
|
101 * code. |
|
102 * @param TMMFState aMode The mode for which this object will be used |
|
103 * @return KErrNone if successfull, else corresponding error code |
|
104 * @return void |
|
105 */ |
|
106 void InitializeL(TFourCC aDesiredFourCC, |
|
107 TMMFState aMode); |
|
108 |
|
109 /** |
|
110 * Initializes DevSound object with codec format aFormat |
|
111 * Leaves on failure. |
|
112 * @since |
|
113 * @param aDevSoundObserver A reference to DevSound Observer instance. |
|
114 * @param aFormat codec format |
|
115 * @param aMode The mode for which this object will be used |
|
116 */ |
|
117 void DoInitializeL(TUid aFormat, |
|
118 TMMFState aMode); |
|
119 |
|
120 /** |
|
121 * Cancels the initialization of a DevSound object. |
|
122 * @since |
|
123 * @return An error code indicating if the function call was successful. |
|
124 * KErrNone on success, |
|
125 * KerrNotReady if this is called before InitializeL() call or after |
|
126 * the object has been initialized, |
|
127 */ |
|
128 TInt CancelInitialize(); |
|
129 |
|
130 /** |
|
131 * Returns the supported Audio settings ie. encoding, sample rates, |
|
132 * mono/stereo operation, buffer size etc.. |
|
133 * @since |
|
134 * @return TMMFCapabilities The device settings. |
|
135 */ |
|
136 TInt Capabilities(TMMFCapabilities& aCap); |
|
137 |
|
138 /** |
|
139 * Returns the current device configuration. |
|
140 * @since |
|
141 * @return TMMFCapabilities The device settings. |
|
142 */ |
|
143 TMMFCapabilities Config() const; |
|
144 |
|
145 /** |
|
146 * Configure CMMFDevSound object with the settings in aConfig. Use this |
|
147 * to set sampling rate, encoding and mono/stereo. |
|
148 * Leaves on failure. |
|
149 * @since |
|
150 * @param const TMMFCapabilities& aConfig The attribute values to which |
|
151 * CMMFDevSound object will be configured to. |
|
152 * @return void |
|
153 */ |
|
154 void SetConfigL(const TMMFCapabilities& aCaps); |
|
155 |
|
156 /** |
|
157 * Returns an integer representing the maximum volume device supports. |
|
158 * This is the maximum value which can be passed to |
|
159 * CMMFDevSound::SetVolume. |
|
160 * @since |
|
161 * @return TInt The maximum volume. This value is platform dependent but |
|
162 * is always greater than or equal to one. |
|
163 */ |
|
164 TInt MaxVolume(); |
|
165 |
|
166 /** |
|
167 * Returns an integer representing the current volume. |
|
168 * @since |
|
169 * @return TInt The current volume level. |
|
170 */ |
|
171 TInt Volume(); |
|
172 |
|
173 /** |
|
174 * Changes the current playback volume to a specified value. The volume |
|
175 * can be changed before or during playback and is effective immediately. |
|
176 * @since |
|
177 * @param aVolume The volume setting. This can be any value from 0 |
|
178 * to the value returned by a call to |
|
179 * CMMFDevSound::MaxVolume(). If the volume is not |
|
180 * within this range, the volume is automatically set |
|
181 * to minimum or maximum value based on the value |
|
182 * that is being passed. Setting a zero value mutes |
|
183 * the sound. Setting the maximum value results in |
|
184 * the loudest possible sound. |
|
185 * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent |
|
186 * to AsynchronousOperationComplete() |
|
187 * @return KErrNone if successful, otherwise system-wide error code |
|
188 */ |
|
189 TInt SetVolume(TInt aVolume, TBool& aAyncCompletion); |
|
190 |
|
191 /** |
|
192 * Gets the maximum gain the device supports. |
|
193 * This is the maximum value which can be passed to CMMFDevSound::SetGain |
|
194 * @since |
|
195 * @return error |
|
196 */ |
|
197 TInt MaxGain(); |
|
198 |
|
199 /** |
|
200 * Returns an integer representing the current gain. |
|
201 * @since |
|
202 * @return TInt The current gain level. |
|
203 */ |
|
204 TInt Gain(); |
|
205 |
|
206 /** |
|
207 * Changes the current recording gain to a specified value. The gain can |
|
208 * be changed before or during recording and is effective immediately. |
|
209 * @since |
|
210 * @param TInt aGain The gain setting. This can be any value from zero to |
|
211 * the value returned by a call to |
|
212 * CMMFDevSound::MaxGain(). If the volume |
|
213 * is not within this range, the gain is automatically |
|
214 * set to minimum or maximum value based on the value |
|
215 * that is being passed. Setting a zero value mutes the |
|
216 * sound. Setting the maximum value results in the |
|
217 * loudest possible sound. |
|
218 * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent |
|
219 * to AsynchronousOperationComplete() |
|
220 * @return void |
|
221 */ |
|
222 TInt SetGain(TInt aGain, TBool& aAyncCompletion); |
|
223 |
|
224 /** |
|
225 * Returns the speaker balance set for playing. |
|
226 * Leaves on failure. |
|
227 * @since |
|
228 * @param TInt &aLeftPercentage On return contains the left speaker |
|
229 * volume percentage. |
|
230 * @param TInt &aRightPercentage On return contains the right speaker |
|
231 * volume percentage. |
|
232 * @return void |
|
233 */ |
|
234 void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); |
|
235 |
|
236 /** |
|
237 * Sets the speaker balance for playing. The speaker balance can be |
|
238 * changed before or during playback and is effective immediately. |
|
239 * Leaves on failure. |
|
240 * @since |
|
241 * @param TInt aLeftPercentage The left speaker volume percentage. This |
|
242 * can be any value from zero to 100. Setting |
|
243 * a zero value mutes the sound on left |
|
244 * speaker. |
|
245 * @param TInt aRightPercentage The right speaker volume percentage. |
|
246 * This can be any value from zero to 100. |
|
247 * Setting a zero value mutes the sound on |
|
248 * right speaker. |
|
249 * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent |
|
250 * to AsynchronousOperationComplete() |
|
251 * @return void |
|
252 */ |
|
253 void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage, TBool& aAsyncCompletion); |
|
254 |
|
255 /** |
|
256 * Returns the microphone gain balance set for recording. |
|
257 * Leaves on failure. |
|
258 * @since |
|
259 * @param TInt &aLeftPercentage On return contains the left microphone |
|
260 * gain percentage. |
|
261 * @param TInt &aRightPercentage On return contains the right microphone |
|
262 * gain percentage. |
|
263 * @return void |
|
264 */ |
|
265 void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); |
|
266 |
|
267 /** |
|
268 * Sets the microphone balance for recording. The microphone balance can |
|
269 * be changed before or during recording and is effective immediately. |
|
270 * Leaves on failure. |
|
271 * @since |
|
272 * @param TInt aLeftPercentage The left microphone gain percentage. This |
|
273 * can be any value from zero to 100. Setting |
|
274 * a zero value mutes the sound from left |
|
275 * microphone. |
|
276 * @param TInt aRightPercentage The right microphone gain percentage. |
|
277 * This can be any value from zero to 100. |
|
278 * Setting a zero value mutes the sound from |
|
279 * right microphone. |
|
280 * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent |
|
281 * to AsynchronousOperationComplete() |
|
282 * @return void |
|
283 */ |
|
284 void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage, TBool& aAsyncCompletion); |
|
285 |
|
286 /** |
|
287 * Initializes the audio device and starts the play process. This |
|
288 * function queries and acquires the audio policy before initializing |
|
289 * audio device. If there was an error during policy initialization, |
|
290 * PlayError() function will be called on the observer with error code |
|
291 * KErrAccessDenied, otherwise BufferToBeFilled() function will be called |
|
292 * with a buffer reference. After reading data into the buffer reference |
|
293 * passed, the client should call PlayData() to play data. |
|
294 * The amount of data that can be played is specified in |
|
295 * CMMFBuffer::RequestSize(). Any data that is read into buffer beyond |
|
296 * this size will be ignored. |
|
297 * Leaves on failure. |
|
298 * @since |
|
299 * @return void |
|
300 */ |
|
301 void PlayInitL(); |
|
302 |
|
303 /** |
|
304 * Initializes the audio device and starts the record process. This |
|
305 * function queries and acquires the audio policy before initializing |
|
306 * audio device. If there was an error during policy initialization, |
|
307 * RecordError() function will be called on the observer with error code |
|
308 * KErrAccessDenied, otherwise BufferToBeEmptied() function will be called |
|
309 * with a buffer reference. This buffer contains recorded or encoded |
|
310 * data. After processing data in the buffer reference passed, the client |
|
311 * should call RecordData() to continue recording process. |
|
312 * The amount of data that is available is specified in |
|
313 * CMMFBuffer::RequestSize(). |
|
314 * Leaves on failure. |
|
315 * @since |
|
316 * @return void |
|
317 */ |
|
318 void RecordInitL(); |
|
319 |
|
320 /** |
|
321 * Plays data in the buffer at the current volume. |
|
322 * The client should fill the buffer with audio data before calling this |
|
323 * function. The observer gets a reference to the buffer along with the |
|
324 * callback function BufferToBeFilled(). When playing of the audio sample |
|
325 * is complete, successfully or otherwise, the function PlayError() on |
|
326 * the observer is called. |
|
327 * The last buffer of the audio stream being played should have the last |
|
328 * buffer flag set using CMMFBuffer::SetLastBuffer(TBool). If a |
|
329 * subsequent attempt to play the clip is made, this flag will need |
|
330 * resetting by the client. |
|
331 * @return void |
|
332 */ |
|
333 void PlayData(); |
|
334 |
|
335 /** |
|
336 * Contine the process of recording. |
|
337 * Once the buffer is filled with recorded data, the Observer gets a |
|
338 * reference to the buffer along with the callback function |
|
339 * BufferToBeEmptied(). After processing the buffer (copying over to a |
|
340 * different buffer or writing to file) the client should call this |
|
341 * function to continue the recording process. |
|
342 * @return void |
|
343 */ |
|
344 void RecordData(); |
|
345 |
|
346 /** |
|
347 * Stops the ongoing operation (Play, Record, TonePlay). |
|
348 * @since |
|
349 * @return KErrNone if successful, system wide error otherwise |
|
350 */ |
|
351 TBool Stop(); |
|
352 |
|
353 /** |
|
354 * Temporarily Stops the ongoing operation (Play, Record, TonePlay). |
|
355 * @since |
|
356 * @return KErrNone if successful, system wide error otherwise |
|
357 */ |
|
358 TInt Pause(); |
|
359 |
|
360 /** |
|
361 * Returns the Sample recorded so far |
|
362 * @since |
|
363 * @return TInt Returns the samples recorded. |
|
364 */ |
|
365 TInt SamplesRecorded(); |
|
366 |
|
367 /** |
|
368 * Returns the Sample played so far |
|
369 * @since |
|
370 * @return TInt Returns the samples played. |
|
371 */ |
|
372 TInt SamplesPlayed(); |
|
373 |
|
374 /** |
|
375 * Initializes the audio device and starts playing a tone. The tone is |
|
376 * played with the frequency and duration specified. |
|
377 * Leaves on failure. |
|
378 * @since |
|
379 * @param TInt aFrequency The frequency at which the tone will be played. |
|
380 * @param const TTimeIntervalMicroSeconds &aDuration The period over |
|
381 * which the tone will be played. A zero value causes the no tone |
|
382 * to be played. |
|
383 * @return void |
|
384 */ |
|
385 void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration); |
|
386 |
|
387 /** |
|
388 * Initializes audio device and starts playing a dual tone. Dual Tone is |
|
389 * played with the specified frequencies and for the specified duration. |
|
390 * Leaves on failure. |
|
391 * @since |
|
392 * @param TInt aFrequencyOne The first frequency of dual tone. |
|
393 * @param TInt aFrequencyTwo The second frequency of dual tone. |
|
394 * @param const TTimeIntervalMicroSeconds &aDuration The period over |
|
395 * which the tone will be played. A zero value causes the no tone |
|
396 * to be played. |
|
397 * @return void |
|
398 */ |
|
399 void PlayDualToneL(TInt aFrequencyOne, |
|
400 TInt aFrequencyTwo, |
|
401 const TTimeIntervalMicroSeconds& aDuration); |
|
402 |
|
403 /** |
|
404 * Initializes the audio device and starts playing the DTMF string |
|
405 * aDTMFString. |
|
406 * Leaves on failure. |
|
407 * @since |
|
408 * @param const TDesC &aDTMFString The DTMF sequence in a descriptor. |
|
409 * @return void |
|
410 */ |
|
411 void PlayDTMFStringL(const TDesC& aDTMFString); |
|
412 |
|
413 /** |
|
414 * Initializes the audio device and starts playing a tone sequence. |
|
415 * Leaves on failure. |
|
416 * @since |
|
417 * @param const TDesC8 &aData The tone sequence in a descriptor. |
|
418 * @return void |
|
419 */ |
|
420 void PlayToneSequenceL(const TDesC8& aData); |
|
421 |
|
422 /** |
|
423 * Initializes the audio device and starts playing the specified |
|
424 * pre-defined tone sequence. |
|
425 * Leaves on failure. |
|
426 * @since |
|
427 * @param TInt aSequenceNumber The index identifying the specific |
|
428 * pre-defined tone sequence. Index values are relative to zero. |
|
429 * This can be any value from zero to the value returned by a call |
|
430 * to FixedSequenceCount() - 1. The function raises a panic if the |
|
431 * sequence number is not within this range. |
|
432 * @return void |
|
433 */ |
|
434 void PlayFixedSequenceL(TInt aSequenceNumber); |
|
435 |
|
436 /** |
|
437 * Defines the number of times the audio is to be repeated during the |
|
438 * tone playback operation. A period of silence can follow each playing |
|
439 * of a tone. The tone playing can be repeated indefinitely |
|
440 * @since |
|
441 * @param TInt aRepeatCount The number of times the tone, together with |
|
442 * the trailing silence, is to be repeated. If this is set to |
|
443 * KMdaRepeatForever, then the tone, together with the trailing |
|
444 * silence, is repeated indefinitely or until Stop() is called. |
|
445 * If this is set to zero, then the tone is not repeated. |
|
446 * @param const TTimeIntervalMicroSeconds &aRepeatTrailingSilence An |
|
447 * interval of silence which will be played after each tone. |
|
448 * Supported only during tone playing. |
|
449 * @return KErrNone if successful, system wide error otherwise |
|
450 */ |
|
451 TInt SetToneRepeats(TInt aRepeatCount, |
|
452 const TTimeIntervalMicroSeconds& aRepeatTrailingSilence); |
|
453 |
|
454 /** |
|
455 * Defines the duration of tone on, tone off and tone pause to be used |
|
456 * during the DTMF tone playback operation. |
|
457 * Supported only during tone playing. |
|
458 * @since |
|
459 * @param TTimeIntervalMicroSeconds32 &aToneOnLength The period over |
|
460 * which the tone will be played. If this is set to zero, then the |
|
461 * tone is not played. |
|
462 * @param TTimeIntervalMicroSeconds32 &aToneOffLength The period over |
|
463 * which the no tone will be played. |
|
464 * @param TTimeIntervalMicroSeconds32 &aPauseLength The period over which |
|
465 * the tone playing will be paused. |
|
466 * @return KErrNone if successful, system wide error otherwise |
|
467 */ |
|
468 TInt SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, |
|
469 TTimeIntervalMicroSeconds32& aToneOffLength, |
|
470 TTimeIntervalMicroSeconds32& aPauseLength); |
|
471 |
|
472 /** |
|
473 * Defines the period over which the volume level is to rise smoothly |
|
474 * from nothing to the normal volume level. |
|
475 * The function is only available before playing. |
|
476 * @since |
|
477 * @param const TTimeIntervalMicroSeconds &aRampDuration The period over |
|
478 * which the volume is to rise. A zero value causes the tone |
|
479 * sample to be played at the normal level for the full duration |
|
480 * of the playback. A value, which is longer than the duration of |
|
481 * the tone sample means that the sample never reaches its normal |
|
482 * volume level. |
|
483 * @return KErrNone if successful, system wide error otherwise |
|
484 */ |
|
485 TInt SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); |
|
486 |
|
487 /** |
|
488 * Defines the priority settings that should be used for this instance. |
|
489 * @since |
|
490 * @param const TMMFPrioritySettings &aPrioritySettings A class type |
|
491 * representing the client's priority, priority preference and |
|
492 * state |
|
493 * @return KErrNone if successful, system wide error otherwise |
|
494 */ |
|
495 TInt SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings); |
|
496 |
|
497 /** |
|
498 * Retrieves a custom interface to the device. |
|
499 * @since |
|
500 * @param TUid aInterfaceId The interface UID, defined with the custom |
|
501 * interface. |
|
502 * @return TAny* A pointer to the interface implementation, or NULL if |
|
503 * the device does not implement the interface requested. The |
|
504 * return value must be cast to the correct type by the user. |
|
505 */ |
|
506 TAny* CustomInterface(TUid aInterfaceId); |
|
507 |
|
508 /** |
|
509 * Returns the number of available pre-defined tone sequences. |
|
510 * This is the number of fixed sequence supported by DevSound by default. |
|
511 * @since |
|
512 * @return TInt The fixed sequence count. This value is implementation |
|
513 * dependent. |
|
514 */ |
|
515 TInt FixedSequenceCount(); |
|
516 |
|
517 /** |
|
518 * Returns the name assigned to a specific pre-defined tone sequence. |
|
519 * This is the number of the fixed sequence supported by DevSound by |
|
520 * default. |
|
521 * The function raises a panic if sequence number specified is invalid. |
|
522 * @since |
|
523 * @param TInt aSequenceNumber The index identifying the specific |
|
524 * pre-defined tone sequence. Index values are relative to zero. |
|
525 * This can be any value from zero to the value returned by a call |
|
526 * to CMdaAudioPlayerUtility::FixedSequenceCount() - 1. The |
|
527 * function raises a panic if sequence number is not within this |
|
528 * range. |
|
529 * @return const TDesC & A reference to a Descriptor containing the fixed |
|
530 * sequence name indexed by aSequenceNumber. |
|
531 */ |
|
532 const TDesC& FixedSequenceName(TInt aSequenceNumber); |
|
533 |
|
534 /** |
|
535 * Returns a list of the supported input datatypes that can be sent to |
|
536 * DevSound for playing audio. The datatypes returned are those that the |
|
537 * DevSound supports given the priority settings passed in |
|
538 * aPrioritySettings. Note that if no supported data types are found this |
|
539 * does not constitute failure, the function will return normally with no |
|
540 * entries in aSupportedDataTypes. |
|
541 * Leaves on failure. |
|
542 * @since |
|
543 * @param RArray< TFourCC > &aSupportedDataTypes The array of supported |
|
544 * data types that will be filled in by this function. The |
|
545 * supported data types of the DevSound are in the form of an |
|
546 * array of TFourCC codes. Any existing entries in the array will |
|
547 * be overwritten on calling this function. If no supported data |
|
548 * types are found given the priority settings, then the |
|
549 * aSupportedDatatypes array will have zero entries. |
|
550 * @param const TMMFPrioritySettings &aPrioritySettings The priority |
|
551 * settings used to determine the supported datatypes. Note this |
|
552 * does not set the priority settings. For input datatypes the |
|
553 * iState member of the priority settings would be expected to be |
|
554 * either EMMFStatePlaying or EMMFStatePlayingRecording. The |
|
555 * priority settings may effect the supported datatypes depending |
|
556 * on the audio routing. |
|
557 * @return void |
|
558 */ |
|
559 void GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypesconst, |
|
560 const TMMFPrioritySettings& aPrioritySettings) const; |
|
561 |
|
562 /** |
|
563 * Returns a list of the supported output dataypes that can be received |
|
564 * from DevSound for recording audio. The datatypes returned are those |
|
565 * that the DevSound supports given the priority settings passed in |
|
566 * aPrioritySettings. Note that if no supported data types are found this |
|
567 * does not constitute failure, the function will return normally with no |
|
568 * entries in aSupportedDataTypes. |
|
569 * Leaves on failure. |
|
570 * @since |
|
571 * @param RArray< TFourCC > &aSupportedDataTypes The array of supported |
|
572 * data types that will be filled in by this function. The |
|
573 * supported datatypes of the DevSound are in the form of an array |
|
574 * of TFourCC codes. Any existing entries in the array will be |
|
575 * overwritten on calling this function. If no supported datatypes |
|
576 * are found given the priority settings, then the |
|
577 * aSupportedDatatypes array will have zero entries. |
|
578 * @param const TMMFPrioritySettings &aPrioritySettings The priority |
|
579 * settings used to determine the supported data types. Note this |
|
580 * does not set the priority settings. For output data types the |
|
581 * iState member of the priority settings would expected to be |
|
582 * either EMMFStateRecording or EMMFStatePlayingRecording. The |
|
583 * priority settings may effect the supported datatypes depending |
|
584 * on the audio routing. |
|
585 * @return void |
|
586 */ |
|
587 void GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes, |
|
588 const TMMFPrioritySettings& aPrioritySettings) const; |
|
589 |
|
590 /** |
|
591 * Sets client configuration |
|
592 * @since |
|
593 * @param TMMFClientConfig& aClientConfig A reference to client |
|
594 * configuration object. |
|
595 * @return KErrNone if successful, system wide error otherwise |
|
596 */ |
|
597 TInt SetClientConfig(const TMMFClientConfig& aClientConfig); |
|
598 |
|
599 /** |
|
600 * Returns client configuration |
|
601 * @since |
|
602 * @return const TMMFClientConfig& A constant reference to client |
|
603 * configuration. |
|
604 */ |
|
605 const TMMFClientConfig& ClientConfig() const; |
|
606 |
|
607 /** |
|
608 * Return to idle state, preparing for destruction. |
|
609 * @since |
|
610 * @return void |
|
611 */ |
|
612 TBool CloseDevSound(); |
|
613 |
|
614 /** |
|
615 * Called when a ProcessingFinished callback is received |
|
616 * @param aAsyncCompletion Returns ETrue to say the call is asynchronous, with result sent |
|
617 * to AsynchronousOperationComplete() |
|
618 * @return an error code KErrNone if successful |
|
619 */ |
|
620 TInt ProcessingFinishedReceived(TBool& aAyncCompletion); |
|
621 |
|
622 TInt ProcessingError(TBool& aAyncCompletion); |
|
623 /** |
|
624 * Empties the buffers below DevSound without deleting the codec |
|
625 * @since |
|
626 * @return KErrNone if successful, otherwise system-wide error code. |
|
627 */ |
|
628 TInt EmptyBuffers(); |
|
629 |
|
630 //provides interface for register a notification event |
|
631 TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8); |
|
632 //provides interface to cancel the registered notification |
|
633 TInt CancelRegisterAsClient(TUid aEventType); |
|
634 //Gets the notification data for client to resume |
|
635 TInt GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData); |
|
636 //waits for the client to resume playback even after the timeout expires |
|
637 TInt WillResumePlay(); |
|
638 |
|
639 /** |
|
640 * Gets the current play time from the audio renderer |
|
641 * @since |
|
642 * @param TTimeIntervalMicroSeconds& aTime On return contains the current play time |
|
643 * @return an error code KErrNone if successful |
|
644 */ |
|
645 TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime); |
|
646 |
|
647 /** |
|
648 * Queries if the low layers does support resume operation. |
|
649 * @since |
|
650 * @return TBool ETrue if Resume is supported |
|
651 * EFalse otherwise |
|
652 */ |
|
653 TBool IsResumeSupported(); |
|
654 |
|
655 /** |
|
656 * Resume the operation (Play, Record, TonePlay) temporarily paused . |
|
657 * @since |
|
658 * @return TInt KErrNone if succesful |
|
659 * KErrNotSupported if the operation is not supported by this implementation |
|
660 */ |
|
661 TInt Resume(); |
|
662 |
|
663 /* |
|
664 Used to send a stop call when there is a error in the buffer |
|
665 */ |
|
666 void BufferErrorEvent(); |
|
667 |
|
668 private: |
|
669 |
|
670 CBody(MDevSoundAdaptationObserver& aDevSoundObserver, |
|
671 MGlobalProperties& aGlobalProperties); |
|
672 |
|
673 void ConstructL(MGlobalProperties& aGlobalProperties); |
|
674 |
|
675 private: // data |
|
676 |
|
677 /** |
|
678 * pointer to devsound framework for callbacks |
|
679 * Not own. |
|
680 */ |
|
681 MDevSoundAdaptationObserver& iDevSoundObserver; |
|
682 |
|
683 /** |
|
684 * holds mode for which current instance is initialized for |
|
685 */ |
|
686 TMMFState iMode; |
|
687 |
|
688 /** |
|
689 * holds format for which current instance is initialized for |
|
690 */ |
|
691 TUid iFormat; |
|
692 |
|
693 /** |
|
694 * holds information of supported configurations |
|
695 * (channels, sampling rates, buffersize...) |
|
696 */ |
|
697 TMMFCapabilities iMmfCapabilities; |
|
698 |
|
699 /** |
|
700 * holds information of current device configuration |
|
701 * (channels, sampling rates, buffersize...) |
|
702 */ |
|
703 TMMFCapabilities iMmfConfig; |
|
704 |
|
705 /** |
|
706 * holds client platsec related information (VID,SID,PID,caps) |
|
707 */ |
|
708 TMMFClientConfig iClientConfig; |
|
709 |
|
710 /** |
|
711 * holds client audio type information |
|
712 */ |
|
713 TMMFPrioritySettings iPrioritySettings; |
|
714 |
|
715 /** |
|
716 * pointer to devaudio |
|
717 * Own. |
|
718 */ |
|
719 CDevAudio *iDevAudio; |
|
720 |
|
721 TToneData iToneData; |
|
722 |
|
723 // Pointer to global properties |
|
724 // Not owned. |
|
725 MGlobalProperties* iGlobalProperties; |
|
726 }; |
|
727 |
|
728 #endif // MMFDEVSOUNDADAPTATIONBODY_H |
|
729 |
|
730 // End of File |