|
1 /* |
|
2 * Copyright (c) 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: Implementation of the base class for effects. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #ifdef _DEBUG |
|
23 #include <e32svr.h> |
|
24 #endif |
|
25 #include <AudioEffectBase.h> |
|
26 #include <MAudioEffectObserver.h> |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CAudioEffect::CAudioEffect |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 EXPORT_C CAudioEffect::CAudioEffect() |
|
37 : iEnabled(EFalse), |
|
38 iEnforced(EFalse), |
|
39 iHaveUpdateRights(ETrue) |
|
40 { |
|
41 } |
|
42 |
|
43 |
|
44 // Destructor |
|
45 EXPORT_C CAudioEffect::~CAudioEffect() |
|
46 { |
|
47 iObservers.Close(); |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CAudioEffect::IsEnable |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 EXPORT_C TBool CAudioEffect::IsEnabled() const |
|
55 { |
|
56 return iEnabled; |
|
57 } |
|
58 |
|
59 // ----------------------------------------------------------------------------- |
|
60 // CAudioEffect::Enable |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 EXPORT_C void CAudioEffect::EnableL() |
|
64 { |
|
65 iEnabled = ETrue; |
|
66 ApplyL(); |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CAudioEffect::Disable |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 EXPORT_C void CAudioEffect::DisableL() |
|
74 { |
|
75 iEnabled = EFalse; |
|
76 ApplyL(); |
|
77 } |
|
78 |
|
79 // ----------------------------------------------------------------------------- |
|
80 // CAudioEffect::Enforce |
|
81 // ----------------------------------------------------------------------------- |
|
82 // |
|
83 EXPORT_C void CAudioEffect::EnforceL( |
|
84 TBool aEnforced ) |
|
85 { |
|
86 iEnforced = aEnforced; |
|
87 ApplyL(); |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CAudioEffect::HaveUpdateRights |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 EXPORT_C TBool CAudioEffect::HaveUpdateRights() const |
|
95 { |
|
96 return iHaveUpdateRights; |
|
97 } |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CAudioEffect::IsEnforced |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 EXPORT_C TBool CAudioEffect::IsEnforced() const |
|
104 { |
|
105 return iEnforced; |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CVolume::RegisterObserverL |
|
110 // ----------------------------------------------------------------------------- |
|
111 // |
|
112 EXPORT_C void CAudioEffect::RegisterObserverL( |
|
113 MAudioEffectObserver& aObserver ) |
|
114 { |
|
115 User::LeaveIfError(iObservers.Append(&aObserver)); |
|
116 } |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // CVolume::UnRegisterObserver |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 EXPORT_C void CAudioEffect::UnRegisterObserver( |
|
123 MAudioEffectObserver& aObserver ) |
|
124 { |
|
125 TInt index = iObservers.Find(&aObserver); |
|
126 if( index != KErrNotFound ) |
|
127 { |
|
128 iObservers.Remove(index); |
|
129 } |
|
130 } |
|
131 |
|
132 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
133 |
|
134 // End of File |