$ show clangen/musikcube
musikcube is a cross-platform, terminal-based music player and streaming server written in C++. It consists of a core library (`musikcore`) with a plugin-based architecture for decoders, encoders, audio outputs, DSP, and data streams. The project includes three distinct front-ends: a terminal UI (`musikcube`) built on a custom curses++ framework, a native Windows UI (`musikwin`) using a custom Win32 wrapper, and an Android remote client (`musikdroid`) written in Kotlin. The server plugin enables remote control and audio streaming via WebSocket and HTTP. The core manages a SQLite-backed music library with indexing, metadata extraction (via TagLib), and playlist management. Audio playback supports gapless and crossfade transitions, visualizers, and an equalizer. The system is designed for extensibility through a well-defined SDK interface set, allowing third-party plugins for decoders, outputs, and DSP. The codebase is mature (copyright 2004-2023) and shows signs of organic growth, with heavy vendored third-party dependencies and platform-specific code. While not architecturally pristine, it demonstrates solid engineering, a clean plugin API, and reusable UI frameworks.
The LLM identified 5 files worth highlighting for reuse:
A self-contained terminal UI framework built on PDCurses/ncurses. Provides windows, layouts, overlays, scrollable lists, text input, dialog boxes, color themes, and event handling. Designed with clear interfaces (IWindow, ILayout, IKeyHandler, IMouseHandler) and a message queue for async operations. This framework is fully extractable and reusable in any terminal application requiring a structured UI, demonstrating careful abstraction over raw curses.
A complete object-oriented wrapper around the Win32 API, providing controls (Button, CheckBox, ComboBox, EditView, ListView, ProgressBar, Trackbar, TabView, etc.), layout management (LinearLayout, Splitter), and application lifecycle (Application, TopLevelWindow, Timer). It includes a theme system, memory DC for flicker-free drawing, and tray icon support. This library is self-contained (with its own solution and project files) and can be extracted for any Windows GUI project, showcasing non-obvious Win32 API usage patterns.
A collection of pure-virtual C++ interfaces defining the plugin SDK (IDecoderFactory, IEncoderFactory, IOutput, IDataStream, IDSP, IVisualizer, ITagReader, ITrack, etc.). Each interface uses a consistent lifecycle (Release(), Name(), Version(), Author(), Guid()) and includes helper types (DataBuffer, IMap, IValue). The SDK is designed to be ABI-stable via version constants and is the foundation for all plugins. This pattern is a textbook example of a decoupled plugin system, reusable for any application needing extensibility.
Defines the QueryBase class template, which standardizes the lifecycle of database queries: run, serialize, deserialize, and result handling. Derived queries (e.g., AlbumListQuery, SearchTrackListQuery) implement OnRun() with SQL logic and provide static methods for serialization/deserialization (using nlohmann/json). This pattern enables asynchronous execution via a message queue and remote execution over WebSocket. It is a clean, reusable abstraction for command-query separation in a C++ application with a remote client.
A thread-safe LRU (Least Recently Used) disk cache implementation with configurable maximum size. It provides get/put/remove operations, eviction of least recently used entries, and periodic cleanup using a background thread. The cache is used by the HTTP data stream plugin to cache audio data for efficient streaming. It is self-contained, parameterized, and could be reused in any application needing a filesystem-backed cache with LRU eviction.