diff --git a/lyric_analysis/bin/main b/lyric_analysis/bin/main index d3cc908..97384a4 100755 Binary files a/lyric_analysis/bin/main and b/lyric_analysis/bin/main differ diff --git a/lyric_analysis/lrc/简单爱.lrc.bak b/lyric_analysis/lrc/简单爱.lrc.bak new file mode 100755 index 0000000..a05be43 --- /dev/null +++ b/lyric_analysis/lrc/简单爱.lrc.bak @@ -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]想~~~ 简!简!单!单! 爱~~~ + diff --git a/lyric_analysis/lrc/简单爱copy.lrc b/lyric_analysis/lrc/简单爱copy.lrc new file mode 100644 index 0000000..a2d9b82 Binary files /dev/null and b/lyric_analysis/lrc/简单爱copy.lrc differ diff --git a/lyric_analysis/objs/main.o b/lyric_analysis/objs/main.o index 92a2ceb..31b4d84 100644 Binary files a/lyric_analysis/objs/main.o and b/lyric_analysis/objs/main.o differ diff --git a/lyric_analysis/objs/time_delay.o b/lyric_analysis/objs/time_delay.o new file mode 100644 index 0000000..8abeeed Binary files /dev/null and b/lyric_analysis/objs/time_delay.o differ diff --git a/lyric_analysis/srcs/Makefile b/lyric_analysis/srcs/Makefile index df3ff8e..aaab389 100644 --- a/lyric_analysis/srcs/Makefile +++ b/lyric_analysis/srcs/Makefile @@ -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 $@ diff --git a/lyric_analysis/srcs/includes/time_delay.h b/lyric_analysis/srcs/includes/time_delay.h new file mode 100644 index 0000000..726e006 --- /dev/null +++ b/lyric_analysis/srcs/includes/time_delay.h @@ -0,0 +1,7 @@ +#ifndef __TIME_DELAY_H__ +#define __TIME_DELAY_H__ + +// 自封装延时函数 +void time_delay(int sec); + +#endif \ No newline at end of file diff --git a/lyric_analysis/srcs/main.c b/lyric_analysis/srcs/main.c index 5d0081c..490569a 100644 --- a/lyric_analysis/srcs/main.c +++ b/lyric_analysis/srcs/main.c @@ -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; } \ No newline at end of file diff --git a/lyric_analysis/srcs/time_delay.c b/lyric_analysis/srcs/time_delay.c index 443b9d0..d6039f3 100755 --- a/lyric_analysis/srcs/time_delay.c +++ b/lyric_analysis/srcs/time_delay.c @@ -1,26 +1,23 @@ #include #include +#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; +// }