📄 sound.c
字号:
/*****************************************************\
Creater: Terry
Date : 2001/5/11 12:49PM
Description: Setup menu using
\*****************************************************/
#include "global.h"
#include "osd.h"
#include "func.h"
#include "ircmd.h"
#include "memmap.h"
#include "regmap.h"
#include "auctrl.h"
#include "cchar.h"
#include "vfd.h"
#if SUPPORT_OSD
#define MONE_sound
#define MAX_BAND 7
#define MAX_MUSIC 5
//extern void InitSW_region(void);
//extern void osd_print_eq_setting(UINT8 r, UINT8 unSele);
//extern void osd_print_realtime_eq(UINT8 r, BYTE * p, BYTE ch);
//extern int CheckDspCtrlRdy();
/*********** Item description **********************\
BYTE function
0 mode(MSB 4bits) ==>show direction picture
0x0:no effect
0x1:basic select function
0x2:can enter number
0x3:need run function by osd id
1 title ---sw region 1
2~6 select item ---sw region 2
\******************************************************/
#if CONFIG==CONFIG_COMBO_SVCD
const UINT8 music_osd_set[MAX_MUSIC][MAX_BAND] = {
{13, 13, 13, 13, 13, 13, 13}, //standard
{21, 16, 8, 5, 8, 16, 21}, //classic
{25, 17, 5, 11, 5, 17, 25}, //rock
{3, 10, 16, 22, 16, 10, 3}, //jazz
{18, 24, 16, 13, 10, 2, 8}, //pop
};
UINT8 user_osd_set[MAX_BAND] = {
13, 13, 13, 13, 13, 13, 13
};
#else
const UINT8 music_osd_set[MAX_MUSIC][MAX_BAND] = {
{11, 11, 11, 11, 11, 11, 11}, //standard
{19, 14, 6, 3, 6, 14, 19}, //classic
{20, 15, 3, 9, 3, 15, 20}, //rock
{1, 8, 14, 20, 14, 8, 1}, //jazz
{16, 20, 14, 11, 8, 1, 6}, //pop
};
UINT8 user_osd_set[MAX_BAND] = {
11, 11, 11, 11, 11, 11, 11
};
#endif
//Show 3d-sound OSD page when users press 3d-sound button
void ShowSoundPage(BYTE r)
{
osd_tog_region(r, OSD_ON);
osd_print_eq_setting(r, 0xff);
}
/*
**
*/
void sound_func_up_dn(BYTE ch, BYTE dir)
{
if((dir == C_DN) && user_osd_set[ch] > 1)
{
user_osd_set[ch]--;
}
else
#if CONFIG==CONFIG_COMBO_SVCD
if((dir == C_UP) && (user_osd_set[ch] < 25))
#else
if((dir == C_UP) && (user_osd_set[ch] < 21))
#endif
{
user_osd_set[ch]++;
}
#if CONFIG==CONFIG_COMBO_SVCD
memcpy(&RegionValStr[3], user_osd_set, MAX_BAND);
osd_print_eq_setting(3, ch * 2);
au_eq_user_gain(ch, user_osd_set[ch] - 13); //band:0~6 db:-12~+12
ShowLevelBand(ch);
#else
memcpy(&RegionValStr[1], user_osd_set, MAX_BAND);
osd_print_eq_setting(1, ch * 2);
au_eq_user_gain(ch, user_osd_set[ch] - 11); //band:0~6 db:-10~+10
#endif
}
BYTE bEqValue_old[7];
void DispRealtimeEq(BYTE r)
{
int i;
#if VFD_MODULE==VFD_EQ
BYTE *p;
#endif
UINT16 unEq[7];
BYTE bEqValue[7];
#if 1//(VFD_MODULE!=VFD_EQ)
if(IsKY3D() && bEqDisplay)
{
if((bEqDisplay & 0x0f) / 2 == 10 / 2)
{
au_get_spectrum(unEq);
for(i = 0; i < 7; i++)
{
unsigned temp = (unEq[i] * 32) / 1024;
/*test */
temp = (bEqValue_old[i] /**7/8*/ + temp) / 2;
bEqValue_old[i] = temp;
#if CONFIG==CONFIG_COMBO_SVCD
if(temp > 25)
temp = 25;
#else
if(temp > 20)
temp = 20;
#endif
/*test */
bEqValue[i] = temp;
}
}
if((bEqDisplay & 0x0f) == 10)
{
au_get_spectrum(unEq);
/*
for (i = 0; i < 7; i++)
{
if (unEq[i] > unEqMaxRef)
{
unEqMaxRef = unEq[i];
}
}
*/
//normalize value to 0 ~ 25
#if 0
for(i = 0, j = 0; i < 7; i++)
{
//unsigned temp = (unEq[i] * 20) / 1024;
unsigned temp = (unEq[i] * 28) / 1024;
/*test */
temp = (bEqValue_old[i] * 3 / 8 + temp) / 2;
bEqValue_old[i] = temp;
if(temp > 25)
temp = 25;
/*test */
bEqValue[i] = temp;
}
#endif
osd_print_realtime_eq(r, bEqValue, CH_N);
bEqDisplay = 1; //reset count to 1
}
else
{
bEqDisplay++;
} // end of if ((bEqDisplay&0x0f)==4)
}
#else //support VFD_EQ
{
p = bEqValue;
if((bEqDisplay & 0x0f) / 2 == 10 / 2)
{
au_get_spectrum(unEq);
for(i = 0; i < 7; i++)
{
unsigned temp = (unEq[i] * 32) / 1024;
temp = (bEqValue_old[i] /**7/8*/ + temp) / 2;
bEqValue_old[i] = temp;
#if CONFIG==CONFIG_COMBO_SVCD
if(temp > 25)
temp = 25;
#else
if(temp > 20)
temp = 20;
#endif
bEqValue[i] = temp;
}
}
if((bEqDisplay & 0x0f) == 10)
{
show_VFD_EQ(p);
if(IsKY3D() && bEqDisplay)
osd_print_realtime_eq(r, bEqValue, CH_N);
bEqDisplay = 1; //reset count to 1
}
else
{
bEqDisplay++;
} // end of if ((bEqDisplay&0x0f)==4)
}
#endif
}
void disp_setup_EQ(BYTE sel_, BYTE r)
{
int i;
BYTE bEqValue[7];
sel_ = sel_ - 2;
for(i = 0; i < 7; i++)
{
if(sel_ == MAX_MUSIC)
bEqValue[i] = user_osd_set[i];
else
bEqValue[i] = music_osd_set[sel_][i];
}
osd_print_realtime_eq(r, bEqValue, CH_S);
//bEqDisplay = 1;
}
void ShowLevelBand(BYTE ch_)
{
#if 1 //def NINTAUS//jhuang open 2002/8/21
psprintf(RegionValStr[1], " %d", ch_);
PrintOsdMsg(STR_OS_BAND, REGION1, 0, 1, CH_S);
if(user_osd_set[ch_] >= 13)
psprintf(RegionValStr[2], " +%02d %sB", (user_osd_set[ch_] - 13), Ch_d);
else
psprintf(RegionValStr[2], " -%02d %sB", (13 - user_osd_set[ch_]), Ch_d);
PrintOsdMsg(STR_OS_LEVEL, REGION2, 0, 1, CH_S);
#else
psprintf(RegionValStr[1], "BAND %d", ch_);
PrintOsdMsg(STR_OS_NULL, REGION1, 0, 1, CH_S);
if(user_osd_set[ch_] >= 13)
psprintf(RegionValStr[2], "LEVEL +%02d DB", (user_osd_set[ch_] - 13));
else
psprintf(RegionValStr[2], "LEVEL -%02d DB", (13 - user_osd_set[ch_]));
PrintOsdMsg(STR_OS_NULL, REGION2, 0, 1, CH_S);
#endif
}
#endif /* SUPPORT_OSD */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -