Exemple #1
0
void music_play(void)
{
    u8 key;
    u8 file_end_time;

#ifdef ADKEY_SELECT_MODE
    mode_switch_protect_bit=0;
#endif	
    while (1)
    {	   		
		if (play_status == MUSIC_PLAY)
		{
			dac_out_select(DAC_DECODE);
		}
		//suspend_sdmmc();

		key = get_msg();
		
#ifdef USE_USB_PROG_PLAY_MODE
		if(usb_play_prog_mode){
			
			usb_prog_hdlr(key);
			if((key==INFO_HALF_SECOND)||(key==(INFO_MODE | KEY_SHORT_UP))||(key==(INFO_NEXT_FIL | KEY_SHORT_UP))||(key==(INFO_PREV_FIL | KEY_SHORT_UP))){
				key = 0xFF;
			}		
		}
#endif	

        switch (key)
        {
        case INFO_NEXT_SYS_MODE:
		return;
		
        case INIT_PLAY:                                 //开始解码播放
            	file_end_time = 0;
            	stop_decode();
		playpoint_flag = 0;
              if(playpoint_filenum)
		{
		    playpoint_flag = 1;
			given_file_number = playpoint_filenum;
		}
#if FILE_ENCRYPTION
            password_start(0);
#endif
            	if (!fs_getfile_bynumber(given_file_number))
            	{
			put_msg_lifo(INFO_NEXT_FIL | KEY_SHORT_UP);
                	break;
            	}

            	if (!start_decode())
            	{
			put_msg_lifo(INFO_NEXT_FIL | KEY_SHORT_UP);
            	}	
#ifdef USE_USB_PROG_PLAY_MODE
		if(usb_prog_icon_bit){
			usb_prog_play=1;
		}
#endif
				
            	break;

        case SEL_GIVEN_DEVICE_GIVEN_FILE:              ///<获取指定设备的指定文件
		get_music_file2();
            	break;
        case INFO_STOP| KEY_SHORT_UP :
#ifdef USE_USB_PROG_PLAY_MODE

		if(usb_prog_play){
				
				usb_prog_play=0;
				usb_play_prog_index =0;
				
				flush_all_msg();
				stop_decode();
				Disp_Con(DISP_STOP);
   			 //printf(" ---> usb_prog_icon_bit	%x \r\n",(u16)usb_prog_icon_bit);
				play_mode  =REPEAT_OFF;
				
				break;
		}
		usb_prog_mode_cls();
#endif

		if((get_device_online_status()==0)){
			break;
		}

		Mute_Ext_PA(MUTE);            
		disp_play_filenum_timer=6;
		play_mode  =REPEAT_OFF;

		flush_all_msg();
		stop_decode();
		Disp_Con(DISP_STOP);			
		break;
        case INFO_NEXT_FIL | KEY_SHORT_UP:
			
#ifdef USE_FOLDER_SELECT_FUNC
		if(folder_select){
			
			select_folder_file(FIND_NEXT_DIR);
		       Disp_Con(DISP_DIR);	
			break;			   
		}
#endif
		disp_play_filenum_timer=10;

		get_music_file1(GET_NEXT_FILE);
            	break;

        case INFO_PREV_FIL | KEY_SHORT_UP:
			
#ifdef USE_FOLDER_SELECT_FUNC
		if(folder_select){
			
			select_folder_file(FIND_PREV_DIR);
		       Disp_Con(DISP_DIR);	
			break;
		}
#endif		

		if(rew_play_timer>0){

			rew_play_timer=0;
                	put_msg_lifo(INIT_PLAY);
		}
		else
		{
			disp_play_filenum_timer=10;
			get_music_file1(GET_PREV_FILE);
		}
            	break;
        case INFO_NEXT_FIL | KEY_HOLD:
			
		if(play_status)
		{
			ff_fr_step = FAST_FARWORD_STEP;
			play_status = MUSIC_FF_FR;
#if (FF_FR_MUSIC)
			if(0 == decode_cmd)
#endif
			{			
				analog_vol_set(0);
				decode_cmd = 0xf0;
			}
            	}
		break;
        case INFO_PREV_FIL | KEY_HOLD:
	       if(music_type == 2)    //wav文件不支持断点记忆,故可以快退
	       { 
	             playpoint_flag =0;
	       }
			
		if(!playpoint_flag) 				//读取断点信息后不支持快退
		{
			if(play_status)
			{
				ff_fr_step = -FAST_FARWORD_STEP;
				play_status = MUSIC_FF_FR;
#if (FF_FR_MUSIC)
				if(0 == decode_cmd)
#endif					
				{
					analog_vol_set(0);
					decode_cmd = 0xf1;
				}
			}    
		}
		break;

        case DECODE_MSG_DISK_ERR:
#ifdef MP3_UART_ENABLE
			sys_printf(" DECODE_MSG_DISK_ERR");
#endif
			
		get_music_file3();
            	break;

        case DECODE_MSG_FILE_END:               ////*将文件结束的消息放到半秒消息中处理,防止单曲循环遇到错误歌曲无法手动切换下一首,或遇到错误歌曲无法到上一首,每首歌曲至少播放约5S*/
		if (get_music_play_time() < 5)
		{
			file_end_time = 7 - (u8)get_music_play_time();
            	}
		else
		{	

#ifdef MP3_UART_ENABLE
			sys_printf(" DECODE_MSG_FILE_END");
#endif
		
			get_music_file1(GET_PLAY_FILE);
		}
		break;
    	case MSG_USB_DISK_IN  :
		Disp_Con(DISP_SCAN_DISK);	
        	disp_scenario = DISP_NORMAL;
	 	//Add_Func_To_List(USB_DEV);
        	given_device = BIT(USB_DISK);
        	put_msg_lifo(SEL_GIVEN_DEVICE_GIVEN_FILE);	
	break;   
	
        case INFO_NEXTMODE:                     ///<下一个模式
		//work_mode = SYS_IDLE;
            //return;
	        stop_decode();
#ifdef NO_DEV_SHOW_NO_DEV
#ifdef USE_USB_PROG_PLAY_MODE
		usb_prog_mode_cls();
#endif
		folder_select=0;
		folder_mode_select=0;
		Disp_Con(DISP_NODEVICE);
#else
             	Disp_Con(DISP_RTC);
		disp_scenario = DISP_RTC_SCEN;
#endif		
		break;
        case INFO_PLAY | KEY_SHORT_UP :
			
#if defined(USE_TIMER_POWER_OFF_FUNC)
		if(timer_setting_enable){
			timer_pwr_setting();
			break;
		}
#endif		
		if((get_device_online_status()&0x03)==0){
			break;
	     }		
            if (DISP_DWORD_NUMBER == curr_menu)
            {
                	Disp_Con(DISP_NULL);
			put_msg_fifo(INFO_PICK_SONG | KEY_SHORT_UP);
                	break;
            }
			
            if (play_status == MUSIC_PAUSE)
            {
			Mute_Ext_PA(UNMUTE);
			play_status = MUSIC_PLAY;
			Disp_Con(DISP_PLAY);
                	mad_control(MAD_PLAY,0);
			if(music_type == 1)
				enable_decodeint();
			if(music_type == 2)
				enable_softint();
            }
            else if (play_status == MUSIC_PLAY)
            {
			Mute_Ext_PA(MUTE);            
			play_status = MUSIC_PAUSE;
			if(music_type == 1)
				disable_decodeint();
			Disp_Con(DISP_PAUSE);
                	mad_control(MAD_PAUSE,0);
                	read_usb_remain_data();
			write_playtime(&playpoint_time);	   	//暂停时记忆断点信息(EEPROM)
            }
            else if (play_status == MUSIC_STOP){

			disp_play_filenum_timer=10;
			
#ifdef USE_USB_PROG_PLAY_MODE
			if(usb_play_prog_mode){

				if(usb_prog_tab[0]!=0){
					given_file_number =usb_prog_tab[0];

				}
				else{
					usb_prog_mode_cls();
				}
				usb_play_prog_mode=0;
			}				
#endif
                	put_msg_lifo(INIT_PLAY);
			//Mute_Ext_PA(UNMUTE);

	     }
            break;

        case INFO_PICK_SONG | KEY_SHORT_UP :
            given_file_number = (u16)cfilenum;           
            cfilenum = 0;
	     if ((given_file_number > 0) && (given_file_number <= fs_msg.fileTotal))
            {
                	put_msg_lifo(INIT_PLAY);
                	break;
            }
	     Disp_Con(DISP_ERROR);
            break;
       case INFO_HALF_SECOND :
	   	
#if ((USE_DEVICE == MEMORY_STYLE)&&(FAT_MEMORY))      
            updata_fat_memory();
#endif

#if defined(USE_BAT_MANAGEMENT)
	     bmt_hdlr();
#endif
#ifdef USE_USB_ERP_2_HDLR
	     usb_erp_2_timer_hdlr();
#endif

#if defined(USE_TIMER_POWER_OFF_FUNC)
	       timer_pwr_off_hdlr();
#endif

            set_brightness_fade_out();
	     update_playpoint(&playpoint_time);		//半秒更新断点进度,不写入存储器

#if 1//defined(USE_FOLDER_SELECT_FUNC)
		if(folder_select){
           	 	return_cnt++;
            		if (RETURN_TIME == return_cnt){
				return_cnt=4;
				folder_select=0;
			}
			else{
				break;
			}
		}
#endif		
	    if(adkey_detect){
	   	    adkey_detect=0;
	   	    set_sys_vol(my_music_vol);
	    }

	     if(disp_play_filenum_timer>0)disp_play_filenum_timer--;
		 
            if (file_end_time)
            {
			file_end_time--;
                	if (file_end_time == 0)
			{
                    		get_music_file1(GET_PLAY_FILE);		
			}
            }
#if FF_FR_MUSIC	   ///在每一次快进完成之后,播出半秒左右的声音
	     if ((2 == decode_cmd)&&(play_status == MUSIC_FF_FR))
	     {
			decode_cmd = 0;
			set_eq(eq_mode);
			play_status = MUSIC_PLAY;
	     }

#else
            if ((decode_cmd != 0) && (decode_cmd <= 2))		
            {
                	decode_cmd--;
			set_eq(eq_mode);
                	if (decode_cmd == 0) 					///<快进快退结束后1S,打开主音量
		  	{
				play_status = MUSIC_PLAY;
		   	}
            }
#endif
#ifdef RTC_DISP_IN_IDLE_MODE

	    if(disp_scenario == DISP_RTC_SCEN){

		    	rtc_setting_exit();

			if(curr_menu != DISP_RTC){
            			return_cnt++;
            			if (RETURN_TIME == return_cnt){
					rtc_disp_hdlr();
				}
				break;
			}
			rtc_disp_hdlr();
			break;
	     }
#endif	

#ifdef NO_DEV_SHOW_NO_DEV
		if((get_device_online_status()&0x03)==0){
			Disp_Con(DISP_NODEVICE);
			break;
		}
#endif            

            if (DISP_PLAY == curr_menu)
            {
			rew_play_timer=1;				            
                	disp_file_time();
            }

            return_cnt++;
            if (RETURN_TIME == return_cnt)
            {

#if defined(USE_TIMER_POWER_OFF_FUNC)	
			timer_setting_enable=0;
#endif

                if (DISP_DWORD_NUMBER == curr_menu)
                {
			Disp_Con(DISP_NULL);
                    	put_msg_fifo(INFO_PICK_SONG | KEY_SHORT_UP);
                }
                else
                {
                    if (play_status== MUSIC_PAUSE){
                        if (curr_menu != DISP_PAUSE)
                            Disp_Con(DISP_PAUSE);
                    }
                    else if(play_status== MUSIC_PLAY){
                        if (curr_menu != DISP_PLAY){

				if(disp_play_filenum_timer==0)
                            Disp_Con(DISP_PLAY);
				else
                            Disp_Con(curr_menu);
			   }
                    }
		      else if(play_status== MUSIC_STOP){

                        if (curr_menu != DISP_STOP)
                            Disp_Con(DISP_STOP);
			  }
                }
            }
#if 1//( USE_RTCRAM == MEMORY_STYLE  )
			save_playpoint(2);	   	//2*0.5 = 1s 1s记录一次播放进度,
#endif
		break;

	 case INFO_MODE | KEY_LONG:

		if((get_device_online_status()==0)){
			break;
		}
#if 0		
#ifdef USE_USB_PROG_PLAY_MODE
		if(play_status == MUSIC_STOP){
			usb_prog_play_init();
			break;
		}
#endif
#endif
		folder_mode_select=~folder_mode_select;
		folder_select=folder_mode_select;
		if(folder_mode_select){
#ifdef USE_USB_PROG_PLAY_MODE
			usb_prog_mode_cls();
#endif		
		       Disp_Con(DISP_DIR);	
		}
		else{
		       Disp_Con(DISP_PLAY);	
		}
		break;
	 case INFO_MODE | KEY_SHORT_UP:

		if((get_device_online_status()==0)){
			break;
		}
#ifdef USE_USB_PROG_PLAY_MODE
		if(play_status == MUSIC_STOP){
			usb_prog_play_init();
			break;
		}
#endif
        case INFO_PLAY_MODE :

		//if(usb_play_prog_mode||usb_prog_icon_bit){
		//	 break;
		//}			
		
		play_mode++;
            	if (play_mode > REPEAT_END)
            	{
                	play_mode = REPEAT_HEAD;
            	}
#ifndef NO_PLAY_MODE_STR_DISP				
            write_info(MEM_PLAY_MODE,play_mode);
            Disp_Con(DISP_PLAYMODE);
#endif			
            break;
			
	    case INFO_EQ_UP | KEY_SHORT_UP :
               
	        eq_mode++;
	        if (eq_mode > CLASSIC)
	        {
	            eq_mode = NORMAL;
	        }
	        write_info(MEM_EQ_MODE,eq_mode);
	        set_eq(eq_mode);
	        Disp_Con(DISP_EQ);
	        break;
#if 0			
    	case INFO_MODE | KEY_LONG:
		if(disp_scenario == DISP_RTC_SCEN){

			if(rtc_setting==0){
				rtc_setting = 0x01;
				rtc_set = 3;
	                	rtc_set_cnt=30;
			}
		}			
		break;
#endif		
#if RTC_ENABLE 
	 case INFO_ALM_BELL :					///<闹钟响消息,进入闹钟循环
            	if (play_status)
            	{
				/**/
			if(music_type == 1)
				disable_decodeint();
                
			mad_control(MAD_PAUSE,0);
                	read_usb_remain_data();
            	}
            
		if(alm_bell_mode())
		{
			if (play_status)
		       {
	              	mad_control(MAD_PLAY,0);
				if(music_type == 1)
					enable_decodeint();
				if(music_type == 2)
					enable_softint();			
	            	}
			return;	
		}

            	if (play_status)
            	{
                	mad_control(MAD_PLAY,0);
			if(music_type == 1)
				enable_decodeint();
			if(music_type == 2)
				enable_softint();			
            	}
#ifdef PWR_CTRL_IN_IDLE_MODE

#if defined(PWR_CTRL_WKUP)
		wkup_pin_ctrl(1);
#else
		PWR_CTRL_GPIO_INIT();
		PWR_CTRL_EN();
#endif

#endif
		break;
#endif			
        default :
_HOT_KEY_HDLR:		
            if (!ap_handle_hotkey(key))
                return;
            if ((!play_status) && (!device_check()))
            {
		if(disp_scenario == DISP_NORMAL){

		  	stop_decode();
	             	Disp_Con(DISP_RTC);
			disp_scenario = DISP_RTC_SCEN;
		  }
                play_status = MUSIC_PLAY;
                //return;
            }
        }
    }
}
/*----------------------------------------------------------------------------*/
void music_play(void)
{
    u8 key;
    u8 res;
	
    while (1)
    {
#if (FF_FR_MUSIC == 0)
        if (play_status == MAD_PLAY)
        {
            dac_out_select(DAC_MUSIC, 0);
        }
#else
        if ((play_status == MAD_PLAY) || (play_status == MAD_FF) || (play_status == MAD_FR))
        {
            dac_out_select(DAC_MUSIC, 0);
        }
#endif
        //suspend_sdmmc();						//可减少SDMMC功耗,但会增加电源波动
        key = app_get_msg();

        switch (key)
        {
        case MSG_CHANGE_WORK_MODE:
            //backup_music_point();
           break;
           // return;

        case MSG_DEVICE_REMOVED:
        	device_check();
        	disk_remove_deal_for_music();
		stop_decode();
	 	dev_remov_timer=8;
		
            break;

        case MSG_MUSIC_NEW_DEVICE_IN:							//有新设备接入
            //backup_music_point();
            flush_all_msg();
            given_file_method = PLAY_FIRST_FILE;
	case MSG_MUSIC_SELECT_NEW_DEVICE:					        //重新选择设备
            res = find_device(given_device);

            if ((res == DEV_INIT_ERR) ||
                    (res == NO_DEFINE_DEV))                    //指定的设备不在线,或初始化失败
            {
			disk_toc_ok=0;
			dev_invalid=1;
		    //Set_Curr_Func(SYS_IDLE);
       	    //put_msg_lifo(MSG_CHANGE_WORK_MODE);      
	            break;
				
                //given_device = DEVICE_AUTO_NEXT;			   //自动选择下一个设备
                //put_msg_lifo(MSG_MUSIC_SELECT_NEW_DEVICE);
                //break;
            }
            else if ((res == NO_EFFECTIVE_DEV) ||
                     (res == NO_DEV_ONLINE))                    //无可播放的设备
            {
#if defined(NO_DEV_DEFAULT_GO_TO_AUX)
		 //Set_Curr_Func(SYS_AUX);
#elif defined(NO_DEV_DEFAULT_GO_TO_IDLE)
		// Set_Curr_Func(SYS_IDLE);
        	 //put_msg_fifo(MSG_NO_DEVICE);	 
#else
		 //Set_Curr_Func(SYS_FMREV);
#endif

			disk_toc_ok=0;
			dev_invalid=1;

		 //Set_Curr_Func(SYS_IDLE);
       	 //put_msg_lifo(MSG_CHANGE_WORK_MODE);      
	        break;

            }
            else
                put_msg_lifo(MSG_MUSIC_SELECT_NEW_FILE);		//找到可用设备

	     first_init_dev =1;

            break;

        case MSG_MUSIC_SELECT_NEW_FILE:

#if 0
            if (device_check() == 0)                                //当前播放设备已经不在线,则自动选取下一个设备
            {
#if 1
			disk_toc_ok=0;
	    	 //Set_Curr_Func(SYS_IDLE);
	        //put_msg_lifo(MSG_CHANGE_WORK_MODE);      
#else            
                given_device = DEVICE_AUTO_NEXT;
                put_msg_lifo(MSG_MUSIC_SELECT_NEW_DEVICE);
#endif				
                break;
            }
#endif
            res = fs_get_filenum(play_mode, given_file_method);

#if 0
            if (res == GET_DEVICE_END)								//下一曲到设备的结束,查找下一个设备的第一首
            {
                given_file_method = PLAY_FIRST_FILE;
                given_device = DEVICE_AUTO_NEXT;
                put_msg_lifo(MSG_MUSIC_SELECT_NEW_DEVICE);
                break;
            }
            else if (res == GET_DEVICE_HEAD)								//上一曲到设备的结束,查找下一个设备的最后一首
            {
                given_file_method = PLAY_LAST_FILE;
                given_device = DEVICE_AUTO_PREV;
                put_msg_lifo(MSG_MUSIC_SELECT_NEW_DEVICE);
                break;
            }
#endif
	     if(res == GET_DEVICE_END){

	              given_file_method = PLAY_FIRST_FILE;	 	
	     		put_msg_lifo(MSG_MUSIC_STOP);
			break;
	     }

            put_msg_lifo(MSG_MUSIC_PLAY_NEW_FILE);
            break;

        case MSG_MUSIC_PLAY_NEW_FILE:									//按文件序号选择文件进行播放

            flush_all_msg();
            stop_decode();
            cipher_ctl(0);
            res = fs_getfile_bynumber(0, &fat_ptr1, given_file_number);
            disp_port(MENU_FILENUM);

            if (res == 0)
            {
                if (given_file_method == PLAY_BREAK_POINT)
                    res = start_decode();
                else
                    res = start_decode();
            }

            if (res != 0)                                       //播放不成功
            {
                play_status = MAD_STOP_WAIT;
                play_delay_time = 0;
                if (given_file_method <= PLAY_BREAK_POINT) 		//重新找下一首
                {
                    given_file_method = PLAY_NEXT_FILE;
                    break;
                }
                else											//重新找上一首
                {
                    given_file_method = PLAY_PREV_FILE;
                    break;
                }
            }
            main_menu = MENU_MUSIC_MAIN;
            write_file_info();

            break;

        case MSG_DECODE_FILE_END:


            if ((dec_msg->play_time >= 5) || (play_status == MAD_FF) || (play_status == MAD_FR))     //当前歌曲的播放时间大于5S时,直接播放下一首
            {         
                	given_file_method = PLAY_AUTO_NEXT;
                	put_msg_lifo(MSG_MUSIC_SELECT_NEW_FILE);
            }
            else													//当前歌曲播放时间小于5S,有可能是不坏歌曲,等待一段时间
            {
                	play_delay_time = 0;
                	given_file_method = PLAY_AUTO_NEXT;
                	play_status = MAD_STOP_WAIT;
            }

    	     if(play_mode == REPEAT_OFF){
			
		    if(given_file_number ==  fs_msg.fileTotal){
				
	            		flush_all_msg();			
				stop_decode();
	    	   }   
    	     }   
            break;

        case MSG_MUSIC_PREV_FILE:												//选择上一个文件进行播放

            given_file_method = PLAY_PREV_FILE;
            put_msg_lifo(MSG_MUSIC_SELECT_NEW_FILE);
            break;

        case MSG_MUSIC_NEXT_FILE:												//选择下一个文件进行播放

            //delay_10ms(30);
            given_file_method = PLAY_NEXT_FILE;
            put_msg_lifo(MSG_MUSIC_SELECT_NEW_FILE);
            break;
#if defined(DECODE_STOP_MODE_ENABLE	)
	case MSG_MUSIC_STOP:

		if(play_status !=MAD_STOP){
            		flush_all_msg();
			stop_decode();
		}
		break;
#endif		
        case MSG_MUSIC_PP:											//暂停和播放
            if (cur_menu == MENU_INPUT_NUMBER)			            //数字输入模式
            {
                put_msg_lifo(MSG_PICH_SONG);
                break;
            }
			
#if defined(DECODE_STOP_MODE_ENABLE	)			
	    if(play_status ==MAD_STOP){
			
	        	device_check();
				
			if(DSA_SEL_DEV == DEVICE_SDMMC0){
				if((device_online&BIT(0))==0){
					break;
				}	
			}
			else if (DSA_SEL_DEV == DEVICE_UDISK){
				if((device_online&BIT(1))==0){
					break;
				}	
			}
			
                    	given_file_method = PLAY_FIRST_FILE;
                    	put_msg_lifo(MSG_MUSIC_SELECT_NEW_FILE);

			play_status = MAD_PLAY;
			break;
	    }
#endif
            if (play_status == MAD_PLAY)
            {
                disp_port(MENU_PAUSE);
                main_menu = MENU_PAUSE;
                mad_control(MAD_PAUSE, 0);
                play_status = MAD_PAUSE;
 // 		  set_play_flash(LED_FLASH_ON);

            }
            else if (play_status == MAD_PAUSE)
            {
                main_menu = MENU_MUSIC_MAIN;
                disp_port(MENU_MUSIC_MAIN);
                mad_control(MAD_PLAY, 0);
                play_status = MAD_PLAY;
 // 		  set_play_flash(LED_FLASH_NOR);				
            }

            flush_all_msg();
            break;

        case MSG_MUSIC_NEXT_EQ:
            if (play_status == MAD_PAUSE)
                break;
            eq_mode++;
            if (eq_mode > CLASSIC)
            {
                eq_mode = NORMAL;
            }
            set_eq(eq_mode);
            disp_port(MENU_SET_EQ);
            break;

        case MSG_NEXT_PLAYMODE:
            if (play_status == MAD_PAUSE)
                break;
            play_mode++;
            if (play_mode > REPEAT_END)
            {
                play_mode = REPEAT_INIT;
            }
            //disp_port(MENU_SET_PLAY_MODE);
            break;

        case MSG_MUTE:												//静音
            break;

#if (FF_FR_EN == 1)
        case MSG_MUSIC_FR:											//启动快退
            if (find_break_point_file_flag)							//如果是记忆播放的歌曲,不能快退
            {

                break;
            }
            if (play_status == MAD_PLAY)
            {
                play_status = MAD_FR;
            }

            break;

        case MSG_MUSIC_FF:											//启动快进
            if (play_status == MAD_PLAY)
            {
                play_status = MAD_FF;
            }
            break;

		case MSG_KEY_CHANGE:
        case MSG_MUSIC_FFR_DONE:									//快进快退结束,恢复播放
            if (play_status == MAD_FR)
            {
                set_eq(eq_mode);
                flush_all_msg();
#if (FF_FR_MUSIC == 0)

                dac_mute_control(0);
#endif
                play_status = MAD_PLAY;
            }
            else if (play_status == MAD_FF)
            {
                set_eq(eq_mode);
                flush_all_msg();
#if (FF_FR_MUSIC == 0)

                dac_mute_control(0);
#endif
                play_status = MAD_PLAY;
            }

            break;
#endif
        case MSG_PICH_SONG:
            if (cur_menu == MENU_INPUT_NUMBER)			           //数字输入模式
            {
                if ((input_number <= fs_msg.fileTotal) && (input_number != 0))			   //输入数字是否有效
                {
                    given_file_number = input_number;
                    given_file_method = PLAY_FIRST_FILE;
                    given_device = DEVICE_AUTO_NEXT;
                    put_msg_lifo(MSG_MUSIC_PLAY_NEW_FILE);
                }
                else
                    disp_port(main_menu);
            }

            break;

#if (MUSIC_SPECTRUM_EN == 1)
        case MSG_100MS:
            if (cur_menu == MENU_MUSIC_MAIN)
            {
                music_spec_cul(1);
                disp_port(MENU_100MS_REFRESH);
            }
            break;
#endif

        case MSG_200MS:
////////////////////////////////////////////////////////////
//快进快退实际的操作在这里完成
#if (FF_FR_EN == 1)
            if (play_status == MAD_FF)
            {
#if (FF_FR_MUSIC == 0)							//如果需要在快进快退过程中听到声音,可以不加此行
                dac_mute_control(1);
#endif
                mad_control(MAD_FF, FF_FR_STEP);
                mad_control(MAD_FAST_FORWARD, 0);
#if (FF_FR_MUSIC == 1)

                dac_mute_control(0,1);
#endif
                mad_control(MAD_PLAY, 0);
            }
            else if (play_status == MAD_FR)
            {
#if (FF_FR_MUSIC == 0)
                dac_mute_control(1);							//如果需要在快进快退过程中听到声音,可以不加此行
#endif
                mad_control(MAD_FR, FF_FR_STEP);
                mad_control(MAD_FAST_REVERASE, 0);
#if (FF_FR_MUSIC == 1)
                dac_mute_control(0,1);
#endif
                mad_control(MAD_PLAY, 0);
            }
            disp_port(MENU_HALF_SEC_REFRESH);
#endif
#if (DISP_DOT_LCD == 1)
            disp_port(MENU_200MS_REFRESH);								//播放时的滚动显示
#endif
            break;

        case MSG_HALF_SECOND:
/////////////////////////////////////////////////////////////
//短歌曲或损坏的歌曲在这里跳到下一首
            if (play_status == MAD_STOP_WAIT)				//等待一段时间再自动选择下一首
            {
                if (play_delay_time < 4)
                    play_delay_time++;
                else
                {
                    put_msg_lifo(MSG_MUSIC_SELECT_NEW_FILE);
                }
            }

		if(dev_remov_timer>0){

			dev_remov_timer--;
			if(dev_remov_timer==0){
			    	 Set_Curr_Func(SYS_IDLE);
			        put_msg_lifo(MSG_CHANGE_WORK_MODE);      
			}
		}
////////////////////////////////////////////////////////////
//显示界面的切换
            if (main_menu_conter < SUB_MENU_TIME)
            {
                main_menu_conter++;
            }
            else if (cur_menu != main_menu)
            {
                if (cur_menu == MENU_INPUT_NUMBER)			//数字输入模式
                {
                    put_msg_lifo(MSG_PICH_SONG);
                    break;
                }
                else
                {
                    cur_menu = main_menu;
                }
                disp_port(cur_menu);
            }
/////////////////////////////////////////////////////////////
//调整显示亮度
            set_brightness_fade_out();
/////////////////////////////////////////////////////////////
//更新实时界面
            disp_port(MENU_HALF_SEC_REFRESH);
            break;
        case MSG_NEXT_FOLDER:
	     select_folder_file(FIND_NEXT_DIR);		
            break;
        case MSG_PREV_FOLDER:
	     select_folder_file(FIND_PREV_DIR);		
            break;
#if 0//RTC_ENABLE
        case MSG_ALM_ON:
            write_next_alm_sec();
            Set_Curr_Func(SYS_RTC);
            put_msg_lifo(MSG_CHANGE_WORK_MODE);
            break;
#endif
        default :
            ap_handle_hotkey(key);
            break;
        }
    }
}