Version 5.0 Major Release.

New Features:
Multi-Channel and High-Resolution Audio Support
48,000 frames per second ("48k") operation.
48k lossless stereo support.
5.1 and 7.1 surround sound support.
Multi-channel and multi-rate operation on ALSA, PipeWire, PulseAudio, FreeBSD, stdout and Unix pipe output backends.
Automatic Audio Format Selection
Flexible and controllable output format selection.
Automatic rate, sample format, and channel count selection.
Full FFmpeg Integration
Support for transcoding.
Advanced resampling capabilities.
New audio format support.
Enhanced Resampling
New vernier resampling and interpolation method optimized for low-power CPUs.
Better performance on resource-constrained devices.

Convolution and Loudness Enhancements:
Convolution system is now multithreaded and works on stereo and multichannel audio at 48k and 44.1k.
Multiple impulse response (IR) files can now be provided via convolution_ir_files setting.
New convolution_thread_pool_size setting for multithreaded processing (defaults to 1).
Loudness processing now works with stereo and multichannel audio at 48k and 44.1k.
Updated to the most recent HiFi-LoFi FFT convolver.

MQTT Enhancements:
Added new publish_retain boolean option. When enabled, published MQTT messages have the retain flag set, so the MQTT broker stores the last message per topic and new subscribers receive the most recent value immediately. Thanks to lululombard for PR #2142.

D-Bus Enhancements:
Added new dbus_default_message_bus command-line argument (can be system or session) to set the default message bus for both D-Bus native service and MPRIS service.

Performance Improvements:
Enhanced compatibility with AirPlay 2 AutoMix and Smart Tracklists resulting in less unexplained track skipping.
Better operation on low-power devices down to Raspberry Pi B.
Improved efficiency on embedded systems.
Enhanced timestamp handling for better synchronization.
Improved sync error calculation.
Rebuilt buffered audio processor for cleaner handling of immediate and deferred flush requests.

Docker Enhancements:
Reduced Docker image sizes with slimmed-down FFmpeg library.
Removed dhclient from Docker images for smaller footprint.

Bug Fixes:
Fixed MQTT warning on service startup: "Could not establish a mqtt connection". The startup script now correctly states that the mosquitto service is required. Thanks to Hugo Villeneuve for PR #2137.
Fixed compatibility with mbedtls library version 3.4+ (present on recent Linux versions). Thanks to Christian Beier for finding and fixing the bug.
Fixed PulseAudio backend so that PA_ERR_NODATA returns "No latency data yet". Thanks to Vladimir Shakov for the report and fix.
Ensured old flush requests are deleted when a new play session starts. Thanks to saujanyashah for the report.
Fixed format warnings on 64-bit and 32-bit systems
Removed compilation warnings on 32-bit builds
Improved argument checking for debug(), inform(), warn() and die() functions
Fixed "daemon" typos throughout codebase. Thanks to Chris Boot for PR #1981.
Added warning if a convolution impulse response file cannot be read due to bad path or permissions

Build System Improvements:
Unified service file with variable substitution for Avahi support, making it easier to add future service dependencies. Thanks to Hugo Villeneuve.
Network interface selection now only considers interfaces that are up, running and not loopback interfaces. Thanks to Carl Johnson for the suggestion.
Configuration File Changes and Deprecations

New settings: convolution_ir_files (replaces convolution_ir_file), convolution_enabled (replaces convolution), convolution_max_length_in_seconds (replaces convolution_max_length), loudness_enabled (replaces loudness).
New convolution_thread_pool_size setting (defaults to 1).
Deprecated settings: convolution_ir_file, convolution, convolution_max_length, loudness.
Corresponding D-Bus methods and properties have been updated.

Deprecation Notice:
The Jack Audio and soundio backends are deprecated and will be removed in a future release. Consider using the updated PipeWire backend instead.

Documentation Updates
Updated BUILD.md with latest build instructions.
Updated AIRPLAY2.md with feature information.
Enhanced convolution and loudness documentation.

Maintenance:
Fixed FFmpeg deprecation warnings.
Bumped actions/checkout from 6.0.1 to 6.0.2.
Bumped docker/login-action from 3.6.0 to 3.7.0.
Bumped docker/build-push-action from 6.13.0 to 6.15.0.
Bumped docker/setup-qemu-action from 3.4.0 to 3.6.0.
Bumped docker/setup-buildx-action from 3.9.0 to 3.10.0.
This commit is contained in:
Mike Brady
2026-02-13 15:17:40 +00:00
parent 3c8ceb7c97
commit b405c0b896
169 changed files with 17206 additions and 10625 deletions
+171 -43
View File
@@ -1,85 +1,213 @@
#include <pthread.h>
#include <sndfile.h>
#include "convolver.h"
#include "ConvolverThreadPool.h"
#include "FFTConvolver.h"
#include "Utilities.h"
#include <pthread.h>
#include <sndfile.h>
#include <unistd.h>
extern "C" void _warn(const char *filename, const int linenumber, const char *format, ...);
extern "C" void _debug(const char *filename, const int linenumber, int level, const char *format, ...);
extern "C" void _debug(const char *filename, const int linenumber, int level, const char *format,
...);
#define warn(...) _warn(__FILE__, __LINE__, __VA_ARGS__)
#define debug(...) _debug(__FILE__, __LINE__, __VA_ARGS__)
fftconvolver::FFTConvolver convolver_l;
fftconvolver::FFTConvolver convolver_r;
// Create and initialize the thread pool
ConvolverThreadPool pool;
// always lock use this when accessing the playing conn value
pthread_mutex_t convolver_lock = PTHREAD_MUTEX_INITIALIZER;
void convolver_pool_init(size_t numThreads, size_t numConvolvers) {
if (!pool.init(numThreads, numConvolvers)) {
debug(1, "failed to initialize thread pool!");
} else {
debug(1, "thread pool initialized with %u threads and %u convolvers.", numThreads,
numConvolvers);
}
}
void convolver_pool_closedown() {
pool.shutdown(); // Just shutdown, don't delete
debug(3, "thread pool shut down");
}
int convolver_init(const char* filename, int max_length) {
int convolver_init(const char *filename, unsigned char channel_count,
double max_length_in_seconds, size_t block_size) {
debug(3, "convolver_init");
int success = 0;
SF_INFO info;
SF_INFO info = {}; // Zero everything, including format
if (filename) {
SNDFILE* file = sf_open(filename, SFM_READ, &info);
SNDFILE *file = sf_open(filename, SFM_READ, &info);
if (file) {
if (info.samplerate == 44100) {
if ((info.channels == 1) || (info.channels == 2)) {
const size_t size = info.frames > max_length ? max_length : info.frames;
float buffer[size*info.channels];
size_t max_length = (size_t)(max_length_in_seconds * info.samplerate);
const size_t size =
(unsigned int)info.frames > max_length ? max_length : (unsigned int)info.frames;
float *buffer = (float*)malloc(sizeof(float) * size * info.channels);
if (buffer != NULL) {
// float buffer[size * info.channels];
float *abuffer = (float*)malloc(sizeof(float) * size);
if (abuffer != NULL) {
size_t l = sf_readf_float(file, buffer, size);
if (l != 0) {
pthread_mutex_lock(&convolver_lock);
convolver_l.reset(); // it is possible that init could be called more than once
convolver_r.reset(); // so it could be necessary to remove all previous settings
unsigned int cc;
if (info.channels == 1) {
convolver_l.init(352, buffer, size);
convolver_r.init(352, buffer, size);
} else {
// deinterleave
float buffer_l[size];
float buffer_r[size];
unsigned int i;
for (i=0; i<size; ++i)
{
buffer_l[i] = buffer[2*i+0];
buffer_r[i] = buffer[2*i+1];
for (cc = 0; cc < channel_count; cc++) {
if (!pool.initConvolver(cc, block_size, buffer, size)) {
debug(1, "new convolver failed to initialize convolver %u ", cc);
}
}
} else if (info.channels == channel_count) {
// we have to deinterleave the ir file channels for each convolver
// float abuffer[size];
for (cc = 0; cc < channel_count; cc++) {
unsigned int i;
for (i = 0; i < size; ++i) {
abuffer[i] = buffer[channel_count * i + cc];
}
if (!pool.initConvolver(cc, block_size, abuffer, size)) {
debug(1, "new convolver failed to initialize convolver %u ", cc);
}
}
convolver_l.init(352, buffer_l, size);
convolver_r.init(352, buffer_r, size);
}
pthread_mutex_unlock(&convolver_lock);
success = 1;
}
debug(1, "IR initialized from \"%s\" with %d channels and %d samples", filename, info.channels, size);
debug(2,
"convolution impulse response filter initialized from \"%s\" with %d channel%s and "
"%d samples",
filename, info.channels, info.channels == 1 ? "" : "s", size);
sf_close(file);
free((void*)abuffer);
} else {
warn("Impulse file \"%s\" contains %d channels. Only 1 or 2 is supported.", filename, info.channels);
debug(1, "failed to init convolvers because insufficient memory was available");
}
free((void*)buffer);
} else {
warn("Impulse file \"%s\" sample rate is %d Hz. Only 44100 Hz is supported", filename, info.samplerate);
warn("failed to init convolvers because insufficient memory was available");
}
sf_close(file);
} else {
warn("Convolution impulse response filter file \"%s\" can not be opened. Please check that "
"it exists, is a valid sound file and has appropriate access permissions.",
filename);
}
}
return success;
}
void convolver_process_l(float* data, int length) {
void convolver_process(unsigned int channel, float *data, int length) {
pool.processAsync(channel, data, data, length);
}
void convolver_wait_for_all() { pool.waitForAll(); }
void convolver_clear_state() {
pool.clearAllStates();
}
const unsigned int max_channels = 8;
fftconvolver::FFTConvolver convolvers[max_channels];
// fftconvolver::FFTConvolver convolver_l;
// fftconvolver::FFTConvolver convolver_r;
// always lock use this when accessing the playing conn value
/*
pthread_mutex_t convolver_lock = PTHREAD_MUTEX_INITIALIZER;
int convolver_init(const char *filename, unsigned char channel_count, double max_length_in_seconds,
size_t block_size) {
debug(1, "convolver_init");
int success = 0;
SF_INFO info;
if (filename) {
SNDFILE *file = sf_open(filename, SFM_READ, &info);
if (file) {
size_t max_length = (size_t)(max_length_in_seconds * info.samplerate);
const size_t size =
(unsigned int)info.frames > max_length ? max_length : (unsigned int)info.frames;
float buffer[size * info.channels];
size_t l = sf_readf_float(file, buffer, size);
if (l != 0) {
pthread_mutex_lock(&convolver_lock);
unsigned int cc;
for (cc = 0; cc < channel_count; cc++) {
convolvers[cc].reset();
}
if (info.channels == 1) {
for (cc = 0; cc < channel_count; cc++) {
convolvers[cc].init(block_size, buffer, size);
}
} else if (info.channels == channel_count) {
// we have to deinterleave the ir file channels for each convolver
for (cc = 0; cc < channel_count; cc++) {
float abuffer[size];
unsigned int i;
for (i = 0; i < size; ++i) {
abuffer[i] = buffer[channel_count * i + cc];
}
convolvers[cc].init(block_size, abuffer, size);
}
}
pthread_mutex_unlock(&convolver_lock);
success = 1;
}
debug(2,
"convolution impulse response filter initialized from \"%s\" with %d channel%s and "
"%d samples",
filename, info.channels, info.channels == 1 ? "" : "s", size);
sf_close(file);
} else {
warn("Convolution impulse response filter file \"%s\" can not be opened. Please check that "
"it exists, is a valid sound file and has appropriate access permissions.",
filename);
}
}
return success;
}
void convolver_reset() {
debug(1, "convolver_reset");
pthread_mutex_lock(&convolver_lock);
unsigned int cc;
for (cc = 0; cc < max_channels; cc++) {
convolvers[cc].reset();
}
// convolver_l.reset(); // it is possible that init could be called more than once
// convolver_r.reset(); // so it could be necessary to remove all previous settings
pthread_mutex_unlock(&convolver_lock);
}
void convolver_clear_state() {
debug(1, "convolver_clear_state");
pthread_mutex_lock(&convolver_lock);
unsigned int cc;
for (cc = 0; cc < max_channels; cc++) {
convolvers[cc].clearState();
}
// convolver_l.reset(); // it is possible that init could be called more than once
// convolver_r.reset(); // so it could be necessary to remove all previous settings
pthread_mutex_unlock(&convolver_lock);
}
void convolver_process(unsigned int channel, float *data, int length) {
pthread_mutex_lock(&convolver_lock);
convolvers[channel].process(data, data, length);
pthread_mutex_unlock(&convolver_lock);
usleep(100);
}
void convolver_process_l(float *data, int length) {
pthread_mutex_lock(&convolver_lock);
convolver_l.process(data, data, length);
pthread_mutex_unlock(&convolver_lock);
}
void convolver_process_r(float* data, int length) {
void convolver_process_r(float *data, int length) {
pthread_mutex_lock(&convolver_lock);
convolver_r.process(data, data, length);
pthread_mutex_unlock(&convolver_lock);
}
*/