Move plugins in their own repository
18
.gitattributes
vendored
|
|
@ -1,23 +1,5 @@
|
||||||
.* export-ignore
|
.* export-ignore
|
||||||
.*/** export-ignore
|
.*/** export-ignore
|
||||||
appveyor.yml export-ignore
|
|
||||||
/scripts/appveyor/** export-ignore
|
|
||||||
/vst/external/VST_SDK/VST3_SDK/**/CMakeLists.txt export-ignore
|
|
||||||
/vst/external/VST_SDK/VST3_SDK/public.sdk/samples export-ignore
|
|
||||||
/vst/external/VST_SDK/VST3_SDK/public.sdk/source/vst/*wrapper/** export-ignore
|
|
||||||
/vst/external/VST_SDK/VST3_SDK/public.sdk/source/vst/interappaudio/** export-ignore
|
|
||||||
/vst/external/VST_SDK/VST3_SDK/public.sdk/source/vst/testsuite/** export-ignore
|
|
||||||
/vst/external/VST_SDK/VST3_SDK/public.sdk/source/vst/utility/test/** export-ignore
|
|
||||||
/editor/external/vstgui4/**/CMakeLists.txt export-ignore
|
|
||||||
/editor/external/vstgui4/vstgui/Documentation/** export-ignore
|
|
||||||
/editor/external/vstgui4/vstgui/doxygen/** export-ignore
|
|
||||||
/editor/external/vstgui4/vstgui/standalone/** export-ignore
|
|
||||||
/editor/external/vstgui4/vstgui/tests/** export-ignore
|
|
||||||
/editor/external/vstgui4/vstgui/tools/** export-ignore
|
|
||||||
/editor/external/vstgui4/vstgui/uidescription/** export-ignore
|
|
||||||
/editor/external/vstgui4/vstgui/uidescription/icontroller.h -export-ignore
|
|
||||||
/editor/external/vstgui4/vstgui/vstgui_standalone* export-ignore
|
|
||||||
/editor/external/vstgui4/vstgui/vstgui_uidescription* export-ignore
|
|
||||||
/external/st_audiofile/thirdparty/dr_libs/old/** export-ignore
|
/external/st_audiofile/thirdparty/dr_libs/old/** export-ignore
|
||||||
/external/st_audiofile/thirdparty/dr_libs/tests/** export-ignore
|
/external/st_audiofile/thirdparty/dr_libs/tests/** export-ignore
|
||||||
/external/filesystem/test/** export-ignore
|
/external/filesystem/test/** export-ignore
|
||||||
|
|
|
||||||
277
.github/workflows/build.yml
vendored
|
|
@ -7,7 +7,6 @@ on:
|
||||||
- 'master'
|
- 'master'
|
||||||
tags:
|
tags:
|
||||||
- '[0-9]*'
|
- '[0-9]*'
|
||||||
- 'v[0-9]*'
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- '*'
|
- '*'
|
||||||
|
|
@ -47,18 +46,7 @@ jobs:
|
||||||
sudo apt-get update && \
|
sudo apt-get update && \
|
||||||
sudo apt-get install \
|
sudo apt-get install \
|
||||||
ninja-build \
|
ninja-build \
|
||||||
libjack-jackd2-dev \
|
libjack-jackd2-dev
|
||||||
libsndfile1-dev \
|
|
||||||
libcairo2-dev \
|
|
||||||
libpango1.0-dev \
|
|
||||||
libfontconfig1-dev \
|
|
||||||
libx11-xcb-dev \
|
|
||||||
libxcb-util-dev \
|
|
||||||
libxcb-cursor-dev \
|
|
||||||
libxcb-xkb-dev \
|
|
||||||
libxkbcommon-dev \
|
|
||||||
libxkbcommon-x11-dev \
|
|
||||||
libxcb-keysyms1-dev
|
|
||||||
- name: Create Build Environment
|
- name: Create Build Environment
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: ${{runner.workspace}}
|
working-directory: ${{runner.workspace}}
|
||||||
|
|
@ -70,13 +58,9 @@ jobs:
|
||||||
cmake "$GITHUB_WORKSPACE" -G Ninja \
|
cmake "$GITHUB_WORKSPACE" -G Ninja \
|
||||||
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
||||||
-DSFIZZ_JACK=ON \
|
-DSFIZZ_JACK=ON \
|
||||||
-DSFIZZ_VST=ON \
|
|
||||||
-DSFIZZ_LV2_UI=ON \
|
|
||||||
-DSFIZZ_PUREDATA=ON \
|
|
||||||
-DSFIZZ_TESTS=ON \
|
-DSFIZZ_TESTS=ON \
|
||||||
-DSFIZZ_SHARED=OFF \
|
-DSFIZZ_SHARED=OFF \
|
||||||
-DSFIZZ_STATIC_DEPENDENCIES=OFF \
|
-DSFIZZ_STATIC_DEPENDENCIES=OFF \
|
||||||
-DSFIZZ_LV2=ON \
|
|
||||||
-DCMAKE_CXX_STANDARD=17
|
-DCMAKE_CXX_STANDARD=17
|
||||||
- name: Build tests
|
- name: Build tests
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
@ -130,14 +114,10 @@ jobs:
|
||||||
cmake "$GITHUB_WORKSPACE" -G Ninja \
|
cmake "$GITHUB_WORKSPACE" -G Ninja \
|
||||||
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
||||||
-DSFIZZ_JACK=OFF \
|
-DSFIZZ_JACK=OFF \
|
||||||
-DSFIZZ_VST=OFF \
|
|
||||||
-DSFIZZ_LV2_UI=OFF \
|
|
||||||
-DSFIZZ_PUREDATA=OFF \
|
|
||||||
-DSFIZZ_USE_SNDFILE=ON \
|
-DSFIZZ_USE_SNDFILE=ON \
|
||||||
-DSFIZZ_TESTS=ON \
|
-DSFIZZ_TESTS=ON \
|
||||||
-DSFIZZ_SHARED=OFF \
|
-DSFIZZ_SHARED=OFF \
|
||||||
-DSFIZZ_STATIC_DEPENDENCIES=OFF \
|
-DSFIZZ_STATIC_DEPENDENCIES=OFF
|
||||||
-DSFIZZ_LV2=OFF
|
|
||||||
- name: Build tests
|
- name: Build tests
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: ${{runner.workspace}}/build
|
working-directory: ${{runner.workspace}}/build
|
||||||
|
|
@ -166,10 +146,6 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
cmake "$GITHUB_WORKSPACE" \
|
cmake "$GITHUB_WORKSPACE" \
|
||||||
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
||||||
-DSFIZZ_AU=ON \
|
|
||||||
-DSFIZZ_LV2=ON \
|
|
||||||
-DSFIZZ_LV2_UI=ON \
|
|
||||||
-DSFIZZ_VST=ON \
|
|
||||||
-DSFIZZ_JACK=OFF \
|
-DSFIZZ_JACK=OFF \
|
||||||
-DSFIZZ_TESTS=ON \
|
-DSFIZZ_TESTS=ON \
|
||||||
-DSFIZZ_SHARED=OFF \
|
-DSFIZZ_SHARED=OFF \
|
||||||
|
|
@ -185,71 +161,23 @@ jobs:
|
||||||
# Reenable with newer cmakes
|
# Reenable with newer cmakes
|
||||||
# working-directory: ${{runner.workspace}}/build
|
# working-directory: ${{runner.workspace}}/build
|
||||||
# run: ctest -j 2 -C "$BUILD_TYPE" --output-on-failure
|
# run: ctest -j 2 -C "$BUILD_TYPE" --output-on-failure
|
||||||
- name: Build plugins
|
|
||||||
shell: bash
|
|
||||||
working-directory: ${{runner.workspace}}/build
|
|
||||||
run: cmake --build . --config "$BUILD_TYPE" -j 2
|
|
||||||
- name: Package OSX bundles
|
|
||||||
shell: bash
|
|
||||||
working-directory: ${{runner.workspace}}
|
|
||||||
run: ./sfizz/scripts/package-osx-bundles.sh
|
|
||||||
- name: Create OSX installer
|
|
||||||
shell: bash
|
|
||||||
working-directory: ${{runner.workspace}}/build
|
|
||||||
run: |
|
|
||||||
productbuild \
|
|
||||||
--distribution $GITHUB_WORKSPACE/scripts/plugin.pkg/package.xml \
|
|
||||||
--identifier "sfz.tools.sfizz" \
|
|
||||||
--package-path "${{runner.workspace}}/build" \
|
|
||||||
--version 0 \
|
|
||||||
${{env.install_name}}.pkg
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: MacOS installer
|
|
||||||
path: |
|
|
||||||
${{runner.workspace}}/build/${{env.install_name}}.pkg
|
|
||||||
|
|
||||||
build_for_mod:
|
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
container:
|
|
||||||
image: jpcima/mod-plugin-builder
|
|
||||||
options: --user 0
|
|
||||||
steps:
|
|
||||||
- name: Set install name
|
|
||||||
run: |
|
|
||||||
echo "install_ref=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
|
|
||||||
echo "install_name=sfizz-${GITHUB_REF##*/}-moddevices" >> "$GITHUB_ENV"
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
- name: Fix up MOD environment
|
|
||||||
shell: bash
|
|
||||||
run: ln -sf /home/builder/mod-workdir ~/mod-workdir
|
|
||||||
- name: Create Build Environment
|
|
||||||
shell: bash
|
|
||||||
working-directory: ${{runner.workspace}}
|
|
||||||
run: mod-plugin-builder /usr/local/bin/cmake -E make_directory build
|
|
||||||
- name: Configure CMake
|
|
||||||
shell: bash
|
|
||||||
working-directory: ${{runner.workspace}}/build
|
|
||||||
run: |
|
|
||||||
mod-plugin-builder /usr/local/bin/cmake "$GITHUB_WORKSPACE" \
|
|
||||||
-DSFIZZ_SYSTEM_PROCESSOR=armv7-a \
|
|
||||||
-DCMAKE_BUILD_TYPE=Release -DSFIZZ_JACK=OFF -DSFIZZ_VST=OFF -DSFIZZ_LV2_UI=OFF
|
|
||||||
- name: Build
|
- name: Build
|
||||||
shell: bash
|
shell: bash
|
||||||
working-directory: ${{runner.workspace}}/build
|
working-directory: ${{runner.workspace}}/build
|
||||||
run: mod-plugin-builder /usr/local/bin/cmake --build . --config "$BUILD_TYPE" -- -j 2
|
run: cmake --build . --config "$BUILD_TYPE" -j 2
|
||||||
- name: Install
|
- name: Install
|
||||||
working-directory: ${{runner.workspace}}/build
|
|
||||||
shell: bash
|
shell: bash
|
||||||
|
working-directory: ${{runner.workspace}}/build
|
||||||
run: |
|
run: |
|
||||||
DESTDIR="$(pwd)/$install_name" mod-plugin-builder /usr/local/bin/cmake --build . --config "$BUILD_TYPE" --target install
|
DESTDIR="$(pwd)/$install_name" cmake --build . --config "$BUILD_TYPE" --target install
|
||||||
tar czvf "$install_name".tar.gz "$install_name"
|
tar czvf "$install_name".tar.gz "$install_name"
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: MOD devices tarball
|
name: macOS tarball
|
||||||
path: ${{runner.workspace}}/build/${{env.install_name}}.tar.gz
|
path: |
|
||||||
|
${{runner.workspace}}/build/${{env.install_name}}.tar.gz
|
||||||
|
|
||||||
|
# build_for_mod: MOVED in plugins repository
|
||||||
|
|
||||||
build_for_windows:
|
build_for_windows:
|
||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
|
|
@ -278,7 +206,7 @@ jobs:
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
working-directory: ${{runner.workspace}}/build
|
working-directory: ${{runner.workspace}}/build
|
||||||
run: |
|
run: |
|
||||||
cmake "${Env:GITHUB_WORKSPACE}" -G"Visual Studio 16 2019" -A"${{matrix.release_arch}}" -DCMAKE_BUILD_TYPE="${Env:BUILD_TYPE}" -DCMAKE_CXX_STANDARD=17 -DSFIZZ_TESTS=ON -DSFIZZ_VST=ON -DSFIZZ_LV2=ON -DSFIZZ_PUREDATA=ON
|
cmake "${Env:GITHUB_WORKSPACE}" -G"Visual Studio 16 2019" -A"${{matrix.release_arch}}" -DCMAKE_BUILD_TYPE="${Env:BUILD_TYPE}" -DCMAKE_CXX_STANDARD=17 -DSFIZZ_TESTS=ON
|
||||||
- name: Build tests
|
- name: Build tests
|
||||||
working-directory: ${{runner.workspace}}/build
|
working-directory: ${{runner.workspace}}/build
|
||||||
run: cmake --build . --config "${Env:BUILD_TYPE}" -j 2 --target sfizz_tests
|
run: cmake --build . --config "${Env:BUILD_TYPE}" -j 2 --target sfizz_tests
|
||||||
|
|
@ -287,96 +215,77 @@ jobs:
|
||||||
- name: Build all
|
- name: Build all
|
||||||
working-directory: ${{runner.workspace}}/build
|
working-directory: ${{runner.workspace}}/build
|
||||||
run: cmake --build . --config "${Env:BUILD_TYPE}" -j 2
|
run: cmake --build . --config "${Env:BUILD_TYPE}" -j 2
|
||||||
- name: Install pluginval
|
|
||||||
if: ${{ matrix.platform == 'x64' }}
|
build_for_mingw:
|
||||||
|
if: ${{ false }} # DISABLED TEMPORARILY
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- platform: i686
|
||||||
|
pkg_platform: Win32
|
||||||
|
bits: 32
|
||||||
|
- platform: x86_64
|
||||||
|
pkg_platform: Win64
|
||||||
|
bits: 64
|
||||||
|
container:
|
||||||
|
image: archlinux
|
||||||
|
steps:
|
||||||
|
- name: Set install name
|
||||||
run: |
|
run: |
|
||||||
Invoke-WebRequest https://github.com/Tracktion/pluginval/releases/download/latest_release/pluginval_Windows.zip -OutFile pluginval.zip
|
echo "install_ref=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
|
||||||
Expand-Archive pluginval.zip -DestinationPath pluginval
|
echo "install_name=sfizz-${GITHUB_REF##*/}-mingw${{matrix.bits}}" >> "$GITHUB_ENV"
|
||||||
echo "$(Get-Location)\pluginval" | Out-File -FilePath ${Env:GITHUB_PATH} -Encoding utf8 -Append
|
- name: Configure pacman repositories
|
||||||
pluginval\pluginval --version
|
shell: bash
|
||||||
- name: Validate VST3
|
run: |
|
||||||
if: ${{ matrix.platform == 'x64' }}
|
cat >>/etc/pacman.conf <<EOF
|
||||||
|
[multilib]
|
||||||
|
Include = /etc/pacman.d/mirrorlist
|
||||||
|
[mingw-w64]
|
||||||
|
SigLevel = Optional TrustAll
|
||||||
|
Server = https://github.com/sfztools/arch-mingw-w64/releases/download/repo.\$arch/
|
||||||
|
EOF
|
||||||
|
- name: Set up dependencies
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
pacman -Sqyu --noconfirm
|
||||||
|
pacman -Sq --needed --noconfirm base-devel git wget ninja mingw-w64-cmake mingw-w64-gcc mingw-w64-pkg-config mingw-w64-libsndfile
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
- name: Fix MinGW headers
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
cp -vf "$GITHUB_WORKSPACE"/scripts/mingw_dwrite_3.h \
|
||||||
|
/usr/${{matrix.platform}}-w64-mingw32/include/dwrite_3.h
|
||||||
|
- name: Create Build Environment
|
||||||
|
shell: bash
|
||||||
|
working-directory: ${{runner.workspace}}
|
||||||
|
run: cmake -E make_directory build
|
||||||
|
- name: Configure CMake
|
||||||
|
shell: bash
|
||||||
working-directory: ${{runner.workspace}}/build
|
working-directory: ${{runner.workspace}}/build
|
||||||
run: pluginval --validate-in-process --validate sfizz.vst3
|
run: |
|
||||||
- name: Create installer
|
${{matrix.platform}}-w64-mingw32-cmake "$GITHUB_WORKSPACE" -G Ninja \
|
||||||
|
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
||||||
|
-DENABLE_LTO=OFF \
|
||||||
|
-DSFIZZ_JACK=OFF \
|
||||||
|
-DSFIZZ_STATIC_DEPENDENCIES=ON \
|
||||||
|
-DCMAKE_CXX_STANDARD=17
|
||||||
|
- name: Build
|
||||||
|
shell: bash
|
||||||
working-directory: ${{runner.workspace}}/build
|
working-directory: ${{runner.workspace}}/build
|
||||||
run: iscc /O"." /F"${Env:install_name}" /dARCH="${{matrix.platform}}" innosetup.iss
|
run: ${{matrix.platform}}-w64-mingw32-cmake --build . --config "$BUILD_TYPE" -j 2
|
||||||
|
- name: Install
|
||||||
|
working-directory: ${{runner.workspace}}/build
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
DESTDIR="$(pwd)/$install_name" ${{matrix.platform}}-w64-mingw32-cmake --build . --config "$BUILD_TYPE" --target install
|
||||||
|
tar czvf "$install_name".tar.gz "$install_name"
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{matrix.pkg_platform}} installer
|
name: ${{matrix.pkg_platform}} MinGW tarball
|
||||||
path: ${{runner.workspace}}/build/${{env.install_name}}.exe
|
path: ${{runner.workspace}}/build/${{env.install_name}}.tar.gz
|
||||||
|
|
||||||
# build_for_mingw:
|
|
||||||
# runs-on: ubuntu-20.04
|
|
||||||
# strategy:
|
|
||||||
# matrix:
|
|
||||||
# include:
|
|
||||||
# - platform: i686
|
|
||||||
# pkg_platform: Win32
|
|
||||||
# bits: 32
|
|
||||||
# - platform: x86_64
|
|
||||||
# pkg_platform: Win64
|
|
||||||
# bits: 64
|
|
||||||
# container:
|
|
||||||
# image: archlinux
|
|
||||||
# steps:
|
|
||||||
# - name: Set install name
|
|
||||||
# run: |
|
|
||||||
# echo "install_ref=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
|
|
||||||
# echo "install_name=sfizz-${GITHUB_REF##*/}-mingw${{matrix.bits}}" >> "$GITHUB_ENV"
|
|
||||||
# - name: Configure pacman repositories
|
|
||||||
# shell: bash
|
|
||||||
# run: |
|
|
||||||
# cat >>/etc/pacman.conf <<EOF
|
|
||||||
# [multilib]
|
|
||||||
# Include = /etc/pacman.d/mirrorlist
|
|
||||||
# [mingw-w64]
|
|
||||||
# SigLevel = Optional TrustAll
|
|
||||||
# Server = https://github.com/jpcima/arch-mingw-w64/releases/download/repo.\$arch/
|
|
||||||
# EOF
|
|
||||||
# - name: Set up dependencies
|
|
||||||
# shell: bash
|
|
||||||
# run: |
|
|
||||||
# pacman -Sqyu --noconfirm
|
|
||||||
# pacman -Sq --needed --noconfirm base-devel git wget ninja mingw-w64-cmake mingw-w64-gcc mingw-w64-pkg-config mingw-w64-libsndfile
|
|
||||||
# - uses: actions/checkout@v3
|
|
||||||
# with:
|
|
||||||
# submodules: recursive
|
|
||||||
# - name: Fix MinGW headers
|
|
||||||
# shell: bash
|
|
||||||
# run: |
|
|
||||||
# cp -vf "$GITHUB_WORKSPACE"/scripts/mingw_dwrite_3.h \
|
|
||||||
# /usr/${{matrix.platform}}-w64-mingw32/include/dwrite_3.h
|
|
||||||
# - name: Create Build Environment
|
|
||||||
# shell: bash
|
|
||||||
# working-directory: ${{runner.workspace}}
|
|
||||||
# run: cmake -E make_directory build
|
|
||||||
# - name: Configure CMake
|
|
||||||
# shell: bash
|
|
||||||
# working-directory: ${{runner.workspace}}/build
|
|
||||||
# run: |
|
|
||||||
# ${{matrix.platform}}-w64-mingw32-cmake "$GITHUB_WORKSPACE" -G Ninja \
|
|
||||||
# -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
|
||||||
# -DENABLE_LTO=OFF \
|
|
||||||
# -DSFIZZ_JACK=OFF \
|
|
||||||
# -DSFIZZ_VST=ON \
|
|
||||||
# -DSFIZZ_PUREDATA=ON \
|
|
||||||
# -DSFIZZ_STATIC_DEPENDENCIES=ON \
|
|
||||||
# -DCMAKE_CXX_STANDARD=17
|
|
||||||
# - name: Build
|
|
||||||
# shell: bash
|
|
||||||
# working-directory: ${{runner.workspace}}/build
|
|
||||||
# run: ${{matrix.platform}}-w64-mingw32-cmake --build . --config "$BUILD_TYPE" -j 2
|
|
||||||
# - name: Install
|
|
||||||
# working-directory: ${{runner.workspace}}/build
|
|
||||||
# shell: bash
|
|
||||||
# run: |
|
|
||||||
# DESTDIR="$(pwd)/$install_name" ${{matrix.platform}}-w64-mingw32-cmake --build . --config "$BUILD_TYPE" --target install
|
|
||||||
# tar czvf "$install_name".tar.gz "$install_name"
|
|
||||||
# - uses: actions/upload-artifact@v3
|
|
||||||
# with:
|
|
||||||
# name: ${{matrix.pkg_platform}} MinGW tarball
|
|
||||||
# path: ${{runner.workspace}}/build/${{env.install_name}}.tar.gz
|
|
||||||
|
|
||||||
build_with_makefile:
|
build_with_makefile:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
@ -440,30 +349,34 @@ jobs:
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
needs:
|
needs:
|
||||||
- build_for_linux
|
- build_for_linux
|
||||||
- build_for_mod
|
|
||||||
# - build_for_mingw
|
# - build_for_mingw
|
||||||
- build_for_windows
|
# - build_for_windows
|
||||||
- archive_source_code
|
- archive_source_code
|
||||||
steps:
|
steps:
|
||||||
- name: Set install name
|
- name: Set install name
|
||||||
run: |
|
run: |
|
||||||
echo "install_ref=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
|
echo "install_ref=${GITHUB_REF##*/}" >> "$GITHUB_ENV"
|
||||||
# - uses: actions/download-artifact@v3
|
- if: ${{ false }} # DISABLED: Use distro packages
|
||||||
# with:
|
uses: actions/download-artifact@v3
|
||||||
# name: Linux tarball
|
with:
|
||||||
|
name: Linux tarball
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: MOD devices tarball
|
name: macOS tarball
|
||||||
# - uses: actions/download-artifact@v3
|
- if: ${{ false }} # DISABLED: MinGW 32 build temporarily disabled
|
||||||
# with:
|
uses: actions/download-artifact@v3
|
||||||
# name: Win32 MinGW tarball
|
with:
|
||||||
# - uses: actions/download-artifact@v3
|
name: Win32 MinGW tarball
|
||||||
# with:
|
- if: ${{ false }} # DISABLED: MinGW 64 build temporarily disabled
|
||||||
# name: Win64 MinGW tarball
|
uses: actions/download-artifact@v3
|
||||||
- uses: actions/download-artifact@v3
|
with:
|
||||||
|
name: Win64 MinGW tarball
|
||||||
|
- if: ${{ false }} # DISABLED: Innosetup 32 in plugins repo
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: Win32 installer
|
name: Win32 installer
|
||||||
- uses: actions/download-artifact@v3
|
- if: ${{ false }} # DISABLED: Innosetup 64 in plugins repo
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: Win64 installer
|
name: Win64 installer
|
||||||
- uses: actions/download-artifact@v3
|
- uses: actions/download-artifact@v3
|
||||||
|
|
|
||||||
6
.gitignore
vendored
|
|
@ -22,12 +22,6 @@ compile_commands.json
|
||||||
clients/sfizz_jack
|
clients/sfizz_jack
|
||||||
clients/sfzprint
|
clients/sfzprint
|
||||||
|
|
||||||
/plugins/vst/download/
|
|
||||||
/plugins/vst/external/vstsdk2.4/
|
|
||||||
/plugins/vst/external/CoreAudioUtilityClasses/
|
|
||||||
|
|
||||||
/plugins/editor/external/fluentui-system-icons/
|
|
||||||
|
|
||||||
*.sublime-*
|
*.sublime-*
|
||||||
*.code-*
|
*.code-*
|
||||||
.kak.tags.namecache
|
.kak.tags.namecache
|
||||||
|
|
|
||||||
15
.gitmodules
vendored
|
|
@ -1,18 +1,6 @@
|
||||||
[submodule "external/abseil-cpp"]
|
[submodule "external/abseil-cpp"]
|
||||||
path = external/abseil-cpp
|
path = external/abseil-cpp
|
||||||
url = https://github.com/abseil/abseil-cpp.git
|
url = https://github.com/abseil/abseil-cpp.git
|
||||||
[submodule "vst/external/VST_SDK/VST3_SDK/base"]
|
|
||||||
path = plugins/vst/external/VST_SDK/VST3_SDK/base
|
|
||||||
url = https://github.com/steinbergmedia/vst3_base.git
|
|
||||||
[submodule "vst/external/VST_SDK/VST3_SDK/pluginterfaces"]
|
|
||||||
path = plugins/vst/external/VST_SDK/VST3_SDK/pluginterfaces
|
|
||||||
url = https://github.com/steinbergmedia/vst3_pluginterfaces.git
|
|
||||||
[submodule "vst/external/VST_SDK/VST3_SDK/public.sdk"]
|
|
||||||
path = plugins/vst/external/VST_SDK/VST3_SDK/public.sdk
|
|
||||||
url = https://github.com/steinbergmedia/vst3_public_sdk.git
|
|
||||||
[submodule "vst/external/VST_SDK/VST3_SDK/vstgui4"]
|
|
||||||
path = plugins/editor/external/vstgui4
|
|
||||||
url = https://github.com/sfztools/vstgui.git
|
|
||||||
[submodule "external/st_audiofile/thirdparty/dr_libs"]
|
[submodule "external/st_audiofile/thirdparty/dr_libs"]
|
||||||
path = external/st_audiofile/thirdparty/dr_libs
|
path = external/st_audiofile/thirdparty/dr_libs
|
||||||
url = https://github.com/mackron/dr_libs.git
|
url = https://github.com/mackron/dr_libs.git
|
||||||
|
|
@ -22,9 +10,6 @@
|
||||||
[submodule "external/st_audiofile/thirdparty/libaiff"]
|
[submodule "external/st_audiofile/thirdparty/libaiff"]
|
||||||
path = external/st_audiofile/thirdparty/libaiff
|
path = external/st_audiofile/thirdparty/libaiff
|
||||||
url = https://github.com/sfztools/libaiff.git
|
url = https://github.com/sfztools/libaiff.git
|
||||||
[submodule "vst/external/sfzt_auwrapper"]
|
|
||||||
path = plugins/vst/external/sfzt_auwrapper
|
|
||||||
url = https://github.com/sfztools/sfzt_auwrapper.git
|
|
||||||
[submodule "external/filesystem"]
|
[submodule "external/filesystem"]
|
||||||
path = external/filesystem
|
path = external/filesystem
|
||||||
url = https://github.com/gulrak/filesystem.git
|
url = https://github.com/gulrak/filesystem.git
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project (sfizz VERSION 1.2.2 LANGUAGES CXX C)
|
project (libsfizz VERSION 1.2.2 LANGUAGES CXX C)
|
||||||
set (PROJECT_DESCRIPTION "A library to load SFZ description files and use them to render music.")
|
set (PROJECT_DESCRIPTION "A library to load SFZ description files and use them to render music.")
|
||||||
|
|
||||||
# External configuration CMake scripts
|
# External configuration CMake scripts
|
||||||
|
|
@ -23,12 +23,6 @@ set (BUILD_TESTING OFF CACHE BOOL "Disable Abseil's tests [default: OFF]")
|
||||||
option_ex (ENABLE_LTO "Enable Link Time Optimization" ON)
|
option_ex (ENABLE_LTO "Enable Link Time Optimization" ON)
|
||||||
option_ex (SFIZZ_JACK "Enable JACK stand-alone build" CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
option_ex (SFIZZ_JACK "Enable JACK stand-alone build" CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
option_ex (SFIZZ_RENDER "Enable renderer of SMF files" ON)
|
option_ex (SFIZZ_RENDER "Enable renderer of SMF files" ON)
|
||||||
option_ex (SFIZZ_LV2 "Enable LV2 plug-in build" ON)
|
|
||||||
option_ex (SFIZZ_LV2_UI "Enable LV2 plug-in user interface" ON)
|
|
||||||
option_ex (SFIZZ_VST "Enable VST plug-in build" ON)
|
|
||||||
option_ex (SFIZZ_AU "Enable AU plug-in build" APPLE)
|
|
||||||
option_ex (SFIZZ_VST2 "Enable VST2 plug-in build (unsupported)" OFF)
|
|
||||||
option_ex (SFIZZ_PUREDATA "Enable Puredata plug-in build" OFF)
|
|
||||||
option_ex (SFIZZ_BENCHMARKS "Enable benchmarks build" OFF)
|
option_ex (SFIZZ_BENCHMARKS "Enable benchmarks build" OFF)
|
||||||
option_ex (SFIZZ_TESTS "Enable tests build" OFF)
|
option_ex (SFIZZ_TESTS "Enable tests build" OFF)
|
||||||
option_ex (SFIZZ_DEMOS "Enable feature demos build" OFF)
|
option_ex (SFIZZ_DEMOS "Enable feature demos build" OFF)
|
||||||
|
|
@ -42,15 +36,13 @@ option_ex (SFIZZ_USE_SYSTEM_SIMDE "Use SIMDe libraries preinstalled on system"
|
||||||
option_ex (SFIZZ_USE_SYSTEM_KISS_FFT "Use KISS FFT libraries preinstalled on system" OFF)
|
option_ex (SFIZZ_USE_SYSTEM_KISS_FFT "Use KISS FFT libraries preinstalled on system" OFF)
|
||||||
option_ex (SFIZZ_USE_SYSTEM_PUGIXML "Use pugixml libraries preinstalled on system" OFF)
|
option_ex (SFIZZ_USE_SYSTEM_PUGIXML "Use pugixml libraries preinstalled on system" OFF)
|
||||||
option_ex (SFIZZ_USE_SYSTEM_CXXOPTS "Use CXXOPTS libraries preinstalled on system" OFF)
|
option_ex (SFIZZ_USE_SYSTEM_CXXOPTS "Use CXXOPTS libraries preinstalled on system" OFF)
|
||||||
option_ex (SFIZZ_USE_SYSTEM_LV2 "Use LV2 headers preinstalled on system" OFF)
|
|
||||||
option_ex (SFIZZ_USE_SYSTEM_VST3SDK "Use VST3SDK source files preinstalled on system" OFF)
|
|
||||||
option_ex (SFIZZ_USE_SYSTEM_CATCH "Use Catch libraries preinstalled on system" OFF)
|
option_ex (SFIZZ_USE_SYSTEM_CATCH "Use Catch libraries preinstalled on system" OFF)
|
||||||
option_ex (SFIZZ_STATIC_DEPENDENCIES "Link dependencies statically" OFF)
|
option_ex (SFIZZ_STATIC_DEPENDENCIES "Link dependencies statically" OFF)
|
||||||
option_ex (SFIZZ_RELEASE_ASSERTS "Forced assertions in release builds" OFF)
|
option_ex (SFIZZ_RELEASE_ASSERTS "Forced assertions in release builds" OFF)
|
||||||
option_ex (SFIZZ_PROFILE_BUILD "Profile the build time" OFF)
|
option_ex (SFIZZ_PROFILE_BUILD "Profile the build time" OFF)
|
||||||
|
|
||||||
# The fixed number of controller parameters
|
# The fixed number of controller parameters
|
||||||
set(SFIZZ_NUM_CCS 512)
|
set(MIDI_CC_MAX 512 CACHE STRING "Maximum amount of Control Change Messages")
|
||||||
|
|
||||||
include (SfizzConfig)
|
include (SfizzConfig)
|
||||||
include (SfizzDeps)
|
include (SfizzDeps)
|
||||||
|
|
@ -59,15 +51,11 @@ include (SfizzFaust)
|
||||||
# Don't use IPO in non Release builds
|
# Don't use IPO in non Release builds
|
||||||
include (CheckIPO)
|
include (CheckIPO)
|
||||||
|
|
||||||
# Dylib bunder for macOS
|
|
||||||
include (BundleDylibs)
|
|
||||||
|
|
||||||
# Add the static library targets and sources
|
# Add the static library targets and sources
|
||||||
add_subdirectory (src)
|
add_subdirectory (src)
|
||||||
|
|
||||||
# Optional targets
|
# Optional targets
|
||||||
add_subdirectory (clients)
|
add_subdirectory (clients)
|
||||||
add_subdirectory (plugins)
|
|
||||||
|
|
||||||
if (SFIZZ_BENCHMARKS)
|
if (SFIZZ_BENCHMARKS)
|
||||||
add_subdirectory (benchmarks)
|
add_subdirectory (benchmarks)
|
||||||
|
|
@ -86,9 +74,4 @@ if (SFIZZ_DEVTOOLS)
|
||||||
add_subdirectory (devtools)
|
add_subdirectory (devtools)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Put it at the end so that the vst/lv2 directories are registered
|
|
||||||
if (NOT MSVC)
|
|
||||||
include(SfizzUninstall)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
show_build_info_if_needed()
|
show_build_info_if_needed()
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,6 @@ Note that we aim at implementing the sfz spec as a whole, and possibly some exte
|
||||||
Sfizz is liberally licensed and you can freely use it in any project under the term of its license and its dependencies.
|
Sfizz is liberally licensed and you can freely use it in any project under the term of its license and its dependencies.
|
||||||
We provide a somewhat simple C and C++ API that covers our use cases within plugins mostly, and should be useful.
|
We provide a somewhat simple C and C++ API that covers our use cases within plugins mostly, and should be useful.
|
||||||
The API is documented over at the [api] page.
|
The API is documented over at the [api] page.
|
||||||
You can find example of using the C API in the `lv2` directory which contains sfizz's LV2 plugin.
|
|
||||||
You can find example of using the C++ API in the `vst3` directory which contains sfizz's VST3 plugin.
|
|
||||||
In both cases sfizz is built in the plugins as a static library.
|
|
||||||
The project [sfizz-render] illustrates how one might use sfizz as a shared library through a `make`- and `pkg-config`-based process.
|
The project [sfizz-render] illustrates how one might use sfizz as a shared library through a `make`- and `pkg-config`-based process.
|
||||||
Other projects that bundle or use sfizz are:
|
Other projects that bundle or use sfizz are:
|
||||||
|
|
||||||
|
|
@ -50,12 +47,13 @@ If you want to add things we encourage you to ask around through an issue, on Di
|
||||||
|
|
||||||
### Handling the repository and its submodules
|
### Handling the repository and its submodules
|
||||||
|
|
||||||
Sfizz uses a number of submodules, namely abseil and the VST sdk.
|
Sfizz uses a number of submodules, namely abseil, ghc::filesystem and simde.
|
||||||
These submodules are purely consumed by sfizz, and the maintainers will manage updating them when needed.
|
These submodules are purely consumed by sfizz, and the maintainers will manage updating them when needed.
|
||||||
As such, they should *not* pose too much issues.
|
As such, they should *not* pose too much issues.
|
||||||
They are all pinned to specific branches or commits in their original repository.
|
They are all pinned to specific branches or commits in their original repository.
|
||||||
|
|
||||||
To clone the sfizz repository, the recommended way is to do
|
To clone the sfizz repository, the recommended way is to do
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/sfztools/sfizz.git --recursive
|
git clone https://github.com/sfztools/sfizz.git --recursive
|
||||||
# Other possibility
|
# Other possibility
|
||||||
|
|
@ -65,6 +63,7 @@ git submodule update --init
|
||||||
```
|
```
|
||||||
|
|
||||||
If after some time you happen to see something like this:
|
If after some time you happen to see something like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
❯ git status
|
❯ git status
|
||||||
On branch develop
|
On branch develop
|
||||||
|
|
@ -78,15 +77,18 @@ Changes not staged for commit:
|
||||||
|
|
||||||
no changes added to commit (use "git add" and/or "git commit -a")
|
no changes added to commit (use "git add" and/or "git commit -a")
|
||||||
```
|
```
|
||||||
|
|
||||||
Then it means that the abseil submodule *on your disk* differs from the one expected by sfizz.
|
Then it means that the abseil submodule *on your disk* differs from the one expected by sfizz.
|
||||||
This usually happens if i) you modified one of abseil's files, in which case the repository will be dirty, or ii) sfizz updated abseil's and pinned it to another commit.
|
This usually happens if i) you modified one of abseil's files, in which case the repository will be dirty, or ii) sfizz updated abseil's and pinned it to another commit.
|
||||||
Assuming you were not adding relevant changes to abseil in order to push them upstream, you can usually resolve this issue through
|
Assuming you were not adding relevant changes to abseil in order to push them upstream, you can usually resolve this issue through
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git submodule update
|
git submodule update
|
||||||
```
|
```
|
||||||
|
|
||||||
**All changes in the submodule will be lost**.
|
**All changes in the submodule will be lost**.
|
||||||
|
|
||||||
If you were in fact modifying abseil for some reason, then consider either pushing your changes upstream or find an alternative.
|
If you were in fact modifying abseil for some reason, then consider either pushing your changes upstream or find an alternative.
|
||||||
Same goes for the VST SDK.
|
|
||||||
|
|
||||||
### Building sfizz from source
|
### Building sfizz from source
|
||||||
|
|
||||||
|
|
@ -111,6 +113,7 @@ Obviously, light technical questions can be asked freely in private, but the goa
|
||||||
|
|
||||||
To start contributing, we encourage you to fork the main sfizz repository on your personal account and clone it locally on your machine
|
To start contributing, we encourage you to fork the main sfizz repository on your personal account and clone it locally on your machine
|
||||||
In the clone of your fork, and add the `sfztools` repository as a remote as follows
|
In the clone of your fork, and add the `sfztools` repository as a remote as follows
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Clone your own fork in a specific directory
|
# Clone your own fork in a specific directory
|
||||||
git clone https://github.com/MY_GITHUB_NAME/sfizz.git sfizz-fork
|
git clone https://github.com/MY_GITHUB_NAME/sfizz.git sfizz-fork
|
||||||
|
|
@ -118,6 +121,7 @@ cd sfizz-fork
|
||||||
# Add the upstream sfztools remote
|
# Add the upstream sfztools remote
|
||||||
git remote add upstream https://github.com/sfztools/sfizz.git
|
git remote add upstream https://github.com/sfztools/sfizz.git
|
||||||
```
|
```
|
||||||
|
|
||||||
Once done, the contribution process is as follows:
|
Once done, the contribution process is as follows:
|
||||||
|
|
||||||
1. Fetch the latest changes from the `upstream` remote, in particular the `develop` branch.
|
1. Fetch the latest changes from the `upstream` remote, in particular the `develop` branch.
|
||||||
|
|
@ -127,6 +131,7 @@ Once done, the contribution process is as follows:
|
||||||
5. Go back to Github web interface and create a pull request
|
5. Go back to Github web interface and create a pull request
|
||||||
|
|
||||||
In command language, this translates to
|
In command language, this translates to
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Fetch the latest status from upstrea
|
# Fetch the latest status from upstrea
|
||||||
git fetch upstream
|
git fetch upstream
|
||||||
|
|
@ -186,10 +191,13 @@ If you write anything testable however, we encourage you to write the tests.
|
||||||
We use the [Catch] library for testing, and you can check out the files in `tests/` for examples on how to add some.
|
We use the [Catch] library for testing, and you can check out the files in `tests/` for examples on how to add some.
|
||||||
|
|
||||||
To actually try your changes, you can use the `clients/sfizz_jack` client to instantiate a JACK application, or use `jalv` for a similar purpose by launching from your build directory
|
To actually try your changes, you can use the `clients/sfizz_jack` client to instantiate a JACK application, or use `jalv` for a similar purpose by launching from your build directory
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
env LV2_PATH=$PWD jalv.gtk3 http://sfztools.github.io/sfizz
|
env LV2_PATH=$PWD jalv.gtk3 http://sfztools.github.io/sfizz
|
||||||
```
|
```
|
||||||
|
|
||||||
Similarly, you can launch e.g. Ardour with suitable reference to your version of the sfizz LV2 plugin with
|
Similarly, you can launch e.g. Ardour with suitable reference to your version of the sfizz LV2 plugin with
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
env LV2_PATH=$PWD Ardour6
|
env LV2_PATH=$PWD Ardour6
|
||||||
```
|
```
|
||||||
|
|
@ -200,9 +208,11 @@ For micro-optimization purposes we have a number of benchmarks written in `bench
|
||||||
If you wonder about the performance of something, feel free to write some too and add them to the build system.
|
If you wonder about the performance of something, feel free to write some too and add them to the build system.
|
||||||
We tend to name the benchmarks with the `bm_` prefix.
|
We tend to name the benchmarks with the `bm_` prefix.
|
||||||
It can be as simple as adding a line
|
It can be as simple as adding a line
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
sfizz_add_benchmark(bm_wavfile BM_wavfile.cpp)
|
sfizz_add_benchmark(bm_wavfile BM_wavfile.cpp)
|
||||||
```
|
```
|
||||||
|
|
||||||
to the `benchmarks/CMakeLists.txt` file but you might need to link to other libraries depending on what you are benchmarking.
|
to the `benchmarks/CMakeLists.txt` file but you might need to link to other libraries depending on what you are benchmarking.
|
||||||
The `CMakeLists.txt` file contains example that you can copy and try.
|
The `CMakeLists.txt` file contains example that you can copy and try.
|
||||||
|
|
||||||
|
|
@ -213,6 +223,7 @@ For now the usage is a bit hand-made, as it requires the [sfizz-render] program
|
||||||
The logger outputs CSV files for the rendering and file-loading processes.
|
The logger outputs CSV files for the rendering and file-loading processes.
|
||||||
The file `scripts/performance_report.py` is made to process and produce a nice interactive report from this data.
|
The file `scripts/performance_report.py` is made to process and produce a nice interactive report from this data.
|
||||||
|
|
||||||
|
|
||||||
[build]: https://sfz.tools/sfizz/development/build/
|
[build]: https://sfz.tools/sfizz/development/build/
|
||||||
[benchmark]: https://github.com/google/benchmark
|
[benchmark]: https://github.com/google/benchmark
|
||||||
[sfizz-render]: https://github.com/sfztools/sfizz-render
|
[sfizz-render]: https://github.com/sfztools/sfizz-render
|
||||||
|
|
|
||||||
39
README.md
|
|
@ -8,23 +8,34 @@
|
||||||
[![ARIA Status Image]](https://sfz.tools/sfizz/development/status/opcodes/?v=aria)
|
[![ARIA Status Image]](https://sfz.tools/sfizz/development/status/opcodes/?v=aria)
|
||||||
[![Cakewalk Status Image]](https://sfz.tools/sfizz/development/status/opcodes/?v=cakewalk)
|
[![Cakewalk Status Image]](https://sfz.tools/sfizz/development/status/opcodes/?v=cakewalk)
|
||||||
|
|
||||||
SFZ parser and synth c++ library, providing AU / LV2 / VST3 plugins
|
SFZ parser and synth c++ library and JACK standalone client,
|
||||||
and JACK standalone client, please check [our website] for more details.
|
please check [our website] for more details.
|
||||||
|
|
||||||

|
## Repository reorganization
|
||||||
|
|
||||||
|
> **Warning**
|
||||||
|
>
|
||||||
|
> On 2023/05/08 the project was divided into 2 repositories:
|
||||||
|
> this contains only the library required by third-party applications,
|
||||||
|
> and [sfizz-ui] for plugins (and a future possible graphics standalone).
|
||||||
|
|
||||||
|
[sfizz-ui]: https://github.com/sfztools/sfizz-ui
|
||||||
|
|
||||||
|
So if you are looking for plugins, you can get both by looking for the `sfizz-ui`
|
||||||
|
repository instead, which contains also this one in the `library` subdirectory.
|
||||||
|
|
||||||
## Using sfizz
|
## Using sfizz
|
||||||
|
|
||||||
Sfizz can be used most easily within an LV2 host such as [Carla] or [Ardour].
|
Sfizz can be used most easily within an LV2 host such as [Carla] or [Ardour].
|
||||||
It can also be integrated as a library within your own program; check out our [API] bindings for C and C++.
|
It can also be integrated as a library within your own program; check out our [API] bindings for C and C++.
|
||||||
Our [releases] are an immediate way to get a working library or LV2/VST plugin for Windows and Mac.
|
Our [releases] are an immediate way to get a working library for Windows and Mac.
|
||||||
Linux builds are available over at [OBS].
|
Linux builds are available over at [OBS].
|
||||||
On any operating system, you might prefer to [build from source]!
|
On any operating system, you might prefer to [build from source]!
|
||||||
|
|
||||||
## Contributing to sfizz
|
## Contributing to sfizz
|
||||||
|
|
||||||
There is actually many things anyone can do, programming-related or music-related.
|
There is actually many things anyone can do, programming-related or music-related.
|
||||||
Please check out the [CONTRIBUTING](CONTRIBUTING.md) document for information about filing bug reports or feature requests, and helping the development of sfizz
|
Please check out the [CONTRIBUTING] document for information about filing bug reports or feature requests, and helping the development of sfizz
|
||||||
|
|
||||||
## Donating to sfizz
|
## Donating to sfizz
|
||||||
|
|
||||||
|
|
@ -33,11 +44,11 @@ We firmly believe in the honesty and goodwill of users as a whole, and we want t
|
||||||
|
|
||||||
No financial returns is explicitely required from using sfizz in any shape.
|
No financial returns is explicitely required from using sfizz in any shape.
|
||||||
However, if you feel that sfizz produces value for you or your products, and if you find that your financial situation allows for it, we put together ways to donate to the project.
|
However, if you feel that sfizz produces value for you or your products, and if you find that your financial situation allows for it, we put together ways to donate to the project.
|
||||||
You are never compelled to do so, the [CONTRIBUTING](CONTRIBUTING.md) file contains different ways to contribute.
|
You are never compelled to do so, the [CONTRIBUTING] file contains different ways to contribute.
|
||||||
|
|
||||||
In all of sfizz's governance model, we strive to live in the open.
|
In all of sfizz's governance model, we strive to live in the open.
|
||||||
Finances are no different, and we put in place a process so that the use of donations is as transparent as possible through our [Open Collective].
|
Finances are no different, and we put in place a process so that the use of donations is as transparent as possible through our [Open Collective].
|
||||||
We invite you to check out the [GOVERNANCE](GOVERNANCE.md) file to see how the organization is governed and how are donations handled.
|
We invite you to check out the [GOVERNANCE] file to see how the organization is governed and how are donations handled.
|
||||||
|
|
||||||
## Dependencies and licenses
|
## Dependencies and licenses
|
||||||
|
|
||||||
|
|
@ -64,14 +75,14 @@ The sfizz library also uses in some subprojects:
|
||||||
|
|
||||||
- [Catch2], licensed under the Boost Software License 1.0
|
- [Catch2], licensed under the Boost Software License 1.0
|
||||||
- [benchmark], licensed under the Apache License 2.0
|
- [benchmark], licensed under the Apache License 2.0
|
||||||
- [LV2], licensed under the ISC license
|
|
||||||
- [JACK], licensed under the GNU Lesser General Public License v2.1
|
- [JACK], licensed under the GNU Lesser General Public License v2.1
|
||||||
- [cxxopts] by Jarryd Beck, licensed under the MIT license
|
- [cxxopts] by Jarryd Beck, licensed under the MIT license
|
||||||
- [fmidi] by Jean Pierre Cimalando, licensed under the Boost Software License 1.0
|
- [fmidi] by Jean Pierre Cimalando, licensed under the Boost Software License 1.0
|
||||||
- [libsamplerate], licensed under the BSD 2-Clause license
|
- [libsamplerate], licensed under the BSD 2-Clause license
|
||||||
- [GLSL-Color-Spaces] by tobspr, licensed under the MIT license
|
|
||||||
- [stb_image] by Sean Barrett, licensed as public domain or MIT license
|
|
||||||
|
|
||||||
|
|
||||||
|
[CONTRIBUTING]: CONTRIBUTING.md
|
||||||
|
[GOVERNANCE]: GOVERNANCE.md
|
||||||
[Abseil]: https://abseil.io/
|
[Abseil]: https://abseil.io/
|
||||||
[atomic_queue]: https://github.com/max0x7ba/atomic_queue
|
[atomic_queue]: https://github.com/max0x7ba/atomic_queue
|
||||||
[benchmark]: https://github.com/google/benchmark
|
[benchmark]: https://github.com/google/benchmark
|
||||||
|
|
@ -90,9 +101,6 @@ The sfizz library also uses in some subprojects:
|
||||||
[fmidi]: https://github.com/jpcima/fmidi
|
[fmidi]: https://github.com/jpcima/fmidi
|
||||||
[libsamplerate]: http://www.mega-nerd.com/SRC/
|
[libsamplerate]: http://www.mega-nerd.com/SRC/
|
||||||
[libsndfile]: http://www.mega-nerd.com/libsndfile/
|
[libsndfile]: http://www.mega-nerd.com/libsndfile/
|
||||||
[LV2]: https://lv2plug.in/
|
|
||||||
[GLSL-Color-Spaces]: https://github.com/tobspr/GLSL-Color-Spaces
|
|
||||||
[stb_image]: https://github.com/nothings/stb
|
|
||||||
[our website]: https://sfz.tools/sfizz
|
[our website]: https://sfz.tools/sfizz
|
||||||
[releases]: https://github.com/sfztools/sfizz/releases
|
[releases]: https://github.com/sfztools/sfizz/releases
|
||||||
[Carla]: https://kx.studio/Applications:Carla
|
[Carla]: https://kx.studio/Applications:Carla
|
||||||
|
|
@ -100,11 +108,12 @@ The sfizz library also uses in some subprojects:
|
||||||
[API]: https://sfz.tools/sfizz/api/
|
[API]: https://sfz.tools/sfizz/api/
|
||||||
[Open Collective]: https://opencollective.com/sfztools
|
[Open Collective]: https://opencollective.com/sfztools
|
||||||
[build from source]: https://sfz.tools/sfizz/development/build/
|
[build from source]: https://sfz.tools/sfizz/development/build/
|
||||||
[AppVeyor Build Status]: https://img.shields.io/appveyor/ci/sfztools/sfizz.svg?label=Windows&style=popout&logo=appveyor
|
|
||||||
[Travis Build Status]: https://img.shields.io/travis/com/sfztools/sfizz.svg?label=Linux&style=popout&logo=travis
|
|
||||||
[Discord Badge Image]: https://img.shields.io/discord/587748534321807416?label=discord&logo=discord
|
[Discord Badge Image]: https://img.shields.io/discord/587748534321807416?label=discord&logo=discord
|
||||||
[OBS]: https://software.opensuse.org//download.html?project=home%3Asfztools%3Asfizz&package=sfizz
|
[OBS]: https://software.opensuse.org//download.html?project=home%3Asfztools%3Asfizz&package=sfizz
|
||||||
[SFZv1 Status Image]: https://sfz.tools/assets/img/sfizz/badge_sfz1.svg
|
[SFZv1 Status Image]: https://sfz.tools/assets/img/sfizz/badge_sfz1.svg
|
||||||
[SFZv2 Status Image]: https://sfz.tools/assets/img/sfizz/badge_sfz2.svg
|
[SFZv2 Status Image]: https://sfz.tools/assets/img/sfizz/badge_sfz2.svg
|
||||||
[ARIA Status Image]: https://sfz.tools/assets/img/sfizz/badge_aria.svg
|
[ARIA Status Image]: https://sfz.tools/assets/img/sfizz/badge_aria.svg
|
||||||
[Cakewalk Status Image]: https://sfz.tools/assets/img/sfizz/badge_cakewalk.svg
|
[Cakewalk Status Image]: https://sfz.tools/assets/img/sfizz/badge_cakewalk.svg
|
||||||
|
|
||||||
|
[AppVeyor Build Status]: https://img.shields.io/appveyor/ci/sfztools/sfizz.svg?label=Windows&style=popout&logo=appveyor
|
||||||
|
[Travis Build Status]: https://img.shields.io/travis/com/sfztools/sfizz.svg?label=Linux&style=popout&logo=travis
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ target_link_libraries(bm_filterStereoMono PRIVATE sfizz::sndfile)
|
||||||
sfizz_add_benchmark(bm_stringResonator BM_stringResonator.cpp)
|
sfizz_add_benchmark(bm_stringResonator BM_stringResonator.cpp)
|
||||||
target_link_libraries(bm_stringResonator PRIVATE sfizz::sndfile)
|
target_link_libraries(bm_stringResonator PRIVATE sfizz::sndfile)
|
||||||
|
|
||||||
if(SFIZZ_SYSTEM_PROCESSOR MATCHES "armv7l")
|
if(PROJECT_SYSTEM_PROCESSOR MATCHES "armv7l")
|
||||||
sfizz_add_benchmark(bm_pan_arm BM_pan_arm.cpp ../src/sfizz/Panning.cpp)
|
sfizz_add_benchmark(bm_pan_arm BM_pan_arm.cpp ../src/sfizz/Panning.cpp)
|
||||||
target_link_libraries(bm_pan_arm PRIVATE sfizz::jsl)
|
target_link_libraries(bm_pan_arm PRIVATE sfizz::jsl)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
# Dylib bundler for macOS
|
|
||||||
# Requires the external program "dylibbundler"
|
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
find_program(DYLIBBUNDLER_PROGRAM "dylibbundler")
|
|
||||||
if(NOT DYLIBBUNDLER_PROGRAM)
|
|
||||||
message(WARNING "The installation helper \"dylibbundler\" is not available.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
function(bundle_dylibs NAME PATH)
|
|
||||||
if(NOT APPLE OR NOT DYLIBBUNDLER_PROGRAM)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(_relative_libdir "../Frameworks")
|
|
||||||
|
|
||||||
get_filename_component(_dir "${PATH}" DIRECTORY)
|
|
||||||
set(_dir "${_dir}/${_relative_libdir}")
|
|
||||||
|
|
||||||
set(_script "${CMAKE_CURRENT_BINARY_DIR}/_bundle-dylibs.${NAME}.cmake")
|
|
||||||
|
|
||||||
file(WRITE "${_script}"
|
|
||||||
"execute_process(COMMAND \"${DYLIBBUNDLER_PROGRAM}\"
|
|
||||||
\"-cd\" \"-of\" \"-b\"
|
|
||||||
\"-x\" \"\$ENV{DESTDIR}${PATH}\"
|
|
||||||
\"-d\" \"\$ENV{DESTDIR}${_dir}\"
|
|
||||||
\"-p\" \"@loader_path/${_relative_libdir}/\")
|
|
||||||
")
|
|
||||||
|
|
||||||
install(SCRIPT "${_script}" ${ARGN})
|
|
||||||
endfunction()
|
|
||||||
|
|
@ -1,126 +0,0 @@
|
||||||
# This option is for MIDI CC support in absence of host midi:binding support
|
|
||||||
option(SFIZZ_LV2_PSA "Enable plugin-side MIDI automations" ON)
|
|
||||||
|
|
||||||
# Configuration for this plugin
|
|
||||||
# TODO: generate version from git
|
|
||||||
set(LV2PLUGIN_VERSION_MINOR 10)
|
|
||||||
set(LV2PLUGIN_VERSION_MICRO 3)
|
|
||||||
set(LV2PLUGIN_NAME "sfizz")
|
|
||||||
set(LV2PLUGIN_COMMENT "SFZ sampler")
|
|
||||||
set(LV2PLUGIN_URI "http://sfztools.github.io/sfizz")
|
|
||||||
set(LV2PLUGIN_REPOSITORY SFIZZ_REPOSITORY)
|
|
||||||
set(LV2PLUGIN_AUTHOR "SFZTools")
|
|
||||||
set(LV2PLUGIN_EMAIL "paul@ferrand.cc")
|
|
||||||
if(SFIZZ_USE_VCPKG)
|
|
||||||
set(LV2PLUGIN_SPDX_LICENSE_ID "LGPL-3.0-only")
|
|
||||||
else()
|
|
||||||
set(LV2PLUGIN_SPDX_LICENSE_ID "ISC")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SFIZZ_LV2_UI)
|
|
||||||
set(LV2PLUGIN_IF_ENABLE_UI "")
|
|
||||||
else()
|
|
||||||
set(LV2PLUGIN_IF_ENABLE_UI "#")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
set(LV2_UI_TYPE "WindowsUI")
|
|
||||||
elseif(APPLE)
|
|
||||||
set(LV2_UI_TYPE "CocoaUI")
|
|
||||||
elseif(HAIKU)
|
|
||||||
set(LV2_UI_TYPE "BeUI")
|
|
||||||
else()
|
|
||||||
set(LV2_UI_TYPE "X11UI")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
set(LV2PLUGIN_INSTALL_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/LV2" CACHE STRING
|
|
||||||
"Install destination for LV2 bundle [default: $ENV{HOME}/Library/Audio/Plug-Ins/LV2]")
|
|
||||||
elseif(MSVC)
|
|
||||||
set(LV2PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lv2" CACHE STRING
|
|
||||||
"Install destination for LV2 bundle [default: ${CMAKE_INSTALL_PREFIX}/lv2]")
|
|
||||||
else()
|
|
||||||
set(LV2PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/lv2" CACHE STRING
|
|
||||||
"Install destination for LV2 bundle [default: ${CMAKE_INSTALL_PREFIX}/lib/lv2]")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(StringUtility)
|
|
||||||
|
|
||||||
function(sfizz_lv2_generate_controllers_ttl FILE)
|
|
||||||
file(WRITE "${FILE}" "# LV2 parameters for SFZ controllers
|
|
||||||
@prefix atom: <http://lv2plug.in/ns/ext/atom#> .
|
|
||||||
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
|
|
||||||
@prefix midi: <http://lv2plug.in/ns/ext/midi#> .
|
|
||||||
@prefix patch: <http://lv2plug.in/ns/ext/patch#> .
|
|
||||||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
||||||
@prefix sfizz: <${LV2PLUGIN_URI}#> .
|
|
||||||
")
|
|
||||||
math(EXPR _j "${SFIZZ_NUM_CCS}-1")
|
|
||||||
foreach(_i RANGE "${_j}")
|
|
||||||
if(_i LESS 128 AND SFIZZ_LV2_PSA)
|
|
||||||
continue() # Don't generate automation parameters for CCs with plugin-side automation
|
|
||||||
endif()
|
|
||||||
|
|
||||||
string_left_pad(_i "${_i}" 3 0)
|
|
||||||
file(APPEND "${FILE}" "
|
|
||||||
sfizz:cc${_i}
|
|
||||||
a lv2:Parameter ;
|
|
||||||
rdfs:label \"Controller ${_i}\" ;
|
|
||||||
rdfs:range atom:Float ;
|
|
||||||
lv2:minimum 0.0 ;
|
|
||||||
lv2:maximum 1.0")
|
|
||||||
|
|
||||||
if(_i LESS 128 AND NOT SFIZZ_LV2_PSA)
|
|
||||||
math(EXPR _digit1 "${_i}>>4")
|
|
||||||
math(EXPR _digit2 "${_i}&15")
|
|
||||||
string(SUBSTRING "0123456789ABCDEF" "${_digit1}" 1 _digit1)
|
|
||||||
string(SUBSTRING "0123456789ABCDEF" "${_digit2}" 1 _digit2)
|
|
||||||
file(APPEND "${FILE}" " ;
|
|
||||||
midi:binding \"B0${_digit1}${_digit2}00\"^^midi:MidiEvent .
|
|
||||||
")
|
|
||||||
else()
|
|
||||||
file(APPEND "${FILE}" " .
|
|
||||||
")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
file(APPEND "${FILE}" "
|
|
||||||
<${LV2PLUGIN_URI}>
|
|
||||||
a lv2:Plugin ;
|
|
||||||
")
|
|
||||||
|
|
||||||
file(APPEND "${FILE}" " patch:readable")
|
|
||||||
if(NOT SFIZZ_LV2_PSA)
|
|
||||||
file(APPEND "${FILE}" " sfizz:cc000")
|
|
||||||
foreach(_i RANGE 1 "${_j}")
|
|
||||||
string_left_pad(_i "${_i}" 3 0)
|
|
||||||
file(APPEND "${FILE}" ", sfizz:cc${_i}")
|
|
||||||
endforeach()
|
|
||||||
else()
|
|
||||||
file(APPEND "${FILE}" " sfizz:cc128")
|
|
||||||
foreach(_i RANGE 129 "${_j}")
|
|
||||||
string_left_pad(_i "${_i}" 3 0)
|
|
||||||
file(APPEND "${FILE}" ", sfizz:cc${_i}")
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
file(APPEND "${FILE}" " ;
|
|
||||||
")
|
|
||||||
|
|
||||||
file(APPEND "${FILE}" " patch:writable")
|
|
||||||
if(NOT SFIZZ_LV2_PSA)
|
|
||||||
file(APPEND "${FILE}" " sfizz:cc000")
|
|
||||||
foreach(_i RANGE 1 "${_j}")
|
|
||||||
string_left_pad(_i "${_i}" 3 0)
|
|
||||||
file(APPEND "${FILE}" ", sfizz:cc${_i}")
|
|
||||||
endforeach()
|
|
||||||
else()
|
|
||||||
file(APPEND "${FILE}" " sfizz:cc128")
|
|
||||||
foreach(_i RANGE 129 "${_j}")
|
|
||||||
string_left_pad(_i "${_i}" 3 0)
|
|
||||||
file(APPEND "${FILE}" ", sfizz:cc${_i}")
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
file(APPEND "${FILE}" " .
|
|
||||||
")
|
|
||||||
endfunction()
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
|
|
||||||
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
|
|
||||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
|
||||||
foreach(file ${files})
|
|
||||||
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
|
|
||||||
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
|
||||||
exec_program(
|
|
||||||
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
|
|
||||||
OUTPUT_VARIABLE rm_out
|
|
||||||
RETURN_VALUE rm_retval
|
|
||||||
)
|
|
||||||
if(NOT "${rm_retval}" STREQUAL 0)
|
|
||||||
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
|
|
||||||
endif()
|
|
||||||
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
|
|
||||||
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
find_path(PD_INCLUDE_BASEDIR "m_pd.h" PATH_SUFFIXES "pd")
|
|
||||||
set(PD_IMP_DEF "${PROJECT_SOURCE_DIR}/plugins/puredata/external/pd/bin/pd.def")
|
|
||||||
|
|
||||||
if(PD_INCLUDE_BASEDIR)
|
|
||||||
message(STATUS "Puredata headers: ${PUREDATA_INCLUDE_DIR}")
|
|
||||||
else()
|
|
||||||
message(STATUS "Puredata headers not found, using our own")
|
|
||||||
set(PD_INCLUDE_BASEDIR "${PROJECT_SOURCE_DIR}/plugins/puredata/external/pd/include")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
set(PUREDATA_SUFFIX ".dll")
|
|
||||||
elseif(APPLE)
|
|
||||||
set(PUREDATA_SUFFIX ".pd_darwin")
|
|
||||||
else()
|
|
||||||
set(PUREDATA_SUFFIX ".pd_linux")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
set(PDPLUGIN_INSTALL_DIR "$ENV{HOME}/Library/Pd" CACHE STRING
|
|
||||||
"Install destination for Puredata bundle [default: $ENV{HOME}/Library/Pd]")
|
|
||||||
elseif(MSVC)
|
|
||||||
set(PDPLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/Pd/extra" CACHE STRING
|
|
||||||
"Install destination for Puredata bundle [default: ${CMAKE_INSTALL_PREFIX}/Pd/extra]")
|
|
||||||
else()
|
|
||||||
set(PDPLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/pd/extra" CACHE STRING
|
|
||||||
"Install destination for Puredata bundle [default: ${CMAKE_INSTALL_PREFIX}/lib/pd/extra]")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
add_library(pdex-implib STATIC IMPORTED)
|
|
||||||
if(MSVC)
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT "pd.lib"
|
|
||||||
COMMAND "lib" "/out:pd.lib" "/def:${PD_IMP_DEF}" "/machine:${MSVC_C_ARCHITECTURE_ID}"
|
|
||||||
DEPENDS "${PD_IMP_DEF}")
|
|
||||||
add_custom_target(pdex-implib-generated
|
|
||||||
DEPENDS "pd.lib")
|
|
||||||
set_target_properties(pdex-implib PROPERTIES
|
|
||||||
IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/pd.lib")
|
|
||||||
else()
|
|
||||||
find_program(PD_DLLTOOL_PROGRAM "dlltool")
|
|
||||||
if(NOT PD_DLLTOOL_PROGRAM)
|
|
||||||
message(FATAL_ERROR "Cannot find dlltool")
|
|
||||||
endif()
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT "libpd.dll.a"
|
|
||||||
COMMAND "${PD_DLLTOOL_PROGRAM}" "-l" "libpd.dll.a" "-d" "${PD_IMP_DEF}"
|
|
||||||
DEPENDS "${PD_IMP_DEF}")
|
|
||||||
add_custom_target(pdex-implib-generated
|
|
||||||
DEPENDS "libpd.dll.a")
|
|
||||||
set_target_properties(pdex-implib PROPERTIES
|
|
||||||
IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/libpd.dll.a")
|
|
||||||
endif()
|
|
||||||
add_dependencies(pdex-implib pdex-implib-generated)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
function(add_pd_external TARGET)
|
|
||||||
add_library("${TARGET}" MODULE ${ARGN})
|
|
||||||
target_include_directories("${TARGET}" PRIVATE "${PD_INCLUDE_BASEDIR}")
|
|
||||||
set_target_properties("${TARGET}" PROPERTIES
|
|
||||||
PREFIX ""
|
|
||||||
SUFFIX "${PUREDATA_SUFFIX}")
|
|
||||||
if(APPLE)
|
|
||||||
set_property(TARGET "${TARGET}" APPEND_STRING
|
|
||||||
PROPERTY LINK_FLAGS " -Wl,-undefined,suppress,-flat_namespace")
|
|
||||||
elseif(WIN32)
|
|
||||||
target_link_libraries("${TARGET}" PRIVATE pdex-implib)
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
@ -4,8 +4,9 @@ include(CheckCXXCompilerFlag)
|
||||||
include(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
include(GNUWarnings)
|
include(GNUWarnings)
|
||||||
|
|
||||||
# FIXME: The current Abseil LTS version requires at least C++14, see
|
# TODO:
|
||||||
# https://github.com/abseil/abseil-cpp/releases/tag/20230125.1
|
# C++14 is the minimum standard version required by Abseil LTS 20230125.1 and later, see
|
||||||
|
# https://github.com/abseil/abseil-cpp/releases/tag/20230125.1
|
||||||
set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to be used")
|
set(CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to be used")
|
||||||
set(CMAKE_C_STANDARD 99 CACHE STRING "C standard to be used")
|
set(CMAKE_C_STANDARD 99 CACHE STRING "C standard to be used")
|
||||||
|
|
||||||
|
|
@ -21,9 +22,6 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
|
||||||
# Set C++ compatibility level
|
# Set C++ compatibility level
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND CMAKE_CXX_STANDARD LESS 17)
|
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND CMAKE_CXX_STANDARD LESS 17)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
elseif((SFIZZ_LV2_UI OR SFIZZ_VST OR SFIZZ_AU OR SFIZZ_VST2) AND CMAKE_CXX_STANDARD LESS 17)
|
|
||||||
# if the UI is part of the build, make it 17
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set build profiling options
|
# Set build profiling options
|
||||||
|
|
@ -88,21 +86,20 @@ endif()
|
||||||
|
|
||||||
# The variable CMAKE_SYSTEM_PROCESSOR is incorrect on Visual studio...
|
# The variable CMAKE_SYSTEM_PROCESSOR is incorrect on Visual studio...
|
||||||
# see https://gitlab.kitware.com/cmake/cmake/issues/15170
|
# see https://gitlab.kitware.com/cmake/cmake/issues/15170
|
||||||
|
if(NOT PROJECT_SYSTEM_PROCESSOR)
|
||||||
if(NOT SFIZZ_SYSTEM_PROCESSOR)
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
set(SFIZZ_SYSTEM_PROCESSOR "${MSVC_CXX_ARCHITECTURE_ID}")
|
set(PROJECT_SYSTEM_PROCESSOR "${MSVC_CXX_ARCHITECTURE_ID}" CACHE STRING "" FORCE)
|
||||||
else()
|
else()
|
||||||
set(SFIZZ_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}")
|
set(PROJECT_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}" CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Add required flags for the builds
|
# Add required flags for the builds
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||||
gw_warn(-Wall -Wextra -Wno-multichar -Werror=return-type)
|
gw_warn(-Wall -Wextra -Wno-multichar -Werror=return-type)
|
||||||
if(SFIZZ_SYSTEM_PROCESSOR MATCHES "^(i.86|x86_64)$")
|
if(PROJECT_SYSTEM_PROCESSOR MATCHES "^(i.86|x86_64)$")
|
||||||
add_compile_options(-msse2)
|
add_compile_options(-msse2)
|
||||||
elseif(SFIZZ_SYSTEM_PROCESSOR MATCHES "^(arm.*)$")
|
elseif(PROJECT_SYSTEM_PROCESSOR MATCHES "^(arm.*)$")
|
||||||
add_compile_options(-mfpu=neon)
|
add_compile_options(-mfpu=neon)
|
||||||
if(NOT ANDROID)
|
if(NOT ANDROID)
|
||||||
add_compile_options(-mfloat-abi=hard)
|
add_compile_options(-mfloat-abi=hard)
|
||||||
|
|
@ -134,21 +131,24 @@ endif()
|
||||||
set(SFIZZ_REPOSITORY https://github.com/sfztools/sfizz)
|
set(SFIZZ_REPOSITORY https://github.com/sfztools/sfizz)
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
|
if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||||
|
set(PROJECT_IS_MAIN TRUE)
|
||||||
|
else()
|
||||||
|
set(PROJECT_IS_MAIN FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Don't show build information when building a different project
|
# Don't show build information when building a different project
|
||||||
function(show_build_info_if_needed)
|
function(show_build_info_if_needed)
|
||||||
if(CMAKE_PROJECT_NAME STREQUAL "sfizz")
|
if(PROJECT_IS_MAIN)
|
||||||
message(STATUS "
|
message(STATUS "
|
||||||
Project name: ${PROJECT_NAME}
|
Project name: ${PROJECT_NAME}
|
||||||
|
CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD}
|
||||||
Build type: ${CMAKE_BUILD_TYPE}
|
Build type: ${CMAKE_BUILD_TYPE}
|
||||||
Build processor: ${SFIZZ_SYSTEM_PROCESSOR}
|
Build processor: ${PROJECT_SYSTEM_PROCESSOR}
|
||||||
Build using LTO: ${ENABLE_LTO}
|
Build using LTO: ${ENABLE_LTO}
|
||||||
Build as shared library: ${SFIZZ_SHARED}
|
Build as shared library: ${SFIZZ_SHARED}
|
||||||
Build JACK stand-alone client: ${SFIZZ_JACK}
|
Build JACK stand-alone client: ${SFIZZ_JACK}
|
||||||
Build render client: ${SFIZZ_RENDER}
|
Build render client: ${SFIZZ_RENDER}
|
||||||
Build LV2 plug-in: ${SFIZZ_LV2}
|
|
||||||
Build LV2 user interface: ${SFIZZ_LV2_UI}
|
|
||||||
Build VST plug-in: ${SFIZZ_VST}
|
|
||||||
Build AU plug-in: ${SFIZZ_AU}
|
|
||||||
Build benchmarks: ${SFIZZ_BENCHMARKS}
|
Build benchmarks: ${SFIZZ_BENCHMARKS}
|
||||||
Build tests: ${SFIZZ_TESTS}
|
Build tests: ${SFIZZ_TESTS}
|
||||||
Build demos: ${SFIZZ_DEMOS}
|
Build demos: ${SFIZZ_DEMOS}
|
||||||
|
|
@ -159,9 +159,29 @@ Statically link dependencies: ${SFIZZ_STATIC_DEPENDENCIES}
|
||||||
Use clang libc++: ${USE_LIBCPP}
|
Use clang libc++: ${USE_LIBCPP}
|
||||||
Release asserts: ${SFIZZ_RELEASE_ASSERTS}
|
Release asserts: ${SFIZZ_RELEASE_ASSERTS}
|
||||||
|
|
||||||
Install prefix: ${CMAKE_INSTALL_PREFIX}
|
Use system abseil-cpp: ${SFIZZ_USE_SYSTEM_ABSEIL}
|
||||||
LV2 destination directory: ${LV2PLUGIN_INSTALL_DIR}
|
Use system catch: ${SFIZZ_USE_SYSTEM_CATCH}
|
||||||
|
Use system cxxopts: ${SFIZZ_USE_SYSTEM_CXXOPTS}
|
||||||
|
Use system ghc-filesystem: ${SFIZZ_USE_SYSTEM_GHC_FS}
|
||||||
|
Use system kiss-fft: ${SFIZZ_USE_SYSTEM_KISS_FFT}
|
||||||
|
Use system pugixml: ${SFIZZ_USE_SYSTEM_PUGIXML}
|
||||||
|
Use system simde: ${SFIZZ_USE_SYSTEM_SIMDE}")
|
||||||
|
if(CMAKE_PROJECT_NAME STREQUAL "sfizz")
|
||||||
|
message(STATUS "
|
||||||
|
Build AU plug-in: ${SFIZZ_AU}
|
||||||
|
Build LV2 plug-in: ${SFIZZ_LV2}
|
||||||
|
Build LV2 user interface: ${SFIZZ_LV2_UI}
|
||||||
|
Build VST plug-in: ${SFIZZ_VST}
|
||||||
|
|
||||||
|
Use system lv2: ${SFIZZ_USE_SYSTEM_LV2}
|
||||||
|
Use system vst3sdk sources: ${SFIZZ_USE_SYSTEM_VST3SDK}
|
||||||
|
|
||||||
LV2 plugin-side CC automation ${SFIZZ_LV2_PSA}
|
LV2 plugin-side CC automation ${SFIZZ_LV2_PSA}
|
||||||
|
LV2 destination directory: ${LV2PLUGIN_INSTALL_DIR}
|
||||||
|
VST destination directory: ${VSTPLUGIN_INSTALL_DIR}")
|
||||||
|
endif()
|
||||||
|
message(STATUS "
|
||||||
|
Install prefix: ${CMAKE_INSTALL_PREFIX}
|
||||||
|
|
||||||
Compiler CXX debug flags: ${CMAKE_CXX_FLAGS_DEBUG}
|
Compiler CXX debug flags: ${CMAKE_CXX_FLAGS_DEBUG}
|
||||||
Compiler CXX release flags: ${CMAKE_CXX_FLAGS_RELEASE}
|
Compiler CXX release flags: ${CMAKE_CXX_FLAGS_RELEASE}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ if(OPENMP_FOUND)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Find macOS system libraries
|
# Find macOS system libraries
|
||||||
|
# TODO: remove UI libs which was used by plugins only
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
find_library(APPLE_COREFOUNDATION_LIBRARY "CoreFoundation")
|
find_library(APPLE_COREFOUNDATION_LIBRARY "CoreFoundation")
|
||||||
find_library(APPLE_FOUNDATION_LIBRARY "Foundation")
|
find_library(APPLE_FOUNDATION_LIBRARY "Foundation")
|
||||||
|
|
@ -53,9 +54,30 @@ endif()
|
||||||
# Add Abseil
|
# Add Abseil
|
||||||
if(SFIZZ_USE_SYSTEM_ABSEIL)
|
if(SFIZZ_USE_SYSTEM_ABSEIL)
|
||||||
find_package(absl REQUIRED)
|
find_package(absl REQUIRED)
|
||||||
# Workaround for silent Abseil module, see #1117
|
|
||||||
if(absl_FOUND)
|
if(absl_FOUND)
|
||||||
|
# FIXME:
|
||||||
|
# 1. Workaround for silent Abseil module, see #1117
|
||||||
message(STATUS "Found system Abseil libraries, version ${absl_VERSION}")
|
message(STATUS "Found system Abseil libraries, version ${absl_VERSION}")
|
||||||
|
# 2. The current Abseil LTS version requires at least C++14, see
|
||||||
|
# https://github.com/abseil/abseil-cpp/releases/tag/20230125.1
|
||||||
|
# but results in errors by using std::string_view, optional etc.,
|
||||||
|
# due to an ABI incompatibility with the installed system library
|
||||||
|
# when built with C++17. This is happens at least with Archlinux and FreeBSD,
|
||||||
|
# so in cases like these a -D CMAKE_CXX_STANDARD=17 is required.
|
||||||
|
# 3. We'll need also to check if to set ABSL_PROPAGATE_CXX_STD=OFF
|
||||||
|
# in future versions because the above issue.
|
||||||
|
|
||||||
|
# Make Abseil to be usable globally also for plugins project:
|
||||||
|
# in CMake 3.24+ we can use `find_package(absl REQUIRED GLOBAL)`,
|
||||||
|
# this requires CMake 3.11+ instead.
|
||||||
|
# For older versions compatibility see
|
||||||
|
# https://stackoverflow.com/questions/45401212/how-to-make-imported-target-global-afterwards
|
||||||
|
set_target_properties(
|
||||||
|
absl::strings
|
||||||
|
absl::optional
|
||||||
|
absl::container_common
|
||||||
|
PROPERTIES IMPORTED_GLOBAL TRUE
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
function(sfizz_add_vendor_abseil)
|
function(sfizz_add_vendor_abseil)
|
||||||
|
|
@ -306,7 +328,7 @@ if(JACK_FOUND)
|
||||||
link_directories(${JACK_LIBRARY_DIRS})
|
link_directories(${JACK_LIBRARY_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# The Qt library
|
# The Qt library (CaptureEG devtool)
|
||||||
find_package(Qt5 COMPONENTS Widgets)
|
find_package(Qt5 COMPONENTS Widgets)
|
||||||
|
|
||||||
# The fmidi library
|
# The fmidi library
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ macro(sfizz_add_simd_sources SOURCES_VAR PREFIX)
|
||||||
|
|
||||||
# For CPU-dispatched X86 sources
|
# For CPU-dispatched X86 sources
|
||||||
# Always build them for all X86 targets.
|
# Always build them for all X86 targets.
|
||||||
if(SFIZZ_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64|x64|X64|i.86|x86|X86)$")
|
if(PROJECT_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64|x64|X64|i.86|x86|X86)$")
|
||||||
# on GCC, it requires to set ISA support flags on individual files
|
# on GCC, it requires to set ISA support flags on individual files
|
||||||
# to be able to use the intrinsics
|
# to be able to use the intrinsics
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
if(NOT TARGET uninstall)
|
|
||||||
configure_file(
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/MakeUninstall.cmake.in"
|
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/MakeUninstall.cmake"
|
|
||||||
IMMEDIATE @ONLY)
|
|
||||||
|
|
||||||
add_custom_target(uninstall
|
|
||||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/MakeUninstall.cmake)
|
|
||||||
|
|
||||||
if(SFIZZ_LV2 AND LV2PLUGIN_INSTALL_DIR)
|
|
||||||
add_custom_command(TARGET uninstall
|
|
||||||
COMMAND rm -rv "${LV2PLUGIN_INSTALL_DIR}/${PROJECT_NAME}.lv2")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SFIZZ_VST AND VSTPLUGIN_INSTALL_DIR)
|
|
||||||
add_custom_command(TARGET uninstall
|
|
||||||
COMMAND rm -rv "${VSTPLUGIN_INSTALL_DIR}/${PROJECT_NAME}.vst3")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
# SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
function(string_left_pad VAR INPUT LENGTH FILLCHAR)
|
|
||||||
set(_output "${INPUT}")
|
|
||||||
string(LENGTH "${_output}" _length)
|
|
||||||
while(_length LESS "${LENGTH}")
|
|
||||||
set(_output "${FILLCHAR}${_output}")
|
|
||||||
string(LENGTH "${_output}" _length)
|
|
||||||
endwhile()
|
|
||||||
set("${VAR}" "${_output}" PARENT_SCOPE)
|
|
||||||
endfunction()
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
set(VSTPLUGIN_NAME "sfizz")
|
|
||||||
set(VSTPLUGIN_VENDOR "SFZTools")
|
|
||||||
set(VSTPLUGIN_URL "http://sfztools.github.io/sfizz")
|
|
||||||
set(VSTPLUGIN_EMAIL "paul@ferrand.cc")
|
|
||||||
|
|
||||||
if(APPLE)
|
|
||||||
set(VSTPLUGIN_INSTALL_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/VST3" CACHE STRING
|
|
||||||
"Install destination for VST bundle [default: $ENV{HOME}/Library/Audio/Plug-Ins/VST3]")
|
|
||||||
set(AUPLUGIN_INSTALL_DIR "$ENV{HOME}/Library/Audio/Plug-Ins/Components" CACHE STRING
|
|
||||||
"Install destination for AudioUnit bundle [default: $ENV{HOME}/Library/Audio/Plug-Ins/Components]")
|
|
||||||
elseif(MSVC)
|
|
||||||
set(VSTPLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/vst3" CACHE STRING
|
|
||||||
"Install destination for VST bundle [default: ${CMAKE_INSTALL_PREFIX}/vst3]")
|
|
||||||
else()
|
|
||||||
set(VSTPLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/vst3" CACHE STRING
|
|
||||||
"Install destination for VST bundle [default: ${CMAKE_INSTALL_PREFIX}/lib/vst3]")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT VST3_SYSTEM_PROCESSOR)
|
|
||||||
set(VST3_SYSTEM_PROCESSOR "${SFIZZ_SYSTEM_PROCESSOR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "The system architecture is: ${VST3_SYSTEM_PROCESSOR}")
|
|
||||||
|
|
||||||
# --- VST3 Bundle architecture ---
|
|
||||||
if(NOT VST3_PACKAGE_ARCHITECTURE)
|
|
||||||
if(APPLE)
|
|
||||||
# VST3 packages are universal on Apple, architecture string not needed
|
|
||||||
else()
|
|
||||||
if(VST3_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64|x64|X64)$")
|
|
||||||
set(VST3_PACKAGE_ARCHITECTURE "x86_64")
|
|
||||||
elseif(VST3_SYSTEM_PROCESSOR MATCHES "^(i.86|x86|X86)$")
|
|
||||||
if(WIN32)
|
|
||||||
set(VST3_PACKAGE_ARCHITECTURE "x86")
|
|
||||||
else()
|
|
||||||
set(VST3_PACKAGE_ARCHITECTURE "i386")
|
|
||||||
endif()
|
|
||||||
elseif(VST3_SYSTEM_PROCESSOR MATCHES "^(armv[3-8][a-z]*)$")
|
|
||||||
set(VST3_PACKAGE_ARCHITECTURE "${VST3_SYSTEM_PROCESSOR}")
|
|
||||||
elseif(VST3_SYSTEM_PROCESSOR MATCHES "^(aarch64)$")
|
|
||||||
set(VST3_PACKAGE_ARCHITECTURE "aarch64")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "We don't know this architecture for VST3: ${VST3_SYSTEM_PROCESSOR}.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "The VST3 architecture is deduced as: ${VST3_PACKAGE_ARCHITECTURE}")
|
|
||||||
BIN
mac/dmg-back.png
|
Before Width: | Height: | Size: 18 KiB |
251
mac/dmg-back.svg
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 40 KiB |
|
|
@ -1,60 +0,0 @@
|
||||||
add_library(plugins-common STATIC EXCLUDE_FROM_ALL
|
|
||||||
"common/plugin/RMSFollower.h"
|
|
||||||
"common/plugin/MessageUtils.h"
|
|
||||||
"common/plugin/MessageUtils.cpp"
|
|
||||||
"common/plugin/InstrumentDescription.h"
|
|
||||||
"common/plugin/InstrumentDescription.cpp"
|
|
||||||
"common/plugin/NativeHelpers.h"
|
|
||||||
"common/plugin/NativeHelpers.cpp"
|
|
||||||
"common/plugin/SfizzFileScan.h"
|
|
||||||
"common/plugin/SfizzFileScan.cpp"
|
|
||||||
"common/plugin/FileTrie.h"
|
|
||||||
"common/plugin/FileTrie.cpp"
|
|
||||||
"common/plugin/SfizzForeignPaths.h"
|
|
||||||
"common/plugin/SfizzForeignPaths.cpp"
|
|
||||||
"common/plugin/SfizzSettings.h"
|
|
||||||
"common/plugin/SfizzSettings.cpp")
|
|
||||||
if(APPLE)
|
|
||||||
target_sources(plugins-common PRIVATE
|
|
||||||
"common/plugin/SfizzForeignPaths.mm"
|
|
||||||
"common/plugin/SfizzSettings.mm"
|
|
||||||
"common/plugin/NativeHelpers.mm")
|
|
||||||
set_property(
|
|
||||||
SOURCE "common/plugin/SfizzForeignPaths.mm"
|
|
||||||
"common/plugin/SfizzSettings.mm"
|
|
||||||
"common/plugin/NativeHelpers.mm"
|
|
||||||
APPEND_STRING
|
|
||||||
PROPERTY COMPILE_FLAGS " -fobjc-arc")
|
|
||||||
endif()
|
|
||||||
target_include_directories(plugins-common PUBLIC "common")
|
|
||||||
target_link_libraries(plugins-common
|
|
||||||
PUBLIC sfizz::spin_mutex
|
|
||||||
PUBLIC sfizz::simde sfizz::filesystem absl::strings
|
|
||||||
PRIVATE sfizz::pugixml
|
|
||||||
PRIVATE sfizz::internal sfizz::sfizz)
|
|
||||||
add_library(sfizz::plugins-common ALIAS plugins-common)
|
|
||||||
|
|
||||||
# Link system dependencies
|
|
||||||
if(WIN32)
|
|
||||||
elseif(ANDROID)
|
|
||||||
elseif(APPLE)
|
|
||||||
target_link_libraries(plugins-common PRIVATE
|
|
||||||
"${APPLE_FOUNDATION_LIBRARY}")
|
|
||||||
else()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if((SFIZZ_LV2 AND SFIZZ_LV2_UI) OR SFIZZ_VST OR SFIZZ_AU OR SFIZZ_VST2)
|
|
||||||
add_subdirectory(editor)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SFIZZ_LV2)
|
|
||||||
add_subdirectory(lv2)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if((SFIZZ_VST OR SFIZZ_AU OR SFIZZ_VST2) AND NOT (SFIZZ_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc).*"))
|
|
||||||
add_subdirectory(vst)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SFIZZ_PUREDATA)
|
|
||||||
add_subdirectory(puredata)
|
|
||||||
endif()
|
|
||||||
|
|
@ -1,108 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "FileTrie.h"
|
|
||||||
#include <iostream>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
constexpr size_t FileTrie::npos;
|
|
||||||
|
|
||||||
fs::path FileTrie::at(size_t index) const
|
|
||||||
{
|
|
||||||
if (index >= entries_.size())
|
|
||||||
throw std::out_of_range("FileTrie::at");
|
|
||||||
return pathFromEntry(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
fs::path FileTrie::operator[](size_t index) const
|
|
||||||
{
|
|
||||||
assert(index < entries_.size());
|
|
||||||
return pathFromEntry(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
fs::path FileTrie::pathFromEntry(size_t index) const
|
|
||||||
{
|
|
||||||
const Entry* currentEntry = &entries_[index];
|
|
||||||
fs::path path = fs::u8path(currentEntry->name);
|
|
||||||
|
|
||||||
size_t currentIndex;
|
|
||||||
while ((currentIndex = currentEntry->parent) != npos) {
|
|
||||||
currentEntry = &entries_[currentIndex];
|
|
||||||
path = fs::u8path(currentEntry->name) / path;
|
|
||||||
}
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const FileTrie& trie)
|
|
||||||
{
|
|
||||||
os << '{' << '\n';
|
|
||||||
for (size_t i = 0, n = trie.size(); i < n; ++i)
|
|
||||||
os << '\t' << i << ':' << ' ' << trie[i] << ',' << '\n';
|
|
||||||
os << '}';
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
FileTrieBuilder::FileTrieBuilder(size_t initialCapacity)
|
|
||||||
{
|
|
||||||
FileTrie& trie = trie_;
|
|
||||||
trie.entries_.reserve(initialCapacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
FileTrie&& FileTrieBuilder::build()
|
|
||||||
{
|
|
||||||
FileTrie& trie = trie_;
|
|
||||||
trie.entries_.shrink_to_fit();
|
|
||||||
return std::move(trie);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t FileTrieBuilder::addFile(const fs::path& path)
|
|
||||||
{
|
|
||||||
if (path.empty())
|
|
||||||
return FileTrie::npos;
|
|
||||||
|
|
||||||
size_t dirIndex = ensureDirectory(path.parent_path());
|
|
||||||
|
|
||||||
FileTrie& trie = trie_;
|
|
||||||
FileTrie::Entry ent;
|
|
||||||
ent.parent = dirIndex;
|
|
||||||
ent.name = (--path.end())->u8string();
|
|
||||||
|
|
||||||
size_t fileIndex = trie.entries_.size();
|
|
||||||
trie.entries_.push_back(std::move(ent));
|
|
||||||
|
|
||||||
return fileIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t FileTrieBuilder::ensureDirectory(const fs::path& dirPath)
|
|
||||||
{
|
|
||||||
if (dirPath.empty())
|
|
||||||
return FileTrie::npos;
|
|
||||||
|
|
||||||
const fs::path::string_type& dirNat = dirPath.native();
|
|
||||||
auto it = directories_.find(dirNat);
|
|
||||||
if (it != directories_.end())
|
|
||||||
return it->second;
|
|
||||||
|
|
||||||
FileTrie& trie = trie_;
|
|
||||||
FileTrie::Entry ent;
|
|
||||||
ent.parent = FileTrie::npos;
|
|
||||||
ent.name = (--dirPath.end())->u8string();
|
|
||||||
if (dirPath.has_parent_path()) {
|
|
||||||
fs::path parentPath = dirPath.parent_path();
|
|
||||||
if (parentPath != dirPath)
|
|
||||||
ent.parent = ensureDirectory(parentPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t dirIndex = trie.entries_.size();
|
|
||||||
trie.entries_.push_back(std::move(ent));
|
|
||||||
|
|
||||||
directories_[dirNat] = dirIndex;
|
|
||||||
|
|
||||||
return dirIndex;
|
|
||||||
}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <ghc/fs_std.hpp>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <unordered_map>
|
|
||||||
#include <iosfwd>
|
|
||||||
#include <cstddef>
|
|
||||||
|
|
||||||
class FileTrie {
|
|
||||||
public:
|
|
||||||
static constexpr size_t npos = ~size_t(0);
|
|
||||||
|
|
||||||
size_t size() const noexcept { return entries_.size(); }
|
|
||||||
fs::path at(size_t index) const;
|
|
||||||
fs::path operator[](size_t index) const;
|
|
||||||
void clear() noexcept { entries_.clear(); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
fs::path pathFromEntry(size_t index) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct Entry {
|
|
||||||
size_t parent = npos;
|
|
||||||
std::string name;
|
|
||||||
};
|
|
||||||
std::vector<Entry> entries_;
|
|
||||||
|
|
||||||
friend class FileTrieBuilder;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const FileTrie& trie);
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
class FileTrieBuilder {
|
|
||||||
public:
|
|
||||||
explicit FileTrieBuilder(size_t initialCapacity = 8192);
|
|
||||||
FileTrie&& build();
|
|
||||||
size_t addFile(const fs::path& path);
|
|
||||||
|
|
||||||
private:
|
|
||||||
size_t ensureDirectory(const fs::path& dirPath);
|
|
||||||
|
|
||||||
private:
|
|
||||||
FileTrie trie_;
|
|
||||||
std::unordered_map<fs::path::string_type, size_t> directories_;
|
|
||||||
};
|
|
||||||
|
|
@ -1,224 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "InstrumentDescription.h"
|
|
||||||
#include "MessageUtils.h"
|
|
||||||
#include "sfizz.hpp"
|
|
||||||
#include <absl/strings/str_cat.h>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <memory>
|
|
||||||
#include <iostream>
|
|
||||||
#include <cstring>
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
template <class... Args>
|
|
||||||
static void bufferedStrCat(std::string* buffer, const Args&... args)
|
|
||||||
{
|
|
||||||
buffer->clear();
|
|
||||||
absl::StrAppend(buffer, args...);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string getDescriptionBlob(sfizz_synth_t* handle)
|
|
||||||
{
|
|
||||||
std::string blob;
|
|
||||||
blob.reserve(128 * 1024);
|
|
||||||
|
|
||||||
std::vector<char> msgbuf;
|
|
||||||
msgbuf.resize(1024);
|
|
||||||
|
|
||||||
std::string pathbuf;
|
|
||||||
pathbuf.reserve(256);
|
|
||||||
|
|
||||||
struct ClientData {
|
|
||||||
sfz::Sfizz* synth = nullptr;
|
|
||||||
sfz::Client* client = nullptr;
|
|
||||||
std::string* blob = nullptr;
|
|
||||||
std::vector<char>* msgbuf = nullptr;
|
|
||||||
std::string* pathbuf = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
sfz::Sfizz synth(handle);
|
|
||||||
ClientData cdata;
|
|
||||||
sfz::ClientPtr client = synth.createClient(&cdata);
|
|
||||||
cdata.synth = &synth;
|
|
||||||
cdata.client = client.get();
|
|
||||||
cdata.blob = &blob;
|
|
||||||
cdata.msgbuf = &msgbuf;
|
|
||||||
cdata.pathbuf = &pathbuf;
|
|
||||||
|
|
||||||
synth.setReceiveCallback(*client, [](void* data, int, const char* path, const char* sig, const sfizz_arg_t* args) {
|
|
||||||
ClientData& cdata = *reinterpret_cast<ClientData*>(data);
|
|
||||||
unsigned indices[8];
|
|
||||||
|
|
||||||
///
|
|
||||||
uint32_t msglen = sfizz_prepare_message(cdata.msgbuf->data(), cdata.msgbuf->size(), path, sig, args);
|
|
||||||
if (msglen > cdata.msgbuf->size()) {
|
|
||||||
cdata.msgbuf->resize(msglen);
|
|
||||||
sfizz_prepare_message(cdata.msgbuf->data(), cdata.msgbuf->size(), path, sig, args);
|
|
||||||
}
|
|
||||||
cdata.blob->append(cdata.msgbuf->data(), msglen);
|
|
||||||
|
|
||||||
///
|
|
||||||
if (Messages::matchOSC("/key/slots", path, indices) && !strcmp(sig, "b")) {
|
|
||||||
ConstBitSpan bits(args[0].b->data, 8 * args[0].b->size);
|
|
||||||
for (unsigned key = 0; key < 128 && key < bits.bit_size(); ++key) {
|
|
||||||
if (bits.test(key)) {
|
|
||||||
bufferedStrCat(cdata.pathbuf, "/key", key, "/label");
|
|
||||||
cdata.synth->sendMessage(*cdata.client, 0, cdata.pathbuf->c_str(), "", nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Messages::matchOSC("/sw/last/slots", path, indices) && !strcmp(sig, "b")) {
|
|
||||||
ConstBitSpan bits(args[0].b->data, 8 * args[0].b->size);
|
|
||||||
for (unsigned key = 0; key < 128 && key < bits.bit_size(); ++key) {
|
|
||||||
if (bits.test(key)) {
|
|
||||||
bufferedStrCat(cdata.pathbuf, "/sw/last/", key, "/label");
|
|
||||||
cdata.synth->sendMessage(*cdata.client, 0, cdata.pathbuf->c_str(), "", nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (Messages::matchOSC("/cc/slots", path, indices) && !strcmp(sig, "b")) {
|
|
||||||
ConstBitSpan bits(args[0].b->data, 8 * args[0].b->size);
|
|
||||||
for (unsigned cc = 0; cc < sfz::config::numCCs && cc < bits.bit_size(); ++cc) {
|
|
||||||
if (bits.test(cc)) {
|
|
||||||
bufferedStrCat(cdata.pathbuf, "/cc", cc, "/label");
|
|
||||||
cdata.synth->sendMessage(*cdata.client, 0, cdata.pathbuf->c_str(), "", nullptr);
|
|
||||||
bufferedStrCat(cdata.pathbuf, "/cc", cc, "/default");
|
|
||||||
cdata.synth->sendMessage(*cdata.client, 0, cdata.pathbuf->c_str(), "", nullptr);
|
|
||||||
bufferedStrCat(cdata.pathbuf, "/cc", cc, "/value");
|
|
||||||
cdata.synth->sendMessage(*cdata.client, 0, cdata.pathbuf->c_str(), "", nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
synth.sendMessage(*client, 0, "/num_regions", "", nullptr);
|
|
||||||
synth.sendMessage(*client, 0, "/num_groups", "", nullptr);
|
|
||||||
synth.sendMessage(*client, 0, "/num_masters", "", nullptr);
|
|
||||||
synth.sendMessage(*client, 0, "/num_curves", "", nullptr);
|
|
||||||
synth.sendMessage(*client, 0, "/num_samples", "", nullptr);
|
|
||||||
synth.sendMessage(*client, 0, "/root_path", "", nullptr);
|
|
||||||
synth.sendMessage(*client, 0, "/image", "", nullptr);
|
|
||||||
synth.sendMessage(*client, 0, "/image_controls", "", nullptr);
|
|
||||||
synth.sendMessage(*client, 0, "/key/slots", "", nullptr);
|
|
||||||
synth.sendMessage(*client, 0, "/sw/last/slots", "", nullptr);
|
|
||||||
synth.sendMessage(*client, 0, "/cc/slots", "", nullptr);
|
|
||||||
synth.sendMessage(*client, 0, "/sustain_or_sostenuto/slots", "", nullptr);
|
|
||||||
|
|
||||||
blob.shrink_to_fit();
|
|
||||||
return blob;
|
|
||||||
}
|
|
||||||
|
|
||||||
InstrumentDescription parseDescriptionBlob(absl::string_view blob)
|
|
||||||
{
|
|
||||||
InstrumentDescription desc;
|
|
||||||
|
|
||||||
const uint8_t* src = reinterpret_cast<const uint8_t*>(blob.data());
|
|
||||||
uint32_t srcSize = blob.size();
|
|
||||||
char buffer[1024];
|
|
||||||
|
|
||||||
const char* path;
|
|
||||||
const char* sig;
|
|
||||||
const sfizz_arg_t* args;
|
|
||||||
|
|
||||||
int32_t byteCount;
|
|
||||||
while ((byteCount = sfizz_extract_message(src, srcSize, buffer, sizeof(buffer), &path, &sig, &args)) > 0) {
|
|
||||||
unsigned indices[8];
|
|
||||||
|
|
||||||
///
|
|
||||||
auto copyArgToBitSpan = [](const sfizz_arg_t& arg, BitSpan bits)
|
|
||||||
{
|
|
||||||
size_t size = std::min<size_t>(bits.byte_size(), arg.b->size);
|
|
||||||
memcpy(bits.data(), arg.b->data, size);
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
|
||||||
if (Messages::matchOSC("/num_regions", path, indices) && !strcmp(sig, "i"))
|
|
||||||
desc.numRegions = uint32_t(args[0].i);
|
|
||||||
else if (Messages::matchOSC("/num_groups", path, indices) && !strcmp(sig, "i"))
|
|
||||||
desc.numGroups = uint32_t(args[0].i);
|
|
||||||
else if (Messages::matchOSC("/num_masters", path, indices) && !strcmp(sig, "i"))
|
|
||||||
desc.numMasters = uint32_t(args[0].i);
|
|
||||||
else if (Messages::matchOSC("/num_curves", path, indices) && !strcmp(sig, "i"))
|
|
||||||
desc.numCurves = uint32_t(args[0].i);
|
|
||||||
else if (Messages::matchOSC("/num_samples", path, indices) && !strcmp(sig, "i"))
|
|
||||||
desc.numSamples = uint32_t(args[0].i);
|
|
||||||
else if (Messages::matchOSC("/root_path", path, indices) && !strcmp(sig, "s"))
|
|
||||||
desc.rootPath = args[0].s;
|
|
||||||
else if (Messages::matchOSC("/image", path, indices) && !strcmp(sig, "s"))
|
|
||||||
desc.image = args[0].s;
|
|
||||||
else if (Messages::matchOSC("/image_controls", path, indices) && !strcmp(sig, "s"))
|
|
||||||
desc.image_controls = args[0].s;
|
|
||||||
else if (Messages::matchOSC("/key/slots", path, indices) && !strcmp(sig, "b"))
|
|
||||||
copyArgToBitSpan(args[0], desc.keyUsed.span());
|
|
||||||
else if (Messages::matchOSC("/sw/last/slots", path, indices) && !strcmp(sig, "b"))
|
|
||||||
copyArgToBitSpan(args[0], desc.keyswitchUsed.span());
|
|
||||||
else if (Messages::matchOSC("/cc/slots", path, indices) && !strcmp(sig, "b"))
|
|
||||||
copyArgToBitSpan(args[0], desc.ccUsed.span());
|
|
||||||
else if (Messages::matchOSC("/sustain_or_sostenuto/slots", path, indices) && !strcmp(sig, "b"))
|
|
||||||
copyArgToBitSpan(args[0], desc.sustainOrSostenuto.span());
|
|
||||||
else if (Messages::matchOSC("/key&/label", path, indices) && !strcmp(sig, "s"))
|
|
||||||
desc.keyLabel[indices[0]] = args[0].s;
|
|
||||||
else if (Messages::matchOSC("/sw/last/&/label", path, indices) && !strcmp(sig, "s"))
|
|
||||||
desc.keyswitchLabel[indices[0]] = args[0].s;
|
|
||||||
else if (Messages::matchOSC("/cc&/label", path, indices) && !strcmp(sig, "s"))
|
|
||||||
desc.ccLabel[indices[0]] = args[0].s;
|
|
||||||
else if (Messages::matchOSC("/cc&/default", path, indices) && !strcmp(sig, "f"))
|
|
||||||
desc.ccDefault[indices[0]] = args[0].f;
|
|
||||||
else if (Messages::matchOSC("/cc&/value", path, indices) && !strcmp(sig, "f"))
|
|
||||||
desc.ccValue[indices[0]] = args[0].f;
|
|
||||||
|
|
||||||
src += byteCount;
|
|
||||||
srcSize -= byteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const InstrumentDescription& desc)
|
|
||||||
{
|
|
||||||
os << "instrument:\n";
|
|
||||||
|
|
||||||
os << " regions: " << desc.numRegions << "\n";
|
|
||||||
os << " groups: " << desc.numGroups << "\n";
|
|
||||||
os << " masters: " << desc.numMasters << "\n";
|
|
||||||
os << " curves: " << desc.numCurves << "\n";
|
|
||||||
os << " samples: " << desc.numSamples << "\n";
|
|
||||||
|
|
||||||
os << " root_path: " << desc.rootPath << "\n";
|
|
||||||
os << " image: " << desc.image << "\n";
|
|
||||||
os << " image_controls: " << desc.image_controls << "\n";
|
|
||||||
|
|
||||||
os << " keys:\n";
|
|
||||||
for (unsigned i = 0; i < 128; ++i) {
|
|
||||||
if (desc.keyUsed.test(i)) {
|
|
||||||
os << " - number: " << i << "\n";
|
|
||||||
if (!desc.keyLabel[i].empty())
|
|
||||||
os << " label: " << desc.keyLabel[i].c_str() << "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
os << " keyswitches:\n";
|
|
||||||
for (unsigned i = 0; i < 128; ++i) {
|
|
||||||
if (desc.keyswitchUsed.test(i)) {
|
|
||||||
os << " - number: " << i << "\n";
|
|
||||||
if (!desc.keyswitchLabel[i].empty())
|
|
||||||
os << " label: " << desc.keyswitchLabel[i].c_str() << "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
os << " cc:\n";
|
|
||||||
for (unsigned i = 0; i < sfz::config::numCCs; ++i) {
|
|
||||||
if (desc.ccUsed.test(i)) {
|
|
||||||
os << " - number: " << i << "\n";
|
|
||||||
os << " default: " << desc.ccDefault[i] << "\n";
|
|
||||||
if (!desc.ccLabel[i].empty())
|
|
||||||
os << " label: " << desc.ccLabel[i].c_str() << "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "sfizz/Config.h"
|
|
||||||
#include "sfizz/utility/bit_array/BitArray.h"
|
|
||||||
#include <absl/strings/string_view.h>
|
|
||||||
#include <string>
|
|
||||||
#include <array>
|
|
||||||
#include <iosfwd>
|
|
||||||
struct sfizz_synth_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Description of user-interactible elements of the SFZ instrument
|
|
||||||
*/
|
|
||||||
struct InstrumentDescription {
|
|
||||||
uint32_t numRegions {};
|
|
||||||
uint32_t numGroups {};
|
|
||||||
uint32_t numMasters {};
|
|
||||||
uint32_t numCurves {};
|
|
||||||
uint32_t numSamples {};
|
|
||||||
std::string rootPath;
|
|
||||||
std::string image;
|
|
||||||
std::string image_controls;
|
|
||||||
BitArray<128> keyUsed {};
|
|
||||||
BitArray<128> keyswitchUsed {};
|
|
||||||
BitArray<128> sustainOrSostenuto {};
|
|
||||||
BitArray<sfz::config::numCCs> ccUsed {};
|
|
||||||
std::array<std::string, 128> keyLabel {};
|
|
||||||
std::array<std::string, 128> keyswitchLabel {};
|
|
||||||
std::array<std::string, sfz::config::numCCs> ccLabel {};
|
|
||||||
std::array<float, sfz::config::numCCs> ccDefault {};
|
|
||||||
std::array<float, sfz::config::numCCs> ccValue {};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Produce a description of the currently loaded instrument in the synth,
|
|
||||||
* in the form of a concatenation of OSC messages.
|
|
||||||
*
|
|
||||||
* This form is a message transmissible over binary channels.
|
|
||||||
*/
|
|
||||||
std::string getDescriptionBlob(sfizz_synth_t* handle);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Extract the information from the OSC blob and rearrange it in a
|
|
||||||
* structured form.
|
|
||||||
*/
|
|
||||||
InstrumentDescription parseDescriptionBlob(absl::string_view blob);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Display the description in human-readable format.
|
|
||||||
*/
|
|
||||||
std::ostream& operator<<(std::ostream& os, const InstrumentDescription& desc);
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "MessageUtils.h"
|
|
||||||
#include <absl/strings/ascii.h>
|
|
||||||
#include <absl/strings/numbers.h>
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
namespace Messages {
|
|
||||||
|
|
||||||
bool matchOSC(const char* pattern, const char* path, unsigned* indices)
|
|
||||||
{
|
|
||||||
unsigned nthIndex = 0;
|
|
||||||
|
|
||||||
while (const char *endp = std::strchr(pattern, '&')) {
|
|
||||||
size_t length = endp - pattern;
|
|
||||||
if (std::strncmp(pattern, path, length))
|
|
||||||
return false;
|
|
||||||
pattern += length;
|
|
||||||
path += length;
|
|
||||||
|
|
||||||
length = 0;
|
|
||||||
while (absl::ascii_isdigit(path[length]))
|
|
||||||
++length;
|
|
||||||
|
|
||||||
if (!absl::SimpleAtoi(absl::string_view(path, length), &indices[nthIndex++]))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
pattern += 1;
|
|
||||||
path += length;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !std::strcmp(path, pattern);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Messages
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace Messages {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simple matcher for message handling in O(N)
|
|
||||||
* @param[in] pattern Pattern to match, where '&' characters match positive integer numbers
|
|
||||||
* @param[in] path Path to match against the pattern
|
|
||||||
* @param[out] indices Table which received the indices, with size >= the number of '&' in the pattern
|
|
||||||
*/
|
|
||||||
bool matchOSC(const char* pattern, const char* path, unsigned* indices);
|
|
||||||
|
|
||||||
} // namespace Messages
|
|
||||||
|
|
@ -1,144 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "NativeHelpers.h"
|
|
||||||
#include <absl/strings/match.h>
|
|
||||||
#include <absl/strings/strip.h>
|
|
||||||
#include <absl/strings/string_view.h>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
#include <windows.h>
|
|
||||||
#include <shlobj.h>
|
|
||||||
|
|
||||||
const fs::path& getUserDocumentsDirectory()
|
|
||||||
{
|
|
||||||
static const fs::path directory = []() -> fs::path {
|
|
||||||
std::unique_ptr<WCHAR[]> path(new WCHAR[32768]);
|
|
||||||
if (SHGetFolderPathW(nullptr, CSIDL_PERSONAL|CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, path.get()) != S_OK)
|
|
||||||
throw std::runtime_error("Cannot get the document directory.");
|
|
||||||
return fs::path(path.get());
|
|
||||||
}();
|
|
||||||
return directory;
|
|
||||||
}
|
|
||||||
|
|
||||||
wchar_t *stringToWideChar(const char *str, int strCch)
|
|
||||||
{
|
|
||||||
unsigned strSize = MultiByteToWideChar(CP_UTF8, 0, str, strCch, nullptr, 0);
|
|
||||||
if (strSize == 0)
|
|
||||||
return {};
|
|
||||||
std::unique_ptr<wchar_t[]> strW(new wchar_t[strSize]);
|
|
||||||
if (MultiByteToWideChar(CP_UTF8, 0, str, strCch, strW.get(), strSize) == 0)
|
|
||||||
return {};
|
|
||||||
return strW.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
char* stringToUTF8(const wchar_t *strW, int strWCch)
|
|
||||||
{
|
|
||||||
unsigned strSize = WideCharToMultiByte(CP_UTF8, 0, strW, strWCch, nullptr, 0, nullptr, nullptr);
|
|
||||||
if (strSize == 0)
|
|
||||||
return {};
|
|
||||||
std::unique_ptr<char[]> str(new char[strSize]);
|
|
||||||
if (WideCharToMultiByte(CP_UTF8, 0, strW, strWCch, str.get(), strSize, nullptr, nullptr) == 0)
|
|
||||||
return {};
|
|
||||||
return str.release();
|
|
||||||
}
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
// implemented in NativeHelpers.mm
|
|
||||||
#else
|
|
||||||
const fs::path& getUserDocumentsDirectory()
|
|
||||||
{
|
|
||||||
static const fs::path directory = []() -> fs::path {
|
|
||||||
for (const XdgUserDirsEntry& ent :
|
|
||||||
parseXdgUserDirs(getXdgConfigHome() / "user-dirs.dirs")) {
|
|
||||||
if (ent.name == "XDG_DOCUMENTS_DIR")
|
|
||||||
return ent.value;
|
|
||||||
}
|
|
||||||
return getUserHomeDirectory() / "Documents";
|
|
||||||
}();
|
|
||||||
return directory;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fs::path& getUserHomeDirectory()
|
|
||||||
{
|
|
||||||
static const fs::path directory = []() -> fs::path {
|
|
||||||
const char* home = getenv("HOME");
|
|
||||||
if (home && home[0] == '/')
|
|
||||||
return fs::u8path(home);
|
|
||||||
else
|
|
||||||
throw std::runtime_error("Cannot get the home directory.");
|
|
||||||
}();
|
|
||||||
return directory;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fs::path& getXdgConfigHome()
|
|
||||||
{
|
|
||||||
static const fs::path directory = []() -> fs::path {
|
|
||||||
const char* config = getenv("XDG_CONFIG_HOME");
|
|
||||||
if (config && config[0] == '/')
|
|
||||||
return fs::u8path(config);
|
|
||||||
else
|
|
||||||
return getUserHomeDirectory() / ".config";
|
|
||||||
|
|
||||||
}();
|
|
||||||
return directory;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<XdgUserDirsEntry> parseXdgUserDirs(const fs::path& userDirsPath)
|
|
||||||
{
|
|
||||||
// from user-dirs.dirs(5)
|
|
||||||
// This file contains lines of the form `XDG_NAME_DIR=VALUE`
|
|
||||||
// VALUE must be of the form "$HOME/Path" or "/Path".
|
|
||||||
// Lines beginning with a # character are ignored.
|
|
||||||
|
|
||||||
std::vector<XdgUserDirsEntry> ents;
|
|
||||||
const fs::path& home = getUserHomeDirectory();
|
|
||||||
|
|
||||||
fs::ifstream in(userDirsPath);
|
|
||||||
std::string lineBuf;
|
|
||||||
|
|
||||||
lineBuf.reserve(256);
|
|
||||||
while (std::getline(in, lineBuf)) {
|
|
||||||
absl::string_view line(lineBuf);
|
|
||||||
|
|
||||||
line = absl::StripLeadingAsciiWhitespace(line);
|
|
||||||
if (line.empty() || line.front() == '#')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
size_t pos = line.find('=');
|
|
||||||
if (pos == line.npos)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
XdgUserDirsEntry ent;
|
|
||||||
ent.name = std::string(line.substr(0, pos));
|
|
||||||
|
|
||||||
absl::string_view rawValue = line.substr(pos + 1);
|
|
||||||
|
|
||||||
rawValue = absl::StripTrailingAsciiWhitespace(rawValue);
|
|
||||||
|
|
||||||
if (rawValue.size() < 2 || rawValue.front() != '"' || rawValue.back() != '"')
|
|
||||||
continue;
|
|
||||||
|
|
||||||
rawValue.remove_prefix(1);
|
|
||||||
rawValue.remove_suffix(1);
|
|
||||||
|
|
||||||
if (!rawValue.empty() && rawValue.front() == '/')
|
|
||||||
ent.value = fs::u8path(rawValue.begin(), rawValue.end());
|
|
||||||
else if (absl::StartsWith(rawValue, "$HOME")) {
|
|
||||||
absl::string_view part = rawValue.substr(5);
|
|
||||||
ent.value = home / fs::u8path(part.begin(), part.end()).relative_path();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ents.push_back(std::move(ent));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ents;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <ghc/fs_std.hpp>
|
|
||||||
#include <vector>
|
|
||||||
#if defined(_WIN32)
|
|
||||||
#include <cwchar>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const fs::path& getUserDocumentsDirectory();
|
|
||||||
|
|
||||||
#if !defined(_WIN32) && !defined(__APPLE__)
|
|
||||||
const fs::path& getUserHomeDirectory();
|
|
||||||
const fs::path& getXdgConfigHome();
|
|
||||||
struct XdgUserDirsEntry { std::string name; fs::path value; };
|
|
||||||
std::vector<XdgUserDirsEntry> parseXdgUserDirs(const fs::path& userDirsPath);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
wchar_t *stringToWideChar(const char *str, int strCch = -1);
|
|
||||||
char* stringToUTF8(const wchar_t *strW, int strWCch = -1);
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "NativeHelpers.h"
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#include <stdexcept>
|
|
||||||
#if !__has_feature(objc_arc)
|
|
||||||
#error This source file requires ARC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const fs::path& getUserDocumentsDirectory()
|
|
||||||
{
|
|
||||||
static const fs::path directory = []() -> fs::path {
|
|
||||||
NSFileManager* fm = [NSFileManager defaultManager];
|
|
||||||
NSArray<NSURL*>* urls = [fm URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask];
|
|
||||||
for (NSUInteger i = 0, n = [urls count]; i < n; ++i) {
|
|
||||||
NSURL *url = [urls objectAtIndex:i];
|
|
||||||
if ([url isFileURL])
|
|
||||||
return fs::path([url path].UTF8String);
|
|
||||||
}
|
|
||||||
throw std::runtime_error("Cannot get the document directory.");
|
|
||||||
}();
|
|
||||||
return directory;
|
|
||||||
}
|
|
||||||
|
|
@ -1,188 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <simde/x86/sse.h>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cmath>
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <malloc.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class RMSFollower {
|
|
||||||
public:
|
|
||||||
RMSFollower()
|
|
||||||
{
|
|
||||||
setNumOutputs(numOutputs_);
|
|
||||||
updatePole();
|
|
||||||
}
|
|
||||||
|
|
||||||
~RMSFollower()
|
|
||||||
{
|
|
||||||
freeAlignedMemory();
|
|
||||||
}
|
|
||||||
|
|
||||||
void clear()
|
|
||||||
{
|
|
||||||
for (int c = 0; c < numOutputs_; c += 4) {
|
|
||||||
simde__m128* mem = (simde__m128*) (mem_ + c);
|
|
||||||
*mem = simde_mm_setzero_ps();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setNumOutputs(int numOutputs)
|
|
||||||
{
|
|
||||||
freeAlignedMemory();
|
|
||||||
numOutputs_ = numOutputs;
|
|
||||||
memSize_ = numOutputs % 4 == 0 ? numOutputs * sizeof(float) : (numOutputs / 4 + 1) * 4 * sizeof(float);
|
|
||||||
#ifdef _WIN32
|
|
||||||
mem_ = (float *)_aligned_malloc(memSize_, 4 * sizeof(float));
|
|
||||||
#elif __APPLE__
|
|
||||||
mem_ = (float *)malloc(memSize_); // Should be 16 aligned
|
|
||||||
#else
|
|
||||||
mem_ = (float *)aligned_alloc(4 * sizeof(float), memSize_);
|
|
||||||
#endif
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void init(float sampleRate)
|
|
||||||
{
|
|
||||||
sampleRate_ = sampleRate;
|
|
||||||
updatePole();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setT60(float t60)
|
|
||||||
{
|
|
||||||
t60_ = t60;
|
|
||||||
updatePole();
|
|
||||||
}
|
|
||||||
|
|
||||||
void process(const float** blocks, size_t numFrames, size_t numChannels)
|
|
||||||
{
|
|
||||||
assert(numChannels <= static_cast<size_t>(numOutputs_));
|
|
||||||
const auto numSafeChannels = (numChannels / 4) * 4;
|
|
||||||
for (size_t c = 0; c < numSafeChannels; c += 4) {
|
|
||||||
simde__m128* mem = (simde__m128*) (mem_ + c);
|
|
||||||
process4(mem, &blocks[c], numFrames);
|
|
||||||
}
|
|
||||||
|
|
||||||
simde__m128* mem = (simde__m128*) (mem_ + numSafeChannels);
|
|
||||||
const auto remainingChannels = numChannels - numSafeChannels;
|
|
||||||
if (remainingChannels >= 4)
|
|
||||||
process4(mem, &blocks[numSafeChannels], numFrames);
|
|
||||||
else if (remainingChannels == 3)
|
|
||||||
process3(mem, &blocks[numSafeChannels], numFrames);
|
|
||||||
else if (remainingChannels == 2)
|
|
||||||
process2(mem, &blocks[numSafeChannels], numFrames);
|
|
||||||
else if (remainingChannels == 1)
|
|
||||||
process1(mem, &blocks[numSafeChannels], numFrames);
|
|
||||||
}
|
|
||||||
|
|
||||||
void getMS(float* ms, size_t numChannels) const
|
|
||||||
{
|
|
||||||
assert(numChannels <= static_cast<size_t>(numOutputs_));
|
|
||||||
const auto numSafeChannels = (numChannels / 4) * 4;
|
|
||||||
for (size_t c = 0; c < numSafeChannels; c += 4) {
|
|
||||||
simde__m128* mem = (simde__m128*) (mem_ + c);
|
|
||||||
simde_mm_store_ps(ms + c, *mem);
|
|
||||||
}
|
|
||||||
|
|
||||||
simde__m128* mem = (simde__m128*) (mem_ + numSafeChannels);
|
|
||||||
float* temp = (float*)&temp;
|
|
||||||
simde_mm_store_ps(temp, *mem);
|
|
||||||
for (size_t c = numSafeChannels, t = 0; c < numChannels; c++, t++)
|
|
||||||
ms[c] = temp[t];
|
|
||||||
}
|
|
||||||
|
|
||||||
void getRMS(float* rms, size_t numChannels) const
|
|
||||||
{
|
|
||||||
assert(numChannels <= static_cast<size_t>(numOutputs_));
|
|
||||||
const auto numSafeChannels = (numChannels / 4) * 4;
|
|
||||||
for (size_t c = 0; c < numSafeChannels; c += 4) {
|
|
||||||
simde__m128* mem = (simde__m128*) (mem_ + c);
|
|
||||||
simde_mm_store_ps(rms + c, simde_mm_sqrt_ps(*mem));
|
|
||||||
}
|
|
||||||
|
|
||||||
simde__m128* mem = (simde__m128*) (mem_ + numSafeChannels);
|
|
||||||
float* temp = (float*)&temp_;
|
|
||||||
simde_mm_store_ps(temp, simde_mm_sqrt_ps(*mem));
|
|
||||||
for (size_t c = numSafeChannels, t = 0; c < numChannels; c++, t++)
|
|
||||||
rms[c] = temp[t];
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void freeAlignedMemory()
|
|
||||||
{
|
|
||||||
if (mem_)
|
|
||||||
#ifdef _WIN32
|
|
||||||
_aligned_free(mem_);
|
|
||||||
#else
|
|
||||||
free(mem_);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void updatePole()
|
|
||||||
{
|
|
||||||
pole_ = std::exp(float(-2.0 * M_PI) / (t60_ * sampleRate_));
|
|
||||||
}
|
|
||||||
|
|
||||||
void process1(simde__m128* mem, const float** blocks, size_t numFrames)
|
|
||||||
{
|
|
||||||
simde__m128 input;
|
|
||||||
const simde__m128 pole = simde_mm_load1_ps(&pole_);
|
|
||||||
for (size_t i = 0; i < numFrames; ++i) {
|
|
||||||
input = simde_mm_setr_ps(
|
|
||||||
blocks[0][i], 0.0f, 0.0f, 0.0f);
|
|
||||||
input = simde_mm_mul_ps(input, input);
|
|
||||||
*mem = simde_mm_add_ps(input, simde_mm_mul_ps(pole, simde_mm_sub_ps(*mem, input)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void process2(simde__m128* mem, const float** blocks, size_t numFrames)
|
|
||||||
{
|
|
||||||
simde__m128 input;
|
|
||||||
const simde__m128 pole = simde_mm_load1_ps(&pole_);
|
|
||||||
for (size_t i = 0; i < numFrames; ++i) {
|
|
||||||
input = simde_mm_setr_ps(
|
|
||||||
blocks[0][i], blocks[1][i], 0.0f, 0.0f);
|
|
||||||
input = simde_mm_mul_ps(input, input);
|
|
||||||
*mem = simde_mm_add_ps(input, simde_mm_mul_ps(pole, simde_mm_sub_ps(*mem, input)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void process3(simde__m128* mem, const float** blocks, size_t numFrames)
|
|
||||||
{
|
|
||||||
simde__m128 input;
|
|
||||||
const simde__m128 pole = simde_mm_load1_ps(&pole_);
|
|
||||||
for (size_t i = 0; i < numFrames; ++i) {
|
|
||||||
input = simde_mm_setr_ps(
|
|
||||||
blocks[0][i], blocks[1][i], blocks[2][i], 0.0f);
|
|
||||||
input = simde_mm_mul_ps(input, input);
|
|
||||||
*mem = simde_mm_add_ps(input, simde_mm_mul_ps(pole, simde_mm_sub_ps(*mem, input)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void process4(simde__m128* mem, const float** blocks, size_t numFrames)
|
|
||||||
{
|
|
||||||
simde__m128 input;
|
|
||||||
const simde__m128 pole = simde_mm_load1_ps(&pole_);
|
|
||||||
for (size_t i = 0; i < numFrames; ++i) {
|
|
||||||
input = simde_mm_setr_ps(
|
|
||||||
blocks[0][i], blocks[1][i], blocks[2][i], blocks[3][i]);
|
|
||||||
input = simde_mm_mul_ps(input, input);
|
|
||||||
*mem = simde_mm_add_ps(input, simde_mm_mul_ps(pole, simde_mm_sub_ps(*mem, input)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
float* mem_ { nullptr };
|
|
||||||
simde__m128 temp_;
|
|
||||||
float pole_ {};
|
|
||||||
float t60_ = 300e-3;
|
|
||||||
float sampleRate_ = 44100;
|
|
||||||
int numOutputs_ = 2;
|
|
||||||
int memSize_ = 4;
|
|
||||||
};
|
|
||||||
|
|
@ -1,286 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "SfizzFileScan.h"
|
|
||||||
#include "SfizzForeignPaths.h"
|
|
||||||
#include "SfizzSettings.h"
|
|
||||||
#include "NativeHelpers.h"
|
|
||||||
#include <absl/strings/ascii.h>
|
|
||||||
#include <absl/algorithm/container.h>
|
|
||||||
#include <memory>
|
|
||||||
#if defined(_WIN32)
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// wait at least this much before refreshing the file rescan
|
|
||||||
// it permits to not repeat the operation many times if many searches are
|
|
||||||
// requested at once, eg. on session loading with multiple plugin instances
|
|
||||||
static const std::chrono::seconds expiration_time { 10 };
|
|
||||||
|
|
||||||
SfzFileScan& SfzFileScan::getInstance()
|
|
||||||
{
|
|
||||||
static SfzFileScan instance;
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SfzFileScan::locateRealFile(const fs::path& pathOrig, fs::path& pathFound)
|
|
||||||
{
|
|
||||||
if (pathOrig.empty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
std::unique_lock<std::mutex> lock { mutex };
|
|
||||||
refreshScan();
|
|
||||||
|
|
||||||
auto it = file_index_.find(keyOf(pathOrig.filename()));
|
|
||||||
if (it == file_index_.end())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const std::list<size_t>& candidateIndices = it->second;
|
|
||||||
std::vector<fs::path> candidates;
|
|
||||||
candidates.reserve(candidateIndices.size());
|
|
||||||
for (const size_t index : candidateIndices)
|
|
||||||
candidates.push_back(file_trie_[index]);
|
|
||||||
|
|
||||||
lock.unlock();
|
|
||||||
|
|
||||||
pathFound = electBestMatch(pathOrig, candidates);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SfzFileScan::isExpired() const
|
|
||||||
{
|
|
||||||
return !completion_time_ ||
|
|
||||||
(clock::now() - *completion_time_) > expiration_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SfzFileScan::refreshScan(bool force)
|
|
||||||
{
|
|
||||||
if (!force && !isExpired())
|
|
||||||
return;
|
|
||||||
|
|
||||||
file_trie_.clear();
|
|
||||||
file_index_.clear();
|
|
||||||
|
|
||||||
FileTrieBuilder builder;
|
|
||||||
|
|
||||||
for (const fs::path& dirPath : SfizzPaths::getSfzSearchPaths()) {
|
|
||||||
std::error_code ec;
|
|
||||||
const fs::directory_options dirOpts =
|
|
||||||
fs::directory_options::skip_permission_denied;
|
|
||||||
|
|
||||||
for (fs::recursive_directory_iterator it(dirPath, dirOpts, ec);
|
|
||||||
!ec && it != fs::recursive_directory_iterator();
|
|
||||||
it.increment(ec))
|
|
||||||
{
|
|
||||||
const fs::directory_entry& ent = *it;
|
|
||||||
const fs::path& filePath = ent.path();
|
|
||||||
std::error_code ec;
|
|
||||||
if (ent.is_regular_file(ec) /*&& pathIsSfz(filePath)*/) {
|
|
||||||
size_t fileIndex = builder.addFile(filePath);
|
|
||||||
file_index_[keyOf(filePath.filename())].push_back(fileIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
file_trie_ = builder.build();
|
|
||||||
completion_time_ = clock::now();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string SfzFileScan::keyOf(const fs::path& path)
|
|
||||||
{
|
|
||||||
std::string key = path.u8string();
|
|
||||||
absl::AsciiStrToLower(&key);
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace SfzFileScanImpl {
|
|
||||||
template <class T>
|
|
||||||
bool asciiCaseEqual(const std::basic_string<T>& a, const std::basic_string<T>& b)
|
|
||||||
{
|
|
||||||
const size_t n = a.size();
|
|
||||||
if (n != b.size())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
auto lower = [](T c) -> T {
|
|
||||||
return (c >= T('A') && c <= T('Z')) ? (c - T('A') + T('a')) : c;
|
|
||||||
};
|
|
||||||
|
|
||||||
for (size_t i = 0; i < n; ++i)
|
|
||||||
if (lower(a[i]) != lower(b[i]))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} // namespace SfzFileScanImpl
|
|
||||||
|
|
||||||
bool SfzFileScan::pathIsSfz(const fs::path& path)
|
|
||||||
{
|
|
||||||
const fs::path::string_type& str = path.native();
|
|
||||||
using char_type = fs::path::value_type;
|
|
||||||
const size_t n = str.size();
|
|
||||||
return n > 4 &&
|
|
||||||
str[n - 4] == char_type('.') &&
|
|
||||||
(str[n - 3] == char_type('s') || str[n - 3] == char_type('S')) &&
|
|
||||||
(str[n - 2] == char_type('f') || str[n - 2] == char_type('F')) &&
|
|
||||||
(str[n - 1] == char_type('z') || str[n - 1] == char_type('Z'));
|
|
||||||
}
|
|
||||||
|
|
||||||
const fs::path& SfzFileScan::electBestMatch(const fs::path& path, absl::Span<const fs::path> candidates)
|
|
||||||
{
|
|
||||||
if (candidates.empty())
|
|
||||||
return path;
|
|
||||||
|
|
||||||
if (candidates.size() == 1)
|
|
||||||
return candidates.front();
|
|
||||||
|
|
||||||
struct Score {
|
|
||||||
size_t components = 0;
|
|
||||||
size_t exact = 0;
|
|
||||||
bool operator<(const Score& other) const noexcept
|
|
||||||
{
|
|
||||||
return (components != other.components) ?
|
|
||||||
(components < other.components) : (exact < other.exact);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector<Score> scores;
|
|
||||||
scores.reserve(candidates.size());
|
|
||||||
|
|
||||||
for (size_t i = 0, n = candidates.size(); i < n; ++i) {
|
|
||||||
scores.emplace_back();
|
|
||||||
Score& score = scores.back();
|
|
||||||
|
|
||||||
const fs::path& p1 = path;
|
|
||||||
const fs::path& p2 = candidates[i];
|
|
||||||
auto it1 = p1.end();
|
|
||||||
auto it2 = p2.end();
|
|
||||||
|
|
||||||
bool matching = true;
|
|
||||||
while (matching && it1-- != p1.begin() && it2-- != p2.begin()) {
|
|
||||||
const fs::path& c1 = *it1;
|
|
||||||
const fs::path& c2 = *it2;
|
|
||||||
if (c1 == c2) {
|
|
||||||
score.components += 1;
|
|
||||||
score.exact += 1;
|
|
||||||
}
|
|
||||||
else if (SfzFileScanImpl::asciiCaseEqual(c1.native(), c2.native()))
|
|
||||||
score.components += 1;
|
|
||||||
else
|
|
||||||
matching = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t best = 0;
|
|
||||||
for (size_t i = 1, n = scores.size(); i < n; ++i) {
|
|
||||||
if (scores[best] < scores[i])
|
|
||||||
best = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return candidates[best];
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace SfizzPaths {
|
|
||||||
|
|
||||||
std::vector<fs::path> getSfzSearchPaths()
|
|
||||||
{
|
|
||||||
std::vector<fs::path> paths;
|
|
||||||
paths.reserve(8);
|
|
||||||
auto addPath = [&paths](const fs::path& newPath) {
|
|
||||||
if (absl::c_find(paths, newPath) == paths.end())
|
|
||||||
paths.push_back(newPath);
|
|
||||||
};
|
|
||||||
|
|
||||||
absl::optional<fs::path> configDefaultPath = getSfzConfigDefaultPath();
|
|
||||||
fs::path fallbackDefaultPath = getSfzFallbackDefaultPath();
|
|
||||||
|
|
||||||
if (configDefaultPath)
|
|
||||||
addPath(*configDefaultPath);
|
|
||||||
addPath(fallbackDefaultPath);
|
|
||||||
|
|
||||||
for (const fs::path& path : getEnvironmentSfzPaths())
|
|
||||||
addPath(path);
|
|
||||||
|
|
||||||
for (const fs::path& foreign : {
|
|
||||||
getAriaPathSetting("user_files_dir"),
|
|
||||||
getAriaPathSetting("Converted_path") })
|
|
||||||
if (!foreign.empty() && foreign.is_absolute())
|
|
||||||
addPath(foreign);
|
|
||||||
|
|
||||||
paths.shrink_to_fit();
|
|
||||||
return paths;
|
|
||||||
}
|
|
||||||
|
|
||||||
absl::optional<fs::path> getSfzConfigDefaultPath()
|
|
||||||
{
|
|
||||||
SfizzSettings settings;
|
|
||||||
fs::path path = fs::u8path(settings.load_or("user_files_dir", {}));
|
|
||||||
if (path.empty() || !path.is_absolute())
|
|
||||||
return {};
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSfzConfigDefaultPath(const fs::path& path)
|
|
||||||
{
|
|
||||||
if (path.empty() || !path.is_absolute())
|
|
||||||
return;
|
|
||||||
SfizzSettings settings;
|
|
||||||
settings.store("user_files_dir", path.u8string());
|
|
||||||
}
|
|
||||||
|
|
||||||
fs::path getSfzFallbackDefaultPath()
|
|
||||||
{
|
|
||||||
return getUserDocumentsDirectory() / "SFZ instruments";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<fs::path> getEnvironmentSfzPaths()
|
|
||||||
{
|
|
||||||
std::vector<fs::path> paths;
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
std::unique_ptr<WCHAR[]> buf;
|
|
||||||
|
|
||||||
DWORD bufsize = GetEnvironmentVariableW(L"SFZ_PATH", nullptr, 0);
|
|
||||||
if (bufsize == 0)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
buf.reset(new WCHAR[bufsize]);
|
|
||||||
if (GetEnvironmentVariableW(L"SFZ_PATH", buf.get(), bufsize) != bufsize - 1)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
paths.reserve(8);
|
|
||||||
|
|
||||||
const WCHAR* env = buf.get();
|
|
||||||
while (*env) {
|
|
||||||
const WCHAR* endp;
|
|
||||||
for (endp = env; *endp && *endp != L';'; ++endp);
|
|
||||||
fs::path path = fs::path(env, endp);
|
|
||||||
if (!path.empty() && path.is_absolute())
|
|
||||||
paths.push_back(std::move(path));
|
|
||||||
env = *endp ? (endp + 1) : endp;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
const char* env = getenv("SFZ_PATH");
|
|
||||||
if (!env)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
paths.reserve(8);
|
|
||||||
|
|
||||||
while (*env) {
|
|
||||||
const char* endp;
|
|
||||||
for (endp = env; *endp != ':' && *endp != '\0'; ++endp);
|
|
||||||
fs::path path = fs::u8path(env, endp);
|
|
||||||
if (!path.empty() && path.is_absolute())
|
|
||||||
paths.push_back(std::move(path));
|
|
||||||
env = *endp ? (endp + 1) : endp;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return paths;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace SfizzPaths
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "FileTrie.h"
|
|
||||||
#include <absl/types/span.h>
|
|
||||||
#include <absl/types/optional.h>
|
|
||||||
#include <ghc/fs_std.hpp>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <list>
|
|
||||||
#include <unordered_map>
|
|
||||||
#include <mutex>
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
class SfzFileScan {
|
|
||||||
public:
|
|
||||||
static SfzFileScan& getInstance();
|
|
||||||
bool locateRealFile(const fs::path& pathOrig, fs::path& pathFound);
|
|
||||||
|
|
||||||
private:
|
|
||||||
typedef std::chrono::steady_clock clock;
|
|
||||||
std::mutex mutex;
|
|
||||||
absl::optional<clock::time_point> completion_time_;
|
|
||||||
FileTrie file_trie_;
|
|
||||||
std::unordered_map<std::string, std::list<size_t>> file_index_;
|
|
||||||
|
|
||||||
bool isExpired() const;
|
|
||||||
void refreshScan(bool force = false);
|
|
||||||
static std::string keyOf(const fs::path& path);
|
|
||||||
static bool pathIsSfz(const fs::path& path);
|
|
||||||
static const fs::path& electBestMatch(const fs::path& path, absl::Span<const fs::path> candidates);
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace SfizzPaths {
|
|
||||||
std::vector<fs::path> getSfzSearchPaths();
|
|
||||||
absl::optional<fs::path> getSfzConfigDefaultPath();
|
|
||||||
void setSfzConfigDefaultPath(const fs::path& path);
|
|
||||||
fs::path getSfzFallbackDefaultPath();
|
|
||||||
std::vector<fs::path> getEnvironmentSfzPaths();
|
|
||||||
} // namespace SfizzPaths
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "SfizzForeignPaths.h"
|
|
||||||
|
|
||||||
namespace SfizzPaths {
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
fs::path getAriaPathSetting(const char* name)
|
|
||||||
{
|
|
||||||
std::unique_ptr<WCHAR[]> nameW;
|
|
||||||
unsigned nameSize = MultiByteToWideChar(CP_UTF8, 0, name, -1, nullptr, 0);
|
|
||||||
if (nameSize == 0)
|
|
||||||
return {};
|
|
||||||
nameW.reset(new WCHAR[nameSize]);
|
|
||||||
if (MultiByteToWideChar(CP_UTF8, 0, name, -1, nameW.get(), nameSize) == 0)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
const WCHAR ariaKeyPath[] = L"Software\\Plogue Art et Technologie, Inc\\Aria";
|
|
||||||
|
|
||||||
HKEY key = nullptr;
|
|
||||||
LSTATUS status = RegOpenKeyExW(HKEY_CURRENT_USER, ariaKeyPath, 0, KEY_QUERY_VALUE, &key);
|
|
||||||
if (status != ERROR_SUCCESS)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
DWORD valueSize = 32768 * sizeof(WCHAR);
|
|
||||||
std::unique_ptr<WCHAR[]> valueW(new WCHAR[(valueSize / sizeof(WCHAR)) + 1]());
|
|
||||||
DWORD valueType;
|
|
||||||
status = RegQueryValueExW(
|
|
||||||
key, nameW.get(), nullptr,
|
|
||||||
&valueType, reinterpret_cast<LPBYTE>(valueW.get()), &valueSize);
|
|
||||||
RegCloseKey(key);
|
|
||||||
if (status != ERROR_SUCCESS || (valueType != REG_SZ && valueType != REG_EXPAND_SZ))
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return fs::path(valueW.get());
|
|
||||||
}
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
// implementation in SfizzForeignPaths.mm
|
|
||||||
#else
|
|
||||||
fs::path getAriaPathSetting(const char* name)
|
|
||||||
{
|
|
||||||
(void)name;
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SfizzPaths
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <ghc/fs_std.hpp>
|
|
||||||
|
|
||||||
namespace SfizzPaths {
|
|
||||||
fs::path getAriaPathSetting(const char* name);
|
|
||||||
} // namespace SfizzPaths
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "SfizzForeignPaths.h"
|
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#if !__has_feature(objc_arc)
|
|
||||||
#error This source file requires ARC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace SfizzPaths {
|
|
||||||
|
|
||||||
fs::path getAriaPathSetting(const char* name)
|
|
||||||
{
|
|
||||||
NSUserDefaults* ud = [[NSUserDefaults alloc] initWithSuiteName:@"com.plogue.aria"];
|
|
||||||
NSString* value = [ud stringForKey:[NSString stringWithUTF8String:name]];
|
|
||||||
if (!value)
|
|
||||||
return {};
|
|
||||||
return fs::path(value.UTF8String);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace SfizzPaths
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,145 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "SfizzSettings.h"
|
|
||||||
#include "NativeHelpers.h"
|
|
||||||
#include <memory>
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
std::string SfizzSettings::load_or(const char* key, absl::string_view defaultValue)
|
|
||||||
{
|
|
||||||
absl::optional<std::string> optValue = load(key);
|
|
||||||
return optValue ? *optValue : std::string(defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
static HKEY openRegistryKey()
|
|
||||||
{
|
|
||||||
LSTATUS status;
|
|
||||||
HKEY root = HKEY_CURRENT_USER;
|
|
||||||
HKEY parent = root;
|
|
||||||
HKEY key = nullptr;
|
|
||||||
for (const WCHAR* component : {L"Software", L"SFZTools", L"sfizz"}) {
|
|
||||||
status = RegCreateKeyExW(
|
|
||||||
parent, component, 0, nullptr,
|
|
||||||
REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, nullptr, &key, nullptr);
|
|
||||||
if (parent != root)
|
|
||||||
RegCloseKey(parent);
|
|
||||||
if (status != ERROR_SUCCESS)
|
|
||||||
return nullptr;
|
|
||||||
parent = key;
|
|
||||||
}
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
absl::optional<std::string> SfizzSettings::load(const char* name)
|
|
||||||
{
|
|
||||||
std::unique_ptr<WCHAR[]> nameW { stringToWideChar(name) };
|
|
||||||
if (!nameW)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
HKEY key = openRegistryKey();
|
|
||||||
if (!key)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
WCHAR valueW[32768];
|
|
||||||
DWORD valueSize = sizeof(valueW);
|
|
||||||
DWORD valueType;
|
|
||||||
LSTATUS status = RegQueryValueExW(
|
|
||||||
key, nameW.get(), nullptr,
|
|
||||||
&valueType, reinterpret_cast<BYTE*>(valueW), &valueSize);
|
|
||||||
RegCloseKey(key);
|
|
||||||
if (status != ERROR_SUCCESS || (valueType != REG_SZ && valueType != REG_EXPAND_SZ))
|
|
||||||
return {};
|
|
||||||
|
|
||||||
std::unique_ptr<char[]> value { stringToUTF8(valueW) };
|
|
||||||
if (!value)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return std::string(value.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SfizzSettings::store(const char* name, absl::string_view value)
|
|
||||||
{
|
|
||||||
std::unique_ptr<WCHAR[]> nameW { stringToWideChar(name) };
|
|
||||||
std::unique_ptr<WCHAR[]> valueW { stringToWideChar(std::string(value).c_str()) };
|
|
||||||
if (!nameW || !valueW)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
HKEY key = openRegistryKey();
|
|
||||||
if (!key)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
LSTATUS status = RegSetValueExW(
|
|
||||||
key, nameW.get(), 0, RRF_RT_REG_SZ,
|
|
||||||
reinterpret_cast<const BYTE*>(valueW.get()),
|
|
||||||
(wcslen(valueW.get()) + 1) * sizeof(WCHAR));
|
|
||||||
RegCloseKey(key);
|
|
||||||
|
|
||||||
return status == ERROR_SUCCESS;
|
|
||||||
}
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
// implementation in SfizzSettings.mm
|
|
||||||
#else
|
|
||||||
#include <pugixml.hpp>
|
|
||||||
#include <ghc/fs_std.hpp>
|
|
||||||
|
|
||||||
static const fs::path getSettingsPath()
|
|
||||||
{
|
|
||||||
const fs::path dirPath = getXdgConfigHome() / "SFZTools" / "sfizz";
|
|
||||||
std::error_code ec;
|
|
||||||
fs::create_directories(dirPath, ec);
|
|
||||||
if (ec)
|
|
||||||
return {};
|
|
||||||
return dirPath / "settings.xml";
|
|
||||||
}
|
|
||||||
|
|
||||||
absl::optional<std::string> SfizzSettings::load(const char* key)
|
|
||||||
{
|
|
||||||
const fs::path path = getSettingsPath();
|
|
||||||
if (path.empty())
|
|
||||||
return {};
|
|
||||||
|
|
||||||
pugi::xml_document doc;
|
|
||||||
if (!doc.load_file(path.c_str()))
|
|
||||||
return {};
|
|
||||||
|
|
||||||
pugi::xml_node root = doc.child("properties");
|
|
||||||
if (!root)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
pugi::xml_node entry = root.find_child_by_attribute("entry", "key", key);
|
|
||||||
if (!entry)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return std::string(entry.text().get());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SfizzSettings::store(const char* key, absl::string_view value)
|
|
||||||
{
|
|
||||||
const fs::path path = getSettingsPath();
|
|
||||||
if (path.empty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
pugi::xml_document doc;
|
|
||||||
doc.load_file(path.c_str());
|
|
||||||
|
|
||||||
pugi::xml_node root = doc.child("properties");
|
|
||||||
if (!root)
|
|
||||||
root = doc.append_child("properties");
|
|
||||||
|
|
||||||
pugi::xml_node entry = root.find_child_by_attribute("entry", "key", key);
|
|
||||||
if (!entry) {
|
|
||||||
entry = root.append_child("entry");
|
|
||||||
entry.append_attribute("key").set_value(key);
|
|
||||||
}
|
|
||||||
entry.text().set(std::string(value).c_str());
|
|
||||||
|
|
||||||
return doc.save_file(path.c_str());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <absl/strings/string_view.h>
|
|
||||||
#include <absl/types/optional.h>
|
|
||||||
|
|
||||||
class SfizzSettings {
|
|
||||||
public:
|
|
||||||
absl::optional<std::string> load(const char* key);
|
|
||||||
std::string load_or(const char* key, absl::string_view defaultValue);
|
|
||||||
bool store(const char* key, absl::string_view value);
|
|
||||||
};
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "SfizzSettings.h"
|
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#if !__has_feature(objc_arc)
|
|
||||||
#error This source file requires ARC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static NSUserDefaults* getUserDefaults()
|
|
||||||
{
|
|
||||||
return [[NSUserDefaults alloc] initWithSuiteName:@"tools.sfz.sfizz"];;
|
|
||||||
}
|
|
||||||
|
|
||||||
absl::optional<std::string> SfizzSettings::load(const char* key)
|
|
||||||
{
|
|
||||||
NSUserDefaults* ud = getUserDefaults();
|
|
||||||
NSString* value = [ud stringForKey:[NSString stringWithUTF8String:key]];
|
|
||||||
if (!value)
|
|
||||||
return {};
|
|
||||||
return std::string(value.UTF8String);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool SfizzSettings::store(const char* key, absl::string_view value)
|
|
||||||
{
|
|
||||||
NSUserDefaults* ud = getUserDefaults();
|
|
||||||
NSString* object =
|
|
||||||
[[NSString alloc] initWithBytes:value.data()
|
|
||||||
length:(NSUInteger)value.size() encoding:NSUTF8StringEncoding];
|
|
||||||
[ud setObject:object forKey:[NSString stringWithUTF8String:key]];
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,158 +0,0 @@
|
||||||
if(SFIZZ_USE_SYSTEM_VST3SDK)
|
|
||||||
find_package(PkgConfig REQUIRED)
|
|
||||||
pkg_check_modules(VST3SDK "vst3sdk" REQUIRED)
|
|
||||||
set(VSTGUI_BASEDIR "${VST3SDK_INCLUDE_DIRS}/vstgui4")
|
|
||||||
else()
|
|
||||||
set(VSTGUI_BASEDIR "${CMAKE_CURRENT_SOURCE_DIR}/external/vstgui4")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include("cmake/Vstgui.cmake")
|
|
||||||
|
|
||||||
set(EDITOR_RESOURCES
|
|
||||||
logo.png
|
|
||||||
logo_orange.png
|
|
||||||
logo_text.png
|
|
||||||
logo_text_white.png
|
|
||||||
logo_text_shaded.png
|
|
||||||
logo_text@2x.png
|
|
||||||
logo_text_white@2x.png
|
|
||||||
logo_text_shaded@2x.png
|
|
||||||
background.png
|
|
||||||
background@2x.png
|
|
||||||
background_button_about.png
|
|
||||||
background_button_about@2x.png
|
|
||||||
icon_white.png
|
|
||||||
icon_white@2x.png
|
|
||||||
knob48.png
|
|
||||||
knob48@2x.png
|
|
||||||
Fonts/sfizz-fluentui-system-r20.ttf
|
|
||||||
Fonts/sfizz-fluentui-system-f20.ttf
|
|
||||||
Fonts/sfizz-misc-icons.ttf
|
|
||||||
Fonts/Roboto-Regular.ttf
|
|
||||||
Themes/Default/theme.xml
|
|
||||||
Themes/Dark/theme.xml
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
|
||||||
set(UI_RESOURCES
|
|
||||||
resources/Themes/Default/theme.xml
|
|
||||||
resources/Themes/Dark/theme.xml
|
|
||||||
)
|
|
||||||
function(copy_editor_resources TARGET SOURCE_DIR DESTINATION_DIR)
|
|
||||||
set(_deps)
|
|
||||||
foreach(res ${EDITOR_RESOURCES})
|
|
||||||
get_filename_component(_dir "${res}" DIRECTORY)
|
|
||||||
file(MAKE_DIRECTORY "${DESTINATION_DIR}/${_dir}")
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT "${DESTINATION_DIR}/${res}"
|
|
||||||
COMMAND "${CMAKE_COMMAND}" "-E" "copy"
|
|
||||||
"${SOURCE_DIR}/${res}" "${DESTINATION_DIR}/${res}"
|
|
||||||
DEPENDS "${SOURCE_DIR}/${res}")
|
|
||||||
list(APPEND _deps "${DESTINATION_DIR}/${res}")
|
|
||||||
endforeach()
|
|
||||||
add_custom_target("${TARGET}_editor_resources" DEPENDS ${_deps})
|
|
||||||
add_dependencies("${TARGET}" "${TARGET}_editor_resources")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
set(UI_FILES layout/main.fl layout/about.fl)
|
|
||||||
source_group("Editor UI" FILES ${UI_FILES})
|
|
||||||
source_group("Editor Resources" FILES ${UI_RESOURCES})
|
|
||||||
|
|
||||||
# editor
|
|
||||||
add_library(sfizz_editor STATIC EXCLUDE_FROM_ALL
|
|
||||||
src/editor/EditIds.h
|
|
||||||
src/editor/EditIds.cpp
|
|
||||||
src/editor/Editor.h
|
|
||||||
src/editor/Editor.cpp
|
|
||||||
src/editor/EditorLibs.h
|
|
||||||
src/editor/EditorLibs.cpp
|
|
||||||
src/editor/EditorController.h
|
|
||||||
src/editor/GUIComponents.h
|
|
||||||
src/editor/GUIComponents.cpp
|
|
||||||
src/editor/GUIDefs.h
|
|
||||||
src/editor/GUIDefs.cpp
|
|
||||||
src/editor/GUIHelpers.h
|
|
||||||
src/editor/GUIHelpers.cpp
|
|
||||||
src/editor/GUIPiano.h
|
|
||||||
src/editor/GUIPiano.cpp
|
|
||||||
src/editor/DlgAbout.h
|
|
||||||
src/editor/DlgAbout.cpp
|
|
||||||
src/editor/Theme.h
|
|
||||||
src/editor/Theme.cpp
|
|
||||||
src/editor/ColorHelpers.h
|
|
||||||
src/editor/ColorHelpers.cpp
|
|
||||||
src/editor/ImageHelpers.h
|
|
||||||
src/editor/ImageHelpers.cpp
|
|
||||||
src/editor/NativeHelpers.h
|
|
||||||
src/editor/NativeHelpers.cpp
|
|
||||||
src/editor/VSTGUIHelpers.h
|
|
||||||
src/editor/VSTGUIHelpers.cpp
|
|
||||||
src/editor/layout/main.hpp
|
|
||||||
src/editor/layout/about.hpp
|
|
||||||
src/editor/utility/vstgui_after.h
|
|
||||||
src/editor/utility/vstgui_before.h
|
|
||||||
${UI_FILES}
|
|
||||||
${UI_RESOURCES}
|
|
||||||
)
|
|
||||||
add_library(sfizz::editor ALIAS sfizz_editor)
|
|
||||||
target_include_directories(sfizz_editor PUBLIC "src")
|
|
||||||
target_link_libraries(sfizz_editor PUBLIC sfizz::messaging sfizz::plugins-common)
|
|
||||||
target_link_libraries(sfizz_editor PRIVATE sfizz::vstgui)
|
|
||||||
target_compile_definitions(sfizz_editor PRIVATE
|
|
||||||
"SFIZZ_VERSION=\"${CMAKE_PROJECT_VERSION}\"")
|
|
||||||
if(APPLE)
|
|
||||||
find_library(APPLE_APPKIT_LIBRARY "AppKit")
|
|
||||||
find_library(APPLE_CORESERVICES_LIBRARY "CoreServices")
|
|
||||||
find_library(APPLE_FOUNDATION_LIBRARY "Foundation")
|
|
||||||
target_sources(sfizz_editor PRIVATE
|
|
||||||
src/editor/NativeHelpers.mm
|
|
||||||
src/editor/VSTGUIHelpers.mm)
|
|
||||||
target_link_libraries(sfizz_editor PRIVATE
|
|
||||||
"${APPLE_APPKIT_LIBRARY}"
|
|
||||||
"${APPLE_CORESERVICES_LIBRARY}"
|
|
||||||
"${APPLE_FOUNDATION_LIBRARY}")
|
|
||||||
target_compile_options(sfizz_editor PRIVATE "-fobjc-arc")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
add_library(sfizz_colorspaces INTERFACE)
|
|
||||||
add_library(sfizz::colorspaces ALIAS sfizz_colorspaces)
|
|
||||||
target_include_directories(sfizz_colorspaces INTERFACE "external/color-spaces")
|
|
||||||
|
|
||||||
add_library(sfizz_stb_image INTERFACE)
|
|
||||||
add_library(sfizz::stb_image ALIAS sfizz_stb_image)
|
|
||||||
target_include_directories(sfizz_stb_image INTERFACE "external/stb_image")
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
#
|
|
||||||
elseif(APPLE)
|
|
||||||
#
|
|
||||||
else()
|
|
||||||
find_package(PkgConfig REQUIRED)
|
|
||||||
pkg_check_modules(sfizz-gio "gio-2.0" REQUIRED)
|
|
||||||
target_include_directories(sfizz_editor PRIVATE ${sfizz-gio_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(sfizz_editor PRIVATE ${sfizz-gio_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
target_link_libraries(sfizz_editor PRIVATE sfizz::colorspaces sfizz::stb_image
|
|
||||||
sfizz::bit_array sfizz::filesystem sfizz::pugixml)
|
|
||||||
|
|
||||||
# layout tool
|
|
||||||
if(NOT CMAKE_CROSSCOMPILING)
|
|
||||||
add_executable(layout-maker
|
|
||||||
"tools/layout-maker/sources/layout.h"
|
|
||||||
"tools/layout-maker/sources/reader.cpp"
|
|
||||||
"tools/layout-maker/sources/reader.h"
|
|
||||||
"tools/layout-maker/sources/main.cpp")
|
|
||||||
target_link_libraries(layout-maker PRIVATE absl::strings)
|
|
||||||
|
|
||||||
foreach(_layout main about)
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/editor/layout/${_layout}.hpp"
|
|
||||||
COMMAND "$<TARGET_FILE:layout-maker>"
|
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/layout/${_layout}.fl"
|
|
||||||
> "${CMAKE_CURRENT_SOURCE_DIR}/src/editor/layout/${_layout}.hpp"
|
|
||||||
DEPENDS layout-maker "${CMAKE_CURRENT_SOURCE_DIR}/layout/${_layout}.fl")
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Git build identifier
|
|
||||||
target_link_libraries(sfizz_editor PRIVATE sfizz-git-build-id)
|
|
||||||
|
|
@ -1,261 +0,0 @@
|
||||||
# Find vstgui version
|
|
||||||
FILE(READ ${VSTGUI_BASEDIR}/vstgui/lib/vstguibase.h VSTGUIBASE_HEADER)
|
|
||||||
string(REGEX MATCH "\#define VSTGUI_VERSION_MAJOR ([0-9]*)" _ ${VSTGUIBASE_HEADER})
|
|
||||||
set(VSTGUI_VERSION_MAJOR ${CMAKE_MATCH_1})
|
|
||||||
string(REGEX MATCH "\#define VSTGUI_VERSION_MINOR ([0-9]*)" _ ${VSTGUIBASE_HEADER})
|
|
||||||
set(VSTGUI_VERSION_MINOR ${CMAKE_MATCH_1})
|
|
||||||
set(VSTGUI_VERSION "${VSTGUI_VERSION_MAJOR}.${VSTGUI_VERSION_MINOR}")
|
|
||||||
|
|
||||||
add_library(sfizz_vstgui STATIC EXCLUDE_FROM_ALL
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/animation/animations.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/animation/animator.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/animation/timingfunctions.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cautoanimation.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cbuttons.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/ccolorchooser.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/ccontrol.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cfontchooser.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cknob.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/clistcontrol.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cmoviebitmap.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cmoviebutton.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/coptionmenu.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cparamdisplay.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cscrollbar.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/csearchtextedit.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/csegmentbutton.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cslider.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cspecialdigit.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/csplashscreen.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cstringlist.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cswitch.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/ctextedit.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/ctextlabel.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cvumeter.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/controls/cxypad.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/platformfactory.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/fileresourceinputstream.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/genericoptionmenu.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/common/generictextedit.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cbitmap.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cbitmapfilter.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/ccolor.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cdatabrowser.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cdrawcontext.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cdrawmethods.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cdropsource.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cfileselector.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cfont.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cframe.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cgradientview.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cgraphicspath.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/clayeredviewcontainer.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/clinestyle.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/coffscreencontext.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/copenglview.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cpoint.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/crect.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/crowcolumnview.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cscrollview.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cshadowviewcontainer.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/csplitview.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cstring.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/ctabview.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/ctooltipsupport.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cview.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cviewcontainer.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/cvstguitimer.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/genericstringlistdatabrowsersource.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/pixelbuffer.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/vstguidebug.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/vstguiinit.cpp")
|
|
||||||
|
|
||||||
if(${VSTGUI_VERSION} VERSION_GREATER "4.10")
|
|
||||||
target_sources(sfizz_vstgui PRIVATE
|
|
||||||
${VSTGUI_BASEDIR}/vstgui/lib/cgradient.cpp
|
|
||||||
${VSTGUI_BASEDIR}/vstgui/lib/events.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_library(sfizz::vstgui ALIAS sfizz_vstgui)
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
target_sources(sfizz_vstgui PRIVATE
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dbitmap.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2ddrawcontext.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dfont.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dgraphicspath.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32datapackage.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32dragging.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32factory.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32frame.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32openglview.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32optionmenu.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32resourcestream.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32support.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/win32textedit.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/winfileselector.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/winstring.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/wintimer.cpp")
|
|
||||||
if(${VSTGUI_VERSION} VERSION_GREATER "4.10")
|
|
||||||
target_sources(sfizz_vstgui PRIVATE
|
|
||||||
${VSTGUI_BASEDIR}/vstgui/lib/platform/win32/direct2d/d2dgradient.cpp)
|
|
||||||
endif()
|
|
||||||
elseif(APPLE)
|
|
||||||
target_sources(sfizz_vstgui PRIVATE
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/carbon/hiviewframe.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/carbon/hiviewoptionmenu.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/carbon/hiviewtextedit.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/autoreleasepool.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/cocoahelpers.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/cocoaopenglview.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/cocoatextedit.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/nsviewdraggingsession.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/nsviewframe.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cocoa/nsviewoptionmenu.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/caviewlayer.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cfontmac.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cgbitmap.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/cgdrawcontext.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/macclipboard.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/macfactory.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/macfileselector.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/macglobals.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/macstring.mm"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/mactimer.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/mac/quartzgraphicspath.cpp")
|
|
||||||
else()
|
|
||||||
target_sources(sfizz_vstgui PRIVATE
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/cairobitmap.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/cairocontext.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/cairofont.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/cairogradient.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/cairopath.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/linuxfactory.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/linuxstring.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/x11dragging.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/x11fileselector.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/x11frame.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/x11platform.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/x11timer.cpp"
|
|
||||||
"${VSTGUI_BASEDIR}/vstgui/lib/platform/linux/x11utils.cpp")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(sfizz_vstgui PUBLIC "${VSTGUI_BASEDIR}")
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
if (NOT MSVC)
|
|
||||||
# autolinked on MSVC with pragmas
|
|
||||||
target_link_libraries(sfizz_vstgui PRIVATE
|
|
||||||
"opengl32"
|
|
||||||
"d2d1"
|
|
||||||
"dwrite"
|
|
||||||
"dwmapi"
|
|
||||||
"windowscodecs"
|
|
||||||
"shlwapi")
|
|
||||||
endif()
|
|
||||||
elseif(APPLE)
|
|
||||||
target_link_libraries(sfizz_vstgui PRIVATE
|
|
||||||
"${APPLE_COREFOUNDATION_LIBRARY}"
|
|
||||||
"${APPLE_FOUNDATION_LIBRARY}"
|
|
||||||
"${APPLE_COCOA_LIBRARY}"
|
|
||||||
"${APPLE_OPENGL_LIBRARY}"
|
|
||||||
"${APPLE_ACCELERATE_LIBRARY}"
|
|
||||||
"${APPLE_QUARTZCORE_LIBRARY}"
|
|
||||||
"${APPLE_CARBON_LIBRARY}"
|
|
||||||
"${APPLE_AUDIOTOOLBOX_LIBRARY}"
|
|
||||||
"${APPLE_COREAUDIO_LIBRARY}"
|
|
||||||
"${APPLE_COREMIDI_LIBRARY}")
|
|
||||||
else()
|
|
||||||
find_package(X11 REQUIRED)
|
|
||||||
find_package(Freetype REQUIRED)
|
|
||||||
find_package(PkgConfig REQUIRED)
|
|
||||||
pkg_check_modules(LIBXCB REQUIRED xcb)
|
|
||||||
pkg_check_modules(LIBXCB_UTIL REQUIRED xcb-util)
|
|
||||||
pkg_check_modules(LIBXCB_CURSOR REQUIRED xcb-cursor)
|
|
||||||
pkg_check_modules(LIBXCB_KEYSYMS REQUIRED xcb-keysyms)
|
|
||||||
pkg_check_modules(LIBXCB_XKB REQUIRED xcb-xkb)
|
|
||||||
pkg_check_modules(LIBXKB_COMMON REQUIRED xkbcommon)
|
|
||||||
pkg_check_modules(LIBXKB_COMMON_X11 REQUIRED xkbcommon-x11)
|
|
||||||
pkg_check_modules(CAIRO REQUIRED cairo)
|
|
||||||
pkg_check_modules(PANGO REQUIRED pangocairo pangoft2)
|
|
||||||
pkg_check_modules(FONTCONFIG REQUIRED fontconfig)
|
|
||||||
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
|
||||||
target_include_directories(sfizz_vstgui PRIVATE
|
|
||||||
${X11_INCLUDE_DIRS}
|
|
||||||
${FREETYPE_INCLUDE_DIRS}
|
|
||||||
${LIBXCB_INCLUDE_DIRS}
|
|
||||||
${LIBXCB_UTIL_INCLUDE_DIRS}
|
|
||||||
${LIBXCB_CURSOR_INCLUDE_DIRS}
|
|
||||||
${LIBXCB_KEYSYMS_INCLUDE_DIRS}
|
|
||||||
${LIBXCB_XKB_INCLUDE_DIRS}
|
|
||||||
${LIBXKB_COMMON_INCLUDE_DIRS}
|
|
||||||
${LIBXKB_COMMON_X11_INCLUDE_DIRS}
|
|
||||||
${CAIRO_INCLUDE_DIRS}
|
|
||||||
${PANGO_INCLUDE_DIRS}
|
|
||||||
${FONTCONFIG_INCLUDE_DIRS}
|
|
||||||
${GLIB_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(sfizz_vstgui PRIVATE
|
|
||||||
${X11_LIBRARIES}
|
|
||||||
${FREETYPE_LIBRARIES}
|
|
||||||
${LIBXCB_LIBRARIES}
|
|
||||||
${LIBXCB_UTIL_LIBRARIES}
|
|
||||||
${LIBXCB_CURSOR_LIBRARIES}
|
|
||||||
${LIBXCB_KEYSYMS_LIBRARIES}
|
|
||||||
${LIBXCB_XKB_LIBRARIES}
|
|
||||||
${LIBXKB_COMMON_LIBRARIES}
|
|
||||||
${LIBXKB_COMMON_X11_LIBRARIES}
|
|
||||||
${CAIRO_LIBRARIES}
|
|
||||||
${PANGO_LIBRARIES}
|
|
||||||
${FONTCONFIG_LIBRARIES}
|
|
||||||
${GLIB_LIBRARIES})
|
|
||||||
find_library(DL_LIBRARY "dl")
|
|
||||||
if(DL_LIBRARY)
|
|
||||||
target_link_libraries(sfizz_vstgui PRIVATE "${DL_LIBRARY}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
|
|
||||||
target_compile_definitions(sfizz_vstgui PUBLIC "DEVELOPMENT")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(${CMAKE_BUILD_TYPE} MATCHES "Release")
|
|
||||||
target_compile_definitions(sfizz_vstgui PUBLIC "RELEASE")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
||||||
# Windows 10 RS2 DDI for custom fonts
|
|
||||||
target_compile_definitions(sfizz_vstgui PRIVATE "NTDDI_VERSION=0x0A000003")
|
|
||||||
# disable custom fonts if dwrite3 API is unavailable in MinGW
|
|
||||||
if(MINGW)
|
|
||||||
check_cxx_source_compiles("
|
|
||||||
#include <windows.h>
|
|
||||||
#include <dwrite_3.h>
|
|
||||||
HRESULT FeatureCheck(IDWriteFontSet* self, const WCHAR* name, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STRETCH stretch, DWRITE_FONT_STYLE style, IDWriteFontSet** fontset)
|
|
||||||
{
|
|
||||||
return self->GetMatchingFonts(name, weight, stretch, style, fontset);
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}" SFIZZ_MINGW_SUPPORTS_DWRITE3)
|
|
||||||
if(NOT SFIZZ_MINGW_SUPPORTS_DWRITE3)
|
|
||||||
message(WARNING "This version of MinGW does not support DirectWrite 3. Custom font support is disabled.")
|
|
||||||
target_compile_definitions(sfizz_vstgui PRIVATE "VSTGUI_WIN32_CUSTOMFONT_SUPPORT=0")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
||||||
gw_target_warn(sfizz_vstgui PRIVATE
|
|
||||||
"-Wno-deprecated-copy"
|
|
||||||
"-Wno-deprecated-declarations"
|
|
||||||
"-Wno-extra"
|
|
||||||
"-Wno-ignored-qualifiers"
|
|
||||||
"-Wno-multichar"
|
|
||||||
"-Wno-reorder"
|
|
||||||
"-Wno-sign-compare"
|
|
||||||
"-Wno-unknown-pragmas"
|
|
||||||
"-Wno-unused-function"
|
|
||||||
"-Wno-unused-parameter"
|
|
||||||
"-Wno-unused-variable")
|
|
||||||
endif()
|
|
||||||
129
plugins/editor/external/color-spaces/ColorSpaces.h
vendored
|
|
@ -1,129 +0,0 @@
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
/*
|
|
||||||
GLSL Color Space Utility Functions
|
|
||||||
(c) 2015 tobspr
|
|
||||||
|
|
||||||
Porting a subset to C++
|
|
||||||
(c) 2020 Jean Pierre Cimalando
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2015
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Most formulars / matrices are from:
|
|
||||||
https://en.wikipedia.org/wiki/SRGB
|
|
||||||
|
|
||||||
Some are from:
|
|
||||||
http://www.chilliant.com/rgb2hsv.html
|
|
||||||
https://www.fourcc.org/fccyvrgb.php
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <array>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
namespace ColorSpaces {
|
|
||||||
|
|
||||||
template <std::size_t N> using vec = std::array<float, N>;
|
|
||||||
using vec3 = vec<3>;
|
|
||||||
using vec4 = vec<4>;
|
|
||||||
|
|
||||||
template <class T>
|
|
||||||
T clamp(T x, T lo, T hi)
|
|
||||||
{
|
|
||||||
return std::max(lo, std::min(hi, x));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <std::size_t N>
|
|
||||||
vec<N> saturate(vec<N> x)
|
|
||||||
{
|
|
||||||
for (std::size_t i = 0; i < N; ++i)
|
|
||||||
x[i] = clamp(x[i], 0.0f, 1.0f);
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
float dot(vec3 a, vec3 b)
|
|
||||||
{
|
|
||||||
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Constants
|
|
||||||
static constexpr float HCV_EPSILON = 1e-10;
|
|
||||||
static constexpr float HCY_EPSILON = 1e-10;
|
|
||||||
|
|
||||||
// Converts a value from linear RGB to HCV (Hue, Chroma, Value)
|
|
||||||
vec3 rgb_to_hcv(vec3 rgb)
|
|
||||||
{
|
|
||||||
// Based on work by Sam Hocevar and Emil Persson
|
|
||||||
vec4 P = (rgb[1] < rgb[2]) ? vec4{{rgb[2], rgb[1], -1.0, 2.0/3.0}} : vec4{{rgb[1], rgb[2], 0.0, -1.0/3.0}};
|
|
||||||
vec4 Q = (rgb[0] < P[0]) ? vec4{{P[0], P[1], P[3], rgb[0]}} : vec4{{rgb[0], P[1], P[2], P[0]}};
|
|
||||||
float C = Q[0] - std::min(Q[3], Q[1]);
|
|
||||||
float H = std::abs((Q[3] - Q[1]) / (6 * C + HCV_EPSILON) + Q[2]);
|
|
||||||
return vec3{{H, C, Q[0]}};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Converts from pure Hue to linear RGB
|
|
||||||
vec3 hue_to_rgb(float hue)
|
|
||||||
{
|
|
||||||
float R = std::fabs(hue * 6 - 3) - 1;
|
|
||||||
float G = 2 - std::fabs(hue * 6 - 2);
|
|
||||||
float B = 2 - std::fabs(hue * 6 - 4);
|
|
||||||
return saturate(vec3{{R,G,B}});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Converts from HCY to linear RGB
|
|
||||||
vec3 hcy_to_rgb(vec3 hcy)
|
|
||||||
{
|
|
||||||
const vec3 HCYwts{{0.299, 0.587, 0.114}};
|
|
||||||
vec3 RGB = hue_to_rgb(hcy[0]);
|
|
||||||
float Z = dot(RGB, HCYwts);
|
|
||||||
if (hcy[2] < Z) {
|
|
||||||
hcy[1] *= hcy[2] / Z;
|
|
||||||
} else if (Z < 1) {
|
|
||||||
hcy[1] *= (1 - hcy[2]) / (1 - Z);
|
|
||||||
}
|
|
||||||
return vec3{{(RGB[0] - Z) * hcy[1] + hcy[2],
|
|
||||||
(RGB[1] - Z) * hcy[1] + hcy[2],
|
|
||||||
(RGB[2] - Z) * hcy[1] + hcy[2]}};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Converts from rgb to hcy (Hue, Chroma, Luminance)
|
|
||||||
vec3 rgb_to_hcy(vec3 rgb)
|
|
||||||
{
|
|
||||||
const vec3 HCYwts = vec3{{0.299, 0.587, 0.114}};
|
|
||||||
// Corrected by David Schaeffer
|
|
||||||
vec3 HCV = rgb_to_hcv(rgb);
|
|
||||||
float Y = dot(rgb, HCYwts);
|
|
||||||
float Z = dot(hue_to_rgb(HCV[0]), HCYwts);
|
|
||||||
if (Y < Z) {
|
|
||||||
HCV[1] *= Z / (HCY_EPSILON + Y);
|
|
||||||
} else {
|
|
||||||
HCV[1] *= (1 - Z) / (HCY_EPSILON + 1 - Y);
|
|
||||||
}
|
|
||||||
return vec3{{HCV[0], HCV[1], Y}};
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ColorSpaces
|
|
||||||
22
plugins/editor/external/color-spaces/LICENSE
vendored
|
|
@ -1,22 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2015
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
||||||
37
plugins/editor/external/stb_image/LICENSE
vendored
|
|
@ -1,37 +0,0 @@
|
||||||
This software is available under 2 licenses -- choose whichever you prefer.
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
ALTERNATIVE A - MIT License
|
|
||||||
Copyright (c) 2017 Sean Barrett
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
|
||||||
This is free and unencumbered software released into the public domain.
|
|
||||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
|
||||||
software, either in source code form or as a compiled binary, for any purpose,
|
|
||||||
commercial or non-commercial, and by any means.
|
|
||||||
In jurisdictions that recognize copyright laws, the author or authors of this
|
|
||||||
software dedicate any and all copyright interest in the software to the public
|
|
||||||
domain. We make this dedication for the benefit of the public at large and to
|
|
||||||
the detriment of our heirs and successors. We intend this dedication to be an
|
|
||||||
overt act of relinquishment in perpetuity of all present and future rights to
|
|
||||||
this software under copyright law.
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
7897
plugins/editor/external/stb_image/stb_image.h
vendored
1
plugins/editor/external/vstgui4
vendored
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 630db26be83f8a1d4bd04926fa45ad10995d2b85
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
# data file for the Fltk User Interface Designer (fluid)
|
|
||||||
version 1.0305
|
|
||||||
header_name {.h}
|
|
||||||
code_name {.cxx}
|
|
||||||
widget_class aboutView {
|
|
||||||
label {About sfizz} open
|
|
||||||
xywh {527 165 800 475} type Double visible
|
|
||||||
} {
|
|
||||||
Fl_Box {} {
|
|
||||||
image {../resources/logo_orange.png} xywh {200 0 400 180}
|
|
||||||
class Logo
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
xywh {260 180 280 80}
|
|
||||||
class InfoBox
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
xywh {200 260 400 100}
|
|
||||||
class DescriptionBox
|
|
||||||
}
|
|
||||||
Fl_Box lblHover_ {
|
|
||||||
xywh {460 435 315 25} labelsize 12 hide
|
|
||||||
class HoverBox
|
|
||||||
}
|
|
||||||
Fl_Button {} {
|
|
||||||
comment {tag=kTagButtonSfztools}
|
|
||||||
xywh {460 405 40 40} labelsize 30
|
|
||||||
class ButtonSfztools
|
|
||||||
}
|
|
||||||
Fl_Button {} {
|
|
||||||
comment {tag=kTagButtonGithub}
|
|
||||||
xywh {530 405 40 40} labelsize 30
|
|
||||||
class ButtonGithub
|
|
||||||
}
|
|
||||||
Fl_Button {} {
|
|
||||||
comment {tag=kTagButtonDiscord}
|
|
||||||
xywh {600 405 40 40} labelsize 30
|
|
||||||
class ButtonDiscord
|
|
||||||
}
|
|
||||||
Fl_Button {} {
|
|
||||||
comment {tag=kTagButtonOpencollective}
|
|
||||||
xywh {670 405 40 40} labelsize 30
|
|
||||||
class ButtonOpencollective
|
|
||||||
}
|
|
||||||
Fl_Button {} {
|
|
||||||
comment {tag=kTagButtonSfzformat}
|
|
||||||
xywh {740 405 40 40} labelsize 30
|
|
||||||
class ButtonSfzformat
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Format
|
|
||||||
Host
|
|
||||||
Processor
|
|
||||||
Address
|
|
||||||
System}
|
|
||||||
xywh {15 375 90 90} align 20
|
|
||||||
class SysInfoKeyBox
|
|
||||||
}
|
|
||||||
Fl_Box lblSysInfoValue_ {
|
|
||||||
label {%PluginFormat%
|
|
||||||
%HostProgram%
|
|
||||||
%HostCPU%
|
|
||||||
%HostBits% bits
|
|
||||||
%HostOS%} selected
|
|
||||||
xywh {105 375 345 90} align 20
|
|
||||||
class SysInfoValueBox
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,464 +0,0 @@
|
||||||
# data file for the Fltk User Interface Designer (fluid)
|
|
||||||
version 1.0304
|
|
||||||
header_name {.h}
|
|
||||||
code_name {.cxx}
|
|
||||||
widget_class mainView {open
|
|
||||||
xywh {624 564 775 515} type Double
|
|
||||||
class LogicalGroup visible
|
|
||||||
} {
|
|
||||||
Fl_Box imageContainer_ {
|
|
||||||
image {../resources/background.png} xywh {0 110 775 335}
|
|
||||||
class Background
|
|
||||||
}
|
|
||||||
Fl_Group {} {
|
|
||||||
comment {palette=invertedPalette} open
|
|
||||||
xywh {0 0 775 110}
|
|
||||||
class LogicalGroup
|
|
||||||
} {
|
|
||||||
Fl_Group {} {
|
|
||||||
xywh {5 4 175 101} box ROUNDED_BOX align 0
|
|
||||||
class RoundedGroup
|
|
||||||
} {
|
|
||||||
Fl_Box {} {
|
|
||||||
comment {tag=kTagAbout}
|
|
||||||
image {../resources/logo_text_shaded.png} xywh {32 9 120 60}
|
|
||||||
class AboutButton
|
|
||||||
}
|
|
||||||
Fl_Button {panelButtons_[kPanelInfo]} {
|
|
||||||
comment {tag=kTagFirstChangePanel+kPanelInfo}
|
|
||||||
xywh {56 73 32 32} labelsize 30
|
|
||||||
class InfoButton
|
|
||||||
}
|
|
||||||
Fl_Button {panelButtons_[kPanelControls]} {
|
|
||||||
comment {tag=kTagFirstChangePanel+kPanelControls}
|
|
||||||
xywh {97 73 32 32} labelsize 30
|
|
||||||
class CCButton
|
|
||||||
}
|
|
||||||
Fl_Button {panelButtons_[kPanelSettings]} {
|
|
||||||
comment {tag=kTagFirstChangePanel+kPanelSettings}
|
|
||||||
xywh {137 73 32 32} labelsize 30
|
|
||||||
class SettingsButton
|
|
||||||
}
|
|
||||||
Fl_Button {panelButtons_[kPanelGeneral]} {
|
|
||||||
comment {tag=kTagFirstChangePanel+kPanelGeneral}
|
|
||||||
xywh {16 73 32 32} labelsize 30
|
|
||||||
class HomeButton
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Fl_Group {} {open
|
|
||||||
xywh {185 5 365 100} box ROUNDED_BOX
|
|
||||||
class RoundedGroup
|
|
||||||
} {
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Separator 1}
|
|
||||||
xywh {195 40 345 5} box BORDER_BOX labeltype NO_LABEL
|
|
||||||
class HLine
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Separator 2}
|
|
||||||
xywh {195 75 345 5} box BORDER_BOX labeltype NO_LABEL
|
|
||||||
class HLine
|
|
||||||
}
|
|
||||||
Fl_Box sfzFileLabel_ {
|
|
||||||
label {DefaultInstrument.sfz}
|
|
||||||
comment {tag=kTagLoadSfzFile}
|
|
||||||
xywh {195 10 270 30} labelsize 20 align 20
|
|
||||||
class ClickableLabel
|
|
||||||
}
|
|
||||||
Fl_Box keyswitchLabel_ {
|
|
||||||
xywh {255 45 285 30} labelsize 20 align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box keyswitchBadge_ {
|
|
||||||
xywh {195 47 60 26} box THIN_UP_BOX labelsize 20
|
|
||||||
class Badge
|
|
||||||
}
|
|
||||||
Fl_Box keyswitchInactiveLabel_ {
|
|
||||||
label {No key switch}
|
|
||||||
xywh {195 45 345 30} labelsize 20 align 20 hide
|
|
||||||
class InactiveLabel
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Voices:}
|
|
||||||
xywh {195 78 60 25} align 24
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Button {} {
|
|
||||||
comment {tag=kTagPreviousSfzFile}
|
|
||||||
xywh {465 15 25 25} labelsize 24
|
|
||||||
class PreviousFileButton
|
|
||||||
}
|
|
||||||
Fl_Button {} {
|
|
||||||
comment {tag=kTagNextSfzFile}
|
|
||||||
xywh {490 15 25 25} labelsize 24
|
|
||||||
class NextFileButton
|
|
||||||
}
|
|
||||||
Fl_Button fileOperationsMenu_ {
|
|
||||||
comment {tag=kTagFileOperations}
|
|
||||||
xywh {515 15 25 25} labelsize 24
|
|
||||||
class ChevronDropDown
|
|
||||||
}
|
|
||||||
Fl_Box infoVoicesLabel_ {
|
|
||||||
xywh {255 78 40 25} align 16
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Max:}
|
|
||||||
xywh {315 78 40 25} align 24
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box numVoicesLabel_ {
|
|
||||||
xywh {355 78 35 25} align 16
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Memory:}
|
|
||||||
xywh {430 78 60 25} align 24
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box memoryLabel_ {
|
|
||||||
xywh {490 78 50 25} align 16
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Button numVoicesSlider_ {
|
|
||||||
comment {tag=kTagSetNumVoices}
|
|
||||||
xywh {390 82 20 20} labelsize 16
|
|
||||||
class ChevronValueDropDown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Fl_Group {} {
|
|
||||||
xywh {555 5 215 100} box ROUNDED_BOX
|
|
||||||
class RoundedGroup
|
|
||||||
} {
|
|
||||||
Fl_Dial {} {
|
|
||||||
xywh {587 20 48 48} value 0.5 hide
|
|
||||||
class Knob48
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label Center
|
|
||||||
xywh {582 70 60 5} hide
|
|
||||||
class ValueLabel
|
|
||||||
}
|
|
||||||
Fl_Box volumeCCKnob_ {
|
|
||||||
label Volume
|
|
||||||
comment {tag=kTagSetCCVolume}
|
|
||||||
xywh {560 10 70 90} box BORDER_BOX align 17
|
|
||||||
class KnobCCBox
|
|
||||||
}
|
|
||||||
Fl_Box panCCKnob_ {
|
|
||||||
label Pan
|
|
||||||
comment {tag=kTagSetCCPan}
|
|
||||||
xywh {635 10 70 90} box BORDER_BOX align 17
|
|
||||||
class KnobCCBox
|
|
||||||
}
|
|
||||||
Fl_Box {meters_[0]} {
|
|
||||||
xywh {710 10 23 90} box BORDER_BOX
|
|
||||||
class VMeter
|
|
||||||
}
|
|
||||||
Fl_Box {meters_[1]} {
|
|
||||||
xywh {740 10 23 90} box BORDER_BOX
|
|
||||||
class VMeter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Fl_Group {subPanels_[kPanelInfo]} {
|
|
||||||
xywh {0 110 775 335} hide
|
|
||||||
class LogicalGroup
|
|
||||||
} {
|
|
||||||
Fl_Group {} {
|
|
||||||
xywh {0 110 775 335} box BORDER_BOX
|
|
||||||
class SquaredTransparentGroup
|
|
||||||
} {
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Curves:}
|
|
||||||
xywh {20 120 60 25} align 20
|
|
||||||
class InfoLabel
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Masters:}
|
|
||||||
xywh {20 145 60 25} align 20
|
|
||||||
class InfoLabel
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Groups:}
|
|
||||||
xywh {20 170 60 25} align 20
|
|
||||||
class InfoLabel
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Regions:}
|
|
||||||
xywh {20 195 60 25} align 20
|
|
||||||
class InfoLabel
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Samples:}
|
|
||||||
xywh {20 220 60 25} align 20
|
|
||||||
class InfoLabel
|
|
||||||
}
|
|
||||||
Fl_Box infoCurvesLabel_ {
|
|
||||||
label 0
|
|
||||||
xywh {120 120 40 25} align 16
|
|
||||||
class InfoLabel
|
|
||||||
}
|
|
||||||
Fl_Box infoMastersLabel_ {
|
|
||||||
label 0
|
|
||||||
xywh {120 145 40 25} align 16
|
|
||||||
class InfoLabel
|
|
||||||
}
|
|
||||||
Fl_Box infoGroupsLabel_ {
|
|
||||||
label 0
|
|
||||||
xywh {120 170 40 25} align 16
|
|
||||||
class InfoLabel
|
|
||||||
}
|
|
||||||
Fl_Box infoRegionsLabel_ {
|
|
||||||
label 0
|
|
||||||
xywh {120 195 40 25} align 16
|
|
||||||
class InfoLabel
|
|
||||||
}
|
|
||||||
Fl_Box infoSamplesLabel_ {
|
|
||||||
label 0
|
|
||||||
xywh {120 220 40 25} align 16
|
|
||||||
class InfoLabel
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Fl_Group {subPanels_[kPanelControls]} {
|
|
||||||
xywh {0 110 775 335} hide
|
|
||||||
class LogicalGroup
|
|
||||||
} {
|
|
||||||
Fl_Group controlsPanel_ {
|
|
||||||
xywh {0 110 775 335} box BORDER_BOX
|
|
||||||
class ControlsPanel
|
|
||||||
} {}
|
|
||||||
}
|
|
||||||
Fl_Group {subPanels_[kPanelSettings]} {
|
|
||||||
xywh {0 110 775 335}
|
|
||||||
class LogicalGroup
|
|
||||||
} {
|
|
||||||
Fl_Group {} {open
|
|
||||||
xywh {0 110 775 335} box BORDER_BOX
|
|
||||||
class SquaredGroup
|
|
||||||
} {
|
|
||||||
Fl_Spinner oversamplingSlider_ {
|
|
||||||
comment {tag=kTagSetOversampling}
|
|
||||||
xywh {180 195 70 25}
|
|
||||||
class ValueMenu
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label Oversampling
|
|
||||||
xywh {10 195 85 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Preload size}
|
|
||||||
xywh {10 170 75 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Spinner preloadSizeSlider_ {
|
|
||||||
comment {tag=kTagSetPreloadSize}
|
|
||||||
xywh {180 170 70 25}
|
|
||||||
class ValueMenu
|
|
||||||
}
|
|
||||||
Fl_Spinner sampleQualitySlider_ {
|
|
||||||
comment {tag=kTagSetSampleQuality}
|
|
||||||
xywh {430 145 80 25}
|
|
||||||
class ValueMenu
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label Sample
|
|
||||||
xywh {270 145 50 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label Oscillator
|
|
||||||
xywh {270 195 60 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Spinner oscillatorQualitySlider_ {
|
|
||||||
comment {tag=kTagSetOscillatorQuality}
|
|
||||||
xywh {430 195 80 25}
|
|
||||||
class ValueMenu
|
|
||||||
}
|
|
||||||
Fl_Spinner themeMenu_ {
|
|
||||||
comment {tag=kTagThemeMenu}
|
|
||||||
xywh {665 145 100 25}
|
|
||||||
class OptionMenu
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label Theme
|
|
||||||
xywh {525 145 45 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {User SFZ folder}
|
|
||||||
xywh {525 170 95 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Button userFilesDirButton_ {
|
|
||||||
label DefaultPath
|
|
||||||
comment {tag=kTagChooseUserFilesDir}
|
|
||||||
xywh {665 170 100 25}
|
|
||||||
class ValueButton
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Root key}
|
|
||||||
xywh {525 310 60 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label Frequency
|
|
||||||
xywh {525 335 70 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Dial stretchedTuningSlider_ {
|
|
||||||
comment {tag=kTagSetStretchedTuning}
|
|
||||||
xywh {700 360 48 48} value 0.5
|
|
||||||
class StyledKnob
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label Stretch
|
|
||||||
xywh {525 370 50 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Scala file}
|
|
||||||
xywh {525 285 60 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Button scalaFileButton_ {
|
|
||||||
label DefaultScale
|
|
||||||
comment {tag=kTagLoadScalaFile}
|
|
||||||
xywh {624 285 100 25}
|
|
||||||
class ValueButton
|
|
||||||
}
|
|
||||||
Fl_Spinner scalaRootKeySlider_ {
|
|
||||||
comment {tag=kTagSetScalaRootKey}
|
|
||||||
xywh {685 310 35 25}
|
|
||||||
class ValueMenu
|
|
||||||
}
|
|
||||||
Fl_Spinner scalaRootOctaveSlider_ {
|
|
||||||
comment {tag=kTagSetScalaRootKey}
|
|
||||||
xywh {720 310 30 25}
|
|
||||||
class ValueMenu
|
|
||||||
}
|
|
||||||
Fl_Button scalaResetButton_ {
|
|
||||||
comment {tag=kTagResetScalaFile}
|
|
||||||
xywh {725 285 25 25}
|
|
||||||
class ResetSomethingButton
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {when freewheeling}
|
|
||||||
xywh {270 170 145 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Spinner freewheelingSampleQualitySlider_ {
|
|
||||||
comment {tag=kTagSetFreewheelingSampleQuality}
|
|
||||||
xywh {430 170 80 25}
|
|
||||||
class ValueMenu
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Sustain cancels release}
|
|
||||||
xywh {10 220 145 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Check_Button sustainCancelsReleaseCheckbox_ {
|
|
||||||
comment {tag=kTagSetSustainCancelsRelease}
|
|
||||||
xywh {180 220 25 25} down_box DOWN_BOX
|
|
||||||
class Checkbox
|
|
||||||
}
|
|
||||||
Fl_Box sfizzVersionLabel_ {
|
|
||||||
label SFIZZ_VERSION
|
|
||||||
xywh {10 145 225 20}
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Rendering quality}
|
|
||||||
xywh {270 115 110 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Separator 2}
|
|
||||||
xywh {10 135 240 5} box BORDER_BOX labeltype NO_LABEL
|
|
||||||
class HLine
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Engine options}
|
|
||||||
xywh {10 115 95 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label Other
|
|
||||||
xywh {525 115 40 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label Tuning
|
|
||||||
xywh {525 255 225 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Separator Rendering}
|
|
||||||
xywh {270 135 239 5} box BORDER_BOX labeltype NO_LABEL
|
|
||||||
class HLine
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Separator Other}
|
|
||||||
xywh {525 135 240 5} box BORDER_BOX labeltype NO_LABEL
|
|
||||||
class HLine
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {Separator Tuning}
|
|
||||||
xywh {525 275 225 5} box BORDER_BOX labeltype NO_LABEL
|
|
||||||
class HLine
|
|
||||||
}
|
|
||||||
Fl_Button tuningFrequencyDropdown_ {
|
|
||||||
comment {tag=kTagSetTuningFrequency}
|
|
||||||
xywh {725 335 25 25} labelsize 24
|
|
||||||
class ChevronValueDropDown
|
|
||||||
}
|
|
||||||
Fl_Text_Editor tuningFrequencyEdit_ {
|
|
||||||
comment {tag=kTagSetTuningFrequency}
|
|
||||||
xywh {665 335 60 25}
|
|
||||||
class TextEdit
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label {when freewheeling}
|
|
||||||
xywh {270 220 145 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Spinner freewheelingOscillatorQualitySlider_ {
|
|
||||||
comment {tag=kTagSetFreewheelingOscillatorQuality}
|
|
||||||
xywh {430 220 80 25}
|
|
||||||
class ValueMenu
|
|
||||||
}
|
|
||||||
Fl_Box {} {
|
|
||||||
label Zoom
|
|
||||||
xywh {525 195 95 25} align 20
|
|
||||||
class Label
|
|
||||||
}
|
|
||||||
Fl_Spinner zoomMenu_ {
|
|
||||||
comment {tag=kTagZoomMenu}
|
|
||||||
xywh {665 195 100 25}
|
|
||||||
class OptionMenu
|
|
||||||
}
|
|
||||||
Fl_Button defaultZoomButton_ {
|
|
||||||
label {Set Default}
|
|
||||||
comment {tag=kTagSetDefaultZoom}
|
|
||||||
xywh {665 220 100 25}
|
|
||||||
class ValueButton
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Fl_Box piano_ {
|
|
||||||
xywh {0 445 775 70} labelsize 16
|
|
||||||
class Piano
|
|
||||||
}
|
|
||||||
Fl_Group {subPanels_[kPanelGeneral]} {
|
|
||||||
xywh {0 110 775 335} hide
|
|
||||||
class LogicalGroup
|
|
||||||
} {}
|
|
||||||
Fl_Box lblHover_ {
|
|
||||||
comment {palette=invertedPalette}
|
|
||||||
xywh {5 105 170 25} hide
|
|
||||||
class HoverBox
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<sfizz-theme author="Andrea Zanellato" version="1.0.0">
|
|
||||||
<color name="frameBackground">#121212</color>
|
|
||||||
<palette name="normal">
|
|
||||||
<color name="boxBackground">#1d1d1d</color>
|
|
||||||
<color name="text">#e3e3e3</color>
|
|
||||||
<color name="inactiveText">#a2a2a2</color>
|
|
||||||
<color name="highlightedText">#e9e9e9</color>
|
|
||||||
<color name="titleBoxText">#e3e3e3</color>
|
|
||||||
<color name="titleBoxBackground">#2d2d2d</color>
|
|
||||||
<color name="valueText">#e3e3e3</color>
|
|
||||||
<color name="valueBackground">#121212</color>
|
|
||||||
<color name="icon">#e3e3e3</color>
|
|
||||||
<color name="iconHighlight">#ff6000</color>
|
|
||||||
<color name="knobActiveTrack">#006b0b</color>
|
|
||||||
<color name="knobInactiveTrack">#6f6f6f</color>
|
|
||||||
<color name="knobLineIndicator">#ffffff</color>
|
|
||||||
<color name="knobText">#ffffff</color>
|
|
||||||
<color name="knobLabelText">#ffffff</color>
|
|
||||||
<color name="knobLabelBackground">#006b0b</color>
|
|
||||||
</palette>
|
|
||||||
<palette name="inverted">
|
|
||||||
<color name="boxBackground">#2d2d2d</color>
|
|
||||||
<color name="text">#9e9e9e</color>
|
|
||||||
<color name="inactiveText">#a2a2a2</color>
|
|
||||||
<color name="highlightedText">#e9e9e9</color>
|
|
||||||
<color name="titleBoxText">#9e9e9e</color>
|
|
||||||
<color name="titleBoxBackground">#2d2d2d</color>
|
|
||||||
<color name="valueText">#9e9e9e</color>
|
|
||||||
<color name="valueBackground">#121212</color>
|
|
||||||
<color name="icon">#9e9e9e</color>
|
|
||||||
<color name="iconHighlight">#ff6000</color>
|
|
||||||
<color name="knobActiveTrack">#006b0b</color>
|
|
||||||
<color name="knobInactiveTrack">#6f6f6f</color>
|
|
||||||
<color name="knobLineIndicator">#ffffff</color>
|
|
||||||
<color name="knobText">#ffffff</color>
|
|
||||||
<color name="knobLabelText">#ffffff</color>
|
|
||||||
<color name="knobLabelBackground">#006b0b</color>
|
|
||||||
</palette>
|
|
||||||
</sfizz-theme>
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<sfizz-theme>
|
|
||||||
<color name="frameBackground">#d3d7cf</color>
|
|
||||||
<palette name="normal">
|
|
||||||
<color name="boxBackground">#babdb6</color>
|
|
||||||
<color name="text">#000000</color>
|
|
||||||
<color name="inactiveText">#b2b2b2</color>
|
|
||||||
<color name="highlightedText">#fd9800</color>
|
|
||||||
<color name="titleBoxText">#ffffff</color>
|
|
||||||
<color name="titleBoxBackground">#2e3436</color>
|
|
||||||
<color name="valueText">#ffffff</color>
|
|
||||||
<color name="valueBackground">#2e3436</color>
|
|
||||||
<color name="icon">#000000</color>
|
|
||||||
<color name="iconHighlight">#fd9800</color>
|
|
||||||
<color name="knobActiveTrack">#00aa11</color>
|
|
||||||
<color name="knobInactiveTrack">#303030</color>
|
|
||||||
<color name="knobLineIndicator">#000000</color>
|
|
||||||
<color name="knobText">#000000</color>
|
|
||||||
<color name="knobLabelText">#ffffff</color>
|
|
||||||
<color name="knobLabelBackground">#006b0b</color>
|
|
||||||
</palette>
|
|
||||||
<palette name="inverted">
|
|
||||||
<color name="boxBackground">#2e3436</color>
|
|
||||||
<color name="text">#ffffff</color>
|
|
||||||
<color name="inactiveText">#b2b2b2</color>
|
|
||||||
<color name="highlightedText">#fd9800</color>
|
|
||||||
<color name="titleBoxText">#000000</color>
|
|
||||||
<color name="titleBoxBackground">#babdb6</color>
|
|
||||||
<color name="valueText">#000000</color>
|
|
||||||
<color name="valueBackground">#9a9a9a</color>
|
|
||||||
<color name="icon">#b2b2b2</color>
|
|
||||||
<color name="iconHighlight">#fd9800</color>
|
|
||||||
<color name="knobActiveTrack">#00aa11</color>
|
|
||||||
<color name="knobInactiveTrack">#606060</color>
|
|
||||||
<color name="knobLineIndicator">#ffffff</color>
|
|
||||||
<color name="knobText">#ffffff</color>
|
|
||||||
<color name="knobLabelText">#ffffff</color>
|
|
||||||
<color name="knobLabelBackground">#006b0b</color>
|
|
||||||
</palette>
|
|
||||||
</sfizz-theme>
|
|
||||||
|
Before Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 90 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
|
@ -1,252 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
inkscape:export-ydpi="192"
|
|
||||||
inkscape:export-xdpi="192"
|
|
||||||
inkscape:export-filename="/home/jpc/documents/projects/sfizz/editor/resources/logo_text@2x.png"
|
|
||||||
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
|
|
||||||
sodipodi:docname="logo_text.svg"
|
|
||||||
id="svg8"
|
|
||||||
version="1.1"
|
|
||||||
viewBox="0 0 105.83333 66.145836"
|
|
||||||
height="250"
|
|
||||||
width="400">
|
|
||||||
<title
|
|
||||||
id="title1469">sfizz logo</title>
|
|
||||||
<defs
|
|
||||||
id="defs2">
|
|
||||||
<linearGradient
|
|
||||||
id="linearGradient1445"
|
|
||||||
inkscape:collect="always">
|
|
||||||
<stop
|
|
||||||
id="stop1441"
|
|
||||||
offset="0"
|
|
||||||
style="stop-color:#646464;stop-opacity:1" />
|
|
||||||
<stop
|
|
||||||
id="stop1443"
|
|
||||||
offset="1"
|
|
||||||
style="stop-color:#000000;stop-opacity:1" />
|
|
||||||
</linearGradient>
|
|
||||||
<inkscape:path-effect
|
|
||||||
effect="fillet_chamfer"
|
|
||||||
id="path-effect1150"
|
|
||||||
is_visible="true"
|
|
||||||
lpeversion="1"
|
|
||||||
satellites_param="F,0,0,1,0,1,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,1,0,2 @ F,0,0,1,0,0,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.47797039,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.51256137,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.33778335,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.27944107,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.25554572,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.29009315,0,2"
|
|
||||||
unit="mm"
|
|
||||||
method="auto"
|
|
||||||
mode="C"
|
|
||||||
radius="1"
|
|
||||||
chamfer_steps="2"
|
|
||||||
flexible="false"
|
|
||||||
use_knot_distance="true"
|
|
||||||
apply_no_radius="true"
|
|
||||||
apply_with_radius="true"
|
|
||||||
only_selected="false"
|
|
||||||
hide_knots="false" />
|
|
||||||
<inkscape:path-effect
|
|
||||||
hide_knots="false"
|
|
||||||
only_selected="false"
|
|
||||||
apply_with_radius="true"
|
|
||||||
apply_no_radius="true"
|
|
||||||
use_knot_distance="true"
|
|
||||||
flexible="false"
|
|
||||||
chamfer_steps="2"
|
|
||||||
radius="1"
|
|
||||||
mode="C"
|
|
||||||
method="auto"
|
|
||||||
unit="mm"
|
|
||||||
satellites_param="F,0,0,1,0,1,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,1,0,2 @ F,0,0,1,0,0,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.47797039,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.51256137,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.33778335,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.27944107,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.25554572,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.29009315,0,2"
|
|
||||||
lpeversion="1"
|
|
||||||
is_visible="true"
|
|
||||||
id="path-effect1136"
|
|
||||||
effect="fillet_chamfer" />
|
|
||||||
<inkscape:path-effect
|
|
||||||
hide_knots="false"
|
|
||||||
only_selected="false"
|
|
||||||
apply_with_radius="true"
|
|
||||||
apply_no_radius="true"
|
|
||||||
use_knot_distance="true"
|
|
||||||
flexible="false"
|
|
||||||
chamfer_steps="2"
|
|
||||||
radius="1"
|
|
||||||
mode="C"
|
|
||||||
method="auto"
|
|
||||||
unit="mm"
|
|
||||||
satellites_param="F,0,0,1,0,1,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,1,0,2 @ F,0,0,1,0,0,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.47797039,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.51256137,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.33778335,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.27944107,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.25554572,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.29009315,0,2"
|
|
||||||
lpeversion="1"
|
|
||||||
is_visible="true"
|
|
||||||
id="path-effect968"
|
|
||||||
effect="fillet_chamfer" />
|
|
||||||
<inkscape:path-effect
|
|
||||||
effect="fillet_chamfer"
|
|
||||||
id="path-effect921"
|
|
||||||
is_visible="true"
|
|
||||||
lpeversion="1"
|
|
||||||
satellites_param="F,0,0,1,0,1,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,1,0,2 @ F,0,0,1,0,0,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.47797039,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.51256137,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.33778335,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.27944107,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.25554572,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.29009315,0,2"
|
|
||||||
unit="mm"
|
|
||||||
method="auto"
|
|
||||||
mode="C"
|
|
||||||
radius="1"
|
|
||||||
chamfer_steps="2"
|
|
||||||
flexible="false"
|
|
||||||
use_knot_distance="true"
|
|
||||||
apply_no_radius="true"
|
|
||||||
apply_with_radius="true"
|
|
||||||
only_selected="false"
|
|
||||||
hide_knots="false" />
|
|
||||||
<inkscape:path-effect
|
|
||||||
hide_knots="false"
|
|
||||||
only_selected="false"
|
|
||||||
apply_with_radius="true"
|
|
||||||
apply_no_radius="true"
|
|
||||||
use_knot_distance="true"
|
|
||||||
flexible="false"
|
|
||||||
chamfer_steps="2"
|
|
||||||
radius="1"
|
|
||||||
mode="C"
|
|
||||||
method="auto"
|
|
||||||
unit="mm"
|
|
||||||
satellites_param="F,0,0,1,0,1,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,1,0,2 @ F,0,0,1,0,0,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.47797039,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.51256137,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.33778335,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.27944107,0,2 | F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.25554572,0,2 @ F,0,0,1,0,0,0,2 @ F,0,0,1,0,0.29009315,0,2"
|
|
||||||
lpeversion="1"
|
|
||||||
is_visible="true"
|
|
||||||
id="path-effect1183"
|
|
||||||
effect="fillet_chamfer" />
|
|
||||||
<inkscape:path-effect
|
|
||||||
end_linecap_type="zerowidth"
|
|
||||||
scale_width="1"
|
|
||||||
miter_limit="4"
|
|
||||||
linejoin_type="round"
|
|
||||||
start_linecap_type="zerowidth"
|
|
||||||
interpolator_beta="0.2"
|
|
||||||
interpolator_type="CubicBezierFit"
|
|
||||||
sort_points="true"
|
|
||||||
offset_points="0.19099662,0.36320029 | 0.41721681,0.40988822 | 0.9095762,0.070646707"
|
|
||||||
lpeversion="1"
|
|
||||||
is_visible="true"
|
|
||||||
id="path-effect1172"
|
|
||||||
effect="powerstroke" />
|
|
||||||
<clipPath
|
|
||||||
id="clipPath917"
|
|
||||||
clipPathUnits="userSpaceOnUse">
|
|
||||||
<rect
|
|
||||||
y="68.872978"
|
|
||||||
x="24.792475"
|
|
||||||
height="25.252825"
|
|
||||||
width="39.659527"
|
|
||||||
id="rect919"
|
|
||||||
style="fill:#ffffff;stroke:none;stroke-width:2;stroke-linecap:round;paint-order:markers stroke fill" />
|
|
||||||
</clipPath>
|
|
||||||
<linearGradient
|
|
||||||
gradientUnits="userSpaceOnUse"
|
|
||||||
y2="231.60674"
|
|
||||||
x2="539.22601"
|
|
||||||
y1="190.42654"
|
|
||||||
x1="539.22601"
|
|
||||||
id="linearGradient1447"
|
|
||||||
xlink:href="#linearGradient1445"
|
|
||||||
inkscape:collect="always"
|
|
||||||
gradientTransform="translate(34.589224,10.333824)" />
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
|
||||||
fit-margin-bottom="10"
|
|
||||||
fit-margin-right="10"
|
|
||||||
fit-margin-left="10"
|
|
||||||
fit-margin-top="10"
|
|
||||||
inkscape:snap-bbox-midpoints="true"
|
|
||||||
inkscape:snap-center="true"
|
|
||||||
inkscape:snap-bbox-edge-midpoints="true"
|
|
||||||
inkscape:bbox-paths="true"
|
|
||||||
inkscape:snap-bbox="true"
|
|
||||||
inkscape:guide-bbox="true"
|
|
||||||
inkscape:window-maximized="1"
|
|
||||||
inkscape:window-y="27"
|
|
||||||
inkscape:window-x="0"
|
|
||||||
inkscape:window-height="1008"
|
|
||||||
inkscape:window-width="1920"
|
|
||||||
showguides="false"
|
|
||||||
inkscape:snap-global="false"
|
|
||||||
showgrid="false"
|
|
||||||
inkscape:document-rotation="0"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
inkscape:document-units="px"
|
|
||||||
inkscape:cy="53.822531"
|
|
||||||
inkscape:cx="17.632385"
|
|
||||||
inkscape:zoom="1"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
borderopacity="1.0"
|
|
||||||
bordercolor="#666666"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
id="base"
|
|
||||||
units="px">
|
|
||||||
<sodipodi:guide
|
|
||||||
id="guide899"
|
|
||||||
orientation="1,0"
|
|
||||||
position="-452.4563,176.31198" />
|
|
||||||
<sodipodi:guide
|
|
||||||
id="guide901"
|
|
||||||
orientation="0,-1"
|
|
||||||
position="-351.71366,154.32488" />
|
|
||||||
<sodipodi:guide
|
|
||||||
id="guide1008"
|
|
||||||
orientation="1,0"
|
|
||||||
position="-536.98274,156.82863" />
|
|
||||||
<sodipodi:guide
|
|
||||||
id="guide1185"
|
|
||||||
orientation="1,0"
|
|
||||||
position="-351.75629,154.33106" />
|
|
||||||
</sodipodi:namedview>
|
|
||||||
<metadata
|
|
||||||
id="metadata5">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
<dc:title>sfizz logo</dc:title>
|
|
||||||
<dc:date>2020-05-16</dc:date>
|
|
||||||
<dc:creator>
|
|
||||||
<cc:Agent>
|
|
||||||
<dc:title>Tobiasz 'unfa' Karoń</dc:title>
|
|
||||||
</cc:Agent>
|
|
||||||
</dc:creator>
|
|
||||||
<dc:rights>
|
|
||||||
<cc:Agent>
|
|
||||||
<dc:title>CC-0</dc:title>
|
|
||||||
</cc:Agent>
|
|
||||||
</dc:rights>
|
|
||||||
<cc:license
|
|
||||||
rdf:resource="http://creativecommons.org/publicdomain/zero/1.0/" />
|
|
||||||
</cc:Work>
|
|
||||||
<cc:License
|
|
||||||
rdf:about="http://creativecommons.org/publicdomain/zero/1.0/">
|
|
||||||
<cc:permits
|
|
||||||
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
|
||||||
<cc:permits
|
|
||||||
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
|
||||||
<cc:permits
|
|
||||||
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
|
||||||
</cc:License>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
transform="translate(-495.92008,-191.91875)"
|
|
||||||
id="layer1"
|
|
||||||
inkscape:groupmode="layer"
|
|
||||||
inkscape:label="Layer 1">
|
|
||||||
<path
|
|
||||||
id="path1439"
|
|
||||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:34.8154px;line-height:1.25;font-family:ABeeZee;-inkscape-font-specification:ABeeZee;letter-spacing:0px;word-spacing:0px;fill:url(#linearGradient1447);fill-opacity:1;stroke:none;stroke-width:0.264584"
|
|
||||||
d="m 569.95053,215.93967 h 13.61282 v 2.40226 l -9.9572,12.91651 h 10.13128 v 2.78523 h -13.99579 v -2.47189 l 9.99202,-12.91651 h -9.78313 z m -16.4328,0 h 13.61282 v 2.40226 l -9.9572,12.91651 h 10.13128 v 2.78523 h -13.99579 v -2.47189 l 9.99202,-12.91651 h -9.78313 z m -6.38378,18.104 h -3.13338 l 3.1682,-18.104 h 3.13339 z m 2.33264,-21.20257 c -0.64989,0 -1.14891,-0.18568 -1.49707,-0.55705 -0.32494,-0.39457 -0.48741,-0.84717 -0.48741,-1.3578 0,-0.74273 0.2321,-1.33459 0.69631,-1.77559 0.4642,-0.46421 1.04446,-0.69631 1.74077,-0.69631 0.64989,0 1.1373,0.19729 1.46224,0.59187 0.34815,0.37136 0.52223,0.81235 0.52223,1.32298 0,0.74273 -0.2321,1.34619 -0.6963,1.8104 -0.46421,0.441 -1.04446,0.6615 -1.74077,0.6615 z m -12.24537,3.76006 h 5.36157 l -0.48741,2.7156 h -5.36157 l -3.06376,17.23362 c -0.18568,1.02125 -0.4526,1.88003 -0.80075,2.57634 -0.34815,0.71952 -0.76594,1.29978 -1.25336,1.74077 -0.48741,0.44099 -1.04446,0.75433 -1.67114,0.94002 -0.62667,0.20889 -1.29977,0.31334 -2.01929,0.31334 -0.76594,0 -1.46225,-0.10445 -2.08892,-0.31334 -0.64989,-0.20889 -1.21854,-0.49902 -1.70596,-0.87039 l 1.25336,-2.57634 c 0.32494,0.32495 0.70791,0.58026 1.1489,0.76594 0.41779,0.18568 0.8936,0.27852 1.42744,0.27852 0.62667,0 1.16051,-0.2205 1.6015,-0.66149 0.46421,-0.44099 0.78915,-1.14891 0.97484,-2.12374 l 3.06375,-17.30325 h -2.78523 l 0.48741,-2.7156 h 2.78524 l 0.52223,-2.78523 c 0.39457,-2.13535 1.14891,-3.65562 2.263,-4.56082 1.11409,-0.92841 2.54152,-1.39262 4.28229,-1.39262 0.95162,0 1.83361,0.12766 2.64597,0.38297 0.81236,0.23211 1.54348,0.52224 2.19337,0.87039 l -1.21854,2.64597 c -0.53383,-0.27853 -1.09088,-0.53384 -1.67114,-0.76594 -0.55704,-0.23211 -1.21853,-0.34816 -1.98447,-0.34816 -0.85878,0 -1.5899,0.25531 -2.19337,0.76594 -0.60347,0.48742 -0.99804,1.25336 -1.18373,2.29782 z m -21.96217,13.36911 c 0.60347,0.53384 1.3578,0.96323 2.263,1.28817 0.92841,0.32495 1.91485,0.48742 2.95931,0.48742 1.29977,0 2.2746,-0.20889 2.92449,-0.62668 0.6731,-0.44099 1.00965,-0.99804 1.00965,-1.67114 0,-0.34815 -0.0696,-0.6731 -0.20889,-0.97483 -0.11605,-0.30173 -0.34816,-0.59186 -0.69631,-0.87039 -0.32495,-0.27852 -0.77755,-0.54544 -1.3578,-0.80075 -0.58026,-0.27852 -1.33459,-0.58025 -2.263,-0.9052 -1.71756,-0.58026 -2.99413,-1.26496 -3.8297,-2.05411 -0.83557,-0.81236 -1.25335,-1.92645 -1.25335,-3.34228 0,-0.69631 0.15087,-1.34619 0.4526,-1.94966 0.32495,-0.60347 0.77755,-1.1257 1.3578,-1.56669 0.60347,-0.46421 1.32299,-0.82397 2.15856,-1.07928 0.85878,-0.25531 1.83361,-0.38297 2.92449,-0.38297 1.18372,0 2.21658,0.12766 3.09857,0.38297 0.9052,0.2321 1.71756,0.53383 2.43708,0.9052 l -0.87039,2.57634 c -0.62667,-0.37137 -1.34619,-0.6731 -2.15855,-0.9052 -0.78915,-0.2321 -1.67114,-0.34815 -2.64597,-0.34815 -1.20693,0 -2.12374,0.24371 -2.75042,0.73112 -0.62668,0.48741 -0.94002,1.02125 -0.94002,1.60151 0,0.27852 0.0464,0.53383 0.13927,0.76594 0.11605,0.2321 0.31333,0.4526 0.59186,0.66149 0.27852,0.20889 0.64988,0.41779 1.11409,0.62668 0.46421,0.20889 1.04446,0.42938 1.74077,0.66149 1.13731,0.39457 2.10053,0.80075 2.88968,1.21854 0.78915,0.39457 1.42743,0.83557 1.91485,1.32298 0.48741,0.48742 0.83557,1.02126 1.04446,1.60151 0.20889,0.55705 0.31334,1.18372 0.31334,1.88003 0,0.81236 -0.17408,1.54348 -0.52223,2.19337 -0.34816,0.64989 -0.83558,1.20693 -1.46225,1.67114 -0.62668,0.44099 -1.39262,0.77754 -2.29782,1.00965 -0.88199,0.25531 -1.86842,0.38297 -2.95931,0.38297 -1.39261,0 -2.63436,-0.17408 -3.72524,-0.52223 -1.09089,-0.34815 -1.99609,-0.80075 -2.71561,-1.3578 z"
|
|
||||||
sodipodi:nodetypes="cccccccccccccccccccccccccccscscscscsccccccscsccccsccccccccsccccscccccscscccccscccsccccssscssccccssccsscc" />
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 4 KiB |
|
|
@ -1,81 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "ColorHelpers.h"
|
|
||||||
#include <ColorSpaces.h>
|
|
||||||
|
|
||||||
SColorRGB::SColorRGB(const CColor &cc)
|
|
||||||
{
|
|
||||||
r = cc.normRed<float>();
|
|
||||||
g = cc.normGreen<float>();
|
|
||||||
b = cc.normBlue<float>();
|
|
||||||
a = cc.normAlpha<float>();
|
|
||||||
}
|
|
||||||
|
|
||||||
SColorRGB::SColorRGB(const SColorHCY &hcy)
|
|
||||||
{
|
|
||||||
ColorSpaces::vec3 vhcy{{hcy.h, hcy.c, hcy.y}};
|
|
||||||
ColorSpaces::vec3 vrgb = ColorSpaces::hcy_to_rgb(vhcy);
|
|
||||||
r = vrgb[0];
|
|
||||||
g = vrgb[1];
|
|
||||||
b = vrgb[2];
|
|
||||||
a = hcy.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
CColor SColorRGB::toColor() const
|
|
||||||
{
|
|
||||||
CColor cc;
|
|
||||||
cc.setNormRed(r);
|
|
||||||
cc.setNormGreen(g);
|
|
||||||
cc.setNormBlue(b);
|
|
||||||
cc.setNormAlpha(a);
|
|
||||||
return cc;
|
|
||||||
}
|
|
||||||
|
|
||||||
SColorHCY::SColorHCY(const SColorRGB &rgb)
|
|
||||||
{
|
|
||||||
ColorSpaces::vec3 vrgb{{rgb.r, rgb.g, rgb.b}};
|
|
||||||
ColorSpaces::vec3 vhcy = ColorSpaces::rgb_to_hcy(vrgb);
|
|
||||||
h = vhcy[0];
|
|
||||||
c = vhcy[1];
|
|
||||||
y = vhcy[2];
|
|
||||||
a = rgb.a;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int hexDigitFromChar(char c)
|
|
||||||
{
|
|
||||||
return (c >= '0' && c <= '9') ? (c - '0') :
|
|
||||||
(c >= 'a' && c <= 'z') ? (c - 'a' + 10) :
|
|
||||||
(c >= 'A' && c <= 'Z') ? (c - 'A' + 10) : -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool colorFromHex(absl::string_view hex, CColor& color)
|
|
||||||
{
|
|
||||||
if (hex.empty() || hex[0] != '#')
|
|
||||||
return false;
|
|
||||||
|
|
||||||
hex = hex.substr(1, hex.size());
|
|
||||||
size_t length = hex.size();
|
|
||||||
uint32_t rgba = 0;
|
|
||||||
if (length == 6 || length == 8) {
|
|
||||||
for (size_t i = 0; i < length; ++i) {
|
|
||||||
int d = hexDigitFromChar(hex[i]);
|
|
||||||
if (d == -1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
rgba = (rgba << 4) | d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (length == 6)
|
|
||||||
rgba = (rgba << 8) | 0xff;
|
|
||||||
|
|
||||||
color.red = rgba >> 24;
|
|
||||||
color.green = (rgba >> 16) & 0xff;
|
|
||||||
color.blue = (rgba >> 8) & 0xff;
|
|
||||||
color.alpha = rgba & 0xff;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "utility/vstgui_before.h"
|
|
||||||
#include "vstgui/lib/ccolor.h"
|
|
||||||
#include "utility/vstgui_after.h"
|
|
||||||
#include <absl/strings/string_view.h>
|
|
||||||
|
|
||||||
using namespace VSTGUI;
|
|
||||||
|
|
||||||
struct SColorRGB;
|
|
||||||
struct SColorHCY;
|
|
||||||
|
|
||||||
struct SColorRGB {
|
|
||||||
SColorRGB() = default;
|
|
||||||
explicit SColorRGB(const CColor &cc);
|
|
||||||
explicit SColorRGB(const SColorHCY &hcy);
|
|
||||||
SColorRGB(float r, float g, float b, float a = 1.0) : r(r), g(g), b(b), a(a) {}
|
|
||||||
CColor toColor() const;
|
|
||||||
|
|
||||||
float r {}, g {}, b {}, a { 1.0 };
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SColorHCY {
|
|
||||||
SColorHCY() = default;
|
|
||||||
explicit SColorHCY(const CColor &cc) : SColorHCY(SColorRGB(cc)) {}
|
|
||||||
explicit SColorHCY(const SColorRGB &rgb);
|
|
||||||
SColorHCY(float h, float c, float y, float a = 1.0) : h(h), c(c), y(y), a(a) {}
|
|
||||||
CColor toColor() const { return SColorRGB(*this).toColor(); }
|
|
||||||
|
|
||||||
float h {}, c {}, y {}, a { 1.0 };
|
|
||||||
};
|
|
||||||
|
|
||||||
bool colorFromHex(absl::string_view hex, CColor& color);
|
|
||||||
|
|
@ -1,323 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "DlgAbout.h"
|
|
||||||
#include "GUIComponents.h"
|
|
||||||
#include "GUIDefs.h"
|
|
||||||
#include "GitBuildId.h"
|
|
||||||
#include "NativeHelpers.h"
|
|
||||||
|
|
||||||
#include "utility/vstgui_before.h"
|
|
||||||
#include "vstgui/vstgui.h"
|
|
||||||
#include "utility/vstgui_after.h"
|
|
||||||
|
|
||||||
#include <absl/strings/str_cat.h>
|
|
||||||
#if 0
|
|
||||||
#include <absl/time/clock.h>
|
|
||||||
#include <absl/time/time.h>
|
|
||||||
#endif
|
|
||||||
using namespace gui;
|
|
||||||
|
|
||||||
SAboutDialog::SAboutDialog(const CRect& bounds)
|
|
||||||
: CViewContainer(bounds)
|
|
||||||
{
|
|
||||||
SharedPointer<CBitmap> logo = owned(new CBitmap("logo_orange.png"));
|
|
||||||
setBackgroundColor(kColorControlsScrollerTransparency);
|
|
||||||
|
|
||||||
CView* aboutView = nullptr;
|
|
||||||
{
|
|
||||||
auto createaboutView = [](const CRect& bounds, int, const char*, CHoriTxtAlign, int) {
|
|
||||||
CViewContainer* container = new CViewContainer(bounds);
|
|
||||||
container->setBackgroundColor(kColorTransparent);
|
|
||||||
return container;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto createLogo = [&logo](const CRect& bounds, int, const char*, CHoriTxtAlign, int) {
|
|
||||||
CViewContainer* container = new CViewContainer(bounds);
|
|
||||||
container->setBackgroundColor(kColorTransparent);
|
|
||||||
container->setBackground(logo);
|
|
||||||
return container;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto createInfoBox = [](const CRect& bounds, int, const char*, CHoriTxtAlign align, int fontsize) {
|
|
||||||
CMultiLineTextLabel* lbl = new CMultiLineTextLabel(bounds);
|
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
|
||||||
lbl->setFont(font);
|
|
||||||
lbl->setFontColor(kWhiteCColor);
|
|
||||||
lbl->setFrameColor(kColorTransparent);
|
|
||||||
lbl->setBackColor(kColorTransparent);
|
|
||||||
lbl->setHoriAlign(align);
|
|
||||||
|
|
||||||
const char* version = SFIZZ_VERSION;
|
|
||||||
std::string versionBuf;
|
|
||||||
if (GitBuildId[0]) {
|
|
||||||
versionBuf = absl::StrCat(SFIZZ_VERSION ".", GitBuildId);
|
|
||||||
version = versionBuf.c_str();
|
|
||||||
}
|
|
||||||
#if 0
|
|
||||||
absl::TimeZone utc = absl::UTCTimeZone();
|
|
||||||
absl::Time time = absl::Now();
|
|
||||||
absl::CivilYear date = absl::ToCivilYear(time, utc);
|
|
||||||
// u8"Copyright 2019-", date.year(), u8" by SFZTools Team,\n"
|
|
||||||
#endif
|
|
||||||
lbl->setText(absl::StrCat(
|
|
||||||
u8"Version ", version, u8"\n"
|
|
||||||
u8"Copyright 2019-2023 by SFZTools Team,\n"
|
|
||||||
u8"licensed under BSD 2-clause license."));
|
|
||||||
return lbl;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto createDescriptionBox = [](const CRect& bounds, int, const char*, CHoriTxtAlign align, int fontsize) {
|
|
||||||
CMultiLineTextLabel* lbl = new CMultiLineTextLabel(bounds);
|
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
|
||||||
lbl->setFont(font);
|
|
||||||
lbl->setFontColor(kWhiteCColor);
|
|
||||||
lbl->setFrameColor(kColorTransparent);
|
|
||||||
lbl->setBackColor(kColorTransparent);
|
|
||||||
lbl->setHoriAlign(align);
|
|
||||||
lbl->setText(absl::StrCat(
|
|
||||||
u8"Maintainers: Paul Ferrand, Jean-Pierre Cimalando\n"
|
|
||||||
u8"Contributors: Andrea Zanellato, Alexander Mitchell, Michael Willis,\n"
|
|
||||||
u8"Tobiasz \"unfa\" Karoń, Kinwie, Atsushi Eno, Dominique Würtz,\n"
|
|
||||||
u8"Even Brenden et al."));
|
|
||||||
return lbl;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto createHoverBox = [](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
|
|
||||||
CTextLabel* lbl = new CTextLabel(bounds, label);
|
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
|
||||||
lbl->setFontColor(kColorOrange);
|
|
||||||
lbl->setFrameColor(kColorTransparent);
|
|
||||||
lbl->setBackColor(kColorTransparent);
|
|
||||||
lbl->setHoriAlign(align);
|
|
||||||
lbl->setFont(font);
|
|
||||||
return lbl;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto createSysInfoKeyBox = [](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
|
|
||||||
CMultiLineTextLabel* lbl = new CMultiLineTextLabel(bounds);
|
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize, kBoldFace);
|
|
||||||
lbl->setFont(font);
|
|
||||||
lbl->setFontColor(kColorOrange);
|
|
||||||
lbl->setFrameColor(kColorTransparent);
|
|
||||||
lbl->setBackColor(kColorTransparent);
|
|
||||||
lbl->setHoriAlign(align);
|
|
||||||
lbl->setText(label);
|
|
||||||
return lbl;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto createSysInfoValueBox = [](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) {
|
|
||||||
CMultiLineTextLabel* lbl = new CMultiLineTextLabel(bounds);
|
|
||||||
auto font = makeOwned<CFontDesc>("Roboto", fontsize);
|
|
||||||
lbl->setFont(font);
|
|
||||||
lbl->setFontColor(kWhiteCColor);
|
|
||||||
lbl->setFrameColor(kColorTransparent);
|
|
||||||
lbl->setBackColor(kColorTransparent);
|
|
||||||
lbl->setHoriAlign(align);
|
|
||||||
lbl->setText(label);
|
|
||||||
return lbl;
|
|
||||||
};
|
|
||||||
|
|
||||||
auto createGlyphButton = [this](UTF8StringPtr glyph, const CRect& bounds, int tag, int fontsize) {
|
|
||||||
STextButton* btn = new STextButton(bounds, this, tag, glyph);
|
|
||||||
btn->setFont(makeOwned<CFontDesc>("Sfizz Misc Icons", fontsize));
|
|
||||||
btn->setTextColor(kWhiteCColor);
|
|
||||||
btn->setHighlightColor(kColorOrange);
|
|
||||||
btn->setFrameColor(kColorTransparent);
|
|
||||||
btn->setFrameColorHighlighted(kColorTransparent);
|
|
||||||
btn->setGradient(nullptr);
|
|
||||||
btn->setGradientHighlighted(nullptr);
|
|
||||||
return btn;
|
|
||||||
};
|
|
||||||
auto createButtonSfztools = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
|
|
||||||
STextButton* btn = createGlyphButton(u8"\ue000", bounds, tag, fontsize);
|
|
||||||
btn->OnHoverEnter = [this, btn]() { buttonHoverEnter(btn, "SFZ Tools"); };
|
|
||||||
btn->OnHoverLeave = [this, btn]() { buttonHoverLeave(btn); };
|
|
||||||
return btn;
|
|
||||||
};
|
|
||||||
auto createButtonGithub = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
|
|
||||||
STextButton* btn = createGlyphButton(u8"\ue001", bounds, tag, fontsize);
|
|
||||||
btn->OnHoverEnter = [this, btn]() { buttonHoverEnter(btn, "Source code"); };
|
|
||||||
btn->OnHoverLeave = [this, btn]() { buttonHoverLeave(btn); };
|
|
||||||
return btn;
|
|
||||||
};
|
|
||||||
auto createButtonDiscord = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
|
|
||||||
STextButton* btn = createGlyphButton(u8"\ue002", bounds, tag, fontsize);
|
|
||||||
btn->OnHoverEnter = [this, btn]() { buttonHoverEnter(btn, "Community chat"); };
|
|
||||||
btn->OnHoverLeave = [this, btn]() { buttonHoverLeave(btn); };
|
|
||||||
return btn;
|
|
||||||
};
|
|
||||||
auto createButtonOpencollective = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
|
|
||||||
STextButton* btn = createGlyphButton(u8"\ue003", bounds, tag, fontsize);
|
|
||||||
btn->OnHoverEnter = [this, btn]() { buttonHoverEnter(btn, "Support us"); };
|
|
||||||
btn->OnHoverLeave = [this, btn]() { buttonHoverLeave(btn); };
|
|
||||||
return btn;
|
|
||||||
};
|
|
||||||
auto createButtonSfzformat = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) {
|
|
||||||
STextButton* btn = createGlyphButton(u8"\ue004", bounds, tag, fontsize);
|
|
||||||
btn->OnHoverEnter = [this, btn]() { buttonHoverEnter(btn, "SFZ Format"); };
|
|
||||||
btn->OnHoverLeave = [this, btn]() { buttonHoverLeave(btn); };
|
|
||||||
return btn;
|
|
||||||
};
|
|
||||||
|
|
||||||
#include "layout/about.hpp"
|
|
||||||
}
|
|
||||||
addView(aboutView);
|
|
||||||
|
|
||||||
CRect aboutBounds = aboutView->getViewSize();
|
|
||||||
aboutBounds.centerInside(CRect(bounds).originize());
|
|
||||||
aboutView->setViewSize(aboutBounds);
|
|
||||||
|
|
||||||
///
|
|
||||||
sysInfoTemplate_ = lblSysInfoValue_->getText();
|
|
||||||
sysInfoVariables_["%Pluginformat%"] = {};
|
|
||||||
sysInfoVariables_["%HostOS%"] = getOperatingSystemName();
|
|
||||||
sysInfoVariables_["%HostCPU%"] = getProcessorName();
|
|
||||||
sysInfoVariables_["%HostBits%"] = std::to_string(8 * sizeof(void*));
|
|
||||||
sysInfoVariables_["%HostProgram%"] = getCurrentProcessName();
|
|
||||||
updateSysInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SAboutDialog::setPluginFormat(const std::string& pluginFormat)
|
|
||||||
{
|
|
||||||
sysInfoVariables_["%PluginFormat%"] = pluginFormat;
|
|
||||||
updateSysInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SAboutDialog::setPluginHost(const std::string& pluginHost)
|
|
||||||
{
|
|
||||||
sysInfoVariables_["%HostProgram%"] = pluginHost;
|
|
||||||
updateSysInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SAboutDialog::updateSysInfo()
|
|
||||||
{
|
|
||||||
std::string text = sysInfoTemplate_;
|
|
||||||
for (const auto& infoKeyValue : sysInfoVariables_) {
|
|
||||||
size_t pos = text.find(infoKeyValue.first);
|
|
||||||
if (pos != text.npos)
|
|
||||||
text.replace(pos, infoKeyValue.first.size(), infoKeyValue.second);
|
|
||||||
}
|
|
||||||
lblSysInfoValue_->setText(UTF8String(text));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SAboutDialog::buttonHoverEnter(CControl* btn, const char* text)
|
|
||||||
{
|
|
||||||
CRect rect = lblHover_->getViewSize();
|
|
||||||
CRect btnRect = btn->getViewSize();
|
|
||||||
rect.left = btnRect.left - 100;
|
|
||||||
rect.right = btnRect.right + 100;
|
|
||||||
lblHover_->setViewSize(rect);
|
|
||||||
|
|
||||||
lblHover_->setText(text);
|
|
||||||
lblHover_->setVisible(true);
|
|
||||||
lblHover_->invalid();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SAboutDialog::buttonHoverLeave(CControl* btn)
|
|
||||||
{
|
|
||||||
(void)btn;
|
|
||||||
lblHover_->setVisible(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
CMouseEventResult SAboutDialog::onMouseDown(CPoint& where, const CButtonState& buttons)
|
|
||||||
{
|
|
||||||
CMouseEventResult result = CViewContainer::onMouseDown(where, buttons);
|
|
||||||
|
|
||||||
if (result != kMouseEventHandled) {
|
|
||||||
setVisible(false);
|
|
||||||
result = kMouseEventHandled;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if VSTGUI_MORE_THAN_4_10
|
|
||||||
void SAboutDialog::onKeyboardEvent (KeyboardEvent& event, CFrame* frame)
|
|
||||||
{
|
|
||||||
auto vstKeyCode = toVstKeyCode (event);
|
|
||||||
if (event.type == EventType::KeyDown && vstKeyCode.virt == VKEY_ESCAPE)
|
|
||||||
{
|
|
||||||
setVisible(false);
|
|
||||||
frame->unregisterKeyboardHook(this);
|
|
||||||
event.consumed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
int32_t SAboutDialog::onKeyDown (const VstKeyCode& keyCode, CFrame* frame)
|
|
||||||
{
|
|
||||||
if (keyCode.virt == VKEY_ESCAPE) {
|
|
||||||
setVisible(false);
|
|
||||||
frame->unregisterKeyboardHook(this);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t SAboutDialog::onKeyUp (const VstKeyCode& keyCode, CFrame* frame)
|
|
||||||
{
|
|
||||||
(void)keyCode;
|
|
||||||
(void)frame;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void SAboutDialog::valueChanged(CControl *ctl)
|
|
||||||
{
|
|
||||||
int32_t tag = ctl->getTag();
|
|
||||||
float value = ctl->getValue();
|
|
||||||
|
|
||||||
switch (tag) {
|
|
||||||
case kTagButtonSfztools:
|
|
||||||
if (value != 1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
Call::later([]() {
|
|
||||||
openURLWithExternalProgram("https://sfz.tools/sfizz/");
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kTagButtonGithub:
|
|
||||||
if (value != 1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
Call::later([]() {
|
|
||||||
openURLWithExternalProgram("https://github.com/sfztools/sfizz");
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kTagButtonDiscord:
|
|
||||||
if (value != 1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
Call::later([]() {
|
|
||||||
openURLWithExternalProgram("https://discord.gg/3ArE9Mw");
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kTagButtonOpencollective:
|
|
||||||
if (value != 1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
Call::later([]() {
|
|
||||||
openURLWithExternalProgram("https://opencollective.com/sfztools");
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kTagButtonSfzformat:
|
|
||||||
if (value != 1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
Call::later([]() {
|
|
||||||
openURLWithExternalProgram("https://sfzformat.com/");
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "utility/vstgui_before.h"
|
|
||||||
#include "vstgui/lib/cviewcontainer.h"
|
|
||||||
#include "vstgui/vstgui.h"
|
|
||||||
#include "utility/vstgui_after.h"
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#define VSTGUI_MORE_THAN_4_10 ((VSTGUI_VERSION_MAJOR > 4) \
|
|
||||||
|| (VSTGUI_VERSION_MAJOR == 4 && VSTGUI_VERSION_MINOR > 10))
|
|
||||||
|
|
||||||
using namespace VSTGUI;
|
|
||||||
|
|
||||||
class SAboutDialog : public CViewContainer, public IControlListener, public IKeyboardHook {
|
|
||||||
|
|
||||||
enum {
|
|
||||||
kTagButtonSfztools,
|
|
||||||
kTagButtonGithub,
|
|
||||||
kTagButtonDiscord,
|
|
||||||
kTagButtonOpencollective,
|
|
||||||
kTagButtonSfzformat
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit SAboutDialog(const CRect& bounds);
|
|
||||||
|
|
||||||
void setPluginFormat(const std::string& pluginFormat);
|
|
||||||
void setPluginHost(const std::string& pluginHost);
|
|
||||||
|
|
||||||
#if VSTGUI_MORE_THAN_4_10
|
|
||||||
void onKeyboardEvent (KeyboardEvent& event, CFrame* frame) override;
|
|
||||||
#else
|
|
||||||
int32_t onKeyDown(const VstKeyCode& code, CFrame* frame) override;
|
|
||||||
int32_t onKeyUp(const VstKeyCode& code, CFrame* frame) override;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
|
||||||
CMouseEventResult onMouseDown(CPoint& where, const CButtonState& buttons) override;
|
|
||||||
|
|
||||||
// IControlListener
|
|
||||||
void valueChanged(CControl* ctl) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void updateSysInfo();
|
|
||||||
|
|
||||||
void buttonHoverEnter(CControl* btn, const char* text);
|
|
||||||
void buttonHoverLeave(CControl* btn);
|
|
||||||
|
|
||||||
CTextLabel* lblHover_ = {};
|
|
||||||
CTextLabel* lblSysInfoValue_ = {};
|
|
||||||
std::string sysInfoTemplate_;
|
|
||||||
std::map<std::string, std::string> sysInfoVariables_;
|
|
||||||
};
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "EditIds.h"
|
|
||||||
|
|
||||||
EditRange EditRange::get(EditId id)
|
|
||||||
{
|
|
||||||
switch (id) {
|
|
||||||
default:
|
|
||||||
assert(false);
|
|
||||||
return {};
|
|
||||||
case EditId::Volume:
|
|
||||||
return { 0, -60, 6 };
|
|
||||||
case EditId::Polyphony:
|
|
||||||
return { 64, 1, 256 };
|
|
||||||
case EditId::Oversampling:
|
|
||||||
return { 0, 0, 3 };
|
|
||||||
case EditId::PreloadSize:
|
|
||||||
return { 8192, 1024, 65536 };
|
|
||||||
case EditId::ScalaRootKey:
|
|
||||||
return { 60, 0, 127 };
|
|
||||||
case EditId::TuningFrequency:
|
|
||||||
return { 440, 300, 500 };
|
|
||||||
case EditId::StretchTuning:
|
|
||||||
return { 0, 0, 1 };
|
|
||||||
case EditId::SampleQuality:
|
|
||||||
return { 2, 0, 10 };
|
|
||||||
case EditId::OscillatorQuality:
|
|
||||||
return { 1, 0, 3 };
|
|
||||||
case EditId::FreewheelingSampleQuality:
|
|
||||||
return { 10, 0, 10 };
|
|
||||||
case EditId::FreewheelingOscillatorQuality:
|
|
||||||
return { 3, 0, 3 };
|
|
||||||
case EditId::SustainCancelsRelease:
|
|
||||||
return { 0, 0, 1 };
|
|
||||||
case EditId::UIActivePanel:
|
|
||||||
return { 0, 0, 255 };
|
|
||||||
case EditId::UIZoom:
|
|
||||||
return { 100, 100, 300 };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,109 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "sfizz/Config.h"
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
enum class EditId : int {
|
|
||||||
SfzFile,
|
|
||||||
Volume,
|
|
||||||
Polyphony,
|
|
||||||
Oversampling,
|
|
||||||
PreloadSize,
|
|
||||||
ScalaFile,
|
|
||||||
ScalaRootKey,
|
|
||||||
TuningFrequency,
|
|
||||||
StretchTuning,
|
|
||||||
SampleQuality,
|
|
||||||
OscillatorQuality,
|
|
||||||
FreewheelingSampleQuality,
|
|
||||||
FreewheelingOscillatorQuality,
|
|
||||||
SustainCancelsRelease,
|
|
||||||
CanEditUserFilesDir,
|
|
||||||
UserFilesDir,
|
|
||||||
FallbackFilesDir,
|
|
||||||
//
|
|
||||||
#define KEY_RANGE(Name) Name##0, Name##Last = Name##0 + 128 - 1
|
|
||||||
#define CC_RANGE(Name) Name##0, Name##Last = Name##0 + sfz::config::numCCs - 1
|
|
||||||
#define METER_RANGE(Name) Name##0, Name##Last = Name##0 + 16 - 1
|
|
||||||
//
|
|
||||||
KEY_RANGE(Key),
|
|
||||||
CC_RANGE(Controller),
|
|
||||||
//
|
|
||||||
KEY_RANGE(KeyUsed),
|
|
||||||
KEY_RANGE(KeyLabel),
|
|
||||||
KEY_RANGE(KeyswitchUsed),
|
|
||||||
KEY_RANGE(KeyswitchLabel),
|
|
||||||
CC_RANGE(ControllerUsed),
|
|
||||||
CC_RANGE(ControllerDefault),
|
|
||||||
CC_RANGE(ControllerLabel),
|
|
||||||
//
|
|
||||||
METER_RANGE(Level),
|
|
||||||
//
|
|
||||||
UINumCurves,
|
|
||||||
UINumMasters,
|
|
||||||
UINumGroups,
|
|
||||||
UINumRegions,
|
|
||||||
UINumPreloadedSamples,
|
|
||||||
UINumActiveVoices,
|
|
||||||
UIActivePanel,
|
|
||||||
UIZoom,
|
|
||||||
//
|
|
||||||
BackgroundImage,
|
|
||||||
ControlsImage,
|
|
||||||
//
|
|
||||||
PluginFormat,
|
|
||||||
PluginHost,
|
|
||||||
PluginOutputs,
|
|
||||||
//
|
|
||||||
#undef KEY_RANGE
|
|
||||||
#undef CC_RANGE
|
|
||||||
#undef METER_RANGE
|
|
||||||
};
|
|
||||||
|
|
||||||
struct EditRange {
|
|
||||||
float def = 0.0;
|
|
||||||
float min = 0.0;
|
|
||||||
float max = 1.0;
|
|
||||||
constexpr EditRange() = default;
|
|
||||||
constexpr EditRange(float def, float min, float max)
|
|
||||||
: def(def), min(min), max(max) {}
|
|
||||||
float extent() const noexcept { return max - min; }
|
|
||||||
static EditRange get(EditId id);
|
|
||||||
};
|
|
||||||
|
|
||||||
#define DEFINE_EDIT_ID_RANGE_HELPERS(type, Type, IdPrefix) \
|
|
||||||
inline bool editIdIs##Type(EditId id) \
|
|
||||||
{ \
|
|
||||||
return int(id) >= int(EditId::IdPrefix##0) && \
|
|
||||||
int(id) <= int(EditId::IdPrefix##Last); \
|
|
||||||
} \
|
|
||||||
inline EditId editIdFor##Type(int value) \
|
|
||||||
{ \
|
|
||||||
EditId id = EditId(int(EditId::IdPrefix##0) + value); \
|
|
||||||
assert(editIdIs##Type(id)); \
|
|
||||||
return id; \
|
|
||||||
} \
|
|
||||||
inline int type##ForEditId(EditId id) \
|
|
||||||
{ \
|
|
||||||
assert(editIdIs##Type(id)); \
|
|
||||||
return int(id) - int(EditId::IdPrefix##0); \
|
|
||||||
}
|
|
||||||
|
|
||||||
// defines editIdForCC, ccForEditId, editIdIsCC, etc..
|
|
||||||
DEFINE_EDIT_ID_RANGE_HELPERS(cc, CC, Controller)
|
|
||||||
DEFINE_EDIT_ID_RANGE_HELPERS(level, Level, Level)
|
|
||||||
DEFINE_EDIT_ID_RANGE_HELPERS(key, Key, Key)
|
|
||||||
DEFINE_EDIT_ID_RANGE_HELPERS(keyUsed, KeyUsed, KeyUsed)
|
|
||||||
DEFINE_EDIT_ID_RANGE_HELPERS(keyLabel, KeyLabel, KeyLabel)
|
|
||||||
DEFINE_EDIT_ID_RANGE_HELPERS(keyswitchUsed, KeyswitchUsed, KeyswitchUsed)
|
|
||||||
DEFINE_EDIT_ID_RANGE_HELPERS(keyswitchLabel, KeyswitchLabel, KeyswitchLabel)
|
|
||||||
DEFINE_EDIT_ID_RANGE_HELPERS(ccUsed, CCUsed, ControllerUsed)
|
|
||||||
DEFINE_EDIT_ID_RANGE_HELPERS(ccDefault, CCDefault, ControllerDefault)
|
|
||||||
DEFINE_EDIT_ID_RANGE_HELPERS(ccLabel, CCLabel, ControllerLabel)
|
|
||||||
|
|
||||||
#undef DEFINE_EDIT_ID_RANGE_HELPERS
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <string>
|
|
||||||
#include <new>
|
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
class EditValue {
|
|
||||||
public:
|
|
||||||
constexpr EditValue() : tag(Nil) {}
|
|
||||||
EditValue(float value) { reset(value); }
|
|
||||||
EditValue(std::string value) { reset(value); }
|
|
||||||
~EditValue() { reset(); }
|
|
||||||
|
|
||||||
void reset() noexcept
|
|
||||||
{
|
|
||||||
if (tag == String)
|
|
||||||
destruct(u.s);
|
|
||||||
tag = Nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset(float value) noexcept
|
|
||||||
{
|
|
||||||
reset();
|
|
||||||
u.f = value;
|
|
||||||
tag = Float;
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset(std::string value) noexcept
|
|
||||||
{
|
|
||||||
reset();
|
|
||||||
new (&u.s) std::string(std::move(value));
|
|
||||||
tag = String;
|
|
||||||
}
|
|
||||||
|
|
||||||
float to_float() const
|
|
||||||
{
|
|
||||||
if (tag != Float)
|
|
||||||
throw std::runtime_error("the tagged union does not contain `float`");
|
|
||||||
return u.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string& to_string() const
|
|
||||||
{
|
|
||||||
if (tag != String)
|
|
||||||
throw std::runtime_error("the tagged union does not contain `string`");
|
|
||||||
return u.s;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
template <class T> static void destruct(T& obj) { obj.~T(); }
|
|
||||||
|
|
||||||
private:
|
|
||||||
enum TypeTag { Nil, Float, String };
|
|
||||||
union Union {
|
|
||||||
constexpr explicit Union(float f = 0.0f) noexcept : f(f) {}
|
|
||||||
~Union() noexcept {}
|
|
||||||
float f;
|
|
||||||
std::string s;
|
|
||||||
};
|
|
||||||
TypeTag tag { Nil };
|
|
||||||
Union u;
|
|
||||||
};
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <sfizz_message.h>
|
|
||||||
#include <memory>
|
|
||||||
class EditorController;
|
|
||||||
|
|
||||||
#include "utility/vstgui_before.h"
|
|
||||||
#include "vstgui/lib/vstguifwd.h"
|
|
||||||
#include "utility/vstgui_after.h"
|
|
||||||
using VSTGUI::CFrame;
|
|
||||||
|
|
||||||
class Editor {
|
|
||||||
public:
|
|
||||||
static const int viewWidth;
|
|
||||||
static const int viewHeight;
|
|
||||||
|
|
||||||
explicit Editor(EditorController& ctrl);
|
|
||||||
~Editor();
|
|
||||||
|
|
||||||
void open(CFrame& frame);
|
|
||||||
void close();
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct Impl;
|
|
||||||
std::unique_ptr<Impl> impl_;
|
|
||||||
};
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "EditValue.h"
|
|
||||||
#include <sfizz_message.h>
|
|
||||||
#include <absl/strings/string_view.h>
|
|
||||||
#include <string>
|
|
||||||
#include <cstdint>
|
|
||||||
enum class EditId : int;
|
|
||||||
|
|
||||||
class EditorController {
|
|
||||||
public:
|
|
||||||
virtual ~EditorController() {}
|
|
||||||
|
|
||||||
// called by Editor
|
|
||||||
virtual void uiSendValue(EditId id, const EditValue& v) = 0;
|
|
||||||
virtual void uiBeginSend(EditId id) = 0;
|
|
||||||
virtual void uiEndSend(EditId id) = 0;
|
|
||||||
virtual void uiSendMIDI(const uint8_t* msg, uint32_t len) = 0;
|
|
||||||
virtual void uiSendMessage(const char* path, const char* sig, const sfizz_arg_t* args) = 0;
|
|
||||||
class Receiver;
|
|
||||||
void decorate(Receiver* r) { r_ = r; }
|
|
||||||
|
|
||||||
class Receiver {
|
|
||||||
public:
|
|
||||||
virtual ~Receiver() {}
|
|
||||||
virtual void uiReceiveValue(EditId id, const EditValue& v) = 0;
|
|
||||||
virtual void uiReceiveMessage(const char* path, const char* sig, const sfizz_arg_t* args) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
// called by DSP
|
|
||||||
void uiReceiveValue(EditId id, const EditValue& v);
|
|
||||||
void uiReceiveMessage(const char* path, const char* sig, const sfizz_arg_t* args);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Receiver* r_ = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline void EditorController::uiReceiveValue(EditId id, const EditValue& v)
|
|
||||||
{
|
|
||||||
if (r_)
|
|
||||||
r_->uiReceiveValue(id, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void EditorController::uiReceiveMessage(const char* path, const char* sig, const sfizz_arg_t* args)
|
|
||||||
{
|
|
||||||
if (r_)
|
|
||||||
r_->uiReceiveMessage(path, sig, args);
|
|
||||||
}
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#define STB_IMAGE_IMPLEMENTATION
|
|
||||||
#include "EditorLibs.h"
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <stb_image.h>
|
|
||||||
|
|
@ -1,521 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "GUIDefs.h"
|
|
||||||
#include <bitset>
|
|
||||||
#include <vector>
|
|
||||||
#include <memory>
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
#include "utility/vstgui_before.h"
|
|
||||||
#include "vstgui/lib/controls/cslider.h"
|
|
||||||
#include "vstgui/lib/controls/cknob.h"
|
|
||||||
#include "vstgui/lib/controls/ctextlabel.h"
|
|
||||||
#include "vstgui/lib/controls/ctextedit.h"
|
|
||||||
#include "vstgui/lib/controls/cbuttons.h"
|
|
||||||
#include "vstgui/lib/controls/coptionmenu.h"
|
|
||||||
#include "vstgui/lib/controls/cscrollbar.h"
|
|
||||||
#include "vstgui/lib/controls/icontrollistener.h"
|
|
||||||
#include "vstgui/lib/cviewcontainer.h"
|
|
||||||
#include "vstgui/lib/cscrollview.h"
|
|
||||||
#include "vstgui/lib/ccolor.h"
|
|
||||||
#include "vstgui/lib/dragging.h"
|
|
||||||
#include "utility/vstgui_after.h"
|
|
||||||
|
|
||||||
using namespace VSTGUI;
|
|
||||||
|
|
||||||
///
|
|
||||||
class SBoxContainer : public CViewContainer {
|
|
||||||
public:
|
|
||||||
explicit SBoxContainer(const CRect& size);
|
|
||||||
virtual ~SBoxContainer() {}
|
|
||||||
void setCornerRadius(CCoord radius);
|
|
||||||
void setBackgroundColor(const CColor& color) override;
|
|
||||||
CColor getBackgroundColor() const override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void drawRect(CDrawContext* dc, const CRect& updateRect) override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
CCoord cornerRadius_ = 0.0;
|
|
||||||
CColor backgroundColor_;
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
|
||||||
class STitleContainer : public SBoxContainer {
|
|
||||||
public:
|
|
||||||
explicit STitleContainer(const CRect& size, UTF8StringPtr text = nullptr);
|
|
||||||
~STitleContainer() {}
|
|
||||||
|
|
||||||
void setTitleFont(CFontRef font);
|
|
||||||
CFontRef getTitleFont() { return titleFont_; }
|
|
||||||
|
|
||||||
void setTitleFontColor(CColor color);
|
|
||||||
CColor getTitleFontColor() const { return titleFontColor_; }
|
|
||||||
void setTitleBackgroundColor(CColor color);
|
|
||||||
CColor getTitleBackgroundColor() const { return titleBackgroundColor_; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void drawRect(CDrawContext* dc, const CRect& updateRect) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string text_;
|
|
||||||
CColor titleFontColor_;
|
|
||||||
CColor titleBackgroundColor_;
|
|
||||||
SharedPointer<CFontDesc> titleFont_;
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
|
||||||
class SFileDropTarget : public IDropTarget,
|
|
||||||
public NonAtomicReferenceCounted {
|
|
||||||
public:
|
|
||||||
typedef std::function<void(const std::string&)> FileDropFunction;
|
|
||||||
void setFileDropFunction(FileDropFunction f);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
DragOperation onDragEnter(DragEventData data) override;
|
|
||||||
DragOperation onDragMove(DragEventData data) override;
|
|
||||||
void onDragLeave(DragEventData data) override;
|
|
||||||
bool onDrop(DragEventData data) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
static bool isFileDrop(IDataPackage* package);
|
|
||||||
|
|
||||||
private:
|
|
||||||
DragOperation op_ = DragOperation::None;
|
|
||||||
FileDropFunction dropFunction_;
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
|
||||||
class SValueMenu : public CParamDisplay {
|
|
||||||
public:
|
|
||||||
explicit SValueMenu(const CRect& bounds, IControlListener* listener, int32_t tag);
|
|
||||||
CColor getHoverColor() const { return hoverColor_; }
|
|
||||||
void setHoverColor(const CColor& color);
|
|
||||||
CMenuItem* addEntry(CMenuItem* item, float value, int32_t index = -1);
|
|
||||||
CMenuItem* addEntry(const UTF8String& title, float value, int32_t index = -1, int32_t itemFlags = CMenuItem::kNoFlags);
|
|
||||||
CMenuItem* addSeparator(int32_t index = -1);
|
|
||||||
int32_t getNbEntries() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void draw(CDrawContext* dc) override;
|
|
||||||
CMouseEventResult onMouseEntered(CPoint& where, const CButtonState& buttons) override;
|
|
||||||
CMouseEventResult onMouseExited(CPoint& where, const CButtonState& buttons) override;
|
|
||||||
CMouseEventResult onMouseDown(CPoint& where, const CButtonState& buttons) override;
|
|
||||||
bool onWheel(const CPoint& where, const CMouseWheelAxis& axis, const float& distance, const CButtonState& buttons) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CColor hoverColor_;
|
|
||||||
bool hovered_ = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
class MenuListener;
|
|
||||||
|
|
||||||
//
|
|
||||||
void onItemClicked(int32_t index);
|
|
||||||
|
|
||||||
//
|
|
||||||
CMenuItemList menuItems_;
|
|
||||||
std::vector<float> menuItemValues_;
|
|
||||||
SharedPointer<MenuListener> menuListener_;
|
|
||||||
|
|
||||||
//
|
|
||||||
class MenuListener : public IControlListener, public NonAtomicReferenceCounted {
|
|
||||||
public:
|
|
||||||
explicit MenuListener(SValueMenu& menu) : menu_(menu) {}
|
|
||||||
void valueChanged(CControl* control) override
|
|
||||||
{
|
|
||||||
menu_.onItemClicked(static_cast<int32_t>(control->getValue()));
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
SValueMenu& menu_;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
|
||||||
class SActionMenu : public CParamDisplay {
|
|
||||||
public:
|
|
||||||
explicit SActionMenu(const CRect& bounds, IControlListener* listener);
|
|
||||||
std::string getTitle() const { return title_; }
|
|
||||||
void setTitle(std::string title);
|
|
||||||
CColor getHoverColor() const { return hoverColor_; }
|
|
||||||
void setHoverColor(const CColor& color);
|
|
||||||
CMenuItem* addEntry(CMenuItem* item, int32_t tag, int32_t index = -1);
|
|
||||||
CMenuItem* addEntry(const UTF8String& title, int32_t tag, int32_t index = -1, int32_t itemFlags = CMenuItem::kNoFlags);
|
|
||||||
CMenuItem* addSeparator(int32_t index = -1);
|
|
||||||
int32_t getNbEntries() const;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void draw(CDrawContext* dc) override;
|
|
||||||
CMouseEventResult onMouseEntered(CPoint& where, const CButtonState& buttons) override;
|
|
||||||
CMouseEventResult onMouseExited(CPoint& where, const CButtonState& buttons) override;
|
|
||||||
CMouseEventResult onMouseDown(CPoint& where, const CButtonState& buttons) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string title_;
|
|
||||||
CColor hoverColor_;
|
|
||||||
bool hovered_ = false;
|
|
||||||
|
|
||||||
class MenuListener;
|
|
||||||
|
|
||||||
//
|
|
||||||
void onItemClicked(int32_t index);
|
|
||||||
|
|
||||||
//
|
|
||||||
CMenuItemList menuItems_;
|
|
||||||
std::vector<int32_t> menuItemTags_;
|
|
||||||
SharedPointer<MenuListener> menuListener_;
|
|
||||||
|
|
||||||
//
|
|
||||||
class MenuListener : public IControlListener, public NonAtomicReferenceCounted {
|
|
||||||
public:
|
|
||||||
explicit MenuListener(SActionMenu& menu) : menu_(menu) {}
|
|
||||||
void valueChanged(CControl* control) override
|
|
||||||
{
|
|
||||||
menu_.onItemClicked(static_cast<int32_t>(control->getValue()));
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
SActionMenu& menu_;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
|
||||||
class SHoverButton : public CKickButton {
|
|
||||||
public:
|
|
||||||
SHoverButton(
|
|
||||||
const CRect& size,
|
|
||||||
IControlListener* listener,
|
|
||||||
int32_t tag,
|
|
||||||
CBitmap* background,
|
|
||||||
const CPoint& offset = CPoint (0, 0))
|
|
||||||
: CKickButton(size, listener, tag, background, offset)
|
|
||||||
{}
|
|
||||||
|
|
||||||
CMouseEventResult onMouseEntered(CPoint&, const CButtonState&) override;
|
|
||||||
CMouseEventResult onMouseExited(CPoint&, const CButtonState&) override;
|
|
||||||
void draw(CDrawContext*) override;
|
|
||||||
|
|
||||||
std::function<void()> OnHoverEnter;
|
|
||||||
std::function<void()> OnHoverLeave;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool hovered_ { false };
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
|
||||||
class STextButton: public CTextButton {
|
|
||||||
public:
|
|
||||||
STextButton(const CRect& size, IControlListener* listener = nullptr, int32_t tag = -1, UTF8StringPtr title = nullptr)
|
|
||||||
: CTextButton(size, listener, tag, title) {}
|
|
||||||
|
|
||||||
CColor getHighlightColor() const { return highlightColor_; }
|
|
||||||
void setHighlightColor(const CColor& color);
|
|
||||||
CColor getInactiveColor() const { return inactiveColor_; }
|
|
||||||
void setInactiveColor(const CColor& color);
|
|
||||||
bool isInactive() const { return inactive_; }
|
|
||||||
void setInactive(bool b);
|
|
||||||
bool isHighlighted() const { return highlighted_; }
|
|
||||||
void setHighlighted(bool b);
|
|
||||||
CMouseEventResult onMouseEntered (CPoint& where, const CButtonState& buttons) override;
|
|
||||||
CMouseEventResult onMouseExited (CPoint& where, const CButtonState& buttons) override;
|
|
||||||
void draw(CDrawContext* context) override;
|
|
||||||
|
|
||||||
std::function<void()> OnHoverEnter;
|
|
||||||
std::function<void()> OnHoverLeave;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CColor highlightColor_;
|
|
||||||
bool hovered_ { false };
|
|
||||||
bool highlighted_ { false };
|
|
||||||
CColor inactiveColor_;
|
|
||||||
bool inactive_ { false };
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
|
||||||
class SStyledKnob : public CKnobBase {
|
|
||||||
public:
|
|
||||||
SStyledKnob(const CRect& size, IControlListener* listener, int32_t tag);
|
|
||||||
|
|
||||||
const CColor& getActiveTrackColor() const { return activeTrackColor_; }
|
|
||||||
void setActiveTrackColor(const CColor& color);
|
|
||||||
|
|
||||||
const CColor& getInactiveTrackColor() const { return inactiveTrackColor_; }
|
|
||||||
void setInactiveTrackColor(const CColor& color);
|
|
||||||
|
|
||||||
const CColor& getLineIndicatorColor() const { return lineIndicatorColor_; }
|
|
||||||
void setLineIndicatorColor(const CColor& color);
|
|
||||||
|
|
||||||
const CColor& getRotatorColor() const { return rotatorColor_; }
|
|
||||||
void setRotatorColor(const CColor& color);
|
|
||||||
|
|
||||||
void setFont(CFontRef font);
|
|
||||||
CFontRef getFont() const { return font_; }
|
|
||||||
|
|
||||||
void setFontColor(CColor fontColor);
|
|
||||||
CColor getFontColor() const { return fontColor_; }
|
|
||||||
|
|
||||||
using ValueToStringFunction = std::function<bool(float value, std::string& result)>;
|
|
||||||
void setValueToStringFunction(ValueToStringFunction func);
|
|
||||||
|
|
||||||
void setHideValue(bool hide) { hideValue_ = hide; invalid(); }
|
|
||||||
bool getHideValue() const { return hideValue_; }
|
|
||||||
|
|
||||||
CLASS_METHODS(SStyledKnob, CKnobBase)
|
|
||||||
protected:
|
|
||||||
void draw(CDrawContext* dc) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CColor activeTrackColor_;
|
|
||||||
CColor inactiveTrackColor_;
|
|
||||||
CColor lineIndicatorColor_;
|
|
||||||
CColor rotatorColor_ { gui::kColorTransparent };
|
|
||||||
bool hideValue_ { false };
|
|
||||||
|
|
||||||
SharedPointer<CFontDesc> font_ = kNormalFont;
|
|
||||||
CColor fontColor_ { 0x00, 0x00, 0x00 };
|
|
||||||
|
|
||||||
ValueToStringFunction valueToStringFunction_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CFilledRect : public CView
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit CFilledRect(const CRect& size)
|
|
||||||
: CView(size) {}
|
|
||||||
|
|
||||||
void setRadius(CCoord radius) { radius_ = radius; invalid(); }
|
|
||||||
CCoord getRadius() const { return radius_; }
|
|
||||||
|
|
||||||
void setColor(CColor color){ color_ = color; invalid(); }
|
|
||||||
CColor getColor() { return color_; }
|
|
||||||
protected:
|
|
||||||
void draw(CDrawContext* dc) override;
|
|
||||||
private:
|
|
||||||
CCoord radius_ { 5.0 };
|
|
||||||
CColor color_ { 0, 0, 0, 70 };
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
|
||||||
class SKnobCCBox : public CViewContainer, ViewListenerAdapter {
|
|
||||||
public:
|
|
||||||
SKnobCCBox(const CRect& size, IControlListener* listener, int32_t tag);
|
|
||||||
~SKnobCCBox();
|
|
||||||
void setHue(float hue);
|
|
||||||
|
|
||||||
float getValue() const { return knob_->getValue(); }
|
|
||||||
float getDefaultValue() const { return knob_->getDefaultValue(); }
|
|
||||||
void setValue(float value);
|
|
||||||
void setDefaultValue(float value);
|
|
||||||
|
|
||||||
void setNameLabelText(const UTF8String& name) { label_->setText(name); label_->invalid(); }
|
|
||||||
void setCCLabelText(const UTF8String& name) { ccLabel_->setText(name); ccLabel_->invalid(); }
|
|
||||||
|
|
||||||
void setNameLabelFont(CFontRef font);
|
|
||||||
CFontRef getNameLabelFont() const { return label_->getFont(); }
|
|
||||||
|
|
||||||
void setNameLabelFontColor(CColor color) { label_->setFontColor(color); label_->invalid(); }
|
|
||||||
CColor getNameLabelFontColor() const { return label_->getFontColor(); }
|
|
||||||
|
|
||||||
void setNameLabelBackColor(CColor color) { label_->setBackColor(color); label_->invalid(); }
|
|
||||||
CColor getNameLabelBackColor() const { return label_->getBackColor(); }
|
|
||||||
|
|
||||||
void setValueEditFont(CFontRef font);
|
|
||||||
CFontRef getValueEditFont() const { return label_->getFont(); }
|
|
||||||
|
|
||||||
void setValueEditFontColor(CColor color) { valueEdit_->setFontColor(color); valueEdit_->invalid(); }
|
|
||||||
CColor getValueEditFontColor() const { return valueEdit_->getFontColor(); }
|
|
||||||
|
|
||||||
void setValueEditBackColor(CColor color) { valueEdit_->setBackColor(color); valueEdit_->invalid(); }
|
|
||||||
CColor getValueEditBackColor() const { return valueEdit_->getBackColor(); }
|
|
||||||
|
|
||||||
void setShadingRectangleColor(CColor color) { shadingRectangle_->setColor(color); shadingRectangle_->invalid(); }
|
|
||||||
CColor getShadingRectangleColor() const { return shadingRectangle_->getColor(); }
|
|
||||||
|
|
||||||
void setCCLabelFont(CFontRef font);
|
|
||||||
CFontRef getCCLabelFont() const { return ccLabel_->getFont(); }
|
|
||||||
|
|
||||||
void setCCLabelFontColor(CColor color) { ccLabel_->setFontColor(color); ccLabel_->invalid(); }
|
|
||||||
CColor getCCLabelFontColor() const { return ccLabel_->getFontColor(); }
|
|
||||||
|
|
||||||
void setCCLabelBackColor(CColor color) { ccLabel_->setBackColor(color); ccLabel_->invalid(); }
|
|
||||||
CColor getCCLabelBackColor() const { return ccLabel_->getBackColor(); }
|
|
||||||
|
|
||||||
void setKnobActiveTrackColor(CColor color) { knob_->setActiveTrackColor(color); knob_->invalid(); }
|
|
||||||
CColor getKnobActiveTrackColor() const { return knob_->getActiveTrackColor(); }
|
|
||||||
|
|
||||||
void setKnobInactiveTrackColor(CColor color) { knob_->setInactiveTrackColor(color); knob_->invalid(); }
|
|
||||||
CColor getKnobInactiveTrackColor() const { return knob_->getInactiveTrackColor(); }
|
|
||||||
|
|
||||||
void setKnobLineIndicatorColor(CColor color) { knob_->setLineIndicatorColor(color); knob_->invalid(); }
|
|
||||||
CColor getKnobLineIndicatorColor() const { return knob_->getLineIndicatorColor(); }
|
|
||||||
|
|
||||||
void setKnobRotatorColor(CColor color) { knob_->setRotatorColor(color); knob_->invalid(); }
|
|
||||||
CColor getKnobRotatorColor() const { return knob_->getRotatorColor(); }
|
|
||||||
|
|
||||||
void setKnobFont(CFontRef font) { knob_->setFont(font); knob_->invalid(); }
|
|
||||||
CFontRef getKnobFont() const { return knob_->getFont(); }
|
|
||||||
|
|
||||||
void setKnobFontColor(CColor color) { knob_->setFontColor(color); knob_->invalid(); }
|
|
||||||
CColor getKnobFontColor() const { return knob_->getFontColor(); }
|
|
||||||
|
|
||||||
// Edit box listener
|
|
||||||
void viewLostFocus (CView* view) override;
|
|
||||||
|
|
||||||
bool isHD() const noexcept { return hdMode_; }
|
|
||||||
void setHDMode(bool mode);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
CMouseEventResult onMouseDown(CPoint& where, const CButtonState& buttons) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void updateViewSizes();
|
|
||||||
void updateViewColors();
|
|
||||||
SharedPointer<CTextLabel> label_;
|
|
||||||
SharedPointer<CTextEdit> valueEdit_;
|
|
||||||
SharedPointer<SStyledKnob> knob_;
|
|
||||||
SharedPointer<CTextLabel> ccLabel_;
|
|
||||||
SharedPointer<CFilledRect> shadingRectangle_;
|
|
||||||
SharedPointer<CMenuItem> menuEntry_;
|
|
||||||
CRect nameLabelSize_;
|
|
||||||
CRect knobSize_;
|
|
||||||
CRect shadingRectangleSize_;
|
|
||||||
CRect ccLabelSize_;
|
|
||||||
CRect valueEditSize_;
|
|
||||||
CRect rectangleSize_;
|
|
||||||
float hue_ = 0.35;
|
|
||||||
|
|
||||||
class MenuListener : public IControlListener, public NonAtomicReferenceCounted {
|
|
||||||
public:
|
|
||||||
explicit MenuListener(SKnobCCBox& box) : box_(box) {}
|
|
||||||
void valueChanged(CControl*) override
|
|
||||||
{
|
|
||||||
box_.setHDMode(!box_.isHD());
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
SKnobCCBox& box_;
|
|
||||||
};
|
|
||||||
SharedPointer<MenuListener> menuListener_;
|
|
||||||
bool hdMode_ { false };
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
|
||||||
class SControlsPanel : public CScrollView {
|
|
||||||
public:
|
|
||||||
explicit SControlsPanel(const CRect& size);
|
|
||||||
|
|
||||||
void setControlUsed(uint32_t index, bool used);
|
|
||||||
void setControlValue(uint32_t index, float value);
|
|
||||||
void setControlDefaultValue(uint32_t index, float value);
|
|
||||||
void setControlLabelText(uint32_t index, UTF8StringPtr text);
|
|
||||||
|
|
||||||
void setNameLabelFont(CFontRef font);
|
|
||||||
void setNameLabelFontColor(CColor color);
|
|
||||||
void setNameLabelBackColor(CColor color);
|
|
||||||
void setCCLabelFont(CFontRef font);
|
|
||||||
void setCCLabelBackColor(CColor color);
|
|
||||||
void setCCLabelFontColor(CColor color);
|
|
||||||
void setValueEditBackColor(CColor color);
|
|
||||||
void setValueEditFontColor(CColor color);
|
|
||||||
void setShadingRectangleColor(CColor color);
|
|
||||||
void setKnobActiveTrackColor(CColor color);
|
|
||||||
void setKnobInactiveTrackColor(CColor color);
|
|
||||||
void setKnobLineIndicatorColor(CColor color);
|
|
||||||
void setKnobRotatorColor(CColor color);
|
|
||||||
void setKnobFont(CFontRef font);
|
|
||||||
void setKnobFontColor(CColor color);
|
|
||||||
|
|
||||||
std::function<void(uint32_t, float)> ValueChangeFunction;
|
|
||||||
std::function<void(uint32_t)> BeginEditFunction;
|
|
||||||
std::function<void(uint32_t)> EndEditFunction;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void recalculateSubViews() override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void updateLayout();
|
|
||||||
void syncAllSlotStyles();
|
|
||||||
void syncSlotStyle(uint32_t index);
|
|
||||||
static std::string getDefaultLabelText(uint32_t index);
|
|
||||||
|
|
||||||
struct ControlSlot;
|
|
||||||
ControlSlot* getSlot(uint32_t index);
|
|
||||||
ControlSlot* getOrCreateSlot(uint32_t index);
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct ControlSlot {
|
|
||||||
bool used = false;
|
|
||||||
SharedPointer<SKnobCCBox> box;
|
|
||||||
};
|
|
||||||
|
|
||||||
class ControlSlotListener : public IControlListener {
|
|
||||||
public:
|
|
||||||
explicit ControlSlotListener(SControlsPanel* panel) : panel_(panel) {}
|
|
||||||
void valueChanged(CControl* pControl) override;
|
|
||||||
void controlBeginEdit(CControl* pControl) override;
|
|
||||||
void controlEndEdit(CControl* pControl) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
SControlsPanel* panel_ = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector<std::unique_ptr<ControlSlot>> slots_;
|
|
||||||
std::unique_ptr<ControlSlotListener> listener_;
|
|
||||||
SharedPointer<CVSTGUITimer> relayoutTrigger_;
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
|
||||||
class SLevelMeter : public CView {
|
|
||||||
public:
|
|
||||||
explicit SLevelMeter(const CRect& size);
|
|
||||||
|
|
||||||
float getValue() const { return value_; }
|
|
||||||
void setValue(float value);
|
|
||||||
|
|
||||||
float getDangerThreshold() const { return dangerThreshold_; }
|
|
||||||
void setDangerThreshold(float thres) { dangerThreshold_ = thres; invalid(); }
|
|
||||||
|
|
||||||
CColor getFrameColor() const { return frameColor_; }
|
|
||||||
void setFrameColor(CColor color) { frameColor_ = color; invalid(); }
|
|
||||||
CColor getBackColor() const { return backColor_; }
|
|
||||||
void setBackColor(CColor color) { backColor_ = color; invalid(); }
|
|
||||||
|
|
||||||
CColor getNormalFillColor() const { return safeFillColor_; }
|
|
||||||
void setNormalFillColor(CColor color) { safeFillColor_ = color; invalid(); }
|
|
||||||
CColor getDangerFillColor() const { return dangerFillColor_; }
|
|
||||||
void setDangerFillColor(CColor color) { dangerFillColor_ = color; invalid(); }
|
|
||||||
|
|
||||||
CCoord getRoundRectRadius() const { return radius_; }
|
|
||||||
void setRoundRectRadius(CCoord radius) { radius_ = radius; invalid(); }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void draw(CDrawContext* dc) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
float value_ = 0;
|
|
||||||
float dangerThreshold_ = 0.5;
|
|
||||||
float dbMin_ = -40;
|
|
||||||
float dbMax_ = 0;
|
|
||||||
CColor frameColor_;
|
|
||||||
CColor safeFillColor_;
|
|
||||||
CColor dangerFillColor_;
|
|
||||||
CColor backColor_;
|
|
||||||
CCoord radius_ = 5.0;
|
|
||||||
SharedPointer<CVSTGUITimer> timer_;
|
|
||||||
bool timerArmed_ = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
|
||||||
class SPlaceHolder : public CView {
|
|
||||||
public:
|
|
||||||
explicit SPlaceHolder(const CRect& size, const CColor& color = {0xff, 0x00, 0x00, 0xff});
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void draw(CDrawContext* dc) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CColor color_;
|
|
||||||
};
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "GUIDefs.h"
|
|
||||||
|
|
||||||
#include "utility/vstgui_before.h"
|
|
||||||
#include "vstgui/lib/ccolor.h"
|
|
||||||
#include "utility/vstgui_after.h"
|
|
||||||
|
|
||||||
namespace gui {
|
|
||||||
|
|
||||||
const CColor kColorTransparent { CColor(0x00, 0x00, 0x00, 0x00) };
|
|
||||||
const CColor kColorTransparentDark { CColor(0x00, 0x00, 0x00, 0xc0) };
|
|
||||||
|
|
||||||
const CColor kColorOrange { CColor(0xfd, 0x98, 0x00, 0xff) };
|
|
||||||
|
|
||||||
const CColor kColorControlsScrollerTransparency { CColor(0x00, 0x00, 0x00, 0x80) };
|
|
||||||
const CColor kColorControlsTransparency { CColor(0x00, 0x00, 0x00, 0x80) };
|
|
||||||
const CColor kColorInfoTransparency { CColor(0x00, 0x00, 0x00, 0x99) };
|
|
||||||
const CColor kColorMeterDanger { CColor(0xaa, 0x00, 0x00) };
|
|
||||||
const CColor kColorMeterNormal { CColor(0x00, 0xaa, 0x11) };
|
|
||||||
const CColor kColorTooltipBackground { CColor(0xff, 0xff, 0xd2, 0xff) };
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "utility/vstgui_before.h"
|
|
||||||
#include "vstgui/lib/vstguifwd.h"
|
|
||||||
#include "utility/vstgui_after.h"
|
|
||||||
|
|
||||||
using VSTGUI::CColor;
|
|
||||||
|
|
||||||
namespace gui {
|
|
||||||
|
|
||||||
extern const CColor kColorTransparent;
|
|
||||||
extern const CColor kColorTransparentDark;
|
|
||||||
|
|
||||||
extern const CColor kColorOrange;
|
|
||||||
|
|
||||||
extern const CColor kColorControlsScrollerTransparency;
|
|
||||||
extern const CColor kColorControlsTransparency;
|
|
||||||
extern const CColor kColorInfoTransparency;
|
|
||||||
extern const CColor kColorMeterDanger;
|
|
||||||
extern const CColor kColorMeterNormal;
|
|
||||||
extern const CColor kColorTooltipBackground;
|
|
||||||
}
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "GUIHelpers.h"
|
|
||||||
#define VSTGUI_MORE_THAN_4_10 ((VSTGUI_VERSION_MAJOR > 4) || (VSTGUI_VERSION_MAJOR == 4 && VSTGUI_VERSION_MINOR > 10))
|
|
||||||
#if VSTGUI_MORE_THAN_4_10
|
|
||||||
#include "utility/vstgui_before.h"
|
|
||||||
#include <vstgui/lib/events.h>
|
|
||||||
#include "utility/vstgui_after.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class SFrameDisabler::KeyAndMouseHook : public CBaseObject,
|
|
||||||
public IKeyboardHook,
|
|
||||||
public IMouseObserver {
|
|
||||||
public:
|
|
||||||
void setEnabled(bool value) { enabled_ = value; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void onMouseEntered(CView*, CFrame*) override {}
|
|
||||||
void onMouseExited(CView*, CFrame*) override {}
|
|
||||||
#if VSTGUI_MORE_THAN_4_10
|
|
||||||
void onKeyboardEvent(KeyboardEvent& event, CFrame* frame) override;
|
|
||||||
void onMouseEvent(MouseEvent& event, CFrame* frame) override;
|
|
||||||
#else
|
|
||||||
int32_t onKeyDown(const VstKeyCode&, CFrame*) override { return enabled_ ? -1 : 1; }
|
|
||||||
int32_t onKeyUp(const VstKeyCode&, CFrame*) override { return enabled_ ? -1 : 1; }
|
|
||||||
CMouseEventResult onMouseMoved(CFrame*, const CPoint&, const CButtonState&) override { return enabled_ ? kMouseEventNotHandled : kMouseEventHandled; }
|
|
||||||
CMouseEventResult onMouseDown(CFrame*, const CPoint&, const CButtonState&) override { return enabled_ ? kMouseEventNotHandled : kMouseEventHandled; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool enabled_ = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
SFrameDisabler::SFrameDisabler(CFrame* frame)
|
|
||||||
: frame_(frame), hook_(makeOwned<KeyAndMouseHook>())
|
|
||||||
{
|
|
||||||
frame->registerKeyboardHook(hook_);
|
|
||||||
frame->registerMouseObserver(hook_);
|
|
||||||
|
|
||||||
delayedEnabler_ = makeOwned<CVSTGUITimer>(
|
|
||||||
[this](CVSTGUITimer* t) { hook_->setEnabled(true); t->stop(); },
|
|
||||||
1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
SFrameDisabler::~SFrameDisabler()
|
|
||||||
{
|
|
||||||
frame_->unregisterKeyboardHook(hook_);
|
|
||||||
frame_->unregisterMouseObserver(hook_);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SFrameDisabler::enable()
|
|
||||||
{
|
|
||||||
delayedEnabler_->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SFrameDisabler::disable()
|
|
||||||
{
|
|
||||||
hook_->setEnabled(false);
|
|
||||||
delayedEnabler_->stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if VSTGUI_MORE_THAN_4_10
|
|
||||||
void SFrameDisabler::KeyAndMouseHook::onKeyboardEvent(KeyboardEvent& event, CFrame*)
|
|
||||||
{
|
|
||||||
if (!enabled_)
|
|
||||||
event.consumed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SFrameDisabler::KeyAndMouseHook::onMouseEvent(MouseEvent& event, CFrame*)
|
|
||||||
{
|
|
||||||
if (!enabled_)
|
|
||||||
event.consumed = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "utility/vstgui_before.h"
|
|
||||||
#include <vstgui/lib/cframe.h>
|
|
||||||
#include <vstgui/lib/cvstguitimer.h>
|
|
||||||
#include "utility/vstgui_after.h"
|
|
||||||
|
|
||||||
using namespace VSTGUI;
|
|
||||||
|
|
||||||
class SFrameDisabler : public CBaseObject {
|
|
||||||
public:
|
|
||||||
explicit SFrameDisabler(CFrame* frame);
|
|
||||||
~SFrameDisabler();
|
|
||||||
|
|
||||||
void enable();
|
|
||||||
void disable();
|
|
||||||
|
|
||||||
private:
|
|
||||||
class KeyAndMouseHook;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CFrame* frame_ = nullptr;
|
|
||||||
SharedPointer<KeyAndMouseHook> hook_;
|
|
||||||
SharedPointer<CVSTGUITimer> delayedEnabler_;
|
|
||||||
};
|
|
||||||
|
|
@ -1,403 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "GUIPiano.h"
|
|
||||||
#include "ColorHelpers.h"
|
|
||||||
#include "utility/vstgui_before.h"
|
|
||||||
#include "vstgui/lib/cdrawcontext.h"
|
|
||||||
#include "vstgui/lib/cgraphicspath.h"
|
|
||||||
#include "utility/vstgui_after.h"
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
static constexpr CCoord keyoffs[12] = {0, 0.6, 1, 1.8, 2, 3,
|
|
||||||
3.55, 4, 4.7, 5, 5.85, 6};
|
|
||||||
static constexpr bool black[12] = {0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0};
|
|
||||||
|
|
||||||
struct SPiano::Impl {
|
|
||||||
unsigned octs_ {};
|
|
||||||
std::unique_ptr<float[]> keyval_ { new float[128]{} };
|
|
||||||
std::bitset<128> keyUsed_;
|
|
||||||
std::bitset<128> keyswitchUsed_;
|
|
||||||
unsigned mousePressedKey_ = ~0u;
|
|
||||||
|
|
||||||
CCoord innerPaddingX_ = 4.0;
|
|
||||||
CCoord innerPaddingY_ = 4.0;
|
|
||||||
CCoord spacingY_ = 4.0;
|
|
||||||
|
|
||||||
CColor backgroundFill_ { 0xca, 0xca, 0xca, 0xff };
|
|
||||||
#if 0
|
|
||||||
float backgroundRadius_ = 5.0;
|
|
||||||
#endif
|
|
||||||
float keyUsedHue_ = 0.55;
|
|
||||||
float keySwitchHue_ = 0.0;
|
|
||||||
float whiteKeyChroma_ = 0.9;
|
|
||||||
float blackKeyChroma_ = 0.75;
|
|
||||||
float whiteKeyLuma_ = 0.9;
|
|
||||||
float blackKeyLuma_ = 0.35;
|
|
||||||
float keyLumaPressDelta_ = 0.2;
|
|
||||||
|
|
||||||
CColor outline_ { 0x00, 0x00, 0x00, 0xff };
|
|
||||||
CColor shadeOutline_ { 0x80, 0x80, 0x80, 0xff };
|
|
||||||
CColor labelStroke_ { 0x63, 0x63, 0x63, 0xff };
|
|
||||||
|
|
||||||
mutable Dimensions dim_;
|
|
||||||
SharedPointer<CFontDesc> font_;
|
|
||||||
};
|
|
||||||
|
|
||||||
SPiano::SPiano(CRect bounds)
|
|
||||||
: CView(bounds), impl_(new Impl)
|
|
||||||
{
|
|
||||||
setNumOctaves(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
CFontRef SPiano::getFont() const
|
|
||||||
{
|
|
||||||
const Impl& impl = *impl_;
|
|
||||||
return impl.font_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPiano::setFont(CFontRef font)
|
|
||||||
{
|
|
||||||
Impl& impl = *impl_;
|
|
||||||
impl.font_ = font;
|
|
||||||
getDimensions(true);
|
|
||||||
invalid();
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned SPiano::getNumOctaves() const
|
|
||||||
{
|
|
||||||
const Impl& impl = *impl_;
|
|
||||||
return impl.octs_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPiano::setNumOctaves(unsigned octs)
|
|
||||||
{
|
|
||||||
Impl& impl = *impl_;
|
|
||||||
impl.octs_ = std::max(1u, octs);
|
|
||||||
getDimensions(true);
|
|
||||||
invalid();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPiano::setKeyUsed(unsigned key, bool used)
|
|
||||||
{
|
|
||||||
Impl& impl = *impl_;
|
|
||||||
|
|
||||||
if (key >= 128)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (impl.keyUsed_.test(key) == used)
|
|
||||||
return;
|
|
||||||
|
|
||||||
impl.keyUsed_.set(key, used);
|
|
||||||
invalid();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPiano::setKeyswitchUsed(unsigned key, bool used)
|
|
||||||
{
|
|
||||||
Impl& impl = *impl_;
|
|
||||||
|
|
||||||
if (key >= 128)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (impl.keyswitchUsed_.test(key) == used)
|
|
||||||
return;
|
|
||||||
|
|
||||||
impl.keyswitchUsed_.set(key, used);
|
|
||||||
invalid();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPiano::setKeyValue(unsigned key, float value)
|
|
||||||
{
|
|
||||||
Impl& impl = *impl_;
|
|
||||||
|
|
||||||
if (key >= 128)
|
|
||||||
return;
|
|
||||||
|
|
||||||
value = std::max(0.0f, std::min(1.0f, value));
|
|
||||||
|
|
||||||
if (impl.keyval_[key] == value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
impl.keyval_[key] = value;
|
|
||||||
invalid();
|
|
||||||
}
|
|
||||||
|
|
||||||
SPiano::KeyRole SPiano::getKeyRole(unsigned key)
|
|
||||||
{
|
|
||||||
Impl& impl = *impl_;
|
|
||||||
KeyRole role = KeyRole::Unused;
|
|
||||||
|
|
||||||
if (key < 128) {
|
|
||||||
if (impl.keyswitchUsed_.test(key))
|
|
||||||
role = KeyRole::Switch;
|
|
||||||
else if (impl.keyUsed_.test(key))
|
|
||||||
role = KeyRole::Note;
|
|
||||||
}
|
|
||||||
|
|
||||||
return role;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPiano::setBackColor(const CColor &color)
|
|
||||||
{
|
|
||||||
Impl& impl = *impl_;
|
|
||||||
if (impl.backgroundFill_ != color) {
|
|
||||||
impl.backgroundFill_ = color;
|
|
||||||
invalid();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPiano::setFontColor(const CColor &color)
|
|
||||||
{
|
|
||||||
Impl& impl = *impl_;
|
|
||||||
if (impl.labelStroke_ != color) {
|
|
||||||
impl.labelStroke_ = color;
|
|
||||||
invalid();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SPiano::draw(CDrawContext* dc)
|
|
||||||
{
|
|
||||||
Impl& impl = *impl_;
|
|
||||||
const Dimensions dim = getDimensions(false);
|
|
||||||
const unsigned octs = impl.octs_;
|
|
||||||
const unsigned keyCount = octs * 12;
|
|
||||||
|
|
||||||
dc->setDrawMode(kAntiAliasing);
|
|
||||||
|
|
||||||
if (impl.backgroundFill_.alpha > 0) {
|
|
||||||
SharedPointer<CGraphicsPath> path;
|
|
||||||
path = owned(dc->createGraphicsPath());
|
|
||||||
#if 0
|
|
||||||
path->addRoundRect(dim.bounds, impl.backgroundRadius_);
|
|
||||||
#endif
|
|
||||||
dc->setFillColor(impl.backgroundFill_);
|
|
||||||
dc->drawGraphicsPath(path, CDrawContext::kPathFilled);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned key = 0; key < keyCount; ++key) {
|
|
||||||
if (!black[key % 12]) {
|
|
||||||
CRect rect = keyRect(key);
|
|
||||||
|
|
||||||
SColorHCY hcy(0.0, impl.whiteKeyChroma_, impl.whiteKeyLuma_);
|
|
||||||
|
|
||||||
switch (getKeyRole(key)) {
|
|
||||||
case KeyRole::Note:
|
|
||||||
hcy.h = impl.keyUsedHue_;
|
|
||||||
break;
|
|
||||||
case KeyRole::Switch:
|
|
||||||
hcy.h = impl.keySwitchHue_;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
hcy.y = 1.0;
|
|
||||||
if (impl.keyval_[key])
|
|
||||||
hcy.c = 0.0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (impl.keyval_[key])
|
|
||||||
hcy.y = std::max(0.0f, hcy.y - impl.keyLumaPressDelta_);
|
|
||||||
|
|
||||||
CColor keycolor = hcy.toColor();
|
|
||||||
dc->setFillColor(keycolor);
|
|
||||||
dc->drawRect(rect, kDrawFilled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dc->setFrameColor(impl.outline_);
|
|
||||||
dc->drawLine(dim.keyBounds.getTopLeft(), dim.keyBounds.getBottomLeft());
|
|
||||||
for (unsigned key = 0; key < keyCount; ++key) {
|
|
||||||
if (!black[key % 12]) {
|
|
||||||
CRect rect = keyRect(key);
|
|
||||||
dc->drawLine(rect.getTopRight(), rect.getBottomRight());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned key = 0; key < keyCount; ++key) {
|
|
||||||
if (black[key % 12]) {
|
|
||||||
CRect rect = keyRect(key);
|
|
||||||
|
|
||||||
SColorHCY hcy(0.0, impl.blackKeyChroma_, impl.blackKeyLuma_);
|
|
||||||
|
|
||||||
switch (getKeyRole(key)) {
|
|
||||||
case KeyRole::Note:
|
|
||||||
hcy.h = impl.keyUsedHue_;
|
|
||||||
break;
|
|
||||||
case KeyRole::Switch:
|
|
||||||
hcy.h = impl.keySwitchHue_;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
hcy.c = 0.0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (impl.keyval_[key])
|
|
||||||
hcy.y = std::min(1.0f, hcy.y + impl.keyLumaPressDelta_);
|
|
||||||
|
|
||||||
CColor keycolor = hcy.toColor();
|
|
||||||
dc->setFillColor(keycolor);
|
|
||||||
dc->drawRect(rect, kDrawFilled);
|
|
||||||
dc->setFrameColor(impl.outline_);
|
|
||||||
dc->drawRect(rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (const CFontRef& font = impl.font_) {
|
|
||||||
for (unsigned o = 0; o < octs; ++o) {
|
|
||||||
CRect rect = keyRect(o * 12);
|
|
||||||
CRect textRect(
|
|
||||||
rect.left, dim.labelBounds.top,
|
|
||||||
rect.right, dim.labelBounds.bottom);
|
|
||||||
dc->setFont(font);
|
|
||||||
dc->setFontColor(impl.labelStroke_);
|
|
||||||
std::string text = std::to_string(static_cast<int>(o) - 1);
|
|
||||||
dc->drawString(text.c_str(), textRect, kCenterText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
dc->setFrameColor(impl.outline_);
|
|
||||||
dc->drawLine(dim.keyBounds.getTopLeft(), dim.keyBounds.getTopRight());
|
|
||||||
dc->setFrameColor(impl.shadeOutline_);
|
|
||||||
dc->drawLine(dim.keyBounds.getBottomLeft(), dim.keyBounds.getBottomRight());
|
|
||||||
}
|
|
||||||
|
|
||||||
dc->setFrameColor(impl.outline_);
|
|
||||||
}
|
|
||||||
|
|
||||||
CMouseEventResult SPiano::onMouseDown(CPoint& where, const CButtonState& buttons)
|
|
||||||
{
|
|
||||||
Impl& impl = *impl_;
|
|
||||||
unsigned key = keyAtPos(where);
|
|
||||||
if (key != ~0u) {
|
|
||||||
impl.keyval_[key] = 1;
|
|
||||||
impl.mousePressedKey_ = key;
|
|
||||||
if (onKeyPressed)
|
|
||||||
onKeyPressed(key, mousePressVelocity(key, where.y));
|
|
||||||
invalid();
|
|
||||||
return kMouseEventHandled;
|
|
||||||
}
|
|
||||||
return CView::onMouseDown(where, buttons);
|
|
||||||
}
|
|
||||||
|
|
||||||
CMouseEventResult SPiano::onMouseUp(CPoint& where, const CButtonState& buttons)
|
|
||||||
{
|
|
||||||
Impl& impl = *impl_;
|
|
||||||
unsigned key = impl.mousePressedKey_;
|
|
||||||
if (key != ~0u) {
|
|
||||||
impl.keyval_[key] = 0;
|
|
||||||
if (onKeyReleased)
|
|
||||||
onKeyReleased(key, mousePressVelocity(key, where.y));
|
|
||||||
impl.mousePressedKey_ = ~0u;
|
|
||||||
invalid();
|
|
||||||
return kMouseEventHandled;
|
|
||||||
}
|
|
||||||
return CView::onMouseUp(where, buttons);
|
|
||||||
}
|
|
||||||
|
|
||||||
CMouseEventResult SPiano::onMouseMoved(CPoint& where, const CButtonState& buttons)
|
|
||||||
{
|
|
||||||
Impl& impl = *impl_;
|
|
||||||
if (impl.mousePressedKey_ != ~0u) {
|
|
||||||
unsigned key = keyAtPos(where);
|
|
||||||
if (impl.mousePressedKey_ != key) {
|
|
||||||
impl.keyval_[impl.mousePressedKey_] = 0;
|
|
||||||
if (onKeyReleased)
|
|
||||||
onKeyReleased(impl.mousePressedKey_, mousePressVelocity(key, where.y));
|
|
||||||
// mousePressedKey_ = ~0u;
|
|
||||||
if (key != ~0u) {
|
|
||||||
impl.keyval_[key] = 1;
|
|
||||||
impl.mousePressedKey_ = key;
|
|
||||||
if (onKeyPressed)
|
|
||||||
onKeyPressed(key, mousePressVelocity(key, where.y));
|
|
||||||
}
|
|
||||||
invalid();
|
|
||||||
}
|
|
||||||
return kMouseEventHandled;
|
|
||||||
}
|
|
||||||
return CView::onMouseMoved(where, buttons);
|
|
||||||
}
|
|
||||||
|
|
||||||
const SPiano::Dimensions& SPiano::getDimensions(bool forceUpdate) const
|
|
||||||
{
|
|
||||||
const Impl& impl = *impl_;
|
|
||||||
|
|
||||||
if (!forceUpdate && impl.dim_.bounds == getViewSize())
|
|
||||||
return impl.dim_;
|
|
||||||
|
|
||||||
Dimensions dim;
|
|
||||||
dim.bounds = getViewSize();
|
|
||||||
dim.paddedBounds = CRect(dim.bounds)
|
|
||||||
.extend(-2 * impl.innerPaddingX_, -2 * impl.innerPaddingY_);
|
|
||||||
CCoord keyHeight = std::floor(dim.paddedBounds.getHeight());
|
|
||||||
CCoord fontHeight = impl.font_ ? impl.font_->getSize() : 0.0;
|
|
||||||
keyHeight -= impl.spacingY_ + fontHeight;
|
|
||||||
dim.keyBounds = CRect(dim.paddedBounds)
|
|
||||||
.setHeight(keyHeight);
|
|
||||||
dim.keyWidth = static_cast<unsigned>(
|
|
||||||
dim.paddedBounds.getWidth() / impl.octs_ / 7.0);
|
|
||||||
dim.keyBounds.setWidth(dim.keyWidth * impl.octs_ * 7.0);
|
|
||||||
dim.keyBounds.offset(
|
|
||||||
std::floor(0.5 * (dim.paddedBounds.getWidth() - dim.keyBounds.getWidth())), 0.0);
|
|
||||||
|
|
||||||
if (!impl.font_)
|
|
||||||
dim.labelBounds = CRect();
|
|
||||||
else
|
|
||||||
dim.labelBounds = CRect(
|
|
||||||
dim.keyBounds.left, dim.keyBounds.bottom + impl.spacingY_,
|
|
||||||
dim.keyBounds.right, dim.keyBounds.bottom + impl.spacingY_ + fontHeight);
|
|
||||||
|
|
||||||
impl.dim_ = dim;
|
|
||||||
return impl.dim_;
|
|
||||||
}
|
|
||||||
|
|
||||||
CRect SPiano::keyRect(const Dimensions& dim, unsigned key)
|
|
||||||
{
|
|
||||||
unsigned oct = key / 12;
|
|
||||||
unsigned note = key % 12;
|
|
||||||
unsigned keyw = dim.keyWidth;
|
|
||||||
unsigned keyh = static_cast<unsigned>(dim.keyBounds.getHeight());
|
|
||||||
CCoord octwidth = (keyoffs[11] + 1.0) * keyw;
|
|
||||||
CCoord octx = octwidth * oct;
|
|
||||||
CCoord notex = octx + keyoffs[note] * keyw;
|
|
||||||
CCoord notew = black[note] ? (0.6 * keyw) : keyw;
|
|
||||||
CCoord noteh = black[note] ? (0.6 * keyh) : keyh;
|
|
||||||
return CRect(notex, 0.0, notex + notew, noteh).offset(dim.keyBounds.getTopLeft());
|
|
||||||
}
|
|
||||||
|
|
||||||
CRect SPiano::keyRect(unsigned key) const
|
|
||||||
{
|
|
||||||
return keyRect(getDimensions(false), key);
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned SPiano::keyAtPos(CPoint pos) const
|
|
||||||
{
|
|
||||||
const Impl& impl = *impl_;
|
|
||||||
const unsigned octs = impl.octs_;
|
|
||||||
|
|
||||||
for (unsigned key = 0; key < octs * 12; ++key) {
|
|
||||||
if (black[key % 12]) {
|
|
||||||
if (keyRect(key).pointInside(pos))
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned key = 0; key < octs * 12; ++key) {
|
|
||||||
if (!black[key % 12]) {
|
|
||||||
if (keyRect(key).pointInside(pos))
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ~0u;
|
|
||||||
}
|
|
||||||
|
|
||||||
float SPiano::mousePressVelocity(unsigned key, CCoord posY)
|
|
||||||
{
|
|
||||||
const CRect rect = keyRect(key);
|
|
||||||
CCoord value = (posY - rect.top) / rect.getHeight();
|
|
||||||
return std::max(0.0f, std::min(1.0f, static_cast<float>(value)));
|
|
||||||
}
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "utility/vstgui_before.h"
|
|
||||||
#include "vstgui/lib/cview.h"
|
|
||||||
#include "vstgui/lib/ccolor.h"
|
|
||||||
#include "utility/vstgui_after.h"
|
|
||||||
#include <functional>
|
|
||||||
#include <vector>
|
|
||||||
#include <bitset>
|
|
||||||
|
|
||||||
using namespace VSTGUI;
|
|
||||||
|
|
||||||
class SPiano : public CView {
|
|
||||||
public:
|
|
||||||
explicit SPiano(CRect bounds);
|
|
||||||
|
|
||||||
CFontRef getFont() const;
|
|
||||||
void setFont(CFontRef font);
|
|
||||||
|
|
||||||
unsigned getNumOctaves() const;
|
|
||||||
void setNumOctaves(unsigned octs);
|
|
||||||
|
|
||||||
void setKeyUsed(unsigned key, bool used);
|
|
||||||
void setKeyswitchUsed(unsigned key, bool used);
|
|
||||||
void setKeyValue(unsigned key, float value);
|
|
||||||
|
|
||||||
enum class KeyRole : int {
|
|
||||||
Unused = 0,
|
|
||||||
Note = 1 << 0,
|
|
||||||
Switch = 1 << 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
KeyRole getKeyRole(unsigned key);
|
|
||||||
|
|
||||||
std::function<void(unsigned, float)> onKeyPressed;
|
|
||||||
std::function<void(unsigned, float)> onKeyReleased;
|
|
||||||
|
|
||||||
void setBackColor(const CColor&);
|
|
||||||
void setFontColor(const CColor&);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void draw(CDrawContext* dc) override;
|
|
||||||
CMouseEventResult onMouseDown(CPoint& where, const CButtonState& buttons) override;
|
|
||||||
CMouseEventResult onMouseUp(CPoint& where, const CButtonState& buttons) override;
|
|
||||||
CMouseEventResult onMouseMoved(CPoint& where, const CButtonState& buttons) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct Dimensions {
|
|
||||||
CRect bounds {};
|
|
||||||
CRect paddedBounds {};
|
|
||||||
CRect keyBounds {};
|
|
||||||
unsigned keyWidth {};
|
|
||||||
CRect labelBounds {};
|
|
||||||
};
|
|
||||||
const Dimensions& getDimensions(bool forceUpdate) const;
|
|
||||||
|
|
||||||
static CRect keyRect(const Dimensions& dim, unsigned key);
|
|
||||||
CRect keyRect(unsigned key) const;
|
|
||||||
unsigned keyAtPos(CPoint pos) const;
|
|
||||||
|
|
||||||
float mousePressVelocity(unsigned key, CCoord posY);
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct Impl;
|
|
||||||
std::unique_ptr<Impl> impl_;
|
|
||||||
};
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#include "ImageHelpers.h"
|
|
||||||
#include "EditorLibs.h"
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
using namespace VSTGUI;
|
|
||||||
|
|
||||||
struct stbi_image_delete {
|
|
||||||
void operator()(unsigned char* x) const noexcept { stbi_image_free(x); }
|
|
||||||
};
|
|
||||||
using stbi_image_u = std::unique_ptr<unsigned char[], stbi_image_delete>;
|
|
||||||
|
|
||||||
SharedPointer<CBitmap> loadAnyFormatImage(const fs::path& filePath)
|
|
||||||
{
|
|
||||||
stbi_image_u image;
|
|
||||||
int width, height, channels;
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
FILE* file { _wfopen(filePath.wstring().c_str(), L"rb") };
|
|
||||||
#else
|
|
||||||
FILE* file { fopen(filePath.c_str(), "rb") };
|
|
||||||
#endif
|
|
||||||
if (file) {
|
|
||||||
image.reset(stbi_load_from_file(file, &width, &height, &channels, STBI_rgb_alpha));
|
|
||||||
fclose(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!image)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
SharedPointer<CBitmap> bitmap = makeOwned<CBitmap>(width, height);
|
|
||||||
SharedPointer<CBitmapPixelAccess> accessor =
|
|
||||||
owned(CBitmapPixelAccess::create(bitmap.get()));
|
|
||||||
|
|
||||||
if (!accessor)
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
const unsigned char* pixel = image.get();
|
|
||||||
do {
|
|
||||||
uint8_t r = pixel[0];
|
|
||||||
uint8_t g = pixel[1];
|
|
||||||
uint8_t b = pixel[2];
|
|
||||||
uint8_t a = pixel[3];
|
|
||||||
|
|
||||||
// premultiply alpha
|
|
||||||
r = uint8_t((r * a) / 255);
|
|
||||||
g = uint8_t((g * a) / 255);
|
|
||||||
b = uint8_t((b * a) / 255);
|
|
||||||
|
|
||||||
accessor->setColor(CColor(r, g, b, a));
|
|
||||||
pixel += 4;
|
|
||||||
} while (++*accessor);
|
|
||||||
accessor = nullptr;
|
|
||||||
|
|
||||||
return bitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
void downscaleToWidthAndHeight(CBitmap* bitmap, CPoint frameSize)
|
|
||||||
{
|
|
||||||
if (!bitmap)
|
|
||||||
return;
|
|
||||||
|
|
||||||
PlatformBitmapPtr platformBitmap = bitmap->getPlatformBitmap();
|
|
||||||
if (!platformBitmap)
|
|
||||||
return;
|
|
||||||
|
|
||||||
CPoint bitmapSize = platformBitmap->getSize();
|
|
||||||
|
|
||||||
CCoord frameW = frameSize.x;
|
|
||||||
CCoord frameH = frameSize.y;
|
|
||||||
CCoord bitmapW = bitmapSize.x;
|
|
||||||
CCoord bitmapH = bitmapSize.y;
|
|
||||||
|
|
||||||
CCoord scale = 1.0;
|
|
||||||
if (bitmapW > frameW || bitmapH > frameH) {
|
|
||||||
CCoord xScale = bitmapW / frameW;
|
|
||||||
CCoord yScale = bitmapH / frameH;
|
|
||||||
scale = (xScale > yScale) ? xScale : yScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
platformBitmap->setScaleFactor(scale);
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
|
|
||||||
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
||||||
// license. You should have receive a LICENSE.md file along with the code.
|
|
||||||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <ghc/fs_std.hpp>
|
|
||||||
|
|
||||||
#include "utility/vstgui_before.h"
|
|
||||||
#include "vstgui/vstgui.h"
|
|
||||||
#include "utility/vstgui_after.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Loads a bitmap from an image file, with a large support of formats
|
|
||||||
* through the stb_image library.
|
|
||||||
*/
|
|
||||||
VSTGUI::SharedPointer<VSTGUI::CBitmap> loadAnyFormatImage(const fs::path& filePath);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Adjust the scale factor of this bitmap, such that both its dimensions
|
|
||||||
* fit into a frame of the given size.
|
|
||||||
*/
|
|
||||||
void downscaleToWidthAndHeight(VSTGUI::CBitmap* bitmap, VSTGUI::CPoint frameSize);
|
|
||||||