⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plays.c

📁 ESS3890+SL原代码(1*16内存)
💻 C
📖 第 1 页 / 共 5 页
字号:
};
static unsigned char c_sel_buf[] = {
    CN_HEADER, CN_XUAN3, ' ', CN_HEADER, CN_ZE2, ' ', ' ', ' ', ' ', ' ', '\0'
};
static unsigned char c_FF_buf[] = {
    CN_HEADER, CN_KUAI4, CN_HEADER, CN_JIN4, ' ', 'X', '1', '\0'
};
static unsigned char c_FR_buf[] = {
    CN_HEADER, CN_KUAI4, CN_HEADER, CN_TUI4, ' ', 'X', '1', '\0'
};
#ifdef SONY3D
static unsigned char c_disc_buf[] = {
    CN_HEADER, CN_XUAN3, CN_HEADER, CN_DIE2, ' ', '\0'
};
#endif
#else
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 /* USE_CN_HEADER */
#endif /* BILINGUAL_OSD */

/* OSD messages used outside play.c module */
unsigned char goto_buf[] = " GO TO   :  ";
#ifdef BILINGUAL_OSD
#ifdef USE_CN_HEADER
unsigned char c_goto_buf[] =
{' ', CN_HEADER, CN_SHI2, ' ', CN_HEADER, CN_JIAN1, ' ', ' ', ' ', ':', ' ', ' ', '\0'};
#else
unsigned char c_goto_buf[] =
{' ', CN_SHI2, ' ', CN_JIAN1, ' ', ' ', ' ', ':', ' ', ' ', '\0'};
#endif /* USE_CN_HEADER */

#ifdef EQUALIZERX /* enable after we have the required Chinese fonts */
unsigned char c_music_type_buf[] = {CN_HEADER,CN_JUN1, CN_HEADER,CN_HENG2,
				    ':',' ',' ',' ',' ',0};
unsigned char c_music_env_buf[] ={CN_HEADER,CN_SHENG1, CN_HEADER,CN_CHANG3,
				  CN_HEADER,CN_XIAO4, CN_HEADER,CN_GUO3,
				  ':',' ',' ',' ',' ',' ',' ',0};
#endif EQUALIZER
#endif BILINGUAL_OSD


#if defined(EQUALIZER) && defined(DAE_SPATIAL)
#ifdef MORE_ENV_TYPES
uchar DAE_mode_table[] = {0, 1, 4, 5, 0, 3, 0, 0, 2, 6};
#else
uchar DAE_mode_table[] = {1, 4, 0, 5, 3, 2};
#endif MORE_ENV_TYPES
#endif /* EQUALIZER && DAE_SPATIAL */

uchar *KEY_mode_msg[] = {
    "KEY ADJUST"
#ifdef EQUALIZER
    ,"EQ INPUT"
#endif
#ifdef GAMMA
    ,"SMARTBRIGHT"
#endif
#ifdef FLESHTONE
    ,"SMARTCOLOR"
#endif
};

/*------------------------------------------------------------------------
    User defined data structures
------------------------------------------------------------------------*/
unsigned short			list_previous_list_offset=0;
unsigned short			list_next_list_offset=0;
static unsigned short		list_return_list_offset=0;
static unsigned short		play_list_playing_time=0;
static unsigned 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 GAMEBOY
static unsigned char		game_list_local_cpu_type=0;
short				game_list_misc_def=0;
short				game_list_buffer_size=0;
int				is_ess_game=0;
#endif
#ifdef VCD_MP3G
int                             is_vcd_mp3g=0;
int                             mp3g_cur_menu_psd_offset = 0;
int                             cur_mp3g_play_item;
int                             cur_mp3g_cdg_size = 0;
int                             cur_mp3g_cdg_start_loc = 0;
int                             cur_mp3g_mp3_size = 0;
int                             cur_mp3g_mp3_start_loc = 0;
static void mp3g_play_list_state();
static void play_mp3g(int item);
static void vcd_mp3g_reset();
static int  Is_VCDMP3G_DISC(unsigned char *pVcd);
#endif

static int			selection_list_loop_count;
static unsigned short		selection_list_default_list_offset=0;
static unsigned short		selection_list_time_out_list_offset=0;
static unsigned 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;

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 */
int play_item_end_time;	/* mmssff : the play end time of the item */
static unsigned char play_item_mode = 0;	/* record stop or play mode. */
unsigned char play_item_type = 0;	/* AUDIO or DATA track */

#ifdef JUMP_N_PAUSE
int PLAY_jump_n_pause = 0;
static char PLAY_in_pause_mode = 0;	/* keep track of pause condition	  */
#endif

char wait_pause = 0;

#ifdef MIC_RECORD
static int  rec_play_timer, rec_follow_timer;
static char reread_counter, contrast_counter;
static char need_playback = 0;
static char mic_osd_on;
static char REC_remain_time_last;
static int  AUD_begin_frame = 0;
#endif /* MIC_RECORD */


/*------------------------------------------------------------------------
  Global Variables
------------------------------------------------------------------------*/
unsigned char track_list[MAX_TRACK_NUMBER];	/* the track play list */
unsigned int track_list_max;	/* max track used in track_list */

int current_key = NO_KEY;	/* The key received from users          */
int assign_key = NO_KEY;	/* internally assigned "key"..
				 * higher priority than IR keys		*/
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          */

unsigned char vocal_assist_on = 0;
unsigned char audio_mode = 0;
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.   */

int cur_track_index = 0;	/* index to the track play list */
static ushort pre_psd_offset;	/* store the previous psd offset, so we can
				 * come back if the new psd offset is not
				 * valid. */

static ushort cur_psd_offset;	/* current psd offset number            */

#ifdef SCENE
unsigned char  	scene_search_on;	/* for scene OSD timeout	*/
unsigned short  current_list_id = 0;
static unsigned short  last_list_id;
static char first_entry;	    /* used in preprocess_digit_key()     */
static int prev_play_state;     /* note play_state when changing  	*/
#endif /*SCENE*/

unsigned int timeout_begin_time;	/* the time in 1/64 second unit */
					/* when the timer is set. */
unsigned char fast_frame_index = 0;	/* FF/FR index of
					 * fast_frame_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.               */

unsigned char repeat_a2b = 0;


static unsigned char intro_mode = 0;	/* 1 -> we are in intro mode          */
unsigned char cd_stop = 1;

/* 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 digit_count = 0;	/* for GOTO and SCENE digits */
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)	 */


static int osd_time_key_index;	/* indicates what is on the screen */
unsigned char cd_tray_just_closed = 0;

/* defines for PLAY_vcd_type (bit mask) */
#define VCD_TYPE_NONE	0x0
#define VCD_TYPE_10	0x1
#define VCD_TYPE_11	0x2
#define VCD_TYPE_20	0x4
#define VCD_TYPE_ALL	0x7
unsigned char PLAY_vcd_type = VCD_TYPE_NONE;

static unsigned char cddigest_start_track = 0;

#ifdef SONY3D			/* Liang Weihua */
extern int TrayStatus;
char int_eject;
int cd_disc_slot;
#endif

#ifdef GAMMA
extern int gamma_index;
#endif

#if (defined(GAMMA) || defined(FLESHTONE))
extern int VscaleStart;
#endif

#if defined(FLESHTONE) || defined(JPEG_DEC)
int JpgFleshtoneVscale = 0;
#endif

#ifdef JPEG_DEC
#ifdef JPEG_ROTATE
extern int Rotate_Proc;
#define ROTATE_NONE 		0
#define ROTATE_INVERT		1
#define ROTATE_MIRROR		2
#define ROTATE_TRANSPOSE	3
#define ROTATE_LEFT		4
#define ROTATE_RIGHT		5
int Pause_JPEG_ReDecoding;
int JPEG_ReDecoding;
#endif
int jpeg_pause = 0;
int jpeg_key = -1;
int jpeg_cur_state;
extern int Huff_state_jpg;
#endif /* JPEG_DEC */

#ifdef GAMEBOY
#ifdef VCDLC
int NES_U_Period = 7;
#else
int NES_U_Period = 5;
#endif
#endif /* GAMEBOY */

#ifdef WMA_DEC
extern int wma_smpl_num;
extern int wma_freq;
extern ushort sample_rate[];
#endif

#ifdef JPEG_DGST
extern int JPG_digest;
extern int jpg_index;
#define JPEG_DGST_WNDW           9
#define DGSTMENU
#ifdef DGSTMENU
static unsigned short jpg_dgst_x[JPEG_DGST_WNDW] = {
    64, 240, 416,
    64, 240, 416,
    64, 240, 416,
};
#else
static unsigned short jpg_dgst_x[JPEG_DGST_WNDW] = {
    64, 272, 480,
    64, 272, 480,
    64, 272, 480,
};
#endif
static unsigned short jpg_dgst_y[JPEG_DGST_WNDW] = {
    44,  44,  44,
    180, 180, 180,
    316, 316, 316
};

static unsigned short jpg_dgst_y_pal[JPEG_DGST_WNDW] = {
    92,  92,  92,
    228, 228, 228,
    364, 364, 364,
};
#endif /* JPEG_DGST */

#ifdef VOLUME_CONTROL
#define USE_VOLUME_TBL 1 /* 1: enable use of customizable volume_tbl[] */

/* variables regarding to audio volume control */
#define AUDIO_MAX_LEVEL	 128
#define AUDIO_LEVEL_BARS 16
#define AUDIO_MIN_LEVEL  0
/* <level><space><digits> */
#define	AUDIO_BUFSZ	 (((AUDIO_LEVEL_BARS-1)/2) + 5)

#if USE_VOLUME_TBL
#define AUDIO_LEVEL_LIMIT AUDIO_LEVEL_BARS
uchar volume_tbl[] = { /* customize for your volume steps */
    0,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128
};
#else
#define AUDIO_LEVEL_LIMIT AUDIO_MAX_LEVEL
#endif USE_VOLUME_TBL

int is_audio_mute;
int audio_level = AUDIO_LEVEL_LIMIT;

int volume_flag=0;
int echo_resume_flag=-1;
void process_mute_key();
void process_volume_key(int level);
static void osdVolumeBar(int, int);
#endif /*  VOLUME_CONTROL */

#ifdef HOST_SLAVE
#include "slave.h"

#define NOTHING 	0
#define PLAY		1
#define PAUSE		2
#define UNPAUSE         3

int stop_track_number=-1;
int pause_track_number=0;
int stop_play_time=0;
int no_toc=0;

extern unsigned char force_Play_Mode_flag;
extern unsigned char force_Playing_State_flag;
extern int codeOperand;
extern unsigned char Recbak_Buffer[RECEIVE_BUFFER_MAX];
#endif

#ifdef POWER_NOISE_MUTE
int             power_down_flag = 0;
#endif


/*------------------------------------------------------------------------
 * Begin function listing
 *------------------------------------------------------------------------*/

#ifdef VOLUME_CONTROL
/*------------------------------------------------------------------------
  Function:

  Parameters:

  Description:
------------------------------------------------------------------------*/
void reset_audio()
{
    is_audio_mute = 0;
    audio_level = AUDIO_LEVEL_LIMIT;
}

void process_mute_key()
{
    int aud_level, zero_mute_on;
    unsigned char *msg, *c_msg;

#ifdef HOST_SLAVE
    if (codeOperand == 1) is_audio_mute = 1; /* Force to mute */
    else if (codeOperand == 2) is_audio_mute = 0; /* Force to un-mute */
    else
#endif

    is_audio_mute ^= 1;
    if (is_audio_mute) {	/* Set to 0 */
	assign_osd_msg(msg, MSG_mute, c_msg, MSG_c_mute);
	vcx_audio_volume = 0;
        zero_mute_on = 0;
    } else {			/* Restore */
	assign_osd_msg(msg, clear_msg, c_msg, clear_msg);
#if USE_VOLUME_TBL
	aud_level = volume_tbl[audio_level];
#else
	aud_level = audio_level;
#endif
	vcx_audio_volume = (unsigned int) ((aud_level << 8) | aud_level);
        zero_mute_on = (aud_level >= 120);
    }
    DSC_zero_mute(zero_mute_on);
    /* Display indefinitely while MUTING */
    OUTOSD(OSD_AUDFX_REGION, msg, c_msg, 0);
}

void process_volume_key(int change_level)
{
    int aud_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_LEVEL_LIMIT) {
	audio_level = AUDIO_LEVEL_LIMIT;
    } else if (audio_level < AUDIO_MIN_LEVEL) {
	audio_level = AUDIO_MIN_LEVEL;
    }

#if USE_VOLUME_TBL
    aud_level = volume_tbl[audio_level];
#else
    aud_level = audio_level;
#endif
    vcx_audio_volume = (unsigned int) ((aud_level << 8) | aud_level);
    DSC_zero_mute((aud_level >= 120));

    /* show osd */
    osdVolumeBar(audio_level, DISPLAY_TIME_OUT);
#ifdef FIVE_DISC_POWERRESUME
#ifdef I2C_E2PROM
	if (!EepromErr){
		i2c_e2prom_bywrite(STARTUP_PLAY_AUDIO_LEVEL+DiscAddr, audio_level);
	}
#endif
#endif FIVE_DISC_POWERRESUME
}

/*(This function is taken from po4tact.c)
 * Display the volume bar.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -