|
1 /* |
|
2 * Copyright (c) 2006 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: Project file for EnhancedMediaClient Utility |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "ReverbEffectImpl.h" |
|
20 #include <EnvironmentalReverbBase.h> |
|
21 #include <ControlObserver.h> |
|
22 |
|
23 using namespace multimedia; |
|
24 |
|
25 CReverbEffect::CReverbEffect() |
|
26 { |
|
27 // No Impl |
|
28 } |
|
29 |
|
30 CReverbEffect::~CReverbEffect() |
|
31 { |
|
32 delete iPrevReverbProxy; |
|
33 delete iReverbProxy; |
|
34 iObservers.Close(); |
|
35 } |
|
36 |
|
37 TInt CReverbEffect::PostConstructor() |
|
38 { |
|
39 TRAPD( status, CEffectControlBase::ConstructL(KUidEnvironmentalReverbEffect) ); |
|
40 return status; |
|
41 } |
|
42 |
|
43 // From MControl begins |
|
44 TInt CReverbEffect::AddObserver( MControlObserver& aObserver ) |
|
45 { |
|
46 return iObservers.Append(&aObserver); |
|
47 } |
|
48 |
|
49 TInt CReverbEffect::RemoveObserver( MControlObserver& aObserver ) |
|
50 { |
|
51 TInt index = iObservers.Find(&aObserver); |
|
52 if( index != KErrNotFound ) |
|
53 { |
|
54 iObservers.Remove(index); |
|
55 } |
|
56 return index; |
|
57 } |
|
58 |
|
59 TUid CReverbEffect::Type() |
|
60 { |
|
61 return KReverbEffectControl; |
|
62 } |
|
63 |
|
64 TControlType CReverbEffect::ControlType() |
|
65 { |
|
66 return EEffectControl; |
|
67 } |
|
68 |
|
69 // From MControl ends |
|
70 |
|
71 // From MEffectControl begins |
|
72 TInt CReverbEffect::Apply() |
|
73 { |
|
74 return DoApply(); |
|
75 } |
|
76 |
|
77 // From MEffectControl ends |
|
78 |
|
79 TInt CReverbEffect::DoApply() |
|
80 { |
|
81 TInt error(KErrNone); |
|
82 if(iReverbProxy) |
|
83 { |
|
84 TRAP(error,iReverbProxy->ApplyL()); |
|
85 } |
|
86 else |
|
87 { |
|
88 error = KErrNotReady; |
|
89 } |
|
90 return error; |
|
91 } |
|
92 |
|
93 /** |
|
94 * Gets the decay HF Ratio in hundredths |
|
95 * @since 5.0 |
|
96 * @return decay HF Ratio |
|
97 */ |
|
98 TInt CReverbEffect::DecayHFRatio(TUint &aRatio) |
|
99 { |
|
100 TInt status(KErrNone); |
|
101 if(iReverbProxy) |
|
102 { |
|
103 aRatio = iReverbProxy->DecayHFRatio(); |
|
104 } |
|
105 else |
|
106 { |
|
107 status = KErrNotReady; |
|
108 } |
|
109 return status; |
|
110 } |
|
111 |
|
112 /** |
|
113 * Gets the reverb decay HF Ratio minimum and maximum in hundredths. |
|
114 * @since 5.0 |
|
115 * @param aMin Minimum decay HF Ratio |
|
116 * @param aMax Maximum decay HF Ratio |
|
117 */ |
|
118 TInt CReverbEffect::DecayHFRatioRange(TUint& aMin, TUint& aMax) |
|
119 { |
|
120 TInt status(KErrNone); |
|
121 TUint32 min, max; |
|
122 if(iReverbProxy) |
|
123 { |
|
124 iReverbProxy->DecayHFRatioRange(min,max); |
|
125 aMin = min; |
|
126 aMax = max; |
|
127 } |
|
128 else |
|
129 { |
|
130 status = KErrNotReady; |
|
131 } |
|
132 return status; |
|
133 } |
|
134 |
|
135 /** |
|
136 * Gets the decay time in milliseconds |
|
137 * @since 5.0 |
|
138 * @return decay time |
|
139 */ |
|
140 TInt CReverbEffect::DecayTime(TUint &aDecayTime) |
|
141 { |
|
142 TInt status(KErrNone); |
|
143 if(iReverbProxy) |
|
144 { |
|
145 aDecayTime = iReverbProxy->DecayTime(); |
|
146 } |
|
147 else |
|
148 { |
|
149 status = KErrNotReady; |
|
150 } |
|
151 return status; |
|
152 } |
|
153 |
|
154 /** |
|
155 * Gets the allowable reverb decay time range in milliseconds. |
|
156 * @since 5.0 |
|
157 * @param aMin Minimum decay time in milliseconds |
|
158 * @param aMax Maximum decay time in milliseconds |
|
159 */ |
|
160 TInt CReverbEffect::DecayTimeRange(TUint& aMin, TUint& aMax) |
|
161 { |
|
162 TInt status(KErrNone); |
|
163 TUint32 min, max; |
|
164 if(iReverbProxy) |
|
165 { |
|
166 iReverbProxy->DecayTimeRange(min,max); |
|
167 aMin = min; |
|
168 aMax = max; |
|
169 } |
|
170 else |
|
171 { |
|
172 status = KErrNotReady; |
|
173 } |
|
174 return status; |
|
175 } |
|
176 |
|
177 /** |
|
178 * Gets the density current value as a percentage in hundredths |
|
179 * @since 5.0 |
|
180 * @return density value |
|
181 */ |
|
182 TInt CReverbEffect::Density(TUint &aDensity) |
|
183 { |
|
184 TInt status(KErrNone); |
|
185 if(iReverbProxy) |
|
186 { |
|
187 aDensity = iReverbProxy->Density(); |
|
188 } |
|
189 else |
|
190 { |
|
191 status = KErrNotReady; |
|
192 } |
|
193 return status; |
|
194 } |
|
195 |
|
196 /** |
|
197 * Gets the diffusion current value as a percentage in hundredths. |
|
198 * @since 5.0 |
|
199 * @return diffusion value |
|
200 */ |
|
201 TInt CReverbEffect::Diffusion(TUint &aDiffusion) |
|
202 { |
|
203 TInt status(KErrNone); |
|
204 if(iReverbProxy) |
|
205 { |
|
206 aDiffusion = iReverbProxy->Diffusion(); |
|
207 } |
|
208 else |
|
209 { |
|
210 status = KErrNotReady; |
|
211 } |
|
212 return status; |
|
213 } |
|
214 |
|
215 /** |
|
216 * Gets the reverb reflections delay in ms. |
|
217 * @since 5.0 |
|
218 * @return reverb reflections delay |
|
219 */ |
|
220 TInt CReverbEffect::ReflectionsDelay(TUint &aDelay) |
|
221 { |
|
222 TInt status(KErrNone); |
|
223 if(iReverbProxy) |
|
224 { |
|
225 aDelay = iReverbProxy->ReflectionsDelay(); |
|
226 } |
|
227 else |
|
228 { |
|
229 status = KErrNotReady; |
|
230 } |
|
231 return status; |
|
232 } |
|
233 |
|
234 /** |
|
235 * Gets the reverb reflections delay maximum in milliseconds. |
|
236 * @since 5.0 |
|
237 * @return reverb reflections delay maximum |
|
238 */ |
|
239 TInt CReverbEffect::ReflectionsDelayMax(TUint &aDelayMax) |
|
240 { |
|
241 TInt status(KErrNone); |
|
242 if(iReverbProxy) |
|
243 { |
|
244 aDelayMax = iReverbProxy->ReflectionsDelayMax(); |
|
245 } |
|
246 else |
|
247 { |
|
248 status = KErrNotReady; |
|
249 } |
|
250 return status; |
|
251 } |
|
252 |
|
253 /** |
|
254 * Gets the reverb reflections level in mB |
|
255 * @since 5.0 |
|
256 * @return Reverb reflections level |
|
257 */ |
|
258 TInt CReverbEffect::ReflectionsLevel(TInt &aLevel) |
|
259 { |
|
260 TInt status(KErrNone); |
|
261 if(iReverbProxy) |
|
262 { |
|
263 aLevel = iReverbProxy->ReflectionsLevel(); |
|
264 } |
|
265 else |
|
266 { |
|
267 status = KErrNotReady; |
|
268 } |
|
269 return status; |
|
270 } |
|
271 |
|
272 /** |
|
273 * Gets the reverb reflections level maximum and minimum in mB |
|
274 * @since 5.0 |
|
275 * @param aMin Minimum reflections level |
|
276 * @param aMax Maximum reflections level |
|
277 */ |
|
278 TInt CReverbEffect::ReflectionLevelRange( TInt& aMin, TInt& aMax ) |
|
279 { |
|
280 TInt status(KErrNone); |
|
281 TInt32 min, max; |
|
282 if(iReverbProxy) |
|
283 { |
|
284 iReverbProxy->ReflectionLevelRange(min,max); |
|
285 aMin = min; |
|
286 aMax = max; |
|
287 } |
|
288 else |
|
289 { |
|
290 status = KErrNotReady; |
|
291 } |
|
292 return status; |
|
293 } |
|
294 |
|
295 /** |
|
296 * Gets the reverb delay in milliseconds |
|
297 * @since 5.0 |
|
298 * @return reverb delay |
|
299 */ |
|
300 TInt CReverbEffect::ReverbDelay(TUint &aDelay) |
|
301 { |
|
302 TInt status(KErrNone); |
|
303 if(iReverbProxy) |
|
304 { |
|
305 aDelay = iReverbProxy->ReverbDelay(); |
|
306 } |
|
307 else |
|
308 { |
|
309 status = KErrNotReady; |
|
310 } |
|
311 return status; |
|
312 } |
|
313 |
|
314 /** |
|
315 * Gets the reverb delay maximum in milliseconds |
|
316 * @since 5.0 |
|
317 * @return reverb delay maximum |
|
318 */ |
|
319 TInt CReverbEffect::ReverbDelayMax(TUint &aDelayMax) |
|
320 { |
|
321 TInt status(KErrNone); |
|
322 if(iReverbProxy) |
|
323 { |
|
324 aDelayMax = iReverbProxy->ReverbDelayMax(); |
|
325 } |
|
326 else |
|
327 { |
|
328 status = KErrNotReady; |
|
329 } |
|
330 return status; |
|
331 } |
|
332 |
|
333 /** |
|
334 * Gets the reverb current level in mB |
|
335 * @since 5.0 |
|
336 * @return reverb current level |
|
337 */ |
|
338 TInt CReverbEffect::ReverbLevel(TInt &aLevel) |
|
339 { |
|
340 TInt status(KErrNone); |
|
341 if(iReverbProxy) |
|
342 { |
|
343 aLevel = iReverbProxy->ReverbLevel(); |
|
344 } |
|
345 else |
|
346 { |
|
347 status = KErrNotReady; |
|
348 } |
|
349 return status; |
|
350 } |
|
351 |
|
352 /** |
|
353 * Gets the reverb current level maximum and minimum in mB |
|
354 * @since 5.0 |
|
355 * @param aMin Minimum current level |
|
356 * @param aMax Maximum current level |
|
357 * @return - |
|
358 */ |
|
359 TInt CReverbEffect::ReverbLevelRange( TInt& aMin, TInt& aMax ) |
|
360 { |
|
361 TInt status(KErrNone); |
|
362 TInt32 min, max; |
|
363 if(iReverbProxy) |
|
364 { |
|
365 iReverbProxy->ReverbLevelRange(min,max); |
|
366 aMin = min; |
|
367 aMax = max; |
|
368 } |
|
369 else |
|
370 { |
|
371 status = KErrNotReady; |
|
372 } |
|
373 return status; |
|
374 } |
|
375 |
|
376 /** |
|
377 * Gets the room HF level current ratio |
|
378 * @since 5.0 |
|
379 * @return room HF level ratio |
|
380 */ |
|
381 TInt CReverbEffect::RoomHFLevel(TInt &aLevel) |
|
382 { |
|
383 TInt status(KErrNone); |
|
384 if(iReverbProxy) |
|
385 { |
|
386 aLevel = iReverbProxy->RoomHFLevel(); |
|
387 } |
|
388 else |
|
389 { |
|
390 status = KErrNotReady; |
|
391 } |
|
392 return status; |
|
393 } |
|
394 |
|
395 /** |
|
396 * Gets the room HF level maximum and minimum ratios |
|
397 * @since 5.0 |
|
398 * @param aMin Minimum current room HF level |
|
399 * @param aMax Maximum current room HF level |
|
400 * @return - |
|
401 */ |
|
402 TInt CReverbEffect::RoomHFLevelRange( TInt& aMin, TInt& aMax ) |
|
403 { |
|
404 TInt status(KErrNone); |
|
405 TInt32 min, max; |
|
406 if(iReverbProxy) |
|
407 { |
|
408 iReverbProxy->RoomHFLevelRange(min,max); |
|
409 aMin = min; |
|
410 aMax = max; |
|
411 } |
|
412 else |
|
413 { |
|
414 status = KErrNotReady; |
|
415 } |
|
416 return status; |
|
417 } |
|
418 |
|
419 /** |
|
420 * Gets the room level current value in mB |
|
421 * @since 5.0 |
|
422 * @return room level value |
|
423 */ |
|
424 TInt CReverbEffect::RoomLevel(TInt &aLevel) |
|
425 { |
|
426 TInt status(KErrNone); |
|
427 if(iReverbProxy) |
|
428 { |
|
429 aLevel = iReverbProxy->RoomLevel(); |
|
430 } |
|
431 else |
|
432 { |
|
433 status = KErrNotReady; |
|
434 } |
|
435 return status; |
|
436 } |
|
437 |
|
438 /** |
|
439 * Gets the room level maximum and minimum in mB |
|
440 * @since 5.0 |
|
441 * @param aMin Minimum current room level |
|
442 * @param aMax Maximum current room level |
|
443 * @return - |
|
444 */ |
|
445 TInt CReverbEffect::RoomLevelRange( TInt& aMin, TInt& aMax ) |
|
446 { |
|
447 TInt status(KErrNone); |
|
448 TInt32 min, max; |
|
449 if(iReverbProxy) |
|
450 { |
|
451 iReverbProxy->RoomLevelRange(min,max); |
|
452 aMin = min; |
|
453 aMax = max; |
|
454 } |
|
455 else |
|
456 { |
|
457 status = KErrNotReady; |
|
458 } |
|
459 return status; |
|
460 } |
|
461 |
|
462 /** |
|
463 * Sets the decay HF Ratio in hundredths |
|
464 * @since 5.0 |
|
465 * @param aDecayHFRatio The decay high frequence ratio in hundredths |
|
466 * @return - |
|
467 */ |
|
468 TInt CReverbEffect::SetDecayHFRatio( TUint aDecayHFRatio ) |
|
469 { |
|
470 TInt status(KErrNone); |
|
471 if(iReverbProxy) |
|
472 { |
|
473 TRAP(status,iReverbProxy->SetDecayHFRatioL(aDecayHFRatio)); |
|
474 } |
|
475 else |
|
476 { |
|
477 status = KErrNotReady; |
|
478 } |
|
479 return status; |
|
480 } |
|
481 |
|
482 /** |
|
483 * Sets the decay time in millisecond |
|
484 * @since 5.0 |
|
485 * @param aDecayTime Decay time in ms |
|
486 */ |
|
487 TInt CReverbEffect::SetDecayTime( TUint aDecayTime ) |
|
488 { |
|
489 TInt status(KErrNone); |
|
490 if(iReverbProxy) |
|
491 { |
|
492 TRAP(status,iReverbProxy->SetDecayTimeL(aDecayTime)); |
|
493 } |
|
494 else |
|
495 { |
|
496 status = KErrNotReady; |
|
497 } |
|
498 return status; |
|
499 } |
|
500 |
|
501 /** |
|
502 * Sets the density value as percentage in hundredths |
|
503 * @since 5.0 |
|
504 * @param aDensity The density. |
|
505 */ |
|
506 TInt CReverbEffect::SetDensity( TUint aDensity ) |
|
507 { |
|
508 TInt status(KErrNone); |
|
509 if(iReverbProxy) |
|
510 { |
|
511 TRAP(status,iReverbProxy->SetDensityL(aDensity)); |
|
512 } |
|
513 else |
|
514 { |
|
515 status = KErrNotReady; |
|
516 } |
|
517 return status; |
|
518 } |
|
519 |
|
520 /** |
|
521 * Sets the diffusion value as a percentage in hundredths |
|
522 * @since 5.0 |
|
523 * @param aDiffusion The diffusion. |
|
524 */ |
|
525 TInt CReverbEffect::SetDiffusion( TUint aDiffusion ) |
|
526 { |
|
527 TInt status(KErrNone); |
|
528 if(iReverbProxy) |
|
529 { |
|
530 TRAP(status,iReverbProxy->SetDiffusionL(aDiffusion)); |
|
531 } |
|
532 else |
|
533 { |
|
534 status = KErrNotReady; |
|
535 } |
|
536 return status; |
|
537 } |
|
538 |
|
539 /** |
|
540 * Sets the reverb reflections delay |
|
541 * @since 5.0 |
|
542 * @param aRefectionsDelay The reflection delay in ms. |
|
543 */ |
|
544 TInt CReverbEffect::SetReflectionsDelay( TUint aReflectionsDelay ) |
|
545 { |
|
546 TInt status(KErrNone); |
|
547 if(iReverbProxy) |
|
548 { |
|
549 TRAP(status,iReverbProxy->SetReflectionsDelayL(aReflectionsDelay)); |
|
550 } |
|
551 else |
|
552 { |
|
553 status = KErrNotReady; |
|
554 } |
|
555 return status; |
|
556 } |
|
557 |
|
558 /** |
|
559 * Sets the reverb reflections level in milli-dB |
|
560 * @since 5.0 |
|
561 * @param aRefectionsLevel The reflection level in mB |
|
562 */ |
|
563 TInt CReverbEffect::SetReflectionsLevel( TInt aReflectionsLevel ) |
|
564 { |
|
565 TInt status(KErrNone); |
|
566 if(iReverbProxy) |
|
567 { |
|
568 TRAP(status,iReverbProxy->SetReflectionsLevelL(aReflectionsLevel)); |
|
569 } |
|
570 else |
|
571 { |
|
572 status = KErrNotReady; |
|
573 } |
|
574 return status; |
|
575 } |
|
576 |
|
577 /** |
|
578 * Sets the reverb delay |
|
579 * @since 5.0 |
|
580 * @param aReverbDelay The reverb delay in ms |
|
581 */ |
|
582 TInt CReverbEffect::SetReverbDelay( TUint aReverbDelay ) |
|
583 { |
|
584 TInt status(KErrNone); |
|
585 if(iReverbProxy) |
|
586 { |
|
587 TRAP(status,iReverbProxy->SetReverbDelayL(aReverbDelay)); |
|
588 } |
|
589 else |
|
590 { |
|
591 status = KErrNotReady; |
|
592 } |
|
593 return status; |
|
594 } |
|
595 |
|
596 /** |
|
597 * Sets the reverb level |
|
598 * @since 5.0 |
|
599 * @param aReverbLevel The reverb level in mB |
|
600 */ |
|
601 TInt CReverbEffect::SetReverbLevel( TInt aReverbLevel ) |
|
602 { |
|
603 TInt status(KErrNone); |
|
604 if(iReverbProxy) |
|
605 { |
|
606 TRAP(status,iReverbProxy->SetReverbLevelL(aReverbLevel)); |
|
607 } |
|
608 else |
|
609 { |
|
610 status = KErrNotReady; |
|
611 } |
|
612 return status; |
|
613 } |
|
614 |
|
615 /** |
|
616 * Sets the room HF level ratio |
|
617 * @since 5.0 |
|
618 * @param aRoomHFLevel The room high frequency ratio |
|
619 */ |
|
620 TInt CReverbEffect::SetRoomHFLevel( TInt aRoomHFLevel ) |
|
621 { |
|
622 TInt status(KErrNone); |
|
623 if(iReverbProxy) |
|
624 { |
|
625 TRAP(status,iReverbProxy->SetRoomHFLevelL(aRoomHFLevel)); |
|
626 } |
|
627 else |
|
628 { |
|
629 status = KErrNotReady; |
|
630 } |
|
631 return status; |
|
632 } |
|
633 |
|
634 /** |
|
635 * Sets the room level value in milli-dB |
|
636 * @since 5.0 |
|
637 * @param aRoomLevel The room level |
|
638 */ |
|
639 TInt CReverbEffect::SetRoomLevel( TInt aRoomLevel ) |
|
640 { |
|
641 TInt status(KErrNone); |
|
642 if(iReverbProxy) |
|
643 { |
|
644 TRAP(status,iReverbProxy->SetRoomLevelL(aRoomLevel)); |
|
645 } |
|
646 else |
|
647 { |
|
648 status = KErrNotReady; |
|
649 } |
|
650 return status; |
|
651 } |
|
652 |
|
653 /** |
|
654 * Gets the total delay maximum in milliseconds |
|
655 * @since 5.0 |
|
656 * @return reverb delay maximum |
|
657 */ |
|
658 TInt CReverbEffect::DelayMax(TUint &aDelayMax) |
|
659 { |
|
660 TInt status(KErrNone); |
|
661 if(iReverbProxy) |
|
662 { |
|
663 aDelayMax = iReverbProxy->DelayMax(); |
|
664 } |
|
665 else |
|
666 { |
|
667 status = KErrNotReady; |
|
668 } |
|
669 return status; |
|
670 } |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 // From MAudioEffectControl |
|
676 /** |
|
677 * Disable the effect |
|
678 * @since 5.0 |
|
679 */ |
|
680 TInt CReverbEffect::Disable() |
|
681 { |
|
682 TInt status(KErrNone); |
|
683 if(iReverbProxy) |
|
684 { |
|
685 TRAP(status,iReverbProxy->DisableL()); |
|
686 } |
|
687 else |
|
688 { |
|
689 status = KErrNotReady; |
|
690 } |
|
691 return status; |
|
692 } |
|
693 |
|
694 /** |
|
695 * Enable the effect |
|
696 * @since 5.0 |
|
697 */ |
|
698 TInt CReverbEffect::Enable() |
|
699 { |
|
700 TInt status(KErrNone); |
|
701 if(iReverbProxy) |
|
702 { |
|
703 TRAP(status,iReverbProxy->EnableL()); |
|
704 } |
|
705 else |
|
706 { |
|
707 status = KErrNotReady; |
|
708 } |
|
709 return status; |
|
710 } |
|
711 |
|
712 /** |
|
713 * Enforce the effect. |
|
714 * @since 5.0 |
|
715 * @param aEnforced Indicate the effect is to be enforced or not. ETrue = Enforced. |
|
716 */ |
|
717 TInt CReverbEffect::Enforce( TBool &aEnforced ) |
|
718 { |
|
719 TInt status(KErrNone); |
|
720 if(iReverbProxy) |
|
721 { |
|
722 TRAP(status,iReverbProxy->EnforceL(aEnforced)); |
|
723 } |
|
724 else |
|
725 { |
|
726 status = KErrNotReady; |
|
727 } |
|
728 return status; |
|
729 } |
|
730 |
|
731 /** |
|
732 * Check if this effect object currently has update rights. |
|
733 * A client can lose update rights in some hardware platforms where there are a limited |
|
734 * number of instances of an effect that can exist at the same time. When an effect instance |
|
735 * has lost update rights the user can still change settings, but any calls to Apply the |
|
736 * settings will be deferred until update rights are regained. |
|
737 * @since 5.0 |
|
738 * @return ETrue if this object currently has rights to update the settings of this effect, |
|
739 * EFalse otherwise. |
|
740 */ |
|
741 TInt CReverbEffect::HaveUpdateRights(TBool &aHaveUpdateRights) |
|
742 { |
|
743 TInt status(KErrNone); |
|
744 if(iReverbProxy) |
|
745 { |
|
746 aHaveUpdateRights = iReverbProxy->HaveUpdateRights(); |
|
747 } |
|
748 else |
|
749 { |
|
750 status = KErrNotReady; |
|
751 } |
|
752 return status; |
|
753 } |
|
754 |
|
755 /** |
|
756 * Check if the effect is enabled |
|
757 * @since 5.0 |
|
758 * @return ETrue if the effect is enabled, EFalse if the effect is disabled. |
|
759 */ |
|
760 TInt CReverbEffect::IsEnabled(TBool &aEnabled) |
|
761 { |
|
762 TInt status(KErrNone); |
|
763 if(iReverbProxy) |
|
764 { |
|
765 aEnabled = iReverbProxy->IsEnabled(); |
|
766 } |
|
767 else |
|
768 { |
|
769 status = KErrNotReady; |
|
770 } |
|
771 return status; |
|
772 } |
|
773 |
|
774 /** |
|
775 * Check if the effect is enforced. |
|
776 * @since 5.0 |
|
777 * @return ETrue if the effect is enforced, EFalse if the effect isn ot enforced. |
|
778 */ |
|
779 TInt CReverbEffect::IsEnforced(TBool &aEnforced) |
|
780 { |
|
781 TInt status(KErrNone); |
|
782 if(iReverbProxy) |
|
783 { |
|
784 aEnforced = iReverbProxy->IsEnforced(); |
|
785 } |
|
786 else |
|
787 { |
|
788 status = KErrNotReady; |
|
789 } |
|
790 return status; |
|
791 } |
|
792 |
|
793 /* |
|
794 * Get the unique identifier of the audio effect |
|
795 * @since 5.0 |
|
796 * @return Unique identifier of the audio effect object. |
|
797 */ |
|
798 TInt CReverbEffect::Uid(TUid &aUid) |
|
799 { |
|
800 TInt status(KErrNone); |
|
801 if(iReverbProxy) |
|
802 { |
|
803 aUid = iReverbProxy->Uid(); |
|
804 } |
|
805 else |
|
806 { |
|
807 status = KErrNotReady; |
|
808 } |
|
809 return status; |
|
810 } |
|
811 // From MAudioEffectControl Ends |
|
812 |
|
813 |
|
814 // From CEffectControlBase begins |
|
815 void CReverbEffect::Event( TEffectControlEvent aEvent ) |
|
816 { |
|
817 TInt status(KErrNone); |
|
818 // Controller Loaded with ECIBuilderCreated |
|
819 if ( aEvent == ECIBuilderCreated ) |
|
820 { |
|
821 RDebug::Print(_L("Deleting Proxy")); |
|
822 status = DeleteEffectProxy(); |
|
823 RDebug::Print(_L("Deleting Proxy [%d]"),status); |
|
824 status = CreateEffectProxy(); |
|
825 RDebug::Print(_L("Creating Proxy [%d]"),status); |
|
826 if(status == KErrNone) |
|
827 { |
|
828 SavePreviousSettings(); |
|
829 } |
|
830 else |
|
831 { |
|
832 for ( TInt i = 0; i < iObservers.Count(); i++ ) |
|
833 { |
|
834 iObservers[i]->Event(this,MAudioEffectControl::KDisabled,NULL); |
|
835 } |
|
836 } |
|
837 } |
|
838 else if ( aEvent == EMessageHandlerDeleted ) |
|
839 { |
|
840 if(status == KErrNone) |
|
841 { |
|
842 DeleteEffectProxy(); |
|
843 } |
|
844 } |
|
845 } |
|
846 |
|
847 // From CEffectControlBase ends |
|
848 TInt CReverbEffect::GetCEnvironmentalReverb( CEnvironmentalReverb*& aOutEnvRev ) |
|
849 { |
|
850 TInt status(KErrNotFound); |
|
851 if ( iReverbProxy ) |
|
852 { |
|
853 aOutEnvRev = iReverbProxy; |
|
854 status = KErrNone; |
|
855 } |
|
856 return status; |
|
857 } |
|
858 |
|
859 TInt CReverbEffect::CreateEffectProxy() |
|
860 { |
|
861 TInt status(KErrNone); |
|
862 status = GetMessageHandle(iMsgHndlrHandlePckg); |
|
863 if(status != KErrNone) |
|
864 { |
|
865 return status; |
|
866 } |
|
867 iCustomCommand = GetCustomCommand(); |
|
868 if(!iCustomCommand) |
|
869 { |
|
870 return KErrNotReady; |
|
871 } |
|
872 |
|
873 TRAP(status,iReverbProxy = CEnvironmentalReverbProxy::NewL(iMsgHndlrHandlePckg, *iCustomCommand, NULL)); |
|
874 if(status == KErrNone) |
|
875 { |
|
876 TRAP(status,iReverbProxy->RegisterObserverL(*this)); |
|
877 } |
|
878 |
|
879 return status; |
|
880 } |
|
881 |
|
882 TInt CReverbEffect::DeleteEffectProxy() |
|
883 { |
|
884 TInt status(KErrNone); |
|
885 if(iReverbProxy) |
|
886 { |
|
887 iPrevReverbProxy = iReverbProxy; |
|
888 } |
|
889 iReverbProxy = NULL; |
|
890 return status; |
|
891 } |
|
892 |
|
893 TInt CReverbEffect::SavePreviousSettings() |
|
894 { |
|
895 TInt status(KErrNone); |
|
896 if(iPrevReverbProxy) |
|
897 { |
|
898 TInt decayRatio = iPrevReverbProxy->DecayHFRatio(); |
|
899 TRAP(status , iReverbProxy->SetDecayHFRatioL(decayRatio)); |
|
900 |
|
901 TInt decayTime = iPrevReverbProxy->DecayTime(); |
|
902 TRAP(status , iReverbProxy->SetDecayTimeL(decayTime)); |
|
903 |
|
904 TInt density = iPrevReverbProxy->Density(); |
|
905 TRAP(status , iReverbProxy->SetDensityL(density)); |
|
906 |
|
907 TInt diffusion = iPrevReverbProxy->Diffusion(); |
|
908 TRAP(status , iReverbProxy->SetDiffusionL(diffusion)); |
|
909 |
|
910 TInt refDelay = iPrevReverbProxy->ReflectionsDelay(); |
|
911 TRAP(status , iReverbProxy->SetReflectionsDelayL(refDelay)); |
|
912 |
|
913 TInt refLevel = iPrevReverbProxy->ReflectionsLevel(); |
|
914 TRAP(status , iReverbProxy->SetReflectionsLevelL(refLevel)); |
|
915 |
|
916 TInt reverbDelay = iPrevReverbProxy->ReverbDelay(); |
|
917 TRAP(status , iReverbProxy->SetReverbDelayL(reverbDelay)); |
|
918 |
|
919 TInt reverbLevel = iPrevReverbProxy->ReverbLevel(); |
|
920 TRAP(status , iReverbProxy->SetReverbLevelL(reverbLevel)); |
|
921 |
|
922 TInt roomHfLevel = iPrevReverbProxy->RoomHFLevel(); |
|
923 TRAP(status , iReverbProxy->SetRoomHFLevelL(roomHfLevel)); |
|
924 |
|
925 TInt roomLevel = iPrevReverbProxy->RoomLevel(); |
|
926 TRAP(status , iReverbProxy->SetRoomLevelL(roomLevel)); |
|
927 |
|
928 TBool enforce = iPrevReverbProxy->IsEnforced(); |
|
929 iReverbProxy->EnforceL(enforce); |
|
930 |
|
931 TBool enable = iPrevReverbProxy->IsEnabled(); |
|
932 if(enable) |
|
933 { |
|
934 iReverbProxy->EnableL(); |
|
935 } |
|
936 |
|
937 delete iPrevReverbProxy; |
|
938 iPrevReverbProxy = NULL; |
|
939 } |
|
940 return status; |
|
941 } |
|
942 |
|
943 void CReverbEffect::EffectChanged( const CAudioEffect* /*aObservedEffect*/, TUint8 aEvent ) |
|
944 { |
|
945 for ( TInt i = 0; i < iObservers.Count(); i++ ) |
|
946 { |
|
947 iObservers[i]->Event(this,aEvent,NULL); |
|
948 } |
|
949 } |
|
950 |
|
951 // End of file |