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

📄 o_volume_control.c

📁 Zoran V966 DVD 解码 Soc芯片的源程序
💻 C
📖 第 1 页 / 共 3 页
字号:
/* **************************************************************************************
*  Copyright (c) 2005 ZORAN Corporation, All Rights Reserved
*  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
*
*  File: $Workfile: o_volumn_control.c$
*
* Description:
* ========
*
****************************************************************************************/
#include "Config.h"   	// Global Configuration - do not remove!
#ifdef D_GUI_COMPONENT_VOLUME_CONTROL
#ifdef DEBUG_UI_TRACE
#undef IFTRACE
#define IFTRACE if (gTraceUI)
#include "Debug\DbgMain.h"
#endif //DEBUG_UI_TRACE

#include "include\sysdefs.h"
/***************************************************************************************
* Include files
****************************************************************************************/
#include "include\math-macro.h"
#include "Playcore\ps\ps.h"

#include "GUI\Menu_system\ms_screen.h"
#include "GUI\Menu_system\ms_container.h"
#include "GUI\Menu_system\ms_display.h"
#include "GUI\Menu_system\ms_component.h"

#include "CoreAPI\CoreAPI.h"
#include "Strings\Strings.h"

#include "Library\String_generate.h"

#include "GUI\Object_class\Text\mso_text.h"
#include "GUI\Object_class\Hslider\mso_hslider.h"
#include "GUI\Object_class\Vlist\mso_vlist.h"
#include "Components\Message\o_message_handler.h"


#include "GUI\Resource\Bitmap\bitmap.h"
#include "Menu\menu_operation_def.h"
#include "Menu_config\menu_config_common.h"


#ifdef D_GINGER_I86
#include "decoder\osdlayou.h"
#endif //D_GINGER_I86
#ifdef D_GINGER_I96
#include "Osdlayou.h"
#endif //D_GINGER_I96
#ifdef I64_STEP_B_PROGRESSIVE
#include "decoder\decoder.h"
#endif

#include "Components\Volume_control\o_volume_control.h"
#include "Components\Volume_control\o_volume_control_config.h"
#include "Components\Custom\Volume_control\o_volume_control_custom.h"

#ifndef DEBUG_UI_TRACE
#undef dbg_printf(sMsg)
#define dbg_printf(sMsg)
#undef	dbgm_printf(sMsg, mode)
#define dbgm_printf(sMsg, mode)
#endif



/***************************************************************************************
* 	Operation functions
****************************************************************************************/
static MS_OP _VolumePromptOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _VolumeKitOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
static MS_OP _VolumekitVlistOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);

#ifdef  D_SEPARATE_CHANNEL_VOLUME_CONTROL
#ifdef D_CENTER_CHANNEL_VOLUME
static MS_OP _CenterChannelSliderOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif //D_CENTER_CHANNEL_VOLUME
#ifdef D_SURROUND_CHANNEL_VOLUME
static MS_OP _SurroundChannelSliderOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif //D_SURROUND_CHANNEL_VOLUME
#ifdef D_LFE_CHANNEL_VOLUME
static MS_OP _SubWooferChannelSliderOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam);
#endif //D_LFE_CHANNEL_VOLUME
#endif //D_SEPARATE_CHANNEL_VOLUME_CONTROL
/***************************************************************************************
* 	Utility functions
****************************************************************************************/
static BOOL _AddItemsToVolumeKit(MSO_VLIST __NEAR* pList);

STATIC UINT16 _CalcMainVolume(UINT16 wHwValue);
STATIC UINT16 _CalcMainVolumeStep(UINT16 wHwValue);

#ifdef  D_SEPARATE_CHANNEL_VOLUME_CONTROL
STATIC UINT16 _CalcEightChannelVolume(UINT16 wHwValue);
STATIC UINT16 _CalcEightChannelVolumeStep(UINT16 wHwValue);
#endif//D_SEPARATE_CHANNEL_VOLUME_CONTROL
/***************************************************************************************
* 	Action functions
****************************************************************************************/
static UINT16 _MainVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue);

#ifdef  D_SEPARATE_CHANNEL_VOLUME_CONTROL
#ifdef D_LEFT_RIGHT_CHANNEL_VOLUME
static UINT16 _LeftChannelVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
static UINT16 _RightChannelVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
#endif
#ifdef D_CENTER_CHANNEL_VOLUME
static UINT16 _CentreChannelVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
#endif
#ifdef D_SURROUND_CHANNEL_VOLUME
static UINT16 _LeftSurroundChannelVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
static UINT16 _RightSurroundChannelVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
#endif 
#ifdef D_LT_RT_CHANNEL_VOLUME
static UINT16 _LeftDownmixVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
static UINT16 _RightDownmixVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
#endif
#ifdef D_LFE_CHANNEL_VOLUME
static UINT16 _SubwooferChannelVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
#endif
#else
#ifdef D_GUI_HEADPHONE_VOLUME
static UINT16 _HeadphoneVolumeSliderAction(HSLIDER_ACTION eType, UINT16 wValue);
#endif
#endif // D_SEPARATE_CHANNEL_VOLUME_CONTROL

/***************************************************************************************
* 	Display functions
****************************************************************************************/
static BOOL _VolumeFillOSDSeg(MSO_OBJECT __NEAR* pThis, MS_AREA __NEAR* pAbsArea);

#include "Components\Custom\Volume_control\o_volume_control_custom.c"
#include "Components\Volume_control\o_volume_control_config.c"



/***************************************************************************************
*	Function 	: 	_VolumePromptOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The Volume Prompt component operation function.
****************************************************************************************/
static MS_OP _VolumePromptOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
#ifdef  D_GUI_O_VOLUME_CONTROL_TIMEOUT 
 	MSO_VOLUMN_CONTROL __NEAR* pHVolumeSlider = (MSO_VOLUMN_CONTROL __NEAR*)pThis;
#endif
	switch(MsOp)
	{
        case MS_OP_INIT:
#ifdef  D_GUI_O_VOLUME_CONTROL_TIMEOUT 
        pHVolumeSlider->moParam.mwTimeOut = TIMEOUT_VOLUME_DISPLAY;
#endif
		MS_ComponentInitFocus((MSO_COMPONENT __NEAR*)pThis);
		break;

	// TODO: When close the volumn object is more reasonalbe
	case MS_OP_CORE_MEDIA_CHANGED:  //Fall Thru
	case MS_OP_VOLUME: //Fall Thru
		MS_SendOperation(pThis, MS_OP_CLOSE_PARENT,  0);
		return MS_OP_NONE;

	//case MS_OP_VOLUME:
	case MS_OP_POWER:
	case MS_OP_PLAY_MODE: //Fall Thru
	case MS_OP_PROLOGIC:  	// Temp done
	case MS_OP_SEARCH: //Fall Thru
	case MS_OP_EJECT: //Fall Thru
	case MS_OP_STOP: //Fall Thru
	case MS_OP_PLAY:
		MS_SendOperation(pThis, MS_OP_CLOSE_PARENT,  0);
		break;
	case MS_OP_CLOSE_PARENT:
		// When close the component, save volume value to Ps.
		CoreAPI_UpdatePlayerSetting(PS_UPDATE_SAVE_SETTINGS, 0);
		break;

  #ifdef  D_GUI_O_VOLUME_CONTROL_TIMEOUT 
	case MS_OP_TICK:
		if(  pHVolumeSlider->moParam.mwTimeOut != 0)
				 pHVolumeSlider->moParam.mwTimeOut--;
		else
				MS_SendOperation(pThis, MS_OP_CLOSE_PARENT,  0);
		break;
#ifndef D_VOLUME_SINGLE_KEY
	case MS_OP_UP:
	case MS_OP_DOWN:
	case MS_OP_LEFT:
	case MS_OP_RIGHT:
		pHVolumeSlider->moParam.mwTimeOut = TIMEOUT_VOLUME_DISPLAY;
		break;
#endif
  #endif //D_GUI_O_VOLUME_CONTROL_TIMEOUT

#ifndef D_VOLUME_SINGLE_KEY
	case MS_OP_VOLUME_UP:
		MS_SendOperation(pThis, MS_OP_RIGHT,  0);
		return MS_OP_NONE;

	case MS_OP_VOLUME_DOWN:
		MS_SendOperation(pThis, MS_OP_LEFT,  0);
		return MS_OP_NONE;
#else
	case MS_OP_VOLUME_UP:
                pHVolumeSlider->moParam.mwTimeOut = TIMEOUT_VOLUME_DISPLAY;
		return MS_ComponentBasicOperation(pThis, MS_OP_RIGHT, lParam);
	case MS_OP_VOLUME_DOWN:
                pHVolumeSlider->moParam.mwTimeOut = TIMEOUT_VOLUME_DISPLAY;
		return MS_ComponentBasicOperation(pThis, MS_OP_LEFT, lParam);
#endif
	default :
		break;
	}
	return MS_ComponentBasicOperation(pThis, MsOp, lParam);
}


/***************************************************************************************
*	Function 	: 	_VolumeKitOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The Volume kit operation function.
****************************************************************************************/
#pragma argsused
static MS_OP _VolumeKitOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	//Pre-processing
	// TODO : if any	

	MsOp = VScrollListOperation(pThis, MsOp, lParam);

	// Post-processing
	switch(MsOp)
	{		
	case MS_OP_REFRESH:
		{			
			MSO_VLIST __NEAR* pList = (MSO_VLIST __NEAR*)MS_GetObjectListPtr(pThis);				
			MS_ASSERT(NULL != pList);
			
			//NO need this sentence. Mode choice pList->moParam.mwTotalItems will change from 1 to 4, if mode is Volume music
			if(pList->moParam.mwTotalItems > pList->moParam.mcNumVisibleItems)
			{
				// Remove all items.
				MS_SendOperation((MSO_OBJECT __NEAR*)pList, MS_OP_EMPTY, 0);

				_AddItemsToVolumeKit(pList);
				
				MS_DisplayAddObject(pThis);	

				// Set focus to the appropriate list item.
				if(MS_IsFocused(pList))
				{
					MSO_OBJECT __NEAR* pObject = MS_GetObjectListPtr(pList);
						
					if(!MS_IS_FOCUS_ON_LASTITEM(pList))	
						MS_ScreenSetFocusObject(pObject);
					else
					{						
						// Make sure we do not set focus on the Value VScroll list.					
						while(NULL != pObject->mpNext)
							pObject = pObject->mpNext;						
						MS_ScreenSetFocusObject(pObject);
					}
				}
			}			
		}
		return MS_OP_NONE;
		
	default:
		break;
	}	
	return MsOp;
}

/***************************************************************************************
*	Function 	: 	_VolumekitVlistOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The Volume kit VLIST operation function.
****************************************************************************************/
#pragma argsused
static MS_OP _VolumekitVlistOperation(MSO_OBJECT __NEAR* pThis, MS_OP MsOp, UINT32 lParam)
{
	switch(MsOp)
	{
	case MS_OP_INIT:
		return MS_OP_NONE;
		
	case MS_OP_OPEN:
		{
			_AddItemsToVolumeKit((MSO_VLIST __NEAR*)pThis);
		}
		break;

	default:
		break;
	}	
	return VListOperation(pThis, MsOp, lParam);
}


#ifdef  D_SEPARATE_CHANNEL_VOLUME_CONTROL
/***************************************************************************************
*	Function 	: 	_SubWooferChannelSliderOperation
*
*	In		:
*
*	Out		:
*
*	Desc 	:	The choice operation of all the slider objects.
****************************************************************************************/
#ifdef D_LFE_CHANNEL_VOLUME
#pragma argsused
static MS_OP _SubWooferChannelSliderOperation(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 subwoofer speaker is off.
			if(SW_NOT_PRESENT == SpeakersConfigTable[wSpeakerConfigIndex].mSubwoofer)
			{	
				MS_SendOperation(pThis, MS_OP_REFRESH, 0);
				if (!MS_IS_HSLIDER_DISABLED(pThis))

⌨️ 快捷键说明

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