22 |
22 |
23 using namespace QTMS; |
23 using namespace QTMS; |
24 using namespace TMS; |
24 using namespace TMS; |
25 |
25 |
26 QTMSGlobalVolEffectImpl::QTMSGlobalVolEffectImpl() |
26 QTMSGlobalVolEffectImpl::QTMSGlobalVolEffectImpl() |
27 { |
27 { |
28 } |
28 } |
29 |
29 |
30 QTMSGlobalVolEffectImpl::~QTMSGlobalVolEffectImpl() |
30 QTMSGlobalVolEffectImpl::~QTMSGlobalVolEffectImpl() |
31 { |
31 { |
32 RemoveObserver(*this); |
32 RemoveObserver(*this); |
33 } |
33 } |
34 |
34 |
35 gint QTMSGlobalVolEffectImpl::Create(QTMSEffect*& qglobalvol, |
35 gint QTMSGlobalVolEffectImpl::Create(QTMSEffect*& qglobalvol, TMS::TMSEffect*& tmsglobalvol) |
36 TMS::TMSEffect*& tmsglobalvol) |
36 { |
37 { |
|
38 gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY); |
37 gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY); |
39 QTMSGlobalVolEffectImpl* self = new QTMSGlobalVolEffectImpl(); |
38 QTMSGlobalVolEffectImpl* self = new QTMSGlobalVolEffectImpl(); |
40 if (self) |
39 if (self) { |
41 { |
|
42 ret = self->PostConstruct(); |
40 ret = self->PostConstruct(); |
43 if (ret != QTMS_RESULT_SUCCESS) |
41 if (ret != QTMS_RESULT_SUCCESS) { |
44 { |
|
45 delete self; |
42 delete self; |
46 self = NULL; |
43 self = NULL; |
47 } |
44 } |
48 self->iEffect = tmsglobalvol; |
45 self->iEffect = tmsglobalvol; |
49 ret = self->AddObserver(*self, NULL); |
46 ret = self->AddObserver(*self, NULL); |
50 } |
47 } |
51 qglobalvol = self; |
48 qglobalvol = self; |
52 return ret; |
49 return ret; |
53 } |
50 } |
54 |
51 |
55 gint QTMSGlobalVolEffectImpl::PostConstruct() |
52 gint QTMSGlobalVolEffectImpl::PostConstruct() |
56 { |
53 { |
57 gint ret(QTMS_RESULT_SUCCESS); |
54 gint ret(QTMS_RESULT_SUCCESS); |
58 return ret; |
55 return ret; |
59 } |
56 } |
60 |
57 |
61 gint QTMSGlobalVolEffectImpl::AddObserver(TMS::TMSEffectObserver& obsrvr, |
58 gint QTMSGlobalVolEffectImpl::AddObserver(TMS::TMSEffectObserver& obsrvr, gpointer user_data) |
62 gpointer user_data) |
59 { |
63 { |
|
64 gint ret(QTMS_RESULT_SUCCESS); |
60 gint ret(QTMS_RESULT_SUCCESS); |
65 |
61 |
66 if (iEffect) |
62 if (iEffect) { |
67 { |
63 ret = static_cast<TMSGlobalVolEffect*> (iEffect)->AddObserver(obsrvr, user_data); |
68 ret = static_cast<TMSGlobalVolEffect*> (iEffect)->AddObserver(obsrvr, |
64 } |
69 user_data); |
|
70 } |
|
71 return ret; |
65 return ret; |
72 } |
66 } |
73 |
67 |
74 gint QTMSGlobalVolEffectImpl::RemoveObserver(TMS::TMSEffectObserver& obsrvr) |
68 gint QTMSGlobalVolEffectImpl::RemoveObserver(TMS::TMSEffectObserver& obsrvr) |
75 { |
69 { |
76 gint ret(QTMS_RESULT_SUCCESS); |
70 gint ret(QTMS_RESULT_SUCCESS); |
77 |
71 |
78 if (iEffect) |
72 if (iEffect) { |
79 { |
73 ret = static_cast<TMSGlobalVolEffect*> (iEffect)->RemoveObserver(obsrvr); |
80 ret = static_cast<TMSGlobalVolEffect*> (iEffect)->RemoveObserver( |
74 } |
81 obsrvr); |
|
82 } |
|
83 return ret; |
75 return ret; |
84 } |
76 } |
85 |
77 |
86 void QTMSGlobalVolEffectImpl::EffectsEvent(const TMS::TMSEffect& /*tmseffect*/, |
78 void QTMSGlobalVolEffectImpl::EffectsEvent(const TMS::TMSEffect& /*tmseffect*/, |
87 TMS::TMSSignalEvent event) |
79 TMS::TMSSignalEvent event) |
88 { |
80 { |
89 QTMSSignalEvent qevent; |
81 QTMSSignalEvent qevent; |
90 |
82 |
91 qevent.type = event.type; |
83 qevent.type = event.type; |
92 qevent.reason = event.reason; |
84 qevent.reason = event.reason; |
93 qevent.curr_state = event.curr_state; |
85 qevent.curr_state = event.curr_state; |
94 qevent.prev_state = event.prev_state; |
86 qevent.prev_state = event.prev_state; |
95 qevent.event_data = event.event_data; |
87 qevent.event_data = event.event_data; |
96 qevent.user_data = event.user_data; |
88 qevent.user_data = event.user_data; |
97 |
89 |
98 emit QTMS::QTMSGlobalVolEffect::EffectsEvent(static_cast<QTMSEffect&> |
90 emit QTMS::QTMSGlobalVolEffect::EffectsEvent(static_cast<QTMSEffect&> (*this), qevent); |
99 (*this), qevent); |
91 } |
100 } |
|
101 |
92 |
102 // End of file |
93 // End of file |