khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c
changeset 21 2ed61feeead6
parent 19 4a629bc82c5e
child 25 6f7ceef7b1d1
equal deleted inserted replaced
20:b67dd1fc57c5 21:2ed61feeead6
    19 //#include <mixer.h>
    19 //#include <mixer.h>
    20 #include "xaadaptationmmf.h"
    20 #include "xaadaptationmmf.h"
    21 #include "xanokialinearvolumeitfadaptationmmf.h"
    21 #include "xanokialinearvolumeitfadaptationmmf.h"
    22 #include "xamediaplayeradaptctxmmf.h"
    22 #include "xamediaplayeradaptctxmmf.h"
    23 #include "cmmfbackendengine.h"
    23 #include "cmmfbackendengine.h"
       
    24 #include "cmmfradiobackendengine.h"
       
    25 
    24 /*
    26 /*
    25  * XAresult XANokiaLinearVolumeItfAdapt_SetVolumeLevel(void *ctx, AdaptationContextIDS ctx->baseObj.ctxId,
    27  * XAresult XANokiaLinearVolumeItfAdapt_SetVolumeLevel(void *ctx, AdaptationContextIDS ctx->baseObj.ctxId,
    26  *                                          XAuint32 percentage)
    28  *                                          XAuint32 percentage)
    27  * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID
    29  * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID
    28  * XAuint32 percentage - Requested volume level, in between MIN_VOLUME_LEVEL and MAX_VOLUME_LEVEL
    30  * XAuint32 percentage - Requested volume level, in between MIN_VOLUME_LEVEL and MAX_VOLUME_LEVEL
    52         vol = (percentage * maxvol) / MAX_PERCENTAGE_VOLUME;
    54         vol = (percentage * maxvol) / MAX_PERCENTAGE_VOLUME;
    53         
    55         
    54         mmf_volumeitf_set_volume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext,
    56         mmf_volumeitf_set_volume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext,
    55                                     vol);
    57                                     vol);
    56         }
    58         }
       
    59     else if (ctx->baseObj.ctxId == XARadioAdaptation)
       
    60     	{
       
    61 		    mmf_set_player_adapt_context(cmmfradiobackendengine_init(), ctx);	        	
       
    62     		res = set_volume(cmmfradiobackendengine_init(), percentage);  		    		
       
    63     	}	    
    57     DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel");
    64     DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel");
    58     return res;
    65     return res;
    59 }
    66 }
    60 
    67 
    61 XAresult XANokiaLinearVolumeItfAdapt_GetStepCount(XAAdaptationMMFCtx *ctx,
    68 XAresult XANokiaLinearVolumeItfAdapt_GetStepCount(XAAdaptationMMFCtx *ctx,
    62                                                     XAuint32* stepcount)
    69                                                     XAuint32* stepcount)
    63     {
    70     {
    64     XAresult res = XA_RESULT_SUCCESS;
    71     XAresult res = XA_RESULT_SUCCESS;
    65     DEBUG_API_A1("->XANokiaLinearVolumeItfAdapt_SetVolumeLevel to: %d",
    72     DEBUG_API("->XANokiaLinearVolumeItfAdapt_GetStepCount ");
    66                                                             percentage);
       
    67     if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation &&
    73     if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation &&
    68                  ctx->baseObj.ctxId != XAMediaRecorderAdaptation &&
    74                  ctx->baseObj.ctxId != XAMediaRecorderAdaptation &&
    69                  ctx->baseObj.ctxId != XARadioAdaptation) )
    75                  ctx->baseObj.ctxId != XARadioAdaptation) )
    70     {
    76     {
    71         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    77         DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
    78         {
    84         {
    79         mmf_volumeitf_get_maxvolume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext,
    85         mmf_volumeitf_get_maxvolume(((XAMediaPlayerAdaptationMMFCtx*)ctx)->mmfContext,
    80                                         stepcount);
    86                                         stepcount);
    81         }
    87         }
    82     
    88     
    83     DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel");
    89     DEBUG_API("<-XANokiaLinearVolumeItfAdapt_GetStepCount");
    84     return res;    
    90     return res;    
    85     }
    91     }
    86 
    92 
    87 void XANokiaLinearVolumeItfAdapt_VolumeChange(XAAdaptationBaseCtx *ctx, TInt aVolume)
    93 void XANokiaLinearVolumeItfAdapt_VolumeChange(XAAdaptationBaseCtx *ctx, TInt aVolume)
    88 {
    94 {