📄 amp_gui.c
字号:
else//channel vol
{
#ifdef TAS_5508_PWM
if((channel_vol_offset[current_channel-1])<CH_VOL_MAX)
(channel_vol_offset[current_channel-1])++;
#else//#ifdef TAS_5508_PWM
if(volum_list[current_channel]>=(MAIN_VOL_MAX-1))
{
if((channel_vol_offset[current_channel-1])<CH_VOL_MAX)
(channel_vol_offset[current_channel-1])++;
}
#endif//#ifdef TAS_5508_PWM
volum_list[current_channel] = GET_ABSOLUTE_VALUE(current_channel);
}
#ifdef SUPPORT_VFD_MESSAGE
set_vfd_message_state(VFD_MESSAGE_VOL,SUBVOL_TIME_OUT);
#else
subvol_time_out=SUBVOL_TIME_OUT;
#endif
volume_changed=1;
}
void subvol_vol_down()
{
if(current_channel == 0) //main vol
{
if(volum_list[0]>0)
volum_list[0] --;
}
else//channel vol
{
if(volum_list[current_channel]>0)
{
if((channel_vol_offset[current_channel-1])>0)
(channel_vol_offset[current_channel-1])--;
volum_list[current_channel] =GET_ABSOLUTE_VALUE(current_channel);
}
}
#ifdef SUPPORT_VFD_MESSAGE
set_vfd_message_state(VFD_MESSAGE_VOL,SUBVOL_TIME_OUT);
#else
subvol_time_out=SUBVOL_TIME_OUT;
#endif
volume_changed=1;
}
void polling_volume_change(void)
{
#ifdef I2C_MASS_DATA_POLLING_WRITE
if((volume_changed==1) && (NULL==p_i2c_mass_data))
#else
if(volume_changed==1)
#endif
{
if(current_channel == 0) //main vol
{
subvol_main_vol();
if(volum_list[0]>=MAIN_VOL_MAX)
{
psprintf(RegionValStr[REGION1], "VOLUME MAX");
}
else if (volum_list[0]<=0)
{
psprintf(RegionValStr[REGION1], "VOLUME MIN");
}
else
{
psprintf(RegionValStr[REGION1], "VOLUME %d",volum_list[0]);
}
PrintOsdMsg(STR_OS_SPACE, REGION1, 1, 1);
}
else//channel vol
{
subvol_channel_volume(current_channel, volum_list[current_channel]);
show_channel_msg();
PrintOsdMsg(STR_OS_SPACE, REGION1, 1, 1);
}
#ifdef SAVE_AMP_VOLUME
save_amp_variable(current_channel);
#endif
#if defined(USE_AMP_MUTE)&&defined(CHANGE_VOL_DEMUTE) //chenzhao20050926
user_amp_mute=0;
#endif//#ifdef USE_AMP_MUTE
volume_changed=0;
}
}
#ifdef USE_AMP_MUTE
//Master Volume Mute
//mute all channels simultaneously
//mute 1: mute 0: demute
void sub_masterMute(BYTE mute)
{
#ifdef SUPPORT_APOGEE_AMP
ddx_masterMute(mute);
#elif (defined(TAS_5508_PWM)||defined(TAS_5086_PWM))
#if 1
if(mute==AMP_MUTE)
{
printf("tass5508 unmute ....... \n");
#ifdef TAS_5508_PWM
#ifdef USE_TAS_5508_MUTE_REG
tas_5508_mute(CH_MASTER_MUTE_MASK);
#else
tas_5508_software_mute();
#endif
#elif defined(TAS_5086_PWM)
tas_5086_software_mute();
#endif
#ifndef MERGE_TEMP
subvol_restore_line_out();
#endif
#ifdef TLV320_DAC
use_tlv320_mute_headphone();
#endif
}
else
{
{
printf("tass5508 unmute ....... \n");
#ifdef TLV320_DAC
mute_tlv320_line_out(0); //unmute line out
#endif
#ifdef SUPPORT_AMP_IO_MUTE
amp_io_demute();
#endif
#ifdef USE_TAS_5508_MUTE_REG
tas_5508_mute(CH_MASTER_MUTE_MASK);
#else
subvol_main_vol();
#ifndef MERGE_TEMP
subvol_sub_vol();
#endif
#endif
#ifndef MERGE_TEMP
subvol_restore_line_out();
#endif
#ifdef SUPPORT_ACTIVE_SUBWOOFER
active_subvol_sub_vol();
#endif
}
}
#else
if(mute==AMP_MUTE)
tas_5508_mute(CH_MASTER_MUTE_MASK);
else
tas_5508_mute(0);
#endif
#endif
}
#endif
#ifdef SUPPORT_AMP_IO_MUTE//chenzhao20051205 for variable PWM processor.
inline void amp_io_mute(void)
{
#ifdef ROM_BUS_EXTENT_IO
#ifdef ORITRON_RECEIVER_6505
rom_bus_set_io(ROM_BUS_OUT_AMP_MUTE,0);
#else
rom_bus_set_io(ROM_BUS_OUT_AMP_MUTE,1);
#endif
#endif
}
inline void amp_io_demute(void)
{
#ifdef ROM_BUS_EXTENT_IO
#ifdef ORITRON_RECEIVER_6505
rom_bus_set_io(ROM_BUS_OUT_AMP_MUTE,1);
#else
rom_bus_set_io(ROM_BUS_OUT_AMP_MUTE,0);
#endif
#endif
}
#endif
#ifdef AMP_SUPPORT_EQ
const BYTE eq_str_id[EQ_MAX]={STR_OS_STANDARD,STR_OS_ROCK,STR_OS_POP,STR_OS_CLASSIC,STR_OS_JAZZ};
EQ_TYPE amp_eq=EQ_FLAT;
inline BYTE amp_set_eq(EQ_TYPE eq)
{
#if defined(TAS_5508_PWM)
return tas_5508_set_eq(eq);
#elif defined(SUPPORT_DDX8001)
ddx_Set_EQ(eq);
return 1;
#else
#amp_should_support_eq
#endif
}
void init_amp_eq(void)
{
amp_eq=EQ_FLAT;
amp_set_eq(amp_eq);
}
#ifdef I2C_MASS_DATA_POLLING_WRITE
void amp_toggle_EQ(void)
{
if(action_click)
{
EQ_TYPE temp=amp_eq;
amp_eq++;
if(amp_eq>=EQ_MAX)
amp_eq=EQ_FLAT;
if(! amp_set_eq(amp_eq))
amp_eq=temp;
}
PrintOsdMsg(eq_str_id[amp_eq], REGION1, 1, 0);
#ifdef SUPPORT_VFD_SHOW_TONE
set_vfd_message_state(VFD_MESSAGE_EQ,SUBVOL_TIME_OUT);
#endif
#ifdef TREBLE_BASS_EQ_MENU_INTERFACE
amp_tone_mode = TONE_EQ;
#endif
}
#else
void amp_toggle_EQ(void)
{
//if(action_click)
{
#if defined(TAS_5508_PWM)
EQ_TYPE amp_eq_last=amp_eq;
if(amp_eq_last==EQ_FLAT)//to avoid pop noise when switch form flat to other.
{
sub_masterMute(AMP_MUTE);
delay_srv_10ms(10);
}
#endif
amp_eq++;
if(amp_eq>=EQ_MAX)
amp_eq=EQ_FLAT;
amp_set_eq(amp_eq);
#if defined(TAS_5508_PWM)
if(amp_eq_last==EQ_FLAT)
sub_masterMute(AMP_DEMUTE);
#endif
}
PrintOsdMsg(eq_str_id[amp_eq], REGION1, 1, 0);
#ifdef SUPPORT_VFD_SHOW_TONE
set_vfd_message_state(VFD_MESSAGE_EQ,SUBVOL_TIME_OUT);
#endif
#ifdef TREBLE_BASS_EQ_MENU_INTERFACE
amp_tone_mode = TONE_EQ;
#endif
}
#endif//#ifdef I2C_MASS_DATA_POLLING_WRITE
#endif
#ifdef TREBLE_BASS_EQ_MENU_INTERFACE
void init_amp_tone_mode(void)
{
amp_tone_mode = TONE_IDLE;
current_channel=0;
}
void show_treble_bass_msg()
{
if((channel_vol_offset[current_channel-1])==(CH_VOL_MAX/2))
{
psprintf(RegionValStr[REGION1],"%s 0",channel_str[current_channel-1]);
}
else if((channel_vol_offset[current_channel-1])<(CH_VOL_MAX/2))
{
psprintf(RegionValStr[REGION1],"%s -%d",channel_str[current_channel-1],(CH_VOL_MAX/2)-(channel_vol_offset[current_channel-1]));
}
else
{
psprintf(RegionValStr[REGION1],"%s +%d",channel_str[current_channel-1],(channel_vol_offset[current_channel-1])-(CH_VOL_MAX/2));
}
PrintOsdMsg(STR_OS_SPACE, REGION1, 2, 1);
}
BYTE call_ir_func_tone_menu(BYTE rx)
{
if(amp_tone_mode == TONE_IDLE)
return 0;
switch(rx)
{
case IRC_EQ: //TONE KEY
{
if(amp_tone_mode == TONE_EQ)
{
set_vfd_message_state(VFD_MESSAGE_EQ,SUBVOL_TIME_OUT);
}
}
break;
case IRC_SELECT: //OK key
{
if(amp_tone_mode == TONE_EQ)
{
set_vfd_message_state(VFD_MESSAGE_EQ,SUBVOL_TIME_OUT);
amp_tone_mode = TONE_BASS;
current_channel = VOL_CH_BASS; //for BASS Mode
show_channel_msg();
//show_treble_bass_msg();
}
}
break;
#ifdef EXIT_KEY
case IRC_EXIT: // setup/exit key
#else
case IRC_SETUP: // setup/exit key
#endif
{
if(amp_tone_mode != TONE_EQ)
{
amp_tone_mode = TONE_EQ;
PrintOsdMsg(eq_str_id[amp_eq], REGION1, 1, 0);
return 1;
}
}
break;
case IRC_UP:
{
if(amp_tone_mode != TONE_EQ && amp_tone_mode != TONE_IDLE)
{
set_vfd_message_state(VFD_MESSAGE_EQ,SUBVOL_TIME_OUT);
if(amp_tone_mode == TONE_TREBLE)
current_channel = VOL_CH_TREBEL;
else
current_channel = VOL_CH_BASS;
//printf("joke: up key ,current_channel = %d ,vol= %d \n",current_channel,(channel_vol_offset[current_channel-1]));
if((channel_vol_offset[current_channel-1])<CH_VOL_MAX)
(channel_vol_offset[current_channel-1])++;
volum_list[current_channel] = GET_ABSOLUTE_VALUE(current_channel);
volume_changed=1;
//subvol_channel_volume(current_channel, volum_list[current_channel]);
//show_treble_bass_msg();
//PrintOsdMsg(STR_OS_SPACE, REGION1, 1, 1);
//#ifdef SAVE_AMP_VOLUME
//save_amp_variable(current_channel);
//#endif
}
}
break;
case IRC_DOWN:
{
if(amp_tone_mode != TONE_EQ && amp_tone_mode != TONE_IDLE)
{
set_vfd_message_state(VFD_MESSAGE_EQ,SUBVOL_TIME_OUT);
if(amp_tone_mode == TONE_TREBLE)
current_channel = VOL_CH_TREBEL;
else
current_channel = VOL_CH_BASS;
//printf("joke:1 down key ,current_channel = %d ,vol= %d \n",current_channel,(channel_vol_offset[current_channel-1]));
//if((channel_vol_offset[current_channel-1])==0)
// break;
//printf("joke: down key ,current_channel = %d ,vol= %d \n",current_channel,(channel_vol_offset[current_channel-1]));
if((channel_vol_offset[current_channel-1])>0)
(channel_vol_offset[current_channel-1])--;
volum_list[current_channel] =GET_ABSOLUTE_VALUE(current_channel);
volume_changed=1;
//subvol_channel_volume(current_channel, volum_list[current_channel]);
//show_treble_bass_msg();
//PrintOsdMsg(STR_OS_SPACE, REGION1, 1, 1);
//#ifdef SAVE_AMP_VOLUME
//save_amp_variable(current_channel);
//#endif
}
}
break;
case IRC_LEFT:
{
if(amp_tone_mode!=TONE_EQ && amp_tone_mode != TONE_IDLE)
{
set_vfd_message_state(VFD_MESSAGE_EQ,SUBVOL_TIME_OUT);
amp_tone_mode = amp_tone_mode - 1;
if(amp_tone_mode<TONE_BASS)
{
current_channel = VOL_CH_TREBEL; //for treble Mode
amp_tone_mode = TONE_TREBLE;
}
else
current_channel = VOL_CH_BASS; //for bass Mode
show_channel_msg();
}
}
break;
case IRC_RIGHT:
{
if(amp_tone_mode!=TONE_EQ && amp_tone_mode != TONE_IDLE)
{
set_vfd_message_state(VFD_MESSAGE_EQ,SUBVOL_TIME_OUT);
amp_tone_mode = amp_tone_mode + 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -