📄 ge_m.c
字号:
/***********************************************************************/
/* File: */
/* Copyright (c) 2000 ZORAN Corporation, All Rights Reserved */
/* THIS IS PROPRIETARY SOURCE CODE OF ZORAN CORPORATION */
/* */
/* =========== */
/* Descripton: */
/* =========== */
/* */
/* Log: */
/* === */
/* $Name: V_1_16 V_1_15 V_1_14 V_1_13 V_1_12 NV_1_00 V_1_11 $
/* $Header: v:/dsg/rcs/dsg/vp2k/Customer/menu/zoran/ge_m.c 1.13 2001/06/11 08:09:10 dingming Exp $
/* $Log: ge_m.c $
/* Revision 1.13 2001/06/11 08:09:10 dingming
/* Revision 1.12 2001/06/06 10:56:20 dingming
/* Revision 1.11 2001/06/06 06:15:07 dingming
/* font 32X24 complile
/* Revision 1.10 2001/02/08 19:00:45 charlie
/* Fix Graphic Equalizer highlighting bugs
/* Revision 1.9 2001/02/08 03:53:27 charlie
/* Fix graphic equalizer highlight bug ( temporary fix )
/* Revision 1.8 2000/11/19 00:04:56 charlie
/* Added comment for MS_UOP_ENTER; Changed 0 to
/* MS_UOP_NOP
/* Revision 1.7 2000/11/17 18:54:12 charlie
/* Use C_FOCUSED
/* Revision 1.6 2000/11/17 02:08:18 cliff
/***********************************************************************/
#ifdef SPECTRUM_EQUALIZER
//
// ge_m.c
//
#include <stdio.h>
#include <string.h>
#include "sysdefs.h"
#include "..\..\..\ui\menu_sys\ms_wdgt.h"
#include "..\..\..\ui\menu_sys\ms_lib.h"
#include "..\..\..\ui\menu_sys\osd_drv.h"
#include "..\..\..\decoder\osdrendr.h"
#include "..\..\..\decoder\osdlayou.h"
#ifdef FONT32X24 //DM0605
#include "..\..\..\customer\dragon\strings\strings.h"
#else
#include "..\..\..\ui\strings\strings.h"
#endif
#include "menu_var.h"
#include "..\..\..\playcore\ps\ps.h"
#include "..\..\..\playcore\coremain\coregdef.h"
#include "..\..\..\kernel\eventdef.h"
// REMINDER This is not needed if we don't use oHWLimit
#include "..\..\..\Decoder\decoder.h"
#ifndef SPECTRUM_EQUALIZER
#define EQUALIZER_BANDGAIN_SZ 6
typedef enum {
DEC_EQUALIZER_STD,
DEC_EQUALIZER_CLASS,
DEC_EQUALIZER_ROCK,
DEC_EQUALIZER_JAZZ,
DEC_EQUALIZER_POP,
DEC_EQUALIZER_USER
} DEC_EQUALIZER_MODE;
typedef struct
{
BYTE band1;
BYTE band2;
BYTE band3;
BYTE band4;
BYTE band5;
BYTE band6;
} EQUALIZER_BANDGAIN;
extern const EQUALIZER_BANDGAIN EQUALIZER_BANDGAIN_STD[];
extern const EQUALIZER_BANDGAIN EQUALIZER_BANDGAIN_CLASS[];
extern const EQUALIZER_BANDGAIN EQUALIZER_BANDGAIN_ROCK[];
extern const EQUALIZER_BANDGAIN EQUALIZER_BANDGAIN_JAZZ[];
extern const EQUALIZER_BANDGAIN EQUALIZER_BANDGAIN_POP[];
EQUALIZER_BANDGAIN EQUALIZER_BANDGAIN_USER[] = {10,10,10,10,10,10};
#endif // SPECTRUM_EQUALIZER
extern DEC_EQUALIZER_MODE dec_equalizer_mode;
typedef struct _GEM
{
WORD wState;
int iHighlightedBar;
BYTE *ge_value;
BYTE prev_ge_value[EQUALIZER_BANDGAIN_SZ];
} GEM;
#define GRAPHIC_EQUALIZER_OFF 0
#define GRAPHIC_EQUALIZER_ON 1
GEM ggem =
{
GRAPHIC_EQUALIZER_OFF,
-1,
NULL,
{ 0, 0, 0, 0, 0, 0}
};
#define MAX_GE_VALUE 20
#define GE_FG_COLOR 0xC
#define GE_MIDG_COLOR 0xD
#define GE_BG_COLOR 0x3
#define GE_FG_COLOR_HIGHLIGHT 0x2
#define GE_MIDG_COLOR_HIGHLIGHT 0x6
// REMINDER Should be redefined when decoder.h exposes EQUALIZER_BANDGAIN_SZ
//#define GE_MAX_GAIN_BARS EQUALIZER_BANDGAIN_SZ
#define GE_MAX_GAIN_BARS 6
#define GE_BAR_WIDTH 8
#define GE_BAR_SPACING 4
#define LAYOUT_WIDTH 720
#define GE_DISPLAY_WIDTH ( GE_BAR_SPACING + GE_MAX_GAIN_BARS * (GE_BAR_WIDTH + GE_BAR_SPACING) )
#define GE_DISPLAY_X_ORIGIN ( ((LAYOUT_WIDTH - GE_DISPLAY_WIDTH) / 2 ) & ~0x0007 )
#define LAYOUT_HEIGHT MS_MAX_LINES_SMALLMM
#define GE_DISPLAY_HEIGHT 100
#define GE_DISPLAY_Y_ORIGIN (MS_LINE_1 + 4)
#define GE_SCREEN_WIDTH 600
// Widget positions
static const MS_POS screen_pos = {60, MS_LINE_2, GE_SCREEN_WIDTH, MS_MAX_LINES_SMALLMM};
static const MS_POS dialog_pos ={0, MS_LINE_0, GE_SCREEN_WIDTH, MS_MAX_LINES_SMALLMM};
#ifdef FONT32X24 //DM0605
static const MS_POS ge_mode_pos = {250, MS_LINE_0 ,296, MS_LINE_HEIGHT};
#else
static const MS_POS ge_mode_pos = {200, MS_LINE_0 ,296, MS_LINE_HEIGHT};
#endif
static const MS_POS dont_care_pos = {200, MS_LINE_1, 0, 0};
#ifdef D_TITLE
static const MS_STATIC mssMenuTitle = {
{
0,
ALIGN_LEFT,
I_COLOR,
{16, MS_LINE_0, 200, MS_LINE_HEIGHT},
NO_PARENT,
static_user_op,
},
(void *)S_GRAPHIC_EQUALIZER
};
#endif // D_TITLE
static const MS_STATIC mssMode = {
{
0,
ALIGN_LEFT,
I_COLOR,
{16, MS_LINE_0, 200, MS_LINE_HEIGHT},
NO_PARENT,
static_user_op,
},
(void *)S_GRAPHIC_EQUALIZER
};
//
// Mode choice information
//
// Item numbers: these correspond to DEC_EQUALIZER_xxx,
#define ITEMNUM_GE_STD 0
#define ITEMNUM_GE_CLASS 1
#define ITEMNUM_GE_ROCK 2
#define ITEMNUM_GE_JAZZ 3
#define ITEMNUM_GE_POP 4
#define ITEMNUM_GE_USER 5
static const OSD_MESSAGES ge_mode_list_c[] = {
S_STANDARD,
S_CLASSICAL,
S_ROCK,
S_JAZZ,
S_POP,
S_USER
};
const MS_TEXT_LIST ge_mode_list = {
6,(int *) ge_mode_list_c
};
#define BAR_X_OFFSET(_iBarIndex_) ( GE_BAR_SPACING + (_iBarIndex_) * ( GE_BAR_SPACING + GE_BAR_WIDTH ) )
#define SCALE_Y(_y_) ((_y_) * GE_DISPLAY_HEIGHT / MAX_GE_VALUE )
#define MAP_Y(_y_) ( GE_DISPLAY_HEIGHT - SCALE_Y(_y_))
#define BAR_FG_COLOR(_iBarIndex_) ( (_iBarIndex_ == ggem.iHighlightedBar) ? GE_FG_COLOR_HIGHLIGHT : GE_FG_COLOR )
#define BAR_MIDG_COLOR(_iBarIndex_) ( (_iBarIndex_ == ggem.iHighlightedBar) ? GE_MIDG_COLOR_HIGHLIGHT : GE_MIDG_COLOR )
void draw_bar(int iBarIndex, BYTE bValue)
{
unsigned short x = GE_DISPLAY_X_ORIGIN + BAR_X_OFFSET(iBarIndex);
unsigned short w = GE_BAR_WIDTH;
unsigned short y = 0;
unsigned short h = 0;
unsigned short yBar = 0;
unsigned short hBar = 0;
unsigned char ucColor;
// Draw foreground rect
yBar = 0;
hBar = bValue;
ucColor = BAR_FG_COLOR(iBarIndex);
y = MAP_Y(yBar + hBar);
h = MAP_Y(yBar) - y;
if ( h )
OSD_PutRect( x, y + GE_DISPLAY_Y_ORIGIN, w, h, ucColor );
ucColor = BAR_MIDG_COLOR(iBarIndex);
y = 0;
h = ( GE_DISPLAY_HEIGHT - h );
if ( h )
OSD_PutRect( x, y + GE_DISPLAY_Y_ORIGIN, w, h, ucColor );
ggem.prev_ge_value[iBarIndex] = bValue;
}
void incremental_draw_bar(int iBarIndex, BYTE bNewValue)
{
BYTE bPrevValue;
unsigned short x = GE_DISPLAY_X_ORIGIN + BAR_X_OFFSET(iBarIndex);
unsigned short w = GE_BAR_WIDTH;
unsigned short y = 0;
unsigned short h = 0;
unsigned short yBar = 0;
unsigned short hBar = 0;
unsigned char ucColor;
bPrevValue = ggem.prev_ge_value[iBarIndex];
if ( bNewValue != bPrevValue )
{
if ( bNewValue < bPrevValue )
{
yBar = bNewValue;
hBar = bPrevValue - bNewValue;
ucColor = BAR_MIDG_COLOR(iBarIndex);
}
else
// if ( bNewValue > bPrevValue )
{
yBar = bPrevValue;
hBar = bNewValue - bPrevValue;
ucColor = BAR_FG_COLOR(iBarIndex);
}
y = MAP_Y(yBar + hBar);
h = MAP_Y(yBar) - y;
if ( h )
OSD_PutRect( x, y + GE_DISPLAY_Y_ORIGIN, w, h, ucColor );
}
ggem.prev_ge_value[iBarIndex] = bNewValue;
}
void init_display(void)
{
int iValueIndex;
unsigned short x = GE_DISPLAY_X_ORIGIN + BAR_X_OFFSET(0);
unsigned char ucColor = GE_MIDG_COLOR;
for ( iValueIndex = 0; iValueIndex < GE_MAX_GAIN_BARS; iValueIndex++ )
{
OSD_PutRect( x, GE_DISPLAY_Y_ORIGIN, GE_BAR_WIDTH, GE_DISPLAY_HEIGHT, ucColor );
x += GE_BAR_WIDTH + GE_BAR_SPACING;
ggem.prev_ge_value[iValueIndex] = 0;
}
{
DWORD d_Cmd;
d_Cmd = (((DWORD)PS_UPDATE_GRAPHIC_EQUALIZER_MODE)<<16) + (DWORD)dec_equalizer_mode ;
ie_send_ex(IE_CORE_UPDATE_PS, (void *)d_Cmd);
}
//DEC_set_graphic_equalizer_mode(dec_equalizer_mode);
ggem.wState = (WORD) GRAPHIC_EQUALIZER_ON;
}
// Update the graphic equalizer display
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -