π π A Python library for audio.
C audioaudio-processingaudio-productionaudio-researchaudio-unitaugmentationjucemachine-learningpybind11pythonvst3vst3-host
Switch to CMake. (#418)
Peter Sobotabb64d179f95
diff --git a/.github/workflows/all.yml b/.github/workflows/all.ymlindex 8554a2e..cdec585 100644--- a/.github/workflows/all.yml+++ b/.github/workflows/all.yml@@ -19,7 +19,7 @@ jobs:strategy:matrix:python-version: ['3.12']- os: ['ubuntu-20.04']+ os: ['ubuntu-24.04']name: Lint Pythonsteps:- name: Set up Python ${{ matrix.python-version }}@@ -32,12 +32,12 @@ jobs:python -m pip install --upgrade pippip install ruff- name: Lint Python code- run: ruff check ${{ runner.workspace }}/pedalboard --ignore=E203,F541 --exclude .git,dist,doc,build,vendors,'*.pyi' --line-length 100+ run: ruff check ${{ github.workspace }}/pedalboard- name: Check Python formatting- run: ruff format --check ${{ runner.workspace }}/pedalboard --exclude .git,dist,doc,build,JUCE,examples,vendors,'*.pyi' --diff --line-length 100+ run: ruff format --check ${{ github.workspace }}/pedalboard --difflint-cpp:- runs-on: 'ubuntu-20.04'+ runs-on: 'ubuntu-24.04'continue-on-error: truename: Lint C++steps:@@ -57,7 +57,7 @@ jobs:strategy:matrix:include:- - { os: ubuntu-20.04, python-version: "3.12", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }+ - { os: ubuntu-24.04, python-version: "3.12", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }name: Pre-build on ${{ matrix.os }} with ${{ matrix.compiler }}steps:- name: Set up Python ${{ matrix.python-version }}@@ -105,33 +105,33 @@ jobs:with:enableCrossOsArchive: truepath: |- ${{ runner.workspace }}/.ccache- ${{ runner.workspace }}/pedalboard/build/lib*- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors+ ${{ github.workspace }}/.ccache+ ${{ github.workspace }}/pedalboard/build/lib*+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/pedalboard/juce_overrides+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/vendorskey: ${{ runner.os }}-${{ matrix.compiler }}-ccache- name: Build pedalboard locallyenv:- CCACHE_DIR: ${{ runner.workspace }}/.ccache- CCACHE_BASEDIR: ${{ runner.workspace }}- CCACHE_DEBUGDIR: ${{ runner.workspace }}/.ccache_debug+ CCACHE_DIR: ${{ github.workspace }}/.ccache+ CCACHE_BASEDIR: ${{ github.workspace }}+ CCACHE_DEBUGDIR: ${{ github.workspace }}/.ccache_debugCCACHE_SLOPPINESS: "pch_defines,include_file_mtime,include_file_ctime,time_macros,locale,random_seed,system_headers"CCACHE_COMPILERCHECK: noneCCACHE_NOINODECACHE: 1CCACHE_IGNOREOPTIONS: "-fno-strict-overflow -fwrapv -W* -arch x86_64 arm64 -dynamic -fno-common -g -I/usr/local/opt/*"- CCACHE_LOGFILE: ${{ runner.workspace }}/.ccache_log+ CCACHE_LOGFILE: ${{ github.workspace }}/.ccache_logCCACHE_DEBUG: "1"DISABLE_LTO: "1" # Speeds up un-cacheable link step which doesn't really increase performance in tests anywaysCC: ${{ matrix.cc }}CXX: ${{ matrix.cxx }}- run: python setup.py develop+ run: python -m pip install -e .- name: Ensure ccache workedenv:- CCACHE_DIR: ${{ runner.workspace }}/.ccache+ CCACHE_DIR: ${{ github.workspace }}/.ccacherun: |ccache --show-stats --verboseccache --zero-stats- # cat ${{ runner.workspace }}/.ccache_log || true+ # cat ${{ github.workspace }}/.ccache_log || true# - name: Delete Existing Cache for ${{ runner.os }} Objects# run: gh cache delete --repo ${{ github.repository }} ${{ steps.cache-objects-restore.outputs.cache-primary-key }}# env:@@ -143,10 +143,10 @@ jobs:with:enableCrossOsArchive: truepath: |- ${{ runner.workspace }}/.ccache- ${{ runner.workspace }}/pedalboard/build/lib*- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors+ ${{ github.workspace }}/.ccache+ ${{ github.workspace }}/pedalboard/build/lib*+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/pedalboard/juce_overrides+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/vendorskey: ${{ steps.cache-objects-restore.outputs.cache-primary-key }}prime-macos-build-caches:@@ -183,16 +183,16 @@ jobs:with:enableCrossOsArchive: truepath: |- ${{ runner.workspace }}/.ccache- ${{ runner.workspace }}/pedalboard/build/lib*- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors+ ${{ github.workspace }}/.ccache+ ${{ github.workspace }}/pedalboard/build/lib*+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/pedalboard/juce_overrides+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/vendorskey: ${{ runner.os }}-${{ matrix.compiler }}-ccache- name: Build pedalboard locallyenv:- CCACHE_DIR: ${{ runner.workspace }}/.ccache- CCACHE_BASEDIR: ${{ runner.workspace }}- CCACHE_DEBUGDIR: ${{ runner.workspace }}/.ccache_debug+ CCACHE_DIR: ${{ github.workspace }}/.ccache+ CCACHE_BASEDIR: ${{ github.workspace }}+ CCACHE_DEBUGDIR: ${{ github.workspace }}/.ccache_debugCCACHE_SLOPPINESS: "pch_defines,include_file_mtime,include_file_ctime,time_macros,locale,random_seed,system_headers"CCACHE_COMPILERCHECK: noneCCACHE_NOINODECACHE: 1@@ -200,7 +200,7 @@ jobs:CCACHE_DEBUG: "1"# Use the minimum macOS deployment target supported by our version of PyBind:MACOSX_DEPLOYMENT_TARGET: "10.14"- CCACHE_LOGFILE: ${{ runner.workspace }}/.ccache_log+ CCACHE_LOGFILE: ${{ github.workspace }}/.ccache_log# This build caching is only to speed up tests on CI, so we only care about x86_64 for now.# Without limiting to a single architecture, ccache can't properly cache mixed Objective-C and C++ builds.# Fun fact: this is supported in Python itself! https://github.com/python/cpython/blob/893c9cc/Lib/_osx_support.py#L314-L328@@ -208,15 +208,15 @@ jobs:DISABLE_LTO: "1" # Speeds up un-cacheable link step which doesn't really increase performance in tests anywaysCC: ${{ matrix.cc }}CXX: ${{ matrix.cxx }}- run: python setup.py develop+ run: python -m pip install -e .- name: Ensure ccache workedenv:- CCACHE_DIR: ${{ runner.workspace }}/.ccache+ CCACHE_DIR: ${{ github.workspace }}/.ccacherun: |ccache --show-stats --verboseccache --zero-stats- # cat ${{ runner.workspace }}/.ccache_log || true- # ls -lashR ${{ runner.workspace }}/pedalboard+ # cat ${{ github.workspace }}/.ccache_log || true+ # ls -lashR ${{ github.workspace }}# - name: Delete Existing Cache for ${{ runner.os }} Objects# run: gh cache delete --repo ${{ github.repository }} ${{ steps.cache-objects-restore.outputs.cache-primary-key }}# env:@@ -228,10 +228,10 @@ jobs:with:enableCrossOsArchive: truepath: |- ${{ runner.workspace }}/.ccache- ${{ runner.workspace }}/pedalboard/build/lib*- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors+ ${{ github.workspace }}/.ccache+ ${{ github.workspace }}/pedalboard/build/lib*+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/pedalboard/juce_overrides+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/vendorskey: ${{ steps.cache-objects-restore.outputs.cache-primary-key }}# Build the native module with ccache enabled so we can share object files between builds:@@ -241,7 +241,7 @@ jobs:strategy:matrix:include:- - { os: ubuntu-20.04, python-version: "3.12", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }+ - { os: ubuntu-24.04, python-version: "3.12", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }name: Pre-build on ${{ matrix.os }} with ${{ matrix.compiler }}steps:- name: Set up Python ${{ matrix.python-version }}@@ -289,34 +289,34 @@ jobs:with:enableCrossOsArchive: truepath: |- ${{ runner.workspace }}/.ccache- ${{ runner.workspace }}/pedalboard/build/lib*- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors+ ${{ github.workspace }}/.ccache+ ${{ github.workspace }}/pedalboard/build/lib*+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/pedalboard/juce_overrides+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/vendorskey: ${{ runner.os }}-${{ matrix.compiler }}-ccache- name: Build pedalboard locallyenv:- CCACHE_DIR: ${{ runner.workspace }}/.ccache- CCACHE_BASEDIR: ${{ runner.workspace }}- CCACHE_DEBUGDIR: ${{ runner.workspace }}/.ccache_debug+ CCACHE_DIR: ${{ github.workspace }}/.ccache+ CCACHE_BASEDIR: ${{ github.workspace }}+ CCACHE_DEBUGDIR: ${{ github.workspace }}/.ccache_debugCCACHE_SLOPPINESS: "pch_defines,include_file_mtime,include_file_ctime,time_macros,locale,random_seed,system_headers"CCACHE_COMPILERCHECK: noneCCACHE_NOINODECACHE: 1CCACHE_IGNOREOPTIONS: "-fno-strict-overflow -fwrapv -W* -arch x86_64 arm64 -dynamic -fno-common -g -I/usr/local/opt/*"- CCACHE_LOGFILE: ${{ runner.workspace }}/.ccache_log+ CCACHE_LOGFILE: ${{ github.workspace }}/.ccache_logUSE_ASAN: "1"DISABLE_LTO: "1" # Speeds up un-cacheable link step which doesn't really increase performance in tests anywaysCC: ${{ matrix.cc }}CXX: ${{ matrix.cxx }}- run: python setup.py develop+ run: python -m pip install -e .- name: Ensure ccache workedenv:- CCACHE_DIR: ${{ runner.workspace }}/.ccache+ CCACHE_DIR: ${{ github.workspace }}/.ccacherun: |ccache --show-stats --verboseccache --zero-stats- # cat ${{ runner.workspace }}/.ccache_log || true- # ls -lashR ${{ runner.workspace }}+ # cat ${{ github.workspace }}/.ccache_log || true+ # ls -lashR ${{ github.workspace }}# - name: Delete Existing Cache for ${{ runner.os }} Objects# run: gh cache delete --repo ${{ github.repository }} ${{ steps.cache-objects-restore.outputs.cache-primary-key }}# env:@@ -328,10 +328,10 @@ jobs:with:enableCrossOsArchive: truepath: |- ${{ runner.workspace }}/.ccache- ${{ runner.workspace }}/pedalboard/build/lib*- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors+ ${{ github.workspace }}/.ccache+ ${{ github.workspace }}/pedalboard/build/lib*+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/pedalboard/juce_overrides+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/vendorskey: ${{ steps.cache-objects-restore.outputs.cache-primary-key }}# This initial job catches obvious failures faster by running tests in parallel on just Ubuntu.@@ -342,7 +342,7 @@ jobs:- prime-ubuntu-build-cachesstrategy:matrix:- os: ["ubuntu-20.04"]+ os: ["ubuntu-24.04"]python-version: ["3.12"]compiler: ["gcc"]cc: ["ccache gcc"]@@ -393,52 +393,54 @@ jobs:with:enableCrossOsArchive: truepath: |- ${{ runner.workspace }}/.ccache- ${{ runner.workspace }}/pedalboard/build/lib*- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors+ ${{ github.workspace }}/.ccache+ ${{ github.workspace }}/pedalboard/build/lib*+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/pedalboard/juce_overrides+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/vendorskey: ${{ runner.os }}-${{ matrix.compiler }}-ccache- name: Print Restored ${{ runner.os }} Objects- run: ls -lashR ${{ runner.workspace }}+ run: ls -lashR ${{ github.workspace }}# Without this, distutils will recompile the extension even though we already have the .so built:- name: Touch Restored ${{ runner.os }} Objects to Prevent Cache Missif: runner.os == 'Linux' || runner.os == 'macOS'run: |- find ${{ runner.workspace }} -name '*.so' -exec touch {} \; || true- find ${{ runner.workspace }} -name '*.o' -exec touch {} \; || true- ls -lR ${{ runner.workspace }}/pedalboard+ find ${{ github.workspace }} -name '*.so' -exec touch {} \; || true+ find ${{ github.workspace }} -name '*.o' -exec touch {} \; || true+ ls -lR ${{ github.workspace }}/pedalboard- name: Build pedalboard locally- run: python setup.py develop+ run: python -m pip install -e .env:- CCACHE_DIR: ${{ runner.workspace }}/.ccache- CCACHE_BASEDIR: ${{ runner.workspace }}- CCACHE_DEBUGDIR: ${{ runner.workspace }}/.ccache_debug+ CCACHE_DIR: ${{ github.workspace }}/.ccache+ CCACHE_BASEDIR: ${{ github.workspace }}+ CCACHE_DEBUGDIR: ${{ github.workspace }}/.ccache_debugCCACHE_SLOPPINESS: "pch_defines,include_file_mtime,include_file_ctime,time_macros,locale,random_seed,system_headers"CCACHE_COMPILERCHECK: noneCCACHE_NOINODECACHE: 1CCACHE_IGNOREOPTIONS: "-fno-strict-overflow -fwrapv -W* -arch x86_64 arm64 -dynamic -fno-common -g -I/usr/local/opt/*"- CCACHE_LOGFILE: ${{ runner.workspace }}/.ccache_log+ CCACHE_LOGFILE: ${{ github.workspace }}/.ccache_logDISABLE_LTO: "1" # Speeds up un-cacheable link step which doesn't really increase performance in tests anywaysCC: ${{ matrix.cc }}CXX: ${{ matrix.cxx }}- name: Ensure ccache workedenv:- CCACHE_DIR: ${{ runner.workspace }}/.ccache+ CCACHE_DIR: ${{ github.workspace }}/.ccacherun: |ccache --show-stats --verboseccache --zero-stats- # cat ${{ runner.workspace }}/.ccache_log || true- # ls -lashR ${{ runner.workspace }}+ # cat ${{ github.workspace }}/.ccache_log || true+ # ls -lashR ${{ github.workspace }}- name: Install VSTs for testingenv:GCS_ASSET_BUCKET_NAME: ${{ secrets.GCS_ASSET_BUCKET_NAME }}GCS_READER_SERVICE_ACCOUNT_KEY: ${{ secrets.GCS_READER_SERVICE_ACCOUNT_KEY }}run: python ./tests/download_test_plugins.py- - name: Setup dummy soundcard for testing+ - name: Setup audio device for testingif: runner.os == 'Linux'run: |- sudo apt-get install -y linux-modules-extra-$(uname -r)- sudo modprobe snd-dummy+ sudo apt-get install -y pulseaudio+ pulseaudio --start+ pactl load-module module-null-sink sink_name=test+ pactl set-default-sink test- name: Run testsenv:TEST_WORKER_INDEX: ${{ matrix.runner_index }}@@ -456,22 +458,19 @@ jobs:strategy:matrix:include:- - { os: macos-13, python-version: "3.8", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }- { os: macos-13, python-version: "3.9", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }- { os: macos-13, python-version: "3.10", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }- { os: macos-13, python-version: "3.11", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }- { os: macos-13, python-version: "3.12", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }- { os: macos-13, python-version: "3.13.0-rc.1", compiler: "clang", cc: "ccache clang", cxx: "ccache clang++" }- - { os: ubuntu-20.04, python-version: "3.8", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }- - { os: ubuntu-20.04, python-version: "3.9", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }- - { os: ubuntu-20.04, python-version: "3.10", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }- - { os: ubuntu-20.04, python-version: "3.11", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }- - { os: ubuntu-20.04, python-version: "3.12", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }- - { os: ubuntu-20.04, python-version: "3.13.0-rc.1", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }- # - { os: windows-latest, python-version: "3.8", compiler: "msvc", cc: "msvc", cxx: "msvc" }- # - { os: windows-latest, python-version: "3.9", compiler: "msvc", cc: "msvc", cxx: "msvc" }- # - { os: windows-latest, python-version: "3.10", compiler: "msvc", cc: "msvc", cxx: "msvc" }- # - { os: windows-latest, python-version: "3.11", compiler: "msvc", cc: "msvc", cxx: "msvc" }+ - { os: ubuntu-24.04, python-version: "3.9", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }+ - { os: ubuntu-24.04, python-version: "3.10", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }+ - { os: ubuntu-24.04, python-version: "3.11", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }+ - { os: ubuntu-24.04, python-version: "3.12", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }+ - { os: ubuntu-24.04, python-version: "3.13.0-rc.1", compiler: "gcc", cc: "ccache gcc", cxx: "ccache g++" }+ - { os: windows-latest, python-version: "3.9", compiler: "msvc", cc: "msvc", cxx: "msvc" }+ - { os: windows-latest, python-version: "3.10", compiler: "msvc", cc: "msvc", cxx: "msvc" }+ - { os: windows-latest, python-version: "3.11", compiler: "msvc", cc: "msvc", cxx: "msvc" }- { os: windows-latest, python-version: "3.12", compiler: "msvc", cc: "msvc", cxx: "msvc" }- { os: windows-latest, python-version: "3.13.0-rc.1", compiler: "msvc", cc: "msvc", cxx: "msvc" }name: Test with Python ${{ matrix.python-version }} on ${{ matrix.os }}@@ -512,6 +511,7 @@ jobs:python -m pip install --upgrade pippip install wheelpip install -r test-requirements.txt+ pip install pybind11 'scikit-build-core[pyproject]'# TensorFlow is an optional dependency; if present, we'll run tests with it:# There are no environment specifiers to select when TensorFlow binaries are available.pip install tensorflow==2.13 || true@@ -532,29 +532,29 @@ jobs:with:enableCrossOsArchive: truepath: |- ${{ runner.workspace }}/.ccache- ${{ runner.workspace }}/pedalboard/build/lib*- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors+ ${{ github.workspace }}/.ccache+ ${{ github.workspace }}/pedalboard/build/lib*+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/pedalboard/juce_overrides+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/vendorskey: ${{ runner.os }}-${{ matrix.compiler }}-ccache# Without this, distutils will recompile the extension even though we already have the shared object built:- name: Touch Restored ${{ runner.os }} Objects to Prevent Cache Missif: runner.os == 'Linux' || runner.os == 'macOS'run: |- find ${{ runner.workspace }} -name '*.so' -exec touch {} \; || true- find ${{ runner.workspace }} -name '*.o' -exec touch {} \; || true- ls -lR ${{ runner.workspace }}/pedalboard+ find ${{ github.workspace }} -name '*.so' -exec touch {} \; || true+ find ${{ github.workspace }} -name '*.o' -exec touch {} \; || true+ ls -lR ${{ github.workspace }}/pedalboard- name: Build pedalboard locally- run: python setup.py develop+ run: python -m pip install -ve .env:- CCACHE_DIR: ${{ runner.workspace }}/.ccache- CCACHE_BASEDIR: ${{ runner.workspace }}- CCACHE_DEBUGDIR: ${{ runner.workspace }}/.ccache_debug+ CCACHE_DIR: ${{ github.workspace }}/.ccache+ CCACHE_BASEDIR: ${{ github.workspace }}+ CCACHE_DEBUGDIR: ${{ github.workspace }}/.ccache_debugCCACHE_SLOPPINESS: "pch_defines,include_file_mtime,include_file_ctime,time_macros,locale,random_seed,system_headers"CCACHE_COMPILERCHECK: noneCCACHE_NOINODECACHE: 1CCACHE_IGNOREOPTIONS: "-fno-strict-overflow -fwrapv -W* -arch x86_64 arm64 -dynamic -fno-common -g -I/usr/local/opt/*"- CCACHE_LOGFILE: ${{ runner.workspace }}/.ccache_log+ CCACHE_LOGFILE: ${{ github.workspace }}/.ccache_logCCACHE_DEBUG: "1"# Use the minimum macOS deployment target supported by our version of PyBind:MACOSX_DEPLOYMENT_TARGET: "10.14"@@ -568,21 +568,21 @@ jobs:- name: Ensure ccache workedif: runner.os == 'Linux' || runner.os == 'macOS'env:- CCACHE_DIR: ${{ runner.workspace }}/.ccache+ CCACHE_DIR: ${{ github.workspace }}/.ccacherun: |ccache --show-stats --verboseccache --zero-stats- # cat ${{ runner.workspace }}/.ccache_log || true+ # cat ${{ github.workspace }}/.ccache_log || true- name: Install VSTs for testingenv:GCS_ASSET_BUCKET_NAME: ${{ secrets.GCS_ASSET_BUCKET_NAME }}GCS_READER_SERVICE_ACCOUNT_KEY: ${{ secrets.GCS_READER_SERVICE_ACCOUNT_KEY }}run: python ./tests/download_test_plugins.py- name: Run tests- if: matrix.os != 'ubuntu-20.04' || matrix.python-version != '3.8'+ if: matrix.os != 'ubuntu-24.04' || matrix.python-version != '3.10'run: pytest --maxfail=4 --cov-report term --cov-fail-under=${{ env.MINIMUM_COVERAGE_PERCENTAGE }} --cov=pedalboard --durations=100- name: Run tests with coverage reporting- if: matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.8'+ if: matrix.os == 'ubuntu-24.04' && matrix.python-version == '3.10'run: |pytest --maxfail=4 --cov-report term --cov-fail-under=${{ env.MINIMUM_COVERAGE_PERCENTAGE }} --cov=pedalboard \&& coverage json --fail-under=${{ env.MINIMUM_COVERAGE_PERCENTAGE }} \@@ -590,7 +590,7 @@ jobs:&& jq -r 'if .totals.percent_covered > ${{ env.MINIMUM_COVERAGE_PERCENTAGE }} then "COVERAGE_COLOR=green" else "COVERAGE_COLOR=red" end' coverage.json >> $GITHUB_ENV- name: Create coverage badgeuses: schneegans/[email protected]- if: matrix.os == 'ubuntu-20.04' && matrix.python-version == '3.8' && github.event_name == 'release' && github.event.action == 'published'+ if: matrix.os == 'ubuntu-24.04' && matrix.python-version == '3.10' && github.event_name == 'release' && github.event.action == 'published'with:auth: ${{ secrets.COVERAGE_GIST_SECRET }}gistID: 8736467e9952991ef44a67915ee7c762@@ -604,8 +604,8 @@ jobs:needs: [prime-asan-build-caches]strategy:matrix:- python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']- os: ['ubuntu-20.04']+ python-version: ['3.9', '3.10', '3.11', '3.12']+ os: ['ubuntu-24.04']name: Test with Python ${{ matrix.python-version }} + Address Sanitizersteps:- name: Set up Python ${{ matrix.python-version }}@@ -646,35 +646,35 @@ jobs:with:enableCrossOsArchive: truepath: |- ${{ runner.workspace }}/.ccache- ${{ runner.workspace }}/pedalboard/build/lib*- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/pedalboard/juce_overrides- ${{ runner.workspace }}/pedalboard/build/temp${{ runner.workspace }}/pedalboard/vendors+ ${{ github.workspace }}/.ccache+ ${{ github.workspace }}/pedalboard/build/lib*+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/pedalboard/juce_overrides+ ${{ github.workspace }}/pedalboard/build/temp${{ github.workspace }}/pedalboard/vendorskey: ${{ runner.os }}-clang-ccache- name: Build pedalboard locallyenv:DEBUG: "0"USE_ASAN: "1"- CCACHE_DIR: ${{ runner.workspace }}/.ccache- CCACHE_BASEDIR: ${{ runner.workspace }}- CCACHE_DEBUGDIR: ${{ runner.workspace }}/.ccache_debug+ CCACHE_DIR: ${{ github.workspace }}/.ccache+ CCACHE_BASEDIR: ${{ github.workspace }}+ CCACHE_DEBUGDIR: ${{ github.workspace }}/.ccache_debugCCACHE_SLOPPINESS: "pch_defines,include_file_mtime,include_file_ctime,time_macros,locale,random_seed,system_headers"CCACHE_COMPILERCHECK: noneCCACHE_NOINODECACHE: 1CCACHE_IGNOREOPTIONS: "-fno-strict-overflow -fwrapv -W* -arch x86_64 arm64 -dynamic -fno-common -g -I/usr/local/opt/*"- CCACHE_LOGFILE: ${{ runner.workspace }}/.ccache_log+ CCACHE_LOGFILE: ${{ github.workspace }}/.ccache_logCCACHE_DEBUG: "1"DISABLE_LTO: "1" # Speeds up un-cacheable link step which doesn't really increase performance in tests anywaysCC: ccache clangCXX: ccache clang++- run: python setup.py develop+ run: python -m pip install -e .- name: Ensure ccache workedenv:- CCACHE_DIR: ${{ runner.workspace }}/.ccache+ CCACHE_DIR: ${{ github.workspace }}/.ccacherun: |ccache --show-stats --verboseccache --zero-stats- # cat ${{ runner.workspace }}/.ccache_log || true+ # cat ${{ github.workspace }}/.ccache_log || true- name: Run tests with ASan loaded# pytest can exit before all Python objects have been destroyed,# so we tell ASan to ignore leaks.@@ -691,53 +691,53 @@ jobs:strategy:matrix:include:- - { os: macos-12, build: cp39-macosx_x86_64 }- - { os: macos-12, build: cp310-macosx_x86_64 }- - { os: macos-12, build: cp311-macosx_x86_64 }- - { os: macos-12, build: cp312-macosx_x86_64 }- - { os: macos-12, build: cp313-macosx_x86_64 }- - { os: macos-12, build: cp313t-macosx_x86_64 }+ - { os: macos-13, build: cp39-macosx_x86_64 }+ - { os: macos-13, build: cp310-macosx_x86_64 }+ - { os: macos-13, build: cp311-macosx_x86_64 }+ - { os: macos-13, build: cp312-macosx_x86_64 }+ - { os: macos-13, build: cp313-macosx_x86_64 }+ - { os: macos-13, build: cp313t-macosx_x86_64 }# Universal wheels are rarely used; only support them for Python 3.12:- - { os: macos-12, build: cp312-macosx_universal2 }- - { os: macos-12, build: cp39-macosx_arm64 }- - { os: macos-12, build: cp310-macosx_arm64 }- - { os: macos-12, build: cp311-macosx_arm64 }- - { os: macos-12, build: cp312-macosx_arm64 }- - { os: macos-12, build: cp313-macosx_arm64 }- - { os: macos-12, build: cp313t-macosx_arm64 }- # - { os: macos-12, build: pp38-macosx_x86_64 }- # - { os: macos-12, build: pp39-macosx_x86_64 }- - { os: windows-latest, build: cp39-win_amd64 }- - { os: windows-latest, build: cp310-win_amd64 }- - { os: windows-latest, build: cp311-win_amd64 }- - { os: windows-latest, build: cp312-win_amd64 }- - { os: windows-latest, build: cp313-win_amd64 }- # - { os: windows-latest, build: cp313t-win_amd64 }- - { os: windows-latest, build: cp312-win32 }- - { os: 'ubuntu-20.04', build: cp39-manylinux_x86_64 }- - { os: 'ubuntu-20.04', build: cp39-manylinux_aarch64 }- # - { os: 'ubuntu-20.04', build: cp39-musllinux_x86_64 }- # - { os: 'ubuntu-20.04', build: cp39-musllinux_aarch64 }- - { os: 'ubuntu-20.04', build: cp310-manylinux_x86_64 }- - { os: 'ubuntu-20.04', build: cp310-manylinux_aarch64 }- - { os: 'ubuntu-20.04', build: cp310-musllinux_x86_64 }- - { os: 'ubuntu-20.04', build: cp310-musllinux_aarch64 }- - { os: 'ubuntu-20.04', build: cp311-manylinux_x86_64 }- - { os: 'ubuntu-20.04', build: cp311-manylinux_aarch64 }- # - { os: 'ubuntu-20.04', build: cp311-musllinux_x86_64 }- # - { os: 'ubuntu-20.04', build: cp311-musllinux_aarch64 }- - { os: 'ubuntu-20.04', build: cp312-manylinux_x86_64 }- - { os: 'ubuntu-20.04', build: cp312-manylinux_aarch64 }- - { os: 'ubuntu-20.04', build: cp312-musllinux_x86_64 }- - { os: 'ubuntu-20.04', build: cp312-musllinux_aarch64 }- - { os: 'ubuntu-20.04', build: cp313-manylinux_x86_64 }- - { os: 'ubuntu-20.04', build: cp313-manylinux_aarch64 }- # - { os: 'ubuntu-20.04', build: cp313-musllinux_x86_64 }- # - { os: 'ubuntu-20.04', build: cp313-musllinux_aarch64 }- - { os: 'ubuntu-20.04', build: cp313t-manylinux_x86_64 }- - { os: 'ubuntu-20.04', build: cp313t-manylinux_aarch64 }- # - { os: 'ubuntu-20.04', build: cp313t-musllinux_x86_64 }- # - { os: 'ubuntu-20.04', build: cp313t-musllinux_aarch64 }+ - { os: macos-13, build: cp312-macosx_universal2 }+ - { os: macos-13, build: cp39-macosx_arm64 }+ - { os: macos-13, build: cp310-macosx_arm64 }+ - { os: macos-13, build: cp311-macosx_arm64 }+ - { os: macos-13, build: cp312-macosx_arm64 }+ - { os: macos-13, build: cp313-macosx_arm64 }+ - { os: macos-13, build: cp313t-macosx_arm64 }+ # - { os: macos-13, build: pp38-macosx_x86_64 }+ # - { os: macos-13, build: pp39-macosx_x86_64 }+ # - { os: windows-latest, build: cp39-win_amd64 }+ # - { os: windows-latest, build: cp310-win_amd64 }+ # - { os: windows-latest, build: cp311-win_amd64 }+ # - { os: windows-latest, build: cp312-win_amd64 }+ # - { os: windows-latest, build: cp313-win_amd64 }+ # # - { os: windows-latest, build: cp313t-win_amd64 }+ # - { os: windows-latest, build: cp312-win32 }+ - { os: 'ubuntu-24.04', build: cp39-manylinux_x86_64 }+ - { os: 'ubuntu-24.04', build: cp39-manylinux_aarch64 }+ # - { os: 'ubuntu-24.04', build: cp39-musllinux_x86_64 }+ # - { os: 'ubuntu-24.04', build: cp39-musllinux_aarch64 }+ - { os: 'ubuntu-24.04', build: cp310-manylinux_x86_64 }+ - { os: 'ubuntu-24.04', build: cp310-manylinux_aarch64 }+ - { os: 'ubuntu-24.04', build: cp310-musllinux_x86_64 }+ - { os: 'ubuntu-24.04', build: cp310-musllinux_aarch64 }+ - { os: 'ubuntu-24.04', build: cp311-manylinux_x86_64 }+ - { os: 'ubuntu-24.04', build: cp311-manylinux_aarch64 }+ # - { os: 'ubuntu-24.04', build: cp311-musllinux_x86_64 }+ # - { os: 'ubuntu-24.04', build: cp311-musllinux_aarch64 }+ - { os: 'ubuntu-24.04', build: cp312-manylinux_x86_64 }+ - { os: 'ubuntu-24.04', build: cp312-manylinux_aarch64 }+ - { os: 'ubuntu-24.04', build: cp312-musllinux_x86_64 }+ - { os: 'ubuntu-24.04', build: cp312-musllinux_aarch64 }+ - { os: 'ubuntu-24.04', build: cp313-manylinux_x86_64 }+ - { os: 'ubuntu-24.04', build: cp313-manylinux_aarch64 }+ # - { os: 'ubuntu-24.04', build: cp313-musllinux_x86_64 }+ # - { os: 'ubuntu-24.04', build: cp313-musllinux_aarch64 }+ - { os: 'ubuntu-24.04', build: cp313t-manylinux_x86_64 }+ - { os: 'ubuntu-24.04', build: cp313t-manylinux_aarch64 }+ # - { os: 'ubuntu-24.04', build: cp313t-musllinux_x86_64 }+ # - { os: 'ubuntu-24.04', build: cp313t-musllinux_aarch64 }name: Build wheel for ${{ matrix.build }}steps:- uses: actions/checkout@v4@@ -746,7 +746,7 @@ jobs:# Used to host cibuildwheel, so version doesn't really matter- uses: actions/setup-python@v5with:- python-version: "3.10"+ python-version: "3.13"- name: Install cibuildwheelrun: python -m pip install 'cibuildwheel>=2.11.0'- name: Set up QEMU for aarch64 on Linux@@ -757,26 +757,11 @@ jobs:- name: Build wheelsrun: python -m cibuildwheel --output-dir wheelhouseenv:- CIBW_TEST_REQUIRES: -r test-requirements.txt- CIBW_TEST_COMMAND: "pytest {project}/tests"CIBW_BUILD: ${{ matrix.build }}- CIBW_ARCHS_WINDOWS: auto # Allow 32-bit Windows builds- CIBW_ARCHS_LINUX: auto64 aarch64 # Useful for building linux images with Apple Silicon- CIBW_ARCHS_MACOS: x86_64 arm64 universal2 # Support Apple Silicon# on macOS and with Python 3.10: building NumPy from source fails without these options:CIBW_ENVIRONMENT: NPY_BLAS_ORDER="" NPY_LAPACK_ORDER="" CIBW_BUILD="${{ matrix.build }}"- CIBW_REPAIR_WHEEL_COMMAND_LINUX: pip install auditwheel-symbols && (auditwheel repair -w {dest_dir} {wheel} || auditwheel-symbols --manylinux 2010 {wheel})- # The manylinux container doesn't have a new enough glibc version,- # so we can't run post-wheel-build tests there.- # The musllinux containers on aarch64 take 6+ hours to test.- # Also testing any pypy versions fails, as TensorFlow isn't pypy compatible.- CIBW_TEST_SKIP: "*manylinux* *musllinux_aarch* *pp* *-macosx_universal2:arm64"- CIBW_PRERELEASE_PYTHONS: "1"# Use the minimum macOS deployment target supported by our version of PyBind:MACOSX_DEPLOYMENT_TARGET: "10.14"- CIBW_MUSLLINUX_X86_64_IMAGE: quay.io/pypa/musllinux_1_1_x86_64:2024-04-29-07d05a0- CIBW_MUSLLINUX_AARCH64_IMAGE: quay.io/pypa/musllinux_1_1_aarch64:2024-04-29-07d05a0- CIBW_FREE_THREADED_SUPPORT: "1"- uses: actions/upload-artifact@v4with:name: wheel-${{ matrix.build }}@@ -794,7 +779,7 @@ jobs:upload-pypi:needs: [merge, run-tests-with-address-sanitizer, run-tests]- runs-on: 'ubuntu-20.04'+ runs-on: 'ubuntu-24.04'name: "Upload wheels to PyPI"if: github.event_name == 'release' && github.event.action == 'published'steps:diff --git a/CMakeLists.txt b/CMakeLists.txtnew file mode 100644index 0000000..91dc0a8--- /dev/null+++ b/CMakeLists.txt@@ -0,0 +1,429 @@+cmake_minimum_required(VERSION 3.18...3.27)++# Warn if the user invokes CMake directly+if (NOT SKBUILD)+ message(WARNING "\+ This CMake file is meant to be executed using 'scikit-build-core'.+ Running it directly will almost certainly not produce the desired+ result. If you are a user trying to install this package, use the+ command below, which will install all necessary build dependencies,+ compile the package in an isolated environment, and then install it.+ =====================================================================+ $ pip install .+ =====================================================================+ If you are a software developer, and this is your own package, then+ it is usually much more efficient to install the build dependencies+ in your environment once and use the following command that avoids+ a costly creation of a new virtual environment at every compilation:+ =====================================================================+ $ pip install pybind11 scikit-build-core[pyproject]+ $ pip install --no-build-isolation -ve .+ =====================================================================+ You may optionally add -Ceditable.rebuild=true to auto-rebuild when+ the package is imported. Otherwise, you need to rerun the above+ after editing C++ files.")+endif()++++# Find Python and pybind11 first, as we need the interpreter+set(PYBIND11_FINDPYTHON ON)+find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)+find_package(pybind11 CONFIG REQUIRED)++message(STATUS "DEBUG: Python_FOUND: ${Python_FOUND}")+message(STATUS "DEBUG: Python_Interpreter_FOUND: ${Python_Interpreter_FOUND}")+message(STATUS "DEBUG: Python_Development_FOUND: ${Python_Development_FOUND}")+message(STATUS "DEBUG: Python_Development.Module_FOUND: ${Python_Development.Module_FOUND}")+message(STATUS "DEBUG: Python_LIBRARIES: ${Python_LIBRARIES}")+message(STATUS "DEBUG: Python_LIBRARY_DIRS: ${Python_LIBRARY_DIRS}")+message(STATUS "DEBUG: Python_INCLUDE_DIRS: ${Python_INCLUDE_DIRS}")+message(STATUS "DEBUG: Python_EXECUTABLE: ${Python_EXECUTABLE}")+message(STATUS "DEBUG: Python_VERSION: ${Python_VERSION}")++# TODO(psobot): This shouldn't be necessary, but our CI build fails on Windows without it.+if(WIN32 AND NOT DEFINED Python_LIBRARY)+ # Dynamically construct the Python_LIBRARY path using version info from find_package(Python)+ if (NOT Python_VERSION)+ message(FATAL_ERROR "Python_VERSION not set after find_package(Python). Cannot construct Python library path.")+ endif()++ # Split the version string into major, minor, and patch parts+ string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.(.+)" _ ${Python_VERSION})+ set(Python_VERSION_MAJOR ${CMAKE_MATCH_1})+ set(Python_VERSION_MINOR ${CMAKE_MATCH_2})+ set(Python_VERSION_PATCH ${CMAKE_MATCH_3})++ set(DYNAMIC_PYTHON_LIB_FILENAME "python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}.lib")+ set(EXPECTED_PYTHON_VERSION_DIR "C:/hostedtoolcache/windows/Python/${Python_VERSION}/x64/libs")+ set(Python_LIBRARY "${EXPECTED_PYTHON_VERSION_DIR}/${DYNAMIC_PYTHON_LIB_FILENAME}")++ message(STATUS "DEBUG: On Windows, constructed DYNAMIC_PYTHON_LIB_FILENAME: ${DYNAMIC_PYTHON_LIB_FILENAME}")+ message(STATUS "DEBUG: On Windows, constructed Python_LIBRARY path: ${Python_LIBRARY}")+endif()++# Set up ccache if available+find_program(CCACHE_PROGRAM ccache)+if(CCACHE_PROGRAM)+ set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")+ set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")+ message(STATUS "Using ccache: ${CCACHE_PROGRAM}")+endif()++# Extract version from pedalboard/version.py+execute_process(+ COMMAND ${CMAKE_COMMAND} -E echo "with open('pedalboard/version.py') as f: exec(f.read()); print(MAJOR, MINOR, PATCH, sep='.')"+ COMMAND ${Python_EXECUTABLE} -+ OUTPUT_VARIABLE PEDALBOARD_VERSION+ OUTPUT_STRIP_TRAILING_WHITESPACE+)++project(pedalboard+ VERSION ${PEDALBOARD_VERSION}+ LANGUAGES CXX C+ DESCRIPTION "A Python library for adding effects to audio."+)++# Global flags+set(CMAKE_CXX_STANDARD 17)+set(CMAKE_CXX_STANDARD_REQUIRED ON)+set(CMAKE_CXX_VISIBILITY_PRESET hidden)+set(CMAKE_POSITION_INDEPENDENT_CODE ON)++# Debug/Release configuration+option(DEBUG "Build with debug symbols" OFF)++if(DEBUG)+ add_compile_definitions(DEBUG=1 _DEBUG=1)+ add_compile_options(-O0 -g)+else()+ if(MSVC)+ add_compile_options(/Ox)+ else()+ add_compile_options(-O3)+ endif()+endif()++# Add flags based on compiler/platform+if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")+ add_compile_options(-Wall)+endif()++# Set up includes and library sources+set(ALL_INCLUDES+ "vendors/pybind11/include/"+ "JUCE/modules/"+ "JUCE/modules/juce_audio_processors/format_types/VST3_SDK/"+ "JUCE/modules/juce_audio_formats/codecs/"+ "vendors/"+ "vendors/libgsm/inc/"+ "vendors/lame/include/"+ "vendors/lame/libmp3lame/"+ "vendors/lame/"+)++# Add any paths containing subfolders that need to be included+file(GLOB GSM_INCLUDE_DIRS "vendors/libgsm/inc")+list(APPEND ALL_INCLUDES ${GSM_INCLUDE_DIRS})++# Platform-specific settings+if(APPLE)+ # macOS specific flags+ add_compile_definitions(MACOS=1 HAVE_VDSP=1)++ # MacOS Frameworks+ find_library(ACCELERATE_FRAMEWORK Accelerate REQUIRED)+ find_library(APPKIT_FRAMEWORK AppKit REQUIRED)+ find_library(AUDIOTOOLBOX_FRAMEWORK AudioToolbox REQUIRED)+ find_library(COCOA_FRAMEWORK Cocoa REQUIRED)+ find_library(COREAUDIO_FRAMEWORK CoreAudio REQUIRED)+ find_library(COREAUDIOKIT_FRAMEWORK CoreAudioKit REQUIRED)+ find_library(COREMIDI_FRAMEWORK CoreMIDI REQUIRED)+ find_library(FOUNDATION_FRAMEWORK Foundation REQUIRED)+ find_library(IOKIT_FRAMEWORK IOKit REQUIRED)+ find_library(QUARTZ_FRAMEWORK QuartzCore REQUIRED)+ find_library(WEBKIT_FRAMEWORK WebKit REQUIRED)++ set(MACOS_FRAMEWORKS+ ${ACCELERATE_FRAMEWORK}+ ${APPKIT_FRAMEWORK}+ ${AUDIOTOOLBOX_FRAMEWORK}+ ${COCOA_FRAMEWORK}+ ${COREAUDIO_FRAMEWORK}+ ${COREAUDIOKIT_FRAMEWORK}+ ${COREMIDI_FRAMEWORK}+ ${FOUNDATION_FRAMEWORK}+ ${IOKIT_FRAMEWORK}+ ${QUARTZ_FRAMEWORK}+ ${WEBKIT_FRAMEWORK}+ )++ add_compile_definitions(JUCE_PLUGINHOST_AU=1)++ # No threading code needed on macOS, vDSP does this for us+ add_compile_definitions(NO_THREADING)++ # File extension handling for Objective-C+++ list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".mm")+elseif(WIN32)+ # Windows specific flags+ add_compile_definitions(WINDOWS=1 USE_BUILTIN_FFT NO_THREADING)+ add_compile_definitions(JUCE_DLL_BUILD=1)++ # Windows-specific libraries+ list(APPEND PLATFORM_LIBRARIES+ kernel32 user32 gdi32 winspool comdlg32 advapi32 shell32+ ole32 oleaut32 uuid odbc32 odbccp32+ )+elseif(UNIX AND NOT APPLE)+ # Linux specific flags+ add_compile_definitions(LINUX=1)++ # FFTW support for Linux+ add_compile_definitions(+ HAVE_FFTW3=1+ LACK_SINCOS=1+ FFTW_DOUBLE_ONLY=1+ USE_PTHREADS+ )++ # Linux Dependencies+ find_package(PkgConfig REQUIRED)+ pkg_check_modules(FREETYPE REQUIRED freetype2)+ find_package(ALSA REQUIRED)++ include_directories(${FREETYPE_INCLUDE_DIRS})+ list(APPEND PLATFORM_LIBRARIES ${FREETYPE_LIBRARIES} ${ALSA_LIBRARIES})++ # Processor-specific optimizations (x86 vs ARM)+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|aarch64")+ add_compile_definitions(HAVE_NEON=1)+ else()+ add_compile_options(-march=native)+ add_compile_definitions(HAVE_AVX)+ endif()++ # Additional Linux flags+ list(APPEND ALL_INCLUDES "vendors/fftw3/api/" "vendors/fftw3/")+endif()++# JUCE-related flags+list(APPEND JUCE_COMPILE_DEFINITIONS+ JUCE_DISPLAY_SPLASH_SCREEN=1+ JUCE_USE_DARK_SPLASH_SCREEN=1+ JUCE_MODULE_AVAILABLE_juce_audio_basics=1+ JUCE_MODULE_AVAILABLE_juce_audio_formats=1+ JUCE_MODULE_AVAILABLE_juce_audio_processors=1+ JUCE_MODULE_AVAILABLE_juce_core=1+ JUCE_MODULE_AVAILABLE_juce_data_structures=1+ JUCE_MODULE_AVAILABLE_juce_dsp=1+ JUCE_MODULE_AVAILABLE_juce_events=1+ JUCE_MODULE_AVAILABLE_juce_graphics=1+ JUCE_MODULE_AVAILABLE_juce_gui_basics=1+ JUCE_MODULE_AVAILABLE_juce_gui_extra=1+ JUCE_MODULE_AVAILABLE_juce_audio_devices=1+ JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1+ JUCE_STRICT_REFCOUNTEDPOINTER=1+ JUCE_STANDALONE_APPLICATION=1+ JUCER_LINUX_MAKE_6D53C8B4=1+ JUCE_APP_VERSION=1.0.0+ JUCE_APP_VERSION_HEX=0x10000+ JucePlugin_Build_VST=0+ JucePlugin_Build_VST3=0+ JucePlugin_Build_AU=0+ JucePlugin_Build_AUv3=0+ JucePlugin_Build_RTAS=0+ JucePlugin_Build_AAX=0+ JucePlugin_Build_Standalone=0+ JucePlugin_Build_Unity=0+ JUCE_DISABLE_JUCE_VERSION_PRINTING=1+ JUCE_WEB_BROWSER=0+ JUCE_USE_CURL=0+ JUCE_USE_MP3AUDIOFORMAT=0+ JUCE_USE_FLAC=0+ JUCE_MODAL_LOOPS_PERMITTED=1+)++if(DEFINED ENV{CIBW_BUILD} AND "$ENV{CIBW_BUILD}" MATCHES "musllinux")+ # For Alpine/musllinux compatibility:+ add_compile_definitions(+ _NL_IDENTIFICATION_LANGUAGE=0x42+ _NL_IDENTIFICATION_TERRITORY=0x43+ )+endif()++# Rubber Band library flags+list(APPEND RUBBERBAND_COMPILE_DEFINITIONS+ USE_BQRESAMPLER=1+ _HAS_STD_BYTE=0+ NOMINMAX+ ALREADY_CONFIGURED+)++# Helper function to collect source files+function(collect_sources)+ # Collect all C++ source files+ file(GLOB_RECURSE CPP_SOURCES "pedalboard/*.cpp")++ # Handle platform-specific sources+ if(APPLE)+ file(GLOB_RECURSE OBJC_SOURCES "pedalboard/*.mm")+ # Exclude specific files that shouldn't be compiled directly+ list(FILTER OBJC_SOURCES EXCLUDE REGEX ".*juce_mac_PatchedWindowing\\.mm$")++ foreach(OBJC_SOURCE ${OBJC_SOURCES})+ get_filename_component(BASENAME ${OBJC_SOURCE} NAME_WE)+ list(FILTER CPP_SOURCES EXCLUDE REGEX ".*/${BASENAME}\\.cpp$")+ endforeach()+ list(APPEND CPP_SOURCES ${OBJC_SOURCES})+ endif()++ # We explicitly patch include_juce_gui_basics.{mm,cpp} with juce_patched_gui_basics.cpp,+ # so remove the latter from the list of C++ sources+ list(FILTER CPP_SOURCES EXCLUDE REGEX ".*juce_patched_gui_basics\\.cpp$")++ # Collect RubberBand sources+ file(GLOB RUBBERBAND_SOURCES "vendors/rubberband/single/*.cpp")++ # Collect general vendor sources+ file(GLOB VENDOR_SOURCES "vendors/*.c")++ # LAME/mpglib sources+ file(GLOB LAME_SOURCES "vendors/lame/libmp3lame/*.c" "vendors/lame/libmp3lame/vector/*.c" "vendors/lame/mpglib/*.c")++ # libgsm sources (excluding toast files)+ file(GLOB GSM_SOURCES "vendors/libgsm/src/*.c")+ list(FILTER GSM_SOURCES EXCLUDE REGEX ".*toast.*")++ # FFTW sources for Linux+ if(UNIX AND NOT APPLE AND NOT DEFINED CIBW_BUILD OR NOT CIBW_BUILD MATCHES "musllinux")+ file(GLOB_RECURSE FFTW_SOURCES "vendors/fftw3/*.c")++ # Exclude files depending on architecture+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm|aarch64")+ list(FILTER FFTW_SOURCES EXCLUDE REGEX ".*(avx|/sse).*")+ else()+ list(FILTER FFTW_SOURCES EXCLUDE REGEX ".*neon.*")+ endif()++ # Exclude unused FFTW components+ list(FILTER FFTW_SOURCES EXCLUDE REGEX ".*(altivec|vsx|mpi|threads|tests|tools|/support|common/|libbench|sse2|avx2|avx512|kcvi|avx-128-fma|generic-simd).*")+ endif()++ # Combine all sources+ set(ALL_SOURCES+ ${CPP_SOURCES}+ ${RUBBERBAND_SOURCES}+ ${VENDOR_SOURCES}+ ${LAME_SOURCES}+ ${GSM_SOURCES}+ ${FFTW_SOURCES}+ PARENT_SCOPE+ )+endfunction()++# Call the function to collect all source files+collect_sources()++# Create the Python module+pybind11_add_module(pedalboard_native ${ALL_SOURCES})++# Add include directories+target_include_directories(pedalboard_native PRIVATE ${ALL_INCLUDES})++if(APPLE)+ # Objective-C++ support for macOS, but only when compiling C++, not C:+ target_compile_options(pedalboard_native PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-xobjective-c++>)+endif()++# Add JUCE and other compile definitions+target_compile_definitions(pedalboard_native PRIVATE ${JUCE_COMPILE_DEFINITIONS})+target_compile_definitions(pedalboard_native PRIVATE ${RUBBERBAND_COMPILE_DEFINITIONS})++# LAME config+if(WIN32)+ target_compile_definitions(pedalboard_native PRIVATE+ HAVE_MPGLIB+ HAVE_XMMINTRIN_H+ )+ target_compile_options(pedalboard_native PRIVATE+ "/FI${CMAKE_CURRENT_SOURCE_DIR}/vendors/lame_config.h"+ )+else()+ target_compile_definitions(pedalboard_native PRIVATE+ HAVE_MPGLIB+ )+ target_compile_options(pedalboard_native PRIVATE+ "-include${CMAKE_CURRENT_SOURCE_DIR}/vendors/lame_config.h"+ )+endif()++# Link libraries+if(APPLE)+ target_link_libraries(pedalboard_native PRIVATE ${MACOS_FRAMEWORKS})+elseif(WIN32)+ target_link_libraries(pedalboard_native PRIVATE ${PLATFORM_LIBRARIES})+ # Link Python libraries+ if(Python_LIBRARIES)+ # This is the ideal case, FindPython worked as expected.+ message(STATUS "DEBUG: Linking against Python_LIBRARIES: ${Python_LIBRARIES}")+ target_link_libraries(pedalboard_native PRIVATE ${Python_LIBRARIES})+ elseif(DEFINED Python_LIBRARY AND EXISTS "${Python_LIBRARY}")+ # Fallback: Python_LIBRARIES is empty, but we have an explicit Python_LIBRARY path.+ message(STATUS "DEBUG: Python_LIBRARIES is empty. Linking directly against Python_LIBRARY: ${Python_LIBRARY}")+ target_link_libraries(pedalboard_native PRIVATE "${Python_LIBRARY}")+ else()+ # Critical error: No way to link Python library on Windows.+ message(FATAL_ERROR "DEBUG: On Windows, Python_LIBRARIES is empty AND Python_LIBRARY is not set or path does not exist ('${Python_LIBRARY}'). Cannot link Python.")+ endif()+elseif(UNIX AND NOT APPLE)+ # Add libatomic for atomic operations on Linux+ target_link_libraries(pedalboard_native PRIVATE ${PLATFORM_LIBRARIES} atomic)++ # Add missing FFTW-specific C flags for Linux+ target_compile_options(pedalboard_native PRIVATE+ $<$<COMPILE_LANGUAGE:C>:+ -DHAVE_UINTPTR_T+ -DPACKAGE="FFTW"+ -DVERSION="0"+ -DPACKAGE_VERSION="00000"+ -DFFTW_CC="clang"+ "-includestring.h"+ "-includestdint.h"+ "-include${CMAKE_CURRENT_SOURCE_DIR}/vendors/fftw3/dft/codelet-dft.h"+ "-include${CMAKE_CURRENT_SOURCE_DIR}/vendors/fftw3/rdft/codelet-rdft.h"+ "-includesys/time.h"+ -DHAVE_INTTYPES_H+ -DHAVE_STDINT_H+ -DHAVE_STDLIB_H+ -DHAVE_STRING_H+ -DHAVE_TIME_H+ -DHAVE_SYS_TIME_H=1+ -DHAVE_UNISTD_H+ -DHAVE_DECL_DRAND48+ -DHAVE_DECL_SRAND48+ -DHAVE_DECL_COSL+ -DHAVE_DECL_SINL+ -DHAVE_DECL_POSIX_MEMALIGN+ -DHAVE_DRAND48+ -DHAVE_SRAND48+ -DHAVE_POSIX_MEMALIGN+ -DHAVE_ISNAN+ -DHAVE_SNPRINTF+ -DHAVE_STRCHR+ -DHAVE_SYSCTL+ -DHAVE_GETTIMEOFDAY>+ )+endif()++# Add LTO if not debugging and not explicitly disabled+if(NOT DEBUG AND NOT DEFINED ENV{DISABLE_LTO})+ include(CheckIPOSupported)+ check_ipo_supported(RESULT HAVE_IPO)+ if(HAVE_IPO)+ set_property(TARGET pedalboard_native PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)+ endif()+endif()++# Install targets+install(TARGETS pedalboard_native DESTINATION .)diff --git a/pedalboard/juce_overrides/include_juce_gui_basics.cpp b/pedalboard/juce_overrides/include_juce_gui_basics.cppindex 263bcb6..22cb022 100644--- a/pedalboard/juce_overrides/include_juce_gui_basics.cpp+++ b/pedalboard/juce_overrides/include_juce_gui_basics.cpp@@ -1 +1 @@-#include <juce_gui_basics/juce_gui_basics.cpp>+#include "./juce_patched_gui_basics.cpp"diff --git a/pedalboard/juce_overrides/include_juce_gui_basics.mm b/pedalboard/juce_overrides/include_juce_gui_basics.mmindex 802cf1f..22cb022 100644--- a/pedalboard/juce_overrides/include_juce_gui_basics.mm+++ b/pedalboard/juce_overrides/include_juce_gui_basics.mm@@ -1 +1 @@-#include <juce_gui_basics/juce_gui_basics.mm>+#include "./juce_patched_gui_basics.cpp"diff --git a/pedalboard/juce_overrides/juce_mac_PatchedWindowing.mm b/pedalboard/juce_overrides/juce_mac_PatchedWindowing.mmnew file mode 100644index 0000000..573977f--- /dev/null+++ b/pedalboard/juce_overrides/juce_mac_PatchedWindowing.mm@@ -0,0 +1,685 @@+/*+ ==============================================================================++ This file is part of the JUCE library.+ Copyright (c) 2020 - Raw Material Software Limited++ JUCE is an open source library subject to commercial or open-source+ licensing.++ By using JUCE, you agree to the terms of both the JUCE 6 End-User License+ Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).++ End User License Agreement: www.juce.com/juce-6-licence+ Privacy Policy: www.juce.com/juce-privacy-policy++ Or: You may also use this code under the terms of the GPL v3 (see+ www.gnu.org/licenses).++ JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER+ EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE+ DISCLAIMED.++ ==============================================================================+*/++namespace juce {++void LookAndFeel::playAlertSound() { NSBeep(); }++//==============================================================================+class OSXMessageBox : private AsyncUpdater {+public:+ OSXMessageBox(const MessageBoxOptions &opts,+ std::unique_ptr<ModalComponentManager::Callback> &&c)+ : options(opts), callback(std::move(c)) {}++ int getResult() const {+ switch (getRawResult()) {+ case NSAlertFirstButtonReturn:+ return 0;+ case NSAlertSecondButtonReturn:+ return 1;+ case NSAlertThirdButtonReturn:+ return 2;+ default:+ break;+ }++ jassertfalse;+ return 0;+ }++ using AsyncUpdater::triggerAsyncUpdate;++private:+ void handleAsyncUpdate() override {+ auto result = getResult();++ if (callback != nullptr)+ callback->modalStateFinished(result);++ delete this;+ }++ static void addButton(NSAlert *alert, const String &button) {+ if (!button.isEmpty())+ [alert addButtonWithTitle:juceStringToNS(button)];+ }++ NSInteger getRawResult() const {+ NSAlert *alert = [[[NSAlert alloc] init] autorelease];++ [alert setMessageText:juceStringToNS(options.getTitle())];+ [alert setInformativeText:juceStringToNS(options.getMessage())];++ [alert+ setAlertStyle:options.getIconType() == MessageBoxIconType::WarningIcon+ ? NSAlertStyleCritical+ : NSAlertStyleInformational];++ const auto button1Text = options.getButtonText(0);++ addButton(alert, button1Text.isEmpty() ? "OK" : button1Text);+ addButton(alert, options.getButtonText(1));+ addButton(alert, options.getButtonText(2));++ return [alert runModal];+ }++ MessageBoxOptions options;+ std::unique_ptr<ModalComponentManager::Callback> callback;++ JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(OSXMessageBox)+};++static int showDialog(const MessageBoxOptions &options,+ ModalComponentManager::Callback *callbackIn,+ AlertWindowMappings::MapFn mapFn) {+#if JUCE_MODAL_LOOPS_PERMITTED+ if (callbackIn == nullptr) {+ jassert(mapFn != nullptr);++ OSXMessageBox messageBox(options, nullptr);+ return mapFn(messageBox.getResult());+ }+#endif++ auto messageBox = std::make_unique<OSXMessageBox>(+ options, AlertWindowMappings::getWrappedCallback(callbackIn, mapFn));++ messageBox->triggerAsyncUpdate();+ messageBox.release();++ return 0;+}++#if JUCE_MODAL_LOOPS_PERMITTED+void JUCE_CALLTYPE NativeMessageBox::showMessageBox(+ MessageBoxIconType iconType, const String &title, const String &message,+ Component * /*associatedComponent*/) {+ showDialog(MessageBoxOptions()+ .withIconType(iconType)+ .withTitle(title)+ .withMessage(message)+ .withButton(TRANS("OK")),+ nullptr, AlertWindowMappings::messageBox);+}++int JUCE_CALLTYPE NativeMessageBox::show(const MessageBoxOptions &options) {+ return showDialog(options, nullptr, AlertWindowMappings::noMapping);+}+#endif++void JUCE_CALLTYPE NativeMessageBox::showMessageBoxAsync(+ MessageBoxIconType iconType, const String &title, const String &message,+ Component * /*associatedComponent*/,+ ModalComponentManager::Callback *callback) {+ showDialog(MessageBoxOptions()+ .withIconType(iconType)+ .withTitle(title)+ .withMessage(message)+ .withButton(TRANS("OK")),+ callback, AlertWindowMappings::messageBox);+}++bool JUCE_CALLTYPE NativeMessageBox::showOkCancelBox(+ MessageBoxIconType iconType, const String &title, const String &message,+ Component * /*associatedComponent*/,+ ModalComponentManager::Callback *callback) {+ return showDialog(MessageBoxOptions()+ .withIconType(iconType)+ .withTitle(title)+ .withMessage(message)+ .withButton(TRANS("OK"))+ .withButton(TRANS("Cancel")),+ callback, AlertWindowMappings::okCancel) != 0;+}++int JUCE_CALLTYPE NativeMessageBox::showYesNoCancelBox(+ MessageBoxIconType iconType, const String &title, const String &message,+ Component * /*associatedComponent*/,+ ModalComponentManager::Callback *callback) {+ return showDialog(MessageBoxOptions()+ .withIconType(iconType)+ .withTitle(title)+ .withMessage(message)+ .withButton(TRANS("Yes"))+ .withButton(TRANS("No"))+ .withButton(TRANS("Cancel")),+ callback, AlertWindowMappings::yesNoCancel);+}++int JUCE_CALLTYPE NativeMessageBox::showYesNoBox(+ MessageBoxIconType iconType, const String &title, const String &message,+ Component * /*associatedComponent*/,+ ModalComponentManager::Callback *callback) {+ return showDialog(MessageBoxOptions()+ .withIconType(iconType)+ .withTitle(title)+ .withMessage(message)+ .withButton(TRANS("Yes"))+ .withButton(TRANS("No")),+ callback, AlertWindowMappings::okCancel);+}++void JUCE_CALLTYPE+NativeMessageBox::showAsync(const MessageBoxOptions &options,+ ModalComponentManager::Callback *callback) {+ showDialog(options, callback, AlertWindowMappings::noMapping);+}++void JUCE_CALLTYPE NativeMessageBox::showAsync(+ const MessageBoxOptions &options, std::function<void(int)> callback) {+ showAsync(options, ModalCallbackFunction::create(callback));+}++//==============================================================================+static NSRect getDragRect(NSView *view, NSEvent *event) {+ auto eventPos = [event locationInWindow];++ return [view convertRect:NSMakeRect(eventPos.x - 16.0f, eventPos.y - 16.0f,+ 32.0f, 32.0f)+ fromView:nil];+}++static NSView *getNSViewForDragEvent(Component *sourceComp) {+ if (sourceComp == nullptr)+ if (auto *draggingSource = Desktop::getInstance().getDraggingMouseSource(0))+ sourceComp = draggingSource->getComponentUnderMouse();++ if (sourceComp != nullptr)+ return (NSView *)sourceComp->getWindowHandle();++ jassertfalse; // This method must be called in response to a component's+ // mouseDown or mouseDrag event!+ return nil;+}++struct NSDraggingSourceHelper : public ObjCClass<NSObject<NSDraggingSource>> {+ NSDraggingSourceHelper()+ : ObjCClass<NSObject<NSDraggingSource>>("JUCENSDraggingSourceHelper_") {+ addIvar<std::function<void()> *>("callback");+ addIvar<String *>("text");+ addIvar<NSDragOperation *>("operation");++ addMethod(@selector(dealloc), dealloc);+ addMethod(@selector(pasteboard:item:provideDataForType:),+ provideDataForType);++ addMethod(@selector(draggingSession:sourceOperationMaskForDraggingContext:),+ sourceOperationMaskForDraggingContext);+ addMethod(@selector(draggingSession:endedAtPoint:operation:),+ draggingSessionEnded);++ addProtocol(@protocol(NSPasteboardItemDataProvider));++ registerClass();+ }++ static void setText(id self, const String &text) {+ object_setInstanceVariable(self, "text", new String(text));+ }++ static void setCompletionCallback(id self, std::function<void()> cb) {+ object_setInstanceVariable(self, "callback", new std::function<void()>(cb));+ }++ static void setDragOperation(id self, NSDragOperation op) {+ object_setInstanceVariable(self, "operation", new NSDragOperation(op));+ }++private:+ static void dealloc(id self, SEL) {+ delete getIvar<String *>(self, "text");+ delete getIvar<std::function<void()> *>(self, "callback");+ delete getIvar<NSDragOperation *>(self, "operation");++ sendSuperclassMessage<void>(self, @selector(dealloc));+ }++ static void provideDataForType(id self, SEL, NSPasteboard *sender,+ NSPasteboardItem *, NSString *type) {+ if ([type compare:NSPasteboardTypeString] == NSOrderedSame)+ if (auto *text = getIvar<String *>(self, "text"))+ [sender setData:[juceStringToNS(*text)+ dataUsingEncoding:NSUTF8StringEncoding]+ forType:NSPasteboardTypeString];+ }++ static NSDragOperation+ sourceOperationMaskForDraggingContext(id self, SEL, NSDraggingSession *,+ NSDraggingContext) {+ return *getIvar<NSDragOperation *>(self, "operation");+ }++ static void draggingSessionEnded(id self, SEL, NSDraggingSession *, NSPoint p,+ NSDragOperation) {+ // Our view doesn't receive a mouse up when the drag ends so we need to+ // generate one here and send it...+ if (auto *view = getNSViewForDragEvent(nullptr))+ if (auto *cgEvent = CGEventCreateMouseEvent(nullptr, kCGEventLeftMouseUp,+ CGPointMake(p.x, p.y),+ kCGMouseButtonLeft))+ if (id e = [NSEvent eventWithCGEvent:cgEvent])+ [view mouseUp:e];++ if (auto *cb = getIvar<std::function<void()> *>(self, "callback"))+ cb->operator()();+ }+};++static NSDraggingSourceHelper draggingSourceHelper;++bool DragAndDropContainer::performExternalDragDropOfText(+ const String &text, Component *sourceComponent,+ std::function<void()> callback) {+ if (text.isEmpty())+ return false;++ if (auto *view = getNSViewForDragEvent(sourceComponent)) {+ JUCE_AUTORELEASEPOOL {+ if (auto event = [[view window] currentEvent]) {+ id helper = [draggingSourceHelper.createInstance() init];+ NSDraggingSourceHelper::setText(helper, text);+ NSDraggingSourceHelper::setDragOperation(helper, NSDragOperationCopy);++ if (callback != nullptr)+ NSDraggingSourceHelper::setCompletionCallback(helper, callback);++ auto pasteboardItem = [[NSPasteboardItem new] autorelease];+ [pasteboardItem+ setDataProvider:helper+ forTypes:[NSArray+ arrayWithObjects:NSPasteboardTypeString, nil]];++ auto dragItem = [[[NSDraggingItem alloc]+ initWithPasteboardWriter:pasteboardItem] autorelease];++ NSImage *image =+ [[NSWorkspace sharedWorkspace] iconForFile:nsEmptyString()];+ [dragItem setDraggingFrame:getDragRect(view, event) contents:image];++ if (auto session = [view+ beginDraggingSessionWithItems:[NSArray arrayWithObject:dragItem]+ event:event+ source:helper]) {+ session.animatesToStartingPositionsOnCancelOrFail = YES;+ session.draggingFormation = NSDraggingFormationNone;++ return true;+ }+ }+ }+ }++ return false;+}++bool DragAndDropContainer::performExternalDragDropOfFiles(+ const StringArray &files, bool canMoveFiles, Component *sourceComponent,+ std::function<void()> callback) {+ if (files.isEmpty())+ return false;++ if (auto *view = getNSViewForDragEvent(sourceComponent)) {+ JUCE_AUTORELEASEPOOL {+ if (auto event = [[view window] currentEvent]) {+ auto dragItems = [[[NSMutableArray alloc] init] autorelease];++ for (auto &filename : files) {+ auto *nsFilename = juceStringToNS(filename);+ auto fileURL = [NSURL fileURLWithPath:nsFilename];+ auto dragItem =+ [[NSDraggingItem alloc] initWithPasteboardWriter:fileURL];++ auto eventPos = [event locationInWindow];+ auto dragRect =+ [view convertRect:NSMakeRect(eventPos.x - 16.0f,+ eventPos.y - 16.0f, 32.0f, 32.0f)+ fromView:nil];+ auto dragImage =+ [[NSWorkspace sharedWorkspace] iconForFile:nsFilename];+ [dragItem setDraggingFrame:dragRect contents:dragImage];++ [dragItems addObject:dragItem];+ [dragItem release];+ }++ auto helper = [draggingSourceHelper.createInstance() autorelease];++ if (callback != nullptr)+ NSDraggingSourceHelper::setCompletionCallback(helper, callback);++ NSDraggingSourceHelper::setDragOperation(+ helper, canMoveFiles ? NSDragOperationMove : NSDragOperationCopy);++ return [view beginDraggingSessionWithItems:dragItems+ event:event+ source:helper] != nullptr;+ }+ }+ }++ return false;+}++//==============================================================================+bool Desktop::canUseSemiTransparentWindows() noexcept { return true; }++Point<float> MouseInputSource::getCurrentRawMousePosition() {+ JUCE_AUTORELEASEPOOL {+ auto p = [NSEvent mouseLocation];+ return {(float)p.x, (float)(getMainScreenHeight() - p.y)};+ }+}++void MouseInputSource::setRawMousePosition(Point<float> newPosition) {+ // this rubbish needs to be done around the warp call, to avoid causing a+ // bizarre glitch..+ CGAssociateMouseAndMouseCursorPosition(false);+ CGWarpMouseCursorPosition(convertToCGPoint(newPosition));+ CGAssociateMouseAndMouseCursorPosition(true);+}++double Desktop::getDefaultMasterScale() { return 1.0; }++Desktop::DisplayOrientation Desktop::getCurrentOrientation() const {+ return upright;+}++bool Desktop::isDarkModeActive() const {+ return [[[NSUserDefaults standardUserDefaults]+ stringForKey:nsStringLiteral("AppleInterfaceStyle")]+ isEqualToString:nsStringLiteral("Dark")];+}++class Desktop::NativeDarkModeChangeDetectorImpl {+public:+ NativeDarkModeChangeDetectorImpl() {+ static DelegateClass delegateClass;++ delegate = [delegateClass.createInstance() init];+ object_setInstanceVariable(delegate, "owner", this);++ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE("-Wundeclared-selector")+ [[NSDistributedNotificationCenter defaultCenter]+ addObserver:delegate+ selector:@selector(darkModeChanged:)+ name:@"AppleInterfaceThemeChangedNotification"+ object:nil];+ JUCE_END_IGNORE_WARNINGS_GCC_LIKE+ }++ ~NativeDarkModeChangeDetectorImpl() {+ object_setInstanceVariable(delegate, "owner", nullptr);+ [[NSDistributedNotificationCenter defaultCenter] removeObserver:delegate];+ [delegate release];+ }++ void darkModeChanged() { Desktop::getInstance().darkModeChanged(); }++private:+ struct DelegateClass : public ObjCClass<NSObject> {+ DelegateClass() : ObjCClass<NSObject>("JUCEDelegate_") {+ addIvar<NativeDarkModeChangeDetectorImpl *>("owner");++ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE("-Wundeclared-selector")+ addMethod(@selector(darkModeChanged:), darkModeChanged);+ JUCE_END_IGNORE_WARNINGS_GCC_LIKE++ registerClass();+ }++ static void darkModeChanged(id self, SEL, NSNotification *) {+ if (auto *owner =+ getIvar<NativeDarkModeChangeDetectorImpl *>(self, "owner"))+ owner->darkModeChanged();+ }+ };++ id delegate = nil;++ JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(NativeDarkModeChangeDetectorImpl)+};++std::unique_ptr<Desktop::NativeDarkModeChangeDetectorImpl>+Desktop::createNativeDarkModeChangeDetectorImpl() {+ return std::make_unique<NativeDarkModeChangeDetectorImpl>();+}++//==============================================================================+class ScreenSaverDefeater : public Timer {+public:+ ScreenSaverDefeater() {+ startTimer(5000);+ timerCallback();+ }++ void timerCallback() override {+ if (Process::isForegroundProcess()) {+ if (assertion == nullptr)+ assertion.reset(new PMAssertion());+ } else {+ assertion.reset();+ }+ }++ struct PMAssertion {+ PMAssertion() : assertionID(kIOPMNullAssertionID) {+ IOReturn res = IOPMAssertionCreateWithName(+ kIOPMAssertionTypePreventUserIdleDisplaySleep, kIOPMAssertionLevelOn,+ CFSTR("JUCE Playback"), &assertionID);+ jassert(res == kIOReturnSuccess);+ ignoreUnused(res);+ }++ ~PMAssertion() {+ if (assertionID != kIOPMNullAssertionID)+ IOPMAssertionRelease(assertionID);+ }++ IOPMAssertionID assertionID;+ };++ std::unique_ptr<PMAssertion> assertion;+};++static std::unique_ptr<ScreenSaverDefeater> screenSaverDefeater;++void Desktop::setScreenSaverEnabled(const bool isEnabled) {+ if (isEnabled)+ screenSaverDefeater.reset();+ else if (screenSaverDefeater == nullptr)+ screenSaverDefeater.reset(new ScreenSaverDefeater());+}++bool Desktop::isScreenSaverEnabled() { return screenSaverDefeater == nullptr; }++//==============================================================================+struct DisplaySettingsChangeCallback : private DeletedAtShutdown {+ DisplaySettingsChangeCallback() {+ CGDisplayRegisterReconfigurationCallback(displayReconfigurationCallback,+ this);+ }++ ~DisplaySettingsChangeCallback() {+ CGDisplayRemoveReconfigurationCallback(displayReconfigurationCallback,+ this);+ clearSingletonInstance();+ }++ static void displayReconfigurationCallback(CGDirectDisplayID,+ CGDisplayChangeSummaryFlags,+ void *userInfo) {+ if (auto *thisPtr = static_cast<DisplaySettingsChangeCallback *>(userInfo))+ if (thisPtr->forceDisplayUpdate != nullptr)+ thisPtr->forceDisplayUpdate();+ }++ std::function<void()> forceDisplayUpdate;++ JUCE_DECLARE_SINGLETON(DisplaySettingsChangeCallback, false)+ JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DisplaySettingsChangeCallback)+};++JUCE_IMPLEMENT_SINGLETON(DisplaySettingsChangeCallback)++static Rectangle<int> convertDisplayRect(NSRect r, CGFloat mainScreenBottom) {+ r.origin.y = mainScreenBottom - (r.origin.y + r.size.height);+ return convertToRectInt(r);+}++static Displays::Display getDisplayFromScreen(NSScreen *s,+ CGFloat &mainScreenBottom,+ const float masterScale) {+ Displays::Display d;++ d.isMain = (mainScreenBottom == 0);++ if (d.isMain)+ mainScreenBottom = [s frame].size.height;++ d.userArea =+ convertDisplayRect([s visibleFrame], mainScreenBottom) / masterScale;+ d.totalArea = convertDisplayRect([s frame], mainScreenBottom) / masterScale;+ d.scale = masterScale;++ if ([s respondsToSelector:@selector(backingScaleFactor)])+ d.scale *= s.backingScaleFactor;++ NSSize dpi =+ [[[s deviceDescription] objectForKey:NSDeviceResolution] sizeValue];+ d.dpi = (dpi.width + dpi.height) / 2.0;++ return d;+}++void Displays::findDisplays(const float masterScale) {+ JUCE_AUTORELEASEPOOL {+ if (DisplaySettingsChangeCallback::getInstanceWithoutCreating() == nullptr)+ DisplaySettingsChangeCallback::getInstance()->forceDisplayUpdate =+ [this] { refresh(); };++ CGFloat mainScreenBottom = 0;++ for (NSScreen *s in [NSScreen screens])+ displays.add(getDisplayFromScreen(s, mainScreenBottom, masterScale));+ }+}++//==============================================================================+bool juce_areThereAnyAlwaysOnTopWindows() {+ for (NSWindow *window in [NSApp windows])+ if ([window level] > NSNormalWindowLevel)+ return true;++ return false;+}++//==============================================================================+static void selectImageForDrawing(const Image &image) {+ [NSGraphicsContext saveGraphicsState];++ if (@available(macOS 10.10, *)) {+ [NSGraphicsContext+ setCurrentContext:[NSGraphicsContext+ graphicsContextWithCGContext:juce_getImageContext(+ image)+ flipped:false]];+ return;+ }++ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE("-Wdeprecated-declarations")+ [NSGraphicsContext+ setCurrentContext:+ [NSGraphicsContext+ graphicsContextWithGraphicsPort:juce_getImageContext(image)+ flipped:false]];+ JUCE_END_IGNORE_WARNINGS_GCC_LIKE+}++static void releaseImageAfterDrawing() {+ [[NSGraphicsContext currentContext] flushGraphics];+ [NSGraphicsContext restoreGraphicsState];+}++Image juce_createIconForFile(const File &file) {+ JUCE_AUTORELEASEPOOL {+ NSImage *image = [[NSWorkspace sharedWorkspace]+ iconForFile:juceStringToNS(file.getFullPathName())];++ Image result(Image::ARGB, (int)[image size].width, (int)[image size].height,+ true);++ selectImageForDrawing(result);+ [image drawAtPoint:NSMakePoint(0, 0)+ fromRect:NSMakeRect(0, 0, [image size].width, [image size].height)+ operation:NSCompositingOperationSourceOver+ fraction:1.0f];+ releaseImageAfterDrawing();++ return result;+ }+}++// Disabled as this is unused by Pedalboard and not supported on Sequoia++static Image createNSWindowSnapshot(NSWindow *nsWindow) { return {}; }++Image createSnapshotOfNativeWindow(void *nativeWindowHandle) {+ if (id windowOrView = (id)nativeWindowHandle) {+ if ([windowOrView isKindOfClass:[NSWindow class]])+ return createNSWindowSnapshot((NSWindow *)windowOrView);++ if ([windowOrView isKindOfClass:[NSView class]])+ return createNSWindowSnapshot([(NSView *)windowOrView window]);+ }++ return {};+}++//==============================================================================+void SystemClipboard::copyTextToClipboard(const String &text) {+ NSPasteboard *pb = [NSPasteboard generalPasteboard];++ [pb declareTypes:[NSArray arrayWithObject:NSPasteboardTypeString] owner:nil];++ [pb setString:juceStringToNS(text) forType:NSPasteboardTypeString];+}++String SystemClipboard::getTextFromClipboard() {+ return nsStringToJuce(+ [[NSPasteboard generalPasteboard] stringForType:NSPasteboardTypeString]);+}++void Process::setDockIconVisible(bool isVisible) {+ ProcessSerialNumber psn{0, kCurrentProcess};++ OSStatus err = TransformProcessType(+ &psn, isVisible ? kProcessTransformToForegroundApplication+ : kProcessTransformToUIElementApplication);+ jassert(err == 0);+ ignoreUnused(err);+}++} // namespace jucediff --git a/pedalboard/juce_overrides/juce_patched_gui_basics.cpp b/pedalboard/juce_overrides/juce_patched_gui_basics.cppnew file mode 100644index 0000000..de62e09--- /dev/null+++ b/pedalboard/juce_overrides/juce_patched_gui_basics.cpp@@ -0,0 +1,590 @@+/*+ ==============================================================================++ This file is part of the JUCE library.+ Copyright (c) 2020 - Raw Material Software Limited++ JUCE is an open source library subject to commercial or open-source+ licensing.++ By using JUCE, you agree to the terms of both the JUCE 6 End-User License+ Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).++ End User License Agreement: www.juce.com/juce-6-licence+ Privacy Policy: www.juce.com/juce-privacy-policy++ Or: You may also use this code under the terms of the GPL v3 (see+ www.gnu.org/licenses).++ JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER+ EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE+ DISCLAIMED.++ ==============================================================================+*/++#ifdef JUCE_GUI_BASICS_H_INCLUDED+/* When you add this cpp file to your project, you mustn't include it in a file+ where you've already included any other headers - just put it inside a file+ on its own, possibly with your config flags preceding it, but don't include+ anything else. That also includes avoiding any automatic prefix header files+ that the compiler may be using.+*/+#error "Incorrect use of JUCE cpp file"+#endif++#define NS_FORMAT_FUNCTION(F, A) // To avoid spurious warnings from GCC++#define JUCE_CORE_INCLUDE_OBJC_HELPERS 1+#define JUCE_CORE_INCLUDE_COM_SMART_PTR 1+#define JUCE_CORE_INCLUDE_JNI_HELPERS 1+#define JUCE_CORE_INCLUDE_NATIVE_HEADERS 1+#define JUCE_EVENTS_INCLUDE_WIN32_MESSAGE_WINDOW 1+#define JUCE_GRAPHICS_INCLUDE_COREGRAPHICS_HELPERS 1+#define JUCE_GUI_BASICS_INCLUDE_XHEADERS 1+#define JUCE_GUI_BASICS_INCLUDE_SCOPED_THREAD_DPI_AWARENESS_SETTER 1++// Avoid error: βexchangeβ is not a member of βstdβ:+#include <utility>++#include "../JUCE/modules/juce_gui_basics/juce_gui_basics.h"++//==============================================================================+#if JUCE_MAC+#import <IOKit/pwr_mgt/IOPMLib.h>+#import <WebKit/WebKit.h>++#if JUCE_SUPPORT_CARBON+#import <Carbon/Carbon.h> // still needed for SetSystemUIMode()+#endif++#elif JUCE_IOS+#if JUCE_PUSH_NOTIFICATIONS && defined(__IPHONE_10_0) && \+ __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0+#import <UserNotifications/UserNotifications.h>+#endif++#import <UIKit/UIActivityViewController.h>++//==============================================================================+#elif JUCE_WINDOWS+#include <commctrl.h>+#include <commdlg.h>+#include <vfw.h>+#include <windowsx.h>++#if !JUCE_MINGW+#include <UIAutomation.h>+#include <sapi.h>+#endif++#if JUCE_WEB_BROWSER+#include <exdisp.h>+#include <exdispid.h>+#endif++#if JUCE_MINGW+#include <imm.h>+#elif !JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES+#pragma comment(lib, "vfw32.lib")+#pragma comment(lib, "imm32.lib")+#pragma comment(lib, "comctl32.lib")++#if JUCE_OPENGL+#pragma comment(lib, "OpenGL32.Lib")+#pragma comment(lib, "GlU32.Lib")+#endif++#if JUCE_DIRECT2D+#pragma comment(lib, "Dwrite.lib")+#pragma comment(lib, "D2d1.lib")+#endif+#endif+#endif++#include <set>++//==============================================================================+#define JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED_OR_OFFSCREEN \+ jassert((MessageManager::getInstanceWithoutCreating() != nullptr && \+ MessageManager::getInstanceWithoutCreating() \+ ->currentThreadHasLockedMessageManager()) || \+ getPeer() == nullptr);++namespace juce {+bool juce_areThereAnyAlwaysOnTopWindows();++bool isEmbeddedInForegroundProcess(Component *c);++#if !JUCE_WINDOWS+bool isEmbeddedInForegroundProcess(Component *) { return false; }+#endif++/* Returns true if this process is in the foreground, or if the viewComponent+ is embedded into a window owned by the foreground process.+*/+static bool isForegroundOrEmbeddedProcess(Component *viewComponent) {+ return Process::isForegroundProcess() ||+ isEmbeddedInForegroundProcess(viewComponent);+}++bool isWindowOnCurrentVirtualDesktop(void *);++struct CustomMouseCursorInfo {+ ScaledImage image;+ Point<int> hotspot;+};+} // namespace juce++#include "../JUCE/modules/juce_gui_basics/accessibility/juce_AccessibilityHandler.cpp"++#include "../JUCE/modules/juce_gui_basics/components/juce_Component.cpp"++#include "../JUCE/modules/juce_gui_basics/components/juce_ComponentListener.cpp"++#include "../JUCE/modules/juce_gui_basics/components/juce_FocusTraverser.cpp"++#include "../JUCE/modules/juce_gui_basics/mouse/juce_MouseInputSource.cpp"++#include "../JUCE/modules/juce_gui_basics/desktop/juce_Displays.cpp"++#include "../JUCE/modules/juce_gui_basics/desktop/juce_Desktop.cpp"++#include "../JUCE/modules/juce_gui_basics/components/juce_ModalComponentManager.cpp"++#include "../JUCE/modules/juce_gui_basics/mouse/juce_ComponentDragger.cpp"++#include "../JUCE/modules/juce_gui_basics/mouse/juce_DragAndDropContainer.cpp"++#include "../JUCE/modules/juce_gui_basics/mouse/juce_MouseEvent.cpp"++#include "../JUCE/modules/juce_gui_basics/mouse/juce_MouseInactivityDetector.cpp"++#include "../JUCE/modules/juce_gui_basics/mouse/juce_MouseListener.cpp"++#include "../JUCE/modules/juce_gui_basics/keyboard/juce_CaretComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/keyboard/juce_KeyboardFocusTraverser.cpp"++#include "../JUCE/modules/juce_gui_basics/keyboard/juce_KeyListener.cpp"++#include "../JUCE/modules/juce_gui_basics/keyboard/juce_KeyPress.cpp"++#include "../JUCE/modules/juce_gui_basics/keyboard/juce_ModifierKeys.cpp"++#include "../JUCE/modules/juce_gui_basics/buttons/juce_ArrowButton.cpp"++#include "../JUCE/modules/juce_gui_basics/buttons/juce_Button.cpp"++#include "../JUCE/modules/juce_gui_basics/buttons/juce_DrawableButton.cpp"++#include "../JUCE/modules/juce_gui_basics/buttons/juce_HyperlinkButton.cpp"++#include "../JUCE/modules/juce_gui_basics/buttons/juce_ImageButton.cpp"++#include "../JUCE/modules/juce_gui_basics/buttons/juce_ShapeButton.cpp"++#include "../JUCE/modules/juce_gui_basics/buttons/juce_TextButton.cpp"++#include "../JUCE/modules/juce_gui_basics/buttons/juce_ToggleButton.cpp"++#include "../JUCE/modules/juce_gui_basics/buttons/juce_ToolbarButton.cpp"++#include "../JUCE/modules/juce_gui_basics/drawables/juce_Drawable.cpp"++#include "../JUCE/modules/juce_gui_basics/drawables/juce_DrawableComposite.cpp"++#include "../JUCE/modules/juce_gui_basics/drawables/juce_DrawableImage.cpp"++#include "../JUCE/modules/juce_gui_basics/drawables/juce_DrawablePath.cpp"++#include "../JUCE/modules/juce_gui_basics/drawables/juce_DrawableRectangle.cpp"++#include "../JUCE/modules/juce_gui_basics/drawables/juce_DrawableShape.cpp"++#include "../JUCE/modules/juce_gui_basics/drawables/juce_DrawableText.cpp"++#include "../JUCE/modules/juce_gui_basics/drawables/juce_SVGParser.cpp"++#include "../JUCE/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsDisplayComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/filebrowser/juce_DirectoryContentsList.cpp"++#include "../JUCE/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/filebrowser/juce_FileChooser.cpp"++#include "../JUCE/modules/juce_gui_basics/filebrowser/juce_FileChooserDialogBox.cpp"++#include "../JUCE/modules/juce_gui_basics/filebrowser/juce_FileListComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/filebrowser/juce_FilenameComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/filebrowser/juce_FileSearchPathListComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/filebrowser/juce_ImagePreviewComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/filebrowser/juce_ContentSharer.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_ComponentAnimator.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_ComponentBoundsConstrainer.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_ComponentBuilder.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_ComponentMovementWatcher.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_ConcertinaPanel.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_GroupComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_MultiDocumentPanel.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_ResizableBorderComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_ResizableCornerComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_ResizableEdgeComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_ScrollBar.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_SidePanel.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_StretchableLayoutManager.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_StretchableLayoutResizerBar.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_StretchableObjectResizer.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_TabbedButtonBar.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_TabbedComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_Viewport.cpp"++#include "../JUCE/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel.cpp"++#include "../JUCE/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp"++#include "../JUCE/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V1.cpp"++#include "../JUCE/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V3.cpp"++#include "../JUCE/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V4.cpp"++#include "../JUCE/modules/juce_gui_basics/menus/juce_MenuBarComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/menus/juce_BurgerMenuComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/menus/juce_MenuBarModel.cpp"++#include "../JUCE/modules/juce_gui_basics/menus/juce_PopupMenu.cpp"++#include "../JUCE/modules/juce_gui_basics/positioning/juce_MarkerList.cpp"++#include "../JUCE/modules/juce_gui_basics/positioning/juce_RelativeCoordinate.cpp"++#include "../JUCE/modules/juce_gui_basics/positioning/juce_RelativeCoordinatePositioner.cpp"++#include "../JUCE/modules/juce_gui_basics/positioning/juce_RelativeParallelogram.cpp"++#include "../JUCE/modules/juce_gui_basics/positioning/juce_RelativePoint.cpp"++#include "../JUCE/modules/juce_gui_basics/positioning/juce_RelativePointPath.cpp"++#include "../JUCE/modules/juce_gui_basics/positioning/juce_RelativeRectangle.cpp"++#include "../JUCE/modules/juce_gui_basics/properties/juce_BooleanPropertyComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/properties/juce_ButtonPropertyComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/properties/juce_ChoicePropertyComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/properties/juce_PropertyComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/properties/juce_PropertyPanel.cpp"++#include "../JUCE/modules/juce_gui_basics/properties/juce_SliderPropertyComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/properties/juce_TextPropertyComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/properties/juce_MultiChoicePropertyComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_ComboBox.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_ImageComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_Label.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_ListBox.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_ProgressBar.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_Slider.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_TableListBox.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_TextEditor.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_ToolbarItemComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_Toolbar.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_ToolbarItemPalette.cpp"++#include "../JUCE/modules/juce_gui_basics/widgets/juce_TreeView.cpp"++#include "../JUCE/modules/juce_gui_basics/windows/juce_AlertWindow.cpp"++#include "../JUCE/modules/juce_gui_basics/windows/juce_CallOutBox.cpp"++#include "../JUCE/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp"++#include "../JUCE/modules/juce_gui_basics/windows/juce_DialogWindow.cpp"++#include "../JUCE/modules/juce_gui_basics/windows/juce_DocumentWindow.cpp"++#include "../JUCE/modules/juce_gui_basics/windows/juce_ResizableWindow.cpp"++#include "../JUCE/modules/juce_gui_basics/windows/juce_ThreadWithProgressWindow.cpp"++#include "../JUCE/modules/juce_gui_basics/windows/juce_TooltipWindow.cpp"++#include "../JUCE/modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp"++#include "../JUCE/modules/juce_gui_basics/commands/juce_ApplicationCommandInfo.cpp"++#include "../JUCE/modules/juce_gui_basics/commands/juce_ApplicationCommandManager.cpp"++#include "../JUCE/modules/juce_gui_basics/commands/juce_ApplicationCommandTarget.cpp"++#include "../JUCE/modules/juce_gui_basics/commands/juce_KeyPressMappingSet.cpp"++#include "../JUCE/modules/juce_gui_basics/application/juce_Application.cpp"++#include "../JUCE/modules/juce_gui_basics/misc/juce_BubbleComponent.cpp"++#include "../JUCE/modules/juce_gui_basics/misc/juce_DropShadower.cpp"++#include "../JUCE/modules/juce_gui_basics/misc/juce_JUCESplashScreen.cpp"++#include "../JUCE/modules/juce_gui_basics/layout/juce_FlexBox.cpp"+#include "../JUCE/modules/juce_gui_basics/layout/juce_Grid.cpp"+#include "../JUCE/modules/juce_gui_basics/layout/juce_GridItem.cpp"++#if JUCE_IOS || JUCE_WINDOWS+#include "../JUCE/modules/juce_gui_basics/native/juce_MultiTouchMapper.h"+#endif++#if JUCE_ANDROID || JUCE_WINDOWS+#include "../JUCE/modules/juce_gui_basics/native/accessibility/juce_AccessibilityTextHelpers.h"+#endif++namespace juce {++static const juce::Identifier disableAsyncLayerBackedViewIdentifier{+ "disableAsyncLayerBackedView"};++JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE("-Wmissing-prototypes")++/** Used by the macOS and iOS peers. */+void setComponentAsyncLayerBackedViewDisabled(+ juce::Component &comp, bool shouldDisableAsyncLayerBackedView) {+ comp.getProperties().set(disableAsyncLayerBackedViewIdentifier,+ shouldDisableAsyncLayerBackedView);+}++/** Used by the macOS and iOS peers. */+bool getComponentAsyncLayerBackedViewDisabled(juce::Component &comp) {+ return comp.getProperties()[disableAsyncLayerBackedViewIdentifier];+}++JUCE_END_IGNORE_WARNINGS_GCC_LIKE++} // namespace juce++#if JUCE_MAC || JUCE_IOS+#include "../JUCE/modules/juce_gui_basics/native/accessibility/juce_mac_AccessibilitySharedCode.mm"++#if JUCE_IOS+#include "../JUCE/modules/juce_gui_basics/native/accessibility/juce_ios_Accessibility.mm"++#include "../JUCE/modules/juce_gui_basics/native/juce_ios_UIViewComponentPeer.mm"++#include "../JUCE/modules/juce_gui_basics/native/juce_ios_Windowing.mm"++#include "../JUCE/modules/juce_gui_basics/native/juce_ios_FileChooser.mm"++#if JUCE_CONTENT_SHARING+#include "../JUCE/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp"+#endif++#else+#include "../JUCE/modules/juce_gui_basics/native/accessibility/juce_mac_Accessibility.mm"++#include "../JUCE/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm"++#include "juce_mac_PatchedWindowing.mm"++#include "../JUCE/modules/juce_gui_basics/native/juce_mac_MainMenu.mm"++#include "../JUCE/modules/juce_gui_basics/native/juce_mac_FileChooser.mm"++#endif++#include "../JUCE/modules/juce_gui_basics/native/juce_mac_MouseCursor.mm"++#elif JUCE_WINDOWS++#if !JUCE_MINGW+#include "../JUCE/modules/juce_gui_basics/native/accessibility/juce_win32_WindowsUIAWrapper.h"++#include "../JUCE/modules/juce_gui_basics/native/accessibility/juce_win32_AccessibilityElement.h"++#include "../JUCE/modules/juce_gui_basics/native/accessibility/juce_win32_UIAHelpers.h"++#include "../JUCE/modules/juce_gui_basics/native/accessibility/juce_win32_UIAProviders.h"++#include "../JUCE/modules/juce_gui_basics/native/accessibility/juce_win32_AccessibilityElement.cpp"++#include "../JUCE/modules/juce_gui_basics/native/accessibility/juce_win32_Accessibility.cpp"++#else+namespace juce {+namespace WindowsAccessibility {+long getUiaRootObjectId() { return -1; }+bool handleWmGetObject(AccessibilityHandler *, WPARAM, LPARAM, LRESULT *) {+ return false;+}+void revokeUIAMapEntriesForWindow(HWND) {}+} // namespace WindowsAccessibility+} // namespace juce+#endif++#include "../JUCE/modules/juce_gui_basics/native/juce_win32_Windowing.cpp"++#include "../JUCE/modules/juce_gui_basics/native/juce_win32_DragAndDrop.cpp"++#include "../JUCE/modules/juce_gui_basics/native/juce_win32_FileChooser.cpp"++#elif JUCE_LINUX || JUCE_BSD+#include "../JUCE/modules/juce_gui_basics/native/x11/juce_linux_X11_DragAndDrop.cpp"++#include "../JUCE/modules/juce_gui_basics/native/x11/juce_linux_X11_Symbols.cpp"++JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE("-Wzero-as-null-pointer-constant")++#include "../JUCE/modules/juce_gui_basics/native/juce_linux_Windowing.cpp"++#include "../JUCE/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp"++JUCE_END_IGNORE_WARNINGS_GCC_LIKE++#include "../JUCE/modules/juce_gui_basics/native/juce_linux_FileChooser.cpp"++#elif JUCE_ANDROID+#include "../JUCE/modules/juce_gui_basics/native/accessibility/juce_android_Accessibility.cpp"++#include "../JUCE/modules/juce_gui_basics/native/juce_android_Windowing.cpp"++#include "../JUCE/modules/juce_gui_basics/native/juce_common_MimeTypes.cpp"++#include "../JUCE/modules/juce_gui_basics/native/juce_android_FileChooser.cpp"++#if JUCE_CONTENT_SHARING+#include "../JUCE/modules/juce_gui_basics/native/juce_android_ContentSharer.cpp"+#endif++#endif++namespace juce {+#if !JUCE_NATIVE_ACCESSIBILITY_INCLUDED+class AccessibilityHandler::AccessibilityNativeImpl {+public:+ AccessibilityNativeImpl(AccessibilityHandler &) {}+};+void AccessibilityHandler::notifyAccessibilityEvent(AccessibilityEvent) const {}+void AccessibilityHandler::postAnnouncement(const String &,+ AnnouncementPriority) {}+AccessibilityNativeHandle *+AccessibilityHandler::getNativeImplementation() const {+ return nullptr;+}+void notifyAccessibilityEventInternal(const AccessibilityHandler &,+ InternalAccessibilityEvent) {}+std::unique_ptr<AccessibilityHandler::AccessibilityNativeImpl>+AccessibilityHandler::createNativeImpl(AccessibilityHandler &) {+ return nullptr;+}+#else+std::unique_ptr<AccessibilityHandler::AccessibilityNativeImpl>+AccessibilityHandler::createNativeImpl(AccessibilityHandler &handler) {+ return std::make_unique<AccessibilityNativeImpl>(handler);+}+#endif+} // namespace juce++//==============================================================================+#if JUCE_WINDOWS+bool juce::isWindowOnCurrentVirtualDesktop(void *x) {+ if (x == nullptr)+ return false;++ static auto *desktopManager = [] {+ // IVirtualDesktopManager Copied from ShObjdl_core.h, because it may not be+ // defined+ MIDL_INTERFACE("a5cd92ff-29be-454c-8d04-d82879fb3f1b")+ juce_IVirtualDesktopManager:+ public+ IUnknown {+ public:+ virtual HRESULT STDMETHODCALLTYPE IsWindowOnCurrentVirtualDesktop(+ __RPC__in HWND topLevelWindow,+ __RPC__out BOOL * onCurrentDesktop) = 0;++ virtual HRESULT STDMETHODCALLTYPE GetWindowDesktopId(+ __RPC__in HWND topLevelWindow, __RPC__out GUID * desktopId) = 0;++ virtual HRESULT STDMETHODCALLTYPE MoveWindowToDesktop(+ __RPC__in HWND topLevelWindow, __RPC__in REFGUID desktopId) = 0;+ };++ juce_IVirtualDesktopManager *result = nullptr;++ JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE("-Wlanguage-extension-token")++ class DECLSPEC_UUID("aa509086-5ca9-4c25-8f95-589d3c07b48a")+ juce_VirtualDesktopManager;++ if (SUCCEEDED(CoCreateInstance(__uuidof(juce_VirtualDesktopManager),+ nullptr, CLSCTX_ALL, IID_PPV_ARGS(&result))))+ return result;++ JUCE_END_IGNORE_WARNINGS_GCC_LIKE++ return static_cast<juce_IVirtualDesktopManager *>(nullptr);+ }();++ BOOL current = false;++ if (auto *dm = desktopManager)+ if (SUCCEEDED(dm->IsWindowOnCurrentVirtualDesktop(static_cast<HWND>(x),+ ¤t)))+ return current != false;++ return true;+}+#else+bool juce::isWindowOnCurrentVirtualDesktop(void *) { return true; }+juce::ScopedDPIAwarenessDisabler::ScopedDPIAwarenessDisabler() {+ ignoreUnused(previousContext);+}+juce::ScopedDPIAwarenessDisabler::~ScopedDPIAwarenessDisabler() {}+#endif++// Depends on types defined in platform-specific windowing files+#include "../JUCE/modules/juce_gui_basics/mouse/juce_MouseCursor.cpp"diff --git a/pedalboard/version.py b/pedalboard/version.pyindex 2a49c80..bad0617 100644--- a/pedalboard/version.py+++ b/pedalboard/version.py@@ -14,9 +14,6 @@# See the License for the specific language governing permissions and# limitations under the License.--MAJOR = 0-MINOR = 9-PATCH = 16--__version__ = "%d.%d.%d" % (MAJOR, MINOR, PATCH)+__version__ = "0.9.16"+# Done this way so we can use dynamic-metadata to parse the version above.+MAJOR, MINOR, PATCH = (int(x) for x in __version__.split("."))diff --git a/pyproject.toml b/pyproject.tomlindex c207858..426886e 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -1,23 +1,101 @@[build-system]-requires = [- "setuptools>=59.6.0",- "wheel>=0.36.2",- 'pybind11>=2.13; python_version>="3.9"',- 'pybind11<=2.12; python_version<="3.8"',- # Building with NumPy 2 allows backwards compatibility with NumPy 1:- 'numpy>=2.1.0rc1; python_version>="3.13"',- 'numpy>=2; python_version>="3.9" and python_version<"3.13"',- 'numpy<2; python_version<="3.8"',-]+requires = ["scikit-build-core>=0.5.0", "pybind11>=2.9.0"]+build-backend = "scikit_build_core.build"-build-backend = "setuptools.build_meta"+[tool.cibuildwheel]+free-threaded-support = true+test-requires = ["-r test-requirements.txt"]+test-command = "pytest {project}/tests"+# The manylinux container doesn't have a new enough glibc version,+# so we can't run post-wheel-build tests there.+# The musllinux containers on aarch64 take 6+ hours to test.+# Also testing any pypy versions fails, as TensorFlow isn't pypy compatible.+test-skip = "*manylinux* *musllinux_aarch* *pp* *-macosx_universal2:arm64"+musllinux-x86_64-image = "quay.io/pypa/musllinux_1_1_x86_64:2024-04-29-07d05a0"+musllinux-aarch64-image = "quay.io/pypa/musllinux_1_1_aarch64:2024-04-29-07d05a0"# See: https://cibuildwheel.readthedocs.io/en/stable/options/#examples[tool.cibuildwheel.linux]before-all = "yum install -y libsndfile libX11-devel libXrandr-devel libXinerama-devel libXrender-devel libXcomposite-devel libXinerama-devel libXcursor-devel freetype-devel alsa-lib-devel"+repair-wheel-command = "pip install auditwheel-symbols && (auditwheel repair -w {dest_dir} {wheel} || auditwheel-symbols --manylinux 2010 {wheel})"+archs = ["auto64", "aarch64"]++[tool.cibuildwheel.macos]+archs = ["x86_64", "arm64", "universal2"]++[tool.cibuildwheel.windows]+archs = ["auto"][[tool.cibuildwheel.overrides]]# Use apk instead of yum when building on Alpine Linux# (Note: this is experimental, as most VSTs require glibc and thus Alpine Linux isn't that useful)select = "*-musllinux*"before-all = "apk add libsndfile libx11-dev libxrandr-dev libxinerama-dev libxrender-dev libxcomposite-dev libxinerama-dev libxcursor-dev freetype-dev libexecinfo-dev alsa-lib-dev"++[project]+name = "pedalboard"+authors = [{ name = "Peter Sobot", email = "[email protected]" }]+description = "A Python library for adding effects to audio."+readme = "README.md"+requires-python = ">=3.8"+license = { file = "LICENSE" }+classifiers = [+ "Development Status :: 4 - Beta",+ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",+ "Operating System :: MacOS",+ "Operating System :: Microsoft :: Windows",+ "Operating System :: POSIX :: Linux",+ "Programming Language :: C++",+ "Programming Language :: Python",+ "Topic :: Multimedia :: Sound/Audio",+ "Programming Language :: Python :: 3.8",+ "Programming Language :: Python :: 3.9",+ "Programming Language :: Python :: 3.10",+ "Programming Language :: Python :: 3.11",+ "Programming Language :: Python :: 3.12",+ "Programming Language :: Python :: 3.13",+]+dependencies = ["numpy"]+version = "0.9.16"++[project.optional-dependencies]+test = ["pytest"]++[tool.scikit-build]+cmake.build-type = "Release"+build.verbose = true+logging.level = "DEBUG"+wheel.packages = ["pedalboard", "pedalboard.io", "pedalboard_native"]+sdist.include = [+ "pedalboard/**/*.py",+ "pedalboard_native/**/*.py",+ "JUCE/**/*.cpp",+ "JUCE/**/*.c",+ "JUCE/**/*.h",+ "JUCE/**/*.mm",+ "JUCE/**/*.m",+ "vendors/**/*.c",+ "vendors/**/*.cpp",+ "vendors/**/*.h",+ "vendors/**/*.inc",+]+sdist.exclude = ["**/__pycache__"]++# [tool.scikit-build.include]+# pedalboard = ["py.typed", "*.pyi", "**/*.pyi"]+# pedalboard_native = ["py.typed", "*.pyi", "**/*.pyi"]++[tool.ruff]+target-version = "py310"+line-length = 100+lint.extend-ignore = ["E203", "F541"]+exclude = [+ ".git",+ "dist",+ "doc",+ "build",+ "JUCE",+ "examples",+ "vendors",+ "*.pyi",+]diff --git a/setup.py b/setup.pyindex e5c5adf..de4d022 100644--- a/setup.py+++ b/setup.py@@ -220,10 +220,9 @@ elif platform.system() == "Linux":"-DHAVE_SNPRINTF","-DHAVE_STRCHR","-DHAVE_SYSCTL",+ "-DHAVE_GETTIMEOFDAY",])- if platform.system() == "Linux":- ALL_CFLAGS.append("-DHAVE_GETTIMEOFDAY")ALL_SOURCE_PATHS += list(Path("vendors/rubberband/single").glob("*.cpp"))diff --git a/tests/download_test_plugins.py b/tests/download_test_plugins.pyindex 477344d..068f409 100644--- a/tests/download_test_plugins.py+++ b/tests/download_test_plugins.py@@ -4,12 +4,14 @@ that we can't embed in the repository itself, but we still want to use fortesting purposes."""-import osimport json-from tqdm import tqdm+import osimport platform++from google.auth.exceptions import RefreshErrorfrom google.cloud import storagefrom google.oauth2 import service_account+from tqdm import tqdmdef main():@@ -35,13 +37,25 @@ def main():# Manually iterate here instead of just calling gsutil on the command line as# GSUtil on Windows is not 100% guaranteed to install properly on GitHub Actions.print(f"Downloading test {plugin_type} plugin files from Google Cloud Storage...")- for blob in tqdm(list(bucket.list_blobs(prefix=prefix))):- local_path = os.path.join(target_filepath, blob.name.replace(prefix + "/", ""))- if local_path.endswith("/"):- os.makedirs(local_path, exist_ok=True)- else:- os.makedirs(os.path.dirname(local_path), exist_ok=True)- blob.download_to_filename(local_path)+ try:+ for blob in tqdm(list(bucket.list_blobs(prefix=prefix))):+ local_path = os.path.join(target_filepath, blob.name.replace(prefix + "/", ""))+ if local_path.endswith("/"):+ os.makedirs(local_path, exist_ok=True)+ else:+ os.makedirs(os.path.dirname(local_path), exist_ok=True)+ blob.download_to_filename(local_path)+ except RefreshError as e:+ raise ValueError(+ "Test plugin download failed, likely due to access token expiration. \n"+ "If you're a Spotify employee and are seeing this error, please "+ "regenerate the GCS_READER_SERVICE_ACCOUNT_KEY environment variable "+ "in the GitHub Actions secrets. The existing service account used for "+ "this can be found by searching for a service account containing the "+ "word 'Pedalboard' in the owning team's Google Cloud console IAM page. "+ "If the service account has been deleted, create a new one and give it "+ "read-only access to objects in the GCS_ASSET_BUCKET_NAME bucket."+ ) from eprint("Done!")diff --git a/tests/test_audio_stream.py b/tests/test_audio_stream.pyindex f8c0494..4f01cda 100644--- a/tests/test_audio_stream.py+++ b/tests/test_audio_stream.py@@ -24,11 +24,24 @@ import pedalboard# Very silly: even just creating an AudioStream object that reads from an `iPhone Microphone``# will cause a locally-present iPhone to emit a sound. Running `pytest` on my laptop makes my# phone ding.-INPUT_DEVICE_NAMES_TO_SKIP = {"iPhone Microphone", "AirPods"}+DEVICE_NAMES_TO_SKIP = {+ "iPhone Microphone",+ "AirPods",+ # PulseAudio devices:+ "Open Sound System",+ "JACK Audio Connection Kit",+ "plugin",+}INPUT_DEVICE_NAMES = [nfor n in pedalboard.io.AudioStream.input_device_names- if not any(substr in n for substr in INPUT_DEVICE_NAMES_TO_SKIP)+ if not any(substring.lower() in n.lower() for substring in DEVICE_NAMES_TO_SKIP)+]++OUTPUT_DEVICE_NAMES = [+ n+ for n in pedalboard.io.AudioStream.output_device_names+ if not any(substring.lower() in n.lower() for substring in DEVICE_NAMES_TO_SKIP)]ACCEPTABLE_ERRORS_ON_CI = {"No driver"}@@ -37,7 +50,7 @@ ACCEPTABLE_ERRORS_ON_CI = {"No driver"}# Note: this test may do nothing on CI, because we don't have mock audio devices available.# This will run on Linux, macOS and probably Windows as long as at least one audio device is available.@pytest.mark.parametrize("input_device_name", INPUT_DEVICE_NAMES)[email protected]("output_device_name", pedalboard.io.AudioStream.output_device_names)[email protected]("output_device_name", OUTPUT_DEVICE_NAMES)def test_create_stream(input_device_name: str, output_device_name: str):try:stream = pedalboard.io.AudioStream(diff --git a/tests/test_external_plugins.py b/tests/test_external_plugins.pyindex 1dbd110..1b3e40d 100644--- a/tests/test_external_plugins.py+++ b/tests/test_external_plugins.py@@ -308,9 +308,9 @@ def test_preset_parameters(plugin_filename: str, plugin_preset: str):actual = getattr(plugin, name)if math.isnan(actual):continue- assert (- actual != default- ), f"Expected attribute {name} to be different from default ({default}), but was {actual}"+ assert actual != default, (+ f"Expected attribute {name} to be different from default ({default}), but was {actual}"+ )@pytest.mark.skipif(@@ -322,9 +322,9 @@ def test_get_vst3_preset(plugin_filename: str):plugin = load_test_plugin(plugin_filename)preset_data: bytes = plugin.preset_data- assert (- preset_data[:4] == b"VST3"- ), "Preset data for {plugin_filename} is not in .vstpreset format"+ assert preset_data[:4] == b"VST3", (+ "Preset data for {plugin_filename} is not in .vstpreset format"+ )# Check that the class ID (8 bytes into the data) is a 32-character hex string.cid = preset_data[8:][:32]assert all(c in b"0123456789ABCDEF" for c in cid), f"CID contains invalid characters: {cid}"@@ -333,17 +333,17 @@ def test_get_vst3_preset(plugin_filename: str):@pytest.mark.skipif(not plugin_named("Magical8BitPlug"), reason="Missing Magical8BitPlug 2 plugin.")def test_set_vst3_preset():plugin_file = plugin_named("Magical8BitPlug")- assert (- plugin_file is not None and "vst3" in plugin_file- ), f"Expected a vst plugin: {plugin_file}"+ assert plugin_file is not None and "vst3" in plugin_file, (+ f"Expected a vst plugin: {plugin_file}"+ )plugin = load_test_plugin(plugin_file)# Pick a known valid value for one of the plugin parameters.default_gain_value = plugin.gainnew_gain_value = 1.0- assert (- default_gain_value != new_gain_value- ), f"Expected default gain to be different than {new_gain_value}"+ assert default_gain_value != new_gain_value, (+ f"Expected default gain to be different than {new_gain_value}"+ )# Update the parameter and get the resulting .vstpreset bytes.plugin.gain = new_gain_value@@ -353,17 +353,17 @@ def test_set_vst3_preset():plugin.gain = default_gain_value# Sanity check that the parameter was successfully set.- assert (- plugin.gain == default_gain_value- ), f"Expected gain to be reset to {default_gain_value}, but got {plugin.gain}"+ assert plugin.gain == default_gain_value, (+ f"Expected gain to be reset to {default_gain_value}, but got {plugin.gain}"+ )# Load the .vstpreset bytes and make sure the parameter was# updated.plugin.preset_data = preset_data- assert (- plugin.gain == new_gain_value- ), f"Expected gain to be {new_gain_value}, but got {plugin.gain}"+ assert plugin.gain == new_gain_value, (+ f"Expected gain to be {new_gain_value}, but got {plugin.gain}"+ )@pytest.mark.parametrize("plugin_filename", AVAILABLE_PLUGINS_IN_TEST_ENVIRONMENT)@@ -832,9 +832,9 @@ def test_plugin_parameters_persist_between_calls(plugin_filename: str):plugin.process(noise, sr)for name, parameter in plugin.parameters.items():- assert (- getattr(plugin, name) == expected_values[name]- ), f"Expected {name} to match saved value"+ assert getattr(plugin, name) == expected_values[name], (+ f"Expected {name} to match saved value"+ )@pytest.mark.parametrize("plugin_filename", sample(AVAILABLE_EFFECT_PLUGINS_IN_TEST_ENVIRONMENT, 1))diff --git a/tests/test_io.py b/tests/test_io.pyindex fdf4dce..3e130a1 100644--- a/tests/test_io.py+++ b/tests/test_io.py@@ -925,9 +925,10 @@ def test_write_matches_encode(assert encoded_output == stream.getvalue()else:# Ogg files contain some randomness when encoded, but should decode identically:- with pedalboard.io.AudioFile(- io.BytesIO(encoded_output)- ) as encoded_f, pedalboard.io.AudioFile(stream) as streamed_f:+ with (+ pedalboard.io.AudioFile(io.BytesIO(encoded_output)) as encoded_f,+ pedalboard.io.AudioFile(stream) as streamed_f,+ ):assert encoded_f.samplerate == streamed_f.samplerateassert encoded_f.num_channels == streamed_f.num_channelsassert encoded_f.frames == streamed_f.frames@@ -986,9 +987,9 @@ def test_swapped_parameter_exception(tmp_path: pathlib.Path, extension: str, samfilename = str(tmp_path / f"test{extension}")with pytest.raises(ValueError) as e:pedalboard.io.WriteableAudioFile(filename, samplerate=1, num_channels=samplerate)- assert "reversing" in str(- e- ), "Expected exception to include details about reversing parameters."+ assert "reversing" in str(e), (+ "Expected exception to include details about reversing parameters."+ )@pytest.mark.parametrize("dtype", [np.uint8, np.uint16, np.uint32, np.uint64])diff --git a/tests/test_io_threading.py b/tests/test_io_threading.pyindex 873f46a..0f3b8b7 100644--- a/tests/test_io_threading.py+++ b/tests/test_io_threading.py@@ -139,9 +139,10 @@ def test_simultaneous_reads_from_the_same_file(raise elock = threading.Lock() if locking_scheme == "lock" else None- with ThreadPoolExecutor(num_workers) as e, AudioFile(buf).resampled_to(- sample_rate, Resample.Quality.ZeroOrderHold- ) as af:+ with (+ ThreadPoolExecutor(num_workers) as e,+ AudioFile(buf).resampled_to(sample_rate, Resample.Quality.ZeroOrderHold) as af,+ ):if raise_exceptions:should_error.set()futures = [e.submit(do_work, af, lock) for _ in range(num_workers)]diff --git a/tests/test_stream_resampler.py b/tests/test_stream_resampler.pyindex cbb8430..4064a5c 100644--- a/tests/test_stream_resampler.py+++ b/tests/test_stream_resampler.py@@ -199,8 +199,8 @@ def test_returned_sample_count(for i, (e, a) in enumerate(zip(expected_output[0], output[0])):assert e == a, (- f"First mismatch at index {i}:\nExpected: [..., {expected_output[0][i - 2: i + 2]},"- f" ...]\nActual: [..., {output[0][i - 2: i + 2]}, ...]"+ f"First mismatch at index {i}:\nExpected: [..., {expected_output[0][i - 2 : i + 2]},"+ f" ...]\nActual: [..., {output[0][i - 2 : i + 2]}, ...]")assert output.shape[1] == expected_output.shape[1], (