📄 emc_audio.c
字号:
/*******************************************************************************
File name : emc_audio.c
Description : audio management
Revision : 1.0
COPYRIGHT (C) EMC-HUST-JRC 2005.
Date Label Auther Comment
---- ---- ------ ---------------------
01-15-2006 Allen Wu Created
*********************************************************************************/
/* Includes --------------------------------------------------------------------- */
#include "usif.h"
#include "avcontrol.h"
//#include "stosd.h"
//#include "hl_stosd.h"
//#include "OsdRegionInit.h"
#include "gui.h"
#include "osdwrap.h"
#include "emc_mainmenu.h"
#include "emc_menustate.h"
#include "emc_font.h"
#include "emc_audio.h"
/* Private defines ----------------------------------------------------------------*/
#define VOL_BOX_WIDTH 500
#define VOL_BOX_HEIGHT 40
#define VOL_BOX_STEP_LENGTH 5
/* Global variables & structures----------------------------------------------------- */
extern U16 AudLevel;
extern BOOL bAudioMuteState;
extern int AudioMode; /* 0=Stereo; 1=MonoR; 2=MonoL;*/
extern UIMenu_t *currMenu;
extern clock_t infoStartTime;
static BOOL bVolBoxOn = FALSE;
/* Functions--------------------------------------------------------------------- */
extern void SRUIF_UpdateBoxInfo(void);
static void drawVolumeBox(void)
{
int x = (ProviewWindowParams.Width - VOL_BOX_WIDTH)/2;
int y = ProviewWindowParams.Height - VOL_BOX_HEIGHT - 40;
char sVolumeValue[3];
EMC_HideAllRegions();
STOSD_FillRectangle(Handle_ProviewWindow,
x, y, VOL_BOX_WIDTH, VOL_BOX_HEIGHT, dialogcolor);
STOSD_FillRectangle(Handle_ProviewWindow,
x+120, y+10, 63*VOL_BOX_STEP_LENGTH, 20, whitecolor);
STOSD_FillRectangle(Handle_ProviewWindow,
x+120, y+10, AudLevel*VOL_BOX_STEP_LENGTH, 20, darkyellow);
EMC_DrawTextRectangle(Handle_ProviewWindow,
x+15, y+(VOL_BOX_HEIGHT-24)/2, 100, 24,
"VOLUME", JLEFT, FONT_MYFONT, FALSE,
whitecolor, dialogcolor, dialogcolor);
if(AudLevel>=10)
{
sVolumeValue[0] = AudLevel/10+'0';
sVolumeValue[1] = AudLevel%10+'0';
}
else
{
sVolumeValue[0] = '0';
sVolumeValue[1] = AudLevel+'0';
}
/*sprintf(sVolumeValue,"%2d",AudLevel);*/
sVolumeValue[2] = '\0';
EMC_DrawTextRectangle(Handle_ProviewWindow,
x+120+63*VOL_BOX_STEP_LENGTH+5, y+(VOL_BOX_HEIGHT-24)/2, 40, 24,
sVolumeValue, JLEFT, FONT_MYFONT, FALSE,
whitecolor, dialogcolor, dialogcolor);
infoStartTime = time_now();
bVolBoxOn = TRUE;
EMC_ShowRegion();
}
static void updateVolumeValue(dvb_MenuCmd_e eNumber)
{
int x = (ProviewWindowParams.Width - VOL_BOX_WIDTH)/2;
int y = ProviewWindowParams.Height - VOL_BOX_HEIGHT - 40;
char sVolumeValue[3];
if(AudLevel>=10)
{
sVolumeValue[0] = AudLevel/10+'0';
sVolumeValue[1] = AudLevel%10+'0';
}
else
{
sVolumeValue[0] = '0';
sVolumeValue[1] = AudLevel+'0';
}
sVolumeValue[2] = '\0';
switch(eNumber)
{
case cmd_VolUp:
STOSD_FillRectangle(Handle_ProviewWindow,
x+120+(AudLevel-1)*VOL_BOX_STEP_LENGTH, y+10, VOL_BOX_STEP_LENGTH, 20, darkyellow);
break;
case cmd_VolDown:
STOSD_FillRectangle(Handle_ProviewWindow,
x+120+(AudLevel)*VOL_BOX_STEP_LENGTH, y+10, VOL_BOX_STEP_LENGTH, 20, whitecolor);
break;
}
EMC_DrawTextRectangle(Handle_ProviewWindow,
x+120+63*VOL_BOX_STEP_LENGTH+5, y+(VOL_BOX_HEIGHT-24)/2, 40, 24,
sVolumeValue, JLEFT, FONT_MYFONT, FALSE,
whitecolor, dialogcolor, dialogcolor);
infoStartTime = time_now();
bVolBoxOn = TRUE;
}
void msm_AudioManage(dvb_MenuCmd_e eNumber)
{
switch (eNumber)
{
case cmd_VolDown:
case cmd_VolUp:
case cmd_Mute:
SRAVC_AudSetVolume(AudLevel);
if (bAudioMuteState)
SRAVC_AudioMute();
else
SRAVC_AudioUnMute();
SRUIF_UpdateBoxInfo();
break;
case cmd_AudioMode:
if(AudioMode == VOL_BALANCE_CENTRE)
SRAVC_SetAudioOutputMode(STAUD_STEREO_STEREO);
else if(AudioMode == VOL_BALANCE_LEFT_MAX)
SRAVC_SetAudioOutputMode(STAUD_STEREO_DUAL_LEFT);
else if(AudioMode == VOL_BALANCE_RIGHT_MAX)
SRAVC_SetAudioOutputMode(STAUD_STEREO_DUAL_RIGHT);
SRUIF_UpdateBoxInfo();
break;
}
}
void msm_AudioChangeMuteState(void)
{
int index = currMenu->itemSelectedIndex;
if(index == 0)
bAudioMuteState = TRUE;
else
bAudioMuteState = FALSE;
msm_AudioManage(cmd_Mute);
}
void msm_AudioChangeMode(void)
{
int index = currMenu->itemSelectedIndex;
switch(index)
{
case 0:
AudioMode = VOL_BALANCE_CENTRE;
break;
case 1:
AudioMode = VOL_BALANCE_LEFT_MAX;
break;
case 2:
AudioMode = VOL_BALANCE_RIGHT_MAX;
break;
}
msm_AudioManage(cmd_AudioMode);
}
void msm_AudioChangeVolume(dvb_MenuCmd_e eNumber)
{
switch(eNumber)
{
case cmd_Volume:
drawVolumeBox();
break;
case cmd_VolUp:
AudLevel++;
if(AudLevel>63)
AudLevel = 63;
msm_AudioManage(eNumber);
if(bVolBoxOn)
updateVolumeValue(eNumber);
else
drawVolumeBox();
break;
case cmd_VolDown:
if(AudLevel>=1)
AudLevel--;
msm_AudioManage(eNumber);
if(bVolBoxOn)
updateVolumeValue(eNumber);
else
drawVolumeBox();
break;
}
}
void msm_HideVolumeBox(void)
{
bVolBoxOn = FALSE;
//STOSD_FillRectangle(Handle_ProviewWindow,0,0,ProviewWindowParams.Width,ProviewWindowParams.Height,backgroundColor);
//STOSD_HideRegion(Handle_ProviewWindow);
EMC_HideAllRegions();
}
/*------------------------------------EOF---------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -