author | hgs |
Fri, 09 Jul 2010 15:40:55 +0300 | |
changeset 50 | 377c906a8701 |
parent 46 | bc5a64e5bc3c |
child 51 | f39ed5e045e0 |
permissions | -rw-r--r-- |
37 | 1 |
/* |
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
2 |
* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies). |
37 | 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: This module contains the implementation of CPEAudioInbandTonePlayer class |
|
15 |
* member functions |
|
16 |
* |
|
17 |
*/ |
|
18 |
||
19 |
||
20 |
// INCLUDE FILES |
|
21 |
#include "cpeaudiodata.h" // CPEAudioData header |
|
22 |
#include "cpeaudioinbandtoneplayer.h" |
|
23 |
#include "cpeaudiofactory.h" |
|
24 |
#include "cpeaudiotoneutility.h" |
|
25 |
#include <AudioPreference.h> |
|
26 |
#include <barsc.h> |
|
27 |
#include <barsread.h> |
|
28 |
#include <data_caging_path_literals.hrh> |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
29 |
#include <defaultbeep.rsg> |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
30 |
#include <featdiscovery.h> |
37 | 31 |
#include <pepanic.pan> |
32 |
#include <talogger.h> |
|
33 |
||
34 |
||
35 |
// EXTERNAL DATA STRUCTURES |
|
36 |
// None |
|
37 |
||
38 |
// EXTERNAL FUNCTION PROTOTYPES |
|
39 |
// None |
|
40 |
||
41 |
// CONSTANTS |
|
42 |
const TInt KPhoneInbandVolumeMax = 10; |
|
43 |
const TInt KPhoneInbandVolumeMin = 0; |
|
44 |
const TInt KPhoneInbandToneZero = 0; |
|
45 |
const TInt KPhoneInbandToneNoRepeat = 0; |
|
46 |
const TInt KPhoneInbandToneRepeatOnce = 1; |
|
47 |
||
48 |
// Resourcefile destination. |
|
49 |
_LIT( KSystemDefaultbeepRscDrive, "Z:" ); |
|
50 |
_LIT( KSystemDefaultbeepRscFile, "DEFAULTBEEP.rSC" ); |
|
51 |
||
52 |
// MACROS |
|
53 |
// None |
|
54 |
||
55 |
// LOCAL CONSTANTS AND MACROS |
|
56 |
// None |
|
57 |
||
58 |
// MODULE DATA STRUCTURES |
|
59 |
// None |
|
60 |
||
61 |
// LOCAL FUNCTION PROTOTYPES |
|
62 |
// None |
|
63 |
||
64 |
||
65 |
// ==================== LOCAL FUNCTIONS ==================== |
|
66 |
// None. |
|
67 |
||
68 |
// ================= MEMBER FUNCTIONS ======================= |
|
69 |
||
70 |
// ----------------------------------------------------------------------------- |
|
71 |
// CPEAudioInbandTonePlayer::NewL |
|
72 |
// Two-phased constructor. |
|
73 |
// ----------------------------------------------------------------------------- |
|
74 |
// |
|
75 |
CPEAudioInbandTonePlayer* CPEAudioInbandTonePlayer::NewL |
|
76 |
( |
|
77 |
CPEAudioData& aOwner, // ref. to class owner |
|
78 |
RFs& aFsSession, |
|
79 |
CPEAudioFactory& aAudioFactory |
|
80 |
) |
|
81 |
{ |
|
82 |
CPEAudioInbandTonePlayer* self = |
|
83 |
new ( ELeave ) CPEAudioInbandTonePlayer( aOwner, aFsSession ); |
|
84 |
||
85 |
CleanupStack::PushL( self ); |
|
86 |
self->ConstructL( aAudioFactory ); |
|
87 |
CleanupStack::Pop( self ); |
|
88 |
||
89 |
return self; |
|
90 |
} |
|
91 |
||
92 |
//Destructor |
|
93 |
CPEAudioInbandTonePlayer::~CPEAudioInbandTonePlayer() |
|
94 |
{ |
|
95 |
delete iPlayBeepSequence; |
|
96 |
delete iPlayNoSoundSequence; |
|
97 |
delete iPlayDataSequence; |
|
98 |
delete iResourceCallWaitingSeq; |
|
99 |
delete iResourceRingGoingSeq; |
|
100 |
delete iResourceRadioPathSeq; |
|
101 |
delete iResourceSpecialSeq; |
|
102 |
delete iResourceCongestionSeq; |
|
103 |
delete iResourceReorderSeq; |
|
104 |
delete iResourceBusySeq; |
|
105 |
delete iCurrent; |
|
106 |
} |
|
107 |
||
108 |
// ----------------------------------------------------------------------------- |
|
109 |
// CPEAudioInbandTonePlayer::CPEAudioInbandTonePlayer |
|
110 |
// C++ default constructor can NOT contain any code, that |
|
111 |
// might leave. |
|
112 |
// ----------------------------------------------------------------------------- |
|
113 |
// |
|
114 |
CPEAudioInbandTonePlayer::CPEAudioInbandTonePlayer |
|
115 |
( |
|
116 |
CPEAudioData& aOwner, // ref. to class owner |
|
117 |
RFs& aFsSession |
|
118 |
):iOwner( aOwner ), |
|
119 |
iFsSession( aFsSession ) |
|
120 |
{ |
|
121 |
} |
|
122 |
||
123 |
// ----------------------------------------------------------------------------- |
|
124 |
// CPEAudioInbandTonePlayer::ConstructL |
|
125 |
// Symbian 2nd phase constructor can leave. |
|
126 |
// ----------------------------------------------------------------------------- |
|
127 |
// |
|
128 |
void CPEAudioInbandTonePlayer::ConstructL( |
|
129 |
CPEAudioFactory& aFactory ) |
|
130 |
{ |
|
131 |
TEFLOGSTRING( KTAOBJECT, "AUD CPEAudioInbandTonePlayer::ConstructL()" ); |
|
132 |
iCurrent = aFactory.CreateAudioToneUtilityL( *this ); |
|
133 |
||
134 |
||
135 |
//Get the inband tone sequences from resource and and store to member variables |
|
136 |
RResourceFile resourceFile; |
|
137 |
||
138 |
TFileName fileName( KSystemDefaultbeepRscDrive ); |
|
139 |
fileName.Append( KDC_RESOURCE_FILES_DIR ); |
|
140 |
fileName.Append( KSystemDefaultbeepRscFile ); |
|
141 |
||
142 |
resourceFile.OpenL( iFsSession, fileName ); |
|
143 |
CleanupClosePushL( resourceFile ); |
|
144 |
||
145 |
HBufC8* resourceBusy = resourceFile.AllocReadL( R_NET_BUSY ); |
|
146 |
HBufC8* resourceReorder = resourceFile.AllocReadL( R_NET_REORDER ); |
|
147 |
HBufC8* resourceCongestion = resourceFile.AllocReadL( R_NET_CONGESTION ); |
|
148 |
HBufC8* resourceSpecial = resourceFile.AllocReadL( R_NET_SPECIAL_INFORMATION ); |
|
149 |
HBufC8* resourceRadioPath = resourceFile.AllocReadL( R_NET_RADIO_NOT_AVAILABLE ); |
|
150 |
HBufC8* resourceRingGoing = resourceFile.AllocReadL( R_NET_RING_GOING ); |
|
46
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
151 |
|
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
152 |
|
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
153 |
HBufC8* resourceCallWaiting; |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
154 |
|
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
155 |
if ( CFeatureDiscovery::IsFeatureSupportedL( KFeatureIdFfAlternativeCallWaitingTone ) ) |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
156 |
{ |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
157 |
resourceCallWaiting = resourceFile.AllocReadL( R_NET_CALL_WAITING_ALTERNATIVE_TONE ); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
158 |
} |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
159 |
else |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
160 |
{ |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
161 |
resourceCallWaiting = resourceFile.AllocReadL( R_NET_CALL_WAITING ); |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
162 |
} |
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
163 |
|
bc5a64e5bc3c
Revision: 201025
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
37
diff
changeset
|
164 |
|
37 | 165 |
HBufC8* dataCallTone = resourceFile.AllocReadL( R_DATA_CALL_TONE ); |
166 |
HBufC8* noSoundSequence = resourceFile.AllocReadL( R_NO_SOUND_SEQUENCE ); |
|
167 |
HBufC8* beepSequence = resourceFile.AllocReadL( R_BEEP_SEQUENCE ); |
|
168 |
||
169 |
CleanupStack::PopAndDestroy( &resourceFile ); |
|
170 |
||
171 |
TResourceReader reader; |
|
172 |
TInt i(0); |
|
173 |
TInt length(0); |
|
174 |
||
175 |
//SubscriberBusy |
|
176 |
reader.SetBuffer( resourceBusy ); |
|
177 |
length = reader.ReadInt16(); |
|
178 |
iResourceBusySeq = HBufC8::NewL( length ); |
|
179 |
//Tptr modifies member variables (HBufC8) length so it includes the memory edited by Append() |
|
180 |
TPtr8 appendBusy(iResourceBusySeq->Des()); |
|
181 |
||
182 |
for( i = 0 ; i < length ; i++ ) |
|
183 |
{ |
|
184 |
appendBusy.Append(reader.ReadUint16()); |
|
185 |
} |
|
186 |
||
187 |
//Reorder |
|
188 |
reader.SetBuffer( resourceReorder ); |
|
189 |
length = reader.ReadInt16(); |
|
190 |
iResourceReorderSeq = HBufC8::NewL( length ); |
|
191 |
//Tptr modifies member variables (HBufC8) length so it includes the memory edited by Append() |
|
192 |
TPtr8 appendReorder(iResourceReorderSeq->Des()); |
|
193 |
||
194 |
for( i = 0 ; i < length ; i++ ) |
|
195 |
{ |
|
196 |
appendReorder.Append(reader.ReadUint16()); |
|
197 |
} |
|
198 |
||
199 |
//Congestion |
|
200 |
reader.SetBuffer( resourceCongestion ); |
|
201 |
length = reader.ReadInt16(); |
|
202 |
iResourceCongestionSeq = HBufC8::NewL( length ); |
|
203 |
//Tptr modifies member variables (HBufC8) length so it includes the memory edited by Append() |
|
204 |
TPtr8 appendCongestion(iResourceCongestionSeq->Des()); |
|
205 |
||
206 |
for( i = 0 ; i < length ; i++ ) |
|
207 |
{ |
|
208 |
appendCongestion.Append(reader.ReadUint16()); |
|
209 |
} |
|
210 |
||
211 |
//Special Information |
|
212 |
reader.SetBuffer( resourceSpecial ); |
|
213 |
length = reader.ReadInt16(); |
|
214 |
iResourceSpecialSeq = HBufC8::NewL( length ); |
|
215 |
//Tptr modifies member variables (HBufC8) length so it includes the memory edited by Append() |
|
216 |
TPtr8 appendSpecial(iResourceSpecialSeq->Des()); |
|
217 |
||
218 |
for( i = 0 ; i < length ; i++ ) |
|
219 |
{ |
|
220 |
appendSpecial.Append(reader.ReadUint16()); |
|
221 |
} |
|
222 |
||
223 |
//RadioPathNotAvailable |
|
224 |
reader.SetBuffer( resourceRadioPath ); |
|
225 |
length = reader.ReadInt16(); |
|
226 |
iResourceRadioPathSeq = HBufC8::NewL( length ); |
|
227 |
//Tptr modifies member variables (HBufC8) length so it includes the memory edited by Append() |
|
228 |
TPtr8 appendRadio(iResourceRadioPathSeq->Des()); |
|
229 |
||
230 |
for( i = 0 ; i < length ; i++ ) |
|
231 |
{ |
|
232 |
appendRadio.Append(reader.ReadUint16()); |
|
233 |
} |
|
234 |
||
235 |
//RemoteAlertingTone |
|
236 |
reader.SetBuffer( resourceRingGoing ); |
|
237 |
length = reader.ReadInt16(); |
|
238 |
iResourceRingGoingSeq = HBufC8::NewL( length ); |
|
239 |
//Tptr modifies member variables (HBufC8) length so it includes the memory edited by Append() |
|
240 |
TPtr8 appendRingGoing(iResourceRingGoingSeq->Des()); |
|
241 |
||
242 |
for( i = 0 ; i < length ; i++ ) |
|
243 |
{ |
|
244 |
appendRingGoing.Append(reader.ReadUint16()); |
|
245 |
} |
|
246 |
//CallWaitingTone |
|
247 |
reader.SetBuffer( resourceCallWaiting ); |
|
248 |
length = reader.ReadInt16(); |
|
249 |
iResourceCallWaitingSeq = HBufC8::NewL( length ); |
|
250 |
//Tptr modifies member variables (HBufC8) length so it includes the memory edited by Append() |
|
251 |
TPtr8 appendCallWaiting(iResourceCallWaitingSeq->Des()); |
|
252 |
||
253 |
for( i = 0 ; i < length ; i++ ) |
|
254 |
{ |
|
255 |
appendCallWaiting.Append(reader.ReadUint16()); |
|
256 |
} |
|
257 |
||
258 |
//DataCalTone |
|
259 |
reader.SetBuffer( dataCallTone ); |
|
260 |
length = reader.ReadInt16(); |
|
261 |
iPlayDataSequence = HBufC8::NewL( length ); |
|
262 |
//Tptr modifies member variables (HBufC8) length so it includes the memory edited by Append() |
|
263 |
TPtr8 appendDataCallTone( iPlayDataSequence->Des() ); |
|
264 |
||
265 |
for( i = 0 ; i < length ; i++ ) |
|
266 |
{ |
|
267 |
appendDataCallTone.Append(reader.ReadUint16()); |
|
268 |
} |
|
269 |
||
270 |
//NoSoundSequence |
|
271 |
reader.SetBuffer( noSoundSequence ); |
|
272 |
length = reader.ReadInt16(); |
|
273 |
iPlayNoSoundSequence = HBufC8::NewL( length ); |
|
274 |
//Tptr modifies member variables (HBufC8) length so it includes the memory edited by Append() |
|
275 |
TPtr8 appendNoSoundSequence( iPlayNoSoundSequence->Des() ); |
|
276 |
||
277 |
for( i = 0 ; i < length ; i++ ) |
|
278 |
{ |
|
279 |
appendNoSoundSequence.Append(reader.ReadUint16()); |
|
280 |
} |
|
281 |
||
282 |
//BeepSequence |
|
283 |
reader.SetBuffer( beepSequence ); |
|
284 |
length = reader.ReadInt16(); |
|
285 |
iPlayBeepSequence = HBufC8::NewL( length ); |
|
286 |
//Tptr modifies member variables (HBufC8) length so it includes the memory edited by Append() |
|
287 |
TPtr8 appendBeepSequence( iPlayBeepSequence->Des() ); |
|
288 |
||
289 |
for( i = 0 ; i < length ; i++ ) |
|
290 |
{ |
|
291 |
appendBeepSequence.Append(reader.ReadUint16()); |
|
292 |
} |
|
293 |
||
294 |
delete dataCallTone; |
|
295 |
delete noSoundSequence; |
|
296 |
delete beepSequence; |
|
297 |
delete resourceBusy; |
|
298 |
delete resourceReorder; |
|
299 |
delete resourceCongestion; |
|
300 |
delete resourceSpecial; |
|
301 |
delete resourceRadioPath; |
|
302 |
delete resourceRingGoing; |
|
303 |
delete resourceCallWaiting; |
|
304 |
||
305 |
} |
|
306 |
||
307 |
// ----------------------------------------------------------------------------- |
|
308 |
// CPEAudioInbandTonePlayer::PlayInbandTone |
|
309 |
// Searches the given Inband tone from iToneArray and calls PlayCurrentTone -member function. |
|
310 |
// ----------------------------------------------------------------------------- |
|
311 |
// |
|
312 |
void CPEAudioInbandTonePlayer::PlayInbandTone( |
|
313 |
TCCPTone aTone ) |
|
314 |
{ |
|
315 |
//Stop playing if there is something playing |
|
316 |
Cancel(); |
|
317 |
||
318 |
UpdateTonePlayerVolume(); |
|
319 |
||
320 |
iToneName = aTone; |
|
321 |
||
322 |
TPtr8 resourceBusySeq = iResourceBusySeq -> Des(); |
|
323 |
TPtr8 resourceRadioPathSeq = iResourceRadioPathSeq -> Des(); |
|
324 |
TPtr8 resourceCongestionSeq = iResourceCongestionSeq -> Des(); |
|
325 |
TPtr8 resourceSpecialSeq = iResourceSpecialSeq -> Des(); |
|
326 |
TPtr8 resourceReorderSeq = iResourceReorderSeq->Des(); |
|
327 |
TPtr8 resourceRingGoingSeq = iResourceRingGoingSeq -> Des(); |
|
328 |
TPtr8 resourceCallWaitingSeq = iResourceCallWaitingSeq -> Des(); |
|
329 |
||
330 |
TEFLOGSTRING( KTAREQOUT, |
|
331 |
"AUD CPEAudioInbandTonePlayer::PlayInbandTone: CMdaAudioToneUtility->PrepareToPlayDesSequence()" ); |
|
332 |
switch( aTone ) |
|
333 |
{ |
|
334 |
case ECCPToneUserBusy: |
|
335 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioInbandTonePlayer::PlayInbandTone: iResourceBusySeq" ); |
|
336 |
iCurrent->PrepareToPlayDesSequence( resourceBusySeq ); |
|
337 |
break; |
|
338 |
case ECCPToneRadioPathNotAvailable: |
|
339 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioInbandTonePlayer::PlayInbandTone: iResourceRadioPathSeq" ); |
|
340 |
iCurrent->PrepareToPlayDesSequence( resourceRadioPathSeq ); |
|
341 |
break; |
|
342 |
case ECCPToneCongestion: |
|
343 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioInbandTonePlayer::PlayInbandTone: iResourceCongestionSeq" ); |
|
344 |
iCurrent->PrepareToPlayDesSequence( resourceCongestionSeq ); |
|
345 |
break; |
|
346 |
case ECCPToneSpecialInformation: |
|
347 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioInbandTonePlayer::PlayInbandTone: iResourceSpecialSeq" ); |
|
348 |
iCurrent->PrepareToPlayDesSequence( resourceSpecialSeq ); |
|
349 |
break; |
|
350 |
case ECCPReorder: |
|
351 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioInbandTonePlayer::PlayInbandTone: iResourceReorderSeq" ); |
|
352 |
iCurrent->PrepareToPlayDesSequence( resourceReorderSeq ); |
|
353 |
break; |
|
354 |
case ECCPRemoteAlerting: |
|
355 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioInbandTonePlayer::PlayInbandTone: iResourceRingGoingSeq" ); |
|
356 |
iCurrent->PrepareToPlayDesSequence( resourceRingGoingSeq ); |
|
357 |
break; |
|
358 |
case ECCPCallWaiting: |
|
359 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioInbandTonePlayer::PlayInbandTone: iResourceCallWaitingSeq" ); |
|
360 |
iCurrent->PrepareToPlayDesSequence( resourceCallWaitingSeq ); |
|
361 |
break; |
|
362 |
case ECCPNoSoundSequence: |
|
363 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioInbandTonePlayer::PlayInbandTone: called ECCPNoSoundSequence " ); |
|
364 |
break; |
|
365 |
default: |
|
366 |
TEFLOGSTRING2( KTAINT, "AUD CPEAudioInbandTonePlayer::PlayInbandTone: No InbandTone defined to play with: %d", aTone ); |
|
367 |
__ASSERT_DEBUG( EFalse, Panic( EPEPanicNotCompleted ) ); |
|
368 |
break; |
|
369 |
} |
|
370 |
} |
|
371 |
||
372 |
// ----------------------------------------------------------------------------- |
|
373 |
// CPEAudioInbandTonePlayer::Cancel |
|
374 |
// Cancels the currently playing tone. |
|
375 |
// (other items were commented in a header). |
|
376 |
// ----------------------------------------------------------------------------- |
|
377 |
// |
|
378 |
void CPEAudioInbandTonePlayer::Cancel() |
|
379 |
{ |
|
380 |
TEFLOGSTRING( KTAINT, "AUD CPEAudioInbandTonePlayer::Cancel()"); |
|
381 |
if ( iCurrent ) |
|
382 |
{ |
|
383 |
if ( iCurrent->State() == EMdaAudioToneUtilityNotReady ) |
|
384 |
{ |
|
385 |
// Prepare is called, but toneplayer's state is not yet prepare, |
|
386 |
// then cancel to prepare is needed. |
|
387 |
TEFLOGSTRING( KTAREQOUT, |
|
388 |
"AUD CPEAudioInbandTonePlayer::Cancel: CMdaAudioToneUtility->CancelPrepare"); |
|
389 |
iCurrent->CancelPrepare(); |
|
390 |
} |
|
391 |
else |
|
392 |
{ |
|
393 |
TEFLOGSTRING( KTAREQOUT, |
|
394 |
"AUD CPEAudioInbandTonePlayer::Cancel: CMdaAudioToneUtility->CancelPlay"); |
|
395 |
iCurrent->CancelPlay(); |
|
396 |
} |
|
397 |
} |
|
398 |
} |
|
399 |
||
400 |
// ----------------------------------------------------------------------------- |
|
401 |
// CPEAudioInbandTonePlayer::PlayCurrentTone |
|
402 |
// Cancels the currently playing tone. |
|
403 |
// (other items were commented in a header). |
|
404 |
// ----------------------------------------------------------------------------- |
|
405 |
// |
|
406 |
void CPEAudioInbandTonePlayer::PlayCurrentTone() |
|
407 |
{ |
|
408 |
if ( iCurrent ) |
|
409 |
{ |
|
410 |
if ( iCurrent->State() == EMdaAudioToneUtilityPrepared ) |
|
411 |
{ |
|
412 |
||
413 |
UpdateTonePlayerVolume(); |
|
414 |
||
415 |
TEFLOGSTRING( KTAREQOUT, |
|
416 |
"AUD CPEAudioInbandTonePlayer::PlayCurrentTone(): CMdaAudioToneUtility->SetPriority()"); |
|
417 |
||
418 |
switch( iToneName ) |
|
419 |
{ |
|
420 |
case ECCPToneUserBusy: |
|
421 |
iCurrent->SetRepeats( |
|
422 |
KMdaAudioToneRepeatForever, |
|
423 |
TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
424 |
iCurrent->SetPriority( |
|
425 |
KAudioPriorityNetMsg, |
|
426 |
static_cast < TMdaPriorityPreference > ( KAudioPrefBusy ) ); |
|
427 |
break; |
|
428 |
case ECCPToneRadioPathNotAvailable: |
|
429 |
iCurrent->SetRepeats( |
|
430 |
KPhoneInbandToneRepeatOnce, |
|
431 |
TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
432 |
iCurrent->SetPriority( |
|
433 |
KAudioPriorityNetMsg, |
|
434 |
static_cast < TMdaPriorityPreference > ( KAudioPrefRadioNotAvailable ) ); |
|
435 |
break; |
|
436 |
case ECCPToneCongestion: |
|
437 |
iCurrent->SetRepeats( |
|
438 |
KMdaAudioToneRepeatForever, |
|
439 |
TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
440 |
iCurrent->SetPriority( |
|
441 |
KAudioPriorityNetMsg, |
|
442 |
static_cast < TMdaPriorityPreference > ( KAudioPrefCongestion ) ); |
|
443 |
break; |
|
444 |
case ECCPToneSpecialInformation: |
|
445 |
iCurrent->SetRepeats( |
|
446 |
KMdaAudioToneRepeatForever, |
|
447 |
TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
448 |
iCurrent->SetPriority( |
|
449 |
KAudioPriorityNetMsg, |
|
450 |
static_cast < TMdaPriorityPreference > ( KAudioPrefSpecialInformation ) ); |
|
451 |
break; |
|
452 |
case ECCPReorder: |
|
453 |
iCurrent->SetRepeats( |
|
454 |
KMdaAudioToneRepeatForever, |
|
455 |
TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
456 |
iCurrent->SetPriority( |
|
457 |
KAudioPriorityNetMsg, |
|
458 |
static_cast < TMdaPriorityPreference > ( KAudioPrefReorder ) ); |
|
459 |
break; |
|
460 |
case ECCPRemoteAlerting: |
|
461 |
iCurrent->SetRepeats( |
|
462 |
KMdaAudioToneRepeatForever, |
|
463 |
TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
464 |
iCurrent->SetPriority( |
|
465 |
KAudioPriorityNetMsg, |
|
466 |
static_cast < TMdaPriorityPreference > ( KAudioPrefRingGoing ) ); |
|
467 |
break; |
|
468 |
case ECCPCallWaiting: |
|
469 |
iCurrent->SetRepeats( |
|
470 |
KPhoneInbandToneNoRepeat, |
|
471 |
TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
472 |
iCurrent->SetPriority( |
|
473 |
KAudioPriorityNetMsg, |
|
474 |
static_cast < TMdaPriorityPreference > ( KAudioPrefCallWaiting )); |
|
475 |
break; |
|
476 |
case ECCPDataCallTone: //EProfileRingingTypeRinging, EProfileRingingTypeAscending, EProfileRingingTypeRingingOnce |
|
477 |
iCurrent->SetRepeats( |
|
478 |
KMdaAudioToneRepeatForever, |
|
479 |
TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
480 |
iCurrent->SetPriority( |
|
481 |
KAudioPriorityPhoneCall, |
|
482 |
static_cast < TMdaPriorityPreference > ( KAudioPrefIncomingDataCall ) ); |
|
483 |
||
484 |
if ( iRingingType == EProfileRingingTypeAscending ) |
|
485 |
{ |
|
486 |
iCurrent->SetVolumeRamp( |
|
487 |
TTimeIntervalMicroSeconds( KPERingingToneRampDuration ) ); |
|
488 |
} |
|
489 |
else |
|
490 |
{ |
|
491 |
//EProfileRingingTypeRinging, EProfileRingingTypeRingingOnce |
|
492 |
iCurrent->SetVolumeRamp( |
|
493 |
TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
494 |
} |
|
495 |
if ( iRingingType == EProfileRingingTypeRingingOnce ) |
|
496 |
{ |
|
497 |
iCurrent->SetRepeats( |
|
498 |
KPhoneInbandToneNoRepeat, |
|
499 |
TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
500 |
} |
|
501 |
break; |
|
502 |
case ECCPNoSoundSequence: |
|
503 |
case ECCPBeepSequence: |
|
504 |
iCurrent->SetRepeats( |
|
505 |
KMdaAudioToneRepeatForever, |
|
506 |
TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
507 |
iCurrent->SetPriority( |
|
508 |
KAudioPriorityPhoneCall, |
|
509 |
static_cast < TMdaPriorityPreference > ( KAudioPrefIncomingCall ) ); |
|
510 |
iCurrent->SetRepeats( |
|
511 |
KPhoneInbandToneNoRepeat, |
|
512 |
TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
513 |
iCurrent->SetVolumeRamp( TTimeIntervalMicroSeconds( KPhoneInbandToneZero ) ); |
|
514 |
break; |
|
515 |
default: |
|
516 |
TEFLOGSTRING2( KTAREQOUT, |
|
517 |
"AUD CPEAudioInbandTonePlayer::PlayCurrentTone: No InbandTone defined to set priority with %d", |
|
518 |
iToneName); |
|
519 |
break; |
|
520 |
} |
|
521 |
||
522 |
#ifdef __WINS__ |
|
523 |
TEFLOGSTRING( KTAMESINT, |
|
524 |
"AUD CPEAudioInbandTonePlayer::PlayCurrentTone: Ignored call to CMdaAudioToneUtility->Play(), because can't play in WINS"); |
|
525 |
#else |
|
526 |
//Play the tone |
|
527 |
TEFLOGSTRING( KTAREQOUT, |
|
528 |
"AUD CPEAudioInbandTonePlayer::PlayCurrentTone: CMdaAudioToneUtility->Play() called"); |
|
529 |
iCurrent->Play(); |
|
530 |
#endif |
|
531 |
} // State() |
|
532 |
} //iCurrent |
|
533 |
} |
|
534 |
||
535 |
// ----------------------------------------------------------------------------- |
|
536 |
// CPEAudioInbandTonePlayer::MatoPrepareComplete |
|
537 |
// Updates flag values and plays current inbandtone. |
|
538 |
// (other items were commented in a header). |
|
539 |
// ----------------------------------------------------------------------------- |
|
540 |
// |
|
541 |
void CPEAudioInbandTonePlayer::MatoPrepareComplete( TInt aError ) |
|
542 |
{ |
|
543 |
||
544 |
if( aError == KErrNone ) |
|
545 |
{ |
|
546 |
PlayCurrentTone(); |
|
547 |
} |
|
548 |
else |
|
549 |
{ |
|
550 |
TEFLOGSTRING2( KTAREQIN, |
|
551 |
"AUD CPEAudioInbandTonePlayer::MatoPrepareComplete: aError = %d", |
|
552 |
aError ); |
|
553 |
} |
|
554 |
||
555 |
||
556 |
} |
|
557 |
||
558 |
||
559 |
// ----------------------------------------------------------------------------- |
|
560 |
// CPEAudioInbandTonePlayer::SetVolume |
|
561 |
// ----------------------------------------------------------------------------- |
|
562 |
// |
|
563 |
void CPEAudioInbandTonePlayer::SetVolume( TInt aVolume ) |
|
564 |
{ |
|
565 |
TInt safeVolume = |
|
566 |
Max( Min( aVolume, KPhoneInbandVolumeMax ), KPhoneInbandVolumeMin ); |
|
567 |
||
568 |
TEFLOGSTRING2( KTAREQIN, |
|
569 |
"AUD CPEAudioInbandTonePlayer::SetVolume: VOLUME = %d", safeVolume ); |
|
570 |
||
571 |
if ( iCurrent && EMdaAudioToneUtilityNotReady != iCurrent->State() ) |
|
572 |
{ |
|
573 |
TInt mediaServerVolume = CalculateMediaServerVolume( safeVolume ); |
|
574 |
TEFLOGSTRING2( KTAREQIN, |
|
575 |
"AUD CPEAudioInbandTonePlayer::SetVolume: MEDIA SERVER VOLUME = %d", |
|
576 |
mediaServerVolume ); |
|
577 |
iCurrent->SetVolume( mediaServerVolume ); |
|
578 |
} |
|
579 |
} |
|
580 |
||
581 |
||
582 |
// ----------------------------------------------------------------------------- |
|
583 |
// CPEAudioInbandTonePlayer::MatoPlayComplete |
|
584 |
// - |
|
585 |
// (other items were commented in a header). |
|
586 |
// ----------------------------------------------------------------------------- |
|
587 |
// |
|
588 |
void CPEAudioInbandTonePlayer::MatoPlayComplete( TInt aError ) |
|
589 |
{ |
|
590 |
||
591 |
if( aError != KErrNone ) |
|
592 |
{ |
|
593 |
TEFLOGSTRING2( KTAREQIN, |
|
594 |
"CPEAudioInbandTonePlayer::MatoPlayComplete: aError = %d", |
|
595 |
aError ); |
|
596 |
} |
|
597 |
||
598 |
} |
|
599 |
||
600 |
// ----------------------------------------------------------------------------- |
|
601 |
// CPEAudioInbandTonePlayer::CalculateMediaServerVolume |
|
602 |
// ----------------------------------------------------------------------------- |
|
603 |
// |
|
604 |
TInt CPEAudioInbandTonePlayer::CalculateMediaServerVolume( TInt aVolume ) const |
|
605 |
{ |
|
606 |
// Our volume level scale is 0...10, media server's can be anything. |
|
607 |
// This scales the volume to correct level. |
|
608 |
return ( iCurrent->MaxVolume() * aVolume ) / |
|
609 |
( KPhoneInbandVolumeMax - KPhoneInbandVolumeMin ); |
|
610 |
} |
|
611 |
||
612 |
||
613 |
// ----------------------------------------------------------------------------- |
|
614 |
// CPEAudioInbandTonePlayer::UpdateTonePlayerVolume |
|
615 |
// ----------------------------------------------------------------------------- |
|
616 |
// |
|
617 |
void CPEAudioInbandTonePlayer::UpdateTonePlayerVolume() |
|
618 |
{ |
|
619 |
TInt volume( KPhoneInbandVolumeMin ); |
|
620 |
iOwner.GetAudioVolumeSync( volume ); |
|
621 |
SetVolume( volume ); |
|
622 |
} |
|
623 |
||
624 |
// End of File |