1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: Volume Interface Implementation |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <stdio.h> |
18 #include <stdio.h> |
19 #include <stdlib.h> |
19 #include <stdlib.h> |
20 #include <assert.h> |
20 #include <assert.h> |
21 |
21 |
22 #include "xavolumeitf.h" |
22 #include "xavolumeitf.h" |
23 |
23 |
24 #include "xavolumeitfadaptation.h" |
24 #include "xavolumeitfadaptation.h" |
25 #include "xanokiavolumeextitfadaptationmmf.h" |
25 #include "xanokiavolumeextitfadaptationmmf.h" |
26 /** |
26 /** |
27 * XAVolumeItfImpl* GetImpl(XAVolumeItf self) |
27 * XAVolumeItfImpl* GetImpl(XAVolumeItf self) |
28 * Description: Validated interface pointer and cast it to implementations pointer. |
28 * Description: Validated interface pointer and cast it to implementations pointer. |
29 **/ |
29 **/ |
30 static XAVolumeItfImpl* GetImpl(XAVolumeItf self) |
30 static XAVolumeItfImpl* GetImpl(XAVolumeItf self) |
31 { |
31 { |
32 if(self) |
32 if (self) |
33 { |
33 { |
34 XAVolumeItfImpl* impl = (XAVolumeItfImpl*)(*self); |
34 XAVolumeItfImpl* impl = (XAVolumeItfImpl*) (*self); |
35 if(impl && impl == impl->self) |
35 if (impl && impl == impl->self) |
36 { |
36 { |
37 return impl; |
37 return impl; |
38 } |
38 } |
39 } |
39 } |
40 return NULL; |
40 return NULL; |
41 } |
41 } |
42 |
42 |
43 /** |
43 /** |
44 * Base interface XAVolumeItf implementation |
44 * Base interface XAVolumeItf implementation |
45 */ |
45 */ |
46 |
46 |
47 /** |
47 /** |
48 * XAresult XAVolumeItfImpl_SetVolumeLevel(XAVolumeItf self, XAmillibel level) |
48 * XAresult XAVolumeItfImpl_SetVolumeLevel(XAVolumeItf self, XAmillibel level) |
49 * Description: Sets the object's volume level. |
49 * Description: Sets the object's volume level. |
50 **/ |
50 **/ |
51 XAresult XAVolumeItfImpl_SetVolumeLevel(XAVolumeItf self, XAmillibel level) |
51 XAresult XAVolumeItfImpl_SetVolumeLevel(XAVolumeItf self, XAmillibel level) |
52 { |
52 { |
53 XAVolumeItfImpl *impl = GetImpl(self); |
53 XAVolumeItfImpl *impl = GetImpl(self); |
54 XAresult ret = XA_RESULT_SUCCESS; |
54 XAresult ret = XA_RESULT_SUCCESS; |
55 |
55 |
56 XAmillibel maximumLevel = 0; |
56 XAmillibel maximumLevel = 0; |
57 DEBUG_API("->XAVolumeItfImpl_SetVolumeLevel"); |
57 DEBUG_API("->XAVolumeItfImpl_SetVolumeLevel"); |
58 |
58 |
59 /* check maximum volume level */ |
59 /* check maximum volume level */ |
60 if(XAVolumeItfImpl_GetMaxVolumeLevel(self, &maximumLevel) != XA_RESULT_SUCCESS) |
60 if (XAVolumeItfImpl_GetMaxVolumeLevel(self, &maximumLevel) |
61 { |
61 != XA_RESULT_SUCCESS) |
|
62 { |
62 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
63 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
63 DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); |
64 DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); |
64 /* cannot solve maximum volume level */ |
65 /* cannot solve maximum volume level */ |
65 return XA_RESULT_PARAMETER_INVALID; |
66 return XA_RESULT_PARAMETER_INVALID; |
66 } |
67 } |
67 |
68 |
68 if(!impl || level > maximumLevel) |
69 if (!impl || level > maximumLevel || !impl->adapCtx) |
69 { |
70 { |
70 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
71 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
71 DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); |
72 DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); |
72 /* invalid parameter */ |
73 /* invalid parameter */ |
73 return XA_RESULT_PARAMETER_INVALID; |
74 return XA_RESULT_PARAMETER_INVALID; |
74 } |
75 } |
75 |
76 |
76 |
|
77 ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); |
77 ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); |
78 if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) |
78 if (ret == XA_RESULT_PARAMETER_INVALID || ret |
79 { |
79 == XA_RESULT_PRECONDITIONS_VIOLATED) |
|
80 { |
80 DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); |
81 DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); |
81 return ret; |
82 return ret; |
82 } |
83 } |
83 if(impl->adapCtx->fwtype == FWMgrFWGST) |
84 if (impl->adapCtx->fwtype == FWMgrFWGST) |
84 { |
85 { |
85 ret = XAVolumeItfAdapt_SetVolumeLevel((XAAdaptationGstCtx*)impl->adapCtx, level); |
86 ret = XAVolumeItfAdapt_SetVolumeLevel( |
|
87 (XAAdaptationGstCtx*) impl->adapCtx, level); |
86 } |
88 } |
87 else |
89 else |
88 { |
90 { |
89 impl->volumeLevel = level; |
91 impl->volumeLevel = level; |
90 } |
92 } |
91 |
93 |
92 if(ret == XA_RESULT_SUCCESS) |
94 if (ret == XA_RESULT_SUCCESS) |
93 { |
95 { |
94 impl->volumeLevel = level; |
96 impl->volumeLevel = level; |
95 } |
97 } |
96 |
98 |
97 XAAdaptationBase_ThreadExit(impl->adapCtx); |
99 XAAdaptationBase_ThreadExit(impl->adapCtx); |
98 |
100 |
99 DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); |
101 DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); |
100 return ret ; |
102 return ret; |
101 } |
103 } |
102 |
104 |
103 /** |
105 /** |
104 * XAresult XAVolumeItfImpl_GetVolumeLevel(XAVolumeItf self, XAmillibel *pLevel) |
106 * XAresult XAVolumeItfImpl_GetVolumeLevel(XAVolumeItf self, XAmillibel *pLevel) |
105 * Description: Gets the object’s volume level. |
107 * Description: Gets the object’s volume level. |
106 **/ |
108 **/ |
107 XAresult XAVolumeItfImpl_GetVolumeLevel(XAVolumeItf self, XAmillibel *pLevel) |
109 XAresult XAVolumeItfImpl_GetVolumeLevel(XAVolumeItf self, XAmillibel *pLevel) |
108 { |
110 { |
109 XAresult ret = XA_RESULT_SUCCESS; |
111 XAresult ret = XA_RESULT_SUCCESS; |
110 XAVolumeItfImpl *impl = GetImpl(self); |
112 XAVolumeItfImpl *impl = GetImpl(self); |
111 DEBUG_API("->XAVolumeItfImpl_GetVolumeLevel"); |
113 DEBUG_API("->XAVolumeItfImpl_GetVolumeLevel"); |
112 |
114 |
113 if(!impl || !pLevel) |
115 if (!impl || !pLevel) |
114 { |
116 { |
115 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
117 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
116 DEBUG_API("<-XAVolumeItfImpl_GetVolumeLevel"); |
118 DEBUG_API("<-XAVolumeItfImpl_GetVolumeLevel"); |
117 /* invalid parameter */ |
119 /* invalid parameter */ |
118 return XA_RESULT_PARAMETER_INVALID; |
120 return XA_RESULT_PARAMETER_INVALID; |
119 } |
121 } |
120 |
122 |
121 *pLevel = impl->volumeLevel; |
123 *pLevel = impl->volumeLevel; |
122 |
124 |
123 DEBUG_API("<-XAVolumeItfImpl_GetVolumeLevel"); |
125 DEBUG_API("<-XAVolumeItfImpl_GetVolumeLevel"); |
124 return ret; |
126 return ret; |
125 } |
127 } |
126 |
128 |
127 /** |
129 /** |
128 * XAresult XAVolumeItfImpl_GetMaxVolumeLevel(XAVolumeItf self, XAmillibel *pMaxLevel) |
130 * XAresult XAVolumeItfImpl_GetMaxVolumeLevel(XAVolumeItf self, XAmillibel *pMaxLevel) |
129 * Description: Gets the maximum supported level. |
131 * Description: Gets the maximum supported level. |
130 **/ |
132 **/ |
131 XAresult XAVolumeItfImpl_GetMaxVolumeLevel(XAVolumeItf self, XAmillibel *pMaxLevel) |
133 XAresult XAVolumeItfImpl_GetMaxVolumeLevel(XAVolumeItf self, |
132 { |
134 XAmillibel *pMaxLevel) |
|
135 { |
133 XAresult ret = XA_RESULT_SUCCESS; |
136 XAresult ret = XA_RESULT_SUCCESS; |
134 XAVolumeItfImpl *impl = GetImpl(self); |
137 XAVolumeItfImpl *impl = GetImpl(self); |
135 DEBUG_API("->XAVolumeItfImpl_GetVolumeLevel"); |
138 DEBUG_API("->XAVolumeItfImpl_GetVolumeLevel"); |
136 |
139 |
137 if(!impl || !pMaxLevel) |
140 if (!impl || !pMaxLevel || !impl->adapCtx) |
138 { |
141 { |
139 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
142 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
140 DEBUG_API("<-XAVolumeItfImpl_GetMaxVolumeLevel"); |
143 DEBUG_API("<-XAVolumeItfImpl_GetMaxVolumeLevel"); |
141 /* invalid parameter */ |
144 /* invalid parameter */ |
142 return XA_RESULT_PARAMETER_INVALID; |
145 return XA_RESULT_PARAMETER_INVALID; |
143 } |
146 } |
144 |
147 |
145 |
|
146 ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); |
148 ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); |
147 if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) |
149 if (ret == XA_RESULT_PARAMETER_INVALID || ret |
148 { |
150 == XA_RESULT_PRECONDITIONS_VIOLATED) |
|
151 { |
149 DEBUG_API("<-XAVolumeItfImpl_GetMaxVolumeLevel"); |
152 DEBUG_API("<-XAVolumeItfImpl_GetMaxVolumeLevel"); |
150 return ret; |
153 return ret; |
151 } |
154 } |
152 if(impl->adapCtx->fwtype == FWMgrFWGST) |
155 if (impl->adapCtx->fwtype == FWMgrFWGST) |
153 { |
156 { |
154 ret = XAVolumeItfAdapt_GetMaxVolumeLevel((XAAdaptationGstCtx*)impl->adapCtx, |
157 ret = XAVolumeItfAdapt_GetMaxVolumeLevel( |
155 pMaxLevel); |
158 (XAAdaptationGstCtx*) impl->adapCtx, pMaxLevel); |
156 } |
159 } |
157 else |
160 else |
158 { |
161 { |
159 *pMaxLevel = MAX_SUPPORT_VOLUME_LEVEL; |
162 *pMaxLevel = MAX_SUPPORT_VOLUME_LEVEL; |
160 } |
163 } |
161 |
164 |
162 XAAdaptationBase_ThreadExit(impl->adapCtx); |
165 XAAdaptationBase_ThreadExit(impl->adapCtx); |
163 |
166 |
164 DEBUG_API("<-XAVolumeItfImpl_GetMaxVolumeLevel"); |
167 DEBUG_API("<-XAVolumeItfImpl_GetMaxVolumeLevel"); |
165 return ret; |
168 return ret; |
166 } |
169 } |
167 |
170 |
168 /** |
171 /** |
169 * XAresult XAVolumeItfImpl_SetMute(XAVolumeItf self, XAboolean mute) |
172 * XAresult XAVolumeItfImpl_SetMute(XAVolumeItf self, XAboolean mute) |
170 * Description: Mutes or unmutes the object. |
173 * Description: Mutes or unmutes the object. |
171 **/ |
174 **/ |
172 XAresult XAVolumeItfImpl_SetMute(XAVolumeItf self, XAboolean mute) |
175 XAresult XAVolumeItfImpl_SetMute(XAVolumeItf self, XAboolean mute) |
173 { |
176 { |
174 XAresult ret = XA_RESULT_SUCCESS; |
177 XAresult ret = XA_RESULT_SUCCESS; |
175 XAVolumeItfImpl *impl = GetImpl(self); |
178 XAVolumeItfImpl *impl = GetImpl(self); |
176 DEBUG_API("->XAVolumeItfImpl_SetMute"); |
179 DEBUG_API("->XAVolumeItfImpl_SetMute"); |
177 |
180 |
178 if(!impl) |
181 if (!impl || !impl->adapCtx) |
179 { |
182 { |
180 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
183 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
181 DEBUG_API("<-XAVolumeItfImpl_SetMute"); |
184 DEBUG_API("<-XAVolumeItfImpl_SetMute"); |
182 /* invalid parameter */ |
185 /* invalid parameter */ |
183 return XA_RESULT_PARAMETER_INVALID; |
186 return XA_RESULT_PARAMETER_INVALID; |
184 } |
187 } |
185 |
188 |
186 |
|
187 ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); |
189 ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); |
188 if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) |
190 if (ret == XA_RESULT_PARAMETER_INVALID || ret |
189 { |
191 == XA_RESULT_PRECONDITIONS_VIOLATED) |
|
192 { |
190 DEBUG_API("<-XAVolumeItfImpl_SetMute"); |
193 DEBUG_API("<-XAVolumeItfImpl_SetMute"); |
191 return ret; |
194 return ret; |
192 } |
195 } |
193 /* check is mute state changed */ |
196 /* check is mute state changed */ |
194 if(mute != impl->mute) |
197 if (mute != impl->mute) |
195 { |
198 { |
196 if(impl->adapCtx->fwtype == FWMgrFWMMF) |
199 if (impl->adapCtx->fwtype == FWMgrFWMMF) |
197 { |
200 { |
198 ret = XANokiaVolumeExtItfAdapt_SetMute((XAAdaptationMMFCtx*)impl->adapCtx, mute); |
201 ret = XANokiaVolumeExtItfAdapt_SetMute( |
|
202 (XAAdaptationMMFCtx*) impl->adapCtx, mute); |
199 } |
203 } |
200 else |
204 else |
201 { |
205 { |
202 ret = XAVolumeItfAdapt_SetMute((XAAdaptationGstCtx*)impl->adapCtx, mute); |
206 ret = XAVolumeItfAdapt_SetMute( |
203 } |
207 (XAAdaptationGstCtx*) impl->adapCtx, mute); |
204 |
208 } |
205 if(ret == XA_RESULT_SUCCESS) |
209 |
206 { |
210 if (ret == XA_RESULT_SUCCESS) |
|
211 { |
207 impl->mute = mute; |
212 impl->mute = mute; |
208 } |
213 } |
209 } |
214 } |
210 |
215 |
211 XAAdaptationBase_ThreadExit(impl->adapCtx); |
216 XAAdaptationBase_ThreadExit(impl->adapCtx); |
212 |
217 |
213 DEBUG_API("<-XAVolumeItfImpl_SetMute"); |
218 DEBUG_API("<-XAVolumeItfImpl_SetMute"); |
214 return ret; |
219 return ret; |
215 } |
220 } |
216 |
221 |
217 /** |
222 /** |
218 * XAresult XAVolumeItfImpl_GetMute(XAVolumeItf self, XAboolean *pMute) |
223 * XAresult XAVolumeItfImpl_GetMute(XAVolumeItf self, XAboolean *pMute) |
219 * Description: Retrieves the object's state. |
224 * Description: Retrieves the object's state. |
220 **/ |
225 **/ |
221 XAresult XAVolumeItfImpl_GetMute(XAVolumeItf self, XAboolean *pMute) |
226 XAresult XAVolumeItfImpl_GetMute(XAVolumeItf self, XAboolean *pMute) |
222 { |
227 { |
223 XAresult ret = XA_RESULT_SUCCESS; |
228 XAresult ret = XA_RESULT_SUCCESS; |
224 XAVolumeItfImpl *impl = GetImpl(self); |
229 XAVolumeItfImpl *impl = GetImpl(self); |
225 DEBUG_API("->XAVolumeItfImpl_GetMute"); |
230 DEBUG_API("->XAVolumeItfImpl_GetMute"); |
226 |
231 |
227 if(!impl || !pMute) |
232 if (!impl || !pMute) |
228 { |
233 { |
229 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
234 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
230 DEBUG_API("<-XAVolumeItfImpl_GetMute"); |
235 DEBUG_API("<-XAVolumeItfImpl_GetMute"); |
231 /* invalid parameter */ |
236 /* invalid parameter */ |
232 return XA_RESULT_PARAMETER_INVALID; |
237 return XA_RESULT_PARAMETER_INVALID; |
233 } |
238 } |
234 |
239 |
235 *pMute = impl->mute; |
240 *pMute = impl->mute; |
236 |
241 |
237 DEBUG_API("<-XAVolumeItfImpl_GetMute"); |
242 DEBUG_API("<-XAVolumeItfImpl_GetMute"); |
238 return ret; |
243 return ret; |
239 } |
244 } |
240 |
245 |
241 /** |
246 /** |
242 * XAresult XAVolumeItfImpl_EnableStereoPosition(XAVolumeItf self, XAboolean enable) |
247 * XAresult XAVolumeItfImpl_EnableStereoPosition(XAVolumeItf self, XAboolean enable) |
243 * Description: Enables or disables the stereo positioning effect. |
248 * Description: Enables or disables the stereo positioning effect. |
244 **/ |
249 **/ |
245 XAresult XAVolumeItfImpl_EnableStereoPosition(XAVolumeItf self, XAboolean enable) |
250 XAresult XAVolumeItfImpl_EnableStereoPosition(XAVolumeItf self, |
246 { |
251 XAboolean enable) |
|
252 { |
247 XAresult ret = XA_RESULT_SUCCESS; |
253 XAresult ret = XA_RESULT_SUCCESS; |
248 XAVolumeItfImpl *impl = GetImpl(self); |
254 XAVolumeItfImpl *impl = GetImpl(self); |
249 DEBUG_API("->XAVolumeItfImpl_EnableStereoPosition"); |
255 DEBUG_API("->XAVolumeItfImpl_EnableStereoPosition"); |
250 |
256 |
251 if(!impl) |
257 if (!impl || !impl->adapCtx) |
252 { |
258 { |
253 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
259 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
254 DEBUG_API("<-XAVolumeItfImpl_EnableStereoPosition"); |
260 DEBUG_API("<-XAVolumeItfImpl_EnableStereoPosition"); |
255 /* invalid parameter */ |
261 /* invalid parameter */ |
256 return XA_RESULT_PARAMETER_INVALID; |
262 return XA_RESULT_PARAMETER_INVALID; |
257 } |
263 } |
258 |
264 |
259 |
|
260 ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); |
265 ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); |
261 if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) |
266 if (ret == XA_RESULT_PARAMETER_INVALID || ret |
262 { |
267 == XA_RESULT_PRECONDITIONS_VIOLATED) |
|
268 { |
263 DEBUG_API("<-XAVolumeItfImpl_EnableStereoPosition"); |
269 DEBUG_API("<-XAVolumeItfImpl_EnableStereoPosition"); |
264 return ret; |
270 return ret; |
265 } |
271 } |
266 /* Check is stereo position state changed */ |
272 /* Check is stereo position state changed */ |
267 if(enable != impl->enableStereoPos) |
273 if (enable != impl->enableStereoPos) |
268 { |
274 { |
269 if(impl->adapCtx->fwtype == FWMgrFWGST) |
275 if (impl->adapCtx->fwtype == FWMgrFWGST) |
270 { |
276 { |
271 ret = XAVolumeItfAdapt_EnableStereoPosition((XAAdaptationGstCtx*)impl->adapCtx, |
277 ret = XAVolumeItfAdapt_EnableStereoPosition( |
272 enable); |
278 (XAAdaptationGstCtx*) impl->adapCtx, enable); |
273 } |
279 } |
274 else |
280 else |
275 { |
281 { |
276 ret = XANokiaVolumeExtItfAdapt_EnableStereoPosition((XAAdaptationMMFCtx*)impl->adapCtx, |
282 ret = XANokiaVolumeExtItfAdapt_EnableStereoPosition( |
277 enable); |
283 (XAAdaptationMMFCtx*) impl->adapCtx, enable); |
278 } |
284 } |
279 if(ret == XA_RESULT_SUCCESS) |
285 if (ret == XA_RESULT_SUCCESS) |
280 { |
286 { |
281 impl->enableStereoPos = enable; |
287 impl->enableStereoPos = enable; |
282 } |
288 } |
283 } |
289 } |
284 |
290 |
285 XAAdaptationBase_ThreadExit(impl->adapCtx); |
291 XAAdaptationBase_ThreadExit(impl->adapCtx); |
286 |
292 |
287 DEBUG_API("<-XAVolumeItfImpl_EnableStereoPosition"); |
293 DEBUG_API("<-XAVolumeItfImpl_EnableStereoPosition"); |
288 return ret; |
294 return ret; |
289 } |
295 } |
290 |
296 |
291 /** |
297 /** |
292 * XAresult XAVolumeItfImpl_IsEnabledStereoPosition(XAVolumeItf self, |
298 * XAresult XAVolumeItfImpl_IsEnabledStereoPosition(XAVolumeItf self, |
293 * XAboolean *pEnable) |
299 * XAboolean *pEnable) |
294 * Description: Returns the enabled state of the stereo positioning effect. |
300 * Description: Returns the enabled state of the stereo positioning effect. |
295 **/ |
301 **/ |
296 XAresult XAVolumeItfImpl_IsEnabledStereoPosition(XAVolumeItf self, |
302 XAresult XAVolumeItfImpl_IsEnabledStereoPosition(XAVolumeItf self, |
297 XAboolean *pEnable) |
303 XAboolean *pEnable) |
298 { |
304 { |
299 XAresult ret = XA_RESULT_SUCCESS; |
305 XAresult ret = XA_RESULT_SUCCESS; |
300 XAVolumeItfImpl *impl = GetImpl(self); |
306 XAVolumeItfImpl *impl = GetImpl(self); |
301 DEBUG_API("->XAVolumeItfImpl_IsEnabledStereoPosition"); |
307 DEBUG_API("->XAVolumeItfImpl_IsEnabledStereoPosition"); |
302 |
308 |
303 if(!impl || !pEnable) |
309 if (!impl || !pEnable) |
304 { |
310 { |
305 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
311 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
306 DEBUG_API("<-XAVolumeItfImpl_IsEnabledStereoPosition"); |
312 DEBUG_API("<-XAVolumeItfImpl_IsEnabledStereoPosition"); |
307 /* invalid parameter */ |
313 /* invalid parameter */ |
308 return XA_RESULT_PARAMETER_INVALID; |
314 return XA_RESULT_PARAMETER_INVALID; |
309 } |
315 } |
310 |
316 |
311 *pEnable = impl->enableStereoPos; |
317 *pEnable = impl->enableStereoPos; |
312 |
318 |
313 DEBUG_API("<-XAVolumeItfImpl_IsEnabledStereoPosition"); |
319 DEBUG_API("<-XAVolumeItfImpl_IsEnabledStereoPosition"); |
314 return ret; |
320 return ret; |
315 } |
321 } |
316 |
322 |
317 /** |
323 /** |
318 * XAresult XAVolumeItfImpl_SetStereoPosition(XAVolumeItf self, |
324 * XAresult XAVolumeItfImpl_SetStereoPosition(XAVolumeItf self, |
319 * XApermille stereoPosition) |
325 * XApermille stereoPosition) |
320 * Description: Sets the stereo position of the object. |
326 * Description: Sets the stereo position of the object. |
321 **/ |
327 **/ |
322 XAresult XAVolumeItfImpl_SetStereoPosition(XAVolumeItf self, |
328 XAresult XAVolumeItfImpl_SetStereoPosition(XAVolumeItf self, |
323 XApermille stereoPosition) |
329 XApermille stereoPosition) |
324 { |
330 { |
325 XAresult ret = XA_RESULT_SUCCESS; |
331 XAresult ret = XA_RESULT_SUCCESS; |
326 XAVolumeItfImpl *impl = GetImpl(self); |
332 XAVolumeItfImpl *impl = GetImpl(self); |
327 DEBUG_API("->XAVolumeItfImpl_SetStereoPosition"); |
333 DEBUG_API("->XAVolumeItfImpl_SetStereoPosition"); |
328 |
334 |
329 if(!impl || (stereoPosition < STEREO_POSITION_LEFT) || |
335 if (!impl || (stereoPosition < STEREO_POSITION_LEFT) || (stereoPosition |
330 (stereoPosition > STEREO_POSITION_RIGHT)) |
336 > STEREO_POSITION_RIGHT) || !impl->adapCtx) |
331 { |
337 { |
332 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
338 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
333 DEBUG_API("<-XAVolumeItfImpl_SetStereoPosition"); |
339 DEBUG_API("<-XAVolumeItfImpl_SetStereoPosition"); |
334 /* invalid parameter */ |
340 /* invalid parameter */ |
335 return XA_RESULT_PARAMETER_INVALID; |
341 return XA_RESULT_PARAMETER_INVALID; |
336 } |
342 } |
337 |
343 |
338 impl->stereoPosition = stereoPosition; |
344 impl->stereoPosition = stereoPosition; |
339 |
345 |
340 |
|
341 ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); |
346 ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); |
342 if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) |
347 if (ret == XA_RESULT_PARAMETER_INVALID || ret |
343 { |
348 == XA_RESULT_PRECONDITIONS_VIOLATED) |
|
349 { |
344 DEBUG_API("<-XAVolumeItfImpl_SetStereoPosition"); |
350 DEBUG_API("<-XAVolumeItfImpl_SetStereoPosition"); |
345 return ret; |
351 return ret; |
346 } |
352 } |
347 /* check is stereo position effect enabled if is then handle effect */ |
353 /* check is stereo position effect enabled if is then handle effect */ |
348 if(impl->enableStereoPos) |
354 if (impl->enableStereoPos) |
349 { |
355 { |
350 if(impl->adapCtx->fwtype == FWMgrFWGST) |
356 if (impl->adapCtx->fwtype == FWMgrFWGST) |
351 { |
357 { |
352 ret = XAVolumeItfAdapt_SetStereoPosition((XAAdaptationGstCtx*)impl->adapCtx, |
358 ret = XAVolumeItfAdapt_SetStereoPosition( |
353 stereoPosition); |
359 (XAAdaptationGstCtx*) impl->adapCtx, stereoPosition); |
354 } |
360 } |
355 else |
361 else |
356 { |
362 { |
357 ret = XANokiaVolumeExtItfAdapt_SetStereoPosition((XAAdaptationMMFCtx*)impl->adapCtx, |
363 ret = XANokiaVolumeExtItfAdapt_SetStereoPosition( |
358 stereoPosition); |
364 (XAAdaptationMMFCtx*) impl->adapCtx, stereoPosition); |
359 } |
365 } |
360 } |
366 } |
361 |
367 |
362 XAAdaptationBase_ThreadExit(impl->adapCtx); |
368 XAAdaptationBase_ThreadExit(impl->adapCtx); |
363 |
369 |
364 DEBUG_API("<-XAVolumeItfImpl_SetStereoPosition"); |
370 DEBUG_API("<-XAVolumeItfImpl_SetStereoPosition"); |
365 return ret; |
371 return ret; |
366 } |
372 } |
367 |
373 |
368 /** |
374 /** |
369 * XAresult XAVolumeItfImpl_GetStereoPosition(XAVolumeItf self, |
375 * XAresult XAVolumeItfImpl_GetStereoPosition(XAVolumeItf self, |
370 * XApermille *pStereoPosition) |
376 * XApermille *pStereoPosition) |
371 * Description: Gets the object’s stereo position setting. |
377 * Description: Gets the object’s stereo position setting. |
372 **/ |
378 **/ |
373 XAresult XAVolumeItfImpl_GetStereoPosition(XAVolumeItf self, |
379 XAresult XAVolumeItfImpl_GetStereoPosition(XAVolumeItf self, |
374 XApermille *pStereoPosition) |
380 XApermille *pStereoPosition) |
375 { |
381 { |
376 XAresult ret = XA_RESULT_SUCCESS; |
382 XAresult ret = XA_RESULT_SUCCESS; |
377 XAVolumeItfImpl *impl = GetImpl(self); |
383 XAVolumeItfImpl *impl = GetImpl(self); |
378 DEBUG_API("->XAVolumeItfImpl_GetStereoPosition"); |
384 DEBUG_API("->XAVolumeItfImpl_GetStereoPosition"); |
379 |
385 |
380 if(!impl || !pStereoPosition) |
386 if (!impl || !pStereoPosition) |
381 { |
387 { |
382 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
388 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
383 DEBUG_API("<-XAVolumeItfImpl_GetStereoPosition"); |
389 DEBUG_API("<-XAVolumeItfImpl_GetStereoPosition"); |
384 /* invalid parameter */ |
390 /* invalid parameter */ |
385 return XA_RESULT_PARAMETER_INVALID; |
391 return XA_RESULT_PARAMETER_INVALID; |
386 } |
392 } |
387 |
393 |
388 *pStereoPosition = impl->stereoPosition; |
394 *pStereoPosition = impl->stereoPosition; |
389 |
395 |
390 DEBUG_API("<-XAVolumeItfImpl_GetStereoPosition"); |
396 DEBUG_API("<-XAVolumeItfImpl_GetStereoPosition"); |
391 return ret; |
397 return ret; |
392 } |
398 } |
393 |
399 |
394 /** |
400 /** |
395 * XAVolumeItfImpl -specific methods |
401 * XAVolumeItfImpl -specific methods |
396 **/ |
402 **/ |
397 |
|
398 |
403 |
399 /** |
404 /** |
400 * XAVolumeItfImpl* XAVolumeItfImpl_Create() |
405 * XAVolumeItfImpl* XAVolumeItfImpl_Create() |
401 * Description: Allocate and initialize VolumeItfImpl |
406 * Description: Allocate and initialize VolumeItfImpl |
402 **/ |
407 **/ |
403 XAVolumeItfImpl* XAVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx ) |
408 XAVolumeItfImpl* XAVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx) |
404 { |
409 { |
405 XAVolumeItfImpl *self = (XAVolumeItfImpl*) |
410 XAVolumeItfImpl *self = (XAVolumeItfImpl*) calloc(1, |
406 calloc(1,sizeof(XAVolumeItfImpl)); |
411 sizeof(XAVolumeItfImpl)); |
407 DEBUG_API("->XAVolumeItfImpl_Create"); |
412 DEBUG_API("->XAVolumeItfImpl_Create"); |
408 |
413 |
409 if(self) |
414 if (self) |
410 { |
415 { |
411 /* init itf default implementation */ |
416 /* init itf default implementation */ |
412 self->itf.EnableStereoPosition = XAVolumeItfImpl_EnableStereoPosition; |
417 self->itf.EnableStereoPosition = XAVolumeItfImpl_EnableStereoPosition; |
413 self->itf.GetMaxVolumeLevel = XAVolumeItfImpl_GetMaxVolumeLevel; |
418 self->itf.GetMaxVolumeLevel = XAVolumeItfImpl_GetMaxVolumeLevel; |
414 self->itf.GetMute = XAVolumeItfImpl_GetMute; |
419 self->itf.GetMute = XAVolumeItfImpl_GetMute; |
415 self->itf.GetStereoPosition = XAVolumeItfImpl_GetStereoPosition; |
420 self->itf.GetStereoPosition = XAVolumeItfImpl_GetStereoPosition; |
416 self->itf.GetVolumeLevel = XAVolumeItfImpl_GetVolumeLevel; |
421 self->itf.GetVolumeLevel = XAVolumeItfImpl_GetVolumeLevel; |
417 self->itf.IsEnabledStereoPosition = XAVolumeItfImpl_IsEnabledStereoPosition; |
422 self->itf.IsEnabledStereoPosition |
|
423 = XAVolumeItfImpl_IsEnabledStereoPosition; |
418 self->itf.SetMute = XAVolumeItfImpl_SetMute; |
424 self->itf.SetMute = XAVolumeItfImpl_SetMute; |
419 self->itf.SetStereoPosition = XAVolumeItfImpl_SetStereoPosition; |
425 self->itf.SetStereoPosition = XAVolumeItfImpl_SetStereoPosition; |
420 self->itf.SetVolumeLevel = XAVolumeItfImpl_SetVolumeLevel; |
426 self->itf.SetVolumeLevel = XAVolumeItfImpl_SetVolumeLevel; |
421 |
427 |
422 /* init variables */ |
428 /* init variables */ |