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

📄 mp3player.c

📁 基于AT89C51SND1C的MP3源代码
💻 C
字号:
#define FUNC_PLAY_MODE			0
#define FUNC_SELECT				1
#define FUNC_VOL_BOTH			2
#define FUNC_VOL_LEFT			3
#define FUNC_VOL_RIGHT			4
#define FUNC_BASS				5
#define FUNC_MEDIUM				6
#define FUNC_TREBLE				7
#define FUNC_BASS_BO0ST			8

#define MAX_MENU				9

code CHAR MP3FileNameExt[]={"MP3"};
code CHAR MenuList[][15]=
	{
		"播放方式:",
		"选曲:",
		"音量调整 (双):",
		"音量调整 (左):",
		"音量调整 (右):",
		"低音:",
		"中音:",
		"高音:",
		"超低音:",
	};
code CHAR PlayMode[][5]={"顺序","随机","预览"};
code CHAR Title[]={"  我的MP3播放机"};
code CHAR SizeUnit[][3]={"KB","MB","GB"};

struct PlayControlStr
{
	WORD	CurrentPoint;
}Play;


void ShowDiskSize(void);
void FunctionProcess(BYTE mode,bit operate);

void ShowDiskSize(void)
{
	data DWORD size;
	data BYTE m;
	xdata CHAR temp[5];

	LCDClearLine(0);
	LCDClearLine(1);
	LCDPrint(0x00,"硬盘大小:");
	//总大小
	size=IDEDevice[0].TotalSectors;
	if (size>9999) {size/=1024;m=0;}
	size*=512;
	if (size>9999) {size/=1024;m=1;}
	if (size>9999) {size/=1024;m=2;}
	WORD2CHAR(size,temp,4);
	LCDPrint(0x05,temp);
	LCDPrint(0x07,SizeUnit[m]);
	//剩余空间
	size=FAT32DiskFreeSize();
	if (size>9999) {size/=1024;m=0;}
	if (size>9999) {size/=1024;m=1;}
	if (size>9999) {size/=1024;m=2;}
	WORD2CHAR(size,temp,4);
	LCDPrint(0x11,temp);
	LCDPrint(0x13,SizeUnit[m]);
	LCDPrint(0x14,"/");
	//分区大小
	size=FAT32DiskSize();
	if (size>9999) {size/=1024;m=0;}
	if (size>9999) {size/=1024;m=1;}
	if (size>9999) {size/=1024;m=2;}
	WORD2CHAR(size,temp,4);
	printf("%s",temp);
	LCDPrint(0x15,temp);
	LCDPrint(0x17,SizeUnit[m]);

}

void FunctionProcess(BYTE mode,bit operate)
{
	data BYTE status;
	data WORD old;
	switch (mode)
	{
		case FUNC_SELECT		:
			if (MP3.Playing)	break;
			LCDClearLine(1);
			old=Play.CurrentPoint;
			if (operate)
			{
				Play.CurrentPoint++;
				while((status=FAT32GetDirName(Play.CurrentPoint))==3) Play.CurrentPoint++;
				if (status==0) Play.CurrentPoint=old;
			}
			else
			{
				Play.CurrentPoint--;
				if (Play.CurrentPoint==0) Play.CurrentPoint=old;
			}
			status=FAT32GetDirName(Play.CurrentPoint);
			if (status==1)
			{
				printf("%d FILE->",Play.CurrentPoint);
				LCDPrint(0x10,"--");
			}
			else if (status==2)
			{
		 		printf("DIR->");
				LCDPrint(0x10,"->");
			}
			printf("%s\n",LongFileName);
			LCDPrint(0x11,LongFileName);
			break;
		case FUNC_PLAY_MODE		:
			break;
		case FUNC_VOL_BOTH		:
			MP3DecoderControl(MP3_VOLUME_BOTH,operate);
			break;
		case FUNC_VOL_LEFT		:
			MP3DecoderControl(MP3_VOLUME_LEFT,operate);
			break;
		case FUNC_VOL_RIGHT		:
			MP3DecoderControl(MP3_VOLUME_RIGHT,operate);
			break;
		case FUNC_BASS			:
			MP3DecoderControl(MP3_BASS,operate);
			break;
		case FUNC_MEDIUM		:
			MP3DecoderControl(MP3_MEDIUM,operate);
			break;
		case FUNC_TREBLE		:
			MP3DecoderControl(MP3_TREBLE,operate);
			break;
		case FUNC_BASS_BO0ST	:
			MP3DecoderControl(MP3_BASS_BOOST,operate);
			break;
	}

}


⌨️ 快捷键说明

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