|
1 /* |
|
2 * Copyright (c) 2005 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: Plug-In that implements C3DRingingToneInterface. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CRingingTone3DPlugin.h" |
|
21 #include "tdaudioconstants.h" |
|
22 #include "RingingTone3DPluginDebug.h" |
|
23 |
|
24 #include <EnvironmentalReverbUtility.h> // CEnvironmentalReverbUtility |
|
25 #include <SourceDopplerBase.h> // CSourceDoppler |
|
26 #include <SourceLocationBase.h> // CSourceLocation |
|
27 #include <ListenerLocationBase.h> // CListenerLocation |
|
28 |
|
29 #ifndef SPP_NSS_3D_RINGING_TONE_STW_DISABLED |
|
30 #include <StereoWideningBase.h> // CStereoWidening |
|
31 #endif |
|
32 |
|
33 |
|
34 #include <MProfileEngine.h> |
|
35 #include <MProfile.h> |
|
36 #include <MProfileTones.h> |
|
37 #include <MProfileExtraSettings.h> |
|
38 #include <MProfile3DToneSettings.h> |
|
39 #include <MProfileName.h> |
|
40 #include <ProfileInternal.hrh> // for TProfile3DToneEffect and TProfile3DToneEcho |
|
41 |
|
42 |
|
43 // CONSTANTS |
|
44 const TUint32 KDopplerFactor = 100; |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 // ============================ MEMBER FUNCTIONS =============================== |
|
50 |
|
51 // ----------------------------------------------------------------------------- |
|
52 // CRingingTone3DPlugin::NewL |
|
53 // Two-phased constructor. |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 CRingingTone3DPlugin* CRingingTone3DPlugin::NewL( TAny* aParameter ) |
|
57 { |
|
58 // aParameter comes from REComSession::CreateImplementationL |
|
59 // (TAny *aConstructionParameters) |
|
60 |
|
61 CRingingTone3DPlugin* self = new ( ELeave ) CRingingTone3DPlugin(); |
|
62 CleanupStack::PushL( self ); |
|
63 self->ConstructL( aParameter ); |
|
64 CleanupStack::Pop(); |
|
65 |
|
66 return self; |
|
67 } |
|
68 |
|
69 // Destructor |
|
70 CRingingTone3DPlugin::~CRingingTone3DPlugin() |
|
71 { |
|
72 |
|
73 // Stop() may leave because of CDrmPlayerUtility error |
|
74 // (CMMFDrmAudioPlayerUtility::IsValidCustomCommandDestination |
|
75 // uses CleanupClosePushL). |
|
76 TRAP_IGNORE( Stop() ); |
|
77 |
|
78 delete iTimer; |
|
79 delete iParser; |
|
80 } |
|
81 |
|
82 |
|
83 // ----------------------------------------------------------------------------- |
|
84 // CRingingTone3DPlugin::Stop |
|
85 // Stop the playback. |
|
86 // ----------------------------------------------------------------------------- |
|
87 // |
|
88 void CRingingTone3DPlugin::Stop() |
|
89 { |
|
90 FLOG( _L("CRingingTone3DPlugin::Stop START") ); |
|
91 |
|
92 // Stop the playback and timer. |
|
93 if ( iTimer ) |
|
94 { |
|
95 iTimer->Cancel(); |
|
96 } |
|
97 |
|
98 StopRingingTone(); |
|
99 |
|
100 delete iReverbEffect; |
|
101 iReverbEffect = NULL; |
|
102 |
|
103 delete iDopplerEffect; |
|
104 iDopplerEffect = NULL; |
|
105 |
|
106 delete iListener; |
|
107 iListener = NULL; |
|
108 |
|
109 delete iSource; |
|
110 iSource = NULL; |
|
111 |
|
112 #ifdef __STEREO_WIDENING_EFFECT_UI |
|
113 delete iStereoWidening; |
|
114 iStereoWidening = NULL; |
|
115 #endif |
|
116 |
|
117 FLOG( _L("CRingingTone3DPlugin::Stop END") ); |
|
118 } |
|
119 |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CRingingTone3DPlugin::CRingingTone3DPlugin |
|
123 // C++ default constructor can NOT contain any code, that |
|
124 // might leave. |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 CRingingTone3DPlugin::CRingingTone3DPlugin() |
|
128 { |
|
129 iPlaying = EFalse; |
|
130 iPlayerType = KErrNotFound; |
|
131 iProfileId = KErrNotFound; |
|
132 |
|
133 iProfile3DToneEffect = KErrNotFound; |
|
134 iProfile3DToneEcho = KErrNotFound; |
|
135 iRingingTone = KNullDesC; |
|
136 } |
|
137 |
|
138 |
|
139 // ----------------------------------------------------------------------------- |
|
140 // CRingingTone3DPlugin::ConstructL |
|
141 // Symbian 2nd phase constructor can leave. |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 void CRingingTone3DPlugin::ConstructL( TAny* aParameter ) |
|
145 { |
|
146 FLOG( _L("CRingingTone3DPlugin::ConstructL START") ); |
|
147 |
|
148 iTimer = C3DAudioTimeOutTimer::NewL( EPriorityHigh, this ); |
|
149 iParser = C3DAudioXMLParser::NewL(); |
|
150 |
|
151 FLOG( _L("CRingingTone3DPlugin::ConstructL END") ); |
|
152 } |
|
153 |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // CRingingTone3DPlugin::Init |
|
157 // |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 void CRingingTone3DPlugin::Init( CMdaAudioPlayerUtility* aSamplePlayer ) |
|
161 { |
|
162 FLOG( _L("CRingingTone3DPlugin::InitL START") ); |
|
163 |
|
164 __ASSERT_ALWAYS( aSamplePlayer, Panic(KErrArgument) ); |
|
165 |
|
166 iAudioPlayerUtility = aSamplePlayer; |
|
167 iPlayerType = EMdaAudioPlayerUtility; |
|
168 |
|
169 #ifdef _DEBUG |
|
170 FlogPlayer( iPlayerType ); |
|
171 #endif |
|
172 |
|
173 FLOG( _L("CRingingTone3DPlugin::InitL END") ); |
|
174 } |
|
175 |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // CRingingTone3DPlugin::Init |
|
179 // |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 void CRingingTone3DPlugin::Init( CMdaAudioToneUtility* aSamplePlayer ) |
|
183 { |
|
184 FLOG( _L("CRingingTone3DPlugin::InitL START") ); |
|
185 |
|
186 __ASSERT_ALWAYS( aSamplePlayer, Panic(KErrArgument) ); |
|
187 |
|
188 iAudioToneUtility = aSamplePlayer; |
|
189 iPlayerType = EMdaAudioToneUtility; |
|
190 |
|
191 #ifdef _DEBUG |
|
192 FlogPlayer( iPlayerType ); |
|
193 #endif |
|
194 |
|
195 FLOG( _L("CRingingTone3DPlugin::InitL END") ); |
|
196 } |
|
197 |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CRingingTone3DPlugin::Init |
|
201 // |
|
202 // ----------------------------------------------------------------------------- |
|
203 // |
|
204 void CRingingTone3DPlugin::Init( CDrmPlayerUtility* aSamplePlayer ) |
|
205 { |
|
206 //FLOG( _L("CRingingTone3DPlugin::InitL START") ); |
|
207 |
|
208 __ASSERT_ALWAYS( aSamplePlayer, Panic(KErrArgument) ); |
|
209 |
|
210 iDrmPlayerUtility = aSamplePlayer; |
|
211 iPlayerType = EDrmPlayerUtility; |
|
212 |
|
213 #ifdef _DEBUG |
|
214 FlogPlayer( iPlayerType ); |
|
215 #endif |
|
216 |
|
217 //FLOG( _L("CRingingTone3DPlugin::InitL END") ); |
|
218 } |
|
219 |
|
220 |
|
221 // ----------------------------------------------------------------------------- |
|
222 // CRingingTone3DPlugin::Init |
|
223 // |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 void CRingingTone3DPlugin::Init( CVideoPlayerUtility* aSamplePlayer ) |
|
227 { |
|
228 FLOG( _L("CRingingTone3DPlugin::InitL START") ); |
|
229 |
|
230 __ASSERT_ALWAYS( aSamplePlayer, Panic(KErrArgument) ); |
|
231 |
|
232 iVideoPlayerUtility = aSamplePlayer; |
|
233 iPlayerType = EVideoPlayerUtility; |
|
234 |
|
235 #ifdef _DEBUG |
|
236 FlogPlayer( iPlayerType ); |
|
237 #endif |
|
238 |
|
239 FLOG( _L("CRingingTone3DPlugin::InitL END") ); |
|
240 } |
|
241 |
|
242 |
|
243 // ----------------------------------------------------------------------------- |
|
244 // CRingingTone3DPlugin::SetAttr (from C3DRingingToneInterface.h) |
|
245 // |
|
246 // ----------------------------------------------------------------------------- |
|
247 // |
|
248 TInt CRingingTone3DPlugin::SetAttr( T3DRingingToneInterfaceAttr aAttributeKey, |
|
249 TInt aValue ) |
|
250 { |
|
251 switch (aAttributeKey) |
|
252 { |
|
253 case E3DRTIAttrProfileId: |
|
254 { |
|
255 iProfileId = aValue; |
|
256 break; |
|
257 } |
|
258 case E3DRTIAttr3DEffect: |
|
259 { |
|
260 iProfile3DToneEffect = aValue; |
|
261 break; |
|
262 } |
|
263 case E3DRTIAttr3DEcho: |
|
264 { |
|
265 iProfile3DToneEcho = aValue; |
|
266 break; |
|
267 } |
|
268 default: |
|
269 { |
|
270 break; |
|
271 } |
|
272 } |
|
273 |
|
274 return KErrNone; |
|
275 } |
|
276 |
|
277 |
|
278 // ----------------------------------------------------------------------------- |
|
279 // CRingingTone3DPlugin::SetAttr (from C3DRingingToneInterface.h) |
|
280 // |
|
281 // ----------------------------------------------------------------------------- |
|
282 // |
|
283 TInt CRingingTone3DPlugin::SetAttr( T3DRingingToneInterfaceAttr aAttributeKey, |
|
284 const TDesC& aValue ) |
|
285 { |
|
286 switch (aAttributeKey) |
|
287 { |
|
288 case E3DRTIAttr3DRingingTone: |
|
289 { |
|
290 if ( aValue.Length() < iRingingTone.MaxLength() ) |
|
291 { |
|
292 iRingingTone = aValue; |
|
293 } |
|
294 break; |
|
295 } |
|
296 default: |
|
297 { |
|
298 break; |
|
299 } |
|
300 } |
|
301 |
|
302 return KErrNone; |
|
303 } |
|
304 |
|
305 |
|
306 // ----------------------------------------------------------------------------- |
|
307 // CRingingTone3DPlugin::SetAttr (from C3DRingingToneInterface.h) |
|
308 // |
|
309 // ----------------------------------------------------------------------------- |
|
310 // |
|
311 TInt CRingingTone3DPlugin::SetAttr( TInt aAttributeKey, TAny* aValue ) |
|
312 { |
|
313 switch (aAttributeKey) |
|
314 { |
|
315 case E3DRTIAttrAudioPlayerUtility: |
|
316 { |
|
317 Init( ( CMdaAudioPlayerUtility* )aValue ); |
|
318 break; |
|
319 } |
|
320 case E3DRTIAttrAudioToneUtility: |
|
321 { |
|
322 Init( ( CMdaAudioToneUtility* )aValue ); |
|
323 break; |
|
324 } |
|
325 case E3DRTIAttrDrmPlayerUtility: |
|
326 { |
|
327 Init( ( CDrmPlayerUtility* )aValue ); |
|
328 break; |
|
329 } |
|
330 case E3DRTIAttrVideoPlayerUtility: |
|
331 { |
|
332 Init( ( CVideoPlayerUtility* )aValue ); |
|
333 break; |
|
334 } |
|
335 |
|
336 default: |
|
337 { |
|
338 break; |
|
339 } |
|
340 } |
|
341 |
|
342 return KErrNone; |
|
343 } |
|
344 |
|
345 |
|
346 // ----------------------------------------------------------------------------- |
|
347 // CRingingTone3DPlugin::PlayL |
|
348 // Start the playback, initialize first in case there has been changes. |
|
349 // ----------------------------------------------------------------------------- |
|
350 // |
|
351 void CRingingTone3DPlugin::PlayL() |
|
352 { |
|
353 TInt err = KErrNone; |
|
354 |
|
355 TRAP( err, DoPlayL() ); |
|
356 |
|
357 if ( err != KErrNone ) |
|
358 { |
|
359 // 3D play failed - play normal ringing tone |
|
360 UnInitialize(); |
|
361 PlayRingingTone(); |
|
362 } |
|
363 } |
|
364 |
|
365 |
|
366 // ----------------------------------------------------------------------------- |
|
367 // CRingingTone3DPlugin::DoPlayL |
|
368 // |
|
369 // Start the playback, initialize first in case there has been changes. |
|
370 // ----------------------------------------------------------------------------- |
|
371 // |
|
372 void CRingingTone3DPlugin::DoPlayL() |
|
373 { |
|
374 FLOG( _L("CRingingTone3DPlugin::DoPlayL START") ); |
|
375 |
|
376 __ASSERT_ALWAYS( iPlayerType != KErrNotFound, Panic(KErrNotReady) ); |
|
377 |
|
378 TInt err = KErrNone; |
|
379 |
|
380 if ( iTimer ) |
|
381 { |
|
382 iTimer->Cancel(); |
|
383 } |
|
384 else |
|
385 { |
|
386 User::Leave( KErrNoMemory ); // ConstructL has failed |
|
387 } |
|
388 |
|
389 TRAP( err, InitializeL() ); // Initialize the plug-in |
|
390 |
|
391 if ( err != KErrNone ) |
|
392 { |
|
393 FLOG( _L("### CRingingTone3DPlugin::InitializeL failed (%d) ###"), err); |
|
394 User::Leave(err); |
|
395 } |
|
396 |
|
397 if ( iProfile3DToneEffect == EProfile3DEffectOff ) |
|
398 { |
|
399 PlayRingingTone(); // play normal ringing tone |
|
400 |
|
401 FLOG( _L("CRingingTone3DPlugin::DoPlayL END") ); |
|
402 return; |
|
403 } |
|
404 |
|
405 |
|
406 #ifdef __STEREO_WIDENING_EFFECT_UI |
|
407 if ( iStereoWidening ) |
|
408 { |
|
409 if ( !iStereoWidening->IsEnabled() ) |
|
410 { |
|
411 FLOG( _L("### CStereoWidening not enabled ###") ); |
|
412 |
|
413 TRAP( err, iStereoWidening->EnableL() ); |
|
414 if ( err != KErrNone ) |
|
415 { |
|
416 FLOG( _L("### CStereoWidening::EnableL failed (%d) ###"), err); |
|
417 User::Leave( err ); |
|
418 } |
|
419 } |
|
420 |
|
421 // play normal ringing tone with stereowidening |
|
422 PlayRingingTone(); |
|
423 |
|
424 FLOG( _L("CRingingTone3DPlugin::DoPlayL END") ); |
|
425 return; |
|
426 } |
|
427 #endif |
|
428 |
|
429 |
|
430 iCurrentUpdate = KErrNotFound; |
|
431 |
|
432 SetNext3DPatternPositionL(); |
|
433 |
|
434 PlayRingingTone(); // Start playing 3D ringing tone. |
|
435 |
|
436 FLOG( _L("CRingingTone3DPlugin::DoPlayL END") ); |
|
437 } |
|
438 |
|
439 |
|
440 // ----------------------------------------------------------------------------- |
|
441 // CRingingTone3DPlugin::TimerExpiredL |
|
442 // Callback method for timer expiration. |
|
443 // Used to update the location and doppler-effects. |
|
444 // ----------------------------------------------------------------------------- |
|
445 // |
|
446 void CRingingTone3DPlugin::TimerExpiredL() |
|
447 { |
|
448 //FLOG( _L("CRingingTone3DPlugin::TimerExpiredL START") ); |
|
449 |
|
450 if ( iCurrentUpdate % 10 == 0 ) |
|
451 { |
|
452 FLOG( _L("CRingingTone3DPlugin::TimerExpiredL called (count = %d)"), iCurrentUpdate); |
|
453 } |
|
454 |
|
455 SetNext3DPatternPositionL(); |
|
456 |
|
457 //FLOG( _L("CRingingTone3DPlugin::TimerExpiredL END") ); |
|
458 } |
|
459 |
|
460 |
|
461 |
|
462 // ----------------------------------------------------------------------------- |
|
463 // CRingingTone3DPlugin::SetNext3DPatternPositionL |
|
464 // |
|
465 // Used to update the location and doppler-effects. |
|
466 // ----------------------------------------------------------------------------- |
|
467 // |
|
468 void CRingingTone3DPlugin::SetNext3DPatternPositionL() |
|
469 { |
|
470 //FLOG( _L("CRingingTone3DPlugin::SetNext3DPatternPositionL START") ); |
|
471 |
|
472 TInt err = KErrNone; |
|
473 |
|
474 if ( !iSource || !iListener ) |
|
475 { |
|
476 FLOG( _L("### CSourceLocation or CListenerLocation or C3DAudioPattern is NULL ###") ); |
|
477 User::Leave( KErrDied ); |
|
478 } |
|
479 |
|
480 if ( iCurrentUpdate == KErrNotFound ) |
|
481 { |
|
482 iCurrentUpdate = 0; // first position |
|
483 } |
|
484 else |
|
485 { |
|
486 iCurrentUpdate++; // next position |
|
487 } |
|
488 |
|
489 // iCurrentUpdate out of bounds. Start from the beginning. |
|
490 if ( iCurrentUpdate >= iParser->CountL() ) |
|
491 { |
|
492 iCurrentUpdate = 0; |
|
493 } |
|
494 |
|
495 |
|
496 // |
|
497 // update doppler-effect |
|
498 // |
|
499 if ( iDoppler && iDopplerEffect ) |
|
500 { |
|
501 // Current doppler-velocity. |
|
502 T3DVelocity velocity = iParser->VelocityL( iCurrentUpdate ); |
|
503 |
|
504 // Update the velocity and apply. |
|
505 TRAP( err, iDopplerEffect->SetCartesianVelocityL( ( TInt32& )velocity.iXVector, |
|
506 ( TInt32& )velocity.iYVector, |
|
507 ( TInt32& )velocity.iZVector ) ); |
|
508 if ( err != KErrNone ) |
|
509 { |
|
510 FLOG( _L("### CSourceDoppler::SetCartesianVelocityL failed (%d) ###"), err); |
|
511 User::Leave( err ); |
|
512 } |
|
513 |
|
514 if ( !iDopplerEffect->IsEnabled() ) |
|
515 { |
|
516 FLOG( _L("### CSourceDoppler not enabled ###") ); |
|
517 |
|
518 TRAP( err, iDopplerEffect->EnableL() ); |
|
519 |
|
520 if ( err != KErrNone ) |
|
521 { |
|
522 FLOG( _L("### CSourceDoppler::EnableL failed (%d) ###"), err); |
|
523 User::Leave( err ); |
|
524 } |
|
525 } |
|
526 |
|
527 TRAP( err, iDopplerEffect->ApplyL() ); |
|
528 if ( err != KErrNone ) |
|
529 { |
|
530 FLOG( _L("### CSourceDoppler::ApplyL failed (%d) ###"), err); |
|
531 User::Leave( err ); |
|
532 } |
|
533 |
|
534 #ifdef _DEBUG |
|
535 //FlogVelocityL( velocity, iCurrentUpdate ); |
|
536 #endif |
|
537 |
|
538 } |
|
539 |
|
540 |
|
541 // |
|
542 // set new 3D pattern position |
|
543 // |
|
544 T3DPosition position = iParser->PositionL( iCurrentUpdate ); |
|
545 |
|
546 TRAP( err, iSource->SetLocationCartesianL( ( TInt32& )position.iX, |
|
547 ( TInt32& )position.iY, |
|
548 ( TInt32& )position.iZ ) ); |
|
549 if ( err != KErrNone ) |
|
550 { |
|
551 FLOG( _L("### CSourceLocation::SetLocationCartesianL failed (%d) ###"), err); |
|
552 User::Leave( err ); |
|
553 } |
|
554 |
|
555 if ( !iSource->IsEnabled() ) |
|
556 { |
|
557 FLOG( _L("### CSourceLocation not enabled ###") ); |
|
558 |
|
559 TRAP( err, iSource->EnableL() ); |
|
560 if ( err != KErrNone ) |
|
561 { |
|
562 FLOG( _L("### CSourceLocation::EnableL failed (%d) ###"), err); |
|
563 User::Leave( err ); |
|
564 } |
|
565 } |
|
566 |
|
567 TRAP( err, iSource->ApplyL() ); |
|
568 if ( err != KErrNone ) |
|
569 { |
|
570 FLOG( _L("### CSourceLocation::ApplyL failed (%d) ###"), err); |
|
571 User::Leave( err ); |
|
572 } |
|
573 |
|
574 |
|
575 #ifdef _DEBUG |
|
576 //FlogPositionL( position, iCurrentUpdate ); |
|
577 #endif |
|
578 |
|
579 |
|
580 // |
|
581 // if reverb is created and not enabled try to enable it. |
|
582 // |
|
583 if ( iReverbEffect ) |
|
584 { |
|
585 TBool enabled = iReverbEffect->EnvironmentalReverb().IsEnabled(); |
|
586 if ( !enabled ) |
|
587 { |
|
588 FLOG( _L("### CEnvironmentalReverb not enabled ###") ); |
|
589 |
|
590 TRAP( err, iReverbEffect->EnvironmentalReverb().EnableL() ); |
|
591 if ( err != KErrNone ) |
|
592 { |
|
593 FLOG( _L("### CEnvironmentalReverb::EnableL failed (%d) ###"), err); |
|
594 User::Leave( err ); |
|
595 } |
|
596 } |
|
597 } |
|
598 |
|
599 |
|
600 // |
|
601 // if listener location is created and not enabled try to enable it |
|
602 // |
|
603 if ( !iListener->IsEnabled() ) |
|
604 { |
|
605 FLOG( _L("### CListnerLocation not enabled ###") ); |
|
606 |
|
607 TRAP( err, iListener->EnableL() ); |
|
608 if ( err != KErrNone ) |
|
609 { |
|
610 FLOG( _L("### CListnerLocation::EnableL failed (%d) ###"), err); |
|
611 User::Leave( err ); |
|
612 } |
|
613 } |
|
614 |
|
615 |
|
616 // Get the update time and calculate it according to velocity set. |
|
617 TInt dTime = iParser->TimeL( iCurrentUpdate ) * 1000; |
|
618 |
|
619 CalculateDTime( dTime ); |
|
620 |
|
621 #ifdef _DEBUG |
|
622 //FlogTimeL( dTime, iCurrentUpdate ); |
|
623 #endif |
|
624 |
|
625 // Start the timer if pattern changes. |
|
626 if ( dTime != 0 ) |
|
627 { |
|
628 iTimer->After( dTime ); |
|
629 } |
|
630 |
|
631 //FLOG( _L("CRingingTone3DPlugin::SetNext3DPatternPositionL END") ); |
|
632 } |
|
633 |
|
634 |
|
635 // ----------------------------------------------------------------------------- |
|
636 // CRingingTone3DPlugin::CalculateDTime |
|
637 // Calculate the time spent in current update, depending on the velocity set. |
|
638 // ----------------------------------------------------------------------------- |
|
639 void CRingingTone3DPlugin::CalculateDTime( TInt& aTime ) |
|
640 { |
|
641 // Velocity is set to zero, so no movement will appear. |
|
642 if ( iVelocity == 0 ) |
|
643 { |
|
644 aTime = 0; |
|
645 } |
|
646 // Velocity is under five (default), so the updates take more time. |
|
647 else if ( iVelocity < KMotionPatternDefaultVelocity ) |
|
648 { |
|
649 aTime = aTime + ( ( aTime / 5 ) * ( KMotionPatternDefaultVelocity - iVelocity ) ); |
|
650 } |
|
651 // Velocity is over five (default), so the updates take less time. |
|
652 else if ( iVelocity > KMotionPatternDefaultVelocity ) |
|
653 { |
|
654 aTime = aTime - ( ( aTime / 6 ) * ( iVelocity - KMotionPatternDefaultVelocity ) ); |
|
655 } |
|
656 } |
|
657 |
|
658 |
|
659 // ----------------------------------------------------------------------------- |
|
660 // CRingingTone3DPlugin::InitializeL() |
|
661 // Initialize the plugin to current settings. |
|
662 // ----------------------------------------------------------------------------- |
|
663 // |
|
664 void CRingingTone3DPlugin::UnInitialize() |
|
665 { |
|
666 if ( iReverbEffect ) |
|
667 { |
|
668 TRAP_IGNORE( iReverbEffect->DisableEnvironmentalReverbL() ); |
|
669 } |
|
670 if ( iListener ) |
|
671 { |
|
672 TRAP_IGNORE( iListener->DisableL() ); |
|
673 } |
|
674 if ( iSource ) |
|
675 { |
|
676 TRAP_IGNORE( iSource->DisableL() ); |
|
677 } |
|
678 |
|
679 if ( iDopplerEffect ) |
|
680 { |
|
681 TRAP_IGNORE( iDopplerEffect->DisableL() ); |
|
682 } |
|
683 } |
|
684 |
|
685 |
|
686 // ----------------------------------------------------------------------------- |
|
687 // CRingingTone3DPlugin::InitializeL() |
|
688 // Initialize the plugin to current settings. |
|
689 // ----------------------------------------------------------------------------- |
|
690 // |
|
691 void CRingingTone3DPlugin::InitializeL() |
|
692 { |
|
693 FLOG( _L("CRingingTone3DPlugin::InitializeL START") ); |
|
694 |
|
695 if ( iProfile3DToneEffect == KErrNotFound || iProfile3DToneEcho == KErrNotFound ) |
|
696 { |
|
697 // profile 3D settings not available - get them from active profile |
|
698 ReadActiveProfileL(); |
|
699 } |
|
700 |
|
701 // if ringing tone has been set (SetAttr), check its validity |
|
702 if ( !CheckRingingTone() ) |
|
703 { |
|
704 FLOG( _L("### invalid 3D ringing tone ###") ); |
|
705 FLOG( _L("CRingingTone3DPlugin::InitializeL END") ); |
|
706 User::Leave(KErrNotFound); |
|
707 } |
|
708 |
|
709 if ( iProfile3DToneEffect == EProfile3DEffectOff ) |
|
710 { |
|
711 FLOG( _L("3D ringing tones not enabled") ); |
|
712 FLOG( _L("CRingingTone3DPlugin::InitializeL END") ); |
|
713 return; |
|
714 } |
|
715 |
|
716 #ifdef _DEBUG |
|
717 Check3DPatternL(iProfile3DToneEffect); |
|
718 Check3DEchoL(iProfile3DToneEcho); |
|
719 #endif |
|
720 |
|
721 |
|
722 #ifdef __STEREO_WIDENING_EFFECT_UI |
|
723 if ( iProfile3DToneEffect == EProfile3DEffectStereoWidening ) |
|
724 { |
|
725 const TInt KStereoWideningLevel = 50; |
|
726 |
|
727 if ( !iStereoWidening ) |
|
728 { |
|
729 iStereoWidening = StereoWideningL(); |
|
730 } |
|
731 |
|
732 iStereoWidening->SetStereoWideningLevelL( KStereoWideningLevel ); |
|
733 iStereoWidening->EnableL(); |
|
734 |
|
735 FLOG( _L("CStereoWidening used as 3D effect") ); |
|
736 FLOG( _L("CRingingTone3DPlugin::InitializeL END") ); |
|
737 return; |
|
738 } |
|
739 #endif |
|
740 |
|
741 // |
|
742 // parse 3D pattern |
|
743 // |
|
744 TInt err = KErrNone; |
|
745 TRAP( err ,iParser->ParseL( iProfile3DToneEffect ) ); |
|
746 if ( err != KErrNone ) |
|
747 { |
|
748 FLOG( _L("### C3DAudioXMLParser::ParseL failed (err=%d, pattern=%d) ###"), err, iProfile3DToneEffect); |
|
749 User::Leave( err ); |
|
750 } |
|
751 |
|
752 |
|
753 #ifdef _DEBUG |
|
754 C3DAudioXMLParser::FlogPubSubL( iProfile3DToneEcho ); |
|
755 #endif |
|
756 |
|
757 iVelocity = iParser->Attribute( C3DAudioXMLParser::EKeyVelocity ); |
|
758 iDoppler = iParser->Attribute( C3DAudioXMLParser::EKeyDopplerUsed ); |
|
759 |
|
760 if ( iProfile3DToneEcho != EProfile3DEchoOff ) |
|
761 { |
|
762 TInt err = KErrNone; |
|
763 |
|
764 if ( !iReverbEffect ) |
|
765 { |
|
766 TRAP( err, iReverbEffect = EnvironmentalReverbUtilityL()); |
|
767 if ( err != KErrNone ) |
|
768 { |
|
769 FLOG( _L("### CEnvironmentalReverbUtility::NewL failed (%d) ###"), err); |
|
770 User::Leave(err); |
|
771 } |
|
772 } |
|
773 |
|
774 // Apply the preset. This also enables reverb effect. |
|
775 TRAP( err, iReverbEffect->ApplyPresetL( iProfile3DToneEcho ) ); |
|
776 if ( err != KErrNone ) |
|
777 { |
|
778 FLOG( _L("### CEnvironmentalReverbUtility::ApplyPresetL failed (%d) ###"), err); |
|
779 User::Leave(err); |
|
780 } |
|
781 } |
|
782 |
|
783 |
|
784 // SourceLocation and ListenerLocation are not created. |
|
785 if ( !iSource ) |
|
786 { |
|
787 iSource = SourceLocationL(); |
|
788 } |
|
789 |
|
790 if ( !iListener ) |
|
791 { |
|
792 iListener = ListenerLocationL(); |
|
793 } |
|
794 |
|
795 // Veriable to set the location. |
|
796 TInt32 zeroInt = 0; |
|
797 |
|
798 // Set both locations to (0, 0, 0) and enable them. |
|
799 iListener->SetLocationCartesianL( zeroInt, zeroInt, zeroInt ); |
|
800 iListener->EnableL(); |
|
801 |
|
802 iSource->SetLocationCartesianL( zeroInt, zeroInt, zeroInt ); |
|
803 iSource->EnableL(); |
|
804 |
|
805 // Doppler is enabled |
|
806 if ( iDoppler ) |
|
807 { |
|
808 // The effect is not created |
|
809 if ( !iDopplerEffect ) |
|
810 { |
|
811 iDopplerEffect = SourceDopplerL(); |
|
812 } |
|
813 |
|
814 TInt maxFactor = iDopplerEffect->FactorMax(); |
|
815 if ( KDopplerFactor > maxFactor ) |
|
816 { |
|
817 iDopplerEffect->SetFactorL( maxFactor ); |
|
818 FLOG( _L("### CSourceDoppler::SetFactorL: max factor (%d) overflow ###"), maxFactor ); |
|
819 } |
|
820 else |
|
821 { |
|
822 // Set doppler factor. |
|
823 iDopplerEffect->SetFactorL( KDopplerFactor ); |
|
824 } |
|
825 |
|
826 // Enable the effect. |
|
827 iDopplerEffect->EnableL(); |
|
828 } |
|
829 |
|
830 |
|
831 FLOG( _L("CRingingTone3DPlugin::InitializeL END") ); |
|
832 } |
|
833 |
|
834 |
|
835 |
|
836 // ----------------------------------------------------------------------------- |
|
837 // CRingingTone3DPlugin::EnvironmentalReverbUtilityL() |
|
838 // |
|
839 // ----------------------------------------------------------------------------- |
|
840 // |
|
841 CEnvironmentalReverbUtility* CRingingTone3DPlugin::EnvironmentalReverbUtilityL() |
|
842 { |
|
843 CEnvironmentalReverbUtility* ret = NULL; |
|
844 |
|
845 switch ( iPlayerType ) |
|
846 { |
|
847 case EMdaAudioPlayerUtility: |
|
848 { |
|
849 ret = CEnvironmentalReverbUtility::NewL( *iAudioPlayerUtility ); |
|
850 break; |
|
851 } |
|
852 case EMdaAudioToneUtility: |
|
853 { |
|
854 ret = CEnvironmentalReverbUtility::NewL( *iAudioToneUtility ); |
|
855 break; |
|
856 } |
|
857 case EDrmPlayerUtility: |
|
858 { |
|
859 ret = CEnvironmentalReverbUtility::NewL( *iDrmPlayerUtility ); |
|
860 break; |
|
861 } |
|
862 case EVideoPlayerUtility: |
|
863 { |
|
864 ret = CEnvironmentalReverbUtility::NewL( *iVideoPlayerUtility ); |
|
865 break; |
|
866 } |
|
867 default: |
|
868 { |
|
869 Panic(KErrArgument); |
|
870 break; |
|
871 } |
|
872 } |
|
873 |
|
874 return ret; |
|
875 } |
|
876 |
|
877 |
|
878 // ----------------------------------------------------------------------------- |
|
879 // CRingingTone3DPlugin::SourceLocationL() |
|
880 // |
|
881 // ----------------------------------------------------------------------------- |
|
882 // |
|
883 CSourceLocation* CRingingTone3DPlugin::SourceLocationL() |
|
884 { |
|
885 CSourceLocation* ret = NULL; |
|
886 |
|
887 switch ( iPlayerType ) |
|
888 { |
|
889 case EMdaAudioPlayerUtility: |
|
890 { |
|
891 ret = CSourceLocation::NewL( *iAudioPlayerUtility ); |
|
892 break; |
|
893 } |
|
894 case EMdaAudioToneUtility: |
|
895 { |
|
896 ret = CSourceLocation::NewL( *iAudioToneUtility ); |
|
897 break; |
|
898 } |
|
899 case EDrmPlayerUtility: |
|
900 { |
|
901 ret = CSourceLocation::NewL( *iDrmPlayerUtility ); |
|
902 break; |
|
903 } |
|
904 case EVideoPlayerUtility: |
|
905 { |
|
906 ret = CSourceLocation::NewL( *iVideoPlayerUtility ); |
|
907 break; |
|
908 } |
|
909 default: |
|
910 { |
|
911 Panic(KErrArgument); |
|
912 break; |
|
913 } |
|
914 } |
|
915 |
|
916 return ret; |
|
917 } |
|
918 |
|
919 |
|
920 // ----------------------------------------------------------------------------- |
|
921 // CRingingTone3DPlugin::ListenerLocationL() |
|
922 // |
|
923 // ----------------------------------------------------------------------------- |
|
924 // |
|
925 CListenerLocation* CRingingTone3DPlugin::ListenerLocationL() |
|
926 { |
|
927 CListenerLocation* ret = NULL; |
|
928 |
|
929 switch ( iPlayerType ) |
|
930 { |
|
931 case EMdaAudioPlayerUtility: |
|
932 { |
|
933 ret = CListenerLocation::NewL( *iAudioPlayerUtility ); |
|
934 break; |
|
935 } |
|
936 case EMdaAudioToneUtility: |
|
937 { |
|
938 ret = CListenerLocation::NewL( *iAudioToneUtility ); |
|
939 break; |
|
940 } |
|
941 case EDrmPlayerUtility: |
|
942 { |
|
943 ret = CListenerLocation::NewL( *iDrmPlayerUtility ); |
|
944 break; |
|
945 } |
|
946 case EVideoPlayerUtility: |
|
947 { |
|
948 ret = CListenerLocation::NewL( *iVideoPlayerUtility ); |
|
949 break; |
|
950 } |
|
951 default: |
|
952 { |
|
953 Panic(KErrArgument); |
|
954 break; |
|
955 } |
|
956 } |
|
957 |
|
958 return ret; |
|
959 } |
|
960 |
|
961 |
|
962 |
|
963 // ----------------------------------------------------------------------------- |
|
964 // CRingingTone3DPlugin::SourceDopplerL() |
|
965 // |
|
966 // ----------------------------------------------------------------------------- |
|
967 // |
|
968 CSourceDoppler* CRingingTone3DPlugin::SourceDopplerL() |
|
969 { |
|
970 CSourceDoppler* ret = NULL; |
|
971 |
|
972 switch ( iPlayerType ) |
|
973 { |
|
974 case EMdaAudioPlayerUtility: |
|
975 { |
|
976 ret = CSourceDoppler::NewL( *iAudioPlayerUtility ); |
|
977 break; |
|
978 } |
|
979 case EMdaAudioToneUtility: |
|
980 { |
|
981 ret = CSourceDoppler::NewL( *iAudioToneUtility ); |
|
982 break; |
|
983 } |
|
984 case EDrmPlayerUtility: |
|
985 { |
|
986 ret = CSourceDoppler::NewL( *iDrmPlayerUtility ); |
|
987 break; |
|
988 } |
|
989 case EVideoPlayerUtility: |
|
990 { |
|
991 ret = CSourceDoppler::NewL( *iVideoPlayerUtility ); |
|
992 break; |
|
993 } |
|
994 default: |
|
995 { |
|
996 Panic(KErrArgument); |
|
997 break; |
|
998 } |
|
999 } |
|
1000 |
|
1001 return ret; |
|
1002 } |
|
1003 |
|
1004 |
|
1005 |
|
1006 #ifdef __STEREO_WIDENING_EFFECT_UI |
|
1007 // ----------------------------------------------------------------------------- |
|
1008 // CRingingTone3DPlugin::StereoWideningL() |
|
1009 // |
|
1010 // ----------------------------------------------------------------------------- |
|
1011 // |
|
1012 CStereoWidening* CRingingTone3DPlugin::StereoWideningL() |
|
1013 { |
|
1014 CStereoWidening* ret = NULL; |
|
1015 |
|
1016 switch ( iPlayerType ) |
|
1017 { |
|
1018 case EMdaAudioPlayerUtility: |
|
1019 { |
|
1020 ret = CStereoWidening::NewL( *iAudioPlayerUtility ); |
|
1021 break; |
|
1022 } |
|
1023 case EMdaAudioToneUtility: |
|
1024 { |
|
1025 ret = CStereoWidening::NewL( *iAudioToneUtility ); |
|
1026 break; |
|
1027 } |
|
1028 case EDrmPlayerUtility: |
|
1029 { |
|
1030 ret = CStereoWidening::NewL( *iDrmPlayerUtility ); |
|
1031 break; |
|
1032 } |
|
1033 case EVideoPlayerUtility: |
|
1034 { |
|
1035 ret = CStereoWidening::NewL( *iVideoPlayerUtility ); |
|
1036 break; |
|
1037 } |
|
1038 default: |
|
1039 { |
|
1040 Panic(KErrArgument); |
|
1041 break; |
|
1042 } |
|
1043 } |
|
1044 |
|
1045 return ret; |
|
1046 } |
|
1047 #endif |
|
1048 |
|
1049 |
|
1050 // ----------------------------------------------------------------------------- |
|
1051 // CRingingTone3DPlugin::PlayRingingTone() |
|
1052 // |
|
1053 // ----------------------------------------------------------------------------- |
|
1054 // |
|
1055 void CRingingTone3DPlugin::PlayRingingTone() |
|
1056 { |
|
1057 if ( iPlaying ) |
|
1058 { |
|
1059 return; |
|
1060 } |
|
1061 iPlaying = ETrue; |
|
1062 |
|
1063 switch ( iPlayerType ) |
|
1064 { |
|
1065 case EMdaAudioPlayerUtility: |
|
1066 { |
|
1067 iAudioPlayerUtility->Play(); |
|
1068 break; |
|
1069 } |
|
1070 case EMdaAudioToneUtility: |
|
1071 { |
|
1072 iAudioToneUtility->Play(); |
|
1073 break; |
|
1074 } |
|
1075 case EDrmPlayerUtility: |
|
1076 { |
|
1077 iDrmPlayerUtility->Play(); |
|
1078 break; |
|
1079 } |
|
1080 case EVideoPlayerUtility: |
|
1081 { |
|
1082 iVideoPlayerUtility->Play(); |
|
1083 break; |
|
1084 } |
|
1085 default: |
|
1086 { |
|
1087 break; |
|
1088 } |
|
1089 } |
|
1090 } |
|
1091 |
|
1092 |
|
1093 // ----------------------------------------------------------------------------- |
|
1094 // CRingingTone3DPlugin::StopRingingTone() |
|
1095 // |
|
1096 // ----------------------------------------------------------------------------- |
|
1097 // |
|
1098 void CRingingTone3DPlugin::StopRingingTone() |
|
1099 { |
|
1100 if ( !iPlaying ) |
|
1101 { |
|
1102 return; |
|
1103 } |
|
1104 iPlaying = EFalse; |
|
1105 |
|
1106 switch ( iPlayerType ) |
|
1107 { |
|
1108 case EMdaAudioPlayerUtility: |
|
1109 { |
|
1110 iAudioPlayerUtility->Stop(); |
|
1111 break; |
|
1112 } |
|
1113 case EMdaAudioToneUtility: |
|
1114 { |
|
1115 iAudioToneUtility->CancelPlay(); |
|
1116 break; |
|
1117 } |
|
1118 case EDrmPlayerUtility: |
|
1119 { |
|
1120 iDrmPlayerUtility->Stop(); |
|
1121 break; |
|
1122 } |
|
1123 case EVideoPlayerUtility: |
|
1124 { |
|
1125 iVideoPlayerUtility->Stop(); |
|
1126 break; |
|
1127 } |
|
1128 default: |
|
1129 { |
|
1130 Panic(KErrArgument); |
|
1131 break; |
|
1132 } |
|
1133 } |
|
1134 |
|
1135 FLOG( _L("CRingingTone3DPlugin::StopRingingTone: ringing stopped") ); |
|
1136 } |
|
1137 |
|
1138 |
|
1139 // ----------------------------------------------------------------------------- |
|
1140 // CRingingTone3DPlugin::Panic() |
|
1141 // |
|
1142 // ----------------------------------------------------------------------------- |
|
1143 // |
|
1144 void CRingingTone3DPlugin::Panic(TInt aReason) |
|
1145 { |
|
1146 _LIT(KPanicCategory,"RingingTone3DAudioPlugin"); |
|
1147 |
|
1148 User::Panic(KPanicCategory, aReason); |
|
1149 } |
|
1150 |
|
1151 |
|
1152 // ----------------------------------------------------------------------------- |
|
1153 // CRingingTone3DPlugin::ReadActiveProfileL() |
|
1154 // ----------------------------------------------------------------------------- |
|
1155 // |
|
1156 void CRingingTone3DPlugin::ReadActiveProfileL() |
|
1157 { |
|
1158 MProfileEngine* profileEngine = CreateProfileEngineL(); |
|
1159 CleanupReleasePushL( *profileEngine ); |
|
1160 |
|
1161 MProfile* activeProfile = profileEngine->ActiveProfileL(); |
|
1162 CleanupReleasePushL( *activeProfile ); |
|
1163 |
|
1164 #ifdef _DEBUG |
|
1165 FlogProfileL(activeProfile); |
|
1166 #endif |
|
1167 |
|
1168 //const MProfileTones& profileTones = activeProfile->ProfileTones(); |
|
1169 //iRingingTone = profileTones.RingingTone1(); |
|
1170 |
|
1171 const MProfileExtraSettings& extra = activeProfile->ProfileExtraSettings(); |
|
1172 const MProfile3DToneSettings& threeD = extra.Profile3DToneSettings(); |
|
1173 |
|
1174 iProfile3DToneEffect = threeD.Effect(); |
|
1175 iProfile3DToneEcho = threeD.Echo(); |
|
1176 |
|
1177 CleanupStack::PopAndDestroy(activeProfile); |
|
1178 CleanupStack::PopAndDestroy( profileEngine ); |
|
1179 } |
|
1180 |
|
1181 |
|
1182 // ----------------------------------------------------------------------------- |
|
1183 // CRingingTone3DPlugin::CheckRingingTone() |
|
1184 // ----------------------------------------------------------------------------- |
|
1185 // |
|
1186 TBool CRingingTone3DPlugin::CheckRingingTone() |
|
1187 { |
|
1188 if ( iRingingTone.Length() == 0 ) |
|
1189 { |
|
1190 return ETrue; // nothing to check |
|
1191 } |
|
1192 |
|
1193 TParsePtr fileParser( iRingingTone ); |
|
1194 TPtrC extPtr = fileParser.Ext(); |
|
1195 |
|
1196 // Ringing tone is valid for 3D-playback, i.e not a .rng-tone or "No ringing tone". |
|
1197 // Or the user has set the RingingToneInUse flag to EFalse in CR. |
|
1198 if ( extPtr.Compare( KRngType ) == 0 || iRingingTone.Compare( KNoToneFileName ) == 0 ) |
|
1199 { |
|
1200 return EFalse; |
|
1201 } |
|
1202 |
|
1203 return ETrue; |
|
1204 } |
|
1205 |
|
1206 |
|
1207 |
|
1208 #ifdef _DEBUG |
|
1209 |
|
1210 // ----------------------------------------------------------------------------- |
|
1211 // CRingingTone3DPlugin::Check3DPatternL() |
|
1212 // |
|
1213 // ----------------------------------------------------------------------------- |
|
1214 // |
|
1215 void CRingingTone3DPlugin::Check3DPatternL(TInt aPattern) |
|
1216 { |
|
1217 |
|
1218 if ( aPattern != EProfile3DEffectOff && aPattern != EProfile3DEffectCircle && |
|
1219 aPattern != EProfile3DEffectFlyby && aPattern != EProfile3DEffectZigZag && |
|
1220 aPattern != EProfile3DEffectRandomWalk && aPattern != EProfile3DEffectChaos && |
|
1221 aPattern != EProfile3DEffectStereoWidening ) |
|
1222 { |
|
1223 User::Leave(KErrArgument); |
|
1224 } |
|
1225 } |
|
1226 |
|
1227 // ----------------------------------------------------------------------------- |
|
1228 // CRingingTone3DPlugin::Check3DEchoL() |
|
1229 // |
|
1230 // ----------------------------------------------------------------------------- |
|
1231 // |
|
1232 void CRingingTone3DPlugin::Check3DEchoL(TInt aEcho) |
|
1233 { |
|
1234 |
|
1235 if ( aEcho != EProfile3DEchoOff && aEcho != EProfile3DEchoLivingRoom && |
|
1236 aEcho != EProfile3DEchoCave && aEcho != EProfile3DEchoStoneCorridor && |
|
1237 aEcho != EProfile3DEchoForest && aEcho != EProfile3DEchoSewerPipe && |
|
1238 aEcho != EProfile3DEchoUnderwater ) |
|
1239 { |
|
1240 User::Leave(KErrArgument); |
|
1241 } |
|
1242 } |
|
1243 |
|
1244 |
|
1245 // ----------------------------------------------------------------------------- |
|
1246 // CRingingTone3DPlugin::FlogRepository() |
|
1247 // |
|
1248 // ----------------------------------------------------------------------------- |
|
1249 // |
|
1250 void CRingingTone3DPlugin::FlogRepositoryL(CRepository* aRepository, TInt aEcho) |
|
1251 { |
|
1252 FLOG( _L("------ start repository data ------") ); |
|
1253 |
|
1254 TInt num = 0; |
|
1255 TBuf<128> buf; |
|
1256 |
|
1257 User::LeaveIfError( aRepository->Get( E3DAudioRepositoryPattern, num ) ); |
|
1258 C3DAudioXMLParser::GetPatternString(buf, num); |
|
1259 FLOG( _L("pattern: %S (%d)"), &buf, num ); |
|
1260 |
|
1261 User::LeaveIfError( aRepository->Get( E3DAudioRepositoryReverb, num ) ); |
|
1262 C3DAudioXMLParser::GetEchoString(buf, num); |
|
1263 |
|
1264 C3DAudioXMLParser::GetEchoString(buf, aEcho); |
|
1265 FLOG( _L("echo: %S (%d)"), &buf, aEcho ); |
|
1266 |
|
1267 User::LeaveIfError( aRepository->Get( E3DAudioRepositoryVelocity, num ) ); |
|
1268 FLOG( _L("velocity: %d"), num ); |
|
1269 |
|
1270 User::LeaveIfError( aRepository->Get( E3DAudioRepositoryDoppler, num ) ); |
|
1271 FLOG( _L("doppler: %d"), num ); |
|
1272 |
|
1273 User::LeaveIfError( aRepository->Get( E3DAudioRepositoryBlockCount, num ) ); |
|
1274 FLOG( _L("block count: %d"), num ); |
|
1275 |
|
1276 FLOG( _L("------ end repository data ------") ); |
|
1277 } |
|
1278 |
|
1279 |
|
1280 // ----------------------------------------------------------------------------- |
|
1281 // CRingingTone3DPlugin::FlogProfile() |
|
1282 // |
|
1283 // ----------------------------------------------------------------------------- |
|
1284 // |
|
1285 void CRingingTone3DPlugin::FlogProfileL(MProfile* aProfile) |
|
1286 { |
|
1287 FLOG( _L("------ start profile data ------") ); |
|
1288 |
|
1289 TInt num = 0; |
|
1290 TBuf<128> buf; |
|
1291 |
|
1292 const MProfileName& name = aProfile->ProfileName(); |
|
1293 buf = name.Name(); |
|
1294 FLOG( _L("profile name: %S"), &buf ); |
|
1295 |
|
1296 const MProfileTones& profileTones = aProfile->ProfileTones(); |
|
1297 TFileName ringingTone = profileTones.RingingTone1(); |
|
1298 FLOG( _L("ringing tone: %S"), &ringingTone ); |
|
1299 |
|
1300 const MProfileExtraSettings& extra = aProfile->ProfileExtraSettings(); |
|
1301 const MProfile3DToneSettings& threeD = extra.Profile3DToneSettings(); |
|
1302 |
|
1303 num = threeD.Effect(); |
|
1304 C3DAudioXMLParser::GetPatternString(buf, num); |
|
1305 FLOG( _L("pattern: %S (%d)"), &buf, num ); |
|
1306 |
|
1307 num = threeD.Echo(); |
|
1308 C3DAudioXMLParser::GetEchoString(buf, num); |
|
1309 FLOG( _L("echo: %S (%d)"), &buf, num ); |
|
1310 |
|
1311 |
|
1312 FLOG( _L("------ end profile data ------") ); |
|
1313 } |
|
1314 |
|
1315 |
|
1316 // ----------------------------------------------------------------------------- |
|
1317 // CRingingTone3DPlugin::FlogPlayer() |
|
1318 // |
|
1319 // ----------------------------------------------------------------------------- |
|
1320 // |
|
1321 void CRingingTone3DPlugin::FlogPlayer(TInt aPlayer) |
|
1322 { |
|
1323 TBuf<128> buf; |
|
1324 |
|
1325 switch ( aPlayer ) |
|
1326 { |
|
1327 case EMdaAudioPlayerUtility: |
|
1328 buf = _L("EMdaAudioPlayerUtility"); |
|
1329 break; |
|
1330 case EMdaAudioToneUtility: |
|
1331 buf = _L("EMdaAudioToneUtility"); |
|
1332 break; |
|
1333 case EDrmPlayerUtility: |
|
1334 buf = _L("EDrmPlayerUtility"); |
|
1335 break; |
|
1336 case EVideoPlayerUtility: |
|
1337 buf = _L("EVideoPlayerUtility"); |
|
1338 break; |
|
1339 |
|
1340 default: |
|
1341 buf = _L("### unknown player ###"); |
|
1342 break; |
|
1343 } |
|
1344 |
|
1345 |
|
1346 FLOG( _L("player type: %S"), &buf ); |
|
1347 } |
|
1348 |
|
1349 |
|
1350 // ----------------------------------------------------------------------------- |
|
1351 // CRingingTone3DPlugin::FlogPositionL() |
|
1352 // |
|
1353 // ----------------------------------------------------------------------------- |
|
1354 // |
|
1355 void CRingingTone3DPlugin::FlogPositionL(T3DPosition& aPosition, TInt aIndex) |
|
1356 { |
|
1357 TBuf<128> buf; |
|
1358 TInt x = aPosition.iX; |
|
1359 TInt y = aPosition.iY; |
|
1360 TInt z = aPosition.iZ; |
|
1361 |
|
1362 buf.Format(_L("%d: position x=%d y=%d z=%d"), aIndex, x,y,z); |
|
1363 FLOG(buf); |
|
1364 } |
|
1365 |
|
1366 |
|
1367 // ----------------------------------------------------------------------------- |
|
1368 // CRingingTone3DPlugin::FlogVelocityL() |
|
1369 // |
|
1370 // ----------------------------------------------------------------------------- |
|
1371 // |
|
1372 void CRingingTone3DPlugin::FlogVelocityL(T3DVelocity& aVelocity, TInt aIndex) |
|
1373 { |
|
1374 TBuf<128> buf; |
|
1375 |
|
1376 TInt x = aVelocity.iXVector; |
|
1377 TInt y = aVelocity.iYVector; |
|
1378 TInt z = aVelocity.iZVector; |
|
1379 |
|
1380 buf.Format(_L("%d: velocity x=%d y=%d z=%d"), aIndex, x,y,z); |
|
1381 FLOG(buf); |
|
1382 } |
|
1383 |
|
1384 // ----------------------------------------------------------------------------- |
|
1385 // CRingingTone3DPlugin::FlogTimeL() |
|
1386 // |
|
1387 // ----------------------------------------------------------------------------- |
|
1388 // |
|
1389 void CRingingTone3DPlugin::FlogTimeL(TInt aTime, TInt aIndex) |
|
1390 { |
|
1391 TBuf<128> buf; |
|
1392 |
|
1393 buf.Format(_L("%d: time = %d"), aIndex, aTime); |
|
1394 FLOG(buf); |
|
1395 } |
|
1396 |
|
1397 #endif // _DEBUG |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 // End of File |