歌词解析: 解析到每一行的歌词,添加延时函数

This commit is contained in:
flykhan 2023-07-22 15:15:41 +08:00
parent e73b06afa5
commit d69cf117d5
9 changed files with 75 additions and 19 deletions

Binary file not shown.

View File

@ -0,0 +1,30 @@
[ti:简单爱]
[ar:周杰伦]
[al:范特西]
[by:大脸猫]
[00:04.41]周杰伦 Chow, Jay Jou
[00:10.56]简单爱(台视Star blue蓝星主题曲)
[00:18.48]词:徐若瑄 曲:周杰伦
[00:26.44]说不上为什么 我变得很主动
[00:31.37]若爱上一个人 什么都会值得去做
[02:04.94][00:36.09]我想大声宣布 对你依依不舍
[02:09.97][00:41.26]连隔壁邻居都猜到我现在的感受
[02:14.94][00:46.17]河边的风 在吹着头发 飘动
[02:19.80][00:51.25]牵着你的手 一阵莫名感动
[02:24.61][00:55.86]我想带你 回我的外婆家
[02:28.32][00:59.79]一起看着日落 一直到我们都睡着
[03:34.64][02:34.71][01:05.83]我想就这样牵着你的手不放开
[03:39.68][02:39.34][01:10.71]爱能不能够永远单纯没有悲哀
[03:44.27][02:43.90][01:15.44]我想 带你骑单车
[03:46.74][02:46.60][01:18.05]我想 和你看棒球
[03:49.77][02:49.58][01:20.71]想这样没担忧
[03:51.61][02:51.59][01:22.69]唱着歌 一直走☆
[03:54.38][02:54.35][01:25.57]我想就这样牵着你的手不放开
[03:59.19][02:59.01][01:30.41]爱可不可以简简单单没有伤害
[04:03.77][03:03.73][01:35.04]你 靠着我的肩膀
[04:06.33][03:06.26][01:37.49]你 在我胸口睡着
[04:09.13][03:09.34][01:40.57]像这样的生活
[04:11.36][03:11.26][01:42.66]我爱你 你爱我★
[03:13.76][01:44.97]想~~~ 简!简!单!单! 爱~~~
[03:23.61][01:54.30]想~~~ 简!简!单!单! 爱~~~

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,7 @@ BIN_DIR := ../bin
CC = gcc
TARGET = $(BIN_DIR)/main
# SRC = $(SRC_DIR)/lrc.c $(SRC_DIR)/console.c $(SRC_DIR)/start_mplayer.c $(SRC_DIR)/main.c
OBJ = $(OBJ_DIR)/lrc.o $(OBJ_DIR)/console.o $(OBJ_DIR)/start_mplayer.o $(OBJ_DIR)/main.o
OBJ = $(OBJ_DIR)/lrc.o $(OBJ_DIR)/console.o $(OBJ_DIR)/start_mplayer.o $(OBJ_DIR)/time_delay.o $(OBJ_DIR)/main.o
# $(OBJ_DIR)/%.o: %.c
# $(CC) -c $< -o $@

View File

@ -0,0 +1,7 @@
#ifndef __TIME_DELAY_H__
#define __TIME_DELAY_H__
// 自封装延时函数
void time_delay(int sec);
#endif

View File

@ -1,6 +1,7 @@
#include "./includes/lrc.h"
#include "./includes/console.h"
#include "./includes/start_mplayer.h"
#include "includes/time_delay.h"
int main()
{
@ -27,5 +28,26 @@ int main()
return -1; // 为歌词数据分配内存失败,退出程序
}
// 读入歌词内容
fread(lrc_mem_data, lrc_size, 1, fp); // 读入歌词数据
// printf("%s", lrc_mem_data);
// FILE *fwx = fopen("../lrc/简单爱copy.lrc", "w");
// fwrite(lrc_mem_data, lrc_size, 1, fwx);
// 逐行解析歌词
char *line = strtok(lrc_mem_data, "\r\n"); // 逐行解析歌词
int i = 1;
while (line != NULL)
{
time_delay(2);
printf("%d.\t%s\n", i++, line);
line = strtok(NULL, "\r\n");
}
// FILE *fwx = fopen("../lrc/简单爱copy.lrc", "wb");
// fwrite(lrc_mem_data, lrc_size, 1, fwx);
// 释放内存,关闭文件
free(lrc_mem_data); // 释放歌词数据内存
fclose(fp); // 关闭歌词文件
return 0;
}

View File

@ -1,26 +1,23 @@
#include <stdio.h>
#include <time.h>
#include "includes/time_delay.h"
void time_delay(int sec)
{
int s_time,e_time;
s_time=time(NULL);
while(1)
int s_time, e_time;
s_time = time(NULL);
while (1)
{
e_time=time(NULL);
if(e_time==s_time+sec)
e_time = time(NULL);
if (e_time == s_time + sec)
break;
}
}
int main(int argc, char *argv[])
{
while(1)
{
printf("hello world\n");
time_delay(3);
}
return 0;
}
// int main(int argc, char *argv[])
// {
// while(1)
// {
// printf("hello world\n");
// time_delay(3);
// }
// return 0;
// }