📄 po4tact.c
字号:
/* If we are in the PAUSE mode, then send a PLAY first */
if (playMode == MODE_PAUSE) {
IR_send_Play();
}
resetMode();
tdmStopCopy = 0; /* Just in case */
stRepAB = 0; /* Clear Repeat A to B */
/* Pausing inside digest, 'NEXT' key goes to the next track */
if (digestPause) {
nextNplay = 1;
CLEAROSD(OSD_VIEW_REGION); /* clear "SELECT >>|" */
}
}
}
/*
* The routine is called when 'EJECT' (OPEN/CLOSE) key is pressed.
*
* Regardless where we are, this routine will bring us back to NORMAL
* play state, and logo will be shown. Since some CD reacts slowly
* comparing to our chip, this routine will intentionally delay
* half of a second (customer can adjust this delay amount) for CD
* to react. It is a bad idea to show logo while CD continues to
* send in data.
*
* Customers also have an option to reset some machine states (such
* as karaoke level, audio L/R, mute, audio volume etc) as they see
* fit.
*/
PRIVATE void procOpenClose()
{
/*
* Hard to keep track of OPEN/CLOSE status because people
* may push the tray in.
*/
#if 0
stOpen ^= 1;
outputOsd(0, stOpen ? MSG_open : MSG_close, 5, OSD_NOTRACK);
#endif
CLEARALLOSD();
OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_open_close, MSG_c_open_close, 5);
/* Reset things in order to show logo */
VID_init();
displayLogo = 1;
resetAll();
keepStillType = 0xe2; /* Assume we'll play E2 still */
#if 0
/*
* Customers may want to customize here: when CD is opened,
* reset all states
*/
vcx_karaokey = 0;
SPA_set_level(SPA_OFF);
vcx_audio_channel = LEFT_RIGHT;
if (muteAudio) procMute(); /* Restore from mute (if needed)*/
audioLevel = AUDIO_INIT; /* Restore to normal volume */
vcx_audio_volume = (int) (unsigned int) vcxVolume[audioLevel];
#endif
#if 1
/*
* We will be showing logo. Since we are running so much faster
* than the CD controller, we may want to wait for some time so
* the external micro controller has a chance to shut off the
* data before we put the logo data in the system buffer.
*
* !!! This 1/4 second delay will slow down the handling of
* repeated OPEN/CLOSE !!!
*/
delayQuarterSec();
#endif
}
/*
* This routine is called when 'PAUSE' key is pressed.
*
* The logic is as follows:
* 1) If we are in the middle of 10+ processing, then this key is
* ignored.
* 2) In we are already in PAUSE mode, then we'll be back to NORMAL
* play mode (with approriate OSD). Otherwise, we'll enter
* PAUSE mode.
*/
PRIVATE void procPause()
{
int tmp = playMode; /* restMode will reset this var, so keep it */
resetMode(); /* We'll be in a new mode from here on */
/*
* If we are in the middle of 10+ selection, "NEXT" doesn't work!
* (customer may want to customize)
*/
if (cntTen) procTrack10Plus(0);
else {
if (tmp == MODE_PAUSE) {
if (detectPlay()) {
if (vcx_digest && digestPause) {
delayQuarterSec();
IR_send_Next();
OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_play, MSG_c_play,5);
} else {
if (scanMode == SCAN_A)
OUTOSD(OSD_VIEW_REGION, MSG_view, MSG_c_view, 0);
else if (scanMode == SCAN_B)
OUTOSD(OSD_DIGEST_REGION, ptrIntro, c_ptrIntro, 2);
else
OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_play, MSG_c_play,
5);
}
}
} else if (tmp == MODE_FAST) {
IR_send_Play();
if (!TDM_isCDDA)
cleanSystemState();
CLEAROSD(OSD_FUNCTION_STATUS_REGION);
OUTOSD(OSD_PAUSE_REGION, MSG_play, MSG_c_play, 5);
} else {
if (detectPause()) {
/* We are really pausing! */
cleanSystemState();
CLEAROSD(OSD_FUNCTION_STATUS_REGION);
OUTOSD(OSD_PAUSE_REGION, MSG_pause, MSG_c_pause, 0);
playMode = MODE_PAUSE;
}
}
}
}
PRIVATE void procPBC()
{
pbcON ^= 1;
if (pbcON) OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_pbc_on, MSG_c_pbc_on, 5);
else OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_pbc_off, MSG_c_pbc_off, 5);
}
/*
* This routine is called when PLAY key is pressed.
*
* The logic is as follows:
* 1) If we are inside digest (SCAN_B), then we'll quit digest
* and play in NORMAL mode.
* 2) If we are in any other state (include 'PAUSE'), we'll be
* back to NORMAL play state.
*/
PRIVATE void procPlay()
{
if (detectPlay()) {
if (vcx_digest) {
if (!digestPause) {
resetMode();
digest2Normal();
} else {
delayQuarterSec();
IR_send_Next();
nextNplay = 1;
}
} else {
resetMode(); /* We'll be in a new mode from here on */
}
CLEARALLOSD();
OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_play, MSG_c_play, 5);
}
}
/*
* This routine is called when PREVIOUS key is pressed.
*
* The logic is as follows:
* 1) If we have pressed '10+' before, then 'PREVIOUS' will show
* the current '10+' information without going to the previous track.
* 2) Otherwise, if we are in 'PAUSE' mode, then we'll reset playMode
* to 'NORMAL'. In any case, CD goes to the previous track and we
* start to play from there.
*/
PRIVATE void procPrevious()
{
/*
* If we are in the middle of 10+ selection, "PREVIOUS" is ignored
* (customer may want to customize this)
*/
if (cntTen) procTrack10Plus(0);
else {
OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_previous, MSG_c_previous, 5);
/* If we are in the PAUSE mode, then send a PLAY first */
if (playMode == MODE_PAUSE) {
IR_send_Play();
}
resetMode();
tdmStopCopy = 0; /* Just in case */
stRepAB = 0; /* Clear Repeat A to B */
/* Pausing inside digest, 'PREV' key goes to the previous track */
if (digestPause) nextNplay = 1;
}
}
/*
* This routine is called when 'REMAIN' key is pressed.
*
* Front panel can display time in 3 different ways
* - Track time (0)
* - Single remain (1)
* - Total remain (2)
* Variable stRem keeps track of currrent "remain" state
*
* This key has no other side effect.
*/
PRIVATE void procRemain()
{
int osdlen = 2; /* OSD for 2 second if we are in pause mode */
if (playMode != MODE_PAUSE) osdlen = 5;
stRem++;
if (stRem == 1)
OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_single_remain,
MSG_c_single_remain, osdlen);
else if (stRem == 2)
OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_total_remain,
MSG_c_total_remain, osdlen);
else {
OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_single_elapsed,
MSG_c_single_elapsed, osdlen);
stRem = 0;
}
}
/*
* This routine is called when 'REPEAT' key is pressed.
*
* CD can be in one of the three repeat modes:
* - No repeat (0)
* - Repeat one track (1)
* - Repeat disc (2)
* Variable stRep keeps track of currrent repeat state
*
* This key has no other side effect.
*/
PRIVATE void procRepeat()
{
int osdlen = 2; /* OSD for 2 second if we are in pause mode */
if (playMode != MODE_PAUSE) osdlen = 5;
/* This key clears SET A (repeat A to B) */
if (stRepAB) stRep = 0;
else stRep++;
stRepAB = 0;
/*
* Output repeat state only if we are not in VIEW/DIGEST
*/
if (scanMode == SCAN_OFF) {
if (stRep == 1)
OUTOSD(OSD_REPEAT_REGION, MSG_repeat_one, MSG_c_repeat_one,osdlen);
else if (stRep == 2)
OUTOSD(OSD_REPEAT_REGION, MSG_repeat_all, MSG_c_repeat_all,osdlen);
else {
OUTOSD(OSD_REPEAT_REGION, MSG_repeat_off, MSG_c_repeat_off,osdlen);
stRep = 0;
}
}
}
/*
* This routine is called when the SLOW key is pressed.
*
* The logic is as follows:
* 1) If we are in SLOW mode, we'll quit it and enter normal play mode.
* 2) If we are in PAUSE mode, then OSD shows 'ERROR' (can't enter
* slow mode from there.
* 3) If we are inside digest, then we'll ignore this key
* 4) In any other mode, we'll first inspect what we are playing
* i) CDDA doesn't have SLOW mode ('ERROR')
* ii) For VCD, we'll quit whatever mode we were in and
* enter SLOW mode.
*/
PRIVATE void procSlow(){
if (playMode == MODE_SLOW) {
resetSystem();
OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_play, MSG_c_play, 5);
}
else if (playMode == MODE_PAUSE) {
OUTOSD(OSD_FUNCTION_STATUS_REGION, msgError, msgError, 2);
}
else {
if (TDM_isCDDA)
OUTOSD(OSD_FUNCTION_STATUS_REGION, msgError, msgError, 5);
else if (scanMode == SCAN_OFF) {
resetMode();
tdmStopCopy = 0; /* Just in case */
playMode = MODE_SLOW;
OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_slow, MSG_c_slow, 0);
vcx_pause = 0;
vcx_slow_motion = 8;
vcx_playvideo_only = 1;
#ifdef CYCLE
vcx_prevent_overflow = 0;
#endif
}
}
}
/*
* This routine is called when 'SURROUND' key is pressed.
*
* We can be in 1 of the 3 states:
* 1) Normal (spatial off)
* 2) Surround sound
* 3) Voice cancellation
*/
PRIVATE void procSpatial()
{
char * ptr;
#ifdef SPATIAL
ptr = SPA_set_level((SPA_level >= SPA_VOCAL_CUT) ? SPA_OFF : SPA_level+1);
#else
ptr = msgError;
#endif
OUTOSD(OSD_FUNCTION_STATUS_REGION, ptr, ptr, 5);
}
/*
* The routine is called when 'STOP' key is pressed.
*
* Regardless where we are, this routine will bring us back to NORMAL
* play state, and logo will be shown. Since some CD reacts slowly
* comparing to our chip, this routine will intentionally delay
* half of a second (customer can adjust this delay amount) for CD
* to react. It is a bad idea to show logo while CD continues to
* send in data.
*/
PRIVATE void procStop()
{
CLEARALLOSD();
OUTOSD(OSD_FUNCTION_STATUS_REGION, MSG_stop, MSG_c_stop, 5);
/* Reset things in order to show logo */
VID_init();
displayLogo = 1;
resetAll();
tdmStopCopy = 1; /* Avoid garbage data */
}
/*
* This routine is called then '10' key is pressed.
*
* The logic is as follows:
* 1) If we are not in PAUSE mode, then we'll reset and get back
* to the NORMAL play mode.
* 2) Regardless of whatever mode we were in, if
* i) we have pressed 10+ before, then 10+ state will be cleared
* and we'll not change the current track number
* ii) in all other cases, we'll go the track 10.
*/
PRIVATE void procTrack10()
{
if (playMode != MODE_PAUSE) {
resetMode();
tdmStopCopy = 0; /* Just in case */
}
/*
* If we are in the middle of 10+ selection, '10' key actually
* clears the selection.
* (customer may want to customize)
*/
if (cntTen) {
/* 10+ then 10 actually clears everything! */
#ifdef PBCON
irSendSelect(10);
#endif
CLEAROSD(OSD_FUNCTION_STATUS_REGION);
cntTen = 0;
} else {
cntTen = 1;
procTrackNumber(0); /* Output "SELECT 10" */
}
}
/*
* This routine is called when 10+ key is pressed.
*
* The logic is as follows:
* 1) If we are not in PAUSE mode, then we'll reset and get back
* to the NORMAL play mode.
* 2) Regardless of whatever mode we were in, we'll keep track of
* how many 10+ has been pressed for OSD purpose.
*
* When 10+ key is pressed and before the final track number is specified,
* NEXT/PREVIOUS/PAUSE keys have no effect (i.e. will be ignored.) 10 key
* can reset 10+ key without changing the current track number
*
* Input:
* num: Number to add to cntTen. Some of the keys (e.g. NEXT/
* PREVIOUS/STOP will not add anything to cntTen, but
* 10PLUS will add 1 to cntTen)
*/
PRIVATE void procTrack10Plus(num)
int num;
{
int osdlen = 2; /* OSD for 2 second if we are in pause mode */
if (playMode != MODE_PAUSE) {
resetMode();
osdlen = 5;
}
cntTen += num;
if (cntTen > 9) cntTen = 0;
msgSelect[SEL_NUM_POS] = cntTen + '0';
msgSelect[SEL_NUM_POS + 1] = '-';
#ifdef BILINGUAL_OSD
c_msgSelect[CSEL_NUM_POS] = cntTen + '0';
c_msgSelect[CSEL_NUM_POS + 1] = '-';
#endif
OUTOSD(OSD_FUNCTION_STATUS_REGION, msgSelect, c_msgSelect, osdlen);
}
/*
* This routine is called then a number key (other than 10/10+) is pressed.
*
* The logic is as follows:
* 1) If we are not in PAUSE mode, then we'll reset and get back
* to the NORMAL play mode.
* 2) If we are in PAUSE mode, then we'll send a 'PLAY' and get
* back to the NORMAL play mode.
* 2) CD is told to move to the specified track.
*/
PRIVATE void procTrackNumber(track)
int track;
{
int tmp = 0;
int osdtrack = track;
#ifdef ZOOM
if (zoom_level) {
if (osdtrack == 2) zoom_move_up();
if (osdtrack == 5) zoom_move_left();
if (osdtrack == 6) zoom_move_down();
if (osdtrack == 7) zoom_move_right();
return;
}
#endif
#ifdef PBCON
/*
* While playing a 2.0 disc, if PBC is ON and we are making selection
* while playing still picture, then add 1 to the track number.
*/
if ((vcdVersion == 0x3230) && pbcON && !vcx_digest &&
(TDM_most_recent_video == keepStillType)) {
track++;
/*
* If the selection
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -