sl@0
|
1 |
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
|
sl@0
|
17 |
|
sl@0
|
18 |
// INCLUDES
|
sl@0
|
19 |
#include <mmf/server/sounddevice.h>
|
sl@0
|
20 |
#include "sounddevicebody.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
/*
|
sl@0
|
23 |
* Default Constructor.
|
sl@0
|
24 |
*/
|
sl@0
|
25 |
CMMFDevSound::CMMFDevSound()
|
sl@0
|
26 |
{
|
sl@0
|
27 |
}
|
sl@0
|
28 |
|
sl@0
|
29 |
/*
|
sl@0
|
30 |
* Destructor.
|
sl@0
|
31 |
*/
|
sl@0
|
32 |
EXPORT_C CMMFDevSound::~CMMFDevSound()
|
sl@0
|
33 |
{
|
sl@0
|
34 |
delete iBody;
|
sl@0
|
35 |
}
|
sl@0
|
36 |
|
sl@0
|
37 |
/*
|
sl@0
|
38 |
* CMMFDevSound::NewL
|
sl@0
|
39 |
*
|
sl@0
|
40 |
* Constructs and returns a pointer to a new CMMFDevSound object.
|
sl@0
|
41 |
*/
|
sl@0
|
42 |
EXPORT_C CMMFDevSound* CMMFDevSound::NewL()
|
sl@0
|
43 |
{
|
sl@0
|
44 |
CMMFDevSound* self = new (ELeave) CMMFDevSound;
|
sl@0
|
45 |
CleanupStack::PushL(self);
|
sl@0
|
46 |
self->ConstructL();
|
sl@0
|
47 |
CleanupStack::Pop(self);
|
sl@0
|
48 |
return self;
|
sl@0
|
49 |
}
|
sl@0
|
50 |
|
sl@0
|
51 |
/*
|
sl@0
|
52 |
* CMMFDevSound::ConstructL
|
sl@0
|
53 |
*
|
sl@0
|
54 |
* Second phase constructor.
|
sl@0
|
55 |
*/
|
sl@0
|
56 |
void CMMFDevSound::ConstructL()
|
sl@0
|
57 |
{
|
sl@0
|
58 |
iBody = CBody::NewL();
|
sl@0
|
59 |
}
|
sl@0
|
60 |
|
sl@0
|
61 |
/*
|
sl@0
|
62 |
* CMMFDevSound::InitializeL
|
sl@0
|
63 |
*
|
sl@0
|
64 |
* Initializes CMMFDevSound object. On completion of Initialization will
|
sl@0
|
65 |
* call InitializeComplete() on aDevSoundObserver.
|
sl@0
|
66 |
*
|
sl@0
|
67 |
* @param aDevSoundObserver. A reference to the DevSound Observer instance.
|
sl@0
|
68 |
* @param aMode. A mode for which this object will be used.
|
sl@0
|
69 |
*/
|
sl@0
|
70 |
EXPORT_C void CMMFDevSound::InitializeL(MDevSoundObserver& aDevSoundObserver,TMMFState aMode)
|
sl@0
|
71 |
|
sl@0
|
72 |
{
|
sl@0
|
73 |
iBody->InitializeL(aDevSoundObserver,aMode);
|
sl@0
|
74 |
}
|
sl@0
|
75 |
|
sl@0
|
76 |
/*
|
sl@0
|
77 |
* CMMFDevSound::InitializeL
|
sl@0
|
78 |
*
|
sl@0
|
79 |
* Initializes CMMFDevSound object with hardware device aHWDev. On completion
|
sl@0
|
80 |
* of Initialization will call InitializeComplete() on aDevSoundObserver.
|
sl@0
|
81 |
*
|
sl@0
|
82 |
* Method is deprecated from OS release 9.5
|
sl@0
|
83 |
*
|
sl@0
|
84 |
* @param aDevSoundObserver. A reference to the DevSound Observer instance.
|
sl@0
|
85 |
* @param aHWDev. CMMFHwDevice implementation identifier.
|
sl@0
|
86 |
* @param aMode. A mode for which this object will be used.
|
sl@0
|
87 |
*/
|
sl@0
|
88 |
EXPORT_C void CMMFDevSound::InitializeL(
|
sl@0
|
89 |
MDevSoundObserver& /*aDevSoundObserver*/,
|
sl@0
|
90 |
TUid /*aHWDev*/,
|
sl@0
|
91 |
TMMFState /*aMode*/)
|
sl@0
|
92 |
{
|
sl@0
|
93 |
User::Leave(KErrNotSupported);
|
sl@0
|
94 |
}
|
sl@0
|
95 |
|
sl@0
|
96 |
/*
|
sl@0
|
97 |
* CMMFDevSound::InitializeL
|
sl@0
|
98 |
*
|
sl@0
|
99 |
* Initializes CMMFDevSound object with hardware device with hardware
|
sl@0
|
100 |
* device's FourCC code. On completion of Initialization will call
|
sl@0
|
101 |
* InitializeComplete() on aDevSoundObserver.
|
sl@0
|
102 |
*
|
sl@0
|
103 |
* @param aDevSoundObserver. A reference to the DevSound Observer instance.
|
sl@0
|
104 |
* @param aDesiredFourCC. CMMFHwDevice implementation FourCC.
|
sl@0
|
105 |
* @param aMode. A mode for which this object will be used.
|
sl@0
|
106 |
*/
|
sl@0
|
107 |
EXPORT_C void CMMFDevSound::InitializeL(
|
sl@0
|
108 |
MDevSoundObserver& aDevSoundObserver,
|
sl@0
|
109 |
TFourCC aDesiredFourCC,
|
sl@0
|
110 |
TMMFState aMode)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
iBody->InitializeL(aDevSoundObserver, aDesiredFourCC, aMode);
|
sl@0
|
113 |
}
|
sl@0
|
114 |
|
sl@0
|
115 |
/*
|
sl@0
|
116 |
* CMMFDevSound::Capabilities
|
sl@0
|
117 |
*
|
sl@0
|
118 |
* Returns supported Audio settings.
|
sl@0
|
119 |
*
|
sl@0
|
120 |
* @return TMMFCapabilities device settings.
|
sl@0
|
121 |
*/
|
sl@0
|
122 |
EXPORT_C TMMFCapabilities CMMFDevSound::Capabilities()
|
sl@0
|
123 |
{
|
sl@0
|
124 |
return iBody->Capabilities();
|
sl@0
|
125 |
}
|
sl@0
|
126 |
|
sl@0
|
127 |
/*
|
sl@0
|
128 |
* CMMFDevSound::Config
|
sl@0
|
129 |
*
|
sl@0
|
130 |
* Returns current audio settings.
|
sl@0
|
131 |
*
|
sl@0
|
132 |
* @return TMMFCapabilities device settings.
|
sl@0
|
133 |
*/
|
sl@0
|
134 |
EXPORT_C TMMFCapabilities CMMFDevSound::Config() const
|
sl@0
|
135 |
{
|
sl@0
|
136 |
return iBody->Config();
|
sl@0
|
137 |
}
|
sl@0
|
138 |
|
sl@0
|
139 |
/*
|
sl@0
|
140 |
* CMMFDevSound::SetConfigL
|
sl@0
|
141 |
*
|
sl@0
|
142 |
* ConfigureS CMMFDevSound object with the settings in aConfig.
|
sl@0
|
143 |
*
|
sl@0
|
144 |
* Use this to set sampling rate, Encoding and Mono/Stereo.
|
sl@0
|
145 |
*
|
sl@0
|
146 |
* @param aConfig. CMMFDevSound configuration settings.
|
sl@0
|
147 |
*/
|
sl@0
|
148 |
EXPORT_C void CMMFDevSound::SetConfigL(const TMMFCapabilities& aConfig)
|
sl@0
|
149 |
{
|
sl@0
|
150 |
iBody->SetConfigL(aConfig);
|
sl@0
|
151 |
}
|
sl@0
|
152 |
|
sl@0
|
153 |
/*
|
sl@0
|
154 |
* CMMFDevSound::MaxVolume
|
sl@0
|
155 |
*
|
sl@0
|
156 |
* Returns an integer representing the maximum volume.
|
sl@0
|
157 |
*
|
sl@0
|
158 |
* This is the maximum volume which can be passed to CMMFDevSound::SetVolume.
|
sl@0
|
159 |
*
|
sl@0
|
160 |
* @return TInt
|
sl@0
|
161 |
* The maximum volume. This value is platform dependent but is always
|
sl@0
|
162 |
* greater than or equal to one.
|
sl@0
|
163 |
*/
|
sl@0
|
164 |
EXPORT_C TInt CMMFDevSound::MaxVolume()
|
sl@0
|
165 |
{
|
sl@0
|
166 |
return iBody->MaxVolume();
|
sl@0
|
167 |
}
|
sl@0
|
168 |
|
sl@0
|
169 |
/*
|
sl@0
|
170 |
* CMMFDevSound::Volume
|
sl@0
|
171 |
*
|
sl@0
|
172 |
* Returns an integer representing current volume level.
|
sl@0
|
173 |
*
|
sl@0
|
174 |
* @return TInt
|
sl@0
|
175 |
* Current volume level.
|
sl@0
|
176 |
*/
|
sl@0
|
177 |
EXPORT_C TInt CMMFDevSound::Volume()
|
sl@0
|
178 |
{
|
sl@0
|
179 |
return iBody->Volume();
|
sl@0
|
180 |
}
|
sl@0
|
181 |
|
sl@0
|
182 |
/*
|
sl@0
|
183 |
* CMMFDevSound::SetVolume
|
sl@0
|
184 |
*
|
sl@0
|
185 |
* Changes current volume level to the specified value.
|
sl@0
|
186 |
*
|
sl@0
|
187 |
* The volume can be changed before or during playback and is effective
|
sl@0
|
188 |
* immediately.
|
sl@0
|
189 |
*
|
sl@0
|
190 |
* @param TInt
|
sl@0
|
191 |
* The volume setting. This can be any value between zero and the
|
sl@0
|
192 |
* value returned by the call to CMMFDevSound::MaxVolume(). If the
|
sl@0
|
193 |
* volume is out of range, it is automatically set to the minimum or
|
sl@0
|
194 |
* maximum level closest to the value being passed in. Setting a zero
|
sl@0
|
195 |
* value mutes the sound.
|
sl@0
|
196 |
*/
|
sl@0
|
197 |
EXPORT_C void CMMFDevSound::SetVolume(TInt aVolume)
|
sl@0
|
198 |
{
|
sl@0
|
199 |
iBody->SetVolume(aVolume);
|
sl@0
|
200 |
}
|
sl@0
|
201 |
|
sl@0
|
202 |
/*
|
sl@0
|
203 |
* CMMFDevSound::MaxGain
|
sl@0
|
204 |
*
|
sl@0
|
205 |
* Returns an integer representing the maximum microphone gain.
|
sl@0
|
206 |
*
|
sl@0
|
207 |
* This is the maximum value which can be passed to CMMFDevSound::SetGain.
|
sl@0
|
208 |
*
|
sl@0
|
209 |
* @return TInt
|
sl@0
|
210 |
* The maximum gain. This value is platform dependent but is always
|
sl@0
|
211 |
* greater than or equal to one.
|
sl@0
|
212 |
*/
|
sl@0
|
213 |
EXPORT_C TInt CMMFDevSound::MaxGain()
|
sl@0
|
214 |
{
|
sl@0
|
215 |
return iBody->MaxGain();
|
sl@0
|
216 |
}
|
sl@0
|
217 |
|
sl@0
|
218 |
/*
|
sl@0
|
219 |
* CMMFDevSound::Gain
|
sl@0
|
220 |
*
|
sl@0
|
221 |
* Returns an integer representing current gain.
|
sl@0
|
222 |
*
|
sl@0
|
223 |
* @return TInt
|
sl@0
|
224 |
* The current gain level.
|
sl@0
|
225 |
*/
|
sl@0
|
226 |
EXPORT_C TInt CMMFDevSound::Gain()
|
sl@0
|
227 |
{
|
sl@0
|
228 |
return iBody->Gain();
|
sl@0
|
229 |
}
|
sl@0
|
230 |
|
sl@0
|
231 |
/*
|
sl@0
|
232 |
* CMMFDevSound::SetGain
|
sl@0
|
233 |
*
|
sl@0
|
234 |
* Changes current recording gain to a specified value.
|
sl@0
|
235 |
*
|
sl@0
|
236 |
* The gain can be changed before or during recording and is effective
|
sl@0
|
237 |
* immediately.
|
sl@0
|
238 |
*
|
sl@0
|
239 |
* @param aGain. This can be any value between zero and the
|
sl@0
|
240 |
* value returned by the call to CMMFDevSound::MaxGain(). If the
|
sl@0
|
241 |
* gain is out of range, it is automatically set to minimum or maximum
|
sl@0
|
242 |
* value closest to the value that is being passed.
|
sl@0
|
243 |
* Setting a zero value mutes the microphone.
|
sl@0
|
244 |
*/
|
sl@0
|
245 |
EXPORT_C void CMMFDevSound::SetGain(TInt aGain)
|
sl@0
|
246 |
{
|
sl@0
|
247 |
iBody->SetGain(aGain);
|
sl@0
|
248 |
}
|
sl@0
|
249 |
|
sl@0
|
250 |
/*
|
sl@0
|
251 |
* CMMFDevSound::GetPlayBalanceL
|
sl@0
|
252 |
*
|
sl@0
|
253 |
* Returns the speaker balance set for playing.
|
sl@0
|
254 |
*
|
sl@0
|
255 |
* @param aLeftPercentage. On return contains the left speaker volume percentage.
|
sl@0
|
256 |
* @param aRightPercentage. On return contains the left speaker volume percentage.
|
sl@0
|
257 |
*/
|
sl@0
|
258 |
EXPORT_C void CMMFDevSound::GetPlayBalanceL(TInt& aLeftPercentage,TInt& aRightPercentage)
|
sl@0
|
259 |
{
|
sl@0
|
260 |
iBody->GetPlayBalanceL(aLeftPercentage, aRightPercentage);
|
sl@0
|
261 |
}
|
sl@0
|
262 |
|
sl@0
|
263 |
/*
|
sl@0
|
264 |
* CMMFDevSound::SetPlayBalanceL
|
sl@0
|
265 |
*
|
sl@0
|
266 |
* Sets the speaker balance for playing.
|
sl@0
|
267 |
*
|
sl@0
|
268 |
* The speaker balance can be changed before or during playback and is
|
sl@0
|
269 |
* effective immediately.
|
sl@0
|
270 |
*
|
sl@0
|
271 |
* @param aLeftPercentage. Left speaker volume perecentage. This can be any value between
|
sl@0
|
272 |
* zero and 100. Setting a zero value mutes the sound on the left
|
sl@0
|
273 |
* speaker.
|
sl@0
|
274 |
* @param aRightPercentage. Right speaker volume perecentage. This can be any value between
|
sl@0
|
275 |
* zero and 100. Setting a zero value mutes the sound on the right
|
sl@0
|
276 |
* speaker.
|
sl@0
|
277 |
*/
|
sl@0
|
278 |
EXPORT_C void CMMFDevSound::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage)
|
sl@0
|
279 |
{
|
sl@0
|
280 |
iBody->SetPlayBalanceL(aLeftPercentage, aRightPercentage);
|
sl@0
|
281 |
}
|
sl@0
|
282 |
|
sl@0
|
283 |
/*
|
sl@0
|
284 |
* CMMFDevSound::GetRecordBalanceL
|
sl@0
|
285 |
*
|
sl@0
|
286 |
* Returns the microphone gain balance set for recording.
|
sl@0
|
287 |
*
|
sl@0
|
288 |
* @param aLeftPercentage. On return contains the left microphone gain percentage.
|
sl@0
|
289 |
* @param aRightPercentage. On return contains the right microphone gain percentage.
|
sl@0
|
290 |
*/
|
sl@0
|
291 |
EXPORT_C void CMMFDevSound::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)
|
sl@0
|
292 |
{
|
sl@0
|
293 |
iBody->GetRecordBalanceL(aLeftPercentage, aRightPercentage);
|
sl@0
|
294 |
}
|
sl@0
|
295 |
|
sl@0
|
296 |
/*
|
sl@0
|
297 |
* CMMFDevSound::SetRecordBalanceL
|
sl@0
|
298 |
*
|
sl@0
|
299 |
* Sets the microphone gain balance for recording.
|
sl@0
|
300 |
*
|
sl@0
|
301 |
* The microphone gain balance can be changed before or during recording and
|
sl@0
|
302 |
* is effective immediately.
|
sl@0
|
303 |
*
|
sl@0
|
304 |
* @param aLeftPercentage. Left microphone gain precentage. This can be any value between zero
|
sl@0
|
305 |
* and 100. Setting a zero value mutes the gain on the left microphone.
|
sl@0
|
306 |
* @param aRightPercentage. Right microphone gain precentage. This can be any value between zero
|
sl@0
|
307 |
* and 100. Setting a zero value mutes the gain on the right microphone
|
sl@0
|
308 |
*/
|
sl@0
|
309 |
EXPORT_C void CMMFDevSound::SetRecordBalanceL(TInt aLeftPercentage,TInt aRightPercentage)
|
sl@0
|
310 |
{
|
sl@0
|
311 |
iBody->SetRecordBalanceL(aLeftPercentage, aRightPercentage);
|
sl@0
|
312 |
}
|
sl@0
|
313 |
|
sl@0
|
314 |
/*
|
sl@0
|
315 |
* CMMFDevSound::PlayInitL
|
sl@0
|
316 |
*
|
sl@0
|
317 |
* Initializes audio device and starts the playback. Before playback can be
|
sl@0
|
318 |
* started, its current client's access priority is first verified by the
|
sl@0
|
319 |
* audio policy. In case of an error during the policy initialization, the
|
sl@0
|
320 |
* PlayError() method will be called on the observer with KErrAccessDenied
|
sl@0
|
321 |
* error code, otherwise BufferToBeFilled() method will be called with a
|
sl@0
|
322 |
* buffer reference. After filling the buffer with the data, the client
|
sl@0
|
323 |
* should call PlayData() to start playback.
|
sl@0
|
324 |
*
|
sl@0
|
325 |
* The amount of data that can be played is specified in
|
sl@0
|
326 |
* CMMFBuffer::RequestSize(). Any data that is read into the buffer beyond
|
sl@0
|
327 |
* this size will be ignored.
|
sl@0
|
328 |
*
|
sl@0
|
329 |
*/
|
sl@0
|
330 |
EXPORT_C void CMMFDevSound::PlayInitL()
|
sl@0
|
331 |
{
|
sl@0
|
332 |
iBody->PlayInitL();
|
sl@0
|
333 |
}
|
sl@0
|
334 |
|
sl@0
|
335 |
/*
|
sl@0
|
336 |
* CMMFDevSound::RecordInitL
|
sl@0
|
337 |
*
|
sl@0
|
338 |
* Initializes audio device and starts the recording. Before recording can be
|
sl@0
|
339 |
* started, its current client's access priority is first verified by the
|
sl@0
|
340 |
* audio policy. In case of an error during the policy initialization, the
|
sl@0
|
341 |
* RecordError() method will be called on the observer with KErrAccessDenied
|
sl@0
|
342 |
* error code, otherwise BufferToBeEmptied() method will be called with a
|
sl@0
|
343 |
* buffer reference. This buffer contains recorded or encoded data. After
|
sl@0
|
344 |
* processing the data in the buffer, the client should call RecordData()
|
sl@0
|
345 |
* to continue recording process.
|
sl@0
|
346 |
*
|
sl@0
|
347 |
* The amount of data that is available is specified in
|
sl@0
|
348 |
* CMMFBuffer::RequestSize().
|
sl@0
|
349 |
*
|
sl@0
|
350 |
*/
|
sl@0
|
351 |
EXPORT_C void CMMFDevSound::RecordInitL()
|
sl@0
|
352 |
{
|
sl@0
|
353 |
iBody->RecordInitL();
|
sl@0
|
354 |
}
|
sl@0
|
355 |
|
sl@0
|
356 |
/*
|
sl@0
|
357 |
* CMMFDevSound::PlayData
|
sl@0
|
358 |
*
|
sl@0
|
359 |
* Plays data in the buffer. The client should fill the buffer with a stream
|
sl@0
|
360 |
* of sampled audio data before calling this method. The observer gets the
|
sl@0
|
361 |
* reference to the buffer along with BufferToBeFilled() callback. When
|
sl@0
|
362 |
* playing of the audio sample is complete, with success or not, the
|
sl@0
|
363 |
* PlayError() method is called on the observer.
|
sl@0
|
364 |
*/
|
sl@0
|
365 |
EXPORT_C void CMMFDevSound::PlayData()
|
sl@0
|
366 |
{
|
sl@0
|
367 |
iBody->PlayData();
|
sl@0
|
368 |
}
|
sl@0
|
369 |
|
sl@0
|
370 |
/*
|
sl@0
|
371 |
* CMMFDevSound::RecordData
|
sl@0
|
372 |
*
|
sl@0
|
373 |
* Records audio data. Once the buffer is filled with recorded sampled audio
|
sl@0
|
374 |
* data, the observer gets reference to the buffer along with
|
sl@0
|
375 |
* BufferToBeEmptied() callback. After processing of the buffer (copying over
|
sl@0
|
376 |
* to a different buffer or writing to a file) the client should call this
|
sl@0
|
377 |
* method again to continue recording process.
|
sl@0
|
378 |
*/
|
sl@0
|
379 |
EXPORT_C void CMMFDevSound::RecordData()
|
sl@0
|
380 |
{
|
sl@0
|
381 |
iBody->RecordData();
|
sl@0
|
382 |
}
|
sl@0
|
383 |
|
sl@0
|
384 |
/*
|
sl@0
|
385 |
* CMMFDevSound::Stop
|
sl@0
|
386 |
*
|
sl@0
|
387 |
* Stops the ongoing operation (Play, Record, TonePlay)
|
sl@0
|
388 |
*/
|
sl@0
|
389 |
EXPORT_C void CMMFDevSound::Stop()
|
sl@0
|
390 |
{
|
sl@0
|
391 |
iBody->Stop();
|
sl@0
|
392 |
}
|
sl@0
|
393 |
|
sl@0
|
394 |
/*
|
sl@0
|
395 |
* CMMFDevSound::Pause
|
sl@0
|
396 |
*
|
sl@0
|
397 |
* Temporarily suspends the ongoing operation (Play, Record, TonePlay)
|
sl@0
|
398 |
*/
|
sl@0
|
399 |
EXPORT_C void CMMFDevSound::Pause()
|
sl@0
|
400 |
{
|
sl@0
|
401 |
iBody->Pause();
|
sl@0
|
402 |
}
|
sl@0
|
403 |
|
sl@0
|
404 |
/*
|
sl@0
|
405 |
* CMMFDevSound::SamplesRecorded
|
sl@0
|
406 |
*
|
sl@0
|
407 |
* Returns the number of recorded samples up to this point.
|
sl@0
|
408 |
*
|
sl@0
|
409 |
* @return TInt
|
sl@0
|
410 |
* Value representing recorded samples.
|
sl@0
|
411 |
*/
|
sl@0
|
412 |
EXPORT_C TInt CMMFDevSound::SamplesRecorded()
|
sl@0
|
413 |
{
|
sl@0
|
414 |
return iBody->SamplesRecorded();
|
sl@0
|
415 |
}
|
sl@0
|
416 |
|
sl@0
|
417 |
/*
|
sl@0
|
418 |
* CMMFDevSound::SamplesPlayed
|
sl@0
|
419 |
*
|
sl@0
|
420 |
* Returns the number of played samples up to this point.
|
sl@0
|
421 |
*
|
sl@0
|
422 |
* @return TInt
|
sl@0
|
423 |
* Value representing played samples.
|
sl@0
|
424 |
*/
|
sl@0
|
425 |
EXPORT_C TInt CMMFDevSound::SamplesPlayed()
|
sl@0
|
426 |
{
|
sl@0
|
427 |
return iBody->SamplesPlayed();
|
sl@0
|
428 |
}
|
sl@0
|
429 |
|
sl@0
|
430 |
/*
|
sl@0
|
431 |
* CMMFDevSound::PlayToneL
|
sl@0
|
432 |
*
|
sl@0
|
433 |
* Initializes audio device and starts playing a single tone according with
|
sl@0
|
434 |
* the specified frequency and duration attributes.
|
sl@0
|
435 |
*
|
sl@0
|
436 |
* @param aFrequency. Frequency at with the tone will be played.
|
sl@0
|
437 |
* @param aDuration. The period over which the tone will be played. A zero value causes
|
sl@0
|
438 |
* no tone to be played.
|
sl@0
|
439 |
*/
|
sl@0
|
440 |
EXPORT_C void CMMFDevSound::PlayToneL(TInt aFrequency,const TTimeIntervalMicroSeconds& aDuration)
|
sl@0
|
441 |
{
|
sl@0
|
442 |
iBody->PlayToneL(aFrequency, aDuration);
|
sl@0
|
443 |
}
|
sl@0
|
444 |
|
sl@0
|
445 |
/*
|
sl@0
|
446 |
* CMMFDevSound::PlayDualToneL
|
sl@0
|
447 |
*
|
sl@0
|
448 |
* Initializes audio device and starts playing a dual tone.
|
sl@0
|
449 |
* The tone consists of two sine waves of different frequencies summed
|
sl@0
|
450 |
* together. Both frequencies and the duration are specified in the passed
|
sl@0
|
451 |
* in attributes.
|
sl@0
|
452 |
*
|
sl@0
|
453 |
* @param aFrequencyOne. Value representing first frequency of the dual tone.
|
sl@0
|
454 |
*
|
sl@0
|
455 |
* @param aFrequencyTwo. Value representing second frequency of the dual tone.
|
sl@0
|
456 |
*
|
sl@0
|
457 |
* @param aDuration. The period over which the tone will be played. A zero value causes
|
sl@0
|
458 |
* no tone to be played.
|
sl@0
|
459 |
*/
|
sl@0
|
460 |
EXPORT_C void CMMFDevSound::PlayDualToneL(
|
sl@0
|
461 |
TInt aFrequencyOne,
|
sl@0
|
462 |
TInt aFrequencyTwo,
|
sl@0
|
463 |
const TTimeIntervalMicroSeconds& aDuration)
|
sl@0
|
464 |
{
|
sl@0
|
465 |
iBody->PlayDualToneL(aFrequencyOne, aFrequencyTwo, aDuration);
|
sl@0
|
466 |
}
|
sl@0
|
467 |
|
sl@0
|
468 |
/*
|
sl@0
|
469 |
* CMMFDevSound::PlayDTMFStringL
|
sl@0
|
470 |
*
|
sl@0
|
471 |
* Initializes audio device and starts playing DTMF string.
|
sl@0
|
472 |
*
|
sl@0
|
473 |
* @param aDTMFString. DTMF sequence in a descriptor.
|
sl@0
|
474 |
*/
|
sl@0
|
475 |
EXPORT_C void CMMFDevSound::PlayDTMFStringL(const TDesC& aDTMFString)
|
sl@0
|
476 |
{
|
sl@0
|
477 |
iBody->PlayDTMFStringL(aDTMFString);
|
sl@0
|
478 |
}
|
sl@0
|
479 |
|
sl@0
|
480 |
/*
|
sl@0
|
481 |
* CMMFDevSound::PlayToneSequenceL
|
sl@0
|
482 |
*
|
sl@0
|
483 |
* Initializes audio device and starts playing tone sequence.
|
sl@0
|
484 |
*
|
sl@0
|
485 |
* @param aData. Tone sequence in a descriptor.
|
sl@0
|
486 |
*/
|
sl@0
|
487 |
EXPORT_C void CMMFDevSound::PlayToneSequenceL(const TDesC8& aData)
|
sl@0
|
488 |
{
|
sl@0
|
489 |
iBody->PlayToneSequenceL(aData);
|
sl@0
|
490 |
}
|
sl@0
|
491 |
|
sl@0
|
492 |
/*
|
sl@0
|
493 |
* CMMFDevSound::PlayFixedSequenceL
|
sl@0
|
494 |
*
|
sl@0
|
495 |
* Initializes audio device and starts playing the specified tone sequence.
|
sl@0
|
496 |
*
|
sl@0
|
497 |
* Method is deprecated from OS release 9.5
|
sl@0
|
498 |
*
|
sl@0
|
499 |
* @param aSequenceNumber. The index identifying the specific pre-defined tone sequence. The
|
sl@0
|
500 |
* index values are relative to zero. This can be any value between
|
sl@0
|
501 |
* zero and the value returned by the call to
|
sl@0
|
502 |
* CMdaAudioPlayerUtility::FixedSequenceCount() - 1. The function
|
sl@0
|
503 |
* raises a panic if sequence number is out of range.
|
sl@0
|
504 |
*/
|
sl@0
|
505 |
EXPORT_C void CMMFDevSound::PlayFixedSequenceL(TInt /*aSequenceNumber*/)
|
sl@0
|
506 |
{
|
sl@0
|
507 |
User::Leave(KErrNotSupported);
|
sl@0
|
508 |
}
|
sl@0
|
509 |
|
sl@0
|
510 |
/*
|
sl@0
|
511 |
* CMMFDevSound::SetToneRepeats
|
sl@0
|
512 |
*
|
sl@0
|
513 |
* Defines the number of times the audio is to be repeated during the tone
|
sl@0
|
514 |
* playback operation.
|
sl@0
|
515 |
*
|
sl@0
|
516 |
* A period of silence can follow each playing of tone. The tone playing can
|
sl@0
|
517 |
* be repeated indefinitely.
|
sl@0
|
518 |
*
|
sl@0
|
519 |
* @param aRepeatCount. The number of times the tone, together with the trailing silence,
|
sl@0
|
520 |
* is to be repeated. If this is set to KMdaRepeatForever, then the
|
sl@0
|
521 |
* tone, together with the trailing silence, is repeated indefinitely
|
sl@0
|
522 |
* or until Stop() is called. If this is set to zero, then the tone is
|
sl@0
|
523 |
* not repeated. Supported only during the tone playing.
|
sl@0
|
524 |
|
sl@0
|
525 |
* @param aRepeatTrailingSilence. The duration of the trailing silence.
|
sl@0
|
526 |
*/
|
sl@0
|
527 |
EXPORT_C void CMMFDevSound::SetToneRepeats(TInt aRepeatCount,const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)
|
sl@0
|
528 |
{
|
sl@0
|
529 |
iBody->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence);
|
sl@0
|
530 |
}
|
sl@0
|
531 |
|
sl@0
|
532 |
/*
|
sl@0
|
533 |
* CMMFDevSound::SetDTMFLengths
|
sl@0
|
534 |
*
|
sl@0
|
535 |
* Defines the duration of 'tone on/tone off' and 'tone pause' to be used
|
sl@0
|
536 |
* during the DTMF playback.
|
sl@0
|
537 |
*
|
sl@0
|
538 |
* Supported only during tone playing.
|
sl@0
|
539 |
*
|
sl@0
|
540 |
* @param aToneOnLength. The period over which the tone will be played. If this is set to
|
sl@0
|
541 |
* zero, then the tone is not played.
|
sl@0
|
542 |
*
|
sl@0
|
543 |
* @param aToneOffLength. The period over which 'no tone' will be played.
|
sl@0
|
544 |
*
|
sl@0
|
545 |
* @param aPauseLength. The period over which the tone playing will be paused.
|
sl@0
|
546 |
*/
|
sl@0
|
547 |
EXPORT_C void CMMFDevSound::SetDTMFLengths(
|
sl@0
|
548 |
TTimeIntervalMicroSeconds32& aToneOnLength,
|
sl@0
|
549 |
TTimeIntervalMicroSeconds32& aToneOffLength,
|
sl@0
|
550 |
TTimeIntervalMicroSeconds32& aPauseLength)
|
sl@0
|
551 |
{
|
sl@0
|
552 |
iBody->SetDTMFLengths(aToneOnLength, aToneOffLength, aPauseLength);
|
sl@0
|
553 |
}
|
sl@0
|
554 |
|
sl@0
|
555 |
/*
|
sl@0
|
556 |
* CMMFDevSound::SetVolumeRamp
|
sl@0
|
557 |
*
|
sl@0
|
558 |
* Defines the period over which the volume level will rise smoothly from
|
sl@0
|
559 |
* mute to the normal volume level.
|
sl@0
|
560 |
*
|
sl@0
|
561 |
* @param aRampDuration. The period over which the volume is to rise. A zero value causes
|
sl@0
|
562 |
* the tone sample to be played at the normal level for the full duration of the
|
sl@0
|
563 |
* playback. A value, which is longer than the duration
|
sl@0
|
564 |
* of the tone sample, will result in the sample never reaching its
|
sl@0
|
565 |
* normal volume level.
|
sl@0
|
566 |
*/
|
sl@0
|
567 |
EXPORT_C void CMMFDevSound::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)
|
sl@0
|
568 |
{
|
sl@0
|
569 |
iBody->SetVolumeRamp(aRampDuration);
|
sl@0
|
570 |
}
|
sl@0
|
571 |
|
sl@0
|
572 |
/*
|
sl@0
|
573 |
* CMMFDevSound::SetPrioritySettings
|
sl@0
|
574 |
*
|
sl@0
|
575 |
* Defines the priority settings that should be used for this instance.
|
sl@0
|
576 |
*
|
sl@0
|
577 |
* @param aPrioritySettings. A structure representing client's priority, priority
|
sl@0
|
578 |
* preference and the state.
|
sl@0
|
579 |
*/
|
sl@0
|
580 |
EXPORT_C void CMMFDevSound::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings)
|
sl@0
|
581 |
{
|
sl@0
|
582 |
iBody->SetPrioritySettings(aPrioritySettings);
|
sl@0
|
583 |
}
|
sl@0
|
584 |
|
sl@0
|
585 |
/*
|
sl@0
|
586 |
* CMMFDevSound::CustomInterface
|
sl@0
|
587 |
*
|
sl@0
|
588 |
* Sends request to the DevSound Server to start custom interface specified
|
sl@0
|
589 |
* by the TUid attribute.
|
sl@0
|
590 |
*
|
sl@0
|
591 |
* @param aInterface. Unique ID of the custom interface
|
sl@0
|
592 |
*
|
sl@0
|
593 |
* @return TAny*
|
sl@0
|
594 |
* Pointer to the custom interface object.
|
sl@0
|
595 |
*/
|
sl@0
|
596 |
EXPORT_C TAny* CMMFDevSound::CustomInterface(TUid aInterface)
|
sl@0
|
597 |
{
|
sl@0
|
598 |
return iBody->CustomInterface(aInterface);
|
sl@0
|
599 |
}
|
sl@0
|
600 |
|
sl@0
|
601 |
/*
|
sl@0
|
602 |
* CMMFDevSound::FixedSequenceCount
|
sl@0
|
603 |
*
|
sl@0
|
604 |
* Returns the number of available pre-defined tone sequences.
|
sl@0
|
605 |
*
|
sl@0
|
606 |
* Method is deprecated from OS release 9.5
|
sl@0
|
607 |
*
|
sl@0
|
608 |
* This is the number of fixed sequence supported by the DevSound by default.
|
sl@0
|
609 |
*
|
sl@0
|
610 |
* @return TInt
|
sl@0
|
611 |
* The fixed sequence count. This value is implementation dependent
|
sl@0
|
612 |
* but is always greater than or equal to zero.
|
sl@0
|
613 |
*/
|
sl@0
|
614 |
EXPORT_C TInt CMMFDevSound::FixedSequenceCount()
|
sl@0
|
615 |
{
|
sl@0
|
616 |
return 0;
|
sl@0
|
617 |
}
|
sl@0
|
618 |
|
sl@0
|
619 |
/*
|
sl@0
|
620 |
* CMMFDevSound::FixedSequenceName
|
sl@0
|
621 |
*
|
sl@0
|
622 |
* Returns the name assigned to a specific pre-defined tone sequence.
|
sl@0
|
623 |
*
|
sl@0
|
624 |
* Method is deprecated from OS release 9.5
|
sl@0
|
625 |
*
|
sl@0
|
626 |
* @param aSequenceNumber. The index identifying the specific pre-defined tone sequence.
|
sl@0
|
627 |
* Index values are relative to zero. This can be any value between
|
sl@0
|
628 |
* zero and the value returned by the call to
|
sl@0
|
629 |
* CMdaAudioPlayerUtility::FixedSequenceCount() - 1. The function
|
sl@0
|
630 |
* raises a panic if sequence number is out of range.
|
sl@0
|
631 |
*
|
sl@0
|
632 |
* @return TDesC&
|
sl@0
|
633 |
* A reference to a descriptor containing fixed sequence name
|
sl@0
|
634 |
* indexed by aSequenceNumber.
|
sl@0
|
635 |
*/
|
sl@0
|
636 |
EXPORT_C const TDesC& CMMFDevSound::FixedSequenceName(TInt /*aSequenceNumber*/)
|
sl@0
|
637 |
{
|
sl@0
|
638 |
return KNullDesC;
|
sl@0
|
639 |
}
|
sl@0
|
640 |
|
sl@0
|
641 |
/*
|
sl@0
|
642 |
* CMMFDevSound::GetSupportedInputDataTypesL
|
sl@0
|
643 |
*
|
sl@0
|
644 |
* Returns a list of supported input data types that can be sent to the
|
sl@0
|
645 |
* DevSound for playing audio.
|
sl@0
|
646 |
*
|
sl@0
|
647 |
* @param aSupportedDataTypes. An array of supported data types.
|
sl@0
|
648 |
* @param aPrioritySettings. Structure containing priority settings.
|
sl@0
|
649 |
*/
|
sl@0
|
650 |
EXPORT_C void CMMFDevSound::GetSupportedInputDataTypesL(RArray<TFourCC>& aSupportedDataTypes,const TMMFPrioritySettings& aPrioritySettings) const
|
sl@0
|
651 |
{
|
sl@0
|
652 |
iBody->GetSupportedInputDataTypesL(aSupportedDataTypes,
|
sl@0
|
653 |
aPrioritySettings);
|
sl@0
|
654 |
}
|
sl@0
|
655 |
|
sl@0
|
656 |
/*
|
sl@0
|
657 |
* CMMFDevSound::GetSupportedOutputDataTypesL
|
sl@0
|
658 |
*
|
sl@0
|
659 |
* Returns a list of supported output data types that can be received from
|
sl@0
|
660 |
* the DevSound for recording audio.
|
sl@0
|
661 |
*
|
sl@0
|
662 |
* @param aSupportedDataTypes. An array of supported data types.
|
sl@0
|
663 |
* @param aPrioritySettings. Structure containing priority settings.
|
sl@0
|
664 |
*/
|
sl@0
|
665 |
EXPORT_C void CMMFDevSound::GetSupportedOutputDataTypesL(RArray<TFourCC>& aSupportedDataTypes,const TMMFPrioritySettings& aPrioritySettings) const
|
sl@0
|
666 |
{
|
sl@0
|
667 |
iBody->GetSupportedOutputDataTypesL(aSupportedDataTypes,aPrioritySettings);
|
sl@0
|
668 |
}
|
sl@0
|
669 |
|
sl@0
|
670 |
/********************************************************************************
|
sl@0
|
671 |
* Non Exported public functions ends here *
|
sl@0
|
672 |
********************************************************************************/
|
sl@0
|
673 |
|
sl@0
|
674 |
/******************************************************************************
|
sl@0
|
675 |
* Function Name: E32Dll
|
sl@0
|
676 |
*
|
sl@0
|
677 |
* Description: Entry point for applications.
|
sl@0
|
678 |
*
|
sl@0
|
679 |
******************************************************************************/
|
sl@0
|
680 |
|
sl@0
|
681 |
enum TDllReason {};
|
sl@0
|
682 |
EXPORT_C TInt E32Dll(TDllReason /*aReason*/)
|
sl@0
|
683 |
{
|
sl@0
|
684 |
return KErrNone;
|
sl@0
|
685 |
}
|
sl@0
|
686 |
|
sl@0
|
687 |
// CMMFDevSoundEventHandler::NewL() has been declared in export table
|
sl@0
|
688 |
// but since it is the only class method to be so, and .h is in source
|
sl@0
|
689 |
// it is not actually usable. Just declare the following to keep linker happy
|
sl@0
|
690 |
|
sl@0
|
691 |
// Need dummy abstract type - this is not the real class
|
sl@0
|
692 |
class RMMFAudioPolicyProxy;
|
sl@0
|
693 |
|
sl@0
|
694 |
class CMMFDevSoundEventHandler : public CActive
|
sl@0
|
695 |
{
|
sl@0
|
696 |
public:
|
sl@0
|
697 |
IMPORT_C static CMMFDevSoundEventHandler* NewL(RMMFAudioPolicyProxy*);
|
sl@0
|
698 |
private:
|
sl@0
|
699 |
CMMFDevSoundEventHandler();
|
sl@0
|
700 |
};
|
sl@0
|
701 |
|
sl@0
|
702 |
EXPORT_C CMMFDevSoundEventHandler* CMMFDevSoundEventHandler::NewL(RMMFAudioPolicyProxy*)
|
sl@0
|
703 |
{
|
sl@0
|
704 |
_LIT(KModule, "DevSound");
|
sl@0
|
705 |
User::Panic(KModule, 1000);
|
sl@0
|
706 |
return NULL;
|
sl@0
|
707 |
}
|
sl@0
|
708 |
|
sl@0
|
709 |
// default constructor - keep compilers happy
|
sl@0
|
710 |
CMMFDevSoundEventHandler::CMMFDevSoundEventHandler():
|
sl@0
|
711 |
CActive(EPriorityStandard)
|
sl@0
|
712 |
{
|
sl@0
|
713 |
}
|
sl@0
|
714 |
|
sl@0
|
715 |
|
sl@0
|
716 |
// End of File
|