$ show nu774/qaac
qaac is a command-line audio encoder that uses Apple's CoreAudioToolbox (or the reference ALAC encoder) to encode audio to AAC or ALAC formats. It supports a wide range of input formats (WAV, FLAC, WavPack, Opus, Ogg Vorbis, CAF, and more) via runtime-loaded codec libraries, and outputs to MP4/M4A, ADTS, CAF, WAV, or raw PCM. The architecture follows a clean pipeline pattern: input sources implement the ISource interface, pass through optional DSP filters (resampler, normalizer, limiter, compressor, matrix mixer, etc.), and are written to output sinks. Metadata handling is integrated via vendored taglib, and the encoder supports gapless encoding, chapter markers, artwork, and various tagging formats. The codebase is predominantly C++ with platform-specific adaptations for Windows and macOS, and includes several reusable utility components such as a streaming FFT convolver, ring buffer, and cross-platform dynamic library loader.
The LLM identified 4 files worth highlighting for reuse:
Implements overlap-save FFT convolution using Ooura's fft4g. Reusable as a generic FIR filter for real-time audio processing. Encapsulates FFT state, ring buffer, and partitioning logic. Extracting it requires minimal changes (replace fft4g if needed).
Provides a templated FIFO (ring buffer) class 'util::FIFO' with push/pop/resize operations. Used in multiple decoders and filters. Self-contained and easily extractable for any producer-consumer streaming scenario.
Parses standard CUE sheet files into structured track/index/duration data. No external dependencies beyond standard library. Can be reused in any application that needs cue sheet parsing, with minimal adaptation.
Cross-platform wrapper for dynamic library loading (dlopen on Unix, LoadLibrary on Windows). Provides RAII-style handle management and symbol lookup. Reusable in any C++ project that needs to load plugins or optional codecs.