From 4736abc80665615d8e7d2a1702904a6396135385 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 May 2026 00:39:03 +0000 Subject: [PATCH 1/3] Initial plan From 60cecd803d88b7acb8048f3c943bb448d5a35e89 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 May 2026 00:44:47 +0000 Subject: [PATCH 2/3] Update spatialaudio module for libspatialaudio 0.4.0 API - Require libspatialaudio >= 0.4.0 in pkg_check_modules - Add 'using namespace spaudio' for the new namespace - Rename class prefixes: CAmbisonicX -> AmbisonicX, CBFormat -> BFormat - Update AmbisonicDecoder::Configure to include sampleRate parameter - Update AmbisonicEncoder::Configure signature (sampleRate, fadeTime) - Update AmbisonicZoomer::Configure to pass sampleRate - Replace PolarPoint with PolarPosition and update field names - Use Orientation constructor instead of aggregate initialization - Use scoped enum Amblib_SpeakerSetUps for speaker layout constants - Remove gain parameter from AmbisonicEncoder::SetPosition Agent-Logs-Url: https://github.com/mltframework/mlt/sessions/c98c5021-60b6-49ce-bc41-77f91e8cfce0 Co-authored-by: ddennedy <1146683+ddennedy@users.noreply.github.com> --- CMakeLists.txt | 2 +- .../spatialaudio/filter_ambisonic-decoder.cpp | 38 +++++++++++-------- .../spatialaudio/filter_ambisonic-encoder.cpp | 21 +++++----- 3 files changed, 35 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index df7ca47930..1b2c6a013a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -384,7 +384,7 @@ if(MOD_SOX) endif() if(MOD_SPATIALAUDIO) - pkg_check_modules(spatialaudio REQUIRED IMPORTED_TARGET spatialaudio) + pkg_check_modules(spatialaudio REQUIRED IMPORTED_TARGET spatialaudio>=0.4.0) list(APPEND MLT_SUPPORTED_COMPONENTS spatialaudio) endif() diff --git a/src/modules/spatialaudio/filter_ambisonic-decoder.cpp b/src/modules/spatialaudio/filter_ambisonic-decoder.cpp index e7d3f925ad..9afa4ca462 100644 --- a/src/modules/spatialaudio/filter_ambisonic-decoder.cpp +++ b/src/modules/spatialaudio/filter_ambisonic-decoder.cpp @@ -1,6 +1,6 @@ /* * filter_ambisonic-decoder.cpp -- decode ambisonic audio to speaker channels - * Copyright (C) 2024 Meltytech, LLC + * Copyright (C) 2024-2026 Meltytech, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,8 @@ #include #include +using namespace spaudio; + static const auto MAX_CHANNELS = 6; static const auto AMBISONICS_BLOCK_SIZE = 1024; static const auto AMBISONICS_ORDER = 1; @@ -34,11 +36,11 @@ class SpatialAudio { private: mlt_filter m_filter; - CAmbisonicBinauralizer binauralizer; + AmbisonicBinauralizer binauralizer; unsigned tailLength; - CAmbisonicDecoder decoder; - CAmbisonicProcessor processor; - CAmbisonicZoomer zoomer; + AmbisonicDecoder decoder; + AmbisonicProcessor processor; + AmbisonicZoomer zoomer; float *speakers[MAX_CHANNELS]; public: @@ -72,6 +74,7 @@ class SpatialAudio { bool error = false; bool binaural = channels >= 2 && mlt_properties_get_int(properties(), "binaural"); + int sampleRate = mlt_properties_get_int(MLT_FRAME_PROPERTIES(frame), "audio_frequency"); // First time setup if (binaural && !binauralizer.GetChannelCount()) { @@ -79,8 +82,7 @@ class SpatialAudio "configuring spatial audio binauralizer\n"); error = !binauralizer.Configure(AMBISONICS_ORDER, true, - mlt_properties_get_int(MLT_FRAME_PROPERTIES(frame), - "audio_frequency"), + sampleRate, samples, tailLength); if (!error) { @@ -96,10 +98,11 @@ class SpatialAudio error = !decoder.Configure(AMBISONICS_ORDER, true, AMBISONICS_BLOCK_SIZE, - channels == 6 ? kAmblib_51 - : channels == 2 ? kAmblib_Stereo - : channels == 4 ? kAmblib_Quad - : kAmblib_CustomSpeakerSetUp, + sampleRate, + channels == 6 ? Amblib_SpeakerSetUps::kAmblib_51 + : channels == 2 ? Amblib_SpeakerSetUps::kAmblib_Stereo + : channels == 4 ? Amblib_SpeakerSetUps::kAmblib_Quad + : Amblib_SpeakerSetUps::kAmblib_CustomSpeakerSetUp, channels); if (!error) { mlt_log_verbose(MLT_FILTER_SERVICE(filter()), @@ -108,7 +111,10 @@ class SpatialAudio if (!error) { mlt_log_verbose(MLT_FILTER_SERVICE(filter()), "configuring spatial audio zoomer\n"); - error = !zoomer.Configure(AMBISONICS_ORDER, true, AMBISONICS_BLOCK_SIZE, 0); + error = !zoomer.Configure(AMBISONICS_ORDER, + true, + AMBISONICS_BLOCK_SIZE, + sampleRate); if (error) { mlt_log_error(MLT_FILTER_SERVICE(filter()), "failed to configure spatial audio zoomer\n"); @@ -125,7 +131,7 @@ class SpatialAudio // Processing if (!error) { - CBFormat bformat; + BFormat bformat; bformat.Configure(AMBISONICS_ORDER, true, samples); for (unsigned i = 0; i < AMBISONICS_1_CHANNELS; ++i) bformat.InsertStream(&buffer[samples * i], i, samples); @@ -133,9 +139,9 @@ class SpatialAudio if (!binaural) { mlt_position position = mlt_filter_get_position(filter(), frame); mlt_position length = mlt_filter_get_length2(filter(), frame); - processor.SetOrientation({-DegreesToRadians(getDouble("yaw", position, length)), - DegreesToRadians(getDouble("pitch", position, length)), - DegreesToRadians(getDouble("roll", position, length))}); + processor.SetOrientation(Orientation(-DegreesToRadians(getDouble("yaw", position, length)), + DegreesToRadians(getDouble("pitch", position, length)), + DegreesToRadians(getDouble("roll", position, length)))); processor.Refresh(); processor.Process(&bformat, samples); zoomer.SetZoom(getDouble("zoom", position, length)); diff --git a/src/modules/spatialaudio/filter_ambisonic-encoder.cpp b/src/modules/spatialaudio/filter_ambisonic-encoder.cpp index a89c7f0d4b..efe5506249 100644 --- a/src/modules/spatialaudio/filter_ambisonic-encoder.cpp +++ b/src/modules/spatialaudio/filter_ambisonic-encoder.cpp @@ -1,6 +1,6 @@ /* * filter_ambisonic-encoder.cpp -- position mono and stero sound in ambisonic space - * Copyright (C) 2024 Meltytech, LLC + * Copyright (C) 2024-2026 Meltytech, LLC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,6 +20,8 @@ #include #include +using namespace spaudio; + // static const auto MAX_CHANNELS = 6; static const auto AMBISONICS_ORDER = 1; static const auto AMBISONICS_1_CHANNELS = 4; @@ -33,7 +35,7 @@ class SpatialAudioEncoder { private: mlt_filter m_filter; - CAmbisonicEncoder encoder; + AmbisonicEncoder encoder; public: SpatialAudioEncoder() @@ -69,7 +71,8 @@ class SpatialAudioEncoder // First time setup if (!encoder.GetOrder()) { mlt_log_verbose(MLT_FILTER_SERVICE(filter()), "configuring spatial audio encoder\n"); - error = !encoder.Configure(AMBISONICS_ORDER, true, 0); + int sampleRate = mlt_properties_get_int(MLT_FRAME_PROPERTIES(frame), "audio_frequency"); + error = !encoder.Configure(AMBISONICS_ORDER, true, sampleRate, 0.f); if (error) { mlt_log_error(MLT_FILTER_SERVICE(filter()), "failed to configure spatial audio encoder\n"); @@ -78,16 +81,16 @@ class SpatialAudioEncoder // Processing if (!error) { - CBFormat bformat; - PolarPoint polar; + BFormat bformat; + PolarPosition polar; mlt_position position = mlt_filter_get_position(filter(), frame); mlt_position length = mlt_filter_get_length2(filter(), frame); bformat.Configure(AMBISONICS_ORDER, true, samples); - polar.fAzimuth = -DegreesToRadians(getDouble("azimuth", position, length)); - polar.fElevation = DegreesToRadians(getDouble("elevation", position, length)); - polar.fDistance = getDouble("distance", position, length); - encoder.SetPosition(polar, 1.f); + polar.azimuth = -DegreesToRadians(getDouble("azimuth", position, length)); + polar.elevation = DegreesToRadians(getDouble("elevation", position, length)); + polar.distance = getDouble("distance", position, length); + encoder.SetPosition(polar); encoder.Refresh(); encoder.Process(buffer, samples, &bformat); for (int i = 0; i < AMBISONICS_1_CHANNELS; ++i) From ceae35921ab499a4fe9e832454c3962dc124769a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 11 May 2026 00:57:27 +0000 Subject: [PATCH 3/3] Apply clang-format-14 formatting to spatialaudio module Agent-Logs-Url: https://github.com/mltframework/mlt/sessions/c1b45048-d3a0-4fd0-aebd-e3689f1003a8 Co-authored-by: ddennedy <1146683+ddennedy@users.noreply.github.com> --- .../spatialaudio/filter_ambisonic-decoder.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/modules/spatialaudio/filter_ambisonic-decoder.cpp b/src/modules/spatialaudio/filter_ambisonic-decoder.cpp index 9afa4ca462..2255fabf72 100644 --- a/src/modules/spatialaudio/filter_ambisonic-decoder.cpp +++ b/src/modules/spatialaudio/filter_ambisonic-decoder.cpp @@ -80,11 +80,7 @@ class SpatialAudio if (binaural && !binauralizer.GetChannelCount()) { mlt_log_verbose(MLT_FILTER_SERVICE(filter()), "configuring spatial audio binauralizer\n"); - error = !binauralizer.Configure(AMBISONICS_ORDER, - true, - sampleRate, - samples, - tailLength); + error = !binauralizer.Configure(AMBISONICS_ORDER, true, sampleRate, samples, tailLength); if (!error) { binauralizer.Reset(); } else { @@ -101,8 +97,9 @@ class SpatialAudio sampleRate, channels == 6 ? Amblib_SpeakerSetUps::kAmblib_51 : channels == 2 ? Amblib_SpeakerSetUps::kAmblib_Stereo - : channels == 4 ? Amblib_SpeakerSetUps::kAmblib_Quad - : Amblib_SpeakerSetUps::kAmblib_CustomSpeakerSetUp, + : channels == 4 + ? Amblib_SpeakerSetUps::kAmblib_Quad + : Amblib_SpeakerSetUps::kAmblib_CustomSpeakerSetUp, channels); if (!error) { mlt_log_verbose(MLT_FILTER_SERVICE(filter()), @@ -139,9 +136,10 @@ class SpatialAudio if (!binaural) { mlt_position position = mlt_filter_get_position(filter(), frame); mlt_position length = mlt_filter_get_length2(filter(), frame); - processor.SetOrientation(Orientation(-DegreesToRadians(getDouble("yaw", position, length)), - DegreesToRadians(getDouble("pitch", position, length)), - DegreesToRadians(getDouble("roll", position, length)))); + processor.SetOrientation( + Orientation(-DegreesToRadians(getDouble("yaw", position, length)), + DegreesToRadians(getDouble("pitch", position, length)), + DegreesToRadians(getDouble("roll", position, length)))); processor.Refresh(); processor.Process(&bformat, samples); zoomer.SetZoom(getDouble("zoom", position, length));