📄 osd_midi.c
字号:
//--------------------------------------
//created by ouyang 2004.08.16
//For MIDI UI
//--------------------------------------
/*
** FILE
** osd_midi.c
**
** DESCRIPTION
** control MIDI UI interface.
*/
//*************************************************
//************For Midi OSD Lyric***********************
//*************************************************
#ifdef SUPPORT_OSDLYRIC
#include "fsmidi.h"
#ifdef SUPPORT_MIDI_MENU_SEL //by dtb in 20040225
#include "fsMidiUI.h"
#endif
#ifdef SUPPORT_PINYINGDELAY //xlluo add 04-11-15
inline int SetPinyingDelay(void)
{
return MIDI_PINYINGINPUT_DELAY; //about 1.5 s
}
#endif
#ifdef SUPPORT_SANJING_SCORE //xlluo for sanjin score 04-10-23
int ScoreDelay(void)
{
//TODO: add your code here
//this func will be calling when score start
return (10000); //default is 2.5 second,unit millisec
}
char * SetScoreGalaStr(int score)
{
//TODO: add your code to replase inhere
//this func would call when show score num
//[out]: the return value would be use disp str
//below scorenum and flush right
//max strlen is 12 chinese characters
//return NULL to show nothing
//[in]score :the num of score would be display on screen,max is 100
char * str[] ={"唱得不错嘛",};
printf("cur score %d\n",score);
return str[0];
}
//special score mode relase to sanjin //xlluo add for custormer request
//2004-11-06
//use macro GETSCOREMODE() to get the score mode
//you can all your code which get new score and refresh
//display item in func. "char * SetScoreGalaStr(int score)"
//I would call the func DrawLTSUI or DrawDKSUI decording to you control.
//when you select the selection "open DKS" or "open LTS"
//I will do that
// first: enable the score mode
// second: call the func. below by your selection
// thrid: set the score mode
// at last: refresh the menu
void DrawLTSUI()
{
//disp the title of LTSUI
//TODO: you should rewrite or modify the ui drawfunc.
int dispX[] ={
10,105, //left column
200,400, //mid column
400,470, //right column
};
draw_midi_bitmap_HZnew(Score_Str_LTS[0], dispX[2]+10, 10, 6, 0, 2, 2, 0);
draw_midi_bitmap_HZnew(Score_Str_LTS[1], dispX[2]+50+10, 10, 6, 0, 2, 2, 0);
draw_midi_bitmap_HZnew(Score_Str_LTS[2], dispX[2]+100+10, 10, 6, 0, 2, 2, 0);
//TODO: add initial draw code here
}
void DrawDKSUI()
{
//disp the title of DKSUI
//TODO: you should rewrite or modify the ui drawfunc.
int dispX[] ={
20,85, //left column
200,400, //mid column
400,470, //right column
};
draw_midi_bitmap_HZnew(Score_Str_DKS[0], dispX[2]-15+24, 0, 6, 0, 2, 2, 0);
draw_midi_bitmap_HZnew(Score_Str_DKS[1], dispX[2]-15+50+24, 0, 6, 0, 2, 2, 0);
draw_midi_bitmap_HZnew(Score_Str_DKS[2], dispX[2]-15+100+24, 0, 6, 0, 2, 2, 0);
//TODO: add initial draw code here
}
//++++++++++++++++++++++++++++++++++++++++++++++++++
//IF THERE IS ANY QUESTION.PLEASE CALL ME OR SEND A MAIL FOR ME
// SUNMEDIA XLLUO
// 86-028-87848688-5816
// MAIL: xlluo@sunplus.com.cn
//++++++++++++++++++++++++++++++++++++++++++++++++++
#endif
//BYTE LyricFontcolor, LyricBgcolor, LyricRevcolour, LyricFigureColor;
#ifdef SUPPORT_REPREGIONCOL //ouyang 2004.07.31
void osd_updataRegion_Color(BYTE R,BYTE G,BYTE B,BYTE A,BYTE code,BYTE regNum)
{
int i =0;
BYTE *osdhead[2];
BYTE *obase;
UINT32 repCol = __palette4F(G, B, R, A);
// osd_tog_region(regNum,OSD_OFF);
if(osd_active_regions<=regNum) return;//error
osdhead[0] =(UINT16*)(get_osdbuf_baseptr() + region[regNum].osd_header[0] * 32);//get osd head pos //ouyang 2004.07.31
if (((((*(osdhead[0]))>>BIT_MD)&0x07) ==OSD_FORMAT_16COLOR)//get color format
&&((((*(osdhead[0]+2))>>BIT_CLUT_TYPE)&0x03) ==OSDV2_CLUT_32b))//for 32 bit clut
{
for (i =0;i<2;i++)
{
osdhead[i] =(UINT16*)(get_osdbuf_baseptr() + region[regNum].osd_header[i] * 32);//get osd head pos
obase =osdhead[i]+HEADER_SIZE;
while (code) //code is base 0, colour clut index
{
code --;
obase += OSD_CLUT_SIZE;
}
wbe32(obase,repCol);
}//__palette4F(130,130,130,130)
}
}
#endif
#ifdef SUPPORT_REGION2_DOT
void osd_midi_init(void)
{
int i;
__osd_init();
#define MIDI_HEADER 4
//setup region 3
header_id = MIDI_HEADER;
region[3].osd_w = MIDI_LYRIC_REGION >> 1;
region[3].osd_h = MIDI_LYRIC_HEIGHT;
osd_create_region1(®ion[3], 20, 150 + 30, NULL, OSD_FORMAT_16COLOR,
OSD_INTERLACED);
//setup region 2
header_id = MIDI_HEADER;
region[2].osd_w = MIDI_MENU_REGION >> 1;
region[2].osd_h = MIDI_MENU_HEIGHT;
osd_create_region1(®ion[2], 20/* 50*/, 60, ®ion[3],
OSD_FORMAT_16COLOR, OSD_INTERLACED);
//setup region 1
header_id = NORMAL_HEADER;
region[1].osd_w = 36 * 4;
region[1].osd_h = OSD_FONT_HEIGHT;
osd_create_region1(®ion[1], 32, 45, ®ion[2], OSD_FORMAT_4COLOR,
OSD_INTERLACED);
//setup region 0
header_id = MIDI_HEADER;
region[0].osd_w = 320;
region[0].osd_h = 60;
osd_create_region1(®ion[0], 26, 15, ®ion[1], OSD_FORMAT_16COLOR,
OSD_INTERLACED);
osd_active_regions = 4;
#ifdef SUPPORT_SCANMODE_SWITCH
SwitchRegionTVformat();//xlluo add 04-6-14
#endif
#ifdef SUPPORT_REPREGIONCOL
// osd_updataRegion_Color(130,130,130,130,0,REGION0);
#endif
osd_init__();
}
#else //#ifdef SUPPORT_REGION2_DOT
//xlluo 03-7-2
void osd_midi_init(void)
{
__osd_init();
#define MIDI_HEADER 3///4
/* //setup region 3
header_id = MIDI_HEADER;
region[3].osd_w = 320;
region[3].osd_h = 140;
osd_create_region1(®ion[3], 20, 150, NULL, OSD_FORMAT_16COLOR,
OSD_INTERLACED); */
//setup region 2
header_id = MIDI_HEADER;
region[2].osd_w = 200;
region[2].osd_h = 190;
osd_create_region1(®ion[2], 78, 60, ®ion[3], OSD_FORMAT_16COLOR,
OSD_INTERLACED);
//setup region 1
header_id = NORMAL_HEADER;
region[1].osd_w = 36 * 4;
region[1].osd_h = OSD_FONT_HEIGHT;
osd_create_region1(®ion[1], 32, 45, ®ion[2], OSD_FORMAT_4COLOR,
OSD_INTERLACED);
//setup region 0
header_id = MIDI_HEADER;
region[0].osd_w = 320;
region[0].osd_h = 60;
osd_create_region1(®ion[0], 26, 15, ®ion[1], OSD_FORMAT_16COLOR,
OSD_INTERLACED);
osd_active_regions = MIDI_HEADER;
osd_init__();
}
#endif //end #ifdef SUPPORT_REGION2_DOT
#ifdef HDD_MODIFY_INDEX_TEST
void osd_copy_vcd_init(void)
{
__osd_init();
#define MIDI_HEADER 4
//setup region 1
header_id = MIDI_HEADER;
region[1].osd_w = 100;
region[1].osd_h = 90;
osd_create_region1(®ion[1], 20, 185, NULL, OSD_FORMAT_16COLOR,OSD_INTERLACED);
//setup region 0
header_id = MIDI_HEADER;
region[0].osd_w = 220;
region[0].osd_h = 200;
osd_create_region1(®ion[0], 50, 40, ®ion[1], OSD_FORMAT_16COLOR,OSD_INTERLACED);
osd_active_regions =2;
osd_init__();
}
#endif
void LyricSetColor(BYTE color, BYTE revercolour)
{
LyricFontcolor = color;
LyricBgcolor = FONT_BACKGROUND_COLOUR;
if (LyricFontcolor == LYRIC_INIT_COLOUR)
LyricFigureColor = FONT_FIGURE_COLOUR;
else
LyricFigureColor = FONT_FIGURE_REV_COLOUR;
LyricRevcolour = revercolour;
}
/****************************************
*** function :draw the font bitmap ;
*** pFont: the pointer of the font bitmap data
*** xStart,yStart: the coordinate
*** fontcolor: the font color
*** bgcolor : the background color of the font
*** FigureColor: the figure color of the font
*** FontType : the font type
*** number: the OSD region NO.
****************************************/
void draw_midi_bitmap_HZnew(const UINT8* pFont, int xStart, int yStart,
BYTE fontcolor, BYTE bgcolor, BYTE FigureColor, BYTE FontType,
BYTE number)
{
BYTE CurrentByte, CurrentByte1, CurrentBit, CurrentBit1;
BYTE NewFormatFlag,bDispHalfByte;
UINT8* p1Font;
UINT8* pTopLine, * pBtmLine, * pLine;
UINT32 iDispLoc, disploc = 0;
int iRegionWidth = region[number].osd_w ;
int osd_format = region[number].osd_format;
unsigned int fwidth,fhight,fbit=0;
unsigned int i, j, Bperpixel,shift_num,tempi;
pTopLine = (BYTE *)(((BYTE *) get_osdbuf_baseptr()) +
(region[number].osd_header[0] + OSD_DATA_OFFSET(region[number].osd_format)) * 32);
pBtmLine = (BYTE *)(((BYTE *) get_osdbuf_baseptr()) +
(region[number].osd_header[1] + OSD_DATA_OFFSET(region[number].osd_format)) * 32);
yStart = (p_scan) ? yStart : yStart>>1;
iDispLoc = (yStart ) * iRegionWidth + xStart;
bDispHalfByte = iDispLoc & 0x01;
iDispLoc = (((yStart - ((yStart) & 0x01)) * iRegionWidth ) + (xStart))>>1;
switch (osd_format)
{
case OSD_FORMAT_4COLOR:
Bperpixel = 2; // 4
shift_num = 2;
break;
case OSD_FORMAT_256COLOR:
Bperpixel = 0; // 1
shift_num = 8;
break;
case OSD_FORMAT_16COLOR:
Bperpixel = 1; // 2
shift_num = 4;
break;
default:
Bperpixel = 1; // 2
shift_num = 4;
break;
}
//judge the format
NewFormatFlag = pFont[0];
if (NewFormatFlag != 0xff)
{
fwidth = pFont[0];
fhight = pFont[1];
}
else
{
fhight = (pFont[4] << 8) | pFont[3];
fwidth = (pFont[6] << 8) | pFont[5];
fbit = fwidth * fhight;
}
if (NewFormatFlag != 0xff)
{
disploc = 0;
for (i = 0; i < fhight; i++)
{
if (((i + yStart) & 0x01)||(p_scan ==1))
pLine = pBtmLine;
else
pLine = pTopLine;
for (j = 0; j < fwidth; j++)
{
tempi = (j+bDispHalfByte) >> Bperpixel;
if (pFont[((j + disploc) >> 3) + 3] & (0x80 >>
((j + disploc) & 0x07)))
pLine[iDispLoc + tempi] = (pLine[iDispLoc + tempi] <<
shift_num) |
fontcolor;
else
pLine[iDispLoc + tempi] = (pLine[iDispLoc + tempi] <<
shift_num) |
bgcolor;
}
disploc += fwidth ;
if (((i + yStart) & 0x01)||(p_scan ==1))
iDispLoc += iRegionWidth;
}
}
else
{
switch(FontType)
{
case 0:
fontcolor=bgcolor;
break;
case 1:
FigureColor=bgcolor;
break;
case 2:
// FigureColor = 11;
break;
default:
break;
}
if (fbit & 0x07)
{
p1Font = (UINT8 *)pFont + (fbit >> 3) + 1;
}
else
{
p1Font = (UINT8 *)pFont + (fbit >> 3);
}
disploc = 0;
for (i = 0; i < fhight; i++)
{
if (((i + yStart) & 0x01)||(p_scan ==1))
pLine = pBtmLine;
else
pLine = pTopLine;
for (j = 0; j < fwidth; j++)
{
CurrentByte = pFont[((j + disploc) >> 3) + 10];
CurrentByte1 = p1Font[((j + disploc) >> 3) + 10];
CurrentBit = CurrentByte & (0x80 >> ((j + disploc) & 0x07));
CurrentBit1 = CurrentByte1 & (0x80 >> ((j + disploc) & 0x07));
tempi = (j+bDispHalfByte) >> Bperpixel;
if (CurrentBit != 0 && CurrentBit1 != 0)
{
pLine[iDispLoc + tempi] = ((pLine[iDispLoc + tempi] <<
shift_num) & 0xf0) |
fontcolor; //0x02;//
}
else if (CurrentBit == 0 && CurrentBit1 != 0)
{
pLine[iDispLoc + tempi] = ((pLine[iDispLoc + tempi] <<
shift_num) & 0xf0) |
FigureColor;//0x0b;//
}
else
{
pLine[iDispLoc + tempi] = ((pLine[iDispLoc + tempi] <<
shift_num) & 0xf0) |
bgcolor; // 0x00;//
}
}
disploc += fwidth ;
if (((i + yStart) & 0x01)||(p_scan ==1))
iDispLoc += iRegionWidth;
}
}
// osd_tog_region(number, OSD_ON);
osd_tog_region(number, OSD_ON); //ouyang 2004.07.31
}
#ifdef SUPPORT_ABSTRACT_FONT
/*****************************************************************************
*** function :draw the font bitmap of the GB1 and GB2 ;support the new GB font.
after abstracting the Font bitmap from CD-ROM, call it to draw the respoding HZ
** xStart,yStart: the coordinate
** c: GB code
** fontcolor: the font color
** bgcolor : the background color of the font
** FigureColor: the figure color of the font
** FontType : the font type
** number: the OSD region NO.
** FontBaseNo: the font database NO.
******************************************************************************/
void osd_midi_DrawHZ_Mem(int xStart, int yStart, UINT16 c, BYTE fontcolor,
BYTE bgcolor, BYTE FigureColor, BYTE FontType, BYTE number,
BYTE FontBaseNo) //BYTE fontcolor, BYTE bgcolor,BYTE FigureColor,
{
BYTE CurrentByte, CurrentByte1, CurrentBit, CurrentBit1;
BYTE NewFormatFlag = 0,bDispHalfByte;
BYTE* p1Font, * pFont = (void*) (0);
BYTE* pTopLine, * pBtmLine, * pLine;
UINT32 iDispLoc, disploc;
int iRegionWidth = region[number].osd_w ; //>>bIsMenuFont;
int osd_format = region[number].osd_format;
unsigned int fwidth = 0,fhight = 0,fbit;
unsigned int i, j, Bperpixel,shift_num,tempi;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -