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

📄 mp3_display.c

📁 智原mp3 SDK 开发包 与巨力 有mp3 wma ogg decoder
💻 C
字号:
/************************
 *   mp3_display.c
 ************************/

#include <string.h>
#include "api.h"
#include "lcd1.h"
#include "common.h"
#include "display.h"
#include "file_brower.h"
#include "mp3_main.h"
#include "lrc_parse.h"
#include "mp3_display.h"
#include "mp3_utile.h"
#include "res.h"
#include "res_show.h"
#include "ap_common.h"
#include "ui_main1.h"
#include "prefer.h"
#include "ui_scroll.h"
#include "ui_slider.h"
#include "global_user.h"

#define PROGRESS_Y  24
#define PROGRESS_X  4
#define FILE_NAME_X 2
#define FILE_NAME_Y 95

INT8U _bufID[10];
static UINT32 last_time = 0;

//INT16U code loop_id[3] ={MLOOP1,MLOOP2,MLOOP5};

extern void song_timeon(SONGTIME type);

extern MUSIC_INFORMATION curr_music;

void dispBmpDigit(INT16U BmpID,INT32U VALUE,INT8U digits,INT8U X,INT8U Y,INT8U digOffset)
{
	INT8U _buf_ = 0;
	INT8U dispColon = 0;
	INT8U ColonPos = 0;

	if(digits>=5)
		dispColon = 1;

	ColonPos = digits/2;
	while(digits--)
	{

	 	if((digits==ColonPos)&&(dispColon==1))
		{	
			if(ColonPos == 2)
	 			_buf_ =0x0A;
				else
				 	_buf_ =0x0B;

			}
		else{
	 		_buf_ = VALUE%10;
	 		VALUE = VALUE/10;		
		}

	 bResShowPic(BmpID+_buf_, X+digits*digOffset ,Y); 
	
	}

}


void vShowBitrate()
{
    	
	if(curr_music.eMusicType == MUSIC_TYPE_MP3)  //mp3
    	{
        	ui_show_a(MMP3);
    	}    	
    	else	
    	{
        	ui_show_a(TYPEWMA);
    	}
    	
    	bResShowPic(KBPS, 75 , 10); 
	   	
	    dispBmpDigit(MBIT0,curr_music.u16BitRate,3,POS_BITRATE,POSY_BITRATE,5);
}

void vShowLoop()
{

  bResShowPic(tUserPreference.u8RepeatMode+MLOOP1, POSITION_B, POSITIONY_B);

}

void vShowEq()
{
   ui_show_c(tUserPreference.u8EqMode+MEQICON1);
}

void vShowRepeat()
{
	if(api_eGetRepeatMode() == REPEAT_MODE_SETA_OK)
		ui_show_a(MRPLNOA);
	else if(api_eGetRepeatMode() == REPEAT_MODE_SETAB_OK)
		ui_show_a(MRPLNOB);
	else  
		vShowBitrate();		

}

void vShowSequence()
{
	dispBmpDigit(MNUM0,
	curr_music.u16Order*1000+totfile
	,7,3,115,5);

}
INT32U algorismToSexagesimal(INT32U VALUE)
{
	INT32U temp = 0;
	INT8U temp1 = 0;
	 temp1 =VALUE/60;
	 temp = temp1*100;
	 temp1 = VALUE%60;
	 return temp+temp1;
}

void vShowTotalTime()
{
//	song_timeon(TIME_TOTAL);
//	ui_show_d(_buf, 1); 
        //ui_show_data(string,8, 124,MNUM0,5);	   

	dispBmpDigit(MNUM0,
	algorismToSexagesimal(curr_music.u32Length)
	,5,8,124,5);
}

void vShowCurrentTime()
{
	INT8U data sec,min;

	//sec = api_u32GetPlayingTime()/60;
	//min = api_u32GetPlayingTime()%60;
	//song_timeon(TIME_PLAY);
	//ui_show_d(_buf, 0); 	
  //ui_show_data(string,40, 114,PRGNUM0,11);

	dispBmpDigit(PRGNUM0,
	algorismToSexagesimal(api_u32GetPlayingTime())
	,5,40,114,11);

}

void ui_draw(void)
{
	//shoud show background now
	bResShowPic(BACKDROP,0,0);
	if(!api_bGetCurrMusicInfo(&curr_music))
		return;	
	//show music type.
	//vShowMusicType();
	vShowBitrate();
	//show speaker 
	//ui_show_spk(1);	
	//show eq type.
	vShowEq();
	//show loop type
	vShowLoop();
	//show music order
	vShowSequence();
	//show file name.
	//gfx_songname();
	vLcd_SongName();
	//show total time.
	vShowTotalTime();
	//show current time
	vShowCurrentTime();
	
	//play_time_update(0);
	last_time = 0;
	bResShowPic(SCHEDU00, 16 , 5);
	
	bResShowPic(RPLAY3,2,51);
	//show progress
	//gfx_progress(1);
	//show volume.
	ui_show_vol();
	//show battary
	ui_show_batt();
	
	//show media type
	bg_color = 0x1d1f;
	fg_color = COLOR_WHITE;
	if(my_disk==0)  //sd
	{
		lcd_puts(56, 17, "SD",0, FONTSIZE_HYPER,0);
	}
	else      //nand
	{
		lcd_puts(48, 17, "NAND",0, FONTSIZE_HYPER,0);
	}
	if(lyric_on)
	{
		bResShowPic(LYYES, 94 , 0);	
	}
	else
	{
		bResShowPic(LYNO, 94 , 0);
	}
	bResShowPic(STOP_PIC, 0 , 2);
	
}


void play_time_update(UINT8 para)
{

	INT32U data time;
	
//	time = api_u32GetPlayingTime();
	if(last_time != api_u32GetPlayingTime()){
		vShowCurrentTime();
		//if(curr_screen->id == SCREEN_MP3) {
         		bResShowPic(SCHEDU00+ (38 * last_time / curr_music.u32Length)%38, 16 , 5);
			last_time = api_u32GetPlayingTime();
	//	}
	}
}

⌨️ 快捷键说明

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