15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <tms.h> |
18 #include <tms.h> |
19 #include <tmseffectobsrvr.h> |
19 #include <tmseffectobsrvr.h> |
|
20 #include "tmsutility.h" |
20 #include "tmscallproxy.h" |
21 #include "tmscallproxy.h" |
21 #include "tmsqueuehandler.h" |
22 #include "tmsqueuehandler.h" |
22 #include "tmsgaineffectbodyimpl.h" |
23 #include "tmsgaineffectbodyimpl.h" |
23 |
24 |
24 using namespace TMS; |
25 using namespace TMS; |
25 |
26 |
26 TMSGainEffectBodyImpl::TMSGainEffectBodyImpl() : |
27 TMSGainEffectBodyImpl::TMSGainEffectBodyImpl() : |
27 iObserver(NULL), |
28 iObserver(NULL), |
28 iProxy(NULL), |
29 iProxy(NULL), |
29 iParentEffect(NULL) |
30 iParent(NULL) |
30 { |
31 { |
31 } |
32 } |
32 |
33 |
33 TMSGainEffectBodyImpl::~TMSGainEffectBodyImpl() |
34 TMSGainEffectBodyImpl::~TMSGainEffectBodyImpl() |
34 { |
35 { |
|
36 TRACE_PRN_FN_ENT; |
|
37 TRACE_PRN_FN_EXT; |
35 } |
38 } |
36 |
39 |
37 gint TMSGainEffectBodyImpl::Create(TMSGainEffectBody*& bodyimpl) |
40 gint TMSGainEffectBodyImpl::Create(TMSGainEffectBody*& bodyimpl) |
38 { |
41 { |
39 gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); |
42 gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); |
71 ret = TMS_RESULT_ALREADY_EXIST; |
74 ret = TMS_RESULT_ALREADY_EXIST; |
72 } |
75 } |
73 return ret; |
76 return ret; |
74 } |
77 } |
75 |
78 |
76 /** |
|
77 * Remove a stream observer from this stream. |
|
78 * |
|
79 * This function can be called at any time. It is recommended to remove |
|
80 * observer after calling Deinit() on stream. Else observer may receive |
|
81 * a callback that is alread dispatched. |
|
82 * |
|
83 * @param obsrvr |
|
84 * The listener to remove. |
|
85 * |
|
86 * @return |
|
87 * TMS_RESULT_SUCCESS if the obsrvr is removed successfully from list. |
|
88 * TMS_RESULT_DOES_NOT_EXIST if obsrvr is not already in the list. |
|
89 * |
|
90 */ |
|
91 gint TMSGainEffectBodyImpl::RemoveObserver(TMSEffectObserver& obsrvr) |
79 gint TMSGainEffectBodyImpl::RemoveObserver(TMSEffectObserver& obsrvr) |
92 { |
80 { |
93 gint ret(TMS_RESULT_SUCCESS); |
81 gint ret(TMS_RESULT_SUCCESS); |
94 if (&obsrvr == iObserver) |
82 if (&obsrvr == iObserver) |
95 { |
83 { |
149 gint ret(TMS_RESULT_SUCCESS); |
137 gint ret(TMS_RESULT_SUCCESS); |
150 effecttype = TMS_EFFECT_GAIN; |
138 effecttype = TMS_EFFECT_GAIN; |
151 return ret; |
139 return ret; |
152 } |
140 } |
153 |
141 |
154 gint TMSGainEffectBodyImpl::SetParentEffect(TMSEffect*& parenteffect) |
142 void TMSGainEffectBodyImpl::SetParent(TMSEffect*& parent) |
155 { |
143 { |
156 gint ret(TMS_RESULT_SUCCESS); |
144 iParent = parent; |
157 iParentEffect = NULL; |
|
158 iParentEffect = parenteffect; |
|
159 return ret; |
|
160 } |
145 } |
161 |
146 |
162 void TMSGainEffectBodyImpl::SetProxy(TMSCallProxy* aProxy, |
147 void TMSGainEffectBodyImpl::SetProxy(TMSCallProxy* aProxy, |
163 gpointer queuehandler) |
148 gpointer queuehandler) |
164 { |
149 { |
165 iProxy = aProxy; |
150 iProxy = aProxy; |
166 ((CQueueHandler*) queuehandler)->AddObserver(*this, TMS_EFFECT_GAIN); |
151 if (queuehandler) |
|
152 { |
|
153 ((TMSQueueHandler*) queuehandler)->AddObserver(*this, TMS_EFFECT_GAIN); |
|
154 } |
167 } |
155 } |
168 |
156 |
169 void TMSGainEffectBodyImpl::QueueEvent(TInt aEventType, TInt aError, |
157 void TMSGainEffectBodyImpl::QueueEvent(TInt aEventType, TInt aError, |
170 void* /*user_data*/) |
158 void* /*user_data*/) |
171 { |
159 { |
172 TMSSignalEvent event; |
160 TMSSignalEvent event; |
173 |
|
174 event.type = TMS_EVENT_EFFECT_GAIN_CHANGED; |
161 event.type = TMS_EVENT_EFFECT_GAIN_CHANGED; |
175 event.reason = aError; |
162 event.reason = aError; |
176 |
163 |
177 switch (aEventType) |
164 switch (aEventType) |
178 { |
165 { |
179 case TMS_EVENT_EFFECT_GAIN_CHANGED: |
166 case TMS_EVENT_EFFECT_GAIN_CHANGED: |
180 { |
167 { |
181 if (iObserver && iParentEffect) |
168 if (iObserver && iParent) |
182 { |
169 { |
183 iObserver->EffectsEvent(iParentEffect, event); |
170 iObserver->EffectsEvent(iParent, event); |
184 } |
171 } |
185 } |
172 } |
186 break; |
173 break; |
187 default: |
174 default: |
188 break; |
175 break; |
189 } |
176 } |
190 } |
177 } |
191 |
178 |
192 // End of file |
|