📄 play.cc
字号:
#define VOCAL_RIGHT_RIGHT 4
#define DIGEST_TRACK_PIC_LIMIT 9
#define MAX_TRACK_NUMBER 99
#define MAX_PROGRAM_TRACKS 99
/* For OSD message buffers */
#define TRACK_NUM_POS 13
#define CTRACK_NUM_POS 9
#define SPEED_POS 4
#define CSPEED_POS 4
#define SLOW_SPEED_POS 5
#define CSLOW_SPEED_POS 3
#define SEL_NUM_POS 8
#define CSEL_NUM_POS 6
/* Play control variables */
static unsigned int seg_sel = 1; /* Use in segment play (select E1 (1) *
* or E2 (2) */
static unsigned int resume_flag; /* store the resume states */
#ifdef FAST_MODE_CONTROL
static int fast_mode_ctrl=0;
#endif
/*------------------------------------------------------------------------
* Variables for display. If we want to save memory, we can use common
* buffer for all osd display.
*------------------------------------------------------------------------*/
char *SPA_msg;
static unsigned char *osd_msg;
#ifdef BILINGUAL_OSD
static unsigned char *c_osd_msg;
#endif
static unsigned char osd_region = OSD_FUNCTION_STATUS_REGION;/*default region*/
static unsigned char osd_timeout = DISPLAY_TIME_OUT;/*default timeout */
static unsigned char track_buf[] = " TRACK SCAN XX ";
static unsigned char sel_buf[] = "SELECT ";
static unsigned char FF_buf[] = "FF X1 ";
static unsigned char FR_buf[] = "FR X1 ";
static unsigned char slow_buf[] = "SLOW ";
static unsigned char clear_msg[] = " ";
static unsigned char error_msg[] = "#"; /* Show a hand */
#ifdef BILINGUAL_OSD
static unsigned char c_track_buf[] = {
' ', CN_DAN1, ' ', CN_QU3, ' ', CN_LIU2, ' ' , CN_LAN3,
' ', 'X', 'X', ' ' , ' ', ' ', '\0'
};
static unsigned char c_slow_buf[] = {
CN_MAN4, CN_FANG4, ' ', ' ', ' ', '\0'
};
static unsigned char c_sel_buf[] = {
CN_XUAN3, ' ', ' ', CN_ZE2, ' ', ' ', ' ', ' ', '\0'
};
static unsigned char c_FF_buf[] = {
CN_KUAI4, CN_JIN4, ' ', 'X', '1', '\0'
};
static unsigned char c_FR_buf[] = {
CN_KUAI4, CN_TUI4, ' ', 'X', '1', '\0'
};
#endif
#ifdef TWO_CDS
static unsigned char disc_buf[] = "DISC ";
static unsigned char c_disc_buf[] = {CN_DIE2,FONT_SPACE,FONT_SPACE,FONT_SPACE,FONT_SPACE,FONT_SPACE,FONT_SPACE,0 };
#endif
/* OSD messages used outside play.c module */
unsigned char goto_buf[] = " GO TO : ";
#ifdef BILINGUAL_OSD
unsigned char c_goto_buf[] =
{ ' ', CN_SHI2, ' ', CN_JIAN1, ' ', ' ', ' ', ':', ' ', ' ', '\0' };
#endif
/*------------------------------------------------------------------------
User defined data structures
------------------------------------------------------------------------*/
short list_previous_list_offset=0;
short list_next_list_offset=0;
static short list_return_list_offset=0;
static short play_list_playing_time=0;
static short play_list_play_item_number=0;
static unsigned char play_list_number_of_items=0;
static unsigned char play_list_play_item_wait_time=0;
static unsigned char play_list_auto_pause_wait_time=0;
static int play_still_retry;
#ifdef MDC_GAME
static short mdc_game_list_buffer_size=0;
#endif
static int selection_list_loop_count;
static short selection_list_default_list_offset=0;
static short selection_list_time_out_list_offset=0;
static short selection_list_play_item_number=0;
static unsigned char selection_list_jump_time=0;
static unsigned char selection_list_number_of_selections=0;
static unsigned char selection_list_base_of_selection_number=0;
static unsigned char selection_list_wait_time_for_timeout=0;
static unsigned char selection_list_loop_count_and_jump_timing=0;
#ifdef SGAME
int play_item_begin_time; /* mmssff : the begining mmssff */
int play_item_real_end_time;/* mmssff : the real end time of the item */
int play_item_start_time; /* mmssff : the start playing mmssff */
int play_item_end_time; /* mmssff : the play end time of the item */
int game_next_delay; /* by maor */
#else
static int play_item_begin_time; /* mmssff : the begining mmssff */
static int play_item_real_end_time;/* mmssff : the real end time of the item */
static int play_item_start_time; /* mmssff : the start playing mmssff */
static int play_item_end_time; /* mmssff : the play end time of the item */
#endif
static unsigned char play_item_mode=0; /* record stop or play mode. */
static unsigned char play_item_type=0; /* AUDIO or DATA track */
#ifdef JUMP_N_PAUSE
IMPORT int VID_frames_before_pause;
int PLAY_jump_n_pause = 0;
static char PLAY_in_pause_mode = 0; /* keep track of pause condition */
#endif
char wait_pause=0;
static char initCD_done; /* the initCD() successfully complete. */
/*------------------------------------------------------------------------
Global Variables
------------------------------------------------------------------------*/
#ifdef SGAME
extern unsigned char current_game_menu;
extern unsigned int game_number;
extern unsigned int game_menu_number;
extern unsigned int game_menu_entry[11];
extern unsigned int game_data_entry[99];
unsigned char vcd_game_video_key;
unsigned char vcd_game_loaded;
unsigned char game_still_over;
#endif
unsigned char track_list[99]; /* the track play list */
unsigned int track_list_max; /* max track used in track_list */
unsigned char track_map[13]; /* track map for motion picture */
int current_key = NO_KEY; /* The key received from users */
#ifdef SGAME
int assign_key = NO_KEY; /* Key assigned from play machine. */
#else
static int assign_key = NO_KEY; /* Key assigned from play machine. */
#endif
int play_state; /* The state of play state machine */
static int play_state_before_auto_pause;
static int auto_pause_reset_time;
int trigger_event; /* Store why the state changed */
static unsigned char vocal_assist_on=0;
static unsigned char audio_mode = 0;
static unsigned char repeat_mode = 0;
/* Store the repeat mode data. */
static unsigned char program_on = 0;
static unsigned char shuffle_on = 0;
/* Store the shuffle mode data. */
unsigned char cur_list_state=0;
/* Record whether we are playing track */
/* list, selection list or play list. */
char cur_track_index=0; /* index to the track play list */
static int pre_psd_offset; /* store the previous psd offset, so we
can come back if the new psd offset
is not valid. */
static int cur_psd_offset; /* current psd offset number */
static unsigned int timeout_begin_time; /* the time in 1/64 second unit */
/* when the timer is set. */
int set_abort_ltoc; /* 1 -> allow abort_ltoc_flag to be set */
static unsigned char fast_frame_index=0; /* FF/FR index of fast_rame_ary to */
/* control FF/FR speed. */
static unsigned char slow_motion_index=0;
/* Indicate the speed of slow motion. */
int repeat_a2b_start_time; /* MMSSFF format of the start time in
in repeata2b mode. */
unsigned char cd_opened = 0; /* 1 -> CD is opened. */
#ifdef TWO_CDS
static unsigned char cd_opened2 = 0; /* 1 -> CD is opened. */
#endif
static unsigned char disk_exist=0; /* 1 -> CD is not empty. */
unsigned char repeat_a2b=0;
static unsigned char intro_mode=0; /* 1 -> we are in intro mode */
static unsigned char goto_absolute=0; /* 1 -> in the absolute goto mode */
unsigned char cd_stop = 1;
/* variables store some data in info.vcd. */
int PSD_size; /* The size of PSD in bytes. */
unsigned char offset_mul=0; /* offset_mul byte. */
/* variable relative to auto pause */
static unsigned char auto_pause=0; /* 1 -> pause is caused by trigger bit.*/
/* variables relative to goto function */
static unsigned char goto_digit=0; /* 1 -> 1st digit of min,
2 -> 2nd digit of min,
3 -> 1st digit of sec,
4 -> 2nd digit of sec.
*/
static unsigned char goto_min=0, goto_sec=0; /* user inputs time */
static unsigned char got_goto_time=0; /* 1 -> got go to time */
static unsigned char keep_goto_key=0;
unsigned int goto_time; /* time to go relative to item start time */
/* variables relative to index+ and index- functions */
unsigned int track_entry_beg; /* 1 base from the beginning of CD */
unsigned int track_entry_end;
unsigned int track_current_entry;
unsigned int track_entry_number;
int next_entry_time; /* used to update index number on lcd */
/* variables to keep the valid selection numbers */
short upper_selection_limit; /* the good selection upper bound */
short lower_selection_limit; /* the good selection lower bound */
/* variables for program mode */
static int TotalProgramTime; /* In mm:ss:ff (CD format, i.e. BCD) */
int TotalRemainTime; /* In mm:ss:ff (CD format, i.e. BCD) */
int CurrentTrackTime; /* In mm:ss:ff (CD format, i.e. BCD) */
static osd_time_key_index; /* indicates what is on the screen */
int cd_disc_slot;
unsigned char cd_tray_just_closed = 0;
static unsigned char in_digest_mode = 0; /* Is it in digest mode ? */
/* defines for PLAY_vcd_type */
#define VCD_TYPE_NONE 0
#define VCD_TYPE_11 1
#define VCD_TYPE_20 2
#define VCD_TYPE_30 4
#ifdef SGAME
#define VCD_TYPE_game 8
#endif
static unsigned char PLAY_vcd_type=VCD_TYPE_NONE;
static unsigned char cddigest_start_track=0;
static unsigned char set_mode_key=0; /* flag to indicates that we need
to assign MODE_KEY to current_key
if the disc is vcd1.1 */
static unsigned char ResumeMinute=0, ResumeSecond=0, ResumeTrack=0;
static int ResumeVertSz, ResumeHorizSz;
static int just_init_CD;
#ifdef VOLUME_CONTROL
/* variables regarding to audio volume control */
PRIVATE unsigned short vcxVolume[] = {
0x0000, /* 0 */
0x0101, /* 1/16 */
0x0202, /* 2/16 */
0x0303, /* 3/16 */
0x0404, /* 4/16 */
0x0505, /* 5/16 */
0x0606, /* 6/16 */
0x0707, /* 7/16 */
0x0808, /* 8/16 */
0x0909, /* 9/16 */
0x0a0a, /* 10/16 */
0x0b0b, /* 11/16 */
0x0c0c, /* 12/16 */
0x0d0d, /* 13/16 */
0x0e0e, /* 14/16 */
0x0f0f, /* 15/16 */
0x1010, /* 16/16 */
};
#define AUDIO_MAX_LEVEL 16
#define AUDIO_MIN_LEVEL 0
#define AUDIO_BUFSZ (((AUDIO_MAX_LEVEL-1)/2) + 5) /*<level><space><digits>*/
int is_audio_mute;
#ifdef VCDROM
unsigned int before_mute;
#endif
#ifdef INTECH_GONGFA
int audio_level = 8;
#else
int audio_level = 16;
#endif
void process_mute_key();
void process_volume_key(int level);
static void osdVolumeBar(int, int);
/*------------------------------------------------------------------------
Function:
Parameters:
Description:
------------------------------------------------------------------------*/
void reset_audio()
{
is_audio_mute = 0;
#ifdef INTECH_GONGFA
audio_level = 8;
#else
audio_level = AUDIO_MAX_LEVEL;
#endif
}
void process_mute_key()
{
unsigned char *msg, *c_msg;
is_audio_mute ^= 1;
if (is_audio_mute) { /* Set to 0 */
assign_osd_msg(msg, MSG_mute, c_msg, MSG_c_mute);
#ifdef VCDROM
before_mute = vcx_audio_volume;
#endif
vcx_audio_volume = 0;
} else { /* Restore */
assign_osd_msg(msg, clear_msg, c_msg, clear_msg);
vcx_audio_volume = (unsigned int) vcxVolume[audio_level];
}
/* Display indefinitely while MUTING */
OUTOSD(OSD_AUDFX_REGION, msg, c_msg, 0);
}
void process_volume_key(int change_level)
{
/* Turn off mute mode if we are in mute mode. */
if (is_audio_mute) {
process_mute_key();
}
audio_level += change_level;
if (audio_level > AUDIO_MAX_LEVEL)
audio_level = AUDIO_MAX_LEVEL;
else if (audio_level < AUDIO_MIN_LEVEL)
audio_level = AUDIO_MIN_LEVEL;
vcx_audio_volume = (unsigned int) vcxVolume[audio_level];
/* show osd */
osdVolumeBar(audio_level, DISPLAY_TIME_OUT);
}
/*(This function is taken from po4tact.c)
* Display the volume bar.
*
* Input:
* level: an integer between AUDIO_MIN_LEVEL (0) and
* AUDIO_MAX_LEVEL (16).
* osdlen: number of seconds to show this OSD
*/
PRIVATE unsigned char volumebarbuf[AUDIO_BUFSZ] = " ";
PRIVATE void osdVolumeBar(level, osdlen)
int level;
int osdlen;
{
int i, tmp = 0;
if (level > AUDIO_MIN_LEVEL) tmp = (level - 1) >> 1;
for (i = tmp; i <= ((AUDIO_MAX_LEVEL - 1) >> 1); i++) {
asm("nop");
volumebarbuf[i] = FONT_SS;
}
for (i = 0; i < tmp; i++) {
asm("nop");
volumebarbuf[i] = FONT_LL;
}
if (level > 0) volumebarbuf[tmp] = ((level - 1) & 1) ? FONT_LL : FONT_LS;
if (level <= 9) {
volumebarbuf[AUDIO_BUFSZ - 3] = ' ';
} else {
level -= 10;
volumebarbuf[AUDIO_BUFSZ - 3] = '1';
}
volumebarbuf[AUDIO_BUFSZ - 2] = '0' + level;
OUTOSD(OSD_KARAOKE_REGION, volumebarbuf, volumebarbuf, osdlen);
}
#endif
/*------------------------------------------------------------------------
Function:
Parameters:
Description:
------------------------------------------------------------------------*/
void reset_play_machine()
{
current_key = STOP_KEY;
play_state = ENTRY_STATE;
#ifdef TWO_CDS
if (continue_play == 2)
continue_play = 0;
#endif
}
/*------------------------------------------------------------------------
Function: play_item
Parameters:
playitem_number: The playitem_number is from play_item in
selection list or play list.
Description:
This function will call proper function to play motion picture,
segment item or entry item depending on the value of
playitem_number.
------------------------------------------------------------------------*/
static void play_item(int playitem_number)
{
/* reset entry variables. The values are chosen to no index at init */
picture_type = 0xe0;
track_entry_beg = 1000;
track_entry_end = 0;
track_entry_number = 1;
next_entry_time = x00999999;/* set it a very big number, so we want
update the lcd index number if we are
not in play entry in track mode. */
/* reset a2b if a2b flag is on */
if (repeat_a2b) {/* REPEAT_AB_START or REPEAT_AB_END */
repeat_a2b = REPEAT_AB_OFF;
panel_repeat_ab(REPEAT_AB_OFF);
}
/* remember the play item */
cur_vcd_playitem = playitem_number;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -