0
|
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 RMMFDEVSOUNDPROXY_H
|
|
21 |
#define RMMFDEVSOUNDPROXY_H
|
|
22 |
|
|
23 |
// INCLUDES
|
|
24 |
#include <mmf/common/mmfipc.h>
|
|
25 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
|
26 |
#include <mmf/common/mmfipcserver.h>
|
|
27 |
#endif
|
|
28 |
#include <mmf/common/mcustomcommand.h>
|
|
29 |
#include "mmfdevsoundcallbackhandler.h"
|
|
30 |
#include "mmfaudioserverproxy.h"
|
|
31 |
|
|
32 |
_LIT(KMMFDevSoundProxyPanicCategory, "MmfDevSoundProxy");
|
|
33 |
|
|
34 |
enum TMMFDevSoundProxyPanicCodes
|
|
35 |
{
|
|
36 |
EMMFDevSoundProxyPlayDataWithoutInitialize,
|
|
37 |
EMMFDevSoundProxyRecordDataWithoutInitialize,
|
|
38 |
EMMFDevSoundProxyInitCompleteInWrongState,
|
|
39 |
EMMFDevSoundProxyToneFinishedInWrongState,
|
|
40 |
EMMFDevSoundProxyPlayErrorInWrongState,
|
|
41 |
EMMFDevSoundProxyRecordErrorInWrongState,
|
|
42 |
EMMFDevSoundProxyUnexpectedConvError,
|
|
43 |
EMMFDevSoundProxyCapabilitiesInWrongState,
|
|
44 |
EMMFDevSoundProxyConfigInWrongState,
|
|
45 |
EMMFDevSoundProxyBTBFInWrongState,
|
|
46 |
EMMFDevSoundProxyBTBEInWrongState,
|
|
47 |
EMMFDevSoundProxyPlayDataInWrongState,
|
|
48 |
EMMFDevSoundProxyRecordDataInWrongState,
|
|
49 |
EMMFDevSoundProxyNonEmptyLastBuffer,
|
|
50 |
};
|
|
51 |
|
|
52 |
|
|
53 |
// FORWARD DECLARATIONS
|
|
54 |
class RMMFDevSoundProxy; // declared here.
|
|
55 |
|
|
56 |
// CLASS DECLARATION
|
|
57 |
|
|
58 |
/**
|
|
59 |
* Main interface to DevSound server.
|
|
60 |
*
|
|
61 |
* @lib MmfDevSoundProxy.lib
|
|
62 |
* @since
|
|
63 |
*/
|
|
64 |
NONSHARABLE_CLASS( RMMFDevSoundProxy ) : public RMmfSessionBase,
|
|
65 |
public MCustomCommand,
|
|
66 |
public MDevSoundObserver,
|
|
67 |
public MMMFDevSoundCancelInitialize
|
|
68 |
{
|
|
69 |
public: // Constructors and destructor
|
|
70 |
/**
|
|
71 |
* Constructor.
|
|
72 |
* @since
|
|
73 |
*/
|
|
74 |
IMPORT_C RMMFDevSoundProxy();
|
|
75 |
|
|
76 |
public: // New functions
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Open a DevSound server session
|
|
80 |
* @since
|
|
81 |
* @return KErrNone if successfull, else corresponding error code
|
|
82 |
*/
|
|
83 |
IMPORT_C TInt Open();
|
|
84 |
|
|
85 |
/**
|
|
86 |
* Post open - called following successful open to complete open process.
|
|
87 |
* Allows async opening
|
|
88 |
* @return KErrNone successful, otherwise one of the standard system errors
|
|
89 |
*/
|
|
90 |
IMPORT_C TInt PostOpen();
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Launch DevSound instances that might have been waiting for audio
|
|
94 |
* policy.
|
|
95 |
* @since
|
|
96 |
* @return KErrNone if successfull, else corresponding error code
|
|
97 |
*/
|
|
98 |
IMPORT_C TInt SetDevSoundInfo();
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Initialize DevSound for the mode aMode.
|
|
102 |
* Leaves on failure.
|
|
103 |
* @since
|
|
104 |
* @param TMMFState aMode The mode for which this object will be used
|
|
105 |
* @param aDevSoundCIObserver Observer which will receive Custom Interface events
|
|
106 |
*
|
|
107 |
*/
|
|
108 |
IMPORT_C void InitializeL(MDevSoundObserver& aDevSoundObserver,
|
|
109 |
TMMFState aMode,
|
|
110 |
MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
|
|
111 |
|
|
112 |
/**
|
|
113 |
* Initializes DevSound object for the mode aMode for processing audio
|
|
114 |
* data with hardware device aHWDev.
|
|
115 |
* Leaves on failure.
|
|
116 |
* @since
|
|
117 |
* @param TUid aHWDev The CMMFHwDevice implementation identifier.
|
|
118 |
* @param TMMFState aMode The mode for which this object will be used
|
|
119 |
* @param aDevSoundCIObserver Observer which will receive Custom Interface events
|
|
120 |
*
|
|
121 |
*/
|
|
122 |
IMPORT_C void InitializeL(MDevSoundObserver& aDevSoundObserver,
|
|
123 |
TUid aHWDev,
|
|
124 |
TMMFState aMode,
|
|
125 |
MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Initializes DevSound object for the mode aMode for processing audio
|
|
129 |
* data with hardware device supporting FourCC aDesiredFourCC.
|
|
130 |
* Leaves on failure.
|
|
131 |
* @since
|
|
132 |
* @param TFourCC aDesiredFourCC The CMMFHwDevice implementation FourCC
|
|
133 |
* code.
|
|
134 |
* @param TMMFState aMode The mode for which this object will be used
|
|
135 |
* @param aDevSoundCIObserver Observer which will receive Custom Interface events
|
|
136 |
*
|
|
137 |
*/
|
|
138 |
IMPORT_C void InitializeL(MDevSoundObserver& aDevSoundObserver,
|
|
139 |
TFourCC aDesiredFourCC,
|
|
140 |
TMMFState aMode,
|
|
141 |
MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Returns the supported Audio settings ie. encoding, sample rates,
|
|
145 |
* mono/stereo operation, buffer size etc..
|
|
146 |
* @since
|
|
147 |
* @return TMMFCapabilities The device settings.
|
|
148 |
*/
|
|
149 |
IMPORT_C TMMFCapabilities Capabilities();
|
|
150 |
|
|
151 |
/**
|
|
152 |
* Returns the current device configuration.
|
|
153 |
* @since
|
|
154 |
* @return TMMFCapabilities The device settings.
|
|
155 |
*/
|
|
156 |
IMPORT_C TMMFCapabilities Config();
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Configure CMMFDevSound object with the settings in aConfig. Use this
|
|
160 |
* to set sampling rate, encoding and mono/stereo.
|
|
161 |
* Leaves on failure.
|
|
162 |
* @since
|
|
163 |
* @param const TMMFCapabilities& aConfig The attribute values to which
|
|
164 |
* CMMFDevSound object will be configured to.
|
|
165 |
* @return KErrNone if successfull, else corresponding error code
|
|
166 |
*/
|
|
167 |
IMPORT_C void SetConfigL(const TMMFCapabilities& aConfig);
|
|
168 |
|
|
169 |
/**
|
|
170 |
* Returns an integer representing the maximum volume device supports.
|
|
171 |
* This is the maximum value which can be passed to
|
|
172 |
* CMMFDevSound::SetVolume.
|
|
173 |
* @since
|
|
174 |
* @return TInt The maximum volume. This value is platform dependent but
|
|
175 |
* is always greater than or equal to one.
|
|
176 |
*/
|
|
177 |
IMPORT_C TInt MaxVolume();
|
|
178 |
|
|
179 |
/**
|
|
180 |
* Returns an integer representing the current volume.
|
|
181 |
* @since
|
|
182 |
* @return TInt The current volume level.
|
|
183 |
*/
|
|
184 |
IMPORT_C TInt Volume();
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Changes the current playback volume to a specified value. The volume
|
|
188 |
* can be changed before or during playback and is effective immediately
|
|
189 |
* @since
|
|
190 |
* @param TInt aVolume The volume setting. This can be any value from 0
|
|
191 |
* to the value returned by a call to
|
|
192 |
* CMMFDevSound::MaxVolume(). If the volume is not
|
|
193 |
* within this range, the volume is automatically set
|
|
194 |
* to minimum or maximum value based on the value
|
|
195 |
* that is being passed. Setting a zero value mutes
|
|
196 |
* the sound. Setting the maximum value results in
|
|
197 |
* the loudest possible sound.
|
|
198 |
* @return KErrNone if successfull, else corresponding error code
|
|
199 |
*/
|
|
200 |
IMPORT_C TInt SetVolume(TInt aVolume);
|
|
201 |
|
|
202 |
/**
|
|
203 |
* Returns an integer representing the maximum gain the device supports.
|
|
204 |
* This is the maximum value which can be passed to CMMFDevSound::SetGain
|
|
205 |
* @since
|
|
206 |
* @return TInt The maximum gain. This value is platform dependent but is
|
|
207 |
* always greater than or equal to one.
|
|
208 |
*/
|
|
209 |
IMPORT_C TInt MaxGain();
|
|
210 |
|
|
211 |
/**
|
|
212 |
* Returns an integer representing the current gain.
|
|
213 |
* @since
|
|
214 |
* @return TInt The current gain level.
|
|
215 |
*/
|
|
216 |
IMPORT_C TInt Gain();
|
|
217 |
|
|
218 |
/**
|
|
219 |
* Changes the current recording gain to a specified value. The gain can
|
|
220 |
* be changed before or during recording and is effective immediately.
|
|
221 |
* @since
|
|
222 |
* @param TInt aGain The gain setting. This can be any value from zero to
|
|
223 |
* the value returned by a call to
|
|
224 |
* CMMFDevSound::MaxGain(). If the volume
|
|
225 |
* is not within this range, the gain is automatically
|
|
226 |
* set to minimum or maximum value based on the value
|
|
227 |
* that is being passed. Setting a zero value mutes the
|
|
228 |
* sound. Setting the maximum value results in the
|
|
229 |
* loudest possible sound.
|
|
230 |
* @return KErrNone if successfull, else corresponding error code
|
|
231 |
*/
|
|
232 |
IMPORT_C TInt SetGain(TInt aGain);
|
|
233 |
|
|
234 |
/**
|
|
235 |
* Returns the speaker balance set for playing.
|
|
236 |
* Leaves on failure.
|
|
237 |
* @since
|
|
238 |
* @param TInt &aLeftPercentage On return contains the left speaker
|
|
239 |
* volume percentage.
|
|
240 |
* @param TInt &aRightPercentage On return contains the right speaker
|
|
241 |
* volume percentage.
|
|
242 |
*/
|
|
243 |
IMPORT_C void GetPlayBalanceL(TInt& aLeftPercentage,
|
|
244 |
TInt& aRightPercentage);
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Sets the speaker balance for playing. The speaker balance can be
|
|
248 |
* changed before or during playback and is effective immediately.
|
|
249 |
* Leaves on failure.
|
|
250 |
* @since
|
|
251 |
* @param TInt aLeftPercentage The left speaker volume percentage. This
|
|
252 |
* can be any value from zero to 100. Setting
|
|
253 |
* a zero value mutes the sound on left
|
|
254 |
* speaker.
|
|
255 |
* @param TInt aRightPercentage The right speaker volume percentage.
|
|
256 |
* This can be any value from zero to 100.
|
|
257 |
* Setting a zero value mutes the sound on
|
|
258 |
* right speaker.
|
|
259 |
*/
|
|
260 |
IMPORT_C void SetPlayBalanceL(TInt aLeftPercentage,
|
|
261 |
TInt aRightPercentage);
|
|
262 |
|
|
263 |
/**
|
|
264 |
* Returns the microphone gain balance set for recording.
|
|
265 |
* Leaves on failure.
|
|
266 |
* @since
|
|
267 |
* @param TInt &aLeftPercentage On return contains the left microphone
|
|
268 |
* gain percentage.
|
|
269 |
* @param TInt &aRightPercentage On return contains the right microphone
|
|
270 |
* gain percentage.
|
|
271 |
* @return void
|
|
272 |
*/
|
|
273 |
IMPORT_C void GetRecordBalanceL(TInt& aLeftPercentage,
|
|
274 |
TInt& aRightPercentage);
|
|
275 |
|
|
276 |
/**
|
|
277 |
* Sets the microphone balance for recording. The microphone balance can
|
|
278 |
* be changed before or during recording and is effective immediately.
|
|
279 |
* Leaves on failure.
|
|
280 |
* @since
|
|
281 |
* @param TInt aLeftPercentage The left microphone gain percentage. This
|
|
282 |
* can be any value from zero to 100. Setting
|
|
283 |
* a zero value mutes the sound from left
|
|
284 |
* microphone.
|
|
285 |
* @param TInt aRightPercentage The right microphone gain percentage.
|
|
286 |
* This can be any value from zero to 100.
|
|
287 |
* Setting a zero value mutes the sound from
|
|
288 |
* right microphone.
|
|
289 |
* @return void
|
|
290 |
*/
|
|
291 |
IMPORT_C void SetRecordBalanceL(TInt aLeftPercentage,
|
|
292 |
TInt aRightPercentage);
|
|
293 |
|
|
294 |
/**
|
|
295 |
* Close the server session
|
|
296 |
* @since
|
|
297 |
* @return void
|
|
298 |
*/
|
|
299 |
IMPORT_C void Close();
|
|
300 |
|
|
301 |
/**
|
|
302 |
* Initializes the audio device and starts the play process. This
|
|
303 |
* function queries and acquires the audio policy before initializing
|
|
304 |
* audio device. If there was an error during policy initialization,
|
|
305 |
* PlayError() function will be called on the observer with error code
|
|
306 |
* KErrAccessDenied, otherwise BufferToBeFilled() function will be called
|
|
307 |
* with a buffer reference. After reading data into the buffer reference
|
|
308 |
* passed, the client should call PlayData() to play data.
|
|
309 |
* The amount of data that can be played is specified in
|
|
310 |
* CMMFBuffer::RequestSize(). Any data that is read into buffer beyond
|
|
311 |
* this size will be ignored.
|
|
312 |
* Leaves on failure.
|
|
313 |
* @since
|
|
314 |
* @return void
|
|
315 |
*/
|
|
316 |
IMPORT_C void PlayInitL();
|
|
317 |
|
|
318 |
/**
|
|
319 |
* Initializes the audio device and starts the record process. This
|
|
320 |
* function queries and acquires the audio policy before initializing
|
|
321 |
* audio device. If there was an error during policy initialization,
|
|
322 |
* RecordError() function will be called on the observer with error code
|
|
323 |
* KErrAccessDenied, otherwise BufferToBeEmptied() function will be called
|
|
324 |
* with a buffer reference. This buffer contains recorded or encoded
|
|
325 |
* data. After processing data in the buffer reference passed, the client
|
|
326 |
* should call RecordData() to continue recording process.
|
|
327 |
* The amount of data that is available is specified in
|
|
328 |
* CMMFBuffer::RequestSize().
|
|
329 |
* Leaves on failure.
|
|
330 |
* @since
|
|
331 |
* @return void
|
|
332 |
*/
|
|
333 |
IMPORT_C void RecordInitL();
|
|
334 |
|
|
335 |
/**
|
|
336 |
* Plays data in the buffer at the current volume.
|
|
337 |
* The client should fill the buffer with audio data before calling this
|
|
338 |
* function. The observer gets a reference to the buffer along with the
|
|
339 |
* callback function BufferToBeFilled(). When playing of the audio sample
|
|
340 |
* is complete, successfully or otherwise, the function PlayError() on
|
|
341 |
* the observer is called.
|
|
342 |
* The last buffer of the audio stream being played should have the last
|
|
343 |
* buffer flag set using CMMFBuffer::SetLastBuffer(TBool). If a
|
|
344 |
* subsequent attempt to play the clip is made, this flag will need
|
|
345 |
* resetting by the client.
|
|
346 |
* @return void
|
|
347 |
*/
|
|
348 |
IMPORT_C void PlayData();
|
|
349 |
|
|
350 |
/**
|
|
351 |
* Contine the process of recording.
|
|
352 |
* Once the buffer is filled with recorded data, the Observer gets a
|
|
353 |
* reference to the buffer along with the callback function
|
|
354 |
* BufferToBeEmptied(). After processing the buffer (copying over to a
|
|
355 |
* different buffer or writing to file) the client should call this
|
|
356 |
* function to continue the recording process.
|
|
357 |
* @return void
|
|
358 |
*/
|
|
359 |
IMPORT_C void RecordData();
|
|
360 |
|
|
361 |
/**
|
|
362 |
* Stops the ongoing operation (Play, Record, TonePlay).
|
|
363 |
* @since
|
|
364 |
* @return void
|
|
365 |
*/
|
|
366 |
IMPORT_C void Stop();
|
|
367 |
|
|
368 |
/**
|
|
369 |
* Temporarily Stops the ongoing operation (Play, Record, TonePlay).
|
|
370 |
* @since
|
|
371 |
* @return void
|
|
372 |
*/
|
|
373 |
IMPORT_C void Pause();
|
|
374 |
|
|
375 |
/**
|
|
376 |
* Initializes the audio device and starts playing a tone. The tone is
|
|
377 |
* played with the frequency and duration specified.
|
|
378 |
* Leaves on failure.
|
|
379 |
* @since
|
|
380 |
* @param TInt aFrequency The frequency at which the tone will be played.
|
|
381 |
* @param const TTimeIntervalMicroSeconds &aDuration The period over
|
|
382 |
* which the tone will be played. A zero value causes the no tone
|
|
383 |
* to be played.
|
|
384 |
* @return void
|
|
385 |
*/
|
|
386 |
IMPORT_C void PlayToneL(TInt aFrequency,
|
|
387 |
const TTimeIntervalMicroSeconds& aDuration);
|
|
388 |
|
|
389 |
/**
|
|
390 |
* Initializes audio device and starts playing a dual tone. Dual Tone is
|
|
391 |
* played with the specified frequencies and for the specified duration.
|
|
392 |
* Leaves on failure.
|
|
393 |
* @since
|
|
394 |
* @param TInt aFrequencyOne The first frequency of dual tone.
|
|
395 |
* @param TInt aFrequencyTwo The second frequency of dual tone.
|
|
396 |
* @param const TTimeIntervalMicroSeconds &aDuration The period over
|
|
397 |
* which the tone will be played. A zero value causes the no tone
|
|
398 |
* to be played.
|
|
399 |
* @return void
|
|
400 |
*/
|
|
401 |
IMPORT_C void PlayDualToneL(
|
|
402 |
TInt aFrequencyOne,
|
|
403 |
TInt aFrequencyTwo,
|
|
404 |
const TTimeIntervalMicroSeconds& aDuration);
|
|
405 |
|
|
406 |
/**
|
|
407 |
* Initializes the audio device and starts playing the DTMF string
|
|
408 |
* aDTMFString.
|
|
409 |
* Leaves on failure.
|
|
410 |
* @since
|
|
411 |
* @param const TDesC &aDTMFString The DTMF sequence in a descriptor.
|
|
412 |
* @return void
|
|
413 |
*/
|
|
414 |
IMPORT_C void PlayDTMFStringL(const TDesC& aDTMFString);
|
|
415 |
|
|
416 |
/**
|
|
417 |
* Initializes the audio device and starts playing a tone sequence.
|
|
418 |
* Leaves on failure.
|
|
419 |
* @since
|
|
420 |
* @param const TDesC8 &aData The tone sequence in a descriptor.
|
|
421 |
* @return void
|
|
422 |
*/
|
|
423 |
IMPORT_C void PlayToneSequenceL(const TDesC8& aData);
|
|
424 |
|
|
425 |
/**
|
|
426 |
* Defines the duration of tone on, tone off and tone pause to be used
|
|
427 |
* during the DTMF tone playback operation.
|
|
428 |
* Supported only during tone playing.
|
|
429 |
* @since
|
|
430 |
* @param TTimeIntervalMicroSeconds32 &aToneOnLength The period over
|
|
431 |
* which the tone will be played. If this is set to zero, then the
|
|
432 |
* tone is not played.
|
|
433 |
* @param TTimeIntervalMicroSeconds32 &aToneOffLength The period over
|
|
434 |
* which the no tone will be played.
|
|
435 |
* @param TTimeIntervalMicroSeconds32 &aPauseLength The period over which
|
|
436 |
* the tone playing will be paused.
|
|
437 |
* @return void
|
|
438 |
*/
|
|
439 |
IMPORT_C void SetDTMFLengths(
|
|
440 |
TTimeIntervalMicroSeconds32& aToneOnLength,
|
|
441 |
TTimeIntervalMicroSeconds32& aToneOffLength,
|
|
442 |
TTimeIntervalMicroSeconds32& aPauseLength);
|
|
443 |
|
|
444 |
/**
|
|
445 |
* Defines the period over which the volume level is to rise smoothly
|
|
446 |
* from nothing to the normal volume level.
|
|
447 |
* The function is only available before playing.
|
|
448 |
* @since
|
|
449 |
* @param const TTimeIntervalMicroSeconds &aRampDuration The period over
|
|
450 |
* which the volume is to rise. A zero value causes the tone
|
|
451 |
* sample to be played at the normal level for the full duration
|
|
452 |
* of the playback. A value, which is longer than the duration of
|
|
453 |
* the tone sample means that the sample never reaches its normal
|
|
454 |
* volume level.
|
|
455 |
* @return void
|
|
456 |
*/
|
|
457 |
IMPORT_C void SetVolumeRamp(
|
|
458 |
const TTimeIntervalMicroSeconds& aRampDuration);
|
|
459 |
|
|
460 |
/**
|
|
461 |
* Returns a list of the supported input datatypes that can be sent to
|
|
462 |
* DevSound for playing audio. The datatypes returned are those that the
|
|
463 |
* DevSound supports given the priority settings passed in
|
|
464 |
* aPrioritySettings. Note that if no supported data types are found this
|
|
465 |
* does not constitute failure, the function will return normally with no
|
|
466 |
* entries in aSupportedDataTypes.
|
|
467 |
* @since
|
|
468 |
* @param RArray< TFourCC > &aSupportedDataTypes The array of supported
|
|
469 |
* data types that will be filled in by this function. The
|
|
470 |
* supported data types of the DevSound are in the form of an
|
|
471 |
* array of TFourCC codes. Any existing entries in the array will
|
|
472 |
* be overwritten on calling this function. If no supported data
|
|
473 |
* types are found given the priority settings, then the
|
|
474 |
* aSupportedDatatypes array will have zero entries.
|
|
475 |
* @param const TMMFPrioritySettings &aPrioritySettings The priority
|
|
476 |
* settings used to determine the supported datatypes. Note this
|
|
477 |
* does not set the priority settings. For input datatypes the
|
|
478 |
* iState member of the priority settings would be expected to be
|
|
479 |
* either EMMFStatePlaying or EMMFStatePlayingRecording. The
|
|
480 |
* priority settings may effect the supported datatypes depending
|
|
481 |
* on the audio routing.
|
|
482 |
* @return void
|
|
483 |
*/
|
|
484 |
IMPORT_C void GetSupportedInputDataTypesL(
|
|
485 |
RArray<TFourCC>& aSupportedDataTypes,
|
|
486 |
const TMMFPrioritySettings& aPrioritySettings);
|
|
487 |
|
|
488 |
/**
|
|
489 |
* Returns a list of the supported output dataypes that can be received
|
|
490 |
* from DevSound for recording audio. The datatypes returned are those
|
|
491 |
* that the DevSound supports given the priority settings passed in
|
|
492 |
* aPrioritySettings. Note that if no supported data types are found this
|
|
493 |
* does not constitute failure, the function will return normally with no
|
|
494 |
* entries in aSupportedDataTypes.
|
|
495 |
* @since
|
|
496 |
* @param RArray< TFourCC > &aSupportedDataTypes The array of supported
|
|
497 |
* data types that will be filled in by this function. The
|
|
498 |
* supported datatypes of the DevSound are in the form of an array
|
|
499 |
* of TFourCC codes. Any existing entries in the array will be
|
|
500 |
* overwritten on calling this function. If no supported datatypes
|
|
501 |
* are found given the priority settings, then the
|
|
502 |
* aSupportedDatatypes array will have zero entries.
|
|
503 |
* @param const TMMFPrioritySettings &aPrioritySettings The priority
|
|
504 |
* settings used to determine the supported data types. Note this
|
|
505 |
* does not set the priority settings. For output data types the
|
|
506 |
* iState member of the priority settings would expected to be
|
|
507 |
* either EMMFStateRecording or EMMFStatePlayingRecording. The
|
|
508 |
* priority settings may effect the supported datatypes depending
|
|
509 |
* on the audio routing.
|
|
510 |
* @return void
|
|
511 |
*/
|
|
512 |
IMPORT_C void GetSupportedOutputDataTypesL(
|
|
513 |
RArray<TFourCC>& aSupportedDataTypes,
|
|
514 |
const TMMFPrioritySettings& aPrioritySettings);
|
|
515 |
|
|
516 |
/**
|
|
517 |
* Returns the number samples recorded so far.
|
|
518 |
* @since
|
|
519 |
* @return TInt The samples recorded.
|
|
520 |
*/
|
|
521 |
IMPORT_C TInt SamplesRecorded();
|
|
522 |
|
|
523 |
/**
|
|
524 |
* Returns the number samples played so far.
|
|
525 |
* @since
|
|
526 |
* @return TInt The samples played.
|
|
527 |
*/
|
|
528 |
IMPORT_C TInt SamplesPlayed();
|
|
529 |
|
|
530 |
/**
|
|
531 |
* Defines the number of times the audio is to be repeated during the
|
|
532 |
* tone playback operation. A period of silence can follow each playing
|
|
533 |
* of a tone. The tone playing can be repeated indefinitely
|
|
534 |
* @since
|
|
535 |
* @param TInt aRepeatCount The number of times the tone, together with
|
|
536 |
* the trailing silence, is to be repeated. If this is set to
|
|
537 |
* KMdaRepeatForever, then the tone, together with the trailing
|
|
538 |
* silence, is repeated indefinitely or until Stop() is called.
|
|
539 |
* If this is set to zero, then the tone is not repeated.
|
|
540 |
* @param const TTimeIntervalMicroSeconds &aRepeatTrailingSilence An
|
|
541 |
* interval of silence which will be played after each tone.
|
|
542 |
* Supported only during tone playing.
|
|
543 |
* @return void
|
|
544 |
*/
|
|
545 |
IMPORT_C void SetToneRepeats(
|
|
546 |
TInt aRepeatCount,
|
|
547 |
const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
|
|
548 |
|
|
549 |
/**
|
|
550 |
* Defines the priority settings that should be used for this instance.
|
|
551 |
* @since
|
|
552 |
* @param const TMMFPrioritySettings &aPrioritySettings A class type
|
|
553 |
* representing the client's priority, priority preference and
|
|
554 |
* state
|
|
555 |
* @return void
|
|
556 |
*/
|
|
557 |
IMPORT_C void SetPrioritySettings(
|
|
558 |
const TMMFPrioritySettings& aPrioritySettings);
|
|
559 |
|
|
560 |
/**
|
|
561 |
* Retrieves a custom interface to the device.
|
|
562 |
* @since
|
|
563 |
* @param TUid aInterfaceId The interface UID, defined with the custom
|
|
564 |
* interface.
|
|
565 |
* @return TAny* A pointer to the interface implementation, or NULL if
|
|
566 |
* the device does not implement the interface requested. The
|
|
567 |
* return value must be cast to the correct type by the user.
|
|
568 |
*/
|
|
569 |
IMPORT_C TAny* CustomInterface(TUid aInterfaceId);
|
|
570 |
|
|
571 |
/**
|
|
572 |
* Returns data buffer from the DevSound server for playback.
|
|
573 |
* @since
|
|
574 |
* @param TMMFDevSoundProxyHwBufPckg& aSetPckg A reference to pckg to
|
|
575 |
* receive buffer information.
|
|
576 |
* @return KErrNone if successfull, otherwise a corresponding error code
|
|
577 |
*/
|
|
578 |
|
|
579 |
IMPORT_C TInt BufferToBeFilledData(
|
|
580 |
TBool aRequestChunk, TMMFDevSoundProxyHwBufPckg& aSetPckg);
|
|
581 |
|
|
582 |
/**
|
|
583 |
* Returns data buffer from the DevSound server for recording.
|
|
584 |
* @since
|
|
585 |
* @param TMMFDevSoundProxyHwBufPckg& aSetPckg A reference to pckg to
|
|
586 |
* receive buffer information.
|
|
587 |
* @return KErrNone if successfull, otherwise a corresponding error code
|
|
588 |
*/
|
|
589 |
IMPORT_C TInt BufferToBeEmptiedData(TMMFDevSoundProxyHwBufPckg& aSetPckg);
|
|
590 |
IMPORT_C TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8);
|
|
591 |
IMPORT_C TInt CancelRegisterAsClient(TUid aEventType);
|
|
592 |
IMPORT_C TInt GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData);
|
|
593 |
IMPORT_C TInt WillResumePlay();
|
|
594 |
IMPORT_C TInt EmptyBuffers();
|
|
595 |
IMPORT_C TInt CancelInitialize();
|
|
596 |
IMPORT_C TInt SetClientThreadInfo(TThreadId& aTid);
|
|
597 |
|
|
598 |
/**
|
|
599 |
* Sends a custom command synchronously to the DevSound server. This
|
|
600 |
* method will not return until the server has serviced the command.
|
|
601 |
* @since
|
|
602 |
* @param "const TMMFMessageDestinationPckg& aDestination"
|
|
603 |
* The destination of the custom command. This consists of the
|
|
604 |
* unique ID of the interface of command handler.
|
|
605 |
* @param "TInt aFunction"
|
|
606 |
* The number of the function to be called on the command
|
|
607 |
* handler.
|
|
608 |
* @param "const TDesC8& aDataTo1"
|
|
609 |
* A reference to data to be copied to the command handler.
|
|
610 |
* The exact contents of the data are dependent on the command
|
|
611 |
* hanlder on the DevSound server. Can be NULL.
|
|
612 |
* @param "const TDesC8& aDataTo2"
|
|
613 |
* A reference to data to be copied to the command handler.
|
|
614 |
* The exact contents of the data are dependent on the command
|
|
615 |
* hanlder on the DevSound server. Can be NULL.
|
|
616 |
* @param "TDes8& aDataFrom"
|
|
617 |
* A reference to an area of memory to which the command handler
|
|
618 |
* will write any data to be passed back to the client. Cannot
|
|
619 |
* be NULL.
|
|
620 |
* @return "TInt"
|
|
621 |
* The result of the custom command. The exact range of values
|
|
622 |
* is dependent on the command handler interface.
|
|
623 |
*/
|
|
624 |
IMPORT_C TInt CustomCommandSync(
|
|
625 |
const TMMFMessageDestinationPckg& aDestination,
|
|
626 |
TInt aFunction,
|
|
627 |
const TDesC8& aDataTo1,
|
|
628 |
const TDesC8& aDataTo2,
|
|
629 |
TDes8& aDataFrom);
|
|
630 |
|
|
631 |
/**
|
|
632 |
* Sends a custom command synchronously to the DevSound server. This
|
|
633 |
* method will not return until the server has serviced the command.
|
|
634 |
* @since
|
|
635 |
* @param "const TMMFMessageDestinationPckg& aDestination"
|
|
636 |
* The destination of the custom command. This consists of the
|
|
637 |
* unique ID of the interface of command handler.
|
|
638 |
* @param "TInt aFunction"
|
|
639 |
* The number of the function to be called on the command
|
|
640 |
* handler.
|
|
641 |
* @param "const TDesC8& aDataTo1"
|
|
642 |
* A reference to data to be copied to the command handler.
|
|
643 |
* The exact contents of the data are dependent on the command
|
|
644 |
* hanlder on the DevSound server. Can be NULL.
|
|
645 |
* @param "const TDesC8& aDataTo2"
|
|
646 |
* A reference to data to be copied to the command handler.
|
|
647 |
* The exact contents of the data are dependent on the command
|
|
648 |
* hanlder on the DevSound server. Can be NULL.
|
|
649 |
* @return "TInt"
|
|
650 |
* The result of the custom command. The exact range of values
|
|
651 |
* is dependent on the command handler interface.
|
|
652 |
*/
|
|
653 |
IMPORT_C TInt CustomCommandSync(
|
|
654 |
const TMMFMessageDestinationPckg& aDestination,
|
|
655 |
TInt aFunction,
|
|
656 |
const TDesC8& aDataTo1,
|
|
657 |
const TDesC8& aDataTo2);
|
|
658 |
|
|
659 |
/**
|
|
660 |
* Sends a custom command asynchronously to the DevSound server.
|
|
661 |
* Note: This method will return immediately. The ::RunL() of the active
|
|
662 |
* object owning the aStatus parameter will be called when the command
|
|
663 |
* is completed by the command handler.
|
|
664 |
* @since
|
|
665 |
* @param "const TMMFMessageDestinationPckg& aDestination"
|
|
666 |
* The destination of the custom command. This consists of the
|
|
667 |
* unique ID of the interface of command handler.
|
|
668 |
* @param "TInt aFunction"
|
|
669 |
* The number of the function to be called on the command
|
|
670 |
* handler.
|
|
671 |
* @param "const TDesC8& aDataTo1"
|
|
672 |
* A reference to data to be copied to the command handler.
|
|
673 |
* The exact contents of the data are dependent on the command
|
|
674 |
* hanlder on the DevSound server. Can be NULL.
|
|
675 |
* @param "const TDesC8& aDataTo2"
|
|
676 |
* A reference to data to be copied to the command handler.
|
|
677 |
* The exact contents of the data are dependent on the command
|
|
678 |
* hanlder on the DevSound server. Can be NULL.
|
|
679 |
* @param "TDes8& aDataFrom"
|
|
680 |
* A reference to an area of memory to which the command handler
|
|
681 |
* will write any data to be passed back to the client. Cannot
|
|
682 |
* be NULL.
|
|
683 |
* @param "TRequestStatus& aStatus"
|
|
684 |
* The TRequestStatus of an active object. This will contain the
|
|
685 |
* result of the custom command on completion. The exact range
|
|
686 |
* of result values is dependent on the custom command
|
|
687 |
* interface.
|
|
688 |
*/
|
|
689 |
IMPORT_C void CustomCommandAsync(
|
|
690 |
const TMMFMessageDestinationPckg& aDestination,
|
|
691 |
TInt aFunction,
|
|
692 |
const TDesC8& aDataTo1,
|
|
693 |
const TDesC8& aDataTo2,
|
|
694 |
TDes8& aDataFrom,
|
|
695 |
TRequestStatus& aStatus);
|
|
696 |
|
|
697 |
/**
|
|
698 |
* Sends a custom command asynchronously to the DevSound server.
|
|
699 |
* Note: This method will return immediately. The ::RunL() of the active
|
|
700 |
* object owning the aStatus parameter will be called when the command
|
|
701 |
* is completed by the command handler.
|
|
702 |
* @since
|
|
703 |
* @param "const TMMFMessageDestinationPckg& aDestination"
|
|
704 |
* The destination of the custom command. This consists of the
|
|
705 |
* unique ID of the interface of command handler.
|
|
706 |
* @param "TInt aFunction"
|
|
707 |
* The number of the function to be called on the command
|
|
708 |
* handler.
|
|
709 |
* @param "const TDesC8& aDataTo1"
|
|
710 |
* A reference to data to be copied to the command handler. The
|
|
711 |
* exact contents of the data are dependent on the command
|
|
712 |
* hanlder on the DevSound server. Can be NULL.
|
|
713 |
* @param "const TDesC8& aDataTo2"
|
|
714 |
* A reference to data to be copied to the command handler. The
|
|
715 |
* exact contents of the data are dependent on the command
|
|
716 |
* hanlder on the DevSound server. Can be NULL.
|
|
717 |
* @param "TRequestStatus& aStatus"
|
|
718 |
* The TRequestStatus of an active object. This will contain the
|
|
719 |
* result of the custom command on completion. The exact range
|
|
720 |
* of result values is dependent on the custom command
|
|
721 |
* interface.
|
|
722 |
*/
|
|
723 |
IMPORT_C void CustomCommandAsync(
|
|
724 |
const TMMFMessageDestinationPckg& aDestination,
|
|
725 |
TInt aFunction,
|
|
726 |
const TDesC8& aDataTo1,
|
|
727 |
const TDesC8& aDataTo2,
|
|
728 |
TRequestStatus& aStatus);
|
|
729 |
|
|
730 |
IMPORT_C TInt SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam);
|
|
731 |
IMPORT_C void AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam);
|
|
732 |
IMPORT_C TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime);
|
|
733 |
|
|
734 |
/**
|
|
735 |
* Queries if the low layers does support resume operation.
|
|
736 |
* @since
|
|
737 |
* @return TBool ETrue if Resume is supported
|
|
738 |
* EFalse otherwise
|
|
739 |
*/
|
|
740 |
IMPORT_C TBool IsResumeSupported();
|
|
741 |
|
|
742 |
/**
|
|
743 |
* Resume the operation (Play, Record, TonePlay) temporarily paused .
|
|
744 |
* @since
|
|
745 |
* @return TInt KErrNone if succesful
|
|
746 |
* KErrNotSupported if the operation is not supported by this implementation
|
|
747 |
*/
|
|
748 |
IMPORT_C TInt Resume();
|
|
749 |
|
|
750 |
// from MDevSoundObserver
|
|
751 |
void InitializeComplete(TInt aError);
|
|
752 |
void ToneFinished(TInt aError);
|
|
753 |
void BufferToBeFilled(CMMFBuffer* aBuffer);
|
|
754 |
void PlayError(TInt aError);
|
|
755 |
void BufferToBeEmptied(CMMFBuffer* aBuffer);
|
|
756 |
void RecordError(TInt aError);
|
|
757 |
void ConvertError(TInt aError);
|
|
758 |
void DeviceMessage(TUid aMessageType, const TDesC8& aMsg);
|
|
759 |
void SendEventToClient(const TMMFEvent& aEvent);
|
|
760 |
|
|
761 |
private:
|
|
762 |
void StartReceivingMsgQueueHandlerEventsL(MMMFDevSoundCustomInterfaceObserver& aDevSoundCIObserver);
|
|
763 |
|
|
764 |
private: // Data
|
|
765 |
|
|
766 |
TMMFDevSoundProxySettingsPckg iDspsPckg;
|
|
767 |
CMMFDataBuffer* iBuffer; //Not Owned
|
|
768 |
HBufC* iSeqName;
|
|
769 |
|
|
770 |
TMMFMessageDestinationPckg iDestinationPckg;
|
|
771 |
|
|
772 |
enum TState
|
|
773 |
{
|
|
774 |
EIdle = 0,
|
|
775 |
EInitializing,
|
|
776 |
EInitialized,
|
|
777 |
EPlaying,
|
|
778 |
EPlayingBufferWait,
|
|
779 |
ETonePlaying,
|
|
780 |
ERecording,
|
|
781 |
ERecordingBufferWait,
|
|
782 |
ERecordingInLastBufferCycle,
|
|
783 |
ERecordingResumingInLastBufferCycle,
|
|
784 |
};
|
|
785 |
|
|
786 |
enum TTonePlayingMode
|
|
787 |
{
|
|
788 |
ESimple = 0,
|
|
789 |
EDual,
|
|
790 |
EDTMFString,
|
|
791 |
ESequence,
|
|
792 |
EFixedSequence
|
|
793 |
};
|
|
794 |
|
|
795 |
// Allows distinguish for operations supported for some tones
|
|
796 |
TTonePlayingMode iToneMode;
|
|
797 |
// Contains state information of this DLL instance. Allows client-size state checking.
|
|
798 |
TState iState;
|
|
799 |
// Reference to the devsound proxy object
|
|
800 |
RMMFAudioServerProxy* iAudioServerProxy;
|
|
801 |
// Reference to observer where the events need to be forwarded to.
|
|
802 |
MDevSoundObserver* iDevSoundObserver;
|
|
803 |
// Message queue
|
|
804 |
RMsgQueue<TMMFDevSoundQueueItem> iMsgQueue;
|
|
805 |
// Reference to the message queue handler
|
|
806 |
CMsgQueueHandler* iMsgQueueHandler;
|
|
807 |
TMMFMessageDestinationPckg iCustIntPckg;
|
|
808 |
};
|
|
809 |
|
|
810 |
#endif // RMMFDEVSOUNDPROXY_H
|
|
811 |
|
|
812 |
// End of File
|