📄 ge_m.c
字号:
// iMode: Graphic Equalizer mode (DEC_EQUALIZER_xxx)
//
void refresh_ge(int iMode)
{
// Get new values and update display
// code below fills in y and h
BYTE bNewValue;
unsigned char ucColor;
int iValueIndex;
BYTE *ge_value;
if ( ggem.wState == GRAPHIC_EQUALIZER_ON )
{
// Get new values
switch ( iMode )
{
case DEC_EQUALIZER_STD:
ge_value = (BYTE *) EQUALIZER_BANDGAIN_STD;
break;
case DEC_EQUALIZER_CLASS:
ge_value = (BYTE *) EQUALIZER_BANDGAIN_CLASS;
break;
case DEC_EQUALIZER_ROCK:
ge_value = (BYTE *) EQUALIZER_BANDGAIN_ROCK;
break;
case DEC_EQUALIZER_JAZZ:
ge_value = (BYTE *) EQUALIZER_BANDGAIN_JAZZ;
break;
case DEC_EQUALIZER_POP:
ge_value = (BYTE *) EQUALIZER_BANDGAIN_POP;
break;
case DEC_EQUALIZER_USER:
ge_value = (BYTE *) EQUALIZER_BANDGAIN_USER;
break;
}
// Save the bandgain value address in our data structure
ggem.ge_value = ge_value;
// update display
for ( iValueIndex = 0; iValueIndex < GE_MAX_GAIN_BARS; iValueIndex++ )
{
bNewValue = *ge_value;
if ( bNewValue > MAX_GE_VALUE )
{
bNewValue = MAX_GE_VALUE;
}
incremental_draw_bar(iValueIndex, bNewValue);
ge_value++;
}
} // ggem.wState
}
void unhighlight_bar(void)
{
int iHighlightedBar = ggem.iHighlightedBar;
ggem.iHighlightedBar = -1;
draw_bar(iHighlightedBar, ggem.ge_value[iHighlightedBar]);
}
void highlight_bar(int iBarIndex)
{
ggem.iHighlightedBar = iBarIndex;
draw_bar(iBarIndex, ggem.ge_value[iBarIndex]);
}
void move_to_bar( MS_UOP uop )
{
int iNextBar = ggem.iHighlightedBar;
switch ( uop )
{
case MS_UOP_LEFT:
// Move to lefthand bar
if ( iNextBar > 0 )
{
iNextBar--;
unhighlight_bar();
highlight_bar(iNextBar);
}
break;
case MS_UOP_RIGHT:
// Move to righthand bar
if ( iNextBar < (GE_MAX_GAIN_BARS -1) )
{
iNextBar++;
unhighlight_bar();
highlight_bar(iNextBar);
}
break;
}
}
void change_bar_value( MS_UOP uop )
{
int iNewValue = (int) ggem.ge_value[ggem.iHighlightedBar];
if ( uop == MS_UOP_UP )
iNewValue++;
else
if ( uop == MS_UOP_DOWN )
iNewValue--;
if ( (iNewValue >= 0) && (iNewValue < MAX_GE_VALUE) )
{
ggem.ge_value[ggem.iHighlightedBar] = (BYTE) iNewValue;
incremental_draw_bar(ggem.iHighlightedBar, (BYTE) iNewValue);
// This forces the decoder to use the new value from EQUALIZER_BANDGAIN_USER (ggem.ge_value)
{
DWORD d_Cmd;
d_Cmd = (((DWORD)PS_UPDATE_GRAPHIC_EQUALIZER_MODE)<<16) + (DWORD)DEC_EQUALIZER_USER ;
ie_send_ex(IE_CORE_UPDATE_PS, (void *)d_Cmd);
}
//DEC_set_graphic_equalizer_mode( DEC_EQUALIZER_USER );
}
}
//
// When the graphic equalizer mode is USER:
// Arrow keys must move to the lefthand and righthand bars, or change a bar's value.
// Enter should remove highlighting and then be handled by the standard choice_user_op
MS_UOP override_choice_user_op(MS_WIDGET *widget,MS_UOP uop,char param)
{
MS_CHOICE *choice = (MS_CHOICE *)widget;
if ( choice->current_choice == ITEMNUM_GE_USER )
{
switch (uop)
{
case MS_UOP_ENTER:
unhighlight_bar();
// Don't set uop to MS_UOP_NOP because we want the
// choice_user_op below to handle enter as a
// command to change the mode
break;
case MS_UOP_LEFT:
case MS_UOP_RIGHT:
move_to_bar(uop);
uop = MS_UOP_NOP;
break;
case MS_UOP_UP:
case MS_UOP_DOWN:
change_bar_value(uop);
uop = MS_UOP_NOP;
break;
}
}
if ( uop )
{
uop = choice_user_op(widget, uop, param);
}
return uop;
}
//
// React to ENTER in the Graphic Equalizer mode choice
//
static void ge_mode_action(int num)
{
DWORD d_Cmd;
int iMode[] = { DEC_EQUALIZER_STD, DEC_EQUALIZER_CLASS, DEC_EQUALIZER_ROCK, DEC_EQUALIZER_JAZZ, DEC_EQUALIZER_POP, DEC_EQUALIZER_USER };
#ifdef NO_C_STDLIB
dbouts("\nGraphic equalizer mode is ");
dbouti( num );
#endif // NO_C_STDLIB
num = iMode[ num ];
// REMINDER do we need this for graphic equalizer?
d_Cmd = (((DWORD)PS_UPDATE_GRAPHIC_EQUALIZER_MODE)<<16) + (DWORD) num;
ie_send_ex(IE_CORE_UPDATE_PS, (void *)d_Cmd);
// DEC_set_graphic_equalizer_mode(num);
//
// Refresh the display to use the new settings
// This should be done incrementally to obtain best performance
//
if ( num == DEC_EQUALIZER_USER )
{
// Entering user mode, so set up for editing:
// Highlight the first bar
// <<< ZORAN CDE0207 : Fix initial highlight bug
#ifdef DISABLE
ggem.iHighlightedBar = 0;
#else
highlight_bar(0);
#endif // DISABLE
// ZORAN CDE0207 >>>
}
else
{
// If we were in user mode, we're no longer editing
// So unhighlight the current bar
if ( ggem.iHighlightedBar >= 0 )
unhighlight_bar();
}
// Update the display to reflect the new mode's settings
// Note that the ge_value address is updated here
dec_equalizer_mode=num;
refresh_ge(num);
}
static void layout (void)
{
go_CurrentLayout.m_bBigMemMap =FALSE;// USE_BIGMEMMAP_WHEN_REQUIRED;
go_CurrentLayout.m_cPixRes = 0;
go_CurrentLayout.m_wOriginX = 0;
#ifdef FONT32X24 //DM0605
go_CurrentLayout.m_wOriginY = MS_LINE_2;
#else
go_CurrentLayout.m_wOriginY = 60;
#endif
go_CurrentLayout.m_wWidth = LAYOUT_WIDTH;
go_CurrentLayout.m_wHeight = MS_MAX_LINES_SMALLMM;
go_CurrentLayout.m_cNbrHole = 0;
go_CurrentLayout.m_cInitColor = 0;
go_CurrentLayout.m_cNbrColor = 16;
go_CurrentLayout.m_pColorPalette = (OSD_Palette *)MenuBitmapColor;
OSDSetLayout();
OSDSetFont(0);
#ifdef NO_C_STDLIB
rtouts("\nGraphic Equalizer layout");
#endif
}
static void on_ge_close(void)
{
#ifdef NO_C_STDLIB
rtouts("Graphic Equalizer screen closed\n");
#endif
}
static void on_dialog_close(void)
{
#ifdef NO_C_STDLIB
rtouts("Graphic Equalizer dialog closed\n");
#endif
ggem.wState = (WORD) GRAPHIC_EQUALIZER_OFF;
SAFELY_DELETE(dialog_box);
SAFELY_DELETE(choice1);
}
void open_ge(void)
{
screen = MS_create_screen((MS_POS *)&screen_pos, screen_color, 0, on_ge_close, layout);
dialog_box = MS_create_dialog((MS_POS *)&dialog_pos,dialog_color,(MS_DIALOG *)screen, on_dialog_close, MS_HOT_SPOT);
MS_add_item((MS_DIALOG*)screen,(MS_WIDGET*)dialog_box, C_FOCUSED);
choice1 = MS_create_choice(&ge_mode_pos, i_color, &ge_mode_list,&dont_care_pos, ge_mode_action, MS_HOT_SPOT);
choice1->current_choice=dec_equalizer_mode;
((MS_WIDGET *) choice1)->user_op = override_choice_user_op;
// REMINDER We'll need to implement this if we want to default to other than standard
//ge_mode_choice(choice1);
MS_add_item((MS_DIALOG *) dialog_box, (MS_WIDGET *) choice1, C_FOCUSED);
MS_add_item((MS_DIALOG *) dialog_box, (MS_WIDGET *) &mssMode, !C_FOCUSED);
MS_dialog_display((MS_DIALOG*)screen);
init_display();
// REMINDER Change the argument if we default to other than standard
//ggem.iHighlightedBar = -1;
refresh_ge(dec_equalizer_mode);
}
#endif // SPECTRUM_EQUALIZER
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -