Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ permissions:
contents: read

jobs:
windows:
name: Windows plugins (MSVC)
runs-on: windows-2025
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Configure
run: cmake --preset windows-plugin -DVISONA_BUILD_PLUGIN_CHECKS=ON
- name: Build
run: cmake --build --preset windows-plugin
- name: Test
run: ctest --preset windows-plugin

linux:
name: Linux core (${{ matrix.compiler }})
runs-on: ubuntu-24.04
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ cmake --preset linux-plugin && cmake --build --preset linux-plugin && ctest --pr
cmake --preset core-gcc && cmake --build --preset core-gcc && ctest --preset core-gcc
```

`core-clang`, `core-sanitize` (Clang with ASan and UBSan) and `core-tsan` (Clang with TSan) work the same way. Format C++ with `clang-format`. Pull-request CI in `.github/workflows/ci.yml` runs the `core-gcc`, `core-clang`, `core-sanitize` and `core-tsan` presets. The macOS app, the macOS VST3, AU and CLAP plugins (Visona and Visona Sync, checked with `auval` and `clap-validator`, signed with a Developer ID and notarized as described in `docs/signing.md`), the Windows x64 and Linux x86_64 VST3 and CLAP plugins (checked with `pluginval` and `clap-validator`) and the Pi ARM64 app (with the `pi-ci` preset, a parallel build of `pi`) are built by `.github/workflows/release.yml` when a GitHub release is published. Run by hand, that workflow builds only the artifacts ticked, from the branch chosen, and publishes them to the `dev-builds` prerelease. `.github/workflows/pi-quick.yml`, run by hand, publishes the Pi app the same way but faster, with the `pi-quick` preset: app only, parallel, `ccache`, no tests. Nothing checks that the JUCE targets compile on macOS, Windows or Linux before then, and nothing in CI runs the UI checks or `tests/scripts/test_pi_deploy.py`.
`core-clang`, `core-sanitize` (Clang with ASan and UBSan) and `core-tsan` (Clang with TSan) work the same way. Format C++ with `clang-format`. Pull-request CI in `.github/workflows/ci.yml` runs the `core-gcc`, `core-clang`, `core-sanitize` and `core-tsan` presets, plus the `windows-plugin` preset with MSVC and offline processor checks. The macOS app, the macOS VST3, AU and CLAP plugins (Visona and Visona Sync, checked with `auval` and `clap-validator`, signed with a Developer ID and notarized as described in `docs/signing.md`), the Windows x64 and Linux x86_64 VST3 and CLAP plugins (checked with `pluginval` and `clap-validator`) and the Pi ARM64 app (with the `pi-ci` preset, a parallel build of `pi`) are built by `.github/workflows/release.yml` when a GitHub release is published. Run by hand, that workflow builds only the artifacts ticked, from the branch chosen, and publishes them to the `dev-builds` prerelease. `.github/workflows/pi-quick.yml`, run by hand, publishes the Pi app the same way but faster, with the `pi-quick` preset: app only, parallel, `ccache`, no tests. Nothing checks that the JUCE targets compile on macOS or Linux before then, and nothing in CI runs the UI checks or `tests/scripts/test_pi_deploy.py`.
34 changes: 34 additions & 0 deletions cmake/LspMsvc.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Adapt only the platform header used by the pinned LSP measurement subset.
# Keep fetched sources pristine and put the generated header ahead of upstream.
function(visona_lsp_msvc_headers output_dir)
set(source "${lsp_common_SOURCE_DIR}/include/lsp-plug.in/common/types.h")
file(READ "${source}" contents)

# Fail on pin drift instead of silently producing an incomplete adaptation.
foreach(needle IN ITEMS "#include <unistd.h>"
"#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)"
"#if defined(__WORDSIZE) && (__WORDSIZE == 128)")
string(FIND "${contents}" "${needle}" position)
if(position EQUAL -1)
message(FATAL_ERROR "Review the LSP MSVC adaptation: missing ${needle}")
endif()
endforeach()

# MSVC has no POSIX unistd.h or ssize_t. ptrdiff_t is signed and pointer-sized.
string(REPLACE "#include <unistd.h>" "typedef ptrdiff_t ssize_t;"
contents "${contents}")
# The supported Windows target is little-endian x64. Do not depend on
# undefined GCC preprocessor macros comparing equal to zero in MSVC.
string(REPLACE "#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)"
"#if defined(_WIN32)\n #define ARCH_LE\n#elif (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)"
contents "${contents}")
string(REPLACE "#if defined(__WORDSIZE) && (__WORDSIZE == 128)"
"#if defined(_WIN64)\n #define ARCH_64BIT\n #elif defined(_WIN32)\n #define ARCH_32BIT\n #elif defined(__WORDSIZE) && (__WORDSIZE == 128)"
contents "${contents}")

set(header "${output_dir}/lsp-plug.in/common/types.h")
file(MAKE_DIRECTORY "${output_dir}/lsp-plug.in/common")
# configure_file avoids changing the header timestamp on every configure.
file(WRITE "${header}.in" "${contents}")
configure_file("${header}.in" "${header}" COPYONLY)
endfunction()
7 changes: 7 additions & 0 deletions cmake/LspStereo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,10 @@ target_include_directories(visona_lsp_stereo SYSTEM PUBLIC
"${lsp_common_SOURCE_DIR}/include")
target_compile_definitions(visona_lsp_stereo PUBLIC
LSP_DSP_UNITS_BUILTIN LSP_DSP_LIB_BUILTIN LSP_COMMON_LIB_BUILTIN)

if(MSVC)
include("${CMAKE_CURRENT_LIST_DIR}/LspMsvc.cmake")
set(lsp_msvc_include "${CMAKE_CURRENT_BINARY_DIR}/lsp-msvc/include")
visona_lsp_msvc_headers("${lsp_msvc_include}")
target_include_directories(visona_lsp_stereo SYSTEM BEFORE PUBLIC "${lsp_msvc_include}")
endif()
2 changes: 1 addition & 1 deletion tests/BandAnalyzerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ TEST_CASE("Band stereo energy does not cancel opposite phase", "[bands]")
const auto stereo = read(analyzer);
REQUIRE(stereo.db[17] == Catch::Approx(-6.0206).margin(0.2));
analyzer.reset(48000);
std::fill(opposite.begin(), opposite.end(), 0);
std::fill(opposite.begin(), opposite.end(), 0.0f);
analyzer.process(tone, opposite, 0);
REQUIRE(read(analyzer).db[17] == Catch::Approx(stereo.db[17] - 3.0103f).margin(0.01));
}
Expand Down
15 changes: 14 additions & 1 deletion third_party/lsp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,20 @@ upstream headers: review it and rerun the oracle tests when updating pins. Do no
link a second/full LSP implementation into the same binary without reconciling
the symbols.

No upstream source patches are carried. `StereoAnalyzer` works around the pinned
On MSVC, `cmake/LspMsvc.cmake` generates an overlay for the pinned common
`types.h`: it replaces the unused POSIX `unistd.h` include with a pointer-sized
signed `ssize_t` and detects Windows word size and endianness explicitly. The
fetched sources remain pristine; only this target and consumers of its headers
see the overlay. `StereoDsp.cpp` includes common types before the DSP declarations
so `ssize_t` is available there too. The meter algorithms and generic DSP sources
remain unmodified. Unused upstream GNU attribute and assembly macros are not
expanded by this subset; this is not general MSVC support for the full LSP API.

When changing pins, review the overlay and include order, build the Windows
plugins with MSVC, and run the core oracle and offline processor tests. PR CI
runs that Windows build in addition to the Linux core and sanitizer jobs.

`StereoAnalyzer` works around the pinned
Panometer's incomplete `clear()` by forcing a period change, and starts both
meters fresh for every published window. See [stereo analysis](../../docs/stereo.md)
for the measurements, validity policy and integration tests.
5 changes: 5 additions & 0 deletions third_party/lsp/StereoDsp.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Bind the six DSP entry points used by LSP's Correlometer and Panometer to
// unmodified, portable upstream implementations. This is not the full LSP API.
// Constant initialization avoids process-global runtime dispatch and its locks.
// Common types supplies ssize_t before the DSP API declarations on MSVC.
#include <lsp-plug.in/common/types.h>
#include <lsp-plug.in/dsp/dsp.h>
#include <lsp-plug.in/stdlib/math.h>

Expand All @@ -10,6 +12,9 @@
#include <private/dsp/arch/generic/hmath/hsum.h>
#include <private/dsp/arch/generic/pmath/sqr.h>

static_assert(sizeof(lsp::umword_t) == sizeof(void*));
static_assert(sizeof(ssize_t) == sizeof(size_t));

namespace lsp::dsp
{
constinit decltype(copy) copy = generic::copy;
Expand Down
Loading