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

📄 main.txt

📁 mp3量不要让站长把时间都花费在为您修正说明上。压缩包解压时不能有密码。系统会自动删除debug和release目录
💻 TXT
📖 第 1 页 / 共 5 页
字号:
;;;417    				if(FAT_LoadPartCluster(p,part,buffer))
;;;418    				{
;;;419    					#if DEBUG
;;;420    						printf_P(("ERROR: Failed to read one sector\r\n"));
;;;421    					#endif
;;;422    					free(buffer);
;;;423    					return 1;
;;;424    				}
;;;425    				for(j=0;j<512;)	/* second loop for analyze each byte of the sector */
;;;426    				{
;;;427    					if(sector == totalsect && j == leftbytes)	/* see if it is the end of file */
;;;428    					{
;;;429    						part = SectorsPerClust;		/* next loop it will get out */
;;;430    						break;
;;;431    					}
;;;432    					if(buffer[j] == '[')			/* if it is the "[" : the tag start */
;;;433    					{
;;;434    						#if DEBUG
;;;435    							printf_P(("found tag start ["));
;;;436    						#endif
;;;437    /**********************************************************************************************************/                                    
;;;438    						i = 0;
;;;439    						if(strcomp_noncase("TI:",&buffer[j+1]))		/* string compare to check if this is a title tag */
;;;440    						{
;;;441    							j+=4;		/* count add 4 */
;;;442    							while(1)		/* store the title */
;;;443    							{
;;;444    								temp = buffer[j++];
;;;445    								if(temp == 0x0d || temp == 0x0a || temp == ']' || i> (TI_LEN - 2)) /* title ended */
;;;446    									break;
;;;447    								LrcStructHead.title[i++] = temp;
;;;448    							}
;;;449    							LrcStructHead.title[i] = 0;	/* need a 0 to end the string */
;;;450                            
;;;451    							#if DEBUG
;;;452    								printf_P((" found title tag: %s ]\r\n"),LrcStructHead.title);
;;;453    							#else
;;;454    								printf_P(("Title  : %s \r\n"),LrcStructHead.title);
;;;455    							#endif
;;;456                                                
;;;457    						}
;;;458    /**********************************************************************************************************/						
;;;459    						else if(strcomp_noncase("AR:",&buffer[j+1]))	/* string compare to check if this is a artist tag */
;;;460    						{
;;;461    							j+=4;	/* count += 4 */
;;;462    							while(1)	/* store the content */
;;;463    							{
;;;464    								temp = buffer[j++];
;;;465    								if(temp == 0x0d || temp == 0x0a || temp == ']' || i>(AR_LEN - 2))	/* tag ended */
;;;466    									break;
;;;467    								LrcStructHead.artist[i++] = temp;
;;;468    							}
;;;469    							LrcStructHead.artist[i] = 0;		/* need a 0 to end the string */
;;;470                            
;;;471    							#if DEBUG
;;;472       								printf_P((" found artist tag: %s ]\r\n"),LrcStructHead.artist);
;;;473    							#else
;;;474    								printf_P(("Artist : %s \r\n"),LrcStructHead.artist);
;;;475    							#endif
;;;476    	 
;;;477    						}
;;;478    /**********************************************************************************************************/
;;;479    						else if(strcomp_noncase("OFFSET:",&buffer[j+1]))	/* string compare to check if this is a offset tag */
;;;480    						{
;;;481    							j+=8;	/* count += 8 */
;;;482    						
;;;483    							LrcStructHead.offset = 0;	/* default value, in case the tag like this [offset:] */
;;;484     							LrcStructHead.sign = 1;
;;;485    
;;;486    							#if DEBUG
;;;487    								printf_P((" found offset tag: "));
;;;488    							#else
;;;489    								//printf_P(("\r\n"));
;;;490    							#endif
;;;491                                               
;;;492    							while(1)	/* proceed the offset */
;;;493    							{
;;;494    								temp = buffer[j++];
;;;495    
;;;496    								#if DEBUG
;;;497    									uart0_putc(temp);
;;;498    								#endif
;;;499                                                           
;;;500    								if(temp == ']')break;	/* tag end */
;;;501    								if(temp == '-')			/* sign */
;;;502    								{
;;;503    									LrcStructHead.sign = 0;
;;;504    									continue;
;;;505    								}
;;;506    								LrcStructHead.offset *= 10;			/* calculate the value */
;;;507    								LrcStructHead.offset += (temp-0x30);
;;;508    							}
;;;509                                               
;;;510    							#if DEBUG
;;;511    								printf_P(("the value in the structure is : %d\r\n"),LrcStructHead.offset);
;;;512    							#endif
;;;513                                                 
;;;514    						}
;;;515    /**********************************************************************************************************/					
;;;516    						else if(strcomp_noncase("BY:",&buffer[j+1]))	/* string compare to check if this is a By tag */
;;;517    						{											/* but we do not need this tag */
;;;518    							j+=4;
;;;519                                                  
;;;520    							#if DEBUG
;;;521    								printf_P((" found by tag: "));
;;;522    							#endif
;;;523                                                   
;;;524    							while(1)
;;;525    							{
;;;526    								temp = buffer[j++];
;;;527    
;;;528    								#if DEBUG
;;;529    									uart0_putc(temp);
;;;530    								#endif
;;;531                                                           
;;;532    								if(temp == 0x0d || temp == 0x0a || temp == ']' ||i>30)break;
;;;533    							}
;;;534    							#if DEBUG
;;;535    								printf_P("\r\n");
;;;536    							#endif
;;;537    						}
;;;538    /**********************************************************************************************************/									 
;;;539    						else if(strcomp_noncase("AL:",&buffer[j+1]))	/* string compare to check if this is a album tag */
;;;540    						{
;;;541    							j+=4;
;;;542    
;;;543    							#if DEBUG
;;;544    								printf_P((" found al tag: "));
;;;545    							#else
;;;546    								uart0_prints(("Album  : "));
;;;547    							#endif
;;;548    
;;;549    							while(1)
;;;550    							{
;;;551    								temp = buffer[j++];   
;;;552    								if(temp == 0x0d || temp == 0x0a || temp == ']' ||i>30)break;
;;;553    								uart0_putc(temp);
;;;554    							}
;;;555    							printf_P("\r\n");
;;;556    						}
;;;557    /**********************************************************************************************************/									   
;;;558    						else		/* otherwise this must the time tag or other not recognize tag */
;;;559    						{
;;;560    							j+=1;
;;;561    							/****************************************************************/
;;;562    							if(sector == totalsect && j == leftbytes + 1) goto end; /* if the file is end */
;;;563    							if(j == 512)	/* wether the sector is end, need to read the next sector */
;;;564    							{
;;;565    								if(part == (SectorsPerClust - 1))	/* if need to read next cluster */
;;;566    								{
;;;567    									//p=FAT_NextCluster_NEW(p);//读下一簇数据			//read next cluster
;;;568    									p=FAT_NextCluster(p);
;;;569    									if(p == 0x0fffffff || p == 0x0ffffff8 || (FAT32_Enable == 0 && p == 0xffff))//如果无后续簇则结束,	//no more cluster  
;;;570    									{
;;;571    										#if DEBUG
;;;572    											printf_P(("No next cluster or read next cluster error\r\n"));
;;;573    										#endif
;;;574    										goto end;
;;;575    									}
;;;576    									part = 0;	/* clear the part count */
;;;577    									if(FAT_LoadPartCluster(p,part,buffer))
;;;578    									{
;;;579    										#if DEBUG
;;;580    											printf_P(("ERROR: Faild to load a sector\r\n"));
;;;581    										#endif
;;;582    										free(buffer);
;;;583    										return 1;
;;;584    									}
;;;585    								}
;;;586    								else 	/* else just read the next part of the cluster */
;;;587    								{
;;;588    									part ++;	/* part ++ */
;;;589    									if(FAT_LoadPartCluster(p,part,buffer))
;;;590    									{
;;;591    										#if DEBUG
;;;592    											printf_P(("ERROR: Faild to load a sector\r\n"));
;;;593    										#endif
;;;594    										free(buffer);
;;;595    										return 1;
;;;596    									}
;;;597    								}
;;;598    								sector ++;	/* sector count +=1 */
;;;599    								j = 0;		/* loop value clear to 0*/
;;;600    							}
;;;601    							/********************************************************/											  
;;;602    							min = 0;		/* clear the temp variable for time to 0 */
;;;603    							sec = 0;
;;;604    							ms = 0;
;;;605    							i = 0;		/* for tag use, to ditermin tag like [XX:XX] & [XX:XX:XX] */
;;;606    							while(1)
;;;607    							{
;;;608    								temp = buffer[j++];
;;;609    
;;;610    								#if DEBUG
;;;611    									uart0_putc(temp);
;;;612    								#endif
;;;613    														  
;;;614    								/**********************************************************/
;;;615    								if(sector == totalsect && j == leftbytes + 1) goto end;	/* file end */
;;;616    								if(j == 512)		/* need to read next sector */
;;;617    								{
;;;618    									if(part == (SectorsPerClust - 1))	/* if need to read next cluster */
;;;619    									{
;;;620    										//p=FAT_NextCluster_NEW(p);//读下一簇数据			//read next cluster
;;;621    										p=FAT_NextCluster(p);
;;;622    										if(p == 0x0fffffff || p == 0x0ffffff8 || (FAT32_Enable == 0 && p == 0xffff))//如果无后续簇则结束,	//no more cluster  
;;;623    										{
;;;624    											#if DEBUG
;;;625    												printf_P(("No next cluster or read next cluster error\r\n"));
;;;626    											#endif
;;;627    											goto end;
;;;628    										}
;;;629    										part = 0;	/* clear the part count */
;;;630    										if(FAT_LoadPartCluster(p,part,buffer))
;;;631    										{
;;;632    											#if DEBUG
;;;633    												printf_P(("ERROR: Faild to load a sector\r\n"));
;;;634    											#endif
;;;635    											free(buffer);
;;;636    											return 1;
;;;637    										}
;;;638    									}
;;;639    									else 	/* else just read the next part of the cluster */
;;;640    									{
;;;641    										part ++;	/* part ++ */
;;;642    										if(FAT_LoadPartCluster(p,part,buffer))
;;;643    										{
;;;644    											#if DEBUG
;;;645    												printf_P(("ERROR: Faild to load a sector\r\n"));
;;;646    											#endif
;;;647    											free(buffer);
;;;648    											return 1;
;;;649    										}
;;;650    									}
;;;651    									sector ++;	/* sector count +=1 */
;;;652    									j = 0;		/* loop value clear to 0*/
;;;653    								}
;;;654    								/***********************************************/														  
;;;655    								if((temp < '0' || temp > '9') && temp != ':' && temp != '.')break;	/* end or not a leagal ch*/
;;;656    								if(temp == ':'){i=1;continue;}
;;;657    								if(temp == '.'){i=2;mscnt = 0;continue;}
;;;658    
;;;659    								/* calculate the value  */
;;;660    								if(i==0)min = min*10 + (temp-0x30);
;;;661    								else if(i==1)sec = sec*10 + (temp-0x30);
;;;662    								else 
;;;663    								{
;;;664    									if(mscnt == 0)
;;;665    										ms += (temp-0x30)*100;
;;;666    									else if(mscnt == 1)
;;;667    										ms += (temp - 0x30)*10;
;;;668    									else ms += temp-0x30;
;;;669    									mscnt ++;
;;;670    								}							 
;;;671    							}
;;;672    							
;;;673    							if(temp == ']')	/* if tag end */
;;;674    							{
;;;675    							
;;;676    								#if DEBUG
;;;677    									printf_P(("  found time tag: "));
;;;678    									printf_P(("min = %d; "),min);
;;;679    									printf_P(("sec = %d; "),sec);
;;;680    									printf_P(("ms = %d; \r\n"),ms);
;;;681    								#endif
;;;682    													  
;;;683    								if(LrcStruct_p == 0)
;;;684    								{
;;;685    									printf_P(("WARNING: Sorry! no more space for the rest tag, som lryic can't display!\r\n"));
;;;686    									goto end;
;;;687    								}
;;;688    
;;;689    								/* set time value without offset */
;;;690    								LrcStruct_p->time = (uint32)(min*60 + sec)*1000 + ms;
;;;691    													  
;;;692    								#if DEBUG

⌨️ 快捷键说明

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