$ show ralph-irving/squeezelite
Squeezelite is a lightweight, headless Squeezebox emulator that acts as a network audio player for Lyrion Music Server (formerly Logitech Media Server). It receives audio streams via the Slimproto protocol, decodes a wide range of codecs (MP3, FLAC, AAC, Ogg Vorbis, WMA, ALAC, DSD, Opus), and outputs to local audio hardware through ALSA, PortAudio, PulseAudio, or stdout. The application is written in C with a modular, multi-threaded architecture: separate threads for network streaming, decoding, resampling, and output, all communicating via circular buffers with mutex protection. It supports high-resolution audio, DSD (DoP and native), resampling with libsoxr, visualizer export to shared memory, IR remote control, and GPIO amplifier control. The codebase is highly portable, with dedicated Makefiles for Linux, macOS, Windows, Solaris, and various ARM architectures, as well as Visual Studio project files. Build-time options (LINKALL, DSD, RESAMPLE, etc.) allow static or dynamic linking of codec libraries. The project is actively maintained with a responsive community and is widely used in embedded audio players and home automation systems.
The LLM identified 4 files worth highlighting for reuse:
Implements a generic, thread-safe circular buffer used for streaming and output buffering. Functions like _buf_used(), _buf_space(), and _buf_unwrap() are well-written and independent of the rest of the codebase. This module can be extracted and reused in any C project that requires a FIFO queue with producer/consumer synchronization.
Contains highly optimized C routines for converting between audio sample formats (S16_LE, S24_3LE, S32_LE, float) and applying gain. The loops are hand-tuned for performance (e.g., unrolled and using SSE-like intrinsics where available). This is a standalone pattern for audio format packing/unpacking that can be reused in any digital audio processing project.
Provides a cross-platform mechanism for dynamically loading OpenSSL symbols at runtime using dlopen/dlsym. It handles multiple soname versions and initializes SSL. This pattern is reusable in any application that wants to make SSL support optional or allow runtime library selection.
Implements conversion from Direct Stream Digital (DSD) audio to PCM using Sebastian Gesemann's algorithm. The code is self-contained with a simple API for initializing and converting DSD frames. It can be extracted and used independently in any audio processing pipeline that needs DSD-to-PCM conversion.