18 #include "xaadaptationmmf.h" |
18 #include "xaadaptationmmf.h" |
19 #include "xanokialinearvolumeitfadaptationmmf.h" |
19 #include "xanokialinearvolumeitfadaptationmmf.h" |
20 #include "xamediaplayeradaptctxmmf.h" |
20 #include "xamediaplayeradaptctxmmf.h" |
21 #include "cmmfbackendengine.h" |
21 #include "cmmfbackendengine.h" |
22 #include "cmmfradiobackendengine.h" |
22 #include "cmmfradiobackendengine.h" |
|
23 |
|
24 XAresult XANokiaLinearVolumeItfAdapt_GetVolumeLevel(XAAdaptationMMFCtx *ctx, XAuint32* percentage) |
|
25 { |
|
26 XAresult res = XA_RESULT_SUCCESS; |
|
27 XAuint32 maxvol; |
|
28 XAuint32 vol; |
|
29 DEBUG_API("->XANokiaLinearVolumeItfAdapt_GetVolumeLevel"); |
|
30 if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation && |
|
31 ctx->baseObj.ctxId != XAMediaRecorderAdaptation && |
|
32 ctx->baseObj.ctxId != XARadioAdaptation) ) |
|
33 { |
|
34 DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); |
|
35 DEBUG_API("<-XANokiaLinearVolumeItfAdapt_GetVolumeLevel"); |
|
36 /* invalid parameter */ |
|
37 return XA_RESULT_PARAMETER_INVALID; |
|
38 } |
|
39 |
|
40 if(ctx->baseObj.ctxId == XAMediaPlayerAdaptation) |
|
41 { |
|
42 mmf_volumeitf_get_maxvolume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext, |
|
43 &maxvol); |
|
44 mmf_volumeitf_get_volume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext, |
|
45 &vol); |
|
46 |
|
47 *percentage = (vol * MAX_PERCENTAGE_VOLUME)/maxvol; |
|
48 |
|
49 } |
|
50 |
|
51 DEBUG_API_A1("<-XANokiaLinearVolumeItfAdapt_GetVolumeLevel %d", percentage); |
|
52 return res; |
|
53 } |
23 |
54 |
24 /* |
55 /* |
25 * XAresult XANokiaLinearVolumeItfAdapt_SetVolumeLevel(void *ctx, AdaptationContextIDS ctx->baseObj.ctxId, |
56 * XAresult XANokiaLinearVolumeItfAdapt_SetVolumeLevel(void *ctx, AdaptationContextIDS ctx->baseObj.ctxId, |
26 * XAuint32 percentage) |
57 * XAuint32 percentage) |
27 * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID |
58 * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID |