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