diff --git a/lyric_analysis/Makefile b/lyric_analysis/Makefile new file mode 100644 index 0000000..b0fe016 --- /dev/null +++ b/lyric_analysis/Makefile @@ -0,0 +1,31 @@ +# 定义路径变量 +SRC_DIR = srcs +OBJ_DIR = objs +BIN_DIR = ./ + +# 定义编译器 +CC = gcc +# 定义目标文件 +TARGET = $(BIN_DIR)/debug +# 定义源文件 +SRCS = $(wildcard $(SRC_DIR)/*.c) +# OBJS = $(OBJ_DIR)/lrc.o $(OBJ_DIR)/console.o $(OBJ_DIR)/start_mplayer.o $(OBJ_DIR)/time_delay.o $(OBJ_DIR)/main.o +OBJS = $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(SRCS)) + +# 编译规则 +$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c + $(CC) -c $< -o $@ + +# 链接规则 +$(TARGET): $(OBJS) + $(CC) $^ -o $@ + +# 默认构建目标 +all: $(TARGET) + +# 清理规则 +clean: + rm -rf $(OBJ_DIR)/*.o $(TARGET) + +# 伪目标 +.PHONY: all clean \ No newline at end of file diff --git a/lyric_analysis/bin/main b/lyric_analysis/bin/main deleted file mode 100755 index 97384a4..0000000 Binary files a/lyric_analysis/bin/main and /dev/null differ diff --git a/lyric_analysis/lrc/简单爱copy.lrc b/lyric_analysis/lrc/简单爱copy.lrc deleted file mode 100644 index a2d9b82..0000000 Binary files a/lyric_analysis/lrc/简单爱copy.lrc and /dev/null differ diff --git a/lyric_analysis/lrc/简单爱.lrc b/lyric_analysis/lrcs/简单爱.lrc old mode 100755 new mode 100644 similarity index 100% rename from lyric_analysis/lrc/简单爱.lrc rename to lyric_analysis/lrcs/简单爱.lrc diff --git a/lyric_analysis/lrc/简单爱.lrc.bak b/lyric_analysis/lrcs/简单爱.lrc.bak old mode 100755 new mode 100644 similarity index 100% rename from lyric_analysis/lrc/简单爱.lrc.bak rename to lyric_analysis/lrcs/简单爱.lrc.bak diff --git a/lyric_analysis/objs/console.o b/lyric_analysis/objs/console.o deleted file mode 100644 index f62fa4a..0000000 Binary files a/lyric_analysis/objs/console.o and /dev/null differ diff --git a/lyric_analysis/objs/lrc.o b/lyric_analysis/objs/lrc.o deleted file mode 100644 index fe8db8a..0000000 Binary files a/lyric_analysis/objs/lrc.o and /dev/null differ diff --git a/lyric_analysis/objs/main.o b/lyric_analysis/objs/main.o deleted file mode 100644 index 31b4d84..0000000 Binary files a/lyric_analysis/objs/main.o and /dev/null differ diff --git a/lyric_analysis/objs/start_mplayer.o b/lyric_analysis/objs/start_mplayer.o deleted file mode 100644 index 29b4460..0000000 Binary files a/lyric_analysis/objs/start_mplayer.o and /dev/null differ diff --git a/lyric_analysis/objs/time_delay.o b/lyric_analysis/objs/time_delay.o deleted file mode 100644 index 8abeeed..0000000 Binary files a/lyric_analysis/objs/time_delay.o and /dev/null differ diff --git a/lyric_analysis/songs/简单爱.mp3 b/lyric_analysis/songs/简单爱.mp3 old mode 100755 new mode 100644 diff --git a/lyric_analysis/srcs/Makefile b/lyric_analysis/srcs/Makefile deleted file mode 100644 index aaab389..0000000 --- a/lyric_analysis/srcs/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# SRC_DIR := ./srcs -OBJ_DIR := ../objs -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)/time_delay.o $(OBJ_DIR)/main.o - -# $(OBJ_DIR)/%.o: %.c -# $(CC) -c $< -o $@ - -$(OBJ_DIR)/%.o: %.c - $(CC) -c $< -o $@ - -$(TARGET): $(OBJ) - $(CC) $^ -o $@ - -clean: - rm -rf $(OBJ_DIR)/*.o $(TARGET) \ No newline at end of file diff --git a/lyric_analysis/srcs/console.c b/lyric_analysis/srcs/console.c old mode 100755 new mode 100644 diff --git a/lyric_analysis/srcs/includes/console.h b/lyric_analysis/srcs/includes/console.h old mode 100755 new mode 100644 diff --git a/lyric_analysis/srcs/includes/lrc.h b/lyric_analysis/srcs/includes/lrc.h index 430e488..f5a6439 100644 --- a/lyric_analysis/srcs/includes/lrc.h +++ b/lyric_analysis/srcs/includes/lrc.h @@ -5,6 +5,14 @@ #include #include +typedef struct lrc +{ + int time; // 歌词时间点 + char lrc_buf[200]; // 歌词内容 + int lrc_cur_num; // 当前歌词行数, 用于标记当前歌词(第几句歌词 从1开始) + struct lrc *next; // 指向下一行歌词(指向链表下一个节点) +} LRC; + FILE *open_lrc_file(const char *lrc_path); // 打开歌词文件 long get_lrc_size(FILE *fp); // 获取歌词文件大小 diff --git a/lyric_analysis/srcs/includes/start_mplayer.h b/lyric_analysis/srcs/includes/start_mplayer.h old mode 100755 new mode 100644 diff --git a/lyric_analysis/srcs/main.c b/lyric_analysis/srcs/main.c index 490569a..6436d18 100644 --- a/lyric_analysis/srcs/main.c +++ b/lyric_analysis/srcs/main.c @@ -6,8 +6,8 @@ int main() { // 定义歌曲和歌词文件路径 - const char *song_path = "../songs/简单爱.mp3"; - const char *lrc_path = "../lrc/简单爱.lrc"; + const char *song_path = "./songs/简单爱.mp3"; + const char *lrc_path = "./lrcs/简单爱.lrc"; FILE *fp = open_lrc_file(lrc_path); // 打开歌词文件 if (NULL == fp) diff --git a/lyric_analysis/srcs/start_mplayer.c b/lyric_analysis/srcs/start_mplayer.c old mode 100755 new mode 100644 diff --git a/lyric_analysis/srcs/time_delay.c b/lyric_analysis/srcs/time_delay.c old mode 100755 new mode 100644