歌词解析: 整理文件夹, 更新优化 Makefile

This commit is contained in:
2023-07-22 15:40:53 +08:00
parent d69cf117d5
commit a9ce625d3a
19 changed files with 41 additions and 21 deletions
-19
View File
@@ -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)
Executable → Regular
View File
View File
+8
View File
@@ -5,6 +5,14 @@
#include <stdlib.h>
#include <string.h>
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); // 获取歌词文件大小
View File
+2 -2
View File
@@ -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)
View File
Executable → Regular
View File