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