1 /* |
|
2 * Copyright (c) 2006-2008 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: Audio Stubs - Declaration of CMMFDevSoundAdaptation::CBody. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef MMFDEVSOUNDADAPTATIONBODY_H |
|
21 #define MMFDEVSOUNDADAPTATIONBODY_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <mmfhwdevice.h> |
|
26 #include <MmfDevSoundAdaptation.h> |
|
27 //#include <MdaSound.h> |
|
28 #include "ToneGenerator.h" |
|
29 #include "DevSoundUtility.h" |
|
30 |
|
31 |
|
32 // CONSTANTS |
|
33 const TInt KDevSoundDefaultFrameSize = 0x1000; |
|
34 const TInt KDevSoundMinFrameSize = 0x800; //2K |
|
35 const TInt KDevSoundMaxFrameSize = 0x4000; //16K |
|
36 const TInt KDevSoundDeltaFrameSize = 0x800; //2K |
|
37 const TInt KDevSoundFramesPerSecond = 4; |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CMMFHwDeviceStub; |
|
41 class CTonePlayCompleteTimer; |
|
42 class CBytesPlayedCIImpl; |
|
43 |
|
44 class CG711DecoderIntfcCI; |
|
45 class CG711EncoderIntfcCI; |
|
46 class CG729DecoderIntfcCI; |
|
47 class CG729EncoderIntfcCI; |
|
48 class CIlbcDecoderIntfcCI; |
|
49 class CIlbcEncoderIntfcCI; |
|
50 class CSpeechEncoderConfigCI; |
|
51 class CErrorConcealmentIntfcCI; |
|
52 |
|
53 // CLASS DECLARATION |
|
54 |
|
55 /** |
|
56 * Class implementing CMMFDevSoundAdaptation behaviour. |
|
57 * |
|
58 * @lib MmfDevSoundAdaptation_Stub.lib |
|
59 * @since S60 3.0 |
|
60 */ |
|
61 class CMMFDevSoundAdaptation::CBody : public CBase, |
|
62 public MMMFHwDeviceObserver |
|
63 { |
|
64 public: // Constructors and destructor |
|
65 |
|
66 /** |
|
67 * Constructs, and returns a pointer to, a new CBody object. |
|
68 * Leaves on failure.. |
|
69 * @return CBody* A pointer to newly created object. |
|
70 */ |
|
71 static CBody* NewL(); |
|
72 |
|
73 /** |
|
74 * Destructor. |
|
75 */ |
|
76 ~CBody(); |
|
77 |
|
78 public: // New functions |
|
79 |
|
80 /** |
|
81 * Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz. |
|
82 * On completion of Initialization, calls InitializeComplete() on |
|
83 * aDevSoundObserver. |
|
84 * Leaves on failure. |
|
85 * @since S60 3.0 |
|
86 * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference |
|
87 * to the DevSound adaptation observer instance. |
|
88 * @param TMMFState aMode Mode for which this object will be used. |
|
89 * @return void |
|
90 */ |
|
91 void InitializeL(MDevSoundAdaptationObserver& aDevSoundObserver, |
|
92 TMMFState aMode); |
|
93 |
|
94 /** |
|
95 * Initializes DevSound object for the mode aMode for processing audio |
|
96 * data with hardware device aHWDev. |
|
97 * On completion of Initialization, calls InitializeComplete() on |
|
98 * aDevSoundObserver. |
|
99 * Leaves on failure. |
|
100 * @since S60 3.0 |
|
101 * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference |
|
102 * to the DevSound adaptation observer instance. |
|
103 * @param TUid aHWDev The CMMFHwDevice implementation identifier. |
|
104 * @param TMMFState aMode The mode for which this object will be used |
|
105 * @return void |
|
106 */ |
|
107 void InitializeL(MDevSoundAdaptationObserver& aDevSoundObserver, |
|
108 TUid aHWDev, TMMFState aMode); |
|
109 |
|
110 /** |
|
111 * Initializes DevSound object for the mode aMode for processing audio |
|
112 * data with hardware device supporting FourCC aDesiredFourCC. |
|
113 * Leaves on failure. |
|
114 * @since S60 3.0 |
|
115 * @param MDevSoundAdaptationObserver& aDevSoundObserver A reference |
|
116 * to the DevSound adaptation observer instance. |
|
117 * @param TFourCC aDesiredFourCC The CMMFHwDevice implementation FourCC |
|
118 * code. |
|
119 * @param TMMFState aMode The mode for which this object will be used |
|
120 * @return KErrNone if successfull, else corresponding error code |
|
121 * @return void |
|
122 */ |
|
123 void InitializeL(MDevSoundAdaptationObserver& aDevSoundObserver, |
|
124 TFourCC aDesiredFourCC, |
|
125 TMMFState aMode); |
|
126 |
|
127 /** |
|
128 * Returns the supported Audio settings ie. encoding, sample rates, |
|
129 * mono/stereo operation, buffer size etc.. |
|
130 * @since S60 3.0 |
|
131 * @return TMMFCapabilities The device settings. |
|
132 */ |
|
133 TMMFCapabilities Capabilities(); |
|
134 |
|
135 /** |
|
136 * Returns the current device configuration. |
|
137 * @since S60 3.0 |
|
138 * @return TMMFCapabilities The device settings. |
|
139 */ |
|
140 TMMFCapabilities Config() const; |
|
141 |
|
142 /** |
|
143 * Configure CMMFDevSound object with the settings in aConfig. Use this |
|
144 * to set sampling rate, encoding and mono/stereo. |
|
145 * Leaves on failure. |
|
146 * @since S60 3.0 |
|
147 * @param const TMMFCapabilities& aConfig The attribute values to which |
|
148 * CMMFDevSound object will be configured to. |
|
149 * @return void |
|
150 */ |
|
151 void SetConfigL(const TMMFCapabilities& aCaps); |
|
152 |
|
153 /** |
|
154 * Returns an integer representing the maximum volume device supports. |
|
155 * This is the maximum value which can be passed to |
|
156 * CMMFDevSound::SetVolume. |
|
157 * @since S60 3.0 |
|
158 * @return TInt The maximum volume. This value is platform dependent but |
|
159 * is always greater than or equal to one. |
|
160 */ |
|
161 TInt MaxVolume(); |
|
162 |
|
163 /** |
|
164 * Returns an integer representing the current volume. |
|
165 * @since S60 3.0 |
|
166 * @return TInt The current volume level. |
|
167 */ |
|
168 TInt Volume(); |
|
169 |
|
170 /** |
|
171 * Changes the current playback volume to a specified value. The volume |
|
172 * can be changed before or during playback and is effective immediately. |
|
173 * @since S60 3.0 |
|
174 * @param TInt aVolume The volume setting. This can be any value from 0 |
|
175 * to the value returned by a call to |
|
176 * CMMFDevSound::MaxVolume(). If the volume is not |
|
177 * within this range, the volume is automatically set |
|
178 * to minimum or maximum value based on the value |
|
179 * that is being passed. Setting a zero value mutes |
|
180 * the sound. Setting the maximum value results in |
|
181 * the loudest possible sound. |
|
182 * @return void |
|
183 */ |
|
184 void SetVolume(TInt aVolume); |
|
185 |
|
186 /** |
|
187 * Returns an integer representing the maximum gain the device supports. |
|
188 * This is the maximum value which can be passed to CMMFDevSound::SetGain |
|
189 * @since S60 3.0 |
|
190 * @return TInt The maximum gain. This value is platform dependent but is |
|
191 * always greater than or equal to one. |
|
192 */ |
|
193 TInt MaxGain(); |
|
194 |
|
195 /** |
|
196 * Returns an integer representing the current gain. |
|
197 * @since S60 3.0 |
|
198 * @return TInt The current gain level. |
|
199 */ |
|
200 TInt Gain(); |
|
201 |
|
202 /** |
|
203 * Changes the current recording gain to a specified value. The gain can |
|
204 * be changed before or during recording and is effective immediately. |
|
205 * @since S60 3.0 |
|
206 * @param TInt aGain The gain setting. This can be any value from zero to |
|
207 * the value returned by a call to |
|
208 * CMMFDevSound::MaxGain(). If the volume |
|
209 * is not within this range, the gain is automatically |
|
210 * set to minimum or maximum value based on the value |
|
211 * that is being passed. Setting a zero value mutes the |
|
212 * sound. Setting the maximum value results in the |
|
213 * loudest possible sound. |
|
214 * @return void |
|
215 */ |
|
216 void SetGain(TInt aGain); |
|
217 |
|
218 /** |
|
219 * Returns the speaker balance set for playing. |
|
220 * Leaves on failure. |
|
221 * @since S60 3.0 |
|
222 * @param TInt &aLeftPercentage On return contains the left speaker |
|
223 * volume percentage. |
|
224 * @param TInt &aRightPercentage On return contains the right speaker |
|
225 * volume percentage. |
|
226 * @return void |
|
227 */ |
|
228 void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); |
|
229 |
|
230 /** |
|
231 * Sets the speaker balance for playing. The speaker balance can be |
|
232 * changed before or during playback and is effective immediately. |
|
233 * Leaves on failure. |
|
234 * @since S60 3.0 |
|
235 * @param TInt aLeftPercentage The left speaker volume percentage. This |
|
236 * can be any value from zero to 100. Setting |
|
237 * a zero value mutes the sound on left |
|
238 * speaker. |
|
239 * @param TInt aRightPercentage The right speaker volume percentage. |
|
240 * This can be any value from zero to 100. |
|
241 * Setting a zero value mutes the sound on |
|
242 * right speaker. |
|
243 * @return void |
|
244 */ |
|
245 void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage); |
|
246 |
|
247 /** |
|
248 * Returns the microphone gain balance set for recording. |
|
249 * Leaves on failure. |
|
250 * @since S60 3.0 |
|
251 * @param TInt &aLeftPercentage On return contains the left microphone |
|
252 * gain percentage. |
|
253 * @param TInt &aRightPercentage On return contains the right microphone |
|
254 * gain percentage. |
|
255 * @return void |
|
256 */ |
|
257 void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); |
|
258 |
|
259 /** |
|
260 * Sets the microphone balance for recording. The microphone balance can |
|
261 * be changed before or during recording and is effective immediately. |
|
262 * Leaves on failure. |
|
263 * @since S60 3.0 |
|
264 * @param TInt aLeftPercentage The left microphone gain percentage. This |
|
265 * can be any value from zero to 100. Setting |
|
266 * a zero value mutes the sound from left |
|
267 * microphone. |
|
268 * @param TInt aRightPercentage The right microphone gain percentage. |
|
269 * This can be any value from zero to 100. |
|
270 * Setting a zero value mutes the sound from |
|
271 * right microphone. |
|
272 * @return void |
|
273 */ |
|
274 void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage); |
|
275 |
|
276 /** |
|
277 * Initializes the audio device and starts the play process. This |
|
278 * function queries and acquires the audio policy before initializing |
|
279 * audio device. If there was an error during policy initialization, |
|
280 * PlayError() function will be called on the observer with error code |
|
281 * KErrAccessDenied, otherwise BufferToBeFilled() function will be called |
|
282 * with a buffer reference. After reading data into the buffer reference |
|
283 * passed, the client should call PlayData() to play data. |
|
284 * The amount of data that can be played is specified in |
|
285 * CMMFBuffer::RequestSize(). Any data that is read into buffer beyond |
|
286 * this size will be ignored. |
|
287 * Leaves on failure. |
|
288 * @since S60 3.0 |
|
289 * @return void |
|
290 */ |
|
291 void PlayInitL(); |
|
292 |
|
293 /** |
|
294 * Initializes the audio device and starts the record process. This |
|
295 * function queries and acquires the audio policy before initializing |
|
296 * audio device. If there was an error during policy initialization, |
|
297 * RecordError() function will be called on the observer with error code |
|
298 * KErrAccessDenied, otherwise BufferToBeEmptied() function will be |
|
299 * called with a buffer reference. This buffer contains recorded or |
|
300 * encoded data. After processing data in the buffer reference passed, |
|
301 * the client should call RecordData() to continue recording process. |
|
302 * The amount of data that is available is specified in |
|
303 * CMMFBuffer::RequestSize(). |
|
304 * Leaves on failure. |
|
305 * @since S60 3.0 |
|
306 * @return void |
|
307 */ |
|
308 void RecordInitL(); |
|
309 |
|
310 /** |
|
311 * Plays data in the buffer at the current volume. |
|
312 * The client should fill the buffer with audio data before calling this |
|
313 * function. The observer gets a reference to the buffer along with the |
|
314 * callback function BufferToBeFilled(). When playing of the audio sample |
|
315 * is complete, successfully or otherwise, the function PlayError() on |
|
316 * the observer is called. |
|
317 * The last buffer of the audio stream being played should have the last |
|
318 * buffer flag set using CMMFBuffer::SetLastBuffer(TBool). If a |
|
319 * subsequent attempt to play the clip is made, this flag will need |
|
320 * resetting by the client. |
|
321 * @return void |
|
322 */ |
|
323 void PlayData(); |
|
324 |
|
325 /** |
|
326 * Contine the process of recording. |
|
327 * Once the buffer is filled with recorded data, the Observer gets a |
|
328 * reference to the buffer along with the callback function |
|
329 * BufferToBeEmptied(). After processing the buffer (copying over to a |
|
330 * different buffer or writing to file) the client should call this |
|
331 * function to continue the recording process. |
|
332 * @return void |
|
333 */ |
|
334 void RecordData(); |
|
335 |
|
336 /** |
|
337 * Stops the ongoing operation (Play, Record, TonePlay, Convert). |
|
338 * @since S60 3.0 |
|
339 * @return void |
|
340 */ |
|
341 void Stop(); |
|
342 |
|
343 /** |
|
344 * Temporarily Stops the ongoing operation (Play, Record, TonePlay, |
|
345 * Convert). |
|
346 * @since S60 3.0 |
|
347 * @return void |
|
348 */ |
|
349 void Pause(); |
|
350 |
|
351 /** |
|
352 * Returns the Sample recorded so far |
|
353 * @since S60 3.0 |
|
354 * @return TInt Returns the samples recorded. |
|
355 */ |
|
356 TInt SamplesRecorded(); |
|
357 |
|
358 /** |
|
359 * Returns the Sample played so far |
|
360 * @since S60 3.0 |
|
361 * @return TInt Returns the samples played. |
|
362 */ |
|
363 TInt SamplesPlayed(); |
|
364 |
|
365 /** |
|
366 * Initializes the audio device and starts playing a tone. The tone is |
|
367 * played with the frequency and duration specified. |
|
368 * Leaves on failure. |
|
369 * @since S60 3.0 |
|
370 * @param TInt aFrequency The frequency at which the tone will be played. |
|
371 * @param const TTimeIntervalMicroSeconds &aDuration The period over |
|
372 * which the tone will be played. A zero value causes the no tone |
|
373 * to be played. |
|
374 * @return void |
|
375 */ |
|
376 void PlayToneL(TInt aFrequency, |
|
377 const TTimeIntervalMicroSeconds& aDuration); |
|
378 |
|
379 /** |
|
380 * Initializes audio device and starts playing a dual tone. Dual Tone is |
|
381 * played with the specified frequencies and for the specified duration. |
|
382 * Leaves on failure. |
|
383 * @since S60 3.0 |
|
384 * @param TInt aFrequencyOne The first frequency of dual tone. |
|
385 * @param TInt aFrequencyTwo The second frequency of dual tone. |
|
386 * @param const TTimeIntervalMicroSeconds &aDuration The period over |
|
387 * which the tone will be played. A zero value causes the no tone |
|
388 * to be played. |
|
389 * @return void |
|
390 */ |
|
391 void PlayDualToneL(TInt aFrequencyOne, |
|
392 TInt aFrequencyTwo, |
|
393 const TTimeIntervalMicroSeconds& aDuration); |
|
394 |
|
395 /** |
|
396 * Initializes the audio device and starts playing the DTMF string |
|
397 * aDTMFString. |
|
398 * Leaves on failure. |
|
399 * @since S60 3.0 |
|
400 * @param const TDesC &aDTMFString The DTMF sequence in a descriptor. |
|
401 * @return void |
|
402 */ |
|
403 void PlayDTMFStringL(const TDesC& aDTMFString); |
|
404 |
|
405 /** |
|
406 * Initializes the audio device and starts playing a tone sequence. |
|
407 * Leaves on failure. |
|
408 * @since S60 3.0 |
|
409 * @param const TDesC8 &aData The tone sequence in a descriptor. |
|
410 * @return void |
|
411 */ |
|
412 void PlayToneSequenceL(const TDesC8& aData); |
|
413 |
|
414 /** |
|
415 * Initializes the audio device and starts playing the specified |
|
416 * pre-defined tone sequence. |
|
417 * Leaves on failure. |
|
418 * @since S60 3.0 |
|
419 * @param TInt aSequenceNumber The index identifying the specific |
|
420 * pre-defined tone sequence. Index values are relative to zero. |
|
421 * This can be any value from zero to the value returned by a call |
|
422 * to FixedSequenceCount() - 1. The function raises a panic if the |
|
423 * sequence number is not within this range. |
|
424 * @return void |
|
425 */ |
|
426 void PlayFixedSequenceL(TInt aSequenceNumber); |
|
427 |
|
428 /** |
|
429 * Defines the number of times the audio is to be repeated during the |
|
430 * tone playback operation. A period of silence can follow each playing |
|
431 * of a tone. The tone playing can be repeated indefinitely |
|
432 * @since S60 3.0 |
|
433 * @param TInt aRepeatCount The number of times the tone, together with |
|
434 * the trailing silence, is to be repeated. If this is set to |
|
435 * KMdaRepeatForever, then the tone, together with the trailing |
|
436 * silence, is repeated indefinitely or until Stop() is called. |
|
437 * If this is set to zero, then the tone is not repeated. |
|
438 * @param const TTimeIntervalMicroSeconds &aRepeatTrailingSilence An |
|
439 * interval of silence which will be played after each tone. |
|
440 * Supported only during tone playing. |
|
441 * @return void |
|
442 */ |
|
443 void SetToneRepeats( |
|
444 TInt aRepeatCount, |
|
445 const TTimeIntervalMicroSeconds& aRepeatTrailingSilence); |
|
446 |
|
447 /** |
|
448 * Defines the duration of tone on, tone off and tone pause to be used |
|
449 * during the DTMF tone playback operation. |
|
450 * Supported only during tone playing. |
|
451 * @since S60 3.0 |
|
452 * @param TTimeIntervalMicroSeconds32 &aToneOnLength The period over |
|
453 * which the tone will be played. If this is set to zero, then the |
|
454 * tone is not played. |
|
455 * @param TTimeIntervalMicroSeconds32 &aToneOffLength The period over |
|
456 * which the no tone will be played. |
|
457 * @param TTimeIntervalMicroSeconds32 &aPauseLength The period over which |
|
458 * the tone playing will be paused. |
|
459 * @return void |
|
460 */ |
|
461 void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, |
|
462 TTimeIntervalMicroSeconds32& aToneOffLength, |
|
463 TTimeIntervalMicroSeconds32& aPauseLength); |
|
464 |
|
465 /** |
|
466 * Defines the period over which the volume level is to rise smoothly |
|
467 * from nothing to the normal volume level. |
|
468 * The function is only available before playing. |
|
469 * @since S60 3.0 |
|
470 * @param const TTimeIntervalMicroSeconds &aRampDuration The period over |
|
471 * which the volume is to rise. A zero value causes the tone |
|
472 * sample to be played at the normal level for the full duration |
|
473 * of the playback. A value, which is longer than the duration of |
|
474 * the tone sample means that the sample never reaches its normal |
|
475 * volume level. |
|
476 * @return void |
|
477 */ |
|
478 void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); |
|
479 |
|
480 /** |
|
481 * Defines the priority settings that should be used for this instance. |
|
482 * @since S60 3.0 |
|
483 * @param const TMMFPrioritySettings &aPrioritySettings A class type |
|
484 * representing the client's priority, priority preference and |
|
485 * state |
|
486 * @return void |
|
487 */ |
|
488 void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings); |
|
489 |
|
490 /** |
|
491 * Retrieves a custom interface to the device. |
|
492 * @since S60 3.0 |
|
493 * @param TUid aInterfaceId The interface UID, defined with the custom |
|
494 * interface. |
|
495 * @return TAny* A pointer to the interface implementation, or NULL if |
|
496 * the device does not implement the interface requested. The |
|
497 * return value must be cast to the correct type by the user. |
|
498 */ |
|
499 TAny* CustomInterface(TUid aInterfaceId); |
|
500 |
|
501 /** |
|
502 * Returns the number of available pre-defined tone sequences. |
|
503 * This is the number of fixed sequence supported by DevSound by default. |
|
504 * @since S60 3.0 |
|
505 * @return TInt The fixed sequence count. This value is implementation |
|
506 * dependent. |
|
507 */ |
|
508 TInt FixedSequenceCount(); |
|
509 |
|
510 /** |
|
511 * Returns the name assigned to a specific pre-defined tone sequence. |
|
512 * This is the number of the fixed sequence supported by DevSound by |
|
513 * default. |
|
514 * The function raises a panic if sequence number specified is invalid. |
|
515 * @since S60 3.0 |
|
516 * @param TInt aSequenceNumber The index identifying the specific |
|
517 * pre-defined tone sequence. Index values are relative to zero. |
|
518 * This can be any value from zero to the value returned by a call |
|
519 * to CMdaAudioPlayerUtility::FixedSequenceCount() - 1. The |
|
520 * function raises a panic if sequence number is not within this |
|
521 * range. |
|
522 * @return const TDesC & A reference to a Descriptor containing the fixed |
|
523 * sequence name indexed by aSequenceNumber. |
|
524 */ |
|
525 const TDesC& FixedSequenceName(TInt aSequenceNumber); |
|
526 |
|
527 /** |
|
528 * Returns a list of the supported input datatypes that can be sent to |
|
529 * DevSound for playing audio. The datatypes returned are those that the |
|
530 * DevSound supports given the priority settings passed in |
|
531 * aPrioritySettings. Note that if no supported data types are found this |
|
532 * does not constitute failure, the function will return normally with no |
|
533 * entries in aSupportedDataTypes. |
|
534 * Leaves on failure. |
|
535 * @since S60 3.0 |
|
536 * @param RArray< TFourCC > &aSupportedDataTypes The array of supported |
|
537 * data types that will be filled in by this function. The |
|
538 * supported data types of the DevSound are in the form of an |
|
539 * array of TFourCC codes. Any existing entries in the array will |
|
540 * be overwritten on calling this function. If no supported data |
|
541 * types are found given the priority settings, then the |
|
542 * aSupportedDatatypes array will have zero entries. |
|
543 * @param const TMMFPrioritySettings &aPrioritySettings The priority |
|
544 * settings used to determine the supported datatypes. Note this |
|
545 * does not set the priority settings. For input datatypes the |
|
546 * iState member of the priority settings would be expected to be |
|
547 * either EMMFStatePlaying or EMMFStatePlayingRecording. The |
|
548 * priority settings may effect the supported datatypes depending |
|
549 * on the audio routing. |
|
550 * @return void |
|
551 */ |
|
552 void GetSupportedInputDataTypesL( |
|
553 RArray<TFourCC>& aSupportedDataTypesconst, |
|
554 const TMMFPrioritySettings& aPrioritySettings) const; |
|
555 |
|
556 /** |
|
557 * Returns a list of the supported output dataypes that can be received |
|
558 * from DevSound for recording audio. The datatypes returned are those |
|
559 * that the DevSound supports given the priority settings passed in |
|
560 * aPrioritySettings. Note that if no supported data types are found this |
|
561 * does not constitute failure, the function will return normally with no |
|
562 * entries in aSupportedDataTypes. |
|
563 * Leaves on failure. |
|
564 * @since S60 3.0 |
|
565 * @param RArray< TFourCC > &aSupportedDataTypes The array of supported |
|
566 * data types that will be filled in by this function. The |
|
567 * supported datatypes of the DevSound are in the form of an array |
|
568 * of TFourCC codes. Any existing entries in the array will be |
|
569 * overwritten on calling this function. If no supported datatypes |
|
570 * are found given the priority settings, then the |
|
571 * aSupportedDatatypes array will have zero entries. |
|
572 * @param const TMMFPrioritySettings &aPrioritySettings The priority |
|
573 * settings used to determine the supported data types. Note this |
|
574 * does not set the priority settings. For output data types the |
|
575 * iState member of the priority settings would expected to be |
|
576 * either EMMFStateRecording or EMMFStatePlayingRecording. The |
|
577 * priority settings may effect the supported datatypes depending |
|
578 * on the audio routing. |
|
579 * @return void |
|
580 */ |
|
581 void GetSupportedOutputDataTypesL( |
|
582 RArray<TFourCC>& aSupportedDataTypes, |
|
583 const TMMFPrioritySettings& aPrioritySettings) const; |
|
584 |
|
585 /** |
|
586 * Sets client configuration |
|
587 * @since S60 3.0 |
|
588 * @param TMMFClientConfig& aClientConfig A reference to client |
|
589 * configuration object. |
|
590 * @return void |
|
591 */ |
|
592 void SetClientConfig(const TMMFClientConfig& aClientConfig); |
|
593 |
|
594 /** |
|
595 * Returns client configuration |
|
596 * @since S60 3.0 |
|
597 * @return const TMMFClientConfig& A constant reference to client |
|
598 * configuration. |
|
599 */ |
|
600 const TMMFClientConfig& ClientConfig() const; |
|
601 |
|
602 // MMMFHwDeviceObserver implementation for CMMFHwDevice |
|
603 |
|
604 /** |
|
605 * Callback function from CMMFHwDevice when it needs data. |
|
606 * @since S60 3.0 |
|
607 * @param CMMFBuffer& aHwBuffer A reference to CMMFBuffer in which the |
|
608 * observer need to fill data into. |
|
609 * @return TInt Error code. KErrNone if success. |
|
610 */ |
|
611 TInt FillThisHwBuffer(CMMFBuffer& aHwBuffer); |
|
612 |
|
613 /** |
|
614 * Callback function from CMMFHwDevice when it has data. |
|
615 * @since S60 3.0 |
|
616 * @param CMMFBuffer& aHwBuffer A reference to CMMFBuffer in which the |
|
617 * observer need to empty data from. |
|
618 * @return TInt Error code. KErrNone if success. |
|
619 */ |
|
620 TInt EmptyThisHwBuffer(CMMFBuffer& aHwBuffer); |
|
621 |
|
622 /** |
|
623 * Callback function from CMMFHwDevice. |
|
624 * @since S60 3.0 |
|
625 * @param TUid aMessageType A Uid identifying type of message. |
|
626 * @param const TDesC8& aMsg.A reference to descriptor containing message |
|
627 * information. |
|
628 * @return TInt Error code. KErrNone if success. |
|
629 */ |
|
630 TInt MsgFromHwDevice(TUid aMessageType, const TDesC8& aMsg); |
|
631 |
|
632 /** |
|
633 * Callback function from CMMFHwDevice when playing back/ recording is |
|
634 * stopped.. |
|
635 * @since S60 3.0 |
|
636 * @return void |
|
637 */ |
|
638 void Stopped(); |
|
639 |
|
640 /** |
|
641 * Callback function from CMMFHwDevice when there is a error during |
|
642 * playback and/or recording. |
|
643 * @since S60 3.0 |
|
644 * @param TInt aError A systemwide error code. |
|
645 * @return void |
|
646 */ |
|
647 void Error(TInt aError); |
|
648 |
|
649 // CMMFHwDevice implementation ends |
|
650 |
|
651 private: |
|
652 |
|
653 /** |
|
654 * Called by Audio Policy Server when play reqeust is granted |
|
655 * Leaves on failure. |
|
656 * @since S60 3.0 |
|
657 * @return void |
|
658 */ |
|
659 void StartPlayDataL(); |
|
660 |
|
661 /** |
|
662 * Called by Audio Policy Server when record reqeust is granted |
|
663 * Leaves on failure. |
|
664 * @since S60 3.0 |
|
665 * @return void |
|
666 */ |
|
667 void StartRecordDataL(); |
|
668 |
|
669 /** |
|
670 * Called by Audio Policy Server when play tone reqeust is granted |
|
671 * Leaves on failure. |
|
672 * @since S60 3.0 |
|
673 * @return void |
|
674 */ |
|
675 void StartPlayToneL(); |
|
676 |
|
677 /** |
|
678 * Called by Audio Policy Server when play dual tone request is granted |
|
679 * Leaves on failure. |
|
680 * @since S60 3.0 |
|
681 * @return void |
|
682 */ |
|
683 void StartPlayDualToneL(); |
|
684 |
|
685 /** |
|
686 * Called by Audio Policy Server when play DTMF reqeust is granted |
|
687 * Leaves on failure. |
|
688 * @since S60 3.0 |
|
689 * @return void |
|
690 */ |
|
691 void StartPlayDTMFStringL(); |
|
692 |
|
693 /** |
|
694 * Called by Audio Policy Server when play tone sequence reqeust |
|
695 * is granted. |
|
696 * Leaves on failure. |
|
697 * @since S60 3.0 |
|
698 * @return void |
|
699 */ |
|
700 void StartPlayToneSequenceL(); |
|
701 |
|
702 /** |
|
703 * Play tone |
|
704 * Leaves on failure. |
|
705 * @since S60 3.0 |
|
706 * @return void |
|
707 */ |
|
708 void DoPlayL(); |
|
709 |
|
710 /** |
|
711 * Sets active tone |
|
712 * @since S60 3.0 |
|
713 * @return void |
|
714 */ |
|
715 void SetActiveToneBuffer(); |
|
716 |
|
717 /** |
|
718 * Fills free tone buffer with tone data |
|
719 * @since S60 3.0 |
|
720 * @return KErrNone if succesfull, else corresponding error code. |
|
721 */ |
|
722 TInt FillFreeToneBuffer(); |
|
723 |
|
724 |
|
725 // HwDevice implementation begins |
|
726 |
|
727 /** |
|
728 * Initialize HwDevice task. |
|
729 * @since S60 3.0 |
|
730 * @return KErrNone if succesfull, else corresponding error code. |
|
731 */ |
|
732 TInt InitTask(); |
|
733 |
|
734 /** |
|
735 * Returns Sampling Frequency the device is currently configured to |
|
736 * @since S60 3.0 |
|
737 * @return KErrNone if succesfull, else corresponding error code. |
|
738 */ |
|
739 TInt SamplingFrequency(); |
|
740 |
|
741 /** |
|
742 * Returns number of channels the device is currently configured to |
|
743 * @since S60 3.0 |
|
744 * @return KErrNone if succesfull, else corresponding error code. |
|
745 */ |
|
746 TInt NumberOfChannels(); |
|
747 |
|
748 /** |
|
749 * returns the number of bytes in each audio sample |
|
750 * @since S60 3.0 |
|
751 * @return TInt Number of of bytes in each audio sample. |
|
752 */ |
|
753 TInt BytesPerAudioSample(); |
|
754 |
|
755 // HwDevice implementation ends |
|
756 |
|
757 /** |
|
758 * Initializes DevSound utility |
|
759 * @since S60 3.0 |
|
760 * @return void |
|
761 */ |
|
762 void InitializeDevSoundUtilL() const; |
|
763 |
|
764 private: |
|
765 |
|
766 /** |
|
767 * C++ default constructor. |
|
768 */ |
|
769 CBody(); |
|
770 |
|
771 /** |
|
772 * By default Symbian 2nd phase constructor is private. |
|
773 */ |
|
774 void ConstructL(RServer2& aPolicyServerHandle); |
|
775 |
|
776 protected: // Data |
|
777 |
|
778 CG711DecoderIntfcCI* iG711DecoderIntfcCI; |
|
779 CG711EncoderIntfcCI* iG711EncoderIntfcCI; |
|
780 CG729DecoderIntfcCI* iG729DecoderIntfcCI; |
|
781 CG729EncoderIntfcCI* iG729EncoderIntfcCI; |
|
782 CIlbcDecoderIntfcCI* iIlbcDecoderIntfcCI; |
|
783 CIlbcEncoderIntfcCI* iIlbcEncoderIntfcCI; |
|
784 CSpeechEncoderConfigCI* iSpeechEncoderConfigCI; |
|
785 CErrorConcealmentIntfcCI* iErrorConcealmentIntfcCI; |
|
786 |
|
787 private: // Data |
|
788 |
|
789 //Objects (owned or referred to): |
|
790 MDevSoundAdaptationObserver* iDevSoundObserver; |
|
791 |
|
792 // DevSound capabilities |
|
793 TMMFCapabilities iDeviceCapabilities; |
|
794 // Current Configuration |
|
795 TMMFCapabilities iDeviceConfig; |
|
796 |
|
797 // Bytes of audio data played in current play cycle |
|
798 TInt iPlayedBytesCount; |
|
799 // Bytes of audio data recorded in current record cycle |
|
800 TInt iRecordedBytesCount; |
|
801 TInt iGain; |
|
802 TInt iVolume; |
|
803 |
|
804 //Tone Stuff: |
|
805 MMdaToneSynthesis* iCurrentGenerator; |
|
806 TMdaSimpleToneGenerator iToneGen; |
|
807 TMdaDualToneGenerator iDualToneGen; |
|
808 TMdaDTMFGenerator iDTMFGen; |
|
809 TMdaSequenceGenerator iSequenceGen; // Not Supported |
|
810 TInt iRepeatCount; |
|
811 TTimeIntervalMicroSeconds iRepeatTrailingSilence; |
|
812 TTimeIntervalMicroSeconds iRampDuration; |
|
813 // Double buffer tone playing |
|
814 CMMFDataBuffer* iToneBuffer1; |
|
815 CMMFDataBuffer* iToneBuffer2; |
|
816 // Reference to current tone buffer playing |
|
817 CMMFDataBuffer* iActiveToneBuffer; |
|
818 |
|
819 // Hardware device implementation |
|
820 CMMFHwDeviceStub* iCMMFHwDevice; |
|
821 // Mode in which DevSound instance will be used for |
|
822 TMMFState iMode; |
|
823 // Reference to hardware buffer |
|
824 CMMFDataBuffer* iHwDeviceBuffer; |
|
825 |
|
826 TBool iLastBufferReceived; |
|
827 |
|
828 // Holds true of Audio data given to DevSound needs to ramped up |
|
829 mutable CMMFDevSoundUtility* iDevSoundUtil; |
|
830 |
|
831 // Fixed sequence related |
|
832 |
|
833 // Holds the fixed sequence data |
|
834 mutable CPtrC8Array* iFixedSequences; |
|
835 // Holds reference to current sequence |
|
836 TPtrC8 iFixedSequence; |
|
837 |
|
838 // Balance |
|
839 TInt iLeftPlayBalance; |
|
840 TInt iRightPlayBalance; |
|
841 TInt iLeftRecordBalance; |
|
842 TInt iRightRecordBalance; |
|
843 TBool iPaused; |
|
844 |
|
845 TUid iHwDeviceID; |
|
846 |
|
847 // Hardware device initialization parameters |
|
848 THwDeviceInitParams iDevInfo; |
|
849 |
|
850 TBool iFirstCallFromHwDevice; |
|
851 |
|
852 // Temporary CI testing only |
|
853 CBytesPlayedCIImpl* iBytesPlayedCIImpl; |
|
854 // Holds clients configuration |
|
855 TMMFClientConfig iClientConfig; |
|
856 |
|
857 // Pointer to CTonePlayCompleteTimer |
|
858 CTonePlayCompleteTimer* iTonePlayCompleteTimer; |
|
859 |
|
860 private: // Friend classes |
|
861 friend class CMMFDevSoundAdaptation; |
|
862 |
|
863 }; |
|
864 |
|
865 #endif // MMFDEVSOUNDADAPTATIONBODY_H |
|
866 |
|
867 // End of File |
|