feat: make everything threads-safe.

feat: complete `uninstall.sh` logic to make everything synced.
	feat: complete basic play logic to handle background, music,
	lyric play.
This commit is contained in:
2026-08-30 15:13:28 +08:00
parent 00b7c0b324
commit 7edba3fbc0
10 changed files with 355 additions and 65 deletions
+10 -2
View File
@@ -14,6 +14,8 @@
#include <string>
#include <vector>
#include "timeline.h"
namespace lr {
struct LyricLine {
@@ -38,17 +40,23 @@ LyricInfo parseLrcFile(const std::string& path);
struct LyricDisplayOptions {
int row = 0; // 1-based terminal row; 0 = auto (last terminal row)
int col = 0; // 1-based start column; 0 = column 1
int maxWidth = 0; // max display columns; 0 = terminal width - 1
bool show = true; // false => run the timeline silently (no terminal writes)
};
// Play the lyrics on a timeline starting at t = 0. Blocks until every line has
// been shown (or `stop` is set). Returns 0.
// Play the lyrics against `timeline` (may be null for a local clock): the
// current lyric line is displayed in real time as the timeline advances.
// Blocks until the timeline passes the last line (or `stop` is set).
// Returns 0.
int playLyrics(const LyricInfo& lyric,
const LyricDisplayOptions& opts = {},
Timeline* timeline = nullptr,
std::atomic<bool>* stop = nullptr);
int playLyricsFile(const std::string& path,
const LyricDisplayOptions& opts = {},
Timeline* timeline = nullptr,
std::atomic<bool>* stop = nullptr);
} // namespace lr