📄 o_volume_control.c
字号:
{
MS_SET_HSLIDER_DISABLE(pThis);
MS_DisplayAddObject(pThis);
}
}
else
{
MS_SendOperation(pThis, MS_OP_REFRESH, lParam);
if (MS_IS_HSLIDER_DISABLED(pThis))
{
MS_CLEAR_HSLIDER_DISABLE(pThis);
MS_DisplayAddObject(pThis);
}
}
}
break;
case MS_OP_ENTER:
return MS_OP_NONE;
default:
break;
}
return MsOp;
}
#endif //D_LFE_CHANNEL_VOLUME
/***************************************************************************************
* Function : _SurroundChannelSliderOperation
*
* In :
*
* Out :
*
* Desc : The choice operation of all the slider objects.
****************************************************************************************/
#ifdef D_SURROUND_CHANNEL_VOLUME
#pragma argsused
static MS_OP _SurroundChannelSliderOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
UINT16 wSpeakerConfigIndex = CoreAPI_GetPsSpkrCfgIdx();
// Pre-processing
switch(MsOp)
{
case MS_OP_LEFT: // Fall Through !!!
case MS_OP_RIGHT:
{
// Do nothing if disabled.
if(MS_IS_HSLIDER_DISABLED(pThis))
{
PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_NOW);
return MS_OP_NONE;
}
}
break;
default:
break;
}
MsOp = HSliderOperationOnVList(pThis, MsOp, lParam);
// Post-processing
switch(MsOp)
{
case MS_OP_INIT: // Fall Through !!!
case MS_OP_ON_DEFROST:
case MS_OP_TICK:
{
// Disable the slider if Surround is off.
if(SPK_NOT_PRESENT == SpeakersConfigTable[wSpeakerConfigIndex].mSurroundSpk)
{
MS_SendOperation(pThis, MS_OP_REFRESH, 0);
if (!MS_IS_HSLIDER_DISABLED(pThis))
{
MS_SET_HSLIDER_DISABLE(pThis);
MS_DisplayAddObject(pThis);
}
}
else
{
MS_SendOperation(pThis, MS_OP_REFRESH, lParam);
if (MS_IS_HSLIDER_DISABLED(pThis))
{
MS_CLEAR_HSLIDER_DISABLE(pThis);
MS_DisplayAddObject(pThis);
}
}
}
break;
case MS_OP_ENTER:
return MS_OP_NONE;
default:
break;
}
return MsOp;
}
#endif //#ifdef D_SURROUND_CHANNEL_VOLUME
/***************************************************************************************
* Function : _CenterChannelSliderOperation
*
* In :
*
* Out :
*
* Desc : The choice operation of all the slider objects.
****************************************************************************************/
#ifdef D_CENTER_CHANNEL_VOLUME
#pragma argsused
static MS_OP _CenterChannelSliderOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
UINT16 wSpeakerConfigIndex = CoreAPI_GetPsSpkrCfgIdx();
// Pre-processing
switch(MsOp)
{
case MS_OP_LEFT: // Fall Through !!!
case MS_OP_RIGHT:
{
// Do nothing if disabled.
if(MS_IS_HSLIDER_DISABLED(pThis))
{
PROHIBIT(MSG_PROHIBIT_NOT_ALLOWED_NOW);
return MS_OP_NONE;
}
}
break;
default:
break;
}
MsOp = HSliderOperationOnVList(pThis, MsOp, lParam);
// Post-processing
switch(MsOp)
{
case MS_OP_INIT: // Fall Through !!!
case MS_OP_ON_DEFROST:
case MS_OP_TICK:
{
// Disable the slider if centre speaker is off.
if(SPK_NOT_PRESENT == SpeakersConfigTable[wSpeakerConfigIndex].mCenterSpk)
{
MS_SendOperation(pThis, MS_OP_REFRESH, 0);
if (!MS_IS_HSLIDER_DISABLED(pThis))
{
MS_SET_HSLIDER_DISABLE(pThis);
MS_DisplayAddObject(pThis);
}
}
else
{
MS_SendOperation(pThis, MS_OP_REFRESH, lParam);
if (MS_IS_HSLIDER_DISABLED(pThis))
{
MS_CLEAR_HSLIDER_DISABLE(pThis);
MS_DisplayAddObject(pThis);
}
}
}
break;
case MS_OP_ENTER:
return MS_OP_NONE;
default:
break;
}
return MsOp;
}
#endif //#ifdef D_CENTER_CHANNEL_VOLUME
#endif //#ifdef D_SEPARATE_CHANNEL_VOLUME_CONTROL
/***************************************************************************************
* Array : aVolumeKit
*
* Purpose : Contains an array of pointer to descriptors of the objects that would be
* added to the Volumekit (oVolumeKitDescriptor).
****************************************************************************************/
static CONST MS_DESCRIPTOR* CONST aVolumeKit[] = {
#ifdef D_SEPARATE_CHANNEL_VOLUME_CONTROL
(MS_DESCRIPTOR*)&oMainVolumeSliderDescriptor,
#ifdef D_LEFT_RIGHT_CHANNEL_VOLUME
(MS_DESCRIPTOR*)&oLeftChannelVolumeSliderDescriptor,
(MS_DESCRIPTOR*)&oRightChannelVolumeSliderDescriptor,
#endif
#ifdef D_CENTER_CHANNEL_VOLUME
(MS_DESCRIPTOR*)&oCentreChannelVolumeSliderDescriptor,
#endif
#ifdef D_SURROUND_CHANNEL_VOLUME
(MS_DESCRIPTOR*)&oLeftSurroundChannelVolumeSliderDescriptor,
(MS_DESCRIPTOR*)&oRightSurroundChannelVolumeSliderDescriptor,
#endif
#ifdef D_LT_RT_CHANNEL_VOLUME
(MS_DESCRIPTOR*)&oLeftDownmixVolumeSliderDescriptor,
(MS_DESCRIPTOR*)&oRightDownmixVolumeSliderDescriptor,
#endif
#ifdef D_LFE_CHANNEL_VOLUME
(MS_DESCRIPTOR*)&oSubwooferChannelVolumeSliderDescriptor,
#endif
#else// D_SEPARATE_CHANNEL_VOLUME_CONTROL
(MS_DESCRIPTOR*)&oMainVolumeSliderDescriptor,
#ifdef D_GUI_HEADPHONE_VOLUME
(MS_DESCRIPTOR*)&oHeadphoneVolumeSliderDescriptor,
#endif //D_GUI_HEADPHONE_VOLUME
#endif // D_SEPARATE_CHANNEL_VOLUME_CONTROL
NULL // IMPORTANT : Last item must always be NULL.
};
/***************************************************************************************
* Utility functions
****************************************************************************************/
static BOOL _AddItemsToVolumeKit(MSO_VLIST __NEAR* pList)
{
if(NULL != pList)
{
UINT8 cIndex;
UINT8 cNumItems;
UINT8 cTotalItemsInToolkit = 0;
MSO_OBJECT __NEAR* pObject;
// Get the total number of tools in the toolkit
while(NULL != aVolumeKit[cTotalItemsInToolkit])
cTotalItemsInToolkit++;
pList->moParam.mwTotalItems = cTotalItemsInToolkit;
cNumItems = MIN(pList->moParam.mcNumVisibleItems, (pList->moParam.mwTotalItems - pList->moParam.mwFirstDisplayItem));
for(cIndex = 0; cIndex < cNumItems; cIndex++)
{
pObject = OVLIST_CreateAndAppendItem(pList, aVolumeKit[pList->moParam.mwFirstDisplayItem + cIndex]);
MS_SendOperation(pObject, MS_OP_OPEN, 0);
MS_SendOperation(pObject, MS_OP_INIT, 0);
}
return TRUE;
}
return FALSE;
}
/***************************************************************************************
* Function : _CalcMainVolume
*
* In : None.
*
* Out : None.
*
* Return :
*
* Desc :
****************************************************************************************/
static UINT16 _CalcMainVolume(UINT16 wHwValue)
{
if (wHwValue > (NUM_SLIDER_STEPS_MAIN - 1))
wHwValue = (NUM_SLIDER_STEPS_MAIN - 1);
return aVolumeValuesMain[wHwValue];
}
/***************************************************************************************
* Function : _CalcMainVolumeStep
*
* In : None.
*
* Out : None.
*
* Return :
*
* Desc :
****************************************************************************************/
static UINT16 _CalcMainVolumeStep(UINT16 wHwValue)
{
UINT8 index;
if(wHwValue == aVolumeValuesMain[0])
return 0;
else if(wHwValue == aVolumeValuesMain[NUM_SLIDER_STEPS_MAIN - 1])
return (NUM_SLIDER_STEPS_MAIN - 1);
//Get the index in the constant data array
// The array is ordered big to small
for(index = 0; index < (NUM_SLIDER_STEPS_MAIN - 1); index++)
{
#if (defined(D_SEPARATE_CHANNEL_VOLUME_CONTROL) ||defined(DAC_INTERNAL_DDX) )
if ((wHwValue <= aVolumeValuesMain[index]) && (wHwValue > aVolumeValuesMain[index+1]))
#else
if (wHwValue <= aVolumeValuesMain[index])
#endif
return(index);
}
return(0);
}
#ifdef D_SEPARATE_CHANNEL_VOLUME_CONTROL
/***************************************************************************************
* Function : _CalcEightChannelVolume
*
* In : None.
*
* Out : None.
*
* Return :
*
* Desc :
****************************************************************************************/
static UINT16 _CalcEightChannelVolume(UINT16 wHwValue)
{
if (wHwValue > (NUM_SLIDER_STEPS_CHANNEL- 1))
wHwValue = (NUM_SLIDER_STEPS_CHANNEL - 1);
return aVolumeValuesSeparate[wHwValue];
}
/***************************************************************************************
* Function : _CalcEightChannelVolumeStep
*
* In : None.
*
* Out : None.
*
* Return :
*
* Desc :
****************************************************************************************/
static UINT16 _CalcEightChannelVolumeStep(UINT16 wHwValue)
{
UINT8 index;
if(wHwValue == aVolumeValuesSeparate[0])
return(0);
else if(wHwValue == aVolumeValuesSeparate[NUM_SLIDER_STEPS_CHANNEL- 1])
return((NUM_SLIDER_STEPS_CHANNEL- 1));
//Get the index in the constant data array
// The array is ordered big to small
for(index = 0; index < (NUM_SLIDER_STEPS_CHANNEL- 1); index++)
{
if ((wHwValue <= aVolumeValuesSeparate[index]) && (wHwValue > aVolumeValuesSeparate[index+1]))
return(index);
}
return(0);
}
#endif
#ifdef D_SEPARATE_CHANNEL_VOLUME_CONTROL
/**************************************************************************
* Function :
* In :
* Out :
* Desc :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -