⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 o_volume_control.c

📁 Zoran V966 DVD 解码 Soc芯片的源程序
💻 C
📖 第 1 页 / 共 3 页
字号:
***************************************************************************/
#ifdef D_LEFT_RIGHT_CHANNEL_VOLUME
static UINT16 _LeftChannelVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue)
{
	if(eType == HS_ACTION_SET)
	{
		// Send the new value to the core.
		wValue = _CalcEightChannelVolume(wValue);
		
		// Send the new value to the core:
		CoreAPI_UpdatePlayerSetting( (UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) | PS_UPDATE_SEPARATE_VOLUME), 
									(wValue | (SEPARATE_ANALOG_AUDIO_CHANNEL_L << 8)) );
	}
	else
	{
		// Read the value from the core:
		wValue = _CalcEightChannelVolumeStep(CoreAPI_GetVolumeChannel(SEPARATE_ANALOG_AUDIO_CHANNEL_L));
	}

	return(wValue);
	}

/**************************************************************************
*	Function	:
*	In		:
*	Out 	:
*	Desc	:
***************************************************************************/
static UINT16 _RightChannelVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue)
{
	if(eType == HS_ACTION_SET)
	{
		wValue = _CalcEightChannelVolume(wValue);
		// Send the new value to the core:
		CoreAPI_UpdatePlayerSetting( (UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) | PS_UPDATE_SEPARATE_VOLUME), 
									(wValue | (SEPARATE_ANALOG_AUDIO_CHANNEL_R << 8)) );
	}
	else
	{
		// Read the value from the core:
		wValue = _CalcEightChannelVolumeStep(CoreAPI_GetVolumeChannel(SEPARATE_ANALOG_AUDIO_CHANNEL_R));
	}

	return(wValue);
}
#endif // #ifdef D_LEFT_RIGHT_CHANNEL_VOLUME

#ifdef D_CENTER_CHANNEL_VOLUME
/**************************************************************************
*	Function	:
*	In		:
*	Out 	:
*	Desc	:
***************************************************************************/
static UINT16 _CentreChannelVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue)
{
	if(eType == HS_ACTION_SET)
	{
		wValue = _CalcEightChannelVolume(wValue);
		// Send the new value to the core:
		CoreAPI_UpdatePlayerSetting( (UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) | PS_UPDATE_SEPARATE_VOLUME),
									(wValue | (SEPARATE_ANALOG_AUDIO_CHANNEL_C << 8)) );
	}
	else
	{
		// Read the value from the core:
		wValue =_CalcEightChannelVolumeStep( CoreAPI_GetVolumeChannel(SEPARATE_ANALOG_AUDIO_CHANNEL_C));
	}

	return(wValue);
}
#endif // D_CENTER_CHANNEL_VOLUME

#ifdef D_SURROUND_CHANNEL_VOLUME
/**************************************************************************
*	Function	:
*	In		:
*	Out 	:
*	Desc	:
***************************************************************************/
static UINT16 _LeftSurroundChannelVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue)
{
	if(eType == HS_ACTION_SET)
	{
		wValue = _CalcEightChannelVolume(wValue);
		// Send the new value to the core:
		CoreAPI_UpdatePlayerSetting( (UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) | PS_UPDATE_SEPARATE_VOLUME), 
									(wValue | (SEPARATE_ANALOG_AUDIO_CHANNEL_LS << 8)) );
	}
	else
	{
		// Read the value from the core:
		wValue = _CalcEightChannelVolumeStep(CoreAPI_GetVolumeChannel(SEPARATE_ANALOG_AUDIO_CHANNEL_LS));
	}

	return(wValue);
}

/**************************************************************************
*	Function	:
*	In		:
*	Out 	:
*	Desc	:
***************************************************************************/
static UINT16 _RightSurroundChannelVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue)
{
	if(eType == HS_ACTION_SET)
	{
		wValue = _CalcEightChannelVolume(wValue);
		// Send the new value to the core:
		CoreAPI_UpdatePlayerSetting( (UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) | PS_UPDATE_SEPARATE_VOLUME), 
									(wValue | (SEPARATE_ANALOG_AUDIO_CHANNEL_RS << 8)) );
	}
	else
	{
		// Read the value from the core:
		wValue = _CalcEightChannelVolumeStep(CoreAPI_GetVolumeChannel(SEPARATE_ANALOG_AUDIO_CHANNEL_RS));
	}

	return(wValue);
}
#endif // D_SURROUND_CHANNEL_VOLUME

#ifdef D_LT_RT_CHANNEL_VOLUME
/**************************************************************************
*	Function	:
*	In		:
*	Out 	:
*	Desc	:
***************************************************************************/
static UINT16 _LeftDownmixVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue)
{
	if(eType == HS_ACTION_SET)
	{
		wValue = _CalcEightChannelVolume(wValue);
		// Send the new value to the core:
		CoreAPI_UpdatePlayerSetting( (UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) | PS_UPDATE_SEPARATE_VOLUME), 
									(wValue | (SEPARATE_ANALOG_AUDIO_CHANNEL_LT << 8)) );
	}
	else
	{
		// Read the value from the core:
		wValue = _CalcEightChannelVolumeStep(CoreAPI_GetVolumeChannel(SEPARATE_ANALOG_AUDIO_CHANNEL_LT));
	}

	return(wValue);
}

/**************************************************************************
*	Function	:
*	In		:
*	Out 	:
*	Desc	:
***************************************************************************/
static UINT16 _RightDownmixVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue)
{
	if(eType == HS_ACTION_SET)
	{
		wValue = _CalcEightChannelVolume(wValue);
		// Send the new value to the core:
		CoreAPI_UpdatePlayerSetting( (UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) | PS_UPDATE_SEPARATE_VOLUME), 
										(wValue | (SEPARATE_ANALOG_AUDIO_CHANNEL_RT << 8)) );
	}
	else
	{
		// Read the value from the core:
		wValue = _CalcEightChannelVolumeStep(CoreAPI_GetVolumeChannel(SEPARATE_ANALOG_AUDIO_CHANNEL_RT));
	}

	return(wValue);
}
#endif // D_LT_RT_CHANNEL_VOLUME

#ifdef D_LFE_CHANNEL_VOLUME
/**************************************************************************
*	Function	:
*	In		:
*	Out 	:
*	Desc	:
***************************************************************************/
static UINT16 _SubwooferChannelVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue)
{
	if(eType == HS_ACTION_SET)
	{
		wValue = _CalcEightChannelVolume(wValue);
		// Send the new value to the core:
		CoreAPI_UpdatePlayerSetting( (UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) | PS_UPDATE_SEPARATE_VOLUME), 
									(wValue | (SEPARATE_ANALOG_AUDIO_CHANNEL_SW << 8)) );
	}
	else
	{
		// Read the value from the core:
		wValue = _CalcEightChannelVolumeStep(CoreAPI_GetVolumeChannel(SEPARATE_ANALOG_AUDIO_CHANNEL_SW));
	}

	return(wValue);
}
#endif // D_LFE_CHANNEL_VOLUME

#else// D_SEPARATE_CHANNEL_VOLUME_CONTROL

#ifdef D_GUI_HEADPHONE_VOLUME
/**************************************************************************
*	Function	:
*	In		:
*	Out 	:
*	Desc	:
***************************************************************************/
static UINT16 _HeadphoneVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue)
{
	UINT32 lVolume;

	if(eType == HS_ACTION_SET)
	{
		// Send the new value to the core:

		// If we are muted currently, unmute:
		if(CoreAPI_IsMute())
		{
			CoreAPI_UpdatePlayerSetting((UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) |  PS_UPDATE_MUTE_SETTING), MUTE_SETTING_OFF );
		}

		// Scale the slider value to the hardware volume range:
		lVolume = (wValue == NUM_SLIDER_STEPS_HEADPHONE_NON_DDX)
				? HW_MAX_VOLUME
		        : ((wValue * (HW_MAX_VOLUME + 1)) / NUM_SLIDER_STEPS_HEADPHONE_NON_DDX);

		CoreAPI_UpdatePlayerSetting( (UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) | PS_UPDATE_DOWNMIX_VOLUME_SETTING), (UINT16)lVolume );
	}
	else
	{
		// Read the value from the core:
		lVolume = CoreAPI_GetVolumeHeadPhone();
		lVolume = ((lVolume * NUM_SLIDER_STEPS_HEADPHONE_NON_DDX) / HW_MAX_VOLUME);
	}

	return((UINT16)lVolume);
}
#endif //D_GUI_HEADPHONE_VOLUME
#endif // D_SEPARATE_CHANNEL_VOLUME_CONTROL


/***************************************************************************************
*	Function	:	_MainVolumeSliderAction
*
*	In		:	eType	=	Getting or Setting the value
*				wValue	=	0 if value to get, or value to be set
*
*	Out 		:	None
*
*	Return	: 	None
*
*	Desc		: 	The main volumn slider action function.
****************************************************************************************/
STATIC UINT16 _MainVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue)
{
    if(eType == HS_ACTION_SET)
    {
	// If we are muted currently, unmute:
	if(MUTE_SETTING_ON == gtps.mMute)
	{
#ifdef D_GINGER_I96
		CoreAPI_UpdatePlayerSetting( (UINT16)PS_UPDATE_MUTE_SETTING, MUTE_SETTING_OFF);
#else
		CoreAPI_UpdatePlayerSetting((UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) | PS_UPDATE_MUTE_SETTING), 
						MUTE_SETTING_OFF);	
#endif
	}
	
       // Send the new value to the core.
        wValue = _CalcMainVolume(wValue);

#ifdef D_GINGER_I96
#ifdef DAC_INTERNAL_DDX
#ifdef  D_SEPARATE_CHANNEL_VOLUME_CONTROL
	CoreAPI_UpdatePlayerSetting((UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) | PS_UPDATE_SEPARATE_VOLUME) , 
								(wValue | (SEPARATE_ANALOG_AUDIO_CHANNEL_M << 8)));
#else//D_SEPARATE_CHANNEL_VOLUME_CONTROL
	CoreAPI_UpdatePlayerSetting( (UINT16)PS_UPDATE_DDX_VOLUME_SETTING, wValue);
#endif//D_SEPARATE_CHANNEL_VOLUME_CONTROL
#else//DAC_INTERNAL_DDX
	CoreAPI_UpdatePlayerSetting( (UINT16)PS_UPDATE_VOLUME_SETTING, wValue);
#endif
#else //D_GINGER_I96
#ifdef  D_SEPARATE_CHANNEL_VOLUME_CONTROL
	CoreAPI_UpdatePlayerSetting((UINT16)(PS_ExtractAction(PS_UPDATE_SAVE_FLAG) | PS_UPDATE_SEPARATE_VOLUME) , 
								(wValue | (SEPARATE_ANALOG_AUDIO_CHANNEL_M << 8)));
#else //D_SEPARATE_CHANNEL_VOLUME_CONTROL
	CoreAPI_UpdatePlayerSetting( (UINT16)PS_UPDATE_VOLUME_SETTING, wValue);
#endif //D_SEPARATE_CHANNEL_VOLUME_CONTROL
#endif //D_GINGER_I96

    }
    else
    	// Read the value from the core.
        wValue = _CalcMainVolumeStep(CoreAPI_GetVolumeMain());
	


    return(wValue);
}

/***************************************************************************************
* 	Display functions
****************************************************************************************/
#pragma argsused
static BOOL _VolumeFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea)
{
	//FORMATED_UNICODE_STRING oFormUniStr;
	MS_DESCRIPTOR_VOLUMN_CONTROL* pDescriptor = (MS_DESCRIPTOR_VOLUMN_CONTROL*)pThis->mpDescriptor;

	OSDR_FillOsdSegBitmapFitArea(pDescriptor->mpBgBmp, pAbsArea);

	return FALSE;
}
/***************************************************************************************
*	Function	:	OVolume_OpenAtPos
*
*	In		:	pParent		=	Pointer to the parent container.
*
*				wStartX		=	X position of the component. The default position (specified in the 
*								descriptor) is used in case this parameter is set to DEFAULT_POSITION.
*
*				wStartY		=	Y position of the component.The default position (specified in the 
*								descriptor) is used in case this parameter is set to DEFAULT_POSITION.
*
*	Out		:	None.
*
*	Return	:	Pointer to the Search component if opened successfully, otherwise NULL.
*
*	Desc		: 	Creates, and displays a Search component at a specified position.
****************************************************************************************/
extern MSO_OBJECT __NEAR* OVolume_OpenAtPos(MSO_CONTAINER __NEAR* pParent, UINT16 wStartX, UINT16 wStartY)
{
	if(NULL != pParent)
	{
		MSO_OBJECT __NEAR* pVolumeWnd = NULL;	
		
		
		pVolumeWnd = (MSO_OBJECT __NEAR*)MS_ComponentOpen((MS_DESCRIPTOR_COMPONENT*)&oVolumeControl, pParent);

		if(NULL != pVolumeWnd)
		{
			if((DEFAULT_POSITION != wStartX) || (DEFAULT_POSITION != wStartY))
			{
				wStartX = (DEFAULT_POSITION == wStartX) ? pVolumeWnd->mpDescriptor->moArea.msX : wStartX;
				wStartY = (DEFAULT_POSITION == wStartY) ? pVolumeWnd->mpDescriptor->moArea.msY : wStartY;
				MS_ObjectMove(pVolumeWnd, wStartX, wStartY);
			}
			
			MS_DisplayAddObject(pVolumeWnd);
		}

		return pVolumeWnd;
	}
	return NULL;
}

#endif //D_GUI_COMPONENT_VOLUME_CONTROL

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -