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

📄 play.c

📁 ESS3890+SL原代码(1*16内存)
💻 C
📖 第 1 页 / 共 5 页
字号:
static 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_PAUSEint PLAY_jump_n_pause = 0; static char PLAY_in_pause_mode = 0; /* keep track of pause condition	  */#endifchar wait_pause=0;#ifdef MIC_RECORDstatic 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 SCENEunsigned 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;#ifdef THREE_CDSstatic int cd_disc_slot;#endif/* defines for PLAY_vcd_type */#define VCD_TYPE_NONE	0x0#define VCD_TYPE_10	0x1#define VCD_TYPE_11	0x2#define VCD_TYPE_20	0x4#define VCD_TYPE_ALL	0x7static unsigned char PLAY_vcd_type=VCD_TYPE_NONE;static unsigned char cddigest_start_track=0;#ifdef GAMMAextern 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_ROTATEextern 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		5int Pause_JPEG_ReDecoding;int JPEG_ReDecoding;#endifint jpeg_pause = 0;int jpeg_key = -1;int jpeg_cur_state;extern int Huff_state_jpg;#endif#ifdef GAMEBOY#ifdef VCDLCint NES_U_Period = 7;#elseint NES_U_Period = 5;#endif#endif /* GAMEBOY */#ifdef WMA_DECextern int wma_smpl_num;extern int wma_freq;extern ushort sample_rate[];#endif#ifdef JPEG_DGSTextern int JPG_digest;extern int jpg_index;#define JPEG_DGST_WNDW           9#define DGSTMENU#ifdef DGSTMENUstatic unsigned short jpg_dgst_x[JPEG_DGST_WNDW] = {    64, 240, 416,    64, 240, 416,    64, 240, 416,};#elsestatic unsigned short jpg_dgst_x[JPEG_DGST_WNDW] = {    64, 272, 480,    64, 272, 480,    64, 272, 480,};#endifstatic 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#define	AUDIO_BUFSZ	(((AUDIO_LEVEL_BARS-1)/2) + 5) /*<level><space><digits>*/#if USE_VOLUME_TBL #define AUDIO_LEVEL_LIMIT AUDIO_LEVEL_BARSuchar 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_TBLint is_audio_mute;int audio_level = AUDIO_LEVEL_LIMIT;void process_mute_key();void process_volume_key(int level);static void    osdVolumeBar(int, int);#endif /* VOLUME_CONTROL */ /*------------------------------------------------------------------------ * 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;    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);    }#ifdef DSC    DSC_zero_mute(zero_mute_on);#endif    /* 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);#ifdef DSC    DSC_zero_mute((aud_level >= 120));#endif    /* 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_LEVEL_LIMIT (16/128). *	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;    int region;       region = OSD_KARAOKE_REGION; #if (defined(MP3) || defined(JPEG_DEC))    if (STREAM_type) region = 7;#endif    if (level > AUDIO_MIN_LEVEL)         tmp = (((level) * AUDIO_LEVEL_BARS) / AUDIO_LEVEL_LIMIT);    PLAY_fill_volumebarbuf(tmp);    volumebarbuf[AUDIO_LEVEL_BARS/2] = ' ';        hex2string(volumebarbuf+AUDIO_BUFSZ - 3, level);    CG_MAP_COLOR(1,6,3);    CG_MAP_DELAYED(8,2,2);    OUTOSD(region, volumebarbuf, volumebarbuf, osdlen);}#endif VOLUME_CONTROL/* fill volumebarbuf[]..used by REC_time_bar() and osdVolumeBar() */static void PLAY_fill_volumebarbuf(int level){    int i;        /* 0 <= level <= 16 */    for (i = 0; i < (level>>1); i++) {	asm("nop");	volumebarbuf[i] = FONT_LL;    }    if (level&1) volumebarbuf[i++] = FONT_LS;            for (; i < (AUDIO_LEVEL_BARS/2); i++) {	asm("nop");	volumebarbuf[i] = FONT_SS;    }}#ifdef EQUALIZER#define EQ_KEY	KEY_MINUS /* testing */#define EQ_ON_OFF_KEY KEY_PLUS /* testing */static int process_EQ_key(key){    int tmp, update = 0;    unsigned char *eq_settings;    if (key == EQ_KEY) {	OSD_eq_mode++;	if (OSD_eq_mode > OSD_EQ_LIMIT) OSD_eq_mode = OSD_EQ_CLEAR;	OSD_eq_mode_previous = OSD_EQ_CLEAR; /* used to bring back EQ OSD */    	EQ_display_setup(1, OSD_eq_mode);	EQ_display(OSD_eq_mode);    } else {	if (OSD_eq_mode != OSD_EQ_CONTROL) {	    /* exit EQ mode */            if (key == SURROUND_KEY) OSD_eq_mode = -2;            else                     OSD_eq_mode = 0;	    EQ_display(OSD_EQ_CLEAR);	    return (0); /* key not processed */	    	}		if (key == SURROUND_KEY) {	    /* change EQ music-type effects */	    EQ_music_type_effect++;	    if (EQ_music_type_effect > EQFX_PERSONAL) 		EQ_music_type_effect = EQFX_STANDARD;	    if (!OSD_eq_mode) return (1); /* let display come back later */	    	    EQ_display(OSD_EQ_CONTROL);	} else if (key == ZOOM_LEFT_KEY) {	    tmp = EQ_cur_freq;	    /* move focus left if possible */	    if (tmp != EQ_60HZ) {		EQ_cur_freq -= 2;		eq_settings = (EQ_music_type_effect == EQFX_PERSONAL) ?		    eq_person_level : &(EQ_SETTINGS[EQ_music_type_effect*7]);		EQ_adj(tmp, eq_settings[(tmp>>1)]);		EQ_adj(EQ_cur_freq, eq_settings[(EQ_cur_freq>>1)]);				update = 1;	    }	} else if (key == ZOOM_RIGHT_KEY) {	    tmp = EQ_cur_freq;	    /* move focus right if possible */	    if (tmp != EQ_15KHZ) {		EQ_cur_freq += 2;		eq_settings = (EQ_music_type_effect == EQFX_PERSONAL) ?		    eq_person_level : &(EQ_SETTINGS[EQ_music_type_effect*7]);		EQ_adj(tmp, eq_settings[(tmp>>1)]);		EQ_adj(EQ_cur_freq, eq_settings[(EQ_cur_freq>>1)]);		update = 1;	    }	} else if ((key == ZOOM_UP_KEY) || (key == ZOOM_DOWN_KEY)) {	    if (EQ_music_type_effect == EQFX_PERSONAL) {		update = (key == ZOOM_UP_KEY) ? 1 : -1;				/* Only personal settings can change */		tmp = eq_person_level[(EQ_cur_freq>>1)] + update;		/* change EQ level if possible */		if ((tmp <= 24) && (tmp >= 0)) {		    eq_person_level[(EQ_cur_freq>>1)] = tmp;		    EQ_adj(EQ_cur_freq, tmp);		    		    update = 1;		} else		    update = 0;	    } else {		/* ignore key */		return (0);	    }	    	} else {	    /* exit EQ mode */	    update = -1;	}		if(update == 1) {	    EQ_show_db(EQ_cur_freq);	} else if(update < 0) {	    /* exit EQ mode */	    EQ_display(OSD_EQ_CLEAR);	    	    return (0); /* key not processed */	}	/* customers requested to turn on EQ when adjusting	 * EQ settings.	 */	if (!EQ_mode) {	    EQ_mode = 1; /* turn on EQ processing */	    MIX_init();	}	    }        return (1);}#endif EQUALIZER/*------------------------------------------------------------------------  Function:  Parameters:  Description:------------------------------------------------------------------------*/void reset_play_machine(){#ifdef EQUALIZER    if (OSD_eq_mode > 0) {	/* exit EQ mode */	EQ_display(0);    }#endif EQUALIZER

⌨️ 快捷键说明

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