diff --git a/.gitattributes b/.gitattributes index 9dc5a4c00..87108da92 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,23 +1,5 @@ .* 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/tests/** export-ignore /external/filesystem/test/** export-ignore diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f0a3e3312..660ecb4c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,6 @@ on: - 'master' tags: - '[0-9]*' - - 'v[0-9]*' pull_request: branches: - '*' @@ -47,18 +46,7 @@ jobs: sudo apt-get update && \ sudo apt-get install \ ninja-build \ - 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 + libjack-jackd2-dev - name: Create Build Environment shell: bash working-directory: ${{runner.workspace}} @@ -70,13 +58,9 @@ jobs: cmake "$GITHUB_WORKSPACE" -G Ninja \ -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ -DSFIZZ_JACK=ON \ - -DSFIZZ_VST=ON \ - -DSFIZZ_LV2_UI=ON \ - -DSFIZZ_PUREDATA=ON \ -DSFIZZ_TESTS=ON \ -DSFIZZ_SHARED=OFF \ -DSFIZZ_STATIC_DEPENDENCIES=OFF \ - -DSFIZZ_LV2=ON \ -DCMAKE_CXX_STANDARD=17 - name: Build tests shell: bash @@ -130,14 +114,10 @@ jobs: cmake "$GITHUB_WORKSPACE" -G Ninja \ -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ -DSFIZZ_JACK=OFF \ - -DSFIZZ_VST=OFF \ - -DSFIZZ_LV2_UI=OFF \ - -DSFIZZ_PUREDATA=OFF \ -DSFIZZ_USE_SNDFILE=ON \ -DSFIZZ_TESTS=ON \ -DSFIZZ_SHARED=OFF \ - -DSFIZZ_STATIC_DEPENDENCIES=OFF \ - -DSFIZZ_LV2=OFF + -DSFIZZ_STATIC_DEPENDENCIES=OFF - name: Build tests shell: bash working-directory: ${{runner.workspace}}/build @@ -166,10 +146,6 @@ jobs: run: | cmake "$GITHUB_WORKSPACE" \ -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ - -DSFIZZ_AU=ON \ - -DSFIZZ_LV2=ON \ - -DSFIZZ_LV2_UI=ON \ - -DSFIZZ_VST=ON \ -DSFIZZ_JACK=OFF \ -DSFIZZ_TESTS=ON \ -DSFIZZ_SHARED=OFF \ @@ -185,71 +161,23 @@ jobs: # Reenable with newer cmakes # working-directory: ${{runner.workspace}}/build # run: ctest -j 2 -C "$BUILD_TYPE" --output-on-failure - - name: Build plugins + - name: Build 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 + - name: Install 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 + DESTDIR="$(pwd)/$install_name" cmake --build . --config "$BUILD_TYPE" --target install + tar czvf "$install_name".tar.gz "$install_name" - uses: actions/upload-artifact@v3 with: - name: MacOS installer + name: macOS tarball path: | - ${{runner.workspace}}/build/${{env.install_name}}.pkg + ${{runner.workspace}}/build/${{env.install_name}}.tar.gz - 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 - shell: bash - working-directory: ${{runner.workspace}}/build - run: mod-plugin-builder /usr/local/bin/cmake --build . --config "$BUILD_TYPE" -- -j 2 - - name: Install - working-directory: ${{runner.workspace}}/build - shell: bash - run: | - DESTDIR="$(pwd)/$install_name" mod-plugin-builder /usr/local/bin/cmake --build . --config "$BUILD_TYPE" --target install - tar czvf "$install_name".tar.gz "$install_name" - - uses: actions/upload-artifact@v3 - with: - name: MOD devices tarball - path: ${{runner.workspace}}/build/${{env.install_name}}.tar.gz +# build_for_mod: MOVED in plugins repository build_for_windows: runs-on: windows-2019 @@ -278,7 +206,7 @@ jobs: - name: Configure CMake working-directory: ${{runner.workspace}}/build 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 working-directory: ${{runner.workspace}}/build run: cmake --build . --config "${Env:BUILD_TYPE}" -j 2 --target sfizz_tests @@ -287,96 +215,77 @@ jobs: - name: Build all working-directory: ${{runner.workspace}}/build 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: | + 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 <> "$GITHUB_ENV" - # echo "install_name=sfizz-${GITHUB_REF##*/}-mingw${{matrix.bits}}" >> "$GITHUB_ENV" - # - name: Configure pacman repositories - # shell: bash - # run: | - # cat >>/etc/pacman.conf <> "$GITHUB_ENV" - # - uses: actions/download-artifact@v3 - # with: - # name: Linux tarball - - uses: actions/download-artifact@v3 + - if: ${{ false }} # DISABLED: Use distro packages + uses: actions/download-artifact@v3 with: - name: MOD devices tarball - # - uses: actions/download-artifact@v3 - # with: - # name: Win32 MinGW tarball - # - uses: actions/download-artifact@v3 - # with: - # name: Win64 MinGW tarball + name: Linux tarball - uses: actions/download-artifact@v3 + with: + name: macOS tarball + - if: ${{ false }} # DISABLED: MinGW 32 build temporarily disabled + uses: actions/download-artifact@v3 + with: + name: Win32 MinGW tarball + - if: ${{ false }} # DISABLED: MinGW 64 build temporarily disabled + uses: actions/download-artifact@v3 + with: + name: Win64 MinGW tarball + - if: ${{ false }} # DISABLED: Innosetup 32 in plugins repo + uses: actions/download-artifact@v3 with: name: Win32 installer - - uses: actions/download-artifact@v3 + - if: ${{ false }} # DISABLED: Innosetup 64 in plugins repo + uses: actions/download-artifact@v3 with: name: Win64 installer - uses: actions/download-artifact@v3 diff --git a/.gitignore b/.gitignore index 647af1091..e29ccc13a 100644 --- a/.gitignore +++ b/.gitignore @@ -22,12 +22,6 @@ compile_commands.json clients/sfizz_jack clients/sfzprint -/plugins/vst/download/ -/plugins/vst/external/vstsdk2.4/ -/plugins/vst/external/CoreAudioUtilityClasses/ - -/plugins/editor/external/fluentui-system-icons/ - *.sublime-* *.code-* .kak.tags.namecache diff --git a/.gitmodules b/.gitmodules index 57665bc67..140063f0c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,18 +1,6 @@ [submodule "external/abseil-cpp"] path = external/abseil-cpp 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"] path = external/st_audiofile/thirdparty/dr_libs url = https://github.com/mackron/dr_libs.git @@ -22,9 +10,6 @@ [submodule "external/st_audiofile/thirdparty/libaiff"] path = external/st_audiofile/thirdparty/libaiff 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"] path = external/filesystem url = https://github.com/gulrak/filesystem.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 049c9d7ae..6ba56bf6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ else() 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.") # 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 (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_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_TESTS "Enable tests 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_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_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_STATIC_DEPENDENCIES "Link dependencies statically" OFF) option_ex (SFIZZ_RELEASE_ASSERTS "Forced assertions in release builds" OFF) option_ex (SFIZZ_PROFILE_BUILD "Profile the build time" OFF) # 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 (SfizzDeps) @@ -59,15 +51,11 @@ include (SfizzFaust) # Don't use IPO in non Release builds include (CheckIPO) -# Dylib bunder for macOS -include (BundleDylibs) - # Add the static library targets and sources add_subdirectory (src) # Optional targets add_subdirectory (clients) -add_subdirectory (plugins) if (SFIZZ_BENCHMARKS) add_subdirectory (benchmarks) @@ -86,9 +74,4 @@ if (SFIZZ_DEVTOOLS) add_subdirectory (devtools) 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() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5f3823e30..afb08c5b8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. 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. -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. 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 -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. As such, they should *not* pose too much issues. They are all pinned to specific branches or commits in their original repository. To clone the sfizz repository, the recommended way is to do + ```bash git clone https://github.com/sfztools/sfizz.git --recursive # Other possibility @@ -65,6 +63,7 @@ git submodule update --init ``` If after some time you happen to see something like this: + ``` ❯ git status 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") ``` + 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. Assuming you were not adding relevant changes to abseil in order to push them upstream, you can usually resolve this issue through + ```bash git submodule update ``` + **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. -Same goes for the VST SDK. ### 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 In the clone of your fork, and add the `sfztools` repository as a remote as follows + ```bash # Clone your own fork in a specific directory git clone https://github.com/MY_GITHUB_NAME/sfizz.git sfizz-fork @@ -118,6 +121,7 @@ cd sfizz-fork # Add the upstream sfztools remote git remote add upstream https://github.com/sfztools/sfizz.git ``` + Once done, the contribution process is as follows: 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 In command language, this translates to + ```bash # Fetch the latest status from upstrea 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. 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 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 + ```bash 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. We tend to name the benchmarks with the `bm_` prefix. It can be as simple as adding a line + ```cmake 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. 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 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/ [benchmark]: https://github.com/google/benchmark [sfizz-render]: https://github.com/sfztools/sfizz-render diff --git a/README.md b/README.md index dfbe897a2..b646be5f2 100644 --- a/README.md +++ b/README.md @@ -8,23 +8,34 @@ [![ARIA Status Image]](https://sfz.tools/sfizz/development/status/opcodes/?v=aria) [![Cakewalk Status Image]](https://sfz.tools/sfizz/development/status/opcodes/?v=cakewalk) -SFZ parser and synth c++ library, providing AU / LV2 / VST3 plugins -and JACK standalone client, please check [our website] for more details. +SFZ parser and synth c++ library and JACK standalone client, +please check [our website] for more details. -![Screenshot](screenshot.png) +## 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 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++. -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]. On any operating system, you might prefer to [build from source]! ## Contributing to sfizz 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 @@ -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. 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. 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 @@ -64,14 +75,14 @@ The sfizz library also uses in some subprojects: - [Catch2], licensed under the Boost Software License 1.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 - [cxxopts] by Jarryd Beck, licensed under the MIT license - [fmidi] by Jean Pierre Cimalando, licensed under the Boost Software License 1.0 - [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/ [atomic_queue]: https://github.com/max0x7ba/atomic_queue [benchmark]: https://github.com/google/benchmark @@ -90,9 +101,6 @@ The sfizz library also uses in some subprojects: [fmidi]: https://github.com/jpcima/fmidi [libsamplerate]: http://www.mega-nerd.com/SRC/ [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 [releases]: https://github.com/sfztools/sfizz/releases [Carla]: https://kx.studio/Applications:Carla @@ -100,11 +108,12 @@ The sfizz library also uses in some subprojects: [API]: https://sfz.tools/sfizz/api/ [Open Collective]: https://opencollective.com/sfztools [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 [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 [SFZv2 Status Image]: https://sfz.tools/assets/img/sfizz/badge_sfz2.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 + +[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 diff --git a/benchmarks/CMakeLists.txt b/benchmarks/CMakeLists.txt index 8f0aac20e..68145e2dc 100644 --- a/benchmarks/CMakeLists.txt +++ b/benchmarks/CMakeLists.txt @@ -75,7 +75,7 @@ target_link_libraries(bm_filterStereoMono PRIVATE sfizz::sndfile) sfizz_add_benchmark(bm_stringResonator BM_stringResonator.cpp) 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) target_link_libraries(bm_pan_arm PRIVATE sfizz::jsl) endif() diff --git a/cmake/BundleDylibs.cmake b/cmake/BundleDylibs.cmake deleted file mode 100644 index f7c0628a2..000000000 --- a/cmake/BundleDylibs.cmake +++ /dev/null @@ -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() diff --git a/cmake/LV2Config.cmake b/cmake/LV2Config.cmake deleted file mode 100644 index 85450a858..000000000 --- a/cmake/LV2Config.cmake +++ /dev/null @@ -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: . -@prefix lv2: . -@prefix midi: . -@prefix patch: . -@prefix rdfs: . -@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() diff --git a/cmake/MakeUninstall.cmake.in b/cmake/MakeUninstall.cmake.in deleted file mode 100644 index c2d34d479..000000000 --- a/cmake/MakeUninstall.cmake.in +++ /dev/null @@ -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() diff --git a/cmake/PuredataConfig.cmake b/cmake/PuredataConfig.cmake deleted file mode 100644 index 11eab2fb1..000000000 --- a/cmake/PuredataConfig.cmake +++ /dev/null @@ -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() diff --git a/cmake/SfizzConfig.cmake b/cmake/SfizzConfig.cmake index 4809a3b27..9ef9edffc 100644 --- a/cmake/SfizzConfig.cmake +++ b/cmake/SfizzConfig.cmake @@ -4,8 +4,9 @@ include(CheckCXXCompilerFlag) include(CheckCXXSourceCompiles) include(GNUWarnings) -# FIXME: The current Abseil LTS version requires at least C++14, see -# https://github.com/abseil/abseil-cpp/releases/tag/20230125.1 +# TODO: +# 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_C_STANDARD 99 CACHE STRING "C standard to be used") @@ -21,9 +22,6 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) # Set C++ compatibility level if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" AND CMAKE_CXX_STANDARD LESS 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() # Set build profiling options @@ -88,21 +86,20 @@ endif() # The variable CMAKE_SYSTEM_PROCESSOR is incorrect on Visual studio... # see https://gitlab.kitware.com/cmake/cmake/issues/15170 - -if(NOT SFIZZ_SYSTEM_PROCESSOR) +if(NOT PROJECT_SYSTEM_PROCESSOR) if(MSVC) - set(SFIZZ_SYSTEM_PROCESSOR "${MSVC_CXX_ARCHITECTURE_ID}") + set(PROJECT_SYSTEM_PROCESSOR "${MSVC_CXX_ARCHITECTURE_ID}" CACHE STRING "" FORCE) else() - set(SFIZZ_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}") + set(PROJECT_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}" CACHE STRING "" FORCE) endif() endif() # Add required flags for the builds if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") 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) - elseif(SFIZZ_SYSTEM_PROCESSOR MATCHES "^(arm.*)$") + elseif(PROJECT_SYSTEM_PROCESSOR MATCHES "^(arm.*)$") add_compile_options(-mfpu=neon) if(NOT ANDROID) add_compile_options(-mfloat-abi=hard) @@ -134,21 +131,24 @@ endif() set(SFIZZ_REPOSITORY https://github.com/sfztools/sfizz) 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 function(show_build_info_if_needed) - if(CMAKE_PROJECT_NAME STREQUAL "sfizz") + if(PROJECT_IS_MAIN) message(STATUS " Project name: ${PROJECT_NAME} +CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD} Build type: ${CMAKE_BUILD_TYPE} -Build processor: ${SFIZZ_SYSTEM_PROCESSOR} +Build processor: ${PROJECT_SYSTEM_PROCESSOR} Build using LTO: ${ENABLE_LTO} Build as shared library: ${SFIZZ_SHARED} Build JACK stand-alone client: ${SFIZZ_JACK} 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 tests: ${SFIZZ_TESTS} Build demos: ${SFIZZ_DEMOS} @@ -159,9 +159,29 @@ Statically link dependencies: ${SFIZZ_STATIC_DEPENDENCIES} Use clang libc++: ${USE_LIBCPP} Release asserts: ${SFIZZ_RELEASE_ASSERTS} -Install prefix: ${CMAKE_INSTALL_PREFIX} -LV2 destination directory: ${LV2PLUGIN_INSTALL_DIR} +Use system abseil-cpp: ${SFIZZ_USE_SYSTEM_ABSEIL} +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 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 release flags: ${CMAKE_CXX_FLAGS_RELEASE} diff --git a/cmake/SfizzDeps.cmake b/cmake/SfizzDeps.cmake index e3ddb5ca8..3b15bbda1 100644 --- a/cmake/SfizzDeps.cmake +++ b/cmake/SfizzDeps.cmake @@ -27,6 +27,7 @@ if(OPENMP_FOUND) endif() # Find macOS system libraries +# TODO: remove UI libs which was used by plugins only if(APPLE) find_library(APPLE_COREFOUNDATION_LIBRARY "CoreFoundation") find_library(APPLE_FOUNDATION_LIBRARY "Foundation") @@ -53,9 +54,30 @@ endif() # Add Abseil if(SFIZZ_USE_SYSTEM_ABSEIL) find_package(absl REQUIRED) - # Workaround for silent Abseil module, see #1117 if(absl_FOUND) + # FIXME: + # 1. Workaround for silent Abseil module, see #1117 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() else() function(sfizz_add_vendor_abseil) @@ -306,7 +328,7 @@ if(JACK_FOUND) link_directories(${JACK_LIBRARY_DIRS}) endif() -# The Qt library +# The Qt library (CaptureEG devtool) find_package(Qt5 COMPONENTS Widgets) # The fmidi library diff --git a/cmake/SfizzSIMDSourceFiles.cmake b/cmake/SfizzSIMDSourceFiles.cmake index 9e588e93e..e7d164b74 100644 --- a/cmake/SfizzSIMDSourceFiles.cmake +++ b/cmake/SfizzSIMDSourceFiles.cmake @@ -9,7 +9,7 @@ macro(sfizz_add_simd_sources SOURCES_VAR PREFIX) # For CPU-dispatched X86 sources # 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 # to be able to use the intrinsics if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") diff --git a/cmake/SfizzUninstall.cmake b/cmake/SfizzUninstall.cmake deleted file mode 100644 index 6286832c1..000000000 --- a/cmake/SfizzUninstall.cmake +++ /dev/null @@ -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() diff --git a/cmake/StringUtility.cmake b/cmake/StringUtility.cmake deleted file mode 100644 index 00c5ba5c4..000000000 --- a/cmake/StringUtility.cmake +++ /dev/null @@ -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() diff --git a/cmake/VSTConfig.cmake b/cmake/VSTConfig.cmake deleted file mode 100644 index a2dde6dd0..000000000 --- a/cmake/VSTConfig.cmake +++ /dev/null @@ -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}") diff --git a/mac/dmg-back.png b/mac/dmg-back.png deleted file mode 100644 index bb1ebf5d9..000000000 Binary files a/mac/dmg-back.png and /dev/null differ diff --git a/mac/dmg-back.svg b/mac/dmg-back.svg deleted file mode 100644 index 1b8e61a5d..000000000 --- a/mac/dmg-back.svg +++ /dev/null @@ -1,251 +0,0 @@ - - - sfizz logo - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - sfizz logo - 2020-05-16 - - - Tobiasz 'unfa' Karoń - - - - - CC-0 - - - - - - - - - - - - - - - diff --git a/mac/dmg-back@2x.png b/mac/dmg-back@2x.png deleted file mode 100644 index a9d91d753..000000000 Binary files a/mac/dmg-back@2x.png and /dev/null differ diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt deleted file mode 100644 index d3f1070e4..000000000 --- a/plugins/CMakeLists.txt +++ /dev/null @@ -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() diff --git a/plugins/common/plugin/FileTrie.cpp b/plugins/common/plugin/FileTrie.cpp deleted file mode 100644 index 014ad6266..000000000 --- a/plugins/common/plugin/FileTrie.cpp +++ /dev/null @@ -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 -#include -#include - -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; -} diff --git a/plugins/common/plugin/FileTrie.h b/plugins/common/plugin/FileTrie.h deleted file mode 100644 index 63bf32d7f..000000000 --- a/plugins/common/plugin/FileTrie.h +++ /dev/null @@ -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 -#include -#include -#include -#include -#include - -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 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 directories_; -}; diff --git a/plugins/common/plugin/InstrumentDescription.cpp b/plugins/common/plugin/InstrumentDescription.cpp deleted file mode 100644 index af8955a0c..000000000 --- a/plugins/common/plugin/InstrumentDescription.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include - -template -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 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* 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(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(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(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; -} diff --git a/plugins/common/plugin/InstrumentDescription.h b/plugins/common/plugin/InstrumentDescription.h deleted file mode 100644 index 2435706cf..000000000 --- a/plugins/common/plugin/InstrumentDescription.h +++ /dev/null @@ -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 -#include -#include -#include -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 ccUsed {}; - std::array keyLabel {}; - std::array keyswitchLabel {}; - std::array ccLabel {}; - std::array ccDefault {}; - std::array 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); diff --git a/plugins/common/plugin/MessageUtils.cpp b/plugins/common/plugin/MessageUtils.cpp deleted file mode 100644 index 84e1b5f97..000000000 --- a/plugins/common/plugin/MessageUtils.cpp +++ /dev/null @@ -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 -#include -#include - -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 diff --git a/plugins/common/plugin/MessageUtils.h b/plugins/common/plugin/MessageUtils.h deleted file mode 100644 index 0faf54a5a..000000000 --- a/plugins/common/plugin/MessageUtils.h +++ /dev/null @@ -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 diff --git a/plugins/common/plugin/NativeHelpers.cpp b/plugins/common/plugin/NativeHelpers.cpp deleted file mode 100644 index 8f7f0aee9..000000000 --- a/plugins/common/plugin/NativeHelpers.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#include -#include - -const fs::path& getUserDocumentsDirectory() -{ - static const fs::path directory = []() -> fs::path { - std::unique_ptr 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 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 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 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 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 diff --git a/plugins/common/plugin/NativeHelpers.h b/plugins/common/plugin/NativeHelpers.h deleted file mode 100644 index 0b534a197..000000000 --- a/plugins/common/plugin/NativeHelpers.h +++ /dev/null @@ -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 -#include -#if defined(_WIN32) -#include -#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 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 diff --git a/plugins/common/plugin/NativeHelpers.mm b/plugins/common/plugin/NativeHelpers.mm deleted file mode 100644 index 8f2bfd3dc..000000000 --- a/plugins/common/plugin/NativeHelpers.mm +++ /dev/null @@ -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 -#include -#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* 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; -} diff --git a/plugins/common/plugin/RMSFollower.h b/plugins/common/plugin/RMSFollower.h deleted file mode 100644 index 10d2f0275..000000000 --- a/plugins/common/plugin/RMSFollower.h +++ /dev/null @@ -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 -#include -#include -#ifdef _WIN32 -#include -#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(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(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(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; -}; diff --git a/plugins/common/plugin/SfizzFileScan.cpp b/plugins/common/plugin/SfizzFileScan.cpp deleted file mode 100644 index 66fbe723c..000000000 --- a/plugins/common/plugin/SfizzFileScan.cpp +++ /dev/null @@ -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 -#include -#include -#if defined(_WIN32) -#include -#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 lock { mutex }; - refreshScan(); - - auto it = file_index_.find(keyOf(pathOrig.filename())); - if (it == file_index_.end()) - return false; - - const std::list& candidateIndices = it->second; - std::vector 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 -bool asciiCaseEqual(const std::basic_string& a, const std::basic_string& 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 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 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 getSfzSearchPaths() -{ - std::vector 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 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 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 getEnvironmentSfzPaths() -{ - std::vector paths; - -#if defined(_WIN32) - std::unique_ptr 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 diff --git a/plugins/common/plugin/SfizzFileScan.h b/plugins/common/plugin/SfizzFileScan.h deleted file mode 100644 index 9a6b0a082..000000000 --- a/plugins/common/plugin/SfizzFileScan.h +++ /dev/null @@ -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 -#include -#include -#include -#include -#include -#include -#include -#include - -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 completion_time_; - FileTrie file_trie_; - std::unordered_map> 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 candidates); -}; - -namespace SfizzPaths { -std::vector getSfzSearchPaths(); -absl::optional getSfzConfigDefaultPath(); -void setSfzConfigDefaultPath(const fs::path& path); -fs::path getSfzFallbackDefaultPath(); -std::vector getEnvironmentSfzPaths(); -} // namespace SfizzPaths diff --git a/plugins/common/plugin/SfizzForeignPaths.cpp b/plugins/common/plugin/SfizzForeignPaths.cpp deleted file mode 100644 index 61fa50f9e..000000000 --- a/plugins/common/plugin/SfizzForeignPaths.cpp +++ /dev/null @@ -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 - -fs::path getAriaPathSetting(const char* name) -{ - std::unique_ptr 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 valueW(new WCHAR[(valueSize / sizeof(WCHAR)) + 1]()); - DWORD valueType; - status = RegQueryValueExW( - key, nameW.get(), nullptr, - &valueType, reinterpret_cast(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 diff --git a/plugins/common/plugin/SfizzForeignPaths.h b/plugins/common/plugin/SfizzForeignPaths.h deleted file mode 100644 index 02f79b42f..000000000 --- a/plugins/common/plugin/SfizzForeignPaths.h +++ /dev/null @@ -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 - -namespace SfizzPaths { -fs::path getAriaPathSetting(const char* name); -} // namespace SfizzPaths diff --git a/plugins/common/plugin/SfizzForeignPaths.mm b/plugins/common/plugin/SfizzForeignPaths.mm deleted file mode 100644 index 074a3ece4..000000000 --- a/plugins/common/plugin/SfizzForeignPaths.mm +++ /dev/null @@ -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 -#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 diff --git a/plugins/common/plugin/SfizzSettings.cpp b/plugins/common/plugin/SfizzSettings.cpp deleted file mode 100644 index 091ad6f75..000000000 --- a/plugins/common/plugin/SfizzSettings.cpp +++ /dev/null @@ -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 -#include - -std::string SfizzSettings::load_or(const char* key, absl::string_view defaultValue) -{ - absl::optional optValue = load(key); - return optValue ? *optValue : std::string(defaultValue); -} - -#if defined(_WIN32) -#include - -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 SfizzSettings::load(const char* name) -{ - std::unique_ptr 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(valueW), &valueSize); - RegCloseKey(key); - if (status != ERROR_SUCCESS || (valueType != REG_SZ && valueType != REG_EXPAND_SZ)) - return {}; - - std::unique_ptr value { stringToUTF8(valueW) }; - if (!value) - return {}; - - return std::string(value.get()); -} - -bool SfizzSettings::store(const char* name, absl::string_view value) -{ - std::unique_ptr nameW { stringToWideChar(name) }; - std::unique_ptr 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(valueW.get()), - (wcslen(valueW.get()) + 1) * sizeof(WCHAR)); - RegCloseKey(key); - - return status == ERROR_SUCCESS; -} -#elif defined(__APPLE__) - // implementation in SfizzSettings.mm -#else -#include -#include - -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 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 diff --git a/plugins/common/plugin/SfizzSettings.h b/plugins/common/plugin/SfizzSettings.h deleted file mode 100644 index 2fcc2927e..000000000 --- a/plugins/common/plugin/SfizzSettings.h +++ /dev/null @@ -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 -#include - -class SfizzSettings { -public: - absl::optional load(const char* key); - std::string load_or(const char* key, absl::string_view defaultValue); - bool store(const char* key, absl::string_view value); -}; diff --git a/plugins/common/plugin/SfizzSettings.mm b/plugins/common/plugin/SfizzSettings.mm deleted file mode 100644 index 9ddbaeb4f..000000000 --- a/plugins/common/plugin/SfizzSettings.mm +++ /dev/null @@ -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 -#if !__has_feature(objc_arc) -#error This source file requires ARC -#endif - -static NSUserDefaults* getUserDefaults() -{ - return [[NSUserDefaults alloc] initWithSuiteName:@"tools.sfz.sfizz"];; -} - -absl::optional 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 diff --git a/plugins/editor/CMakeLists.txt b/plugins/editor/CMakeLists.txt deleted file mode 100644 index 1c63a6def..000000000 --- a/plugins/editor/CMakeLists.txt +++ /dev/null @@ -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 "$" - "${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) diff --git a/plugins/editor/cmake/Vstgui.cmake b/plugins/editor/cmake/Vstgui.cmake deleted file mode 100644 index 77c2d5811..000000000 --- a/plugins/editor/cmake/Vstgui.cmake +++ /dev/null @@ -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 -#include -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() diff --git a/plugins/editor/external/color-spaces/ColorSpaces.h b/plugins/editor/external/color-spaces/ColorSpaces.h deleted file mode 100644 index 06af231a8..000000000 --- a/plugins/editor/external/color-spaces/ColorSpaces.h +++ /dev/null @@ -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 -#include -#include - -namespace ColorSpaces { - -template using vec = std::array; -using vec3 = vec<3>; -using vec4 = vec<4>; - -template -T clamp(T x, T lo, T hi) -{ - return std::max(lo, std::min(hi, x)); -} - -template -vec saturate(vec 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 diff --git a/plugins/editor/external/color-spaces/LICENSE b/plugins/editor/external/color-spaces/LICENSE deleted file mode 100644 index 20efd1b3e..000000000 --- a/plugins/editor/external/color-spaces/LICENSE +++ /dev/null @@ -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. - diff --git a/plugins/editor/external/stb_image/LICENSE b/plugins/editor/external/stb_image/LICENSE deleted file mode 100644 index a77ae91f3..000000000 --- a/plugins/editor/external/stb_image/LICENSE +++ /dev/null @@ -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. diff --git a/plugins/editor/external/stb_image/stb_image.h b/plugins/editor/external/stb_image/stb_image.h deleted file mode 100644 index d60371b95..000000000 --- a/plugins/editor/external/stb_image/stb_image.h +++ /dev/null @@ -1,7897 +0,0 @@ -/* stb_image - v2.27 - public domain image loader - http://nothings.org/stb - no warranty implied; use at your own risk - - Do this: - #define STB_IMAGE_IMPLEMENTATION - before you include this file in *one* C or C++ file to create the implementation. - - // i.e. it should look like this: - #include ... - #include ... - #include ... - #define STB_IMAGE_IMPLEMENTATION - #include "stb_image.h" - - You can #define STBI_ASSERT(x) before the #include to avoid using assert.h. - And #define STBI_MALLOC, STBI_REALLOC, and STBI_FREE to avoid using malloc,realloc,free - - - QUICK NOTES: - Primarily of interest to game developers and other people who can - avoid problematic images and only need the trivial interface - - JPEG baseline & progressive (12 bpc/arithmetic not supported, same as stock IJG lib) - PNG 1/2/4/8/16-bit-per-channel - - TGA (not sure what subset, if a subset) - BMP non-1bpp, non-RLE - PSD (composited view only, no extra channels, 8/16 bit-per-channel) - - GIF (*comp always reports as 4-channel) - HDR (radiance rgbE format) - PIC (Softimage PIC) - PNM (PPM and PGM binary only) - - Animated GIF still needs a proper API, but here's one way to do it: - http://gist.github.com/urraka/685d9a6340b26b830d49 - - - decode from memory or through FILE (define STBI_NO_STDIO to remove code) - - decode from arbitrary I/O callbacks - - SIMD acceleration on x86/x64 (SSE2) and ARM (NEON) - - Full documentation under "DOCUMENTATION" below. - - -LICENSE - - See end of file for license information. - -RECENT REVISION HISTORY: - - 2.27 (2021-07-11) document stbi_info better, 16-bit PNM support, bug fixes - 2.26 (2020-07-13) many minor fixes - 2.25 (2020-02-02) fix warnings - 2.24 (2020-02-02) fix warnings; thread-local failure_reason and flip_vertically - 2.23 (2019-08-11) fix clang static analysis warning - 2.22 (2019-03-04) gif fixes, fix warnings - 2.21 (2019-02-25) fix typo in comment - 2.20 (2019-02-07) support utf8 filenames in Windows; fix warnings and platform ifdefs - 2.19 (2018-02-11) fix warning - 2.18 (2018-01-30) fix warnings - 2.17 (2018-01-29) bugfix, 1-bit BMP, 16-bitness query, fix warnings - 2.16 (2017-07-23) all functions have 16-bit variants; optimizations; bugfixes - 2.15 (2017-03-18) fix png-1,2,4; all Imagenet JPGs; no runtime SSE detection on GCC - 2.14 (2017-03-03) remove deprecated STBI_JPEG_OLD; fixes for Imagenet JPGs - 2.13 (2016-12-04) experimental 16-bit API, only for PNG so far; fixes - 2.12 (2016-04-02) fix typo in 2.11 PSD fix that caused crashes - 2.11 (2016-04-02) 16-bit PNGS; enable SSE2 in non-gcc x64 - RGB-format JPEG; remove white matting in PSD; - allocate large structures on the stack; - correct channel count for PNG & BMP - 2.10 (2016-01-22) avoid warning introduced in 2.09 - 2.09 (2016-01-16) 16-bit TGA; comments in PNM files; STBI_REALLOC_SIZED - - See end of file for full revision history. - - - ============================ Contributors ========================= - - Image formats Extensions, features - Sean Barrett (jpeg, png, bmp) Jetro Lauha (stbi_info) - Nicolas Schulz (hdr, psd) Martin "SpartanJ" Golini (stbi_info) - Jonathan Dummer (tga) James "moose2000" Brown (iPhone PNG) - Jean-Marc Lienher (gif) Ben "Disch" Wenger (io callbacks) - Tom Seddon (pic) Omar Cornut (1/2/4-bit PNG) - Thatcher Ulrich (psd) Nicolas Guillemot (vertical flip) - Ken Miller (pgm, ppm) Richard Mitton (16-bit PSD) - github:urraka (animated gif) Junggon Kim (PNM comments) - Christopher Forseth (animated gif) Daniel Gibson (16-bit TGA) - socks-the-fox (16-bit PNG) - Jeremy Sawicki (handle all ImageNet JPGs) - Optimizations & bugfixes Mikhail Morozov (1-bit BMP) - Fabian "ryg" Giesen Anael Seghezzi (is-16-bit query) - Arseny Kapoulkine Simon Breuss (16-bit PNM) - John-Mark Allen - Carmelo J Fdez-Aguera - - Bug & warning fixes - Marc LeBlanc David Woo Guillaume George Martins Mozeiko - Christpher Lloyd Jerry Jansson Joseph Thomson Blazej Dariusz Roszkowski - Phil Jordan Dave Moore Roy Eltham - Hayaki Saito Nathan Reed Won Chun - Luke Graham Johan Duparc Nick Verigakis the Horde3D community - Thomas Ruf Ronny Chevalier github:rlyeh - Janez Zemva John Bartholomew Michal Cichon github:romigrou - Jonathan Blow Ken Hamada Tero Hanninen github:svdijk - Eugene Golushkov Laurent Gomila Cort Stratton github:snagar - Aruelien Pocheville Sergio Gonzalez Thibault Reuille github:Zelex - Cass Everitt Ryamond Barbiero github:grim210 - Paul Du Bois Engin Manap Aldo Culquicondor github:sammyhw - Philipp Wiesemann Dale Weiler Oriol Ferrer Mesia github:phprus - Josh Tobin Matthew Gregan github:poppolopoppo - Julian Raschke Gregory Mullen Christian Floisand github:darealshinji - Baldur Karlsson Kevin Schmidt JR Smith github:Michaelangel007 - Brad Weinberger Matvey Cherevko github:mosra - Luca Sas Alexander Veselov Zack Middleton [reserved] - Ryan C. Gordon [reserved] [reserved] - DO NOT ADD YOUR NAME HERE - - Jacko Dirks - - To add your name to the credits, pick a random blank space in the middle and fill it. - 80% of merge conflicts on stb PRs are due to people adding their name at the end - of the credits. -*/ - -#ifndef STBI_INCLUDE_STB_IMAGE_H -#define STBI_INCLUDE_STB_IMAGE_H - -// DOCUMENTATION -// -// Limitations: -// - no 12-bit-per-channel JPEG -// - no JPEGs with arithmetic coding -// - GIF always returns *comp=4 -// -// Basic usage (see HDR discussion below for HDR usage): -// int x,y,n; -// unsigned char *data = stbi_load(filename, &x, &y, &n, 0); -// // ... process data if not NULL ... -// // ... x = width, y = height, n = # 8-bit components per pixel ... -// // ... replace '0' with '1'..'4' to force that many components per pixel -// // ... but 'n' will always be the number that it would have been if you said 0 -// stbi_image_free(data) -// -// Standard parameters: -// int *x -- outputs image width in pixels -// int *y -- outputs image height in pixels -// int *channels_in_file -- outputs # of image components in image file -// int desired_channels -- if non-zero, # of image components requested in result -// -// The return value from an image loader is an 'unsigned char *' which points -// to the pixel data, or NULL on an allocation failure or if the image is -// corrupt or invalid. The pixel data consists of *y scanlines of *x pixels, -// with each pixel consisting of N interleaved 8-bit components; the first -// pixel pointed to is top-left-most in the image. There is no padding between -// image scanlines or between pixels, regardless of format. The number of -// components N is 'desired_channels' if desired_channels is non-zero, or -// *channels_in_file otherwise. If desired_channels is non-zero, -// *channels_in_file has the number of components that _would_ have been -// output otherwise. E.g. if you set desired_channels to 4, you will always -// get RGBA output, but you can check *channels_in_file to see if it's trivially -// opaque because e.g. there were only 3 channels in the source image. -// -// An output image with N components has the following components interleaved -// in this order in each pixel: -// -// N=#comp components -// 1 grey -// 2 grey, alpha -// 3 red, green, blue -// 4 red, green, blue, alpha -// -// If image loading fails for any reason, the return value will be NULL, -// and *x, *y, *channels_in_file will be unchanged. The function -// stbi_failure_reason() can be queried for an extremely brief, end-user -// unfriendly explanation of why the load failed. Define STBI_NO_FAILURE_STRINGS -// to avoid compiling these strings at all, and STBI_FAILURE_USERMSG to get slightly -// more user-friendly ones. -// -// Paletted PNG, BMP, GIF, and PIC images are automatically depalettized. -// -// To query the width, height and component count of an image without having to -// decode the full file, you can use the stbi_info family of functions: -// -// int x,y,n,ok; -// ok = stbi_info(filename, &x, &y, &n); -// // returns ok=1 and sets x, y, n if image is a supported format, -// // 0 otherwise. -// -// Note that stb_image pervasively uses ints in its public API for sizes, -// including sizes of memory buffers. This is now part of the API and thus -// hard to change without causing breakage. As a result, the various image -// loaders all have certain limits on image size; these differ somewhat -// by format but generally boil down to either just under 2GB or just under -// 1GB. When the decoded image would be larger than this, stb_image decoding -// will fail. -// -// Additionally, stb_image will reject image files that have any of their -// dimensions set to a larger value than the configurable STBI_MAX_DIMENSIONS, -// which defaults to 2**24 = 16777216 pixels. Due to the above memory limit, -// the only way to have an image with such dimensions load correctly -// is for it to have a rather extreme aspect ratio. Either way, the -// assumption here is that such larger images are likely to be malformed -// or malicious. If you do need to load an image with individual dimensions -// larger than that, and it still fits in the overall size limit, you can -// #define STBI_MAX_DIMENSIONS on your own to be something larger. -// -// =========================================================================== -// -// UNICODE: -// -// If compiling for Windows and you wish to use Unicode filenames, compile -// with -// #define STBI_WINDOWS_UTF8 -// and pass utf8-encoded filenames. Call stbi_convert_wchar_to_utf8 to convert -// Windows wchar_t filenames to utf8. -// -// =========================================================================== -// -// Philosophy -// -// stb libraries are designed with the following priorities: -// -// 1. easy to use -// 2. easy to maintain -// 3. good performance -// -// Sometimes I let "good performance" creep up in priority over "easy to maintain", -// and for best performance I may provide less-easy-to-use APIs that give higher -// performance, in addition to the easy-to-use ones. Nevertheless, it's important -// to keep in mind that from the standpoint of you, a client of this library, -// all you care about is #1 and #3, and stb libraries DO NOT emphasize #3 above all. -// -// Some secondary priorities arise directly from the first two, some of which -// provide more explicit reasons why performance can't be emphasized. -// -// - Portable ("ease of use") -// - Small source code footprint ("easy to maintain") -// - No dependencies ("ease of use") -// -// =========================================================================== -// -// I/O callbacks -// -// I/O callbacks allow you to read from arbitrary sources, like packaged -// files or some other source. Data read from callbacks are processed -// through a small internal buffer (currently 128 bytes) to try to reduce -// overhead. -// -// The three functions you must define are "read" (reads some bytes of data), -// "skip" (skips some bytes of data), "eof" (reports if the stream is at the end). -// -// =========================================================================== -// -// SIMD support -// -// The JPEG decoder will try to automatically use SIMD kernels on x86 when -// supported by the compiler. For ARM Neon support, you must explicitly -// request it. -// -// (The old do-it-yourself SIMD API is no longer supported in the current -// code.) -// -// On x86, SSE2 will automatically be used when available based on a run-time -// test; if not, the generic C versions are used as a fall-back. On ARM targets, -// the typical path is to have separate builds for NEON and non-NEON devices -// (at least this is true for iOS and Android). Therefore, the NEON support is -// toggled by a build flag: define STBI_NEON to get NEON loops. -// -// If for some reason you do not want to use any of SIMD code, or if -// you have issues compiling it, you can disable it entirely by -// defining STBI_NO_SIMD. -// -// =========================================================================== -// -// HDR image support (disable by defining STBI_NO_HDR) -// -// stb_image supports loading HDR images in general, and currently the Radiance -// .HDR file format specifically. You can still load any file through the existing -// interface; if you attempt to load an HDR file, it will be automatically remapped -// to LDR, assuming gamma 2.2 and an arbitrary scale factor defaulting to 1; -// both of these constants can be reconfigured through this interface: -// -// stbi_hdr_to_ldr_gamma(2.2f); -// stbi_hdr_to_ldr_scale(1.0f); -// -// (note, do not use _inverse_ constants; stbi_image will invert them -// appropriately). -// -// Additionally, there is a new, parallel interface for loading files as -// (linear) floats to preserve the full dynamic range: -// -// float *data = stbi_loadf(filename, &x, &y, &n, 0); -// -// If you load LDR images through this interface, those images will -// be promoted to floating point values, run through the inverse of -// constants corresponding to the above: -// -// stbi_ldr_to_hdr_scale(1.0f); -// stbi_ldr_to_hdr_gamma(2.2f); -// -// Finally, given a filename (or an open file or memory block--see header -// file for details) containing image data, you can query for the "most -// appropriate" interface to use (that is, whether the image is HDR or -// not), using: -// -// stbi_is_hdr(char *filename); -// -// =========================================================================== -// -// iPhone PNG support: -// -// We optionally support converting iPhone-formatted PNGs (which store -// premultiplied BGRA) back to RGB, even though they're internally encoded -// differently. To enable this conversion, call -// stbi_convert_iphone_png_to_rgb(1). -// -// Call stbi_set_unpremultiply_on_load(1) as well to force a divide per -// pixel to remove any premultiplied alpha *only* if the image file explicitly -// says there's premultiplied data (currently only happens in iPhone images, -// and only if iPhone convert-to-rgb processing is on). -// -// =========================================================================== -// -// ADDITIONAL CONFIGURATION -// -// - You can suppress implementation of any of the decoders to reduce -// your code footprint by #defining one or more of the following -// symbols before creating the implementation. -// -// STBI_NO_JPEG -// STBI_NO_PNG -// STBI_NO_BMP -// STBI_NO_PSD -// STBI_NO_TGA -// STBI_NO_GIF -// STBI_NO_HDR -// STBI_NO_PIC -// STBI_NO_PNM (.ppm and .pgm) -// -// - You can request *only* certain decoders and suppress all other ones -// (this will be more forward-compatible, as addition of new decoders -// doesn't require you to disable them explicitly): -// -// STBI_ONLY_JPEG -// STBI_ONLY_PNG -// STBI_ONLY_BMP -// STBI_ONLY_PSD -// STBI_ONLY_TGA -// STBI_ONLY_GIF -// STBI_ONLY_HDR -// STBI_ONLY_PIC -// STBI_ONLY_PNM (.ppm and .pgm) -// -// - If you use STBI_NO_PNG (or _ONLY_ without PNG), and you still -// want the zlib decoder to be available, #define STBI_SUPPORT_ZLIB -// -// - If you define STBI_MAX_DIMENSIONS, stb_image will reject images greater -// than that size (in either width or height) without further processing. -// This is to let programs in the wild set an upper bound to prevent -// denial-of-service attacks on untrusted data, as one could generate a -// valid image of gigantic dimensions and force stb_image to allocate a -// huge block of memory and spend disproportionate time decoding it. By -// default this is set to (1 << 24), which is 16777216, but that's still -// very big. - -#ifndef STBI_NO_STDIO -#include -#endif // STBI_NO_STDIO - -#define STBI_VERSION 1 - -enum -{ - STBI_default = 0, // only used for desired_channels - - STBI_grey = 1, - STBI_grey_alpha = 2, - STBI_rgb = 3, - STBI_rgb_alpha = 4 -}; - -#include -typedef unsigned char stbi_uc; -typedef unsigned short stbi_us; - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef STBIDEF -#ifdef STB_IMAGE_STATIC -#define STBIDEF static -#else -#define STBIDEF extern -#endif -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// PRIMARY API - works on images of any type -// - -// -// load image by filename, open file, or memory buffer -// - -typedef struct -{ - int (*read) (void *user,char *data,int size); // fill 'data' with 'size' bytes. return number of bytes actually read - void (*skip) (void *user,int n); // skip the next 'n' bytes, or 'unget' the last -n bytes if negative - int (*eof) (void *user); // returns nonzero if we are at end of file/data -} stbi_io_callbacks; - -//////////////////////////////////// -// -// 8-bits-per-channel interface -// - -STBIDEF stbi_uc *stbi_load_from_memory (stbi_uc const *buffer, int len , int *x, int *y, int *channels_in_file, int desired_channels); -STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk , void *user, int *x, int *y, int *channels_in_file, int desired_channels); - -#ifndef STBI_NO_STDIO -STBIDEF stbi_uc *stbi_load (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels); -STBIDEF stbi_uc *stbi_load_from_file (FILE *f, int *x, int *y, int *channels_in_file, int desired_channels); -// for stbi_load_from_file, file pointer is left pointing immediately after image -#endif - -#ifndef STBI_NO_GIF -STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp); -#endif - -#ifdef STBI_WINDOWS_UTF8 -STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input); -#endif - -//////////////////////////////////// -// -// 16-bits-per-channel interface -// - -STBIDEF stbi_us *stbi_load_16_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels); -STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels); - -#ifndef STBI_NO_STDIO -STBIDEF stbi_us *stbi_load_16 (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels); -STBIDEF stbi_us *stbi_load_from_file_16(FILE *f, int *x, int *y, int *channels_in_file, int desired_channels); -#endif - -//////////////////////////////////// -// -// float-per-channel interface -// -#ifndef STBI_NO_LINEAR - STBIDEF float *stbi_loadf_from_memory (stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels); - STBIDEF float *stbi_loadf_from_callbacks (stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels); - - #ifndef STBI_NO_STDIO - STBIDEF float *stbi_loadf (char const *filename, int *x, int *y, int *channels_in_file, int desired_channels); - STBIDEF float *stbi_loadf_from_file (FILE *f, int *x, int *y, int *channels_in_file, int desired_channels); - #endif -#endif - -#ifndef STBI_NO_HDR - STBIDEF void stbi_hdr_to_ldr_gamma(float gamma); - STBIDEF void stbi_hdr_to_ldr_scale(float scale); -#endif // STBI_NO_HDR - -#ifndef STBI_NO_LINEAR - STBIDEF void stbi_ldr_to_hdr_gamma(float gamma); - STBIDEF void stbi_ldr_to_hdr_scale(float scale); -#endif // STBI_NO_LINEAR - -// stbi_is_hdr is always defined, but always returns false if STBI_NO_HDR -STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user); -STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len); -#ifndef STBI_NO_STDIO -STBIDEF int stbi_is_hdr (char const *filename); -STBIDEF int stbi_is_hdr_from_file(FILE *f); -#endif // STBI_NO_STDIO - - -// get a VERY brief reason for failure -// on most compilers (and ALL modern mainstream compilers) this is threadsafe -STBIDEF const char *stbi_failure_reason (void); - -// free the loaded image -- this is just free() -STBIDEF void stbi_image_free (void *retval_from_stbi_load); - -// get image dimensions & components without fully decoding -STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp); -STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp); -STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len); -STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *clbk, void *user); - -#ifndef STBI_NO_STDIO -STBIDEF int stbi_info (char const *filename, int *x, int *y, int *comp); -STBIDEF int stbi_info_from_file (FILE *f, int *x, int *y, int *comp); -STBIDEF int stbi_is_16_bit (char const *filename); -STBIDEF int stbi_is_16_bit_from_file(FILE *f); -#endif - - - -// for image formats that explicitly notate that they have premultiplied alpha, -// we just return the colors as stored in the file. set this flag to force -// unpremultiplication. results are undefined if the unpremultiply overflow. -STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply); - -// indicate whether we should process iphone images back to canonical format, -// or just pass them through "as-is" -STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert); - -// flip the image vertically, so the first pixel in the output array is the bottom left -STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip); - -// as above, but only applies to images loaded on the thread that calls the function -// this function is only available if your compiler supports thread-local variables; -// calling it will fail to link if your compiler doesn't -STBIDEF void stbi_set_unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply); -STBIDEF void stbi_convert_iphone_png_to_rgb_thread(int flag_true_if_should_convert); -STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_should_flip); - -// ZLIB client - used by PNG, available for other purposes - -STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen); -STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header); -STBIDEF char *stbi_zlib_decode_malloc(const char *buffer, int len, int *outlen); -STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, const char *ibuffer, int ilen); - -STBIDEF char *stbi_zlib_decode_noheader_malloc(const char *buffer, int len, int *outlen); -STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen); - - -#ifdef __cplusplus -} -#endif - -// -// -//// end header file ///////////////////////////////////////////////////// -#endif // STBI_INCLUDE_STB_IMAGE_H - -#ifdef STB_IMAGE_IMPLEMENTATION - -#if defined(STBI_ONLY_JPEG) || defined(STBI_ONLY_PNG) || defined(STBI_ONLY_BMP) \ - || defined(STBI_ONLY_TGA) || defined(STBI_ONLY_GIF) || defined(STBI_ONLY_PSD) \ - || defined(STBI_ONLY_HDR) || defined(STBI_ONLY_PIC) || defined(STBI_ONLY_PNM) \ - || defined(STBI_ONLY_ZLIB) - #ifndef STBI_ONLY_JPEG - #define STBI_NO_JPEG - #endif - #ifndef STBI_ONLY_PNG - #define STBI_NO_PNG - #endif - #ifndef STBI_ONLY_BMP - #define STBI_NO_BMP - #endif - #ifndef STBI_ONLY_PSD - #define STBI_NO_PSD - #endif - #ifndef STBI_ONLY_TGA - #define STBI_NO_TGA - #endif - #ifndef STBI_ONLY_GIF - #define STBI_NO_GIF - #endif - #ifndef STBI_ONLY_HDR - #define STBI_NO_HDR - #endif - #ifndef STBI_ONLY_PIC - #define STBI_NO_PIC - #endif - #ifndef STBI_ONLY_PNM - #define STBI_NO_PNM - #endif -#endif - -#if defined(STBI_NO_PNG) && !defined(STBI_SUPPORT_ZLIB) && !defined(STBI_NO_ZLIB) -#define STBI_NO_ZLIB -#endif - - -#include -#include // ptrdiff_t on osx -#include -#include -#include - -#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) -#include // ldexp, pow -#endif - -#ifndef STBI_NO_STDIO -#include -#endif - -#ifndef STBI_ASSERT -#include -#define STBI_ASSERT(x) assert(x) -#endif - -#ifdef __cplusplus -#define STBI_EXTERN extern "C" -#else -#define STBI_EXTERN extern -#endif - - -#ifndef _MSC_VER - #ifdef __cplusplus - #define stbi_inline inline - #else - #define stbi_inline - #endif -#else - #define stbi_inline __forceinline -#endif - -#ifndef STBI_NO_THREAD_LOCALS - #if defined(__cplusplus) && __cplusplus >= 201103L - #define STBI_THREAD_LOCAL thread_local - #elif defined(__GNUC__) && __GNUC__ < 5 - #define STBI_THREAD_LOCAL __thread - #elif defined(_MSC_VER) - #define STBI_THREAD_LOCAL __declspec(thread) - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__STDC_NO_THREADS__) - #define STBI_THREAD_LOCAL _Thread_local - #endif - - #ifndef STBI_THREAD_LOCAL - #if defined(__GNUC__) - #define STBI_THREAD_LOCAL __thread - #endif - #endif -#endif - -#ifdef _MSC_VER -typedef unsigned short stbi__uint16; -typedef signed short stbi__int16; -typedef unsigned int stbi__uint32; -typedef signed int stbi__int32; -#else -#include -typedef uint16_t stbi__uint16; -typedef int16_t stbi__int16; -typedef uint32_t stbi__uint32; -typedef int32_t stbi__int32; -#endif - -// should produce compiler error if size is wrong -typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 : -1]; - -#ifdef _MSC_VER -#define STBI_NOTUSED(v) (void)(v) -#else -#define STBI_NOTUSED(v) (void)sizeof(v) -#endif - -#ifdef _MSC_VER -#define STBI_HAS_LROTL -#endif - -#ifdef STBI_HAS_LROTL - #define stbi_lrot(x,y) _lrotl(x,y) -#else - #define stbi_lrot(x,y) (((x) << (y)) | ((x) >> (-(y) & 31))) -#endif - -#if defined(STBI_MALLOC) && defined(STBI_FREE) && (defined(STBI_REALLOC) || defined(STBI_REALLOC_SIZED)) -// ok -#elif !defined(STBI_MALLOC) && !defined(STBI_FREE) && !defined(STBI_REALLOC) && !defined(STBI_REALLOC_SIZED) -// ok -#else -#error "Must define all or none of STBI_MALLOC, STBI_FREE, and STBI_REALLOC (or STBI_REALLOC_SIZED)." -#endif - -#ifndef STBI_MALLOC -#define STBI_MALLOC(sz) malloc(sz) -#define STBI_REALLOC(p,newsz) realloc(p,newsz) -#define STBI_FREE(p) free(p) -#endif - -#ifndef STBI_REALLOC_SIZED -#define STBI_REALLOC_SIZED(p,oldsz,newsz) STBI_REALLOC(p,newsz) -#endif - -// x86/x64 detection -#if defined(__x86_64__) || defined(_M_X64) -#define STBI__X64_TARGET -#elif defined(__i386) || defined(_M_IX86) -#define STBI__X86_TARGET -#endif - -#if defined(__GNUC__) && defined(STBI__X86_TARGET) && !defined(__SSE2__) && !defined(STBI_NO_SIMD) -// gcc doesn't support sse2 intrinsics unless you compile with -msse2, -// which in turn means it gets to use SSE2 everywhere. This is unfortunate, -// but previous attempts to provide the SSE2 functions with runtime -// detection caused numerous issues. The way architecture extensions are -// exposed in GCC/Clang is, sadly, not really suited for one-file libs. -// New behavior: if compiled with -msse2, we use SSE2 without any -// detection; if not, we don't use it at all. -#define STBI_NO_SIMD -#endif - -#if defined(__MINGW32__) && defined(STBI__X86_TARGET) && !defined(STBI_MINGW_ENABLE_SSE2) && !defined(STBI_NO_SIMD) -// Note that __MINGW32__ doesn't actually mean 32-bit, so we have to avoid STBI__X64_TARGET -// -// 32-bit MinGW wants ESP to be 16-byte aligned, but this is not in the -// Windows ABI and VC++ as well as Windows DLLs don't maintain that invariant. -// As a result, enabling SSE2 on 32-bit MinGW is dangerous when not -// simultaneously enabling "-mstackrealign". -// -// See https://github.com/nothings/stb/issues/81 for more information. -// -// So default to no SSE2 on 32-bit MinGW. If you've read this far and added -// -mstackrealign to your build settings, feel free to #define STBI_MINGW_ENABLE_SSE2. -#define STBI_NO_SIMD -#endif - -#if !defined(STBI_NO_SIMD) && (defined(STBI__X86_TARGET) || defined(STBI__X64_TARGET)) -#define STBI_SSE2 -#include - -#ifdef _MSC_VER - -#if _MSC_VER >= 1400 // not VC6 -#include // __cpuid -static int stbi__cpuid3(void) -{ - int info[4]; - __cpuid(info,1); - return info[3]; -} -#else -static int stbi__cpuid3(void) -{ - int res; - __asm { - mov eax,1 - cpuid - mov res,edx - } - return res; -} -#endif - -#define STBI_SIMD_ALIGN(type, name) __declspec(align(16)) type name - -#if !defined(STBI_NO_JPEG) && defined(STBI_SSE2) -static int stbi__sse2_available(void) -{ - int info3 = stbi__cpuid3(); - return ((info3 >> 26) & 1) != 0; -} -#endif - -#else // assume GCC-style if not VC++ -#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16))) - -#if !defined(STBI_NO_JPEG) && defined(STBI_SSE2) -static int stbi__sse2_available(void) -{ - // If we're even attempting to compile this on GCC/Clang, that means - // -msse2 is on, which means the compiler is allowed to use SSE2 - // instructions at will, and so are we. - return 1; -} -#endif - -#endif -#endif - -// ARM NEON -#if defined(STBI_NO_SIMD) && defined(STBI_NEON) -#undef STBI_NEON -#endif - -#ifdef STBI_NEON -#include -#ifdef _MSC_VER -#define STBI_SIMD_ALIGN(type, name) __declspec(align(16)) type name -#else -#define STBI_SIMD_ALIGN(type, name) type name __attribute__((aligned(16))) -#endif -#endif - -#ifndef STBI_SIMD_ALIGN -#define STBI_SIMD_ALIGN(type, name) type name -#endif - -#ifndef STBI_MAX_DIMENSIONS -#define STBI_MAX_DIMENSIONS (1 << 24) -#endif - -/////////////////////////////////////////////// -// -// stbi__context struct and start_xxx functions - -// stbi__context structure is our basic context used by all images, so it -// contains all the IO context, plus some basic image information -typedef struct -{ - stbi__uint32 img_x, img_y; - int img_n, img_out_n; - - stbi_io_callbacks io; - void *io_user_data; - - int read_from_callbacks; - int buflen; - stbi_uc buffer_start[128]; - int callback_already_read; - - stbi_uc *img_buffer, *img_buffer_end; - stbi_uc *img_buffer_original, *img_buffer_original_end; -} stbi__context; - - -static void stbi__refill_buffer(stbi__context *s); - -// initialize a memory-decode context -static void stbi__start_mem(stbi__context *s, stbi_uc const *buffer, int len) -{ - s->io.read = NULL; - s->read_from_callbacks = 0; - s->callback_already_read = 0; - s->img_buffer = s->img_buffer_original = (stbi_uc *) buffer; - s->img_buffer_end = s->img_buffer_original_end = (stbi_uc *) buffer+len; -} - -// initialize a callback-based context -static void stbi__start_callbacks(stbi__context *s, stbi_io_callbacks *c, void *user) -{ - s->io = *c; - s->io_user_data = user; - s->buflen = sizeof(s->buffer_start); - s->read_from_callbacks = 1; - s->callback_already_read = 0; - s->img_buffer = s->img_buffer_original = s->buffer_start; - stbi__refill_buffer(s); - s->img_buffer_original_end = s->img_buffer_end; -} - -#ifndef STBI_NO_STDIO - -static int stbi__stdio_read(void *user, char *data, int size) -{ - return (int) fread(data,1,size,(FILE*) user); -} - -static void stbi__stdio_skip(void *user, int n) -{ - int ch; - fseek((FILE*) user, n, SEEK_CUR); - ch = fgetc((FILE*) user); /* have to read a byte to reset feof()'s flag */ - if (ch != EOF) { - ungetc(ch, (FILE *) user); /* push byte back onto stream if valid. */ - } -} - -static int stbi__stdio_eof(void *user) -{ - return feof((FILE*) user) || ferror((FILE *) user); -} - -static stbi_io_callbacks stbi__stdio_callbacks = -{ - stbi__stdio_read, - stbi__stdio_skip, - stbi__stdio_eof, -}; - -static void stbi__start_file(stbi__context *s, FILE *f) -{ - stbi__start_callbacks(s, &stbi__stdio_callbacks, (void *) f); -} - -//static void stop_file(stbi__context *s) { } - -#endif // !STBI_NO_STDIO - -static void stbi__rewind(stbi__context *s) -{ - // conceptually rewind SHOULD rewind to the beginning of the stream, - // but we just rewind to the beginning of the initial buffer, because - // we only use it after doing 'test', which only ever looks at at most 92 bytes - s->img_buffer = s->img_buffer_original; - s->img_buffer_end = s->img_buffer_original_end; -} - -enum -{ - STBI_ORDER_RGB, - STBI_ORDER_BGR -}; - -typedef struct -{ - int bits_per_channel; - int num_channels; - int channel_order; -} stbi__result_info; - -#ifndef STBI_NO_JPEG -static int stbi__jpeg_test(stbi__context *s); -static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_PNG -static int stbi__png_test(stbi__context *s); -static void *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp); -static int stbi__png_is16(stbi__context *s); -#endif - -#ifndef STBI_NO_BMP -static int stbi__bmp_test(stbi__context *s); -static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_TGA -static int stbi__tga_test(stbi__context *s); -static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_PSD -static int stbi__psd_test(stbi__context *s); -static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc); -static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp); -static int stbi__psd_is16(stbi__context *s); -#endif - -#ifndef STBI_NO_HDR -static int stbi__hdr_test(stbi__context *s); -static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_PIC -static int stbi__pic_test(stbi__context *s); -static void *stbi__pic_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_GIF -static int stbi__gif_test(stbi__context *s); -static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, int *z, int *comp, int req_comp); -static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp); -#endif - -#ifndef STBI_NO_PNM -static int stbi__pnm_test(stbi__context *s); -static void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri); -static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp); -static int stbi__pnm_is16(stbi__context *s); -#endif - -static -#ifdef STBI_THREAD_LOCAL -STBI_THREAD_LOCAL -#endif -const char *stbi__g_failure_reason; - -STBIDEF const char *stbi_failure_reason(void) -{ - return stbi__g_failure_reason; -} - -#ifndef STBI_NO_FAILURE_STRINGS -static int stbi__err(const char *str) -{ - stbi__g_failure_reason = str; - return 0; -} -#endif - -static void *stbi__malloc(size_t size) -{ - return STBI_MALLOC(size); -} - -// stb_image uses ints pervasively, including for offset calculations. -// therefore the largest decoded image size we can support with the -// current code, even on 64-bit targets, is INT_MAX. this is not a -// significant limitation for the intended use case. -// -// we do, however, need to make sure our size calculations don't -// overflow. hence a few helper functions for size calculations that -// multiply integers together, making sure that they're non-negative -// and no overflow occurs. - -// return 1 if the sum is valid, 0 on overflow. -// negative terms are considered invalid. -static int stbi__addsizes_valid(int a, int b) -{ - if (b < 0) return 0; - // now 0 <= b <= INT_MAX, hence also - // 0 <= INT_MAX - b <= INTMAX. - // And "a + b <= INT_MAX" (which might overflow) is the - // same as a <= INT_MAX - b (no overflow) - return a <= INT_MAX - b; -} - -// returns 1 if the product is valid, 0 on overflow. -// negative factors are considered invalid. -static int stbi__mul2sizes_valid(int a, int b) -{ - if (a < 0 || b < 0) return 0; - if (b == 0) return 1; // mul-by-0 is always safe - // portable way to check for no overflows in a*b - return a <= INT_MAX/b; -} - -#if !defined(STBI_NO_JPEG) || !defined(STBI_NO_PNG) || !defined(STBI_NO_TGA) || !defined(STBI_NO_HDR) -// returns 1 if "a*b + add" has no negative terms/factors and doesn't overflow -static int stbi__mad2sizes_valid(int a, int b, int add) -{ - return stbi__mul2sizes_valid(a, b) && stbi__addsizes_valid(a*b, add); -} -#endif - -// returns 1 if "a*b*c + add" has no negative terms/factors and doesn't overflow -static int stbi__mad3sizes_valid(int a, int b, int c, int add) -{ - return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) && - stbi__addsizes_valid(a*b*c, add); -} - -// returns 1 if "a*b*c*d + add" has no negative terms/factors and doesn't overflow -#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) || !defined(STBI_NO_PNM) -static int stbi__mad4sizes_valid(int a, int b, int c, int d, int add) -{ - return stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) && - stbi__mul2sizes_valid(a*b*c, d) && stbi__addsizes_valid(a*b*c*d, add); -} -#endif - -#if !defined(STBI_NO_JPEG) || !defined(STBI_NO_PNG) || !defined(STBI_NO_TGA) || !defined(STBI_NO_HDR) -// mallocs with size overflow checking -static void *stbi__malloc_mad2(int a, int b, int add) -{ - if (!stbi__mad2sizes_valid(a, b, add)) return NULL; - return stbi__malloc(a*b + add); -} -#endif - -static void *stbi__malloc_mad3(int a, int b, int c, int add) -{ - if (!stbi__mad3sizes_valid(a, b, c, add)) return NULL; - return stbi__malloc(a*b*c + add); -} - -#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) || !defined(STBI_NO_PNM) -static void *stbi__malloc_mad4(int a, int b, int c, int d, int add) -{ - if (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL; - return stbi__malloc(a*b*c*d + add); -} -#endif - -// stbi__err - error -// stbi__errpf - error returning pointer to float -// stbi__errpuc - error returning pointer to unsigned char - -#ifdef STBI_NO_FAILURE_STRINGS - #define stbi__err(x,y) 0 -#elif defined(STBI_FAILURE_USERMSG) - #define stbi__err(x,y) stbi__err(y) -#else - #define stbi__err(x,y) stbi__err(x) -#endif - -#define stbi__errpf(x,y) ((float *)(size_t) (stbi__err(x,y)?NULL:NULL)) -#define stbi__errpuc(x,y) ((unsigned char *)(size_t) (stbi__err(x,y)?NULL:NULL)) - -STBIDEF void stbi_image_free(void *retval_from_stbi_load) -{ - STBI_FREE(retval_from_stbi_load); -} - -#ifndef STBI_NO_LINEAR -static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp); -#endif - -#ifndef STBI_NO_HDR -static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp); -#endif - -static int stbi__vertically_flip_on_load_global = 0; - -STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip) -{ - stbi__vertically_flip_on_load_global = flag_true_if_should_flip; -} - -#ifndef STBI_THREAD_LOCAL -#define stbi__vertically_flip_on_load stbi__vertically_flip_on_load_global -#else -static STBI_THREAD_LOCAL int stbi__vertically_flip_on_load_local, stbi__vertically_flip_on_load_set; - -STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_should_flip) -{ - stbi__vertically_flip_on_load_local = flag_true_if_should_flip; - stbi__vertically_flip_on_load_set = 1; -} - -#define stbi__vertically_flip_on_load (stbi__vertically_flip_on_load_set \ - ? stbi__vertically_flip_on_load_local \ - : stbi__vertically_flip_on_load_global) -#endif // STBI_THREAD_LOCAL - -static void *stbi__load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc) -{ - memset(ri, 0, sizeof(*ri)); // make sure it's initialized if we add new fields - ri->bits_per_channel = 8; // default is 8 so most paths don't have to be changed - ri->channel_order = STBI_ORDER_RGB; // all current input & output are this, but this is here so we can add BGR order - ri->num_channels = 0; - - // test the formats with a very explicit header first (at least a FOURCC - // or distinctive magic number first) - #ifndef STBI_NO_PNG - if (stbi__png_test(s)) return stbi__png_load(s,x,y,comp,req_comp, ri); - #endif - #ifndef STBI_NO_BMP - if (stbi__bmp_test(s)) return stbi__bmp_load(s,x,y,comp,req_comp, ri); - #endif - #ifndef STBI_NO_GIF - if (stbi__gif_test(s)) return stbi__gif_load(s,x,y,comp,req_comp, ri); - #endif - #ifndef STBI_NO_PSD - if (stbi__psd_test(s)) return stbi__psd_load(s,x,y,comp,req_comp, ri, bpc); - #else - STBI_NOTUSED(bpc); - #endif - #ifndef STBI_NO_PIC - if (stbi__pic_test(s)) return stbi__pic_load(s,x,y,comp,req_comp, ri); - #endif - - // then the formats that can end up attempting to load with just 1 or 2 - // bytes matching expectations; these are prone to false positives, so - // try them later - #ifndef STBI_NO_JPEG - if (stbi__jpeg_test(s)) return stbi__jpeg_load(s,x,y,comp,req_comp, ri); - #endif - #ifndef STBI_NO_PNM - if (stbi__pnm_test(s)) return stbi__pnm_load(s,x,y,comp,req_comp, ri); - #endif - - #ifndef STBI_NO_HDR - if (stbi__hdr_test(s)) { - float *hdr = stbi__hdr_load(s, x,y,comp,req_comp, ri); - return stbi__hdr_to_ldr(hdr, *x, *y, req_comp ? req_comp : *comp); - } - #endif - - #ifndef STBI_NO_TGA - // test tga last because it's a crappy test! - if (stbi__tga_test(s)) - return stbi__tga_load(s,x,y,comp,req_comp, ri); - #endif - - return stbi__errpuc("unknown image type", "Image not of any known type, or corrupt"); -} - -static stbi_uc *stbi__convert_16_to_8(stbi__uint16 *orig, int w, int h, int channels) -{ - int i; - int img_len = w * h * channels; - stbi_uc *reduced; - - reduced = (stbi_uc *) stbi__malloc(img_len); - if (reduced == NULL) return stbi__errpuc("outofmem", "Out of memory"); - - for (i = 0; i < img_len; ++i) - reduced[i] = (stbi_uc)((orig[i] >> 8) & 0xFF); // top half of each byte is sufficient approx of 16->8 bit scaling - - STBI_FREE(orig); - return reduced; -} - -static stbi__uint16 *stbi__convert_8_to_16(stbi_uc *orig, int w, int h, int channels) -{ - int i; - int img_len = w * h * channels; - stbi__uint16 *enlarged; - - enlarged = (stbi__uint16 *) stbi__malloc(img_len*2); - if (enlarged == NULL) return (stbi__uint16 *) stbi__errpuc("outofmem", "Out of memory"); - - for (i = 0; i < img_len; ++i) - enlarged[i] = (stbi__uint16)((orig[i] << 8) + orig[i]); // replicate to high and low byte, maps 0->0, 255->0xffff - - STBI_FREE(orig); - return enlarged; -} - -static void stbi__vertical_flip(void *image, int w, int h, int bytes_per_pixel) -{ - int row; - size_t bytes_per_row = (size_t)w * bytes_per_pixel; - stbi_uc temp[2048]; - stbi_uc *bytes = (stbi_uc *)image; - - for (row = 0; row < (h>>1); row++) { - stbi_uc *row0 = bytes + row*bytes_per_row; - stbi_uc *row1 = bytes + (h - row - 1)*bytes_per_row; - // swap row0 with row1 - size_t bytes_left = bytes_per_row; - while (bytes_left) { - size_t bytes_copy = (bytes_left < sizeof(temp)) ? bytes_left : sizeof(temp); - memcpy(temp, row0, bytes_copy); - memcpy(row0, row1, bytes_copy); - memcpy(row1, temp, bytes_copy); - row0 += bytes_copy; - row1 += bytes_copy; - bytes_left -= bytes_copy; - } - } -} - -#ifndef STBI_NO_GIF -static void stbi__vertical_flip_slices(void *image, int w, int h, int z, int bytes_per_pixel) -{ - int slice; - int slice_size = w * h * bytes_per_pixel; - - stbi_uc *bytes = (stbi_uc *)image; - for (slice = 0; slice < z; ++slice) { - stbi__vertical_flip(bytes, w, h, bytes_per_pixel); - bytes += slice_size; - } -} -#endif - -static unsigned char *stbi__load_and_postprocess_8bit(stbi__context *s, int *x, int *y, int *comp, int req_comp) -{ - stbi__result_info ri; - void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 8); - - if (result == NULL) - return NULL; - - // it is the responsibility of the loaders to make sure we get either 8 or 16 bit. - STBI_ASSERT(ri.bits_per_channel == 8 || ri.bits_per_channel == 16); - - if (ri.bits_per_channel != 8) { - result = stbi__convert_16_to_8((stbi__uint16 *) result, *x, *y, req_comp == 0 ? *comp : req_comp); - ri.bits_per_channel = 8; - } - - // @TODO: move stbi__convert_format to here - - if (stbi__vertically_flip_on_load) { - int channels = req_comp ? req_comp : *comp; - stbi__vertical_flip(result, *x, *y, channels * sizeof(stbi_uc)); - } - - return (unsigned char *) result; -} - -static stbi__uint16 *stbi__load_and_postprocess_16bit(stbi__context *s, int *x, int *y, int *comp, int req_comp) -{ - stbi__result_info ri; - void *result = stbi__load_main(s, x, y, comp, req_comp, &ri, 16); - - if (result == NULL) - return NULL; - - // it is the responsibility of the loaders to make sure we get either 8 or 16 bit. - STBI_ASSERT(ri.bits_per_channel == 8 || ri.bits_per_channel == 16); - - if (ri.bits_per_channel != 16) { - result = stbi__convert_8_to_16((stbi_uc *) result, *x, *y, req_comp == 0 ? *comp : req_comp); - ri.bits_per_channel = 16; - } - - // @TODO: move stbi__convert_format16 to here - // @TODO: special case RGB-to-Y (and RGBA-to-YA) for 8-bit-to-16-bit case to keep more precision - - if (stbi__vertically_flip_on_load) { - int channels = req_comp ? req_comp : *comp; - stbi__vertical_flip(result, *x, *y, channels * sizeof(stbi__uint16)); - } - - return (stbi__uint16 *) result; -} - -#if !defined(STBI_NO_HDR) && !defined(STBI_NO_LINEAR) -static void stbi__float_postprocess(float *result, int *x, int *y, int *comp, int req_comp) -{ - if (stbi__vertically_flip_on_load && result != NULL) { - int channels = req_comp ? req_comp : *comp; - stbi__vertical_flip(result, *x, *y, channels * sizeof(float)); - } -} -#endif - -#ifndef STBI_NO_STDIO - -#if defined(_WIN32) && defined(STBI_WINDOWS_UTF8) -STBI_EXTERN __declspec(dllimport) int __stdcall MultiByteToWideChar(unsigned int cp, unsigned long flags, const char *str, int cbmb, wchar_t *widestr, int cchwide); -STBI_EXTERN __declspec(dllimport) int __stdcall WideCharToMultiByte(unsigned int cp, unsigned long flags, const wchar_t *widestr, int cchwide, char *str, int cbmb, const char *defchar, int *used_default); -#endif - -#if defined(_WIN32) && defined(STBI_WINDOWS_UTF8) -STBIDEF int stbi_convert_wchar_to_utf8(char *buffer, size_t bufferlen, const wchar_t* input) -{ - return WideCharToMultiByte(65001 /* UTF8 */, 0, input, -1, buffer, (int) bufferlen, NULL, NULL); -} -#endif - -static FILE *stbi__fopen(char const *filename, char const *mode) -{ - FILE *f; -#if defined(_WIN32) && defined(STBI_WINDOWS_UTF8) - wchar_t wMode[64]; - wchar_t wFilename[1024]; - if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, filename, -1, wFilename, sizeof(wFilename)/sizeof(*wFilename))) - return 0; - - if (0 == MultiByteToWideChar(65001 /* UTF8 */, 0, mode, -1, wMode, sizeof(wMode)/sizeof(*wMode))) - return 0; - -#if defined(_MSC_VER) && _MSC_VER >= 1400 - if (0 != _wfopen_s(&f, wFilename, wMode)) - f = 0; -#else - f = _wfopen(wFilename, wMode); -#endif - -#elif defined(_MSC_VER) && _MSC_VER >= 1400 - if (0 != fopen_s(&f, filename, mode)) - f=0; -#else - f = fopen(filename, mode); -#endif - return f; -} - - -STBIDEF stbi_uc *stbi_load(char const *filename, int *x, int *y, int *comp, int req_comp) -{ - FILE *f = stbi__fopen(filename, "rb"); - unsigned char *result; - if (!f) return stbi__errpuc("can't fopen", "Unable to open file"); - result = stbi_load_from_file(f,x,y,comp,req_comp); - fclose(f); - return result; -} - -STBIDEF stbi_uc *stbi_load_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) -{ - unsigned char *result; - stbi__context s; - stbi__start_file(&s,f); - result = stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp); - if (result) { - // need to 'unget' all the characters in the IO buffer - fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR); - } - return result; -} - -STBIDEF stbi__uint16 *stbi_load_from_file_16(FILE *f, int *x, int *y, int *comp, int req_comp) -{ - stbi__uint16 *result; - stbi__context s; - stbi__start_file(&s,f); - result = stbi__load_and_postprocess_16bit(&s,x,y,comp,req_comp); - if (result) { - // need to 'unget' all the characters in the IO buffer - fseek(f, - (int) (s.img_buffer_end - s.img_buffer), SEEK_CUR); - } - return result; -} - -STBIDEF stbi_us *stbi_load_16(char const *filename, int *x, int *y, int *comp, int req_comp) -{ - FILE *f = stbi__fopen(filename, "rb"); - stbi__uint16 *result; - if (!f) return (stbi_us *) stbi__errpuc("can't fopen", "Unable to open file"); - result = stbi_load_from_file_16(f,x,y,comp,req_comp); - fclose(f); - return result; -} - - -#endif //!STBI_NO_STDIO - -STBIDEF stbi_us *stbi_load_16_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *channels_in_file, int desired_channels) -{ - stbi__context s; - stbi__start_mem(&s,buffer,len); - return stbi__load_and_postprocess_16bit(&s,x,y,channels_in_file,desired_channels); -} - -STBIDEF stbi_us *stbi_load_16_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *channels_in_file, int desired_channels) -{ - stbi__context s; - stbi__start_callbacks(&s, (stbi_io_callbacks *)clbk, user); - return stbi__load_and_postprocess_16bit(&s,x,y,channels_in_file,desired_channels); -} - -STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) -{ - stbi__context s; - stbi__start_mem(&s,buffer,len); - return stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp); -} - -STBIDEF stbi_uc *stbi_load_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp) -{ - stbi__context s; - stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user); - return stbi__load_and_postprocess_8bit(&s,x,y,comp,req_comp); -} - -#ifndef STBI_NO_GIF -STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp) -{ - unsigned char *result; - stbi__context s; - stbi__start_mem(&s,buffer,len); - - result = (unsigned char*) stbi__load_gif_main(&s, delays, x, y, z, comp, req_comp); - if (stbi__vertically_flip_on_load) { - stbi__vertical_flip_slices( result, *x, *y, *z, *comp ); - } - - return result; -} -#endif - -#ifndef STBI_NO_LINEAR -static float *stbi__loadf_main(stbi__context *s, int *x, int *y, int *comp, int req_comp) -{ - unsigned char *data; - #ifndef STBI_NO_HDR - if (stbi__hdr_test(s)) { - stbi__result_info ri; - float *hdr_data = stbi__hdr_load(s,x,y,comp,req_comp, &ri); - if (hdr_data) - stbi__float_postprocess(hdr_data,x,y,comp,req_comp); - return hdr_data; - } - #endif - data = stbi__load_and_postprocess_8bit(s, x, y, comp, req_comp); - if (data) - return stbi__ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp); - return stbi__errpf("unknown image type", "Image not of any known type, or corrupt"); -} - -STBIDEF float *stbi_loadf_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp) -{ - stbi__context s; - stbi__start_mem(&s,buffer,len); - return stbi__loadf_main(&s,x,y,comp,req_comp); -} - -STBIDEF float *stbi_loadf_from_callbacks(stbi_io_callbacks const *clbk, void *user, int *x, int *y, int *comp, int req_comp) -{ - stbi__context s; - stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user); - return stbi__loadf_main(&s,x,y,comp,req_comp); -} - -#ifndef STBI_NO_STDIO -STBIDEF float *stbi_loadf(char const *filename, int *x, int *y, int *comp, int req_comp) -{ - float *result; - FILE *f = stbi__fopen(filename, "rb"); - if (!f) return stbi__errpf("can't fopen", "Unable to open file"); - result = stbi_loadf_from_file(f,x,y,comp,req_comp); - fclose(f); - return result; -} - -STBIDEF float *stbi_loadf_from_file(FILE *f, int *x, int *y, int *comp, int req_comp) -{ - stbi__context s; - stbi__start_file(&s,f); - return stbi__loadf_main(&s,x,y,comp,req_comp); -} -#endif // !STBI_NO_STDIO - -#endif // !STBI_NO_LINEAR - -// these is-hdr-or-not is defined independent of whether STBI_NO_LINEAR is -// defined, for API simplicity; if STBI_NO_LINEAR is defined, it always -// reports false! - -STBIDEF int stbi_is_hdr_from_memory(stbi_uc const *buffer, int len) -{ - #ifndef STBI_NO_HDR - stbi__context s; - stbi__start_mem(&s,buffer,len); - return stbi__hdr_test(&s); - #else - STBI_NOTUSED(buffer); - STBI_NOTUSED(len); - return 0; - #endif -} - -#ifndef STBI_NO_STDIO -STBIDEF int stbi_is_hdr (char const *filename) -{ - FILE *f = stbi__fopen(filename, "rb"); - int result=0; - if (f) { - result = stbi_is_hdr_from_file(f); - fclose(f); - } - return result; -} - -STBIDEF int stbi_is_hdr_from_file(FILE *f) -{ - #ifndef STBI_NO_HDR - long pos = ftell(f); - int res; - stbi__context s; - stbi__start_file(&s,f); - res = stbi__hdr_test(&s); - fseek(f, pos, SEEK_SET); - return res; - #else - STBI_NOTUSED(f); - return 0; - #endif -} -#endif // !STBI_NO_STDIO - -STBIDEF int stbi_is_hdr_from_callbacks(stbi_io_callbacks const *clbk, void *user) -{ - #ifndef STBI_NO_HDR - stbi__context s; - stbi__start_callbacks(&s, (stbi_io_callbacks *) clbk, user); - return stbi__hdr_test(&s); - #else - STBI_NOTUSED(clbk); - STBI_NOTUSED(user); - return 0; - #endif -} - -#ifndef STBI_NO_LINEAR -static float stbi__l2h_gamma=2.2f, stbi__l2h_scale=1.0f; - -STBIDEF void stbi_ldr_to_hdr_gamma(float gamma) { stbi__l2h_gamma = gamma; } -STBIDEF void stbi_ldr_to_hdr_scale(float scale) { stbi__l2h_scale = scale; } -#endif - -static float stbi__h2l_gamma_i=1.0f/2.2f, stbi__h2l_scale_i=1.0f; - -STBIDEF void stbi_hdr_to_ldr_gamma(float gamma) { stbi__h2l_gamma_i = 1/gamma; } -STBIDEF void stbi_hdr_to_ldr_scale(float scale) { stbi__h2l_scale_i = 1/scale; } - - -////////////////////////////////////////////////////////////////////////////// -// -// Common code used by all image loaders -// - -enum -{ - STBI__SCAN_load=0, - STBI__SCAN_type, - STBI__SCAN_header -}; - -static void stbi__refill_buffer(stbi__context *s) -{ - int n = (s->io.read)(s->io_user_data,(char*)s->buffer_start,s->buflen); - s->callback_already_read += (int) (s->img_buffer - s->img_buffer_original); - if (n == 0) { - // at end of file, treat same as if from memory, but need to handle case - // where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file - s->read_from_callbacks = 0; - s->img_buffer = s->buffer_start; - s->img_buffer_end = s->buffer_start+1; - *s->img_buffer = 0; - } else { - s->img_buffer = s->buffer_start; - s->img_buffer_end = s->buffer_start + n; - } -} - -stbi_inline static stbi_uc stbi__get8(stbi__context *s) -{ - if (s->img_buffer < s->img_buffer_end) - return *s->img_buffer++; - if (s->read_from_callbacks) { - stbi__refill_buffer(s); - return *s->img_buffer++; - } - return 0; -} - -#if defined(STBI_NO_JPEG) && defined(STBI_NO_HDR) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM) -// nothing -#else -stbi_inline static int stbi__at_eof(stbi__context *s) -{ - if (s->io.read) { - if (!(s->io.eof)(s->io_user_data)) return 0; - // if feof() is true, check if buffer = end - // special case: we've only got the special 0 character at the end - if (s->read_from_callbacks == 0) return 1; - } - - return s->img_buffer >= s->img_buffer_end; -} -#endif - -#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && defined(STBI_NO_PIC) -// nothing -#else -static void stbi__skip(stbi__context *s, int n) -{ - if (n == 0) return; // already there! - if (n < 0) { - s->img_buffer = s->img_buffer_end; - return; - } - if (s->io.read) { - int blen = (int) (s->img_buffer_end - s->img_buffer); - if (blen < n) { - s->img_buffer = s->img_buffer_end; - (s->io.skip)(s->io_user_data, n - blen); - return; - } - } - s->img_buffer += n; -} -#endif - -#if defined(STBI_NO_PNG) && defined(STBI_NO_TGA) && defined(STBI_NO_HDR) && defined(STBI_NO_PNM) -// nothing -#else -static int stbi__getn(stbi__context *s, stbi_uc *buffer, int n) -{ - if (s->io.read) { - int blen = (int) (s->img_buffer_end - s->img_buffer); - if (blen < n) { - int res, count; - - memcpy(buffer, s->img_buffer, blen); - - count = (s->io.read)(s->io_user_data, (char*) buffer + blen, n - blen); - res = (count == (n-blen)); - s->img_buffer = s->img_buffer_end; - return res; - } - } - - if (s->img_buffer+n <= s->img_buffer_end) { - memcpy(buffer, s->img_buffer, n); - s->img_buffer += n; - return 1; - } else - return 0; -} -#endif - -#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC) -// nothing -#else -static int stbi__get16be(stbi__context *s) -{ - int z = stbi__get8(s); - return (z << 8) + stbi__get8(s); -} -#endif - -#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) && defined(STBI_NO_PIC) -// nothing -#else -static stbi__uint32 stbi__get32be(stbi__context *s) -{ - stbi__uint32 z = stbi__get16be(s); - return (z << 16) + stbi__get16be(s); -} -#endif - -#if defined(STBI_NO_BMP) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) -// nothing -#else -static int stbi__get16le(stbi__context *s) -{ - int z = stbi__get8(s); - return z + (stbi__get8(s) << 8); -} -#endif - -#ifndef STBI_NO_BMP -static stbi__uint32 stbi__get32le(stbi__context *s) -{ - stbi__uint32 z = stbi__get16le(s); - z += (stbi__uint32)stbi__get16le(s) << 16; - return z; -} -#endif - -#define STBI__BYTECAST(x) ((stbi_uc) ((x) & 255)) // truncate int to byte without warnings - -#if defined(STBI_NO_JPEG) && defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM) -// nothing -#else -////////////////////////////////////////////////////////////////////////////// -// -// generic converter from built-in img_n to req_comp -// individual types do this automatically as much as possible (e.g. jpeg -// does all cases internally since it needs to colorspace convert anyway, -// and it never has alpha, so very few cases ). png can automatically -// interleave an alpha=255 channel, but falls back to this for other cases -// -// assume data buffer is malloced, so malloc a new one and free that one -// only failure mode is malloc failing - -static stbi_uc stbi__compute_y(int r, int g, int b) -{ - return (stbi_uc) (((r*77) + (g*150) + (29*b)) >> 8); -} -#endif - -#if defined(STBI_NO_PNG) && defined(STBI_NO_BMP) && defined(STBI_NO_PSD) && defined(STBI_NO_TGA) && defined(STBI_NO_GIF) && defined(STBI_NO_PIC) && defined(STBI_NO_PNM) -// nothing -#else -static unsigned char *stbi__convert_format(unsigned char *data, int img_n, int req_comp, unsigned int x, unsigned int y) -{ - int i,j; - unsigned char *good; - - if (req_comp == img_n) return data; - STBI_ASSERT(req_comp >= 1 && req_comp <= 4); - - good = (unsigned char *) stbi__malloc_mad3(req_comp, x, y, 0); - if (good == NULL) { - STBI_FREE(data); - return stbi__errpuc("outofmem", "Out of memory"); - } - - for (j=0; j < (int) y; ++j) { - unsigned char *src = data + j * x * img_n ; - unsigned char *dest = good + j * x * req_comp; - - #define STBI__COMBO(a,b) ((a)*8+(b)) - #define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b) - // convert source image with img_n components to one with req_comp components; - // avoid switch per pixel, so use switch per scanline and massive macros - switch (STBI__COMBO(img_n, req_comp)) { - STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=255; } break; - STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; - STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=255; } break; - STBI__CASE(2,1) { dest[0]=src[0]; } break; - STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; - STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1]; } break; - STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=255; } break; - STBI__CASE(3,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break; - STBI__CASE(3,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = 255; } break; - STBI__CASE(4,1) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); } break; - STBI__CASE(4,2) { dest[0]=stbi__compute_y(src[0],src[1],src[2]); dest[1] = src[3]; } break; - STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2]; } break; - default: STBI_ASSERT(0); STBI_FREE(data); STBI_FREE(good); return stbi__errpuc("unsupported", "Unsupported format conversion"); - } - #undef STBI__CASE - } - - STBI_FREE(data); - return good; -} -#endif - -#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) -// nothing -#else -static stbi__uint16 stbi__compute_y_16(int r, int g, int b) -{ - return (stbi__uint16) (((r*77) + (g*150) + (29*b)) >> 8); -} -#endif - -#if defined(STBI_NO_PNG) && defined(STBI_NO_PSD) -// nothing -#else -static stbi__uint16 *stbi__convert_format16(stbi__uint16 *data, int img_n, int req_comp, unsigned int x, unsigned int y) -{ - int i,j; - stbi__uint16 *good; - - if (req_comp == img_n) return data; - STBI_ASSERT(req_comp >= 1 && req_comp <= 4); - - good = (stbi__uint16 *) stbi__malloc(req_comp * x * y * 2); - if (good == NULL) { - STBI_FREE(data); - return (stbi__uint16 *) stbi__errpuc("outofmem", "Out of memory"); - } - - for (j=0; j < (int) y; ++j) { - stbi__uint16 *src = data + j * x * img_n ; - stbi__uint16 *dest = good + j * x * req_comp; - - #define STBI__COMBO(a,b) ((a)*8+(b)) - #define STBI__CASE(a,b) case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b) - // convert source image with img_n components to one with req_comp components; - // avoid switch per pixel, so use switch per scanline and massive macros - switch (STBI__COMBO(img_n, req_comp)) { - STBI__CASE(1,2) { dest[0]=src[0]; dest[1]=0xffff; } break; - STBI__CASE(1,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; - STBI__CASE(1,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=0xffff; } break; - STBI__CASE(2,1) { dest[0]=src[0]; } break; - STBI__CASE(2,3) { dest[0]=dest[1]=dest[2]=src[0]; } break; - STBI__CASE(2,4) { dest[0]=dest[1]=dest[2]=src[0]; dest[3]=src[1]; } break; - STBI__CASE(3,4) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2];dest[3]=0xffff; } break; - STBI__CASE(3,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break; - STBI__CASE(3,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); dest[1] = 0xffff; } break; - STBI__CASE(4,1) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); } break; - STBI__CASE(4,2) { dest[0]=stbi__compute_y_16(src[0],src[1],src[2]); dest[1] = src[3]; } break; - STBI__CASE(4,3) { dest[0]=src[0];dest[1]=src[1];dest[2]=src[2]; } break; - default: STBI_ASSERT(0); STBI_FREE(data); STBI_FREE(good); return (stbi__uint16*) stbi__errpuc("unsupported", "Unsupported format conversion"); - } - #undef STBI__CASE - } - - STBI_FREE(data); - return good; -} -#endif - -#ifndef STBI_NO_LINEAR -static float *stbi__ldr_to_hdr(stbi_uc *data, int x, int y, int comp) -{ - int i,k,n; - float *output; - if (!data) return NULL; - output = (float *) stbi__malloc_mad4(x, y, comp, sizeof(float), 0); - if (output == NULL) { STBI_FREE(data); return stbi__errpf("outofmem", "Out of memory"); } - // compute number of non-alpha components - if (comp & 1) n = comp; else n = comp-1; - for (i=0; i < x*y; ++i) { - for (k=0; k < n; ++k) { - output[i*comp + k] = (float) (pow(data[i*comp+k]/255.0f, stbi__l2h_gamma) * stbi__l2h_scale); - } - } - if (n < comp) { - for (i=0; i < x*y; ++i) { - output[i*comp + n] = data[i*comp + n]/255.0f; - } - } - STBI_FREE(data); - return output; -} -#endif - -#ifndef STBI_NO_HDR -#define stbi__float2int(x) ((int) (x)) -static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp) -{ - int i,k,n; - stbi_uc *output; - if (!data) return NULL; - output = (stbi_uc *) stbi__malloc_mad3(x, y, comp, 0); - if (output == NULL) { STBI_FREE(data); return stbi__errpuc("outofmem", "Out of memory"); } - // compute number of non-alpha components - if (comp & 1) n = comp; else n = comp-1; - for (i=0; i < x*y; ++i) { - for (k=0; k < n; ++k) { - float z = (float) pow(data[i*comp+k]*stbi__h2l_scale_i, stbi__h2l_gamma_i) * 255 + 0.5f; - if (z < 0) z = 0; - if (z > 255) z = 255; - output[i*comp + k] = (stbi_uc) stbi__float2int(z); - } - if (k < comp) { - float z = data[i*comp+k] * 255 + 0.5f; - if (z < 0) z = 0; - if (z > 255) z = 255; - output[i*comp + k] = (stbi_uc) stbi__float2int(z); - } - } - STBI_FREE(data); - return output; -} -#endif - -////////////////////////////////////////////////////////////////////////////// -// -// "baseline" JPEG/JFIF decoder -// -// simple implementation -// - doesn't support delayed output of y-dimension -// - simple interface (only one output format: 8-bit interleaved RGB) -// - doesn't try to recover corrupt jpegs -// - doesn't allow partial loading, loading multiple at once -// - still fast on x86 (copying globals into locals doesn't help x86) -// - allocates lots of intermediate memory (full size of all components) -// - non-interleaved case requires this anyway -// - allows good upsampling (see next) -// high-quality -// - upsampled channels are bilinearly interpolated, even across blocks -// - quality integer IDCT derived from IJG's 'slow' -// performance -// - fast huffman; reasonable integer IDCT -// - some SIMD kernels for common paths on targets with SSE2/NEON -// - uses a lot of intermediate memory, could cache poorly - -#ifndef STBI_NO_JPEG - -// huffman decoding acceleration -#define FAST_BITS 9 // larger handles more cases; smaller stomps less cache - -typedef struct -{ - stbi_uc fast[1 << FAST_BITS]; - // weirdly, repacking this into AoS is a 10% speed loss, instead of a win - stbi__uint16 code[256]; - stbi_uc values[256]; - stbi_uc size[257]; - unsigned int maxcode[18]; - int delta[17]; // old 'firstsymbol' - old 'firstcode' -} stbi__huffman; - -typedef struct -{ - stbi__context *s; - stbi__huffman huff_dc[4]; - stbi__huffman huff_ac[4]; - stbi__uint16 dequant[4][64]; - stbi__int16 fast_ac[4][1 << FAST_BITS]; - -// sizes for components, interleaved MCUs - int img_h_max, img_v_max; - int img_mcu_x, img_mcu_y; - int img_mcu_w, img_mcu_h; - -// definition of jpeg image component - struct - { - int id; - int h,v; - int tq; - int hd,ha; - int dc_pred; - - int x,y,w2,h2; - stbi_uc *data; - void *raw_data, *raw_coeff; - stbi_uc *linebuf; - short *coeff; // progressive only - int coeff_w, coeff_h; // number of 8x8 coefficient blocks - } img_comp[4]; - - stbi__uint32 code_buffer; // jpeg entropy-coded buffer - int code_bits; // number of valid bits - unsigned char marker; // marker seen while filling entropy buffer - int nomore; // flag if we saw a marker so must stop - - int progressive; - int spec_start; - int spec_end; - int succ_high; - int succ_low; - int eob_run; - int jfif; - int app14_color_transform; // Adobe APP14 tag - int rgb; - - int scan_n, order[4]; - int restart_interval, todo; - -// kernels - void (*idct_block_kernel)(stbi_uc *out, int out_stride, short data[64]); - void (*YCbCr_to_RGB_kernel)(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step); - stbi_uc *(*resample_row_hv_2_kernel)(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs); -} stbi__jpeg; - -static int stbi__build_huffman(stbi__huffman *h, int *count) -{ - int i,j,k=0; - unsigned int code; - // build size list for each symbol (from JPEG spec) - for (i=0; i < 16; ++i) - for (j=0; j < count[i]; ++j) - h->size[k++] = (stbi_uc) (i+1); - h->size[k] = 0; - - // compute actual symbols (from jpeg spec) - code = 0; - k = 0; - for(j=1; j <= 16; ++j) { - // compute delta to add to code to compute symbol id - h->delta[j] = k - code; - if (h->size[k] == j) { - while (h->size[k] == j) - h->code[k++] = (stbi__uint16) (code++); - if (code-1 >= (1u << j)) return stbi__err("bad code lengths","Corrupt JPEG"); - } - // compute largest code + 1 for this size, preshifted as needed later - h->maxcode[j] = code << (16-j); - code <<= 1; - } - h->maxcode[j] = 0xffffffff; - - // build non-spec acceleration table; 255 is flag for not-accelerated - memset(h->fast, 255, 1 << FAST_BITS); - for (i=0; i < k; ++i) { - int s = h->size[i]; - if (s <= FAST_BITS) { - int c = h->code[i] << (FAST_BITS-s); - int m = 1 << (FAST_BITS-s); - for (j=0; j < m; ++j) { - h->fast[c+j] = (stbi_uc) i; - } - } - } - return 1; -} - -// build a table that decodes both magnitude and value of small ACs in -// one go. -static void stbi__build_fast_ac(stbi__int16 *fast_ac, stbi__huffman *h) -{ - int i; - for (i=0; i < (1 << FAST_BITS); ++i) { - stbi_uc fast = h->fast[i]; - fast_ac[i] = 0; - if (fast < 255) { - int rs = h->values[fast]; - int run = (rs >> 4) & 15; - int magbits = rs & 15; - int len = h->size[fast]; - - if (magbits && len + magbits <= FAST_BITS) { - // magnitude code followed by receive_extend code - int k = ((i << len) & ((1 << FAST_BITS) - 1)) >> (FAST_BITS - magbits); - int m = 1 << (magbits - 1); - if (k < m) k += (~0U << magbits) + 1; - // if the result is small enough, we can fit it in fast_ac table - if (k >= -128 && k <= 127) - fast_ac[i] = (stbi__int16) ((k * 256) + (run * 16) + (len + magbits)); - } - } - } -} - -static void stbi__grow_buffer_unsafe(stbi__jpeg *j) -{ - do { - unsigned int b = j->nomore ? 0 : stbi__get8(j->s); - if (b == 0xff) { - int c = stbi__get8(j->s); - while (c == 0xff) c = stbi__get8(j->s); // consume fill bytes - if (c != 0) { - j->marker = (unsigned char) c; - j->nomore = 1; - return; - } - } - j->code_buffer |= b << (24 - j->code_bits); - j->code_bits += 8; - } while (j->code_bits <= 24); -} - -// (1 << n) - 1 -static const stbi__uint32 stbi__bmask[17]={0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535}; - -// decode a jpeg huffman value from the bitstream -stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h) -{ - unsigned int temp; - int c,k; - - if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); - - // look at the top FAST_BITS and determine what symbol ID it is, - // if the code is <= FAST_BITS - c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); - k = h->fast[c]; - if (k < 255) { - int s = h->size[k]; - if (s > j->code_bits) - return -1; - j->code_buffer <<= s; - j->code_bits -= s; - return h->values[k]; - } - - // naive test is to shift the code_buffer down so k bits are - // valid, then test against maxcode. To speed this up, we've - // preshifted maxcode left so that it has (16-k) 0s at the - // end; in other words, regardless of the number of bits, it - // wants to be compared against something shifted to have 16; - // that way we don't need to shift inside the loop. - temp = j->code_buffer >> 16; - for (k=FAST_BITS+1 ; ; ++k) - if (temp < h->maxcode[k]) - break; - if (k == 17) { - // error! code not found - j->code_bits -= 16; - return -1; - } - - if (k > j->code_bits) - return -1; - - // convert the huffman code to the symbol id - c = ((j->code_buffer >> (32 - k)) & stbi__bmask[k]) + h->delta[k]; - STBI_ASSERT((((j->code_buffer) >> (32 - h->size[c])) & stbi__bmask[h->size[c]]) == h->code[c]); - - // convert the id to a symbol - j->code_bits -= k; - j->code_buffer <<= k; - return h->values[c]; -} - -// bias[n] = (-1<code_bits < n) stbi__grow_buffer_unsafe(j); - - sgn = j->code_buffer >> 31; // sign bit always in MSB; 0 if MSB clear (positive), 1 if MSB set (negative) - k = stbi_lrot(j->code_buffer, n); - j->code_buffer = k & ~stbi__bmask[n]; - k &= stbi__bmask[n]; - j->code_bits -= n; - return k + (stbi__jbias[n] & (sgn - 1)); -} - -// get some unsigned bits -stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n) -{ - unsigned int k; - if (j->code_bits < n) stbi__grow_buffer_unsafe(j); - k = stbi_lrot(j->code_buffer, n); - j->code_buffer = k & ~stbi__bmask[n]; - k &= stbi__bmask[n]; - j->code_bits -= n; - return k; -} - -stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j) -{ - unsigned int k; - if (j->code_bits < 1) stbi__grow_buffer_unsafe(j); - k = j->code_buffer; - j->code_buffer <<= 1; - --j->code_bits; - return k & 0x80000000; -} - -// given a value that's at position X in the zigzag stream, -// where does it appear in the 8x8 matrix coded as row-major? -static const stbi_uc stbi__jpeg_dezigzag[64+15] = -{ - 0, 1, 8, 16, 9, 2, 3, 10, - 17, 24, 32, 25, 18, 11, 4, 5, - 12, 19, 26, 33, 40, 48, 41, 34, - 27, 20, 13, 6, 7, 14, 21, 28, - 35, 42, 49, 56, 57, 50, 43, 36, - 29, 22, 15, 23, 30, 37, 44, 51, - 58, 59, 52, 45, 38, 31, 39, 46, - 53, 60, 61, 54, 47, 55, 62, 63, - // let corrupt input sample past end - 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 63, 63 -}; - -// decode one 64-entry block-- -static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, stbi__int16 *fac, int b, stbi__uint16 *dequant) -{ - int diff,dc,k; - int t; - - if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); - t = stbi__jpeg_huff_decode(j, hdc); - if (t < 0 || t > 15) return stbi__err("bad huffman code","Corrupt JPEG"); - - // 0 all the ac values now so we can do it 32-bits at a time - memset(data,0,64*sizeof(data[0])); - - diff = t ? stbi__extend_receive(j, t) : 0; - dc = j->img_comp[b].dc_pred + diff; - j->img_comp[b].dc_pred = dc; - data[0] = (short) (dc * dequant[0]); - - // decode AC components, see JPEG spec - k = 1; - do { - unsigned int zig; - int c,r,s; - if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); - c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); - r = fac[c]; - if (r) { // fast-AC path - k += (r >> 4) & 15; // run - s = r & 15; // combined length - j->code_buffer <<= s; - j->code_bits -= s; - // decode into unzigzag'd location - zig = stbi__jpeg_dezigzag[k++]; - data[zig] = (short) ((r >> 8) * dequant[zig]); - } else { - int rs = stbi__jpeg_huff_decode(j, hac); - if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); - s = rs & 15; - r = rs >> 4; - if (s == 0) { - if (rs != 0xf0) break; // end block - k += 16; - } else { - k += r; - // decode into unzigzag'd location - zig = stbi__jpeg_dezigzag[k++]; - data[zig] = (short) (stbi__extend_receive(j,s) * dequant[zig]); - } - } - } while (k < 64); - return 1; -} - -static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__huffman *hdc, int b) -{ - int diff,dc; - int t; - if (j->spec_end != 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); - - if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); - - if (j->succ_high == 0) { - // first scan for DC coefficient, must be first - memset(data,0,64*sizeof(data[0])); // 0 all the ac values now - t = stbi__jpeg_huff_decode(j, hdc); - if (t < 0 || t > 15) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); - diff = t ? stbi__extend_receive(j, t) : 0; - - dc = j->img_comp[b].dc_pred + diff; - j->img_comp[b].dc_pred = dc; - data[0] = (short) (dc * (1 << j->succ_low)); - } else { - // refinement scan for DC coefficient - if (stbi__jpeg_get_bit(j)) - data[0] += (short) (1 << j->succ_low); - } - return 1; -} - -// @OPTIMIZE: store non-zigzagged during the decode passes, -// and only de-zigzag when dequantizing -static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__huffman *hac, stbi__int16 *fac) -{ - int k; - if (j->spec_start == 0) return stbi__err("can't merge dc and ac", "Corrupt JPEG"); - - if (j->succ_high == 0) { - int shift = j->succ_low; - - if (j->eob_run) { - --j->eob_run; - return 1; - } - - k = j->spec_start; - do { - unsigned int zig; - int c,r,s; - if (j->code_bits < 16) stbi__grow_buffer_unsafe(j); - c = (j->code_buffer >> (32 - FAST_BITS)) & ((1 << FAST_BITS)-1); - r = fac[c]; - if (r) { // fast-AC path - k += (r >> 4) & 15; // run - s = r & 15; // combined length - j->code_buffer <<= s; - j->code_bits -= s; - zig = stbi__jpeg_dezigzag[k++]; - data[zig] = (short) ((r >> 8) * (1 << shift)); - } else { - int rs = stbi__jpeg_huff_decode(j, hac); - if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); - s = rs & 15; - r = rs >> 4; - if (s == 0) { - if (r < 15) { - j->eob_run = (1 << r); - if (r) - j->eob_run += stbi__jpeg_get_bits(j, r); - --j->eob_run; - break; - } - k += 16; - } else { - k += r; - zig = stbi__jpeg_dezigzag[k++]; - data[zig] = (short) (stbi__extend_receive(j,s) * (1 << shift)); - } - } - } while (k <= j->spec_end); - } else { - // refinement scan for these AC coefficients - - short bit = (short) (1 << j->succ_low); - - if (j->eob_run) { - --j->eob_run; - for (k = j->spec_start; k <= j->spec_end; ++k) { - short *p = &data[stbi__jpeg_dezigzag[k]]; - if (*p != 0) - if (stbi__jpeg_get_bit(j)) - if ((*p & bit)==0) { - if (*p > 0) - *p += bit; - else - *p -= bit; - } - } - } else { - k = j->spec_start; - do { - int r,s; - int rs = stbi__jpeg_huff_decode(j, hac); // @OPTIMIZE see if we can use the fast path here, advance-by-r is so slow, eh - if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG"); - s = rs & 15; - r = rs >> 4; - if (s == 0) { - if (r < 15) { - j->eob_run = (1 << r) - 1; - if (r) - j->eob_run += stbi__jpeg_get_bits(j, r); - r = 64; // force end of block - } else { - // r=15 s=0 should write 16 0s, so we just do - // a run of 15 0s and then write s (which is 0), - // so we don't have to do anything special here - } - } else { - if (s != 1) return stbi__err("bad huffman code", "Corrupt JPEG"); - // sign bit - if (stbi__jpeg_get_bit(j)) - s = bit; - else - s = -bit; - } - - // advance by r - while (k <= j->spec_end) { - short *p = &data[stbi__jpeg_dezigzag[k++]]; - if (*p != 0) { - if (stbi__jpeg_get_bit(j)) - if ((*p & bit)==0) { - if (*p > 0) - *p += bit; - else - *p -= bit; - } - } else { - if (r == 0) { - *p = (short) s; - break; - } - --r; - } - } - } while (k <= j->spec_end); - } - } - return 1; -} - -// take a -128..127 value and stbi__clamp it and convert to 0..255 -stbi_inline static stbi_uc stbi__clamp(int x) -{ - // trick to use a single test to catch both cases - if ((unsigned int) x > 255) { - if (x < 0) return 0; - if (x > 255) return 255; - } - return (stbi_uc) x; -} - -#define stbi__f2f(x) ((int) (((x) * 4096 + 0.5))) -#define stbi__fsh(x) ((x) * 4096) - -// derived from jidctint -- DCT_ISLOW -#define STBI__IDCT_1D(s0,s1,s2,s3,s4,s5,s6,s7) \ - int t0,t1,t2,t3,p1,p2,p3,p4,p5,x0,x1,x2,x3; \ - p2 = s2; \ - p3 = s6; \ - p1 = (p2+p3) * stbi__f2f(0.5411961f); \ - t2 = p1 + p3*stbi__f2f(-1.847759065f); \ - t3 = p1 + p2*stbi__f2f( 0.765366865f); \ - p2 = s0; \ - p3 = s4; \ - t0 = stbi__fsh(p2+p3); \ - t1 = stbi__fsh(p2-p3); \ - x0 = t0+t3; \ - x3 = t0-t3; \ - x1 = t1+t2; \ - x2 = t1-t2; \ - t0 = s7; \ - t1 = s5; \ - t2 = s3; \ - t3 = s1; \ - p3 = t0+t2; \ - p4 = t1+t3; \ - p1 = t0+t3; \ - p2 = t1+t2; \ - p5 = (p3+p4)*stbi__f2f( 1.175875602f); \ - t0 = t0*stbi__f2f( 0.298631336f); \ - t1 = t1*stbi__f2f( 2.053119869f); \ - t2 = t2*stbi__f2f( 3.072711026f); \ - t3 = t3*stbi__f2f( 1.501321110f); \ - p1 = p5 + p1*stbi__f2f(-0.899976223f); \ - p2 = p5 + p2*stbi__f2f(-2.562915447f); \ - p3 = p3*stbi__f2f(-1.961570560f); \ - p4 = p4*stbi__f2f(-0.390180644f); \ - t3 += p1+p4; \ - t2 += p2+p3; \ - t1 += p2+p4; \ - t0 += p1+p3; - -static void stbi__idct_block(stbi_uc *out, int out_stride, short data[64]) -{ - int i,val[64],*v=val; - stbi_uc *o; - short *d = data; - - // columns - for (i=0; i < 8; ++i,++d, ++v) { - // if all zeroes, shortcut -- this avoids dequantizing 0s and IDCTing - if (d[ 8]==0 && d[16]==0 && d[24]==0 && d[32]==0 - && d[40]==0 && d[48]==0 && d[56]==0) { - // no shortcut 0 seconds - // (1|2|3|4|5|6|7)==0 0 seconds - // all separate -0.047 seconds - // 1 && 2|3 && 4|5 && 6|7: -0.047 seconds - int dcterm = d[0]*4; - v[0] = v[8] = v[16] = v[24] = v[32] = v[40] = v[48] = v[56] = dcterm; - } else { - STBI__IDCT_1D(d[ 0],d[ 8],d[16],d[24],d[32],d[40],d[48],d[56]) - // constants scaled things up by 1<<12; let's bring them back - // down, but keep 2 extra bits of precision - x0 += 512; x1 += 512; x2 += 512; x3 += 512; - v[ 0] = (x0+t3) >> 10; - v[56] = (x0-t3) >> 10; - v[ 8] = (x1+t2) >> 10; - v[48] = (x1-t2) >> 10; - v[16] = (x2+t1) >> 10; - v[40] = (x2-t1) >> 10; - v[24] = (x3+t0) >> 10; - v[32] = (x3-t0) >> 10; - } - } - - for (i=0, v=val, o=out; i < 8; ++i,v+=8,o+=out_stride) { - // no fast case since the first 1D IDCT spread components out - STBI__IDCT_1D(v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7]) - // constants scaled things up by 1<<12, plus we had 1<<2 from first - // loop, plus horizontal and vertical each scale by sqrt(8) so together - // we've got an extra 1<<3, so 1<<17 total we need to remove. - // so we want to round that, which means adding 0.5 * 1<<17, - // aka 65536. Also, we'll end up with -128 to 127 that we want - // to encode as 0..255 by adding 128, so we'll add that before the shift - x0 += 65536 + (128<<17); - x1 += 65536 + (128<<17); - x2 += 65536 + (128<<17); - x3 += 65536 + (128<<17); - // tried computing the shifts into temps, or'ing the temps to see - // if any were out of range, but that was slower - o[0] = stbi__clamp((x0+t3) >> 17); - o[7] = stbi__clamp((x0-t3) >> 17); - o[1] = stbi__clamp((x1+t2) >> 17); - o[6] = stbi__clamp((x1-t2) >> 17); - o[2] = stbi__clamp((x2+t1) >> 17); - o[5] = stbi__clamp((x2-t1) >> 17); - o[3] = stbi__clamp((x3+t0) >> 17); - o[4] = stbi__clamp((x3-t0) >> 17); - } -} - -#ifdef STBI_SSE2 -// sse2 integer IDCT. not the fastest possible implementation but it -// produces bit-identical results to the generic C version so it's -// fully "transparent". -static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64]) -{ - // This is constructed to match our regular (generic) integer IDCT exactly. - __m128i row0, row1, row2, row3, row4, row5, row6, row7; - __m128i tmp; - - // dot product constant: even elems=x, odd elems=y - #define dct_const(x,y) _mm_setr_epi16((x),(y),(x),(y),(x),(y),(x),(y)) - - // out(0) = c0[even]*x + c0[odd]*y (c0, x, y 16-bit, out 32-bit) - // out(1) = c1[even]*x + c1[odd]*y - #define dct_rot(out0,out1, x,y,c0,c1) \ - __m128i c0##lo = _mm_unpacklo_epi16((x),(y)); \ - __m128i c0##hi = _mm_unpackhi_epi16((x),(y)); \ - __m128i out0##_l = _mm_madd_epi16(c0##lo, c0); \ - __m128i out0##_h = _mm_madd_epi16(c0##hi, c0); \ - __m128i out1##_l = _mm_madd_epi16(c0##lo, c1); \ - __m128i out1##_h = _mm_madd_epi16(c0##hi, c1) - - // out = in << 12 (in 16-bit, out 32-bit) - #define dct_widen(out, in) \ - __m128i out##_l = _mm_srai_epi32(_mm_unpacklo_epi16(_mm_setzero_si128(), (in)), 4); \ - __m128i out##_h = _mm_srai_epi32(_mm_unpackhi_epi16(_mm_setzero_si128(), (in)), 4) - - // wide add - #define dct_wadd(out, a, b) \ - __m128i out##_l = _mm_add_epi32(a##_l, b##_l); \ - __m128i out##_h = _mm_add_epi32(a##_h, b##_h) - - // wide sub - #define dct_wsub(out, a, b) \ - __m128i out##_l = _mm_sub_epi32(a##_l, b##_l); \ - __m128i out##_h = _mm_sub_epi32(a##_h, b##_h) - - // butterfly a/b, add bias, then shift by "s" and pack - #define dct_bfly32o(out0, out1, a,b,bias,s) \ - { \ - __m128i abiased_l = _mm_add_epi32(a##_l, bias); \ - __m128i abiased_h = _mm_add_epi32(a##_h, bias); \ - dct_wadd(sum, abiased, b); \ - dct_wsub(dif, abiased, b); \ - out0 = _mm_packs_epi32(_mm_srai_epi32(sum_l, s), _mm_srai_epi32(sum_h, s)); \ - out1 = _mm_packs_epi32(_mm_srai_epi32(dif_l, s), _mm_srai_epi32(dif_h, s)); \ - } - - // 8-bit interleave step (for transposes) - #define dct_interleave8(a, b) \ - tmp = a; \ - a = _mm_unpacklo_epi8(a, b); \ - b = _mm_unpackhi_epi8(tmp, b) - - // 16-bit interleave step (for transposes) - #define dct_interleave16(a, b) \ - tmp = a; \ - a = _mm_unpacklo_epi16(a, b); \ - b = _mm_unpackhi_epi16(tmp, b) - - #define dct_pass(bias,shift) \ - { \ - /* even part */ \ - dct_rot(t2e,t3e, row2,row6, rot0_0,rot0_1); \ - __m128i sum04 = _mm_add_epi16(row0, row4); \ - __m128i dif04 = _mm_sub_epi16(row0, row4); \ - dct_widen(t0e, sum04); \ - dct_widen(t1e, dif04); \ - dct_wadd(x0, t0e, t3e); \ - dct_wsub(x3, t0e, t3e); \ - dct_wadd(x1, t1e, t2e); \ - dct_wsub(x2, t1e, t2e); \ - /* odd part */ \ - dct_rot(y0o,y2o, row7,row3, rot2_0,rot2_1); \ - dct_rot(y1o,y3o, row5,row1, rot3_0,rot3_1); \ - __m128i sum17 = _mm_add_epi16(row1, row7); \ - __m128i sum35 = _mm_add_epi16(row3, row5); \ - dct_rot(y4o,y5o, sum17,sum35, rot1_0,rot1_1); \ - dct_wadd(x4, y0o, y4o); \ - dct_wadd(x5, y1o, y5o); \ - dct_wadd(x6, y2o, y5o); \ - dct_wadd(x7, y3o, y4o); \ - dct_bfly32o(row0,row7, x0,x7,bias,shift); \ - dct_bfly32o(row1,row6, x1,x6,bias,shift); \ - dct_bfly32o(row2,row5, x2,x5,bias,shift); \ - dct_bfly32o(row3,row4, x3,x4,bias,shift); \ - } - - __m128i rot0_0 = dct_const(stbi__f2f(0.5411961f), stbi__f2f(0.5411961f) + stbi__f2f(-1.847759065f)); - __m128i rot0_1 = dct_const(stbi__f2f(0.5411961f) + stbi__f2f( 0.765366865f), stbi__f2f(0.5411961f)); - __m128i rot1_0 = dct_const(stbi__f2f(1.175875602f) + stbi__f2f(-0.899976223f), stbi__f2f(1.175875602f)); - __m128i rot1_1 = dct_const(stbi__f2f(1.175875602f), stbi__f2f(1.175875602f) + stbi__f2f(-2.562915447f)); - __m128i rot2_0 = dct_const(stbi__f2f(-1.961570560f) + stbi__f2f( 0.298631336f), stbi__f2f(-1.961570560f)); - __m128i rot2_1 = dct_const(stbi__f2f(-1.961570560f), stbi__f2f(-1.961570560f) + stbi__f2f( 3.072711026f)); - __m128i rot3_0 = dct_const(stbi__f2f(-0.390180644f) + stbi__f2f( 2.053119869f), stbi__f2f(-0.390180644f)); - __m128i rot3_1 = dct_const(stbi__f2f(-0.390180644f), stbi__f2f(-0.390180644f) + stbi__f2f( 1.501321110f)); - - // rounding biases in column/row passes, see stbi__idct_block for explanation. - __m128i bias_0 = _mm_set1_epi32(512); - __m128i bias_1 = _mm_set1_epi32(65536 + (128<<17)); - - // load - row0 = _mm_load_si128((const __m128i *) (data + 0*8)); - row1 = _mm_load_si128((const __m128i *) (data + 1*8)); - row2 = _mm_load_si128((const __m128i *) (data + 2*8)); - row3 = _mm_load_si128((const __m128i *) (data + 3*8)); - row4 = _mm_load_si128((const __m128i *) (data + 4*8)); - row5 = _mm_load_si128((const __m128i *) (data + 5*8)); - row6 = _mm_load_si128((const __m128i *) (data + 6*8)); - row7 = _mm_load_si128((const __m128i *) (data + 7*8)); - - // column pass - dct_pass(bias_0, 10); - - { - // 16bit 8x8 transpose pass 1 - dct_interleave16(row0, row4); - dct_interleave16(row1, row5); - dct_interleave16(row2, row6); - dct_interleave16(row3, row7); - - // transpose pass 2 - dct_interleave16(row0, row2); - dct_interleave16(row1, row3); - dct_interleave16(row4, row6); - dct_interleave16(row5, row7); - - // transpose pass 3 - dct_interleave16(row0, row1); - dct_interleave16(row2, row3); - dct_interleave16(row4, row5); - dct_interleave16(row6, row7); - } - - // row pass - dct_pass(bias_1, 17); - - { - // pack - __m128i p0 = _mm_packus_epi16(row0, row1); // a0a1a2a3...a7b0b1b2b3...b7 - __m128i p1 = _mm_packus_epi16(row2, row3); - __m128i p2 = _mm_packus_epi16(row4, row5); - __m128i p3 = _mm_packus_epi16(row6, row7); - - // 8bit 8x8 transpose pass 1 - dct_interleave8(p0, p2); // a0e0a1e1... - dct_interleave8(p1, p3); // c0g0c1g1... - - // transpose pass 2 - dct_interleave8(p0, p1); // a0c0e0g0... - dct_interleave8(p2, p3); // b0d0f0h0... - - // transpose pass 3 - dct_interleave8(p0, p2); // a0b0c0d0... - dct_interleave8(p1, p3); // a4b4c4d4... - - // store - _mm_storel_epi64((__m128i *) out, p0); out += out_stride; - _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p0, 0x4e)); out += out_stride; - _mm_storel_epi64((__m128i *) out, p2); out += out_stride; - _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p2, 0x4e)); out += out_stride; - _mm_storel_epi64((__m128i *) out, p1); out += out_stride; - _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p1, 0x4e)); out += out_stride; - _mm_storel_epi64((__m128i *) out, p3); out += out_stride; - _mm_storel_epi64((__m128i *) out, _mm_shuffle_epi32(p3, 0x4e)); - } - -#undef dct_const -#undef dct_rot -#undef dct_widen -#undef dct_wadd -#undef dct_wsub -#undef dct_bfly32o -#undef dct_interleave8 -#undef dct_interleave16 -#undef dct_pass -} - -#endif // STBI_SSE2 - -#ifdef STBI_NEON - -// NEON integer IDCT. should produce bit-identical -// results to the generic C version. -static void stbi__idct_simd(stbi_uc *out, int out_stride, short data[64]) -{ - int16x8_t row0, row1, row2, row3, row4, row5, row6, row7; - - int16x4_t rot0_0 = vdup_n_s16(stbi__f2f(0.5411961f)); - int16x4_t rot0_1 = vdup_n_s16(stbi__f2f(-1.847759065f)); - int16x4_t rot0_2 = vdup_n_s16(stbi__f2f( 0.765366865f)); - int16x4_t rot1_0 = vdup_n_s16(stbi__f2f( 1.175875602f)); - int16x4_t rot1_1 = vdup_n_s16(stbi__f2f(-0.899976223f)); - int16x4_t rot1_2 = vdup_n_s16(stbi__f2f(-2.562915447f)); - int16x4_t rot2_0 = vdup_n_s16(stbi__f2f(-1.961570560f)); - int16x4_t rot2_1 = vdup_n_s16(stbi__f2f(-0.390180644f)); - int16x4_t rot3_0 = vdup_n_s16(stbi__f2f( 0.298631336f)); - int16x4_t rot3_1 = vdup_n_s16(stbi__f2f( 2.053119869f)); - int16x4_t rot3_2 = vdup_n_s16(stbi__f2f( 3.072711026f)); - int16x4_t rot3_3 = vdup_n_s16(stbi__f2f( 1.501321110f)); - -#define dct_long_mul(out, inq, coeff) \ - int32x4_t out##_l = vmull_s16(vget_low_s16(inq), coeff); \ - int32x4_t out##_h = vmull_s16(vget_high_s16(inq), coeff) - -#define dct_long_mac(out, acc, inq, coeff) \ - int32x4_t out##_l = vmlal_s16(acc##_l, vget_low_s16(inq), coeff); \ - int32x4_t out##_h = vmlal_s16(acc##_h, vget_high_s16(inq), coeff) - -#define dct_widen(out, inq) \ - int32x4_t out##_l = vshll_n_s16(vget_low_s16(inq), 12); \ - int32x4_t out##_h = vshll_n_s16(vget_high_s16(inq), 12) - -// wide add -#define dct_wadd(out, a, b) \ - int32x4_t out##_l = vaddq_s32(a##_l, b##_l); \ - int32x4_t out##_h = vaddq_s32(a##_h, b##_h) - -// wide sub -#define dct_wsub(out, a, b) \ - int32x4_t out##_l = vsubq_s32(a##_l, b##_l); \ - int32x4_t out##_h = vsubq_s32(a##_h, b##_h) - -// butterfly a/b, then shift using "shiftop" by "s" and pack -#define dct_bfly32o(out0,out1, a,b,shiftop,s) \ - { \ - dct_wadd(sum, a, b); \ - dct_wsub(dif, a, b); \ - out0 = vcombine_s16(shiftop(sum_l, s), shiftop(sum_h, s)); \ - out1 = vcombine_s16(shiftop(dif_l, s), shiftop(dif_h, s)); \ - } - -#define dct_pass(shiftop, shift) \ - { \ - /* even part */ \ - int16x8_t sum26 = vaddq_s16(row2, row6); \ - dct_long_mul(p1e, sum26, rot0_0); \ - dct_long_mac(t2e, p1e, row6, rot0_1); \ - dct_long_mac(t3e, p1e, row2, rot0_2); \ - int16x8_t sum04 = vaddq_s16(row0, row4); \ - int16x8_t dif04 = vsubq_s16(row0, row4); \ - dct_widen(t0e, sum04); \ - dct_widen(t1e, dif04); \ - dct_wadd(x0, t0e, t3e); \ - dct_wsub(x3, t0e, t3e); \ - dct_wadd(x1, t1e, t2e); \ - dct_wsub(x2, t1e, t2e); \ - /* odd part */ \ - int16x8_t sum15 = vaddq_s16(row1, row5); \ - int16x8_t sum17 = vaddq_s16(row1, row7); \ - int16x8_t sum35 = vaddq_s16(row3, row5); \ - int16x8_t sum37 = vaddq_s16(row3, row7); \ - int16x8_t sumodd = vaddq_s16(sum17, sum35); \ - dct_long_mul(p5o, sumodd, rot1_0); \ - dct_long_mac(p1o, p5o, sum17, rot1_1); \ - dct_long_mac(p2o, p5o, sum35, rot1_2); \ - dct_long_mul(p3o, sum37, rot2_0); \ - dct_long_mul(p4o, sum15, rot2_1); \ - dct_wadd(sump13o, p1o, p3o); \ - dct_wadd(sump24o, p2o, p4o); \ - dct_wadd(sump23o, p2o, p3o); \ - dct_wadd(sump14o, p1o, p4o); \ - dct_long_mac(x4, sump13o, row7, rot3_0); \ - dct_long_mac(x5, sump24o, row5, rot3_1); \ - dct_long_mac(x6, sump23o, row3, rot3_2); \ - dct_long_mac(x7, sump14o, row1, rot3_3); \ - dct_bfly32o(row0,row7, x0,x7,shiftop,shift); \ - dct_bfly32o(row1,row6, x1,x6,shiftop,shift); \ - dct_bfly32o(row2,row5, x2,x5,shiftop,shift); \ - dct_bfly32o(row3,row4, x3,x4,shiftop,shift); \ - } - - // load - row0 = vld1q_s16(data + 0*8); - row1 = vld1q_s16(data + 1*8); - row2 = vld1q_s16(data + 2*8); - row3 = vld1q_s16(data + 3*8); - row4 = vld1q_s16(data + 4*8); - row5 = vld1q_s16(data + 5*8); - row6 = vld1q_s16(data + 6*8); - row7 = vld1q_s16(data + 7*8); - - // add DC bias - row0 = vaddq_s16(row0, vsetq_lane_s16(1024, vdupq_n_s16(0), 0)); - - // column pass - dct_pass(vrshrn_n_s32, 10); - - // 16bit 8x8 transpose - { -// these three map to a single VTRN.16, VTRN.32, and VSWP, respectively. -// whether compilers actually get this is another story, sadly. -#define dct_trn16(x, y) { int16x8x2_t t = vtrnq_s16(x, y); x = t.val[0]; y = t.val[1]; } -#define dct_trn32(x, y) { int32x4x2_t t = vtrnq_s32(vreinterpretq_s32_s16(x), vreinterpretq_s32_s16(y)); x = vreinterpretq_s16_s32(t.val[0]); y = vreinterpretq_s16_s32(t.val[1]); } -#define dct_trn64(x, y) { int16x8_t x0 = x; int16x8_t y0 = y; x = vcombine_s16(vget_low_s16(x0), vget_low_s16(y0)); y = vcombine_s16(vget_high_s16(x0), vget_high_s16(y0)); } - - // pass 1 - dct_trn16(row0, row1); // a0b0a2b2a4b4a6b6 - dct_trn16(row2, row3); - dct_trn16(row4, row5); - dct_trn16(row6, row7); - - // pass 2 - dct_trn32(row0, row2); // a0b0c0d0a4b4c4d4 - dct_trn32(row1, row3); - dct_trn32(row4, row6); - dct_trn32(row5, row7); - - // pass 3 - dct_trn64(row0, row4); // a0b0c0d0e0f0g0h0 - dct_trn64(row1, row5); - dct_trn64(row2, row6); - dct_trn64(row3, row7); - -#undef dct_trn16 -#undef dct_trn32 -#undef dct_trn64 - } - - // row pass - // vrshrn_n_s32 only supports shifts up to 16, we need - // 17. so do a non-rounding shift of 16 first then follow - // up with a rounding shift by 1. - dct_pass(vshrn_n_s32, 16); - - { - // pack and round - uint8x8_t p0 = vqrshrun_n_s16(row0, 1); - uint8x8_t p1 = vqrshrun_n_s16(row1, 1); - uint8x8_t p2 = vqrshrun_n_s16(row2, 1); - uint8x8_t p3 = vqrshrun_n_s16(row3, 1); - uint8x8_t p4 = vqrshrun_n_s16(row4, 1); - uint8x8_t p5 = vqrshrun_n_s16(row5, 1); - uint8x8_t p6 = vqrshrun_n_s16(row6, 1); - uint8x8_t p7 = vqrshrun_n_s16(row7, 1); - - // again, these can translate into one instruction, but often don't. -#define dct_trn8_8(x, y) { uint8x8x2_t t = vtrn_u8(x, y); x = t.val[0]; y = t.val[1]; } -#define dct_trn8_16(x, y) { uint16x4x2_t t = vtrn_u16(vreinterpret_u16_u8(x), vreinterpret_u16_u8(y)); x = vreinterpret_u8_u16(t.val[0]); y = vreinterpret_u8_u16(t.val[1]); } -#define dct_trn8_32(x, y) { uint32x2x2_t t = vtrn_u32(vreinterpret_u32_u8(x), vreinterpret_u32_u8(y)); x = vreinterpret_u8_u32(t.val[0]); y = vreinterpret_u8_u32(t.val[1]); } - - // sadly can't use interleaved stores here since we only write - // 8 bytes to each scan line! - - // 8x8 8-bit transpose pass 1 - dct_trn8_8(p0, p1); - dct_trn8_8(p2, p3); - dct_trn8_8(p4, p5); - dct_trn8_8(p6, p7); - - // pass 2 - dct_trn8_16(p0, p2); - dct_trn8_16(p1, p3); - dct_trn8_16(p4, p6); - dct_trn8_16(p5, p7); - - // pass 3 - dct_trn8_32(p0, p4); - dct_trn8_32(p1, p5); - dct_trn8_32(p2, p6); - dct_trn8_32(p3, p7); - - // store - vst1_u8(out, p0); out += out_stride; - vst1_u8(out, p1); out += out_stride; - vst1_u8(out, p2); out += out_stride; - vst1_u8(out, p3); out += out_stride; - vst1_u8(out, p4); out += out_stride; - vst1_u8(out, p5); out += out_stride; - vst1_u8(out, p6); out += out_stride; - vst1_u8(out, p7); - -#undef dct_trn8_8 -#undef dct_trn8_16 -#undef dct_trn8_32 - } - -#undef dct_long_mul -#undef dct_long_mac -#undef dct_widen -#undef dct_wadd -#undef dct_wsub -#undef dct_bfly32o -#undef dct_pass -} - -#endif // STBI_NEON - -#define STBI__MARKER_none 0xff -// if there's a pending marker from the entropy stream, return that -// otherwise, fetch from the stream and get a marker. if there's no -// marker, return 0xff, which is never a valid marker value -static stbi_uc stbi__get_marker(stbi__jpeg *j) -{ - stbi_uc x; - if (j->marker != STBI__MARKER_none) { x = j->marker; j->marker = STBI__MARKER_none; return x; } - x = stbi__get8(j->s); - if (x != 0xff) return STBI__MARKER_none; - while (x == 0xff) - x = stbi__get8(j->s); // consume repeated 0xff fill bytes - return x; -} - -// in each scan, we'll have scan_n components, and the order -// of the components is specified by order[] -#define STBI__RESTART(x) ((x) >= 0xd0 && (x) <= 0xd7) - -// after a restart interval, stbi__jpeg_reset the entropy decoder and -// the dc prediction -static void stbi__jpeg_reset(stbi__jpeg *j) -{ - j->code_bits = 0; - j->code_buffer = 0; - j->nomore = 0; - j->img_comp[0].dc_pred = j->img_comp[1].dc_pred = j->img_comp[2].dc_pred = j->img_comp[3].dc_pred = 0; - j->marker = STBI__MARKER_none; - j->todo = j->restart_interval ? j->restart_interval : 0x7fffffff; - j->eob_run = 0; - // no more than 1<<31 MCUs if no restart_interal? that's plenty safe, - // since we don't even allow 1<<30 pixels -} - -static int stbi__parse_entropy_coded_data(stbi__jpeg *z) -{ - stbi__jpeg_reset(z); - if (!z->progressive) { - if (z->scan_n == 1) { - int i,j; - STBI_SIMD_ALIGN(short, data[64]); - int n = z->order[0]; - // non-interleaved data, we just need to process one block at a time, - // in trivial scanline order - // number of blocks to do just depends on how many actual "pixels" this - // component has, independent of interleaved MCU blocking and such - int w = (z->img_comp[n].x+7) >> 3; - int h = (z->img_comp[n].y+7) >> 3; - for (j=0; j < h; ++j) { - for (i=0; i < w; ++i) { - int ha = z->img_comp[n].ha; - if (!stbi__jpeg_decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+ha, z->fast_ac[ha], n, z->dequant[z->img_comp[n].tq])) return 0; - z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data); - // every data block is an MCU, so countdown the restart interval - if (--z->todo <= 0) { - if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); - // if it's NOT a restart, then just bail, so we get corrupt data - // rather than no data - if (!STBI__RESTART(z->marker)) return 1; - stbi__jpeg_reset(z); - } - } - } - return 1; - } else { // interleaved - int i,j,k,x,y; - STBI_SIMD_ALIGN(short, data[64]); - for (j=0; j < z->img_mcu_y; ++j) { - for (i=0; i < z->img_mcu_x; ++i) { - // scan an interleaved mcu... process scan_n components in order - for (k=0; k < z->scan_n; ++k) { - int n = z->order[k]; - // scan out an mcu's worth of this component; that's just determined - // by the basic H and V specified for the component - for (y=0; y < z->img_comp[n].v; ++y) { - for (x=0; x < z->img_comp[n].h; ++x) { - int x2 = (i*z->img_comp[n].h + x)*8; - int y2 = (j*z->img_comp[n].v + y)*8; - int ha = z->img_comp[n].ha; - if (!stbi__jpeg_decode_block(z, data, z->huff_dc+z->img_comp[n].hd, z->huff_ac+ha, z->fast_ac[ha], n, z->dequant[z->img_comp[n].tq])) return 0; - z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*y2+x2, z->img_comp[n].w2, data); - } - } - } - // after all interleaved components, that's an interleaved MCU, - // so now count down the restart interval - if (--z->todo <= 0) { - if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); - if (!STBI__RESTART(z->marker)) return 1; - stbi__jpeg_reset(z); - } - } - } - return 1; - } - } else { - if (z->scan_n == 1) { - int i,j; - int n = z->order[0]; - // non-interleaved data, we just need to process one block at a time, - // in trivial scanline order - // number of blocks to do just depends on how many actual "pixels" this - // component has, independent of interleaved MCU blocking and such - int w = (z->img_comp[n].x+7) >> 3; - int h = (z->img_comp[n].y+7) >> 3; - for (j=0; j < h; ++j) { - for (i=0; i < w; ++i) { - short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w); - if (z->spec_start == 0) { - if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n)) - return 0; - } else { - int ha = z->img_comp[n].ha; - if (!stbi__jpeg_decode_block_prog_ac(z, data, &z->huff_ac[ha], z->fast_ac[ha])) - return 0; - } - // every data block is an MCU, so countdown the restart interval - if (--z->todo <= 0) { - if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); - if (!STBI__RESTART(z->marker)) return 1; - stbi__jpeg_reset(z); - } - } - } - return 1; - } else { // interleaved - int i,j,k,x,y; - for (j=0; j < z->img_mcu_y; ++j) { - for (i=0; i < z->img_mcu_x; ++i) { - // scan an interleaved mcu... process scan_n components in order - for (k=0; k < z->scan_n; ++k) { - int n = z->order[k]; - // scan out an mcu's worth of this component; that's just determined - // by the basic H and V specified for the component - for (y=0; y < z->img_comp[n].v; ++y) { - for (x=0; x < z->img_comp[n].h; ++x) { - int x2 = (i*z->img_comp[n].h + x); - int y2 = (j*z->img_comp[n].v + y); - short *data = z->img_comp[n].coeff + 64 * (x2 + y2 * z->img_comp[n].coeff_w); - if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n)) - return 0; - } - } - } - // after all interleaved components, that's an interleaved MCU, - // so now count down the restart interval - if (--z->todo <= 0) { - if (z->code_bits < 24) stbi__grow_buffer_unsafe(z); - if (!STBI__RESTART(z->marker)) return 1; - stbi__jpeg_reset(z); - } - } - } - return 1; - } - } -} - -static void stbi__jpeg_dequantize(short *data, stbi__uint16 *dequant) -{ - int i; - for (i=0; i < 64; ++i) - data[i] *= dequant[i]; -} - -static void stbi__jpeg_finish(stbi__jpeg *z) -{ - if (z->progressive) { - // dequantize and idct the data - int i,j,n; - for (n=0; n < z->s->img_n; ++n) { - int w = (z->img_comp[n].x+7) >> 3; - int h = (z->img_comp[n].y+7) >> 3; - for (j=0; j < h; ++j) { - for (i=0; i < w; ++i) { - short *data = z->img_comp[n].coeff + 64 * (i + j * z->img_comp[n].coeff_w); - stbi__jpeg_dequantize(data, z->dequant[z->img_comp[n].tq]); - z->idct_block_kernel(z->img_comp[n].data+z->img_comp[n].w2*j*8+i*8, z->img_comp[n].w2, data); - } - } - } - } -} - -static int stbi__process_marker(stbi__jpeg *z, int m) -{ - int L; - switch (m) { - case STBI__MARKER_none: // no marker found - return stbi__err("expected marker","Corrupt JPEG"); - - case 0xDD: // DRI - specify restart interval - if (stbi__get16be(z->s) != 4) return stbi__err("bad DRI len","Corrupt JPEG"); - z->restart_interval = stbi__get16be(z->s); - return 1; - - case 0xDB: // DQT - define quantization table - L = stbi__get16be(z->s)-2; - while (L > 0) { - int q = stbi__get8(z->s); - int p = q >> 4, sixteen = (p != 0); - int t = q & 15,i; - if (p != 0 && p != 1) return stbi__err("bad DQT type","Corrupt JPEG"); - if (t > 3) return stbi__err("bad DQT table","Corrupt JPEG"); - - for (i=0; i < 64; ++i) - z->dequant[t][stbi__jpeg_dezigzag[i]] = (stbi__uint16)(sixteen ? stbi__get16be(z->s) : stbi__get8(z->s)); - L -= (sixteen ? 129 : 65); - } - return L==0; - - case 0xC4: // DHT - define huffman table - L = stbi__get16be(z->s)-2; - while (L > 0) { - stbi_uc *v; - int sizes[16],i,n=0; - int q = stbi__get8(z->s); - int tc = q >> 4; - int th = q & 15; - if (tc > 1 || th > 3) return stbi__err("bad DHT header","Corrupt JPEG"); - for (i=0; i < 16; ++i) { - sizes[i] = stbi__get8(z->s); - n += sizes[i]; - } - L -= 17; - if (tc == 0) { - if (!stbi__build_huffman(z->huff_dc+th, sizes)) return 0; - v = z->huff_dc[th].values; - } else { - if (!stbi__build_huffman(z->huff_ac+th, sizes)) return 0; - v = z->huff_ac[th].values; - } - for (i=0; i < n; ++i) - v[i] = stbi__get8(z->s); - if (tc != 0) - stbi__build_fast_ac(z->fast_ac[th], z->huff_ac + th); - L -= n; - } - return L==0; - } - - // check for comment block or APP blocks - if ((m >= 0xE0 && m <= 0xEF) || m == 0xFE) { - L = stbi__get16be(z->s); - if (L < 2) { - if (m == 0xFE) - return stbi__err("bad COM len","Corrupt JPEG"); - else - return stbi__err("bad APP len","Corrupt JPEG"); - } - L -= 2; - - if (m == 0xE0 && L >= 5) { // JFIF APP0 segment - static const unsigned char tag[5] = {'J','F','I','F','\0'}; - int ok = 1; - int i; - for (i=0; i < 5; ++i) - if (stbi__get8(z->s) != tag[i]) - ok = 0; - L -= 5; - if (ok) - z->jfif = 1; - } else if (m == 0xEE && L >= 12) { // Adobe APP14 segment - static const unsigned char tag[6] = {'A','d','o','b','e','\0'}; - int ok = 1; - int i; - for (i=0; i < 6; ++i) - if (stbi__get8(z->s) != tag[i]) - ok = 0; - L -= 6; - if (ok) { - stbi__get8(z->s); // version - stbi__get16be(z->s); // flags0 - stbi__get16be(z->s); // flags1 - z->app14_color_transform = stbi__get8(z->s); // color transform - L -= 6; - } - } - - stbi__skip(z->s, L); - return 1; - } - - return stbi__err("unknown marker","Corrupt JPEG"); -} - -// after we see SOS -static int stbi__process_scan_header(stbi__jpeg *z) -{ - int i; - int Ls = stbi__get16be(z->s); - z->scan_n = stbi__get8(z->s); - if (z->scan_n < 1 || z->scan_n > 4 || z->scan_n > (int) z->s->img_n) return stbi__err("bad SOS component count","Corrupt JPEG"); - if (Ls != 6+2*z->scan_n) return stbi__err("bad SOS len","Corrupt JPEG"); - for (i=0; i < z->scan_n; ++i) { - int id = stbi__get8(z->s), which; - int q = stbi__get8(z->s); - for (which = 0; which < z->s->img_n; ++which) - if (z->img_comp[which].id == id) - break; - if (which == z->s->img_n) return 0; // no match - z->img_comp[which].hd = q >> 4; if (z->img_comp[which].hd > 3) return stbi__err("bad DC huff","Corrupt JPEG"); - z->img_comp[which].ha = q & 15; if (z->img_comp[which].ha > 3) return stbi__err("bad AC huff","Corrupt JPEG"); - z->order[i] = which; - } - - { - int aa; - z->spec_start = stbi__get8(z->s); - z->spec_end = stbi__get8(z->s); // should be 63, but might be 0 - aa = stbi__get8(z->s); - z->succ_high = (aa >> 4); - z->succ_low = (aa & 15); - if (z->progressive) { - if (z->spec_start > 63 || z->spec_end > 63 || z->spec_start > z->spec_end || z->succ_high > 13 || z->succ_low > 13) - return stbi__err("bad SOS", "Corrupt JPEG"); - } else { - if (z->spec_start != 0) return stbi__err("bad SOS","Corrupt JPEG"); - if (z->succ_high != 0 || z->succ_low != 0) return stbi__err("bad SOS","Corrupt JPEG"); - z->spec_end = 63; - } - } - - return 1; -} - -static int stbi__free_jpeg_components(stbi__jpeg *z, int ncomp, int why) -{ - int i; - for (i=0; i < ncomp; ++i) { - if (z->img_comp[i].raw_data) { - STBI_FREE(z->img_comp[i].raw_data); - z->img_comp[i].raw_data = NULL; - z->img_comp[i].data = NULL; - } - if (z->img_comp[i].raw_coeff) { - STBI_FREE(z->img_comp[i].raw_coeff); - z->img_comp[i].raw_coeff = 0; - z->img_comp[i].coeff = 0; - } - if (z->img_comp[i].linebuf) { - STBI_FREE(z->img_comp[i].linebuf); - z->img_comp[i].linebuf = NULL; - } - } - return why; -} - -static int stbi__process_frame_header(stbi__jpeg *z, int scan) -{ - stbi__context *s = z->s; - int Lf,p,i,q, h_max=1,v_max=1,c; - Lf = stbi__get16be(s); if (Lf < 11) return stbi__err("bad SOF len","Corrupt JPEG"); // JPEG - p = stbi__get8(s); if (p != 8) return stbi__err("only 8-bit","JPEG format not supported: 8-bit only"); // JPEG baseline - s->img_y = stbi__get16be(s); if (s->img_y == 0) return stbi__err("no header height", "JPEG format not supported: delayed height"); // Legal, but we don't handle it--but neither does IJG - s->img_x = stbi__get16be(s); if (s->img_x == 0) return stbi__err("0 width","Corrupt JPEG"); // JPEG requires - if (s->img_y > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); - if (s->img_x > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); - c = stbi__get8(s); - if (c != 3 && c != 1 && c != 4) return stbi__err("bad component count","Corrupt JPEG"); - s->img_n = c; - for (i=0; i < c; ++i) { - z->img_comp[i].data = NULL; - z->img_comp[i].linebuf = NULL; - } - - if (Lf != 8+3*s->img_n) return stbi__err("bad SOF len","Corrupt JPEG"); - - z->rgb = 0; - for (i=0; i < s->img_n; ++i) { - static const unsigned char rgb[3] = { 'R', 'G', 'B' }; - z->img_comp[i].id = stbi__get8(s); - if (s->img_n == 3 && z->img_comp[i].id == rgb[i]) - ++z->rgb; - q = stbi__get8(s); - z->img_comp[i].h = (q >> 4); if (!z->img_comp[i].h || z->img_comp[i].h > 4) return stbi__err("bad H","Corrupt JPEG"); - z->img_comp[i].v = q & 15; if (!z->img_comp[i].v || z->img_comp[i].v > 4) return stbi__err("bad V","Corrupt JPEG"); - z->img_comp[i].tq = stbi__get8(s); if (z->img_comp[i].tq > 3) return stbi__err("bad TQ","Corrupt JPEG"); - } - - if (scan != STBI__SCAN_load) return 1; - - if (!stbi__mad3sizes_valid(s->img_x, s->img_y, s->img_n, 0)) return stbi__err("too large", "Image too large to decode"); - - for (i=0; i < s->img_n; ++i) { - if (z->img_comp[i].h > h_max) h_max = z->img_comp[i].h; - if (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v; - } - - // check that plane subsampling factors are integer ratios; our resamplers can't deal with fractional ratios - // and I've never seen a non-corrupted JPEG file actually use them - for (i=0; i < s->img_n; ++i) { - if (h_max % z->img_comp[i].h != 0) return stbi__err("bad H","Corrupt JPEG"); - if (v_max % z->img_comp[i].v != 0) return stbi__err("bad V","Corrupt JPEG"); - } - - // compute interleaved mcu info - z->img_h_max = h_max; - z->img_v_max = v_max; - z->img_mcu_w = h_max * 8; - z->img_mcu_h = v_max * 8; - // these sizes can't be more than 17 bits - z->img_mcu_x = (s->img_x + z->img_mcu_w-1) / z->img_mcu_w; - z->img_mcu_y = (s->img_y + z->img_mcu_h-1) / z->img_mcu_h; - - for (i=0; i < s->img_n; ++i) { - // number of effective pixels (e.g. for non-interleaved MCU) - z->img_comp[i].x = (s->img_x * z->img_comp[i].h + h_max-1) / h_max; - z->img_comp[i].y = (s->img_y * z->img_comp[i].v + v_max-1) / v_max; - // to simplify generation, we'll allocate enough memory to decode - // the bogus oversized data from using interleaved MCUs and their - // big blocks (e.g. a 16x16 iMCU on an image of width 33); we won't - // discard the extra data until colorspace conversion - // - // img_mcu_x, img_mcu_y: <=17 bits; comp[i].h and .v are <=4 (checked earlier) - // so these muls can't overflow with 32-bit ints (which we require) - z->img_comp[i].w2 = z->img_mcu_x * z->img_comp[i].h * 8; - z->img_comp[i].h2 = z->img_mcu_y * z->img_comp[i].v * 8; - z->img_comp[i].coeff = 0; - z->img_comp[i].raw_coeff = 0; - z->img_comp[i].linebuf = NULL; - z->img_comp[i].raw_data = stbi__malloc_mad2(z->img_comp[i].w2, z->img_comp[i].h2, 15); - if (z->img_comp[i].raw_data == NULL) - return stbi__free_jpeg_components(z, i+1, stbi__err("outofmem", "Out of memory")); - // align blocks for idct using mmx/sse - z->img_comp[i].data = (stbi_uc*) (((size_t) z->img_comp[i].raw_data + 15) & ~15); - if (z->progressive) { - // w2, h2 are multiples of 8 (see above) - z->img_comp[i].coeff_w = z->img_comp[i].w2 / 8; - z->img_comp[i].coeff_h = z->img_comp[i].h2 / 8; - z->img_comp[i].raw_coeff = stbi__malloc_mad3(z->img_comp[i].w2, z->img_comp[i].h2, sizeof(short), 15); - if (z->img_comp[i].raw_coeff == NULL) - return stbi__free_jpeg_components(z, i+1, stbi__err("outofmem", "Out of memory")); - z->img_comp[i].coeff = (short*) (((size_t) z->img_comp[i].raw_coeff + 15) & ~15); - } - } - - return 1; -} - -// use comparisons since in some cases we handle more than one case (e.g. SOF) -#define stbi__DNL(x) ((x) == 0xdc) -#define stbi__SOI(x) ((x) == 0xd8) -#define stbi__EOI(x) ((x) == 0xd9) -#define stbi__SOF(x) ((x) == 0xc0 || (x) == 0xc1 || (x) == 0xc2) -#define stbi__SOS(x) ((x) == 0xda) - -#define stbi__SOF_progressive(x) ((x) == 0xc2) - -static int stbi__decode_jpeg_header(stbi__jpeg *z, int scan) -{ - int m; - z->jfif = 0; - z->app14_color_transform = -1; // valid values are 0,1,2 - z->marker = STBI__MARKER_none; // initialize cached marker to empty - m = stbi__get_marker(z); - if (!stbi__SOI(m)) return stbi__err("no SOI","Corrupt JPEG"); - if (scan == STBI__SCAN_type) return 1; - m = stbi__get_marker(z); - while (!stbi__SOF(m)) { - if (!stbi__process_marker(z,m)) return 0; - m = stbi__get_marker(z); - while (m == STBI__MARKER_none) { - // some files have extra padding after their blocks, so ok, we'll scan - if (stbi__at_eof(z->s)) return stbi__err("no SOF", "Corrupt JPEG"); - m = stbi__get_marker(z); - } - } - z->progressive = stbi__SOF_progressive(m); - if (!stbi__process_frame_header(z, scan)) return 0; - return 1; -} - -// decode image to YCbCr format -static int stbi__decode_jpeg_image(stbi__jpeg *j) -{ - int m; - for (m = 0; m < 4; m++) { - j->img_comp[m].raw_data = NULL; - j->img_comp[m].raw_coeff = NULL; - } - j->restart_interval = 0; - if (!stbi__decode_jpeg_header(j, STBI__SCAN_load)) return 0; - m = stbi__get_marker(j); - while (!stbi__EOI(m)) { - if (stbi__SOS(m)) { - if (!stbi__process_scan_header(j)) return 0; - if (!stbi__parse_entropy_coded_data(j)) return 0; - if (j->marker == STBI__MARKER_none ) { - // handle 0s at the end of image data from IP Kamera 9060 - while (!stbi__at_eof(j->s)) { - int x = stbi__get8(j->s); - if (x == 255) { - j->marker = stbi__get8(j->s); - break; - } - } - // if we reach eof without hitting a marker, stbi__get_marker() below will fail and we'll eventually return 0 - } - } else if (stbi__DNL(m)) { - int Ld = stbi__get16be(j->s); - stbi__uint32 NL = stbi__get16be(j->s); - if (Ld != 4) return stbi__err("bad DNL len", "Corrupt JPEG"); - if (NL != j->s->img_y) return stbi__err("bad DNL height", "Corrupt JPEG"); - } else { - if (!stbi__process_marker(j, m)) return 0; - } - m = stbi__get_marker(j); - } - if (j->progressive) - stbi__jpeg_finish(j); - return 1; -} - -// static jfif-centered resampling (across block boundaries) - -typedef stbi_uc *(*resample_row_func)(stbi_uc *out, stbi_uc *in0, stbi_uc *in1, - int w, int hs); - -#define stbi__div4(x) ((stbi_uc) ((x) >> 2)) - -static stbi_uc *resample_row_1(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) -{ - STBI_NOTUSED(out); - STBI_NOTUSED(in_far); - STBI_NOTUSED(w); - STBI_NOTUSED(hs); - return in_near; -} - -static stbi_uc* stbi__resample_row_v_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) -{ - // need to generate two samples vertically for every one in input - int i; - STBI_NOTUSED(hs); - for (i=0; i < w; ++i) - out[i] = stbi__div4(3*in_near[i] + in_far[i] + 2); - return out; -} - -static stbi_uc* stbi__resample_row_h_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) -{ - // need to generate two samples horizontally for every one in input - int i; - stbi_uc *input = in_near; - - if (w == 1) { - // if only one sample, can't do any interpolation - out[0] = out[1] = input[0]; - return out; - } - - out[0] = input[0]; - out[1] = stbi__div4(input[0]*3 + input[1] + 2); - for (i=1; i < w-1; ++i) { - int n = 3*input[i]+2; - out[i*2+0] = stbi__div4(n+input[i-1]); - out[i*2+1] = stbi__div4(n+input[i+1]); - } - out[i*2+0] = stbi__div4(input[w-2]*3 + input[w-1] + 2); - out[i*2+1] = input[w-1]; - - STBI_NOTUSED(in_far); - STBI_NOTUSED(hs); - - return out; -} - -#define stbi__div16(x) ((stbi_uc) ((x) >> 4)) - -static stbi_uc *stbi__resample_row_hv_2(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) -{ - // need to generate 2x2 samples for every one in input - int i,t0,t1; - if (w == 1) { - out[0] = out[1] = stbi__div4(3*in_near[0] + in_far[0] + 2); - return out; - } - - t1 = 3*in_near[0] + in_far[0]; - out[0] = stbi__div4(t1+2); - for (i=1; i < w; ++i) { - t0 = t1; - t1 = 3*in_near[i]+in_far[i]; - out[i*2-1] = stbi__div16(3*t0 + t1 + 8); - out[i*2 ] = stbi__div16(3*t1 + t0 + 8); - } - out[w*2-1] = stbi__div4(t1+2); - - STBI_NOTUSED(hs); - - return out; -} - -#if defined(STBI_SSE2) || defined(STBI_NEON) -static stbi_uc *stbi__resample_row_hv_2_simd(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) -{ - // need to generate 2x2 samples for every one in input - int i=0,t0,t1; - - if (w == 1) { - out[0] = out[1] = stbi__div4(3*in_near[0] + in_far[0] + 2); - return out; - } - - t1 = 3*in_near[0] + in_far[0]; - // process groups of 8 pixels for as long as we can. - // note we can't handle the last pixel in a row in this loop - // because we need to handle the filter boundary conditions. - for (; i < ((w-1) & ~7); i += 8) { -#if defined(STBI_SSE2) - // load and perform the vertical filtering pass - // this uses 3*x + y = 4*x + (y - x) - __m128i zero = _mm_setzero_si128(); - __m128i farb = _mm_loadl_epi64((__m128i *) (in_far + i)); - __m128i nearb = _mm_loadl_epi64((__m128i *) (in_near + i)); - __m128i farw = _mm_unpacklo_epi8(farb, zero); - __m128i nearw = _mm_unpacklo_epi8(nearb, zero); - __m128i diff = _mm_sub_epi16(farw, nearw); - __m128i nears = _mm_slli_epi16(nearw, 2); - __m128i curr = _mm_add_epi16(nears, diff); // current row - - // horizontal filter works the same based on shifted vers of current - // row. "prev" is current row shifted right by 1 pixel; we need to - // insert the previous pixel value (from t1). - // "next" is current row shifted left by 1 pixel, with first pixel - // of next block of 8 pixels added in. - __m128i prv0 = _mm_slli_si128(curr, 2); - __m128i nxt0 = _mm_srli_si128(curr, 2); - __m128i prev = _mm_insert_epi16(prv0, t1, 0); - __m128i next = _mm_insert_epi16(nxt0, 3*in_near[i+8] + in_far[i+8], 7); - - // horizontal filter, polyphase implementation since it's convenient: - // even pixels = 3*cur + prev = cur*4 + (prev - cur) - // odd pixels = 3*cur + next = cur*4 + (next - cur) - // note the shared term. - __m128i bias = _mm_set1_epi16(8); - __m128i curs = _mm_slli_epi16(curr, 2); - __m128i prvd = _mm_sub_epi16(prev, curr); - __m128i nxtd = _mm_sub_epi16(next, curr); - __m128i curb = _mm_add_epi16(curs, bias); - __m128i even = _mm_add_epi16(prvd, curb); - __m128i odd = _mm_add_epi16(nxtd, curb); - - // interleave even and odd pixels, then undo scaling. - __m128i int0 = _mm_unpacklo_epi16(even, odd); - __m128i int1 = _mm_unpackhi_epi16(even, odd); - __m128i de0 = _mm_srli_epi16(int0, 4); - __m128i de1 = _mm_srli_epi16(int1, 4); - - // pack and write output - __m128i outv = _mm_packus_epi16(de0, de1); - _mm_storeu_si128((__m128i *) (out + i*2), outv); -#elif defined(STBI_NEON) - // load and perform the vertical filtering pass - // this uses 3*x + y = 4*x + (y - x) - uint8x8_t farb = vld1_u8(in_far + i); - uint8x8_t nearb = vld1_u8(in_near + i); - int16x8_t diff = vreinterpretq_s16_u16(vsubl_u8(farb, nearb)); - int16x8_t nears = vreinterpretq_s16_u16(vshll_n_u8(nearb, 2)); - int16x8_t curr = vaddq_s16(nears, diff); // current row - - // horizontal filter works the same based on shifted vers of current - // row. "prev" is current row shifted right by 1 pixel; we need to - // insert the previous pixel value (from t1). - // "next" is current row shifted left by 1 pixel, with first pixel - // of next block of 8 pixels added in. - int16x8_t prv0 = vextq_s16(curr, curr, 7); - int16x8_t nxt0 = vextq_s16(curr, curr, 1); - int16x8_t prev = vsetq_lane_s16(t1, prv0, 0); - int16x8_t next = vsetq_lane_s16(3*in_near[i+8] + in_far[i+8], nxt0, 7); - - // horizontal filter, polyphase implementation since it's convenient: - // even pixels = 3*cur + prev = cur*4 + (prev - cur) - // odd pixels = 3*cur + next = cur*4 + (next - cur) - // note the shared term. - int16x8_t curs = vshlq_n_s16(curr, 2); - int16x8_t prvd = vsubq_s16(prev, curr); - int16x8_t nxtd = vsubq_s16(next, curr); - int16x8_t even = vaddq_s16(curs, prvd); - int16x8_t odd = vaddq_s16(curs, nxtd); - - // undo scaling and round, then store with even/odd phases interleaved - uint8x8x2_t o; - o.val[0] = vqrshrun_n_s16(even, 4); - o.val[1] = vqrshrun_n_s16(odd, 4); - vst2_u8(out + i*2, o); -#endif - - // "previous" value for next iter - t1 = 3*in_near[i+7] + in_far[i+7]; - } - - t0 = t1; - t1 = 3*in_near[i] + in_far[i]; - out[i*2] = stbi__div16(3*t1 + t0 + 8); - - for (++i; i < w; ++i) { - t0 = t1; - t1 = 3*in_near[i]+in_far[i]; - out[i*2-1] = stbi__div16(3*t0 + t1 + 8); - out[i*2 ] = stbi__div16(3*t1 + t0 + 8); - } - out[w*2-1] = stbi__div4(t1+2); - - STBI_NOTUSED(hs); - - return out; -} -#endif - -static stbi_uc *stbi__resample_row_generic(stbi_uc *out, stbi_uc *in_near, stbi_uc *in_far, int w, int hs) -{ - // resample with nearest-neighbor - int i,j; - STBI_NOTUSED(in_far); - for (i=0; i < w; ++i) - for (j=0; j < hs; ++j) - out[i*hs+j] = in_near[i]; - return out; -} - -// this is a reduced-precision calculation of YCbCr-to-RGB introduced -// to make sure the code produces the same results in both SIMD and scalar -#define stbi__float2fixed(x) (((int) ((x) * 4096.0f + 0.5f)) << 8) -static void stbi__YCbCr_to_RGB_row(stbi_uc *out, const stbi_uc *y, const stbi_uc *pcb, const stbi_uc *pcr, int count, int step) -{ - int i; - for (i=0; i < count; ++i) { - int y_fixed = (y[i] << 20) + (1<<19); // rounding - int r,g,b; - int cr = pcr[i] - 128; - int cb = pcb[i] - 128; - r = y_fixed + cr* stbi__float2fixed(1.40200f); - g = y_fixed + (cr*-stbi__float2fixed(0.71414f)) + ((cb*-stbi__float2fixed(0.34414f)) & 0xffff0000); - b = y_fixed + cb* stbi__float2fixed(1.77200f); - r >>= 20; - g >>= 20; - b >>= 20; - if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; } - if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } - if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; } - out[0] = (stbi_uc)r; - out[1] = (stbi_uc)g; - out[2] = (stbi_uc)b; - out[3] = 255; - out += step; - } -} - -#if defined(STBI_SSE2) || defined(STBI_NEON) -static void stbi__YCbCr_to_RGB_simd(stbi_uc *out, stbi_uc const *y, stbi_uc const *pcb, stbi_uc const *pcr, int count, int step) -{ - int i = 0; - -#ifdef STBI_SSE2 - // step == 3 is pretty ugly on the final interleave, and i'm not convinced - // it's useful in practice (you wouldn't use it for textures, for example). - // so just accelerate step == 4 case. - if (step == 4) { - // this is a fairly straightforward implementation and not super-optimized. - __m128i signflip = _mm_set1_epi8(-0x80); - __m128i cr_const0 = _mm_set1_epi16( (short) ( 1.40200f*4096.0f+0.5f)); - __m128i cr_const1 = _mm_set1_epi16( - (short) ( 0.71414f*4096.0f+0.5f)); - __m128i cb_const0 = _mm_set1_epi16( - (short) ( 0.34414f*4096.0f+0.5f)); - __m128i cb_const1 = _mm_set1_epi16( (short) ( 1.77200f*4096.0f+0.5f)); - __m128i y_bias = _mm_set1_epi8((char) (unsigned char) 128); - __m128i xw = _mm_set1_epi16(255); // alpha channel - - for (; i+7 < count; i += 8) { - // load - __m128i y_bytes = _mm_loadl_epi64((__m128i *) (y+i)); - __m128i cr_bytes = _mm_loadl_epi64((__m128i *) (pcr+i)); - __m128i cb_bytes = _mm_loadl_epi64((__m128i *) (pcb+i)); - __m128i cr_biased = _mm_xor_si128(cr_bytes, signflip); // -128 - __m128i cb_biased = _mm_xor_si128(cb_bytes, signflip); // -128 - - // unpack to short (and left-shift cr, cb by 8) - __m128i yw = _mm_unpacklo_epi8(y_bias, y_bytes); - __m128i crw = _mm_unpacklo_epi8(_mm_setzero_si128(), cr_biased); - __m128i cbw = _mm_unpacklo_epi8(_mm_setzero_si128(), cb_biased); - - // color transform - __m128i yws = _mm_srli_epi16(yw, 4); - __m128i cr0 = _mm_mulhi_epi16(cr_const0, crw); - __m128i cb0 = _mm_mulhi_epi16(cb_const0, cbw); - __m128i cb1 = _mm_mulhi_epi16(cbw, cb_const1); - __m128i cr1 = _mm_mulhi_epi16(crw, cr_const1); - __m128i rws = _mm_add_epi16(cr0, yws); - __m128i gwt = _mm_add_epi16(cb0, yws); - __m128i bws = _mm_add_epi16(yws, cb1); - __m128i gws = _mm_add_epi16(gwt, cr1); - - // descale - __m128i rw = _mm_srai_epi16(rws, 4); - __m128i bw = _mm_srai_epi16(bws, 4); - __m128i gw = _mm_srai_epi16(gws, 4); - - // back to byte, set up for transpose - __m128i brb = _mm_packus_epi16(rw, bw); - __m128i gxb = _mm_packus_epi16(gw, xw); - - // transpose to interleave channels - __m128i t0 = _mm_unpacklo_epi8(brb, gxb); - __m128i t1 = _mm_unpackhi_epi8(brb, gxb); - __m128i o0 = _mm_unpacklo_epi16(t0, t1); - __m128i o1 = _mm_unpackhi_epi16(t0, t1); - - // store - _mm_storeu_si128((__m128i *) (out + 0), o0); - _mm_storeu_si128((__m128i *) (out + 16), o1); - out += 32; - } - } -#endif - -#ifdef STBI_NEON - // in this version, step=3 support would be easy to add. but is there demand? - if (step == 4) { - // this is a fairly straightforward implementation and not super-optimized. - uint8x8_t signflip = vdup_n_u8(0x80); - int16x8_t cr_const0 = vdupq_n_s16( (short) ( 1.40200f*4096.0f+0.5f)); - int16x8_t cr_const1 = vdupq_n_s16( - (short) ( 0.71414f*4096.0f+0.5f)); - int16x8_t cb_const0 = vdupq_n_s16( - (short) ( 0.34414f*4096.0f+0.5f)); - int16x8_t cb_const1 = vdupq_n_s16( (short) ( 1.77200f*4096.0f+0.5f)); - - for (; i+7 < count; i += 8) { - // load - uint8x8_t y_bytes = vld1_u8(y + i); - uint8x8_t cr_bytes = vld1_u8(pcr + i); - uint8x8_t cb_bytes = vld1_u8(pcb + i); - int8x8_t cr_biased = vreinterpret_s8_u8(vsub_u8(cr_bytes, signflip)); - int8x8_t cb_biased = vreinterpret_s8_u8(vsub_u8(cb_bytes, signflip)); - - // expand to s16 - int16x8_t yws = vreinterpretq_s16_u16(vshll_n_u8(y_bytes, 4)); - int16x8_t crw = vshll_n_s8(cr_biased, 7); - int16x8_t cbw = vshll_n_s8(cb_biased, 7); - - // color transform - int16x8_t cr0 = vqdmulhq_s16(crw, cr_const0); - int16x8_t cb0 = vqdmulhq_s16(cbw, cb_const0); - int16x8_t cr1 = vqdmulhq_s16(crw, cr_const1); - int16x8_t cb1 = vqdmulhq_s16(cbw, cb_const1); - int16x8_t rws = vaddq_s16(yws, cr0); - int16x8_t gws = vaddq_s16(vaddq_s16(yws, cb0), cr1); - int16x8_t bws = vaddq_s16(yws, cb1); - - // undo scaling, round, convert to byte - uint8x8x4_t o; - o.val[0] = vqrshrun_n_s16(rws, 4); - o.val[1] = vqrshrun_n_s16(gws, 4); - o.val[2] = vqrshrun_n_s16(bws, 4); - o.val[3] = vdup_n_u8(255); - - // store, interleaving r/g/b/a - vst4_u8(out, o); - out += 8*4; - } - } -#endif - - for (; i < count; ++i) { - int y_fixed = (y[i] << 20) + (1<<19); // rounding - int r,g,b; - int cr = pcr[i] - 128; - int cb = pcb[i] - 128; - r = y_fixed + cr* stbi__float2fixed(1.40200f); - g = y_fixed + cr*-stbi__float2fixed(0.71414f) + ((cb*-stbi__float2fixed(0.34414f)) & 0xffff0000); - b = y_fixed + cb* stbi__float2fixed(1.77200f); - r >>= 20; - g >>= 20; - b >>= 20; - if ((unsigned) r > 255) { if (r < 0) r = 0; else r = 255; } - if ((unsigned) g > 255) { if (g < 0) g = 0; else g = 255; } - if ((unsigned) b > 255) { if (b < 0) b = 0; else b = 255; } - out[0] = (stbi_uc)r; - out[1] = (stbi_uc)g; - out[2] = (stbi_uc)b; - out[3] = 255; - out += step; - } -} -#endif - -// set up the kernels -static void stbi__setup_jpeg(stbi__jpeg *j) -{ - j->idct_block_kernel = stbi__idct_block; - j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_row; - j->resample_row_hv_2_kernel = stbi__resample_row_hv_2; - -#ifdef STBI_SSE2 - if (stbi__sse2_available()) { - j->idct_block_kernel = stbi__idct_simd; - j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_simd; - j->resample_row_hv_2_kernel = stbi__resample_row_hv_2_simd; - } -#endif - -#ifdef STBI_NEON - j->idct_block_kernel = stbi__idct_simd; - j->YCbCr_to_RGB_kernel = stbi__YCbCr_to_RGB_simd; - j->resample_row_hv_2_kernel = stbi__resample_row_hv_2_simd; -#endif -} - -// clean up the temporary component buffers -static void stbi__cleanup_jpeg(stbi__jpeg *j) -{ - stbi__free_jpeg_components(j, j->s->img_n, 0); -} - -typedef struct -{ - resample_row_func resample; - stbi_uc *line0,*line1; - int hs,vs; // expansion factor in each axis - int w_lores; // horizontal pixels pre-expansion - int ystep; // how far through vertical expansion we are - int ypos; // which pre-expansion row we're on -} stbi__resample; - -// fast 0..255 * 0..255 => 0..255 rounded multiplication -static stbi_uc stbi__blinn_8x8(stbi_uc x, stbi_uc y) -{ - unsigned int t = x*y + 128; - return (stbi_uc) ((t + (t >>8)) >> 8); -} - -static stbi_uc *load_jpeg_image(stbi__jpeg *z, int *out_x, int *out_y, int *comp, int req_comp) -{ - int n, decode_n, is_rgb; - z->s->img_n = 0; // make stbi__cleanup_jpeg safe - - // validate req_comp - if (req_comp < 0 || req_comp > 4) return stbi__errpuc("bad req_comp", "Internal error"); - - // load a jpeg image from whichever source, but leave in YCbCr format - if (!stbi__decode_jpeg_image(z)) { stbi__cleanup_jpeg(z); return NULL; } - - // determine actual number of components to generate - n = req_comp ? req_comp : z->s->img_n >= 3 ? 3 : 1; - - is_rgb = z->s->img_n == 3 && (z->rgb == 3 || (z->app14_color_transform == 0 && !z->jfif)); - - if (z->s->img_n == 3 && n < 3 && !is_rgb) - decode_n = 1; - else - decode_n = z->s->img_n; - - // nothing to do if no components requested; check this now to avoid - // accessing uninitialized coutput[0] later - if (decode_n <= 0) { stbi__cleanup_jpeg(z); return NULL; } - - // resample and color-convert - { - int k; - unsigned int i,j; - stbi_uc *output; - stbi_uc *coutput[4] = { NULL, NULL, NULL, NULL }; - - stbi__resample res_comp[4]; - - for (k=0; k < decode_n; ++k) { - stbi__resample *r = &res_comp[k]; - - // allocate line buffer big enough for upsampling off the edges - // with upsample factor of 4 - z->img_comp[k].linebuf = (stbi_uc *) stbi__malloc(z->s->img_x + 3); - if (!z->img_comp[k].linebuf) { stbi__cleanup_jpeg(z); return stbi__errpuc("outofmem", "Out of memory"); } - - r->hs = z->img_h_max / z->img_comp[k].h; - r->vs = z->img_v_max / z->img_comp[k].v; - r->ystep = r->vs >> 1; - r->w_lores = (z->s->img_x + r->hs-1) / r->hs; - r->ypos = 0; - r->line0 = r->line1 = z->img_comp[k].data; - - if (r->hs == 1 && r->vs == 1) r->resample = resample_row_1; - else if (r->hs == 1 && r->vs == 2) r->resample = stbi__resample_row_v_2; - else if (r->hs == 2 && r->vs == 1) r->resample = stbi__resample_row_h_2; - else if (r->hs == 2 && r->vs == 2) r->resample = z->resample_row_hv_2_kernel; - else r->resample = stbi__resample_row_generic; - } - - // can't error after this so, this is safe - output = (stbi_uc *) stbi__malloc_mad3(n, z->s->img_x, z->s->img_y, 1); - if (!output) { stbi__cleanup_jpeg(z); return stbi__errpuc("outofmem", "Out of memory"); } - - // now go ahead and resample - for (j=0; j < z->s->img_y; ++j) { - stbi_uc *out = output + n * z->s->img_x * j; - for (k=0; k < decode_n; ++k) { - stbi__resample *r = &res_comp[k]; - int y_bot = r->ystep >= (r->vs >> 1); - coutput[k] = r->resample(z->img_comp[k].linebuf, - y_bot ? r->line1 : r->line0, - y_bot ? r->line0 : r->line1, - r->w_lores, r->hs); - if (++r->ystep >= r->vs) { - r->ystep = 0; - r->line0 = r->line1; - if (++r->ypos < z->img_comp[k].y) - r->line1 += z->img_comp[k].w2; - } - } - if (n >= 3) { - stbi_uc *y = coutput[0]; - if (z->s->img_n == 3) { - if (is_rgb) { - for (i=0; i < z->s->img_x; ++i) { - out[0] = y[i]; - out[1] = coutput[1][i]; - out[2] = coutput[2][i]; - out[3] = 255; - out += n; - } - } else { - z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n); - } - } else if (z->s->img_n == 4) { - if (z->app14_color_transform == 0) { // CMYK - for (i=0; i < z->s->img_x; ++i) { - stbi_uc m = coutput[3][i]; - out[0] = stbi__blinn_8x8(coutput[0][i], m); - out[1] = stbi__blinn_8x8(coutput[1][i], m); - out[2] = stbi__blinn_8x8(coutput[2][i], m); - out[3] = 255; - out += n; - } - } else if (z->app14_color_transform == 2) { // YCCK - z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n); - for (i=0; i < z->s->img_x; ++i) { - stbi_uc m = coutput[3][i]; - out[0] = stbi__blinn_8x8(255 - out[0], m); - out[1] = stbi__blinn_8x8(255 - out[1], m); - out[2] = stbi__blinn_8x8(255 - out[2], m); - out += n; - } - } else { // YCbCr + alpha? Ignore the fourth channel for now - z->YCbCr_to_RGB_kernel(out, y, coutput[1], coutput[2], z->s->img_x, n); - } - } else - for (i=0; i < z->s->img_x; ++i) { - out[0] = out[1] = out[2] = y[i]; - out[3] = 255; // not used if n==3 - out += n; - } - } else { - if (is_rgb) { - if (n == 1) - for (i=0; i < z->s->img_x; ++i) - *out++ = stbi__compute_y(coutput[0][i], coutput[1][i], coutput[2][i]); - else { - for (i=0; i < z->s->img_x; ++i, out += 2) { - out[0] = stbi__compute_y(coutput[0][i], coutput[1][i], coutput[2][i]); - out[1] = 255; - } - } - } else if (z->s->img_n == 4 && z->app14_color_transform == 0) { - for (i=0; i < z->s->img_x; ++i) { - stbi_uc m = coutput[3][i]; - stbi_uc r = stbi__blinn_8x8(coutput[0][i], m); - stbi_uc g = stbi__blinn_8x8(coutput[1][i], m); - stbi_uc b = stbi__blinn_8x8(coutput[2][i], m); - out[0] = stbi__compute_y(r, g, b); - out[1] = 255; - out += n; - } - } else if (z->s->img_n == 4 && z->app14_color_transform == 2) { - for (i=0; i < z->s->img_x; ++i) { - out[0] = stbi__blinn_8x8(255 - coutput[0][i], coutput[3][i]); - out[1] = 255; - out += n; - } - } else { - stbi_uc *y = coutput[0]; - if (n == 1) - for (i=0; i < z->s->img_x; ++i) out[i] = y[i]; - else - for (i=0; i < z->s->img_x; ++i) { *out++ = y[i]; *out++ = 255; } - } - } - } - stbi__cleanup_jpeg(z); - *out_x = z->s->img_x; - *out_y = z->s->img_y; - if (comp) *comp = z->s->img_n >= 3 ? 3 : 1; // report original components, not output - return output; - } -} - -static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - unsigned char* result; - stbi__jpeg* j = (stbi__jpeg*) stbi__malloc(sizeof(stbi__jpeg)); - if (!j) return stbi__errpuc("outofmem", "Out of memory"); - STBI_NOTUSED(ri); - j->s = s; - stbi__setup_jpeg(j); - result = load_jpeg_image(j, x,y,comp,req_comp); - STBI_FREE(j); - return result; -} - -static int stbi__jpeg_test(stbi__context *s) -{ - int r; - stbi__jpeg* j = (stbi__jpeg*)stbi__malloc(sizeof(stbi__jpeg)); - if (!j) return stbi__err("outofmem", "Out of memory"); - j->s = s; - stbi__setup_jpeg(j); - r = stbi__decode_jpeg_header(j, STBI__SCAN_type); - stbi__rewind(s); - STBI_FREE(j); - return r; -} - -static int stbi__jpeg_info_raw(stbi__jpeg *j, int *x, int *y, int *comp) -{ - if (!stbi__decode_jpeg_header(j, STBI__SCAN_header)) { - stbi__rewind( j->s ); - return 0; - } - if (x) *x = j->s->img_x; - if (y) *y = j->s->img_y; - if (comp) *comp = j->s->img_n >= 3 ? 3 : 1; - return 1; -} - -static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp) -{ - int result; - stbi__jpeg* j = (stbi__jpeg*) (stbi__malloc(sizeof(stbi__jpeg))); - if (!j) return stbi__err("outofmem", "Out of memory"); - j->s = s; - result = stbi__jpeg_info_raw(j, x, y, comp); - STBI_FREE(j); - return result; -} -#endif - -// public domain zlib decode v0.2 Sean Barrett 2006-11-18 -// simple implementation -// - all input must be provided in an upfront buffer -// - all output is written to a single output buffer (can malloc/realloc) -// performance -// - fast huffman - -#ifndef STBI_NO_ZLIB - -// fast-way is faster to check than jpeg huffman, but slow way is slower -#define STBI__ZFAST_BITS 9 // accelerate all cases in default tables -#define STBI__ZFAST_MASK ((1 << STBI__ZFAST_BITS) - 1) -#define STBI__ZNSYMS 288 // number of symbols in literal/length alphabet - -// zlib-style huffman encoding -// (jpegs packs from left, zlib from right, so can't share code) -typedef struct -{ - stbi__uint16 fast[1 << STBI__ZFAST_BITS]; - stbi__uint16 firstcode[16]; - int maxcode[17]; - stbi__uint16 firstsymbol[16]; - stbi_uc size[STBI__ZNSYMS]; - stbi__uint16 value[STBI__ZNSYMS]; -} stbi__zhuffman; - -stbi_inline static int stbi__bitreverse16(int n) -{ - n = ((n & 0xAAAA) >> 1) | ((n & 0x5555) << 1); - n = ((n & 0xCCCC) >> 2) | ((n & 0x3333) << 2); - n = ((n & 0xF0F0) >> 4) | ((n & 0x0F0F) << 4); - n = ((n & 0xFF00) >> 8) | ((n & 0x00FF) << 8); - return n; -} - -stbi_inline static int stbi__bit_reverse(int v, int bits) -{ - STBI_ASSERT(bits <= 16); - // to bit reverse n bits, reverse 16 and shift - // e.g. 11 bits, bit reverse and shift away 5 - return stbi__bitreverse16(v) >> (16-bits); -} - -static int stbi__zbuild_huffman(stbi__zhuffman *z, const stbi_uc *sizelist, int num) -{ - int i,k=0; - int code, next_code[16], sizes[17]; - - // DEFLATE spec for generating codes - memset(sizes, 0, sizeof(sizes)); - memset(z->fast, 0, sizeof(z->fast)); - for (i=0; i < num; ++i) - ++sizes[sizelist[i]]; - sizes[0] = 0; - for (i=1; i < 16; ++i) - if (sizes[i] > (1 << i)) - return stbi__err("bad sizes", "Corrupt PNG"); - code = 0; - for (i=1; i < 16; ++i) { - next_code[i] = code; - z->firstcode[i] = (stbi__uint16) code; - z->firstsymbol[i] = (stbi__uint16) k; - code = (code + sizes[i]); - if (sizes[i]) - if (code-1 >= (1 << i)) return stbi__err("bad codelengths","Corrupt PNG"); - z->maxcode[i] = code << (16-i); // preshift for inner loop - code <<= 1; - k += sizes[i]; - } - z->maxcode[16] = 0x10000; // sentinel - for (i=0; i < num; ++i) { - int s = sizelist[i]; - if (s) { - int c = next_code[s] - z->firstcode[s] + z->firstsymbol[s]; - stbi__uint16 fastv = (stbi__uint16) ((s << 9) | i); - z->size [c] = (stbi_uc ) s; - z->value[c] = (stbi__uint16) i; - if (s <= STBI__ZFAST_BITS) { - int j = stbi__bit_reverse(next_code[s],s); - while (j < (1 << STBI__ZFAST_BITS)) { - z->fast[j] = fastv; - j += (1 << s); - } - } - ++next_code[s]; - } - } - return 1; -} - -// zlib-from-memory implementation for PNG reading -// because PNG allows splitting the zlib stream arbitrarily, -// and it's annoying structurally to have PNG call ZLIB call PNG, -// we require PNG read all the IDATs and combine them into a single -// memory buffer - -typedef struct -{ - stbi_uc *zbuffer, *zbuffer_end; - int num_bits; - stbi__uint32 code_buffer; - - char *zout; - char *zout_start; - char *zout_end; - int z_expandable; - - stbi__zhuffman z_length, z_distance; -} stbi__zbuf; - -stbi_inline static int stbi__zeof(stbi__zbuf *z) -{ - return (z->zbuffer >= z->zbuffer_end); -} - -stbi_inline static stbi_uc stbi__zget8(stbi__zbuf *z) -{ - return stbi__zeof(z) ? 0 : *z->zbuffer++; -} - -static void stbi__fill_bits(stbi__zbuf *z) -{ - do { - if (z->code_buffer >= (1U << z->num_bits)) { - z->zbuffer = z->zbuffer_end; /* treat this as EOF so we fail. */ - return; - } - z->code_buffer |= (unsigned int) stbi__zget8(z) << z->num_bits; - z->num_bits += 8; - } while (z->num_bits <= 24); -} - -stbi_inline static unsigned int stbi__zreceive(stbi__zbuf *z, int n) -{ - unsigned int k; - if (z->num_bits < n) stbi__fill_bits(z); - k = z->code_buffer & ((1 << n) - 1); - z->code_buffer >>= n; - z->num_bits -= n; - return k; -} - -static int stbi__zhuffman_decode_slowpath(stbi__zbuf *a, stbi__zhuffman *z) -{ - int b,s,k; - // not resolved by fast table, so compute it the slow way - // use jpeg approach, which requires MSbits at top - k = stbi__bit_reverse(a->code_buffer, 16); - for (s=STBI__ZFAST_BITS+1; ; ++s) - if (k < z->maxcode[s]) - break; - if (s >= 16) return -1; // invalid code! - // code size is s, so: - b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s]; - if (b >= STBI__ZNSYMS) return -1; // some data was corrupt somewhere! - if (z->size[b] != s) return -1; // was originally an assert, but report failure instead. - a->code_buffer >>= s; - a->num_bits -= s; - return z->value[b]; -} - -stbi_inline static int stbi__zhuffman_decode(stbi__zbuf *a, stbi__zhuffman *z) -{ - int b,s; - if (a->num_bits < 16) { - if (stbi__zeof(a)) { - return -1; /* report error for unexpected end of data. */ - } - stbi__fill_bits(a); - } - b = z->fast[a->code_buffer & STBI__ZFAST_MASK]; - if (b) { - s = b >> 9; - a->code_buffer >>= s; - a->num_bits -= s; - return b & 511; - } - return stbi__zhuffman_decode_slowpath(a, z); -} - -static int stbi__zexpand(stbi__zbuf *z, char *zout, int n) // need to make room for n bytes -{ - char *q; - unsigned int cur, limit, old_limit; - z->zout = zout; - if (!z->z_expandable) return stbi__err("output buffer limit","Corrupt PNG"); - cur = (unsigned int) (z->zout - z->zout_start); - limit = old_limit = (unsigned) (z->zout_end - z->zout_start); - if (UINT_MAX - cur < (unsigned) n) return stbi__err("outofmem", "Out of memory"); - while (cur + n > limit) { - if(limit > UINT_MAX / 2) return stbi__err("outofmem", "Out of memory"); - limit *= 2; - } - q = (char *) STBI_REALLOC_SIZED(z->zout_start, old_limit, limit); - STBI_NOTUSED(old_limit); - if (q == NULL) return stbi__err("outofmem", "Out of memory"); - z->zout_start = q; - z->zout = q + cur; - z->zout_end = q + limit; - return 1; -} - -static const int stbi__zlength_base[31] = { - 3,4,5,6,7,8,9,10,11,13, - 15,17,19,23,27,31,35,43,51,59, - 67,83,99,115,131,163,195,227,258,0,0 }; - -static const int stbi__zlength_extra[31]= -{ 0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0 }; - -static const int stbi__zdist_base[32] = { 1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193, -257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0}; - -static const int stbi__zdist_extra[32] = -{ 0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; - -static int stbi__parse_huffman_block(stbi__zbuf *a) -{ - char *zout = a->zout; - for(;;) { - int z = stbi__zhuffman_decode(a, &a->z_length); - if (z < 256) { - if (z < 0) return stbi__err("bad huffman code","Corrupt PNG"); // error in huffman codes - if (zout >= a->zout_end) { - if (!stbi__zexpand(a, zout, 1)) return 0; - zout = a->zout; - } - *zout++ = (char) z; - } else { - stbi_uc *p; - int len,dist; - if (z == 256) { - a->zout = zout; - return 1; - } - z -= 257; - len = stbi__zlength_base[z]; - if (stbi__zlength_extra[z]) len += stbi__zreceive(a, stbi__zlength_extra[z]); - z = stbi__zhuffman_decode(a, &a->z_distance); - if (z < 0) return stbi__err("bad huffman code","Corrupt PNG"); - dist = stbi__zdist_base[z]; - if (stbi__zdist_extra[z]) dist += stbi__zreceive(a, stbi__zdist_extra[z]); - if (zout - a->zout_start < dist) return stbi__err("bad dist","Corrupt PNG"); - if (zout + len > a->zout_end) { - if (!stbi__zexpand(a, zout, len)) return 0; - zout = a->zout; - } - p = (stbi_uc *) (zout - dist); - if (dist == 1) { // run of one byte; common in images. - stbi_uc v = *p; - if (len) { do *zout++ = v; while (--len); } - } else { - if (len) { do *zout++ = *p++; while (--len); } - } - } - } -} - -static int stbi__compute_huffman_codes(stbi__zbuf *a) -{ - static const stbi_uc length_dezigzag[19] = { 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 }; - stbi__zhuffman z_codelength; - stbi_uc lencodes[286+32+137];//padding for maximum single op - stbi_uc codelength_sizes[19]; - int i,n; - - int hlit = stbi__zreceive(a,5) + 257; - int hdist = stbi__zreceive(a,5) + 1; - int hclen = stbi__zreceive(a,4) + 4; - int ntot = hlit + hdist; - - memset(codelength_sizes, 0, sizeof(codelength_sizes)); - for (i=0; i < hclen; ++i) { - int s = stbi__zreceive(a,3); - codelength_sizes[length_dezigzag[i]] = (stbi_uc) s; - } - if (!stbi__zbuild_huffman(&z_codelength, codelength_sizes, 19)) return 0; - - n = 0; - while (n < ntot) { - int c = stbi__zhuffman_decode(a, &z_codelength); - if (c < 0 || c >= 19) return stbi__err("bad codelengths", "Corrupt PNG"); - if (c < 16) - lencodes[n++] = (stbi_uc) c; - else { - stbi_uc fill = 0; - if (c == 16) { - c = stbi__zreceive(a,2)+3; - if (n == 0) return stbi__err("bad codelengths", "Corrupt PNG"); - fill = lencodes[n-1]; - } else if (c == 17) { - c = stbi__zreceive(a,3)+3; - } else if (c == 18) { - c = stbi__zreceive(a,7)+11; - } else { - return stbi__err("bad codelengths", "Corrupt PNG"); - } - if (ntot - n < c) return stbi__err("bad codelengths", "Corrupt PNG"); - memset(lencodes+n, fill, c); - n += c; - } - } - if (n != ntot) return stbi__err("bad codelengths","Corrupt PNG"); - if (!stbi__zbuild_huffman(&a->z_length, lencodes, hlit)) return 0; - if (!stbi__zbuild_huffman(&a->z_distance, lencodes+hlit, hdist)) return 0; - return 1; -} - -static int stbi__parse_uncompressed_block(stbi__zbuf *a) -{ - stbi_uc header[4]; - int len,nlen,k; - if (a->num_bits & 7) - stbi__zreceive(a, a->num_bits & 7); // discard - // drain the bit-packed data into header - k = 0; - while (a->num_bits > 0) { - header[k++] = (stbi_uc) (a->code_buffer & 255); // suppress MSVC run-time check - a->code_buffer >>= 8; - a->num_bits -= 8; - } - if (a->num_bits < 0) return stbi__err("zlib corrupt","Corrupt PNG"); - // now fill header the normal way - while (k < 4) - header[k++] = stbi__zget8(a); - len = header[1] * 256 + header[0]; - nlen = header[3] * 256 + header[2]; - if (nlen != (len ^ 0xffff)) return stbi__err("zlib corrupt","Corrupt PNG"); - if (a->zbuffer + len > a->zbuffer_end) return stbi__err("read past buffer","Corrupt PNG"); - if (a->zout + len > a->zout_end) - if (!stbi__zexpand(a, a->zout, len)) return 0; - memcpy(a->zout, a->zbuffer, len); - a->zbuffer += len; - a->zout += len; - return 1; -} - -static int stbi__parse_zlib_header(stbi__zbuf *a) -{ - int cmf = stbi__zget8(a); - int cm = cmf & 15; - /* int cinfo = cmf >> 4; */ - int flg = stbi__zget8(a); - if (stbi__zeof(a)) return stbi__err("bad zlib header","Corrupt PNG"); // zlib spec - if ((cmf*256+flg) % 31 != 0) return stbi__err("bad zlib header","Corrupt PNG"); // zlib spec - if (flg & 32) return stbi__err("no preset dict","Corrupt PNG"); // preset dictionary not allowed in png - if (cm != 8) return stbi__err("bad compression","Corrupt PNG"); // DEFLATE required for png - // window = 1 << (8 + cinfo)... but who cares, we fully buffer output - return 1; -} - -static const stbi_uc stbi__zdefault_length[STBI__ZNSYMS] = -{ - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, - 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, - 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, - 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8 -}; -static const stbi_uc stbi__zdefault_distance[32] = -{ - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5 -}; -/* -Init algorithm: -{ - int i; // use <= to match clearly with spec - for (i=0; i <= 143; ++i) stbi__zdefault_length[i] = 8; - for ( ; i <= 255; ++i) stbi__zdefault_length[i] = 9; - for ( ; i <= 279; ++i) stbi__zdefault_length[i] = 7; - for ( ; i <= 287; ++i) stbi__zdefault_length[i] = 8; - - for (i=0; i <= 31; ++i) stbi__zdefault_distance[i] = 5; -} -*/ - -static int stbi__parse_zlib(stbi__zbuf *a, int parse_header) -{ - int final, type; - if (parse_header) - if (!stbi__parse_zlib_header(a)) return 0; - a->num_bits = 0; - a->code_buffer = 0; - do { - final = stbi__zreceive(a,1); - type = stbi__zreceive(a,2); - if (type == 0) { - if (!stbi__parse_uncompressed_block(a)) return 0; - } else if (type == 3) { - return 0; - } else { - if (type == 1) { - // use fixed code lengths - if (!stbi__zbuild_huffman(&a->z_length , stbi__zdefault_length , STBI__ZNSYMS)) return 0; - if (!stbi__zbuild_huffman(&a->z_distance, stbi__zdefault_distance, 32)) return 0; - } else { - if (!stbi__compute_huffman_codes(a)) return 0; - } - if (!stbi__parse_huffman_block(a)) return 0; - } - } while (!final); - return 1; -} - -static int stbi__do_zlib(stbi__zbuf *a, char *obuf, int olen, int exp, int parse_header) -{ - a->zout_start = obuf; - a->zout = obuf; - a->zout_end = obuf + olen; - a->z_expandable = exp; - - return stbi__parse_zlib(a, parse_header); -} - -STBIDEF char *stbi_zlib_decode_malloc_guesssize(const char *buffer, int len, int initial_size, int *outlen) -{ - stbi__zbuf a; - char *p = (char *) stbi__malloc(initial_size); - if (p == NULL) return NULL; - a.zbuffer = (stbi_uc *) buffer; - a.zbuffer_end = (stbi_uc *) buffer + len; - if (stbi__do_zlib(&a, p, initial_size, 1, 1)) { - if (outlen) *outlen = (int) (a.zout - a.zout_start); - return a.zout_start; - } else { - STBI_FREE(a.zout_start); - return NULL; - } -} - -STBIDEF char *stbi_zlib_decode_malloc(char const *buffer, int len, int *outlen) -{ - return stbi_zlib_decode_malloc_guesssize(buffer, len, 16384, outlen); -} - -STBIDEF char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header) -{ - stbi__zbuf a; - char *p = (char *) stbi__malloc(initial_size); - if (p == NULL) return NULL; - a.zbuffer = (stbi_uc *) buffer; - a.zbuffer_end = (stbi_uc *) buffer + len; - if (stbi__do_zlib(&a, p, initial_size, 1, parse_header)) { - if (outlen) *outlen = (int) (a.zout - a.zout_start); - return a.zout_start; - } else { - STBI_FREE(a.zout_start); - return NULL; - } -} - -STBIDEF int stbi_zlib_decode_buffer(char *obuffer, int olen, char const *ibuffer, int ilen) -{ - stbi__zbuf a; - a.zbuffer = (stbi_uc *) ibuffer; - a.zbuffer_end = (stbi_uc *) ibuffer + ilen; - if (stbi__do_zlib(&a, obuffer, olen, 0, 1)) - return (int) (a.zout - a.zout_start); - else - return -1; -} - -STBIDEF char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen) -{ - stbi__zbuf a; - char *p = (char *) stbi__malloc(16384); - if (p == NULL) return NULL; - a.zbuffer = (stbi_uc *) buffer; - a.zbuffer_end = (stbi_uc *) buffer+len; - if (stbi__do_zlib(&a, p, 16384, 1, 0)) { - if (outlen) *outlen = (int) (a.zout - a.zout_start); - return a.zout_start; - } else { - STBI_FREE(a.zout_start); - return NULL; - } -} - -STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const char *ibuffer, int ilen) -{ - stbi__zbuf a; - a.zbuffer = (stbi_uc *) ibuffer; - a.zbuffer_end = (stbi_uc *) ibuffer + ilen; - if (stbi__do_zlib(&a, obuffer, olen, 0, 0)) - return (int) (a.zout - a.zout_start); - else - return -1; -} -#endif - -// public domain "baseline" PNG decoder v0.10 Sean Barrett 2006-11-18 -// simple implementation -// - only 8-bit samples -// - no CRC checking -// - allocates lots of intermediate memory -// - avoids problem of streaming data between subsystems -// - avoids explicit window management -// performance -// - uses stb_zlib, a PD zlib implementation with fast huffman decoding - -#ifndef STBI_NO_PNG -typedef struct -{ - stbi__uint32 length; - stbi__uint32 type; -} stbi__pngchunk; - -static stbi__pngchunk stbi__get_chunk_header(stbi__context *s) -{ - stbi__pngchunk c; - c.length = stbi__get32be(s); - c.type = stbi__get32be(s); - return c; -} - -static int stbi__check_png_header(stbi__context *s) -{ - static const stbi_uc png_sig[8] = { 137,80,78,71,13,10,26,10 }; - int i; - for (i=0; i < 8; ++i) - if (stbi__get8(s) != png_sig[i]) return stbi__err("bad png sig","Not a PNG"); - return 1; -} - -typedef struct -{ - stbi__context *s; - stbi_uc *idata, *expanded, *out; - int depth; -} stbi__png; - - -enum { - STBI__F_none=0, - STBI__F_sub=1, - STBI__F_up=2, - STBI__F_avg=3, - STBI__F_paeth=4, - // synthetic filters used for first scanline to avoid needing a dummy row of 0s - STBI__F_avg_first, - STBI__F_paeth_first -}; - -static stbi_uc first_row_filter[5] = -{ - STBI__F_none, - STBI__F_sub, - STBI__F_none, - STBI__F_avg_first, - STBI__F_paeth_first -}; - -static int stbi__paeth(int a, int b, int c) -{ - int p = a + b - c; - int pa = abs(p-a); - int pb = abs(p-b); - int pc = abs(p-c); - if (pa <= pb && pa <= pc) return a; - if (pb <= pc) return b; - return c; -} - -static const stbi_uc stbi__depth_scale_table[9] = { 0, 0xff, 0x55, 0, 0x11, 0,0,0, 0x01 }; - -// create the png data from post-deflated data -static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 raw_len, int out_n, stbi__uint32 x, stbi__uint32 y, int depth, int color) -{ - int bytes = (depth == 16? 2 : 1); - stbi__context *s = a->s; - stbi__uint32 i,j,stride = x*out_n*bytes; - stbi__uint32 img_len, img_width_bytes; - int k; - int img_n = s->img_n; // copy it into a local for later - - int output_bytes = out_n*bytes; - int filter_bytes = img_n*bytes; - int width = x; - - STBI_ASSERT(out_n == s->img_n || out_n == s->img_n+1); - a->out = (stbi_uc *) stbi__malloc_mad3(x, y, output_bytes, 0); // extra bytes to write off the end into - if (!a->out) return stbi__err("outofmem", "Out of memory"); - - if (!stbi__mad3sizes_valid(img_n, x, depth, 7)) return stbi__err("too large", "Corrupt PNG"); - img_width_bytes = (((img_n * x * depth) + 7) >> 3); - img_len = (img_width_bytes + 1) * y; - - // we used to check for exact match between raw_len and img_len on non-interlaced PNGs, - // but issue #276 reported a PNG in the wild that had extra data at the end (all zeros), - // so just check for raw_len < img_len always. - if (raw_len < img_len) return stbi__err("not enough pixels","Corrupt PNG"); - - for (j=0; j < y; ++j) { - stbi_uc *cur = a->out + stride*j; - stbi_uc *prior; - int filter = *raw++; - - if (filter > 4) - return stbi__err("invalid filter","Corrupt PNG"); - - if (depth < 8) { - if (img_width_bytes > x) return stbi__err("invalid width","Corrupt PNG"); - cur += x*out_n - img_width_bytes; // store output to the rightmost img_len bytes, so we can decode in place - filter_bytes = 1; - width = img_width_bytes; - } - prior = cur - stride; // bugfix: need to compute this after 'cur +=' computation above - - // if first row, use special filter that doesn't sample previous row - if (j == 0) filter = first_row_filter[filter]; - - // handle first byte explicitly - for (k=0; k < filter_bytes; ++k) { - switch (filter) { - case STBI__F_none : cur[k] = raw[k]; break; - case STBI__F_sub : cur[k] = raw[k]; break; - case STBI__F_up : cur[k] = STBI__BYTECAST(raw[k] + prior[k]); break; - case STBI__F_avg : cur[k] = STBI__BYTECAST(raw[k] + (prior[k]>>1)); break; - case STBI__F_paeth : cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(0,prior[k],0)); break; - case STBI__F_avg_first : cur[k] = raw[k]; break; - case STBI__F_paeth_first: cur[k] = raw[k]; break; - } - } - - if (depth == 8) { - if (img_n != out_n) - cur[img_n] = 255; // first pixel - raw += img_n; - cur += out_n; - prior += out_n; - } else if (depth == 16) { - if (img_n != out_n) { - cur[filter_bytes] = 255; // first pixel top byte - cur[filter_bytes+1] = 255; // first pixel bottom byte - } - raw += filter_bytes; - cur += output_bytes; - prior += output_bytes; - } else { - raw += 1; - cur += 1; - prior += 1; - } - - // this is a little gross, so that we don't switch per-pixel or per-component - if (depth < 8 || img_n == out_n) { - int nk = (width - 1)*filter_bytes; - #define STBI__CASE(f) \ - case f: \ - for (k=0; k < nk; ++k) - switch (filter) { - // "none" filter turns into a memcpy here; make that explicit. - case STBI__F_none: memcpy(cur, raw, nk); break; - STBI__CASE(STBI__F_sub) { cur[k] = STBI__BYTECAST(raw[k] + cur[k-filter_bytes]); } break; - STBI__CASE(STBI__F_up) { cur[k] = STBI__BYTECAST(raw[k] + prior[k]); } break; - STBI__CASE(STBI__F_avg) { cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k-filter_bytes])>>1)); } break; - STBI__CASE(STBI__F_paeth) { cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-filter_bytes],prior[k],prior[k-filter_bytes])); } break; - STBI__CASE(STBI__F_avg_first) { cur[k] = STBI__BYTECAST(raw[k] + (cur[k-filter_bytes] >> 1)); } break; - STBI__CASE(STBI__F_paeth_first) { cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k-filter_bytes],0,0)); } break; - } - #undef STBI__CASE - raw += nk; - } else { - STBI_ASSERT(img_n+1 == out_n); - #define STBI__CASE(f) \ - case f: \ - for (i=x-1; i >= 1; --i, cur[filter_bytes]=255,raw+=filter_bytes,cur+=output_bytes,prior+=output_bytes) \ - for (k=0; k < filter_bytes; ++k) - switch (filter) { - STBI__CASE(STBI__F_none) { cur[k] = raw[k]; } break; - STBI__CASE(STBI__F_sub) { cur[k] = STBI__BYTECAST(raw[k] + cur[k- output_bytes]); } break; - STBI__CASE(STBI__F_up) { cur[k] = STBI__BYTECAST(raw[k] + prior[k]); } break; - STBI__CASE(STBI__F_avg) { cur[k] = STBI__BYTECAST(raw[k] + ((prior[k] + cur[k- output_bytes])>>1)); } break; - STBI__CASE(STBI__F_paeth) { cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k- output_bytes],prior[k],prior[k- output_bytes])); } break; - STBI__CASE(STBI__F_avg_first) { cur[k] = STBI__BYTECAST(raw[k] + (cur[k- output_bytes] >> 1)); } break; - STBI__CASE(STBI__F_paeth_first) { cur[k] = STBI__BYTECAST(raw[k] + stbi__paeth(cur[k- output_bytes],0,0)); } break; - } - #undef STBI__CASE - - // the loop above sets the high byte of the pixels' alpha, but for - // 16 bit png files we also need the low byte set. we'll do that here. - if (depth == 16) { - cur = a->out + stride*j; // start at the beginning of the row again - for (i=0; i < x; ++i,cur+=output_bytes) { - cur[filter_bytes+1] = 255; - } - } - } - } - - // we make a separate pass to expand bits to pixels; for performance, - // this could run two scanlines behind the above code, so it won't - // intefere with filtering but will still be in the cache. - if (depth < 8) { - for (j=0; j < y; ++j) { - stbi_uc *cur = a->out + stride*j; - stbi_uc *in = a->out + stride*j + x*out_n - img_width_bytes; - // unpack 1/2/4-bit into a 8-bit buffer. allows us to keep the common 8-bit path optimal at minimal cost for 1/2/4-bit - // png guarante byte alignment, if width is not multiple of 8/4/2 we'll decode dummy trailing data that will be skipped in the later loop - stbi_uc scale = (color == 0) ? stbi__depth_scale_table[depth] : 1; // scale grayscale values to 0..255 range - - // note that the final byte might overshoot and write more data than desired. - // we can allocate enough data that this never writes out of memory, but it - // could also overwrite the next scanline. can it overwrite non-empty data - // on the next scanline? yes, consider 1-pixel-wide scanlines with 1-bit-per-pixel. - // so we need to explicitly clamp the final ones - - if (depth == 4) { - for (k=x*img_n; k >= 2; k-=2, ++in) { - *cur++ = scale * ((*in >> 4) ); - *cur++ = scale * ((*in ) & 0x0f); - } - if (k > 0) *cur++ = scale * ((*in >> 4) ); - } else if (depth == 2) { - for (k=x*img_n; k >= 4; k-=4, ++in) { - *cur++ = scale * ((*in >> 6) ); - *cur++ = scale * ((*in >> 4) & 0x03); - *cur++ = scale * ((*in >> 2) & 0x03); - *cur++ = scale * ((*in ) & 0x03); - } - if (k > 0) *cur++ = scale * ((*in >> 6) ); - if (k > 1) *cur++ = scale * ((*in >> 4) & 0x03); - if (k > 2) *cur++ = scale * ((*in >> 2) & 0x03); - } else if (depth == 1) { - for (k=x*img_n; k >= 8; k-=8, ++in) { - *cur++ = scale * ((*in >> 7) ); - *cur++ = scale * ((*in >> 6) & 0x01); - *cur++ = scale * ((*in >> 5) & 0x01); - *cur++ = scale * ((*in >> 4) & 0x01); - *cur++ = scale * ((*in >> 3) & 0x01); - *cur++ = scale * ((*in >> 2) & 0x01); - *cur++ = scale * ((*in >> 1) & 0x01); - *cur++ = scale * ((*in ) & 0x01); - } - if (k > 0) *cur++ = scale * ((*in >> 7) ); - if (k > 1) *cur++ = scale * ((*in >> 6) & 0x01); - if (k > 2) *cur++ = scale * ((*in >> 5) & 0x01); - if (k > 3) *cur++ = scale * ((*in >> 4) & 0x01); - if (k > 4) *cur++ = scale * ((*in >> 3) & 0x01); - if (k > 5) *cur++ = scale * ((*in >> 2) & 0x01); - if (k > 6) *cur++ = scale * ((*in >> 1) & 0x01); - } - if (img_n != out_n) { - int q; - // insert alpha = 255 - cur = a->out + stride*j; - if (img_n == 1) { - for (q=x-1; q >= 0; --q) { - cur[q*2+1] = 255; - cur[q*2+0] = cur[q]; - } - } else { - STBI_ASSERT(img_n == 3); - for (q=x-1; q >= 0; --q) { - cur[q*4+3] = 255; - cur[q*4+2] = cur[q*3+2]; - cur[q*4+1] = cur[q*3+1]; - cur[q*4+0] = cur[q*3+0]; - } - } - } - } - } else if (depth == 16) { - // force the image data from big-endian to platform-native. - // this is done in a separate pass due to the decoding relying - // on the data being untouched, but could probably be done - // per-line during decode if care is taken. - stbi_uc *cur = a->out; - stbi__uint16 *cur16 = (stbi__uint16*)cur; - - for(i=0; i < x*y*out_n; ++i,cur16++,cur+=2) { - *cur16 = (cur[0] << 8) | cur[1]; - } - } - - return 1; -} - -static int stbi__create_png_image(stbi__png *a, stbi_uc *image_data, stbi__uint32 image_data_len, int out_n, int depth, int color, int interlaced) -{ - int bytes = (depth == 16 ? 2 : 1); - int out_bytes = out_n * bytes; - stbi_uc *final; - int p; - if (!interlaced) - return stbi__create_png_image_raw(a, image_data, image_data_len, out_n, a->s->img_x, a->s->img_y, depth, color); - - // de-interlacing - final = (stbi_uc *) stbi__malloc_mad3(a->s->img_x, a->s->img_y, out_bytes, 0); - if (!final) return stbi__err("outofmem", "Out of memory"); - for (p=0; p < 7; ++p) { - int xorig[] = { 0,4,0,2,0,1,0 }; - int yorig[] = { 0,0,4,0,2,0,1 }; - int xspc[] = { 8,8,4,4,2,2,1 }; - int yspc[] = { 8,8,8,4,4,2,2 }; - int i,j,x,y; - // pass1_x[4] = 0, pass1_x[5] = 1, pass1_x[12] = 1 - x = (a->s->img_x - xorig[p] + xspc[p]-1) / xspc[p]; - y = (a->s->img_y - yorig[p] + yspc[p]-1) / yspc[p]; - if (x && y) { - stbi__uint32 img_len = ((((a->s->img_n * x * depth) + 7) >> 3) + 1) * y; - if (!stbi__create_png_image_raw(a, image_data, image_data_len, out_n, x, y, depth, color)) { - STBI_FREE(final); - return 0; - } - for (j=0; j < y; ++j) { - for (i=0; i < x; ++i) { - int out_y = j*yspc[p]+yorig[p]; - int out_x = i*xspc[p]+xorig[p]; - memcpy(final + out_y*a->s->img_x*out_bytes + out_x*out_bytes, - a->out + (j*x+i)*out_bytes, out_bytes); - } - } - STBI_FREE(a->out); - image_data += img_len; - image_data_len -= img_len; - } - } - a->out = final; - - return 1; -} - -static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], int out_n) -{ - stbi__context *s = z->s; - stbi__uint32 i, pixel_count = s->img_x * s->img_y; - stbi_uc *p = z->out; - - // compute color-based transparency, assuming we've - // already got 255 as the alpha value in the output - STBI_ASSERT(out_n == 2 || out_n == 4); - - if (out_n == 2) { - for (i=0; i < pixel_count; ++i) { - p[1] = (p[0] == tc[0] ? 0 : 255); - p += 2; - } - } else { - for (i=0; i < pixel_count; ++i) { - if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2]) - p[3] = 0; - p += 4; - } - } - return 1; -} - -static int stbi__compute_transparency16(stbi__png *z, stbi__uint16 tc[3], int out_n) -{ - stbi__context *s = z->s; - stbi__uint32 i, pixel_count = s->img_x * s->img_y; - stbi__uint16 *p = (stbi__uint16*) z->out; - - // compute color-based transparency, assuming we've - // already got 65535 as the alpha value in the output - STBI_ASSERT(out_n == 2 || out_n == 4); - - if (out_n == 2) { - for (i = 0; i < pixel_count; ++i) { - p[1] = (p[0] == tc[0] ? 0 : 65535); - p += 2; - } - } else { - for (i = 0; i < pixel_count; ++i) { - if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2]) - p[3] = 0; - p += 4; - } - } - return 1; -} - -static int stbi__expand_png_palette(stbi__png *a, stbi_uc *palette, int len, int pal_img_n) -{ - stbi__uint32 i, pixel_count = a->s->img_x * a->s->img_y; - stbi_uc *p, *temp_out, *orig = a->out; - - p = (stbi_uc *) stbi__malloc_mad2(pixel_count, pal_img_n, 0); - if (p == NULL) return stbi__err("outofmem", "Out of memory"); - - // between here and free(out) below, exitting would leak - temp_out = p; - - if (pal_img_n == 3) { - for (i=0; i < pixel_count; ++i) { - int n = orig[i]*4; - p[0] = palette[n ]; - p[1] = palette[n+1]; - p[2] = palette[n+2]; - p += 3; - } - } else { - for (i=0; i < pixel_count; ++i) { - int n = orig[i]*4; - p[0] = palette[n ]; - p[1] = palette[n+1]; - p[2] = palette[n+2]; - p[3] = palette[n+3]; - p += 4; - } - } - STBI_FREE(a->out); - a->out = temp_out; - - STBI_NOTUSED(len); - - return 1; -} - -static int stbi__unpremultiply_on_load_global = 0; -static int stbi__de_iphone_flag_global = 0; - -STBIDEF void stbi_set_unpremultiply_on_load(int flag_true_if_should_unpremultiply) -{ - stbi__unpremultiply_on_load_global = flag_true_if_should_unpremultiply; -} - -STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert) -{ - stbi__de_iphone_flag_global = flag_true_if_should_convert; -} - -#ifndef STBI_THREAD_LOCAL -#define stbi__unpremultiply_on_load stbi__unpremultiply_on_load_global -#define stbi__de_iphone_flag stbi__de_iphone_flag_global -#else -static STBI_THREAD_LOCAL int stbi__unpremultiply_on_load_local, stbi__unpremultiply_on_load_set; -static STBI_THREAD_LOCAL int stbi__de_iphone_flag_local, stbi__de_iphone_flag_set; - -STBIDEF void stbi__unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply) -{ - stbi__unpremultiply_on_load_local = flag_true_if_should_unpremultiply; - stbi__unpremultiply_on_load_set = 1; -} - -STBIDEF void stbi_convert_iphone_png_to_rgb_thread(int flag_true_if_should_convert) -{ - stbi__de_iphone_flag_local = flag_true_if_should_convert; - stbi__de_iphone_flag_set = 1; -} - -#define stbi__unpremultiply_on_load (stbi__unpremultiply_on_load_set \ - ? stbi__unpremultiply_on_load_local \ - : stbi__unpremultiply_on_load_global) -#define stbi__de_iphone_flag (stbi__de_iphone_flag_set \ - ? stbi__de_iphone_flag_local \ - : stbi__de_iphone_flag_global) -#endif // STBI_THREAD_LOCAL - -static void stbi__de_iphone(stbi__png *z) -{ - stbi__context *s = z->s; - stbi__uint32 i, pixel_count = s->img_x * s->img_y; - stbi_uc *p = z->out; - - if (s->img_out_n == 3) { // convert bgr to rgb - for (i=0; i < pixel_count; ++i) { - stbi_uc t = p[0]; - p[0] = p[2]; - p[2] = t; - p += 3; - } - } else { - STBI_ASSERT(s->img_out_n == 4); - if (stbi__unpremultiply_on_load) { - // convert bgr to rgb and unpremultiply - for (i=0; i < pixel_count; ++i) { - stbi_uc a = p[3]; - stbi_uc t = p[0]; - if (a) { - stbi_uc half = a / 2; - p[0] = (p[2] * 255 + half) / a; - p[1] = (p[1] * 255 + half) / a; - p[2] = ( t * 255 + half) / a; - } else { - p[0] = p[2]; - p[2] = t; - } - p += 4; - } - } else { - // convert bgr to rgb - for (i=0; i < pixel_count; ++i) { - stbi_uc t = p[0]; - p[0] = p[2]; - p[2] = t; - p += 4; - } - } - } -} - -#define STBI__PNG_TYPE(a,b,c,d) (((unsigned) (a) << 24) + ((unsigned) (b) << 16) + ((unsigned) (c) << 8) + (unsigned) (d)) - -static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp) -{ - stbi_uc palette[1024], pal_img_n=0; - stbi_uc has_trans=0, tc[3]={0}; - stbi__uint16 tc16[3]; - stbi__uint32 ioff=0, idata_limit=0, i, pal_len=0; - int first=1,k,interlace=0, color=0, is_iphone=0; - stbi__context *s = z->s; - - z->expanded = NULL; - z->idata = NULL; - z->out = NULL; - - if (!stbi__check_png_header(s)) return 0; - - if (scan == STBI__SCAN_type) return 1; - - for (;;) { - stbi__pngchunk c = stbi__get_chunk_header(s); - switch (c.type) { - case STBI__PNG_TYPE('C','g','B','I'): - is_iphone = 1; - stbi__skip(s, c.length); - break; - case STBI__PNG_TYPE('I','H','D','R'): { - int comp,filter; - if (!first) return stbi__err("multiple IHDR","Corrupt PNG"); - first = 0; - if (c.length != 13) return stbi__err("bad IHDR len","Corrupt PNG"); - s->img_x = stbi__get32be(s); - s->img_y = stbi__get32be(s); - if (s->img_y > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); - if (s->img_x > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); - z->depth = stbi__get8(s); if (z->depth != 1 && z->depth != 2 && z->depth != 4 && z->depth != 8 && z->depth != 16) return stbi__err("1/2/4/8/16-bit only","PNG not supported: 1/2/4/8/16-bit only"); - color = stbi__get8(s); if (color > 6) return stbi__err("bad ctype","Corrupt PNG"); - if (color == 3 && z->depth == 16) return stbi__err("bad ctype","Corrupt PNG"); - if (color == 3) pal_img_n = 3; else if (color & 1) return stbi__err("bad ctype","Corrupt PNG"); - comp = stbi__get8(s); if (comp) return stbi__err("bad comp method","Corrupt PNG"); - filter= stbi__get8(s); if (filter) return stbi__err("bad filter method","Corrupt PNG"); - interlace = stbi__get8(s); if (interlace>1) return stbi__err("bad interlace method","Corrupt PNG"); - if (!s->img_x || !s->img_y) return stbi__err("0-pixel image","Corrupt PNG"); - if (!pal_img_n) { - s->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0); - if ((1 << 30) / s->img_x / s->img_n < s->img_y) return stbi__err("too large", "Image too large to decode"); - if (scan == STBI__SCAN_header) return 1; - } else { - // if paletted, then pal_n is our final components, and - // img_n is # components to decompress/filter. - s->img_n = 1; - if ((1 << 30) / s->img_x / 4 < s->img_y) return stbi__err("too large","Corrupt PNG"); - // if SCAN_header, have to scan to see if we have a tRNS - } - break; - } - - case STBI__PNG_TYPE('P','L','T','E'): { - if (first) return stbi__err("first not IHDR", "Corrupt PNG"); - if (c.length > 256*3) return stbi__err("invalid PLTE","Corrupt PNG"); - pal_len = c.length / 3; - if (pal_len * 3 != c.length) return stbi__err("invalid PLTE","Corrupt PNG"); - for (i=0; i < pal_len; ++i) { - palette[i*4+0] = stbi__get8(s); - palette[i*4+1] = stbi__get8(s); - palette[i*4+2] = stbi__get8(s); - palette[i*4+3] = 255; - } - break; - } - - case STBI__PNG_TYPE('t','R','N','S'): { - if (first) return stbi__err("first not IHDR", "Corrupt PNG"); - if (z->idata) return stbi__err("tRNS after IDAT","Corrupt PNG"); - if (pal_img_n) { - if (scan == STBI__SCAN_header) { s->img_n = 4; return 1; } - if (pal_len == 0) return stbi__err("tRNS before PLTE","Corrupt PNG"); - if (c.length > pal_len) return stbi__err("bad tRNS len","Corrupt PNG"); - pal_img_n = 4; - for (i=0; i < c.length; ++i) - palette[i*4+3] = stbi__get8(s); - } else { - if (!(s->img_n & 1)) return stbi__err("tRNS with alpha","Corrupt PNG"); - if (c.length != (stbi__uint32) s->img_n*2) return stbi__err("bad tRNS len","Corrupt PNG"); - has_trans = 1; - if (z->depth == 16) { - for (k = 0; k < s->img_n; ++k) tc16[k] = (stbi__uint16)stbi__get16be(s); // copy the values as-is - } else { - for (k = 0; k < s->img_n; ++k) tc[k] = (stbi_uc)(stbi__get16be(s) & 255) * stbi__depth_scale_table[z->depth]; // non 8-bit images will be larger - } - } - break; - } - - case STBI__PNG_TYPE('I','D','A','T'): { - if (first) return stbi__err("first not IHDR", "Corrupt PNG"); - if (pal_img_n && !pal_len) return stbi__err("no PLTE","Corrupt PNG"); - if (scan == STBI__SCAN_header) { s->img_n = pal_img_n; return 1; } - if ((int)(ioff + c.length) < (int)ioff) return 0; - if (ioff + c.length > idata_limit) { - stbi__uint32 idata_limit_old = idata_limit; - stbi_uc *p; - if (idata_limit == 0) idata_limit = c.length > 4096 ? c.length : 4096; - while (ioff + c.length > idata_limit) - idata_limit *= 2; - STBI_NOTUSED(idata_limit_old); - p = (stbi_uc *) STBI_REALLOC_SIZED(z->idata, idata_limit_old, idata_limit); if (p == NULL) return stbi__err("outofmem", "Out of memory"); - z->idata = p; - } - if (!stbi__getn(s, z->idata+ioff,c.length)) return stbi__err("outofdata","Corrupt PNG"); - ioff += c.length; - break; - } - - case STBI__PNG_TYPE('I','E','N','D'): { - stbi__uint32 raw_len, bpl; - if (first) return stbi__err("first not IHDR", "Corrupt PNG"); - if (scan != STBI__SCAN_load) return 1; - if (z->idata == NULL) return stbi__err("no IDAT","Corrupt PNG"); - // initial guess for decoded data size to avoid unnecessary reallocs - bpl = (s->img_x * z->depth + 7) / 8; // bytes per line, per component - raw_len = bpl * s->img_y * s->img_n /* pixels */ + s->img_y /* filter mode per row */; - z->expanded = (stbi_uc *) stbi_zlib_decode_malloc_guesssize_headerflag((char *) z->idata, ioff, raw_len, (int *) &raw_len, !is_iphone); - if (z->expanded == NULL) return 0; // zlib should set error - STBI_FREE(z->idata); z->idata = NULL; - if ((req_comp == s->img_n+1 && req_comp != 3 && !pal_img_n) || has_trans) - s->img_out_n = s->img_n+1; - else - s->img_out_n = s->img_n; - if (!stbi__create_png_image(z, z->expanded, raw_len, s->img_out_n, z->depth, color, interlace)) return 0; - if (has_trans) { - if (z->depth == 16) { - if (!stbi__compute_transparency16(z, tc16, s->img_out_n)) return 0; - } else { - if (!stbi__compute_transparency(z, tc, s->img_out_n)) return 0; - } - } - if (is_iphone && stbi__de_iphone_flag && s->img_out_n > 2) - stbi__de_iphone(z); - if (pal_img_n) { - // pal_img_n == 3 or 4 - s->img_n = pal_img_n; // record the actual colors we had - s->img_out_n = pal_img_n; - if (req_comp >= 3) s->img_out_n = req_comp; - if (!stbi__expand_png_palette(z, palette, pal_len, s->img_out_n)) - return 0; - } else if (has_trans) { - // non-paletted image with tRNS -> source image has (constant) alpha - ++s->img_n; - } - STBI_FREE(z->expanded); z->expanded = NULL; - // end of PNG chunk, read and skip CRC - stbi__get32be(s); - return 1; - } - - default: - // if critical, fail - if (first) return stbi__err("first not IHDR", "Corrupt PNG"); - if ((c.type & (1 << 29)) == 0) { - #ifndef STBI_NO_FAILURE_STRINGS - // not threadsafe - static char invalid_chunk[] = "XXXX PNG chunk not known"; - invalid_chunk[0] = STBI__BYTECAST(c.type >> 24); - invalid_chunk[1] = STBI__BYTECAST(c.type >> 16); - invalid_chunk[2] = STBI__BYTECAST(c.type >> 8); - invalid_chunk[3] = STBI__BYTECAST(c.type >> 0); - #endif - return stbi__err(invalid_chunk, "PNG not supported: unknown PNG chunk type"); - } - stbi__skip(s, c.length); - break; - } - // end of PNG chunk, read and skip CRC - stbi__get32be(s); - } -} - -static void *stbi__do_png(stbi__png *p, int *x, int *y, int *n, int req_comp, stbi__result_info *ri) -{ - void *result=NULL; - if (req_comp < 0 || req_comp > 4) return stbi__errpuc("bad req_comp", "Internal error"); - if (stbi__parse_png_file(p, STBI__SCAN_load, req_comp)) { - if (p->depth <= 8) - ri->bits_per_channel = 8; - else if (p->depth == 16) - ri->bits_per_channel = 16; - else - return stbi__errpuc("bad bits_per_channel", "PNG not supported: unsupported color depth"); - result = p->out; - p->out = NULL; - if (req_comp && req_comp != p->s->img_out_n) { - if (ri->bits_per_channel == 8) - result = stbi__convert_format((unsigned char *) result, p->s->img_out_n, req_comp, p->s->img_x, p->s->img_y); - else - result = stbi__convert_format16((stbi__uint16 *) result, p->s->img_out_n, req_comp, p->s->img_x, p->s->img_y); - p->s->img_out_n = req_comp; - if (result == NULL) return result; - } - *x = p->s->img_x; - *y = p->s->img_y; - if (n) *n = p->s->img_n; - } - STBI_FREE(p->out); p->out = NULL; - STBI_FREE(p->expanded); p->expanded = NULL; - STBI_FREE(p->idata); p->idata = NULL; - - return result; -} - -static void *stbi__png_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - stbi__png p; - p.s = s; - return stbi__do_png(&p, x,y,comp,req_comp, ri); -} - -static int stbi__png_test(stbi__context *s) -{ - int r; - r = stbi__check_png_header(s); - stbi__rewind(s); - return r; -} - -static int stbi__png_info_raw(stbi__png *p, int *x, int *y, int *comp) -{ - if (!stbi__parse_png_file(p, STBI__SCAN_header, 0)) { - stbi__rewind( p->s ); - return 0; - } - if (x) *x = p->s->img_x; - if (y) *y = p->s->img_y; - if (comp) *comp = p->s->img_n; - return 1; -} - -static int stbi__png_info(stbi__context *s, int *x, int *y, int *comp) -{ - stbi__png p; - p.s = s; - return stbi__png_info_raw(&p, x, y, comp); -} - -static int stbi__png_is16(stbi__context *s) -{ - stbi__png p; - p.s = s; - if (!stbi__png_info_raw(&p, NULL, NULL, NULL)) - return 0; - if (p.depth != 16) { - stbi__rewind(p.s); - return 0; - } - return 1; -} -#endif - -// Microsoft/Windows BMP image - -#ifndef STBI_NO_BMP -static int stbi__bmp_test_raw(stbi__context *s) -{ - int r; - int sz; - if (stbi__get8(s) != 'B') return 0; - if (stbi__get8(s) != 'M') return 0; - stbi__get32le(s); // discard filesize - stbi__get16le(s); // discard reserved - stbi__get16le(s); // discard reserved - stbi__get32le(s); // discard data offset - sz = stbi__get32le(s); - r = (sz == 12 || sz == 40 || sz == 56 || sz == 108 || sz == 124); - return r; -} - -static int stbi__bmp_test(stbi__context *s) -{ - int r = stbi__bmp_test_raw(s); - stbi__rewind(s); - return r; -} - - -// returns 0..31 for the highest set bit -static int stbi__high_bit(unsigned int z) -{ - int n=0; - if (z == 0) return -1; - if (z >= 0x10000) { n += 16; z >>= 16; } - if (z >= 0x00100) { n += 8; z >>= 8; } - if (z >= 0x00010) { n += 4; z >>= 4; } - if (z >= 0x00004) { n += 2; z >>= 2; } - if (z >= 0x00002) { n += 1;/* >>= 1;*/ } - return n; -} - -static int stbi__bitcount(unsigned int a) -{ - a = (a & 0x55555555) + ((a >> 1) & 0x55555555); // max 2 - a = (a & 0x33333333) + ((a >> 2) & 0x33333333); // max 4 - a = (a + (a >> 4)) & 0x0f0f0f0f; // max 8 per 4, now 8 bits - a = (a + (a >> 8)); // max 16 per 8 bits - a = (a + (a >> 16)); // max 32 per 8 bits - return a & 0xff; -} - -// extract an arbitrarily-aligned N-bit value (N=bits) -// from v, and then make it 8-bits long and fractionally -// extend it to full full range. -static int stbi__shiftsigned(unsigned int v, int shift, int bits) -{ - static unsigned int mul_table[9] = { - 0, - 0xff/*0b11111111*/, 0x55/*0b01010101*/, 0x49/*0b01001001*/, 0x11/*0b00010001*/, - 0x21/*0b00100001*/, 0x41/*0b01000001*/, 0x81/*0b10000001*/, 0x01/*0b00000001*/, - }; - static unsigned int shift_table[9] = { - 0, 0,0,1,0,2,4,6,0, - }; - if (shift < 0) - v <<= -shift; - else - v >>= shift; - STBI_ASSERT(v < 256); - v >>= (8-bits); - STBI_ASSERT(bits >= 0 && bits <= 8); - return (int) ((unsigned) v * mul_table[bits]) >> shift_table[bits]; -} - -typedef struct -{ - int bpp, offset, hsz; - unsigned int mr,mg,mb,ma, all_a; - int extra_read; -} stbi__bmp_data; - -static int stbi__bmp_set_mask_defaults(stbi__bmp_data *info, int compress) -{ - // BI_BITFIELDS specifies masks explicitly, don't override - if (compress == 3) - return 1; - - if (compress == 0) { - if (info->bpp == 16) { - info->mr = 31u << 10; - info->mg = 31u << 5; - info->mb = 31u << 0; - } else if (info->bpp == 32) { - info->mr = 0xffu << 16; - info->mg = 0xffu << 8; - info->mb = 0xffu << 0; - info->ma = 0xffu << 24; - info->all_a = 0; // if all_a is 0 at end, then we loaded alpha channel but it was all 0 - } else { - // otherwise, use defaults, which is all-0 - info->mr = info->mg = info->mb = info->ma = 0; - } - return 1; - } - return 0; // error -} - -static void *stbi__bmp_parse_header(stbi__context *s, stbi__bmp_data *info) -{ - int hsz; - if (stbi__get8(s) != 'B' || stbi__get8(s) != 'M') return stbi__errpuc("not BMP", "Corrupt BMP"); - stbi__get32le(s); // discard filesize - stbi__get16le(s); // discard reserved - stbi__get16le(s); // discard reserved - info->offset = stbi__get32le(s); - info->hsz = hsz = stbi__get32le(s); - info->mr = info->mg = info->mb = info->ma = 0; - info->extra_read = 14; - - if (info->offset < 0) return stbi__errpuc("bad BMP", "bad BMP"); - - if (hsz != 12 && hsz != 40 && hsz != 56 && hsz != 108 && hsz != 124) return stbi__errpuc("unknown BMP", "BMP type not supported: unknown"); - if (hsz == 12) { - s->img_x = stbi__get16le(s); - s->img_y = stbi__get16le(s); - } else { - s->img_x = stbi__get32le(s); - s->img_y = stbi__get32le(s); - } - if (stbi__get16le(s) != 1) return stbi__errpuc("bad BMP", "bad BMP"); - info->bpp = stbi__get16le(s); - if (hsz != 12) { - int compress = stbi__get32le(s); - if (compress == 1 || compress == 2) return stbi__errpuc("BMP RLE", "BMP type not supported: RLE"); - if (compress >= 4) return stbi__errpuc("BMP JPEG/PNG", "BMP type not supported: unsupported compression"); // this includes PNG/JPEG modes - if (compress == 3 && info->bpp != 16 && info->bpp != 32) return stbi__errpuc("bad BMP", "bad BMP"); // bitfields requires 16 or 32 bits/pixel - stbi__get32le(s); // discard sizeof - stbi__get32le(s); // discard hres - stbi__get32le(s); // discard vres - stbi__get32le(s); // discard colorsused - stbi__get32le(s); // discard max important - if (hsz == 40 || hsz == 56) { - if (hsz == 56) { - stbi__get32le(s); - stbi__get32le(s); - stbi__get32le(s); - stbi__get32le(s); - } - if (info->bpp == 16 || info->bpp == 32) { - if (compress == 0) { - stbi__bmp_set_mask_defaults(info, compress); - } else if (compress == 3) { - info->mr = stbi__get32le(s); - info->mg = stbi__get32le(s); - info->mb = stbi__get32le(s); - info->extra_read += 12; - // not documented, but generated by photoshop and handled by mspaint - if (info->mr == info->mg && info->mg == info->mb) { - // ?!?!? - return stbi__errpuc("bad BMP", "bad BMP"); - } - } else - return stbi__errpuc("bad BMP", "bad BMP"); - } - } else { - // V4/V5 header - int i; - if (hsz != 108 && hsz != 124) - return stbi__errpuc("bad BMP", "bad BMP"); - info->mr = stbi__get32le(s); - info->mg = stbi__get32le(s); - info->mb = stbi__get32le(s); - info->ma = stbi__get32le(s); - if (compress != 3) // override mr/mg/mb unless in BI_BITFIELDS mode, as per docs - stbi__bmp_set_mask_defaults(info, compress); - stbi__get32le(s); // discard color space - for (i=0; i < 12; ++i) - stbi__get32le(s); // discard color space parameters - if (hsz == 124) { - stbi__get32le(s); // discard rendering intent - stbi__get32le(s); // discard offset of profile data - stbi__get32le(s); // discard size of profile data - stbi__get32le(s); // discard reserved - } - } - } - return (void *) 1; -} - - -static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - stbi_uc *out; - unsigned int mr=0,mg=0,mb=0,ma=0, all_a; - stbi_uc pal[256][4]; - int psize=0,i,j,width; - int flip_vertically, pad, target; - stbi__bmp_data info; - STBI_NOTUSED(ri); - - info.all_a = 255; - if (stbi__bmp_parse_header(s, &info) == NULL) - return NULL; // error code already set - - flip_vertically = ((int) s->img_y) > 0; - s->img_y = abs((int) s->img_y); - - if (s->img_y > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); - if (s->img_x > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); - - mr = info.mr; - mg = info.mg; - mb = info.mb; - ma = info.ma; - all_a = info.all_a; - - if (info.hsz == 12) { - if (info.bpp < 24) - psize = (info.offset - info.extra_read - 24) / 3; - } else { - if (info.bpp < 16) - psize = (info.offset - info.extra_read - info.hsz) >> 2; - } - if (psize == 0) { - if (info.offset != s->callback_already_read + (s->img_buffer - s->img_buffer_original)) { - return stbi__errpuc("bad offset", "Corrupt BMP"); - } - } - - if (info.bpp == 24 && ma == 0xff000000) - s->img_n = 3; - else - s->img_n = ma ? 4 : 3; - if (req_comp && req_comp >= 3) // we can directly decode 3 or 4 - target = req_comp; - else - target = s->img_n; // if they want monochrome, we'll post-convert - - // sanity-check size - if (!stbi__mad3sizes_valid(target, s->img_x, s->img_y, 0)) - return stbi__errpuc("too large", "Corrupt BMP"); - - out = (stbi_uc *) stbi__malloc_mad3(target, s->img_x, s->img_y, 0); - if (!out) return stbi__errpuc("outofmem", "Out of memory"); - if (info.bpp < 16) { - int z=0; - if (psize == 0 || psize > 256) { STBI_FREE(out); return stbi__errpuc("invalid", "Corrupt BMP"); } - for (i=0; i < psize; ++i) { - pal[i][2] = stbi__get8(s); - pal[i][1] = stbi__get8(s); - pal[i][0] = stbi__get8(s); - if (info.hsz != 12) stbi__get8(s); - pal[i][3] = 255; - } - stbi__skip(s, info.offset - info.extra_read - info.hsz - psize * (info.hsz == 12 ? 3 : 4)); - if (info.bpp == 1) width = (s->img_x + 7) >> 3; - else if (info.bpp == 4) width = (s->img_x + 1) >> 1; - else if (info.bpp == 8) width = s->img_x; - else { STBI_FREE(out); return stbi__errpuc("bad bpp", "Corrupt BMP"); } - pad = (-width)&3; - if (info.bpp == 1) { - for (j=0; j < (int) s->img_y; ++j) { - int bit_offset = 7, v = stbi__get8(s); - for (i=0; i < (int) s->img_x; ++i) { - int color = (v>>bit_offset)&0x1; - out[z++] = pal[color][0]; - out[z++] = pal[color][1]; - out[z++] = pal[color][2]; - if (target == 4) out[z++] = 255; - if (i+1 == (int) s->img_x) break; - if((--bit_offset) < 0) { - bit_offset = 7; - v = stbi__get8(s); - } - } - stbi__skip(s, pad); - } - } else { - for (j=0; j < (int) s->img_y; ++j) { - for (i=0; i < (int) s->img_x; i += 2) { - int v=stbi__get8(s),v2=0; - if (info.bpp == 4) { - v2 = v & 15; - v >>= 4; - } - out[z++] = pal[v][0]; - out[z++] = pal[v][1]; - out[z++] = pal[v][2]; - if (target == 4) out[z++] = 255; - if (i+1 == (int) s->img_x) break; - v = (info.bpp == 8) ? stbi__get8(s) : v2; - out[z++] = pal[v][0]; - out[z++] = pal[v][1]; - out[z++] = pal[v][2]; - if (target == 4) out[z++] = 255; - } - stbi__skip(s, pad); - } - } - } else { - int rshift=0,gshift=0,bshift=0,ashift=0,rcount=0,gcount=0,bcount=0,acount=0; - int z = 0; - int easy=0; - stbi__skip(s, info.offset - info.extra_read - info.hsz); - if (info.bpp == 24) width = 3 * s->img_x; - else if (info.bpp == 16) width = 2*s->img_x; - else /* bpp = 32 and pad = 0 */ width=0; - pad = (-width) & 3; - if (info.bpp == 24) { - easy = 1; - } else if (info.bpp == 32) { - if (mb == 0xff && mg == 0xff00 && mr == 0x00ff0000 && ma == 0xff000000) - easy = 2; - } - if (!easy) { - if (!mr || !mg || !mb) { STBI_FREE(out); return stbi__errpuc("bad masks", "Corrupt BMP"); } - // right shift amt to put high bit in position #7 - rshift = stbi__high_bit(mr)-7; rcount = stbi__bitcount(mr); - gshift = stbi__high_bit(mg)-7; gcount = stbi__bitcount(mg); - bshift = stbi__high_bit(mb)-7; bcount = stbi__bitcount(mb); - ashift = stbi__high_bit(ma)-7; acount = stbi__bitcount(ma); - if (rcount > 8 || gcount > 8 || bcount > 8 || acount > 8) { STBI_FREE(out); return stbi__errpuc("bad masks", "Corrupt BMP"); } - } - for (j=0; j < (int) s->img_y; ++j) { - if (easy) { - for (i=0; i < (int) s->img_x; ++i) { - unsigned char a; - out[z+2] = stbi__get8(s); - out[z+1] = stbi__get8(s); - out[z+0] = stbi__get8(s); - z += 3; - a = (easy == 2 ? stbi__get8(s) : 255); - all_a |= a; - if (target == 4) out[z++] = a; - } - } else { - int bpp = info.bpp; - for (i=0; i < (int) s->img_x; ++i) { - stbi__uint32 v = (bpp == 16 ? (stbi__uint32) stbi__get16le(s) : stbi__get32le(s)); - unsigned int a; - out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mr, rshift, rcount)); - out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mg, gshift, gcount)); - out[z++] = STBI__BYTECAST(stbi__shiftsigned(v & mb, bshift, bcount)); - a = (ma ? stbi__shiftsigned(v & ma, ashift, acount) : 255); - all_a |= a; - if (target == 4) out[z++] = STBI__BYTECAST(a); - } - } - stbi__skip(s, pad); - } - } - - // if alpha channel is all 0s, replace with all 255s - if (target == 4 && all_a == 0) - for (i=4*s->img_x*s->img_y-1; i >= 0; i -= 4) - out[i] = 255; - - if (flip_vertically) { - stbi_uc t; - for (j=0; j < (int) s->img_y>>1; ++j) { - stbi_uc *p1 = out + j *s->img_x*target; - stbi_uc *p2 = out + (s->img_y-1-j)*s->img_x*target; - for (i=0; i < (int) s->img_x*target; ++i) { - t = p1[i]; p1[i] = p2[i]; p2[i] = t; - } - } - } - - if (req_comp && req_comp != target) { - out = stbi__convert_format(out, target, req_comp, s->img_x, s->img_y); - if (out == NULL) return out; // stbi__convert_format frees input on failure - } - - *x = s->img_x; - *y = s->img_y; - if (comp) *comp = s->img_n; - return out; -} -#endif - -// Targa Truevision - TGA -// by Jonathan Dummer -#ifndef STBI_NO_TGA -// returns STBI_rgb or whatever, 0 on error -static int stbi__tga_get_comp(int bits_per_pixel, int is_grey, int* is_rgb16) -{ - // only RGB or RGBA (incl. 16bit) or grey allowed - if (is_rgb16) *is_rgb16 = 0; - switch(bits_per_pixel) { - case 8: return STBI_grey; - case 16: if(is_grey) return STBI_grey_alpha; - // fallthrough - case 15: if(is_rgb16) *is_rgb16 = 1; - return STBI_rgb; - case 24: // fallthrough - case 32: return bits_per_pixel/8; - default: return 0; - } -} - -static int stbi__tga_info(stbi__context *s, int *x, int *y, int *comp) -{ - int tga_w, tga_h, tga_comp, tga_image_type, tga_bits_per_pixel, tga_colormap_bpp; - int sz, tga_colormap_type; - stbi__get8(s); // discard Offset - tga_colormap_type = stbi__get8(s); // colormap type - if( tga_colormap_type > 1 ) { - stbi__rewind(s); - return 0; // only RGB or indexed allowed - } - tga_image_type = stbi__get8(s); // image type - if ( tga_colormap_type == 1 ) { // colormapped (paletted) image - if (tga_image_type != 1 && tga_image_type != 9) { - stbi__rewind(s); - return 0; - } - stbi__skip(s,4); // skip index of first colormap entry and number of entries - sz = stbi__get8(s); // check bits per palette color entry - if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) { - stbi__rewind(s); - return 0; - } - stbi__skip(s,4); // skip image x and y origin - tga_colormap_bpp = sz; - } else { // "normal" image w/o colormap - only RGB or grey allowed, +/- RLE - if ( (tga_image_type != 2) && (tga_image_type != 3) && (tga_image_type != 10) && (tga_image_type != 11) ) { - stbi__rewind(s); - return 0; // only RGB or grey allowed, +/- RLE - } - stbi__skip(s,9); // skip colormap specification and image x/y origin - tga_colormap_bpp = 0; - } - tga_w = stbi__get16le(s); - if( tga_w < 1 ) { - stbi__rewind(s); - return 0; // test width - } - tga_h = stbi__get16le(s); - if( tga_h < 1 ) { - stbi__rewind(s); - return 0; // test height - } - tga_bits_per_pixel = stbi__get8(s); // bits per pixel - stbi__get8(s); // ignore alpha bits - if (tga_colormap_bpp != 0) { - if((tga_bits_per_pixel != 8) && (tga_bits_per_pixel != 16)) { - // when using a colormap, tga_bits_per_pixel is the size of the indexes - // I don't think anything but 8 or 16bit indexes makes sense - stbi__rewind(s); - return 0; - } - tga_comp = stbi__tga_get_comp(tga_colormap_bpp, 0, NULL); - } else { - tga_comp = stbi__tga_get_comp(tga_bits_per_pixel, (tga_image_type == 3) || (tga_image_type == 11), NULL); - } - if(!tga_comp) { - stbi__rewind(s); - return 0; - } - if (x) *x = tga_w; - if (y) *y = tga_h; - if (comp) *comp = tga_comp; - return 1; // seems to have passed everything -} - -static int stbi__tga_test(stbi__context *s) -{ - int res = 0; - int sz, tga_color_type; - stbi__get8(s); // discard Offset - tga_color_type = stbi__get8(s); // color type - if ( tga_color_type > 1 ) goto errorEnd; // only RGB or indexed allowed - sz = stbi__get8(s); // image type - if ( tga_color_type == 1 ) { // colormapped (paletted) image - if (sz != 1 && sz != 9) goto errorEnd; // colortype 1 demands image type 1 or 9 - stbi__skip(s,4); // skip index of first colormap entry and number of entries - sz = stbi__get8(s); // check bits per palette color entry - if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) goto errorEnd; - stbi__skip(s,4); // skip image x and y origin - } else { // "normal" image w/o colormap - if ( (sz != 2) && (sz != 3) && (sz != 10) && (sz != 11) ) goto errorEnd; // only RGB or grey allowed, +/- RLE - stbi__skip(s,9); // skip colormap specification and image x/y origin - } - if ( stbi__get16le(s) < 1 ) goto errorEnd; // test width - if ( stbi__get16le(s) < 1 ) goto errorEnd; // test height - sz = stbi__get8(s); // bits per pixel - if ( (tga_color_type == 1) && (sz != 8) && (sz != 16) ) goto errorEnd; // for colormapped images, bpp is size of an index - if ( (sz != 8) && (sz != 15) && (sz != 16) && (sz != 24) && (sz != 32) ) goto errorEnd; - - res = 1; // if we got this far, everything's good and we can return 1 instead of 0 - -errorEnd: - stbi__rewind(s); - return res; -} - -// read 16bit value and convert to 24bit RGB -static void stbi__tga_read_rgb16(stbi__context *s, stbi_uc* out) -{ - stbi__uint16 px = (stbi__uint16)stbi__get16le(s); - stbi__uint16 fiveBitMask = 31; - // we have 3 channels with 5bits each - int r = (px >> 10) & fiveBitMask; - int g = (px >> 5) & fiveBitMask; - int b = px & fiveBitMask; - // Note that this saves the data in RGB(A) order, so it doesn't need to be swapped later - out[0] = (stbi_uc)((r * 255)/31); - out[1] = (stbi_uc)((g * 255)/31); - out[2] = (stbi_uc)((b * 255)/31); - - // some people claim that the most significant bit might be used for alpha - // (possibly if an alpha-bit is set in the "image descriptor byte") - // but that only made 16bit test images completely translucent.. - // so let's treat all 15 and 16bit TGAs as RGB with no alpha. -} - -static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - // read in the TGA header stuff - int tga_offset = stbi__get8(s); - int tga_indexed = stbi__get8(s); - int tga_image_type = stbi__get8(s); - int tga_is_RLE = 0; - int tga_palette_start = stbi__get16le(s); - int tga_palette_len = stbi__get16le(s); - int tga_palette_bits = stbi__get8(s); - int tga_x_origin = stbi__get16le(s); - int tga_y_origin = stbi__get16le(s); - int tga_width = stbi__get16le(s); - int tga_height = stbi__get16le(s); - int tga_bits_per_pixel = stbi__get8(s); - int tga_comp, tga_rgb16=0; - int tga_inverted = stbi__get8(s); - // int tga_alpha_bits = tga_inverted & 15; // the 4 lowest bits - unused (useless?) - // image data - unsigned char *tga_data; - unsigned char *tga_palette = NULL; - int i, j; - unsigned char raw_data[4] = {0}; - int RLE_count = 0; - int RLE_repeating = 0; - int read_next_pixel = 1; - STBI_NOTUSED(ri); - STBI_NOTUSED(tga_x_origin); // @TODO - STBI_NOTUSED(tga_y_origin); // @TODO - - if (tga_height > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); - if (tga_width > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); - - // do a tiny bit of precessing - if ( tga_image_type >= 8 ) - { - tga_image_type -= 8; - tga_is_RLE = 1; - } - tga_inverted = 1 - ((tga_inverted >> 5) & 1); - - // If I'm paletted, then I'll use the number of bits from the palette - if ( tga_indexed ) tga_comp = stbi__tga_get_comp(tga_palette_bits, 0, &tga_rgb16); - else tga_comp = stbi__tga_get_comp(tga_bits_per_pixel, (tga_image_type == 3), &tga_rgb16); - - if(!tga_comp) // shouldn't really happen, stbi__tga_test() should have ensured basic consistency - return stbi__errpuc("bad format", "Can't find out TGA pixelformat"); - - // tga info - *x = tga_width; - *y = tga_height; - if (comp) *comp = tga_comp; - - if (!stbi__mad3sizes_valid(tga_width, tga_height, tga_comp, 0)) - return stbi__errpuc("too large", "Corrupt TGA"); - - tga_data = (unsigned char*)stbi__malloc_mad3(tga_width, tga_height, tga_comp, 0); - if (!tga_data) return stbi__errpuc("outofmem", "Out of memory"); - - // skip to the data's starting position (offset usually = 0) - stbi__skip(s, tga_offset ); - - if ( !tga_indexed && !tga_is_RLE && !tga_rgb16 ) { - for (i=0; i < tga_height; ++i) { - int row = tga_inverted ? tga_height -i - 1 : i; - stbi_uc *tga_row = tga_data + row*tga_width*tga_comp; - stbi__getn(s, tga_row, tga_width * tga_comp); - } - } else { - // do I need to load a palette? - if ( tga_indexed) - { - if (tga_palette_len == 0) { /* you have to have at least one entry! */ - STBI_FREE(tga_data); - return stbi__errpuc("bad palette", "Corrupt TGA"); - } - - // any data to skip? (offset usually = 0) - stbi__skip(s, tga_palette_start ); - // load the palette - tga_palette = (unsigned char*)stbi__malloc_mad2(tga_palette_len, tga_comp, 0); - if (!tga_palette) { - STBI_FREE(tga_data); - return stbi__errpuc("outofmem", "Out of memory"); - } - if (tga_rgb16) { - stbi_uc *pal_entry = tga_palette; - STBI_ASSERT(tga_comp == STBI_rgb); - for (i=0; i < tga_palette_len; ++i) { - stbi__tga_read_rgb16(s, pal_entry); - pal_entry += tga_comp; - } - } else if (!stbi__getn(s, tga_palette, tga_palette_len * tga_comp)) { - STBI_FREE(tga_data); - STBI_FREE(tga_palette); - return stbi__errpuc("bad palette", "Corrupt TGA"); - } - } - // load the data - for (i=0; i < tga_width * tga_height; ++i) - { - // if I'm in RLE mode, do I need to get a RLE stbi__pngchunk? - if ( tga_is_RLE ) - { - if ( RLE_count == 0 ) - { - // yep, get the next byte as a RLE command - int RLE_cmd = stbi__get8(s); - RLE_count = 1 + (RLE_cmd & 127); - RLE_repeating = RLE_cmd >> 7; - read_next_pixel = 1; - } else if ( !RLE_repeating ) - { - read_next_pixel = 1; - } - } else - { - read_next_pixel = 1; - } - // OK, if I need to read a pixel, do it now - if ( read_next_pixel ) - { - // load however much data we did have - if ( tga_indexed ) - { - // read in index, then perform the lookup - int pal_idx = (tga_bits_per_pixel == 8) ? stbi__get8(s) : stbi__get16le(s); - if ( pal_idx >= tga_palette_len ) { - // invalid index - pal_idx = 0; - } - pal_idx *= tga_comp; - for (j = 0; j < tga_comp; ++j) { - raw_data[j] = tga_palette[pal_idx+j]; - } - } else if(tga_rgb16) { - STBI_ASSERT(tga_comp == STBI_rgb); - stbi__tga_read_rgb16(s, raw_data); - } else { - // read in the data raw - for (j = 0; j < tga_comp; ++j) { - raw_data[j] = stbi__get8(s); - } - } - // clear the reading flag for the next pixel - read_next_pixel = 0; - } // end of reading a pixel - - // copy data - for (j = 0; j < tga_comp; ++j) - tga_data[i*tga_comp+j] = raw_data[j]; - - // in case we're in RLE mode, keep counting down - --RLE_count; - } - // do I need to invert the image? - if ( tga_inverted ) - { - for (j = 0; j*2 < tga_height; ++j) - { - int index1 = j * tga_width * tga_comp; - int index2 = (tga_height - 1 - j) * tga_width * tga_comp; - for (i = tga_width * tga_comp; i > 0; --i) - { - unsigned char temp = tga_data[index1]; - tga_data[index1] = tga_data[index2]; - tga_data[index2] = temp; - ++index1; - ++index2; - } - } - } - // clear my palette, if I had one - if ( tga_palette != NULL ) - { - STBI_FREE( tga_palette ); - } - } - - // swap RGB - if the source data was RGB16, it already is in the right order - if (tga_comp >= 3 && !tga_rgb16) - { - unsigned char* tga_pixel = tga_data; - for (i=0; i < tga_width * tga_height; ++i) - { - unsigned char temp = tga_pixel[0]; - tga_pixel[0] = tga_pixel[2]; - tga_pixel[2] = temp; - tga_pixel += tga_comp; - } - } - - // convert to target component count - if (req_comp && req_comp != tga_comp) - tga_data = stbi__convert_format(tga_data, tga_comp, req_comp, tga_width, tga_height); - - // the things I do to get rid of an error message, and yet keep - // Microsoft's C compilers happy... [8^( - tga_palette_start = tga_palette_len = tga_palette_bits = - tga_x_origin = tga_y_origin = 0; - STBI_NOTUSED(tga_palette_start); - // OK, done - return tga_data; -} -#endif - -// ************************************************************************************************* -// Photoshop PSD loader -- PD by Thatcher Ulrich, integration by Nicolas Schulz, tweaked by STB - -#ifndef STBI_NO_PSD -static int stbi__psd_test(stbi__context *s) -{ - int r = (stbi__get32be(s) == 0x38425053); - stbi__rewind(s); - return r; -} - -static int stbi__psd_decode_rle(stbi__context *s, stbi_uc *p, int pixelCount) -{ - int count, nleft, len; - - count = 0; - while ((nleft = pixelCount - count) > 0) { - len = stbi__get8(s); - if (len == 128) { - // No-op. - } else if (len < 128) { - // Copy next len+1 bytes literally. - len++; - if (len > nleft) return 0; // corrupt data - count += len; - while (len) { - *p = stbi__get8(s); - p += 4; - len--; - } - } else if (len > 128) { - stbi_uc val; - // Next -len+1 bytes in the dest are replicated from next source byte. - // (Interpret len as a negative 8-bit int.) - len = 257 - len; - if (len > nleft) return 0; // corrupt data - val = stbi__get8(s); - count += len; - while (len) { - *p = val; - p += 4; - len--; - } - } - } - - return 1; -} - -static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri, int bpc) -{ - int pixelCount; - int channelCount, compression; - int channel, i; - int bitdepth; - int w,h; - stbi_uc *out; - STBI_NOTUSED(ri); - - // Check identifier - if (stbi__get32be(s) != 0x38425053) // "8BPS" - return stbi__errpuc("not PSD", "Corrupt PSD image"); - - // Check file type version. - if (stbi__get16be(s) != 1) - return stbi__errpuc("wrong version", "Unsupported version of PSD image"); - - // Skip 6 reserved bytes. - stbi__skip(s, 6 ); - - // Read the number of channels (R, G, B, A, etc). - channelCount = stbi__get16be(s); - if (channelCount < 0 || channelCount > 16) - return stbi__errpuc("wrong channel count", "Unsupported number of channels in PSD image"); - - // Read the rows and columns of the image. - h = stbi__get32be(s); - w = stbi__get32be(s); - - if (h > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); - if (w > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); - - // Make sure the depth is 8 bits. - bitdepth = stbi__get16be(s); - if (bitdepth != 8 && bitdepth != 16) - return stbi__errpuc("unsupported bit depth", "PSD bit depth is not 8 or 16 bit"); - - // Make sure the color mode is RGB. - // Valid options are: - // 0: Bitmap - // 1: Grayscale - // 2: Indexed color - // 3: RGB color - // 4: CMYK color - // 7: Multichannel - // 8: Duotone - // 9: Lab color - if (stbi__get16be(s) != 3) - return stbi__errpuc("wrong color format", "PSD is not in RGB color format"); - - // Skip the Mode Data. (It's the palette for indexed color; other info for other modes.) - stbi__skip(s,stbi__get32be(s) ); - - // Skip the image resources. (resolution, pen tool paths, etc) - stbi__skip(s, stbi__get32be(s) ); - - // Skip the reserved data. - stbi__skip(s, stbi__get32be(s) ); - - // Find out if the data is compressed. - // Known values: - // 0: no compression - // 1: RLE compressed - compression = stbi__get16be(s); - if (compression > 1) - return stbi__errpuc("bad compression", "PSD has an unknown compression format"); - - // Check size - if (!stbi__mad3sizes_valid(4, w, h, 0)) - return stbi__errpuc("too large", "Corrupt PSD"); - - // Create the destination image. - - if (!compression && bitdepth == 16 && bpc == 16) { - out = (stbi_uc *) stbi__malloc_mad3(8, w, h, 0); - ri->bits_per_channel = 16; - } else - out = (stbi_uc *) stbi__malloc(4 * w*h); - - if (!out) return stbi__errpuc("outofmem", "Out of memory"); - pixelCount = w*h; - - // Initialize the data to zero. - //memset( out, 0, pixelCount * 4 ); - - // Finally, the image data. - if (compression) { - // RLE as used by .PSD and .TIFF - // Loop until you get the number of unpacked bytes you are expecting: - // Read the next source byte into n. - // If n is between 0 and 127 inclusive, copy the next n+1 bytes literally. - // Else if n is between -127 and -1 inclusive, copy the next byte -n+1 times. - // Else if n is 128, noop. - // Endloop - - // The RLE-compressed data is preceded by a 2-byte data count for each row in the data, - // which we're going to just skip. - stbi__skip(s, h * channelCount * 2 ); - - // Read the RLE data by channel. - for (channel = 0; channel < 4; channel++) { - stbi_uc *p; - - p = out+channel; - if (channel >= channelCount) { - // Fill this channel with default data. - for (i = 0; i < pixelCount; i++, p += 4) - *p = (channel == 3 ? 255 : 0); - } else { - // Read the RLE data. - if (!stbi__psd_decode_rle(s, p, pixelCount)) { - STBI_FREE(out); - return stbi__errpuc("corrupt", "bad RLE data"); - } - } - } - - } else { - // We're at the raw image data. It's each channel in order (Red, Green, Blue, Alpha, ...) - // where each channel consists of an 8-bit (or 16-bit) value for each pixel in the image. - - // Read the data by channel. - for (channel = 0; channel < 4; channel++) { - if (channel >= channelCount) { - // Fill this channel with default data. - if (bitdepth == 16 && bpc == 16) { - stbi__uint16 *q = ((stbi__uint16 *) out) + channel; - stbi__uint16 val = channel == 3 ? 65535 : 0; - for (i = 0; i < pixelCount; i++, q += 4) - *q = val; - } else { - stbi_uc *p = out+channel; - stbi_uc val = channel == 3 ? 255 : 0; - for (i = 0; i < pixelCount; i++, p += 4) - *p = val; - } - } else { - if (ri->bits_per_channel == 16) { // output bpc - stbi__uint16 *q = ((stbi__uint16 *) out) + channel; - for (i = 0; i < pixelCount; i++, q += 4) - *q = (stbi__uint16) stbi__get16be(s); - } else { - stbi_uc *p = out+channel; - if (bitdepth == 16) { // input bpc - for (i = 0; i < pixelCount; i++, p += 4) - *p = (stbi_uc) (stbi__get16be(s) >> 8); - } else { - for (i = 0; i < pixelCount; i++, p += 4) - *p = stbi__get8(s); - } - } - } - } - } - - // remove weird white matte from PSD - if (channelCount >= 4) { - if (ri->bits_per_channel == 16) { - for (i=0; i < w*h; ++i) { - stbi__uint16 *pixel = (stbi__uint16 *) out + 4*i; - if (pixel[3] != 0 && pixel[3] != 65535) { - float a = pixel[3] / 65535.0f; - float ra = 1.0f / a; - float inv_a = 65535.0f * (1 - ra); - pixel[0] = (stbi__uint16) (pixel[0]*ra + inv_a); - pixel[1] = (stbi__uint16) (pixel[1]*ra + inv_a); - pixel[2] = (stbi__uint16) (pixel[2]*ra + inv_a); - } - } - } else { - for (i=0; i < w*h; ++i) { - unsigned char *pixel = out + 4*i; - if (pixel[3] != 0 && pixel[3] != 255) { - float a = pixel[3] / 255.0f; - float ra = 1.0f / a; - float inv_a = 255.0f * (1 - ra); - pixel[0] = (unsigned char) (pixel[0]*ra + inv_a); - pixel[1] = (unsigned char) (pixel[1]*ra + inv_a); - pixel[2] = (unsigned char) (pixel[2]*ra + inv_a); - } - } - } - } - - // convert to desired output format - if (req_comp && req_comp != 4) { - if (ri->bits_per_channel == 16) - out = (stbi_uc *) stbi__convert_format16((stbi__uint16 *) out, 4, req_comp, w, h); - else - out = stbi__convert_format(out, 4, req_comp, w, h); - if (out == NULL) return out; // stbi__convert_format frees input on failure - } - - if (comp) *comp = 4; - *y = h; - *x = w; - - return out; -} -#endif - -// ************************************************************************************************* -// Softimage PIC loader -// by Tom Seddon -// -// See http://softimage.wiki.softimage.com/index.php/INFO:_PIC_file_format -// See http://ozviz.wasp.uwa.edu.au/~pbourke/dataformats/softimagepic/ - -#ifndef STBI_NO_PIC -static int stbi__pic_is4(stbi__context *s,const char *str) -{ - int i; - for (i=0; i<4; ++i) - if (stbi__get8(s) != (stbi_uc)str[i]) - return 0; - - return 1; -} - -static int stbi__pic_test_core(stbi__context *s) -{ - int i; - - if (!stbi__pic_is4(s,"\x53\x80\xF6\x34")) - return 0; - - for(i=0;i<84;++i) - stbi__get8(s); - - if (!stbi__pic_is4(s,"PICT")) - return 0; - - return 1; -} - -typedef struct -{ - stbi_uc size,type,channel; -} stbi__pic_packet; - -static stbi_uc *stbi__readval(stbi__context *s, int channel, stbi_uc *dest) -{ - int mask=0x80, i; - - for (i=0; i<4; ++i, mask>>=1) { - if (channel & mask) { - if (stbi__at_eof(s)) return stbi__errpuc("bad file","PIC file too short"); - dest[i]=stbi__get8(s); - } - } - - return dest; -} - -static void stbi__copyval(int channel,stbi_uc *dest,const stbi_uc *src) -{ - int mask=0x80,i; - - for (i=0;i<4; ++i, mask>>=1) - if (channel&mask) - dest[i]=src[i]; -} - -static stbi_uc *stbi__pic_load_core(stbi__context *s,int width,int height,int *comp, stbi_uc *result) -{ - int act_comp=0,num_packets=0,y,chained; - stbi__pic_packet packets[10]; - - // this will (should...) cater for even some bizarre stuff like having data - // for the same channel in multiple packets. - do { - stbi__pic_packet *packet; - - if (num_packets==sizeof(packets)/sizeof(packets[0])) - return stbi__errpuc("bad format","too many packets"); - - packet = &packets[num_packets++]; - - chained = stbi__get8(s); - packet->size = stbi__get8(s); - packet->type = stbi__get8(s); - packet->channel = stbi__get8(s); - - act_comp |= packet->channel; - - if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (reading packets)"); - if (packet->size != 8) return stbi__errpuc("bad format","packet isn't 8bpp"); - } while (chained); - - *comp = (act_comp & 0x10 ? 4 : 3); // has alpha channel? - - for(y=0; ytype) { - default: - return stbi__errpuc("bad format","packet has bad compression type"); - - case 0: {//uncompressed - int x; - - for(x=0;xchannel,dest)) - return 0; - break; - } - - case 1://Pure RLE - { - int left=width, i; - - while (left>0) { - stbi_uc count,value[4]; - - count=stbi__get8(s); - if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pure read count)"); - - if (count > left) - count = (stbi_uc) left; - - if (!stbi__readval(s,packet->channel,value)) return 0; - - for(i=0; ichannel,dest,value); - left -= count; - } - } - break; - - case 2: {//Mixed RLE - int left=width; - while (left>0) { - int count = stbi__get8(s), i; - if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (mixed read count)"); - - if (count >= 128) { // Repeated - stbi_uc value[4]; - - if (count==128) - count = stbi__get16be(s); - else - count -= 127; - if (count > left) - return stbi__errpuc("bad file","scanline overrun"); - - if (!stbi__readval(s,packet->channel,value)) - return 0; - - for(i=0;ichannel,dest,value); - } else { // Raw - ++count; - if (count>left) return stbi__errpuc("bad file","scanline overrun"); - - for(i=0;ichannel,dest)) - return 0; - } - left-=count; - } - break; - } - } - } - } - - return result; -} - -static void *stbi__pic_load(stbi__context *s,int *px,int *py,int *comp,int req_comp, stbi__result_info *ri) -{ - stbi_uc *result; - int i, x,y, internal_comp; - STBI_NOTUSED(ri); - - if (!comp) comp = &internal_comp; - - for (i=0; i<92; ++i) - stbi__get8(s); - - x = stbi__get16be(s); - y = stbi__get16be(s); - - if (y > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); - if (x > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); - - if (stbi__at_eof(s)) return stbi__errpuc("bad file","file too short (pic header)"); - if (!stbi__mad3sizes_valid(x, y, 4, 0)) return stbi__errpuc("too large", "PIC image too large to decode"); - - stbi__get32be(s); //skip `ratio' - stbi__get16be(s); //skip `fields' - stbi__get16be(s); //skip `pad' - - // intermediate buffer is RGBA - result = (stbi_uc *) stbi__malloc_mad3(x, y, 4, 0); - if (!result) return stbi__errpuc("outofmem", "Out of memory"); - memset(result, 0xff, x*y*4); - - if (!stbi__pic_load_core(s,x,y,comp, result)) { - STBI_FREE(result); - result=0; - } - *px = x; - *py = y; - if (req_comp == 0) req_comp = *comp; - result=stbi__convert_format(result,4,req_comp,x,y); - - return result; -} - -static int stbi__pic_test(stbi__context *s) -{ - int r = stbi__pic_test_core(s); - stbi__rewind(s); - return r; -} -#endif - -// ************************************************************************************************* -// GIF loader -- public domain by Jean-Marc Lienher -- simplified/shrunk by stb - -#ifndef STBI_NO_GIF -typedef struct -{ - stbi__int16 prefix; - stbi_uc first; - stbi_uc suffix; -} stbi__gif_lzw; - -typedef struct -{ - int w,h; - stbi_uc *out; // output buffer (always 4 components) - stbi_uc *background; // The current "background" as far as a gif is concerned - stbi_uc *history; - int flags, bgindex, ratio, transparent, eflags; - stbi_uc pal[256][4]; - stbi_uc lpal[256][4]; - stbi__gif_lzw codes[8192]; - stbi_uc *color_table; - int parse, step; - int lflags; - int start_x, start_y; - int max_x, max_y; - int cur_x, cur_y; - int line_size; - int delay; -} stbi__gif; - -static int stbi__gif_test_raw(stbi__context *s) -{ - int sz; - if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8') return 0; - sz = stbi__get8(s); - if (sz != '9' && sz != '7') return 0; - if (stbi__get8(s) != 'a') return 0; - return 1; -} - -static int stbi__gif_test(stbi__context *s) -{ - int r = stbi__gif_test_raw(s); - stbi__rewind(s); - return r; -} - -static void stbi__gif_parse_colortable(stbi__context *s, stbi_uc pal[256][4], int num_entries, int transp) -{ - int i; - for (i=0; i < num_entries; ++i) { - pal[i][2] = stbi__get8(s); - pal[i][1] = stbi__get8(s); - pal[i][0] = stbi__get8(s); - pal[i][3] = transp == i ? 0 : 255; - } -} - -static int stbi__gif_header(stbi__context *s, stbi__gif *g, int *comp, int is_info) -{ - stbi_uc version; - if (stbi__get8(s) != 'G' || stbi__get8(s) != 'I' || stbi__get8(s) != 'F' || stbi__get8(s) != '8') - return stbi__err("not GIF", "Corrupt GIF"); - - version = stbi__get8(s); - if (version != '7' && version != '9') return stbi__err("not GIF", "Corrupt GIF"); - if (stbi__get8(s) != 'a') return stbi__err("not GIF", "Corrupt GIF"); - - stbi__g_failure_reason = ""; - g->w = stbi__get16le(s); - g->h = stbi__get16le(s); - g->flags = stbi__get8(s); - g->bgindex = stbi__get8(s); - g->ratio = stbi__get8(s); - g->transparent = -1; - - if (g->w > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); - if (g->h > STBI_MAX_DIMENSIONS) return stbi__err("too large","Very large image (corrupt?)"); - - if (comp != 0) *comp = 4; // can't actually tell whether it's 3 or 4 until we parse the comments - - if (is_info) return 1; - - if (g->flags & 0x80) - stbi__gif_parse_colortable(s,g->pal, 2 << (g->flags & 7), -1); - - return 1; -} - -static int stbi__gif_info_raw(stbi__context *s, int *x, int *y, int *comp) -{ - stbi__gif* g = (stbi__gif*) stbi__malloc(sizeof(stbi__gif)); - if (!g) return stbi__err("outofmem", "Out of memory"); - if (!stbi__gif_header(s, g, comp, 1)) { - STBI_FREE(g); - stbi__rewind( s ); - return 0; - } - if (x) *x = g->w; - if (y) *y = g->h; - STBI_FREE(g); - return 1; -} - -static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code) -{ - stbi_uc *p, *c; - int idx; - - // recurse to decode the prefixes, since the linked-list is backwards, - // and working backwards through an interleaved image would be nasty - if (g->codes[code].prefix >= 0) - stbi__out_gif_code(g, g->codes[code].prefix); - - if (g->cur_y >= g->max_y) return; - - idx = g->cur_x + g->cur_y; - p = &g->out[idx]; - g->history[idx / 4] = 1; - - c = &g->color_table[g->codes[code].suffix * 4]; - if (c[3] > 128) { // don't render transparent pixels; - p[0] = c[2]; - p[1] = c[1]; - p[2] = c[0]; - p[3] = c[3]; - } - g->cur_x += 4; - - if (g->cur_x >= g->max_x) { - g->cur_x = g->start_x; - g->cur_y += g->step; - - while (g->cur_y >= g->max_y && g->parse > 0) { - g->step = (1 << g->parse) * g->line_size; - g->cur_y = g->start_y + (g->step >> 1); - --g->parse; - } - } -} - -static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g) -{ - stbi_uc lzw_cs; - stbi__int32 len, init_code; - stbi__uint32 first; - stbi__int32 codesize, codemask, avail, oldcode, bits, valid_bits, clear; - stbi__gif_lzw *p; - - lzw_cs = stbi__get8(s); - if (lzw_cs > 12) return NULL; - clear = 1 << lzw_cs; - first = 1; - codesize = lzw_cs + 1; - codemask = (1 << codesize) - 1; - bits = 0; - valid_bits = 0; - for (init_code = 0; init_code < clear; init_code++) { - g->codes[init_code].prefix = -1; - g->codes[init_code].first = (stbi_uc) init_code; - g->codes[init_code].suffix = (stbi_uc) init_code; - } - - // support no starting clear code - avail = clear+2; - oldcode = -1; - - len = 0; - for(;;) { - if (valid_bits < codesize) { - if (len == 0) { - len = stbi__get8(s); // start new block - if (len == 0) - return g->out; - } - --len; - bits |= (stbi__int32) stbi__get8(s) << valid_bits; - valid_bits += 8; - } else { - stbi__int32 code = bits & codemask; - bits >>= codesize; - valid_bits -= codesize; - // @OPTIMIZE: is there some way we can accelerate the non-clear path? - if (code == clear) { // clear code - codesize = lzw_cs + 1; - codemask = (1 << codesize) - 1; - avail = clear + 2; - oldcode = -1; - first = 0; - } else if (code == clear + 1) { // end of stream code - stbi__skip(s, len); - while ((len = stbi__get8(s)) > 0) - stbi__skip(s,len); - return g->out; - } else if (code <= avail) { - if (first) { - return stbi__errpuc("no clear code", "Corrupt GIF"); - } - - if (oldcode >= 0) { - p = &g->codes[avail++]; - if (avail > 8192) { - return stbi__errpuc("too many codes", "Corrupt GIF"); - } - - p->prefix = (stbi__int16) oldcode; - p->first = g->codes[oldcode].first; - p->suffix = (code == avail) ? p->first : g->codes[code].first; - } else if (code == avail) - return stbi__errpuc("illegal code in raster", "Corrupt GIF"); - - stbi__out_gif_code(g, (stbi__uint16) code); - - if ((avail & codemask) == 0 && avail <= 0x0FFF) { - codesize++; - codemask = (1 << codesize) - 1; - } - - oldcode = code; - } else { - return stbi__errpuc("illegal code in raster", "Corrupt GIF"); - } - } - } -} - -// this function is designed to support animated gifs, although stb_image doesn't support it -// two back is the image from two frames ago, used for a very specific disposal format -static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, int req_comp, stbi_uc *two_back) -{ - int dispose; - int first_frame; - int pi; - int pcount; - STBI_NOTUSED(req_comp); - - // on first frame, any non-written pixels get the background colour (non-transparent) - first_frame = 0; - if (g->out == 0) { - if (!stbi__gif_header(s, g, comp,0)) return 0; // stbi__g_failure_reason set by stbi__gif_header - if (!stbi__mad3sizes_valid(4, g->w, g->h, 0)) - return stbi__errpuc("too large", "GIF image is too large"); - pcount = g->w * g->h; - g->out = (stbi_uc *) stbi__malloc(4 * pcount); - g->background = (stbi_uc *) stbi__malloc(4 * pcount); - g->history = (stbi_uc *) stbi__malloc(pcount); - if (!g->out || !g->background || !g->history) - return stbi__errpuc("outofmem", "Out of memory"); - - // image is treated as "transparent" at the start - ie, nothing overwrites the current background; - // background colour is only used for pixels that are not rendered first frame, after that "background" - // color refers to the color that was there the previous frame. - memset(g->out, 0x00, 4 * pcount); - memset(g->background, 0x00, 4 * pcount); // state of the background (starts transparent) - memset(g->history, 0x00, pcount); // pixels that were affected previous frame - first_frame = 1; - } else { - // second frame - how do we dispose of the previous one? - dispose = (g->eflags & 0x1C) >> 2; - pcount = g->w * g->h; - - if ((dispose == 3) && (two_back == 0)) { - dispose = 2; // if I don't have an image to revert back to, default to the old background - } - - if (dispose == 3) { // use previous graphic - for (pi = 0; pi < pcount; ++pi) { - if (g->history[pi]) { - memcpy( &g->out[pi * 4], &two_back[pi * 4], 4 ); - } - } - } else if (dispose == 2) { - // restore what was changed last frame to background before that frame; - for (pi = 0; pi < pcount; ++pi) { - if (g->history[pi]) { - memcpy( &g->out[pi * 4], &g->background[pi * 4], 4 ); - } - } - } else { - // This is a non-disposal case eithe way, so just - // leave the pixels as is, and they will become the new background - // 1: do not dispose - // 0: not specified. - } - - // background is what out is after the undoing of the previou frame; - memcpy( g->background, g->out, 4 * g->w * g->h ); - } - - // clear my history; - memset( g->history, 0x00, g->w * g->h ); // pixels that were affected previous frame - - for (;;) { - int tag = stbi__get8(s); - switch (tag) { - case 0x2C: /* Image Descriptor */ - { - stbi__int32 x, y, w, h; - stbi_uc *o; - - x = stbi__get16le(s); - y = stbi__get16le(s); - w = stbi__get16le(s); - h = stbi__get16le(s); - if (((x + w) > (g->w)) || ((y + h) > (g->h))) - return stbi__errpuc("bad Image Descriptor", "Corrupt GIF"); - - g->line_size = g->w * 4; - g->start_x = x * 4; - g->start_y = y * g->line_size; - g->max_x = g->start_x + w * 4; - g->max_y = g->start_y + h * g->line_size; - g->cur_x = g->start_x; - g->cur_y = g->start_y; - - // if the width of the specified rectangle is 0, that means - // we may not see *any* pixels or the image is malformed; - // to make sure this is caught, move the current y down to - // max_y (which is what out_gif_code checks). - if (w == 0) - g->cur_y = g->max_y; - - g->lflags = stbi__get8(s); - - if (g->lflags & 0x40) { - g->step = 8 * g->line_size; // first interlaced spacing - g->parse = 3; - } else { - g->step = g->line_size; - g->parse = 0; - } - - if (g->lflags & 0x80) { - stbi__gif_parse_colortable(s,g->lpal, 2 << (g->lflags & 7), g->eflags & 0x01 ? g->transparent : -1); - g->color_table = (stbi_uc *) g->lpal; - } else if (g->flags & 0x80) { - g->color_table = (stbi_uc *) g->pal; - } else - return stbi__errpuc("missing color table", "Corrupt GIF"); - - o = stbi__process_gif_raster(s, g); - if (!o) return NULL; - - // if this was the first frame, - pcount = g->w * g->h; - if (first_frame && (g->bgindex > 0)) { - // if first frame, any pixel not drawn to gets the background color - for (pi = 0; pi < pcount; ++pi) { - if (g->history[pi] == 0) { - g->pal[g->bgindex][3] = 255; // just in case it was made transparent, undo that; It will be reset next frame if need be; - memcpy( &g->out[pi * 4], &g->pal[g->bgindex], 4 ); - } - } - } - - return o; - } - - case 0x21: // Comment Extension. - { - int len; - int ext = stbi__get8(s); - if (ext == 0xF9) { // Graphic Control Extension. - len = stbi__get8(s); - if (len == 4) { - g->eflags = stbi__get8(s); - g->delay = 10 * stbi__get16le(s); // delay - 1/100th of a second, saving as 1/1000ths. - - // unset old transparent - if (g->transparent >= 0) { - g->pal[g->transparent][3] = 255; - } - if (g->eflags & 0x01) { - g->transparent = stbi__get8(s); - if (g->transparent >= 0) { - g->pal[g->transparent][3] = 0; - } - } else { - // don't need transparent - stbi__skip(s, 1); - g->transparent = -1; - } - } else { - stbi__skip(s, len); - break; - } - } - while ((len = stbi__get8(s)) != 0) { - stbi__skip(s, len); - } - break; - } - - case 0x3B: // gif stream termination code - return (stbi_uc *) s; // using '1' causes warning on some compilers - - default: - return stbi__errpuc("unknown code", "Corrupt GIF"); - } - } -} - -static void *stbi__load_gif_main_outofmem(stbi__gif *g, stbi_uc *out, int **delays) -{ - STBI_FREE(g->out); - STBI_FREE(g->history); - STBI_FREE(g->background); - - if (out) STBI_FREE(out); - if (delays && *delays) STBI_FREE(*delays); - return stbi__errpuc("outofmem", "Out of memory"); -} - -static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, int *z, int *comp, int req_comp) -{ - if (stbi__gif_test(s)) { - int layers = 0; - stbi_uc *u = 0; - stbi_uc *out = 0; - stbi_uc *two_back = 0; - stbi__gif g; - int stride; - int out_size = 0; - int delays_size = 0; - - STBI_NOTUSED(out_size); - STBI_NOTUSED(delays_size); - - memset(&g, 0, sizeof(g)); - if (delays) { - *delays = 0; - } - - do { - u = stbi__gif_load_next(s, &g, comp, req_comp, two_back); - if (u == (stbi_uc *) s) u = 0; // end of animated gif marker - - if (u) { - *x = g.w; - *y = g.h; - ++layers; - stride = g.w * g.h * 4; - - if (out) { - void *tmp = (stbi_uc*) STBI_REALLOC_SIZED( out, out_size, layers * stride ); - if (!tmp) - return stbi__load_gif_main_outofmem(&g, out, delays); - else { - out = (stbi_uc*) tmp; - out_size = layers * stride; - } - - if (delays) { - int *new_delays = (int*) STBI_REALLOC_SIZED( *delays, delays_size, sizeof(int) * layers ); - if (!new_delays) - return stbi__load_gif_main_outofmem(&g, out, delays); - *delays = new_delays; - delays_size = layers * sizeof(int); - } - } else { - out = (stbi_uc*)stbi__malloc( layers * stride ); - if (!out) - return stbi__load_gif_main_outofmem(&g, out, delays); - out_size = layers * stride; - if (delays) { - *delays = (int*) stbi__malloc( layers * sizeof(int) ); - if (!*delays) - return stbi__load_gif_main_outofmem(&g, out, delays); - delays_size = layers * sizeof(int); - } - } - memcpy( out + ((layers - 1) * stride), u, stride ); - if (layers >= 2) { - two_back = out - 2 * stride; - } - - if (delays) { - (*delays)[layers - 1U] = g.delay; - } - } - } while (u != 0); - - // free temp buffer; - STBI_FREE(g.out); - STBI_FREE(g.history); - STBI_FREE(g.background); - - // do the final conversion after loading everything; - if (req_comp && req_comp != 4) - out = stbi__convert_format(out, 4, req_comp, layers * g.w, g.h); - - *z = layers; - return out; - } else { - return stbi__errpuc("not GIF", "Image was not as a gif type."); - } -} - -static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - stbi_uc *u = 0; - stbi__gif g; - memset(&g, 0, sizeof(g)); - STBI_NOTUSED(ri); - - u = stbi__gif_load_next(s, &g, comp, req_comp, 0); - if (u == (stbi_uc *) s) u = 0; // end of animated gif marker - if (u) { - *x = g.w; - *y = g.h; - - // moved conversion to after successful load so that the same - // can be done for multiple frames. - if (req_comp && req_comp != 4) - u = stbi__convert_format(u, 4, req_comp, g.w, g.h); - } else if (g.out) { - // if there was an error and we allocated an image buffer, free it! - STBI_FREE(g.out); - } - - // free buffers needed for multiple frame loading; - STBI_FREE(g.history); - STBI_FREE(g.background); - - return u; -} - -static int stbi__gif_info(stbi__context *s, int *x, int *y, int *comp) -{ - return stbi__gif_info_raw(s,x,y,comp); -} -#endif - -// ************************************************************************************************* -// Radiance RGBE HDR loader -// originally by Nicolas Schulz -#ifndef STBI_NO_HDR -static int stbi__hdr_test_core(stbi__context *s, const char *signature) -{ - int i; - for (i=0; signature[i]; ++i) - if (stbi__get8(s) != signature[i]) - return 0; - stbi__rewind(s); - return 1; -} - -static int stbi__hdr_test(stbi__context* s) -{ - int r = stbi__hdr_test_core(s, "#?RADIANCE\n"); - stbi__rewind(s); - if(!r) { - r = stbi__hdr_test_core(s, "#?RGBE\n"); - stbi__rewind(s); - } - return r; -} - -#define STBI__HDR_BUFLEN 1024 -static char *stbi__hdr_gettoken(stbi__context *z, char *buffer) -{ - int len=0; - char c = '\0'; - - c = (char) stbi__get8(z); - - while (!stbi__at_eof(z) && c != '\n') { - buffer[len++] = c; - if (len == STBI__HDR_BUFLEN-1) { - // flush to end of line - while (!stbi__at_eof(z) && stbi__get8(z) != '\n') - ; - break; - } - c = (char) stbi__get8(z); - } - - buffer[len] = 0; - return buffer; -} - -static void stbi__hdr_convert(float *output, stbi_uc *input, int req_comp) -{ - if ( input[3] != 0 ) { - float f1; - // Exponent - f1 = (float) ldexp(1.0f, input[3] - (int)(128 + 8)); - if (req_comp <= 2) - output[0] = (input[0] + input[1] + input[2]) * f1 / 3; - else { - output[0] = input[0] * f1; - output[1] = input[1] * f1; - output[2] = input[2] * f1; - } - if (req_comp == 2) output[1] = 1; - if (req_comp == 4) output[3] = 1; - } else { - switch (req_comp) { - case 4: output[3] = 1; /* fallthrough */ - case 3: output[0] = output[1] = output[2] = 0; - break; - case 2: output[1] = 1; /* fallthrough */ - case 1: output[0] = 0; - break; - } - } -} - -static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - char buffer[STBI__HDR_BUFLEN]; - char *token; - int valid = 0; - int width, height; - stbi_uc *scanline; - float *hdr_data; - int len; - unsigned char count, value; - int i, j, k, c1,c2, z; - const char *headerToken; - STBI_NOTUSED(ri); - - // Check identifier - headerToken = stbi__hdr_gettoken(s,buffer); - if (strcmp(headerToken, "#?RADIANCE") != 0 && strcmp(headerToken, "#?RGBE") != 0) - return stbi__errpf("not HDR", "Corrupt HDR image"); - - // Parse header - for(;;) { - token = stbi__hdr_gettoken(s,buffer); - if (token[0] == 0) break; - if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1; - } - - if (!valid) return stbi__errpf("unsupported format", "Unsupported HDR format"); - - // Parse width and height - // can't use sscanf() if we're not using stdio! - token = stbi__hdr_gettoken(s,buffer); - if (strncmp(token, "-Y ", 3)) return stbi__errpf("unsupported data layout", "Unsupported HDR format"); - token += 3; - height = (int) strtol(token, &token, 10); - while (*token == ' ') ++token; - if (strncmp(token, "+X ", 3)) return stbi__errpf("unsupported data layout", "Unsupported HDR format"); - token += 3; - width = (int) strtol(token, NULL, 10); - - if (height > STBI_MAX_DIMENSIONS) return stbi__errpf("too large","Very large image (corrupt?)"); - if (width > STBI_MAX_DIMENSIONS) return stbi__errpf("too large","Very large image (corrupt?)"); - - *x = width; - *y = height; - - if (comp) *comp = 3; - if (req_comp == 0) req_comp = 3; - - if (!stbi__mad4sizes_valid(width, height, req_comp, sizeof(float), 0)) - return stbi__errpf("too large", "HDR image is too large"); - - // Read data - hdr_data = (float *) stbi__malloc_mad4(width, height, req_comp, sizeof(float), 0); - if (!hdr_data) - return stbi__errpf("outofmem", "Out of memory"); - - // Load image data - // image data is stored as some number of sca - if ( width < 8 || width >= 32768) { - // Read flat data - for (j=0; j < height; ++j) { - for (i=0; i < width; ++i) { - stbi_uc rgbe[4]; - main_decode_loop: - stbi__getn(s, rgbe, 4); - stbi__hdr_convert(hdr_data + j * width * req_comp + i * req_comp, rgbe, req_comp); - } - } - } else { - // Read RLE-encoded data - scanline = NULL; - - for (j = 0; j < height; ++j) { - c1 = stbi__get8(s); - c2 = stbi__get8(s); - len = stbi__get8(s); - if (c1 != 2 || c2 != 2 || (len & 0x80)) { - // not run-length encoded, so we have to actually use THIS data as a decoded - // pixel (note this can't be a valid pixel--one of RGB must be >= 128) - stbi_uc rgbe[4]; - rgbe[0] = (stbi_uc) c1; - rgbe[1] = (stbi_uc) c2; - rgbe[2] = (stbi_uc) len; - rgbe[3] = (stbi_uc) stbi__get8(s); - stbi__hdr_convert(hdr_data, rgbe, req_comp); - i = 1; - j = 0; - STBI_FREE(scanline); - goto main_decode_loop; // yes, this makes no sense - } - len <<= 8; - len |= stbi__get8(s); - if (len != width) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("invalid decoded scanline length", "corrupt HDR"); } - if (scanline == NULL) { - scanline = (stbi_uc *) stbi__malloc_mad2(width, 4, 0); - if (!scanline) { - STBI_FREE(hdr_data); - return stbi__errpf("outofmem", "Out of memory"); - } - } - - for (k = 0; k < 4; ++k) { - int nleft; - i = 0; - while ((nleft = width - i) > 0) { - count = stbi__get8(s); - if (count > 128) { - // Run - value = stbi__get8(s); - count -= 128; - if (count > nleft) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); } - for (z = 0; z < count; ++z) - scanline[i++ * 4 + k] = value; - } else { - // Dump - if (count > nleft) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf("corrupt", "bad RLE data in HDR"); } - for (z = 0; z < count; ++z) - scanline[i++ * 4 + k] = stbi__get8(s); - } - } - } - for (i=0; i < width; ++i) - stbi__hdr_convert(hdr_data+(j*width + i)*req_comp, scanline + i*4, req_comp); - } - if (scanline) - STBI_FREE(scanline); - } - - return hdr_data; -} - -static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp) -{ - char buffer[STBI__HDR_BUFLEN]; - char *token; - int valid = 0; - int dummy; - - if (!x) x = &dummy; - if (!y) y = &dummy; - if (!comp) comp = &dummy; - - if (stbi__hdr_test(s) == 0) { - stbi__rewind( s ); - return 0; - } - - for(;;) { - token = stbi__hdr_gettoken(s,buffer); - if (token[0] == 0) break; - if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1; - } - - if (!valid) { - stbi__rewind( s ); - return 0; - } - token = stbi__hdr_gettoken(s,buffer); - if (strncmp(token, "-Y ", 3)) { - stbi__rewind( s ); - return 0; - } - token += 3; - *y = (int) strtol(token, &token, 10); - while (*token == ' ') ++token; - if (strncmp(token, "+X ", 3)) { - stbi__rewind( s ); - return 0; - } - token += 3; - *x = (int) strtol(token, NULL, 10); - *comp = 3; - return 1; -} -#endif // STBI_NO_HDR - -#ifndef STBI_NO_BMP -static int stbi__bmp_info(stbi__context *s, int *x, int *y, int *comp) -{ - void *p; - stbi__bmp_data info; - - info.all_a = 255; - p = stbi__bmp_parse_header(s, &info); - if (p == NULL) { - stbi__rewind( s ); - return 0; - } - if (x) *x = s->img_x; - if (y) *y = s->img_y; - if (comp) { - if (info.bpp == 24 && info.ma == 0xff000000) - *comp = 3; - else - *comp = info.ma ? 4 : 3; - } - return 1; -} -#endif - -#ifndef STBI_NO_PSD -static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp) -{ - int channelCount, dummy, depth; - if (!x) x = &dummy; - if (!y) y = &dummy; - if (!comp) comp = &dummy; - if (stbi__get32be(s) != 0x38425053) { - stbi__rewind( s ); - return 0; - } - if (stbi__get16be(s) != 1) { - stbi__rewind( s ); - return 0; - } - stbi__skip(s, 6); - channelCount = stbi__get16be(s); - if (channelCount < 0 || channelCount > 16) { - stbi__rewind( s ); - return 0; - } - *y = stbi__get32be(s); - *x = stbi__get32be(s); - depth = stbi__get16be(s); - if (depth != 8 && depth != 16) { - stbi__rewind( s ); - return 0; - } - if (stbi__get16be(s) != 3) { - stbi__rewind( s ); - return 0; - } - *comp = 4; - return 1; -} - -static int stbi__psd_is16(stbi__context *s) -{ - int channelCount, depth; - if (stbi__get32be(s) != 0x38425053) { - stbi__rewind( s ); - return 0; - } - if (stbi__get16be(s) != 1) { - stbi__rewind( s ); - return 0; - } - stbi__skip(s, 6); - channelCount = stbi__get16be(s); - if (channelCount < 0 || channelCount > 16) { - stbi__rewind( s ); - return 0; - } - STBI_NOTUSED(stbi__get32be(s)); - STBI_NOTUSED(stbi__get32be(s)); - depth = stbi__get16be(s); - if (depth != 16) { - stbi__rewind( s ); - return 0; - } - return 1; -} -#endif - -#ifndef STBI_NO_PIC -static int stbi__pic_info(stbi__context *s, int *x, int *y, int *comp) -{ - int act_comp=0,num_packets=0,chained,dummy; - stbi__pic_packet packets[10]; - - if (!x) x = &dummy; - if (!y) y = &dummy; - if (!comp) comp = &dummy; - - if (!stbi__pic_is4(s,"\x53\x80\xF6\x34")) { - stbi__rewind(s); - return 0; - } - - stbi__skip(s, 88); - - *x = stbi__get16be(s); - *y = stbi__get16be(s); - if (stbi__at_eof(s)) { - stbi__rewind( s); - return 0; - } - if ( (*x) != 0 && (1 << 28) / (*x) < (*y)) { - stbi__rewind( s ); - return 0; - } - - stbi__skip(s, 8); - - do { - stbi__pic_packet *packet; - - if (num_packets==sizeof(packets)/sizeof(packets[0])) - return 0; - - packet = &packets[num_packets++]; - chained = stbi__get8(s); - packet->size = stbi__get8(s); - packet->type = stbi__get8(s); - packet->channel = stbi__get8(s); - act_comp |= packet->channel; - - if (stbi__at_eof(s)) { - stbi__rewind( s ); - return 0; - } - if (packet->size != 8) { - stbi__rewind( s ); - return 0; - } - } while (chained); - - *comp = (act_comp & 0x10 ? 4 : 3); - - return 1; -} -#endif - -// ************************************************************************************************* -// Portable Gray Map and Portable Pixel Map loader -// by Ken Miller -// -// PGM: http://netpbm.sourceforge.net/doc/pgm.html -// PPM: http://netpbm.sourceforge.net/doc/ppm.html -// -// Known limitations: -// Does not support comments in the header section -// Does not support ASCII image data (formats P2 and P3) - -#ifndef STBI_NO_PNM - -static int stbi__pnm_test(stbi__context *s) -{ - char p, t; - p = (char) stbi__get8(s); - t = (char) stbi__get8(s); - if (p != 'P' || (t != '5' && t != '6')) { - stbi__rewind( s ); - return 0; - } - return 1; -} - -static void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) -{ - stbi_uc *out; - STBI_NOTUSED(ri); - - ri->bits_per_channel = stbi__pnm_info(s, (int *)&s->img_x, (int *)&s->img_y, (int *)&s->img_n); - if (ri->bits_per_channel == 0) - return 0; - - if (s->img_y > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); - if (s->img_x > STBI_MAX_DIMENSIONS) return stbi__errpuc("too large","Very large image (corrupt?)"); - - *x = s->img_x; - *y = s->img_y; - if (comp) *comp = s->img_n; - - if (!stbi__mad4sizes_valid(s->img_n, s->img_x, s->img_y, ri->bits_per_channel / 8, 0)) - return stbi__errpuc("too large", "PNM too large"); - - out = (stbi_uc *) stbi__malloc_mad4(s->img_n, s->img_x, s->img_y, ri->bits_per_channel / 8, 0); - if (!out) return stbi__errpuc("outofmem", "Out of memory"); - stbi__getn(s, out, s->img_n * s->img_x * s->img_y * (ri->bits_per_channel / 8)); - - if (req_comp && req_comp != s->img_n) { - out = stbi__convert_format(out, s->img_n, req_comp, s->img_x, s->img_y); - if (out == NULL) return out; // stbi__convert_format frees input on failure - } - return out; -} - -static int stbi__pnm_isspace(char c) -{ - return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r'; -} - -static void stbi__pnm_skip_whitespace(stbi__context *s, char *c) -{ - for (;;) { - while (!stbi__at_eof(s) && stbi__pnm_isspace(*c)) - *c = (char) stbi__get8(s); - - if (stbi__at_eof(s) || *c != '#') - break; - - while (!stbi__at_eof(s) && *c != '\n' && *c != '\r' ) - *c = (char) stbi__get8(s); - } -} - -static int stbi__pnm_isdigit(char c) -{ - return c >= '0' && c <= '9'; -} - -static int stbi__pnm_getinteger(stbi__context *s, char *c) -{ - int value = 0; - - while (!stbi__at_eof(s) && stbi__pnm_isdigit(*c)) { - value = value*10 + (*c - '0'); - *c = (char) stbi__get8(s); - } - - return value; -} - -static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp) -{ - int maxv, dummy; - char c, p, t; - - if (!x) x = &dummy; - if (!y) y = &dummy; - if (!comp) comp = &dummy; - - stbi__rewind(s); - - // Get identifier - p = (char) stbi__get8(s); - t = (char) stbi__get8(s); - if (p != 'P' || (t != '5' && t != '6')) { - stbi__rewind(s); - return 0; - } - - *comp = (t == '6') ? 3 : 1; // '5' is 1-component .pgm; '6' is 3-component .ppm - - c = (char) stbi__get8(s); - stbi__pnm_skip_whitespace(s, &c); - - *x = stbi__pnm_getinteger(s, &c); // read width - stbi__pnm_skip_whitespace(s, &c); - - *y = stbi__pnm_getinteger(s, &c); // read height - stbi__pnm_skip_whitespace(s, &c); - - maxv = stbi__pnm_getinteger(s, &c); // read max value - if (maxv > 65535) - return stbi__err("max value > 65535", "PPM image supports only 8-bit and 16-bit images"); - else if (maxv > 255) - return 16; - else - return 8; -} - -static int stbi__pnm_is16(stbi__context *s) -{ - if (stbi__pnm_info(s, NULL, NULL, NULL) == 16) - return 1; - return 0; -} -#endif - -static int stbi__info_main(stbi__context *s, int *x, int *y, int *comp) -{ - #ifndef STBI_NO_JPEG - if (stbi__jpeg_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_PNG - if (stbi__png_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_GIF - if (stbi__gif_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_BMP - if (stbi__bmp_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_PSD - if (stbi__psd_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_PIC - if (stbi__pic_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_PNM - if (stbi__pnm_info(s, x, y, comp)) return 1; - #endif - - #ifndef STBI_NO_HDR - if (stbi__hdr_info(s, x, y, comp)) return 1; - #endif - - // test tga last because it's a crappy test! - #ifndef STBI_NO_TGA - if (stbi__tga_info(s, x, y, comp)) - return 1; - #endif - return stbi__err("unknown image type", "Image not of any known type, or corrupt"); -} - -static int stbi__is_16_main(stbi__context *s) -{ - #ifndef STBI_NO_PNG - if (stbi__png_is16(s)) return 1; - #endif - - #ifndef STBI_NO_PSD - if (stbi__psd_is16(s)) return 1; - #endif - - #ifndef STBI_NO_PNM - if (stbi__pnm_is16(s)) return 1; - #endif - return 0; -} - -#ifndef STBI_NO_STDIO -STBIDEF int stbi_info(char const *filename, int *x, int *y, int *comp) -{ - FILE *f = stbi__fopen(filename, "rb"); - int result; - if (!f) return stbi__err("can't fopen", "Unable to open file"); - result = stbi_info_from_file(f, x, y, comp); - fclose(f); - return result; -} - -STBIDEF int stbi_info_from_file(FILE *f, int *x, int *y, int *comp) -{ - int r; - stbi__context s; - long pos = ftell(f); - stbi__start_file(&s, f); - r = stbi__info_main(&s,x,y,comp); - fseek(f,pos,SEEK_SET); - return r; -} - -STBIDEF int stbi_is_16_bit(char const *filename) -{ - FILE *f = stbi__fopen(filename, "rb"); - int result; - if (!f) return stbi__err("can't fopen", "Unable to open file"); - result = stbi_is_16_bit_from_file(f); - fclose(f); - return result; -} - -STBIDEF int stbi_is_16_bit_from_file(FILE *f) -{ - int r; - stbi__context s; - long pos = ftell(f); - stbi__start_file(&s, f); - r = stbi__is_16_main(&s); - fseek(f,pos,SEEK_SET); - return r; -} -#endif // !STBI_NO_STDIO - -STBIDEF int stbi_info_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp) -{ - stbi__context s; - stbi__start_mem(&s,buffer,len); - return stbi__info_main(&s,x,y,comp); -} - -STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int *x, int *y, int *comp) -{ - stbi__context s; - stbi__start_callbacks(&s, (stbi_io_callbacks *) c, user); - return stbi__info_main(&s,x,y,comp); -} - -STBIDEF int stbi_is_16_bit_from_memory(stbi_uc const *buffer, int len) -{ - stbi__context s; - stbi__start_mem(&s,buffer,len); - return stbi__is_16_main(&s); -} - -STBIDEF int stbi_is_16_bit_from_callbacks(stbi_io_callbacks const *c, void *user) -{ - stbi__context s; - stbi__start_callbacks(&s, (stbi_io_callbacks *) c, user); - return stbi__is_16_main(&s); -} - -#endif // STB_IMAGE_IMPLEMENTATION - -/* - revision history: - 2.20 (2019-02-07) support utf8 filenames in Windows; fix warnings and platform ifdefs - 2.19 (2018-02-11) fix warning - 2.18 (2018-01-30) fix warnings - 2.17 (2018-01-29) change sbti__shiftsigned to avoid clang -O2 bug - 1-bit BMP - *_is_16_bit api - avoid warnings - 2.16 (2017-07-23) all functions have 16-bit variants; - STBI_NO_STDIO works again; - compilation fixes; - fix rounding in unpremultiply; - optimize vertical flip; - disable raw_len validation; - documentation fixes - 2.15 (2017-03-18) fix png-1,2,4 bug; now all Imagenet JPGs decode; - warning fixes; disable run-time SSE detection on gcc; - uniform handling of optional "return" values; - thread-safe initialization of zlib tables - 2.14 (2017-03-03) remove deprecated STBI_JPEG_OLD; fixes for Imagenet JPGs - 2.13 (2016-11-29) add 16-bit API, only supported for PNG right now - 2.12 (2016-04-02) fix typo in 2.11 PSD fix that caused crashes - 2.11 (2016-04-02) allocate large structures on the stack - remove white matting for transparent PSD - fix reported channel count for PNG & BMP - re-enable SSE2 in non-gcc 64-bit - support RGB-formatted JPEG - read 16-bit PNGs (only as 8-bit) - 2.10 (2016-01-22) avoid warning introduced in 2.09 by STBI_REALLOC_SIZED - 2.09 (2016-01-16) allow comments in PNM files - 16-bit-per-pixel TGA (not bit-per-component) - info() for TGA could break due to .hdr handling - info() for BMP to shares code instead of sloppy parse - can use STBI_REALLOC_SIZED if allocator doesn't support realloc - code cleanup - 2.08 (2015-09-13) fix to 2.07 cleanup, reading RGB PSD as RGBA - 2.07 (2015-09-13) fix compiler warnings - partial animated GIF support - limited 16-bpc PSD support - #ifdef unused functions - bug with < 92 byte PIC,PNM,HDR,TGA - 2.06 (2015-04-19) fix bug where PSD returns wrong '*comp' value - 2.05 (2015-04-19) fix bug in progressive JPEG handling, fix warning - 2.04 (2015-04-15) try to re-enable SIMD on MinGW 64-bit - 2.03 (2015-04-12) extra corruption checking (mmozeiko) - stbi_set_flip_vertically_on_load (nguillemot) - fix NEON support; fix mingw support - 2.02 (2015-01-19) fix incorrect assert, fix warning - 2.01 (2015-01-17) fix various warnings; suppress SIMD on gcc 32-bit without -msse2 - 2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG - 2.00 (2014-12-25) optimize JPG, including x86 SSE2 & NEON SIMD (ryg) - progressive JPEG (stb) - PGM/PPM support (Ken Miller) - STBI_MALLOC,STBI_REALLOC,STBI_FREE - GIF bugfix -- seemingly never worked - STBI_NO_*, STBI_ONLY_* - 1.48 (2014-12-14) fix incorrectly-named assert() - 1.47 (2014-12-14) 1/2/4-bit PNG support, both direct and paletted (Omar Cornut & stb) - optimize PNG (ryg) - fix bug in interlaced PNG with user-specified channel count (stb) - 1.46 (2014-08-26) - fix broken tRNS chunk (colorkey-style transparency) in non-paletted PNG - 1.45 (2014-08-16) - fix MSVC-ARM internal compiler error by wrapping malloc - 1.44 (2014-08-07) - various warning fixes from Ronny Chevalier - 1.43 (2014-07-15) - fix MSVC-only compiler problem in code changed in 1.42 - 1.42 (2014-07-09) - don't define _CRT_SECURE_NO_WARNINGS (affects user code) - fixes to stbi__cleanup_jpeg path - added STBI_ASSERT to avoid requiring assert.h - 1.41 (2014-06-25) - fix search&replace from 1.36 that messed up comments/error messages - 1.40 (2014-06-22) - fix gcc struct-initialization warning - 1.39 (2014-06-15) - fix to TGA optimization when req_comp != number of components in TGA; - fix to GIF loading because BMP wasn't rewinding (whoops, no GIFs in my test suite) - add support for BMP version 5 (more ignored fields) - 1.38 (2014-06-06) - suppress MSVC warnings on integer casts truncating values - fix accidental rename of 'skip' field of I/O - 1.37 (2014-06-04) - remove duplicate typedef - 1.36 (2014-06-03) - convert to header file single-file library - if de-iphone isn't set, load iphone images color-swapped instead of returning NULL - 1.35 (2014-05-27) - various warnings - fix broken STBI_SIMD path - fix bug where stbi_load_from_file no longer left file pointer in correct place - fix broken non-easy path for 32-bit BMP (possibly never used) - TGA optimization by Arseny Kapoulkine - 1.34 (unknown) - use STBI_NOTUSED in stbi__resample_row_generic(), fix one more leak in tga failure case - 1.33 (2011-07-14) - make stbi_is_hdr work in STBI_NO_HDR (as specified), minor compiler-friendly improvements - 1.32 (2011-07-13) - support for "info" function for all supported filetypes (SpartanJ) - 1.31 (2011-06-20) - a few more leak fixes, bug in PNG handling (SpartanJ) - 1.30 (2011-06-11) - added ability to load files via callbacks to accomidate custom input streams (Ben Wenger) - removed deprecated format-specific test/load functions - removed support for installable file formats (stbi_loader) -- would have been broken for IO callbacks anyway - error cases in bmp and tga give messages and don't leak (Raymond Barbiero, grisha) - fix inefficiency in decoding 32-bit BMP (David Woo) - 1.29 (2010-08-16) - various warning fixes from Aurelien Pocheville - 1.28 (2010-08-01) - fix bug in GIF palette transparency (SpartanJ) - 1.27 (2010-08-01) - cast-to-stbi_uc to fix warnings - 1.26 (2010-07-24) - fix bug in file buffering for PNG reported by SpartanJ - 1.25 (2010-07-17) - refix trans_data warning (Won Chun) - 1.24 (2010-07-12) - perf improvements reading from files on platforms with lock-heavy fgetc() - minor perf improvements for jpeg - deprecated type-specific functions so we'll get feedback if they're needed - attempt to fix trans_data warning (Won Chun) - 1.23 fixed bug in iPhone support - 1.22 (2010-07-10) - removed image *writing* support - stbi_info support from Jetro Lauha - GIF support from Jean-Marc Lienher - iPhone PNG-extensions from James Brown - warning-fixes from Nicolas Schulz and Janez Zemva (i.stbi__err. Janez (U+017D)emva) - 1.21 fix use of 'stbi_uc' in header (reported by jon blow) - 1.20 added support for Softimage PIC, by Tom Seddon - 1.19 bug in interlaced PNG corruption check (found by ryg) - 1.18 (2008-08-02) - fix a threading bug (local mutable static) - 1.17 support interlaced PNG - 1.16 major bugfix - stbi__convert_format converted one too many pixels - 1.15 initialize some fields for thread safety - 1.14 fix threadsafe conversion bug - header-file-only version (#define STBI_HEADER_FILE_ONLY before including) - 1.13 threadsafe - 1.12 const qualifiers in the API - 1.11 Support installable IDCT, colorspace conversion routines - 1.10 Fixes for 64-bit (don't use "unsigned long") - optimized upsampling by Fabian "ryg" Giesen - 1.09 Fix format-conversion for PSD code (bad global variables!) - 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz - 1.07 attempt to fix C++ warning/errors again - 1.06 attempt to fix C++ warning/errors again - 1.05 fix TGA loading to return correct *comp and use good luminance calc - 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free - 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR - 1.02 support for (subset of) HDR files, float interface for preferred access to them - 1.01 fix bug: possible bug in handling right-side up bmps... not sure - fix bug: the stbi__bmp_load() and stbi__tga_load() functions didn't work at all - 1.00 interface to zlib that skips zlib header - 0.99 correct handling of alpha in palette - 0.98 TGA loader by lonesock; dynamically add loaders (untested) - 0.97 jpeg errors on too large a file; also catch another malloc failure - 0.96 fix detection of invalid v value - particleman@mollyrocket forum - 0.95 during header scan, seek to markers in case of padding - 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same - 0.93 handle jpegtran output; verbose errors - 0.92 read 4,8,16,24,32-bit BMP files of several formats - 0.91 output 24-bit Windows 3.0 BMP files - 0.90 fix a few more warnings; bump version number to approach 1.0 - 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd - 0.60 fix compiling as c++ - 0.59 fix warnings: merge Dave Moore's -Wall fixes - 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian - 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less than 16 available - 0.56 fix bug: zlib uncompressed mode len vs. nlen - 0.55 fix bug: restart_interval not initialized to 0 - 0.54 allow NULL for 'int *comp' - 0.53 fix bug in png 3->4; speedup png decoding - 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments - 0.51 obey req_comp requests, 1-component jpegs return as 1-component, - on 'test' only check type, not whether we support this variant - 0.50 (2006-11-19) - first released version -*/ - - -/* ------------------------------------------------------------------------------- -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. ------------------------------------------------------------------------------- -*/ diff --git a/plugins/editor/external/vstgui4 b/plugins/editor/external/vstgui4 deleted file mode 160000 index 630db26be..000000000 --- a/plugins/editor/external/vstgui4 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 630db26be83f8a1d4bd04926fa45ad10995d2b85 diff --git a/plugins/editor/layout/about.fl b/plugins/editor/layout/about.fl deleted file mode 100644 index 439419292..000000000 --- a/plugins/editor/layout/about.fl +++ /dev/null @@ -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 - } -} diff --git a/plugins/editor/layout/main.fl b/plugins/editor/layout/main.fl deleted file mode 100644 index be2497a8f..000000000 --- a/plugins/editor/layout/main.fl +++ /dev/null @@ -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 - } -} diff --git a/plugins/editor/resources/Fonts/Roboto-Regular.ttf b/plugins/editor/resources/Fonts/Roboto-Regular.ttf deleted file mode 100644 index 2b6392ffe..000000000 Binary files a/plugins/editor/resources/Fonts/Roboto-Regular.ttf and /dev/null differ diff --git a/plugins/editor/resources/Fonts/sfizz-fluentui-system-f20.ttf b/plugins/editor/resources/Fonts/sfizz-fluentui-system-f20.ttf deleted file mode 100644 index 691a6dacc..000000000 Binary files a/plugins/editor/resources/Fonts/sfizz-fluentui-system-f20.ttf and /dev/null differ diff --git a/plugins/editor/resources/Fonts/sfizz-fluentui-system-r20.ttf b/plugins/editor/resources/Fonts/sfizz-fluentui-system-r20.ttf deleted file mode 100644 index dc27711e7..000000000 Binary files a/plugins/editor/resources/Fonts/sfizz-fluentui-system-r20.ttf and /dev/null differ diff --git a/plugins/editor/resources/Fonts/sfizz-misc-icons.ttf b/plugins/editor/resources/Fonts/sfizz-misc-icons.ttf deleted file mode 100644 index 6f40464ec..000000000 Binary files a/plugins/editor/resources/Fonts/sfizz-misc-icons.ttf and /dev/null differ diff --git a/plugins/editor/resources/Themes/Dark/theme.xml b/plugins/editor/resources/Themes/Dark/theme.xml deleted file mode 100644 index b5e9152f6..000000000 --- a/plugins/editor/resources/Themes/Dark/theme.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - #121212 - - #1d1d1d - #e3e3e3 - #a2a2a2 - #e9e9e9 - #e3e3e3 - #2d2d2d - #e3e3e3 - #121212 - #e3e3e3 - #ff6000 - #006b0b - #6f6f6f - #ffffff - #ffffff - #ffffff - #006b0b - - - #2d2d2d - #9e9e9e - #a2a2a2 - #e9e9e9 - #9e9e9e - #2d2d2d - #9e9e9e - #121212 - #9e9e9e - #ff6000 - #006b0b - #6f6f6f - #ffffff - #ffffff - #ffffff - #006b0b - - diff --git a/plugins/editor/resources/Themes/Default/theme.xml b/plugins/editor/resources/Themes/Default/theme.xml deleted file mode 100644 index 7aac2b8ac..000000000 --- a/plugins/editor/resources/Themes/Default/theme.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - #d3d7cf - - #babdb6 - #000000 - #b2b2b2 - #fd9800 - #ffffff - #2e3436 - #ffffff - #2e3436 - #000000 - #fd9800 - #00aa11 - #303030 - #000000 - #000000 - #ffffff - #006b0b - - - #2e3436 - #ffffff - #b2b2b2 - #fd9800 - #000000 - #babdb6 - #000000 - #9a9a9a - #b2b2b2 - #fd9800 - #00aa11 - #606060 - #ffffff - #ffffff - #ffffff - #006b0b - - diff --git a/plugins/editor/resources/background.png b/plugins/editor/resources/background.png deleted file mode 100644 index 671268679..000000000 Binary files a/plugins/editor/resources/background.png and /dev/null differ diff --git a/plugins/editor/resources/background@2x.png b/plugins/editor/resources/background@2x.png deleted file mode 100644 index 9177e38b0..000000000 Binary files a/plugins/editor/resources/background@2x.png and /dev/null differ diff --git a/plugins/editor/resources/background_button_about.png b/plugins/editor/resources/background_button_about.png deleted file mode 100644 index d6e4c19ba..000000000 Binary files a/plugins/editor/resources/background_button_about.png and /dev/null differ diff --git a/plugins/editor/resources/background_button_about@2x.png b/plugins/editor/resources/background_button_about@2x.png deleted file mode 100644 index 7ae71e8ff..000000000 Binary files a/plugins/editor/resources/background_button_about@2x.png and /dev/null differ diff --git a/plugins/editor/resources/icon_white.png b/plugins/editor/resources/icon_white.png deleted file mode 100644 index d63b6f3df..000000000 Binary files a/plugins/editor/resources/icon_white.png and /dev/null differ diff --git a/plugins/editor/resources/icon_white.svg b/plugins/editor/resources/icon_white.svg deleted file mode 100644 index 4021b7876..000000000 --- a/plugins/editor/resources/icon_white.svg +++ /dev/null @@ -1,253 +0,0 @@ - - - sfizz logo - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - sfizz logo - 2020-05-16 - - - Tobiasz 'unfa' Karoń - - - - - CC-0 - - - - - - - - - - - - - - - diff --git a/plugins/editor/resources/icon_white@2x.png b/plugins/editor/resources/icon_white@2x.png deleted file mode 100644 index e5bc80a22..000000000 Binary files a/plugins/editor/resources/icon_white@2x.png and /dev/null differ diff --git a/plugins/editor/resources/knob.knob b/plugins/editor/resources/knob.knob deleted file mode 100644 index 093bd66cc..000000000 Binary files a/plugins/editor/resources/knob.knob and /dev/null differ diff --git a/plugins/editor/resources/knob48.png b/plugins/editor/resources/knob48.png deleted file mode 100644 index d0fc774ab..000000000 Binary files a/plugins/editor/resources/knob48.png and /dev/null differ diff --git a/plugins/editor/resources/knob48@2x.png b/plugins/editor/resources/knob48@2x.png deleted file mode 100644 index f064cfc3e..000000000 Binary files a/plugins/editor/resources/knob48@2x.png and /dev/null differ diff --git a/plugins/editor/resources/logo.png b/plugins/editor/resources/logo.png deleted file mode 100644 index 2474e9913..000000000 Binary files a/plugins/editor/resources/logo.png and /dev/null differ diff --git a/plugins/editor/resources/logo.svg b/plugins/editor/resources/logo.svg deleted file mode 100644 index 6b9e1029b..000000000 --- a/plugins/editor/resources/logo.svg +++ /dev/null @@ -1,246 +0,0 @@ - - - sfizz logo - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - sfizz logo - 2020-05-16 - - - Tobiasz 'unfa' Karoń - - - - - CC-0 - - - - - - - - - - - - - - - diff --git a/plugins/editor/resources/logo_orange.png b/plugins/editor/resources/logo_orange.png deleted file mode 100644 index e765347b8..000000000 Binary files a/plugins/editor/resources/logo_orange.png and /dev/null differ diff --git a/plugins/editor/resources/logo_orange.svg b/plugins/editor/resources/logo_orange.svg deleted file mode 100644 index bb249725d..000000000 --- a/plugins/editor/resources/logo_orange.svg +++ /dev/null @@ -1,246 +0,0 @@ - - - sfizz logo - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - sfizz logo - 2020-05-16 - - - Tobiasz 'unfa' Karoń - - - - - CC-0 - - - - - - - - - - - - - - - diff --git a/plugins/editor/resources/logo_orange@2x.png b/plugins/editor/resources/logo_orange@2x.png deleted file mode 100644 index fde46ddaf..000000000 Binary files a/plugins/editor/resources/logo_orange@2x.png and /dev/null differ diff --git a/plugins/editor/resources/logo_shaded.svg b/plugins/editor/resources/logo_shaded.svg deleted file mode 100644 index 5e21ed046..000000000 --- a/plugins/editor/resources/logo_shaded.svg +++ /dev/null @@ -1,246 +0,0 @@ - - - sfizz logo - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - sfizz logo - 2020-05-16 - - - Tobiasz 'unfa' Karoń - - - - - CC-0 - - - - - - - - - - - - - - - diff --git a/plugins/editor/resources/logo_text.png b/plugins/editor/resources/logo_text.png deleted file mode 100644 index d683e44e1..000000000 Binary files a/plugins/editor/resources/logo_text.png and /dev/null differ diff --git a/plugins/editor/resources/logo_text.svg b/plugins/editor/resources/logo_text.svg deleted file mode 100644 index a62481c87..000000000 --- a/plugins/editor/resources/logo_text.svg +++ /dev/null @@ -1,252 +0,0 @@ - - - sfizz logo - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - sfizz logo - 2020-05-16 - - - Tobiasz 'unfa' Karoń - - - - - CC-0 - - - - - - - - - - - - - - - diff --git a/plugins/editor/resources/logo_text@2x.png b/plugins/editor/resources/logo_text@2x.png deleted file mode 100644 index c3e28c637..000000000 Binary files a/plugins/editor/resources/logo_text@2x.png and /dev/null differ diff --git a/plugins/editor/resources/logo_text_shaded.png b/plugins/editor/resources/logo_text_shaded.png deleted file mode 100644 index e4198b1cc..000000000 Binary files a/plugins/editor/resources/logo_text_shaded.png and /dev/null differ diff --git a/plugins/editor/resources/logo_text_shaded@2x.png b/plugins/editor/resources/logo_text_shaded@2x.png deleted file mode 100644 index b786d9b98..000000000 Binary files a/plugins/editor/resources/logo_text_shaded@2x.png and /dev/null differ diff --git a/plugins/editor/resources/logo_text_white.png b/plugins/editor/resources/logo_text_white.png deleted file mode 100644 index 312719e5d..000000000 Binary files a/plugins/editor/resources/logo_text_white.png and /dev/null differ diff --git a/plugins/editor/resources/logo_text_white@2x.png b/plugins/editor/resources/logo_text_white@2x.png deleted file mode 100644 index d3464ae7d..000000000 Binary files a/plugins/editor/resources/logo_text_white@2x.png and /dev/null differ diff --git a/plugins/editor/src/editor/ColorHelpers.cpp b/plugins/editor/src/editor/ColorHelpers.cpp deleted file mode 100644 index 5ce3314d9..000000000 --- a/plugins/editor/src/editor/ColorHelpers.cpp +++ /dev/null @@ -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 - -SColorRGB::SColorRGB(const CColor &cc) -{ - r = cc.normRed(); - g = cc.normGreen(); - b = cc.normBlue(); - a = cc.normAlpha(); -} - -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; -} diff --git a/plugins/editor/src/editor/ColorHelpers.h b/plugins/editor/src/editor/ColorHelpers.h deleted file mode 100644 index c79501cd9..000000000 --- a/plugins/editor/src/editor/ColorHelpers.h +++ /dev/null @@ -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 - -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); diff --git a/plugins/editor/src/editor/DlgAbout.cpp b/plugins/editor/src/editor/DlgAbout.cpp deleted file mode 100644 index 6bf5ed8ef..000000000 --- a/plugins/editor/src/editor/DlgAbout.cpp +++ /dev/null @@ -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 -#if 0 -#include -#include -#endif -using namespace gui; - -SAboutDialog::SAboutDialog(const CRect& bounds) - : CViewContainer(bounds) -{ - SharedPointer 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("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("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("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("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("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("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; - } -} diff --git a/plugins/editor/src/editor/DlgAbout.h b/plugins/editor/src/editor/DlgAbout.h deleted file mode 100644 index 4f36c217e..000000000 --- a/plugins/editor/src/editor/DlgAbout.h +++ /dev/null @@ -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 - -#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 sysInfoVariables_; -}; diff --git a/plugins/editor/src/editor/EditIds.cpp b/plugins/editor/src/editor/EditIds.cpp deleted file mode 100644 index 34ea4e1c0..000000000 --- a/plugins/editor/src/editor/EditIds.cpp +++ /dev/null @@ -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 }; - } -} diff --git a/plugins/editor/src/editor/EditIds.h b/plugins/editor/src/editor/EditIds.h deleted file mode 100644 index f6f6c1a5a..000000000 --- a/plugins/editor/src/editor/EditIds.h +++ /dev/null @@ -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 - -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 diff --git a/plugins/editor/src/editor/EditValue.h b/plugins/editor/src/editor/EditValue.h deleted file mode 100644 index b8d911ddd..000000000 --- a/plugins/editor/src/editor/EditValue.h +++ /dev/null @@ -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 -#include -#include - -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 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; -}; diff --git a/plugins/editor/src/editor/Editor.cpp b/plugins/editor/src/editor/Editor.cpp deleted file mode 100644 index 81e5d3712..000000000 --- a/plugins/editor/src/editor/Editor.cpp +++ /dev/null @@ -1,2345 +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 "Editor.h" -#include "EditorController.h" -#include "EditIds.h" -#include "GUIDefs.h" -#include "GUIComponents.h" -#include "GUIHelpers.h" -#include "GUIPiano.h" -#include "GitBuildId.h" -#include "DlgAbout.h" -#include "ImageHelpers.h" -#include "NativeHelpers.h" -#include "VSTGUIHelpers.h" -#include "BitArray.h" -#include "Theme.h" -#include "plugin/MessageUtils.h" -#include "plugin/SfizzSettings.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "utility/vstgui_before.h" -#include "vstgui/vstgui.h" -#include "utility/vstgui_after.h" - -using namespace VSTGUI; -using namespace gui; - -const int Editor::viewWidth { 775 }; -const int Editor::viewHeight { 515 }; - -struct Editor::Impl : EditorController::Receiver, - public IControlListener, - public Theme::ChangeListener -{ - EditorController* ctrl_ = nullptr; - CFrame* frame_ = nullptr; - SharedPointer frameDisabler_; - SharedPointer mainView_; - - std::string currentSfzFile_; - std::string currentScalaFile_; - std::string currentThemeName_; - std::string userFilesDir_; - std::string fallbackFilesDir_; - bool multi_ { false }; - - float zoom_ = 1.0f; - - int currentKeyswitch_ = -1; - std::unordered_map keyswitchNames_; - - SharedPointer memQueryTimer_; - - enum { - kPanelGeneral, - kPanelInfo, - kPanelControls, - kPanelSettings, - kNumPanels, - }; - - unsigned activePanel_ = 0; - CViewContainer* subPanels_[kNumPanels] = {}; - STextButton* panelButtons_[kNumPanels] = {}; - - enum { - kTagLoadSfzFile, - kTagEditSfzFile, - kTagCreateNewSfzFile, - kTagOpenSfzFolder, - kTagPreviousSfzFile, - kTagNextSfzFile, - kTagFileOperations, - kTagSetMainVolume, - kTagSetNumVoices, - kTagSetOversampling, - kTagSetPreloadSize, - kTagLoadScalaFile, - kTagResetScalaFile, - kTagSetScalaRootKey, - kTagSetTuningFrequency, - kTagSetStretchedTuning, - kTagSetSampleQuality, - kTagSetOscillatorQuality, - kTagSetFreewheelingSampleQuality, - kTagSetFreewheelingOscillatorQuality, - kTagSetSustainCancelsRelease, - kTagSetCCVolume, - kTagSetCCPan, - kTagChooseUserFilesDir, - kTagAbout, - kTagThemeMenu, - kTagZoomMenu, - kTagSetDefaultZoom, - kTagFirstChangePanel, - kTagLastChangePanel = kTagFirstChangePanel + kNumPanels - 1, - }; - - STextButton* sfzFileLabel_ = nullptr; - CTextLabel* scalaFileLabel_ = nullptr; - STextButton* scalaFileButton_ = nullptr; - STextButton* scalaResetButton_ = nullptr; - CControl *volumeSlider_ = nullptr; - CTextLabel* volumeLabel_ = nullptr; - SValueMenu *numVoicesSlider_ = nullptr; - CTextLabel* numVoicesLabel_ = nullptr; - SValueMenu *oversamplingSlider_ = nullptr; - CTextLabel* oversamplingLabel_ = nullptr; - SValueMenu *preloadSizeSlider_ = nullptr; - CTextLabel* preloadSizeLabel_ = nullptr; - SValueMenu *scalaRootKeySlider_ = nullptr; - SValueMenu *scalaRootOctaveSlider_ = nullptr; - CTextLabel* scalaRootKeyLabel_ = nullptr; - SValueMenu* tuningFrequencyDropdown_ = nullptr; - CTextEdit* tuningFrequencyEdit_ = nullptr; - CTextLabel* tuningFrequencyLabel_ = nullptr; - CControl *stretchedTuningSlider_ = nullptr; - CTextLabel* stretchedTuningLabel_ = nullptr; - SValueMenu *sampleQualitySlider_ = nullptr; - SValueMenu *oscillatorQualitySlider_ = nullptr; - SValueMenu *freewheelingSampleQualitySlider_ = nullptr; - SValueMenu *freewheelingOscillatorQualitySlider_ = nullptr; - CCheckBox *sustainCancelsReleaseCheckbox_ = nullptr; - CTextLabel* keyswitchLabel_ = nullptr; - CTextLabel* keyswitchInactiveLabel_ = nullptr; - CTextLabel* keyswitchBadge_ = nullptr; - CTextLabel* lblHover_ = nullptr; - COptionMenu* themeMenu_ = nullptr; - COptionMenu* zoomMenu_ = nullptr; - STextButton* defaultZoomButton_ = nullptr; - std::unique_ptr theme_; - - STitleContainer* userFilesGroup_ = nullptr; - STextButton* userFilesDirButton_ = nullptr; - - CTextLabel* infoCurvesLabel_ = nullptr; - CTextLabel* infoMastersLabel_ = nullptr; - CTextLabel* infoGroupsLabel_ = nullptr; - CTextLabel* infoRegionsLabel_ = nullptr; - CTextLabel* infoSamplesLabel_ = nullptr; - CTextLabel* infoVoicesLabel_ = nullptr; - - CViewContainer* imageContainer_ = nullptr; - - CTextLabel* memoryLabel_ = nullptr; - - SActionMenu* fileOperationsMenu_ = nullptr; - - SPiano* piano_ = nullptr; - - SControlsPanel* controlsPanel_ = nullptr; - - SKnobCCBox* volumeCCKnob_ = nullptr; - SKnobCCBox* panCCKnob_ = nullptr; - - SLevelMeter* meters_[16] {}; - SAboutDialog* aboutDialog_ = nullptr; - - SharedPointer backgroundBitmap_; - SharedPointer defaultBackgroundBitmap_; - SharedPointer controlsBitmap_; - - CTextLabel* sfizzVersionLabel_ = nullptr; - - SKnobCCBox* getSecondaryCCKnob(unsigned cc) - { - switch (cc) { - case 7: return volumeCCKnob_ ? volumeCCKnob_ : nullptr; - case 10: return panCCKnob_ ? panCCKnob_ : nullptr; - default: return nullptr; - } - } - - void uiReceiveValue(EditId id, const EditValue& v) override; - void uiReceiveMessage(const char* path, const char* sig, const sfizz_arg_t* args) override; - - // queued OSC API; sends OSC with intermediate delay between messages - // to prevent message bursts overloading the buffer - void sendQueuedOSC(const char* path, const char* sig, const sfizz_arg_t* args); - void clearQueuedOSC(); - void tickOSCQueue(CVSTGUITimer* timer); - std::queue oscSendQueue_; - SharedPointer oscSendQueueTimer_; - - void createFrameContents(); - SLevelMeter* createVMeter(const CRect& bounds, int, const char*, CHoriTxtAlign, int); - - template - void adjustMinMaxToEditRange(Control* c, EditId id) - { - if (!c) - return; - const EditRange er = EditRange::get(id); - c->setMin(er.min); - c->setMax(er.max); - c->setDefaultValue(er.def); - } - - void chooseSfzFile(); - void createNewSfzFile(); - void changeSfzFile(const std::string& filePath); - void changeToNextSfzFile(long offset); - void chooseScalaFile(); - void changeScalaFile(const std::string& filePath); - void chooseUserFilesDir(); - std::string getFileChooserInitialDir(const std::string& previousFilePath) const; - - static bool scanDirectoryFiles(const fs::path& dirPath, std::function filter, std::vector& fileNames); - - static absl::string_view simplifiedFileName(absl::string_view path, absl::string_view removedSuffix, absl::string_view ifEmpty); - - void updateSfzFileLabel(const std::string& filePath); - void updateScalaFileLabel(const std::string& filePath); - void updateUserFilesDirLabel(const std::string& filePath); - static void updateLabelWithFileName(CTextLabel* label, const std::string& filePath, absl::string_view removedSuffix); - static void updateButtonWithFileName(STextButton* button, const std::string& filePath, absl::string_view removedSuffix); - static void updateSButtonWithFileName(STextButton* button, const std::string& filePath, absl::string_view removedSuffix); - void updateVolumeLabel(float volume); - void updateNumVoicesLabel(int numVoices); - void updateOversamplingLabel(int oversamplingLog2); - void updatePreloadSizeLabel(int preloadSize); - void updateScalaRootKeyLabel(int rootKey); - void updateStretchedTuningLabel(float stretchedTuning); - void buttonHoverEnter(CControl* btn, const char* text); - void buttonHoverLeave(CControl* btn); - - absl::string_view getCurrentKeyswitchName() const; - void updateKeyswitchNameLabel(); - - void updateKeyUsed(unsigned key, bool used); - void updateKeyLabel(unsigned key, const char* label); - void updateKeyswitchUsed(unsigned key, bool used); - void updateCCUsed(unsigned cc, bool used); - void updateCCValue(unsigned cc, float value); - void updateCCDefaultValue(unsigned cc, float value); - void updateCCLabel(unsigned cc, const char* label); - void updateSWLastCurrent(int sw); - void updateSWLastLabel(unsigned sw, const char* label); - void updateBackgroundImage(const char* filepath); - void updateControlsImage(const char* filepath); - void updateMemoryUsed(uint64_t mem); - - // edition of CC by UI - void performCCValueChange(unsigned cc, float value); - void performCCBeginEdit(unsigned cc); - void performCCEndEdit(unsigned cc); - - void setActivePanel(unsigned panelId); - void setupCurrentPanel(); - void applyBackgroundForCurrentPanel(); - - static void formatLabel(CTextLabel* label, const char* fmt, ...); - static void vformatLabel(CTextLabel* label, const char* fmt, va_list ap); - - // IControlListener - void valueChanged(CControl* ctl) override; - void enterOrLeaveEdit(CControl* ctl, bool enter); - void controlBeginEdit(CControl* ctl) override; - void controlEndEdit(CControl* ctl) override; - - // Theme - void onThemeChanged() override; - std::vector> OnThemeChanged; - - // Zoom - void setZoom(int zoom); - - // Misc - static std::string getUnicodeNoteName(unsigned key) - { - const char* keyNames[12] = { - u8"C", u8"C♯", u8"D", u8"D♯", u8"E", - u8"F", u8"F♯", u8"G", u8"G♯", u8"A", u8"A♯", u8"B", - }; - int octave = static_cast(key / 12) - 1; - const char* keyName = keyNames[key % 12]; - return std::string(keyName) + ' ' + std::to_string(octave); - } -}; - -Editor::Editor(EditorController& ctrl) - : impl_(new Impl) -{ - Impl& impl = *impl_; - - impl.ctrl_ = &ctrl; - - ctrl.decorate(&impl); - - impl.createFrameContents(); -} - -Editor::~Editor() -{ - Impl& impl = *impl_; - - close(); - - EditorController& ctrl = *impl.ctrl_; - ctrl.decorate(nullptr); -} - -void Editor::open(CFrame& frame) -{ - Impl& impl = *impl_; - - fprintf(stderr, "[sfizz] The resource path of the bundle is %s\n", - getResourceBasePath().u8string().c_str()); - - impl.frame_ = &frame; - - frame.addView(impl.mainView_.get()); - - SfizzSettings settings; - int zoom = atoi(settings.load_or("default_zoom", "100").c_str()); - impl.setZoom(zoom); - fprintf(stderr, "[sfizz] zoom factor: %f\n", impl.frame_->getZoom()); - - impl.frameDisabler_ = makeOwned(&frame); - - impl.memQueryTimer_ = makeOwned([this](CVSTGUITimer*) { - impl_->sendQueuedOSC("/mem/buffers", "", nullptr); - }, 1000, true); - - uint32_t oscSendInterval = 1; // milliseconds - impl.oscSendQueueTimer_ = makeOwned( - [this](CVSTGUITimer* timer) { impl_->tickOSCQueue(timer); }, - oscSendInterval, false); -} - -void Editor::close() -{ - Impl& impl = *impl_; - - impl.clearQueuedOSC(); - impl.oscSendQueueTimer_ = nullptr; - - impl.memQueryTimer_ = nullptr; - - impl.frameDisabler_ = nullptr; - - if (impl.frame_) { - impl.frame_->removeView(impl.mainView_.get(), false); - impl.frame_ = nullptr; - } -} - -SLevelMeter* Editor::Impl::createVMeter(const CRect& bounds, int, const char*, CHoriTxtAlign, int) { - SLevelMeter* meter = new SLevelMeter(bounds); - Palette* palette = &theme_->invertedPalette; - meter->setFrameColor(kColorTransparent); - meter->setNormalFillColor(kColorMeterNormal); - meter->setDangerFillColor(kColorMeterDanger); - meter->setBackColor(palette->knobInactiveTrack); - return meter; -}; - -void Editor::Impl::uiReceiveValue(EditId id, const EditValue& v) -{ - switch (id) { - case EditId::SfzFile: - { - const std::string& value = v.to_string(); - currentSfzFile_ = value; - updateSfzFileLabel(value); - } - break; - case EditId::Volume: - { - const float value = v.to_float(); - if (volumeSlider_) - volumeSlider_->setValue(value); - updateVolumeLabel(value); - } - break; - case EditId::Polyphony: - { - const int value = static_cast(v.to_float()); - if (numVoicesSlider_) - numVoicesSlider_->setValue(value); - updateNumVoicesLabel(value); - } - break; - case EditId::Oversampling: - { - const int value = static_cast(v.to_float()); - - int log2Value = 0; - for (int f = value; f > 1; f /= 2) - ++log2Value; - - if (oversamplingSlider_) - oversamplingSlider_->setValue(log2Value); - updateOversamplingLabel(log2Value); - } - break; - case EditId::PreloadSize: - { - const int value = static_cast(v.to_float()); - if (preloadSizeSlider_) - preloadSizeSlider_->setValue(value); - updatePreloadSizeLabel(value); - } - break; - case EditId::ScalaFile: - { - const std::string& value = v.to_string(); - currentScalaFile_ = value; - updateScalaFileLabel(value); - } - break; - case EditId::ScalaRootKey: - { - const int value = std::max(0, static_cast(v.to_float())); - if (scalaRootKeySlider_) - scalaRootKeySlider_->setValue(value % 12); - if (scalaRootOctaveSlider_) - scalaRootOctaveSlider_->setValue(value / 12); - updateScalaRootKeyLabel(value); - } - break; - case EditId::TuningFrequency: - { - const float value = v.to_float(); - if (tuningFrequencyEdit_) - tuningFrequencyEdit_->setValue(value); - } - break; - case EditId::StretchTuning: - { - const float value = v.to_float(); - if (stretchedTuningSlider_) - stretchedTuningSlider_->setValue(value); - updateStretchedTuningLabel(value); - } - break; - case EditId::SampleQuality: - { - const int value = static_cast(v.to_float()); - if (CControl* slider = sampleQualitySlider_) { - slider->setValue(float(value)); - slider->invalid(); - } - } - break; - case EditId::OscillatorQuality: - { - const int value = static_cast(v.to_float()); - if (CControl* slider = oscillatorQualitySlider_) { - slider->setValue(float(value)); - slider->invalid(); - } - } - break; - case EditId::FreewheelingSampleQuality: - { - const int value = static_cast(v.to_float()); - if (CControl* slider = freewheelingSampleQualitySlider_) { - slider->setValue(float(value)); - slider->invalid(); - } - } - break; - case EditId::FreewheelingOscillatorQuality: - { - const int value = static_cast(v.to_float()); - if (CControl* slider = freewheelingOscillatorQualitySlider_) { - slider->setValue(float(value)); - slider->invalid(); - } - } - break; - case EditId::SustainCancelsRelease: - { - const bool value = v.to_float(); - if (CControl* checkbox = sustainCancelsReleaseCheckbox_) { - checkbox->setValue(value); - checkbox->invalid(); - } - } - break; - case EditId::CanEditUserFilesDir: - { - if (STitleContainer* group = userFilesGroup_) - group->setVisible(v.to_float()); - break; - } - case EditId::UserFilesDir: - { - userFilesDir_ = v.to_string(); - updateUserFilesDirLabel(userFilesDir_); - break; - } - case EditId::FallbackFilesDir: - { - fallbackFilesDir_ = v.to_string(); - break; - } - case EditId::PluginFormat: - aboutDialog_->setPluginFormat(v.to_string()); - break; - case EditId::PluginHost: - aboutDialog_->setPluginHost(v.to_string()); - break; - case EditId::UINumCurves: - { - const int value = static_cast(v.to_float()); - if (CTextLabel* label = infoCurvesLabel_) - formatLabel(label, "%u", value); - } - break; - case EditId::UINumMasters: - { - const int value = static_cast(v.to_float()); - if (CTextLabel* label = infoMastersLabel_) - formatLabel(label, "%u", value); - } - break; - case EditId::UINumGroups: - { - const int value = static_cast(v.to_float()); - if (CTextLabel* label = infoGroupsLabel_) - formatLabel(label, "%u", value); - } - break; - case EditId::UINumRegions: - { - const int value = static_cast(v.to_float()); - if (CTextLabel* label = infoRegionsLabel_) - formatLabel(label, "%u", value); - } - break; - case EditId::UINumPreloadedSamples: - { - const int value = static_cast(v.to_float()); - if (CTextLabel* label = infoSamplesLabel_) - formatLabel(label, "%u", value); - } - break; - case EditId::UINumActiveVoices: - { - const int value = static_cast(v.to_float()); - if (CTextLabel* label = infoVoicesLabel_) - formatLabel(label, "%u", value); - } - break; - case EditId::UIActivePanel: - { - const int value = static_cast(v.to_float()); - setActivePanel(value); - } - break; - case EditId::BackgroundImage: - { - const std::string& value = v.to_string(); - updateBackgroundImage(value.c_str()); - } - break; - case EditId::ControlsImage: - { - const std::string& value = v.to_string(); - updateControlsImage(value.c_str()); - } - break; - case EditId::PluginOutputs: - { - const int value = static_cast(v.to_float()); - if (!meters_[0]) - return; - - const auto firstMeterRect = meters_[0]->getViewSize(); - const auto minLeft = firstMeterRect.left; - auto maxRight = firstMeterRect.right; - auto numMeters = 1; - for (; numMeters < 16; ++numMeters) { - if (!meters_[numMeters]) - break; - - maxRight = meters_[numMeters]->getViewSize().right; - } - const auto meterWidth = std::max(1.0, (maxRight - minLeft - value + 1) / value); - - auto meterParent = meters_[0]->getParentView()->asViewContainer(); - const auto roundRectRadius = [value] { - if (value < 4) - return 5.0; - else if (value < 8) - return 3.0; - else if (value < 16) - return 1.0; - else - return 0.0; - }(); - - for (int i = 0; i < 16; ++i) { - if (meters_[i]) { - meterParent->removeView(meters_[i]); - } - - if (i < value) { - double left { minLeft + i * (meterWidth + 1) }; - CRect rect { left, firstMeterRect.top, left + meterWidth, firstMeterRect.bottom }; - meters_[i] = createVMeter(rect, -1, "", kCenterText, 14); - meters_[i]->setRoundRectRadius(roundRectRadius); - meterParent->addView(meters_[i]); - } - } - break; - } - default: - if (editIdIsKey(id)) { - const int key = keyForEditId(id); - const float value = v.to_float(); - if (SPiano* piano = piano_) - piano->setKeyValue(key, value); - } - else if (editIdIsKeyUsed(id)) { - updateKeyUsed(keyUsedForEditId(id), v.to_float() != 0); - } - else if (editIdIsKeyLabel(id)) { - updateKeyLabel(keyLabelForEditId(id), v.to_string().c_str()); - } - else if (editIdIsKeyswitchUsed(id)) { - updateKeyswitchUsed(keyswitchUsedForEditId(id), v.to_float() != 0); - } - else if (editIdIsKeyswitchLabel(id)) { - updateSWLastLabel(keyswitchLabelForEditId(id), v.to_string().c_str()); - } - else if (editIdIsCC(id)) { - updateCCValue(unsigned(ccForEditId(id)), v.to_float()); - } - else if (editIdIsCCUsed(id)) { - bool used = v.to_float() != 0; - updateCCUsed(ccUsedForEditId(id), used); - } - else if (editIdIsCCDefault(id)) { - updateCCDefaultValue(ccDefaultForEditId(id), v.to_float()); - } - else if (editIdIsCCLabel(id)) { - updateCCLabel(ccLabelForEditId(id), v.to_string().c_str()); - } - else if (editIdIsLevel(id)) { - const float value = v.to_float(); - if (SLevelMeter* meter = meters_[levelForEditId(id)]) - meter->setValue(value); - } - break; - } -} - -void Editor::Impl::uiReceiveMessage(const char* path, const char* sig, const sfizz_arg_t* args) -{ - unsigned indices[8]; - - if (Messages::matchOSC("/sw/last/current", path, indices) && !strcmp(sig, "i")) { - updateSWLastCurrent(args[0].i); - } - else if (Messages::matchOSC("/sw/last/current", path, indices) && !strcmp(sig, "N")) { - updateSWLastCurrent(-1); - } - else if (Messages::matchOSC("/mem/buffers", path, indices) && !strcmp(sig, "h")) { - updateMemoryUsed(args[0].h); - } - else { - //fprintf(stderr, "Receive unhandled OSC: %s\n", path); - } -} - -void Editor::Impl::sendQueuedOSC(const char* path, const char* sig, const sfizz_arg_t* args) -{ - if (!frame_) - return; - - uint32_t oscSize = sfizz_prepare_message(nullptr, 0, path, sig, args); - std::string oscData(oscSize, '\0'); - sfizz_prepare_message(&oscData[0], oscSize, path, sig, args); - oscSendQueue_.push(std::move(oscData)); - oscSendQueueTimer_->start(); -} - -void Editor::Impl::clearQueuedOSC() -{ - while (!oscSendQueue_.empty()) - oscSendQueue_.pop(); -} - -void Editor::Impl::tickOSCQueue(CVSTGUITimer* timer) -{ - if (oscSendQueue_.empty()) { - timer->stop(); - return; - } - const std::string& msg = oscSendQueue_.front(); - const char* path; - const char* sig; - const sfizz_arg_t* args; - uint8_t buffer[1024]; - if (sfizz_extract_message(msg.data(), msg.size(), buffer, sizeof(buffer), &path, &sig, &args) > 0) - ctrl_->uiSendMessage(path, sig, args); - oscSendQueue_.pop(); -} - -void Editor::Impl::createFrameContents() -{ - CViewContainer* mainView; - Theme* theme; - - SharedPointer backgroundAbout = owned(new CBitmap("background_button_about.png")); - SharedPointer background = owned(new CBitmap("background.png")); - SharedPointer knob48 = owned(new CBitmap("knob48.png")); - - // TODO: is this used somewhere? - SharedPointer logoText = owned(new CBitmap("logo_text.png")); - - defaultBackgroundBitmap_ = background; - backgroundBitmap_ = background; - controlsBitmap_ = nullptr; - - { - theme = new Theme; - theme_.reset(theme); - - theme->listener = this; - OnThemeChanged.clear(); - OnThemeChanged.reserve(128); - - Palette& invertedPalette = theme->invertedPalette; - Palette& defaultPalette = theme->normalPalette; - Palette* palette = &defaultPalette; - auto enterPalette = [&palette](Palette& p) { palette = &p; }; - - auto createLogicalGroup = [](const CRect& bounds, int, const char*, CHoriTxtAlign, int) { - CViewContainer* container = new CViewContainer(bounds); - container->setBackgroundColor(kColorTransparent); - return container; - }; - auto createRoundedGroup = [this, &palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int) { - auto* box = new SBoxContainer(bounds); - box->setCornerRadius(10.0); - OnThemeChanged.push_back([box, palette]() { - box->setBackgroundColor(palette->boxBackground); - }); - return box; - }; - auto createSquaredGroup = [this, &palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int) { - auto* box = new CViewContainer(bounds); - OnThemeChanged.push_back([box, palette]() { - box->setBackgroundColor(palette->boxBackground); - }); - return box; - }; - auto createSquaredTransparentGroup = [](const CRect& bounds, int, const char*, CHoriTxtAlign, int) { - auto* box = new CViewContainer(bounds); - box->setBackgroundColor(kColorInfoTransparency); - return box; - }; -#if 0 - auto createTitleGroup = [this, &palette](const CRect& bounds, int, const char* label, CHoriTxtAlign, int fontsize) { - auto* box = new STitleContainer(bounds, label); - box->setCornerRadius(10.0); - OnThemeChanged.push_back([box, palette]() { - box->setBackgroundColor(palette->boxBackground); - box->setTitleFontColor(palette->titleBoxText); - box->setTitleBackgroundColor(palette->titleBoxBackground); - }); - auto font = makeOwned("Roboto", fontsize); - box->setTitleFont(font); - return box; - }; -#endif - auto createAboutButton = [this, &backgroundAbout]( - const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) { - SHoverButton* btn = new SHoverButton(bounds, this, tag, backgroundAbout); - btn->OnHoverEnter = [this, btn]() { buttonHoverEnter(btn, "About sfizz..."); }; - btn->OnHoverLeave = [this, btn]() { buttonHoverLeave(btn); }; - return btn; - }; - auto createLabel = [this, &palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) { - CTextLabel* lbl = new CTextLabel(bounds, label); - lbl->setFrameColor(kColorTransparent); - lbl->setBackColor(kColorTransparent); - OnThemeChanged.push_back([lbl, palette]() { - lbl->setFontColor(palette->text); - }); - lbl->setHoriAlign(align); - auto font = makeOwned("Roboto", fontsize); - lbl->setFont(font); - return lbl; - }; - auto createInfoLabel = [](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) { - CTextLabel* lbl = new CTextLabel(bounds, label); - lbl->setFrameColor(kColorTransparent); - lbl->setBackColor(kColorTransparent); - lbl->setFontColor(kWhiteCColor); - lbl->setHoriAlign(align); - auto font = makeOwned("Roboto", fontsize); - lbl->setFont(font); - return lbl; - }; - auto createInactiveLabel = [this, &palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) { - CTextLabel* lbl = new CTextLabel(bounds, label); - lbl->setFrameColor(kColorTransparent); - lbl->setBackColor(kColorTransparent); - OnThemeChanged.push_back([lbl, palette]() { - lbl->setFontColor(palette->inactiveText); - }); - lbl->setHoriAlign(align); - auto font = makeOwned("Roboto", fontsize); - lbl->setFont(font); - return lbl; - }; - auto createHLine = [this, &palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int) { - int y = static_cast(0.5 * (bounds.top + bounds.bottom)); - CRect lineBounds(bounds.left, y, bounds.right, y + 1); - CViewContainer* hline = new CViewContainer(lineBounds); - OnThemeChanged.push_back([hline, palette]() { - hline->setBackgroundColor(palette->text); - }); - return hline; - }; - auto createValueLabel = [this, &palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) { - CTextLabel* lbl = new CTextLabel(bounds, label); - lbl->setFrameColor(kColorTransparent); - lbl->setBackColor(kColorTransparent); - OnThemeChanged.push_back([lbl, palette]() { - lbl->setFontColor(palette->text); - }); - lbl->setHoriAlign(align); - auto font = makeOwned("Roboto", fontsize); - lbl->setFont(font); - return lbl; - }; - auto createBadge = [this, &palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) { - CTextLabel* lbl = new CTextLabel(bounds, label); - lbl->setFrameColor(kColorTransparent); - OnThemeChanged.push_back([lbl, palette]() { - lbl->setBackColor(palette->valueBackground); - lbl->setFontColor(palette->valueText); - }); - lbl->setHoriAlign(align); - lbl->setStyle(CParamDisplay::kRoundRectStyle); - lbl->setRoundRectRadius(5.0); - auto font = makeOwned("Roboto", fontsize); - lbl->setFont(font); - return lbl; - }; - - auto createClickableLabel = [this, &palette](const CRect& bounds, int tag, const char* label, CHoriTxtAlign align, int fontsize) { - STextButton* button = new STextButton(bounds, this, tag, label); - auto font = makeOwned("Roboto", fontsize); - button->setFont(font); - button->setTextAlignment(align); - OnThemeChanged.push_back([button, palette]() { - button->setTextColor(palette->text); - button->setInactiveColor(palette->inactiveText); - button->setHighlightColor(palette->highlightedText); - }); - button->setFrameColor(kColorTransparent); - button->setFrameColorHighlighted(kColorTransparent); - SharedPointer gradient = owned(CGradient::create(0.0, 1.0, kColorTransparent, kColorTransparent)); - button->setGradient(gradient); - button->setGradientHighlighted(gradient); - return button; - }; - auto createValueButton = [this, &palette](const CRect& bounds, int tag, const char* label, CHoriTxtAlign align, int fontsize) { - STextButton* button = new STextButton(bounds, this, tag, label); - auto font = makeOwned("Roboto", fontsize); - button->setFont(font); - button->setTextAlignment(align); - OnThemeChanged.push_back([button, palette]() { - button->setTextColor(palette->valueText); - button->setInactiveColor(palette->inactiveText); - button->setHighlightColor(palette->highlightedText); - SharedPointer gradient = owned(CGradient::create(0.0, 1.0, palette->valueBackground, palette->valueBackground)); - button->setGradient(gradient); - button->setGradientHighlighted(gradient); - }); - button->setFrameColor(kColorTransparent); - button->setFrameColorHighlighted(kColorTransparent); - return button; - }; - auto createValueMenu = [this, &palette](const CRect& bounds, int tag, const char*, CHoriTxtAlign align, int fontsize) { - SValueMenu* vm = new SValueMenu(bounds, this, tag); - vm->setHoriAlign(align); - auto font = makeOwned("Roboto", fontsize); - vm->setFont(font); - OnThemeChanged.push_back([vm, palette]() { - vm->setFontColor(palette->valueText); - vm->setBackColor(palette->valueBackground); - }); - vm->setFrameColor(kColorTransparent); - vm->setStyle(CParamDisplay::kRoundRectStyle); - vm->setRoundRectRadius(5.0); - return vm; - }; - auto createOptionMenu = [this, &palette](const CRect& bounds, int tag, const char*, CHoriTxtAlign align, int fontsize) { - auto* cb = new COptionMenu(bounds, this, tag); - cb->setHoriAlign(align); - auto font = makeOwned("Roboto", fontsize); - cb->setFont(font); - OnThemeChanged.push_back([cb, palette]() { - cb->setFontColor(palette->valueText); - cb->setBackColor(palette->valueBackground); - }); - cb->setFrameColor(kColorTransparent); - cb->setStyle(CParamDisplay::kRoundRectStyle); - cb->setRoundRectRadius(5.0); - return cb; - }; - auto createHoverBox = [this, &palette](const CRect& bounds, int, const char* label, CHoriTxtAlign align, int fontsize) { - CTextLabel* lbl = new CTextLabel(bounds, label); - auto font = makeOwned("Roboto", fontsize); -#if 0 - OnThemeChanged.push_back([lbl, palette]() { - lbl->setFontColor(palette->valueText); - lbl->setBackColor(palette->valueBackground); - lbl->setFrameColor(palette->valueText); - }); -#else - // XP-style tooltips: Theme-based tooltips are nearly unreadable - lbl->setFontColor(kBlackCColor); - lbl->setBackColor(kColorTooltipBackground); - lbl->setFrameColor(kBlackCColor); - lbl->setStyle(CParamDisplay::kRoundRectStyle); - lbl->setRoundRectRadius(5.0); -#endif - lbl->setHoriAlign(align); - lbl->setFont(font); - lbl->setAutosizeFlags(kAutosizeAll); - return lbl; - }; - auto createGlyphButton = [this, &palette](UTF8StringPtr glyph, const CRect& bounds, int tag, int fontsize) { - STextButton* btn = new STextButton(bounds, this, tag, glyph); - btn->setFont(makeOwned("Sfizz Fluent System F20", fontsize)); - OnThemeChanged.push_back([btn, palette]() { - btn->setTextColor(palette->icon); - btn->setHighlightColor(palette->iconHighlight); - }); - btn->setFrameColor(kColorTransparent); - btn->setFrameColorHighlighted(kColorTransparent); - btn->setGradient(nullptr); - btn->setGradientHighlighted(nullptr); - return btn; - }; - auto createHomeButton = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { - auto* btn = createGlyphButton(u8"\ue1d6", bounds, tag, fontsize); - btn->OnHoverEnter = [this, btn]() { buttonHoverEnter(btn, "Home"); }; - btn->OnHoverLeave = [this, btn]() { buttonHoverLeave(btn); }; - return btn; - }; - auto createInfoButton = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { - auto* btn = createGlyphButton(u8"\ue1e7", bounds, tag, fontsize); - btn->OnHoverEnter = [this, btn]() { buttonHoverEnter(btn, "Information"); }; - btn->OnHoverLeave = [this, btn]() { buttonHoverLeave(btn); }; - return btn; - }; - auto createCCButton = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { - auto* btn = createGlyphButton(u8"\ue253", bounds, tag, fontsize); - btn->OnHoverEnter = [this, btn]() { buttonHoverEnter(btn, "Controls"); }; - btn->OnHoverLeave = [this, btn]() { buttonHoverLeave(btn); }; - return btn; - }; - auto createSettingsButton = [this, &createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { - auto* btn = createGlyphButton(u8"\ue2e4", bounds, tag, fontsize); - btn->OnHoverEnter = [this, btn]() { buttonHoverEnter(btn, "Settings"); }; - btn->OnHoverLeave = [this, btn]() { buttonHoverLeave(btn); }; - return btn; - }; -#if 0 - auto createEditFileButton = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { - return createGlyphButton(u8"\ue148", bounds, tag, fontsize); - }; - auto createLoadFileButton = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { - return createGlyphButton(u8"\ue1a3", bounds, tag, fontsize); - }; -#endif - auto createPreviousFileButton = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { - return createGlyphButton(u8"\ue0d9", bounds, tag, fontsize); - }; - auto createNextFileButton = [&createGlyphButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { - return createGlyphButton(u8"\ue0da", bounds, tag, fontsize); - }; - auto createResetSomethingButton = [&createValueButton](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { - STextButton* btn = createValueButton(bounds, tag, u8"\ue13a", kCenterText, fontsize); - btn->setFont(makeOwned("Sfizz Fluent System F20", fontsize)); - return btn; - }; - auto createPiano = [this, &palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int fontsize) { - SPiano* piano = new SPiano(bounds); - auto font = makeOwned("Roboto", fontsize); - piano->setFont(font); - OnThemeChanged.push_back([piano, palette]() { - piano->setFontColor(palette->text); - piano->setBackColor(palette->boxBackground); - }); - return piano; - }; - auto createChevronDropDown = [this, &palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int fontsize) { - SActionMenu* menu = new SActionMenu(bounds, this); - menu->setTitle(u8"\ue0d7"); - menu->setFont(makeOwned("Sfizz Fluent System F20", fontsize)); - OnThemeChanged.push_back([menu, palette]() { - menu->setFontColor(palette->icon); - menu->setHoverColor(palette->iconHighlight); - }); - menu->setFrameColor(kColorTransparent); - menu->setBackColor(kColorTransparent); - return menu; - }; - auto createChevronValueDropDown = [this, &palette](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int fontsize) { - SValueMenu* menu = new SValueMenu(bounds, this, tag); - menu->setValueToStringFunction2([](float, std::string& result, CParamDisplay*) -> bool { - result = u8"\ue0d7"; - return true; - }); - menu->setFont(makeOwned("Sfizz Fluent System F20", fontsize)); - OnThemeChanged.push_back([menu, palette]() { - menu->setFontColor(palette->icon); - menu->setHoverColor(palette->iconHighlight); - }); - menu->setFrameColor(kColorTransparent); - menu->setBackColor(kColorTransparent); - return menu; - }; - auto createKnob48 = [this, &knob48](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) { - return new CAnimKnob(bounds, this, tag, 31, 48, knob48); - }; - auto createStyledKnob = [this, &palette](const CRect& bounds, int tag, const char*, CHoriTxtAlign, int) { - SStyledKnob* knob = new SStyledKnob(bounds, this, tag); - OnThemeChanged.push_back([knob, palette]() { - knob->setActiveTrackColor(palette->knobActiveTrack); - knob->setInactiveTrackColor(palette->knobInactiveTrack); - knob->setLineIndicatorColor(palette->knobLineIndicator); - }); - return knob; - }; - auto createKnobCCBox = [this, &palette](const CRect& bounds, int tag, const char* label, CHoriTxtAlign, int fontsize) { - SKnobCCBox* box = new SKnobCCBox(bounds, this, tag); - auto font = makeOwned("Roboto", fontsize); - box->setNameLabelText(label); - box->setNameLabelFont(font); - box->setKnobFont(font); - box->setCCLabelText(label); - box->setCCLabelFont(font); - OnThemeChanged.push_back([box, palette]() { - box->setNameLabelFontColor(palette->knobText); - box->setValueEditFontColor(palette->knobText); - auto shadingColor = palette->knobText; - shadingColor.alpha = 70; - box->setShadingRectangleColor(shadingColor); - box->setCCLabelFontColor(palette->knobLabelText); - box->setCCLabelBackColor(palette->knobLabelBackground); - box->setKnobFontColor(palette->knobText); - box->setKnobLineIndicatorColor(palette->knobLineIndicator); - box->setKnobActiveTrackColor(palette->knobActiveTrack); - box->setKnobInactiveTrackColor(palette->knobInactiveTrack); - }); - return box; - }; - auto createBackground = [&background](const CRect& bounds, int, const char*, CHoriTxtAlign, int) { - CViewContainer* container = new CViewContainer(bounds); - container->setBackground(background); - return container; - }; - auto createControlsPanel = [this, &palette](const CRect& bounds, int, const char*, CHoriTxtAlign, int fontsize) { - auto* panel = new SControlsPanel(bounds); - auto font = makeOwned("Roboto", fontsize); - panel->setCCLabelFont(font); - panel->setKnobFont(font); - panel->setKnobFontColor(kWhiteCColor); - panel->setKnobLineIndicatorColor(kWhiteCColor); - panel->setKnobRotatorColor(kColorControlsTransparency); - panel->setNameLabelFont(font); - panel->setNameLabelFontColor(kWhiteCColor); - panel->setNameLabelBackColor(kColorControlsTransparency); - OnThemeChanged.push_back([panel, palette]() { - panel->setValueEditFontColor(palette->knobText); - auto shadingColor = palette->knobText; - shadingColor.alpha = 70; - panel->setShadingRectangleColor(shadingColor); - panel->setCCLabelFontColor(palette->knobLabelText); - panel->setCCLabelBackColor(palette->knobLabelBackground); - panel->setKnobActiveTrackColor(palette->knobActiveTrack); - panel->setKnobInactiveTrackColor(palette->knobInactiveTrack); - }); - return panel; - }; - - auto createCheckbox = [this](const CRect& bounds, int tag, const char* label, CHoriTxtAlign, int) { - auto* checkbox = new CCheckBox(bounds, this, tag, label); - return checkbox; - }; - - auto createTextEdit = [this, &palette] (const CRect& bounds, int tag, const char* label, CHoriTxtAlign align, int fontsize) { - auto* edit = new CTextEdit(bounds, this, tag, label, nullptr); - auto font = makeOwned("Roboto", fontsize); - edit->setFont(font); - edit->setHoriAlign(align); - edit->setFrameColor(kColorTransparent); - edit->setStyle(CParamDisplay::kRoundRectStyle); - edit->setRoundRectRadius(5.0); - OnThemeChanged.push_back([edit, palette]() { - edit->setFontColor(palette->valueText); - edit->setBackColor(palette->valueBackground); - }); - return edit; - }; - - #include "layout/main.hpp" - - OnThemeChanged.push_back([mainView, theme]() { - mainView->setBackgroundColor(theme->frameBackground); - }); - - OnThemeChanged.push_back([this, theme]() { - for (unsigned i = 0, n = sizeof(meters_)/sizeof(meters_[0]); i < n; ++i ) { - Palette& palette = theme->invertedPalette; - const auto meter = meters_[i]; - if (meter) - meter->setBackColor(palette.knobInactiveTrack); - } - }); - -#if LINUX - if (!isZenityAvailable()) { - CRect bounds = mainView->getViewSize(); - - CViewContainer* box = new CViewContainer(bounds); - mainView->addView(box); - box->setBackgroundColor(kColorTransparentDark); - - CRect textSize = CRect(0, 0, 400, 80).centerInside(bounds); - CMultiLineTextLabel* textLabel = new CMultiLineTextLabel(textSize); - box->addView(textLabel); - textLabel->setTextInset(CPoint(10.0, 10.0)); - textLabel->setStyle(CParamDisplay::kRoundRectStyle); - textLabel->setRoundRectRadius(10.0); - textLabel->setFrameColor(CColor(0xb2, 0xb2, 0xb2)); - textLabel->setBackColor(CColor(0x2e, 0x34, 0x36)); - auto font = makeOwned("Roboto", 16.0); - textLabel->setFont(font); - textLabel->setLineLayout(CMultiLineTextLabel::LineLayout::wrap); - textLabel->setText( - "The required program \"zenity\" is missing.\n" - "Install this software package first, and restart sfizz."); - } -#endif - - mainView_ = owned(mainView); - } - - if (CTextLabel* label = sfizzVersionLabel_) { - std::string version = GitBuildId[0] ? absl::StrCat(SFIZZ_VERSION ".", GitBuildId) : SFIZZ_VERSION; - label->setText(absl::StrCat(u8"sfizz ", version)); - } - - /// - currentThemeName_ = theme->loadCurrentName(); - theme->load(currentThemeName_); - - /// - SAboutDialog* aboutDialog = new SAboutDialog(mainView->getViewSize()); - mainView->addView(aboutDialog); - aboutDialog_ = aboutDialog; - aboutDialog->setVisible(false); - - /// - SharedPointer fileDropTarget = owned(new SFileDropTarget); - - fileDropTarget->setFileDropFunction([this](const std::string& file) { - changeSfzFile(file); - }); - - mainView_->setDropTarget(fileDropTarget); - - /// - adjustMinMaxToEditRange(volumeSlider_, EditId::Volume); - adjustMinMaxToEditRange(numVoicesSlider_, EditId::Polyphony); - adjustMinMaxToEditRange(oversamplingSlider_, EditId::Oversampling); - adjustMinMaxToEditRange(preloadSizeSlider_, EditId::PreloadSize); - if (scalaRootKeySlider_) { - scalaRootKeySlider_->setMin(0.0); - scalaRootKeySlider_->setMax(11.0); - scalaRootKeySlider_->setDefaultValue( - static_cast(EditRange::get(EditId::ScalaRootKey).def) % 12); - } - if (scalaRootOctaveSlider_) { - scalaRootOctaveSlider_->setMin(0.0); - scalaRootOctaveSlider_->setMax(10.0); - scalaRootOctaveSlider_->setDefaultValue( - static_cast(EditRange::get(EditId::ScalaRootKey).def) / 12); - } - adjustMinMaxToEditRange(tuningFrequencyDropdown_, EditId::TuningFrequency); - adjustMinMaxToEditRange(tuningFrequencyEdit_, EditId::TuningFrequency); - tuningFrequencyEdit_->setWheelInc(0.1f / EditRange::get(EditId::TuningFrequency).extent()); - adjustMinMaxToEditRange(stretchedTuningSlider_, EditId::StretchTuning); - adjustMinMaxToEditRange(sampleQualitySlider_, EditId::SampleQuality); - adjustMinMaxToEditRange(oscillatorQualitySlider_, EditId::OscillatorQuality); - adjustMinMaxToEditRange(freewheelingSampleQualitySlider_, EditId::FreewheelingSampleQuality); - adjustMinMaxToEditRange(freewheelingOscillatorQualitySlider_, EditId::FreewheelingOscillatorQuality); - adjustMinMaxToEditRange(sustainCancelsReleaseCheckbox_, EditId::SustainCancelsRelease); - adjustMinMaxToEditRange(zoomMenu_, EditId::UIZoom); - - for (int value : {1, 2, 4, 8, 16, 32, 64, 96, 128, 160, 192, 224, 256}) - numVoicesSlider_->addEntry(std::to_string(value), value); - - for (int log2value = 0; log2value <= 3; ++log2value) { - int value = 1 << log2value; - oversamplingSlider_->addEntry(std::to_string(value) + "x", log2value); - } - - oversamplingSlider_->setValueToStringFunction2( - [](float value, std::string& result, CParamDisplay*) -> bool - { - result = std::to_string(1 << static_cast(value)) + "x"; - return true; - }); - - for (int value : { 100, 125, 150, 175, 200, 225, 250, 275, 300 }) { - zoomMenu_->addEntry(std::to_string(value) + "%", value); - } - - zoomMenu_->setValueToStringFunction2( - [](float value, std::string& result, CParamDisplay*) -> bool - { - result = std::to_string(static_cast(value) * 100) + "%"; - return true; - }); - - for (int log2value = 10; log2value <= 16; ++log2value) { - int value = 1 << log2value; - char text[256]; - sprintf(text, "%lu kB", static_cast(value / 1024 * sizeof(float))); - text[sizeof(text) - 1] = '\0'; - preloadSizeSlider_->addEntry(text, value); - } - preloadSizeSlider_->setValueToStringFunction2( - [](float value, std::string& result, CParamDisplay*) -> bool - { - result = std::to_string(static_cast(std::round(value * (1.0 / 1024 * sizeof(float))))) + " kB"; - return true; - }); - - static const std::pair tuningFrequencies[] = { - {380.0f, "English pitchpipe 380 (1720)"}, - {409.0f, "Handel fork 409 (1780)"}, - {415.0f, "Baroque 415"}, - {422.5f, "Handel fork 422.5 (1740)"}, - {423.2f, "Dresden opera 423.2 (1815)"}, - {435.0f, "French Law 435 (1859)"}, - {439.0f, "British Phil 439 (1896)"}, - {440.0f, "International 440"}, - {442.0f, "European 442"}, - {445.0f, "Germany, China 445"}, - {451.0f, "La Scala in Milan 451 (18th)"}, - }; - - for (std::pair value : tuningFrequencies) - tuningFrequencyDropdown_->addEntry(value.second, value.first); - - tuningFrequencyEdit_->setValueToStringFunction( - [](float value, char result[256], CParamDisplay*) -> bool - { - sprintf(result, "%.1f Hz", value); - return true; - }); - - tuningFrequencyEdit_->setStringToValueFunction([](UTF8StringPtr txt, float& result, CTextEdit*) -> bool { - float value; - if (absl::SimpleAtof(txt, &value)) { - result = value; - return true; - } - - return false; - }); - - static const char* notesInOctave[12] = { - "C", "C#", "D", "D#", "E", - "F", "F#", "G", "G#", "A", "A#", "B", - }; - for (int note = 0; note < 12; ++note) - scalaRootKeySlider_->addEntry(notesInOctave[note], note); - for (int octave = 0; octave <= 10; ++octave) - scalaRootOctaveSlider_->addEntry(std::to_string(octave - 1), octave); - scalaRootKeySlider_->setValueToStringFunction2( - [](float value, std::string& result, CParamDisplay*) -> bool - { - result = notesInOctave[std::max(0, static_cast(value)) % 12]; - return true; - }); - scalaRootOctaveSlider_->setValueToStringFunction2( - [](float value, std::string& result, CParamDisplay*) -> bool - { - result = std::to_string(static_cast(value) - 1); - return true; - }); - - if (SActionMenu* menu = fileOperationsMenu_) { - menu->addEntry("Load file", kTagLoadSfzFile); - menu->addEntry("Edit file", kTagEditSfzFile); - menu->addEntry("Create new file", kTagCreateNewSfzFile); - menu->addEntry("Open SFZ folder", kTagOpenSfzFolder); - } - - static const std::array sampleQualityLabels {{ - "Nearest", "Linear", "Polynomial", - "Sinc 8", "Sinc 12", "Sinc 16", "Sinc 24", - "Sinc 36", "Sinc 48", "Sinc 60", "Sinc 72", - }}; - - auto setupSampleQualityMenu = [&] (SValueMenu* menu) { - if (menu) { - for (size_t i = 0; i < sampleQualityLabels.size(); ++i) - menu->addEntry(sampleQualityLabels[i], float(i)); - menu->setValueToStringFunction2([](float value, std::string& result, CParamDisplay*) -> bool { - int index = int(value); - if (index < 0 || unsigned(index) >= sampleQualityLabels.size()) - return false; - result = sampleQualityLabels[unsigned(index)]; - return true; - }); - } - }; - - setupSampleQualityMenu(sampleQualitySlider_); - setupSampleQualityMenu(freewheelingSampleQualitySlider_); - - static const std::array oscillatorQualityLabels {{ - "Nearest", "Linear", "High", "Dual-High", - }}; - - auto setupOscillatorQualityMenu = [&] (SValueMenu* menu) { - if (menu) { - for (size_t i = 0; i < oscillatorQualityLabels.size(); ++i) - menu->addEntry(oscillatorQualityLabels[i], float(i)); - menu->setValueToStringFunction2([](float value, std::string& result, CParamDisplay*) -> bool { - int index = int(value); - if (index < 0 || unsigned(index) >= oscillatorQualityLabels.size()) - return false; - result = oscillatorQualityLabels[unsigned(index)]; - return true; - }); - } - }; - - setupOscillatorQualityMenu(oscillatorQualitySlider_); - setupOscillatorQualityMenu(freewheelingOscillatorQualitySlider_); - - if (SPiano* piano = piano_) { - piano->onKeyPressed = [this](unsigned key, float vel) { - uint8_t msg[3]; - msg[0] = 0x90; - msg[1] = static_cast(key); - msg[2] = static_cast(std::max(1, static_cast(vel * 127))); - ctrl_->uiSendMIDI(msg, sizeof(msg)); - }; - piano->onKeyReleased = [this](unsigned key, float vel) { - uint8_t msg[3]; - msg[0] = 0x80; - msg[1] = static_cast(key); - msg[2] = static_cast(vel * 127); - ctrl_->uiSendMIDI(msg, sizeof(msg)); - }; - } - - if (SControlsPanel* panel = controlsPanel_) { - panel->ValueChangeFunction = [this](uint32_t cc, float value) { - performCCValueChange(cc, value); - updateCCValue(cc, value); - }; - panel->BeginEditFunction = [this](uint32_t cc) { - performCCBeginEdit(cc); - }; - panel->EndEditFunction = [this](uint32_t cc) { - performCCEndEdit(cc); - }; - } - - if (SKnobCCBox* box = volumeCCKnob_) { - unsigned ccNumber = 7; - box->setCCLabelText(("CC " + std::to_string(ccNumber)).c_str()); - } - if (SKnobCCBox* box = panCCKnob_) { - unsigned ccNumber = 10; - box->setCCLabelText(("CC " + std::to_string(ccNumber)).c_str()); - } - - updateKeyswitchNameLabel(); - - /// - CViewContainer* panel; - activePanel_ = 0; - - // all panels - for (unsigned currentPanel = 0; currentPanel < kNumPanels; ++currentPanel) { - panel = subPanels_[currentPanel]; - - if (!panel) - continue; - - panel->setVisible(currentPanel == activePanel_); - } - - setupCurrentPanel(); - - if (COptionMenu* menu = themeMenu_) { - const std::vector& names = Theme::getAvailableNames(); - size_t index = ~size_t(0); - for (size_t i = 0, n = names.size(); i < n; ++i) { - const std::string& name = names[i]; - menu->addEntry(UTF8String(name)); - if (name == currentThemeName_) - index = i; - } - if (index != ~size_t(0)) - menu->setCurrent(index); - } -} - -void Editor::Impl::chooseSfzFile() -{ - SharedPointer fs = owned(CNewFileSelector::create(frame_)); - - fs->setTitle("Load SFZ file"); - fs->addFileExtension(CFileExtension("SFZ", "sfz")); - - // also add extensions of importable files - fs->addFileExtension(CFileExtension("WAV", "wav")); - fs->addFileExtension(CFileExtension("FLAC", "flac")); - fs->addFileExtension(CFileExtension("OGG", "ogg")); - fs->addFileExtension(CFileExtension("MP3", "mp3")); - fs->addFileExtension(CFileExtension("AIF", "aif")); - fs->addFileExtension(CFileExtension("AIFF", "aiff")); - fs->addFileExtension(CFileExtension("AIFC", "aifc")); - // Decent samples - fs->addFileExtension(CFileExtension("DSPRESET", "dspreset")); - - std::string initialDir = getFileChooserInitialDir(currentSfzFile_); - if (!initialDir.empty()) - fs->setInitialDirectory(initialDir.c_str()); - - frameDisabler_->disable(); - bool runOk = fs->runModal(); - frameDisabler_->enable(); - - if (runOk) { - UTF8StringPtr file = fs->getSelectedFile(0); - if (file) - changeSfzFile(file); - } -} - -/// -static const char defaultSfzText[] = - "sample=*sine" "\n" - "ampeg_attack=0.02 ampeg_release=0.1" "\n"; - -static void createDefaultSfzFileIfNotExisting(const fs::path& path) -{ - if (!fs::exists(path)) - fs::ofstream { path } << defaultSfzText; -} - -/// -void Editor::Impl::createNewSfzFile() -{ - SharedPointer fs = owned(CNewFileSelector::create(frame_, CNewFileSelector::kSelectSaveFile)); - - fs->setTitle("Create SFZ file"); - fs->addFileExtension(CFileExtension("SFZ", "sfz")); - - std::string initialDir = getFileChooserInitialDir(currentSfzFile_); - if (!initialDir.empty()) - fs->setInitialDirectory(initialDir.c_str()); - - frameDisabler_->disable(); - bool runOk = fs->runModal(); - frameDisabler_->enable(); - - if (runOk) { - UTF8StringPtr file = fs->getSelectedFile(0); - std::string fileStr; - if (file && !absl::EndsWithIgnoreCase(file, ".sfz")) { - fileStr = std::string(file) + ".sfz"; - file = fileStr.c_str(); - } - if (file) { - createDefaultSfzFileIfNotExisting(fs::u8path(file)); - changeSfzFile(file); - openFileInExternalEditor(file); - } - } -} - -void Editor::Impl::changeSfzFile(const std::string& filePath) -{ - ctrl_->uiSendValue(EditId::SfzFile, filePath); - currentSfzFile_ = filePath; - updateSfzFileLabel(filePath); -} - -void Editor::Impl::changeToNextSfzFile(long offset) -{ - if (currentSfzFile_.empty()) - return; - - const fs::path filePath = fs::u8path(currentSfzFile_); - const fs::path dirPath = filePath.parent_path(); - - // extract file names of regular files from the sfz directory - std::vector fileNames; - fileNames.reserve(64); - - auto fileFilter = [](const fs::path &name) -> bool { - std::string ext = name.extension().u8string(); - absl::AsciiStrToLower(&ext); - return ext == ".sfz"; - }; - - if (!scanDirectoryFiles(dirPath, fileFilter, fileNames)) - return; - - // sort file names - const size_t size = fileNames.size(); - if (size == 0) - return; - - std::sort(fileNames.begin(), fileNames.end()); - - // find our current position in the file name list - size_t currentIndex = 0; - const fs::path currentFileName = filePath.filename(); - - while (currentIndex + 1 < size && fileNames[currentIndex] < currentFileName) - ++currentIndex; - - // advance to the next or previous item - typedef typename std::make_signed::type signed_size_t; - - size_t newIndex = static_cast(currentIndex) + offset; - if (static_cast(newIndex) < 0) - newIndex = static_cast(newIndex) % - static_cast(size) + size; - newIndex %= size; - - if (newIndex != currentIndex) { - const fs::path newFilePath = dirPath / fileNames[newIndex]; - changeSfzFile(newFilePath.u8string()); - } -} - -void Editor::Impl::chooseScalaFile() -{ - SharedPointer fs = owned(CNewFileSelector::create(frame_)); - - fs->setTitle("Load Scala file"); - fs->addFileExtension(CFileExtension("SCL", "scl")); - - std::string initialDir = getFileChooserInitialDir(currentScalaFile_); - if (!initialDir.empty()) - fs->setInitialDirectory(initialDir.c_str()); - - frameDisabler_->disable(); - bool runOk = fs->runModal(); - frameDisabler_->enable(); - - if (runOk) { - UTF8StringPtr file = fs->getSelectedFile(0); - if (file) - changeScalaFile(file); - } -} - -void Editor::Impl::changeScalaFile(const std::string& filePath) -{ - ctrl_->uiSendValue(EditId::ScalaFile, filePath); - currentScalaFile_ = filePath; - updateScalaFileLabel(filePath); -} - -void Editor::Impl::chooseUserFilesDir() -{ - SharedPointer fs = owned( - CNewFileSelector::create(frame_, CNewFileSelector::kSelectDirectory)); - - fs->setTitle("Set user files directory"); - - frameDisabler_->disable(); - bool runOk = fs->runModal(); - frameDisabler_->enable(); - - if (runOk) { - UTF8StringPtr dir = fs->getSelectedFile(0); - if (dir) { - userFilesDir_ = std::string(dir); - updateUserFilesDirLabel(userFilesDir_); - ctrl_->uiSendValue(EditId::UserFilesDir, userFilesDir_); - } - } -} - -std::string Editor::Impl::getFileChooserInitialDir(const std::string& previousFilePath) const -{ - fs::path initialPath; - - if (!previousFilePath.empty()) - initialPath = fs::u8path(previousFilePath).parent_path(); - else if (!userFilesDir_.empty()) - initialPath = fs::u8path(userFilesDir_); - else if (!fallbackFilesDir_.empty()) - initialPath = fs::u8path(fallbackFilesDir_); - - std::string initialDir = initialPath.u8string(); - if (!initialDir.empty()) - initialDir.push_back('/'); - - return initialDir; -} - -bool Editor::Impl::scanDirectoryFiles(const fs::path& dirPath, std::function filter, std::vector& fileNames) -{ - std::error_code ec; - fs::directory_iterator it { dirPath, ec }; - - if (ec) - return false; - - fileNames.clear(); - - while (!ec && it != fs::directory_iterator()) { - const fs::directory_entry& ent = *it; - - std::error_code fileEc; - const fs::file_status status = ent.status(fileEc); - if (fileEc) - continue; - - if (status.type() == fs::file_type::regular) { - fs::path fileName = ent.path().filename(); - if (!filter || filter(fileName)) - fileNames.push_back(std::move(fileName)); - } - - it.increment(ec); - } - - if (ec) - return false; - - return true; -} - -absl::string_view Editor::Impl::simplifiedFileName(absl::string_view path, absl::string_view removedSuffix, absl::string_view ifEmpty) -{ - if (path.empty()) - return ifEmpty; - -#if defined (_WIN32) - size_t pos = path.find_last_of("/\\"); -#else - size_t pos = path.rfind('/'); -#endif - path = (pos != path.npos) ? path.substr(pos + 1) : path; - - if (!removedSuffix.empty() && absl::EndsWithIgnoreCase(path, removedSuffix)) - path.remove_suffix(removedSuffix.size()); - - return path; -} - -void Editor::Impl::updateSfzFileLabel(const std::string& filePath) -{ - updateButtonWithFileName(sfzFileLabel_, filePath, ".sfz"); -} - -void Editor::Impl::updateScalaFileLabel(const std::string& filePath) -{ - updateLabelWithFileName(scalaFileLabel_, filePath, ".scl"); - updateButtonWithFileName(scalaFileButton_, filePath, ".scl"); -} - -void Editor::Impl::updateUserFilesDirLabel(const std::string& filePath) -{ - updateButtonWithFileName(userFilesDirButton_, filePath, {}); -} - -void Editor::Impl::updateLabelWithFileName(CTextLabel* label, const std::string& filePath, absl::string_view removedSuffix) -{ - if (!label) - return; - - std::string fileName = std::string(simplifiedFileName(filePath, removedSuffix, "")); - label->setText(fileName.c_str()); -} - -void Editor::Impl::updateButtonWithFileName(STextButton* button, const std::string& filePath, absl::string_view removedSuffix) -{ - if (!button) - return; - - std::string fileName = std::string(simplifiedFileName(filePath, removedSuffix, {})); - if (!fileName.empty()) { - button->setTitle(fileName.c_str()); - button->setInactive(false); - } - else { - button->setTitle("No file"); - button->setInactive(true); - } -} - -void Editor::Impl::updateVolumeLabel(float volume) -{ - CTextLabel* label = volumeLabel_; - if (!label) - return; - - char text[64]; - sprintf(text, "%.1f dB", volume); - text[sizeof(text) - 1] = '\0'; - label->setText(text); -} - -void Editor::Impl::updateNumVoicesLabel(int numVoices) -{ - CTextLabel* label = numVoicesLabel_; - if (!label) - return; - - char text[64]; - sprintf(text, "%d", numVoices); - text[sizeof(text) - 1] = '\0'; - label->setText(text); -} - -void Editor::Impl::updateOversamplingLabel(int oversamplingLog2) -{ - CTextLabel* label = oversamplingLabel_; - if (!label) - return; - - char text[64]; - sprintf(text, "%dx", 1 << oversamplingLog2); - text[sizeof(text) - 1] = '\0'; - label->setText(text); -} - -void Editor::Impl::updatePreloadSizeLabel(int preloadSize) -{ - CTextLabel* label = preloadSizeLabel_; - if (!label) - return; - - char text[64]; - sprintf(text, "%d kB", static_cast(std::round(preloadSize * (1.0 / 1024)))); - text[sizeof(text) - 1] = '\0'; - label->setText(text); -} - -void Editor::Impl::updateScalaRootKeyLabel(int rootKey) -{ - CTextLabel* label = scalaRootKeyLabel_; - if (!label) - return; - - static const char *octNoteNames[12] = { - "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", - }; - - auto noteName = [](int key) -> std::string - { - int octNum; - int octNoteNum; - if (key >= 0) { - octNum = key / 12 - 1; - octNoteNum = key % 12; - } - else { - octNum = -2 - (key + 1) / -12; - octNoteNum = (key % 12 + 12) % 12; - } - return std::string(octNoteNames[octNoteNum]) + std::to_string(octNum); - }; - - label->setText(noteName(rootKey)); -} - -void Editor::Impl::updateStretchedTuningLabel(float stretchedTuning) -{ - CTextLabel* label = stretchedTuningLabel_; - if (!label) - return; - - char text[64]; - sprintf(text, "%.3f", stretchedTuning); - text[sizeof(text) - 1] = '\0'; - label->setText(text); -} - -void Editor::Impl::buttonHoverEnter(CControl* btn, const char* text) -{ - lblHover_->setText(text); - lblHover_->sizeToFit(); - CRect rect = lblHover_->getViewSize(); - CRect btnRect = btn->getViewSize(); - auto height = rect.getHeight(); - auto width = rect.getWidth(); - rect.left = btnRect.left; - rect.top = btnRect.bottom + 2; - rect.setWidth(width + 10); - rect.setHeight(height); - lblHover_->setViewSize(rect); - lblHover_->setVisible(true); - lblHover_->invalid(); -} - -void Editor::Impl::buttonHoverLeave(CControl* btn) -{ - (void)btn; - lblHover_->setVisible(false); - lblHover_->invalid(); -} - -absl::string_view Editor::Impl::getCurrentKeyswitchName() const -{ - int sw = currentKeyswitch_; - if (sw == -1) - return {}; - - auto it = keyswitchNames_.find(static_cast(sw)); - if (it == keyswitchNames_.end()) - return {}; - - return it->second; -} - -void Editor::Impl::updateKeyswitchNameLabel() -{ - CTextLabel* label = keyswitchLabel_; - CTextLabel* badge = keyswitchBadge_; - CTextLabel* inactiveLabel = keyswitchInactiveLabel_; - - int sw = currentKeyswitch_; - const std::string name { getCurrentKeyswitchName() }; - - if (sw == -1) { - if (badge) - badge->setVisible(false); - if (label) - label->setVisible(false); - if (inactiveLabel) - inactiveLabel->setVisible(true); - } - else { - if (badge) { - badge->setText(getUnicodeNoteName(sw)); - badge->setVisible(true); - } - if (label) { - label->setText(name.c_str()); - label->setVisible(true); - } - if (inactiveLabel) - inactiveLabel->setVisible(false); - } -} - -void Editor::Impl::updateKeyUsed(unsigned key, bool used) -{ - if (SPiano* piano = piano_) - piano->setKeyUsed(key, used); -} - -void Editor::Impl::updateKeyLabel(unsigned key, const char* label) -{ - // TODO nothing done with this info currently - (void)key; - (void)label; -} - -void Editor::Impl::updateKeyswitchUsed(unsigned key, bool used) -{ - if (SPiano* piano = piano_) - piano->setKeyswitchUsed(key, used); -} - -void Editor::Impl::updateCCUsed(unsigned cc, bool used) -{ - if (SControlsPanel* panel = controlsPanel_) - panel->setControlUsed(cc, used); -} - -void Editor::Impl::updateCCValue(unsigned cc, float value) -{ - if (SControlsPanel* panel = controlsPanel_) - panel->setControlValue(cc, value); - - if (SKnobCCBox* other = getSecondaryCCKnob(cc)) { - other->setValue(value); - other->invalid(); - } -} - -void Editor::Impl::updateCCDefaultValue(unsigned cc, float value) -{ - if (SControlsPanel* panel = controlsPanel_) - panel->setControlDefaultValue(cc, value); - - if (SKnobCCBox* other = getSecondaryCCKnob(cc)) - other->setDefaultValue(value); -} - -void Editor::Impl::updateCCLabel(unsigned cc, const char* label) -{ - if (SControlsPanel* panel = controlsPanel_) - panel->setControlLabelText(cc, label); -} - -void Editor::Impl::updateSWLastCurrent(int sw) -{ - if (currentKeyswitch_ == sw) - return; - currentKeyswitch_ = sw; - updateKeyswitchNameLabel(); -} - -void Editor::Impl::updateSWLastLabel(unsigned sw, const char* label) -{ - keyswitchNames_[sw].assign(label); - if ((unsigned)currentKeyswitch_ == sw) - updateKeyswitchNameLabel(); -} - -void Editor::Impl::updateBackgroundImage(const char* filepath) -{ - backgroundBitmap_ = loadAnyFormatImage(filepath); - - if (!backgroundBitmap_) - backgroundBitmap_ = defaultBackgroundBitmap_; - - applyBackgroundForCurrentPanel(); -} - -void Editor::Impl::updateControlsImage(const char* filepath) -{ - controlsBitmap_ = loadAnyFormatImage(filepath); - - if (!controlsBitmap_) { - return; - } - - applyBackgroundForCurrentPanel(); -} - -void Editor::Impl::setupCurrentPanel() -{ - for (unsigned i = 0; i < kNumPanels; ++i) { - if (STextButton* button = panelButtons_[i]) - button->setHighlighted(i == activePanel_); - } - - applyBackgroundForCurrentPanel(); -} - -void Editor::Impl::applyBackgroundForCurrentPanel() -{ - CBitmap* bitmap; - imageContainer_->setBackgroundColor(theme_->frameBackground); - - if (activePanel_ == kPanelGeneral || activePanel_ == kPanelInfo) { - bitmap = backgroundBitmap_; - } else if (activePanel_ == kPanelControls) { - bitmap = controlsBitmap_; - if (!controlsBitmap_) { - imageContainer_->setBackground(nullptr); - return; - } - } else { - return; - } - - downscaleToWidthAndHeight(bitmap, imageContainer_->getViewSize().getSize()); - - // Centered image - CCoord xoffset = - (imageContainer_->getViewSize().getWidth() - bitmap->getWidth()) / 2; - - imageContainer_->setBackgroundOffset(CPoint(-xoffset, 0)); - imageContainer_->setBackground(bitmap); -} - -void Editor::Impl::updateMemoryUsed(uint64_t mem) -{ - if (CTextLabel* label = memoryLabel_) { - double value = mem / 1e3; - const char* unit = "kB"; - int precision = 0; - if (value >= 1e3) { - value /= 1e3; - unit = "MB"; - } - if (value >= 1e3) { - value /= 1e3; - unit = "GB"; - precision = 1; - } - char textbuf[128]; - snprintf(textbuf, sizeof(textbuf), "%.*f %s", precision, value, unit); - label->setText(textbuf); - } -} - -void Editor::Impl::performCCValueChange(unsigned cc, float value) -{ - EditorController& ctrl = *ctrl_; - ctrl.uiSendValue(editIdForCC(int(cc)), value); -} - -void Editor::Impl::performCCBeginEdit(unsigned cc) -{ - // TODO(jpc) CC as parameters and automation - (void)cc; -} - -void Editor::Impl::performCCEndEdit(unsigned cc) -{ - // TODO(jpc) CC as parameters and automation - (void)cc; -} - -void Editor::Impl::setActivePanel(unsigned panelId) -{ - panelId = std::max(0, std::min(kNumPanels - 1, static_cast(panelId))); - - if (activePanel_ != panelId) { - if (subPanels_[activePanel_]) - subPanels_[activePanel_]->setVisible(false); - if (subPanels_[panelId]) - subPanels_[panelId]->setVisible(true); - activePanel_ = panelId; - setupCurrentPanel(); - } -} - -void Editor::Impl::setZoom(int zoom) -{ - if (!zoomMenu_) - return; - - float zoomFactor = static_cast(zoom) / 100; - - std::vector values = - { 100, 125, 150, 175, 200, 225, 250, 275, 300 }; - - size_t pos = std::distance(values.cbegin(), - find(values.cbegin(), values.cend(), zoom)); - - if (pos < values.size()) { - zoom_ = zoomFactor; - zoomMenu_->setCurrent(pos); - frame_->setZoom(zoom_); - } else { - zoom_ = 1.0f; - zoomMenu_->setCurrent(0); - } -} - -void Editor::Impl::formatLabel(CTextLabel* label, const char* fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - vformatLabel(label, fmt, ap); - va_end(ap); -} - -void Editor::Impl::vformatLabel(CTextLabel* label, const char* fmt, va_list ap) -{ - char text[256]; - vsprintf(text, fmt, ap); - text[sizeof(text) - 1] = '\0'; - label->setText(text); -} - -void Editor::Impl::valueChanged(CControl* ctl) -{ - int32_t tag = ctl->getTag(); - float value = ctl->getValue(); - EditorController& ctrl = *ctrl_; - - switch (tag) { - case kTagLoadSfzFile: - if (value != 1) - break; - - Call::later([this]() { chooseSfzFile(); }); - break; - - case kTagEditSfzFile: - if (value != 1) - break; - - if (!currentSfzFile_.empty()) - openFileInExternalEditor(currentSfzFile_.c_str()); - break; - - case kTagCreateNewSfzFile: - if (value != 1) - break; - - Call::later([this]() { createNewSfzFile(); }); - break; - - case kTagOpenSfzFolder: - if (value != 1) - break; - - if (!userFilesDir_.empty()) - openDirectoryInExplorer(userFilesDir_.c_str()); - else if (!fallbackFilesDir_.empty()) - openDirectoryInExplorer(fallbackFilesDir_.c_str()); - break; - - case kTagPreviousSfzFile: - if (value != 1) - break; - - Call::later([this]() { changeToNextSfzFile(-1); }); - break; - - case kTagNextSfzFile: - if (value != 1) - break; - - Call::later([this]() { changeToNextSfzFile(+1); }); - break; - - case kTagLoadScalaFile: - if (value != 1) - break; - - Call::later([this]() { chooseScalaFile(); }); - break; - - case kTagResetScalaFile: - if (value != 1) - break; - - changeScalaFile(std::string()); - break; - - case kTagSetMainVolume: - ctrl.uiSendValue(EditId::Volume, value); - updateVolumeLabel(value); - break; - - case kTagSetCCVolume: - performCCValueChange(7, value); - updateCCValue(7, value); - break; - - case kTagSetCCPan: - performCCValueChange(10, value); - updateCCValue(10, value); - break; - - case kTagSetNumVoices: - ctrl.uiSendValue(EditId::Polyphony, value); - updateNumVoicesLabel(static_cast(value)); - break; - - case kTagSetOversampling: - ctrl.uiSendValue(EditId::Oversampling, static_cast(1 << static_cast(value))); - updateOversamplingLabel(static_cast(value)); - break; - - case kTagSetPreloadSize: - ctrl.uiSendValue(EditId::PreloadSize, value); - updatePreloadSizeLabel(static_cast(value)); - break; - - case kTagSetScalaRootKey: - { - if (scalaRootKeySlider_ && scalaRootOctaveSlider_) { - int key = static_cast(scalaRootKeySlider_->getValue()); - int octave = static_cast(scalaRootOctaveSlider_->getValue()); - int midiKey = key + 12 * octave; - ctrl.uiSendValue(EditId::ScalaRootKey, midiKey); - updateScalaRootKeyLabel(midiKey); - } - } - break; - - case kTagSetTuningFrequency: - ctrl.uiSendValue(EditId::TuningFrequency, value); - if (tuningFrequencyEdit_) - tuningFrequencyEdit_->setValue(value); - break; - - case kTagSetSampleQuality: - ctrl.uiSendValue(EditId::SampleQuality, value); - break; - - case kTagSetOscillatorQuality: - ctrl.uiSendValue(EditId::OscillatorQuality, value); - break; - - case kTagSetFreewheelingSampleQuality: - ctrl.uiSendValue(EditId::FreewheelingSampleQuality, value); - break; - - case kTagSetFreewheelingOscillatorQuality: - ctrl.uiSendValue(EditId::FreewheelingOscillatorQuality, value); - break; - - case kTagSetSustainCancelsRelease: - ctrl.uiSendValue(EditId::SustainCancelsRelease, value); - break; - - case kTagSetStretchedTuning: - ctrl.uiSendValue(EditId::StretchTuning, value); - updateStretchedTuningLabel(value); - break; - - case kTagChooseUserFilesDir: - if (value != 1) - break; - - Call::later([this]() { chooseUserFilesDir(); }); - break; - - case kTagAbout: - if (value != 1) - break; - - Call::later([this]() { - aboutDialog_->setVisible(true); - frame_->registerKeyboardHook(aboutDialog_); - }); - break; - - case kTagThemeMenu: - { - currentThemeName_ = Theme::getAvailableNames()[int(value)]; - Theme::storeCurrentName(currentThemeName_); - theme_->load(currentThemeName_); - } - break; - - case kTagZoomMenu: { - std::vector values = - { 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0 }; - - auto zoom = values.at(value); - zoom_ = zoom; -#if 0 - fprintf(stderr, "[sfizz] valueChanged: %f\n", zoom_); - // TODO: Recreate frame with the new size - frame_->setZoom(zoom_); -#endif - } break; - - case kTagSetDefaultZoom: { - SfizzSettings settings; - char zoom[64]; - sprintf(zoom, "%i", static_cast(zoom_ * 100)); - zoom[sizeof(zoom) - 1] = '\0'; - settings.store("default_zoom", zoom); - } break; - default: - if (tag >= kTagFirstChangePanel && tag <= kTagLastChangePanel) { - int panelId = tag - kTagFirstChangePanel; - ctrl.uiSendValue(EditId::UIActivePanel, static_cast(panelId)); - setActivePanel(panelId); - } - break; - } -} - -void Editor::Impl::enterOrLeaveEdit(CControl* ctl, bool enter) -{ - int32_t tag = ctl->getTag(); - EditId id; - - switch (tag) { - case kTagSetMainVolume: id = EditId::Volume; break; - case kTagSetNumVoices: id = EditId::Polyphony; break; - case kTagSetOversampling: id = EditId::Oversampling; break; - case kTagSetPreloadSize: id = EditId::PreloadSize; break; - case kTagSetScalaRootKey: id = EditId::ScalaRootKey; break; - case kTagSetTuningFrequency: id = EditId::TuningFrequency; break; - case kTagSetStretchedTuning: id = EditId::StretchTuning; break; - case kTagSetCCVolume: id = editIdForCC(7); break; - case kTagSetCCPan: id = editIdForCC(10); break; - default: return; - } - - EditorController& ctrl = *ctrl_; - if (enter) - ctrl.uiBeginSend(id); - else - ctrl.uiEndSend(id); -} - -void Editor::Impl::controlBeginEdit(CControl* ctl) -{ - enterOrLeaveEdit(ctl, true); -} - -void Editor::Impl::controlEndEdit(CControl* ctl) -{ - enterOrLeaveEdit(ctl, false); -} - -void Editor::Impl::onThemeChanged() -{ - for (std::function &function : OnThemeChanged) { - if (function) - function(); - } - if (CFrame* frame = frame_) - frame->invalid(); -} diff --git a/plugins/editor/src/editor/Editor.h b/plugins/editor/src/editor/Editor.h deleted file mode 100644 index dd3aebae0..000000000 --- a/plugins/editor/src/editor/Editor.h +++ /dev/null @@ -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 -#include -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_; -}; diff --git a/plugins/editor/src/editor/EditorController.h b/plugins/editor/src/editor/EditorController.h deleted file mode 100644 index bbe801157..000000000 --- a/plugins/editor/src/editor/EditorController.h +++ /dev/null @@ -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 -#include -#include -#include -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); -} diff --git a/plugins/editor/src/editor/EditorLibs.cpp b/plugins/editor/src/editor/EditorLibs.cpp deleted file mode 100644 index af8e9d173..000000000 --- a/plugins/editor/src/editor/EditorLibs.cpp +++ /dev/null @@ -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" diff --git a/plugins/editor/src/editor/EditorLibs.h b/plugins/editor/src/editor/EditorLibs.h deleted file mode 100644 index ecd11f18d..000000000 --- a/plugins/editor/src/editor/EditorLibs.h +++ /dev/null @@ -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 diff --git a/plugins/editor/src/editor/GUIComponents.cpp b/plugins/editor/src/editor/GUIComponents.cpp deleted file mode 100644 index 6b2a6dde0..000000000 --- a/plugins/editor/src/editor/GUIComponents.cpp +++ /dev/null @@ -1,1350 +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 "GUIComponents.h" -#include "ColorHelpers.h" -#include -#include - -#include "utility/vstgui_before.h" -#include "vstgui/lib/cdrawcontext.h" -#include "vstgui/lib/cgraphicspath.h" -#include "vstgui/lib/cvstguitimer.h" -#include "vstgui/lib/cframe.h" -#include "utility/vstgui_after.h" -#include "absl/strings/numbers.h" - -using namespace gui; - -/// -SBoxContainer::SBoxContainer(const CRect& size) - : CViewContainer(size) -{ - CViewContainer::setBackgroundColor(kColorTransparent); -} - -void SBoxContainer::setCornerRadius(CCoord radius) -{ - cornerRadius_ = radius; - invalid(); -} - -void SBoxContainer::setBackgroundColor(const CColor& color) -{ - backgroundColor_ = color; - invalid(); -} - -CColor SBoxContainer::getBackgroundColor() const -{ - return backgroundColor_; -} - -void SBoxContainer::drawRect(CDrawContext* dc, const CRect& updateRect) -{ - CRect bounds = getViewSize(); - - dc->setDrawMode(kAntiAliasing); - - SharedPointer path = owned(dc->createGraphicsPath()); - path->addRoundRect(bounds, cornerRadius_); - - dc->setFillColor(backgroundColor_); - dc->drawGraphicsPath(path.get(), CDrawContext::kPathFilled); - - CViewContainer::drawRect(dc, updateRect); -} - -/// -STitleContainer::STitleContainer(const CRect& size, UTF8StringPtr text) - : SBoxContainer(size), text_(text ? text : ""), titleFont_(kNormalFont) -{ -} - -void STitleContainer::setTitleFont(CFontRef font) -{ - titleFont_ = font; - invalid(); -} - -void STitleContainer::setTitleFontColor(CColor color) -{ - titleFontColor_ = color; - invalid(); -} - -void STitleContainer::setTitleBackgroundColor(CColor color) -{ - titleBackgroundColor_ = color; - invalid(); -} - -void STitleContainer::drawRect(CDrawContext* dc, const CRect& updateRect) -{ - SBoxContainer::drawRect(dc, updateRect); - - CRect bounds = getViewSize(); - CCoord cornerRadius = cornerRadius_; - - dc->setDrawMode(kAntiAliasing); - - CCoord fontHeight = titleFont_->getSize(); - CCoord titleHeight = fontHeight + 8.0; - - CRect titleBounds = bounds; - titleBounds.bottom = titleBounds.top + titleHeight; - - SharedPointer path = owned(dc->createGraphicsPath()); - path->beginSubpath(titleBounds.getBottomRight()); - path->addLine(titleBounds.getBottomLeft()); - path->addArc(CRect(titleBounds.left, titleBounds.top, titleBounds.left + 2.0 * cornerRadius, titleBounds.top + 2.0 * cornerRadius), 180., 270., true); - path->addArc(CRect(titleBounds.right - 2.0 * cornerRadius, titleBounds.top, titleBounds.right, titleBounds.top + 2.0 * cornerRadius), 270., 360., true); - path->closeSubpath(); - - dc->setFillColor(titleBackgroundColor_); - dc->drawGraphicsPath(path, CDrawContext::kPathFilled); - - dc->setFont(titleFont_); - dc->setFontColor(titleFontColor_); - dc->drawString(text_.c_str(), titleBounds, kCenterText); -} - -/// -void SFileDropTarget::setFileDropFunction(FileDropFunction f) -{ - dropFunction_ = std::move(f); -} - -DragOperation SFileDropTarget::onDragEnter(DragEventData data) -{ - op_ = isFileDrop(data.drag) ? - DragOperation::Copy : DragOperation::None; - return op_; -} - -DragOperation SFileDropTarget::onDragMove(DragEventData data) -{ - (void)data; - return op_; -} - -void SFileDropTarget::onDragLeave(DragEventData data) -{ - (void)data; - op_ = DragOperation::None; -} - -bool SFileDropTarget::onDrop(DragEventData data) -{ - if (op_ != DragOperation::Copy || !isFileDrop(data.drag)) - return false; - - IDataPackage::Type type; - const void* bytes; - uint32_t size = data.drag->getData(0, bytes, type); - std::string path(reinterpret_cast(bytes), size); - - if (dropFunction_) - dropFunction_(path); - - return true; -} - -bool SFileDropTarget::isFileDrop(IDataPackage* package) -{ - return package->getCount() == 1 && - package->getDataType(0) == IDataPackage::kFilePath; -} - -/// -SValueMenu::SValueMenu(const CRect& bounds, IControlListener* listener, int32_t tag) - : CParamDisplay(bounds), menuListener_(owned(new MenuListener(*this))) -{ - setListener(listener); - setTag(tag); - setWheelInc(0.0f); -} - -void SValueMenu::setHoverColor(const CColor& color) -{ - hoverColor_ = color; - invalid(); -} - -CMenuItem* SValueMenu::addEntry(CMenuItem* item, float value, int32_t index) -{ - if (index < 0 || index > getNbEntries()) { - menuItems_.emplace_back(owned(item)); - menuItemValues_.emplace_back(value); - } - else - { - menuItems_.insert(menuItems_.begin() + index, owned(item)); - menuItemValues_.insert(menuItemValues_.begin() + index, value); - } - return item; -} - -CMenuItem* SValueMenu::addEntry(const UTF8String& title, float value, int32_t index, int32_t itemFlags) -{ - if (title == "-") - return addSeparator(index); - CMenuItem* item = new CMenuItem(title, nullptr, 0, nullptr, itemFlags); - return addEntry(item, value, index); -} - -CMenuItem* SValueMenu::addSeparator(int32_t index) -{ - CMenuItem* item = new CMenuItem("", nullptr, 0, nullptr, CMenuItem::kSeparator); - return addEntry(item, 0.0f, index); -} - -int32_t SValueMenu::getNbEntries() const -{ - return static_cast(menuItems_.size()); -} - -void SValueMenu::draw(CDrawContext* dc) -{ - CColor backupColor = fontColor; - if (hovered_) - fontColor = hoverColor_; - CParamDisplay::draw(dc); - if (hovered_) - fontColor = backupColor; -} - -CMouseEventResult SValueMenu::onMouseEntered(CPoint& where, const CButtonState& buttons) -{ - hovered_ = true; - invalid(); - return CParamDisplay::onMouseEntered(where, buttons); -} - -CMouseEventResult SValueMenu::onMouseExited(CPoint& where, const CButtonState& buttons) -{ - hovered_ = false; - invalid(); - return CParamDisplay::onMouseExited(where, buttons); -} - -CMouseEventResult SValueMenu::onMouseDown(CPoint& where, const CButtonState& buttons) -{ - (void)where; - - if (buttons & (kLButton|kRButton|kApple)) { - CFrame* frame = getFrame(); - CRect bounds = getViewSize(); - - CPoint frameWhere = bounds.getBottomLeft(); - this->localToFrame(frameWhere); - - auto self = shared(this); - frame->doAfterEventProcessing([self, frameWhere]() { - if (CFrame* frame = self->getFrame()) { - SharedPointer menu = owned(new COptionMenu(CRect(), self->menuListener_, -1, nullptr, nullptr, COptionMenu::kPopupStyle)); - for (const SharedPointer& item : self->menuItems_) { - menu->addEntry(item); - item->remember(); // above call does not increment refcount - } - menu->setFont(self->getFont()); - menu->setFontColor(self->getFontColor()); - menu->setBackColor(self->getBackColor()); - menu->popup(frame, frameWhere + CPoint(0.0, 1.0)); - } - }); - return kMouseDownEventHandledButDontNeedMovedOrUpEvents; - } - - return kMouseEventNotHandled; -} - -bool SValueMenu::onWheel(const CPoint& where, const CMouseWheelAxis& axis, const float& distance, const CButtonState& buttons) -{ - (void)where; - (void)buttons; - - if (axis != kMouseWheelAxisY) - return false; - - float wheelInc = getWheelInc(); - if (wheelInc != 0) { - float oldValue = getValue(); - setValueNormalized(getValueNormalized() + distance * wheelInc); - if (getValue() != oldValue) { - valueChanged(); - invalid(); - } - } - return true; -} - -void SValueMenu::onItemClicked(int32_t index) -{ - float oldValue = getValue(); - setValue(menuItemValues_[index]); - if (getValue() != oldValue) { - valueChanged(); - invalid(); - } -} - -/// -SActionMenu::SActionMenu(const CRect& bounds, IControlListener* listener) - : CParamDisplay(bounds), menuListener_(owned(new MenuListener(*this))) -{ - setListener(listener); - - auto toString = [](float, std::string& result, CParamDisplay* display) { - result = static_cast(display)->getTitle(); - return true; - }; - - setValueToStringFunction2(toString); -} - -void SActionMenu::setTitle(std::string title) -{ - title_ = std::move(title); - invalid(); -} - -void SActionMenu::setHoverColor(const CColor& color) -{ - hoverColor_ = color; - invalid(); -} - -CMenuItem* SActionMenu::addEntry(CMenuItem* item, int32_t tag, int32_t index) -{ - if (index < 0 || index > getNbEntries()) { - menuItems_.emplace_back(owned(item)); - menuItemTags_.emplace_back(tag); - } - else - { - menuItems_.insert(menuItems_.begin() + index, owned(item)); - menuItemTags_.insert(menuItemTags_.begin() + index, tag); - } - return item; -} - -CMenuItem* SActionMenu::addEntry(const UTF8String& title, int32_t tag, int32_t index, int32_t itemFlags) -{ - if (title == "-") - return addSeparator(index); - CMenuItem* item = new CMenuItem(title, nullptr, 0, nullptr, itemFlags); - return addEntry(item, tag, index); -} - -CMenuItem* SActionMenu::addSeparator(int32_t index) -{ - CMenuItem* item = new CMenuItem("", nullptr, 0, nullptr, CMenuItem::kSeparator); - return addEntry(item, 0.0f, index); -} - -int32_t SActionMenu::getNbEntries() const -{ - return static_cast(menuItems_.size()); -} - -void SActionMenu::draw(CDrawContext* dc) -{ - CColor backupColor = fontColor; - if (hovered_) - fontColor = hoverColor_; - CParamDisplay::draw(dc); - if (hovered_) - fontColor = backupColor; -} - -CMouseEventResult SActionMenu::onMouseEntered(CPoint& where, const CButtonState& buttons) -{ - hovered_ = true; - invalid(); - return CParamDisplay::onMouseEntered(where, buttons); -} - -CMouseEventResult SActionMenu::onMouseExited(CPoint& where, const CButtonState& buttons) -{ - hovered_ = false; - invalid(); - return CParamDisplay::onMouseExited(where, buttons); -} - -CMouseEventResult SActionMenu::onMouseDown(CPoint& where, const CButtonState& buttons) -{ - (void)where; - - if (buttons & (kLButton|kRButton|kApple)) { - CFrame* frame = getFrame(); - CRect bounds = getViewSize(); - - CPoint frameWhere = bounds.getBottomLeft(); - this->localToFrame(frameWhere); - - auto self = shared(this); - frame->doAfterEventProcessing([self, frameWhere]() { - if (CFrame* frame = self->getFrame()) { - SharedPointer menu = owned(new COptionMenu(CRect(), self->menuListener_, -1, nullptr, nullptr, COptionMenu::kPopupStyle)); - for (const SharedPointer& item : self->menuItems_) { - menu->addEntry(item); - item->remember(); // above call does not increment refcount - } - menu->setFont(self->getFont()); - menu->setFontColor(self->getFontColor()); - menu->setBackColor(self->getBackColor()); - menu->popup(frame, frameWhere + CPoint(0.0, 1.0)); - } - }); - return kMouseDownEventHandledButDontNeedMovedOrUpEvents; - } - - return kMouseEventNotHandled; -} - -void SActionMenu::onItemClicked(int32_t index) -{ - setTag(menuItemTags_[index]); - setValue(1.0f); - if (listener) - listener->valueChanged(this); - setValue(0.0f); - if (listener) - listener->valueChanged(this); -} - -/// -CMouseEventResult SHoverButton::onMouseEntered(CPoint& where, const CButtonState& buttons) { - hovered_ = true; - if (OnHoverEnter) - OnHoverEnter(); - invalid(); - return CKickButton::onMouseEntered(where, buttons); -} - -CMouseEventResult SHoverButton::onMouseExited(CPoint& where, const CButtonState& buttons) { - hovered_ = false; - if (OnHoverLeave) - OnHoverLeave(); - invalid(); - return CKickButton::onMouseExited(where, buttons); -} - -void SHoverButton::draw(CDrawContext* dc) { - CPoint where(offset.x, offset.y); - bounceValue(); - if (hovered_) - where.y += heightOfOneImage; - if (getDrawBackground()) - getDrawBackground()->draw(dc, getViewSize(), where); - setDirty(false); -} - -/// -void STextButton::setHighlightColor(const CColor& color) -{ - highlightColor_ = color; - invalid(); -} - -void STextButton::setInactiveColor(const CColor& color) -{ - inactiveColor_ = color; - invalid(); -} - -void STextButton::setInactive(bool b) -{ - inactive_ = b; - invalid(); -} - -void STextButton::setHighlighted(bool b) -{ - highlighted_ = b; - invalid(); -} - -void STextButton::draw(CDrawContext* context) -{ - CColor backupColor = textColor; - if (inactive_) - textColor = inactiveColor_; // textColor is protected - else if (hovered_ || highlighted_) - textColor = highlightColor_; - else if (inactive_) - textColor = inactiveColor_; - CTextButton::draw(context); - textColor = backupColor; -} - - -CMouseEventResult STextButton::onMouseEntered (CPoint& where, const CButtonState& buttons) -{ - hovered_ = true; - if (OnHoverEnter) - OnHoverEnter(); - invalid(); - return CTextButton::onMouseEntered(where, buttons); -} - -CMouseEventResult STextButton::onMouseExited (CPoint& where, const CButtonState& buttons) -{ - hovered_ = false; - if (OnHoverLeave) - OnHoverLeave(); - invalid(); - return CTextButton::onMouseExited(where, buttons); -} - -/// -SStyledKnob::SStyledKnob(const CRect& size, IControlListener* listener, int32_t tag) - : CKnobBase(size, listener, tag, nullptr) -{ -} - -void SStyledKnob::setActiveTrackColor(const CColor& color) -{ - if (activeTrackColor_ == color) - return; - activeTrackColor_ = color; - invalid(); -} - -void SStyledKnob::setInactiveTrackColor(const CColor& color) -{ - if (inactiveTrackColor_ == color) - return; - inactiveTrackColor_ = color; - invalid(); -} - -void SStyledKnob::setLineIndicatorColor(const CColor& color) -{ - if (lineIndicatorColor_ == color) - return; - lineIndicatorColor_ = color; - invalid(); -} - -void SStyledKnob::setRotatorColor(const CColor &color) -{ - if (rotatorColor_ == color) - return; - rotatorColor_ = color; - invalid(); -} - -void SStyledKnob::setFont(CFontRef font) -{ - if (font_ == font) - return; - font_ = font; - invalid(); -} - -void SStyledKnob::setFontColor(CColor fontColor) -{ - if (fontColor_ == fontColor) - return; - fontColor_ = fontColor; - invalid(); -} - -void SStyledKnob::setValueToStringFunction(ValueToStringFunction func) -{ - valueToStringFunction_ = std::move(func); - invalid(); -} - -void SStyledKnob::draw(CDrawContext* dc) -{ - const CCoord lineWidth = 4.0; - const CCoord indicatorLineLength = 8.0; - const CCoord angleSpread = 250.0; - const CCoord angle1 = 270.0 - 0.5 * angleSpread; - const CCoord angle2 = 270.0 + 0.5 * angleSpread; - - dc->setDrawMode(kAntiAliasing); - - const CRect bounds = getViewSize(); - - // compute inner bounds - CRect rect(bounds); - rect.setWidth(std::min(rect.getWidth(), rect.getHeight())); - rect.setHeight(rect.getWidth()); - rect.centerInside(bounds); - rect.extend(-lineWidth, -lineWidth); - - CRect knobRect(rect); - knobRect.centerInside(bounds); - knobRect.extend(-lineWidth, -lineWidth); - - SharedPointer path; - - // rotator - path = owned(dc->createGraphicsPath()); - path->addEllipse(knobRect); - - dc->setFillColor(rotatorColor_); - dc->drawGraphicsPath(path, CDrawContext::kPathFilled); - - // inactive track - path = owned(dc->createGraphicsPath()); - path->addArc(rect, angle1, angle2, true); - - dc->setFrameColor(inactiveTrackColor_); - dc->setLineWidth(lineWidth); - dc->setLineStyle(kLineSolid); - dc->drawGraphicsPath(path, CDrawContext::kPathStroked); - - // active track - const CCoord v = getValueNormalized(); - const CCoord vAngle = angle1 + v * angleSpread; - path = owned(dc->createGraphicsPath()); - path->addArc(rect, angle1, vAngle, true); - - dc->setFrameColor(activeTrackColor_); - dc->setLineWidth(lineWidth + 0.5); - dc->setLineStyle(kLineSolid); - dc->drawGraphicsPath(path, CDrawContext::kPathStroked); - - // indicator line - { - CCoord module1 = 0.5 * rect.getWidth() - indicatorLineLength; - CCoord module2 = 0.5 * rect.getWidth(); - std::complex c1 = std::polar(module1, vAngle * (M_PI / 180.0)); - std::complex c2 = std::polar(module2, vAngle * (M_PI / 180.0)); - - CPoint p1(c1.real(), c1.imag()); - CPoint p2(c2.real(), c2.imag()); - p1.offset(rect.getCenter()); - p2.offset(rect.getCenter()); - - dc->setFrameColor(lineIndicatorColor_); - dc->setLineWidth(1.0); - dc->setLineStyle(kLineSolid); - dc->drawLine(p1, p2); - } - - if (valueToStringFunction_ && fontColor_.alpha > 0 && !hideValue_) { - std::string text; - if (valueToStringFunction_(getValue(), text)) { - dc->setFont(font_); - dc->setFontColor(fontColor_); - dc->drawString(text.c_str(), bounds); - } - } -} - -void CFilledRect::draw(CDrawContext* dc) -{ - CRect bounds = getViewSize(); - dc->setFillColor(color_); - bool isRounded = radius_ > 0.0; - if (isRounded) { - auto roundRect = owned(dc->createRoundRectGraphicsPath(bounds, radius_)); - dc->drawGraphicsPath(roundRect, CDrawContext::kPathFilled); - } else { - dc->drawRect(bounds, kDrawFilled); - } -} - -/// -SKnobCCBox::SKnobCCBox(const CRect& size, IControlListener* listener, int32_t tag) - : CViewContainer(size), - label_(makeOwned(CRect())), - valueEdit_(makeOwned(CRect(), listener, tag)), - knob_(makeOwned(CRect(), listener, tag)), - ccLabel_(makeOwned(CRect())), - shadingRectangle_(makeOwned(CRect())), - menuEntry_(makeOwned("Use HDCC", tag)), - menuListener_(owned(new MenuListener(*this))) -{ - setBackgroundColor(kColorTransparent); - - label_->setText("Parameter"); - label_->setBackColor(kColorTransparent); - label_->setFrameColor(kColorTransparent); - label_->setFontColor(kBlackCColor); - label_->setStyle(CParamDisplay::kRoundRectStyle); - label_->setRoundRectRadius(5.0); - - knob_->setLineIndicatorColor(kBlackCColor); - - ccLabel_->setText("CC 1"); - ccLabel_->setStyle(CParamDisplay::kRoundRectStyle); - ccLabel_->setRoundRectRadius(5.0); - ccLabel_->setFrameColor(kColorTransparent); - ccLabel_->setFontColor(kWhiteCColor); - - valueEdit_->setBackColor(kColorTransparent); - valueEdit_->setFrameColor(kColorTransparent); - valueEdit_->setFontColor(kBlackCColor); - valueEdit_->registerViewListener(this); - setHDMode(false); - valueEdit_->setVisible(false); - - shadingRectangle_->setVisible(false); - - addView(label_); - label_->remember(); - addView(knob_); - knob_->remember(); - addView(shadingRectangle_); - shadingRectangle_->remember(); - addView(valueEdit_); - valueEdit_->remember(); - addView(ccLabel_); - ccLabel_->remember(); - updateViewColors(); - updateViewSizes(); -} - -SKnobCCBox::~SKnobCCBox() -{ - valueEdit_->unregisterViewListener(this); -} - -void SKnobCCBox::setHDMode(bool mode) -{ - if (mode) { - auto valueToString = [](float value, std::string& text, VSTGUI::CParamDisplay*) -> bool { - std::string s = std::to_string(value + 0.005f); - text = s.substr(0, 4); - return true; - }; - knob_->setValueToStringFunction([valueToString](float value, std::string& text) { - return valueToString(value, text, nullptr); - }); - valueEdit_->setValueToStringFunction2(valueToString); - - valueEdit_->setStringToValueFunction([](UTF8StringPtr txt, float& result, CTextEdit*) -> bool { - float value; - if (absl::SimpleAtof(txt, &value)) { - result = value; - return true; - } - - return false; - }); - menuEntry_->setTitle("Use low-res. CC"); - } else { - auto valueToString = [](float value, std::string& text, VSTGUI::CParamDisplay*) -> bool { - text = std::to_string(std::lround(value * 127)); - return true; - }; - knob_->setValueToStringFunction([valueToString](float value, std::string& text) { - return valueToString(value, text, nullptr); - }); - valueEdit_->setValueToStringFunction2(valueToString); - - valueEdit_->setStringToValueFunction([](UTF8StringPtr txt, float& result, CTextEdit*) -> bool { - float value; - if (absl::SimpleAtof(txt, &value)) { - result = value / 127.0f; - return true; - } - - return false; - }); - menuEntry_->setTitle("Use high-res. CC"); - } - - hdMode_ = mode; - valueEdit_->setValue(valueEdit_->getValue()); - invalid(); -} - -CMouseEventResult SKnobCCBox::onMouseDown(CPoint& where, const CButtonState& buttons) -{ - if (buttons.isRightButton()) { - CFrame* frame = getFrame(); - CPoint frameWhere = where; - frameWhere.offset(-getViewSize().left, -getViewSize().top); - this->localToFrame(frameWhere); - - auto self = shared(this); - frame->doAfterEventProcessing([self, frameWhere]() { - if (CFrame* frame = self->getFrame()) { - SharedPointer menu = - owned(new COptionMenu(CRect(), self->menuListener_, -1, nullptr, nullptr, COptionMenu::kPopupStyle)); - menu->addEntry(self->menuEntry_); - self->menuEntry_->remember(); // above call does not increment refcount - - menu->setFont(self->getValueEditFont()); - menu->setFontColor(self->getValueEditFontColor()); - menu->setBackColor(self->getValueEditBackColor()); - menu->popup(frame, frameWhere); - } - }); - return kMouseEventHandled; - } else if (buttons.isDoubleClick() && !valueEdit_->isVisible()) { - valueEdit_->setVisible(true); - shadingRectangle_->setVisible(true); - knob_->setHideValue(true); - valueEdit_->takeFocus(); - invalid(); - return kMouseEventHandled; - } - - return CViewContainer::onMouseDown(where, buttons); -} - -void SKnobCCBox::viewLostFocus (CView* view) -{ - if (view == valueEdit_.get()) { - shadingRectangle_->setVisible(false); - valueEdit_->setVisible(false); - knob_->setHideValue(false); - invalid(); - } -} - -void SKnobCCBox::setHue(float hue) -{ - hue_ = hue; - updateViewColors(); -} - -void SKnobCCBox::setNameLabelFont(CFontRef font) -{ - label_->setFont(font); - updateViewSizes(); -} - -void SKnobCCBox::setValueEditFont(CFontRef font) -{ - label_->setFont(font); - updateViewSizes(); -} - -void SKnobCCBox::setCCLabelFont(CFontRef font) -{ - ccLabel_->setFont(font); - updateViewSizes(); -} - -void SKnobCCBox::setValue(float value) -{ - float oldValue = knob_->getValue(); - knob_->setValue(value); - valueEdit_->setValue(value); - if (value != oldValue) - invalid(); -} - -void SKnobCCBox::setDefaultValue(float value) -{ - knob_->setDefaultValue(value); - valueEdit_->setDefaultValue(value); -} - -void SKnobCCBox::updateViewSizes() -{ - const CRect size = getViewSize(); - const CCoord ypad = 4.0; - - const CFontRef nameFont = label_->getFont(); - const CFontRef ccFont = ccLabel_->getFont(); - const CFontRef valueFont = valueEdit_->getFont(); - - nameLabelSize_ = CRect(0.0, 0.0, size.getWidth(), nameFont->getSize() + 2 * ypad); - ccLabelSize_ = CRect(0.0, size.getHeight() - ccFont->getSize() - 2 * ypad, size.getWidth(), size.getHeight()); - knobSize_ = CRect(0.0, nameLabelSize_.bottom, size.getWidth(), ccLabelSize_.top); - valueEditSize_ = CRect( - size.getWidth() / 2 - valueFont->getSize(), - size.getHeight() / 2 - valueFont->getSize() / 2, - size.getWidth() / 2 + valueFont->getSize(), - size.getHeight() / 2 + valueFont->getSize() / 2 - ); - - // remove knob side areas - CCoord side = std::max(0.0, knobSize_.getWidth() - knobSize_.getHeight()); - knobSize_.extend(-0.5 * side, 0.0); - shadingRectangleSize_ = knobSize_; - shadingRectangleSize_.bottom -= ypad; - - // - label_->setViewSize(nameLabelSize_); - knob_->setViewSize(knobSize_); - ccLabel_->setViewSize(ccLabelSize_); - valueEdit_->setViewSize(valueEditSize_); - shadingRectangle_->setViewSize(shadingRectangleSize_); - - invalid(); -} - -void SKnobCCBox::updateViewColors() -{ - const float knobLuma = 0.4; - const float ccLuma = 0.25; - - SColorHCY knobActiveTrackColor { hue_, 1.0, knobLuma }; - SColorHCY knobInactiveTrackColor { 0.0, 0.0, knobLuma }; - knob_->setActiveTrackColor(knobActiveTrackColor.toColor()); - knob_->setInactiveTrackColor(knobInactiveTrackColor.toColor()); - - SColorHCY ccLabelColor { hue_, 1.0, ccLuma }; - ccLabel_->setBackColor(ccLabelColor.toColor()); - - invalid(); -} - -/// -SControlsPanel::SControlsPanel(const CRect& size) - : CScrollView( - size, CRect(), - CScrollView::kVerticalScrollbar|CScrollView::kDontDrawFrame|CScrollView::kAutoHideScrollbars), - listener_(new ControlSlotListener(this)) -{ - // slot 0 always exists, keep the default style on the views there - getOrCreateSlot(0); - - setBackgroundColor(kColorTransparent); - - setScrollbarWidth(10.0); - - relayoutTrigger_ = makeOwned( - [this](CVSTGUITimer* timer) { timer->stop(); updateLayout(); }, - 1, false); -} - -void SControlsPanel::setControlUsed(uint32_t index, bool used) -{ - ControlSlot* slot = getSlot(index); - if (!slot && !used) - return; - if (!slot) - slot = getOrCreateSlot(index); - if (used != slot->used) { - slot->used = used; - relayoutTrigger_->start(); - } -} - -std::string SControlsPanel::getDefaultLabelText(uint32_t index) -{ - (void)index; - return {}; -} - -SControlsPanel::ControlSlot* SControlsPanel::getSlot(uint32_t index) -{ - ControlSlot* slot = nullptr; - if (index < slots_.size()) - slot = slots_[index].get(); - return slot; -} - -SControlsPanel::ControlSlot* SControlsPanel::getOrCreateSlot(uint32_t index) -{ - ControlSlot* slot = getSlot(index); - if (slot) - return slot; - - if (index + 1 > slots_.size()) - slots_.resize(index + 1); - - slot = new ControlSlot; - slots_[index].reset(slot); - - CRect boxSize { 0.0, 0.0, 120.0, 90.0 }; - SharedPointer box = makeOwned(boxSize, listener_.get(), index); - slot->box = box; - slot->box->setCCLabelText(("CC " + std::to_string(index)).c_str()); - - syncSlotStyle(index); - - return slot; -} - -void SControlsPanel::setControlValue(uint32_t index, float value) -{ - ControlSlot* slot = getOrCreateSlot(index); - SKnobCCBox* box = slot->box; - float oldValue = box->getValue(); - box->setValue(value); - if (box->getValue() != oldValue) - box->invalid(); -} - -void SControlsPanel::setControlDefaultValue(uint32_t index, float value) -{ - ControlSlot* slot = getOrCreateSlot(index); - SKnobCCBox* box = slot->box; - box->setDefaultValue(value); -} - -void SControlsPanel::setControlLabelText(uint32_t index, UTF8StringPtr text) -{ - ControlSlot* slot = getOrCreateSlot(index); - SKnobCCBox* box = slot->box; - if (text && text[0] != '\0') - box->setNameLabelText(text); - else - box->setNameLabelText(getDefaultLabelText(index).c_str()); - box->invalid(); -} - -void SControlsPanel::setNameLabelFont(CFontRef font) -{ - slots_[0]->box->setNameLabelFont(font); - slots_[0]->box->setValueEditFont(font); - syncAllSlotStyles(); -} - -void SControlsPanel::setNameLabelFontColor(CColor color) -{ - slots_[0]->box->setNameLabelFontColor(color); - slots_[0]->box->setValueEditFontColor(color); - syncAllSlotStyles(); -} - -void SControlsPanel::setNameLabelBackColor(CColor color) -{ - slots_[0]->box->setNameLabelBackColor(color); - slots_[0]->box->setValueEditBackColor(color); - syncAllSlotStyles(); -} - -void SControlsPanel::setCCLabelFont(CFontRef font) -{ - slots_[0]->box->setCCLabelFont(font); - syncAllSlotStyles(); -} - -void SControlsPanel::setCCLabelBackColor(CColor color) -{ - slots_[0]->box->setCCLabelBackColor(color); - syncAllSlotStyles(); -} - -void SControlsPanel::setCCLabelFontColor(CColor color) -{ - slots_[0]->box->setCCLabelFontColor(color); - syncAllSlotStyles(); -} - -void SControlsPanel::setValueEditBackColor(CColor color) -{ - slots_[0]->box->setValueEditBackColor(color); - syncAllSlotStyles(); -} - -void SControlsPanel::setShadingRectangleColor(CColor color) -{ - slots_[0]->box->setShadingRectangleColor(color); - syncAllSlotStyles(); -} - -void SControlsPanel::setValueEditFontColor(CColor color) -{ - slots_[0]->box->setValueEditFontColor(color); - syncAllSlotStyles(); -} - -void SControlsPanel::setKnobActiveTrackColor(CColor color) -{ - slots_[0]->box->setKnobActiveTrackColor(color); - syncAllSlotStyles(); -} - -void SControlsPanel::setKnobInactiveTrackColor(CColor color) -{ - slots_[0]->box->setKnobInactiveTrackColor(color); - syncAllSlotStyles(); -} - -void SControlsPanel::setKnobLineIndicatorColor(CColor color) -{ - slots_[0]->box->setKnobLineIndicatorColor(color); - syncAllSlotStyles(); -} - -void SControlsPanel::setKnobRotatorColor(CColor color) -{ - slots_[0]->box->setKnobRotatorColor(color); - syncAllSlotStyles(); -} - -void SControlsPanel::setKnobFont(CFontRef font) -{ - slots_[0]->box->setKnobFont(font); - syncAllSlotStyles(); -} - -void SControlsPanel::setKnobFontColor(CColor color) -{ - slots_[0]->box->setKnobFontColor(color); - syncAllSlotStyles(); -} - -void SControlsPanel::recalculateSubViews() -{ - CScrollView::recalculateSubViews(); - - // maybe the operation just created the scroll bar - if (CScrollbar* vsb = getVerticalScrollbar()) { - // update scrollbar style - vsb->setFrameColor(kColorTransparent); - vsb->setBackgroundColor(kColorTransparent); - vsb->setScrollerColor(kColorControlsScrollerTransparency); - } -} - -void SControlsPanel::updateLayout() -{ - removeAll(); - - const CRect viewBounds = getViewSize(); - - bool isFirstSlot = true; - CCoord itemWidth {}; - CCoord itemHeight {}; - CCoord itemOffsetX {}; - - int numColumns {}; - const CCoord horizontalPadding = 4.0; - CCoord verticalPadding = 4.0; - CCoord interRowPadding = {}; - CCoord interColumnPadding = 8.0; - - int currentRow = 0; - int currentColumn = 0; - int containerBottom = 0; - - uint32_t numSlots = static_cast(slots_.size()); - for (uint32_t i = 0; i < numSlots; ++i) { - ControlSlot* slot = slots_[i].get(); - if (!slot || !slot->used) - continue; - - CViewContainer* box = slot->box; - - if (isFirstSlot) { - itemWidth = box->getWidth(); - itemHeight = box->getHeight(); - isFirstSlot = false; - numColumns = int((viewBounds.getWidth() - horizontalPadding) / - (itemWidth + interColumnPadding)); - numColumns = std::max(1, numColumns); - itemOffsetX = (viewBounds.getWidth() - horizontalPadding - - numColumns * (itemWidth + interColumnPadding)) / 2.0; - - int maxRowsShown = int((viewBounds.getHeight() - 2 * verticalPadding) / itemHeight); - if (maxRowsShown > 1) - interRowPadding = (viewBounds.getHeight() - 2 * verticalPadding - itemHeight * maxRowsShown) / (maxRowsShown - 1); - } - - CRect itemBounds = box->getViewSize(); - itemBounds.moveTo( - itemOffsetX + horizontalPadding + currentColumn * (interColumnPadding + itemWidth), - verticalPadding + currentRow * (interRowPadding + itemHeight)); - - box->setViewSize(itemBounds); - - containerBottom = itemBounds.bottom; - - addView(box); - box->remember(); - - if (++currentColumn == numColumns) { - currentColumn = 0; - ++currentRow; - } - } - - setContainerSize(CRect(0.0, 0.0, viewBounds.getWidth(), containerBottom + verticalPadding)); - - invalid(); -} - -void SControlsPanel::syncAllSlotStyles() -{ - uint32_t count = static_cast(slots_.size()); - for (uint32_t index = 0; index < count; ++index) - syncSlotStyle(index); -} - -void SControlsPanel::syncSlotStyle(uint32_t index) -{ - if (index >= slots_.size()) - return; - - const SKnobCCBox* ref = slots_[0]->box; - SKnobCCBox* cur = slots_[index]->box; - - if (!cur) - return; - - if (cur != ref) { - cur->setNameLabelFont(ref->getNameLabelFont()); - cur->setNameLabelFontColor(ref->getNameLabelFontColor()); - cur->setNameLabelBackColor(ref->getNameLabelBackColor()); - - cur->setValueEditFont(ref->getValueEditFont()); - cur->setValueEditFontColor(ref->getValueEditFontColor()); - - cur->setShadingRectangleColor(ref->getShadingRectangleColor()); - - cur->setCCLabelFont(ref->getCCLabelFont()); - cur->setCCLabelFontColor(ref->getCCLabelFontColor()); - cur->setCCLabelBackColor(ref->getCCLabelBackColor()); - - cur->setKnobActiveTrackColor(ref->getKnobActiveTrackColor()); - cur->setKnobInactiveTrackColor(ref->getKnobInactiveTrackColor()); - cur->setKnobLineIndicatorColor(ref->getKnobLineIndicatorColor()); - cur->setKnobRotatorColor(ref->getKnobRotatorColor()); - cur->setKnobFont(ref->getKnobFont()); - cur->setKnobFontColor(ref->getKnobFontColor()); - } - - cur->invalid(); -} - -void SControlsPanel::ControlSlotListener::valueChanged(CControl* pControl) -{ - if (panel_->ValueChangeFunction) - panel_->ValueChangeFunction(pControl->getTag(), pControl->getValue()); -} - -void SControlsPanel::ControlSlotListener::controlBeginEdit(CControl* pControl) -{ - if (panel_->BeginEditFunction) - panel_->BeginEditFunction(pControl->getTag()); -} - -void SControlsPanel::ControlSlotListener::controlEndEdit(CControl* pControl) -{ - if (panel_->EndEditFunction) - panel_->EndEditFunction(pControl->getTag()); -} - -/// -SLevelMeter::SLevelMeter(const CRect& size) - : CView(size) -{ -} - -void SLevelMeter::setValue(float value) -{ - if (value_ == value) - return; - - value_ = value; - - // instantiate the timer lazily - if (!timer_) { - const uint32_t interval = 10; - timer_ = makeOwned( - [this](CVSTGUITimer* timer) { - timer->stop(); - timerArmed_ = false; - invalid(); - }, interval, false); - } - - // defer the update, but do not rearm the timer - if (!timerArmed_) { - timerArmed_ = true; - timer_->start(); - } -} - -void SLevelMeter::draw(CDrawContext* dc) -{ - float dbValue = 20.0f * std::log10(value_); - float fill = (dbValue - dbMin_) / (dbMax_ - dbMin_); - fill = (fill < 0.0f) ? 0.0f : fill; - fill = (fill > 1.0f) ? 1.0f : fill; - - CRect largeBounds = getViewSize(); - CRect fillBounds = largeBounds; - fillBounds.top = largeBounds.bottom - fill * largeBounds.getHeight(); - - const CColor safeColor = safeFillColor_; - const CColor dangerColor = dangerFillColor_; - - CColor fillColor; - if (safeColor == dangerColor) { - fillColor = safeColor; - } - else { - float thres = dangerThreshold_; - float mix = (fill - thres) / (1.0f - thres); - mix = (mix < 0.0f) ? 0.0f : mix; - - CCoord safeH, safeS, safeV, safeA; - CCoord dangerH, dangerS, dangerV, dangerA; - safeColor.toHSV(safeH, safeS, safeV); - dangerColor.toHSV(dangerH, dangerS, dangerV); - safeA = safeColor.alpha / 255.0; - dangerA = dangerColor.alpha / 255.0; - - CCoord H, S, V, A; - H = safeH + mix * (dangerH - safeH); - S = safeS + mix * (dangerS - safeS); - V = safeV + mix * (dangerV - safeV); - A = safeA + mix * (dangerA - safeA); - - fillColor.fromHSV(H, S, V); - fillColor.alpha = static_cast(A * 255.0); - } - - CCoord radius = radius_; - bool isRounded = radius > 0.0; - - dc->setDrawMode(isRounded ? kAntiAliasing : kAliasing); - - SharedPointer largeRoundRect; - SharedPointer fillRoundRect; - - if (isRounded) { - largeRoundRect = owned(dc->createRoundRectGraphicsPath(largeBounds, radius)); - fillRoundRect = owned(dc->createRoundRectGraphicsPath(fillBounds, radius)); - } - - if (backColor_.alpha > 0) { - dc->setFillColor(backColor_); - if (!isRounded) - dc->drawRect(largeBounds, kDrawFilled); - else - dc->drawGraphicsPath(largeRoundRect, CDrawContext::kPathFilled); - } - - dc->setFrameColor(frameColor_); - dc->setFillColor(fillColor); - - if (!isRounded) { - if (fill > 0) - dc->drawRect(fillBounds, kDrawFilled); - dc->drawRect(largeBounds); - } - else { - if (fill > 0 && fillBounds.getHeight() >= radius) - dc->drawGraphicsPath(fillRoundRect, CDrawContext::kPathFilled); - dc->drawGraphicsPath(largeRoundRect, CDrawContext::kPathStroked); - } -} - -/// -SPlaceHolder::SPlaceHolder(const CRect& size, const CColor& color) - : CView(size), color_(color) -{ -} - -void SPlaceHolder::draw(CDrawContext* dc) -{ - const CRect bounds = getViewSize(); - dc->setDrawMode(kAliasing); - dc->setFrameColor(color_); - dc->drawRect(bounds); - dc->drawLine(bounds.getTopLeft(), bounds.getBottomRight()); - dc->drawLine(bounds.getTopRight(), bounds.getBottomLeft()); -} diff --git a/plugins/editor/src/editor/GUIComponents.h b/plugins/editor/src/editor/GUIComponents.h deleted file mode 100644 index a0ce85410..000000000 --- a/plugins/editor/src/editor/GUIComponents.h +++ /dev/null @@ -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 -#include -#include -#include - -#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 titleFont_; -}; - -/// -class SFileDropTarget : public IDropTarget, - public NonAtomicReferenceCounted { -public: - typedef std::function 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 menuItemValues_; - SharedPointer menuListener_; - - // - class MenuListener : public IControlListener, public NonAtomicReferenceCounted { - public: - explicit MenuListener(SValueMenu& menu) : menu_(menu) {} - void valueChanged(CControl* control) override - { - menu_.onItemClicked(static_cast(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 menuItemTags_; - SharedPointer menuListener_; - - // - class MenuListener : public IControlListener, public NonAtomicReferenceCounted { - public: - explicit MenuListener(SActionMenu& menu) : menu_(menu) {} - void valueChanged(CControl* control) override - { - menu_.onItemClicked(static_cast(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 OnHoverEnter; - std::function 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 OnHoverEnter; - std::function 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; - 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 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 label_; - SharedPointer valueEdit_; - SharedPointer knob_; - SharedPointer ccLabel_; - SharedPointer shadingRectangle_; - SharedPointer 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_; - 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 ValueChangeFunction; - std::function BeginEditFunction; - std::function 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 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> slots_; - std::unique_ptr listener_; - SharedPointer 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 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_; -}; diff --git a/plugins/editor/src/editor/GUIDefs.cpp b/plugins/editor/src/editor/GUIDefs.cpp deleted file mode 100644 index 176f3220c..000000000 --- a/plugins/editor/src/editor/GUIDefs.cpp +++ /dev/null @@ -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) }; -} diff --git a/plugins/editor/src/editor/GUIDefs.h b/plugins/editor/src/editor/GUIDefs.h deleted file mode 100644 index 5238aba67..000000000 --- a/plugins/editor/src/editor/GUIDefs.h +++ /dev/null @@ -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; -} diff --git a/plugins/editor/src/editor/GUIHelpers.cpp b/plugins/editor/src/editor/GUIHelpers.cpp deleted file mode 100644 index 9faf7ef47..000000000 --- a/plugins/editor/src/editor/GUIHelpers.cpp +++ /dev/null @@ -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 -#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()) -{ - frame->registerKeyboardHook(hook_); - frame->registerMouseObserver(hook_); - - delayedEnabler_ = makeOwned( - [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 diff --git a/plugins/editor/src/editor/GUIHelpers.h b/plugins/editor/src/editor/GUIHelpers.h deleted file mode 100644 index 86f43df79..000000000 --- a/plugins/editor/src/editor/GUIHelpers.h +++ /dev/null @@ -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 -#include -#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 hook_; - SharedPointer delayedEnabler_; -}; diff --git a/plugins/editor/src/editor/GUIPiano.cpp b/plugins/editor/src/editor/GUIPiano.cpp deleted file mode 100644 index ce94dd357..000000000 --- a/plugins/editor/src/editor/GUIPiano.cpp +++ /dev/null @@ -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 -#include - -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 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 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 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(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( - 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(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(value))); -} diff --git a/plugins/editor/src/editor/GUIPiano.h b/plugins/editor/src/editor/GUIPiano.h deleted file mode 100644 index b20a6f889..000000000 --- a/plugins/editor/src/editor/GUIPiano.h +++ /dev/null @@ -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 -#include -#include - -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 onKeyPressed; - std::function 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_; -}; diff --git a/plugins/editor/src/editor/ImageHelpers.cpp b/plugins/editor/src/editor/ImageHelpers.cpp deleted file mode 100644 index c946088ae..000000000 --- a/plugins/editor/src/editor/ImageHelpers.cpp +++ /dev/null @@ -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 - -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; - -SharedPointer 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 bitmap = makeOwned(width, height); - SharedPointer 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); -} diff --git a/plugins/editor/src/editor/ImageHelpers.h b/plugins/editor/src/editor/ImageHelpers.h deleted file mode 100644 index 8c51612e1..000000000 --- a/plugins/editor/src/editor/ImageHelpers.h +++ /dev/null @@ -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 - -#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 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); diff --git a/plugins/editor/src/editor/NativeHelpers.cpp b/plugins/editor/src/editor/NativeHelpers.cpp deleted file mode 100644 index f089b258d..000000000 --- a/plugins/editor/src/editor/NativeHelpers.cpp +++ /dev/null @@ -1,340 +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 "plugin/NativeHelpers.h" - -#if defined(_WIN32) -#include "ghc/fs_std.hpp" -#include -#include - -bool openFileInExternalEditor(const char *filename) -{ - std::wstring path = stringToWideChar(filename); - - SHELLEXECUTEINFOW info; - memset(&info, 0, sizeof(info)); - - info.cbSize = sizeof(info); - info.fMask = SEE_MASK_CLASSNAME; - info.lpVerb = L"open"; - info.lpFile = path.c_str(); - info.lpClass = L"txtfile"; - info.nShow = SW_SHOW; - - return ShellExecuteExW(&info); -} - -bool openDirectoryInExplorer(const char *filename) -{ - std::wstring path = stringToWideChar(filename); - - SHELLEXECUTEINFOW info; - memset(&info, 0, sizeof(info)); - - info.cbSize = sizeof(info); - info.lpVerb = L"explore"; - info.lpFile = path.c_str(); - info.nShow = SW_SHOW; - - return ShellExecuteExW(&info); -} - -bool openURLWithExternalProgram(const char *url) -{ - std::wstring path = stringToWideChar(url); - - SHELLEXECUTEINFOW info; - memset(&info, 0, sizeof(info)); - - info.cbSize = sizeof(info); - info.lpVerb = L"open"; - info.lpFile = path.c_str(); - info.nShow = SW_SHOW; - - return ShellExecuteExW(&info); -} - -bool askQuestion(const char *text) -{ - int ret = MessageBoxW(nullptr, stringToWideChar(text), L"Question", MB_YESNO); - return ret == IDYES; -} - -std::string getOperatingSystemName() -{ - LSTATUS status; - HKEY key = nullptr; - const WCHAR keyPath[] = L"Software\\Microsoft\\Windows NT\\CurrentVersion"; - const WCHAR valueName[] = L"ProductName"; - const char fallbackName[] = "Windows (unknown)"; - - status = RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyPath, 0, KEY_QUERY_VALUE, &key); - if (status != ERROR_SUCCESS) - return fallbackName; - - DWORD valueSize = 32768 * sizeof(WCHAR); - std::unique_ptr valueW(new WCHAR[(valueSize / sizeof(WCHAR)) + 1]()); - DWORD valueType; - status = RegQueryValueExW( - key, valueName, nullptr, - &valueType, reinterpret_cast(valueW.get()), &valueSize); - RegCloseKey(key); - if (status != ERROR_SUCCESS || (valueType != REG_SZ && valueType != REG_EXPAND_SZ)) - return fallbackName; - - std::unique_ptr valueUTF8(stringToUTF8(valueW.get())); - return valueUTF8.get(); -} - -std::string getProcessorName() -{ - LSTATUS status; - HKEY key = nullptr; - const WCHAR keyPath[] = L"Hardware\\Description\\System\\CentralProcessor\\0"; - const WCHAR valueName[] = L"ProcessorNameString"; - const char fallbackName[] = "Unknown"; - - status = RegOpenKeyExW(HKEY_LOCAL_MACHINE, keyPath, 0, KEY_QUERY_VALUE, &key); - if (status != ERROR_SUCCESS) - return fallbackName; - - DWORD valueSize = 32768 * sizeof(WCHAR); - std::unique_ptr valueW(new WCHAR[(valueSize / sizeof(WCHAR)) + 1]()); - DWORD valueType; - status = RegQueryValueExW( - key, valueName, nullptr, - &valueType, reinterpret_cast(valueW.get()), &valueSize); - RegCloseKey(key); - if (status != ERROR_SUCCESS || (valueType != REG_SZ && valueType != REG_EXPAND_SZ)) - return fallbackName; - - std::unique_ptr valueUTF8(stringToUTF8(valueW.get())); - return valueUTF8.get(); -} - -std::string getCurrentProcessName() -{ - DWORD size = 32768; - std::unique_ptr buffer(new WCHAR[size]()); - - if (!GetModuleFileNameW(nullptr, buffer.get(), size)) - return {}; - - buffer[size - 1] = L'\0'; - const WCHAR* name = buffer.get(); - - if (const WCHAR* pos = wcsrchr(name, L'\\')) - name = pos + 1; - - std::unique_ptr nameUTF8(stringToUTF8(name)); - return nameUTF8.get(); -} -#elif defined(__APPLE__) - // implemented in NativeHelpers.mm -#else -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -extern "C" { extern char **environ; } -extern "C" { extern char *__progname; } - -static bool openFileByMimeType(const char *filename, const char *mimetype) -{ - GAppInfo* appinfo = g_app_info_get_default_for_type(mimetype, FALSE); - if (!appinfo) - return 1; - - GList* files = nullptr; - GFile* file = g_file_new_for_path(filename); - files = g_list_append(files, file); - gboolean success = g_app_info_launch(appinfo, files, nullptr, nullptr); - g_object_unref(file); - g_list_free(files); - g_object_unref(appinfo); - return success == TRUE; -} - -bool openFileInExternalEditor(const char *filename) -{ - return openFileByMimeType(filename, "text/plain"); -} - -bool openDirectoryInExplorer(const char *filename) -{ - return openFileByMimeType(filename, "inode/directory"); -} - -bool openURLWithExternalProgram(const char *url) -{ - gboolean success = g_app_info_launch_default_for_uri(url, nullptr, nullptr); - return success == TRUE; -} - -static std::vector createForkEnviron() -{ - std::vector newEnv; - newEnv.reserve(256); - for (char **envp = environ; *envp; ++envp) { - // ensure the process will link with system libraries, - // and not these from the Ardour bundle. - if (strncmp(*envp, "LD_LIBRARY_PATH=", 16) == 0) - continue; - newEnv.push_back(*envp); - } - newEnv.push_back(nullptr); - return newEnv; -} - -static const std::string zenityPath = [] { - auto glibPath = g_find_program_in_path("zenity"); - if (glibPath) { - std::string s { glibPath }; - g_free(glibPath); - return s; - } else { - return std::string("/usr/bin/zenity"); - } -}(); - -bool askQuestion(const char *text) -{ - char *argv[] = { - const_cast(zenityPath.c_str()), - const_cast("--question"), - const_cast("--text"), - const_cast(text), - nullptr, - }; - - std::vector newEnv = createForkEnviron(); - char **envp = newEnv.data(); - - pid_t forkPid = vfork(); - if (forkPid == -1) - return false; - - if (forkPid == 0) { - execve(argv[0], argv, envp); - _exit(1); - } - - int wret; - int wstatus; - do { - wret = waitpid(forkPid, &wstatus, 0); - } while (wret == -1 && errno == EINTR); - - if (wret == -1 || !WIFEXITED(wstatus)) - return false; - - return WEXITSTATUS(wstatus) == 0; -} - -bool isZenityAvailable() -{ - return access(zenityPath.c_str(), X_OK) == 0; -} - -std::string getOperatingSystemName() -{ - std::string name; - - std::ifstream in("/etc/os-release", std::ios::binary); - if (!in) - in = std::ifstream("/usr/lib/os-release", std::ios::binary); - if (in) { - std::string line; - line.reserve(256); - for (bool found = false; !found && std::getline(in, line); ) { - const char prefix[] = "PRETTY_NAME="; - size_t length = sizeof(prefix) - 1; - found = line.size() >= length && !memcmp(line.data(), prefix, length); - if (found) { - if (char* value = g_shell_unquote(line.c_str() + length, nullptr)) { - name.assign(value); - g_free(value); - } - } - } - in.close(); - } - - if (name.empty()) { - utsname un {}; - int ret = uname(&un); - if (ret != -1 && un.sysname[0] != '\0') - name.append(un.sysname); - else { - name.append("Unknown"); - } - if (ret != -1 && un.release[0] != '\0') { - name.push_back(' '); - name.append(un.release); - } - } - - return name; -} - -std::string getProcessorName() -{ - std::string name; - std::string line; - std::ifstream in("/proc/cpuinfo", std::ios::binary); - - line.reserve(256); - - while (name.empty() && std::getline(in, line) && !line.empty()) { - size_t pos = line.find(':'); - if (pos == line.npos) - continue; - - absl::string_view left = absl::string_view(line).substr(0, pos); - absl::string_view right = absl::string_view(line).substr(pos + 1); - - left = absl::StripAsciiWhitespace(left); - right = absl::StripAsciiWhitespace(right); - - if (left == "model name") - name = std::string(right); - } - - if (name.empty()) - name = "Unknown"; - - return name; -} - -std::string getCurrentProcessName() -{ - std::string name; - - const std::string commPath = "/proc/" + std::to_string(getpid()) + "/comm"; - - if (std::ifstream in { commPath, std::ios::binary }) { - name.reserve(256); - for (int c; (c = in.get()) != std::char_traits::eof() && c != '\n'; ) - name.push_back(static_cast(c)); - } - - if (name.empty()) { - if (const char* progname = __progname) - name.assign(progname); - } - - return name; -} -#endif diff --git a/plugins/editor/src/editor/NativeHelpers.h b/plugins/editor/src/editor/NativeHelpers.h deleted file mode 100644 index 2741981e5..000000000 --- a/plugins/editor/src/editor/NativeHelpers.h +++ /dev/null @@ -1,20 +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 - -bool openFileInExternalEditor(const char *filename); -bool openDirectoryInExplorer(const char *filename); -bool openURLWithExternalProgram(const char *url); -bool askQuestion(const char *text); -std::string getOperatingSystemName(); -std::string getProcessorName(); -std::string getCurrentProcessName(); - -#if !defined(_WIN32) && !defined(__APPLE__) -bool isZenityAvailable(); -#endif diff --git a/plugins/editor/src/editor/NativeHelpers.mm b/plugins/editor/src/editor/NativeHelpers.mm deleted file mode 100644 index e2d539908..000000000 --- a/plugins/editor/src/editor/NativeHelpers.mm +++ /dev/null @@ -1,111 +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" - -#if defined(__APPLE__) -#import -#import -#import -#include -#include -#include -#include - -static bool openFileWithApplication(const char *fileName, NSString *application) -{ - NSWorkspace* workspace = [NSWorkspace sharedWorkspace]; - NSString* fileNameNs = [NSString stringWithUTF8String:fileName]; - return [workspace openFile:fileNameNs withApplication:application] == YES; -} - -bool openFileInExternalEditor(const char *fileName) -{ - NSURL* appURL = nil; - NSURL* fileURL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:fileName]]; - const LSRolesMask roles = kLSRolesEditor; - - NSArray* editorApps = (__bridge_transfer NSArray*)LSCopyApplicationURLsForURL( - (__bridge CFURLRef)fileURL, roles); - - for (NSUInteger i = 0, n = [editorApps count]; i < n && !appURL; ++i) { - NSURL* url = [editorApps objectAtIndex:i]; - if (url && [url isFileURL]) - appURL = url; - } - - if (!appURL) { - NSURL* url = (__bridge_transfer NSURL*)LSCopyDefaultApplicationURLForContentType( - kUTTypePlainText, roles, nil); - if (url && [url isFileURL]) - appURL = url; - } - - if (!appURL) - return false; - - return openFileWithApplication(fileName, [appURL path]); -} - -bool openDirectoryInExplorer(const char *fileName) -{ - return openFileWithApplication(fileName, @"Finder"); -} - -bool openURLWithExternalProgram(const char *url) -{ - NSWorkspace* workspace = [NSWorkspace sharedWorkspace]; - NSURL* urlNs = [NSURL URLWithString:[NSString stringWithUTF8String:url]]; - return [workspace openURL:urlNs] == YES; -} - -bool askQuestion(const char *text) -{ - NSAlert *alert = [[NSAlert alloc] init]; - [alert setMessageText:[NSString stringWithUTF8String:text]]; - [alert addButtonWithTitle:@"OK"]; - [alert addButtonWithTitle:@"Cancel"]; - NSInteger button = [alert runModal]; - return button == NSAlertFirstButtonReturn; -} - -std::string getOperatingSystemName() -{ -#if TARGET_OS_IOS - NSString *osName = @"iOS"; -#elif TARGET_OS_MAC - NSString *osName = @"macOS"; -#endif - NSString *osVersion = [[NSProcessInfo processInfo] operatingSystemVersionString]; - return [[NSString stringWithFormat:@"%@ %@", osName, osVersion] UTF8String]; -} - -std::string getProcessorName() -{ - char nameBuf[256]; - size_t size = sizeof(nameBuf); - const char* fallbackName = "Unknown"; - - if (sysctlbyname("machdep.cpu.brand_string", nameBuf, &size, nullptr, 0) == -1) - return fallbackName; - - size = strnlen(nameBuf, sizeof(nameBuf)); - if (size == 0) - return fallbackName; - - return std::string(nameBuf, size); -} - -std::string getCurrentProcessName() -{ - kinfo_proc proc {}; - size_t size = sizeof(kinfo_proc); - int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, int(getpid()) }; - if (sysctl(name, 4, &proc, &size, nullptr, 0) == -1) - return {}; - return proc.kp_proc.p_comm; -} -#endif diff --git a/plugins/editor/src/editor/Theme.cpp b/plugins/editor/src/editor/Theme.cpp deleted file mode 100644 index 351e31459..000000000 --- a/plugins/editor/src/editor/Theme.cpp +++ /dev/null @@ -1,173 +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 "Theme.h" -#include "ColorHelpers.h" -#include "VSTGUIHelpers.h" -#include "plugin/SfizzSettings.h" -#include "sfizz/utility/StringViewHelpers.h" -#include -#include -#include -#include - -void Theme::clear() { - frameBackground = {}; - normalPalette = {}; - invertedPalette = {}; -} - -void Theme::load(const std::string& name) -{ - fs::path resPath = getResourceBasePath(); - fs::path themePath = resPath / "Themes" / fs::u8path(name) / "theme.xml"; - - pugi::xml_document doc; - pugi::xml_parse_result result = doc.load_file(themePath.c_str()); - if (!result) { - std::cerr << "[sfizz] cannot load theme from " << resPath << '\n'; - return; - } - - loadDocument(doc); -} - -void Theme::loadDocument(const pugi::xml_document& doc) -{ - pugi::xml_node rootNode(doc.child("sfizz-theme")); - if (!rootNode) { - std::cerr << "[sfizz] trying to load an invalid theme\n"; - return; - } - - /// - clear(); - - /// - auto loadChildColorNodes = [this](pugi::xml_node topNode, bool inverted) { - for (pugi::xml_node colorNode : topNode.children("color")) { - absl::string_view name = colorNode.attribute("name").as_string(); - CColor* slot = getColorFromName(name, inverted); - if (!slot) { - std::cerr << "[sfizz] color not recognized: " << name << "\n"; - continue; - } - - *slot = {}; - - absl::string_view colorText = colorNode.text().as_string(); - if (!colorFromHex(colorText, *slot)) - std::cerr << "[sfizz] invalid color value: " << colorText << "\n"; - } - }; - - /// - loadChildColorNodes(rootNode, false); - - for (pugi::xml_node paletteNode : rootNode.children("palette")) { - absl::string_view paletteName = paletteNode.attribute("name").as_string(); - - bool inverted; - if (paletteName == "normal") - inverted = false; - else if (paletteName == "inverted") - inverted = true; - else { - std::cerr << "[sfizz] palette not recognized: " << paletteName << "\n"; - continue; - } - - loadChildColorNodes(paletteNode, inverted); - } - - /// - invokeChangeListener(); -} - -void Theme::storeCurrentName(absl::string_view name) -{ - SfizzSettings settings; - settings.store("current_theme", name); -} - -std::string Theme::loadCurrentName() -{ - SfizzSettings settings; - return settings.load_or("current_theme", "Default"); -} - -const std::vector& Theme::getAvailableNames() -{ - static const std::vector names = extractAvailableNames(); - return names; -} - -std::vector Theme::extractAvailableNames() -{ - fs::path themesPath = getResourceBasePath() / "Themes"; - - std::error_code ec; - fs::directory_iterator it(themesPath, ec); - if (ec) { - std::cerr << "[sfizz] error reading the theme directory: " << ec.message() << '\n'; - return {}; - } - - std::vector names; - for (; !ec && it != fs::directory_iterator(); it.increment(ec)) { - const fs::directory_entry& entry = *it; - if (entry.is_directory()) - names.emplace_back(entry.path().filename().u8string()); - } - - std::sort( - names.begin(), names.end(), - [](const std::string& a, const std::string& b) -> bool { - return (a == "Default") ? true : (b == "Default") ? false : a < b; - }); - - return names; -} - -CColor* Theme::getColorFromName(absl::string_view name, bool fromInvertedPalette) -{ - CColor* c = nullptr; - switch (hash(name)) { - #define COLOR_CASE(X) \ - case hash(#X): \ - c = &X; \ - break - #define PALETTE_COLOR_CASE(X) \ - case hash(#X): \ - c = fromInvertedPalette ? \ - &invertedPalette.X : &normalPalette.X; \ - break - - COLOR_CASE(frameBackground); - PALETTE_COLOR_CASE(boxBackground); - PALETTE_COLOR_CASE(highlightedText); - PALETTE_COLOR_CASE(icon); - PALETTE_COLOR_CASE(iconHighlight); - PALETTE_COLOR_CASE(inactiveText); - PALETTE_COLOR_CASE(knobActiveTrack); - PALETTE_COLOR_CASE(knobInactiveTrack); - PALETTE_COLOR_CASE(knobLabelText); - PALETTE_COLOR_CASE(knobLineIndicator); - PALETTE_COLOR_CASE(knobText); - PALETTE_COLOR_CASE(knobLabelBackground); - PALETTE_COLOR_CASE(text); - PALETTE_COLOR_CASE(titleBoxBackground); - PALETTE_COLOR_CASE(titleBoxText); - PALETTE_COLOR_CASE(valueBackground); - PALETTE_COLOR_CASE(valueText); - - #undef COLOR_CASE - #undef PALETTE_COLOR_CASE - - default: break; - } - return c; -} diff --git a/plugins/editor/src/editor/Theme.h b/plugins/editor/src/editor/Theme.h deleted file mode 100644 index 9e5d87a42..000000000 --- a/plugins/editor/src/editor/Theme.h +++ /dev/null @@ -1,68 +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/vstgui.h" -#include "utility/vstgui_after.h" -#include -#include -#include -namespace pugi { class xml_document; } - -using namespace VSTGUI; - -struct Palette { - CColor boxBackground; - CColor text; - CColor inactiveText; - CColor highlightedText; - CColor titleBoxText; - CColor titleBoxBackground; - CColor icon; - CColor iconHighlight; - CColor valueText; - CColor valueBackground; - CColor knobActiveTrack; - CColor knobInactiveTrack; - CColor knobLineIndicator; - CColor knobText; - CColor knobLabelText; - CColor knobLabelBackground; -}; - -struct Theme { - Theme() = default; - - Theme(const Theme&) = delete; - Theme& operator=(const Theme&) = delete; - - CColor frameBackground; - Palette normalPalette {}; - Palette invertedPalette {}; - - struct ChangeListener { - virtual ~ChangeListener() {} - virtual void onThemeChanged() = 0; - }; - - ChangeListener* listener = nullptr; - - void clear(); - void load(const std::string& name); - void loadDocument(const pugi::xml_document& doc); - - void invokeChangeListener() { if (listener) listener->onThemeChanged(); } - - static void storeCurrentName(absl::string_view name); - static std::string loadCurrentName(); - static const std::vector& getAvailableNames(); - - CColor* getColorFromName(absl::string_view name, bool fromInvertedPalette = false); - -private: - static std::vector extractAvailableNames(); -}; diff --git a/plugins/editor/src/editor/VSTGUIHelpers.cpp b/plugins/editor/src/editor/VSTGUIHelpers.cpp deleted file mode 100644 index 2e7d41d71..000000000 --- a/plugins/editor/src/editor/VSTGUIHelpers.cpp +++ /dev/null @@ -1,35 +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 "VSTGUIHelpers.h" -#include "utility/vstgui_before.h" -#include "vstgui/lib/platform/platformfactory.h" -#if defined(_WIN32) -# include "vstgui/lib/platform/win32/win32factory.h" -#elif defined(__APPLE__) -#else -# include "vstgui/lib/platform/linux/linuxfactory.h" -#endif -#include "utility/vstgui_after.h" - -using namespace VSTGUI; - -#if defined(_WIN32) -fs::path getResourceBasePath() -{ - Optional optionalPath = getPlatformFactory().asWin32Factory()->getResourceBasePath(); - if (!optionalPath) - return fs::path(); - return fs::u8path(optionalPath->getString()); -} -#elif defined(__APPLE__) - // implemented in VSTGUIHelpers.mm -#else -fs::path getResourceBasePath() -{ - return fs::u8path(getPlatformFactory().asLinuxFactory()->getResourcePath()); -} -#endif diff --git a/plugins/editor/src/editor/VSTGUIHelpers.h b/plugins/editor/src/editor/VSTGUIHelpers.h deleted file mode 100644 index 01c8ef523..000000000 --- a/plugins/editor/src/editor/VSTGUIHelpers.h +++ /dev/null @@ -1,10 +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 - -fs::path getResourceBasePath(); diff --git a/plugins/editor/src/editor/VSTGUIHelpers.mm b/plugins/editor/src/editor/VSTGUIHelpers.mm deleted file mode 100644 index 7f753a2be..000000000 --- a/plugins/editor/src/editor/VSTGUIHelpers.mm +++ /dev/null @@ -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 "VSTGUIHelpers.h" - -#if defined(__APPLE__) -#include "vstgui/lib/platform/mac/macfactory.h" -#import -#import - -fs::path getResourceBasePath() -{ - CFBundleRef bundle = VSTGUI::getPlatformFactory().asMacFactory()->getBundle(); - if (!bundle) - return fs::path(); - - NSURL* url = (__bridge_transfer NSURL*)CFBundleCopyResourcesDirectoryURL(bundle); - if (!url || ![url isFileURL]) - return fs::path(); - - return fs::u8path([[url path] UTF8String]); -} -#endif diff --git a/plugins/editor/src/editor/layout/about.hpp b/plugins/editor/src/editor/layout/about.hpp deleted file mode 100644 index f4b5608bd..000000000 --- a/plugins/editor/src/editor/layout/about.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* This file is generated by the layout maker tool. */ -auto* const view__0 = createaboutView(CRect(0, 0, 800, 475), -1, "About sfizz", kCenterText, 14); -aboutView = view__0; -auto* const view__1 = createLogo(CRect(200, 0, 600, 180), -1, "", kCenterText, 14); -view__0->addView(view__1); -auto* const view__2 = createInfoBox(CRect(260, 180, 540, 260), -1, "", kCenterText, 14); -view__0->addView(view__2); -auto* const view__3 = createDescriptionBox(CRect(200, 260, 600, 360), -1, "", kCenterText, 14); -view__0->addView(view__3); -auto* const view__4 = createHoverBox(CRect(460, 435, 775, 460), -1, "", kCenterText, 12); -lblHover_ = view__4; -view__0->addView(view__4); -view__4->setVisible(false); -auto* const view__5 = createButtonSfztools(CRect(460, 405, 500, 445), kTagButtonSfztools, "", kCenterText, 30); -view__0->addView(view__5); -auto* const view__6 = createButtonGithub(CRect(530, 405, 570, 445), kTagButtonGithub, "", kCenterText, 30); -view__0->addView(view__6); -auto* const view__7 = createButtonDiscord(CRect(600, 405, 640, 445), kTagButtonDiscord, "", kCenterText, 30); -view__0->addView(view__7); -auto* const view__8 = createButtonOpencollective(CRect(670, 405, 710, 445), kTagButtonOpencollective, "", kCenterText, 30); -view__0->addView(view__8); -auto* const view__9 = createButtonSfzformat(CRect(740, 405, 780, 445), kTagButtonSfzformat, "", kCenterText, 30); -view__0->addView(view__9); -auto* const view__10 = createSysInfoKeyBox(CRect(15, 375, 105, 465), -1, "Format\nHost\nProcessor\nAddress\nSystem", kLeftText, 14); -view__0->addView(view__10); -auto* const view__11 = createSysInfoValueBox(CRect(105, 375, 450, 465), -1, "%PluginFormat%\n%HostProgram%\n%HostCPU%\n%HostBits% bits\n%HostOS%", kLeftText, 14); -lblSysInfoValue_ = view__11; -view__0->addView(view__11); diff --git a/plugins/editor/src/editor/layout/main.hpp b/plugins/editor/src/editor/layout/main.hpp deleted file mode 100644 index 2faf625c2..000000000 --- a/plugins/editor/src/editor/layout/main.hpp +++ /dev/null @@ -1,247 +0,0 @@ -/* This file is generated by the layout maker tool. */ -auto* const view__0 = createLogicalGroup(CRect(0, 0, 775, 515), -1, "", kCenterText, 14); -mainView = view__0; -auto* const view__1 = createBackground(CRect(0, 110, 775, 445), -1, "", kCenterText, 14); -imageContainer_ = view__1; -view__0->addView(view__1); -enterPalette(invertedPalette); -auto* const view__2 = createLogicalGroup(CRect(0, 0, 775, 110), -1, "", kCenterText, 14); -view__0->addView(view__2); -auto* const view__3 = createRoundedGroup(CRect(5, 4, 180, 105), -1, "", kCenterText, 14); -view__2->addView(view__3); -auto* const view__4 = createAboutButton(CRect(27, 5, 147, 65), kTagAbout, "", kCenterText, 14); -view__3->addView(view__4); -auto* const view__5 = createInfoButton(CRect(51, 69, 83, 101), kTagFirstChangePanel+kPanelInfo, "", kCenterText, 30); -panelButtons_[kPanelInfo] = view__5; -view__3->addView(view__5); -auto* const view__6 = createCCButton(CRect(92, 69, 124, 101), kTagFirstChangePanel+kPanelControls, "", kCenterText, 30); -panelButtons_[kPanelControls] = view__6; -view__3->addView(view__6); -auto* const view__7 = createSettingsButton(CRect(132, 69, 164, 101), kTagFirstChangePanel+kPanelSettings, "", kCenterText, 30); -panelButtons_[kPanelSettings] = view__7; -view__3->addView(view__7); -auto* const view__8 = createHomeButton(CRect(11, 69, 43, 101), kTagFirstChangePanel+kPanelGeneral, "", kCenterText, 30); -panelButtons_[kPanelGeneral] = view__8; -view__3->addView(view__8); -auto* const view__9 = createRoundedGroup(CRect(185, 5, 550, 105), -1, "", kCenterText, 14); -view__2->addView(view__9); -auto* const view__10 = createHLine(CRect(10, 35, 355, 40), -1, "", kCenterText, 14); -view__9->addView(view__10); -auto* const view__11 = createHLine(CRect(10, 70, 355, 75), -1, "", kCenterText, 14); -view__9->addView(view__11); -auto* const view__12 = createClickableLabel(CRect(10, 5, 280, 35), kTagLoadSfzFile, "DefaultInstrument.sfz", kLeftText, 20); -sfzFileLabel_ = view__12; -view__9->addView(view__12); -auto* const view__13 = createLabel(CRect(70, 40, 355, 70), -1, "", kLeftText, 20); -keyswitchLabel_ = view__13; -view__9->addView(view__13); -auto* const view__14 = createBadge(CRect(10, 42, 70, 68), -1, "", kCenterText, 20); -keyswitchBadge_ = view__14; -view__9->addView(view__14); -auto* const view__15 = createInactiveLabel(CRect(10, 40, 355, 70), -1, "No key switch", kLeftText, 20); -keyswitchInactiveLabel_ = view__15; -view__9->addView(view__15); -view__15->setVisible(false); -auto* const view__16 = createLabel(CRect(10, 73, 70, 98), -1, "Voices:", kRightText, 14); -view__9->addView(view__16); -auto* const view__17 = createPreviousFileButton(CRect(280, 10, 305, 35), kTagPreviousSfzFile, "", kCenterText, 24); -view__9->addView(view__17); -auto* const view__18 = createNextFileButton(CRect(305, 10, 330, 35), kTagNextSfzFile, "", kCenterText, 24); -view__9->addView(view__18); -auto* const view__19 = createChevronDropDown(CRect(330, 10, 355, 35), kTagFileOperations, "", kCenterText, 24); -fileOperationsMenu_ = view__19; -view__9->addView(view__19); -auto* const view__20 = createLabel(CRect(70, 73, 110, 98), -1, "", kCenterText, 14); -infoVoicesLabel_ = view__20; -view__9->addView(view__20); -auto* const view__21 = createLabel(CRect(130, 73, 170, 98), -1, "Max:", kRightText, 14); -view__9->addView(view__21); -auto* const view__22 = createLabel(CRect(170, 73, 205, 98), -1, "", kCenterText, 14); -numVoicesLabel_ = view__22; -view__9->addView(view__22); -auto* const view__23 = createLabel(CRect(245, 73, 305, 98), -1, "Memory:", kRightText, 14); -view__9->addView(view__23); -auto* const view__24 = createLabel(CRect(305, 73, 355, 98), -1, "", kCenterText, 14); -memoryLabel_ = view__24; -view__9->addView(view__24); -auto* const view__25 = createChevronValueDropDown(CRect(205, 77, 225, 97), kTagSetNumVoices, "", kCenterText, 16); -numVoicesSlider_ = view__25; -view__9->addView(view__25); -auto* const view__26 = createRoundedGroup(CRect(555, 5, 770, 105), -1, "", kCenterText, 14); -view__2->addView(view__26); -auto* const view__27 = createKnob48(CRect(32, 15, 80, 63), -1, "", kCenterText, 14); -view__26->addView(view__27); -view__27->setVisible(false); -auto* const view__28 = createValueLabel(CRect(27, 65, 87, 70), -1, "Center", kCenterText, 14); -view__26->addView(view__28); -view__28->setVisible(false); -auto* const view__29 = createKnobCCBox(CRect(5, 5, 75, 95), kTagSetCCVolume, "Volume", kCenterText, 14); -volumeCCKnob_ = view__29; -view__26->addView(view__29); -auto* const view__30 = createKnobCCBox(CRect(80, 5, 150, 95), kTagSetCCPan, "Pan", kCenterText, 14); -panCCKnob_ = view__30; -view__26->addView(view__30); -auto* const view__31 = createVMeter(CRect(155, 5, 178, 95), -1, "", kCenterText, 14); -meters_[0] = view__31; -view__26->addView(view__31); -auto* const view__32 = createVMeter(CRect(185, 5, 208, 95), -1, "", kCenterText, 14); -meters_[1] = view__32; -view__26->addView(view__32); -enterPalette(defaultPalette); -auto* const view__33 = createLogicalGroup(CRect(0, 110, 775, 445), -1, "", kCenterText, 14); -subPanels_[kPanelInfo] = view__33; -view__0->addView(view__33); -view__33->setVisible(false); -auto* const view__34 = createSquaredTransparentGroup(CRect(0, 0, 775, 335), -1, "", kCenterText, 14); -view__33->addView(view__34); -auto* const view__35 = createInfoLabel(CRect(20, 10, 80, 35), -1, "Curves:", kLeftText, 14); -view__34->addView(view__35); -auto* const view__36 = createInfoLabel(CRect(20, 35, 80, 60), -1, "Masters:", kLeftText, 14); -view__34->addView(view__36); -auto* const view__37 = createInfoLabel(CRect(20, 60, 80, 85), -1, "Groups:", kLeftText, 14); -view__34->addView(view__37); -auto* const view__38 = createInfoLabel(CRect(20, 85, 80, 110), -1, "Regions:", kLeftText, 14); -view__34->addView(view__38); -auto* const view__39 = createInfoLabel(CRect(20, 110, 80, 135), -1, "Samples:", kLeftText, 14); -view__34->addView(view__39); -auto* const view__40 = createInfoLabel(CRect(120, 10, 160, 35), -1, "0", kCenterText, 14); -infoCurvesLabel_ = view__40; -view__34->addView(view__40); -auto* const view__41 = createInfoLabel(CRect(120, 35, 160, 60), -1, "0", kCenterText, 14); -infoMastersLabel_ = view__41; -view__34->addView(view__41); -auto* const view__42 = createInfoLabel(CRect(120, 60, 160, 85), -1, "0", kCenterText, 14); -infoGroupsLabel_ = view__42; -view__34->addView(view__42); -auto* const view__43 = createInfoLabel(CRect(120, 85, 160, 110), -1, "0", kCenterText, 14); -infoRegionsLabel_ = view__43; -view__34->addView(view__43); -auto* const view__44 = createInfoLabel(CRect(120, 110, 160, 135), -1, "0", kCenterText, 14); -infoSamplesLabel_ = view__44; -view__34->addView(view__44); -auto* const view__45 = createLogicalGroup(CRect(0, 110, 775, 445), -1, "", kCenterText, 14); -subPanels_[kPanelControls] = view__45; -view__0->addView(view__45); -view__45->setVisible(false); -auto* const view__46 = createControlsPanel(CRect(0, 0, 775, 335), -1, "", kCenterText, 14); -controlsPanel_ = view__46; -view__45->addView(view__46); -auto* const view__47 = createLogicalGroup(CRect(0, 110, 775, 445), -1, "", kCenterText, 14); -subPanels_[kPanelSettings] = view__47; -view__0->addView(view__47); -auto* const view__48 = createSquaredGroup(CRect(0, 0, 775, 335), -1, "", kCenterText, 14); -view__47->addView(view__48); -auto* const view__49 = createValueMenu(CRect(180, 85, 250, 110), kTagSetOversampling, "", kCenterText, 14); -oversamplingSlider_ = view__49; -view__48->addView(view__49); -auto* const view__50 = createLabel(CRect(10, 85, 95, 110), -1, "Oversampling", kLeftText, 14); -view__48->addView(view__50); -auto* const view__51 = createLabel(CRect(10, 60, 85, 85), -1, "Preload size", kLeftText, 14); -view__48->addView(view__51); -auto* const view__52 = createValueMenu(CRect(180, 60, 250, 85), kTagSetPreloadSize, "", kCenterText, 14); -preloadSizeSlider_ = view__52; -view__48->addView(view__52); -auto* const view__53 = createValueMenu(CRect(430, 35, 510, 60), kTagSetSampleQuality, "", kCenterText, 14); -sampleQualitySlider_ = view__53; -view__48->addView(view__53); -auto* const view__54 = createLabel(CRect(270, 35, 320, 60), -1, "Sample", kLeftText, 14); -view__48->addView(view__54); -auto* const view__55 = createLabel(CRect(270, 85, 330, 110), -1, "Oscillator", kLeftText, 14); -view__48->addView(view__55); -auto* const view__56 = createValueMenu(CRect(430, 85, 510, 110), kTagSetOscillatorQuality, "", kCenterText, 14); -oscillatorQualitySlider_ = view__56; -view__48->addView(view__56); -auto* const view__57 = createOptionMenu(CRect(665, 35, 765, 60), kTagThemeMenu, "", kCenterText, 14); -themeMenu_ = view__57; -view__48->addView(view__57); -auto* const view__58 = createLabel(CRect(525, 35, 570, 60), -1, "Theme", kLeftText, 14); -view__48->addView(view__58); -auto* const view__59 = createLabel(CRect(525, 60, 620, 85), -1, "User SFZ folder", kLeftText, 14); -view__48->addView(view__59); -auto* const view__60 = createValueButton(CRect(665, 60, 765, 85), kTagChooseUserFilesDir, "DefaultPath", kCenterText, 14); -userFilesDirButton_ = view__60; -view__48->addView(view__60); -auto* const view__61 = createLabel(CRect(525, 200, 585, 225), -1, "Root key", kLeftText, 14); -view__48->addView(view__61); -auto* const view__62 = createLabel(CRect(525, 225, 595, 250), -1, "Frequency", kLeftText, 14); -view__48->addView(view__62); -auto* const view__63 = createStyledKnob(CRect(700, 250, 748, 298), kTagSetStretchedTuning, "", kCenterText, 14); -stretchedTuningSlider_ = view__63; -view__48->addView(view__63); -auto* const view__64 = createLabel(CRect(525, 260, 575, 285), -1, "Stretch", kLeftText, 14); -view__48->addView(view__64); -auto* const view__65 = createLabel(CRect(525, 175, 585, 200), -1, "Scala file", kLeftText, 14); -view__48->addView(view__65); -auto* const view__66 = createValueButton(CRect(624, 175, 724, 200), kTagLoadScalaFile, "DefaultScale", kCenterText, 14); -scalaFileButton_ = view__66; -view__48->addView(view__66); -auto* const view__67 = createValueMenu(CRect(685, 200, 720, 225), kTagSetScalaRootKey, "", kCenterText, 14); -scalaRootKeySlider_ = view__67; -view__48->addView(view__67); -auto* const view__68 = createValueMenu(CRect(720, 200, 750, 225), kTagSetScalaRootKey, "", kCenterText, 14); -scalaRootOctaveSlider_ = view__68; -view__48->addView(view__68); -auto* const view__69 = createResetSomethingButton(CRect(725, 175, 750, 200), kTagResetScalaFile, "", kCenterText, 14); -scalaResetButton_ = view__69; -view__48->addView(view__69); -auto* const view__70 = createLabel(CRect(270, 60, 415, 85), -1, "when freewheeling", kLeftText, 14); -view__48->addView(view__70); -auto* const view__71 = createValueMenu(CRect(430, 60, 510, 85), kTagSetFreewheelingSampleQuality, "", kCenterText, 14); -freewheelingSampleQualitySlider_ = view__71; -view__48->addView(view__71); -auto* const view__72 = createLabel(CRect(10, 110, 155, 135), -1, "Sustain cancels release", kLeftText, 14); -view__48->addView(view__72); -auto* const view__73 = createCheckbox(CRect(180, 110, 205, 135), kTagSetSustainCancelsRelease, "", kCenterText, 14); -sustainCancelsReleaseCheckbox_ = view__73; -view__48->addView(view__73); -auto* const view__74 = createLabel(CRect(10, 35, 235, 55), -1, "SFIZZ_VERSION", kCenterText, 14); -sfizzVersionLabel_ = view__74; -view__48->addView(view__74); -auto* const view__75 = createLabel(CRect(270, 5, 380, 30), -1, "Rendering quality", kLeftText, 14); -view__48->addView(view__75); -auto* const view__76 = createHLine(CRect(10, 25, 250, 30), -1, "", kCenterText, 14); -view__48->addView(view__76); -auto* const view__77 = createLabel(CRect(10, 5, 105, 30), -1, "Engine options", kLeftText, 14); -view__48->addView(view__77); -auto* const view__78 = createLabel(CRect(525, 5, 565, 30), -1, "Other", kLeftText, 14); -view__48->addView(view__78); -auto* const view__79 = createLabel(CRect(525, 145, 750, 170), -1, "Tuning", kLeftText, 14); -view__48->addView(view__79); -auto* const view__80 = createHLine(CRect(270, 25, 509, 30), -1, "", kCenterText, 14); -view__48->addView(view__80); -auto* const view__81 = createHLine(CRect(525, 25, 765, 30), -1, "", kCenterText, 14); -view__48->addView(view__81); -auto* const view__82 = createHLine(CRect(525, 165, 750, 170), -1, "", kCenterText, 14); -view__48->addView(view__82); -auto* const view__83 = createChevronValueDropDown(CRect(725, 225, 750, 250), kTagSetTuningFrequency, "", kCenterText, 24); -tuningFrequencyDropdown_ = view__83; -view__48->addView(view__83); -auto* const view__84 = createTextEdit(CRect(665, 225, 725, 250), kTagSetTuningFrequency, "", kCenterText, 14); -tuningFrequencyEdit_ = view__84; -view__48->addView(view__84); -auto* const view__85 = createLabel(CRect(270, 110, 415, 135), -1, "when freewheeling", kLeftText, 14); -view__48->addView(view__85); -auto* const view__86 = createValueMenu(CRect(430, 110, 510, 135), kTagSetFreewheelingOscillatorQuality, "", kCenterText, 14); -freewheelingOscillatorQualitySlider_ = view__86; -view__48->addView(view__86); -auto* const view__87 = createLabel(CRect(525, 85, 620, 110), -1, "Zoom", kLeftText, 14); -view__48->addView(view__87); -auto* const view__88 = createOptionMenu(CRect(665, 85, 765, 110), kTagZoomMenu, "", kCenterText, 14); -zoomMenu_ = view__88; -view__48->addView(view__88); -auto* const view__89 = createValueButton(CRect(665, 110, 765, 135), kTagSetDefaultZoom, "Set Default", kCenterText, 14); -defaultZoomButton_ = view__89; -view__48->addView(view__89); -auto* const view__90 = createPiano(CRect(0, 445, 775, 515), -1, "", kCenterText, 16); -piano_ = view__90; -view__0->addView(view__90); -auto* const view__91 = createLogicalGroup(CRect(0, 110, 775, 445), -1, "", kCenterText, 14); -subPanels_[kPanelGeneral] = view__91; -view__0->addView(view__91); -view__91->setVisible(false); -enterPalette(invertedPalette); -auto* const view__92 = createHoverBox(CRect(5, 105, 175, 130), -1, "", kCenterText, 14); -lblHover_ = view__92; -view__0->addView(view__92); -view__92->setVisible(false); -enterPalette(defaultPalette); diff --git a/plugins/editor/src/editor/utility/vstgui_after.h b/plugins/editor/src/editor/utility/vstgui_after.h deleted file mode 100644 index 69e3b4db9..000000000 --- a/plugins/editor/src/editor/utility/vstgui_after.h +++ /dev/null @@ -1,9 +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 - -#if defined(__GNUC__) -#pragma GCC diagnostic pop -#endif diff --git a/plugins/editor/src/editor/utility/vstgui_before.h b/plugins/editor/src/editor/utility/vstgui_before.h deleted file mode 100644 index 8293e82b7..000000000 --- a/plugins/editor/src/editor/utility/vstgui_before.h +++ /dev/null @@ -1,14 +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 - -#if defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" -#pragma GCC diagnostic ignored "-Wignored-qualifiers" -#pragma GCC diagnostic ignored "-Wdeprecated-copy" -#pragma GCC diagnostic ignored "-Wmultichar" -#pragma GCC diagnostic ignored "-Wextra" -#endif diff --git a/plugins/editor/tools/layout-maker/LICENSE b/plugins/editor/tools/layout-maker/LICENSE deleted file mode 100644 index 36b7cd93c..000000000 --- a/plugins/editor/tools/layout-maker/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -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, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/plugins/editor/tools/layout-maker/README b/plugins/editor/tools/layout-maker/README deleted file mode 100644 index e8402cc3e..000000000 --- a/plugins/editor/tools/layout-maker/README +++ /dev/null @@ -1,2 +0,0 @@ -This purpose of this tool is to accept UI designs make with Fluid, the FLTK -design editor, and convert these designs to music plugin interfaces. diff --git a/plugins/editor/tools/layout-maker/sources/layout.h b/plugins/editor/tools/layout-maker/sources/layout.h deleted file mode 100644 index d68627f5c..000000000 --- a/plugins/editor/tools/layout-maker/sources/layout.h +++ /dev/null @@ -1,50 +0,0 @@ -// -*- C++ -*- -// SPDX-License-Identifier: BSL-1.0 -// -// Copyright Jean Pierre Cimalando 2019-2020. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -#pragma once -#include -#include - -struct LayoutImage { - std::string filepath; - int x = 0; - int y = 0; - int w = 0; - int h = 0; -}; - -struct LayoutItem { - std::string id; - std::string classname; - std::string label; - int x = 0; - int y = 0; - int w = 0; - int h = 0; - std::string box; - std::string down_box; - int labelfont = 0; - int labelsize = 14; - std::string labeltype; - int textsize = 14; - int align = 0; - double value = 0; - double minimum = 0; - double maximum = 0; - double step = 0; - std::string type; - std::string callback; - LayoutImage image; - bool hidden = false; - std::string comment; - std::vector items; -}; - -struct Layout { - std::vector items; -}; diff --git a/plugins/editor/tools/layout-maker/sources/main.cpp b/plugins/editor/tools/layout-maker/sources/main.cpp deleted file mode 100644 index a456ace4e..000000000 --- a/plugins/editor/tools/layout-maker/sources/main.cpp +++ /dev/null @@ -1,190 +0,0 @@ -// -*- C++ -*- -// SPDX-License-Identifier: BSL-1.0 -// -// Copyright Jean Pierre Cimalando 2019-2020. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -#include "layout.h" -#include "reader.h" -#include -#include -#include -#include - -/// -typedef std::unordered_map Metadata; - -static Metadata metadata_from_comment(absl::string_view comment) -{ - Metadata md; - - while (!comment.empty()) { - absl::string_view line; - - size_t pos = comment.find_first_of("\r\n"); - if (pos != comment.npos) { - line = comment.substr(0, pos); - comment.remove_prefix(pos + 1); - } - else { - line = comment; - comment = {}; - } - - line = absl::StripAsciiWhitespace(line); - if (line.empty() || line[0] == '#') - continue; - - std::string key, value; - pos = line.find_first_of('='); - if (pos != comment.npos) { - key = std::string(line.substr(0, pos)); - value = std::string(line.substr(pos + 1)); - } - else - key = std::string(line); - - md.emplace(std::move(key), std::move(value)); - } - - return md; -} - -/// -static std::string cstrQuote(absl::string_view text) -{ - std::string cstr; - cstr.reserve(2 * text.size() + 2); - - cstr.push_back('"'); - - for (char c : text) { - switch (c) { - case '\a' : - cstr.append("\\a"); - break; - case '\b' : - cstr.append("\\b"); - break; - case '\t' : - cstr.append("\\t"); - break; - case '\n' : - cstr.append("\\n"); - break; - case '\v' : - cstr.append("\\v"); - break; - case '\f' : - cstr.append("\\f"); - break; - case '\r' : - cstr.append("\\r"); - break; - case '"': - case '\\': - cstr.push_back('\\'); - cstr.push_back(c); - break; - default: - cstr.push_back(c); - break; - } - } - - cstr.push_back('"'); - return cstr; -} - -/// -static void codegen_item(int& idCounter, int parentId, int parentX, int parentY, const LayoutItem& item, absl::string_view oldPalette) -{ - const Metadata md = metadata_from_comment(item.comment); - - absl::string_view tag = "-1"; - absl::string_view newPalette; - - Metadata::const_iterator it; - it = md.find("tag"); - if (it != md.end()) - tag = it->second; - it = md.find("palette"); - if (it != md.end()) - newPalette = it->second; - - absl::string_view currentPalette = newPalette.empty() ? oldPalette : newPalette; - - int id = idCounter++; - int myX = item.x; - int myY = item.y; - if (parentId == -1) { - myX = 0; - myY = 0; - } - int relX = myX - parentX; - int relY = myY - parentY; - - //std::cout << "// Begin " << id << " " << item.classname << " {" << item.label << "}" << "\n"; - - if (!newPalette.empty()) - std::cout << "enterPalette(" << newPalette << ");\n"; - - absl::string_view label; - if (!item.label.empty() && item.labeltype != "NO_LABEL") - label = item.label; - - absl::string_view align = "kCenterText"; - if (item.align & 4) - align = "kLeftText"; - else if (item.align & 8) - align = "kRightText"; - - std::cout << "auto"/*item.classname*/ << "* const view__" << id << " = create" << item.classname << "(CRect(" << relX << ", " << relY << ", " << (relX + item.w) << ", " << (relY + item.h) << "), " << tag << ", " << cstrQuote(label) << ", " << align << ", " << item.labelsize << ");\n"; - - if (!item.id.empty()) - std::cout << item.id << " = view__" << id << ";\n"; - - if (parentId != -1) - std::cout << "view__" << parentId << "->addView(view__" << id << ");\n"; - - if (item.hidden) - std::cout << "view__" << id << "->setVisible(false);\n"; - - for (const LayoutItem& subItem : item.items) - codegen_item(idCounter, id, myX, myY, subItem, currentPalette); - - if (!newPalette.empty()) - std::cout << "enterPalette(" << oldPalette << ");\n"; - - //std::cout << "// End " << id << " " << item.classname << " {" << item.label << "}" << "\n"; -} - -static void codegen_layout(const LayoutItem& item) -{ - int idCounter = 0; - codegen_item(idCounter, -1, 0, 0, item, "defaultPalette"); -} - -/// -int main(int argc, char *argv[]) -{ - if (argc != 2) { - std::cerr << "Please indicate a fluid design file.\n"; - return 1; - } - - Layout layout = read_file_layout(argv[1]); - - if (layout.items.size() != 1) { - std::cerr << "There must be exactly 1 top level component."; - return 1; - } - - std::cout << "/* This file is generated by the layout maker tool. */\n"; - - codegen_layout(layout.items[0]); - - return 0; -} diff --git a/plugins/editor/tools/layout-maker/sources/reader.cpp b/plugins/editor/tools/layout-maker/sources/reader.cpp deleted file mode 100644 index ab2fbdf80..000000000 --- a/plugins/editor/tools/layout-maker/sources/reader.cpp +++ /dev/null @@ -1,316 +0,0 @@ -// -*- C++ -*- -// SPDX-License-Identifier: BSL-1.0 -// -// Copyright Jean Pierre Cimalando 2019-2020. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -#include "reader.h" -#include -#include -#include - -/// -class tokenizer { -public: - tokenizer( - absl::string_view text, - absl::string_view dropped_delims, - absl::string_view kept_delims); - - absl::string_view next(bool consume); - std::string string_until(char closing, bool consume); - bool at_end() const; - -private: - bool is_dropped(char c) const { - return dropped_delims_.find(c) != dropped_delims_.npos; - } - bool is_kept(char c) const { - return kept_delims_.find(c) != kept_delims_.npos; - } - bool is_delim(char c) const { - return dropped_delims_.find(c) != dropped_delims_.npos || - kept_delims_.find(c) != kept_delims_.npos; - } - -private: - absl::string_view text_; - absl::string_view dropped_delims_; - absl::string_view kept_delims_; -}; - -tokenizer::tokenizer( - absl::string_view text, - absl::string_view dropped_delims, - absl::string_view kept_delims) - : text_(text), dropped_delims_(dropped_delims), kept_delims_(kept_delims) -{ -} - -absl::string_view tokenizer::next(bool consume) -{ - absl::string_view text = text_; - - while (!text.empty() && is_dropped(text[0])) - text.remove_prefix(1); - - if (text.empty()) - return {}; - - size_t pos; - { - auto it = std::find_if(text.begin(), text.end(), [this](char c) -> bool { return is_delim(c); }); - if (it == text.end()) - pos = text.size(); - else { - pos = std::distance(text.begin(), it); - pos += is_kept(text[0]); - } - } - - absl::string_view token = text.substr(0, pos); - if (consume) - text_ = text.substr(pos); - return token; -} - -std::string tokenizer::string_until(char closing, bool consume) -{ - absl::string_view text = text_; - std::string result; - - result.reserve(256); - - for (char c; !text.empty() && - ((c = text[0]), text.remove_prefix(1), c != closing); ) { - if (c != '\\') - result.push_back(c); - else { - if (!text.empty()) { - c = text[0]; - text.remove_prefix(1); - result.push_back(c); - } - } - } - - if (consume) - text_ = text; - return result; -} - -bool tokenizer::at_end() const -{ - absl::string_view text = text_; - - while (!text.empty() && is_dropped(text[0])) - text.remove_prefix(1); - - return text.empty(); -} - -/// -typedef std::vector TokenList; -static bool read_file_lines(const char *filename, std::string &text); -static Layout read_tokens_layout(tokenizer &tkzr); - -Layout read_file_layout(const char *filename) -{ - std::string text; - if (!read_file_lines(filename, text)) - throw std::runtime_error("Cannot read fluid design file."); - - tokenizer tok(text, " \t\r\n", "{}"); - return read_tokens_layout(tok); -} - -static std::string consume_next_token(tokenizer &tkzr) -{ - if (tkzr.at_end()) - throw file_format_error("Premature end of tokens"); - return std::string(tkzr.next(true)); -} - -static bool try_consume_next_token(const char *text, tokenizer &tkzr) -{ - if (tkzr.at_end()) - return false; - - if (tkzr.next(false) != text) - return false; - - tkzr.next(true); - return true; -} - -static void ensure_next_token(const char *text, tokenizer &tkzr) -{ - std::string tok = consume_next_token(tkzr); - if (tok != text) - throw file_format_error("Unexpected token: " + tok); -} - -static std::string consume_any_string(tokenizer &tkzr) -{ - if (!tkzr.at_end() && tkzr.next(false) == "{") { - tkzr.next(true); - return tkzr.string_until('}', true); - } - else - return consume_next_token(tkzr); -} - -static int consume_int_token(tokenizer &tkzr) -{ - std::string text = consume_next_token(tkzr); - return std::stoi(text); -} - -static int consume_real_token(tokenizer &tkzr) -{ - std::string text = consume_next_token(tkzr); - return std::stod(text); -} - -static void consume_layout_item_properties(LayoutItem &item, tokenizer &tkzr) -{ - ensure_next_token("{", tkzr); - for (bool have = true; have;) { - if (try_consume_next_token("open", tkzr)) - ; // skip - else if (try_consume_next_token("selected", tkzr)) - ; // skip - else if (try_consume_next_token("label", tkzr)) - item.label = consume_any_string(tkzr); - else if (try_consume_next_token("xywh", tkzr)) { - ensure_next_token("{", tkzr); - item.x = consume_int_token(tkzr); - item.y = consume_int_token(tkzr); - item.w = consume_int_token(tkzr); - item.h = consume_int_token(tkzr); - ensure_next_token("}", tkzr); - } - else if (try_consume_next_token("box", tkzr)) - item.box = consume_next_token(tkzr); - else if (try_consume_next_token("down_box", tkzr)) - item.down_box = consume_next_token(tkzr); - else if (try_consume_next_token("labelfont", tkzr)) - item.labelfont = consume_int_token(tkzr); - else if (try_consume_next_token("labelsize", tkzr)) - item.labelsize = consume_int_token(tkzr); - else if (try_consume_next_token("labeltype", tkzr)) - item.labeltype = consume_any_string(tkzr); - else if (try_consume_next_token("textsize", tkzr)) - item.textsize = consume_int_token(tkzr); - else if (try_consume_next_token("align", tkzr)) - item.align = consume_int_token(tkzr); - else if (try_consume_next_token("type", tkzr)) - item.type = consume_any_string(tkzr); - else if (try_consume_next_token("callback", tkzr)) - item.callback = consume_any_string(tkzr); - else if (try_consume_next_token("class", tkzr)) - item.classname = consume_any_string(tkzr); - else if (try_consume_next_token("value", tkzr)) - item.value = consume_real_token(tkzr); - else if (try_consume_next_token("minimum", tkzr)) - item.minimum = consume_real_token(tkzr); - else if (try_consume_next_token("maximum", tkzr)) - item.maximum = consume_real_token(tkzr); - else if (try_consume_next_token("step", tkzr)) - item.step = consume_real_token(tkzr); - else if (try_consume_next_token("image", tkzr)) - item.image.filepath = consume_any_string(tkzr); - else if (try_consume_next_token("hide", tkzr)) - item.hidden = true; - else if (try_consume_next_token("visible", tkzr)) - /* skip */; - else if (try_consume_next_token("comment", tkzr)) - item.comment = consume_any_string(tkzr); - else - have = false; - } - ensure_next_token("}", tkzr); -} - -static LayoutItem consume_layout_item(const std::string &classname, tokenizer &tkzr, bool anonymous = false) -{ - LayoutItem item; - item.classname = classname; - if (!anonymous) - item.id = consume_any_string(tkzr); - consume_layout_item_properties(item, tkzr); - if (!tkzr.at_end() && tkzr.next(false) == "{") { - consume_next_token(tkzr); - for (std::string text; (text = consume_next_token(tkzr)) != "}";) { - if (text == "decl") { - consume_any_string(tkzr); - consume_any_string(tkzr); - } - else if (text == "Function") { - consume_any_string(tkzr); - consume_any_string(tkzr); - consume_any_string(tkzr); - } - else - item.items.push_back(consume_layout_item(text, tkzr)); - } - } - return item; -} - -static Layout read_tokens_layout(tokenizer &tkzr) -{ - Layout layout; - - std::string version_name; - std::string header_name; - std::string code_name; - - while (!tkzr.at_end()) { - std::string key = consume_next_token(tkzr); - - if (key == "version") - version_name = consume_next_token(tkzr); - else if (key == "header_name") { - ensure_next_token("{", tkzr); - header_name = consume_next_token(tkzr); - ensure_next_token("}", tkzr); - } - else if (key == "code_name") { - ensure_next_token("{", tkzr); - code_name = consume_next_token(tkzr); - ensure_next_token("}", tkzr); - } - else if (key == "decl") { - consume_any_string(tkzr); - consume_any_string(tkzr); - } - else if (key == "widget_class") { - key = consume_next_token(tkzr); - layout.items.push_back(consume_layout_item(key, tkzr, true)); - layout.items.back().id = key; - } - else - layout.items.push_back(consume_layout_item(key, tkzr)); - } - - return layout; -} - -/// -static bool read_file_lines(const char *filename, std::string &text) -{ - std::ifstream stream(filename); - std::string line; - - while (std::getline(stream, line)) { - if (!line.empty() && line[0] != '#') { - text.append(line); - text.push_back('\n'); - } - } - - return !stream.bad(); -} diff --git a/plugins/editor/tools/layout-maker/sources/reader.h b/plugins/editor/tools/layout-maker/sources/reader.h deleted file mode 100644 index 3dc6b4ba7..000000000 --- a/plugins/editor/tools/layout-maker/sources/reader.h +++ /dev/null @@ -1,21 +0,0 @@ -// -*- C++ -*- -// SPDX-License-Identifier: BSL-1.0 -// -// Copyright Jean Pierre Cimalando 2019-2020. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -#pragma once -#include "layout.h" -#include -#include - -Layout read_file_layout(const char *filename); - -/// -struct file_format_error : public std::runtime_error { -public: - explicit file_format_error(const std::string &reason = "Format error") - : runtime_error(reason) {} -}; diff --git a/plugins/lv2/CMakeLists.txt b/plugins/lv2/CMakeLists.txt deleted file mode 100644 index 13dfe3e09..000000000 --- a/plugins/lv2/CMakeLists.txt +++ /dev/null @@ -1,145 +0,0 @@ -set(LV2PLUGIN_PRJ_NAME "${PROJECT_NAME}_lv2") - -# Set the build directory as /lv2/.lv2/ -set(PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.lv2") - -# LV2 plugin specific settings -include(LV2Config) - -# Keep non build turtle files in IDE -set(LV2PLUGIN_TTL_SRC_FILES - manifest.ttl.in - ${PROJECT_NAME}.ttl.in -) -if(SFIZZ_LV2_UI) - list(APPEND LV2PLUGIN_TTL_SRC_FILES - ${PROJECT_NAME}_ui.ttl.in) -endif() -source_group("Turtle Files" FILES - ${LV2PLUGIN_TTL_SRC_FILES} -) -add_library(${LV2PLUGIN_PRJ_NAME} MODULE - ${PROJECT_NAME}.cpp - ${PROJECT_NAME}_lv2_common.cpp - ${LV2PLUGIN_TTL_SRC_FILES}) -target_link_libraries(${LV2PLUGIN_PRJ_NAME} PRIVATE sfizz::sfizz sfizz::import sfizz::plugins-common) - -if(SFIZZ_LV2_UI) - add_library(${LV2PLUGIN_PRJ_NAME}_ui MODULE - ${PROJECT_NAME}_ui.cpp - ${PROJECT_NAME}_lv2_common.cpp - vstgui_helpers.h - vstgui_helpers.cpp) - target_link_libraries(${LV2PLUGIN_PRJ_NAME}_ui PRIVATE sfizz::editor sfizz::vstgui sfizz::plugins-common) -endif() - -if(SFIZZ_LV2_PSA) - target_compile_definitions(${LV2PLUGIN_PRJ_NAME} PRIVATE "SFIZZ_LV2_PSA=1") - if(SFIZZ_LV2_UI) - target_compile_definitions(${LV2PLUGIN_PRJ_NAME}_ui PRIVATE "SFIZZ_LV2_PSA=1") - endif() -endif() - -# Explicitely strip all symbols on Linux but lv2_descriptor() -# MacOS linker does not support this apparently https://bugs.webkit.org/show_bug.cgi?id=144555 -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - target_link_libraries(${LV2PLUGIN_PRJ_NAME} PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/lv2.version") - # target_link_libraries(${LV2PLUGIN_PRJ_NAME} "-Wl,-u,lv2_descriptor") - if(SFIZZ_LV2_UI) - target_link_libraries(${LV2PLUGIN_PRJ_NAME}_ui PRIVATE "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/lv2ui.version") - # target_link_libraries(${LV2PLUGIN_PRJ_NAME}_ui "-Wl,-u,lv2ui_descriptor") - endif() -endif() - -target_include_directories(${LV2PLUGIN_PRJ_NAME} PRIVATE . external/ardour) -if(SFIZZ_USE_SYSTEM_LV2) - find_path(LV2_INCLUDE_DIR "lv2.h") - if(NOT LV2_INCLUDE_DIR) - message(FATAL_ERROR "Cannot find lv2 include directory") - else() - message(STATUS "Found system lv2") - endif() -else() - target_include_directories(${LV2PLUGIN_PRJ_NAME} PRIVATE vendor) -endif() -sfizz_enable_lto_if_needed(${LV2PLUGIN_PRJ_NAME}) -if(MINGW) - set_target_properties(${LV2PLUGIN_PRJ_NAME} PROPERTIES LINK_FLAGS "-static") -endif() - -if(SFIZZ_LV2_UI) - target_include_directories(${LV2PLUGIN_PRJ_NAME}_ui PRIVATE . external/ardour) - if(NOT SFIZZ_USE_SYSTEM_LV2) - target_include_directories(${LV2PLUGIN_PRJ_NAME}_ui PRIVATE vendor) - endif() - sfizz_enable_lto_if_needed(${LV2PLUGIN_PRJ_NAME}_ui) - if(MINGW) - set_target_properties(${LV2PLUGIN_PRJ_NAME}_ui PROPERTIES LINK_FLAGS "-static") - endif() -endif() - -# Define a preprocessor variable to indicate a build with UI enabled -if(SFIZZ_LV2_UI) - target_compile_definitions(${LV2PLUGIN_PRJ_NAME} PRIVATE "SFIZZ_LV2_UI=1") - target_compile_definitions(${LV2PLUGIN_PRJ_NAME}_ui PRIVATE "SFIZZ_LV2_UI=1") -endif() - -# Remove the "lib" prefix, rename the target name and build it in the .lv build dir -# /lv2/_lv2. to -# /lv2/.lv2/. -set_target_properties(${LV2PLUGIN_PRJ_NAME} PROPERTIES PREFIX "") -set_target_properties(${LV2PLUGIN_PRJ_NAME} PROPERTIES OUTPUT_NAME "${PROJECT_NAME}") -set_target_properties(${LV2PLUGIN_PRJ_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Contents/Binary/$<0:>") - -if(SFIZZ_LV2_UI) - set_target_properties(${LV2PLUGIN_PRJ_NAME}_ui PROPERTIES PREFIX "") - set_target_properties(${LV2PLUGIN_PRJ_NAME}_ui PROPERTIES OUTPUT_NAME "${PROJECT_NAME}_ui") - set_target_properties(${LV2PLUGIN_PRJ_NAME}_ui PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/Contents/Binary/$<0:>") -endif() - -# Generate *.ttl files from *.in sources, -# create the destination directory if it doesn't exists and copy needed files -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}) -configure_file(manifest.ttl.in ${PROJECT_BINARY_DIR}/manifest.ttl) -configure_file(${PROJECT_NAME}.ttl.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.ttl) -if(SFIZZ_LV2_UI) - configure_file(${PROJECT_NAME}_ui.ttl.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}_ui.ttl) -endif() -configure_file(LICENSE.md.in ${PROJECT_BINARY_DIR}/LICENSE.md) - -# Generate controllers.ttl -sfizz_lv2_generate_controllers_ttl("${PROJECT_BINARY_DIR}/controllers.ttl") - -# Copy resource files into the bundle -set(LV2_RESOURCES - DefaultInstrument.sfz - DefaultScale.scl) -execute_process( - COMMAND "${CMAKE_COMMAND}" -E make_directory "${PROJECT_BINARY_DIR}/Contents/Resources") -foreach(res ${LV2_RESOURCES}) - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/resources/${res}" - DESTINATION "${PROJECT_BINARY_DIR}/Contents/Resources") -endforeach() - -# Copy editor resources -if(SFIZZ_LV2_UI) - execute_process( - COMMAND "${CMAKE_COMMAND}" -E make_directory "${PROJECT_BINARY_DIR}/Contents/Resources") - copy_editor_resources( - ${LV2PLUGIN_PRJ_NAME}_ui - "${CMAKE_CURRENT_SOURCE_DIR}/../editor/resources" - "${PROJECT_BINARY_DIR}/Contents/Resources") -endif() - -# Installation -if(NOT MSVC) - install(DIRECTORY ${PROJECT_BINARY_DIR} DESTINATION ${LV2PLUGIN_INSTALL_DIR} - COMPONENT "lv2" - USE_SOURCE_PERMISSIONS) - bundle_dylibs(lv2 - "${LV2PLUGIN_INSTALL_DIR}/${PROJECT_NAME}.lv2/Contents/Binary/sfizz.so" - COMPONENT "lv2") - bundle_dylibs(lv2-ui - "${LV2PLUGIN_INSTALL_DIR}/${PROJECT_NAME}.lv2/Contents/Binary/sfizz_ui.so" - COMPONENT "lv2") -endif() diff --git a/plugins/lv2/LICENSE.md.in b/plugins/lv2/LICENSE.md.in deleted file mode 100644 index 1d0b134e9..000000000 --- a/plugins/lv2/LICENSE.md.in +++ /dev/null @@ -1,12 +0,0 @@ -Most of the code in the plug comes from various examples in the LV2 distribution and -example plugins. As such, the source code of the LV2 plugin version of `sfizz` is -distributed under the same terms as the LV2 specification, which is the ISC license. -Check the LICENSE.md at (@LV2PLUGIN_REPOSITORY@) file for more -information about the license of the source code of the `sfizz` library and its -contributors. - -The `sfizz` LV2 plugin can be optionally statically built against `libsndfile` -from Erik de Castro Lopo (http://www.mega-nerd.com/libsndfile). `libsndfile` -is distributed under the terms of the LGPL v2 or v3. If you distribute a -statically-linked LV2 version of `sfizz` built against `libsndfile`, you need -to respect the terms of the LGPL v2 or v3 license. diff --git a/plugins/lv2/external/ardour/ardour/lv2_extensions.h b/plugins/lv2/external/ardour/ardour/lv2_extensions.h deleted file mode 100644 index fde2934e4..000000000 --- a/plugins/lv2/external/ardour/ardour/lv2_extensions.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - Copyright 2016 Robin Gareus - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#ifndef _ardour_lv2_extensions_h_ -#define _ardour_lv2_extensions_h_ - -#include - -/** - @defgroup lv2inlinedisplay Inline-Display - - Support for displaying a miniaturized generic view - directly in the host's Mixer Window. - - @{ -*/ - -#define LV2_INLINEDISPLAY_URI "http://harrisonconsoles.com/lv2/inlinedisplay" -#define LV2_INLINEDISPLAY_PREFIX LV2_INLINEDISPLAY_URI "#" -#define LV2_INLINEDISPLAY__interface LV2_INLINEDISPLAY_PREFIX "interface" -#define LV2_INLINEDISPLAY__queue_draw LV2_INLINEDISPLAY_PREFIX "queue_draw" -#define LV2_INLINEDISPLAY__in_gui LV2_INLINEDISPLAY_PREFIX "in_gui" - -/** Opaque handle for LV2_Inline_Display::queue_draw() */ -typedef void* LV2_Inline_Display_Handle; - -/** raw image pixmap format is ARGB32, - * the data pointer is owned by the plugin and must be valid - * from the first call to render until cleanup. - */ -typedef struct { - unsigned char *data; - int width; - int height; - int stride; -} LV2_Inline_Display_Image_Surface; - -/** a LV2 Feature provided by the Host to the plugin */ -typedef struct { - /** Opaque host data */ - LV2_Inline_Display_Handle handle; - /** Request from run() that the host should call render() at a later time - * to update the inline display */ - void (*queue_draw)(LV2_Inline_Display_Handle handle); -} LV2_Inline_Display; - -/** - * Plugin Inline-Display Interface. - */ -typedef struct { - /** - * The render method. This is called by the host in a non-realtime context, - * usually the main GUI thread. - * The data pointer is owned by the plugin and must be valid - * from the first call to render until cleanup. - * - * @param instance The LV2 instance - * @param w the max available width - * @param h the max available height - * @return pointer to a LV2_Inline_Display_Image_Surface or NULL - */ - LV2_Inline_Display_Image_Surface* (*render)(LV2_Handle instance, uint32_t w, uint32_t h); -} LV2_Inline_Display_Interface; - -/** - @} -*/ - -/** - @defgroup lv2automate Self-Automation - - Support for plugins to write automation data via Atom Events - - @{ -*/ - -#define LV2_AUTOMATE_URI "http://ardour.org/lv2/automate" -#define LV2_AUTOMATE_URI_PREFIX LV2_AUTOMATE_URI "#" -/** an lv2:optionalFeature */ -#define LV2_AUTOMATE_URI__can_write LV2_AUTOMATE_URI_PREFIX "canWriteAutomatation" -/** atom:supports */ -#define LV2_AUTOMATE_URI__control LV2_AUTOMATE_URI_PREFIX "automationControl" -/** lv2:portProperty */ -#define LV2_AUTOMATE_URI__controlled LV2_AUTOMATE_URI_PREFIX "automationControlled" -#define LV2_AUTOMATE_URI__controller LV2_AUTOMATE_URI_PREFIX "automationController" - -/** atom messages */ -#define LV2_AUTOMATE_URI__event LV2_AUTOMATE_URI_PREFIX "event" -#define LV2_AUTOMATE_URI__setup LV2_AUTOMATE_URI_PREFIX "setup" -#define LV2_AUTOMATE_URI__finalize LV2_AUTOMATE_URI_PREFIX "finalize" -#define LV2_AUTOMATE_URI__start LV2_AUTOMATE_URI_PREFIX "start" -#define LV2_AUTOMATE_URI__end LV2_AUTOMATE_URI_PREFIX "end" -#define LV2_AUTOMATE_URI__parameter LV2_AUTOMATE_URI_PREFIX "parameter" -#define LV2_AUTOMATE_URI__value LV2_AUTOMATE_URI_PREFIX "value" - -/** - @} -*/ - -/** - @defgroup lv2license License-Report - - Allow for commercial LV2 to report their - licensing status. - - @{ -*/ - -#define LV2_PLUGINLICENSE_URI "http://harrisonconsoles.com/lv2/license" -#define LV2_PLUGINLICENSE_PREFIX LV2_PLUGINLICENSE_URI "#" -#define LV2_PLUGINLICENSE__interface LV2_PLUGINLICENSE_PREFIX "interface" -#define LV2_PLUGINLICENSE__interface2 LV2_PLUGINLICENSE_PREFIX "interface2" - - -typedef struct _LV2_License_Interface { - /* @return -1 if no license is needed; 0 if unlicensed, 1 if licensed */ - int (*is_licensed)(LV2_Handle instance); - /* @return a string copy of the licensee name if licensed, or NULL, the caller needs to free this */ - char* (*licensee)(LV2_Handle instance); - /* @return a URI identifying the plugin-bundle or plugin for which a given license is valid */ - const char* (*product_uri)(LV2_Handle instance); - /* @return human readable product name for the URI */ - const char* (*product_name)(LV2_Handle instance); - /* @return link to website or webstore */ - const char* (*store_url)(LV2_Handle instance); - /* interface2 ext: preferred location to install the license file, the caller needs to free this */ - char* (*preferred_license_file_path)(LV2_Handle instance); - /* interface2 ext: currently used license file (if any, may be NULL), the caller needs to free this */ - char* (*current_license_file_path)(LV2_Handle instance); - /* interface2 ext: free() allocated strings (licensee, license_file_paths) */ - void (*free)(char*); -} LV2_License_Interface; - -/** - @} -*/ - -/** - @defgroup lv2bypass Plugin-provided bypass - - A port with the designation "processing#enable" must - control a plugin's internal bypass mode. - - If the port value is larger than zero the plugin processes - normally. - - If the port value is zero, the plugin is expected to bypass - all signals unmodified. - - The plugin is responsible for providing a click-free transition - between the states. - - (values less than zero are reserved for future use: - e.g click-free insert/removal of latent plugins. - Generally values <= 0 are to be treated as bypassed.) - - lv2:designation ; - - @{ -*/ - -#define LV2_PROCESSING_URI "http://ardour.org/lv2/processing" -#define LV2_PROCESSING_URI_PREFIX LV2_PROCESSING_URI "#" -#define LV2_PROCESSING_URI__enable LV2_PROCESSING_URI_PREFIX "enable" - -/** - @} -*/ - - -/** - @defgroup lv2routing plugin port/routing control - - This is a "feature" to simplify per port meta-data of - http://lv2plug.in/ns/ext/port-groups/port-groups.html#source - - Plugins using this feature provide a strong hint that the host - should always connect all audio output-ports. - - This allows mono->stereo plugins to override strict_io rules. - - @{ -*/ - -#define LV2_ROUTING_URI "http://harrisonconsoles.com/lv2/routing" -#define LV2_ROUTING_PREFIX LV2_ROUTING_URI "#" -#define LV2_ROUTING__connectAllOutputs LV2_ROUTING_PREFIX "connectAllOutputs" - -/** - @} -*/ - -/** - @defgroup lv2midnam MIDI Naming - - @{ -*/ - - -#define LV2_MIDNAM_URI "http://ardour.org/lv2/midnam" -#define LV2_MIDNAM_PREFIX LV2_MIDNAM_URI "#" -#define LV2_MIDNAM__interface LV2_MIDNAM_PREFIX "interface" -#define LV2_MIDNAM__update LV2_MIDNAM_PREFIX "update" - -typedef void* LV2_Midnam_Handle; - -/** a LV2 Feature provided by the Host to the plugin */ -typedef struct { - /** Opaque host data */ - LV2_Midnam_Handle handle; - /** Request from run() that the host should re-read the midnam */ - void (*update)(LV2_Midnam_Handle handle); -} LV2_Midnam; - -typedef struct { - /** Query midnam document. The plugin - * is expected to return a null-terminated XML - * text which is a valid midnam desciption - * (or NULL in case of error). - * - * The midnam \ must be unique and - * specific for the given plugin-instance. - */ - char* (*midnam)(LV2_Handle instance); - - /** The unique model id used ith the midnam, - * (or NULL). - */ - char* (*model)(LV2_Handle instance); - - /** free allocated strings. The host - * calls this for every value returned by - * \ref midnam and \ref model. - */ - void (*free)(char*); -} LV2_Midnam_Interface; - -/** - @} -*/ - -/** - @defgroup lv2bankpatch MIDI Bank/Patch Notifications - - LV2 extension to allow a synth to inform a host about the - currentl used MIDI bank/program. - - @{ -*/ - - -#define LV2_BANKPATCH_URI "http://ardour.org/lv2/bankpatch" -#define LV2_BANKPATCH_PREFIX LV2_BANKPATCH_URI "#" -#define LV2_BANKPATCH__notify LV2_BANKPATCH_PREFIX "notify" - -typedef void* LV2_BankPatch_Handle; - -/** a LV2 Feature provided by the Host to the plugin */ -typedef struct { - /** Opaque host data */ - LV2_BankPatch_Handle handle; - /** Info from plugin's run(), notify host that bank/program changed */ - void (*notify)(LV2_BankPatch_Handle handle, uint8_t channel, uint32_t bank, uint8_t pgm); -} LV2_BankPatch; - -/** - @} -*/ -#endif diff --git a/plugins/lv2/lv2.version b/plugins/lv2/lv2.version deleted file mode 100644 index 5ac53645f..000000000 --- a/plugins/lv2/lv2.version +++ /dev/null @@ -1,4 +0,0 @@ -LV2ABI_1.0 { - global: *lv2_descriptor*; - local: *; -}; diff --git a/plugins/lv2/lv2ui.version b/plugins/lv2/lv2ui.version deleted file mode 100644 index 95c55e1b7..000000000 --- a/plugins/lv2/lv2ui.version +++ /dev/null @@ -1,4 +0,0 @@ -LV2UIABI_1.0 { - global: *lv2ui_descriptor*; - local: *; -}; diff --git a/plugins/lv2/manifest.ttl.in b/plugins/lv2/manifest.ttl.in deleted file mode 100644 index 37305afd3..000000000 --- a/plugins/lv2/manifest.ttl.in +++ /dev/null @@ -1,18 +0,0 @@ -@prefix lv2: . -@prefix rdfs: . -@prefix ui: . - -<@LV2PLUGIN_URI@> - a lv2:Plugin ; - lv2:binary ; - rdfs:seeAlso <@PROJECT_NAME@.ttl>, . - -<@LV2PLUGIN_URI@-multi> - a lv2:Plugin ; - lv2:binary ; - rdfs:seeAlso <@PROJECT_NAME@.ttl>, . - -@LV2PLUGIN_IF_ENABLE_UI@<@LV2PLUGIN_URI@#ui> -@LV2PLUGIN_IF_ENABLE_UI@ a ui:@LV2_UI_TYPE@ ; -@LV2PLUGIN_IF_ENABLE_UI@ ui:binary ; -@LV2PLUGIN_IF_ENABLE_UI@ rdfs:seeAlso <@PROJECT_NAME@_ui.ttl> . diff --git a/plugins/lv2/resources/DefaultInstrument.sfz b/plugins/lv2/resources/DefaultInstrument.sfz deleted file mode 100644 index 5f82f9c24..000000000 --- a/plugins/lv2/resources/DefaultInstrument.sfz +++ /dev/null @@ -1,3 +0,0 @@ - -sample=*sine -ampeg_attack=0.02 ampeg_release=0.1 diff --git a/plugins/lv2/resources/DefaultScale.scl b/plugins/lv2/resources/DefaultScale.scl deleted file mode 100644 index 081422f02..000000000 --- a/plugins/lv2/resources/DefaultScale.scl +++ /dev/null @@ -1,14 +0,0 @@ -Equal temperament -12 -100.0 -200.0 -300.0 -400.0 -500.0 -600.0 -700.0 -800.0 -900.0 -1000.0 -1100.0 -1200.0 diff --git a/plugins/lv2/sfizz.cpp b/plugins/lv2/sfizz.cpp deleted file mode 100644 index ea7bbae53..000000000 --- a/plugins/lv2/sfizz.cpp +++ /dev/null @@ -1,1978 +0,0 @@ -/* - SPDX-License-Identifier: ISC - - Sfizz LV2 plugin - - Copyright 2019-2020, Paul Ferrand - - This file was based on skeleton and example code from the LV2 plugin - distribution available at http://lv2plug.in/ - - The LV2 sample plugins have the following copyright and notice, which are - extended to the current work: - Copyright 2011-2016 David Robillard - Copyright 2011 Gabriel M. Beddingfield - Copyright 2011 James Morris - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - Compiling this plugin statically against libsndfile implies distributing it - under the terms of the LGPL v3 license. See the LICENSE.md file for more - information. If you did not receive a LICENSE.md file, inform the current - maintainer. - - THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "sfizz_lv2.h" -#include "sfizz_lv2_plugin.h" - -#include "sfizz/import/sfizz_import.h" -#include "plugin/InstrumentDescription.h" - -#include -#include -#include - -#include - -#define CHANNEL_MASK 0x0F -#define MIDI_CHANNEL(byte) (byte & CHANNEL_MASK) -#define MIDI_STATUS(byte) (byte & ~CHANNEL_MASK) -#define PITCH_BUILD_AND_CENTER(first_byte, last_byte) (int)(((unsigned int)last_byte << 7) + (unsigned int)first_byte) - 8192 -#define MAX_BLOCK_SIZE 8192 -#define MAX_VOICES 256 -#define DEFAULT_VOICES 64 -#define DEFAULT_OVERSAMPLING SFIZZ_OVERSAMPLING_X1 -#define DEFAULT_PRELOAD 8192 -#define LOG_SAMPLE_COUNT 48000 -#define UNUSED(x) (void)(x) - -#ifndef NDEBUG -#define LV2_DEBUG(...) lv2_log_note(&self->logger, "[DEBUG] " __VA_ARGS__) -#else -#define LV2_DEBUG(...) -#endif - -enum -{ - SFIZZ_TIMEINFO_POSITION = 1 << 0, - SFIZZ_TIMEINFO_SIGNATURE = 1 << 1, - SFIZZ_TIMEINFO_TEMPO = 1 << 2, - SFIZZ_TIMEINFO_SPEED = 1 << 3, -}; - -/// -static bool -sfizz_lv2_load_file(sfizz_plugin_t *self, const char *file_path); - -static bool -sfizz_lv2_load_scala_file(sfizz_plugin_t *self, const char *file_path); - -/// -static void -sfizz_lv2_state_free_path(LV2_State_Free_Path_Handle handle, - char *path) -{ - (void)handle; - free(path); -} - -static LV2_State_Free_Path sfizz_State_Free_Path = -{ - NULL, - &sfizz_lv2_state_free_path, -}; - -static void -sfizz_lv2_map_required_uris(sfizz_plugin_t *self) -{ - LV2_URID_Map *map = self->map; - self->midi_event_uri = map->map(map->handle, LV2_MIDI__MidiEvent); - self->max_block_length_uri = map->map(map->handle, LV2_BUF_SIZE__maxBlockLength); - self->nominal_block_length_uri = map->map(map->handle, LV2_BUF_SIZE__nominalBlockLength); - self->sample_rate_uri = map->map(map->handle, LV2_PARAMETERS__sampleRate); - self->atom_float_uri = map->map(map->handle, LV2_ATOM__Float); - self->atom_double_uri = map->map(map->handle, LV2_ATOM__Double); - self->atom_int_uri = map->map(map->handle, LV2_ATOM__Int); - self->atom_long_uri = map->map(map->handle, LV2_ATOM__Long); - self->atom_path_uri = map->map(map->handle, LV2_ATOM__Path); - self->atom_urid_uri = map->map(map->handle, LV2_ATOM__URID); - self->atom_object_uri = map->map(map->handle, LV2_ATOM__Object); - self->atom_blank_uri = map->map(map->handle, LV2_ATOM__Blank); - self->patch_set_uri = map->map(map->handle, LV2_PATCH__Set); - self->patch_get_uri = map->map(map->handle, LV2_PATCH__Get); - self->patch_put_uri = map->map(map->handle, LV2_PATCH__Put); - self->patch_body_uri = map->map(map->handle, LV2_PATCH__body); - self->patch_property_uri = map->map(map->handle, LV2_PATCH__property); - self->patch_value_uri = map->map(map->handle, LV2_PATCH__value); - self->state_changed_uri = map->map(map->handle, LV2_STATE__StateChanged); - self->sfizz_sfz_file_uri = map->map(map->handle, SFIZZ__sfzFile); - self->sfizz_scala_file_uri = map->map(map->handle, SFIZZ__tuningfile); - self->sfizz_description_uri = map->map(map->handle, SFIZZ__description); - self->sfizz_num_voices_uri = map->map(map->handle, SFIZZ__numVoices); - self->sfizz_preload_size_uri = map->map(map->handle, SFIZZ__preloadSize); - self->sfizz_oversampling_uri = map->map(map->handle, SFIZZ__oversampling); - self->sfizz_last_keyswitch_uri = map->map(map->handle, SFIZZ__lastKeyswitch); - self->sfizz_log_status_uri = map->map(map->handle, SFIZZ__logStatus); - self->sfizz_check_modification_uri = map->map(map->handle, SFIZZ__checkModification); - self->sfizz_osc_blob_uri = map->map(map->handle, SFIZZ__OSCBlob); - self->sfizz_notify_uri = map->map(map->handle, SFIZZ__Notify); - self->sfizz_audio_level_uri = map->map(map->handle, SFIZZ__AudioLevel); - self->time_position_uri = map->map(map->handle, LV2_TIME__Position); - self->time_bar_uri = map->map(map->handle, LV2_TIME__bar); - self->time_bar_beat_uri = map->map(map->handle, LV2_TIME__barBeat); - self->time_beat_unit_uri = map->map(map->handle, LV2_TIME__beatUnit); - self->time_beats_per_bar_uri = map->map(map->handle, LV2_TIME__beatsPerBar); - self->time_beats_per_minute_uri = map->map(map->handle, LV2_TIME__beatsPerMinute); - self->time_speed_uri = map->map(map->handle, LV2_TIME__speed); -} - -static bool -sfizz_atom_extract_real(sfizz_plugin_t *self, const LV2_Atom *atom, double *real) -{ - if (!atom) - return false; - - const LV2_URID type = atom->type; - - if (type == self->atom_int_uri && atom->size >= sizeof(int32_t)) { - *real = ((const LV2_Atom_Int *)atom)->body; - return true; - } - if (type == self->atom_long_uri && atom->size >= sizeof(int64_t)) { - *real = ((const LV2_Atom_Long *)atom)->body; - return true; - } - if (type == self->atom_float_uri && atom->size >= sizeof(float)) { - *real = ((const LV2_Atom_Float *)atom)->body; - return true; - } - if (type == self->atom_double_uri && atom->size >= sizeof(double)) { - *real = ((const LV2_Atom_Double *)atom)->body; - return true; - } - - return false; -} - -static bool -sfizz_atom_extract_integer(sfizz_plugin_t *self, const LV2_Atom *atom, int64_t *integer) -{ - if (!atom) - return false; - - const LV2_URID type = atom->type; - - if (type == self->atom_int_uri && atom->size >= sizeof(int32_t)) { - *integer = ((const LV2_Atom_Int *)atom)->body; - return true; - } - if (type == self->atom_long_uri && atom->size >= sizeof(int64_t)) { - *integer = ((const LV2_Atom_Long *)atom)->body; - return true; - } - if (type == self->atom_float_uri && atom->size >= sizeof(float)) { - *integer = (int64_t)((const LV2_Atom_Float *)atom)->body; - return true; - } - if (type == self->atom_double_uri && atom->size >= sizeof(double)) { - *integer = (int64_t)((const LV2_Atom_Double *)atom)->body; - return true; - } - - return false; -} - -static void -connect_port_stereo(LV2_Handle instance, - uint32_t port, - void *data) -{ - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - switch (port) - { - case SFIZZ_CONTROL: - self->control_port = (const LV2_Atom_Sequence *)data; - break; - case SFIZZ_AUTOMATE: - self->automate_port = (LV2_Atom_Sequence *)data; - break; - case SFIZZ_LEFT: - self->output_buffers[0] = (float *)data; - break; - case SFIZZ_RIGHT: - self->output_buffers[1] = (float *)data; - break; - case SFIZZ_VOLUME: - self->volume_port = (const float *)data; - break; - case SFIZZ_POLYPHONY: - self->polyphony_port = (const float *)data; - break; - case SFIZZ_OVERSAMPLING: - self->oversampling_port = (const float *)data; - break; - case SFIZZ_PRELOAD: - self->preload_port = (const float *)data; - break; - case SFIZZ_FREEWHEELING: - self->freewheel_port = (const float *)data; - break; - case SFIZZ_SCALA_ROOT_KEY: - self->scala_root_key_port = (const float *)data; - break; - case SFIZZ_TUNING_FREQUENCY: - self->tuning_frequency_port = (const float *)data; - break; - case SFIZZ_STRETCH_TUNING: - self->stretch_tuning_port = (const float *)data; - break; - case SFIZZ_SAMPLE_QUALITY: - self->sample_quality_port = (const float *)data; - break; - case SFIZZ_OSCILLATOR_QUALITY: - self->oscillator_quality_port = (const float *)data; - break; - case SFIZZ_ACTIVE_VOICES: - self->active_voices_port = (float *)data; - break; - case SFIZZ_NUM_CURVES: - self->num_curves_port = (float *)data; - break; - case SFIZZ_NUM_MASTERS: - self->num_masters_port = (float *)data; - break; - case SFIZZ_NUM_GROUPS: - self->num_groups_port = (float *)data; - break; - case SFIZZ_NUM_REGIONS: - self->num_regions_port = (float *)data; - break; - case SFIZZ_NUM_SAMPLES: - self->num_samples_port = (float *)data; - break; - case SFIZZ_FREEWHEELING_SAMPLE_QUALITY: - self->freewheeling_sample_quality_port = (const float *)data; - break; - case SFIZZ_FREEWHEELING_OSCILLATOR_QUALITY: - self->freewheeling_oscillator_quality_port = (const float *)data; - break; - case SFIZZ_SUSTAIN_CANCELS_RELEASE: - self->sustain_cancels_release_port = (const float *)data; - break; - default: - break; - } -} - -static void -connect_port_multi(LV2_Handle instance, - uint32_t port, - void *data) -{ - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - switch (port) - { - case SFIZZ_MULTI_CONTROL: - self->control_port = (const LV2_Atom_Sequence *)data; - break; - case SFIZZ_MULTI_AUTOMATE: - self->automate_port = (LV2_Atom_Sequence *)data; - break; - case SFIZZ_MULTI_OUT1L: - self->output_buffers[0] = (float *)data; - break; - case SFIZZ_MULTI_OUT1R: - self->output_buffers[1] = (float *)data; - break; - case SFIZZ_MULTI_OUT2L: - self->output_buffers[2] = (float *)data; - break; - case SFIZZ_MULTI_OUT2R: - self->output_buffers[3] = (float *)data; - break; - case SFIZZ_MULTI_OUT3L: - self->output_buffers[4] = (float *)data; - break; - case SFIZZ_MULTI_OUT3R: - self->output_buffers[5] = (float *)data; - break; - case SFIZZ_MULTI_OUT4L: - self->output_buffers[6] = (float *)data; - break; - case SFIZZ_MULTI_OUT4R: - self->output_buffers[7] = (float *)data; - break; - case SFIZZ_MULTI_OUT5L: - self->output_buffers[8] = (float *)data; - break; - case SFIZZ_MULTI_OUT5R: - self->output_buffers[9] = (float *)data; - break; - case SFIZZ_MULTI_OUT6L: - self->output_buffers[10] = (float *)data; - break; - case SFIZZ_MULTI_OUT6R: - self->output_buffers[11] = (float *)data; - break; - case SFIZZ_MULTI_OUT7L: - self->output_buffers[12] = (float *)data; - break; - case SFIZZ_MULTI_OUT7R: - self->output_buffers[13] = (float *)data; - break; - case SFIZZ_MULTI_OUT8L: - self->output_buffers[14] = (float *)data; - break; - case SFIZZ_MULTI_OUT8R: - self->output_buffers[15] = (float *)data; - break; - case SFIZZ_MULTI_VOLUME: - self->volume_port = (const float *)data; - break; - case SFIZZ_MULTI_POLYPHONY: - self->polyphony_port = (const float *)data; - break; - case SFIZZ_MULTI_OVERSAMPLING: - self->oversampling_port = (const float *)data; - break; - case SFIZZ_MULTI_PRELOAD: - self->preload_port = (const float *)data; - break; - case SFIZZ_MULTI_FREEWHEELING: - self->freewheel_port = (const float *)data; - break; - case SFIZZ_MULTI_SCALA_ROOT_KEY: - self->scala_root_key_port = (const float *)data; - break; - case SFIZZ_MULTI_TUNING_FREQUENCY: - self->tuning_frequency_port = (const float *)data; - break; - case SFIZZ_MULTI_STRETCH_TUNING: - self->stretch_tuning_port = (const float *)data; - break; - case SFIZZ_MULTI_SAMPLE_QUALITY: - self->sample_quality_port = (const float *)data; - break; - case SFIZZ_MULTI_OSCILLATOR_QUALITY: - self->oscillator_quality_port = (const float *)data; - break; - case SFIZZ_MULTI_ACTIVE_VOICES: - self->active_voices_port = (float *)data; - break; - case SFIZZ_MULTI_NUM_CURVES: - self->num_curves_port = (float *)data; - break; - case SFIZZ_MULTI_NUM_MASTERS: - self->num_masters_port = (float *)data; - break; - case SFIZZ_MULTI_NUM_GROUPS: - self->num_groups_port = (float *)data; - break; - case SFIZZ_MULTI_NUM_REGIONS: - self->num_regions_port = (float *)data; - break; - case SFIZZ_MULTI_NUM_SAMPLES: - self->num_samples_port = (float *)data; - break; - case SFIZZ_MULTI_FREEWHEELING_SAMPLE_QUALITY: - self->freewheeling_sample_quality_port = (const float *)data; - break; - case SFIZZ_MULTI_FREEWHEELING_OSCILLATOR_QUALITY: - self->freewheeling_oscillator_quality_port = (const float *)data; - break; - case SFIZZ_MULTI_SUSTAIN_CANCELS_RELEASE: - self->sustain_cancels_release_port = (const float *)data; - break; - default: - break; - } -} - -static void -connect_port(LV2_Handle instance, - uint32_t port, - void *data) -{ - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - if (self->multi_out) - connect_port_multi(instance, port, data); - else - connect_port_stereo(instance, port, data); -} - -// This function sets the sample rate in the self parameter but does not update it. -static void -sfizz_lv2_parse_sample_rate(sfizz_plugin_t* self, const LV2_Options_Option* opt) -{ - if (opt->type == self->atom_float_uri) - { - // self->sample_rate = *(float*)opt->value; - LV2_DEBUG("Attempted to change the sample rate to %.2f (original was %.2f); ignored", - *(float*)opt->value, - self->sample_rate); - } - else if (opt->type == self->atom_int_uri) - { - // self->sample_rate = *(int*)opt->value; - LV2_DEBUG("Attempted to change the sample rate to %d (original was %.2f); ignored", - *(int*)opt->value, - self->sample_rate); - } - else - { - lv2_log_warning(&self->logger, "[sfizz] Got a sample rate but could not resolve the type of the atom\n"); - if (self->unmap) - lv2_log_warning(&self->logger, - "[sfizz] Atom URI: %s\n", - self->unmap->unmap(self->unmap->handle, opt->type)); - } -} - -static void -sfizz_lv2_get_default_sfz_path(sfizz_plugin_t *self, char *path, size_t size) -{ - snprintf(path, size, "%s/%s", self->bundle_path, DEFAULT_SFZ_FILE); -} - -static void -sfizz_lv2_get_default_scala_path(sfizz_plugin_t *self, char *path, size_t size) -{ - snprintf(path, size, "%s/%s", self->bundle_path, DEFAULT_SCALA_FILE); -} - -static void -sfizz_lv2_update_timeinfo(sfizz_plugin_t *self, int delay, int updates) -{ - if (updates & SFIZZ_TIMEINFO_POSITION) - sfizz_send_time_position(self->synth, delay, self->bar, self->bar_beat); - if (updates & SFIZZ_TIMEINFO_SIGNATURE) - sfizz_send_time_signature(self->synth, delay, self->beats_per_bar, self->beat_unit); - if (updates & SFIZZ_TIMEINFO_TEMPO) - sfizz_send_bpm_tempo(self->synth, delay, self->bpm_tempo); - if (updates & SFIZZ_TIMEINFO_SPEED) - sfizz_send_playback_state(self->synth, delay, self->speed > 0); -} - -static void -sfizz_lv2_receive_message(void* data, int delay, const char* path, const char* sig, const sfizz_arg_t* args) -{ - (void)delay; - - sfizz_plugin_t *self = (sfizz_plugin_t *)data; - - if (!strcmp(path, "/sw/last/current") && sig) - { - if (sig[0] == 'i') - self->last_keyswitch = args[0].i; - else if (sig[0] == 'N') - self->last_keyswitch = -1; - } - - // transmit to UI as OSC blob - uint8_t *osc_temp = self->osc_temp; - uint32_t osc_size = sfizz_prepare_message(osc_temp, OSC_TEMP_SIZE, path, sig, args); - if (osc_size > OSC_TEMP_SIZE) - return; - - LV2_Atom_Forge* forge = &self->forge_automate; - bool write_ok = - lv2_atom_forge_frame_time(forge, 0) && - lv2_atom_forge_atom(forge, osc_size, self->sfizz_osc_blob_uri) && - lv2_atom_forge_raw(forge, osc_temp, osc_size); - if (write_ok) - lv2_atom_forge_pad(forge, osc_size); - - (void)write_ok; -} - -static LV2_Handle -instantiate(const LV2_Descriptor *descriptor, - double rate, - const char *bundle_path, - const LV2_Feature *const *features) -{ - UNUSED(descriptor); - LV2_Options_Option *options = NULL; - bool supports_bounded_block_size = false; - bool options_has_block_size = false; - bool supports_fixed_block_size = false; - - // Allocate and initialise instance structure. - sfizz_plugin_t *self = new sfizz_plugin_t; - if (!self) - return NULL; - - strncpy(self->bundle_path, bundle_path, MAX_BUNDLE_PATH_SIZE); - self->bundle_path[MAX_BUNDLE_PATH_SIZE - 1] = '\0'; - - // Set defaults - self->multi_out = !strcmp(descriptor->URI, SFIZZ_MULTI_URI); - self->max_block_size = MAX_BLOCK_SIZE; - self->sample_rate = (float)rate; - self->expect_nominal_block_length = false; - self->sfz_file_path[0] = '\0'; - self->scala_file_path[0] = '\0'; - self->num_voices = DEFAULT_VOICES; - self->oversampling = DEFAULT_OVERSAMPLING; - self->preload_size = DEFAULT_PRELOAD; - self->stretch_tuning = 0.0f; - self->check_modification = false; - self->sample_counter = 0; - - // Initial timing - self->bar = 0; - self->bar_beat = 0; - self->beats_per_bar = 4; - self->beat_unit = 4; - self->bpm_tempo = 120; - self->speed = 1; - - // Get the features from the host and populate the structure - for (const LV2_Feature *const *f = features; *f; f++) - { - const char *uri = (**f).URI; - void *data = (**f).data; - - // lv2_log_note(&self->logger, "Feature URI: %s\n", (**f).URI); - - if (!strcmp(uri, LV2_URID__map)) - self->map = (LV2_URID_Map *)data; - - if (!strcmp(uri, LV2_URID__unmap)) - self->unmap = (LV2_URID_Unmap *)data; - - if (!strcmp(uri, LV2_BUF_SIZE__boundedBlockLength)) - supports_bounded_block_size = true; - - if (!strcmp(uri, LV2_BUF_SIZE__fixedBlockLength)) - supports_fixed_block_size = true; - - if (!strcmp(uri, LV2_OPTIONS__options)) - options = (LV2_Options_Option *)data; - - if (!strcmp(uri, LV2_WORKER__schedule)) - self->worker = (LV2_Worker_Schedule *)data; - - if (!strcmp(uri, LV2_LOG__log)) - self->log = (LV2_Log_Log *)data; - - if (!strcmp(uri, LV2_MIDNAM__update)) - self->midnam = (LV2_Midnam *)data; - } - - // Setup the loggers - lv2_log_logger_init(&self->logger, self->map, self->log); - - // The map feature is required - if (!self->map) - { - lv2_log_error(&self->logger, "Map feature not found, aborting..\n"); - delete self; - return NULL; - } - - // The worker feature is required - if (!self->worker) - { - lv2_log_error(&self->logger, "Worker feature not found, aborting..\n"); - delete self; - return NULL; - } - - // Map the URIs we will need - sfizz_lv2_map_required_uris(self); - - // Initialize the forge - lv2_atom_forge_init(&self->forge_automate, self->map); - lv2_atom_forge_init(&self->forge_secondary, self->map); - - // Check the options for the block size and sample rate parameters - if (options) - { - for (const LV2_Options_Option *opt = options; opt->key || opt->value; ++opt) - { - if (opt->key == self->sample_rate_uri) - { - sfizz_lv2_parse_sample_rate(self, opt); - } - else if (!self->expect_nominal_block_length && opt->key == self->max_block_length_uri) - { - if (opt->type != self->atom_int_uri) - { - lv2_log_warning(&self->logger, "Got a max block size but the type was wrong\n"); - continue; - } - self->max_block_size = *(int *)opt->value; - options_has_block_size = true; - } - else if (opt->key == self->nominal_block_length_uri) - { - if (opt->type != self->atom_int_uri) - { - lv2_log_warning(&self->logger, "Got a nominal block size but the type was wrong\n"); - continue; - } - self->max_block_size = *(int *)opt->value; - self->expect_nominal_block_length = true; - options_has_block_size = true; - } - } - } - else - { - lv2_log_warning(&self->logger, - "No option array was given upon instantiation; will use default values.\n"); - } - - // We need _some_ information on the block size - if (!supports_bounded_block_size && !supports_fixed_block_size && !options_has_block_size) - { - lv2_log_error(&self->logger, - "Bounded block size not supported and options gave no block size, aborting..\n"); - delete self; - return NULL; - } - - self->ccmap = sfizz_lv2_ccmap_create(self->map); - self->cc_current = new float[sfz::config::numCCs](); - - self->synth = sfizz_create_synth(); - self->client = sfizz_create_client(self); - self->synth_mutex = spin_mutex_create(); - sfizz_set_broadcast_callback(self->synth, &sfizz_lv2_receive_message, self); - sfizz_set_receive_callback(self->client, &sfizz_lv2_receive_message); - - self->sfz_blob_mutex = new std::mutex; - - sfizz_lv2_load_file(self, self->sfz_file_path); - sfizz_lv2_load_scala_file(self, self->scala_file_path); - - sfizz_lv2_update_timeinfo(self, 0, ~0); - - self->text_description[0] = 0; - self->resend_description = false; - -#if defined(SFIZZ_LV2_UI) - if (self->multi_out) - self->rms_follower.setNumOutputs(MULTI_OUTPUT_COUNT); - else - self->rms_follower.setNumOutputs(2); -#endif - - return (LV2_Handle)self; -} - -static void -cleanup(LV2_Handle instance) -{ - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - delete[] self->sfz_blob_data; - delete self->sfz_blob_mutex; - spin_mutex_destroy(self->synth_mutex); - sfizz_delete_client(self->client); - sfizz_free(self->synth); - delete[] self->cc_current; - sfizz_lv2_ccmap_free(self->ccmap); - delete self; -} - -static void -activate(LV2_Handle instance) -{ - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - sfizz_set_samples_per_block(self->synth, self->max_block_size); - sfizz_set_sample_rate(self->synth, self->sample_rate); - self->must_update_midnam.store(1); -#if defined(SFIZZ_LV2_UI) - self->rms_follower.init(self->sample_rate); -#endif -} - -static void -deactivate(LV2_Handle instance) -{ - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - sfizz_all_sound_off(self->synth); -} - -static void -sfizz_lv2_send_file_path(sfizz_plugin_t *self, LV2_URID verb_uri, LV2_URID urid, const char *path) -{ - LV2_Atom_Forge_Frame frame; - - LV2_Atom_Forge* forge = &self->forge_automate; - bool write_ok = - lv2_atom_forge_frame_time(forge, 0) && - lv2_atom_forge_object(forge, &frame, 0, verb_uri) && - lv2_atom_forge_key(forge, self->patch_property_uri) && - lv2_atom_forge_urid(forge, urid) && - lv2_atom_forge_key(forge, self->patch_value_uri) && - lv2_atom_forge_path(forge, path, (uint32_t)strlen(path)); - - if (write_ok) - lv2_atom_forge_pop(forge, &frame); -} - -static void -sfizz_lv2_send_instrument_description(sfizz_plugin_t *self) -{ - LV2_Atom_Forge_Frame frame; - LV2_Atom_Forge* forge = &self->forge_automate; - - bool write_ok = - lv2_atom_forge_frame_time(forge, 0) && - lv2_atom_forge_object(forge, &frame, 0, self->patch_set_uri) && - lv2_atom_forge_key(forge, self->patch_property_uri) && - lv2_atom_forge_urid(forge, self->sfizz_description_uri) && - lv2_atom_forge_key(forge, self->patch_value_uri) && - lv2_atom_forge_string(forge, self->text_description, - (uint32_t)strnlen(self->text_description, sizeof(self->text_description))); - - if (write_ok) - lv2_atom_forge_pop(forge, &frame); -} - -static void -sfizz_lv2_send_controller(sfizz_plugin_t *self, LV2_URID verb_uri, unsigned cc, float value) -{ - LV2_URID urid = sfizz_lv2_ccmap_map(self->ccmap, int(cc)); - LV2_Atom_Forge_Frame frame; - - LV2_Atom_Forge* forge = &self->forge_automate; - bool write_ok = - lv2_atom_forge_frame_time(forge, 0) && - lv2_atom_forge_object(forge, &frame, 0, verb_uri) && - lv2_atom_forge_key(forge, self->patch_property_uri) && - lv2_atom_forge_urid(forge, urid) && - lv2_atom_forge_key(forge, self->patch_value_uri) && - lv2_atom_forge_float(forge, value); - - if (write_ok) - lv2_atom_forge_pop(forge, &frame); -} - -#if defined(SFIZZ_LV2_UI) -static void -sfizz_lv2_send_levels(sfizz_plugin_t *self, const float* levels, uint32_t num_levels) -{ - LV2_Atom_Forge* forge = &self->forge_automate; - bool write_ok = lv2_atom_forge_frame_time(forge, 0); - - LV2_Atom_Vector *vector = nullptr; - if (write_ok) { - LV2_Atom_Forge_Ref ref = lv2_atom_forge_vector(forge, sizeof(float), self->atom_float_uri, num_levels, levels); - write_ok = ref; - if (write_ok) - vector = (LV2_Atom_Vector *)lv2_atom_forge_deref(forge, ref); - } - - if (write_ok) - vector->atom.type = self->sfizz_audio_level_uri; - - (void)write_ok; -} -#endif - -static void -sfizz_lv2_handle_atom_object(sfizz_plugin_t *self, int delay, const LV2_Atom_Object *obj) -{ - const LV2_Atom *property = NULL; - lv2_atom_object_get(obj, self->patch_property_uri, &property, 0); - if (!property) - { - lv2_log_error(&self->logger, - "[sfizz] Could not get the property from the patch object, aborting\n"); - return; - } - - if (property->type != self->atom_urid_uri) - { - lv2_log_error(&self->logger, - "[sfizz] Atom type was not a URID, aborting\n"); - return; - } - - const uint32_t key = ((const LV2_Atom_URID *)property)->body; - const LV2_Atom *atom = NULL; - lv2_atom_object_get(obj, self->patch_value_uri, &atom, 0); - if (!atom) - { - lv2_log_error(&self->logger, "[sfizz] Error retrieving the atom, aborting\n"); - if (self->unmap) - lv2_log_warning(&self->logger, - "Atom URI: %s\n", - self->unmap->unmap(self->unmap->handle, key)); - return; - } - - typedef struct - { - LV2_Atom atom; - char body[MAX_PATH_SIZE]; - } sfizz_path_atom_buffer_t; - - int cc = sfizz_lv2_ccmap_unmap(self->ccmap, key); - if (cc != -1) { - if (atom->type == self->atom_float_uri && atom->size == sizeof(float)) { - float value = *(const float *)LV2_ATOM_BODY_CONST(atom); - sfizz_automate_hdcc(self->synth, delay, cc, value); - self->cc_current[cc] = value; - } - } - else if (key == self->sfizz_sfz_file_uri) - { - LV2_Atom_Forge *forge = &self->forge_secondary; - sfizz_path_atom_buffer_t buffer; - lv2_atom_forge_set_buffer(forge, (uint8_t *)&buffer, sizeof(buffer)); - const char *body = (const char *)LV2_ATOM_BODY_CONST(atom); - uint32_t size = (uint32_t)strnlen(body, atom->size); - if (lv2_atom_forge_typed_string(forge, self->sfizz_sfz_file_uri, body, size)) - self->worker->schedule_work(self->worker->handle, lv2_atom_total_size(&buffer.atom), &buffer.atom); - self->check_modification = false; - } - else if (key == self->sfizz_scala_file_uri) - { - LV2_Atom_Forge *forge = &self->forge_secondary; - sfizz_path_atom_buffer_t buffer; - lv2_atom_forge_set_buffer(forge, (uint8_t *)&buffer, sizeof(buffer)); - const char *body = (const char *)LV2_ATOM_BODY_CONST(atom); - uint32_t size = (uint32_t)strnlen(body, atom->size); - if (lv2_atom_forge_typed_string(forge, self->sfizz_scala_file_uri, body, size)) - self->worker->schedule_work(self->worker->handle, lv2_atom_total_size(&buffer.atom), &buffer.atom); - self->check_modification = false; - } - else - { - lv2_log_warning(&self->logger, "[sfizz] Unknown or unsupported object\n"); - if (self->unmap) - lv2_log_warning(&self->logger, - "Object URI: %s\n", - self->unmap->unmap(self->unmap->handle, key)); - return; - } -} - -static void -sfizz_lv2_process_midi_event(sfizz_plugin_t *self, const LV2_Atom_Event *ev) -{ - const uint8_t *const msg = (const uint8_t *)(ev + 1); - switch (lv2_midi_message_type(msg)) - { - case LV2_MIDI_MSG_NOTE_ON: - if (msg[2] == 0) - goto noteoff; // 0 velocity note-ons should be forbidden but just in case... - - sfizz_send_note_on(self->synth, - (int)ev->time.frames, - (int)msg[1], - msg[2]); - break; - case LV2_MIDI_MSG_NOTE_OFF: noteoff: - sfizz_send_note_off(self->synth, - (int)ev->time.frames, - (int)msg[1], - msg[2]); - break; - case LV2_MIDI_MSG_CONTROLLER: - { - unsigned cc = msg[1]; - float value = float(msg[2]) * (1.0f / 127.0f); - -// Note(jpc) CC must be mapped by host, not handled here. -// See LV2 midi:binding. -#if defined(SFIZZ_LV2_PSA) - switch (cc) - { - default: - { - sfizz_automate_hdcc(self->synth, - (int)ev->time.frames, - (int)cc, - value); - self->cc_current[cc] = value; - } - break; - case LV2_MIDI_CTL_ALL_NOTES_OFF: - // TODO implemented as all-sound-off - sfizz_all_sound_off(self->synth); - break; - case LV2_MIDI_CTL_ALL_SOUNDS_OFF: - sfizz_all_sound_off(self->synth); - break; - } -#endif - } - break; - case LV2_MIDI_MSG_CHANNEL_PRESSURE: - sfizz_send_channel_aftertouch(self->synth, - (int)ev->time.frames, - msg[1]); - break; - case LV2_MIDI_MSG_NOTE_PRESSURE: - sfizz_send_poly_aftertouch(self->synth, - (int)ev->time.frames, - (int)msg[1], - msg[2]); - break; - case LV2_MIDI_MSG_BENDER: - sfizz_send_pitch_wheel(self->synth, - (int)ev->time.frames, - PITCH_BUILD_AND_CENTER(msg[1], msg[2])); - break; - case LV2_MIDI_MSG_PGM_CHANGE: - sfizz_send_program_change(self->synth, - (int)ev->time.frames, - msg[1]); - break; - default: - break; - } -} - -static void -sfizz_lv2_status_log(sfizz_plugin_t *self) -{ - UNUSED(self); - // lv2_log_note(&self->logger, "[sfizz] Allocated buffers: %d\n", sfizz_get_num_buffers(self->synth)); - // lv2_log_note(&self->logger, "[sfizz] Allocated bytes: %d bytes\n", sfizz_get_num_bytes(self->synth)); - // lv2_log_note(&self->logger, "[sfizz] Active voices: %d\n", sfizz_get_num_active_voices(self->synth)); -} - -static int next_pow_2(int v) -{ - if (v < 1) - return 1; - - // Bit twiddling hack - v--; - v |= v >> 1; - v |= v >> 2; - v |= v >> 4; - v |= v >> 8; - v |= v >> 16; - v++; - return v; -} - -static void -sfizz_lv2_check_oversampling(sfizz_plugin_t* self) -{ - int port_value = next_pow_2((int)*self->oversampling_port); - if (port_value == (int)self->oversampling) - return; - - self->oversampling = (sfizz_oversampling_factor_t)port_value; - - LV2_Atom_Int atom; - atom.atom.type = self->sfizz_oversampling_uri; - atom.atom.size = sizeof(int); - atom.body = self->oversampling; - if (self->worker->schedule_work(self->worker->handle, - lv2_atom_total_size((LV2_Atom *)&atom), - &atom) != LV2_WORKER_SUCCESS) - { - lv2_log_error(&self->logger, "[sfizz] There was an issue changing the oversampling factor\n"); - } -} - -static void -sfizz_lv2_check_preload_size(sfizz_plugin_t* self) -{ - unsigned int preload_size = (int)*self->preload_port; - if (preload_size != self->preload_size) - { - LV2_Atom_Int atom; - atom.atom.type = self->sfizz_preload_size_uri; - atom.atom.size = sizeof(int); - atom.body = preload_size; - if (self->worker->schedule_work(self->worker->handle, - lv2_atom_total_size((LV2_Atom *)&atom), - &atom) != LV2_WORKER_SUCCESS) - { - lv2_log_error(&self->logger, "[sfizz] There was an issue changing the preload size\n"); - } - self->preload_size = preload_size; - } -} - -static void -sfizz_lv2_check_num_voices(sfizz_plugin_t* self) -{ - int num_voices = (int)*self->polyphony_port; - if (num_voices != self->num_voices) - { - LV2_Atom_Int atom; - atom.atom.type = self->sfizz_num_voices_uri; - atom.atom.size = sizeof(int); - atom.body = num_voices; - if (self->worker->schedule_work(self->worker->handle, - lv2_atom_total_size((LV2_Atom *)&atom), - &atom) != LV2_WORKER_SUCCESS) - { - lv2_log_error(&self->logger, "[sfizz] There was an issue changing the number of voices\n"); - } - self->num_voices = num_voices; - } -} - -static void -sfizz_lv2_check_freewheeling(sfizz_plugin_t* self) -{ - if (*(self->freewheel_port) > 0) - { - sfizz_enable_freewheeling(self->synth); - } - else - { - sfizz_disable_freewheeling(self->synth); - } -} - -static void -sfizz_lv2_check_stretch_tuning(sfizz_plugin_t* self) -{ - float stretch_tuning = (float)*self->stretch_tuning_port; - if (stretch_tuning != self->stretch_tuning) - { - sfizz_load_stretch_tuning_by_ratio(self->synth, stretch_tuning); - self->stretch_tuning = stretch_tuning; - } -} - -static void -run(LV2_Handle instance, uint32_t sample_count) -{ - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - assert(self->control_port && self->automate_port); - - if (!spin_mutex_trylock(self->synth_mutex)) - { - for (int channel = 0; channel < 2; ++channel) - memset(self->output_buffers[channel], 0, sample_count * sizeof(float)); - return; - } - - // Set up dedicated forges to write on their respective ports. - const size_t automate_capacity = self->automate_port->atom.size; - lv2_atom_forge_set_buffer(&self->forge_automate, (uint8_t *)self->automate_port, automate_capacity); - - // Start sequences in the respective output ports. - LV2_Atom_Forge_Frame automate_frame; - if (!lv2_atom_forge_sequence_head(&self->forge_automate, &automate_frame, 0)) - assert(false); - - LV2_ATOM_SEQUENCE_FOREACH(self->control_port, ev) - { - const int delay = (int)ev->time.frames; - - // If the received atom is an object/patch message - if (ev->body.type == self->atom_object_uri || ev->body.type == self->atom_blank_uri) - { - const LV2_Atom_Object *obj = (const LV2_Atom_Object *)&ev->body; - - if (obj->body.otype == self->patch_set_uri) - { - sfizz_lv2_handle_atom_object(self, delay, obj); - } - else if (obj->body.otype == self->patch_get_uri) - { - const LV2_Atom_URID *property = NULL; - lv2_atom_object_get(obj, self->patch_property_uri, &property, 0); - if (!property) // Send the full state - { - sfizz_lv2_send_file_path(self, self->sfizz_notify_uri, self->sfizz_sfz_file_uri, self->sfz_file_path); - sfizz_lv2_send_file_path(self, self->sfizz_notify_uri, self->sfizz_scala_file_uri, self->scala_file_path); - - for (unsigned cc = 0; cc < sfz::config::numCCs; ++cc) - sfizz_lv2_send_controller(self, self->sfizz_notify_uri, cc, self->cc_current[cc]); - - sfizz_lv2_send_instrument_description(self); - } - else if (property->body == self->sfizz_sfz_file_uri) - { - sfizz_lv2_send_file_path(self, self->sfizz_notify_uri, self->sfizz_sfz_file_uri, self->sfz_file_path); - } - else if (property->body == self->sfizz_scala_file_uri) - { - sfizz_lv2_send_file_path(self, self->sfizz_notify_uri, self->sfizz_scala_file_uri, self->scala_file_path); - } - else if (property->body == self->sfizz_description_uri) - { - sfizz_lv2_send_instrument_description(self); - } - else - { - int cc = sfizz_lv2_ccmap_unmap(self->ccmap, property->body); - if (cc != -1) - sfizz_lv2_send_controller(self, self->sfizz_notify_uri, unsigned(cc), self->cc_current[cc]); - } - } - else if (obj->body.otype == self->time_position_uri) - { - const LV2_Atom *bar_atom = NULL; - const LV2_Atom *bar_beat_atom = NULL; - const LV2_Atom *beat_unit_atom = NULL; - const LV2_Atom *beats_per_bar_atom = NULL; - const LV2_Atom *beats_per_minute_atom = NULL; - const LV2_Atom *speed_atom = NULL; - - lv2_atom_object_get( - obj, - self->time_bar_uri, &bar_atom, - self->time_bar_beat_uri, &bar_beat_atom, - self->time_beats_per_bar_uri, &beats_per_bar_atom, - self->time_beats_per_minute_uri, &beats_per_minute_atom, - self->time_beat_unit_uri, &beat_unit_atom, - self->time_speed_uri, &speed_atom, - 0); - - int updates = 0; - - int64_t bar; - double bar_beat; - if (sfizz_atom_extract_integer(self, bar_atom, &bar)) { - self->bar = (int)bar; - updates |= SFIZZ_TIMEINFO_POSITION; - } - if (sfizz_atom_extract_real(self, bar_beat_atom, &bar_beat)) { - self->bar_beat = (float)bar_beat; - updates |= SFIZZ_TIMEINFO_POSITION; - } - - double beats_per_bar; - int64_t beat_unit; - if (sfizz_atom_extract_real(self, beats_per_bar_atom, &beats_per_bar)) { - self->beats_per_bar = (int)beats_per_bar; - updates |= SFIZZ_TIMEINFO_SIGNATURE; - } - if (sfizz_atom_extract_integer(self, beat_unit_atom, &beat_unit)) { - self->beat_unit = (int)beat_unit; - updates |= SFIZZ_TIMEINFO_SIGNATURE; - } - - double tempo; - if (sfizz_atom_extract_real(self, beats_per_minute_atom, &tempo)) { - self->bpm_tempo = (float)tempo; - updates |= SFIZZ_TIMEINFO_TEMPO; - } - - double speed; - if (sfizz_atom_extract_real(self, speed_atom, &speed)) { - self->speed = (float)speed; - updates |= SFIZZ_TIMEINFO_SPEED; - } - - sfizz_lv2_update_timeinfo(self, delay, updates); - } - else - { - lv2_log_warning(&self->logger, "[sfizz] Got an Object atom but it was not supported\n"); - if (self->unmap) - lv2_log_warning(&self->logger, - "Object URI: %s\n", - self->unmap->unmap(self->unmap->handle, obj->body.otype)); - continue; - } - } - else if (ev->body.type == self->midi_event_uri) - { - // Got an atom that is a MIDI event - sfizz_lv2_process_midi_event(self, ev); - } - else if (ev->body.type == self->sfizz_osc_blob_uri) - { - // Got an atom that is a OSC event - const char *path; - const char *sig; - const sfizz_arg_t *args; - uint8_t buffer[1024]; - if (sfizz_extract_message(LV2_ATOM_BODY_CONST(&ev->body), ev->body.size, buffer, sizeof(buffer), &path, &sig, &args) > 0) - sfizz_send_message(self->synth, self->client, (int)ev->time.frames, path, sig, args); - } - } - - - // Check and update parameters if needed - sfizz_lv2_check_freewheeling(self); - sfizz_set_volume(self->synth, *(self->volume_port)); - sfizz_set_scala_root_key(self->synth, *(self->scala_root_key_port)); - sfizz_set_tuning_frequency(self->synth, *(self->tuning_frequency_port)); - sfizz_set_sample_quality(self->synth, SFIZZ_PROCESS_LIVE, (int)(*self->sample_quality_port)); - sfizz_set_oscillator_quality(self->synth, SFIZZ_PROCESS_LIVE, (int)(*self->oscillator_quality_port)); - sfizz_set_sample_quality(self->synth, SFIZZ_PROCESS_FREEWHEELING, (int)(*self->freewheeling_sample_quality_port)); - sfizz_set_oscillator_quality(self->synth, SFIZZ_PROCESS_FREEWHEELING, (int)(*self->freewheeling_oscillator_quality_port)); - sfizz_set_sustain_cancels_release(self->synth, (*self->sustain_cancels_release_port > 0.0f)); - sfizz_lv2_check_stretch_tuning(self); - sfizz_lv2_check_preload_size(self); - sfizz_lv2_check_oversampling(self); - sfizz_lv2_check_num_voices(self); - *(self->active_voices_port) = sfizz_get_num_active_voices(self->synth); - *(self->num_curves_port) = sfizz_get_num_curves(self->synth); - *(self->num_masters_port) = sfizz_get_num_masters(self->synth); - *(self->num_groups_port) = sfizz_get_num_groups(self->synth); - *(self->num_regions_port) = sfizz_get_num_regions(self->synth); - *(self->num_samples_port) = sfizz_get_num_preloaded_samples(self->synth); - if (self->resend_description) { - sfizz_lv2_send_instrument_description(self); - self->resend_description = false; - } - - // Log the buffer usage - self->sample_counter += (int)sample_count; - if (self->sample_counter > LOG_SAMPLE_COUNT && self->check_modification) - { - LV2_Atom atom; - atom.size = 0; -#ifndef NDEBUG - atom.type = self->sfizz_log_status_uri; - if (!(self->worker->schedule_work(self->worker->handle, - lv2_atom_total_size((LV2_Atom *)&atom), - &atom) == LV2_WORKER_SUCCESS)) - { - lv2_log_error(&self->logger, "[sfizz] There was an issue sending a logging message to the background worker\n"); - } -#endif - atom.type = self->sfizz_check_modification_uri; - if ((self->worker->schedule_work(self->worker->handle, - lv2_atom_total_size((LV2_Atom *)&atom), - &atom) == LV2_WORKER_SUCCESS)) { - self->check_modification = false; - } else { - lv2_log_error(&self->logger, "[sfizz] There was an issue sending a notice to check the modification of the SFZ file to the background worker\n"); - } - self->sample_counter = 0; - } - - // Render the block - if (self->multi_out) - sfizz_render_block(self->synth, self->output_buffers, MULTI_OUTPUT_COUNT, (int)sample_count); - else - sfizz_render_block(self->synth, self->output_buffers, 2, (int)sample_count); - - // Request OSC updates - sfizz_send_message(self->synth, self->client, 0, "/sw/last/current", "", nullptr); - - if (self->midnam && self->must_update_midnam.exchange(0)) - { - self->midnam->update(self->midnam->handle); - } - - if (self->resync_cc) { - for (unsigned cc = 0; cc < sfz::config::numCCs; ++cc) - sfizz_lv2_send_controller(self, self->patch_set_uri, cc, self->cc_current[cc]); - - self->resync_cc = false; - } - - spin_mutex_unlock(self->synth_mutex); - -#if defined(SFIZZ_LV2_UI) - if (self->ui_active) - { - if (self->multi_out) { - self->rms_follower.process((const float**)self->output_buffers, - sample_count, MULTI_OUTPUT_COUNT); - float levels[MULTI_OUTPUT_COUNT]; - self->rms_follower.getRMS(levels, MULTI_OUTPUT_COUNT); - sfizz_lv2_send_levels(self, levels, MULTI_OUTPUT_COUNT); - } else { - self->rms_follower.process((const float**)self->output_buffers, - sample_count, 2); - float levels[2]; - self->rms_follower.getRMS(levels, 2); - sfizz_lv2_send_levels(self, levels, 2); - } - } - else - { - self->rms_follower.clear(); - } -#endif - - lv2_atom_forge_pop(&self->forge_automate, &automate_frame); -} - -static uint32_t -lv2_get_options(LV2_Handle instance, LV2_Options_Option *options) -{ - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - LV2_DEBUG("[DEBUG] get_options called\n"); - for (LV2_Options_Option *opt = options; opt->key || opt->value; ++opt) - { - if (self->unmap) { - LV2_DEBUG("[DEBUG] Called for an option with key (subject): %s (%s) \n", - self->unmap->unmap(self->unmap->handle, opt->key), - self->unmap->unmap(self->unmap->handle, opt->subject)); - } - - if (opt->key == self->sample_rate_uri) - { - opt->type = self->atom_float_uri; - opt->size = sizeof(float); - opt->value = (void*)&self->sample_rate; - return LV2_OPTIONS_SUCCESS; - } - - if (opt->key == self->max_block_length_uri || opt->key == self->nominal_block_length_uri) - { - opt->type = self->atom_int_uri; - opt->size = sizeof(int); - opt->value = (void*)&self->max_block_size; - return LV2_OPTIONS_SUCCESS; - } - } - return LV2_OPTIONS_ERR_UNKNOWN; -} - -static uint32_t -lv2_set_options(LV2_Handle instance, const LV2_Options_Option *options) -{ - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - - // Update the block size and sample rate as needed - for (const LV2_Options_Option *opt = options; opt->key || opt->value; ++opt) - { - if (opt->key == self->sample_rate_uri) - { - sfizz_lv2_parse_sample_rate(self, opt); - spin_mutex_lock(self->synth_mutex); - sfizz_set_sample_rate(self->synth, self->sample_rate); - spin_mutex_unlock(self->synth_mutex); - } - else if (!self->expect_nominal_block_length && opt->key == self->max_block_length_uri) - { - if (opt->type != self->atom_int_uri) - { - lv2_log_warning(&self->logger, "[sfizz] Got a max block size but the type was wrong\n"); - continue; - } - self->max_block_size = *(int *)opt->value; - spin_mutex_lock(self->synth_mutex); - sfizz_set_samples_per_block(self->synth, self->max_block_size); - spin_mutex_unlock(self->synth_mutex); - } - else if (opt->key == self->nominal_block_length_uri) - { - if (opt->type != self->atom_int_uri) - { - lv2_log_warning(&self->logger, "[sfizz] Got a nominal block size but the type was wrong\n"); - continue; - } - self->max_block_size = *(int *)opt->value; - spin_mutex_lock(self->synth_mutex); - sfizz_set_samples_per_block(self->synth, self->max_block_size); - spin_mutex_unlock(self->synth_mutex); - } - } - return LV2_OPTIONS_SUCCESS; -} - -static void -sfizz_lv2_update_file_info(sfizz_plugin_t* self, const char *file_path) -{ - if (file_path != self->sfz_file_path) - strcpy(self->sfz_file_path, file_path); - - lv2_log_note(&self->logger, "[sfizz] File changed to: %s\n", file_path); - - char *unknown_opcodes = sfizz_get_unknown_opcodes(self->synth); - if (unknown_opcodes) - { - lv2_log_note(&self->logger, "[sfizz] Unknown opcodes: %s\n", unknown_opcodes); - free(unknown_opcodes); - } - lv2_log_note(&self->logger, "[sfizz] Number of masters: %d\n", sfizz_get_num_masters(self->synth)); - lv2_log_note(&self->logger, "[sfizz] Number of groups: %d\n", sfizz_get_num_groups(self->synth)); - lv2_log_note(&self->logger, "[sfizz] Number of regions: %d\n", sfizz_get_num_regions(self->synth)); - - self->must_update_midnam.store(1); -} - -static void -sfizz_lv2_update_sfz_info(sfizz_plugin_t *self) -{ - const std::string blob = getDescriptionBlob(self->synth); - - // Update description blob that UI can fetch, thread-safely - uint32_t size = uint32_t(blob.size()); - uint8_t *data = new uint8_t[size]; - memcpy(data, blob.data(), size); - - self->sfz_blob_mutex->lock(); - self->sfz_blob_serial += 1; - const uint8_t *old_data = self->sfz_blob_data; - self->sfz_blob_data = data; - self->sfz_blob_size = size; - self->sfz_blob_mutex->unlock(); - - delete[] old_data; - - // - const InstrumentDescription desc = parseDescriptionBlob(blob); - char *cursor = self->text_description; - char *end = self->text_description + sizeof(self->text_description); - cursor += snprintf(cursor, end - cursor, "CC used:\n"); - for (unsigned cc = 0; cc < sfz::config::numCCs; ++cc) { - if (desc.ccUsed.test(cc) && !desc.sustainOrSostenuto.test(cc)) { - // Update the current CCs - self->cc_current[cc] = desc.ccValue[cc]; - self->resync_cc = true; - - if (desc.ccLabel[cc].empty()) - cursor += snprintf(cursor, end - cursor, "- %d\n", cc); - else - cursor += snprintf(cursor, end - cursor, "- %d: %s\n", - cc, desc.ccLabel[cc].c_str()); - } - } -} - -static bool -sfizz_lv2_load_file(sfizz_plugin_t *self, const char *file_path) -{ - char buf[MAX_PATH_SIZE]; - if (file_path[0] == '\0') - { - sfizz_lv2_get_default_sfz_path(self, buf, MAX_PATH_SIZE); - file_path = buf; - } - - /// - bool status = sfizz_load_or_import_file(self->synth, file_path, nullptr); - sfizz_lv2_update_sfz_info(self); - sfizz_lv2_update_file_info(self, file_path); - return status; -} - -static bool -sfizz_lv2_load_scala_file(sfizz_plugin_t *self, const char *file_path) -{ - char buf[MAX_PATH_SIZE]; - if (file_path[0] == '\0') - { - sfizz_lv2_get_default_scala_path(self, buf, MAX_PATH_SIZE); - file_path = buf; - } - - bool status = sfizz_load_scala_file(self->synth, file_path); - if (file_path != self->scala_file_path) - strcpy(self->scala_file_path, file_path); - return status; -} - -static LV2_State_Status -restore(LV2_Handle instance, - LV2_State_Retrieve_Function retrieve, - LV2_State_Handle handle, - uint32_t flags, - const LV2_Feature *const *features) -{ - UNUSED(flags); - LV2_State_Status status = LV2_STATE_SUCCESS; - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - - LV2_State_Map_Path *map_path = NULL; - LV2_State_Free_Path *free_path = &sfizz_State_Free_Path; - for (const LV2_Feature *const *f = features; *f; ++f) - { - if (!strcmp((*f)->URI, LV2_STATE__mapPath)) - map_path = (LV2_State_Map_Path *)(**f).data; - else if (!strcmp((*f)->URI, LV2_STATE__freePath)) - free_path = (LV2_State_Free_Path *)(**f).data; - } - - // Set default values - self->last_keyswitch = -1; - sfizz_lv2_get_default_sfz_path(self, self->sfz_file_path, MAX_PATH_SIZE); - sfizz_lv2_get_default_scala_path(self, self->scala_file_path, MAX_PATH_SIZE); - - // Fetch back the saved file path, if any - size_t size; - uint32_t type; - uint32_t val_flags; - const void *value; - value = retrieve(handle, self->sfizz_sfz_file_uri, &size, &type, &val_flags); - if (value) - { - const char *path = (const char *)value; - if (map_path) - { - path = map_path->absolute_path(map_path->handle, path); - if (!path) - status = LV2_STATE_ERR_UNKNOWN; - } - - if (path) - { - strncpy(self->sfz_file_path, path, MAX_PATH_SIZE - 1); - self->sfz_file_path[MAX_PATH_SIZE - 1] = '\0'; - - if (map_path) - free_path->free_path(free_path->handle, (char *)path); - } - } - - value = retrieve(handle, self->sfizz_scala_file_uri, &size, &type, &val_flags); - if (value) - { - const char *path = (const char *)value; - if (map_path) - { - path = map_path->absolute_path(map_path->handle, path); - if (!path) - status = LV2_STATE_ERR_UNKNOWN; - } - - if (path) - { - strncpy(self->scala_file_path, path, MAX_PATH_SIZE - 1); - self->scala_file_path[MAX_PATH_SIZE - 1] = '\0'; - - if (map_path) - free_path->free_path(free_path->handle, (char *)path); - } - } - - value = retrieve(handle, self->sfizz_last_keyswitch_uri, &size, &type, &val_flags); - if (value) - { - int last_keyswitch = *(const int*)value; - self->last_keyswitch = last_keyswitch; - } - - // Collect all CC values present in the state - std::unique_ptr[]> cc_values( - new absl::optional[sfz::config::numCCs]); - - for (unsigned cc = 0; cc < sfz::config::numCCs; ++cc) { - LV2_URID urid = sfizz_lv2_ccmap_map(self->ccmap, int(cc)); - value = retrieve(handle, urid, &size, &type, &val_flags); - if (value && type == self->atom_float_uri) - cc_values[cc] = *(const float *)value; - } - - // Sync the parameters to the synth - spin_mutex_lock(self->synth_mutex); - - // Load an empty file to remove the default sine, and then the new file. - sfizz_load_string(self->synth, "empty.sfz", ""); - self->check_modification = false; - if (sfizz_lv2_load_file(self, self->sfz_file_path)) - { - lv2_log_note(&self->logger, - "[sfizz] Restoring the file %s\n", self->sfz_file_path); - self->check_modification = true; - } - else - { - lv2_log_error(&self->logger, - "[sfizz] Error while restoring the file %s\n", self->sfz_file_path); - } - - if (sfizz_lv2_load_scala_file(self, self->scala_file_path)) - { - lv2_log_note(&self->logger, - "[sfizz] Restoring the scale %s\n", self->scala_file_path); - } - else - { - lv2_log_error(&self->logger, - "[sfizz] Error while restoring the scale %s\n", self->scala_file_path); - } - - // Override default automation values with these from the state file - for (unsigned cc = 0; cc < sfz::config::numCCs; ++cc) { - absl::optional value = cc_values[cc]; - if (value) { - // Set CC in the synth - sfizz_automate_hdcc(self->synth, 0, int(cc), *value); - // Update the current CCs - self->cc_current[cc] = *value; - } - } - - if (self->last_keyswitch >= 0 && self->last_keyswitch <= 127) { - sfizz_send_hd_note_on(self->synth, 0, self->last_keyswitch, 1.0f); - sfizz_send_hd_note_off(self->synth, 1, self->last_keyswitch, 0.0f); - } - - spin_mutex_unlock(self->synth_mutex); - - return status; -} - -static LV2_State_Status -save(LV2_Handle instance, - LV2_State_Store_Function store, - LV2_State_Handle handle, - uint32_t flags, - const LV2_Feature *const *features) -{ - UNUSED(flags); - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - - LV2_State_Map_Path *map_path = NULL; - LV2_State_Free_Path *free_path = &sfizz_State_Free_Path; - for (const LV2_Feature *const *f = features; *f; ++f) - { - if (!strcmp((*f)->URI, LV2_STATE__mapPath)) - map_path = (LV2_State_Map_Path *)(**f).data; - else if (!strcmp((*f)->URI, LV2_STATE__freePath)) - free_path = (LV2_State_Free_Path *)(**f).data; - } - - const char *path; - - // Save the file path - path = self->sfz_file_path; - if (map_path) - { - path = map_path->abstract_path(map_path->handle, path); - if (!path) - return LV2_STATE_ERR_UNKNOWN; - } - store(handle, - self->sfizz_sfz_file_uri, - path, - strlen(path) + 1, - self->atom_path_uri, - LV2_STATE_IS_POD); - if (map_path) - free_path->free_path(free_path->handle, (char *)path); - - // Save the scala file path - path = self->scala_file_path; - if (map_path) - { - path = map_path->abstract_path(map_path->handle, path); - if (!path) - return LV2_STATE_ERR_UNKNOWN; - } - if (!path) - return LV2_STATE_ERR_UNKNOWN; - store(handle, - self->sfizz_scala_file_uri, - path, - strlen(path) + 1, - self->atom_path_uri, - LV2_STATE_IS_POD); - if (map_path) - free_path->free_path(free_path->handle, (char *)path); - - // Save the CCs (used only) - self->sfz_blob_mutex->lock(); - const InstrumentDescription desc = parseDescriptionBlob( - absl::string_view((const char*)self->sfz_blob_data, self->sfz_blob_size)); - self->sfz_blob_mutex->unlock(); - - if (self->last_keyswitch >= 0 && self->last_keyswitch <= 127) { - store(handle, - self->sfizz_last_keyswitch_uri, - &self->last_keyswitch, - sizeof(int), - self->atom_int_uri, - LV2_STATE_IS_POD); - } - for (unsigned cc = 0; cc < sfz::config::numCCs; ++cc) { - if (desc.ccUsed.test(cc) && !desc.sustainOrSostenuto.test(cc)) { - LV2_URID urid = sfizz_lv2_ccmap_map(self->ccmap, int(cc)); - store(handle, - urid, - &self->cc_current[cc], - sizeof(float), - self->atom_float_uri, - LV2_STATE_IS_POD); - } - } - - return LV2_STATE_SUCCESS; -} - -static void -sfizz_lv2_respond_with_simple_atom( - LV2_Worker_Respond_Function respond, - LV2_Worker_Respond_Handle handle, - uint32_t type_uri) -{ - LV2_Atom atom; - atom.size = 0; - atom.type = type_uri; - respond(handle, lv2_atom_total_size(&atom), &atom); -} - -// This runs in a lower priority thread -static LV2_Worker_Status -work(LV2_Handle instance, - LV2_Worker_Respond_Function respond, - LV2_Worker_Respond_Handle handle, - uint32_t size, - const void *data) -{ - UNUSED(size); - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - if (!data) { - lv2_log_error(&self->logger, "[sfizz] Ignoring empty data in the worker thread\n"); - return LV2_WORKER_ERR_UNKNOWN; - } - - const LV2_Atom *atom = (const LV2_Atom *)data; - if (atom->type == self->sfizz_sfz_file_uri) - { - const char *sfz_file_path = (const char *)LV2_ATOM_BODY_CONST(atom); - - spin_mutex_lock(self->synth_mutex); - bool success = sfizz_lv2_load_file(self, sfz_file_path); - spin_mutex_unlock(self->synth_mutex); - - if (!success) { - lv2_log_error(&self->logger, - "[sfizz] Error with %s; no file should be loaded\n", sfz_file_path); - } - - // Reactivate checking for file changes - sfizz_lv2_respond_with_simple_atom(respond, handle, self->sfizz_check_modification_uri); - sfizz_lv2_respond_with_simple_atom(respond, handle, self->sfizz_description_uri); - } - else if (atom->type == self->sfizz_scala_file_uri) - { - const char *scala_file_path = (const char *)LV2_ATOM_BODY_CONST(atom); - - spin_mutex_lock(self->synth_mutex); - bool success = sfizz_lv2_load_scala_file(self, scala_file_path); - spin_mutex_unlock(self->synth_mutex); - - if (success) { - lv2_log_note(&self->logger, "[sfizz] Scala file loaded: %s\n", scala_file_path); - } else { - lv2_log_error(&self->logger, - "[sfizz] Error with %s; no new scala file should be loaded\n", scala_file_path); - } - - // Reactivate checking for file changes - sfizz_lv2_respond_with_simple_atom(respond, handle, self->sfizz_check_modification_uri); - } - else if (atom->type == self->sfizz_num_voices_uri) - { - const int num_voices = *(const int *)LV2_ATOM_BODY_CONST(atom); - - spin_mutex_lock(self->synth_mutex); - sfizz_set_num_voices(self->synth, num_voices); - spin_mutex_unlock(self->synth_mutex); - - if (sfizz_get_num_voices(self->synth) == num_voices) { - lv2_log_note(&self->logger, "[sfizz] Number of voices changed to: %d\n", num_voices); - } else { - lv2_log_error(&self->logger, "[sfizz] Error changing the number of voices\n"); - } - } - else if (atom->type == self->sfizz_preload_size_uri) - { - const unsigned int preload_size = *(const unsigned int *)LV2_ATOM_BODY_CONST(atom); - - spin_mutex_lock(self->synth_mutex); - sfizz_set_preload_size(self->synth, preload_size); - spin_mutex_unlock(self->synth_mutex); - - if (sfizz_get_preload_size(self->synth) == preload_size) { - lv2_log_note(&self->logger, "[sfizz] Preload size changed to: %d\n", preload_size); - } else { - lv2_log_error(&self->logger, "[sfizz] Error changing the preload size\n"); - } - } - else if (atom->type == self->sfizz_oversampling_uri) - { - const sfizz_oversampling_factor_t oversampling = - *(const sfizz_oversampling_factor_t *)LV2_ATOM_BODY_CONST(atom); - - spin_mutex_lock(self->synth_mutex); - sfizz_set_oversampling_factor(self->synth, oversampling); - spin_mutex_unlock(self->synth_mutex); - - if (sfizz_get_oversampling_factor(self->synth) == oversampling) { - lv2_log_note(&self->logger, "[sfizz] Oversampling changed to: %d\n", oversampling); - } else { - lv2_log_error(&self->logger, "[sfizz] Error changing the oversampling\n"); - } - } - else if (atom->type == self->sfizz_log_status_uri) - { - sfizz_lv2_status_log(self); - } - else if (atom->type == self->sfizz_check_modification_uri) - { - if (sfizz_should_reload_file(self->synth)) - { - lv2_log_note(&self->logger, - "[sfizz] File %s seems to have been updated, reloading\n", - self->sfz_file_path); - - spin_mutex_lock(self->synth_mutex); - bool success = sfizz_lv2_load_file(self, self->sfz_file_path); - spin_mutex_unlock(self->synth_mutex); - - if (!success) { - lv2_log_error(&self->logger, - "[sfizz] Error with %s; no file should be loaded\n", self->sfz_file_path); - } - - sfizz_lv2_respond_with_simple_atom(respond, handle, self->sfizz_description_uri); - } - - if (sfizz_should_reload_scala(self->synth)) - { - lv2_log_note(&self->logger, - "[sfizz] Scala file %s seems to have been updated, reloading\n", - self->scala_file_path); - - spin_mutex_lock(self->synth_mutex); - bool success = sfizz_lv2_load_scala_file(self, self->scala_file_path); - spin_mutex_unlock(self->synth_mutex); - - if (success) { - lv2_log_note(&self->logger, "[sfizz] Scala file loaded: %s\n", self->scala_file_path); - } else { - lv2_log_error(&self->logger, - "[sfizz] Error with %s; no new scala file should be loaded\n", self->scala_file_path); - } - } - - // Reactivate checking for file changes - sfizz_lv2_respond_with_simple_atom(respond, handle, self->sfizz_check_modification_uri); - } - else - { - lv2_log_error(&self->logger, "[sfizz] Got an unknown atom in work\n"); - if (self->unmap) - lv2_log_error(&self->logger, - "URI: %s\n", - self->unmap->unmap(self->unmap->handle, atom->type)); - return LV2_WORKER_ERR_UNKNOWN; - } - return LV2_WORKER_SUCCESS; -} - -// This runs in the audio thread -static LV2_Worker_Status -work_response(LV2_Handle instance, - uint32_t size, - const void *data) -{ - UNUSED(size); - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - - if (!data) - return LV2_WORKER_ERR_UNKNOWN; - - const LV2_Atom *atom = (const LV2_Atom *)data; - if (atom->type == self->sfizz_check_modification_uri) { - self->check_modification = true; // check changes - } else if (atom->type == self->sfizz_description_uri) { - self->resend_description = true; - } else { - lv2_log_error(&self->logger, "[sfizz] Got an unexpected atom in work response\n"); - if (self->unmap) - lv2_log_error(&self->logger, - "URI: %s\n", - self->unmap->unmap(self->unmap->handle, atom->type)); - return LV2_WORKER_ERR_UNKNOWN; - } - - return LV2_WORKER_SUCCESS; -} - -static char * -midnam_model(LV2_Handle instance) -{ - char *model = (char *)malloc(64); - if (!model) - return NULL; - - sprintf(model, "Sfizz LV2:%p", instance); - return model; -} - -static char * -midnam_export(LV2_Handle instance) -{ - sfizz_plugin_t *self = (sfizz_plugin_t *)instance; - - char *model = midnam_model(instance); - if (!model) - return NULL; - - char *xml = sfizz_export_midnam(self->synth, model); - free(model); - return xml; -} - -static void -midnam_free(char *string) -{ - sfizz_free_memory(string); -} - -static const void * -extension_data(const char *uri) -{ - static const LV2_Options_Interface options = {lv2_get_options, lv2_set_options}; - static const LV2_State_Interface state = {save, restore}; - static const LV2_Worker_Interface worker = {work, work_response, NULL}; - static const LV2_Midnam_Interface midnam = {midnam_export, midnam_model, midnam_free}; - - // Advertise the extensions we support - if (!strcmp(uri, LV2_OPTIONS__interface)) - return &options; - else if (!strcmp(uri, LV2_STATE__interface)) - return &state; - else if (!strcmp(uri, LV2_WORKER__interface)) - return &worker; - else if (!strcmp(uri, LV2_MIDNAM__interface)) - return &midnam; - - return NULL; -} - -static const LV2_Descriptor descriptor = { - SFIZZ_URI, - instantiate, - connect_port, - activate, - run, - deactivate, - cleanup, - extension_data}; - -static const LV2_Descriptor descriptor_multi = { - SFIZZ_MULTI_URI, - instantiate, - connect_port, - activate, - run, - deactivate, - cleanup, - extension_data}; - -LV2_SYMBOL_EXPORT -const LV2_Descriptor * -lv2_descriptor(uint32_t index) -{ - switch (index) - { - case 0: - return &descriptor; - case 1: - return &descriptor_multi; - default: - return NULL; - } -} diff --git a/plugins/lv2/sfizz.ttl.in b/plugins/lv2/sfizz.ttl.in deleted file mode 100644 index e4c6d8b8c..000000000 --- a/plugins/lv2/sfizz.ttl.in +++ /dev/null @@ -1,917 +0,0 @@ -@prefix atom: . -@prefix bufsize: . -@prefix doap: . -@prefix foaf: . -@prefix lv2: . -@prefix midi: . -@prefix opts: . -@prefix param: . -@prefix patch: . -@prefix pg: . -@prefix pprop: . -@prefix rdf: . -@prefix rdfs: . -@prefix rsz: . -@prefix state: . -@prefix time: . -@prefix ui: . -@prefix units: . -@prefix urid: . -@prefix work: . -@prefix midnam: . - -midnam:interface a lv2:ExtensionData . -midnam:update a lv2:Feature . - -<@LV2PLUGIN_URI@#stereo_output> - a pg:StereoGroup, pg:OutputGroup ; - lv2:symbol "stereo_output" ; - lv2:name "Stereo output", - "Sortie stéréo"@fr , - "Uscita stereo"@it . - -<@LV2PLUGIN_URI@#config> - a pg:Group ; - lv2:symbol "config" ; - lv2:name "Configuration", - "Configuration"@fr , - "Impostazioni"@it . - -<@LV2PLUGIN_URI@#tuning> - a pg:Group ; - lv2:symbol "tuning" ; - lv2:name "Tuning", - "Accordage"@fr , - "Accordatura"@it . - -<@LV2PLUGIN_URI@#status> - a pg:Group ; - lv2:symbol "status" ; - lv2:name "status", - "Statut"@fr . - -<@LV2PLUGIN_URI@:sfzfile> - a lv2:Parameter ; - rdfs:label "SFZ file", - "Fichier SFZ"@fr , - "File SFZ"@it ; - rdfs:range atom:Path . - -<@LV2PLUGIN_URI@:tuningfile> - a lv2:Parameter ; - pg:group <@LV2PLUGIN_URI@#tuning> ; - rdfs:label "Scala file", - "Fichier Scala"@fr , - "File Scala"@it ; - rdfs:range atom:Path . - -<@LV2PLUGIN_URI@:description> - a lv2:Parameter ; - rdfs:label "Instrument description" ; - rdfs:range atom:String . - -<@LV2PLUGIN_URI@> - a doap:Project, lv2:Plugin, lv2:InstrumentPlugin ; - - doap:name "@LV2PLUGIN_NAME@" ; - doap:license ; - doap:maintainer [ - foaf:name "@LV2PLUGIN_AUTHOR@" ; - foaf:homepage <@LV2PLUGIN_URI@> ; - foaf:mbox ; - ] ; - rdfs:comment "@LV2PLUGIN_COMMENT@", - "Échantillonneur SFZ"@fr , - "Campionatore SFZ"@it ; - - lv2:minorVersion @LV2PLUGIN_VERSION_MINOR@ ; - lv2:microVersion @LV2PLUGIN_VERSION_MICRO@ ; - - lv2:requiredFeature urid:map, bufsize:boundedBlockLength, work:schedule ; - lv2:optionalFeature lv2:hardRTCapable, opts:options, state:mapPath, state:freePath ; - lv2:extensionData opts:interface, state:interface, work:interface ; - - lv2:optionalFeature midnam:update ; - lv2:extensionData midnam:interface ; - - opts:supportedOption param:sampleRate ; - opts:supportedOption bufsize:maxBlockLength, bufsize:nominalBlockLength ; - - @LV2PLUGIN_IF_ENABLE_UI@ui:ui <@LV2PLUGIN_URI@#ui> ; - - patch:writable <@LV2PLUGIN_URI@:sfzfile> , - <@LV2PLUGIN_URI@:tuningfile> ; - patch:readable <@LV2PLUGIN_URI@:description> ; - - pg:mainOutput <@LV2PLUGIN_URI@#stereo_output> ; - - lv2:port [ - a lv2:InputPort, atom:AtomPort ; - atom:bufferType atom:Sequence ; - atom:supports patch:Message, midi:MidiEvent, time:Position, <@LV2PLUGIN_URI@:OSCBlob>, <@LV2PLUGIN_URI@:Notify> ; - lv2:designation lv2:control ; - lv2:index 0 ; - lv2:symbol "control" ; - lv2:name "Control", - "Contrôle"@fr ; - rsz:minimumSize 524288 ; - ] , [ - a lv2:OutputPort, atom:AtomPort ; - atom:bufferType atom:Sequence ; - atom:supports patch:Message, <@LV2PLUGIN_URI@:OSCBlob> ; - lv2:designation lv2:control ; - lv2:index 1 ; - lv2:symbol "automate" ; - lv2:name "Automate", - "Automatisation"@fr ; - rsz:minimumSize 524288 ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 2 ; - lv2:symbol "out_left" ; - lv2:name "Left Output", - "Sortie gauche"@fr , - "Uscita Sinistra"@it ; - pg:group <@LV2PLUGIN_URI@#stereo_output> ; - lv2:designation pg:left - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 3 ; - lv2:symbol "out_right" ; - lv2:name "Right Output", - "Sortie droite"@fr , - "Uscita Destra"@it ; - pg:group <@LV2PLUGIN_URI@#stereo_output> ; - lv2:designation pg:right - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 4 ; - lv2:symbol "volume" ; - lv2:name "Volume" ; - lv2:default 0.0 ; - lv2:minimum -80.0 ; - lv2:maximum 6.0 ; - units:unit units:db - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 5 ; - lv2:symbol "num_voices" ; - lv2:name "Polyphony", - "Polyphonie"@fr , - "Polifonia"@it ; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:portProperty pprop:notAutomatic ; - lv2:portProperty pprop:expensive ; - lv2:portProperty lv2:integer ; - lv2:portProperty lv2:enumeration ; - lv2:default 64 ; - lv2:minimum 8 ; - lv2:maximum 256 ; - lv2:scalePoint [ rdfs:label "8 voices", - "8 voix"@fr , - "8 Voci"@it; - rdf:value 8 - ] ; - lv2:scalePoint [ rdfs:label "16 voices", - "16 voix"@fr , - "16 Voci"@it; - rdf:value 16 - ] ; - lv2:scalePoint [ rdfs:label "32 voices", - "32 voix"@fr , - "32 Voci"@it; - rdf:value 32 - ] ; - lv2:scalePoint [ rdfs:label "64 voices", - "64 voix"@fr , - "64 Voci"@it; - rdf:value 64 - ] ; - lv2:scalePoint [ rdfs:label "128 voices", - "128 voix"@fr , - "128 Voci"@it; - rdf:value 128 - ] ; - lv2:scalePoint [ rdfs:label "256 voices", - "256 voix"@fr , - "256 Voci"@it; - rdf:value 256 - ] ; - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 6 ; - lv2:symbol "oversampling" ; - lv2:name "Oversampling factor", - "Facteur de suréchantillonnage"@fr , - "Fattore Sovracampionamento"@it ; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:portProperty pprop:notAutomatic ; - lv2:portProperty pprop:expensive ; - lv2:portProperty lv2:integer ; - lv2:portProperty lv2:enumeration ; - lv2:default 1 ; - lv2:minimum 1 ; - lv2:maximum 8 ; - lv2:scalePoint [ rdfs:label "x1 oversampling", - "suréchantillonnage x1"@fr , - "x1 Sovracampionamento"@it; - rdf:value 1 - ] ; - lv2:scalePoint [ rdfs:label "x2 oversampling", - "suréchantillonnage x2"@fr , - "x2 Sovracampionamento"@it; - rdf:value 2 - ] ; - lv2:scalePoint [ rdfs:label "x4 oversampling", - "suréchantillonnage x4"@fr , - "x4 Sovracampionamento"@it; - rdf:value 4 - ] ; - lv2:scalePoint [ rdfs:label "x8 oversampling", - "suréchantillonnage x8"@fr , - "x8 Sovracampionamento"@it; - rdf:value 8 - ] ; - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 7 ; - lv2:symbol "preload_size" ; - lv2:name "Preload size", - "Taille préchargée"@fr , - "Grandezza Precaricamento"@it ; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:portProperty pprop:notAutomatic ; - lv2:portProperty pprop:expensive ; - lv2:portProperty lv2:integer ; - lv2:portProperty lv2:enumeration ; - lv2:default 8192 ; - lv2:minimum 1024 ; - lv2:maximum 65536 ; - lv2:scalePoint [ rdfs:label "4 KB", - "4 Ko"@fr; - rdf:value 1024 - ] ; - lv2:scalePoint [ rdfs:label "8 KB", - "8 Ko"@fr; - rdf:value 2048 - ] ; - lv2:scalePoint [ rdfs:label "16 KB", - "16 Ko"@fr; - rdf:value 4096 - ] ; - lv2:scalePoint [ rdfs:label "32 KB", - "32 Ko"@fr; - rdf:value 8192 - ] ; - lv2:scalePoint [ rdfs:label "64 KB", - "64 Ko"@fr; - rdf:value 16384 - ] ; - lv2:scalePoint [ rdfs:label "128 KB", - "128 Ko"@fr; - rdf:value 32768 - ] ; - lv2:scalePoint [ rdfs:label "256 KB", - "256 Ko"@fr; - rdf:value 65536 - ] ; - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 8 ; - lv2:symbol "freewheeling" ; - lv2:name "Freewheeling", - "En roue libre (freewheeling)"@fr , - "A Ruota Libera"@it ; - lv2:designation lv2:freeWheeling ; - lv2:portProperty lv2:toggled ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 1 ; - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 9 ; - lv2:symbol "scala_root_key" ; - lv2:name "Scala root key", - "Tonalité de base Scala"@fr , - "Tonalità di base Scala"@it ; - pg:group <@LV2PLUGIN_URI@#tuning> ; - lv2:portProperty lv2:integer ; - lv2:default 60 ; - lv2:minimum 0 ; - lv2:maximum 127 ; - units:unit units:midiNote - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 10 ; - lv2:symbol "tuning_frequency" ; - lv2:name "Tuning frequency", - "Fréquence d'accordage"@fr , - "Frequenza di accordatura"@it ; - pg:group <@LV2PLUGIN_URI@#tuning> ; - lv2:default 440.0 ; - lv2:minimum 300.0 ; - lv2:maximum 500.0 ; - units:unit units:hz - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 11 ; - lv2:symbol "stretched_tuning" ; - lv2:name "Stretched tuning", - "Accordage étiré"@fr , - "Tensione di accordatura"@it ; - pg:group <@LV2PLUGIN_URI@#tuning> ; - lv2:default 0.0 ; - lv2:minimum 0.0 ; - lv2:maximum 1.0 ; - units:unit units:coef - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 12 ; - lv2:symbol "sample_quality" ; - lv2:name "Sample quality", - "Qualité des échantillons"@fr , - "Qualità del campione"@it ; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:default 2.0 ; - lv2:minimum 0.0 ; - lv2:maximum 10.0 - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 13 ; - lv2:symbol "oscillator_quality" ; - lv2:name "Oscillator quality", - "Qualité des oscillateurs"@fr , - "Qualità dell'oscillatore"@it ; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:default 1.0 ; - lv2:minimum 0.0 ; - lv2:maximum 3.0 - ] , [ - a lv2:OutputPort, lv2:ControlPort ; - lv2:index 14 ; - lv2:symbol "active_voices" ; - lv2:name "Active voices", - "Voix utilisées"@fr ; - pg:group <@LV2PLUGIN_URI@#status> ; - lv2:portProperty lv2:integer ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 256 ; - ] , [ - a lv2:OutputPort, lv2:ControlPort ; - lv2:index 15 ; - lv2:symbol "num_curves" ; - lv2:name "Number of curves", - "Nombre de courbes"@fr ; - pg:group <@LV2PLUGIN_URI@#status> ; - lv2:portProperty lv2:integer ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 65535 ; - ] , [ - a lv2:OutputPort, lv2:ControlPort ; - lv2:index 16 ; - lv2:symbol "num_masters" ; - lv2:name "Number of masters", - "Nombre de maîtres"@fr ; - pg:group <@LV2PLUGIN_URI@#status> ; - lv2:portProperty lv2:integer ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 65535 ; - ] , [ - a lv2:OutputPort, lv2:ControlPort ; - lv2:index 17 ; - lv2:symbol "num_groups" ; - lv2:name "Number of groups", - "Nombre de groupes"@fr ; - pg:group <@LV2PLUGIN_URI@#status> ; - lv2:portProperty lv2:integer ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 65535 ; - ] , [ - a lv2:OutputPort, lv2:ControlPort ; - lv2:index 18 ; - lv2:symbol "num_regions" ; - lv2:name "Number of regions", - "Nombre de régions"@fr ; - pg:group <@LV2PLUGIN_URI@#status> ; - lv2:portProperty lv2:integer ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 65535 ; - ] , [ - a lv2:OutputPort, lv2:ControlPort ; - lv2:index 19 ; - lv2:symbol "num_samples" ; - lv2:name "Number of samples", - "Nombre d'échantillons"@fr ; - pg:group <@LV2PLUGIN_URI@#status> ; - lv2:portProperty lv2:integer ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 65535 ; - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 20 ; - lv2:symbol "freewheeling_sample_quality" ; - lv2:name "Freewheeling Sample quality", - "Qualité des échantillons en roue libre"@fr; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:default 10.0 ; - lv2:minimum 0.0 ; - lv2:maximum 10.0 - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 21 ; - lv2:symbol "freewheeling_oscillator_quality" ; - lv2:name "Freewheeling Oscillator quality", - "Qualité des oscillateurs en roue libre"@fr ; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:default 3.0 ; - lv2:minimum 0.0 ; - lv2:maximum 3.0 - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 22 ; - lv2:symbol "sustain_cancels_release" ; - lv2:name "Sustain cancels release"; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:portProperty lv2:toggled ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 1 ; - ] ; - - rdfs:seeAlso . - -<@LV2PLUGIN_URI@-multi> - a doap:Project, lv2:Plugin, lv2:InstrumentPlugin ; - - doap:name "@LV2PLUGIN_NAME@-multi" ; - doap:license ; - doap:maintainer [ - foaf:name "@LV2PLUGIN_AUTHOR@" ; - foaf:homepage <@LV2PLUGIN_URI@> ; - foaf:mbox ; - ] ; - rdfs:comment "@LV2PLUGIN_COMMENT@", - "Échantillonneur SFZ"@fr , - "Campionatore SFZ"@it ; - - lv2:minorVersion @LV2PLUGIN_VERSION_MINOR@ ; - lv2:microVersion @LV2PLUGIN_VERSION_MICRO@ ; - - lv2:requiredFeature urid:map, bufsize:boundedBlockLength, work:schedule ; - lv2:optionalFeature lv2:hardRTCapable, opts:options, state:mapPath, state:freePath ; - lv2:extensionData opts:interface, state:interface, work:interface ; - - lv2:optionalFeature midnam:update ; - lv2:extensionData midnam:interface ; - - opts:supportedOption param:sampleRate ; - opts:supportedOption bufsize:maxBlockLength, bufsize:nominalBlockLength ; - - @LV2PLUGIN_IF_ENABLE_UI@ui:ui <@LV2PLUGIN_URI@#ui> ; - - patch:writable <@LV2PLUGIN_URI@:sfzfile> , - <@LV2PLUGIN_URI@:tuningfile> ; - patch:readable <@LV2PLUGIN_URI@:description> ; - - pg:mainOutput <@LV2PLUGIN_URI@#stereo_output> ; - - lv2:port [ - a lv2:InputPort, atom:AtomPort ; - atom:bufferType atom:Sequence ; - atom:supports patch:Message, midi:MidiEvent, time:Position, <@LV2PLUGIN_URI@:OSCBlob>, <@LV2PLUGIN_URI@:Notify> ; - lv2:designation lv2:control ; - lv2:index 0 ; - lv2:symbol "control" ; - lv2:name "Control", - "Contrôle"@fr ; - rsz:minimumSize 524288 ; - ] , [ - a lv2:OutputPort, atom:AtomPort ; - atom:bufferType atom:Sequence ; - atom:supports patch:Message, <@LV2PLUGIN_URI@:OSCBlob> ; - lv2:designation lv2:control ; - lv2:index 1 ; - lv2:symbol "automate" ; - lv2:name "Automate", - "Automatisation"@fr ; - rsz:minimumSize 524288 ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 2 ; - lv2:symbol "out1L" ; - lv2:name "Output 1 Left", - "Sortie gauche 1"@fr , - "Uscita Sinistra 1"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 3 ; - lv2:symbol "out1R" ; - lv2:name "Output 1 Right", - "Sortie droite 1"@fr , - "Uscita Destra 1"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 4 ; - lv2:symbol "out2L" ; - lv2:name "Output 2 Left", - "Sortie gauche 2"@fr , - "Uscita Sinistra 2"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 5 ; - lv2:symbol "out2R" ; - lv2:name "Output 2 Right", - "Sortie droite 2"@fr , - "Uscita Destra 2"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 6 ; - lv2:symbol "out3L" ; - lv2:name "Output 3 Left", - "Sortie gauche 3"@fr , - "Uscita Sinistra 3"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 7 ; - lv2:symbol "out3R" ; - lv2:name "Output 3 Right", - "Sortie droite 3"@fr , - "Uscita Destra 3"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 8 ; - lv2:symbol "out4L" ; - lv2:name "Output 4 Left", - "Sortie gauche 4"@fr , - "Uscita Sinistra 4"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 9 ; - lv2:symbol "out4R" ; - lv2:name "Output 4 Right", - "Sortie droite 4"@fr , - "Uscita Destra 4"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 10 ; - lv2:symbol "out5L" ; - lv2:name "Output 5 Left", - "Sortie gauche 5"@fr , - "Uscita Sinistra 5"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 11 ; - lv2:symbol "out5R" ; - lv2:name "Output 5 Right", - "Sortie droite 5"@fr , - "Uscita Destra 5"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 12 ; - lv2:symbol "out6L" ; - lv2:name "Output 6 Left", - "Sortie gauche 6"@fr , - "Uscita Sinistra 6"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 13 ; - lv2:symbol "out6R" ; - lv2:name "Output 6 Right", - "Sortie droite 6"@fr , - "Uscita Destra 6"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 14 ; - lv2:symbol "out7L" ; - lv2:name "Output 7 Left", - "Sortie gauche 7"@fr , - "Uscita Sinistra 7"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 15 ; - lv2:symbol "out7R" ; - lv2:name "Output 7 Right", - "Sortie droite 7"@fr , - "Uscita Destra 7"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 16 ; - lv2:symbol "out8L" ; - lv2:name "Output 8 Left", - "Sortie gauche 8"@fr , - "Uscita Sinistra 8"@it ; - ] , [ - a lv2:AudioPort, lv2:OutputPort ; - lv2:index 17 ; - lv2:symbol "out8R" ; - lv2:name "Output 8 Right", - "Sortie droite 8"@fr , - "Uscita Destra 8"@it ; - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 18 ; - lv2:symbol "volume" ; - lv2:name "Volume" ; - lv2:default 0.0 ; - lv2:minimum -80.0 ; - lv2:maximum 6.0 ; - units:unit units:db - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 19 ; - lv2:symbol "num_voices" ; - lv2:name "Polyphony", - "Polyphonie"@fr , - "Polifonia"@it ; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:portProperty pprop:notAutomatic ; - lv2:portProperty pprop:expensive ; - lv2:portProperty lv2:integer ; - lv2:portProperty lv2:enumeration ; - lv2:default 64 ; - lv2:minimum 8 ; - lv2:maximum 256 ; - lv2:scalePoint [ rdfs:label "8 voices", - "8 voix"@fr , - "8 Voci"@it; - rdf:value 8 - ] ; - lv2:scalePoint [ rdfs:label "16 voices", - "16 voix"@fr , - "16 Voci"@it; - rdf:value 16 - ] ; - lv2:scalePoint [ rdfs:label "32 voices", - "32 voix"@fr , - "32 Voci"@it; - rdf:value 32 - ] ; - lv2:scalePoint [ rdfs:label "64 voices", - "64 voix"@fr , - "64 Voci"@it; - rdf:value 64 - ] ; - lv2:scalePoint [ rdfs:label "128 voices", - "128 voix"@fr , - "128 Voci"@it; - rdf:value 128 - ] ; - lv2:scalePoint [ rdfs:label "256 voices", - "256 voix"@fr , - "256 Voci"@it; - rdf:value 256 - ] ; - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 20 ; - lv2:symbol "oversampling" ; - lv2:name "Oversampling factor", - "Facteur de suréchantillonnage"@fr , - "Fattore Sovracampionamento"@it ; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:portProperty pprop:notAutomatic ; - lv2:portProperty pprop:expensive ; - lv2:portProperty lv2:integer ; - lv2:portProperty lv2:enumeration ; - lv2:default 1 ; - lv2:minimum 1 ; - lv2:maximum 8 ; - lv2:scalePoint [ rdfs:label "x1 oversampling", - "suréchantillonnage x1"@fr , - "x1 Sovracampionamento"@it; - rdf:value 1 - ] ; - lv2:scalePoint [ rdfs:label "x2 oversampling", - "suréchantillonnage x2"@fr , - "x2 Sovracampionamento"@it; - rdf:value 2 - ] ; - lv2:scalePoint [ rdfs:label "x4 oversampling", - "suréchantillonnage x4"@fr , - "x4 Sovracampionamento"@it; - rdf:value 4 - ] ; - lv2:scalePoint [ rdfs:label "x8 oversampling", - "suréchantillonnage x8"@fr , - "x8 Sovracampionamento"@it; - rdf:value 8 - ] ; - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 21 ; - lv2:symbol "preload_size" ; - lv2:name "Preload size", - "Taille préchargée"@fr , - "Grandezza Precaricamento"@it ; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:portProperty pprop:notAutomatic ; - lv2:portProperty pprop:expensive ; - lv2:portProperty lv2:integer ; - lv2:portProperty lv2:enumeration ; - lv2:default 8192 ; - lv2:minimum 1024 ; - lv2:maximum 65536 ; - lv2:scalePoint [ rdfs:label "4 KB", - "4 Ko"@fr; - rdf:value 1024 - ] ; - lv2:scalePoint [ rdfs:label "8 KB", - "8 Ko"@fr; - rdf:value 2048 - ] ; - lv2:scalePoint [ rdfs:label "16 KB", - "16 Ko"@fr; - rdf:value 4096 - ] ; - lv2:scalePoint [ rdfs:label "32 KB", - "32 Ko"@fr; - rdf:value 8192 - ] ; - lv2:scalePoint [ rdfs:label "64 KB", - "64 Ko"@fr; - rdf:value 16384 - ] ; - lv2:scalePoint [ rdfs:label "128 KB", - "128 Ko"@fr; - rdf:value 32768 - ] ; - lv2:scalePoint [ rdfs:label "256 KB", - "256 Ko"@fr; - rdf:value 65536 - ] ; - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 22 ; - lv2:symbol "freewheeling" ; - lv2:name "Freewheeling", - "En roue libre (freewheeling)"@fr , - "A Ruota Libera"@it ; - lv2:designation lv2:freeWheeling ; - lv2:portProperty lv2:toggled ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 1 ; - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 23 ; - lv2:symbol "scala_root_key" ; - lv2:name "Scala root key", - "Tonalité de base Scala"@fr , - "Tonalità di base Scala"@it ; - pg:group <@LV2PLUGIN_URI@#tuning> ; - lv2:portProperty lv2:integer ; - lv2:default 60 ; - lv2:minimum 0 ; - lv2:maximum 127 ; - units:unit units:midiNote - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 24 ; - lv2:symbol "tuning_frequency" ; - lv2:name "Tuning frequency", - "Fréquence d'accordage"@fr , - "Frequenza di accordatura"@it ; - pg:group <@LV2PLUGIN_URI@#tuning> ; - lv2:default 440.0 ; - lv2:minimum 300.0 ; - lv2:maximum 500.0 ; - units:unit units:hz - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 25 ; - lv2:symbol "stretched_tuning" ; - lv2:name "Stretched tuning", - "Accordage étiré"@fr , - "Tensione di accordatura"@it ; - pg:group <@LV2PLUGIN_URI@#tuning> ; - lv2:default 0.0 ; - lv2:minimum 0.0 ; - lv2:maximum 1.0 ; - units:unit units:coef - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 26 ; - lv2:symbol "sample_quality" ; - lv2:name "Sample quality", - "Qualité des échantillons"@fr , - "Qualità del campione"@it ; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:default 2.0 ; - lv2:minimum 0.0 ; - lv2:maximum 10.0 - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 27 ; - lv2:symbol "oscillator_quality" ; - lv2:name "Oscillator quality", - "Qualité des oscillateurs"@fr , - "Qualità dell'oscillatore"@it ; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:default 1.0 ; - lv2:minimum 0.0 ; - lv2:maximum 3.0 - ] , [ - a lv2:OutputPort, lv2:ControlPort ; - lv2:index 28 ; - lv2:symbol "active_voices" ; - lv2:name "Active voices", - "Voix utilisées"@fr ; - pg:group <@LV2PLUGIN_URI@#status> ; - lv2:portProperty lv2:integer ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 256 ; - ] , [ - a lv2:OutputPort, lv2:ControlPort ; - lv2:index 29 ; - lv2:symbol "num_curves" ; - lv2:name "Number of curves", - "Nombre de courbes"@fr ; - pg:group <@LV2PLUGIN_URI@#status> ; - lv2:portProperty lv2:integer ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 65535 ; - ] , [ - a lv2:OutputPort, lv2:ControlPort ; - lv2:index 30 ; - lv2:symbol "num_masters" ; - lv2:name "Number of masters", - "Nombre de maîtres"@fr ; - pg:group <@LV2PLUGIN_URI@#status> ; - lv2:portProperty lv2:integer ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 65535 ; - ] , [ - a lv2:OutputPort, lv2:ControlPort ; - lv2:index 31 ; - lv2:symbol "num_groups" ; - lv2:name "Number of groups", - "Nombre de groupes"@fr ; - pg:group <@LV2PLUGIN_URI@#status> ; - lv2:portProperty lv2:integer ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 65535 ; - ] , [ - a lv2:OutputPort, lv2:ControlPort ; - lv2:index 32 ; - lv2:symbol "num_regions" ; - lv2:name "Number of regions", - "Nombre de régions"@fr ; - pg:group <@LV2PLUGIN_URI@#status> ; - lv2:portProperty lv2:integer ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 65535 ; - ] , [ - a lv2:OutputPort, lv2:ControlPort ; - lv2:index 33 ; - lv2:symbol "num_samples" ; - lv2:name "Number of samples", - "Nombre d'échantillons"@fr ; - pg:group <@LV2PLUGIN_URI@#status> ; - lv2:portProperty lv2:integer ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 65535 ; - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 34 ; - lv2:symbol "freewheeling_sample_quality" ; - lv2:name "Freewheeling Sample quality", - "Qualité des échantillons en roue libre"@fr; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:default 10.0 ; - lv2:minimum 0.0 ; - lv2:maximum 10.0 - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 35 ; - lv2:symbol "freewheeling_oscillator_quality" ; - lv2:name "Freewheeling Oscillator quality", - "Qualité des oscillateurs en roue libre"@fr ; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:default 3.0 ; - lv2:minimum 0.0 ; - lv2:maximum 3.0 - ] , [ - a lv2:InputPort, lv2:ControlPort ; - lv2:index 36 ; - lv2:symbol "sustain_cancels_release" ; - lv2:name "Sustain cancels release"; - pg:group <@LV2PLUGIN_URI@#config> ; - lv2:portProperty lv2:toggled ; - lv2:default 0 ; - lv2:minimum 0 ; - lv2:maximum 1 ; - ] ; - - rdfs:seeAlso . diff --git a/plugins/lv2/sfizz_lv2.h b/plugins/lv2/sfizz_lv2.h deleted file mode 100644 index ab3dc946f..000000000 --- a/plugins/lv2/sfizz_lv2.h +++ /dev/null @@ -1,163 +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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#define MAX_PATH_SIZE 1024 -#define ATOM_TEMP_SIZE 8192 -#define OSC_TEMP_SIZE 8192 -#define MULTI_OUTPUT_COUNT 16 - -#define SFIZZ_URI "http://sfztools.github.io/sfizz" -#define SFIZZ_MULTI_URI SFIZZ_URI "-multi" -#define SFIZZ_UI_URI "http://sfztools.github.io/sfizz#ui" -#define SFIZZ_PREFIX SFIZZ_URI "#" -#define SFIZZ__sfzFile SFIZZ_URI ":" "sfzfile" -#define SFIZZ__tuningfile SFIZZ_URI ":" "tuningfile" -#define SFIZZ__numVoices SFIZZ_URI ":" "numvoices" -#define SFIZZ__preloadSize SFIZZ_URI ":" "preload_size" -#define SFIZZ__oversampling SFIZZ_URI ":" "oversampling" -#define SFIZZ__lastKeyswitch SFIZZ_URI ":" "last_keyswitch" -#define SFIZZ__description SFIZZ_URI ":" "description" -// These ones are just for the worker -#define SFIZZ__logStatus SFIZZ_URI ":" "log_status" -#define SFIZZ__checkModification SFIZZ_URI ":" "check_modification" -// OSC atoms -#define SFIZZ__OSCBlob SFIZZ_URI ":" "OSCBlob" -#define SFIZZ__Notify SFIZZ_URI ":" "Notify" -// Level atoms -#define SFIZZ__AudioLevel SFIZZ_URI ":" "AudioLevel" - -enum -{ - SFIZZ_CONTROL = 0, - SFIZZ_AUTOMATE = 1, - SFIZZ_LEFT = 2, - SFIZZ_RIGHT = 3, - SFIZZ_VOLUME = 4, - SFIZZ_POLYPHONY = 5, - SFIZZ_OVERSAMPLING = 6, - SFIZZ_PRELOAD = 7, - SFIZZ_FREEWHEELING = 8, - SFIZZ_SCALA_ROOT_KEY = 9, - SFIZZ_TUNING_FREQUENCY = 10, - SFIZZ_STRETCH_TUNING = 11, - SFIZZ_SAMPLE_QUALITY = 12, - SFIZZ_OSCILLATOR_QUALITY = 13, - SFIZZ_ACTIVE_VOICES = 14, - SFIZZ_NUM_CURVES = 15, - SFIZZ_NUM_MASTERS = 16, - SFIZZ_NUM_GROUPS = 17, - SFIZZ_NUM_REGIONS = 18, - SFIZZ_NUM_SAMPLES = 19, - SFIZZ_FREEWHEELING_SAMPLE_QUALITY = 20, - SFIZZ_FREEWHEELING_OSCILLATOR_QUALITY = 21, - SFIZZ_SUSTAIN_CANCELS_RELEASE = 22, -}; - -enum -{ - SFIZZ_MULTI_CONTROL = 0, - SFIZZ_MULTI_AUTOMATE = 1, - SFIZZ_MULTI_OUT1L = 2, - SFIZZ_MULTI_OUT1R = 3, - SFIZZ_MULTI_OUT2L = 4, - SFIZZ_MULTI_OUT2R = 5, - SFIZZ_MULTI_OUT3L = 6, - SFIZZ_MULTI_OUT3R = 7, - SFIZZ_MULTI_OUT4L = 8, - SFIZZ_MULTI_OUT4R = 9, - SFIZZ_MULTI_OUT5L = 10, - SFIZZ_MULTI_OUT5R = 11, - SFIZZ_MULTI_OUT6L = 12, - SFIZZ_MULTI_OUT6R = 13, - SFIZZ_MULTI_OUT7L = 14, - SFIZZ_MULTI_OUT7R = 15, - SFIZZ_MULTI_OUT8L = 16, - SFIZZ_MULTI_OUT8R = 17, - SFIZZ_MULTI_VOLUME = 18, - SFIZZ_MULTI_POLYPHONY = 19, - SFIZZ_MULTI_OVERSAMPLING = 20, - SFIZZ_MULTI_PRELOAD = 21, - SFIZZ_MULTI_FREEWHEELING = 22, - SFIZZ_MULTI_SCALA_ROOT_KEY = 23, - SFIZZ_MULTI_TUNING_FREQUENCY = 24, - SFIZZ_MULTI_STRETCH_TUNING = 25, - SFIZZ_MULTI_SAMPLE_QUALITY = 26, - SFIZZ_MULTI_OSCILLATOR_QUALITY = 27, - SFIZZ_MULTI_ACTIVE_VOICES = 28, - SFIZZ_MULTI_NUM_CURVES = 29, - SFIZZ_MULTI_NUM_MASTERS = 30, - SFIZZ_MULTI_NUM_GROUPS = 31, - SFIZZ_MULTI_NUM_REGIONS = 32, - SFIZZ_MULTI_NUM_SAMPLES = 33, - SFIZZ_MULTI_FREEWHEELING_SAMPLE_QUALITY = 34, - SFIZZ_MULTI_FREEWHEELING_OSCILLATOR_QUALITY = 35, - SFIZZ_MULTI_SUSTAIN_CANCELS_RELEASE = 36, -}; - -// For use with instance-access -struct sfizz_plugin_t; - -/** - * @brief Fetch a copy of the current description, if more recent than what the - * version we already have. - * - * @param self The LV2 plugin - * @param serial The optional serial number to compare against - * @param desc The memory zone which receives the copy - * @param sizep The memory zone which receives the size - * @param serialp The memory zone which receives the new serial - * @return if serial is not null and its value isn't older, false - * otherwise, true, and the pointer returned in descp must be freed with delete[] after use - */ -bool sfizz_lv2_fetch_description( - sfizz_plugin_t *self, const int *serial, - uint8_t **descp, uint32_t *sizep, int *serialp); - -/** - * @brief Returns the number of outputs of the plugin - * - * @param self - * @return int - */ -int sfizz_lv2_get_num_outputs(sfizz_plugin_t *self); - -#if defined(SFIZZ_LV2_UI) -void sfizz_lv2_set_ui_active(sfizz_plugin_t *self, bool ui_active); -#endif - -// Mapping URID to CC and vice-versa -struct sfizz_lv2_ccmap; -sfizz_lv2_ccmap *sfizz_lv2_ccmap_create(LV2_URID_Map* map); -void sfizz_lv2_ccmap_free(sfizz_lv2_ccmap *ccmap); -LV2_URID sfizz_lv2_ccmap_map(const sfizz_lv2_ccmap *ccmap, int cc); -int sfizz_lv2_ccmap_unmap(const sfizz_lv2_ccmap *ccmap, LV2_URID urid); - -struct sfizz_lv2_ccmap_delete { - void operator()(sfizz_lv2_ccmap* ccmap) const noexcept { sfizz_lv2_ccmap_free(ccmap); } -}; diff --git a/plugins/lv2/sfizz_lv2_common.cpp b/plugins/lv2/sfizz_lv2_common.cpp deleted file mode 100644 index bd6a38ee8..000000000 --- a/plugins/lv2/sfizz_lv2_common.cpp +++ /dev/null @@ -1,125 +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 "sfizz_lv2.h" -#include "sfizz_lv2_plugin.h" -#include "sfizz/Config.h" - -bool sfizz_lv2_fetch_description( - sfizz_plugin_t *self, const int *serial, - uint8_t **descp, uint32_t *sizep, int *serialp) -{ - // must be thread-safe - - if (serial && self->sfz_blob_serial == *serial) - return false; - - self->sfz_blob_mutex->lock(); - uint32_t size = self->sfz_blob_size; - uint8_t *data = new uint8_t[size]; - int new_serial = self->sfz_blob_serial; - memcpy(data, self->sfz_blob_data, size); - self->sfz_blob_mutex->unlock(); - - *descp = data; - *sizep = size; - *serialp = new_serial; - - return true; -} - -int sfizz_lv2_get_num_outputs(sfizz_plugin_t *self) -{ - if (self->multi_out) - return MULTI_OUTPUT_COUNT; - - return 2; -} - -#if defined(SFIZZ_LV2_UI) -void sfizz_lv2_set_ui_active(sfizz_plugin_t *self, bool ui_active) -{ - self->ui_active = ui_active; -} -#endif - -struct sfizz_lv2_ccmap { - LV2_URID *cc_to_urid; - int *urid_to_cc; - LV2_URID min_cc_urid; - LV2_URID max_cc_urid; -}; - -sfizz_lv2_ccmap * -sfizz_lv2_ccmap_create(LV2_URID_Map* map) -{ - // store the associations between CC number and parameter URID - // construct it trivially in the form of a tabulated perfect hash function - - LV2_URID* cc_to_urid = new LV2_URID[sfz::config::numCCs]; - int* urid_to_cc; - int urid_to_cc_size; - - LV2_URID min_cc_urid {}; - LV2_URID max_cc_urid {}; - for (int cc = 0; cc < sfz::config::numCCs; ++cc) { - char name[256]; - sprintf(name, SFIZZ_URI "#cc%03d", cc); - LV2_URID urid = map->map(map->handle, name); - if (cc == 0) { - min_cc_urid = urid; - max_cc_urid = urid; - } - else { - min_cc_urid = (urid < min_cc_urid) ? urid : min_cc_urid; - max_cc_urid = (urid > max_cc_urid) ? urid : max_cc_urid; - } - cc_to_urid[cc] = urid; - } - - urid_to_cc_size = max_cc_urid - min_cc_urid + 1; - urid_to_cc = new int[urid_to_cc_size]; - - for (int i = 0; i < urid_to_cc_size; ++i) - urid_to_cc[i] = -1; - - for (int cc = 0; cc < sfz::config::numCCs; ++cc) { - LV2_URID urid = cc_to_urid[cc]; - urid_to_cc[urid - min_cc_urid] = cc; - } - - sfizz_lv2_ccmap *self = new sfizz_lv2_ccmap; - self->cc_to_urid = cc_to_urid; - self->urid_to_cc = urid_to_cc; - self->min_cc_urid = min_cc_urid; - self->max_cc_urid = max_cc_urid; - return self; -} - -void sfizz_lv2_ccmap_free(sfizz_lv2_ccmap *ccmap) -{ - if (ccmap) { - delete[] ccmap->cc_to_urid; - delete[] ccmap->urid_to_cc; - delete ccmap; - } -} - -LV2_URID sfizz_lv2_ccmap_map(const sfizz_lv2_ccmap *ccmap, int cc) -{ - LV2_URID urid = 0; - if (cc >= 0 && cc < sfz::config::numCCs) - urid = ccmap->cc_to_urid[cc]; - return urid; -} - -int sfizz_lv2_ccmap_unmap(const sfizz_lv2_ccmap *ccmap, LV2_URID urid) -{ - int cc = -1; - if (urid >= ccmap->min_cc_urid && urid <= ccmap->max_cc_urid) - cc = ccmap->urid_to_cc[urid - ccmap->min_cc_urid]; - return cc; -} diff --git a/plugins/lv2/sfizz_lv2_plugin.h b/plugins/lv2/sfizz_lv2_plugin.h deleted file mode 100644 index e6722397f..000000000 --- a/plugins/lv2/sfizz_lv2_plugin.h +++ /dev/null @@ -1,163 +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_lv2.h" -#if defined(SFIZZ_LV2_UI) -#include "plugin/RMSFollower.h" -#endif -#include -#include -#include -#include -#include -#include -#include - -#define DEFAULT_SCALA_FILE "Contents/Resources/DefaultScale.scl" -#define DEFAULT_SFZ_FILE "Contents/Resources/DefaultInstrument.sfz" -// This assumes that the longest path is the default sfz file; if not, change it -#define MAX_BUNDLE_PATH_SIZE (MAX_PATH_SIZE - sizeof(DEFAULT_SFZ_FILE)) - -struct sfizz_plugin_t -{ - // Features - LV2_URID_Map *map {}; - LV2_URID_Unmap *unmap {}; - LV2_Worker_Schedule *worker {}; - LV2_Log_Log *log {}; - LV2_Midnam *midnam {}; - - // Ports - bool multi_out { false }; - const LV2_Atom_Sequence *control_port {}; - LV2_Atom_Sequence *automate_port {}; - float *output_buffers[MULTI_OUTPUT_COUNT] {}; - const float *volume_port {}; - const float *polyphony_port {}; - const float *oversampling_port {}; - const float *preload_port {}; - const float *freewheel_port {}; - const float *scala_root_key_port {}; - const float *tuning_frequency_port {}; - const float *stretch_tuning_port {}; - const float *sample_quality_port {}; - const float *oscillator_quality_port {}; - const float *freewheeling_sample_quality_port {}; - const float *freewheeling_oscillator_quality_port {}; - const float *sustain_cancels_release_port {}; - float *active_voices_port {}; - float *num_curves_port {}; - float *num_masters_port {}; - float *num_groups_port {}; - float *num_regions_port {}; - float *num_samples_port {}; - - // Atom forge - LV2_Atom_Forge forge_automate {}; ///< Forge for writing automation atoms in run thread - LV2_Atom_Forge forge_secondary {}; ///< Forge for writing into other buffers - - // Logger - LV2_Log_Logger logger {}; - - // URIs - LV2_URID midi_event_uri {}; - LV2_URID options_interface_uri {}; - LV2_URID max_block_length_uri {}; - LV2_URID nominal_block_length_uri {}; - LV2_URID sample_rate_uri {}; - LV2_URID atom_object_uri {}; - LV2_URID atom_blank_uri {}; - LV2_URID atom_float_uri {}; - LV2_URID atom_double_uri {}; - LV2_URID atom_int_uri {}; - LV2_URID atom_long_uri {}; - LV2_URID atom_urid_uri {}; - LV2_URID atom_path_uri {}; - LV2_URID patch_set_uri {}; - LV2_URID patch_get_uri {}; - LV2_URID patch_put_uri {}; - LV2_URID patch_property_uri {}; - LV2_URID patch_value_uri {}; - LV2_URID patch_body_uri {}; - LV2_URID state_changed_uri {}; - LV2_URID sfizz_sfz_file_uri {}; - LV2_URID sfizz_scala_file_uri {}; - LV2_URID sfizz_description_uri {}; - LV2_URID sfizz_num_voices_uri {}; - LV2_URID sfizz_preload_size_uri {}; - LV2_URID sfizz_oversampling_uri {}; - LV2_URID sfizz_last_keyswitch_uri {}; - LV2_URID sfizz_log_status_uri {}; - LV2_URID sfizz_check_modification_uri {}; - LV2_URID sfizz_active_voices_uri {}; - LV2_URID sfizz_osc_blob_uri {}; - LV2_URID sfizz_notify_uri {}; - LV2_URID sfizz_audio_level_uri {}; - LV2_URID time_position_uri {}; - LV2_URID time_bar_uri {}; - LV2_URID time_bar_beat_uri {}; - LV2_URID time_beat_unit_uri {}; - LV2_URID time_beats_per_bar_uri {}; - LV2_URID time_beats_per_minute_uri {}; - LV2_URID time_speed_uri {}; - - // CC parameters - sfizz_lv2_ccmap* ccmap {}; - - // Sfizz related data - sfizz_synth_t *synth {}; - sfizz_client_t *client {}; - spin_mutex_t *synth_mutex {}; - bool expect_nominal_block_length {}; - char sfz_file_path[MAX_PATH_SIZE] {}; - char scala_file_path[MAX_PATH_SIZE] {}; - int num_voices {}; - unsigned int preload_size {}; - sfizz_oversampling_factor_t oversampling {}; - float stretch_tuning {}; - volatile bool check_modification {}; - int max_block_size {}; - int sample_counter {}; - float sample_rate {}; - std::atomic must_update_midnam {}; - volatile bool must_automate_cc {}; - int last_keyswitch { -1 }; - - // Current instrument description - std::mutex *sfz_blob_mutex {}; - volatile int sfz_blob_serial {}; - const uint8_t *volatile sfz_blob_data {}; - volatile uint32_t sfz_blob_size {}; - char text_description[1024]; - volatile bool resend_description {}; - - // Current CC values in the synth (synchronized by `synth_mutex`) - // updated by hdcc or file load - float *cc_current {}; - volatile bool resync_cc { false }; - - // Timing data - int bar {}; - double bar_beat {}; - int beats_per_bar {}; - int beat_unit {}; - double bpm_tempo {}; - double speed {}; - - // Paths - char bundle_path[MAX_BUNDLE_PATH_SIZE] {}; - - // OSC - uint8_t osc_temp[OSC_TEMP_SIZE] {}; - -#if defined(SFIZZ_LV2_UI) - // UI - volatile bool ui_active = false; - RMSFollower rms_follower; -#endif -}; diff --git a/plugins/lv2/sfizz_ui.cpp b/plugins/lv2/sfizz_ui.cpp deleted file mode 100644 index ba4689591..000000000 --- a/plugins/lv2/sfizz_ui.cpp +++ /dev/null @@ -1,903 +0,0 @@ -/* - SPDX-License-Identifier: ISC - - Sfizz LV2 plugin - - Copyright 2019-2020, Paul Ferrand - - This file was based on skeleton and example code from the LV2 plugin - distribution available at http://lv2plug.in/ - - The LV2 sample plugins have the following copyright and notice, which are - extended to the current work: - Copyright 2011-2016 David Robillard - Copyright 2011 Gabriel M. Beddingfield - Copyright 2011 James Morris - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - Compiling this plugin statically against libsndfile implies distributing it - under the terms of the LGPL v3 license. See the LICENSE.md file for more - information. If you did not receive a LICENSE.md file, inform the current - maintainer. - - THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include "sfizz_lv2.h" - -#include "editor/Editor.h" -#include "editor/EditorController.h" -#include "editor/EditIds.h" -#include "plugin/InstrumentDescription.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef LV2_UI__scaleFactor -#define LV2_UI__scaleFactor LV2_UI_PREFIX "scaleFactor" -#endif - -#include -#include -#include -#include -#include - -#include "vstgui_helpers.h" - -#include "editor/utility/vstgui_before.h" -#include "vstgui/lib/cframe.h" -#include "vstgui/lib/platform/iplatformframe.h" -#include "vstgui/lib/platform/platformfactory.h" -#if defined(_WIN32) -#include "vstgui/lib/platform/platform_win32.h" -#include "vstgui/lib/platform/win32/win32factory.h" -#endif -#include "editor/utility/vstgui_after.h" -using namespace VSTGUI; - -/// -struct FrameHolderDeleter { - void operator()(CFrame* frame) const - { - if (frame->getNbReference() != 1) - frame->forget(); - else - frame->close(); - } -}; -typedef std::unique_ptr FrameHolder; - -/// -struct sfizz_ui_t : EditorController, VSTGUIEditorInterface { -#if LINUX - SoHandleInitializer soHandleInitializer; -#endif -#if MAC - BundleRefInitializer bundleRefInitializer; -#endif - VSTGUIInitializer vstguiInitializer; - LV2UI_Write_Function write = nullptr; - LV2UI_Controller con = nullptr; - LV2_URID_Map *map = nullptr; - LV2_URID_Unmap *unmap = nullptr; - LV2UI_Resize *resize = nullptr; - LV2UI_Touch *touch = nullptr; - sfizz_plugin_t *plugin = nullptr; - FrameHolder uiFrame; - std::unique_ptr editor; -#if LINUX - SharedPointer runLoop; -#endif - - /// VSTGUIEditorInterface - CFrame* getFrame() const override { return uiFrame.get(); } - int32_t getKnobMode () const override { return kLinearMode; } - LV2_Atom_Forge atom_forge; - LV2_URID atom_event_transfer_uri; - LV2_URID atom_object_uri; - LV2_URID atom_float_uri; - LV2_URID atom_path_uri; - LV2_URID atom_urid_uri; - LV2_URID midi_event_uri; - LV2_URID patch_get_uri; - LV2_URID patch_set_uri; - LV2_URID patch_property_uri; - LV2_URID patch_value_uri; -#if !defined(__APPLE__) - LV2_URID opt_scalefactor_uri; - float scale_factor = 0.0f; -#endif - LV2_URID sfizz_sfz_file_uri; - LV2_URID sfizz_scala_file_uri; - LV2_URID sfizz_osc_blob_uri; - LV2_URID sfizz_notify_uri; - LV2_URID sfizz_audio_level_uri; - std::unique_ptr ccmap; - - uint8_t osc_temp[OSC_TEMP_SIZE]; - alignas(LV2_Atom) uint8_t atom_temp[ATOM_TEMP_SIZE]; - - int sfz_serial = 0; - bool valid_sfz_serial = false; - bool multi_out = false; - -protected: - void uiSendValue(EditId id, const EditValue& v) override; - void uiBeginSend(EditId id) override; - void uiEndSend(EditId id) override; - void uiSendMIDI(const uint8_t* msg, uint32_t len) override; - void uiSendMessage(const char* path, const char* sig, const sfizz_arg_t* args) override; - -private: - void uiTouch(EditId id, bool t); -}; - -#if defined(_WIN32) -static bool fixBundlePath(std::string& path) -{ - // go up some directories until reaching the *.lv2 directory - bool valid = false; - while (!valid && !path.empty()) { - if (path.back() == '\\' || path.back() == '/') - path.pop_back(); - else if (path.size() > 4 && !memcmp(".lv2", path.data() + path.size() - 4, 4)) - valid = true; - else { - path.pop_back(); - while (!path.empty() && path.back() != '\\' && path.back() != '/') - path.pop_back(); - } - } - return valid; -} -#endif - -static LV2UI_Handle -instantiate(const LV2UI_Descriptor *descriptor, - const char *plugin_uri, - const char *bundle_path, - LV2UI_Write_Function write_function, - LV2UI_Controller controller, - LV2UI_Widget *widget, - const LV2_Feature * const *features) -{ - std::unique_ptr self { new sfizz_ui_t }; - - (void)descriptor; - (void)plugin_uri; - (void)bundle_path; - - self->write = write_function; - self->con = controller; - - void *parentWindowId = nullptr; - - LV2_URID_Map *map = nullptr; - LV2_URID_Unmap *unmap = nullptr; - const LV2_Options_Option* options = nullptr; - - for (const LV2_Feature *const *f = features; *f; f++) - { - if (!strcmp((**f).URI, LV2_URID__map)) - self->map = map = (LV2_URID_Map *)(**f).data; - else if (!strcmp((**f).URI, LV2_URID__unmap)) - self->unmap = unmap = (LV2_URID_Unmap *)(**f).data; - else if (!strcmp((**f).URI, LV2_UI__resize)) - self->resize = (LV2UI_Resize *)(**f).data; - else if (!strcmp((**f).URI, LV2_UI__touch)) - self->touch = (LV2UI_Touch*)(**f).data; - else if (!strcmp((**f).URI, LV2_UI__parent)) - parentWindowId = (**f).data; - else if (!strcmp((**f).URI, LV2_INSTANCE_ACCESS_URI)) - self->plugin = (sfizz_plugin_t *)(**f).data; - else if (!strcmp((**f).URI, LV2_OPTIONS__options)) - options = (const LV2_Options_Option*)(**f).data; // scaleFactor only ATM - } - - // The map feature is required - if (!map || !unmap) - return nullptr; - - // The instance-access feature is required - if (!self->plugin) - return nullptr; - - LV2_Atom_Forge *forge = &self->atom_forge; - lv2_atom_forge_init(forge, map); - self->atom_event_transfer_uri = map->map(map->handle, LV2_ATOM__eventTransfer); - self->atom_object_uri = map->map(map->handle, LV2_ATOM__Object); - self->atom_float_uri = map->map(map->handle, LV2_ATOM__Float); - self->atom_path_uri = map->map(map->handle, LV2_ATOM__Path); - self->atom_urid_uri = map->map(map->handle, LV2_ATOM__URID); - self->midi_event_uri = map->map(map->handle, LV2_MIDI__MidiEvent); -#if !defined(__APPLE__) - self->opt_scalefactor_uri = map->map(map->handle, LV2_UI__scaleFactor); -#endif - self->patch_get_uri = map->map(map->handle, LV2_PATCH__Get); - self->patch_set_uri = map->map(map->handle, LV2_PATCH__Set); - self->patch_property_uri = map->map(map->handle, LV2_PATCH__property); - self->patch_value_uri = map->map(map->handle, LV2_PATCH__value); - self->sfizz_sfz_file_uri = map->map(map->handle, SFIZZ__sfzFile); - self->sfizz_scala_file_uri = map->map(map->handle, SFIZZ__tuningfile); - self->sfizz_osc_blob_uri = map->map(map->handle, SFIZZ__OSCBlob); - self->sfizz_notify_uri = map->map(map->handle, SFIZZ__Notify); - self->sfizz_audio_level_uri = map->map(map->handle, SFIZZ__AudioLevel); - self->ccmap.reset(sfizz_lv2_ccmap_create(map)); - -#if !defined(__APPLE__) - if (options != nullptr) { - for (int i=0; options[i].key != 0; ++i) - { - if (options[i].key == self->opt_scalefactor_uri) { - if (options[i].type == self->atom_float_uri) { - self->scale_factor = *(const float*)options[i].value; - fprintf(stderr, "[sfizz] scale factor: %f\n", self->scale_factor); - } else { - fprintf(stderr, "[sfizz] Host provides UI scale factor but has wrong value type\n"); - } - } - } - } -#endif - - // set up the resource path - // * on Linux, this is determined by going 2 folders back from the SO path - // name, and appending "Contents/Resources" (not overridable) - // * on Windows, the folder is set programmatically - // * on macOS, resource files are looked up using CFBundle APIs - -#if defined(_WIN32) - // some hosts give us the DLL path instead of the bundle path, - // so we have to work around that. - std::string realBundlePath { bundle_path }; - if (!fixBundlePath(realBundlePath)) - return nullptr; - - const Win32Factory* winFactory = VSTGUI::getPlatformFactory().asWin32Factory(); - std::string resourcePath = realBundlePath + "\\Contents\\Resources\\"; - winFactory->setResourceBasePath(resourcePath.c_str()); -#endif - - // makes labels refresh correctly - CView::kDirtyCallAlwaysOnMainThread = true; - - const CRect uiBounds(0, 0, Editor::viewWidth, Editor::viewHeight); - CFrame* uiFrame = new CFrame(uiBounds, self.get()); - self->uiFrame.reset(uiFrame); - - IPlatformFrameConfig* config = nullptr; -#if LINUX - SharedPointer runLoop = owned(new Lv2IdleRunLoop); - self->runLoop = runLoop; - VSTGUI::X11::FrameConfig x11Config; - x11Config.runLoop = runLoop; - config = &x11Config; -#endif - - if (!uiFrame->open(parentWindowId, PlatformType::kDefaultNative, config)) - return nullptr; - - Editor *editor = new Editor(*self); - self->editor.reset(editor); - editor->open(*uiFrame); - - // let the editor know about plugin format - self->uiReceiveValue(EditId::PluginFormat, std::string("LV2")); - - // user files dir is not relevant to LV2 (not yet?) - // LV2 has its own path management mechanism - self->uiReceiveValue(EditId::CanEditUserFilesDir, 0); - - // Send the number of outputs if necessary - int numOutputs = sfizz_lv2_get_num_outputs(self->plugin); - if (numOutputs > 2) { - self->multi_out = true; - self->uiReceiveValue(EditId::PluginOutputs, numOutputs); - } - - *widget = reinterpret_cast(uiFrame->getPlatformFrame()->getPlatformRepresentation()); - -#if !defined (__APPLE__) - float scaleFactor = uiFrame->getZoom() * self->scale_factor; - uiFrame->setZoom(scaleFactor); - fprintf(stderr, "[sfizz] zoom factor: %f\n", scaleFactor); - - int width = Editor::viewWidth * scaleFactor; - int height = Editor::viewHeight * scaleFactor; -#else - int width = Editor::viewWidth; - int height = Editor::viewHeight; -#endif - if (self->resize) - self->resize->ui_resize(self->resize->handle, width, height); - - // send a request to receive all parameters - uint8_t buffer[256]; - lv2_atom_forge_set_buffer(forge, buffer, sizeof(buffer)); - LV2_Atom_Forge_Frame frame; - LV2_Atom *msg = (LV2_Atom *)lv2_atom_forge_object(forge, &frame, 0, self->patch_get_uri); - lv2_atom_forge_pop(forge, &frame); - write_function(controller, 0, lv2_atom_total_size(msg), self->atom_event_transfer_uri, msg); - - return self.release(); -} - -static void -cleanup(LV2UI_Handle ui) -{ - sfizz_ui_t *self = (sfizz_ui_t *)ui; - sfizz_lv2_set_ui_active(self->plugin, false); - delete self; -} - -static void -port_event_stereo(sfizz_ui_t *self, uint32_t port_index, const void *buffer) -{ - const float v = *reinterpret_cast(buffer); - - switch (port_index) { - case SFIZZ_VOLUME: - self->uiReceiveValue(EditId::Volume, v); - break; - case SFIZZ_POLYPHONY: - self->uiReceiveValue(EditId::Polyphony, v); - break; - case SFIZZ_OVERSAMPLING: - self->uiReceiveValue(EditId::Oversampling, v); - break; - case SFIZZ_PRELOAD: - self->uiReceiveValue(EditId::PreloadSize, v); - break; - case SFIZZ_SCALA_ROOT_KEY: - self->uiReceiveValue(EditId::ScalaRootKey, v); - break; - case SFIZZ_TUNING_FREQUENCY: - self->uiReceiveValue(EditId::TuningFrequency, v); - break; - case SFIZZ_STRETCH_TUNING: - self->uiReceiveValue(EditId::StretchTuning, v); - break; - case SFIZZ_SAMPLE_QUALITY: - self->uiReceiveValue(EditId::SampleQuality, v); - break; - case SFIZZ_OSCILLATOR_QUALITY: - self->uiReceiveValue(EditId::OscillatorQuality, v); - break; - case SFIZZ_ACTIVE_VOICES: - self->uiReceiveValue(EditId::UINumActiveVoices, v); - break; - case SFIZZ_NUM_CURVES: - self->uiReceiveValue(EditId::UINumCurves, v); - break; - case SFIZZ_NUM_MASTERS: - self->uiReceiveValue(EditId::UINumMasters, v); - break; - case SFIZZ_NUM_GROUPS: - self->uiReceiveValue(EditId::UINumGroups, v); - break; - case SFIZZ_NUM_REGIONS: - self->uiReceiveValue(EditId::UINumRegions, v); - break; - case SFIZZ_NUM_SAMPLES: - self->uiReceiveValue(EditId::UINumPreloadedSamples, v); - break; - case SFIZZ_FREEWHEELING_SAMPLE_QUALITY: - self->uiReceiveValue(EditId::FreewheelingSampleQuality, v); - break; - case SFIZZ_FREEWHEELING_OSCILLATOR_QUALITY: - self->uiReceiveValue(EditId::FreewheelingOscillatorQuality, v); - break; - case SFIZZ_SUSTAIN_CANCELS_RELEASE: - self->uiReceiveValue(EditId::SustainCancelsRelease, v); - break; - } -} - -static void -port_event_multi(sfizz_ui_t *self, uint32_t port_index, const void *buffer) -{ - const float v = *reinterpret_cast(buffer); - - switch (port_index) { - case SFIZZ_MULTI_VOLUME: - self->uiReceiveValue(EditId::Volume, v); - break; - case SFIZZ_MULTI_POLYPHONY: - self->uiReceiveValue(EditId::Polyphony, v); - break; - case SFIZZ_MULTI_OVERSAMPLING: - self->uiReceiveValue(EditId::Oversampling, v); - break; - case SFIZZ_MULTI_PRELOAD: - self->uiReceiveValue(EditId::PreloadSize, v); - break; - case SFIZZ_MULTI_SCALA_ROOT_KEY: - self->uiReceiveValue(EditId::ScalaRootKey, v); - break; - case SFIZZ_MULTI_TUNING_FREQUENCY: - self->uiReceiveValue(EditId::TuningFrequency, v); - break; - case SFIZZ_MULTI_STRETCH_TUNING: - self->uiReceiveValue(EditId::StretchTuning, v); - break; - case SFIZZ_MULTI_SAMPLE_QUALITY: - self->uiReceiveValue(EditId::SampleQuality, v); - break; - case SFIZZ_MULTI_OSCILLATOR_QUALITY: - self->uiReceiveValue(EditId::OscillatorQuality, v); - break; - case SFIZZ_MULTI_ACTIVE_VOICES: - self->uiReceiveValue(EditId::UINumActiveVoices, v); - break; - case SFIZZ_MULTI_NUM_CURVES: - self->uiReceiveValue(EditId::UINumCurves, v); - break; - case SFIZZ_MULTI_NUM_MASTERS: - self->uiReceiveValue(EditId::UINumMasters, v); - break; - case SFIZZ_MULTI_NUM_GROUPS: - self->uiReceiveValue(EditId::UINumGroups, v); - break; - case SFIZZ_MULTI_NUM_REGIONS: - self->uiReceiveValue(EditId::UINumRegions, v); - break; - case SFIZZ_MULTI_NUM_SAMPLES: - self->uiReceiveValue(EditId::UINumPreloadedSamples, v); - break; - case SFIZZ_MULTI_FREEWHEELING_SAMPLE_QUALITY: - self->uiReceiveValue(EditId::FreewheelingSampleQuality, v); - break; - case SFIZZ_MULTI_FREEWHEELING_OSCILLATOR_QUALITY: - self->uiReceiveValue(EditId::FreewheelingOscillatorQuality, v); - break; - case SFIZZ_MULTI_SUSTAIN_CANCELS_RELEASE: - self->uiReceiveValue(EditId::SustainCancelsRelease, v); - break; - } -} - -static void -port_event(LV2UI_Handle ui, - uint32_t port_index, - uint32_t buffer_size, - uint32_t format, - const void *buffer) -{ - sfizz_ui_t *self = (sfizz_ui_t *)ui; - if (format == 0) { - if (self->multi_out) - port_event_multi(self, port_index, buffer); - else - port_event_stereo(self, port_index, buffer); - } - else if (format == self->atom_event_transfer_uri) { - auto *atom = reinterpret_cast(buffer); - - if (atom->type == self->atom_object_uri) { - const LV2_Atom *prop = nullptr; - const LV2_Atom *value = nullptr; - - lv2_atom_object_get( - reinterpret_cast(atom), - self->patch_property_uri, &prop, self->patch_value_uri, &value, 0); - - if (prop && value && prop->type == self->atom_urid_uri) { - const LV2_URID prop_uri = reinterpret_cast(prop)->body; - auto *value_body = reinterpret_cast(LV2_ATOM_BODY_CONST(value)); - - int cc = sfizz_lv2_ccmap_unmap(self->ccmap.get(), prop_uri); - - if (cc != -1) { - if (value->type == self->atom_float_uri) { - float ccvalue = *reinterpret_cast(value_body); - self->uiReceiveValue(editIdForCC(cc), ccvalue); - } - } - else if (prop_uri == self->sfizz_sfz_file_uri && value->type == self->atom_path_uri) { - std::string path(value_body, strnlen(value_body, value->size)); - self->uiReceiveValue(EditId::SfzFile, path); - } - else if (prop_uri == self->sfizz_scala_file_uri && value->type == self->atom_path_uri) { - std::string path(value_body, strnlen(value_body, value->size)); - self->uiReceiveValue(EditId::ScalaFile, path); - } - } - } - else if (atom->type == self->sfizz_osc_blob_uri) { - const char *path; - const char *sig; - const sfizz_arg_t *args; - uint8_t buffer[1024]; - if (sfizz_extract_message(LV2_ATOM_BODY_CONST(atom), atom->size, buffer, sizeof(buffer), &path, &sig, &args) > 0) - self->uiReceiveMessage(path, sig, args); - } - else if (atom->type == self->sfizz_audio_level_uri) { - const LV2_Atom_Vector *vector = reinterpret_cast(atom); - - if (vector->body.child_type == self->atom_float_uri && - vector->body.child_size == sizeof(float)) - { - const uint8_t *vec_body = reinterpret_cast( - LV2_ATOM_CONTENTS_CONST(LV2_Atom_Vector, vector)); - const uint8_t *vec_end = reinterpret_cast( - LV2_ATOM_BODY_CONST(&vector->atom)) + vector->atom.size; - - const float *levels = reinterpret_cast(vec_body); - uint32_t count = static_cast((vec_end - vec_body) / sizeof(float)); - - for (uint32_t i = 0; i < count; ++i) - self->uiReceiveValue(editIdForLevel(i), levels[i]); - } - } - } - - (void)buffer_size; -} - -static void -sfizz_ui_update_description(sfizz_ui_t *self, const InstrumentDescription& desc) -{ - self->uiReceiveValue(EditId::UINumCurves, desc.numCurves); - self->uiReceiveValue(EditId::UINumMasters, desc.numMasters); - self->uiReceiveValue(EditId::UINumGroups, desc.numGroups); - self->uiReceiveValue(EditId::UINumRegions, desc.numRegions); - self->uiReceiveValue(EditId::UINumPreloadedSamples, desc.numSamples); - - const fs::path rootPath = fs::u8path(desc.rootPath); - const fs::path imagePath = rootPath / fs::u8path(desc.image); - const fs::path imageCtrlPath = rootPath / fs::u8path(desc.image_controls); - self->uiReceiveValue(EditId::BackgroundImage, imagePath.u8string()); - self->uiReceiveValue(EditId::ControlsImage, imageCtrlPath.u8string()); - - for (unsigned key = 0; key < 128; ++key) { - bool keyUsed = desc.keyUsed.test(key); - bool keyswitchUsed = desc.keyswitchUsed.test(key); - self->uiReceiveValue(editIdForKeyUsed(key), float(keyUsed)); - self->uiReceiveValue(editIdForKeyswitchUsed(key), float(keyswitchUsed)); - if (keyUsed) - self->uiReceiveValue(editIdForKeyLabel(key), desc.keyLabel[key]); - if (keyswitchUsed) - self->uiReceiveValue(editIdForKeyswitchLabel(key), desc.keyswitchLabel[key]); - } - - for (unsigned cc = 0; cc < sfz::config::numCCs; ++cc) { - bool ccUsed = desc.ccUsed.test(cc) && !desc.sustainOrSostenuto.test(cc); - self->uiReceiveValue(editIdForCCUsed(cc), float(ccUsed)); - if (ccUsed) { - self->uiReceiveValue(editIdForCCDefault(cc), desc.ccDefault[cc]); - self->uiReceiveValue(editIdForCCLabel(cc), desc.ccLabel[cc]); - } - } -} - -static void -sfizz_ui_check_sfz_update(sfizz_ui_t *self) -{ - uint8_t *data = nullptr; - uint32_t size = 0; - int new_serial = 0; - const int *serial = self->valid_sfz_serial ? &self->sfz_serial : nullptr; - - bool update = sfizz_lv2_fetch_description( - self->plugin, serial, &data, &size, &new_serial); - - if (update) { - std::unique_ptr cleanup(data); - self->sfz_serial = new_serial; - self->valid_sfz_serial = true; - - const InstrumentDescription desc = parseDescriptionBlob( - absl::string_view(reinterpret_cast(data), size)); - sfizz_ui_update_description(self, desc); - } -} - -static int -idle(LV2UI_Handle ui) -{ - sfizz_ui_t *self = (sfizz_ui_t *)ui; - - // check if there are news regarding the current SFZ - sfizz_ui_check_sfz_update(self); - -#if LINUX - self->runLoop->execIdle(); -#else - (void)self; -#endif - - sfizz_lv2_set_ui_active(self->plugin, self->uiFrame->isVisible()); - - return 0; -} - -static const LV2UI_Idle_Interface idle_interface = { - &idle, -}; - -static int -show(LV2UI_Handle ui) -{ - sfizz_ui_t *self = (sfizz_ui_t *)ui; - self->uiFrame->setVisible(true); - return 0; -} - -static int -hide(LV2UI_Handle ui) -{ - sfizz_ui_t *self = (sfizz_ui_t *)ui; - self->uiFrame->setVisible(false); - return 0; -} - -static const LV2UI_Show_Interface show_interface = { - &show, - &hide, -}; - -const void * -extension_data(const char *uri) -{ - if (!strcmp(uri, LV2_UI__idleInterface)) - return &idle_interface; - - if (!strcmp(uri, LV2_UI__showInterface)) - return &show_interface; - - return nullptr; -} - -static const LV2UI_Descriptor descriptor = { - SFIZZ_UI_URI, - instantiate, - cleanup, - port_event, - extension_data, -}; - -LV2_SYMBOL_EXPORT -const LV2UI_Descriptor * -lv2ui_descriptor(uint32_t index) -{ - switch (index) - { - case 0: - return &descriptor; - default: - return nullptr; - } -} - -/// -void sfizz_ui_t::uiSendValue(EditId id, const EditValue& v) -{ - auto sendFloat = [this](int port, float value) { - write(con, port, sizeof(float), 0, &value); - }; - - auto sendPath = [this](LV2_URID property, const std::string& value) { - LV2_Atom_Forge *forge = &atom_forge; - LV2_Atom_Forge_Frame frame; - auto *atom = reinterpret_cast(atom_temp); - lv2_atom_forge_set_buffer(forge, atom_temp, sizeof(atom_temp)); - if (lv2_atom_forge_object(forge, &frame, 0, patch_set_uri) && - lv2_atom_forge_key(forge, patch_property_uri) && - lv2_atom_forge_urid(forge, property) && - lv2_atom_forge_key(forge, patch_value_uri) && - lv2_atom_forge_path(forge, value.data(), value.size())) - { - lv2_atom_forge_pop(forge, &frame); - write(con, SFIZZ_CONTROL, lv2_atom_total_size(atom), atom_event_transfer_uri, atom); - } - }; - - auto sendController = [this](LV2_URID property, float value) { - LV2_Atom_Forge *forge = &atom_forge; - LV2_Atom_Forge_Frame frame; - auto *atom = reinterpret_cast(atom_temp); - lv2_atom_forge_set_buffer(forge, atom_temp, sizeof(atom_temp)); - if (lv2_atom_forge_object(forge, &frame, 0, patch_set_uri) && - lv2_atom_forge_key(forge, patch_property_uri) && - lv2_atom_forge_urid(forge, property) && - lv2_atom_forge_key(forge, patch_value_uri) && - lv2_atom_forge_float(forge, value)) - { - lv2_atom_forge_pop(forge, &frame); - write(con, SFIZZ_CONTROL, lv2_atom_total_size(atom), atom_event_transfer_uri, atom); - } - }; - - switch (id) { - case EditId::Volume: - if (multi_out) - sendFloat(SFIZZ_MULTI_VOLUME, v.to_float()); - else - sendFloat(SFIZZ_VOLUME, v.to_float()); - break; - case EditId::Polyphony: - if (multi_out) - sendFloat(SFIZZ_MULTI_POLYPHONY, v.to_float()); - else - sendFloat(SFIZZ_POLYPHONY, v.to_float()); - break; - case EditId::Oversampling: - if (multi_out) - sendFloat(SFIZZ_MULTI_OVERSAMPLING, v.to_float()); - else - sendFloat(SFIZZ_OVERSAMPLING, v.to_float()); - break; - case EditId::PreloadSize: - if (multi_out) - sendFloat(SFIZZ_MULTI_PRELOAD, v.to_float()); - else - sendFloat(SFIZZ_PRELOAD, v.to_float()); - break; - case EditId::ScalaRootKey: - if (multi_out) - sendFloat(SFIZZ_MULTI_SCALA_ROOT_KEY, v.to_float()); - else - sendFloat(SFIZZ_SCALA_ROOT_KEY, v.to_float()); - break; - case EditId::TuningFrequency: - if (multi_out) - sendFloat(SFIZZ_MULTI_TUNING_FREQUENCY, v.to_float()); - else - sendFloat(SFIZZ_TUNING_FREQUENCY, v.to_float()); - break; - case EditId::StretchTuning: - if (multi_out) - sendFloat(SFIZZ_MULTI_STRETCH_TUNING, v.to_float()); - else - sendFloat(SFIZZ_STRETCH_TUNING, v.to_float()); - break; - case EditId::SampleQuality: - if (multi_out) - sendFloat(SFIZZ_MULTI_SAMPLE_QUALITY, v.to_float()); - else - sendFloat(SFIZZ_SAMPLE_QUALITY, v.to_float()); - break; - case EditId::OscillatorQuality: - if (multi_out) - sendFloat(SFIZZ_MULTI_OSCILLATOR_QUALITY, v.to_float()); - else - sendFloat(SFIZZ_OSCILLATOR_QUALITY, v.to_float()); - break; - case EditId::FreewheelingSampleQuality: - if (multi_out) - sendFloat(SFIZZ_MULTI_FREEWHEELING_SAMPLE_QUALITY, v.to_float()); - else - sendFloat(SFIZZ_FREEWHEELING_SAMPLE_QUALITY, v.to_float()); - break; - case EditId::FreewheelingOscillatorQuality: - if (multi_out) - sendFloat(SFIZZ_MULTI_FREEWHEELING_OSCILLATOR_QUALITY, v.to_float()); - else - sendFloat(SFIZZ_FREEWHEELING_OSCILLATOR_QUALITY, v.to_float()); - break; - case EditId::SustainCancelsRelease: - if (multi_out) - sendFloat(SFIZZ_MULTI_SUSTAIN_CANCELS_RELEASE, v.to_float()); - else - sendFloat(SFIZZ_SUSTAIN_CANCELS_RELEASE, v.to_float()); - break; - case EditId::SfzFile: - sendPath(sfizz_sfz_file_uri, v.to_string()); - break; - case EditId::ScalaFile: - sendPath(sfizz_scala_file_uri, v.to_string()); - break; - default: - if (editIdIsCC(id)) { - int cc = ccForEditId(id); -#if defined(SFIZZ_LV2_PSA) - if (cc >= 0 && cc < 128) { - // Send MIDI message - uint8_t msg[3]; - msg[0] = 0xB0; - msg[1] = static_cast(cc); - msg[2] = static_cast(v.to_float() * 127); - uiSendMIDI(msg, 3); - break; - } -#endif - LV2_URID urid = sfizz_lv2_ccmap_map(ccmap.get(), cc); - sendController(urid, v.to_float()); - } - break; - } -} - -void sfizz_ui_t::uiBeginSend(EditId id) -{ - uiTouch(id, true); -} - -void sfizz_ui_t::uiEndSend(EditId id) -{ - uiTouch(id, false); -} - -void sfizz_ui_t::uiTouch(EditId id, bool t) -{ - if (!touch) - return; - - switch (id) { - case EditId::Volume: - touch->touch(touch->handle, SFIZZ_VOLUME, t); - break; - case EditId::Polyphony: - touch->touch(touch->handle, SFIZZ_POLYPHONY, t); - break; - case EditId::Oversampling: - touch->touch(touch->handle, SFIZZ_OVERSAMPLING, t); - break; - case EditId::PreloadSize: - touch->touch(touch->handle, SFIZZ_PRELOAD, t); - break; - case EditId::ScalaRootKey: - touch->touch(touch->handle, SFIZZ_SCALA_ROOT_KEY, t); - break; - case EditId::TuningFrequency: - touch->touch(touch->handle, SFIZZ_TUNING_FREQUENCY, t); - break; - case EditId::StretchTuning: - touch->touch(touch->handle, SFIZZ_STRETCH_TUNING, t); - break; - case EditId::SampleQuality: - touch->touch(touch->handle, SFIZZ_SAMPLE_QUALITY, t); - break; - case EditId::OscillatorQuality: - touch->touch(touch->handle, SFIZZ_OSCILLATOR_QUALITY, t); - break; - default: - break; - } -} - -void sfizz_ui_t::uiSendMIDI(const uint8_t* msg, uint32_t len) -{ - LV2_Atom_Forge *forge = &atom_forge; - auto *atom = reinterpret_cast(atom_temp); - lv2_atom_forge_set_buffer(forge, atom_temp, sizeof(atom_temp)); - if (lv2_atom_forge_atom(forge, len, midi_event_uri) && - lv2_atom_forge_write(forge, msg, len)) - { - write(con, SFIZZ_CONTROL, lv2_atom_total_size(atom), atom_event_transfer_uri, atom); - } -} - -void sfizz_ui_t::uiSendMessage(const char* path, const char* sig, const sfizz_arg_t* args) -{ - uint8_t *osc_temp = this->osc_temp; - uint32_t osc_size = sfizz_prepare_message(osc_temp, OSC_TEMP_SIZE, path, sig, args); - - if (osc_size > OSC_TEMP_SIZE) - return; - - LV2_Atom_Forge *forge = &atom_forge; - auto *atom = reinterpret_cast(atom_temp); - lv2_atom_forge_set_buffer(forge, atom_temp, sizeof(atom_temp)); - - if (lv2_atom_forge_atom(forge, osc_size, sfizz_osc_blob_uri) && - lv2_atom_forge_raw(forge, osc_temp, osc_size)) - { - write(con, SFIZZ_CONTROL, lv2_atom_total_size(atom), atom_event_transfer_uri, atom); - } -} diff --git a/plugins/lv2/sfizz_ui.ttl.in b/plugins/lv2/sfizz_ui.ttl.in deleted file mode 100644 index 53470317c..000000000 --- a/plugins/lv2/sfizz_ui.ttl.in +++ /dev/null @@ -1,17 +0,0 @@ -@prefix lv2: . -@prefix opts: . -@prefix ui: . -@prefix urid: . - -<@LV2PLUGIN_URI@#ui> - lv2:extensionData ui:idleInterface ; - lv2:extensionData ui:showInterface ; - lv2:requiredFeature ui:idleInterface ; - lv2:optionalFeature ui:noUserResize ; - lv2:optionalFeature ui:resize ; - lv2:optionalFeature ui:parent ; - lv2:optionalFeature ui:touch ; - opts:supportedOption ui:scaleFactor ; - lv2:requiredFeature urid:map ; - lv2:requiredFeature urid:unmap ; - lv2:requiredFeature . diff --git a/plugins/lv2/vendor/lv2/atom/atom.h b/plugins/lv2/vendor/lv2/atom/atom.h deleted file mode 100644 index a6178cfaa..000000000 --- a/plugins/lv2/vendor/lv2/atom/atom.h +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright 2008-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_ATOM_H -#define LV2_ATOM_H - -/** - @defgroup atom Atom - @ingroup lv2 - - A generic value container and several data types. - - See for details. - - @{ -*/ - -#include - -// clang-format off - -#define LV2_ATOM_URI "http://lv2plug.in/ns/ext/atom" ///< http://lv2plug.in/ns/ext/atom -#define LV2_ATOM_PREFIX LV2_ATOM_URI "#" ///< http://lv2plug.in/ns/ext/atom# - -#define LV2_ATOM__Atom LV2_ATOM_PREFIX "Atom" ///< http://lv2plug.in/ns/ext/atom#Atom -#define LV2_ATOM__AtomPort LV2_ATOM_PREFIX "AtomPort" ///< http://lv2plug.in/ns/ext/atom#AtomPort -#define LV2_ATOM__Blank LV2_ATOM_PREFIX "Blank" ///< http://lv2plug.in/ns/ext/atom#Blank -#define LV2_ATOM__Bool LV2_ATOM_PREFIX "Bool" ///< http://lv2plug.in/ns/ext/atom#Bool -#define LV2_ATOM__Chunk LV2_ATOM_PREFIX "Chunk" ///< http://lv2plug.in/ns/ext/atom#Chunk -#define LV2_ATOM__Double LV2_ATOM_PREFIX "Double" ///< http://lv2plug.in/ns/ext/atom#Double -#define LV2_ATOM__Event LV2_ATOM_PREFIX "Event" ///< http://lv2plug.in/ns/ext/atom#Event -#define LV2_ATOM__Float LV2_ATOM_PREFIX "Float" ///< http://lv2plug.in/ns/ext/atom#Float -#define LV2_ATOM__Int LV2_ATOM_PREFIX "Int" ///< http://lv2plug.in/ns/ext/atom#Int -#define LV2_ATOM__Literal LV2_ATOM_PREFIX "Literal" ///< http://lv2plug.in/ns/ext/atom#Literal -#define LV2_ATOM__Long LV2_ATOM_PREFIX "Long" ///< http://lv2plug.in/ns/ext/atom#Long -#define LV2_ATOM__Number LV2_ATOM_PREFIX "Number" ///< http://lv2plug.in/ns/ext/atom#Number -#define LV2_ATOM__Object LV2_ATOM_PREFIX "Object" ///< http://lv2plug.in/ns/ext/atom#Object -#define LV2_ATOM__Path LV2_ATOM_PREFIX "Path" ///< http://lv2plug.in/ns/ext/atom#Path -#define LV2_ATOM__Property LV2_ATOM_PREFIX "Property" ///< http://lv2plug.in/ns/ext/atom#Property -#define LV2_ATOM__Resource LV2_ATOM_PREFIX "Resource" ///< http://lv2plug.in/ns/ext/atom#Resource -#define LV2_ATOM__Sequence LV2_ATOM_PREFIX "Sequence" ///< http://lv2plug.in/ns/ext/atom#Sequence -#define LV2_ATOM__Sound LV2_ATOM_PREFIX "Sound" ///< http://lv2plug.in/ns/ext/atom#Sound -#define LV2_ATOM__String LV2_ATOM_PREFIX "String" ///< http://lv2plug.in/ns/ext/atom#String -#define LV2_ATOM__Tuple LV2_ATOM_PREFIX "Tuple" ///< http://lv2plug.in/ns/ext/atom#Tuple -#define LV2_ATOM__URI LV2_ATOM_PREFIX "URI" ///< http://lv2plug.in/ns/ext/atom#URI -#define LV2_ATOM__URID LV2_ATOM_PREFIX "URID" ///< http://lv2plug.in/ns/ext/atom#URID -#define LV2_ATOM__Vector LV2_ATOM_PREFIX "Vector" ///< http://lv2plug.in/ns/ext/atom#Vector -#define LV2_ATOM__atomTransfer LV2_ATOM_PREFIX "atomTransfer" ///< http://lv2plug.in/ns/ext/atom#atomTransfer -#define LV2_ATOM__beatTime LV2_ATOM_PREFIX "beatTime" ///< http://lv2plug.in/ns/ext/atom#beatTime -#define LV2_ATOM__bufferType LV2_ATOM_PREFIX "bufferType" ///< http://lv2plug.in/ns/ext/atom#bufferType -#define LV2_ATOM__childType LV2_ATOM_PREFIX "childType" ///< http://lv2plug.in/ns/ext/atom#childType -#define LV2_ATOM__eventTransfer LV2_ATOM_PREFIX "eventTransfer" ///< http://lv2plug.in/ns/ext/atom#eventTransfer -#define LV2_ATOM__frameTime LV2_ATOM_PREFIX "frameTime" ///< http://lv2plug.in/ns/ext/atom#frameTime -#define LV2_ATOM__supports LV2_ATOM_PREFIX "supports" ///< http://lv2plug.in/ns/ext/atom#supports -#define LV2_ATOM__timeUnit LV2_ATOM_PREFIX "timeUnit" ///< http://lv2plug.in/ns/ext/atom#timeUnit - -// clang-format on - -#define LV2_ATOM_REFERENCE_TYPE 0 ///< The special type for a reference atom - -#ifdef __cplusplus -extern "C" { -#endif - -/** @cond */ -/** This expression will fail to compile if double does not fit in 64 bits. */ -typedef char lv2_atom_assert_double_fits_in_64_bits - [((sizeof(double) <= sizeof(uint64_t)) * 2) - 1]; -/** @endcond */ - -/** - Return a pointer to the contents of an Atom. The "contents" of an atom - is the data past the complete type-specific header. - @param type The type of the atom, for example LV2_Atom_String. - @param atom A variable-sized atom. -*/ -#define LV2_ATOM_CONTENTS(type, atom) ((void*)((uint8_t*)(atom) + sizeof(type))) - -/** - Const version of LV2_ATOM_CONTENTS. -*/ -#define LV2_ATOM_CONTENTS_CONST(type, atom) \ - ((const void*)((const uint8_t*)(atom) + sizeof(type))) - -/** - Return a pointer to the body of an Atom. The "body" of an atom is the - data just past the LV2_Atom head (i.e. the same offset for all types). -*/ -#define LV2_ATOM_BODY(atom) LV2_ATOM_CONTENTS(LV2_Atom, atom) - -/** - Const version of LV2_ATOM_BODY. -*/ -#define LV2_ATOM_BODY_CONST(atom) LV2_ATOM_CONTENTS_CONST(LV2_Atom, atom) - -/** The header of an atom:Atom. */ -typedef struct { - uint32_t size; /**< Size in bytes, not including type and size. */ - uint32_t type; /**< Type of this atom (mapped URI). */ -} LV2_Atom; - -/** An atom:Int or atom:Bool. May be cast to LV2_Atom. */ -typedef struct { - LV2_Atom atom; /**< Atom header. */ - int32_t body; /**< Integer value. */ -} LV2_Atom_Int; - -/** An atom:Long. May be cast to LV2_Atom. */ -typedef struct { - LV2_Atom atom; /**< Atom header. */ - int64_t body; /**< Integer value. */ -} LV2_Atom_Long; - -/** An atom:Float. May be cast to LV2_Atom. */ -typedef struct { - LV2_Atom atom; /**< Atom header. */ - float body; /**< Floating point value. */ -} LV2_Atom_Float; - -/** An atom:Double. May be cast to LV2_Atom. */ -typedef struct { - LV2_Atom atom; /**< Atom header. */ - double body; /**< Floating point value. */ -} LV2_Atom_Double; - -/** An atom:Bool. May be cast to LV2_Atom. */ -typedef LV2_Atom_Int LV2_Atom_Bool; - -/** An atom:URID. May be cast to LV2_Atom. */ -typedef struct { - LV2_Atom atom; /**< Atom header. */ - uint32_t body; /**< URID. */ -} LV2_Atom_URID; - -/** An atom:String. May be cast to LV2_Atom. */ -typedef struct { - LV2_Atom atom; /**< Atom header. */ - /* Contents (a null-terminated UTF-8 string) follow here. */ -} LV2_Atom_String; - -/** The body of an atom:Literal. */ -typedef struct { - uint32_t datatype; /**< Datatype URID. */ - uint32_t lang; /**< Language URID. */ - /* Contents (a null-terminated UTF-8 string) follow here. */ -} LV2_Atom_Literal_Body; - -/** An atom:Literal. May be cast to LV2_Atom. */ -typedef struct { - LV2_Atom atom; /**< Atom header. */ - LV2_Atom_Literal_Body body; /**< Body. */ -} LV2_Atom_Literal; - -/** An atom:Tuple. May be cast to LV2_Atom. */ -typedef struct { - LV2_Atom atom; /**< Atom header. */ - /* Contents (a series of complete atoms) follow here. */ -} LV2_Atom_Tuple; - -/** The body of an atom:Vector. */ -typedef struct { - uint32_t child_size; /**< The size of each element in the vector. */ - uint32_t child_type; /**< The type of each element in the vector. */ - /* Contents (a series of packed atom bodies) follow here. */ -} LV2_Atom_Vector_Body; - -/** An atom:Vector. May be cast to LV2_Atom. */ -typedef struct { - LV2_Atom atom; /**< Atom header. */ - LV2_Atom_Vector_Body body; /**< Body. */ -} LV2_Atom_Vector; - -/** The body of an atom:Property (typically in an atom:Object). */ -typedef struct { - uint32_t key; /**< Key (predicate) (mapped URI). */ - uint32_t context; /**< Context URID (may be, and generally is, 0). */ - LV2_Atom value; /**< Value atom header. */ - /* Value atom body follows here. */ -} LV2_Atom_Property_Body; - -/** An atom:Property. May be cast to LV2_Atom. */ -typedef struct { - LV2_Atom atom; /**< Atom header. */ - LV2_Atom_Property_Body body; /**< Body. */ -} LV2_Atom_Property; - -/** The body of an atom:Object. May be cast to LV2_Atom. */ -typedef struct { - uint32_t id; /**< URID, or 0 for blank. */ - uint32_t otype; /**< Type URID (same as rdf:type, for fast dispatch). */ - /* Contents (a series of property bodies) follow here. */ -} LV2_Atom_Object_Body; - -/** An atom:Object. May be cast to LV2_Atom. */ -typedef struct { - LV2_Atom atom; /**< Atom header. */ - LV2_Atom_Object_Body body; /**< Body. */ -} LV2_Atom_Object; - -/** The header of an atom:Event. Note this type is NOT an LV2_Atom. */ -typedef struct { - /** Time stamp. Which type is valid is determined by context. */ - union { - int64_t frames; /**< Time in audio frames. */ - double beats; /**< Time in beats. */ - } time; - LV2_Atom body; /**< Event body atom header. */ - /* Body atom contents follow here. */ -} LV2_Atom_Event; - -/** - The body of an atom:Sequence (a sequence of events). - - The unit field is either a URID that described an appropriate time stamp - type, or may be 0 where a default stamp type is known. For - LV2_Descriptor::run(), the default stamp type is audio frames. - - The contents of a sequence is a series of LV2_Atom_Event, each aligned - to 64-bits, for example: -
-   | Event 1 (size 6)                              | Event 2
-   |       |       |       |       |       |       |       |       |
-   | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
-   |FRAMES         |TYPE   |SIZE   |DATADATADATAPAD|FRAMES         |...
-   
-*/ -typedef struct { - uint32_t unit; /**< URID of unit of event time stamps. */ - uint32_t pad; /**< Currently unused. */ - /* Contents (a series of events) follow here. */ -} LV2_Atom_Sequence_Body; - -/** An atom:Sequence. */ -typedef struct { - LV2_Atom atom; /**< Atom header. */ - LV2_Atom_Sequence_Body body; /**< Body. */ -} LV2_Atom_Sequence; - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_ATOM_H */ diff --git a/plugins/lv2/vendor/lv2/atom/forge.h b/plugins/lv2/vendor/lv2/atom/forge.h deleted file mode 100644 index 5e9bef842..000000000 --- a/plugins/lv2/vendor/lv2/atom/forge.h +++ /dev/null @@ -1,670 +0,0 @@ -// Copyright 2008-2016 David Robillard -// SPDX-License-Identifier: ISC - -/** - @file forge.h An API for constructing LV2 atoms. - - This file provides an API for constructing Atoms which makes it relatively - simple to build nested atoms of arbitrary complexity without requiring - dynamic memory allocation. - - The API is based on successively appending the appropriate pieces to build a - complete Atom. The size of containers is automatically updated. Functions - that begin a container return (via their frame argument) a stack frame which - must be popped when the container is finished. - - All output is written to a user-provided buffer or sink function. This - makes it possible to create atoms on the stack, on the heap, in LV2 port - buffers, in a ringbuffer, or elsewhere, all using the same API. - - This entire API is realtime safe if used with a buffer or a realtime safe - sink, except lv2_atom_forge_init() which is only realtime safe if the URI - map function is. - - Note these functions are all static inline, do not take their address. - - This header is non-normative, it is provided for convenience. -*/ - -#ifndef LV2_ATOM_FORGE_H -#define LV2_ATOM_FORGE_H - -/** - @defgroup forge Forge - @ingroup atom - - An API for constructing LV2 atoms. - - @{ -*/ - -#include "lv2/atom/atom.h" -#include "lv2/atom/util.h" -#include "lv2/core/attributes.h" -#include "lv2/urid/urid.h" - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// Disable deprecation warnings for Blank and Resource -LV2_DISABLE_DEPRECATION_WARNINGS - -/** Handle for LV2_Atom_Forge_Sink. */ -typedef void* LV2_Atom_Forge_Sink_Handle; - -/** A reference to a chunk of written output. */ -typedef intptr_t LV2_Atom_Forge_Ref; - -/** Sink function for writing output. See lv2_atom_forge_set_sink(). */ -typedef LV2_Atom_Forge_Ref (*LV2_Atom_Forge_Sink)( - LV2_Atom_Forge_Sink_Handle handle, - const void* buf, - uint32_t size); - -/** Function for resolving a reference. See lv2_atom_forge_set_sink(). */ -typedef LV2_Atom* (*LV2_Atom_Forge_Deref_Func)( - LV2_Atom_Forge_Sink_Handle handle, - LV2_Atom_Forge_Ref ref); - -/** A stack frame used for keeping track of nested Atom containers. */ -typedef struct LV2_Atom_Forge_Frame { - struct LV2_Atom_Forge_Frame* parent; - LV2_Atom_Forge_Ref ref; -} LV2_Atom_Forge_Frame; - -/** A "forge" for creating atoms by appending to a buffer. */ -typedef struct { - uint8_t* buf; - uint32_t offset; - uint32_t size; - - LV2_Atom_Forge_Sink sink; - LV2_Atom_Forge_Deref_Func deref; - LV2_Atom_Forge_Sink_Handle handle; - - LV2_Atom_Forge_Frame* stack; - - LV2_URID Blank LV2_DEPRECATED; - LV2_URID Bool; - LV2_URID Chunk; - LV2_URID Double; - LV2_URID Float; - LV2_URID Int; - LV2_URID Long; - LV2_URID Literal; - LV2_URID Object; - LV2_URID Path; - LV2_URID Property; - LV2_URID Resource LV2_DEPRECATED; - LV2_URID Sequence; - LV2_URID String; - LV2_URID Tuple; - LV2_URID URI; - LV2_URID URID; - LV2_URID Vector; -} LV2_Atom_Forge; - -static inline void -lv2_atom_forge_set_buffer(LV2_Atom_Forge* forge, uint8_t* buf, size_t size); - -/** - Initialise `forge`. - - URIs will be mapped using `map` and stored, a reference to `map` itself is - not held. -*/ -static inline void -lv2_atom_forge_init(LV2_Atom_Forge* forge, LV2_URID_Map* map) -{ - lv2_atom_forge_set_buffer(forge, NULL, 0); - forge->Blank = map->map(map->handle, LV2_ATOM__Blank); - forge->Bool = map->map(map->handle, LV2_ATOM__Bool); - forge->Chunk = map->map(map->handle, LV2_ATOM__Chunk); - forge->Double = map->map(map->handle, LV2_ATOM__Double); - forge->Float = map->map(map->handle, LV2_ATOM__Float); - forge->Int = map->map(map->handle, LV2_ATOM__Int); - forge->Long = map->map(map->handle, LV2_ATOM__Long); - forge->Literal = map->map(map->handle, LV2_ATOM__Literal); - forge->Object = map->map(map->handle, LV2_ATOM__Object); - forge->Path = map->map(map->handle, LV2_ATOM__Path); - forge->Property = map->map(map->handle, LV2_ATOM__Property); - forge->Resource = map->map(map->handle, LV2_ATOM__Resource); - forge->Sequence = map->map(map->handle, LV2_ATOM__Sequence); - forge->String = map->map(map->handle, LV2_ATOM__String); - forge->Tuple = map->map(map->handle, LV2_ATOM__Tuple); - forge->URI = map->map(map->handle, LV2_ATOM__URI); - forge->URID = map->map(map->handle, LV2_ATOM__URID); - forge->Vector = map->map(map->handle, LV2_ATOM__Vector); -} - -/** Access the Atom pointed to by a reference. */ -static inline LV2_Atom* -lv2_atom_forge_deref(LV2_Atom_Forge* forge, LV2_Atom_Forge_Ref ref) -{ - return forge->buf ? (LV2_Atom*)ref : forge->deref(forge->handle, ref); -} - -/** - @name Object Stack - @{ -*/ - -/** - Push a stack frame. - This is done automatically by container functions (which take a stack frame - pointer), but may be called by the user to push the top level container when - writing to an existing Atom. -*/ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_push(LV2_Atom_Forge* forge, - LV2_Atom_Forge_Frame* frame, - LV2_Atom_Forge_Ref ref) -{ - frame->parent = forge->stack; - frame->ref = ref; - - if (ref) { - forge->stack = frame; // Don't push, so walking the stack is always safe - } - - return ref; -} - -/** Pop a stack frame. This must be called when a container is finished. */ -static inline void -lv2_atom_forge_pop(LV2_Atom_Forge* forge, LV2_Atom_Forge_Frame* frame) -{ - if (frame->ref) { - // If frame has a valid ref, it must be the top of the stack - assert(frame == forge->stack); - forge->stack = frame->parent; - } - // Otherwise, frame was not pushed because of overflow, do nothing -} - -/** Return true iff the top of the stack has the given type. */ -static inline bool -lv2_atom_forge_top_is(LV2_Atom_Forge* forge, uint32_t type) -{ - return forge->stack && forge->stack->ref && - (lv2_atom_forge_deref(forge, forge->stack->ref)->type == type); -} - -/** Return true iff `type` is an atom:Object. */ -static inline bool -lv2_atom_forge_is_object_type(const LV2_Atom_Forge* forge, uint32_t type) -{ - return (type == forge->Object || type == forge->Blank || - type == forge->Resource); -} - -/** Return true iff `type` is an atom:Object with a blank ID. */ -static inline bool -lv2_atom_forge_is_blank(const LV2_Atom_Forge* forge, - uint32_t type, - const LV2_Atom_Object_Body* body) -{ - return (type == forge->Blank || (type == forge->Object && body->id == 0)); -} - -/** - @} - @name Output Configuration - @{ -*/ - -/** Set the output buffer where `forge` will write atoms. */ -static inline void -lv2_atom_forge_set_buffer(LV2_Atom_Forge* forge, uint8_t* buf, size_t size) -{ - forge->buf = buf; - forge->size = (uint32_t)size; - forge->offset = 0; - forge->deref = NULL; - forge->sink = NULL; - forge->handle = NULL; - forge->stack = NULL; -} - -/** - Set the sink function where `forge` will write output. - - The return value of forge functions is an LV2_Atom_Forge_Ref which is an - integer type safe to use as a pointer but is otherwise opaque. The sink - function must return a ref that can be dereferenced to access as least - sizeof(LV2_Atom) bytes of the written data, so sizes can be updated. For - ringbuffers, this should be possible as long as the size of the buffer is a - multiple of sizeof(LV2_Atom), since atoms are always aligned. - - Note that 0 is an invalid reference, so if you are using a buffer offset be - sure to offset it such that 0 is never a valid reference. You will get - confusing errors otherwise. -*/ -static inline void -lv2_atom_forge_set_sink(LV2_Atom_Forge* forge, - LV2_Atom_Forge_Sink sink, - LV2_Atom_Forge_Deref_Func deref, - LV2_Atom_Forge_Sink_Handle handle) -{ - forge->buf = NULL; - forge->size = forge->offset = 0; - forge->deref = deref; - forge->sink = sink; - forge->handle = handle; - forge->stack = NULL; -} - -/** - @} - @name Low Level Output - @{ -*/ - -/** - Write raw output. This is used internally, but is also useful for writing - atom types not explicitly supported by the forge API. Note the caller is - responsible for ensuring the output is appropriately padded. -*/ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_raw(LV2_Atom_Forge* forge, const void* data, uint32_t size) -{ - LV2_Atom_Forge_Ref out = 0; - if (forge->sink) { - out = forge->sink(forge->handle, data, size); - } else { - out = (LV2_Atom_Forge_Ref)forge->buf + forge->offset; - uint8_t* mem = forge->buf + forge->offset; - if (forge->offset + size > forge->size) { - return 0; - } - forge->offset += size; - memcpy(mem, data, size); - } - for (LV2_Atom_Forge_Frame* f = forge->stack; f; f = f->parent) { - lv2_atom_forge_deref(forge, f->ref)->size += size; - } - return out; -} - -/** Pad output accordingly so next write is 64-bit aligned. */ -static inline void -lv2_atom_forge_pad(LV2_Atom_Forge* forge, uint32_t written) -{ - const uint64_t pad = 0; - const uint32_t pad_size = lv2_atom_pad_size(written) - written; - lv2_atom_forge_raw(forge, &pad, pad_size); -} - -/** Write raw output, padding to 64-bits as necessary. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_write(LV2_Atom_Forge* forge, const void* data, uint32_t size) -{ - LV2_Atom_Forge_Ref out = lv2_atom_forge_raw(forge, data, size); - if (out) { - lv2_atom_forge_pad(forge, size); - } - return out; -} - -/** Write a null-terminated string body. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_string_body(LV2_Atom_Forge* forge, const char* str, uint32_t len) -{ - LV2_Atom_Forge_Ref out = lv2_atom_forge_raw(forge, str, len); - if (out && (out = lv2_atom_forge_raw(forge, "", 1))) { - lv2_atom_forge_pad(forge, len + 1); - } - return out; -} - -/** - @} - @name Atom Output - @{ -*/ - -/** Write an atom:Atom header. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_atom(LV2_Atom_Forge* forge, uint32_t size, uint32_t type) -{ - const LV2_Atom a = {size, type}; - return lv2_atom_forge_raw(forge, &a, sizeof(a)); -} - -/** Write a primitive (fixed-size) atom. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_primitive(LV2_Atom_Forge* forge, const LV2_Atom* a) -{ - return ( - lv2_atom_forge_top_is(forge, forge->Vector) - ? lv2_atom_forge_raw(forge, LV2_ATOM_BODY_CONST(a), a->size) - : lv2_atom_forge_write(forge, a, (uint32_t)sizeof(LV2_Atom) + a->size)); -} - -/** Write an atom:Int. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_int(LV2_Atom_Forge* forge, int32_t val) -{ - const LV2_Atom_Int a = {{sizeof(val), forge->Int}, val}; - return lv2_atom_forge_primitive(forge, (const LV2_Atom*)&a); -} - -/** Write an atom:Long. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_long(LV2_Atom_Forge* forge, int64_t val) -{ - const LV2_Atom_Long a = {{sizeof(val), forge->Long}, val}; - return lv2_atom_forge_primitive(forge, (const LV2_Atom*)&a); -} - -/** Write an atom:Float. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_float(LV2_Atom_Forge* forge, float val) -{ - const LV2_Atom_Float a = {{sizeof(val), forge->Float}, val}; - return lv2_atom_forge_primitive(forge, (const LV2_Atom*)&a); -} - -/** Write an atom:Double. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_double(LV2_Atom_Forge* forge, double val) -{ - const LV2_Atom_Double a = {{sizeof(val), forge->Double}, val}; - return lv2_atom_forge_primitive(forge, (const LV2_Atom*)&a); -} - -/** Write an atom:Bool. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_bool(LV2_Atom_Forge* forge, bool val) -{ - const LV2_Atom_Bool a = {{sizeof(int32_t), forge->Bool}, val ? 1 : 0}; - return lv2_atom_forge_primitive(forge, (const LV2_Atom*)&a); -} - -/** Write an atom:URID. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_urid(LV2_Atom_Forge* forge, LV2_URID id) -{ - const LV2_Atom_URID a = {{sizeof(id), forge->URID}, id}; - return lv2_atom_forge_primitive(forge, (const LV2_Atom*)&a); -} - -/** Write an atom compatible with atom:String. Used internally. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_typed_string(LV2_Atom_Forge* forge, - uint32_t type, - const char* str, - uint32_t len) -{ - const LV2_Atom_String a = {{len + 1, type}}; - LV2_Atom_Forge_Ref out = lv2_atom_forge_raw(forge, &a, sizeof(a)); - if (out) { - if (!lv2_atom_forge_string_body(forge, str, len)) { - LV2_Atom* atom = lv2_atom_forge_deref(forge, out); - atom->size = atom->type = 0; - out = 0; - } - } - return out; -} - -/** Write an atom:String. Note that `str` need not be NULL terminated. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_string(LV2_Atom_Forge* forge, const char* str, uint32_t len) -{ - return lv2_atom_forge_typed_string(forge, forge->String, str, len); -} - -/** - Write an atom:URI. Note that `uri` need not be NULL terminated. - This does not map the URI, but writes the complete URI string. To write - a mapped URI, use lv2_atom_forge_urid(). -*/ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_uri(LV2_Atom_Forge* forge, const char* uri, uint32_t len) -{ - return lv2_atom_forge_typed_string(forge, forge->URI, uri, len); -} - -/** Write an atom:Path. Note that `path` need not be NULL terminated. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_path(LV2_Atom_Forge* forge, const char* path, uint32_t len) -{ - return lv2_atom_forge_typed_string(forge, forge->Path, path, len); -} - -/** Write an atom:Literal. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_literal(LV2_Atom_Forge* forge, - const char* str, - uint32_t len, - uint32_t datatype, - uint32_t lang) -{ - const LV2_Atom_Literal a = { - {(uint32_t)(sizeof(LV2_Atom_Literal) - sizeof(LV2_Atom) + len + 1), - forge->Literal}, - {datatype, lang}}; - LV2_Atom_Forge_Ref out = lv2_atom_forge_raw(forge, &a, sizeof(a)); - if (out) { - if (!lv2_atom_forge_string_body(forge, str, len)) { - LV2_Atom* atom = lv2_atom_forge_deref(forge, out); - atom->size = atom->type = 0; - out = 0; - } - } - return out; -} - -/** Start an atom:Vector. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_vector_head(LV2_Atom_Forge* forge, - LV2_Atom_Forge_Frame* frame, - uint32_t child_size, - uint32_t child_type) -{ - const LV2_Atom_Vector a = {{sizeof(LV2_Atom_Vector_Body), forge->Vector}, - {child_size, child_type}}; - return lv2_atom_forge_push( - forge, frame, lv2_atom_forge_write(forge, &a, sizeof(a))); -} - -/** Write a complete atom:Vector. */ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_vector(LV2_Atom_Forge* forge, - uint32_t child_size, - uint32_t child_type, - uint32_t n_elems, - const void* elems) -{ - const LV2_Atom_Vector a = { - {(uint32_t)sizeof(LV2_Atom_Vector_Body) + n_elems * child_size, - forge->Vector}, - {child_size, child_type}}; - LV2_Atom_Forge_Ref out = lv2_atom_forge_write(forge, &a, sizeof(a)); - if (out) { - lv2_atom_forge_write(forge, elems, child_size * n_elems); - } - return out; -} - -/** - Write the header of an atom:Tuple. - - The passed frame will be initialised to represent this tuple. To complete - the tuple, write a sequence of atoms, then pop the frame with - lv2_atom_forge_pop(). - - For example: - @code - // Write tuple (1, 2.0) - LV2_Atom_Forge_Frame frame; - LV2_Atom* tup = (LV2_Atom*)lv2_atom_forge_tuple(forge, &frame); - lv2_atom_forge_int(forge, 1); - lv2_atom_forge_float(forge, 2.0); - lv2_atom_forge_pop(forge, &frame); - @endcode -*/ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_tuple(LV2_Atom_Forge* forge, LV2_Atom_Forge_Frame* frame) -{ - const LV2_Atom_Tuple a = {{0, forge->Tuple}}; - return lv2_atom_forge_push( - forge, frame, lv2_atom_forge_write(forge, &a, sizeof(a))); -} - -/** - Write the header of an atom:Object. - - The passed frame will be initialised to represent this object. To complete - the object, write a sequence of properties, then pop the frame with - lv2_atom_forge_pop(). - - For example: - @code - LV2_URID eg_Cat = map("http://example.org/Cat"); - LV2_URID eg_name = map("http://example.org/name"); - - // Start object with type eg_Cat and blank ID - LV2_Atom_Forge_Frame frame; - lv2_atom_forge_object(forge, &frame, 0, eg_Cat); - - // Append property eg:name = "Hobbes" - lv2_atom_forge_key(forge, eg_name); - lv2_atom_forge_string(forge, "Hobbes", strlen("Hobbes")); - - // Finish object - lv2_atom_forge_pop(forge, &frame); - @endcode -*/ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_object(LV2_Atom_Forge* forge, - LV2_Atom_Forge_Frame* frame, - LV2_URID id, - LV2_URID otype) -{ - const LV2_Atom_Object a = { - {(uint32_t)sizeof(LV2_Atom_Object_Body), forge->Object}, {id, otype}}; - return lv2_atom_forge_push( - forge, frame, lv2_atom_forge_write(forge, &a, sizeof(a))); -} - -/** - The same as lv2_atom_forge_object(), but for object:Resource. - - This function is deprecated and should not be used in new code. - Use lv2_atom_forge_object() directly instead. -*/ -LV2_DEPRECATED -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_resource(LV2_Atom_Forge* forge, - LV2_Atom_Forge_Frame* frame, - LV2_URID id, - LV2_URID otype) -{ - const LV2_Atom_Object a = { - {(uint32_t)sizeof(LV2_Atom_Object_Body), forge->Resource}, {id, otype}}; - return lv2_atom_forge_push( - forge, frame, lv2_atom_forge_write(forge, &a, sizeof(a))); -} - -/** - The same as lv2_atom_forge_object(), but for object:Blank. - - This function is deprecated and should not be used in new code. - Use lv2_atom_forge_object() directly instead. -*/ -LV2_DEPRECATED -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_blank(LV2_Atom_Forge* forge, - LV2_Atom_Forge_Frame* frame, - uint32_t id, - LV2_URID otype) -{ - const LV2_Atom_Object a = { - {(uint32_t)sizeof(LV2_Atom_Object_Body), forge->Blank}, {id, otype}}; - return lv2_atom_forge_push( - forge, frame, lv2_atom_forge_write(forge, &a, sizeof(a))); -} - -/** - Write a property key in an Object, to be followed by the value. - - See lv2_atom_forge_object() documentation for an example. -*/ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_key(LV2_Atom_Forge* forge, LV2_URID key) -{ - const LV2_Atom_Property_Body a = {key, 0, {0, 0}}; - return lv2_atom_forge_write(forge, &a, 2 * (uint32_t)sizeof(uint32_t)); -} - -/** - Write the header for a property body in an object, with context. - - If you do not need the context, which is almost certainly the case, - use the simpler lv2_atom_forge_key() instead. -*/ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_property_head(LV2_Atom_Forge* forge, - LV2_URID key, - LV2_URID context) -{ - const LV2_Atom_Property_Body a = {key, context, {0, 0}}; - return lv2_atom_forge_write(forge, &a, 2 * (uint32_t)sizeof(uint32_t)); -} - -/** - Write the header for a Sequence. -*/ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_sequence_head(LV2_Atom_Forge* forge, - LV2_Atom_Forge_Frame* frame, - uint32_t unit) -{ - const LV2_Atom_Sequence a = { - {(uint32_t)sizeof(LV2_Atom_Sequence_Body), forge->Sequence}, {unit, 0}}; - return lv2_atom_forge_push( - forge, frame, lv2_atom_forge_write(forge, &a, sizeof(a))); -} - -/** - Write the time stamp header of an Event (in a Sequence) in audio frames. - After this, call the appropriate forge method(s) to write the body. Note - the returned reference is to an LV2_Event which is NOT an Atom. -*/ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_frame_time(LV2_Atom_Forge* forge, int64_t frames) -{ - return lv2_atom_forge_write(forge, &frames, sizeof(frames)); -} - -/** - Write the time stamp header of an Event (in a Sequence) in beats. After - this, call the appropriate forge method(s) to write the body. Note the - returned reference is to an LV2_Event which is NOT an Atom. -*/ -static inline LV2_Atom_Forge_Ref -lv2_atom_forge_beat_time(LV2_Atom_Forge* forge, double beats) -{ - return lv2_atom_forge_write(forge, &beats, sizeof(beats)); -} - -LV2_RESTORE_WARNINGS - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} - @} -*/ - -#endif /* LV2_ATOM_FORGE_H */ diff --git a/plugins/lv2/vendor/lv2/atom/util.h b/plugins/lv2/vendor/lv2/atom/util.h deleted file mode 100644 index f585f82ad..000000000 --- a/plugins/lv2/vendor/lv2/atom/util.h +++ /dev/null @@ -1,510 +0,0 @@ -// Copyright 2008-2015 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_ATOM_UTIL_H -#define LV2_ATOM_UTIL_H - -/** - @file util.h Helper functions for the LV2 Atom extension. - - Note these functions are all static inline, do not take their address. - - This header is non-normative, it is provided for convenience. -*/ - -/** - @defgroup util Utilities - @ingroup atom - - Utilities for working with atoms. - - @{ -*/ - -#include "lv2/atom/atom.h" - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** Pad a size to 64 bits. */ -static inline uint32_t -lv2_atom_pad_size(uint32_t size) -{ - return (size + 7U) & (~7U); -} - -/** Return the total size of `atom`, including the header. */ -static inline uint32_t -lv2_atom_total_size(const LV2_Atom* atom) -{ - return (uint32_t)sizeof(LV2_Atom) + atom->size; -} - -/** Return true iff `atom` is null. */ -static inline bool -lv2_atom_is_null(const LV2_Atom* atom) -{ - return !atom || (atom->type == 0 && atom->size == 0); -} - -/** Return true iff `a` is equal to `b`. */ -static inline bool -lv2_atom_equals(const LV2_Atom* a, const LV2_Atom* b) -{ - return (a == b) || ((a->type == b->type) && (a->size == b->size) && - !memcmp(a + 1, b + 1, a->size)); -} - -/** - @name Sequence Iterator - @{ -*/ - -/** Get an iterator pointing to the first event in a Sequence body. */ -static inline LV2_Atom_Event* -lv2_atom_sequence_begin(const LV2_Atom_Sequence_Body* body) -{ - return (LV2_Atom_Event*)(body + 1); -} - -/** Get an iterator pointing to the end of a Sequence body. */ -static inline LV2_Atom_Event* -lv2_atom_sequence_end(const LV2_Atom_Sequence_Body* body, uint32_t size) -{ - return (LV2_Atom_Event*)((const uint8_t*)body + lv2_atom_pad_size(size)); -} - -/** Return true iff `i` has reached the end of `body`. */ -static inline bool -lv2_atom_sequence_is_end(const LV2_Atom_Sequence_Body* body, - uint32_t size, - const LV2_Atom_Event* i) -{ - return (const uint8_t*)i >= ((const uint8_t*)body + size); -} - -/** Return an iterator to the element following `i`. */ -static inline LV2_Atom_Event* -lv2_atom_sequence_next(const LV2_Atom_Event* i) -{ - return (LV2_Atom_Event*)((const uint8_t*)i + sizeof(LV2_Atom_Event) + - lv2_atom_pad_size(i->body.size)); -} - -/** - A macro for iterating over all events in a Sequence. - @param seq The sequence to iterate over - @param iter The name of the iterator - - This macro is used similarly to a for loop (which it expands to), for - example: - - @code - LV2_ATOM_SEQUENCE_FOREACH(sequence, ev) { - // Do something with ev (an LV2_Atom_Event*) here... - } - @endcode -*/ -#define LV2_ATOM_SEQUENCE_FOREACH(seq, iter) \ - for (LV2_Atom_Event * iter = lv2_atom_sequence_begin(&(seq)->body); \ - !lv2_atom_sequence_is_end(&(seq)->body, (seq)->atom.size, (iter)); \ - (iter) = lv2_atom_sequence_next(iter)) - -/** Like LV2_ATOM_SEQUENCE_FOREACH but for a headerless sequence body. */ -#define LV2_ATOM_SEQUENCE_BODY_FOREACH(body, size, iter) \ - for (LV2_Atom_Event * iter = lv2_atom_sequence_begin(body); \ - !lv2_atom_sequence_is_end(body, size, (iter)); \ - (iter) = lv2_atom_sequence_next(iter)) - -/** - @} - @name Sequence Utilities - @{ -*/ - -/** - Clear all events from `sequence`. - - This simply resets the size field, the other fields are left untouched. -*/ -static inline void -lv2_atom_sequence_clear(LV2_Atom_Sequence* seq) -{ - seq->atom.size = sizeof(LV2_Atom_Sequence_Body); -} - -/** - Append an event at the end of `sequence`. - - @param seq Sequence to append to. - @param capacity Total capacity of the sequence atom - (as set by the host for sequence output ports). - @param event Event to write. - - @return A pointer to the newly written event in `seq`, - or NULL on failure (insufficient space). -*/ -static inline LV2_Atom_Event* -lv2_atom_sequence_append_event(LV2_Atom_Sequence* seq, - uint32_t capacity, - const LV2_Atom_Event* event) -{ - const uint32_t total_size = (uint32_t)sizeof(*event) + event->body.size; - if (capacity - seq->atom.size < total_size) { - return NULL; - } - - LV2_Atom_Event* e = lv2_atom_sequence_end(&seq->body, seq->atom.size); - memcpy(e, event, total_size); - - seq->atom.size += lv2_atom_pad_size(total_size); - - return e; -} - -/** - @} - @name Tuple Iterator - @{ -*/ - -/** Get an iterator pointing to the first element in `tup`. */ -static inline LV2_Atom* -lv2_atom_tuple_begin(const LV2_Atom_Tuple* tup) -{ - return (LV2_Atom*)(LV2_ATOM_BODY(tup)); -} - -/** Return true iff `i` has reached the end of `body`. */ -static inline bool -lv2_atom_tuple_is_end(const void* body, uint32_t size, const LV2_Atom* i) -{ - return (const uint8_t*)i >= ((const uint8_t*)body + size); -} - -/** Return an iterator to the element following `i`. */ -static inline LV2_Atom* -lv2_atom_tuple_next(const LV2_Atom* i) -{ - return (LV2_Atom*)((const uint8_t*)i + sizeof(LV2_Atom) + - lv2_atom_pad_size(i->size)); -} - -/** - A macro for iterating over all properties of a Tuple. - @param tuple The tuple to iterate over - @param iter The name of the iterator - - This macro is used similarly to a for loop (which it expands to), for - example: - - @code - LV2_ATOM_TUPLE_FOREACH(tuple, elem) { - // Do something with elem (an LV2_Atom*) here... - } - @endcode -*/ -#define LV2_ATOM_TUPLE_FOREACH(tuple, iter) \ - for (LV2_Atom * iter = lv2_atom_tuple_begin(tuple); \ - !lv2_atom_tuple_is_end( \ - LV2_ATOM_BODY(tuple), (tuple)->atom.size, (iter)); \ - (iter) = lv2_atom_tuple_next(iter)) - -/** Like LV2_ATOM_TUPLE_FOREACH but for a headerless tuple body. */ -#define LV2_ATOM_TUPLE_BODY_FOREACH(body, size, iter) \ - for (LV2_Atom * iter = (LV2_Atom*)(body); \ - !lv2_atom_tuple_is_end(body, size, (iter)); \ - (iter) = lv2_atom_tuple_next(iter)) - -/** - @} - @name Object Iterator - @{ -*/ - -/** Return a pointer to the first property in `body`. */ -static inline LV2_Atom_Property_Body* -lv2_atom_object_begin(const LV2_Atom_Object_Body* body) -{ - return (LV2_Atom_Property_Body*)(body + 1); -} - -/** Return true iff `i` has reached the end of `obj`. */ -static inline bool -lv2_atom_object_is_end(const LV2_Atom_Object_Body* body, - uint32_t size, - const LV2_Atom_Property_Body* i) -{ - return (const uint8_t*)i >= ((const uint8_t*)body + size); -} - -/** Return an iterator to the property following `i`. */ -static inline LV2_Atom_Property_Body* -lv2_atom_object_next(const LV2_Atom_Property_Body* i) -{ - const LV2_Atom* const value = - (const LV2_Atom*)((const uint8_t*)i + 2 * sizeof(uint32_t)); - return (LV2_Atom_Property_Body*)((const uint8_t*)i + - lv2_atom_pad_size( - (uint32_t)sizeof(LV2_Atom_Property_Body) + - value->size)); -} - -/** - A macro for iterating over all properties of an Object. - @param obj The object to iterate over - @param iter The name of the iterator - - This macro is used similarly to a for loop (which it expands to), for - example: - - @code - LV2_ATOM_OBJECT_FOREACH(object, i) { - // Do something with i (an LV2_Atom_Property_Body*) here... - } - @endcode -*/ -#define LV2_ATOM_OBJECT_FOREACH(obj, iter) \ - for (LV2_Atom_Property_Body * iter = lv2_atom_object_begin(&(obj)->body); \ - !lv2_atom_object_is_end(&(obj)->body, (obj)->atom.size, (iter)); \ - (iter) = lv2_atom_object_next(iter)) - -/** Like LV2_ATOM_OBJECT_FOREACH but for a headerless object body. */ -#define LV2_ATOM_OBJECT_BODY_FOREACH(body, size, iter) \ - for (LV2_Atom_Property_Body * iter = lv2_atom_object_begin(body); \ - !lv2_atom_object_is_end(body, size, (iter)); \ - (iter) = lv2_atom_object_next(iter)) - -/** - @} - @name Object Query - @{ -*/ - -/** A single entry in an Object query. */ -typedef struct { - uint32_t key; /**< Key to query (input set by user) */ - const LV2_Atom** value; /**< Found value (output set by query function) */ -} LV2_Atom_Object_Query; - -/** Sentinel for lv2_atom_object_query(). */ -static const LV2_Atom_Object_Query LV2_ATOM_OBJECT_QUERY_END = {0, NULL}; - -/** - Get an object's values for various keys. - - The value pointer of each item in `query` will be set to the location of - the corresponding value in `object`. Every value pointer in `query` MUST - be initialised to NULL. This function reads `object` in a single linear - sweep. By allocating `query` on the stack, objects can be "queried" - quickly without allocating any memory. This function is realtime safe. - - This function can only do "flat" queries, it is not smart enough to match - variables in nested objects. - - For example: - @code - const LV2_Atom* name = NULL; - const LV2_Atom* age = NULL; - LV2_Atom_Object_Query q[] = { - { urids.eg_name, &name }, - { urids.eg_age, &age }, - LV2_ATOM_OBJECT_QUERY_END - }; - lv2_atom_object_query(obj, q); - // name and age are now set to the appropriate values in obj, or NULL. - @endcode -*/ -static inline int -lv2_atom_object_query(const LV2_Atom_Object* object, - LV2_Atom_Object_Query* query) -{ - int matches = 0; - int n_queries = 0; - - /* Count number of query keys so we can short-circuit when done */ - for (LV2_Atom_Object_Query* q = query; q->key; ++q) { - ++n_queries; - } - - LV2_ATOM_OBJECT_FOREACH (object, prop) { - for (LV2_Atom_Object_Query* q = query; q->key; ++q) { - if (q->key == prop->key && !*q->value) { - *q->value = &prop->value; - if (++matches == n_queries) { - return matches; - } - break; - } - } - } - return matches; -} - -/** - Body only version of lv2_atom_object_get(). -*/ -static inline int -lv2_atom_object_body_get(uint32_t size, const LV2_Atom_Object_Body* body, ...) -{ - int matches = 0; - int n_queries = 0; - - /* Count number of keys so we can short-circuit when done */ - va_list args; - va_start(args, body); - for (n_queries = 0; va_arg(args, uint32_t); ++n_queries) { - if (!va_arg(args, const LV2_Atom**)) { - va_end(args); - return -1; - } - } - va_end(args); - - LV2_ATOM_OBJECT_BODY_FOREACH (body, size, prop) { - va_start(args, body); - for (int i = 0; i < n_queries; ++i) { - uint32_t qkey = va_arg(args, uint32_t); - const LV2_Atom** qval = va_arg(args, const LV2_Atom**); - if (qkey == prop->key && !*qval) { - *qval = &prop->value; - if (++matches == n_queries) { - va_end(args); - return matches; - } - break; - } - } - va_end(args); - } - return matches; -} - -/** - Variable argument version of lv2_atom_object_query(). - - This is nicer-looking in code, but a bit more error-prone since it is not - type safe and the argument list must be terminated. - - The arguments should be a series of uint32_t key and const LV2_Atom** value - pairs, terminated by a zero key. The value pointers MUST be initialized to - NULL. For example: - - @code - const LV2_Atom* name = NULL; - const LV2_Atom* age = NULL; - lv2_atom_object_get(obj, - uris.name_key, &name, - uris.age_key, &age, - 0); - @endcode -*/ -static inline int -lv2_atom_object_get(const LV2_Atom_Object* object, ...) -{ - int matches = 0; - int n_queries = 0; - - /* Count number of keys so we can short-circuit when done */ - va_list args; - va_start(args, object); - for (n_queries = 0; va_arg(args, uint32_t); ++n_queries) { - if (!va_arg(args, const LV2_Atom**)) { - va_end(args); - return -1; - } - } - va_end(args); - - LV2_ATOM_OBJECT_FOREACH (object, prop) { - va_start(args, object); - for (int i = 0; i < n_queries; ++i) { - uint32_t qkey = va_arg(args, uint32_t); - const LV2_Atom** qval = va_arg(args, const LV2_Atom**); - if (qkey == prop->key && !*qval) { - *qval = &prop->value; - if (++matches == n_queries) { - va_end(args); - return matches; - } - break; - } - } - va_end(args); - } - return matches; -} - -/** - Variable argument version of lv2_atom_object_query() with types. - - This is like lv2_atom_object_get(), but each entry has an additional - parameter to specify the required type. Only atoms with a matching type - will be selected. - - The arguments should be a series of uint32_t key, const LV2_Atom**, uint32_t - type triples, terminated by a zero key. The value pointers MUST be - initialized to NULL. For example: - - @code - const LV2_Atom_String* name = NULL; - const LV2_Atom_Int* age = NULL; - lv2_atom_object_get(obj, - uris.name_key, &name, uris.atom_String, - uris.age_key, &age, uris.atom_Int - 0); - @endcode -*/ -static inline int -lv2_atom_object_get_typed(const LV2_Atom_Object* object, ...) -{ - int matches = 0; - int n_queries = 0; - - /* Count number of keys so we can short-circuit when done */ - va_list args; - va_start(args, object); - for (n_queries = 0; va_arg(args, uint32_t); ++n_queries) { - if (!va_arg(args, const LV2_Atom**) || !va_arg(args, uint32_t)) { - va_end(args); - return -1; - } - } - va_end(args); - - LV2_ATOM_OBJECT_FOREACH (object, prop) { - va_start(args, object); - for (int i = 0; i < n_queries; ++i) { - const uint32_t qkey = va_arg(args, uint32_t); - const LV2_Atom** qval = va_arg(args, const LV2_Atom**); - const uint32_t qtype = va_arg(args, uint32_t); - if (!*qval && qkey == prop->key && qtype == prop->value.type) { - *qval = &prop->value; - if (++matches == n_queries) { - va_end(args); - return matches; - } - break; - } - } - va_end(args); - } - return matches; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} - @} -*/ - -#endif /* LV2_ATOM_UTIL_H */ diff --git a/plugins/lv2/vendor/lv2/buf-size/buf-size.h b/plugins/lv2/vendor/lv2/buf-size/buf-size.h deleted file mode 100644 index 17be7bc41..000000000 --- a/plugins/lv2/vendor/lv2/buf-size/buf-size.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2007-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_BUF_SIZE_H -#define LV2_BUF_SIZE_H - -/** - @defgroup buf-size Buffer Size - @ingroup lv2 - - Access to, and restrictions on, buffer sizes. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_BUF_SIZE_URI "http://lv2plug.in/ns/ext/buf-size" ///< http://lv2plug.in/ns/ext/buf-size -#define LV2_BUF_SIZE_PREFIX LV2_BUF_SIZE_URI "#" ///< http://lv2plug.in/ns/ext/buf-size# - -#define LV2_BUF_SIZE__boundedBlockLength LV2_BUF_SIZE_PREFIX "boundedBlockLength" ///< http://lv2plug.in/ns/ext/buf-size#boundedBlockLength -#define LV2_BUF_SIZE__coarseBlockLength LV2_BUF_SIZE_PREFIX "coarseBlockLength" ///< http://lv2plug.in/ns/ext/buf-size#coarseBlockLength -#define LV2_BUF_SIZE__fixedBlockLength LV2_BUF_SIZE_PREFIX "fixedBlockLength" ///< http://lv2plug.in/ns/ext/buf-size#fixedBlockLength -#define LV2_BUF_SIZE__maxBlockLength LV2_BUF_SIZE_PREFIX "maxBlockLength" ///< http://lv2plug.in/ns/ext/buf-size#maxBlockLength -#define LV2_BUF_SIZE__minBlockLength LV2_BUF_SIZE_PREFIX "minBlockLength" ///< http://lv2plug.in/ns/ext/buf-size#minBlockLength -#define LV2_BUF_SIZE__nominalBlockLength LV2_BUF_SIZE_PREFIX "nominalBlockLength" ///< http://lv2plug.in/ns/ext/buf-size#nominalBlockLength -#define LV2_BUF_SIZE__powerOf2BlockLength LV2_BUF_SIZE_PREFIX "powerOf2BlockLength" ///< http://lv2plug.in/ns/ext/buf-size#powerOf2BlockLength -#define LV2_BUF_SIZE__sequenceSize LV2_BUF_SIZE_PREFIX "sequenceSize" ///< http://lv2plug.in/ns/ext/buf-size#sequenceSize - -// clang-format on - -/** - @} -*/ - -#endif /* LV2_BUF_SIZE_H */ diff --git a/plugins/lv2/vendor/lv2/core/attributes.h b/plugins/lv2/vendor/lv2/core/attributes.h deleted file mode 100644 index ab469312c..000000000 --- a/plugins/lv2/vendor/lv2/core/attributes.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2018 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_CORE_ATTRIBUTES_H -#define LV2_CORE_ATTRIBUTES_H - -/** - @defgroup attributes Attributes - @ingroup lv2 - - Macros for source code attributes. - - @{ -*/ - -#if defined(__GNUC__) && __GNUC__ > 3 -# define LV2_DEPRECATED __attribute__((__deprecated__)) -#else -# define LV2_DEPRECATED -#endif - -#if defined(__clang__) -# define LV2_DISABLE_DEPRECATION_WARNINGS \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") -#elif defined(__GNUC__) && __GNUC__ > 4 -# define LV2_DISABLE_DEPRECATION_WARNINGS \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") -#else -# define LV2_DISABLE_DEPRECATION_WARNINGS -#endif - -#if defined(__clang__) -# define LV2_RESTORE_WARNINGS _Pragma("clang diagnostic pop") -#elif defined(__GNUC__) && __GNUC__ > 4 -# define LV2_RESTORE_WARNINGS _Pragma("GCC diagnostic pop") -#else -# define LV2_RESTORE_WARNINGS -#endif - -/** - @} -*/ - -#endif /* LV2_CORE_ATTRIBUTES_H */ diff --git a/plugins/lv2/vendor/lv2/core/lv2.h b/plugins/lv2/vendor/lv2/core/lv2.h deleted file mode 100644 index 06adea042..000000000 --- a/plugins/lv2/vendor/lv2/core/lv2.h +++ /dev/null @@ -1,470 +0,0 @@ -// Copyright 2006-2020 David Robillard -// Copyright 2006-2012 Steve Harris -// Copyright 2000-2002 Richard W.E. Furse, Paul Barton-Davis, Stefan Westerfeld. -// SPDX-License-Identifier: ISC - -#ifndef LV2_H_INCLUDED -#define LV2_H_INCLUDED - -/** - @defgroup lv2 LV2 - - The LV2 specification. - - @{ -*/ - -/** - @defgroup lv2core LV2 Core - - Core LV2 specification. - - See for details. - - @{ -*/ - -#include - -// clang-format off - -#define LV2_CORE_URI "http://lv2plug.in/ns/lv2core" ///< http://lv2plug.in/ns/lv2core -#define LV2_CORE_PREFIX LV2_CORE_URI "#" ///< http://lv2plug.in/ns/lv2core# - -#define LV2_CORE__AllpassPlugin LV2_CORE_PREFIX "AllpassPlugin" ///< http://lv2plug.in/ns/lv2core#AllpassPlugin -#define LV2_CORE__AmplifierPlugin LV2_CORE_PREFIX "AmplifierPlugin" ///< http://lv2plug.in/ns/lv2core#AmplifierPlugin -#define LV2_CORE__AnalyserPlugin LV2_CORE_PREFIX "AnalyserPlugin" ///< http://lv2plug.in/ns/lv2core#AnalyserPlugin -#define LV2_CORE__AudioPort LV2_CORE_PREFIX "AudioPort" ///< http://lv2plug.in/ns/lv2core#AudioPort -#define LV2_CORE__BandpassPlugin LV2_CORE_PREFIX "BandpassPlugin" ///< http://lv2plug.in/ns/lv2core#BandpassPlugin -#define LV2_CORE__CVPort LV2_CORE_PREFIX "CVPort" ///< http://lv2plug.in/ns/lv2core#CVPort -#define LV2_CORE__ChorusPlugin LV2_CORE_PREFIX "ChorusPlugin" ///< http://lv2plug.in/ns/lv2core#ChorusPlugin -#define LV2_CORE__CombPlugin LV2_CORE_PREFIX "CombPlugin" ///< http://lv2plug.in/ns/lv2core#CombPlugin -#define LV2_CORE__CompressorPlugin LV2_CORE_PREFIX "CompressorPlugin" ///< http://lv2plug.in/ns/lv2core#CompressorPlugin -#define LV2_CORE__ConstantPlugin LV2_CORE_PREFIX "ConstantPlugin" ///< http://lv2plug.in/ns/lv2core#ConstantPlugin -#define LV2_CORE__ControlPort LV2_CORE_PREFIX "ControlPort" ///< http://lv2plug.in/ns/lv2core#ControlPort -#define LV2_CORE__ConverterPlugin LV2_CORE_PREFIX "ConverterPlugin" ///< http://lv2plug.in/ns/lv2core#ConverterPlugin -#define LV2_CORE__DelayPlugin LV2_CORE_PREFIX "DelayPlugin" ///< http://lv2plug.in/ns/lv2core#DelayPlugin -#define LV2_CORE__DistortionPlugin LV2_CORE_PREFIX "DistortionPlugin" ///< http://lv2plug.in/ns/lv2core#DistortionPlugin -#define LV2_CORE__DynamicsPlugin LV2_CORE_PREFIX "DynamicsPlugin" ///< http://lv2plug.in/ns/lv2core#DynamicsPlugin -#define LV2_CORE__EQPlugin LV2_CORE_PREFIX "EQPlugin" ///< http://lv2plug.in/ns/lv2core#EQPlugin -#define LV2_CORE__EnvelopePlugin LV2_CORE_PREFIX "EnvelopePlugin" ///< http://lv2plug.in/ns/lv2core#EnvelopePlugin -#define LV2_CORE__ExpanderPlugin LV2_CORE_PREFIX "ExpanderPlugin" ///< http://lv2plug.in/ns/lv2core#ExpanderPlugin -#define LV2_CORE__ExtensionData LV2_CORE_PREFIX "ExtensionData" ///< http://lv2plug.in/ns/lv2core#ExtensionData -#define LV2_CORE__Feature LV2_CORE_PREFIX "Feature" ///< http://lv2plug.in/ns/lv2core#Feature -#define LV2_CORE__FilterPlugin LV2_CORE_PREFIX "FilterPlugin" ///< http://lv2plug.in/ns/lv2core#FilterPlugin -#define LV2_CORE__FlangerPlugin LV2_CORE_PREFIX "FlangerPlugin" ///< http://lv2plug.in/ns/lv2core#FlangerPlugin -#define LV2_CORE__FunctionPlugin LV2_CORE_PREFIX "FunctionPlugin" ///< http://lv2plug.in/ns/lv2core#FunctionPlugin -#define LV2_CORE__GatePlugin LV2_CORE_PREFIX "GatePlugin" ///< http://lv2plug.in/ns/lv2core#GatePlugin -#define LV2_CORE__GeneratorPlugin LV2_CORE_PREFIX "GeneratorPlugin" ///< http://lv2plug.in/ns/lv2core#GeneratorPlugin -#define LV2_CORE__HighpassPlugin LV2_CORE_PREFIX "HighpassPlugin" ///< http://lv2plug.in/ns/lv2core#HighpassPlugin -#define LV2_CORE__InputPort LV2_CORE_PREFIX "InputPort" ///< http://lv2plug.in/ns/lv2core#InputPort -#define LV2_CORE__InstrumentPlugin LV2_CORE_PREFIX "InstrumentPlugin" ///< http://lv2plug.in/ns/lv2core#InstrumentPlugin -#define LV2_CORE__LimiterPlugin LV2_CORE_PREFIX "LimiterPlugin" ///< http://lv2plug.in/ns/lv2core#LimiterPlugin -#define LV2_CORE__LowpassPlugin LV2_CORE_PREFIX "LowpassPlugin" ///< http://lv2plug.in/ns/lv2core#LowpassPlugin -#define LV2_CORE__MixerPlugin LV2_CORE_PREFIX "MixerPlugin" ///< http://lv2plug.in/ns/lv2core#MixerPlugin -#define LV2_CORE__ModulatorPlugin LV2_CORE_PREFIX "ModulatorPlugin" ///< http://lv2plug.in/ns/lv2core#ModulatorPlugin -#define LV2_CORE__MultiEQPlugin LV2_CORE_PREFIX "MultiEQPlugin" ///< http://lv2plug.in/ns/lv2core#MultiEQPlugin -#define LV2_CORE__OscillatorPlugin LV2_CORE_PREFIX "OscillatorPlugin" ///< http://lv2plug.in/ns/lv2core#OscillatorPlugin -#define LV2_CORE__OutputPort LV2_CORE_PREFIX "OutputPort" ///< http://lv2plug.in/ns/lv2core#OutputPort -#define LV2_CORE__ParaEQPlugin LV2_CORE_PREFIX "ParaEQPlugin" ///< http://lv2plug.in/ns/lv2core#ParaEQPlugin -#define LV2_CORE__PhaserPlugin LV2_CORE_PREFIX "PhaserPlugin" ///< http://lv2plug.in/ns/lv2core#PhaserPlugin -#define LV2_CORE__PitchPlugin LV2_CORE_PREFIX "PitchPlugin" ///< http://lv2plug.in/ns/lv2core#PitchPlugin -#define LV2_CORE__Plugin LV2_CORE_PREFIX "Plugin" ///< http://lv2plug.in/ns/lv2core#Plugin -#define LV2_CORE__PluginBase LV2_CORE_PREFIX "PluginBase" ///< http://lv2plug.in/ns/lv2core#PluginBase -#define LV2_CORE__Point LV2_CORE_PREFIX "Point" ///< http://lv2plug.in/ns/lv2core#Point -#define LV2_CORE__Port LV2_CORE_PREFIX "Port" ///< http://lv2plug.in/ns/lv2core#Port -#define LV2_CORE__PortProperty LV2_CORE_PREFIX "PortProperty" ///< http://lv2plug.in/ns/lv2core#PortProperty -#define LV2_CORE__Resource LV2_CORE_PREFIX "Resource" ///< http://lv2plug.in/ns/lv2core#Resource -#define LV2_CORE__ReverbPlugin LV2_CORE_PREFIX "ReverbPlugin" ///< http://lv2plug.in/ns/lv2core#ReverbPlugin -#define LV2_CORE__ScalePoint LV2_CORE_PREFIX "ScalePoint" ///< http://lv2plug.in/ns/lv2core#ScalePoint -#define LV2_CORE__SimulatorPlugin LV2_CORE_PREFIX "SimulatorPlugin" ///< http://lv2plug.in/ns/lv2core#SimulatorPlugin -#define LV2_CORE__SpatialPlugin LV2_CORE_PREFIX "SpatialPlugin" ///< http://lv2plug.in/ns/lv2core#SpatialPlugin -#define LV2_CORE__Specification LV2_CORE_PREFIX "Specification" ///< http://lv2plug.in/ns/lv2core#Specification -#define LV2_CORE__SpectralPlugin LV2_CORE_PREFIX "SpectralPlugin" ///< http://lv2plug.in/ns/lv2core#SpectralPlugin -#define LV2_CORE__UtilityPlugin LV2_CORE_PREFIX "UtilityPlugin" ///< http://lv2plug.in/ns/lv2core#UtilityPlugin -#define LV2_CORE__WaveshaperPlugin LV2_CORE_PREFIX "WaveshaperPlugin" ///< http://lv2plug.in/ns/lv2core#WaveshaperPlugin -#define LV2_CORE__appliesTo LV2_CORE_PREFIX "appliesTo" ///< http://lv2plug.in/ns/lv2core#appliesTo -#define LV2_CORE__binary LV2_CORE_PREFIX "binary" ///< http://lv2plug.in/ns/lv2core#binary -#define LV2_CORE__connectionOptional LV2_CORE_PREFIX "connectionOptional" ///< http://lv2plug.in/ns/lv2core#connectionOptional -#define LV2_CORE__control LV2_CORE_PREFIX "control" ///< http://lv2plug.in/ns/lv2core#control -#define LV2_CORE__default LV2_CORE_PREFIX "default" ///< http://lv2plug.in/ns/lv2core#default -#define LV2_CORE__designation LV2_CORE_PREFIX "designation" ///< http://lv2plug.in/ns/lv2core#designation -#define LV2_CORE__documentation LV2_CORE_PREFIX "documentation" ///< http://lv2plug.in/ns/lv2core#documentation -#define LV2_CORE__enabled LV2_CORE_PREFIX "enabled" ///< http://lv2plug.in/ns/lv2core#enabled -#define LV2_CORE__enumeration LV2_CORE_PREFIX "enumeration" ///< http://lv2plug.in/ns/lv2core#enumeration -#define LV2_CORE__extensionData LV2_CORE_PREFIX "extensionData" ///< http://lv2plug.in/ns/lv2core#extensionData -#define LV2_CORE__freeWheeling LV2_CORE_PREFIX "freeWheeling" ///< http://lv2plug.in/ns/lv2core#freeWheeling -#define LV2_CORE__hardRTCapable LV2_CORE_PREFIX "hardRTCapable" ///< http://lv2plug.in/ns/lv2core#hardRTCapable -#define LV2_CORE__inPlaceBroken LV2_CORE_PREFIX "inPlaceBroken" ///< http://lv2plug.in/ns/lv2core#inPlaceBroken -#define LV2_CORE__index LV2_CORE_PREFIX "index" ///< http://lv2plug.in/ns/lv2core#index -#define LV2_CORE__integer LV2_CORE_PREFIX "integer" ///< http://lv2plug.in/ns/lv2core#integer -#define LV2_CORE__isLive LV2_CORE_PREFIX "isLive" ///< http://lv2plug.in/ns/lv2core#isLive -#define LV2_CORE__latency LV2_CORE_PREFIX "latency" ///< http://lv2plug.in/ns/lv2core#latency -#define LV2_CORE__maximum LV2_CORE_PREFIX "maximum" ///< http://lv2plug.in/ns/lv2core#maximum -#define LV2_CORE__microVersion LV2_CORE_PREFIX "microVersion" ///< http://lv2plug.in/ns/lv2core#microVersion -#define LV2_CORE__minimum LV2_CORE_PREFIX "minimum" ///< http://lv2plug.in/ns/lv2core#minimum -#define LV2_CORE__minorVersion LV2_CORE_PREFIX "minorVersion" ///< http://lv2plug.in/ns/lv2core#minorVersion -#define LV2_CORE__name LV2_CORE_PREFIX "name" ///< http://lv2plug.in/ns/lv2core#name -#define LV2_CORE__optionalFeature LV2_CORE_PREFIX "optionalFeature" ///< http://lv2plug.in/ns/lv2core#optionalFeature -#define LV2_CORE__port LV2_CORE_PREFIX "port" ///< http://lv2plug.in/ns/lv2core#port -#define LV2_CORE__portProperty LV2_CORE_PREFIX "portProperty" ///< http://lv2plug.in/ns/lv2core#portProperty -#define LV2_CORE__project LV2_CORE_PREFIX "project" ///< http://lv2plug.in/ns/lv2core#project -#define LV2_CORE__prototype LV2_CORE_PREFIX "prototype" ///< http://lv2plug.in/ns/lv2core#prototype -#define LV2_CORE__reportsLatency LV2_CORE_PREFIX "reportsLatency" ///< http://lv2plug.in/ns/lv2core#reportsLatency -#define LV2_CORE__requiredFeature LV2_CORE_PREFIX "requiredFeature" ///< http://lv2plug.in/ns/lv2core#requiredFeature -#define LV2_CORE__sampleRate LV2_CORE_PREFIX "sampleRate" ///< http://lv2plug.in/ns/lv2core#sampleRate -#define LV2_CORE__scalePoint LV2_CORE_PREFIX "scalePoint" ///< http://lv2plug.in/ns/lv2core#scalePoint -#define LV2_CORE__symbol LV2_CORE_PREFIX "symbol" ///< http://lv2plug.in/ns/lv2core#symbol -#define LV2_CORE__toggled LV2_CORE_PREFIX "toggled" ///< http://lv2plug.in/ns/lv2core#toggled - -// clang-format on - -#ifdef __cplusplus -extern "C" { -#endif - -/** - Plugin Instance Handle. - - This is a handle for one particular instance of a plugin. It is valid to - compare to NULL (or 0 for C++) but otherwise the host MUST NOT attempt to - interpret it. -*/ -typedef void* LV2_Handle; - -/** - Feature. - - Features allow hosts to make additional functionality available to plugins - without requiring modification to the LV2 API. Extensions may define new - features and specify the `URI` and `data` to be used if necessary. - Some features, such as lv2:isLive, do not require the host to pass data. -*/ -typedef struct { - /** - A globally unique, case-sensitive identifier (URI) for this feature. - - This MUST be a valid URI string as defined by RFC 3986. - */ - const char* URI; - - /** - Pointer to arbitrary data. - - The format of this data is defined by the extension which describes the - feature with the given `URI`. - */ - void* data; -} LV2_Feature; - -/** - Plugin Descriptor. - - This structure provides the core functions necessary to instantiate and use - a plugin. -*/ -typedef struct LV2_Descriptor { - /** - A globally unique, case-sensitive identifier for this plugin. - - This MUST be a valid URI string as defined by RFC 3986. All plugins with - the same URI MUST be compatible to some degree, see - http://lv2plug.in/ns/lv2core for details. - */ - const char* URI; - - /** - Instantiate the plugin. - - Note that instance initialisation should generally occur in activate() - rather than here. If a host calls instantiate(), it MUST call cleanup() - at some point in the future. - - @param descriptor Descriptor of the plugin to instantiate. - - @param sample_rate Sample rate, in Hz, for the new plugin instance. - - @param bundle_path Path to the LV2 bundle which contains this plugin - binary. It MUST include the trailing directory separator so that simply - appending a filename will yield the path to that file in the bundle. - - @param features A NULL terminated array of LV2_Feature structs which - represent the features the host supports. Plugins may refuse to - instantiate if required features are not found here. However, hosts MUST - NOT use this as a discovery mechanism: instead, use the RDF data to - determine which features are required and do not attempt to instantiate - unsupported plugins at all. This parameter MUST NOT be NULL, i.e. a host - that supports no features MUST pass a single element array containing - NULL. - - @return A handle for the new plugin instance, or NULL if instantiation - has failed. - */ - LV2_Handle (*instantiate)(const struct LV2_Descriptor* descriptor, - double sample_rate, - const char* bundle_path, - const LV2_Feature* const* features); - - /** - Connect a port on a plugin instance to a memory location. - - Plugin writers should be aware that the host may elect to use the same - buffer for more than one port and even use the same buffer for both - input and output (see lv2:inPlaceBroken in lv2.ttl). - - If the plugin has the feature lv2:hardRTCapable then there are various - things that the plugin MUST NOT do within the connect_port() function; - see lv2core.ttl for details. - - connect_port() MUST be called at least once for each port before run() - is called, unless that port is lv2:connectionOptional. The plugin must - pay careful attention to the block size passed to run() since the block - allocated may only just be large enough to contain the data, and is not - guaranteed to remain constant between run() calls. - - connect_port() may be called more than once for a plugin instance to - allow the host to change the buffers that the plugin is reading or - writing. These calls may be made before or after activate() or - deactivate() calls. - - @param instance Plugin instance containing the port. - - @param port Index of the port to connect. The host MUST NOT try to - connect a port index that is not defined in the plugin's RDF data. If - it does, the plugin's behaviour is undefined (a crash is likely). - - @param data_location Pointer to data of the type defined by the port - type in the plugin's RDF data (for example, an array of float for an - lv2:AudioPort). This pointer must be stored by the plugin instance and - used to read/write data when run() is called. Data present at the time - of the connect_port() call MUST NOT be considered meaningful. - */ - void (*connect_port)(LV2_Handle instance, uint32_t port, void* data_location); - - /** - Initialise a plugin instance and activate it for use. - - This is separated from instantiate() to aid real-time support and so - that hosts can reinitialise a plugin instance by calling deactivate() - and then activate(). In this case the plugin instance MUST reset all - state information dependent on the history of the plugin instance except - for any data locations provided by connect_port(). If there is nothing - for activate() to do then this field may be NULL. - - When present, hosts MUST call this function once before run() is called - for the first time. This call SHOULD be made as close to the run() call - as possible and indicates to real-time plugins that they are now live, - however plugins MUST NOT rely on a prompt call to run() after - activate(). - - The host MUST NOT call activate() again until deactivate() has been - called first. If a host calls activate(), it MUST call deactivate() at - some point in the future. Note that connect_port() may be called before - or after activate(). - */ - void (*activate)(LV2_Handle instance); - - /** - Run a plugin instance for a block. - - Note that if an activate() function exists then it must be called before - run(). If deactivate() is called for a plugin instance then run() may - not be called until activate() has been called again. - - If the plugin has the feature lv2:hardRTCapable then there are various - things that the plugin MUST NOT do within the run() function (see - lv2core.ttl for details). - - As a special case, when `sample_count` is 0, the plugin should update - any output ports that represent a single instant in time (for example, - control ports, but not audio ports). This is particularly useful for - latent plugins, which should update their latency output port so hosts - can pre-roll plugins to compute latency. Plugins MUST NOT crash when - `sample_count` is 0. - - @param instance Instance to be run. - - @param sample_count The block size (in samples) for which the plugin - instance must run. - */ - void (*run)(LV2_Handle instance, uint32_t sample_count); - - /** - Deactivate a plugin instance (counterpart to activate()). - - Hosts MUST deactivate all activated instances after they have been run() - for the last time. This call SHOULD be made as close to the last run() - call as possible and indicates to real-time plugins that they are no - longer live, however plugins MUST NOT rely on prompt deactivation. If - there is nothing for deactivate() to do then this field may be NULL - - Deactivation is not similar to pausing since the plugin instance will be - reinitialised by activate(). However, deactivate() itself MUST NOT fully - reset plugin state. For example, the host may deactivate a plugin, then - store its state (using some extension to do so). - - Hosts MUST NOT call deactivate() unless activate() was previously - called. Note that connect_port() may be called before or after - deactivate(). - */ - void (*deactivate)(LV2_Handle instance); - - /** - Clean up a plugin instance (counterpart to instantiate()). - - Once an instance of a plugin has been finished with it must be deleted - using this function. The instance handle passed ceases to be valid after - this call. - - If activate() was called for a plugin instance then a corresponding call - to deactivate() MUST be made before cleanup() is called. Hosts MUST NOT - call cleanup() unless instantiate() was previously called. - */ - void (*cleanup)(LV2_Handle instance); - - /** - Return additional plugin data defined by some extension. - - A typical use of this facility is to return a struct containing function - pointers to extend the LV2_Descriptor API. - - The actual type and meaning of the returned object MUST be specified - precisely by the extension. This function MUST return NULL for any - unsupported URI. If a plugin does not support any extension data, this - field may be NULL. - - The host is never responsible for freeing the returned value. - */ - const void* (*extension_data)(const char* uri); -} LV2_Descriptor; - -/** - Helper macro needed for LV2_SYMBOL_EXPORT when using C++. -*/ -#ifdef __cplusplus -# define LV2_SYMBOL_EXTERN extern "C" -#else -# define LV2_SYMBOL_EXTERN -#endif - -/** - Put this (LV2_SYMBOL_EXPORT) before any functions that are to be loaded - by the host as a symbol from the dynamic library. -*/ -#ifdef _WIN32 -# define LV2_SYMBOL_EXPORT LV2_SYMBOL_EXTERN __declspec(dllexport) -#else -# define LV2_SYMBOL_EXPORT \ - LV2_SYMBOL_EXTERN __attribute__((visibility("default"))) -#endif - -/** - Prototype for plugin accessor function. - - Plugins are discovered by hosts using RDF data (not by loading libraries). - See http://lv2plug.in for details on the discovery process, though most - hosts should use an existing library to implement this functionality. - - This is the simple plugin discovery API, suitable for most statically - defined plugins. Advanced plugins that need access to their bundle during - discovery can use lv2_lib_descriptor() instead. Plugin libraries MUST - include a function called "lv2_descriptor" or "lv2_lib_descriptor" with - C-style linkage, but SHOULD provide "lv2_descriptor" wherever possible. - - When it is time to load a plugin (designated by its URI), the host loads the - plugin's library, gets the lv2_descriptor() function from it, and uses this - function to find the LV2_Descriptor for the desired plugin. Plugins are - accessed by index using values from 0 upwards. This function MUST return - NULL for out of range indices, so the host can enumerate plugins by - increasing `index` until NULL is returned. - - Note that `index` has no meaning, hosts MUST NOT depend on it remaining - consistent between loads of the plugin library. -*/ -LV2_SYMBOL_EXPORT -const LV2_Descriptor* -lv2_descriptor(uint32_t index); - -/** - Type of the lv2_descriptor() function in a library (old discovery API). -*/ -typedef const LV2_Descriptor* (*LV2_Descriptor_Function)(uint32_t index); - -/** - Handle for a library descriptor. -*/ -typedef void* LV2_Lib_Handle; - -/** - Descriptor for a plugin library. - - To access a plugin library, the host creates an LV2_Lib_Descriptor via the - lv2_lib_descriptor() function in the shared object. -*/ -typedef struct { - /** - Opaque library data which must be passed as the first parameter to all - the methods of this struct. - */ - LV2_Lib_Handle handle; - - /** - The total size of this struct. This allows for this struct to be - expanded in the future if necessary. This MUST be set by the library to - sizeof(LV2_Lib_Descriptor). The host MUST NOT access any fields of this - struct beyond get_plugin() unless this field indicates they are present. - */ - uint32_t size; - - /** - Destroy this library descriptor and free all related resources. - */ - void (*cleanup)(LV2_Lib_Handle handle); - - /** - Plugin accessor. - - Plugins are accessed by index using values from 0 upwards. Out of range - indices MUST result in this function returning NULL, so the host can - enumerate plugins by increasing `index` until NULL is returned. - */ - const LV2_Descriptor* (*get_plugin)(LV2_Lib_Handle handle, uint32_t index); -} LV2_Lib_Descriptor; - -/** - Prototype for library accessor function. - - This is the more advanced discovery API, which allows plugin libraries to - access their bundles during discovery, which makes it possible for plugins to - be dynamically defined by files in their bundle. This API also has an - explicit cleanup function, removing any need for non-portable shared library - destructors. Simple plugins that do not require these features may use - lv2_descriptor() instead. - - This is the entry point for a plugin library. Hosts load this symbol from - the library and call this function to obtain a library descriptor which can - be used to access all the contained plugins. The returned object must not - be destroyed (using LV2_Lib_Descriptor::cleanup()) until all plugins loaded - from that library have been destroyed. -*/ -LV2_SYMBOL_EXPORT -const LV2_Lib_Descriptor* -lv2_lib_descriptor(const char* bundle_path, const LV2_Feature* const* features); - -/** - Type of the lv2_lib_descriptor() function in an LV2 library. -*/ -typedef const LV2_Lib_Descriptor* (*LV2_Lib_Descriptor_Function)( - const char* bundle_path, - const LV2_Feature* const* features); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} - @} -*/ - -#endif /* LV2_H_INCLUDED */ diff --git a/plugins/lv2/vendor/lv2/core/lv2_util.h b/plugins/lv2/vendor/lv2/core/lv2_util.h deleted file mode 100644 index 8cd287293..000000000 --- a/plugins/lv2/vendor/lv2/core/lv2_util.h +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2016 David Robillard -// SPDX-License-Identifier: ISC - -/** - @defgroup util Utilities - @ingroup lv2core - @{ -*/ - -#include "lv2/core/lv2.h" - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - Return the data for a feature in a features array. - - If the feature is not found, NULL is returned. Note that this function is - only useful for features with data, and can not detect features that are - present but have NULL data. -*/ -static inline void* -lv2_features_data(const LV2_Feature* const* features, const char* const uri) -{ - if (features) { - for (const LV2_Feature* const* f = features; *f; ++f) { - if (!strcmp(uri, (*f)->URI)) { - return (*f)->data; - } - } - } - return NULL; -} - -/** - Query a features array. - - This function allows getting several features in one call, and detect - missing required features, with the same caveat of lv2_features_data(). - - The arguments should be a series of const char* uri, void** data, bool - required, terminated by a NULL URI. The data pointers MUST be initialized - to NULL. For example: - - @code - LV2_URID_Log* log = NULL; - LV2_URID_Map* map = NULL; - const char* missing = lv2_features_query( - features, - LV2_LOG__log, &log, false, - LV2_URID__map, &map, true, - NULL); - @endcode - - @return NULL on success, otherwise the URI of this missing feature. -*/ -static inline const char* -lv2_features_query(const LV2_Feature* const* features, ...) -{ - va_list args; - va_start(args, features); - - const char* uri = NULL; - while ((uri = va_arg(args, const char*))) { - void** data = va_arg(args, void**); - bool required = (bool)va_arg(args, int); - - *data = lv2_features_data(features, uri); - if (required && !*data) { - va_end(args); - return uri; - } - } - - va_end(args); - return NULL; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ diff --git a/plugins/lv2/vendor/lv2/data-access/data-access.h b/plugins/lv2/vendor/lv2/data-access/data-access.h deleted file mode 100644 index 2809d93dc..000000000 --- a/plugins/lv2/vendor/lv2/data-access/data-access.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2008-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_DATA_ACCESS_H -#define LV2_DATA_ACCESS_H - -/** - @defgroup data-access Data Access - @ingroup lv2 - - Access to plugin extension_data() for UIs. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_DATA_ACCESS_URI "http://lv2plug.in/ns/ext/data-access" ///< http://lv2plug.in/ns/ext/data-access -#define LV2_DATA_ACCESS_PREFIX LV2_DATA_ACCESS_URI "#" ///< http://lv2plug.in/ns/ext/data-access# - -// clang-format on - -#ifdef __cplusplus -extern "C" { -#endif - -/** - The data field of the LV2_Feature for this extension. - - To support this feature the host must pass an LV2_Feature struct to the - instantiate method with URI "http://lv2plug.in/ns/ext/data-access" - and data pointed to an instance of this struct. -*/ -typedef struct { - /** - A pointer to a method the UI can call to get data (of a type specified - by some other extension) from the plugin. - - This call never is never guaranteed to return anything, UIs should - degrade gracefully if direct access to the plugin data is not possible - (in which case this function will return NULL). - - This is for access to large data that can only possibly work if the UI - and plugin are running in the same process. For all other things, use - the normal LV2 UI communication system. - */ - const void* (*data_access)(const char* uri); -} LV2_Extension_Data_Feature; - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_DATA_ACCESS_H */ diff --git a/plugins/lv2/vendor/lv2/dynmanifest/dynmanifest.h b/plugins/lv2/vendor/lv2/dynmanifest/dynmanifest.h deleted file mode 100644 index d67c75036..000000000 --- a/plugins/lv2/vendor/lv2/dynmanifest/dynmanifest.h +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2008-2011 Stefano D'Angelo -// SPDX-License-Identifier: ISC - -#ifndef LV2_DYN_MANIFEST_H_INCLUDED -#define LV2_DYN_MANIFEST_H_INCLUDED - -/** - @defgroup dynmanifest Dynamic Manifest - @ingroup lv2 - - Support for dynamic data generation. - - See for details. - - @{ -*/ - -#include "lv2/core/lv2.h" - -#include - -// clang-format off - -#define LV2_DYN_MANIFEST_URI "http://lv2plug.in/ns/ext/dynmanifest" ///< http://lv2plug.in/ns/ext/dynmanifest -#define LV2_DYN_MANIFEST_PREFIX LV2_DYN_MANIFEST_URI "#" ///< http://lv2plug.in/ns/ext/dynmanifest# - -// clang-format on - -#ifdef __cplusplus -extern "C" { -#endif - -/** - Dynamic manifest generator handle. - - This handle indicates a particular status of a dynamic manifest generator. - The host MUST NOT attempt to interpret it and, unlikely LV2_Handle, it is - NOT even valid to compare this to NULL. The dynamic manifest generator MAY - use it to reference internal data. -*/ -typedef void* LV2_Dyn_Manifest_Handle; - -/** - Generate the dynamic manifest. - - @param handle Pointer to an uninitialized dynamic manifest generator handle. - - @param features NULL terminated array of LV2_Feature structs which represent - the features the host supports. The dynamic manifest generator may refuse to - (re)generate the dynamic manifest if required features are not found here - (however hosts SHOULD NOT use this as a discovery mechanism, instead of - reading the static manifest file). This array must always exist; if a host - has no features, it MUST pass a single element array containing NULL. - - @return 0 on success, otherwise a non-zero error code. The host SHOULD - evaluate the result of the operation by examining the returned value and - MUST NOT try to interpret the value of handle. -*/ -int -lv2_dyn_manifest_open(LV2_Dyn_Manifest_Handle* handle, - const LV2_Feature* const* features); - -/** - Fetch a "list" of subject URIs described in the dynamic manifest. - - The dynamic manifest generator has to fill the resource only with the needed - triples to make the host aware of the "objects" it wants to expose. For - example, if the plugin library exposes a regular LV2 plugin, it should - output only a triple like the following: - - a lv2:Plugin . - - The objects that are eligible for exposure are those that would need to be - represented by a subject node in a static manifest. - - @param handle Dynamic manifest generator handle. - - @param fp FILE * identifying the resource the host has to set up for the - dynamic manifest generator. The host MUST pass a writable, empty resource to - this function, and the dynamic manifest generator MUST ONLY perform write - operations on it at the end of the stream (for example, using only - fprintf(), fwrite() and similar). - - @return 0 on success, otherwise a non-zero error code. -*/ -int -lv2_dyn_manifest_get_subjects(LV2_Dyn_Manifest_Handle handle, FILE* fp); - -/** - Function that fetches data related to a specific URI. - - The dynamic manifest generator has to fill the resource with data related to - object represented by the given URI. For example, if the library exposes a - regular LV2 plugin whose URI, as retrieved by the host using - lv2_dyn_manifest_get_subjects() is http://example.org/plugin then it - should output something like: - -
-   
-       a lv2:Plugin ;
-       doap:name "My Plugin" ;
-       lv2:binary  ;
-       etc:etc "..." .
-   
- - @param handle Dynamic manifest generator handle. - - @param fp FILE * identifying the resource the host has to set up for the - dynamic manifest generator. The host MUST pass a writable resource to this - function, and the dynamic manifest generator MUST ONLY perform write - operations on it at the current position of the stream (for example, using - only fprintf(), fwrite() and similar). - - @param uri URI to get data about (in the "plain" form, i.e., absolute URI - without Turtle prefixes). - - @return 0 on success, otherwise a non-zero error code. -*/ -int -lv2_dyn_manifest_get_data(LV2_Dyn_Manifest_Handle handle, - FILE* fp, - const char* uri); - -/** - Function that ends the operations on the dynamic manifest generator. - - This function SHOULD be used by the dynamic manifest generator to perform - cleanup operations, etc. - - Once this function is called, referring to handle will cause undefined - behavior. - - @param handle Dynamic manifest generator handle. -*/ -void -lv2_dyn_manifest_close(LV2_Dyn_Manifest_Handle handle); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_DYN_MANIFEST_H_INCLUDED */ diff --git a/plugins/lv2/vendor/lv2/event/event-helpers.h b/plugins/lv2/vendor/lv2/event/event-helpers.h deleted file mode 100644 index 0bf352f88..000000000 --- a/plugins/lv2/vendor/lv2/event/event-helpers.h +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright 2008-2015 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_EVENT_HELPERS_H -#define LV2_EVENT_HELPERS_H - -/** - @file event-helpers.h Helper functions for the LV2 Event extension - . -*/ - -#include "lv2/core/attributes.h" -#include "lv2/event/event.h" - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -LV2_DISABLE_DEPRECATION_WARNINGS - -/** @file - * Helper functions for the LV2 Event extension - * . - * - * These functions are provided for convenience only, use of them is not - * required for supporting lv2ev (i.e. the events extension is defined by the - * raw buffer format described in lv2_event.h and NOT by this API). - * - * Note that these functions are all static inline which basically means: - * do not take the address of these functions. */ - -/** Pad a size to 64 bits (for event sizes) */ -static inline uint16_t -lv2_event_pad_size(uint16_t size) -{ - return (uint16_t)((size + 7U) & ~7U); -} - -/** Initialize (empty, reset..) an existing event buffer. - * The contents of buf are ignored entirely and overwritten, except capacity - * which is unmodified. */ -static inline void -lv2_event_buffer_reset(LV2_Event_Buffer* buf, - uint16_t stamp_type, - uint8_t* data) -{ - buf->data = data; - buf->header_size = sizeof(LV2_Event_Buffer); - buf->stamp_type = stamp_type; - buf->event_count = 0; - buf->size = 0; -} - -/** Allocate a new, empty event buffer. */ -static inline LV2_Event_Buffer* -lv2_event_buffer_new(uint32_t capacity, uint16_t stamp_type) -{ - const size_t size = sizeof(LV2_Event_Buffer) + capacity; - LV2_Event_Buffer* buf = (LV2_Event_Buffer*)malloc(size); - if (buf != NULL) { - buf->capacity = capacity; - lv2_event_buffer_reset(buf, stamp_type, (uint8_t*)(buf + 1)); - return buf; - } - return NULL; -} - -/** An iterator over an LV2_Event_Buffer. - * - * Multiple simultaneous read iterators over a single buffer is fine, - * but changing the buffer invalidates all iterators. */ -typedef struct { - LV2_Event_Buffer* buf; - uint32_t offset; -} LV2_Event_Iterator; - -/** Reset an iterator to point to the start of `buf`. - * @return True if `iter` is valid, otherwise false (buffer is empty) */ -static inline bool -lv2_event_begin(LV2_Event_Iterator* iter, LV2_Event_Buffer* buf) -{ - iter->buf = buf; - iter->offset = 0; - return (buf->size > 0); -} - -/** Check if `iter` is valid. - * @return True if `iter` is valid, otherwise false (past end of buffer) */ -static inline bool -lv2_event_is_valid(LV2_Event_Iterator* iter) -{ - return (iter->buf && (iter->offset < iter->buf->size)); -} - -/** Advance `iter` forward one event. - * `iter` must be valid. - * @return True if `iter` is valid, otherwise false (reached end of buffer) */ -static inline bool -lv2_event_increment(LV2_Event_Iterator* iter) -{ - if (!lv2_event_is_valid(iter)) { - return false; - } - - LV2_Event* const ev = (LV2_Event*)(iter->buf->data + iter->offset); - - iter->offset += - lv2_event_pad_size((uint16_t)((uint16_t)sizeof(LV2_Event) + ev->size)); - - return true; -} - -/** Dereference an event iterator (get the event currently pointed at). - * `iter` must be valid. - * `data` if non-NULL, will be set to point to the contents of the event - * returned. - * @return A Pointer to the event `iter` is currently pointing at, or NULL - * if the end of the buffer is reached (in which case `data` is - * also set to NULL). */ -static inline LV2_Event* -lv2_event_get(LV2_Event_Iterator* iter, uint8_t** data) -{ - if (!lv2_event_is_valid(iter)) { - return NULL; - } - - LV2_Event* const ev = (LV2_Event*)(iter->buf->data + iter->offset); - - if (data) { - *data = (uint8_t*)ev + sizeof(LV2_Event); - } - - return ev; -} - -/** Write an event at `iter`. - * The event (if any) pointed to by `iter` will be overwritten, and `iter` - * incremented to point to the following event (i.e. several calls to this - * function can be done in sequence without twiddling iter in-between). - * @return True if event was written, otherwise false (buffer is full). */ -static inline bool -lv2_event_write(LV2_Event_Iterator* iter, - uint32_t frames, - uint32_t subframes, - uint16_t type, - uint16_t size, - const uint8_t* data) -{ - if (!iter->buf) { - return false; - } - - if (iter->buf->capacity - iter->buf->size < sizeof(LV2_Event) + size) { - return false; - } - - LV2_Event* const ev = (LV2_Event*)(iter->buf->data + iter->offset); - - ev->frames = frames; - ev->subframes = subframes; - ev->type = type; - ev->size = size; - memcpy((uint8_t*)ev + sizeof(LV2_Event), data, size); - ++iter->buf->event_count; - - size = lv2_event_pad_size((uint16_t)(sizeof(LV2_Event) + size)); - iter->buf->size += size; - iter->offset += size; - - return true; -} - -/** Reserve space for an event in the buffer and return a pointer to - the memory where the caller can write the event data, or NULL if there - is not enough room in the buffer. */ -static inline uint8_t* -lv2_event_reserve(LV2_Event_Iterator* iter, - uint32_t frames, - uint32_t subframes, - uint16_t type, - uint16_t size) -{ - const uint16_t total_size = (uint16_t)(sizeof(LV2_Event) + size); - if (iter->buf->capacity - iter->buf->size < total_size) { - return NULL; - } - - LV2_Event* const ev = (LV2_Event*)(iter->buf->data + iter->offset); - - ev->frames = frames; - ev->subframes = subframes; - ev->type = type; - ev->size = size; - ++iter->buf->event_count; - - const uint16_t padded_size = lv2_event_pad_size(total_size); - iter->buf->size += padded_size; - iter->offset += padded_size; - - return (uint8_t*)ev + sizeof(LV2_Event); -} - -/** Write an event at `iter`. - * The event (if any) pointed to by `iter` will be overwritten, and `iter` - * incremented to point to the following event (i.e. several calls to this - * function can be done in sequence without twiddling iter in-between). - * @return True if event was written, otherwise false (buffer is full). */ -static inline bool -lv2_event_write_event(LV2_Event_Iterator* iter, - const LV2_Event* ev, - const uint8_t* data) -{ - const uint16_t total_size = (uint16_t)(sizeof(LV2_Event) + ev->size); - if (iter->buf->capacity - iter->buf->size < total_size) { - return false; - } - - LV2_Event* const write_ev = (LV2_Event*)(iter->buf->data + iter->offset); - - *write_ev = *ev; - memcpy((uint8_t*)write_ev + sizeof(LV2_Event), data, ev->size); - ++iter->buf->event_count; - - const uint16_t padded_size = lv2_event_pad_size(total_size); - iter->buf->size += padded_size; - iter->offset += padded_size; - - return true; -} - -LV2_RESTORE_WARNINGS - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* LV2_EVENT_HELPERS_H */ diff --git a/plugins/lv2/vendor/lv2/event/event.h b/plugins/lv2/vendor/lv2/event/event.h deleted file mode 100644 index b880de16f..000000000 --- a/plugins/lv2/vendor/lv2/event/event.h +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright 2008-2016 David Robillard -// Copyright 2006-2007 Lars Luthman -// SPDX-License-Identifier: ISC - -#ifndef LV2_EVENT_H -#define LV2_EVENT_H - -/** - @defgroup event Event - @ingroup lv2 - - Generic time-stamped events. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_EVENT_URI "http://lv2plug.in/ns/ext/event" ///< http://lv2plug.in/ns/ext/event -#define LV2_EVENT_PREFIX LV2_EVENT_URI "#" ///< http://lv2plug.in/ns/ext/event# - -#define LV2_EVENT__Event LV2_EVENT_PREFIX "Event" ///< http://lv2plug.in/ns/ext/event#Event -#define LV2_EVENT__EventPort LV2_EVENT_PREFIX "EventPort" ///< http://lv2plug.in/ns/ext/event#EventPort -#define LV2_EVENT__FrameStamp LV2_EVENT_PREFIX "FrameStamp" ///< http://lv2plug.in/ns/ext/event#FrameStamp -#define LV2_EVENT__TimeStamp LV2_EVENT_PREFIX "TimeStamp" ///< http://lv2plug.in/ns/ext/event#TimeStamp -#define LV2_EVENT__generatesTimeStamp LV2_EVENT_PREFIX "generatesTimeStamp" ///< http://lv2plug.in/ns/ext/event#generatesTimeStamp -#define LV2_EVENT__generic LV2_EVENT_PREFIX "generic" ///< http://lv2plug.in/ns/ext/event#generic -#define LV2_EVENT__inheritsEvent LV2_EVENT_PREFIX "inheritsEvent" ///< http://lv2plug.in/ns/ext/event#inheritsEvent -#define LV2_EVENT__inheritsTimeStamp LV2_EVENT_PREFIX "inheritsTimeStamp" ///< http://lv2plug.in/ns/ext/event#inheritsTimeStamp -#define LV2_EVENT__supportsEvent LV2_EVENT_PREFIX "supportsEvent" ///< http://lv2plug.in/ns/ext/event#supportsEvent -#define LV2_EVENT__supportsTimeStamp LV2_EVENT_PREFIX "supportsTimeStamp" ///< http://lv2plug.in/ns/ext/event#supportsTimeStamp - -// clang-format on - -#define LV2_EVENT_AUDIO_STAMP 0 ///< Special timestamp type for audio frames - -#include "lv2/core/attributes.h" - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -LV2_DISABLE_DEPRECATION_WARNINGS - -/** - The best Pulses Per Quarter Note for tempo-based uint32_t timestamps. - Equal to 2^12 * 5 * 7 * 9 * 11 * 13 * 17, which is evenly divisible - by all integers from 1 through 18 inclusive, and powers of 2 up to 2^12. -*/ -LV2_DEPRECATED -static const uint32_t LV2_EVENT_PPQN = 3136573440U; - -/** - An LV2 event (header only). - - LV2 events are generic time-stamped containers for any type of event. - The type field defines the format of a given event's contents. - - This struct defines the header of an LV2 event. An LV2 event is a single - chunk of POD (plain old data), usually contained in a flat buffer (see - LV2_EventBuffer below). Unless a required feature says otherwise, hosts may - assume a deep copy of an LV2 event can be created safely using a simple: - - memcpy(ev_copy, ev, sizeof(LV2_Event) + ev->size); (or equivalent) -*/ -LV2_DEPRECATED -typedef struct { - /** - The frames portion of timestamp. The units used here can optionally be - set for a port (with the lv2ev:timeUnits property), otherwise this is - audio frames, corresponding to the sample_count parameter of the LV2 run - method (frame 0 is the first frame for that call to run). - */ - uint32_t frames; - - /** - The sub-frames portion of timestamp. The units used here can optionally - be set for a port (with the lv2ev:timeUnits property), otherwise this is - 1/(2^32) of an audio frame. - */ - uint32_t subframes; - - /** - The type of this event, as a number which represents some URI - defining an event type. This value MUST be some value previously - returned from a call to the uri_to_id function defined in the LV2 - URI map extension (see lv2_uri_map.h). - There are special rules which must be followed depending on the type - of an event. If the plugin recognizes an event type, the definition - of that event type will describe how to interpret the event, and - any required behaviour. Otherwise, if the type is 0, this event is a - non-POD event and lv2_event_unref MUST be called if the event is - 'dropped' (see above). Even if the plugin does not understand an event, - it may pass the event through to an output by simply copying (and NOT - calling lv2_event_unref). These rules are designed to allow for generic - event handling plugins and large non-POD events, but with minimal hassle - on simple plugins that "don't care" about these more advanced features. - */ - uint16_t type; - - /** - The size of the data portion of this event in bytes, which immediately - follows. The header size (12 bytes) is not included in this value. - */ - uint16_t size; - - /* size bytes of data follow here */ -} LV2_Event; - -/** - A buffer of LV2 events (header only). - - Like events (which this contains) an event buffer is a single chunk of POD: - the entire buffer (including contents) can be copied with a single memcpy. - The first contained event begins sizeof(LV2_EventBuffer) bytes after the - start of this struct. - - After this header, the buffer contains an event header (defined by struct - LV2_Event), followed by that event's contents (padded to 64 bits), followed - by another header, etc: - - | | | | | | | - | | | | | | | | | | | | | | | | | | | | | | | | | - |FRAMES |SUBFRMS|TYP|LEN|DATA..DATA..PAD|FRAMES | ... -*/ -LV2_DEPRECATED -typedef struct { - /** - The contents of the event buffer. This may or may not reside in the - same block of memory as this header, plugins must not assume either. - The host guarantees this points to at least capacity bytes of allocated - memory (though only size bytes of that are valid events). - */ - uint8_t* data; - - /** - The size of this event header in bytes (including everything). - - This is to allow for extending this header in the future without - breaking binary compatibility. Whenever this header is copied, - it MUST be done using this field (and NOT the sizeof this struct). - */ - uint16_t header_size; - - /** - The type of the time stamps for events in this buffer. - As a special exception, '0' always means audio frames and subframes - (1/UINT32_MAX'th of a frame) in the sample rate passed to instantiate. - - INPUTS: The host must set this field to the numeric ID of some URI - defining the meaning of the frames/subframes fields of contained events - (obtained by the LV2 URI Map uri_to_id function with the URI of this - extension as the 'map' argument, see lv2_uri_map.h). The host must - never pass a plugin a buffer which uses a stamp type the plugin does not - 'understand'. The value of this field must never change, except when - connect_port is called on the input port, at which time the host MUST - have set the stamp_type field to the value that will be used for all - subsequent run calls. - - OUTPUTS: The plugin may set this to any value that has been returned - from uri_to_id with the URI of this extension for a 'map' argument. - When connected to a buffer with connect_port, output ports MUST set this - field to the type of time stamp they will be writing. On any call to - connect_port on an event input port, the plugin may change this field on - any output port, it is the responsibility of the host to check if any of - these values have changed and act accordingly. - */ - uint16_t stamp_type; - - /** - The number of events in this buffer. - - INPUTS: The host must set this field to the number of events contained - in the data buffer before calling run(). The plugin must not change - this field. - - OUTPUTS: The plugin must set this field to the number of events it has - written to the buffer before returning from run(). Any initial value - should be ignored by the plugin. - */ - uint32_t event_count; - - /** - The size of the data buffer in bytes. - This is set by the host and must not be changed by the plugin. - The host is allowed to change this between run() calls. - */ - uint32_t capacity; - - /** - The size of the initial portion of the data buffer containing data. - - INPUTS: The host must set this field to the number of bytes used - by all events it has written to the buffer (including headers) - before calling the plugin's run(). - The plugin must not change this field. - - OUTPUTS: The plugin must set this field to the number of bytes - used by all events it has written to the buffer (including headers) - before returning from run(). - Any initial value should be ignored by the plugin. - */ - uint32_t size; -} LV2_Event_Buffer; - -/** - Opaque pointer to host data. -*/ -LV2_DEPRECATED -typedef void* LV2_Event_Callback_Data; - -/** - Non-POD events feature. - - To support this feature the host must pass an LV2_Feature struct to the - plugin's instantiate method with URI "http://lv2plug.in/ns/ext/event" - and data pointed to an instance of this struct. Note this feature - is not mandatory to support the event extension. -*/ -LV2_DEPRECATED -typedef struct { - /** - Opaque pointer to host data. - - The plugin MUST pass this to any call to functions in this struct. - Otherwise, it must not be interpreted in any way. - */ - LV2_Event_Callback_Data callback_data; - - /** - Take a reference to a non-POD event. - - If a plugin receives an event with type 0, it means the event is a - pointer to some object in memory and not a flat sequence of bytes - in the buffer. When receiving a non-POD event, the plugin already - has an implicit reference to the event. If the event is stored AND - passed to an output, lv2_event_ref MUST be called on that event. - If the event is only stored OR passed through, this is not necessary - (as the plugin already has 1 implicit reference). - - @param callback_data The callback_data field of this struct. - - @param event An event received at an input that will not be copied to - an output or stored in any way. - - PLUGINS THAT VIOLATE THESE RULES MAY CAUSE CRASHES AND MEMORY LEAKS. - */ - uint32_t (*lv2_event_ref)(LV2_Event_Callback_Data callback_data, - LV2_Event* event); - - /** - Drop a reference to a non-POD event. - - If a plugin receives an event with type 0, it means the event is a - pointer to some object in memory and not a flat sequence of bytes - in the buffer. If the plugin does not pass the event through to - an output or store it internally somehow, it MUST call this function - on the event (more information on using non-POD events below). - - @param callback_data The callback_data field of this struct. - - @param event An event received at an input that will not be copied to an - output or stored in any way. - - PLUGINS THAT VIOLATE THESE RULES MAY CAUSE CRASHES AND MEMORY LEAKS. - */ - uint32_t (*lv2_event_unref)(LV2_Event_Callback_Data callback_data, - LV2_Event* event); -} LV2_Event_Feature; - -LV2_RESTORE_WARNINGS - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_EVENT_H */ diff --git a/plugins/lv2/vendor/lv2/instance-access/instance-access.h b/plugins/lv2/vendor/lv2/instance-access/instance-access.h deleted file mode 100644 index a87ecaf11..000000000 --- a/plugins/lv2/vendor/lv2/instance-access/instance-access.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2008-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_INSTANCE_ACCESS_H -#define LV2_INSTANCE_ACCESS_H - -/** - @defgroup instance-access Instance Access - @ingroup lv2 - - Access to the LV2_Handle of a plugin for UIs. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_INSTANCE_ACCESS_URI "http://lv2plug.in/ns/ext/instance-access" ///< http://lv2plug.in/ns/ext/instance-access - -// clang-format on - -/** - @} -*/ - -#endif /* LV2_INSTANCE_ACCESS_H */ diff --git a/plugins/lv2/vendor/lv2/log/log.h b/plugins/lv2/vendor/lv2/log/log.h deleted file mode 100644 index cdaa6d33f..000000000 --- a/plugins/lv2/vendor/lv2/log/log.h +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2012-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_LOG_H -#define LV2_LOG_H - -/** - @defgroup log Log - @ingroup lv2 - - Interface for plugins to log via the host. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_LOG_URI "http://lv2plug.in/ns/ext/log" ///< http://lv2plug.in/ns/ext/log -#define LV2_LOG_PREFIX LV2_LOG_URI "#" ///< http://lv2plug.in/ns/ext/log# - -#define LV2_LOG__Entry LV2_LOG_PREFIX "Entry" ///< http://lv2plug.in/ns/ext/log#Entry -#define LV2_LOG__Error LV2_LOG_PREFIX "Error" ///< http://lv2plug.in/ns/ext/log#Error -#define LV2_LOG__Note LV2_LOG_PREFIX "Note" ///< http://lv2plug.in/ns/ext/log#Note -#define LV2_LOG__Trace LV2_LOG_PREFIX "Trace" ///< http://lv2plug.in/ns/ext/log#Trace -#define LV2_LOG__Warning LV2_LOG_PREFIX "Warning" ///< http://lv2plug.in/ns/ext/log#Warning -#define LV2_LOG__log LV2_LOG_PREFIX "log" ///< http://lv2plug.in/ns/ext/log#log - -// clang-format on - -#include "lv2/urid/urid.h" - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** @cond */ -#ifdef __GNUC__ -/** Allow type checking of printf-like functions. */ -# define LV2_LOG_FUNC(fmt, arg1) __attribute__((format(printf, fmt, arg1))) -#else -# define LV2_LOG_FUNC(fmt, arg1) -#endif -/** @endcond */ - -/** - Opaque data to host data for LV2_Log_Log. -*/ -typedef void* LV2_Log_Handle; - -/** - Log feature (LV2_LOG__log) -*/ -typedef struct { - /** - Opaque pointer to host data. - - This MUST be passed to methods in this struct whenever they are called. - Otherwise, it must not be interpreted in any way. - */ - LV2_Log_Handle handle; - - /** - Log a message, passing format parameters directly. - - The API of this function matches that of the standard C printf function, - except for the addition of the first two parameters. This function may - be called from any non-realtime context, or from any context if `type` - is @ref LV2_LOG__Trace. - */ - LV2_LOG_FUNC(3, 4) - int (*printf)(LV2_Log_Handle handle, LV2_URID type, const char* fmt, ...); - - /** - Log a message, passing format parameters in a va_list. - - The API of this function matches that of the standard C vprintf - function, except for the addition of the first two parameters. This - function may be called from any non-realtime context, or from any - context if `type` is @ref LV2_LOG__Trace. - */ - LV2_LOG_FUNC(3, 0) - int (*vprintf)(LV2_Log_Handle handle, - LV2_URID type, - const char* fmt, - va_list ap); -} LV2_Log_Log; - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_LOG_H */ diff --git a/plugins/lv2/vendor/lv2/log/logger.h b/plugins/lv2/vendor/lv2/log/logger.h deleted file mode 100644 index b7d28568d..000000000 --- a/plugins/lv2/vendor/lv2/log/logger.h +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2012-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_ATOM_LOGGER_H -#define LV2_ATOM_LOGGER_H - -/** - @defgroup logger Logger - @ingroup log - - Convenience API for easy logging in plugin code. This API provides simple - wrappers for logging from a plugin, which automatically fall back to - printing to stderr if host support is unavailable. - - @{ -*/ - -#include "lv2/log/log.h" -#include "lv2/urid/urid.h" - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - Logger convenience API state. -*/ -typedef struct { - LV2_Log_Log* log; - - LV2_URID Error; - LV2_URID Note; - LV2_URID Trace; - LV2_URID Warning; -} LV2_Log_Logger; - -/** - Set `map` as the URI map for `logger`. - - This affects the message type URIDs (Error, Warning, etc) which are passed - to the log's print functions. -*/ -static inline void -lv2_log_logger_set_map(LV2_Log_Logger* logger, LV2_URID_Map* map) -{ - if (map) { - logger->Error = map->map(map->handle, LV2_LOG__Error); - logger->Note = map->map(map->handle, LV2_LOG__Note); - logger->Trace = map->map(map->handle, LV2_LOG__Trace); - logger->Warning = map->map(map->handle, LV2_LOG__Warning); - } else { - logger->Error = logger->Note = logger->Trace = logger->Warning = 0; - } -} - -/** - Initialise `logger`. - - URIs will be mapped using `map` and stored, a reference to `map` itself is - not held. Both `map` and `log` may be NULL when unsupported by the host, - in which case the implementation will fall back to printing to stderr. -*/ -static inline void -lv2_log_logger_init(LV2_Log_Logger* logger, LV2_URID_Map* map, LV2_Log_Log* log) -{ - logger->log = log; - lv2_log_logger_set_map(logger, map); -} - -/** - Log a message to the host, or stderr if support is unavailable. -*/ -LV2_LOG_FUNC(3, 0) -static inline int -lv2_log_vprintf(LV2_Log_Logger* logger, - LV2_URID type, - const char* fmt, - va_list args) -{ - return ((logger && logger->log) - ? logger->log->vprintf(logger->log->handle, type, fmt, args) - : vfprintf(stderr, fmt, args)); -} - -/** Log an error via lv2_log_vprintf(). */ -LV2_LOG_FUNC(2, 3) -static inline int -lv2_log_error(LV2_Log_Logger* logger, const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - const int ret = lv2_log_vprintf(logger, logger->Error, fmt, args); - va_end(args); - return ret; -} - -/** Log a note via lv2_log_vprintf(). */ -LV2_LOG_FUNC(2, 3) -static inline int -lv2_log_note(LV2_Log_Logger* logger, const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - const int ret = lv2_log_vprintf(logger, logger->Note, fmt, args); - va_end(args); - return ret; -} - -/** Log a trace via lv2_log_vprintf(). */ -LV2_LOG_FUNC(2, 3) -static inline int -lv2_log_trace(LV2_Log_Logger* logger, const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - const int ret = lv2_log_vprintf(logger, logger->Trace, fmt, args); - va_end(args); - return ret; -} - -/** Log a warning via lv2_log_vprintf(). */ -LV2_LOG_FUNC(2, 3) -static inline int -lv2_log_warning(LV2_Log_Logger* logger, const char* fmt, ...) -{ - va_list args; - va_start(args, fmt); - const int ret = lv2_log_vprintf(logger, logger->Warning, fmt, args); - va_end(args); - return ret; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_LOG_LOGGER_H */ diff --git a/plugins/lv2/vendor/lv2/midi/midi.h b/plugins/lv2/vendor/lv2/midi/midi.h deleted file mode 100644 index cef7bc828..000000000 --- a/plugins/lv2/vendor/lv2/midi/midi.h +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright 2012-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_MIDI_H -#define LV2_MIDI_H - -/** - @defgroup midi MIDI - @ingroup lv2 - - Definitions of standard MIDI messages. - - See for details. - - @{ -*/ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// clang-format off - -#define LV2_MIDI_URI "http://lv2plug.in/ns/ext/midi" ///< http://lv2plug.in/ns/ext/midi -#define LV2_MIDI_PREFIX LV2_MIDI_URI "#" ///< http://lv2plug.in/ns/ext/midi# - -#define LV2_MIDI__ActiveSense LV2_MIDI_PREFIX "ActiveSense" ///< http://lv2plug.in/ns/ext/midi#ActiveSense -#define LV2_MIDI__Aftertouch LV2_MIDI_PREFIX "Aftertouch" ///< http://lv2plug.in/ns/ext/midi#Aftertouch -#define LV2_MIDI__Bender LV2_MIDI_PREFIX "Bender" ///< http://lv2plug.in/ns/ext/midi#Bender -#define LV2_MIDI__ChannelPressure LV2_MIDI_PREFIX "ChannelPressure" ///< http://lv2plug.in/ns/ext/midi#ChannelPressure -#define LV2_MIDI__Chunk LV2_MIDI_PREFIX "Chunk" ///< http://lv2plug.in/ns/ext/midi#Chunk -#define LV2_MIDI__Clock LV2_MIDI_PREFIX "Clock" ///< http://lv2plug.in/ns/ext/midi#Clock -#define LV2_MIDI__Continue LV2_MIDI_PREFIX "Continue" ///< http://lv2plug.in/ns/ext/midi#Continue -#define LV2_MIDI__Controller LV2_MIDI_PREFIX "Controller" ///< http://lv2plug.in/ns/ext/midi#Controller -#define LV2_MIDI__MidiEvent LV2_MIDI_PREFIX "MidiEvent" ///< http://lv2plug.in/ns/ext/midi#MidiEvent -#define LV2_MIDI__NoteOff LV2_MIDI_PREFIX "NoteOff" ///< http://lv2plug.in/ns/ext/midi#NoteOff -#define LV2_MIDI__NoteOn LV2_MIDI_PREFIX "NoteOn" ///< http://lv2plug.in/ns/ext/midi#NoteOn -#define LV2_MIDI__ProgramChange LV2_MIDI_PREFIX "ProgramChange" ///< http://lv2plug.in/ns/ext/midi#ProgramChange -#define LV2_MIDI__QuarterFrame LV2_MIDI_PREFIX "QuarterFrame" ///< http://lv2plug.in/ns/ext/midi#QuarterFrame -#define LV2_MIDI__Reset LV2_MIDI_PREFIX "Reset" ///< http://lv2plug.in/ns/ext/midi#Reset -#define LV2_MIDI__SongPosition LV2_MIDI_PREFIX "SongPosition" ///< http://lv2plug.in/ns/ext/midi#SongPosition -#define LV2_MIDI__SongSelect LV2_MIDI_PREFIX "SongSelect" ///< http://lv2plug.in/ns/ext/midi#SongSelect -#define LV2_MIDI__Start LV2_MIDI_PREFIX "Start" ///< http://lv2plug.in/ns/ext/midi#Start -#define LV2_MIDI__Stop LV2_MIDI_PREFIX "Stop" ///< http://lv2plug.in/ns/ext/midi#Stop -#define LV2_MIDI__SystemCommon LV2_MIDI_PREFIX "SystemCommon" ///< http://lv2plug.in/ns/ext/midi#SystemCommon -#define LV2_MIDI__SystemExclusive LV2_MIDI_PREFIX "SystemExclusive" ///< http://lv2plug.in/ns/ext/midi#SystemExclusive -#define LV2_MIDI__SystemMessage LV2_MIDI_PREFIX "SystemMessage" ///< http://lv2plug.in/ns/ext/midi#SystemMessage -#define LV2_MIDI__SystemRealtime LV2_MIDI_PREFIX "SystemRealtime" ///< http://lv2plug.in/ns/ext/midi#SystemRealtime -#define LV2_MIDI__Tick LV2_MIDI_PREFIX "Tick" ///< http://lv2plug.in/ns/ext/midi#Tick -#define LV2_MIDI__TuneRequest LV2_MIDI_PREFIX "TuneRequest" ///< http://lv2plug.in/ns/ext/midi#TuneRequest -#define LV2_MIDI__VoiceMessage LV2_MIDI_PREFIX "VoiceMessage" ///< http://lv2plug.in/ns/ext/midi#VoiceMessage -#define LV2_MIDI__benderValue LV2_MIDI_PREFIX "benderValue" ///< http://lv2plug.in/ns/ext/midi#benderValue -#define LV2_MIDI__binding LV2_MIDI_PREFIX "binding" ///< http://lv2plug.in/ns/ext/midi#binding -#define LV2_MIDI__byteNumber LV2_MIDI_PREFIX "byteNumber" ///< http://lv2plug.in/ns/ext/midi#byteNumber -#define LV2_MIDI__channel LV2_MIDI_PREFIX "channel" ///< http://lv2plug.in/ns/ext/midi#channel -#define LV2_MIDI__chunk LV2_MIDI_PREFIX "chunk" ///< http://lv2plug.in/ns/ext/midi#chunk -#define LV2_MIDI__controllerNumber LV2_MIDI_PREFIX "controllerNumber" ///< http://lv2plug.in/ns/ext/midi#controllerNumber -#define LV2_MIDI__controllerValue LV2_MIDI_PREFIX "controllerValue" ///< http://lv2plug.in/ns/ext/midi#controllerValue -#define LV2_MIDI__noteNumber LV2_MIDI_PREFIX "noteNumber" ///< http://lv2plug.in/ns/ext/midi#noteNumber -#define LV2_MIDI__pressure LV2_MIDI_PREFIX "pressure" ///< http://lv2plug.in/ns/ext/midi#pressure -#define LV2_MIDI__programNumber LV2_MIDI_PREFIX "programNumber" ///< http://lv2plug.in/ns/ext/midi#programNumber -#define LV2_MIDI__property LV2_MIDI_PREFIX "property" ///< http://lv2plug.in/ns/ext/midi#property -#define LV2_MIDI__songNumber LV2_MIDI_PREFIX "songNumber" ///< http://lv2plug.in/ns/ext/midi#songNumber -#define LV2_MIDI__songPosition LV2_MIDI_PREFIX "songPosition" ///< http://lv2plug.in/ns/ext/midi#songPosition -#define LV2_MIDI__status LV2_MIDI_PREFIX "status" ///< http://lv2plug.in/ns/ext/midi#status -#define LV2_MIDI__statusMask LV2_MIDI_PREFIX "statusMask" ///< http://lv2plug.in/ns/ext/midi#statusMask -#define LV2_MIDI__velocity LV2_MIDI_PREFIX "velocity" ///< http://lv2plug.in/ns/ext/midi#velocity - -// clang-format on - -/** - MIDI Message Type. - - This includes both voice messages (which have a channel) and system messages - (which do not), as well as a sentinel value for invalid messages. To get - the type of a message suitable for use in a switch statement, use - lv2_midi_get_type() on the status byte. -*/ -typedef enum { - LV2_MIDI_MSG_INVALID = 0, /**< Invalid Message */ - LV2_MIDI_MSG_NOTE_OFF = 0x80, /**< Note Off */ - LV2_MIDI_MSG_NOTE_ON = 0x90, /**< Note On */ - LV2_MIDI_MSG_NOTE_PRESSURE = 0xA0, /**< Note Pressure */ - LV2_MIDI_MSG_CONTROLLER = 0xB0, /**< Controller */ - LV2_MIDI_MSG_PGM_CHANGE = 0xC0, /**< Program Change */ - LV2_MIDI_MSG_CHANNEL_PRESSURE = 0xD0, /**< Channel Pressure */ - LV2_MIDI_MSG_BENDER = 0xE0, /**< Pitch Bender */ - LV2_MIDI_MSG_SYSTEM_EXCLUSIVE = 0xF0, /**< System Exclusive Begin */ - LV2_MIDI_MSG_MTC_QUARTER = 0xF1, /**< MTC Quarter Frame */ - LV2_MIDI_MSG_SONG_POS = 0xF2, /**< Song Position */ - LV2_MIDI_MSG_SONG_SELECT = 0xF3, /**< Song Select */ - LV2_MIDI_MSG_TUNE_REQUEST = 0xF6, /**< Tune Request */ - LV2_MIDI_MSG_CLOCK = 0xF8, /**< Clock */ - LV2_MIDI_MSG_START = 0xFA, /**< Start */ - LV2_MIDI_MSG_CONTINUE = 0xFB, /**< Continue */ - LV2_MIDI_MSG_STOP = 0xFC, /**< Stop */ - LV2_MIDI_MSG_ACTIVE_SENSE = 0xFE, /**< Active Sensing */ - LV2_MIDI_MSG_RESET = 0xFF /**< Reset */ -} LV2_Midi_Message_Type; - -/** - Standard MIDI Controller Numbers. -*/ -typedef enum { - LV2_MIDI_CTL_MSB_BANK = 0x00, /**< Bank Selection */ - LV2_MIDI_CTL_MSB_MODWHEEL = 0x01, /**< Modulation */ - LV2_MIDI_CTL_MSB_BREATH = 0x02, /**< Breath */ - LV2_MIDI_CTL_MSB_FOOT = 0x04, /**< Foot */ - LV2_MIDI_CTL_MSB_PORTAMENTO_TIME = 0x05, /**< Portamento Time */ - LV2_MIDI_CTL_MSB_DATA_ENTRY = 0x06, /**< Data Entry */ - LV2_MIDI_CTL_MSB_MAIN_VOLUME = 0x07, /**< Main Volume */ - LV2_MIDI_CTL_MSB_BALANCE = 0x08, /**< Balance */ - LV2_MIDI_CTL_MSB_PAN = 0x0A, /**< Panpot */ - LV2_MIDI_CTL_MSB_EXPRESSION = 0x0B, /**< Expression */ - LV2_MIDI_CTL_MSB_EFFECT1 = 0x0C, /**< Effect1 */ - LV2_MIDI_CTL_MSB_EFFECT2 = 0x0D, /**< Effect2 */ - LV2_MIDI_CTL_MSB_GENERAL_PURPOSE1 = 0x10, /**< General Purpose 1 */ - LV2_MIDI_CTL_MSB_GENERAL_PURPOSE2 = 0x11, /**< General Purpose 2 */ - LV2_MIDI_CTL_MSB_GENERAL_PURPOSE3 = 0x12, /**< General Purpose 3 */ - LV2_MIDI_CTL_MSB_GENERAL_PURPOSE4 = 0x13, /**< General Purpose 4 */ - LV2_MIDI_CTL_LSB_BANK = 0x20, /**< Bank Selection */ - LV2_MIDI_CTL_LSB_MODWHEEL = 0x21, /**< Modulation */ - LV2_MIDI_CTL_LSB_BREATH = 0x22, /**< Breath */ - LV2_MIDI_CTL_LSB_FOOT = 0x24, /**< Foot */ - LV2_MIDI_CTL_LSB_PORTAMENTO_TIME = 0x25, /**< Portamento Time */ - LV2_MIDI_CTL_LSB_DATA_ENTRY = 0x26, /**< Data Entry */ - LV2_MIDI_CTL_LSB_MAIN_VOLUME = 0x27, /**< Main Volume */ - LV2_MIDI_CTL_LSB_BALANCE = 0x28, /**< Balance */ - LV2_MIDI_CTL_LSB_PAN = 0x2A, /**< Panpot */ - LV2_MIDI_CTL_LSB_EXPRESSION = 0x2B, /**< Expression */ - LV2_MIDI_CTL_LSB_EFFECT1 = 0x2C, /**< Effect1 */ - LV2_MIDI_CTL_LSB_EFFECT2 = 0x2D, /**< Effect2 */ - LV2_MIDI_CTL_LSB_GENERAL_PURPOSE1 = 0x30, /**< General Purpose 1 */ - LV2_MIDI_CTL_LSB_GENERAL_PURPOSE2 = 0x31, /**< General Purpose 2 */ - LV2_MIDI_CTL_LSB_GENERAL_PURPOSE3 = 0x32, /**< General Purpose 3 */ - LV2_MIDI_CTL_LSB_GENERAL_PURPOSE4 = 0x33, /**< General Purpose 4 */ - LV2_MIDI_CTL_SUSTAIN = 0x40, /**< Sustain Pedal */ - LV2_MIDI_CTL_PORTAMENTO = 0x41, /**< Portamento */ - LV2_MIDI_CTL_SOSTENUTO = 0x42, /**< Sostenuto */ - LV2_MIDI_CTL_SOFT_PEDAL = 0x43, /**< Soft Pedal */ - LV2_MIDI_CTL_LEGATO_FOOTSWITCH = 0x44, /**< Legato Foot Switch */ - LV2_MIDI_CTL_HOLD2 = 0x45, /**< Hold2 */ - LV2_MIDI_CTL_SC1_SOUND_VARIATION = 0x46, /**< SC1 Sound Variation */ - LV2_MIDI_CTL_SC2_TIMBRE = 0x47, /**< SC2 Timbre */ - LV2_MIDI_CTL_SC3_RELEASE_TIME = 0x48, /**< SC3 Release Time */ - LV2_MIDI_CTL_SC4_ATTACK_TIME = 0x49, /**< SC4 Attack Time */ - LV2_MIDI_CTL_SC5_BRIGHTNESS = 0x4A, /**< SC5 Brightness */ - LV2_MIDI_CTL_SC6 = 0x4B, /**< SC6 */ - LV2_MIDI_CTL_SC7 = 0x4C, /**< SC7 */ - LV2_MIDI_CTL_SC8 = 0x4D, /**< SC8 */ - LV2_MIDI_CTL_SC9 = 0x4E, /**< SC9 */ - LV2_MIDI_CTL_SC10 = 0x4F, /**< SC10 */ - LV2_MIDI_CTL_GENERAL_PURPOSE5 = 0x50, /**< General Purpose 5 */ - LV2_MIDI_CTL_GENERAL_PURPOSE6 = 0x51, /**< General Purpose 6 */ - LV2_MIDI_CTL_GENERAL_PURPOSE7 = 0x52, /**< General Purpose 7 */ - LV2_MIDI_CTL_GENERAL_PURPOSE8 = 0x53, /**< General Purpose 8 */ - LV2_MIDI_CTL_PORTAMENTO_CONTROL = 0x54, /**< Portamento Control */ - LV2_MIDI_CTL_E1_REVERB_DEPTH = 0x5B, /**< E1 Reverb Depth */ - LV2_MIDI_CTL_E2_TREMOLO_DEPTH = 0x5C, /**< E2 Tremolo Depth */ - LV2_MIDI_CTL_E3_CHORUS_DEPTH = 0x5D, /**< E3 Chorus Depth */ - LV2_MIDI_CTL_E4_DETUNE_DEPTH = 0x5E, /**< E4 Detune Depth */ - LV2_MIDI_CTL_E5_PHASER_DEPTH = 0x5F, /**< E5 Phaser Depth */ - LV2_MIDI_CTL_DATA_INCREMENT = 0x60, /**< Data Increment */ - LV2_MIDI_CTL_DATA_DECREMENT = 0x61, /**< Data Decrement */ - LV2_MIDI_CTL_NRPN_LSB = 0x62, /**< Non-registered Parameter Number */ - LV2_MIDI_CTL_NRPN_MSB = 0x63, /**< Non-registered Parameter Number */ - LV2_MIDI_CTL_RPN_LSB = 0x64, /**< Registered Parameter Number */ - LV2_MIDI_CTL_RPN_MSB = 0x65, /**< Registered Parameter Number */ - LV2_MIDI_CTL_ALL_SOUNDS_OFF = 0x78, /**< All Sounds Off */ - LV2_MIDI_CTL_RESET_CONTROLLERS = 0x79, /**< Reset Controllers */ - LV2_MIDI_CTL_LOCAL_CONTROL_SWITCH = 0x7A, /**< Local Control Switch */ - LV2_MIDI_CTL_ALL_NOTES_OFF = 0x7B, /**< All Notes Off */ - LV2_MIDI_CTL_OMNI_OFF = 0x7C, /**< Omni Off */ - LV2_MIDI_CTL_OMNI_ON = 0x7D, /**< Omni On */ - LV2_MIDI_CTL_MONO1 = 0x7E, /**< Mono1 */ - LV2_MIDI_CTL_MONO2 = 0x7F /**< Mono2 */ -} LV2_Midi_Controller; - -/** - Return true iff `msg` is a MIDI voice message (which has a channel). -*/ -static inline bool -lv2_midi_is_voice_message(const uint8_t* msg) -{ - return msg[0] >= 0x80 && msg[0] < 0xF0; -} - -/** - Return true iff `msg` is a MIDI system message (which has no channel). -*/ -static inline bool -lv2_midi_is_system_message(const uint8_t* msg) -{ - switch (msg[0]) { - case 0xF4: - case 0xF5: - case 0xF7: - case 0xF9: - case 0xFD: - return false; - default: - return (msg[0] & 0xF0U) == 0xF0U; - } -} - -/** - Return the type of a MIDI message. - @param msg Pointer to the start (status byte) of a MIDI message. -*/ -static inline LV2_Midi_Message_Type -lv2_midi_message_type(const uint8_t* msg) -{ - if (lv2_midi_is_voice_message(msg)) { - return (LV2_Midi_Message_Type)(msg[0] & 0xF0U); - } - - if (lv2_midi_is_system_message(msg)) { - return (LV2_Midi_Message_Type)msg[0]; - } - - return LV2_MIDI_MSG_INVALID; -} - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_MIDI_H */ diff --git a/plugins/lv2/vendor/lv2/morph/morph.h b/plugins/lv2/vendor/lv2/morph/morph.h deleted file mode 100644 index e60a7d5d3..000000000 --- a/plugins/lv2/vendor/lv2/morph/morph.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_MORPH_H -#define LV2_MORPH_H - -/** - @defgroup morph Morph - @ingroup lv2 - - Ports that can dynamically change type. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_MORPH_URI "http://lv2plug.in/ns/ext/morph" ///< http://lv2plug.in/ns/ext/morph -#define LV2_MORPH_PREFIX LV2_MORPH_URI "#" ///< http://lv2plug.in/ns/ext/morph# - -#define LV2_MORPH__AutoMorphPort LV2_MORPH_PREFIX "AutoMorphPort" ///< http://lv2plug.in/ns/ext/morph#AutoMorphPort -#define LV2_MORPH__MorphPort LV2_MORPH_PREFIX "MorphPort" ///< http://lv2plug.in/ns/ext/morph#MorphPort -#define LV2_MORPH__interface LV2_MORPH_PREFIX "interface" ///< http://lv2plug.in/ns/ext/morph#interface -#define LV2_MORPH__supportsType LV2_MORPH_PREFIX "supportsType" ///< http://lv2plug.in/ns/ext/morph#supportsType -#define LV2_MORPH__currentType LV2_MORPH_PREFIX "currentType" ///< http://lv2plug.in/ns/ext/morph#currentType - -// clang-format on - -/** - @} -*/ - -#endif /* LV2_MORPH_H */ diff --git a/plugins/lv2/vendor/lv2/options/options.h b/plugins/lv2/vendor/lv2/options/options.h deleted file mode 100644 index 48f7bfbeb..000000000 --- a/plugins/lv2/vendor/lv2/options/options.h +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2012-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_OPTIONS_H -#define LV2_OPTIONS_H - -/** - @defgroup options Options - @ingroup lv2 - - Instantiation time options. - - See for details. - - @{ -*/ - -#include "lv2/core/lv2.h" -#include "lv2/urid/urid.h" - -#include - -// clang-format off - -#define LV2_OPTIONS_URI "http://lv2plug.in/ns/ext/options" ///< http://lv2plug.in/ns/ext/options -#define LV2_OPTIONS_PREFIX LV2_OPTIONS_URI "#" ///< http://lv2plug.in/ns/ext/options# - -#define LV2_OPTIONS__Option LV2_OPTIONS_PREFIX "Option" ///< http://lv2plug.in/ns/ext/options#Option -#define LV2_OPTIONS__interface LV2_OPTIONS_PREFIX "interface" ///< http://lv2plug.in/ns/ext/options#interface -#define LV2_OPTIONS__options LV2_OPTIONS_PREFIX "options" ///< http://lv2plug.in/ns/ext/options#options -#define LV2_OPTIONS__requiredOption LV2_OPTIONS_PREFIX "requiredOption" ///< http://lv2plug.in/ns/ext/options#requiredOption -#define LV2_OPTIONS__supportedOption LV2_OPTIONS_PREFIX "supportedOption" ///< http://lv2plug.in/ns/ext/options#supportedOption - -// clang-format on - -#ifdef __cplusplus -extern "C" { -#endif - -/** - The context of an Option, which defines the subject it applies to. -*/ -typedef enum { - /** - This option applies to the instance itself. The subject must be - ignored. - */ - LV2_OPTIONS_INSTANCE, - - /** - This option applies to some named resource. The subject is a URI mapped - to an integer (a LV2_URID, like the key) - */ - LV2_OPTIONS_RESOURCE, - - /** - This option applies to some blank node. The subject is a blank node - identifier, which is valid only within the current local scope. - */ - LV2_OPTIONS_BLANK, - - /** - This option applies to a port on the instance. The subject is the - port's index. - */ - LV2_OPTIONS_PORT -} LV2_Options_Context; - -/** - An option. - - This is a property with a subject, also known as a triple or statement. - - This struct is useful anywhere a statement needs to be passed where no - memory ownership issues are present (since the value is a const pointer). - - Options can be passed to an instance via the feature LV2_OPTIONS__options - with data pointed to an array of options terminated by a zeroed option, or - accessed/manipulated using LV2_Options_Interface. -*/ -typedef struct { - LV2_Options_Context context; /**< Context (type of subject). */ - uint32_t subject; /**< Subject. */ - LV2_URID key; /**< Key (property). */ - uint32_t size; /**< Size of value in bytes. */ - LV2_URID type; /**< Type of value (datatype). */ - const void* value; /**< Pointer to value (object). */ -} LV2_Options_Option; - -/** A status code for option functions. */ -typedef enum { - LV2_OPTIONS_SUCCESS = 0U, /**< Completed successfully. */ - LV2_OPTIONS_ERR_UNKNOWN = 1U, /**< Unknown error. */ - LV2_OPTIONS_ERR_BAD_SUBJECT = 1U << 1U, /**< Invalid/unsupported subject. */ - LV2_OPTIONS_ERR_BAD_KEY = 1U << 2U, /**< Invalid/unsupported key. */ - LV2_OPTIONS_ERR_BAD_VALUE = 1U << 3U /**< Invalid/unsupported value. */ -} LV2_Options_Status; - -/** - Interface for dynamically setting options (LV2_OPTIONS__interface). -*/ -typedef struct { - /** - Get the given options. - - Each element of the passed options array MUST have type, subject, and - key set. All other fields (size, type, value) MUST be initialised to - zero, and are set to the option value if such an option is found. - - This function is in the "instantiation" LV2 threading class, so no other - instance functions may be called concurrently. - - @return Bitwise OR of LV2_Options_Status values. - */ - uint32_t (*get)(LV2_Handle instance, LV2_Options_Option* options); - - /** - Set the given options. - - This function is in the "instantiation" LV2 threading class, so no other - instance functions may be called concurrently. - - @return Bitwise OR of LV2_Options_Status values. - */ - uint32_t (*set)(LV2_Handle instance, const LV2_Options_Option* options); -} LV2_Options_Interface; - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_OPTIONS_H */ diff --git a/plugins/lv2/vendor/lv2/parameters/parameters.h b/plugins/lv2/vendor/lv2/parameters/parameters.h deleted file mode 100644 index 6c17a1cc0..000000000 --- a/plugins/lv2/vendor/lv2/parameters/parameters.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2012-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_PARAMETERS_H -#define LV2_PARAMETERS_H - -/** - @defgroup parameters Parameters - @ingroup lv2 - - Common parameters for audio processing. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_PARAMETERS_URI "http://lv2plug.in/ns/ext/parameters" ///< http://lv2plug.in/ns/ext/parameters -#define LV2_PARAMETERS_PREFIX LV2_PARAMETERS_URI "#" ///< http://lv2plug.in/ns/ext/parameters# - -#define LV2_PARAMETERS__CompressorControls LV2_PARAMETERS_PREFIX "CompressorControls" ///< http://lv2plug.in/ns/ext/parameters#CompressorControls -#define LV2_PARAMETERS__ControlGroup LV2_PARAMETERS_PREFIX "ControlGroup" ///< http://lv2plug.in/ns/ext/parameters#ControlGroup -#define LV2_PARAMETERS__EnvelopeControls LV2_PARAMETERS_PREFIX "EnvelopeControls" ///< http://lv2plug.in/ns/ext/parameters#EnvelopeControls -#define LV2_PARAMETERS__FilterControls LV2_PARAMETERS_PREFIX "FilterControls" ///< http://lv2plug.in/ns/ext/parameters#FilterControls -#define LV2_PARAMETERS__OscillatorControls LV2_PARAMETERS_PREFIX "OscillatorControls" ///< http://lv2plug.in/ns/ext/parameters#OscillatorControls -#define LV2_PARAMETERS__amplitude LV2_PARAMETERS_PREFIX "amplitude" ///< http://lv2plug.in/ns/ext/parameters#amplitude -#define LV2_PARAMETERS__attack LV2_PARAMETERS_PREFIX "attack" ///< http://lv2plug.in/ns/ext/parameters#attack -#define LV2_PARAMETERS__bypass LV2_PARAMETERS_PREFIX "bypass" ///< http://lv2plug.in/ns/ext/parameters#bypass -#define LV2_PARAMETERS__cutoffFrequency LV2_PARAMETERS_PREFIX "cutoffFrequency" ///< http://lv2plug.in/ns/ext/parameters#cutoffFrequency -#define LV2_PARAMETERS__decay LV2_PARAMETERS_PREFIX "decay" ///< http://lv2plug.in/ns/ext/parameters#decay -#define LV2_PARAMETERS__delay LV2_PARAMETERS_PREFIX "delay" ///< http://lv2plug.in/ns/ext/parameters#delay -#define LV2_PARAMETERS__dryLevel LV2_PARAMETERS_PREFIX "dryLevel" ///< http://lv2plug.in/ns/ext/parameters#dryLevel -#define LV2_PARAMETERS__frequency LV2_PARAMETERS_PREFIX "frequency" ///< http://lv2plug.in/ns/ext/parameters#frequency -#define LV2_PARAMETERS__gain LV2_PARAMETERS_PREFIX "gain" ///< http://lv2plug.in/ns/ext/parameters#gain -#define LV2_PARAMETERS__hold LV2_PARAMETERS_PREFIX "hold" ///< http://lv2plug.in/ns/ext/parameters#hold -#define LV2_PARAMETERS__pulseWidth LV2_PARAMETERS_PREFIX "pulseWidth" ///< http://lv2plug.in/ns/ext/parameters#pulseWidth -#define LV2_PARAMETERS__ratio LV2_PARAMETERS_PREFIX "ratio" ///< http://lv2plug.in/ns/ext/parameters#ratio -#define LV2_PARAMETERS__release LV2_PARAMETERS_PREFIX "release" ///< http://lv2plug.in/ns/ext/parameters#release -#define LV2_PARAMETERS__resonance LV2_PARAMETERS_PREFIX "resonance" ///< http://lv2plug.in/ns/ext/parameters#resonance -#define LV2_PARAMETERS__sampleRate LV2_PARAMETERS_PREFIX "sampleRate" ///< http://lv2plug.in/ns/ext/parameters#sampleRate -#define LV2_PARAMETERS__sustain LV2_PARAMETERS_PREFIX "sustain" ///< http://lv2plug.in/ns/ext/parameters#sustain -#define LV2_PARAMETERS__threshold LV2_PARAMETERS_PREFIX "threshold" ///< http://lv2plug.in/ns/ext/parameters#threshold -#define LV2_PARAMETERS__waveform LV2_PARAMETERS_PREFIX "waveform" ///< http://lv2plug.in/ns/ext/parameters#waveform -#define LV2_PARAMETERS__wetDryRatio LV2_PARAMETERS_PREFIX "wetDryRatio" ///< http://lv2plug.in/ns/ext/parameters#wetDryRatio -#define LV2_PARAMETERS__wetLevel LV2_PARAMETERS_PREFIX "wetLevel" ///< http://lv2plug.in/ns/ext/parameters#wetLevel - -// clang-format on - -/** - @} -*/ - -#endif /* LV2_PARAMETERS_H */ diff --git a/plugins/lv2/vendor/lv2/patch/patch.h b/plugins/lv2/vendor/lv2/patch/patch.h deleted file mode 100644 index 16b7889ab..000000000 --- a/plugins/lv2/vendor/lv2/patch/patch.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2012-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_PATCH_H -#define LV2_PATCH_H - -/** - @defgroup patch Patch - @ingroup lv2 - - Messages for accessing and manipulating properties. - - Note the patch extension is purely data, this header merely defines URIs for - convenience. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_PATCH_URI "http://lv2plug.in/ns/ext/patch" ///< http://lv2plug.in/ns/ext/patch -#define LV2_PATCH_PREFIX LV2_PATCH_URI "#" ///< http://lv2plug.in/ns/ext/patch# - -#define LV2_PATCH__Ack LV2_PATCH_PREFIX "Ack" ///< http://lv2plug.in/ns/ext/patch#Ack -#define LV2_PATCH__Delete LV2_PATCH_PREFIX "Delete" ///< http://lv2plug.in/ns/ext/patch#Delete -#define LV2_PATCH__Copy LV2_PATCH_PREFIX "Copy" ///< http://lv2plug.in/ns/ext/patch#Copy -#define LV2_PATCH__Error LV2_PATCH_PREFIX "Error" ///< http://lv2plug.in/ns/ext/patch#Error -#define LV2_PATCH__Get LV2_PATCH_PREFIX "Get" ///< http://lv2plug.in/ns/ext/patch#Get -#define LV2_PATCH__Message LV2_PATCH_PREFIX "Message" ///< http://lv2plug.in/ns/ext/patch#Message -#define LV2_PATCH__Move LV2_PATCH_PREFIX "Move" ///< http://lv2plug.in/ns/ext/patch#Move -#define LV2_PATCH__Patch LV2_PATCH_PREFIX "Patch" ///< http://lv2plug.in/ns/ext/patch#Patch -#define LV2_PATCH__Post LV2_PATCH_PREFIX "Post" ///< http://lv2plug.in/ns/ext/patch#Post -#define LV2_PATCH__Put LV2_PATCH_PREFIX "Put" ///< http://lv2plug.in/ns/ext/patch#Put -#define LV2_PATCH__Request LV2_PATCH_PREFIX "Request" ///< http://lv2plug.in/ns/ext/patch#Request -#define LV2_PATCH__Response LV2_PATCH_PREFIX "Response" ///< http://lv2plug.in/ns/ext/patch#Response -#define LV2_PATCH__Set LV2_PATCH_PREFIX "Set" ///< http://lv2plug.in/ns/ext/patch#Set -#define LV2_PATCH__accept LV2_PATCH_PREFIX "accept" ///< http://lv2plug.in/ns/ext/patch#accept -#define LV2_PATCH__add LV2_PATCH_PREFIX "add" ///< http://lv2plug.in/ns/ext/patch#add -#define LV2_PATCH__body LV2_PATCH_PREFIX "body" ///< http://lv2plug.in/ns/ext/patch#body -#define LV2_PATCH__context LV2_PATCH_PREFIX "context" ///< http://lv2plug.in/ns/ext/patch#context -#define LV2_PATCH__destination LV2_PATCH_PREFIX "destination" ///< http://lv2plug.in/ns/ext/patch#destination -#define LV2_PATCH__property LV2_PATCH_PREFIX "property" ///< http://lv2plug.in/ns/ext/patch#property -#define LV2_PATCH__readable LV2_PATCH_PREFIX "readable" ///< http://lv2plug.in/ns/ext/patch#readable -#define LV2_PATCH__remove LV2_PATCH_PREFIX "remove" ///< http://lv2plug.in/ns/ext/patch#remove -#define LV2_PATCH__request LV2_PATCH_PREFIX "request" ///< http://lv2plug.in/ns/ext/patch#request -#define LV2_PATCH__subject LV2_PATCH_PREFIX "subject" ///< http://lv2plug.in/ns/ext/patch#subject -#define LV2_PATCH__sequenceNumber LV2_PATCH_PREFIX "sequenceNumber" ///< http://lv2plug.in/ns/ext/patch#sequenceNumber -#define LV2_PATCH__value LV2_PATCH_PREFIX "value" ///< http://lv2plug.in/ns/ext/patch#value -#define LV2_PATCH__wildcard LV2_PATCH_PREFIX "wildcard" ///< http://lv2plug.in/ns/ext/patch#wildcard -#define LV2_PATCH__writable LV2_PATCH_PREFIX "writable" ///< http://lv2plug.in/ns/ext/patch#writable - -// clang-format on - -/** - @} -*/ - -#endif /* LV2_PATCH_H */ diff --git a/plugins/lv2/vendor/lv2/port-groups/port-groups.h b/plugins/lv2/vendor/lv2/port-groups/port-groups.h deleted file mode 100644 index 303890a47..000000000 --- a/plugins/lv2/vendor/lv2/port-groups/port-groups.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2012-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_PORT_GROUPS_H -#define LV2_PORT_GROUPS_H - -/** - @defgroup port-groups Port Groups - @ingroup lv2 - - Multi-channel groups of LV2 ports. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_PORT_GROUPS_URI "http://lv2plug.in/ns/ext/port-groups" ///< http://lv2plug.in/ns/ext/port-groups -#define LV2_PORT_GROUPS_PREFIX LV2_PORT_GROUPS_URI "#" ///< http://lv2plug.in/ns/ext/port-groups# - -#define LV2_PORT_GROUPS__DiscreteGroup LV2_PORT_GROUPS_PREFIX "DiscreteGroup" ///< http://lv2plug.in/ns/ext/port-groups#DiscreteGroup -#define LV2_PORT_GROUPS__Element LV2_PORT_GROUPS_PREFIX "Element" ///< http://lv2plug.in/ns/ext/port-groups#Element -#define LV2_PORT_GROUPS__FivePointOneGroup LV2_PORT_GROUPS_PREFIX "FivePointOneGroup" ///< http://lv2plug.in/ns/ext/port-groups#FivePointOneGroup -#define LV2_PORT_GROUPS__FivePointZeroGroup LV2_PORT_GROUPS_PREFIX "FivePointZeroGroup" ///< http://lv2plug.in/ns/ext/port-groups#FivePointZeroGroup -#define LV2_PORT_GROUPS__FourPointZeroGroup LV2_PORT_GROUPS_PREFIX "FourPointZeroGroup" ///< http://lv2plug.in/ns/ext/port-groups#FourPointZeroGroup -#define LV2_PORT_GROUPS__Group LV2_PORT_GROUPS_PREFIX "Group" ///< http://lv2plug.in/ns/ext/port-groups#Group -#define LV2_PORT_GROUPS__InputGroup LV2_PORT_GROUPS_PREFIX "InputGroup" ///< http://lv2plug.in/ns/ext/port-groups#InputGroup -#define LV2_PORT_GROUPS__MidSideGroup LV2_PORT_GROUPS_PREFIX "MidSideGroup" ///< http://lv2plug.in/ns/ext/port-groups#MidSideGroup -#define LV2_PORT_GROUPS__MonoGroup LV2_PORT_GROUPS_PREFIX "MonoGroup" ///< http://lv2plug.in/ns/ext/port-groups#MonoGroup -#define LV2_PORT_GROUPS__OutputGroup LV2_PORT_GROUPS_PREFIX "OutputGroup" ///< http://lv2plug.in/ns/ext/port-groups#OutputGroup -#define LV2_PORT_GROUPS__SevenPointOneGroup LV2_PORT_GROUPS_PREFIX "SevenPointOneGroup" ///< http://lv2plug.in/ns/ext/port-groups#SevenPointOneGroup -#define LV2_PORT_GROUPS__SevenPointOneWideGroup LV2_PORT_GROUPS_PREFIX "SevenPointOneWideGroup" ///< http://lv2plug.in/ns/ext/port-groups#SevenPointOneWideGroup -#define LV2_PORT_GROUPS__SixPointOneGroup LV2_PORT_GROUPS_PREFIX "SixPointOneGroup" ///< http://lv2plug.in/ns/ext/port-groups#SixPointOneGroup -#define LV2_PORT_GROUPS__StereoGroup LV2_PORT_GROUPS_PREFIX "StereoGroup" ///< http://lv2plug.in/ns/ext/port-groups#StereoGroup -#define LV2_PORT_GROUPS__ThreePointZeroGroup LV2_PORT_GROUPS_PREFIX "ThreePointZeroGroup" ///< http://lv2plug.in/ns/ext/port-groups#ThreePointZeroGroup -#define LV2_PORT_GROUPS__center LV2_PORT_GROUPS_PREFIX "center" ///< http://lv2plug.in/ns/ext/port-groups#center -#define LV2_PORT_GROUPS__centerLeft LV2_PORT_GROUPS_PREFIX "centerLeft" ///< http://lv2plug.in/ns/ext/port-groups#centerLeft -#define LV2_PORT_GROUPS__centerRight LV2_PORT_GROUPS_PREFIX "centerRight" ///< http://lv2plug.in/ns/ext/port-groups#centerRight -#define LV2_PORT_GROUPS__element LV2_PORT_GROUPS_PREFIX "element" ///< http://lv2plug.in/ns/ext/port-groups#element -#define LV2_PORT_GROUPS__group LV2_PORT_GROUPS_PREFIX "group" ///< http://lv2plug.in/ns/ext/port-groups#group -#define LV2_PORT_GROUPS__left LV2_PORT_GROUPS_PREFIX "left" ///< http://lv2plug.in/ns/ext/port-groups#left -#define LV2_PORT_GROUPS__lowFrequencyEffects LV2_PORT_GROUPS_PREFIX "lowFrequencyEffects" ///< http://lv2plug.in/ns/ext/port-groups#lowFrequencyEffects -#define LV2_PORT_GROUPS__mainInput LV2_PORT_GROUPS_PREFIX "mainInput" ///< http://lv2plug.in/ns/ext/port-groups#mainInput -#define LV2_PORT_GROUPS__mainOutput LV2_PORT_GROUPS_PREFIX "mainOutput" ///< http://lv2plug.in/ns/ext/port-groups#mainOutput -#define LV2_PORT_GROUPS__rearCenter LV2_PORT_GROUPS_PREFIX "rearCenter" ///< http://lv2plug.in/ns/ext/port-groups#rearCenter -#define LV2_PORT_GROUPS__rearLeft LV2_PORT_GROUPS_PREFIX "rearLeft" ///< http://lv2plug.in/ns/ext/port-groups#rearLeft -#define LV2_PORT_GROUPS__rearRight LV2_PORT_GROUPS_PREFIX "rearRight" ///< http://lv2plug.in/ns/ext/port-groups#rearRight -#define LV2_PORT_GROUPS__right LV2_PORT_GROUPS_PREFIX "right" ///< http://lv2plug.in/ns/ext/port-groups#right -#define LV2_PORT_GROUPS__side LV2_PORT_GROUPS_PREFIX "side" ///< http://lv2plug.in/ns/ext/port-groups#side -#define LV2_PORT_GROUPS__sideChainOf LV2_PORT_GROUPS_PREFIX "sideChainOf" ///< http://lv2plug.in/ns/ext/port-groups#sideChainOf -#define LV2_PORT_GROUPS__sideLeft LV2_PORT_GROUPS_PREFIX "sideLeft" ///< http://lv2plug.in/ns/ext/port-groups#sideLeft -#define LV2_PORT_GROUPS__sideRight LV2_PORT_GROUPS_PREFIX "sideRight" ///< http://lv2plug.in/ns/ext/port-groups#sideRight -#define LV2_PORT_GROUPS__source LV2_PORT_GROUPS_PREFIX "source" ///< http://lv2plug.in/ns/ext/port-groups#source -#define LV2_PORT_GROUPS__subGroupOf LV2_PORT_GROUPS_PREFIX "subGroupOf" ///< http://lv2plug.in/ns/ext/port-groups#subGroupOf - -// clang-format on - -/** - @} -*/ - -#endif /* LV2_PORT_GROUPS_H */ diff --git a/plugins/lv2/vendor/lv2/port-props/port-props.h b/plugins/lv2/vendor/lv2/port-props/port-props.h deleted file mode 100644 index ff45140b7..000000000 --- a/plugins/lv2/vendor/lv2/port-props/port-props.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_PORT_PROPS_H -#define LV2_PORT_PROPS_H - -/** - @defgroup port-props Port Properties - @ingroup lv2 - - Various port properties. - - @{ -*/ - -// clang-format off - -#define LV2_PORT_PROPS_URI "http://lv2plug.in/ns/ext/port-props" ///< http://lv2plug.in/ns/ext/port-props -#define LV2_PORT_PROPS_PREFIX LV2_PORT_PROPS_URI "#" ///< http://lv2plug.in/ns/ext/port-props# - -#define LV2_PORT_PROPS__causesArtifacts LV2_PORT_PROPS_PREFIX "causesArtifacts" ///< http://lv2plug.in/ns/ext/port-props#causesArtifacts -#define LV2_PORT_PROPS__continuousCV LV2_PORT_PROPS_PREFIX "continuousCV" ///< http://lv2plug.in/ns/ext/port-props#continuousCV -#define LV2_PORT_PROPS__discreteCV LV2_PORT_PROPS_PREFIX "discreteCV" ///< http://lv2plug.in/ns/ext/port-props#discreteCV -#define LV2_PORT_PROPS__displayPriority LV2_PORT_PROPS_PREFIX "displayPriority" ///< http://lv2plug.in/ns/ext/port-props#displayPriority -#define LV2_PORT_PROPS__expensive LV2_PORT_PROPS_PREFIX "expensive" ///< http://lv2plug.in/ns/ext/port-props#expensive -#define LV2_PORT_PROPS__hasStrictBounds LV2_PORT_PROPS_PREFIX "hasStrictBounds" ///< http://lv2plug.in/ns/ext/port-props#hasStrictBounds -#define LV2_PORT_PROPS__logarithmic LV2_PORT_PROPS_PREFIX "logarithmic" ///< http://lv2plug.in/ns/ext/port-props#logarithmic -#define LV2_PORT_PROPS__notAutomatic LV2_PORT_PROPS_PREFIX "notAutomatic" ///< http://lv2plug.in/ns/ext/port-props#notAutomatic -#define LV2_PORT_PROPS__notOnGUI LV2_PORT_PROPS_PREFIX "notOnGUI" ///< http://lv2plug.in/ns/ext/port-props#notOnGUI -#define LV2_PORT_PROPS__rangeSteps LV2_PORT_PROPS_PREFIX "rangeSteps" ///< http://lv2plug.in/ns/ext/port-props#rangeSteps -#define LV2_PORT_PROPS__supportsStrictBounds LV2_PORT_PROPS_PREFIX "supportsStrictBounds" ///< http://lv2plug.in/ns/ext/port-props#supportsStrictBounds -#define LV2_PORT_PROPS__trigger LV2_PORT_PROPS_PREFIX "trigger" ///< http://lv2plug.in/ns/ext/port-props#trigger - -// clang-format on - -/** - @} -*/ - -#endif /* LV2_PORT_PROPS_H */ diff --git a/plugins/lv2/vendor/lv2/presets/presets.h b/plugins/lv2/vendor/lv2/presets/presets.h deleted file mode 100644 index 7100605d4..000000000 --- a/plugins/lv2/vendor/lv2/presets/presets.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_PRESETS_H -#define LV2_PRESETS_H - -/** - @defgroup presets Presets - @ingroup lv2 - - Presets for plugins. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_PRESETS_URI "http://lv2plug.in/ns/ext/presets" ///< http://lv2plug.in/ns/ext/presets -#define LV2_PRESETS_PREFIX LV2_PRESETS_URI "#" ///< http://lv2plug.in/ns/ext/presets# - -#define LV2_PRESETS__Bank LV2_PRESETS_PREFIX "Bank" ///< http://lv2plug.in/ns/ext/presets#Bank -#define LV2_PRESETS__Preset LV2_PRESETS_PREFIX "Preset" ///< http://lv2plug.in/ns/ext/presets#Preset -#define LV2_PRESETS__bank LV2_PRESETS_PREFIX "bank" ///< http://lv2plug.in/ns/ext/presets#bank -#define LV2_PRESETS__preset LV2_PRESETS_PREFIX "preset" ///< http://lv2plug.in/ns/ext/presets#preset -#define LV2_PRESETS__value LV2_PRESETS_PREFIX "value" ///< http://lv2plug.in/ns/ext/presets#value - -// clang-format on - -/** - @} -*/ - -#endif /* LV2_PRESETS_H */ diff --git a/plugins/lv2/vendor/lv2/resize-port/resize-port.h b/plugins/lv2/vendor/lv2/resize-port/resize-port.h deleted file mode 100644 index cd4828e2d..000000000 --- a/plugins/lv2/vendor/lv2/resize-port/resize-port.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2007-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_RESIZE_PORT_H -#define LV2_RESIZE_PORT_H - -/** - @defgroup resize-port Resize Port - @ingroup lv2 - - Dynamically sized LV2 port buffers. - - @{ -*/ - -#include -#include - -// clang-format off - -#define LV2_RESIZE_PORT_URI "http://lv2plug.in/ns/ext/resize-port" ///< http://lv2plug.in/ns/ext/resize-port -#define LV2_RESIZE_PORT_PREFIX LV2_RESIZE_PORT_URI "#" ///< http://lv2plug.in/ns/ext/resize-port# - -#define LV2_RESIZE_PORT__asLargeAs LV2_RESIZE_PORT_PREFIX "asLargeAs" ///< http://lv2plug.in/ns/ext/resize-port#asLargeAs -#define LV2_RESIZE_PORT__minimumSize LV2_RESIZE_PORT_PREFIX "minimumSize" ///< http://lv2plug.in/ns/ext/resize-port#minimumSize -#define LV2_RESIZE_PORT__resize LV2_RESIZE_PORT_PREFIX "resize" ///< http://lv2plug.in/ns/ext/resize-port#resize - -// clang-format on - -#ifdef __cplusplus -extern "C" { -#endif - -/** A status code for state functions. */ -typedef enum { - LV2_RESIZE_PORT_SUCCESS = 0, /**< Completed successfully. */ - LV2_RESIZE_PORT_ERR_UNKNOWN = 1, /**< Unknown error. */ - LV2_RESIZE_PORT_ERR_NO_SPACE = 2 /**< Insufficient space. */ -} LV2_Resize_Port_Status; - -/** Opaque data for resize method. */ -typedef void* LV2_Resize_Port_Feature_Data; - -/** Host feature to allow plugins to resize their port buffers. */ -typedef struct { - /** Opaque data for resize method. */ - LV2_Resize_Port_Feature_Data data; - - /** - Resize a port buffer to at least `size` bytes. - - This function MAY return an error, in which case the port buffer was not - resized and the port is still connected to the same location. Plugins - MUST gracefully handle this situation. - - This function is in the audio threading class. - - The host MUST preserve the contents of the port buffer when resizing. - - Plugins MAY resize a port many times in a single run callback. Hosts - SHOULD make this as inexpensive as possible. - */ - LV2_Resize_Port_Status (*resize)(LV2_Resize_Port_Feature_Data data, - uint32_t index, - size_t size); -} LV2_Resize_Port_Resize; - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_RESIZE_PORT_H */ diff --git a/plugins/lv2/vendor/lv2/state/state.h b/plugins/lv2/vendor/lv2/state/state.h deleted file mode 100644 index 9c5d9d828..000000000 --- a/plugins/lv2/vendor/lv2/state/state.h +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright 2010-2016 David Robillard -// Copyright 2010 Leonard Ritter -// SPDX-License-Identifier: ISC - -#ifndef LV2_STATE_H -#define LV2_STATE_H - -/** - @defgroup state State - @ingroup lv2 - - An interface for LV2 plugins to save and restore state. - - See for details. - - @{ -*/ - -#include "lv2/core/lv2.h" - -#include -#include - -// clang-format off - -#define LV2_STATE_URI "http://lv2plug.in/ns/ext/state" ///< http://lv2plug.in/ns/ext/state -#define LV2_STATE_PREFIX LV2_STATE_URI "#" ///< http://lv2plug.in/ns/ext/state# - -#define LV2_STATE__State LV2_STATE_PREFIX "State" ///< http://lv2plug.in/ns/ext/state#State -#define LV2_STATE__interface LV2_STATE_PREFIX "interface" ///< http://lv2plug.in/ns/ext/state#interface -#define LV2_STATE__loadDefaultState LV2_STATE_PREFIX "loadDefaultState" ///< http://lv2plug.in/ns/ext/state#loadDefaultState -#define LV2_STATE__freePath LV2_STATE_PREFIX "freePath" ///< http://lv2plug.in/ns/ext/state#freePath -#define LV2_STATE__makePath LV2_STATE_PREFIX "makePath" ///< http://lv2plug.in/ns/ext/state#makePath -#define LV2_STATE__mapPath LV2_STATE_PREFIX "mapPath" ///< http://lv2plug.in/ns/ext/state#mapPath -#define LV2_STATE__state LV2_STATE_PREFIX "state" ///< http://lv2plug.in/ns/ext/state#state -#define LV2_STATE__threadSafeRestore LV2_STATE_PREFIX "threadSafeRestore" ///< http://lv2plug.in/ns/ext/state#threadSafeRestore -#define LV2_STATE__StateChanged LV2_STATE_PREFIX "StateChanged" ///< http://lv2plug.in/ns/ext/state#StateChanged - -// clang-format on - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void* LV2_State_Handle; ///< Opaque handle for state save/restore -typedef void* - LV2_State_Free_Path_Handle; ///< Opaque handle for state:freePath feature -typedef void* - LV2_State_Map_Path_Handle; ///< Opaque handle for state:mapPath feature -typedef void* - LV2_State_Make_Path_Handle; ///< Opaque handle for state:makePath feature - -/** - Flags describing value characteristics. - - These flags are used along with the value's type URI to determine how to - (de-)serialise the value data, or whether it is even possible to do so. -*/ -typedef enum { - /** - Plain Old Data. - - Values with this flag contain no pointers or references to other areas - of memory. It is safe to copy POD values with a simple memcpy and store - them for the duration of the process. A POD value is not necessarily - safe to transmit between processes or machines (for example, filenames - are POD), see LV2_STATE_IS_PORTABLE for details. - - Implementations MUST NOT attempt to copy or serialise a non-POD value if - they do not understand its type (and thus know how to correctly do so). - */ - LV2_STATE_IS_POD = 1U << 0U, - - /** - Portable (architecture independent) data. - - Values with this flag are in a format that is usable on any - architecture. A portable value saved on one machine can be restored on - another machine regardless of architecture. The format of portable - values MUST NOT depend on architecture-specific properties like - endianness or alignment. Portable values MUST NOT contain filenames. - */ - LV2_STATE_IS_PORTABLE = 1U << 1U, - - /** - Native data. - - This flag is used by the host to indicate that the saved data is only - going to be used locally in the currently running process (for things - like instance duplication or snapshots), so the plugin should use the - most efficient representation possible and not worry about serialisation - and portability. - */ - LV2_STATE_IS_NATIVE = 1U << 2U -} LV2_State_Flags; - -/** A status code for state functions. */ -typedef enum { - LV2_STATE_SUCCESS = 0, /**< Completed successfully. */ - LV2_STATE_ERR_UNKNOWN = 1, /**< Unknown error. */ - LV2_STATE_ERR_BAD_TYPE = 2, /**< Failed due to unsupported type. */ - LV2_STATE_ERR_BAD_FLAGS = 3, /**< Failed due to unsupported flags. */ - LV2_STATE_ERR_NO_FEATURE = 4, /**< Failed due to missing features. */ - LV2_STATE_ERR_NO_PROPERTY = 5, /**< Failed due to missing property. */ - LV2_STATE_ERR_NO_SPACE = 6 /**< Failed due to insufficient space. */ -} LV2_State_Status; - -/** - A host-provided function to store a property. - @param handle Must be the handle passed to LV2_State_Interface.save(). - @param key The key to store `value` under (URID). - @param value Pointer to the value to be stored. - @param size The size of `value` in bytes. - @param type The type of `value` (URID). - @param flags LV2_State_Flags for `value`. - @return 0 on success, otherwise a non-zero error code. - - The host passes a callback of this type to LV2_State_Interface.save(). This - callback is called repeatedly by the plugin to store all the properties that - describe its current state. - - DO NOT INVENT NONSENSE URI SCHEMES FOR THE KEY. Best is to use keys from - existing vocabularies. If nothing appropriate is available, use http URIs - that point to somewhere you can host documents so documentation can be made - resolvable (typically a child of the plugin or project URI). If this is not - possible, invent a URN scheme, e.g. urn:myproj:whatever. The plugin MUST - NOT pass an invalid URI key. - - The host MAY fail to store a property for whatever reason, but SHOULD - store any property that is LV2_STATE_IS_POD and LV2_STATE_IS_PORTABLE. - Implementations SHOULD use the types from the LV2 Atom extension - (http://lv2plug.in/ns/ext/atom) wherever possible. The plugin SHOULD - attempt to fall-back and avoid the error if possible. - - Note that `size` MUST be > 0, and `value` MUST point to a valid region of - memory `size` bytes long (this is required to make restore unambiguous). - - The plugin MUST NOT attempt to use this function outside of the - LV2_State_Interface.restore() context. -*/ -typedef LV2_State_Status (*LV2_State_Store_Function)(LV2_State_Handle handle, - uint32_t key, - const void* value, - size_t size, - uint32_t type, - uint32_t flags); - -/** - A host-provided function to retrieve a property. - @param handle Must be the handle passed to LV2_State_Interface.restore(). - @param key The key of the property to retrieve (URID). - @param size (Output) If non-NULL, set to the size of the restored value. - @param type (Output) If non-NULL, set to the type of the restored value. - @param flags (Output) If non-NULL, set to the flags for the restored value. - @return A pointer to the restored value (object), or NULL if no value - has been stored under `key`. - - A callback of this type is passed by the host to - LV2_State_Interface.restore(). This callback is called repeatedly by the - plugin to retrieve any properties it requires to restore its state. - - The returned value MUST remain valid until LV2_State_Interface.restore() - returns. The plugin MUST NOT attempt to use this function, or any value - returned from it, outside of the LV2_State_Interface.restore() context. -*/ -typedef const void* (*LV2_State_Retrieve_Function)(LV2_State_Handle handle, - uint32_t key, - size_t* size, - uint32_t* type, - uint32_t* flags); - -/** - LV2 Plugin State Interface. - - When the plugin's extension_data is called with argument - LV2_STATE__interface, the plugin MUST return an LV2_State_Interface - structure, which remains valid for the lifetime of the plugin. - - The host can use the contained function pointers to save and restore the - state of a plugin instance at any time, provided the threading restrictions - of the functions are met. - - Stored data is only guaranteed to be compatible between instances of plugins - with the same URI (i.e. if a change to a plugin would cause a fatal error - when restoring state saved by a previous version of that plugin, the plugin - URI MUST change just as it must when ports change incompatibly). Plugin - authors should consider this possibility, and always store sensible data - with meaningful types to avoid such problems in the future. -*/ -typedef struct { - /** - Save plugin state using a host-provided `store` callback. - - @param instance The instance handle of the plugin. - @param store The host-provided store callback. - @param handle An opaque pointer to host data which MUST be passed as the - handle parameter to `store` if it is called. - @param flags Flags describing desired properties of this save. These - flags may be used to determine the most appropriate values to store. - @param features Extensible parameter for passing any additional - features to be used for this save. - - The plugin is expected to store everything necessary to completely - restore its state later. Plugins SHOULD store simple POD data whenever - possible, and consider the possibility of state being restored much - later on a different machine. - - The `handle` pointer and `store` function MUST NOT be used - beyond the scope of save(). - - This function has its own special threading class: it may not be called - concurrently with any "Instantiation" function, but it may be called - concurrently with functions in any other class, unless the definition of - that class prohibits it (for example, it may not be called concurrently - with a "Discovery" function, but it may be called concurrently with an - "Audio" function. The plugin is responsible for any locking or - lock-free techniques necessary to make this possible. - - Note that in the simple case where state is only modified by restore(), - there are no synchronization issues since save() is never called - concurrently with restore() (though run() may read it during a save). - - Plugins that dynamically modify state while running, however, must take - care to do so in such a way that a concurrent call to save() will save a - consistent representation of plugin state for a single instant in time. - */ - LV2_State_Status (*save)(LV2_Handle instance, - LV2_State_Store_Function store, - LV2_State_Handle handle, - uint32_t flags, - const LV2_Feature* const* features); - - /** - Restore plugin state using a host-provided `retrieve` callback. - - @param instance The instance handle of the plugin. - @param retrieve The host-provided retrieve callback. - @param handle An opaque pointer to host data which MUST be passed as the - handle parameter to `retrieve` if it is called. - @param flags Currently unused. - @param features Extensible parameter for passing any additional - features to be used for this restore. - - The plugin MAY assume a restored value was set by a previous call to - LV2_State_Interface.save() by a plugin with the same URI. - - The plugin MUST gracefully fall back to a default value when a value can - not be retrieved. This allows the host to reset the plugin state with - an empty map. - - The `handle` pointer and `store` function MUST NOT be used - beyond the scope of restore(). - - This function is in the "Instantiation" threading class as defined by - LV2. This means it MUST NOT be called concurrently with any other - function on the same plugin instance. - */ - LV2_State_Status (*restore)(LV2_Handle instance, - LV2_State_Retrieve_Function retrieve, - LV2_State_Handle handle, - uint32_t flags, - const LV2_Feature* const* features); -} LV2_State_Interface; - -/** - Feature data for state:mapPath (@ref LV2_STATE__mapPath). -*/ -typedef struct { - /** - Opaque host data. - */ - LV2_State_Map_Path_Handle handle; - - /** - Map an absolute path to an abstract path for use in plugin state. - @param handle MUST be the `handle` member of this struct. - @param absolute_path The absolute path of a file. - @return An abstract path suitable for use in plugin state. - - The plugin MUST use this function to map any paths that will be stored - in plugin state. The returned value is an abstract path which MAY not - be an actual file system path; absolute_path() MUST be used to map - it to an actual path in order to use the file. - - Plugins MUST NOT make any assumptions about abstract paths except that - they can be mapped back to the absolute path of the "same" file (though - not necessarily the same original path) using absolute_path(). - - This function may only be called within the context of - LV2_State_Interface methods. The caller must free the returned value - with LV2_State_Free_Path.free_path(). - */ - char* (*abstract_path)(LV2_State_Map_Path_Handle handle, - const char* absolute_path); - - /** - Map an abstract path from plugin state to an absolute path. - @param handle MUST be the `handle` member of this struct. - @param abstract_path An abstract path (typically from plugin state). - @return An absolute file system path. - - The plugin MUST use this function in order to actually open or otherwise - use any paths loaded from plugin state. - - This function may only be called within the context of - LV2_State_Interface methods. The caller must free the returned value - with LV2_State_Free_Path.free_path(). - */ - char* (*absolute_path)(LV2_State_Map_Path_Handle handle, - const char* abstract_path); -} LV2_State_Map_Path; - -/** - Feature data for state:makePath (@ref LV2_STATE__makePath). -*/ -typedef struct { - /** - Opaque host data. - */ - LV2_State_Make_Path_Handle handle; - - /** - Return a path the plugin may use to create a new file. - @param handle MUST be the `handle` member of this struct. - @param path The path of the new file within a namespace unique to this - plugin instance. - @return The absolute path to use for the new file. - - This function can be used by plugins to create files and directories, - either at state saving time (if this feature is passed to - LV2_State_Interface.save()) or any time (if this feature is passed to - LV2_Descriptor.instantiate()). - - The host MUST do whatever is necessary for the plugin to be able to - create a file at the returned path (for example, using fopen()), - including creating any leading directories. - - If this function is passed to LV2_Descriptor.instantiate(), it may be - called from any non-realtime context. If it is passed to - LV2_State_Interface.save(), it may only be called within the dynamic - scope of that function call. - - The caller must free the returned value with - LV2_State_Free_Path.free_path(). - */ - char* (*path)(LV2_State_Make_Path_Handle handle, const char* path); -} LV2_State_Make_Path; - -/** - Feature data for state:freePath (@ref LV2_STATE__freePath). -*/ -typedef struct { - /** - Opaque host data. - */ - LV2_State_Free_Path_Handle handle; - - /** - Free a path returned by a state feature. - - @param handle MUST be the `handle` member of this struct. - @param path The path previously returned by a state feature. - - This function can be used by plugins to free paths allocated by the host - and returned by state features (LV2_State_Map_Path.abstract_path(), - LV2_State_Map_Path.absolute_path(), and LV2_State_Make_Path.path()). - */ - void (*free_path)(LV2_State_Free_Path_Handle handle, char* path); -} LV2_State_Free_Path; - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_STATE_H */ diff --git a/plugins/lv2/vendor/lv2/time/time.h b/plugins/lv2/vendor/lv2/time/time.h deleted file mode 100644 index 83408c983..000000000 --- a/plugins/lv2/vendor/lv2/time/time.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2011-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_TIME_H -#define LV2_TIME_H - -/** - @defgroup time Time - @ingroup lv2 - - Properties for describing time. - - Note the time extension is purely data, this header merely defines URIs for - convenience. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_TIME_URI "http://lv2plug.in/ns/ext/time" ///< http://lv2plug.in/ns/ext/time -#define LV2_TIME_PREFIX LV2_TIME_URI "#" ///< http://lv2plug.in/ns/ext/time# - -#define LV2_TIME__Time LV2_TIME_PREFIX "Time" ///< http://lv2plug.in/ns/ext/time#Time -#define LV2_TIME__Position LV2_TIME_PREFIX "Position" ///< http://lv2plug.in/ns/ext/time#Position -#define LV2_TIME__Rate LV2_TIME_PREFIX "Rate" ///< http://lv2plug.in/ns/ext/time#Rate -#define LV2_TIME__position LV2_TIME_PREFIX "position" ///< http://lv2plug.in/ns/ext/time#position -#define LV2_TIME__barBeat LV2_TIME_PREFIX "barBeat" ///< http://lv2plug.in/ns/ext/time#barBeat -#define LV2_TIME__bar LV2_TIME_PREFIX "bar" ///< http://lv2plug.in/ns/ext/time#bar -#define LV2_TIME__beat LV2_TIME_PREFIX "beat" ///< http://lv2plug.in/ns/ext/time#beat -#define LV2_TIME__beatUnit LV2_TIME_PREFIX "beatUnit" ///< http://lv2plug.in/ns/ext/time#beatUnit -#define LV2_TIME__beatsPerBar LV2_TIME_PREFIX "beatsPerBar" ///< http://lv2plug.in/ns/ext/time#beatsPerBar -#define LV2_TIME__beatsPerMinute LV2_TIME_PREFIX "beatsPerMinute" ///< http://lv2plug.in/ns/ext/time#beatsPerMinute -#define LV2_TIME__frame LV2_TIME_PREFIX "frame" ///< http://lv2plug.in/ns/ext/time#frame -#define LV2_TIME__framesPerSecond LV2_TIME_PREFIX "framesPerSecond" ///< http://lv2plug.in/ns/ext/time#framesPerSecond -#define LV2_TIME__speed LV2_TIME_PREFIX "speed" ///< http://lv2plug.in/ns/ext/time#speed - -// clang-format on - -/** - @} -*/ - -#endif /* LV2_TIME_H */ diff --git a/plugins/lv2/vendor/lv2/ui/ui.h b/plugins/lv2/vendor/lv2/ui/ui.h deleted file mode 100644 index 5ef75a3f1..000000000 --- a/plugins/lv2/vendor/lv2/ui/ui.h +++ /dev/null @@ -1,529 +0,0 @@ -// Copyright 2009-2016 David Robillard -// Copyright 2006-2011 Lars Luthman -// SPDX-License-Identifier: ISC - -#ifndef LV2_UI_H -#define LV2_UI_H - -/** - @defgroup ui User Interfaces - @ingroup lv2 - - User interfaces of any type for plugins. - - See for details. - - @{ -*/ - -#include "lv2/core/lv2.h" -#include "lv2/urid/urid.h" - -#include -#include - -// clang-format off - -#define LV2_UI_URI "http://lv2plug.in/ns/extensions/ui" ///< http://lv2plug.in/ns/extensions/ui -#define LV2_UI_PREFIX LV2_UI_URI "#" ///< http://lv2plug.in/ns/extensions/ui# - -#define LV2_UI__CocoaUI LV2_UI_PREFIX "CocoaUI" ///< http://lv2plug.in/ns/extensions/ui#CocoaUI -#define LV2_UI__Gtk3UI LV2_UI_PREFIX "Gtk3UI" ///< http://lv2plug.in/ns/extensions/ui#Gtk3UI -#define LV2_UI__GtkUI LV2_UI_PREFIX "GtkUI" ///< http://lv2plug.in/ns/extensions/ui#GtkUI -#define LV2_UI__PortNotification LV2_UI_PREFIX "PortNotification" ///< http://lv2plug.in/ns/extensions/ui#PortNotification -#define LV2_UI__PortProtocol LV2_UI_PREFIX "PortProtocol" ///< http://lv2plug.in/ns/extensions/ui#PortProtocol -#define LV2_UI__Qt4UI LV2_UI_PREFIX "Qt4UI" ///< http://lv2plug.in/ns/extensions/ui#Qt4UI -#define LV2_UI__Qt5UI LV2_UI_PREFIX "Qt5UI" ///< http://lv2plug.in/ns/extensions/ui#Qt5UI -#define LV2_UI__UI LV2_UI_PREFIX "UI" ///< http://lv2plug.in/ns/extensions/ui#UI -#define LV2_UI__WindowsUI LV2_UI_PREFIX "WindowsUI" ///< http://lv2plug.in/ns/extensions/ui#WindowsUI -#define LV2_UI__X11UI LV2_UI_PREFIX "X11UI" ///< http://lv2plug.in/ns/extensions/ui#X11UI -#define LV2_UI__binary LV2_UI_PREFIX "binary" ///< http://lv2plug.in/ns/extensions/ui#binary -#define LV2_UI__fixedSize LV2_UI_PREFIX "fixedSize" ///< http://lv2plug.in/ns/extensions/ui#fixedSize -#define LV2_UI__idleInterface LV2_UI_PREFIX "idleInterface" ///< http://lv2plug.in/ns/extensions/ui#idleInterface -#define LV2_UI__noUserResize LV2_UI_PREFIX "noUserResize" ///< http://lv2plug.in/ns/extensions/ui#noUserResize -#define LV2_UI__notifyType LV2_UI_PREFIX "notifyType" ///< http://lv2plug.in/ns/extensions/ui#notifyType -#define LV2_UI__parent LV2_UI_PREFIX "parent" ///< http://lv2plug.in/ns/extensions/ui#parent -#define LV2_UI__plugin LV2_UI_PREFIX "plugin" ///< http://lv2plug.in/ns/extensions/ui#plugin -#define LV2_UI__portIndex LV2_UI_PREFIX "portIndex" ///< http://lv2plug.in/ns/extensions/ui#portIndex -#define LV2_UI__portMap LV2_UI_PREFIX "portMap" ///< http://lv2plug.in/ns/extensions/ui#portMap -#define LV2_UI__portNotification LV2_UI_PREFIX "portNotification" ///< http://lv2plug.in/ns/extensions/ui#portNotification -#define LV2_UI__portSubscribe LV2_UI_PREFIX "portSubscribe" ///< http://lv2plug.in/ns/extensions/ui#portSubscribe -#define LV2_UI__protocol LV2_UI_PREFIX "protocol" ///< http://lv2plug.in/ns/extensions/ui#protocol -#define LV2_UI__requestValue LV2_UI_PREFIX "requestValue" ///< http://lv2plug.in/ns/extensions/ui#requestValue -#define LV2_UI__floatProtocol LV2_UI_PREFIX "floatProtocol" ///< http://lv2plug.in/ns/extensions/ui#floatProtocol -#define LV2_UI__peakProtocol LV2_UI_PREFIX "peakProtocol" ///< http://lv2plug.in/ns/extensions/ui#peakProtocol -#define LV2_UI__resize LV2_UI_PREFIX "resize" ///< http://lv2plug.in/ns/extensions/ui#resize -#define LV2_UI__showInterface LV2_UI_PREFIX "showInterface" ///< http://lv2plug.in/ns/extensions/ui#showInterface -#define LV2_UI__touch LV2_UI_PREFIX "touch" ///< http://lv2plug.in/ns/extensions/ui#touch -#define LV2_UI__ui LV2_UI_PREFIX "ui" ///< http://lv2plug.in/ns/extensions/ui#ui -#define LV2_UI__updateRate LV2_UI_PREFIX "updateRate" ///< http://lv2plug.in/ns/extensions/ui#updateRate -#define LV2_UI__windowTitle LV2_UI_PREFIX "windowTitle" ///< http://lv2plug.in/ns/extensions/ui#windowTitle -#define LV2_UI__scaleFactor LV2_UI_PREFIX "scaleFactor" ///< http://lv2plug.in/ns/extensions/ui#scaleFactor -#define LV2_UI__foregroundColor LV2_UI_PREFIX "foregroundColor" ///< http://lv2plug.in/ns/extensions/ui#foregroundColor -#define LV2_UI__backgroundColor LV2_UI_PREFIX "backgroundColor" ///< http://lv2plug.in/ns/extensions/ui#backgroundColor - -// clang-format on - -/** - The index returned by LV2UI_Port_Map::port_index() for unknown ports. -*/ -#define LV2UI_INVALID_PORT_INDEX ((uint32_t)-1) - -#ifdef __cplusplus -extern "C" { -#endif - -/** - A pointer to some widget or other type of UI handle. - - The actual type is defined by the type of the UI. -*/ -typedef void* LV2UI_Widget; - -/** - A pointer to UI instance internals. - - The host may compare this to NULL, but otherwise MUST NOT interpret it. -*/ -typedef void* LV2UI_Handle; - -/** - A pointer to a controller provided by the host. - - The UI may compare this to NULL, but otherwise MUST NOT interpret it. -*/ -typedef void* LV2UI_Controller; - -/** - A pointer to opaque data for a feature. -*/ -typedef void* LV2UI_Feature_Handle; - -/** - A host-provided function that sends data to a plugin's input ports. - - @param controller The opaque controller pointer passed to - LV2UI_Descriptor::instantiate(). - - @param port_index Index of the port to update. - - @param buffer Buffer containing `buffer_size` bytes of data. - - @param buffer_size Size of `buffer` in bytes. - - @param port_protocol Either 0 or the URID for a ui:PortProtocol. If 0, the - protocol is implicitly ui:floatProtocol, the port MUST be an lv2:ControlPort - input, `buffer` MUST point to a single float value, and `buffer_size` MUST - be sizeof(float). The UI SHOULD NOT use a protocol not supported by the - host, but the host MUST gracefully ignore any protocol it does not - understand. -*/ -typedef void (*LV2UI_Write_Function)(LV2UI_Controller controller, - uint32_t port_index, - uint32_t buffer_size, - uint32_t port_protocol, - const void* buffer); - -/** - A plugin UI. - - A pointer to an object of this type is returned by the lv2ui_descriptor() - function. -*/ -typedef struct LV2UI_Descriptor { - /** - The URI for this UI (not for the plugin it controls). - */ - const char* URI; - - /** - Create a new UI and return a handle to it. This function works - similarly to LV2_Descriptor::instantiate(). - - @param descriptor The descriptor for the UI to instantiate. - - @param plugin_uri The URI of the plugin that this UI will control. - - @param bundle_path The path to the bundle containing this UI, including - the trailing directory separator. - - @param write_function A function that the UI can use to send data to the - plugin's input ports. - - @param controller A handle for the UI instance to be passed as the - first parameter of UI methods. - - @param widget (output) widget pointer. The UI points this at its main - widget, which has the type defined by the UI type in the data file. - - @param features An array of LV2_Feature pointers. The host must pass - all feature URIs that it and the UI supports and any additional data, as - in LV2_Descriptor::instantiate(). Note that UI features and plugin - features are not necessarily the same. - - */ - LV2UI_Handle (*instantiate)(const struct LV2UI_Descriptor* descriptor, - const char* plugin_uri, - const char* bundle_path, - LV2UI_Write_Function write_function, - LV2UI_Controller controller, - LV2UI_Widget* widget, - const LV2_Feature* const* features); - - /** - Destroy the UI. The host must not try to access the widget after - calling this function. - */ - void (*cleanup)(LV2UI_Handle ui); - - /** - Tell the UI that something interesting has happened at a plugin port. - - What is "interesting" and how it is written to `buffer` is defined by - `format`, which has the same meaning as in LV2UI_Write_Function(). - Format 0 is a special case for lv2:ControlPort, where this function - should be called when the port value changes (but not necessarily for - every change), `buffer_size` must be sizeof(float), and `buffer` - points to a single IEEE-754 float. - - By default, the host should only call this function for lv2:ControlPort - inputs. However, the UI can request updates for other ports statically - with ui:portNotification or dynamically with ui:portSubscribe. - - The UI MUST NOT retain any reference to `buffer` after this function - returns, it is only valid for the duration of the call. - - This member may be NULL if the UI is not interested in any port events. - */ - void (*port_event)(LV2UI_Handle ui, - uint32_t port_index, - uint32_t buffer_size, - uint32_t format, - const void* buffer); - - /** - Return a data structure associated with an extension URI, typically an - interface struct with additional function pointers - - This member may be set to NULL if the UI is not interested in supporting - any extensions. This is similar to LV2_Descriptor::extension_data(). - - */ - const void* (*extension_data)(const char* uri); -} LV2UI_Descriptor; - -/** - Feature/interface for resizable UIs (LV2_UI__resize). - - This structure is used in two ways: as a feature passed by the host via - LV2UI_Descriptor::instantiate(), or as an interface provided by a UI via - LV2UI_Descriptor::extension_data()). -*/ -typedef struct { - /** - Pointer to opaque data which must be passed to ui_resize(). - */ - LV2UI_Feature_Handle handle; - - /** - Request/advertise a size change. - - When provided by the host, the UI may call this function to inform the - host about the size of the UI. - - When provided by the UI, the host may call this function to notify the - UI that it should change its size accordingly. In this case, the host - must pass the LV2UI_Handle to provide access to the UI instance. - - @return 0 on success. - */ - int (*ui_resize)(LV2UI_Feature_Handle handle, int width, int height); -} LV2UI_Resize; - -/** - Feature to map port symbols to UIs. - - This can be used by the UI to get the index for a port with the given - symbol. This makes it possible to implement and distribute a UI separately - from the plugin (since symbol, unlike index, is a stable port identifier). -*/ -typedef struct { - /** - Pointer to opaque data which must be passed to port_index(). - */ - LV2UI_Feature_Handle handle; - - /** - Get the index for the port with the given `symbol`. - - @return The index of the port, or LV2UI_INVALID_PORT_INDEX if no such - port is found. - */ - uint32_t (*port_index)(LV2UI_Feature_Handle handle, const char* symbol); -} LV2UI_Port_Map; - -/** - Feature to subscribe to port updates (LV2_UI__portSubscribe). -*/ -typedef struct { - /** - Pointer to opaque data which must be passed to subscribe() and - unsubscribe(). - */ - LV2UI_Feature_Handle handle; - - /** - Subscribe to updates for a port. - - This means that the host will call the UI's port_event() function when - the port value changes (as defined by protocol). - - Calling this function with the same `port_index` and `port_protocol` - as an already active subscription has no effect. - - @param handle The handle field of this struct. - @param port_index The index of the port. - @param port_protocol The URID of the ui:PortProtocol. - @param features Features for this subscription. - @return 0 on success. - */ - uint32_t (*subscribe)(LV2UI_Feature_Handle handle, - uint32_t port_index, - uint32_t port_protocol, - const LV2_Feature* const* features); - - /** - Unsubscribe from updates for a port. - - This means that the host will cease calling calling port_event() when - the port value changes. - - Calling this function with a `port_index` and `port_protocol` that - does not refer to an active port subscription has no effect. - - @param handle The handle field of this struct. - @param port_index The index of the port. - @param port_protocol The URID of the ui:PortProtocol. - @param features Features for this subscription. - @return 0 on success. - */ - uint32_t (*unsubscribe)(LV2UI_Feature_Handle handle, - uint32_t port_index, - uint32_t port_protocol, - const LV2_Feature* const* features); -} LV2UI_Port_Subscribe; - -/** - A feature to notify the host that the user has grabbed a UI control. -*/ -typedef struct { - /** - Pointer to opaque data which must be passed to touch(). - */ - LV2UI_Feature_Handle handle; - - /** - Notify the host that a control has been grabbed or released. - - The host should cease automating the port or otherwise manipulating the - port value until the control has been ungrabbed. - - @param handle The handle field of this struct. - @param port_index The index of the port associated with the control. - @param grabbed If true, the control has been grabbed, otherwise the - control has been released. - */ - void (*touch)(LV2UI_Feature_Handle handle, uint32_t port_index, bool grabbed); -} LV2UI_Touch; - -/** - A status code for LV2UI_Request_Value::request(). -*/ -typedef enum { - /** - Completed successfully. - - The host will set the parameter later if the user chooses a new value. - */ - LV2UI_REQUEST_VALUE_SUCCESS, - - /** - Parameter already being requested. - - The host is already requesting a parameter from the user (for example, a - dialog is visible), or the UI is otherwise busy and can not make this - request. - */ - LV2UI_REQUEST_VALUE_BUSY, - - /** - Unknown parameter. - - The host is not aware of this parameter, and is not able to set a new - value for it. - */ - LV2UI_REQUEST_VALUE_ERR_UNKNOWN, - - /** - Unsupported parameter. - - The host knows about this parameter, but does not support requesting a - new value for it from the user. This is likely because the host does - not have UI support for choosing a value with the appropriate type. - */ - LV2UI_REQUEST_VALUE_ERR_UNSUPPORTED -} LV2UI_Request_Value_Status; - -/** - A feature to request a new parameter value from the host. -*/ -typedef struct { - /** - Pointer to opaque data which must be passed to request(). - */ - LV2UI_Feature_Handle handle; - - /** - Request a value for a parameter from the host. - - This is mainly used by UIs to request values for complex parameters that - don't change often, such as file paths, but it may be used to request - any parameter value. - - This function returns immediately, and the return value indicates - whether the host can fulfil the request. The host may notify the - plugin about the new parameter value, for example when a file is - selected by the user, via the usual mechanism. Typically, the host will - send a message to the plugin that sets the new parameter value, and the - plugin will notify the UI via a message as usual for any other parameter - change. - - To provide an appropriate UI, the host can determine details about the - parameter from the plugin data as usual. The additional parameters of - this function provide support for more advanced use cases, but in the - simple common case, the plugin will simply pass the key of the desired - parameter and zero for everything else. - - @param handle The handle field of this struct. - - @param key The URID of the parameter. - - @param type The optional type of the value to request. This can be used - to request a specific value type for parameters that support several. - If non-zero, it must be the URID of an instance of rdfs:Class or - rdfs:Datatype. - - @param features Additional features for this request, or NULL. - - @return A status code which is 0 on success. - */ - LV2UI_Request_Value_Status (*request)(LV2UI_Feature_Handle handle, - LV2_URID key, - LV2_URID type, - const LV2_Feature* const* features); - -} LV2UI_Request_Value; - -/** - UI Idle Interface (LV2_UI__idleInterface) - - UIs can provide this interface to have an idle() callback called by the host - rapidly to update the UI. -*/ -typedef struct { - /** - Run a single iteration of the UI's idle loop. - - This will be called rapidly in the UI thread at a rate appropriate - for a toolkit main loop. There are no precise timing guarantees, but - the host should attempt to call idle() at a high enough rate for smooth - animation, at least 30Hz. - - @return non-zero if the UI has been closed, in which case the host - should stop calling idle(), and can either completely destroy the UI, or - re-show it and resume calling idle(). - */ - int (*idle)(LV2UI_Handle ui); -} LV2UI_Idle_Interface; - -/** - UI Show Interface (LV2_UI__showInterface) - - UIs can provide this interface to show and hide a window, which allows them - to function in hosts unable to embed their widget. This allows any UI to - provide a fallback for embedding that works in any host. - - If used: - - The host MUST use LV2UI_Idle_Interface to drive the UI. - - The UI MUST return non-zero from LV2UI_Idle_Interface::idle() when it has - been closed. - - If idle() returns non-zero, the host MUST call hide() and stop calling - idle(). It MAY later call show() then resume calling idle(). -*/ -typedef struct { - /** - Show a window for this UI. - - The window title MAY have been passed by the host to - LV2UI_Descriptor::instantiate() as an LV2_Options_Option with key - LV2_UI__windowTitle. - - @return 0 on success, or anything else to stop being called. - */ - int (*show)(LV2UI_Handle ui); - - /** - Hide the window for this UI. - - @return 0 on success, or anything else to stop being called. - */ - int (*hide)(LV2UI_Handle ui); -} LV2UI_Show_Interface; - -/** - Peak data for a slice of time, the update format for ui:peakProtocol. -*/ -typedef struct { - /** - The start of the measurement period. This is just a running counter - that is only meaningful in comparison to previous values and must not be - interpreted as an absolute time. - */ - uint32_t period_start; - - /** - The size of the measurement period, in the same units as period_start. - */ - uint32_t period_size; - - /** - The peak value for the measurement period. This should be the maximal - value for abs(sample) over all the samples in the period. - */ - float peak; -} LV2UI_Peak_Data; - -/** - Prototype for UI accessor function. - - This is the entry point to a UI library, which works in the same way as - lv2_descriptor() but for UIs rather than plugins. -*/ -LV2_SYMBOL_EXPORT -const LV2UI_Descriptor* -lv2ui_descriptor(uint32_t index); - -/** - The type of the lv2ui_descriptor() function. -*/ -typedef const LV2UI_Descriptor* (*LV2UI_DescriptorFunction)(uint32_t index); - -#ifdef __cplusplus -} -#endif - -/** - @} -*/ - -#endif /* LV2_UI_H */ diff --git a/plugins/lv2/vendor/lv2/units/units.h b/plugins/lv2/vendor/lv2/units/units.h deleted file mode 100644 index 0b8d41633..000000000 --- a/plugins/lv2/vendor/lv2/units/units.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2012-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_UNITS_H -#define LV2_UNITS_H - -/** - @defgroup units Units - @ingroup lv2 - - Units for LV2 values. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_UNITS_URI "http://lv2plug.in/ns/extensions/units" ///< http://lv2plug.in/ns/extensions/units -#define LV2_UNITS_PREFIX LV2_UNITS_URI "#" ///< http://lv2plug.in/ns/extensions/units# - -#define LV2_UNITS__Conversion LV2_UNITS_PREFIX "Conversion" ///< http://lv2plug.in/ns/extensions/units#Conversion -#define LV2_UNITS__Unit LV2_UNITS_PREFIX "Unit" ///< http://lv2plug.in/ns/extensions/units#Unit -#define LV2_UNITS__bar LV2_UNITS_PREFIX "bar" ///< http://lv2plug.in/ns/extensions/units#bar -#define LV2_UNITS__beat LV2_UNITS_PREFIX "beat" ///< http://lv2plug.in/ns/extensions/units#beat -#define LV2_UNITS__bpm LV2_UNITS_PREFIX "bpm" ///< http://lv2plug.in/ns/extensions/units#bpm -#define LV2_UNITS__cent LV2_UNITS_PREFIX "cent" ///< http://lv2plug.in/ns/extensions/units#cent -#define LV2_UNITS__cm LV2_UNITS_PREFIX "cm" ///< http://lv2plug.in/ns/extensions/units#cm -#define LV2_UNITS__coef LV2_UNITS_PREFIX "coef" ///< http://lv2plug.in/ns/extensions/units#coef -#define LV2_UNITS__conversion LV2_UNITS_PREFIX "conversion" ///< http://lv2plug.in/ns/extensions/units#conversion -#define LV2_UNITS__db LV2_UNITS_PREFIX "db" ///< http://lv2plug.in/ns/extensions/units#db -#define LV2_UNITS__degree LV2_UNITS_PREFIX "degree" ///< http://lv2plug.in/ns/extensions/units#degree -#define LV2_UNITS__frame LV2_UNITS_PREFIX "frame" ///< http://lv2plug.in/ns/extensions/units#frame -#define LV2_UNITS__hz LV2_UNITS_PREFIX "hz" ///< http://lv2plug.in/ns/extensions/units#hz -#define LV2_UNITS__inch LV2_UNITS_PREFIX "inch" ///< http://lv2plug.in/ns/extensions/units#inch -#define LV2_UNITS__khz LV2_UNITS_PREFIX "khz" ///< http://lv2plug.in/ns/extensions/units#khz -#define LV2_UNITS__km LV2_UNITS_PREFIX "km" ///< http://lv2plug.in/ns/extensions/units#km -#define LV2_UNITS__m LV2_UNITS_PREFIX "m" ///< http://lv2plug.in/ns/extensions/units#m -#define LV2_UNITS__mhz LV2_UNITS_PREFIX "mhz" ///< http://lv2plug.in/ns/extensions/units#mhz -#define LV2_UNITS__midiNote LV2_UNITS_PREFIX "midiNote" ///< http://lv2plug.in/ns/extensions/units#midiNote -#define LV2_UNITS__mile LV2_UNITS_PREFIX "mile" ///< http://lv2plug.in/ns/extensions/units#mile -#define LV2_UNITS__min LV2_UNITS_PREFIX "min" ///< http://lv2plug.in/ns/extensions/units#min -#define LV2_UNITS__mm LV2_UNITS_PREFIX "mm" ///< http://lv2plug.in/ns/extensions/units#mm -#define LV2_UNITS__ms LV2_UNITS_PREFIX "ms" ///< http://lv2plug.in/ns/extensions/units#ms -#define LV2_UNITS__name LV2_UNITS_PREFIX "name" ///< http://lv2plug.in/ns/extensions/units#name -#define LV2_UNITS__oct LV2_UNITS_PREFIX "oct" ///< http://lv2plug.in/ns/extensions/units#oct -#define LV2_UNITS__pc LV2_UNITS_PREFIX "pc" ///< http://lv2plug.in/ns/extensions/units#pc -#define LV2_UNITS__prefixConversion LV2_UNITS_PREFIX "prefixConversion" ///< http://lv2plug.in/ns/extensions/units#prefixConversion -#define LV2_UNITS__render LV2_UNITS_PREFIX "render" ///< http://lv2plug.in/ns/extensions/units#render -#define LV2_UNITS__s LV2_UNITS_PREFIX "s" ///< http://lv2plug.in/ns/extensions/units#s -#define LV2_UNITS__semitone12TET LV2_UNITS_PREFIX "semitone12TET" ///< http://lv2plug.in/ns/extensions/units#semitone12TET -#define LV2_UNITS__symbol LV2_UNITS_PREFIX "symbol" ///< http://lv2plug.in/ns/extensions/units#symbol -#define LV2_UNITS__unit LV2_UNITS_PREFIX "unit" ///< http://lv2plug.in/ns/extensions/units#unit - -// clang-format on - -/** - @} -*/ - -#endif /* LV2_UNITS_H */ diff --git a/plugins/lv2/vendor/lv2/uri-map/uri-map.h b/plugins/lv2/vendor/lv2/uri-map/uri-map.h deleted file mode 100644 index 0c683d0f6..000000000 --- a/plugins/lv2/vendor/lv2/uri-map/uri-map.h +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2008-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_URI_MAP_H -#define LV2_URI_MAP_H - -/** - @defgroup uri-map URI Map - @ingroup lv2 - - A feature for mapping URIs to integers. - - This extension defines a simple mechanism for plugins to map URIs to - integers, usually for performance reasons (e.g. processing events typed by - URIs in real time). The expected use case is for plugins to map URIs to - integers for things they 'understand' at instantiation time, and store those - values for use in the audio thread without doing any string comparison. - This allows the extensibility of RDF with the performance of integers (or - centrally defined enumerations). - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_URI_MAP_URI "http://lv2plug.in/ns/ext/uri-map" ///< http://lv2plug.in/ns/ext/uri-map -#define LV2_URI_MAP_PREFIX LV2_URI_MAP_URI "#" ///< http://lv2plug.in/ns/ext/uri-map# - -// clang-format on - -#include "lv2/core/attributes.h" - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -LV2_DISABLE_DEPRECATION_WARNINGS - -/** - Opaque pointer to host data. -*/ -LV2_DEPRECATED -typedef void* LV2_URI_Map_Callback_Data; - -/** - URI Map Feature. - - To support this feature the host must pass an LV2_Feature struct to the - plugin's instantiate method with URI "http://lv2plug.in/ns/ext/uri-map" - and data pointed to an instance of this struct. -*/ -LV2_DEPRECATED -typedef struct { - /** - Opaque pointer to host data. - - The plugin MUST pass this to any call to functions in this struct. - Otherwise, it must not be interpreted in any way. - */ - LV2_URI_Map_Callback_Data callback_data; - - /** - Get the numeric ID of a URI from the host. - - @param callback_data Must be the callback_data member of this struct. - @param map The 'context' of this URI. Certain extensions may define a - URI that must be passed here with certain restrictions on the return - value (e.g. limited range). This value may be NULL if the plugin needs - an ID for a URI in general. Extensions SHOULD NOT define a context - unless there is a specific need to do so, e.g. to restrict the range of - the returned value. - @param uri The URI to be mapped to an integer ID. - - This function is referentially transparent; any number of calls with the - same arguments is guaranteed to return the same value over the life of a - plugin instance (though the same URI may return different values with a - different map parameter). However, this function is not necessarily very - fast: plugins SHOULD cache any IDs they might need in performance - critical situations. - - The return value 0 is reserved and indicates that an ID for that URI - could not be created for whatever reason. Extensions MAY define more - precisely what this means in a certain context, but in general plugins - SHOULD handle this situation as gracefully as possible. However, hosts - SHOULD NOT return 0 from this function in non-exceptional circumstances - (e.g. the URI map SHOULD be dynamic). Hosts that statically support only - a fixed set of URIs should not expect plugins to function correctly. - */ - uint32_t (*uri_to_id)(LV2_URI_Map_Callback_Data callback_data, - const char* map, - const char* uri); -} LV2_URI_Map_Feature; - -LV2_RESTORE_WARNINGS - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_URI_MAP_H */ diff --git a/plugins/lv2/vendor/lv2/urid/urid.h b/plugins/lv2/vendor/lv2/urid/urid.h deleted file mode 100644 index 5890307f3..000000000 --- a/plugins/lv2/vendor/lv2/urid/urid.h +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2008-2016 David Robillard -// Copyright 2011 Gabriel M. Beddingfield -// SPDX-License-Identifier: ISC - -#ifndef LV2_URID_H -#define LV2_URID_H - -/** - @defgroup urid URID - @ingroup lv2 - - Features for mapping URIs to and from integers. - - See for details. - - @{ -*/ - -// clang-format off - -#define LV2_URID_URI "http://lv2plug.in/ns/ext/urid" ///< http://lv2plug.in/ns/ext/urid -#define LV2_URID_PREFIX LV2_URID_URI "#" ///< http://lv2plug.in/ns/ext/urid# - -#define LV2_URID__map LV2_URID_PREFIX "map" ///< http://lv2plug.in/ns/ext/urid#map -#define LV2_URID__unmap LV2_URID_PREFIX "unmap" ///< http://lv2plug.in/ns/ext/urid#unmap - -#define LV2_URID_MAP_URI LV2_URID__map ///< Legacy -#define LV2_URID_UNMAP_URI LV2_URID__unmap ///< Legacy - -// clang-format on - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - Opaque pointer to host data for LV2_URID_Map. -*/ -typedef void* LV2_URID_Map_Handle; - -/** - Opaque pointer to host data for LV2_URID_Unmap. -*/ -typedef void* LV2_URID_Unmap_Handle; - -/** - URI mapped to an integer. -*/ -typedef uint32_t LV2_URID; - -/** - URID Map Feature (LV2_URID__map) -*/ -typedef struct { - /** - Opaque pointer to host data. - - This MUST be passed to map_uri() whenever it is called. - Otherwise, it must not be interpreted in any way. - */ - LV2_URID_Map_Handle handle; - - /** - Get the numeric ID of a URI. - - If the ID does not already exist, it will be created. - - This function is referentially transparent; any number of calls with the - same arguments is guaranteed to return the same value over the life of a - plugin instance. Note, however, that several URIs MAY resolve to the - same ID if the host considers those URIs equivalent. - - This function is not necessarily very fast or RT-safe: plugins SHOULD - cache any IDs they might need in performance critical situations. - - The return value 0 is reserved and indicates that an ID for that URI - could not be created for whatever reason. However, hosts SHOULD NOT - return 0 from this function in non-exceptional circumstances (i.e. the - URI map SHOULD be dynamic). - - @param handle Must be the callback_data member of this struct. - @param uri The URI to be mapped to an integer ID. - */ - LV2_URID (*map)(LV2_URID_Map_Handle handle, const char* uri); -} LV2_URID_Map; - -/** - URI Unmap Feature (LV2_URID__unmap) -*/ -typedef struct { - /** - Opaque pointer to host data. - - This MUST be passed to unmap() whenever it is called. - Otherwise, it must not be interpreted in any way. - */ - LV2_URID_Unmap_Handle handle; - - /** - Get the URI for a previously mapped numeric ID. - - Returns NULL if `urid` is not yet mapped. Otherwise, the corresponding - URI is returned in a canonical form. This MAY not be the exact same - string that was originally passed to LV2_URID_Map::map(), but it MUST be - an identical URI according to the URI syntax specification (RFC3986). A - non-NULL return for a given `urid` will always be the same for the life - of the plugin. Plugins that intend to perform string comparison on - unmapped URIs SHOULD first canonicalise URI strings with a call to - map_uri() followed by a call to unmap_uri(). - - @param handle Must be the callback_data member of this struct. - @param urid The ID to be mapped back to the URI string. - */ - const char* (*unmap)(LV2_URID_Unmap_Handle handle, LV2_URID urid); -} LV2_URID_Unmap; - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_URID_H */ diff --git a/plugins/lv2/vendor/lv2/worker/worker.h b/plugins/lv2/vendor/lv2/worker/worker.h deleted file mode 100644 index 0b0e792b5..000000000 --- a/plugins/lv2/vendor/lv2/worker/worker.h +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2012-2016 David Robillard -// SPDX-License-Identifier: ISC - -#ifndef LV2_WORKER_H -#define LV2_WORKER_H - -/** - @defgroup worker Worker - @ingroup lv2 - - Support for non-realtime plugin operations. - - See for details. - - @{ -*/ - -#include "lv2/core/lv2.h" - -#include - -// clang-format off - -#define LV2_WORKER_URI "http://lv2plug.in/ns/ext/worker" ///< http://lv2plug.in/ns/ext/worker -#define LV2_WORKER_PREFIX LV2_WORKER_URI "#" ///< http://lv2plug.in/ns/ext/worker# - -#define LV2_WORKER__interface LV2_WORKER_PREFIX "interface" ///< http://lv2plug.in/ns/ext/worker#interface -#define LV2_WORKER__schedule LV2_WORKER_PREFIX "schedule" ///< http://lv2plug.in/ns/ext/worker#schedule - -// clang-format on - -#ifdef __cplusplus -extern "C" { -#endif - -/** - Status code for worker functions. -*/ -typedef enum { - LV2_WORKER_SUCCESS = 0, /**< Completed successfully. */ - LV2_WORKER_ERR_UNKNOWN = 1, /**< Unknown error. */ - LV2_WORKER_ERR_NO_SPACE = 2 /**< Failed due to lack of space. */ -} LV2_Worker_Status; - -/** Opaque handle for LV2_Worker_Interface::work(). */ -typedef void* LV2_Worker_Respond_Handle; - -/** - A function to respond to run() from the worker method. - - The `data` MUST be safe for the host to copy and later pass to - work_response(), and the host MUST guarantee that it will be eventually - passed to work_response() if this function returns LV2_WORKER_SUCCESS. -*/ -typedef LV2_Worker_Status (*LV2_Worker_Respond_Function)( - LV2_Worker_Respond_Handle handle, - uint32_t size, - const void* data); - -/** - Plugin Worker Interface. - - This is the interface provided by the plugin to implement a worker method. - The plugin's extension_data() method should return an LV2_Worker_Interface - when called with LV2_WORKER__interface as its argument. -*/ -typedef struct { - /** - The worker method. This is called by the host in a non-realtime context - as requested, possibly with an arbitrary message to handle. - - A response can be sent to run() using `respond`. The plugin MUST NOT - make any assumptions about which thread calls this method, except that - there are no real-time requirements and only one call may be executed at - a time. That is, the host MAY call this method from any non-real-time - thread, but MUST NOT make concurrent calls to this method from several - threads. - - @param instance The LV2 instance this is a method on. - @param respond A function for sending a response to run(). - @param handle Must be passed to `respond` if it is called. - @param size The size of `data`. - @param data Data from run(), or NULL. - */ - LV2_Worker_Status (*work)(LV2_Handle instance, - LV2_Worker_Respond_Function respond, - LV2_Worker_Respond_Handle handle, - uint32_t size, - const void* data); - - /** - Handle a response from the worker. This is called by the host in the - run() context when a response from the worker is ready. - - @param instance The LV2 instance this is a method on. - @param size The size of `body`. - @param body Message body, or NULL. - */ - LV2_Worker_Status (*work_response)(LV2_Handle instance, - uint32_t size, - const void* body); - - /** - Called when all responses for this cycle have been delivered. - - Since work_response() may be called after run() finished, this provides - a hook for code that must run after the cycle is completed. - - This field may be NULL if the plugin has no use for it. Otherwise, the - host MUST call it after every run(), regardless of whether or not any - responses were sent that cycle. - */ - LV2_Worker_Status (*end_run)(LV2_Handle instance); -} LV2_Worker_Interface; - -/** Opaque handle for LV2_Worker_Schedule. */ -typedef void* LV2_Worker_Schedule_Handle; - -/** - Schedule Worker Host Feature. - - The host passes this feature to provide a schedule_work() function, which - the plugin can use to schedule a worker call from run(). -*/ -typedef struct { - /** - Opaque host data. - */ - LV2_Worker_Schedule_Handle handle; - - /** - Request from run() that the host call the worker. - - This function is in the audio threading class. It should be called from - run() to request that the host call the work() method in a non-realtime - context with the given arguments. - - This function is always safe to call from run(), but it is not - guaranteed that the worker is actually called from a different thread. - In particular, when free-wheeling (for example, during offline - rendering), the worker may be executed immediately. This allows - single-threaded processing with sample accuracy and avoids timing - problems when run() is executing much faster or slower than real-time. - - Plugins SHOULD be written in such a way that if the worker runs - immediately, and responses from the worker are delivered immediately, - the effect of the work takes place immediately with sample accuracy. - - The `data` MUST be safe for the host to copy and later pass to work(), - and the host MUST guarantee that it will be eventually passed to work() - if this function returns LV2_WORKER_SUCCESS. - - @param handle The handle field of this struct. - @param size The size of `data`. - @param data Message to pass to work(), or NULL. - */ - LV2_Worker_Status (*schedule_work)(LV2_Worker_Schedule_Handle handle, - uint32_t size, - const void* data); -} LV2_Worker_Schedule; - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -/** - @} -*/ - -#endif /* LV2_WORKER_H */ diff --git a/plugins/lv2/vstgui_helpers.cpp b/plugins/lv2/vstgui_helpers.cpp deleted file mode 100644 index 02a2b4dce..000000000 --- a/plugins/lv2/vstgui_helpers.cpp +++ /dev/null @@ -1,246 +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 - -// Note(jpc) same code as used in Surge LV2, I am the original author - -#include "vstgui_helpers.h" -#include -#include -#include -#include -#include -#if LINUX -#include -#include -#endif -#if WINDOWS -#include -#endif -#if MAC -#include "vstgui/plugin-bindings/getpluginbundle.h" -#endif -#include "vstgui/lib/vstguiinit.h" - -#if LINUX -void Lv2IdleRunLoop::execIdle() -{ - std::chrono::steady_clock::time_point tick = std::chrono::steady_clock::now(); - - for (Event& ev : _events) - { - if (!ev.alive) - continue; - -// TODO LV2: fix me, XCB descriptor polling not working at this point -#if 0 - pollfd pfd = {}; - pfd.fd = ev.fd; - pfd.events = POLLIN|POLLERR|POLLHUP; - if (poll(&pfd, 1, 0) > 0) -#endif - { - ev.handler->onEvent(); - } - } - - for (Timer& tm : _timers) - { - if (!tm.alive) - continue; - - if (tm.lastTickValid) - { - std::chrono::steady_clock::duration duration = tick - tm.lastTick; - tm.counter += std::chrono::duration_cast(duration); - if (tm.counter >= tm.interval) - { - tm.handler->onTimer(); - tm.counter = std::min(tm.counter - tm.interval, tm.interval); - } - } - tm.lastTick = tick; - tm.lastTickValid = true; - } - - garbageCollectDeadHandlers(_events); - garbageCollectDeadHandlers(_timers); -} - -bool Lv2IdleRunLoop::registerEventHandler(int fd, VSTGUI::X11::IEventHandler* handler) -{ - // fprintf(stderr, "registerEventHandler %d %p\n", fd, handler); - - Event ev; - ev.fd = fd; - ev.handler = handler; - ev.alive = true; - _events.push_back(ev); - - return true; -} - -bool Lv2IdleRunLoop::unregisterEventHandler(VSTGUI::X11::IEventHandler* handler) -{ - // fprintf(stderr, "unregisterEventHandler %p\n", handler); - - auto it = std::find_if(_events.begin(), _events.end(), [handler](const Event& ev) -> bool { - return ev.handler == handler && ev.alive; - }); - - if (it != _events.end()) - it->alive = false; - - return true; -} - -bool Lv2IdleRunLoop::registerTimer(uint64_t interval, VSTGUI::X11::ITimerHandler* handler) -{ - // fprintf(stderr, "registerTimer %lu %p\n", interval, handler); - - Timer tm; - tm.interval = std::chrono::milliseconds(interval); - tm.counter = std::chrono::microseconds(0); - tm.lastTickValid = false; - tm.handler = handler; - tm.alive = true; - _timers.push_back(tm); - - return true; -} - -bool Lv2IdleRunLoop::unregisterTimer(VSTGUI::X11::ITimerHandler* handler) -{ - // fprintf(stderr, "unregisterTimer %p\n", handler); - - auto it = std::find_if(_timers.begin(), _timers.end(), [handler](const Timer& tm) -> bool { - return tm.handler == handler && tm.alive; - }); - - if (it != _timers.end()) - it->alive = false; - - return true; -} - -template void Lv2IdleRunLoop::garbageCollectDeadHandlers(std::list& handlers) -{ - auto pos = handlers.begin(); - auto end = handlers.end(); - - while (pos != end) - { - auto curPos = pos++; - if (!curPos->alive) - handlers.erase(curPos); - } -} -#endif - -/// -#if LINUX -namespace VSTGUI -{ -void* soHandle = nullptr; - -static volatile size_t soHandleCount = 0; -static std::mutex soHandleMutex; - -SoHandleInitializer::SoHandleInitializer() -{ - std::lock_guard lock(soHandleMutex); - if (soHandleCount++ == 0) { - Dl_info info; - if (dladdr((void*)&lv2ui_descriptor, &info)) - soHandle = dlopen(info.dli_fname, RTLD_LAZY); - if (!soHandle) - throw std::runtime_error("SoHandleInitializer"); - } -} - -SoHandleInitializer::~SoHandleInitializer() -{ - std::lock_guard lock(soHandleMutex); - if (--soHandleCount == 0) { - dlclose(soHandle); - soHandle = nullptr; - } -} - -} // namespace VSTGUI -#endif - -/// -#if WINDOWS -void* hInstance = nullptr; - -__declspec(dllexport) -BOOL WINAPI DllMain(HINSTANCE dllInstance, DWORD reason, LPVOID) -{ - if (reason == DLL_PROCESS_ATTACH) - hInstance = dllInstance; - return TRUE; -} -#endif - -/// -#if MAC -namespace VSTGUI -{ -void* gBundleRef = nullptr; - -static volatile size_t gBundleRefCount = 0; -static std::mutex gBundleRefMutex; - -BundleRefInitializer::BundleRefInitializer() -{ - std::lock_guard lock(gBundleRefMutex); - if (gBundleRefCount++ == 0) { - gBundleRef = GetPluginBundle(); - if (!gBundleRef) - throw std::runtime_error("BundleRefInitializer"); - } -} - -BundleRefInitializer::~BundleRefInitializer() -{ - std::lock_guard lock(gBundleRefMutex); - if (--gBundleRefCount == 0) { - CFRelease((CFBundleRef)gBundleRef); - gBundleRef = nullptr; - } -} - -} // namespace VSTGUI -#endif - -namespace VSTGUI { - -static volatile size_t gVstguiInitCount = 0; -static std::mutex gVstguiInitMutex; - -VSTGUIInitializer::VSTGUIInitializer() -{ - std::lock_guard lock(gVstguiInitMutex); - if (gVstguiInitCount++ == 0) { -#if WINDOWS - VSTGUI::init((HINSTANCE)hInstance); -#elif MAC - VSTGUI::init((CFBundleRef)gBundleRef); -#else - VSTGUI::init(soHandle); -#endif - } -} - -VSTGUIInitializer::~VSTGUIInitializer() -{ - std::lock_guard lock(gVstguiInitMutex); - if (--gVstguiInitCount == 0) { - VSTGUI::exit(); - } -} - -} // namespace VSTGUI diff --git a/plugins/lv2/vstgui_helpers.h b/plugins/lv2/vstgui_helpers.h deleted file mode 100644 index 165ee45e7..000000000 --- a/plugins/lv2/vstgui_helpers.h +++ /dev/null @@ -1,101 +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 - -// Note(jpc) same code as used in Surge LV2, I am the original author - -#pragma once -#include -#include - -#include "editor/utility/vstgui_before.h" -#include "vstgui/lib/vstguibase.h" -#if LINUX -#include "vstgui/lib/platform/platform_x11.h" -#include "vstgui/lib/platform/linux/x11platform.h" -#endif -#include "editor/utility/vstgui_after.h" - -#if LINUX -class Lv2IdleRunLoop : public VSTGUI::X11::IRunLoop -{ -public: - void execIdle(); - - bool registerEventHandler(int fd, VSTGUI::X11::IEventHandler* handler) override; - bool unregisterEventHandler(VSTGUI::X11::IEventHandler* handler) override; - bool registerTimer(uint64_t interval, VSTGUI::X11::ITimerHandler* handler) override; - bool unregisterTimer(VSTGUI::X11::ITimerHandler* handler) override; - - void forget() override - {} - void remember() override - {} - -private: - struct Event - { - int fd; - VSTGUI::X11::IEventHandler* handler; - bool alive; - }; - struct Timer - { - std::chrono::microseconds interval; - std::chrono::microseconds counter; - bool lastTickValid; - std::chrono::steady_clock::time_point lastTick; - VSTGUI::X11::ITimerHandler* handler; - bool alive; - }; - -private: - template static void garbageCollectDeadHandlers(std::list& handlers); - -private: - std::list _events; - std::list _timers; -}; -#endif - -#if LINUX -namespace VSTGUI -{ -class SoHandleInitializer { -public: - SoHandleInitializer(); - ~SoHandleInitializer(); -private: - SoHandleInitializer(const SoHandleInitializer&) = delete; - SoHandleInitializer& operator=(const SoHandleInitializer&) = delete; -}; -} -#endif - -#if MAC -namespace VSTGUI -{ -class BundleRefInitializer { -public: - BundleRefInitializer(); - ~BundleRefInitializer(); -private: - BundleRefInitializer(const BundleRefInitializer&) = delete; - BundleRefInitializer& operator=(const BundleRefInitializer&) = delete; -}; -} -#endif - -namespace VSTGUI -{ -class VSTGUIInitializer { -public: - VSTGUIInitializer(); - ~VSTGUIInitializer(); -private: - VSTGUIInitializer(const VSTGUIInitializer&) = delete; - VSTGUIInitializer& operator=(const VSTGUIInitializer&) = delete; -}; -} diff --git a/plugins/puredata/CMakeLists.txt b/plugins/puredata/CMakeLists.txt deleted file mode 100644 index c8c6fd1f6..000000000 --- a/plugins/puredata/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -# Puredata plugin specific settings -include(PuredataConfig) - -set(PUREDATA_BINARY_DIR "${PROJECT_BINARY_DIR}/pd/sfizz") - -set(PUREDATA_RESOURCES - "sfizz~-help.pd" - "example.sfz") - -function(copy_puredata_resources TARGET SOURCE_DIR DESTINATION_DIR) - set(_deps) - foreach(res ${PUREDATA_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}_puredata_resources" DEPENDS ${_deps}) - add_dependencies("${TARGET}" "${TARGET}_puredata_resources") -endfunction() - -add_pd_external(sfizz_puredata "sfizz_puredata.c") -target_compile_definitions(sfizz_puredata PRIVATE - "SFIZZ_NUM_CCS=${SFIZZ_NUM_CCS}" - "SFIZZ_VERSION=\"${CMAKE_PROJECT_VERSION}\"") -target_link_libraries(sfizz_puredata PRIVATE sfizz::import sfizz::sfizz) - -set_target_properties(sfizz_puredata PROPERTIES - OUTPUT_NAME "sfizz" - LIBRARY_OUTPUT_DIRECTORY "${PUREDATA_BINARY_DIR}/$<0:>") - -if(MINGW) - set_property(TARGET sfizz_puredata APPEND_STRING - PROPERTY LINK_FLAGS " -static") -endif() - -# Git build identifier -target_link_libraries(sfizz_puredata PRIVATE sfizz-git-build-id) - -# Copy resources -copy_puredata_resources(sfizz_puredata - "${CMAKE_CURRENT_SOURCE_DIR}" - "${PUREDATA_BINARY_DIR}") - -# Installation -if(NOT MSVC) - install(DIRECTORY "${PUREDATA_BINARY_DIR}" DESTINATION "${PDPLUGIN_INSTALL_DIR}" - COMPONENT "puredata" - USE_SOURCE_PERMISSIONS) - bundle_dylibs(puredata - "${PDPLUGIN_INSTALL_DIR}/sfizz/sfizz${PUREDATA_SUFFIX}" - COMPONENT "puredata") -endif() diff --git a/plugins/puredata/example.sfz b/plugins/puredata/example.sfz deleted file mode 100644 index 6e64db979..000000000 --- a/plugins/puredata/example.sfz +++ /dev/null @@ -1,22 +0,0 @@ - -ampeg_attack=0.25 -ampeg_decay=5 -ampeg_sustain=50 -ampeg_release=2 -fil_type=lpf_4p -resonance=3 -cutoff=3000 -oscillator_phase=-1 -cutoff_oncc300=3600 -cutoff_curvecc300=1 - - -sample=*saw -oscillator_multi=3 -oscillator_detune=10 -lfo1_freq=5 -lfo1_pitch=30 - - -sample=*triangle -transpose=-12 diff --git a/plugins/puredata/external/pd/LICENSE.txt b/plugins/puredata/external/pd/LICENSE.txt deleted file mode 100644 index a56a51eb5..000000000 --- a/plugins/puredata/external/pd/LICENSE.txt +++ /dev/null @@ -1,30 +0,0 @@ -This software is copyrighted by Miller Puckette and others. The following -terms (the "Standard Improved BSD License") apply to all files associated with -the software unless explicitly disclaimed in individual files: - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. -3. The name of the author may not be used to endorse or promote - products derived from this software without specific prior - written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. diff --git a/plugins/puredata/external/pd/bin/pd.def b/plugins/puredata/external/pd/bin/pd.def deleted file mode 100644 index 607bd9905..000000000 --- a/plugins/puredata/external/pd/bin/pd.def +++ /dev/null @@ -1,601 +0,0 @@ -LIBRARY pd -EXPORTS - ABORT - array_free - array_getcoordinate - array_getfields - array_new - array_redraw - array_resize - array_resize_and_redraw - atom_gensym - atom_getfloat - atom_getfloatarg - atom_getint - atom_getintarg - atom_getsymbol - atom_getsymbolarg - atom_string - audio_isopen - audio_shouldkeepopen - binbuf_add - binbuf_addbinbuf - binbuf_addsemi - binbuf_addv - binbuf_clear - binbuf_duplicate - binbuf_eval - binbuf_evalfile - binbuf_free - binbuf_getnatom - binbuf_gettext - binbuf_getvec - binbuf_new - binbuf_print - binbuf_read - binbuf_read_via_canvas - binbuf_read_via_path - binbuf_realizedollsym - binbuf_resize - binbuf_restore - binbuf_text - binbuf_write - bug - canvas_addinlet - canvas_addoutlet - canvas_class DATA - canvas_closebang - canvas_connect - canvas_create_editor - canvas_dataproperties - canvas_deletelinesfor - canvas_deletelinesforio - canvas_destroy_editor - canvas_dirty - canvas_disconnect - canvas_dspstate DATA - canvas_editmode - canvas_fixlinesfor - canvas_free - canvas_getargs - canvas_getcurrent - canvas_getcurrentdir - canvas_getdir - canvas_getdollarzero - canvas_getenv - canvas_getindex - canvas_getrootfor - canvas_hitbox - canvas_initbang - canvas_isabstraction - canvas_isconnected - canvas_istable - canvas_loadbang - canvas_makebindsym - canvas_makefilename - canvas_new - canvas_noundo - canvas_open - canvas_path_iterate - canvas_readscalar - canvas_realizedollar - canvas_redraw - canvas_redrawallfortemplate - canvas_redrawallfortemplatecanvas - canvas_rename - canvas_resortinlets - canvas_resortoutlets - canvas_restoreconnections - canvas_resume_dsp - canvas_rminlet - canvas_rmoutlet - canvas_selectinrect - canvas_setargs - canvas_setcurrent - canvas_setcursor - canvas_setdeleting - canvas_setundo - canvas_showtext - canvas_stowconnections - canvas_suspend_dsp - canvas_unsetcurrent - canvas_update_dsp - canvas_updatewindowlist - canvas_vis - canvas_whichfind DATA - canvas_writescalar - class_addanything - class_addbang - class_addcreator - class_addlist - class_addmethod - class_addpointer - class_addsymbol - class_doaddfloat - class_domainsignalin - class_gethelpdir - class_gethelpname - class_getname - class_getpropertiesfn - class_getsavefn - class_isdrawcommand - class_new - class_new64 - class_set_extern_dir - class_setdrawcommand - class_sethelpsymbol - class_setparentwidget - class_setpropertiesfn - class_setsavefn - class_setwidget - clock_delay - clock_free - clock_getlogicaltime - clock_getsystime - clock_getsystimeafter - clock_gettimesince - clock_gettimesincewithunits - clock_new - clock_set - clock_setunit - clock_unset - clone_class DATA - copy_perform - copybytes - cos_table DATA - dbtopow - dbtorms - dsp_add - dsp_add_copy - dsp_add_plus - dsp_add_scalarcopy - dsp_add_zero - dsp_addv - endpost - error - ex_Avg - ex_Sum - ex_avg - ex_funcs DATA - ex_getsym - ex_mkvector - ex_size - ex_store - ex_sum - ex_symname - fielddesc_cvtfromcoord - fielddesc_cvttocoord - fielddesc_getcoord - fielddesc_setcoord - floatinlet_new - freebytes - ftom - g_editor_freepdinstance - g_editor_newpdinstance - g_template_freepdinstance - g_template_newpdinstance - garray_class DATA - garray_getarray - garray_getfloatarray - garray_getfloatwords - garray_getglist - garray_npoints - garray_redraw - garray_resize - garray_resize_long - garray_setsaveit - garray_template - garray_usedindsp - garray_vec - gensym - get_sys_dacsr - get_sys_main_advance - get_sys_schedadvance - get_sys_schedblocksize - get_sys_sleepgrain - get_sys_soundin - get_sys_soundout - get_sys_time - get_sys_time_per_dsp_tick - getbytes - getfn - getzbytes - gfxstub_deleteforkey - gfxstub_new - glist_add - glist_addglist - glist_arraydialog - glist_clear - glist_delete - glist_deselect - glist_dpixtodx - glist_dpixtody - glist_drawiofor - glist_eraseiofor - glist_findgraph - glist_findrtext - glist_fontheight - glist_fontwidth - glist_getcanvas - glist_getfont - glist_getnextxy - glist_getzoom - glist_glist - glist_grab - glist_init - glist_isgraph - glist_isselected - glist_istoplevel - glist_isvisible - glist_mergefile - glist_noselect - glist_pixelstox - glist_pixelstoy - glist_read - glist_redraw - glist_retext - glist_select - glist_selectall - glist_sort - glist_valid DATA - glist_writetobinbuf - glist_xtopixels - glist_ytopixels - glob_evalfile - glob_initfromgui - glob_pdobject DATA - glob_quit - glob_setfilename - gobj_activate - gobj_click - gobj_delete - gobj_displace - gobj_getrect - gobj_save - gobj_select - gobj_shouldvis - gobj_vis - gpointer_check - gpointer_copy - gpointer_init - gpointer_setarray - gpointer_setglist - gpointer_unset - graph_array - gstub_cutoff - gstub_new - gtemplate_get - guiconnect_new - guiconnect_notarget - iem_fstyletoint - iem_inttofstyle - iem_inttosymargs - iem_symargstoint - iemgui_all_dollar2raute - iemgui_all_dollararg2sym - iemgui_all_loadcolors - iemgui_all_raute2dollar - iemgui_all_sym2dollararg - iemgui_clip_font - iemgui_clip_size - iemgui_color - iemgui_color_hex DATA - iemgui_delete - iemgui_delta - iemgui_dialog - iemgui_displace - iemgui_dollar2raute - iemgui_label - iemgui_label_font - iemgui_label_pos - iemgui_new_dogetname - iemgui_new_getnames - iemgui_newzoom - iemgui_pos - iemgui_properties - iemgui_raute2dollar - iemgui_receive - iemgui_save - iemgui_select - iemgui_send - iemgui_size - iemgui_verify_snd_ne_rcv - iemgui_vis - iemgui_vu_col DATA - iemgui_vu_db2i DATA - iemgui_vu_scale_str DATA - iemgui_zoom - ilog2 - inlet_free - inlet_new - inmidi_aftertouch - inmidi_byte - inmidi_controlchange - inmidi_noteon - inmidi_pitchbend - inmidi_polyaftertouch - inmidi_programchange - inmidi_realtimein - inmidi_sysex - linetraverser_next - linetraverser_skipobject - linetraverser_start - logpost - max_ex_tab - max_ex_tab_store - max_ex_var - max_ex_var_store - mayer_fft - mayer_fht - mayer_ifft - mayer_realfft - mayer_realifft - midi_getdevs - mmio_close_audio - mmio_getdevs - mmio_open_audio - mmio_reportidle - mmio_send_dacs - mtof - namelist_append - namelist_append_files - namelist_free - namelist_get - nullfn - obj_connect - obj_disconnect - obj_issignalinlet - obj_issignaloutlet - obj_list - obj_nexttraverseoutlet - obj_ninlets - obj_noutlets - obj_nsiginlets - obj_nsigoutlets - obj_saveformat - obj_siginletindex - obj_sigoutletindex - obj_starttraverseoutlet - open_via_helppath - open_via_path - outlet_anything - outlet_bang - outlet_float - outlet_free - outlet_getsymbol - outlet_list - outlet_new - outlet_pointer - outlet_setstacklim - outlet_symbol - pa_close_audio - pa_getdevs - pa_open_audio - pa_send_dacs - pd_bang - pd_bind - pd_canvasmaker DATA - pd_checkglist - pd_checkobject - pd_compatibilitylevel DATA - pd_emptylist - pd_error - pd_fft - pd_findbyclass - pd_float - pd_forwardmess - pd_free - pd_getcanvaslist - pd_getdspstate - pd_getparentwidget - pd_globallock - pd_globalunlock - pd_list - pd_maininstance DATA - pd_new - pd_newest - pd_objectmaker DATA - pd_pointer - pd_popsym - pd_pushsym - pd_symbol - pd_typedmess - pd_unbind - pd_vmess - plus_perform - pointerinlet_new - post - postatom - postfloat - poststring - powtodb - q8_rsqrt - q8_sqrt - qrsqrt - qsqrt - resample_dsp - resample_free - resample_init - resamplefrom_dsp - resampleto_dsp - resizebytes - rmstodb - rtext_activate - rtext_displace - rtext_draw - rtext_erase - rtext_free - rtext_getseltext - rtext_gettag - rtext_gettext - rtext_height - rtext_key - rtext_mouse - rtext_new - rtext_retext - rtext_select - rtext_width - s_ DATA - s__N DATA - s__X DATA - s_anything DATA - s_bang DATA - s_float DATA - s_list DATA - s_pointer DATA - s_signal DATA - s_symbol DATA - s_x DATA - s_y DATA - scalar_class DATA - scalar_getbasexy - scalar_new - scalar_redraw - sched_geteventno - sched_set_using_audio - sched_tick - signalinlet_new - socketreceiver_new - socketreceiver_read - startpost - symbolinlet_new - sys_addhist - sys_addpollfn - sys_advance_samples DATA - sys_audioapi DATA - sys_audiodevnametonumber - sys_audiodevnumbertoname - sys_bail - sys_bashfilename - sys_clearhist - sys_close - sys_close_audio - sys_close_midi - sys_closesocket - sys_debuglevel DATA - sys_decodedialog - sys_defaultfont DATA - sys_defeatrt DATA - sys_do_open_midi - sys_externalschedlib DATA - sys_fclose - sys_flags DATA - sys_font DATA - sys_fontheight - sys_fontweight DATA - sys_fontwidth - sys_fopen - sys_get_audio_apis - sys_get_audio_devs - sys_get_audio_params - sys_get_inchannels - sys_get_midi_apis - sys_get_midi_devs - sys_get_midi_params - sys_get_outchannels - sys_getblksize - sys_getmeters - sys_getrealtime - sys_getsr - sys_getversion - sys_gui - sys_guicmd DATA - sys_havegui - sys_hipriority DATA - sys_hostfontsize - sys_idlehook DATA - sys_init_fdpoll - sys_initmidiqueue - sys_isabsolutepath - sys_libdir DATA - sys_listdevs - sys_listmididevs - sys_load_lib - sys_loadpreferences - sys_lock - sys_log_error - sys_logerror - sys_microsleep - sys_midiapi DATA - sys_midibytein - sys_mididevnametonumber - sys_mididevnumbertoname - sys_midiindevlist DATA - sys_midioutdevlist DATA - sys_nearestfontsize - sys_nmidiin DATA - sys_nmidiout DATA - sys_noloadbang DATA - sys_open - sys_open_absolute - sys_open_midi - sys_ouch - sys_poll_midi - sys_pollgui - sys_pollmidiqueue - sys_pretendguibytes - sys_printhook DATA - sys_printtostderr DATA - sys_putmidibyte - sys_putmidimess - sys_queuegui - sys_register_loader - sys_reopen_audio - sys_reopen_midi - sys_reportidle - sys_rmpollfn - sys_save_audio_params - sys_savepreferences - sys_schedadvance DATA - sys_send_dacs - sys_set_audio_api - sys_set_audio_settings - sys_set_audio_settings_reopen - sys_set_audio_state - sys_set_midi_api - sys_setchsr - sys_setextrapath - sys_setmiditimediff - sys_sleepgrain DATA - sys_sockerror - sys_trylock - sys_trytoopenone - sys_unbashfilename - sys_unixerror - sys_unlock - sys_unqueuegui - sys_usestdpath DATA - sys_verbose DATA - sys_vgui - sys_zoom_open DATA - sys_zoomfontheight - sys_zoomfontwidth - template_find_field - template_findbyname - template_findcanvas - template_free - template_getfloat - template_getsymbol - template_match - template_new - template_notify - template_setfloat - template_setsymbol - text_drawborder - text_eraseborder - text_setto - text_widgetbehavior DATA - text_xpix - text_ypix - value_get - value_getfloat - value_release - value_setfloat - verbose - vinlet_class DATA - voutlet_class DATA - word_free - word_init - word_restore - zero_perform - zgetfn diff --git a/plugins/puredata/external/pd/include/m_pd.h b/plugins/puredata/external/pd/include/m_pd.h deleted file mode 100644 index 1bcbfff49..000000000 --- a/plugins/puredata/external/pd/include/m_pd.h +++ /dev/null @@ -1,911 +0,0 @@ -/* Copyright (c) 1997-1999 Miller Puckette. -* For information on usage and redistribution, and for a DISCLAIMER OF ALL -* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ - -#ifndef __m_pd_h_ - -#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) -extern "C" { -#endif - -#define PD_MAJOR_VERSION 0 -#define PD_MINOR_VERSION 51 -#define PD_BUGFIX_VERSION 4 -#define PD_TEST_VERSION "" -extern int pd_compatibilitylevel; /* e.g., 43 for pd 0.43 compatibility */ - -/* old name for "MSW" flag -- we have to take it for the sake of many old -"nmakefiles" for externs, which will define NT and not MSW */ -#if defined(NT) && !defined(MSW) -#define MSW -#endif - -/* These pragmas are only used for MSVC, not MinGW or Cygwin */ -#ifdef _MSC_VER -/* #pragma warning( disable : 4091 ) */ -#pragma warning( disable : 4305 ) /* uncast const double to float */ -#pragma warning( disable : 4244 ) /* uncast float/int conversion etc. */ -#pragma warning( disable : 4101 ) /* unused automatic variables */ -#endif /* _MSC_VER */ - - /* the external storage class is "extern" in UNIX; in MSW it's ugly. */ -#ifdef _WIN32 -#ifdef PD_INTERNAL -#define EXTERN __declspec(dllexport) extern -#else -#define EXTERN __declspec(dllimport) extern -#endif /* PD_INTERNAL */ -#else -#define EXTERN extern -#endif /* _WIN32 */ - - /* On most c compilers, you can just say "struct foo;" to declare a - structure whose elements are defined elsewhere. On MSVC, when compiling - C (but not C++) code, you have to say "extern struct foo;". So we make - a stupid macro: */ -#if defined(_MSC_VER) && !defined(_LANGUAGE_C_PLUS_PLUS) \ - && !defined(__cplusplus) -#define EXTERN_STRUCT extern struct -#else -#define EXTERN_STRUCT struct -#endif - -/* Define some attributes, specific to the compiler */ -#if defined(__GNUC__) -#define ATTRIBUTE_FORMAT_PRINTF(a, b) __attribute__ ((format (printf, a, b))) -#else -#define ATTRIBUTE_FORMAT_PRINTF(a, b) -#endif - -#if !defined(_SIZE_T) && !defined(_SIZE_T_) -#include /* just for size_t -- how lame! */ -#endif - -/* Microsoft Visual Studio is not C99, but since VS2015 has included most C99 headers: - https://docs.microsoft.com/en-us/previous-versions/hh409293(v=vs.140)#c-runtime-library - These definitions recreate stdint.h types, but only in pre-2015 Visual Studio: */ -#if defined(_MSC_VER) && _MSC_VER < 1900 -typedef signed __int8 int8_t; -typedef signed __int16 int16_t; -typedef signed __int32 int32_t; -typedef signed __int64 int64_t; -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -#else -# include -#endif - -/* for FILE, needed by sys_fopen() and sys_fclose() only */ -#include - -#define MAXPDSTRING 1000 /* use this for anything you want */ -#define MAXPDARG 5 /* max number of args we can typecheck today */ - -/* signed and unsigned integer types the size of a pointer: */ -#if !defined(PD_LONGINTTYPE) -#if defined(_WIN32) && defined(_WIN64) -#define PD_LONGINTTYPE long long -#else -#define PD_LONGINTTYPE long -#endif -#endif - -#if !defined(PD_FLOATSIZE) - /* normally, our floats (t_float, t_sample,...) are 32bit */ -# define PD_FLOATSIZE 32 -#endif - -#if PD_FLOATSIZE == 32 -# define PD_FLOATTYPE float -/* an unsigned int of the same size as FLOATTYPE: */ -# define PD_FLOATUINTTYPE uint32_t - -#elif PD_FLOATSIZE == 64 -# define PD_FLOATTYPE double -# define PD_FLOATUINTTYPE uint64_t -#else -# error invalid FLOATSIZE: must be 32 or 64 -#endif - -typedef PD_LONGINTTYPE t_int; /* pointer-size integer */ -typedef PD_FLOATTYPE t_float; /* a float type at most the same size */ -typedef PD_FLOATTYPE t_floatarg; /* float type for function calls */ - -typedef struct _symbol -{ - const char *s_name; - struct _class **s_thing; - struct _symbol *s_next; -} t_symbol; - -EXTERN_STRUCT _array; -#define t_array struct _array /* g_canvas.h */ - -/* pointers to glist and array elements go through a "stub" which sticks -around after the glist or array is freed. The stub itself is deleted when -both the glist/array is gone and the refcount is zero, ensuring that no -gpointers are pointing here. */ - -#define GP_NONE 0 /* the stub points nowhere (has been cut off) */ -#define GP_GLIST 1 /* the stub points to a glist element */ -#define GP_ARRAY 2 /* ... or array */ - -typedef struct _gstub -{ - union - { - struct _glist *gs_glist; /* glist we're in */ - struct _array *gs_array; /* array we're in */ - } gs_un; - int gs_which; /* GP_GLIST/GP_ARRAY */ - int gs_refcount; /* number of gpointers pointing here */ -} t_gstub; - -typedef struct _gpointer /* pointer to a gobj in a glist */ -{ - union - { - struct _scalar *gp_scalar; /* scalar we're in (if glist) */ - union word *gp_w; /* raw data (if array) */ - } gp_un; - int gp_valid; /* number which must match gpointee */ - t_gstub *gp_stub; /* stub which points to glist/array */ -} t_gpointer; - -typedef union word -{ - t_float w_float; - t_symbol *w_symbol; - t_gpointer *w_gpointer; - t_array *w_array; - struct _binbuf *w_binbuf; - int w_index; -} t_word; - -typedef enum -{ - A_NULL, - A_FLOAT, - A_SYMBOL, - A_POINTER, - A_SEMI, - A_COMMA, - A_DEFFLOAT, - A_DEFSYM, - A_DOLLAR, - A_DOLLSYM, - A_GIMME, - A_CANT -} t_atomtype; - -#define A_DEFSYMBOL A_DEFSYM /* better name for this */ - -typedef struct _atom -{ - t_atomtype a_type; - union word a_w; -} t_atom; - -EXTERN_STRUCT _class; -#define t_class struct _class - -EXTERN_STRUCT _outlet; -#define t_outlet struct _outlet - -EXTERN_STRUCT _inlet; -#define t_inlet struct _inlet - -EXTERN_STRUCT _binbuf; -#define t_binbuf struct _binbuf - -EXTERN_STRUCT _clock; -#define t_clock struct _clock - -EXTERN_STRUCT _outconnect; -#define t_outconnect struct _outconnect - -EXTERN_STRUCT _glist; -#define t_glist struct _glist -#define t_canvas struct _glist /* LATER lose this */ - -EXTERN_STRUCT _template; - -typedef t_class *t_pd; /* pure datum: nothing but a class pointer */ - -typedef struct _gobj /* a graphical object */ -{ - t_pd g_pd; /* pure datum header (class) */ - struct _gobj *g_next; /* next in list */ -} t_gobj; - -typedef struct _scalar /* a graphical object holding data */ -{ - t_gobj sc_gobj; /* header for graphical object */ - t_symbol *sc_template; /* template name (LATER replace with pointer) */ - t_word sc_vec[1]; /* indeterminate-length array of words */ -} t_scalar; - -typedef struct _text /* patchable object - graphical, with text */ -{ - t_gobj te_g; /* header for graphical object */ - t_binbuf *te_binbuf; /* holder for the text */ - t_outlet *te_outlet; /* linked list of outlets */ - t_inlet *te_inlet; /* linked list of inlets */ - short te_xpix; /* x&y location (within the toplevel) */ - short te_ypix; - short te_width; /* requested width in chars, 0 if auto */ - unsigned int te_type:2; /* from defs below */ -} t_text; - -#define T_TEXT 0 /* just a textual comment */ -#define T_OBJECT 1 /* a MAX style patchable object */ -#define T_MESSAGE 2 /* a MAX type message */ -#define T_ATOM 3 /* a cell to display a number or symbol */ - -#define te_pd te_g.g_pd - - /* t_object is synonym for t_text (LATER unify them) */ - -typedef struct _text t_object; - -#define ob_outlet te_outlet -#define ob_inlet te_inlet -#define ob_binbuf te_binbuf -#define ob_pd te_g.g_pd -#define ob_g te_g - -typedef void (*t_method)(void); -typedef void *(*t_newmethod)(void); - -/* in ARM 64 a varargs prototype generates a different function call sequence -from a fixed one, so in that special case we make a more restrictive -definition for t_gotfn. This will break some code in the "chaos" package -in Pd extended. (that code will run incorrectly anyhow so why not catch it -at compile time anyhow.) */ -#if defined(__APPLE__) && defined(__aarch64__) -typedef void (*t_gotfn)(void *x); -#else -typedef void (*t_gotfn)(void *x, ...); -#endif - -/* ---------------- pre-defined objects and symbols --------------*/ -EXTERN t_pd pd_objectmaker; /* factory for creating "object" boxes */ -EXTERN t_pd pd_canvasmaker; /* factory for creating canvases */ - -/* --------- prototypes from the central message system ----------- */ -EXTERN void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv); -EXTERN void pd_forwardmess(t_pd *x, int argc, t_atom *argv); -EXTERN t_symbol *gensym(const char *s); -EXTERN t_gotfn getfn(const t_pd *x, t_symbol *s); -EXTERN t_gotfn zgetfn(const t_pd *x, t_symbol *s); -EXTERN void nullfn(void); -EXTERN void pd_vmess(t_pd *x, t_symbol *s, const char *fmt, ...); - -/* the following macros are for sending non-type-checkable messages, i.e., -using function lookup but circumventing type checking on arguments. Only -use for internal messaging protected by A_CANT so that the message can't -be generated at patch level. */ -#define mess0(x, s) ((*getfn((x), (s)))((x))) -typedef void (*t_gotfn1)(void *x, void *arg1); -#define mess1(x, s, a) ((*(t_gotfn1)getfn((x), (s)))((x), (a))) -typedef void (*t_gotfn2)(void *x, void *arg1, void *arg2); -#define mess2(x, s, a,b) ((*(t_gotfn2)getfn((x), (s)))((x), (a),(b))) -typedef void (*t_gotfn3)(void *x, void *arg1, void *arg2, void *arg3); -#define mess3(x, s, a,b,c) ((*(t_gotfn3)getfn((x), (s)))((x), (a),(b),(c))) -typedef void (*t_gotfn4)(void *x, - void *arg1, void *arg2, void *arg3, void *arg4); -#define mess4(x, s, a,b,c,d) \ - ((*(t_gotfn4)getfn((x), (s)))((x), (a),(b),(c),(d))) -typedef void (*t_gotfn5)(void *x, - void *arg1, void *arg2, void *arg3, void *arg4, void *arg5); -#define mess5(x, s, a,b,c,d,e) \ - ((*(t_gotfn5)getfn((x), (s)))((x), (a),(b),(c),(d),(e))) - -EXTERN void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv); -EXTERN t_pd *pd_newest(void); - -/* --------------- memory management -------------------- */ -EXTERN void *getbytes(size_t nbytes); -EXTERN void *getzbytes(size_t nbytes); -EXTERN void *copybytes(const void *src, size_t nbytes); -EXTERN void freebytes(void *x, size_t nbytes); -EXTERN void *resizebytes(void *x, size_t oldsize, size_t newsize); - -/* -------------------- atoms ----------------------------- */ - -#define SETSEMI(atom) ((atom)->a_type = A_SEMI, (atom)->a_w.w_index = 0) -#define SETCOMMA(atom) ((atom)->a_type = A_COMMA, (atom)->a_w.w_index = 0) -#define SETPOINTER(atom, gp) ((atom)->a_type = A_POINTER, \ - (atom)->a_w.w_gpointer = (gp)) -#define SETFLOAT(atom, f) ((atom)->a_type = A_FLOAT, (atom)->a_w.w_float = (f)) -#define SETSYMBOL(atom, s) ((atom)->a_type = A_SYMBOL, \ - (atom)->a_w.w_symbol = (s)) -#define SETDOLLAR(atom, n) ((atom)->a_type = A_DOLLAR, \ - (atom)->a_w.w_index = (n)) -#define SETDOLLSYM(atom, s) ((atom)->a_type = A_DOLLSYM, \ - (atom)->a_w.w_symbol= (s)) - -EXTERN t_float atom_getfloat(const t_atom *a); -EXTERN t_int atom_getint(const t_atom *a); -EXTERN t_symbol *atom_getsymbol(const t_atom *a); -EXTERN t_symbol *atom_gensym(const t_atom *a); -EXTERN t_float atom_getfloatarg(int which, int argc, const t_atom *argv); -EXTERN t_int atom_getintarg(int which, int argc, const t_atom *argv); -EXTERN t_symbol *atom_getsymbolarg(int which, int argc, const t_atom *argv); - -EXTERN void atom_string(const t_atom *a, char *buf, unsigned int bufsize); - -/* ------------------ binbufs --------------- */ - -EXTERN t_binbuf *binbuf_new(void); -EXTERN void binbuf_free(t_binbuf *x); -EXTERN t_binbuf *binbuf_duplicate(const t_binbuf *y); - -EXTERN void binbuf_text(t_binbuf *x, const char *text, size_t size); -EXTERN void binbuf_gettext(const t_binbuf *x, char **bufp, int *lengthp); -EXTERN void binbuf_clear(t_binbuf *x); -EXTERN void binbuf_add(t_binbuf *x, int argc, const t_atom *argv); -EXTERN void binbuf_addv(t_binbuf *x, const char *fmt, ...); -EXTERN void binbuf_addbinbuf(t_binbuf *x, const t_binbuf *y); -EXTERN void binbuf_addsemi(t_binbuf *x); -EXTERN void binbuf_restore(t_binbuf *x, int argc, const t_atom *argv); -EXTERN void binbuf_print(const t_binbuf *x); -EXTERN int binbuf_getnatom(const t_binbuf *x); -EXTERN t_atom *binbuf_getvec(const t_binbuf *x); -EXTERN int binbuf_resize(t_binbuf *x, int newsize); -EXTERN void binbuf_eval(const t_binbuf *x, t_pd *target, int argc, const t_atom *argv); -EXTERN int binbuf_read(t_binbuf *b, const char *filename, const char *dirname, - int crflag); -EXTERN int binbuf_read_via_canvas(t_binbuf *b, const char *filename, const t_canvas *canvas, - int crflag); -EXTERN int binbuf_read_via_path(t_binbuf *b, const char *filename, const char *dirname, - int crflag); -EXTERN int binbuf_write(const t_binbuf *x, const char *filename, const char *dir, - int crflag); -EXTERN void binbuf_evalfile(t_symbol *name, t_symbol *dir); -EXTERN t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, const t_atom *av, - int tonew); - -/* ------------------ clocks --------------- */ - -EXTERN t_clock *clock_new(void *owner, t_method fn); -EXTERN void clock_set(t_clock *x, double systime); -EXTERN void clock_delay(t_clock *x, double delaytime); -EXTERN void clock_unset(t_clock *x); -EXTERN void clock_setunit(t_clock *x, double timeunit, int sampflag); -EXTERN double clock_getlogicaltime(void); -EXTERN double clock_getsystime(void); /* OBSOLETE; use clock_getlogicaltime() */ -EXTERN double clock_gettimesince(double prevsystime); -EXTERN double clock_gettimesincewithunits(double prevsystime, - double units, int sampflag); -EXTERN double clock_getsystimeafter(double delaytime); -EXTERN void clock_free(t_clock *x); - -/* ----------------- pure data ---------------- */ -EXTERN t_pd *pd_new(t_class *cls); -EXTERN void pd_free(t_pd *x); -EXTERN void pd_bind(t_pd *x, t_symbol *s); -EXTERN void pd_unbind(t_pd *x, t_symbol *s); -EXTERN t_pd *pd_findbyclass(t_symbol *s, const t_class *c); -EXTERN void pd_pushsym(t_pd *x); -EXTERN void pd_popsym(t_pd *x); -EXTERN void pd_bang(t_pd *x); -EXTERN void pd_pointer(t_pd *x, t_gpointer *gp); -EXTERN void pd_float(t_pd *x, t_float f); -EXTERN void pd_symbol(t_pd *x, t_symbol *s); -EXTERN void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv); -EXTERN void pd_anything(t_pd *x, t_symbol *s, int argc, t_atom *argv); -#define pd_class(x) (*(x)) - -/* ----------------- pointers ---------------- */ -EXTERN void gpointer_init(t_gpointer *gp); -EXTERN void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto); -EXTERN void gpointer_unset(t_gpointer *gp); -EXTERN int gpointer_check(const t_gpointer *gp, int headok); - -/* ----------------- patchable "objects" -------------- */ -EXTERN t_inlet *inlet_new(t_object *owner, t_pd *dest, t_symbol *s1, - t_symbol *s2); -EXTERN t_inlet *pointerinlet_new(t_object *owner, t_gpointer *gp); -EXTERN t_inlet *floatinlet_new(t_object *owner, t_float *fp); -EXTERN t_inlet *symbolinlet_new(t_object *owner, t_symbol **sp); -EXTERN t_inlet *signalinlet_new(t_object *owner, t_float f); -EXTERN void inlet_free(t_inlet *x); - -EXTERN t_outlet *outlet_new(t_object *owner, t_symbol *s); -EXTERN void outlet_bang(t_outlet *x); -EXTERN void outlet_pointer(t_outlet *x, t_gpointer *gp); -EXTERN void outlet_float(t_outlet *x, t_float f); -EXTERN void outlet_symbol(t_outlet *x, t_symbol *s); -EXTERN void outlet_list(t_outlet *x, t_symbol *s, int argc, t_atom *argv); -EXTERN void outlet_anything(t_outlet *x, t_symbol *s, int argc, t_atom *argv); -EXTERN t_symbol *outlet_getsymbol(t_outlet *x); -EXTERN void outlet_free(t_outlet *x); -EXTERN t_object *pd_checkobject(t_pd *x); - - -/* -------------------- canvases -------------- */ - -EXTERN void glob_setfilename(void *dummy, t_symbol *name, t_symbol *dir); - -EXTERN void canvas_setargs(int argc, const t_atom *argv); -EXTERN void canvas_getargs(int *argcp, t_atom **argvp); -EXTERN t_symbol *canvas_getcurrentdir(void); -EXTERN t_glist *canvas_getcurrent(void); -EXTERN void canvas_makefilename(const t_glist *c, const char *file, - char *result, int resultsize); -EXTERN t_symbol *canvas_getdir(const t_glist *x); -EXTERN char sys_font[]; /* default typeface set in s_main.c */ -EXTERN char sys_fontweight[]; /* default font weight set in s_main.c */ -EXTERN int sys_hostfontsize(int fontsize, int zoom); -EXTERN int sys_zoomfontwidth(int fontsize, int zoom, int worstcase); -EXTERN int sys_zoomfontheight(int fontsize, int zoom, int worstcase); -EXTERN int sys_fontwidth(int fontsize); -EXTERN int sys_fontheight(int fontsize); -EXTERN void canvas_dataproperties(t_glist *x, t_scalar *sc, t_binbuf *b); -EXTERN int canvas_open(const t_canvas *x, const char *name, const char *ext, - char *dirresult, char **nameresult, unsigned int size, int bin); - -/* ---------------- widget behaviors ---------------------- */ - -EXTERN_STRUCT _widgetbehavior; -#define t_widgetbehavior struct _widgetbehavior - -EXTERN_STRUCT _parentwidgetbehavior; -#define t_parentwidgetbehavior struct _parentwidgetbehavior -EXTERN const t_parentwidgetbehavior *pd_getparentwidget(t_pd *x); - -/* -------------------- classes -------------- */ - -#define CLASS_DEFAULT 0 /* flags for new classes below */ -#define CLASS_PD 1 -#define CLASS_GOBJ 2 -#define CLASS_PATCHABLE 3 -#define CLASS_NOINLET 8 - -#define CLASS_TYPEMASK 3 - -EXTERN t_class *class_new(t_symbol *name, t_newmethod newmethod, - t_method freemethod, size_t size, int flags, t_atomtype arg1, ...); - -EXTERN t_class *class_new64(t_symbol *name, t_newmethod newmethod, - t_method freemethod, size_t size, int flags, t_atomtype arg1, ...); - -EXTERN void class_free(t_class *c); - -#ifdef PDINSTANCE -EXTERN t_class *class_getfirst(void); -#endif - -EXTERN void class_addcreator(t_newmethod newmethod, t_symbol *s, - t_atomtype type1, ...); -EXTERN void class_addmethod(t_class *c, t_method fn, t_symbol *sel, - t_atomtype arg1, ...); -EXTERN void class_addbang(t_class *c, t_method fn); -EXTERN void class_addpointer(t_class *c, t_method fn); -EXTERN void class_doaddfloat(t_class *c, t_method fn); -EXTERN void class_addsymbol(t_class *c, t_method fn); -EXTERN void class_addlist(t_class *c, t_method fn); -EXTERN void class_addanything(t_class *c, t_method fn); -EXTERN void class_sethelpsymbol(t_class *c, t_symbol *s); -EXTERN void class_setwidget(t_class *c, const t_widgetbehavior *w); -EXTERN void class_setparentwidget(t_class *c, const t_parentwidgetbehavior *w); -EXTERN const char *class_getname(const t_class *c); -EXTERN const char *class_gethelpname(const t_class *c); -EXTERN const char *class_gethelpdir(const t_class *c); -EXTERN void class_setdrawcommand(t_class *c); -EXTERN int class_isdrawcommand(const t_class *c); -EXTERN void class_domainsignalin(t_class *c, int onset); -EXTERN void class_set_extern_dir(t_symbol *s); -#define CLASS_MAINSIGNALIN(c, type, field) \ - class_domainsignalin(c, (char *)(&((type *)0)->field) - (char *)0) - - /* prototype for functions to save Pd's to a binbuf */ -typedef void (*t_savefn)(t_gobj *x, t_binbuf *b); -EXTERN void class_setsavefn(t_class *c, t_savefn f); -EXTERN t_savefn class_getsavefn(const t_class *c); -EXTERN void obj_saveformat(const t_object *x, t_binbuf *bb); /* add format to bb */ - - /* prototype for functions to open properties dialogs */ -typedef void (*t_propertiesfn)(t_gobj *x, struct _glist *glist); -EXTERN void class_setpropertiesfn(t_class *c, t_propertiesfn f); -EXTERN t_propertiesfn class_getpropertiesfn(const t_class *c); - -typedef void (*t_classfreefn)(t_class *); -EXTERN void class_setfreefn(t_class *c, t_classfreefn fn); - -#ifndef PD_CLASS_DEF -#define class_addbang(x, y) class_addbang((x), (t_method)(y)) -#define class_addpointer(x, y) class_addpointer((x), (t_method)(y)) -#define class_addfloat(x, y) class_doaddfloat((x), (t_method)(y)) -#define class_addsymbol(x, y) class_addsymbol((x), (t_method)(y)) -#define class_addlist(x, y) class_addlist((x), (t_method)(y)) -#define class_addanything(x, y) class_addanything((x), (t_method)(y)) -#endif - -#if PD_FLOATSIZE == 64 -# define class_new class_new64 -#endif - -/* ------------ printing --------------------------------- */ -EXTERN void post(const char *fmt, ...); -EXTERN void startpost(const char *fmt, ...); -EXTERN void poststring(const char *s); -EXTERN void postfloat(t_floatarg f); -EXTERN void postatom(int argc, const t_atom *argv); -EXTERN void endpost(void); -EXTERN void error(const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2); -EXTERN void verbose(int level, const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(2, 3); -EXTERN void bug(const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2); -EXTERN void pd_error(const void *object, const char *fmt, ...) ATTRIBUTE_FORMAT_PRINTF(2, 3); -EXTERN void logpost(const void *object, const int level, const char *fmt, ...) - ATTRIBUTE_FORMAT_PRINTF(3, 4); - -/* ------------ system interface routines ------------------- */ -EXTERN int sys_isabsolutepath(const char *dir); -EXTERN void sys_bashfilename(const char *from, char *to); -EXTERN void sys_unbashfilename(const char *from, char *to); -EXTERN int open_via_path(const char *dir, const char *name, const char *ext, - char *dirresult, char **nameresult, unsigned int size, int bin); -EXTERN int sched_geteventno(void); -EXTERN double sys_getrealtime(void); -EXTERN int (*sys_idlehook)(void); /* hook to add idle time computation */ - -/* Win32's open()/fopen() do not handle UTF-8 filenames so we need - * these internal versions that handle UTF-8 filenames the same across - * all platforms. They are recommended for use in external - * objectclasses as well so they work with Unicode filenames on Windows */ -EXTERN int sys_open(const char *path, int oflag, ...); -EXTERN int sys_close(int fd); -EXTERN FILE *sys_fopen(const char *filename, const char *mode); -EXTERN int sys_fclose(FILE *stream); - -/* ------------ threading ------------------- */ -EXTERN void sys_lock(void); -EXTERN void sys_unlock(void); -EXTERN int sys_trylock(void); - - -/* --------------- signals ----------------------------------- */ - -typedef PD_FLOATTYPE t_sample; -typedef union _sampleint_union { - t_sample f; - PD_FLOATUINTTYPE i; -} t_sampleint_union; -#define MAXLOGSIG 32 -#define MAXSIGSIZE (1 << MAXLOGSIG) - -typedef struct _signal -{ - int s_n; /* number of points in the array */ - t_sample *s_vec; /* the array */ - t_float s_sr; /* sample rate */ - int s_refcount; /* number of times used */ - int s_isborrowed; /* whether we're going to borrow our array */ - struct _signal *s_borrowedfrom; /* signal to borrow it from */ - struct _signal *s_nextfree; /* next in freelist */ - struct _signal *s_nextused; /* next in used list */ - int s_vecsize; /* allocated size of array in points */ -} t_signal; - -typedef t_int *(*t_perfroutine)(t_int *args); - -EXTERN t_int *plus_perform(t_int *args); -EXTERN t_int *zero_perform(t_int *args); -EXTERN t_int *copy_perform(t_int *args); - -EXTERN void dsp_add_plus(t_sample *in1, t_sample *in2, t_sample *out, int n); -EXTERN void dsp_add_copy(t_sample *in, t_sample *out, int n); -EXTERN void dsp_add_scalarcopy(t_float *in, t_sample *out, int n); -EXTERN void dsp_add_zero(t_sample *out, int n); - -EXTERN int sys_getblksize(void); -EXTERN t_float sys_getsr(void); -EXTERN int sys_get_inchannels(void); -EXTERN int sys_get_outchannels(void); - -EXTERN void dsp_add(t_perfroutine f, int n, ...); -EXTERN void dsp_addv(t_perfroutine f, int n, t_int *vec); -EXTERN void pd_fft(t_float *buf, int npoints, int inverse); -EXTERN int ilog2(int n); - -EXTERN void mayer_fht(t_sample *fz, int n); -EXTERN void mayer_fft(int n, t_sample *real, t_sample *imag); -EXTERN void mayer_ifft(int n, t_sample *real, t_sample *imag); -EXTERN void mayer_realfft(int n, t_sample *real); -EXTERN void mayer_realifft(int n, t_sample *real); - -EXTERN float *cos_table; -#define LOGCOSTABSIZE 9 -#define COSTABSIZE (1<> 1) & 0x20000000)); -} - -#elif PD_FLOATSIZE == 64 - -typedef union -{ - t_float f; - unsigned int ui[2]; -}t_bigorsmall64; - -static inline int PD_BADFLOAT(t_float f) /* malformed double */ -{ - t_bigorsmall64 pun; - pun.f = f; - pun.ui[1] &= 0x7ff00000; - return((pun.ui[1] == 0) | (pun.ui[1] == 0x7ff00000)); -} - -static inline int PD_BIGORSMALL(t_float f) /* exponent outside (-512,512) */ -{ - t_bigorsmall64 pun; - pun.f = f; - return((pun.ui[1] & 0x20000000) == ((pun.ui[1] >> 1) & 0x20000000)); -} - -#endif /* PD_FLOATSIZE */ -#else /* not INTEL or ARM */ -#define PD_BADFLOAT(f) 0 -#define PD_BIGORSMALL(f) 0 -#endif - -#else /* _MSC_VER */ -#if PD_FLOATSIZE == 32 -#define PD_BADFLOAT(f) ((((*(unsigned int*)&(f))&0x7f800000)==0) || \ - (((*(unsigned int*)&(f))&0x7f800000)==0x7f800000)) -/* more stringent test: anything not between 1e-19 and 1e19 in absolute val */ -#define PD_BIGORSMALL(f) ((((*(unsigned int*)&(f))&0x60000000)==0) || \ - (((*(unsigned int*)&(f))&0x60000000)==0x60000000)) -#else /* 64 bits... don't know what to do here */ -#define PD_BADFLOAT(f) (!(((f) >= 0) || ((f) <= 0))) -#define PD_BIGORSMALL(f) ((f) > 1e150 || (f) < -1e150 \ - || (f) > -1e-150 && (f) < 1e-150 ) -#endif -#endif /* _MSC_VER */ - /* get version number at run time */ -EXTERN void sys_getversion(int *major, int *minor, int *bugfix); - -EXTERN_STRUCT _instancemidi; -#define t_instancemidi struct _instancemidi - -EXTERN_STRUCT _instanceinter; -#define t_instanceinter struct _instanceinter - -EXTERN_STRUCT _instancecanvas; -#define t_instancecanvas struct _instancecanvas - -EXTERN_STRUCT _instanceugen; -#define t_instanceugen struct _instanceugen - -EXTERN_STRUCT _instancestuff; -#define t_instancestuff struct _instancestuff - -#ifndef PDTHREADS -#define PDTHREADS 1 -#endif - -struct _pdinstance -{ - double pd_systime; /* global time in Pd ticks */ - t_clock *pd_clock_setlist; /* list of set clocks */ - t_canvas *pd_canvaslist; /* list of all root canvases */ - struct _template *pd_templatelist; /* list of all templates */ - int pd_instanceno; /* ordinal number of this instance */ - t_symbol **pd_symhash; /* symbol table hash table */ - t_instancemidi *pd_midi; /* private stuff for x_midi.c */ - t_instanceinter *pd_inter; /* private stuff for s_inter.c */ - t_instanceugen *pd_ugen; /* private stuff for d_ugen.c */ - t_instancecanvas *pd_gui; /* semi-private stuff in g_canvas.h */ - t_instancestuff *pd_stuff; /* semi-private stuff in s_stuff.h */ - t_pd *pd_newest; /* most recently created object */ -#ifdef PDINSTANCE - t_symbol pd_s_pointer; - t_symbol pd_s_float; - t_symbol pd_s_symbol; - t_symbol pd_s_bang; - t_symbol pd_s_list; - t_symbol pd_s_anything; - t_symbol pd_s_signal; - t_symbol pd_s__N; - t_symbol pd_s__X; - t_symbol pd_s_x; - t_symbol pd_s_y; - t_symbol pd_s_; -#endif -#if PDTHREADS - int pd_islocked; -#endif -}; -#define t_pdinstance struct _pdinstance -EXTERN t_pdinstance pd_maininstance; - -/* m_pd.c */ -#ifdef PDINSTANCE -EXTERN t_pdinstance *pdinstance_new(void); -EXTERN void pd_setinstance(t_pdinstance *x); -EXTERN void pdinstance_free(t_pdinstance *x); -#endif /* PDINSTANCE */ - -#if defined(PDTHREADS) && defined(PDINSTANCE) -#ifdef _MSC_VER -#define PERTHREAD __declspec(thread) -#else -#define PERTHREAD __thread -#endif /* _MSC_VER */ -#else -#define PERTHREAD -#endif - -#ifdef PDINSTANCE -extern PERTHREAD t_pdinstance *pd_this; -EXTERN t_pdinstance **pd_instances; -EXTERN int pd_ninstances; -#else -#define pd_this (&pd_maininstance) -#endif /* PDINSTANCE */ - -#ifdef PDINSTANCE -#define s_pointer (pd_this->pd_s_pointer) -#define s_float (pd_this->pd_s_float) -#define s_symbol (pd_this->pd_s_symbol) -#define s_bang (pd_this->pd_s_bang) -#define s_list (pd_this->pd_s_list) -#define s_anything (pd_this->pd_s_anything) -#define s_signal (pd_this->pd_s_signal) -#define s__N (pd_this->pd_s__N) -#define s__X (pd_this->pd_s__X) -#define s_x (pd_this->pd_s_x) -#define s_y (pd_this->pd_s_y) -#define s_ (pd_this->pd_s_) -#else -EXTERN t_symbol s_pointer, s_float, s_symbol, s_bang, s_list, s_anything, - s_signal, s__N, s__X, s_x, s_y, s_; -#endif - -EXTERN t_canvas *pd_getcanvaslist(void); -EXTERN int pd_getdspstate(void); - -/* x_text.c */ -EXTERN t_binbuf *text_getbufbyname(t_symbol *s); /* get binbuf from text obj */ -EXTERN void text_notifybyname(t_symbol *s); /* notify it was modified */ - -#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) -} -#endif - -#define __m_pd_h_ -#endif /* __m_pd_h_ */ diff --git a/plugins/puredata/sfizz_puredata.c b/plugins/puredata/sfizz_puredata.c deleted file mode 100644 index 4043b6cae..000000000 --- a/plugins/puredata/sfizz_puredata.c +++ /dev/null @@ -1,336 +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 "GitBuildId.h" -#include -#include -#include -#include -#include -#include -#include - -static t_class* cls_sfizz_tilde; - -typedef struct _sfizz_tilde { - t_object obj; - t_outlet* outputs[2]; - t_inlet* input_cc; - t_inlet* input_bend; - t_inlet* input_touch; - t_inlet* input_polytouch; - sfizz_synth_t* synth; - int midi[3]; - int midinum; - t_symbol* dir; - char* filepath; -} t_sfizz_tilde; - -static t_float clamp01(t_float x) -{ - x = (x > 0) ? x : 0; - x = (x < 1) ? x : 1; - return x; -} - -static t_float clampB1(t_float x) -{ - x = (x > -1) ? x : -1; - x = (x < 1) ? x : 1; - return x; -} - -static void sfizz_tilde_set_file(t_sfizz_tilde* self, const char* file) -{ - const char* dir = self->dir->s_name; - char* filepath; - if (file[0] != '\0') { - filepath = malloc(strlen(dir) + 1 + strlen(file) + 1); - sprintf(filepath, "%s/%s", dir, file); - } - else { - filepath = malloc(1); - *filepath = '\0'; - } - free(self->filepath); - self->filepath = filepath; -} - -static bool sfizz_tilde_do_load(t_sfizz_tilde* self) -{ - bool loaded; - if (self->filepath[0] != '\0') - loaded = sfizz_load_or_import_file(self->synth, self->filepath, NULL); - else - loaded = sfizz_load_string(self->synth, "default.sfz", "sample=*sine"); - return loaded; -} - -static void* sfizz_tilde_new(t_symbol* sym, int argc, t_atom argv[]) -{ - (void)sym; - t_sfizz_tilde* self = (t_sfizz_tilde*)pd_new(cls_sfizz_tilde); - - const char* file; - if (argc == 0) - file = ""; - else if (argc == 1 && argv[0].a_type == A_SYMBOL) - file = argv[0].a_w.w_symbol->s_name; - else { - pd_free((t_pd*)self); - return NULL; - } - - self->dir = canvas_getcurrentdir(); - - self->outputs[0] = outlet_new(&self->obj, &s_signal); - self->outputs[1] = outlet_new(&self->obj, &s_signal); - - self->input_cc = inlet_new(&self->obj, &self->obj.ob_pd, &s_float, gensym("cc")); - self->input_bend = inlet_new(&self->obj, &self->obj.ob_pd, &s_float, gensym("bend")); - self->input_touch = inlet_new(&self->obj, &self->obj.ob_pd, &s_float, gensym("touch")); - self->input_polytouch = inlet_new(&self->obj, &self->obj.ob_pd, &s_float, gensym("polytouch")); - - sfizz_synth_t* synth = sfizz_create_synth(); - self->synth = synth; - - sfizz_set_sample_rate(synth, sys_getsr()); - sfizz_set_samples_per_block(synth, sys_getblksize()); - - sfizz_tilde_set_file(self, file); - if (!sfizz_tilde_do_load(self)) { - pd_free((t_pd*)self); - return NULL; - } - - return self; -} - -static void sfizz_tilde_free(t_sfizz_tilde* self) -{ - if (self->filepath) - free(self->filepath); - if (self->synth) - sfizz_free(self->synth); - if (self->outputs[0]) - outlet_free(self->outputs[0]); - if (self->outputs[1]) - outlet_free(self->outputs[1]); - if (self->input_cc) - inlet_free(self->input_cc); - if (self->input_bend) - inlet_free(self->input_bend); - if (self->input_touch) - inlet_free(self->input_touch); - if (self->input_polytouch) - inlet_free(self->input_polytouch); -} - -static t_int* sfizz_tilde_perform(t_int* w) -{ - t_sfizz_tilde* self; - t_sample* outputs[2]; - t_int nframes; - - w++; - self = (t_sfizz_tilde*)*w++; - outputs[0] = (t_sample*)*w++; - outputs[1] = (t_sample*)*w++; - nframes = (t_int)*w++; - - sfizz_render_block(self->synth, outputs, 2, nframes); - - return w; -} - -static void sfizz_tilde_dsp(t_sfizz_tilde* self, t_signal** sp) -{ - dsp_add( - &sfizz_tilde_perform, 4, (t_int)self, - (t_int)sp[0]->s_vec, (t_int)sp[1]->s_vec, (t_int)sp[0]->s_n); -} - -static void sfizz_tilde_list(t_sfizz_tilde* self, t_symbol* sym, int argc, t_atom* argv) -{ - (void)sym; - - if (argc == 2 && argv[0].a_type == A_FLOAT && argv[1].a_type == A_FLOAT) { - int key = (int)argv[0].a_w.w_float; - if (key < 0 || key > 127) - return; - t_float vel = clamp01(argv[1].a_w.w_float / 127); - if (vel > 0) - sfizz_send_hd_note_on(self->synth, 0, key, vel); - else - sfizz_send_hd_note_off(self->synth, 0, key, 0); - } -} - -static void sfizz_tilde_midiin(t_sfizz_tilde* self, t_float f) -{ - int byte = (int)f; - bool isstatus = (byte & 0x80) != 0; - - int* midi = self->midi; - int midinum = self->midinum; - - // - if (isstatus) { - midi[0] = byte; - midinum = 1; - } - else if (midinum != -1 && midinum < 3) - midi[midinum++] = byte; - else - midinum = -1; - - // - switch (midinum) { - case 2: - switch (midi[0] & 0xf0) { - case 0xd0: // channel aftertouch - sfizz_send_channel_aftertouch(self->synth, 0, midi[1]); - break; - } - break; - case 3: - switch (midi[0] & 0xf0) { - case 0x90: // note on - if (midi[2] == 0) - goto noteoff; - sfizz_send_note_on(self->synth, 0, midi[1], midi[2]); - break; - case 0x80: // note off - noteoff: - sfizz_send_note_off(self->synth, 0, midi[1], midi[2]); - break; - case 0xb0: // controller - sfizz_send_cc(self->synth, 0, midi[1], midi[2]); - break; - case 0xa0: // key aftertouch - sfizz_send_poly_aftertouch(self->synth, 0, midi[1], midi[2]); - break; - case 0xe0: // pitch bend - sfizz_send_pitch_wheel(self->synth, 0, (midi[1] + (midi[2] << 7)) - 8192); - break; - } - break; - } - - self->midinum = midinum; -} - -static void sfizz_tilde_load(t_sfizz_tilde* self, t_symbol* sym) -{ - sfizz_tilde_set_file(self, sym->s_name); - sfizz_tilde_do_load(self); -} - -static void sfizz_tilde_reload(t_sfizz_tilde* self, t_float value) -{ - (void)value; - sfizz_tilde_do_load(self); -} - -static void sfizz_tilde_hdcc(t_sfizz_tilde* self, t_float f1, t_float f2) -{ - int cc = (int)f1; - if (cc < 0 || cc >= SFIZZ_NUM_CCS) - return; - sfizz_automate_hdcc(self->synth, 0, (int)cc, clamp01(f2)); -} - -static void sfizz_tilde_cc(t_sfizz_tilde* self, t_float f1, t_float f2) -{ - sfizz_tilde_hdcc(self, f1, f2 / 127); -} - -static void sfizz_tilde_hdbend(t_sfizz_tilde* self, t_float f1) -{ - sfizz_send_hd_pitch_wheel(self->synth, 0, clampB1(f1)); -} - -static void sfizz_tilde_bend(t_sfizz_tilde* self, t_float f1) -{ - return sfizz_tilde_hdbend(self, f1 / 8191); -} - -static void sfizz_tilde_hdtouch(t_sfizz_tilde* self, t_float f1) -{ - sfizz_send_hd_channel_aftertouch(self->synth, 0, clamp01(f1)); -} - -static void sfizz_tilde_touch(t_sfizz_tilde* self, t_float f1) -{ - sfizz_tilde_hdtouch(self, f1 / 127); -} - -static void sfizz_tilde_hdpolytouch(t_sfizz_tilde* self, t_float key, t_float f2) -{ - if (key < 0 || key > 127) - return; - sfizz_send_hd_poly_aftertouch(self->synth, 0, (int)key, clamp01(f2)); -} - -static void sfizz_tilde_polytouch(t_sfizz_tilde* self, t_float f1, t_float f2) -{ - sfizz_tilde_hdpolytouch(self, f1, f2 / 127); -} - -static void sfizz_tilde_voices(t_sfizz_tilde* self, t_float f1) -{ - int numvoices = (int)f1; - numvoices = (numvoices < 1) ? 1 : numvoices; - sfizz_set_num_voices(self->synth, numvoices); -} - -#if defined(_WIN32) -__declspec(dllexport) -#else -__attribute__((visibility("default"))) -#endif -void sfizz_setup() -{ - if (GitBuildId[0]) - post("sfizz external for Puredata, version '%s.%s'", SFIZZ_VERSION, GitBuildId); - else - post("sfizz external for Puredata, version '%s'", SFIZZ_VERSION); - - cls_sfizz_tilde = class_new( - gensym("sfizz~"), - (t_newmethod)&sfizz_tilde_new, - (t_method)&sfizz_tilde_free, - sizeof(t_sfizz_tilde), - CLASS_DEFAULT, A_GIMME, A_NULL); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_dsp, gensym("dsp"), A_CANT, A_NULL); - class_addlist( - cls_sfizz_tilde, (t_method)&sfizz_tilde_list); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_midiin, &s_float, A_FLOAT, A_NULL); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_load, gensym("load"), A_DEFSYM, A_NULL); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_reload, gensym("reload"), A_DEFFLOAT, A_NULL); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_cc, gensym("cc"), A_FLOAT, A_FLOAT, A_NULL); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_hdcc, gensym("hdcc"), A_FLOAT, A_FLOAT, A_NULL); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_bend, gensym("bend"), A_FLOAT, A_NULL); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_hdbend, gensym("hdbend"), A_FLOAT, A_NULL); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_touch, gensym("touch"), A_FLOAT, A_NULL); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_hdtouch, gensym("hdtouch"), A_FLOAT, A_NULL); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_polytouch, gensym("polytouch"), A_FLOAT, A_FLOAT, A_NULL); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_hdpolytouch, gensym("hdpolytouch"), A_FLOAT, A_FLOAT, A_NULL); - class_addmethod( - cls_sfizz_tilde, (t_method)&sfizz_tilde_voices, gensym("voices"), A_FLOAT, A_NULL); -} diff --git a/plugins/puredata/sfizz~-help.pd b/plugins/puredata/sfizz~-help.pd deleted file mode 100644 index c3024d327..000000000 --- a/plugins/puredata/sfizz~-help.pd +++ /dev/null @@ -1,60 +0,0 @@ -#N canvas 614 464 709 426 12; -#X declare -lib sfizz; -#X obj 4 3 cnv 15 700 80 empty empty sfizz 20 30 0 40 -261682 -66577 -0; -#X text 45 54 A synthesizer for instruments in SFZ format; -#X text 33 167 create a SFZ instrument; -#X obj 26 323 midiin; -#X text 23 300 connect MIDI-in; -#X obj 162 223 dac~; -#X msg 177 345 voices \$1; -#X text 175 301 modify the polyphony; -#X obj 376 326 hsl 127 15 0 1 0 1 empty empty empty -2 -8 0 10 -262144 --1 -1 6300 1; -#X floatatom 466 346 5 0 0 0 - - -; -#X text 372 302 modulate a parameter; -#X msg 373 346 hdcc 300 \$1; -#X obj 27 115 declare -lib sfizz; -#X obj 163 192 sfizz~ example.sfz; -#X text 18 93 load the sfizz library; -#X msg 221 115 \; pd dsp 1; -#X text 218 94 click to turn on DSP; -#X text 153 247 output stereo audio; -#X msg 398 223 reload; -#X msg 498 223 load example.sfz; -#X text 396 200 reload the instrument or load another; -#X obj 241 165 r \$0-input; -#X obj 26 348 s \$0-input; -#X obj 177 370 s \$0-input; -#X obj 373 371 s \$0-input; -#X obj 398 248 s \$0-input; -#X obj 498 248 s \$0-input; -#X obj 177 326 nbx 5 14 1 256 0 1 empty empty empty 0 -8 0 10 -262144 --1 -1 64 256; -#X text 567 302 send a note; -#X obj 568 348 makenote 100 500; -#X obj 568 373 list; -#X obj 568 398 s \$0-input; -#X msg 568 323 60; -#X obj 386 92 cnv 15 300 100 empty empty Inlets 20 12 0 14 -233017 --66577 0; -#X text 395 140 3: pitch bend; -#X text 395 154 4: channel aftertouch; -#X text 395 168 5: polyphonic aftertouch and key; -#X text 395 126 2: controller and value; -#X text 395 112 1: note and velocity; -#X connect 3 0 22 0; -#X connect 6 0 23 0; -#X connect 8 0 11 0; -#X connect 8 0 9 0; -#X connect 11 0 24 0; -#X connect 13 0 5 0; -#X connect 13 1 5 1; -#X connect 18 0 25 0; -#X connect 19 0 26 0; -#X connect 21 0 13 0; -#X connect 27 0 6 0; -#X connect 29 0 30 0; -#X connect 29 1 30 1; -#X connect 30 0 31 0; -#X connect 32 0 29 0; diff --git a/plugins/vst/CMakeLists.txt b/plugins/vst/CMakeLists.txt deleted file mode 100644 index c7025cd2f..000000000 --- a/plugins/vst/CMakeLists.txt +++ /dev/null @@ -1,376 +0,0 @@ -if(SFIZZ_USE_SYSTEM_VST3SDK) - find_package(PkgConfig REQUIRED) - pkg_check_modules(VST3SDK "vst3sdk" REQUIRED) - set(VST3SDK_BASEDIR "${VST3SDK_INCLUDE_DIRS}") -else() - set(VST3SDK_BASEDIR "${CMAKE_CURRENT_SOURCE_DIR}/external/VST_SDK/VST3_SDK") -endif() - -#set(AUWRAPPER_BASEDIR "${VST3SDK_BASEDIR}/public.sdk/source/vst/auwrapper") -set(AUWRAPPER_BASEDIR "${CMAKE_CURRENT_SOURCE_DIR}/external/sfzt_auwrapper") - -# VST plugin specific settings -include(VSTConfig) - -configure_file(VstPluginDefs.h.in "${CMAKE_CURRENT_BINARY_DIR}/VstPluginDefs.h") - -# Build VST3 SDK -include("cmake/Vst3.cmake") - -# Add the ring buffer -set(RINGBUFFER_HEADERS - "external/ring_buffer/ring_buffer/ring_buffer.h" - "external/ring_buffer/ring_buffer/ring_buffer.tcc") -add_library(sfizz-ring-buffer STATIC EXCLUDE_FROM_ALL - "external/ring_buffer/ring_buffer/ring_buffer.cpp" - ${RINGBUFFER_HEADERS}) -source_group("Header Files" FILES ${RINGBUFFER_HEADERS}) -target_include_directories(sfizz-ring-buffer PUBLIC "external/ring_buffer") -add_library(sfizz::ring-buffer ALIAS sfizz-ring-buffer) - -# Build the VST shared code -add_library(sfizz-vst3-core STATIC EXCLUDE_FROM_ALL - SfizzVstProcessor.cpp - SfizzVstProcessor.h - SfizzVstController.cpp - SfizzVstController.h - SfizzVstEditor.cpp - SfizzVstEditor.h - SfizzVstState.cpp - SfizzVstState.h - SfizzVstParameters.h - SfizzVstUpdates.h - SfizzVstUpdates.hpp - SfizzVstUpdates.cpp - SfizzVstIDs.h - OrderedEventProcessor.h - OrderedEventProcessor.hpp - IdleUpdateHandler.h - X11RunLoop.h - X11RunLoop.cpp) -target_include_directories(sfizz-vst3-core - PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") -target_link_libraries(sfizz-vst3-core - PRIVATE sfizz::sfizz - PRIVATE sfizz::import - PRIVATE sfizz::editor - PRIVATE sfizz::plugins-common - PRIVATE sfizz::pugixml sfizz::filesystem - PRIVATE sfizz::ring-buffer - PRIVATE absl::strings absl::optional absl::container_common - vst3sdk - vst3sdk_vstgui) -gw_target_warn(sfizz-vst3-core PRIVATE - "-Wno-ignored-qualifiers" - "-Wno-unused-parameter") -add_library(sfizz::vst3-core ALIAS sfizz-vst3-core) - -# --- VST3 plugin --- # - -if(SFIZZ_VST) - set(VSTPLUGIN_PRJ_NAME "${PROJECT_NAME}_vst3") - set(VSTPLUGIN_BUNDLE_NAME "${PROJECT_NAME}.vst3") - - add_library(${VSTPLUGIN_PRJ_NAME} MODULE "VstPluginFactory.cpp") - if(WIN32) - target_sources(${VSTPLUGIN_PRJ_NAME} PRIVATE vst3.def) - endif() - target_include_directories(${VSTPLUGIN_PRJ_NAME} - PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") - target_link_libraries(${VSTPLUGIN_PRJ_NAME} - PRIVATE sfizz-vst3-core) - set_target_properties(${VSTPLUGIN_PRJ_NAME} PROPERTIES - OUTPUT_NAME "${PROJECT_NAME}" - PREFIX "") - - plugin_add_vst3sdk(${VSTPLUGIN_PRJ_NAME}) - plugin_add_vstgui(${VSTPLUGIN_PRJ_NAME}) - - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - target_link_libraries(${VSTPLUGIN_PRJ_NAME} PRIVATE - "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/vst3.version") - endif() - sfizz_enable_lto_if_needed(${VSTPLUGIN_PRJ_NAME}) - if(MINGW) - set_target_properties(${VSTPLUGIN_PRJ_NAME} PROPERTIES LINK_FLAGS "-static") - endif() - - # Create the bundle(see "VST 3 Locations / Format") - execute_process( - COMMAND "${CMAKE_COMMAND}" -E make_directory "${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/Resources") - copy_editor_resources( - ${VSTPLUGIN_PRJ_NAME} - "${CMAKE_CURRENT_SOURCE_DIR}/../editor/resources" - "${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/Resources") - if(WIN32) - set_target_properties(${VSTPLUGIN_PRJ_NAME} PROPERTIES - SUFFIX ".vst3" - LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/${VST3_PACKAGE_ARCHITECTURE}-win/$<0:>") - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/win/Plugin.ico" - "${CMAKE_CURRENT_SOURCE_DIR}/win/desktop.ini" - DESTINATION "${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}") - elseif(APPLE) - set_target_properties(${VSTPLUGIN_PRJ_NAME} PROPERTIES - SUFFIX "" - LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/MacOS/$<0:>") - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/mac/PkgInfo" - DESTINATION "${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents") - set(SFIZZ_VST3_BUNDLE_EXECUTABLE "${PROJECT_NAME}") - set(SFIZZ_VST3_BUNDLE_VERSION "${PROJECT_VERSION}") - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.vst3.plist" - "${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/Info.plist" @ONLY) - else() - set_target_properties(${VSTPLUGIN_PRJ_NAME} PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/${VST3_PACKAGE_ARCHITECTURE}-linux/$<0:>") - endif() - - # Copy the license - if(APPLE) - # on macOS, files are not permitted at the bundle root, during code signing - file(COPY "gpl-3.0.txt" - DESTINATION "${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/SharedSupport/License") - else() - file(COPY "gpl-3.0.txt" - DESTINATION "${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}") - endif() - - # To help debugging the link only - if(FALSE) - target_link_options(${VSTPLUGIN_PRJ_NAME} PRIVATE "-Wl,-no-undefined") - endif() - - # Installation - if(NOT MSVC) - install(DIRECTORY "${PROJECT_BINARY_DIR}/${VSTPLUGIN_BUNDLE_NAME}" - DESTINATION "${VSTPLUGIN_INSTALL_DIR}" - COMPONENT "vst" - USE_SOURCE_PERMISSIONS) - bundle_dylibs(vst - "${VSTPLUGIN_INSTALL_DIR}/${VSTPLUGIN_BUNDLE_NAME}/Contents/MacOS/sfizz" - COMPONENT "vst") - endif() -endif() - -# --- Audio Unit wrapper --- # - -if(SFIZZ_AU AND NOT APPLE) - message(WARNING "Audio Unit is available only for macOS builds") -elseif(SFIZZ_AU) - set(AUPLUGIN_PRJ_NAME "${PROJECT_NAME}_au") - set(AUPLUGIN_BUNDLE_NAME "${PROJECT_NAME}.component") - - add_library(${AUPLUGIN_PRJ_NAME} MODULE - "VstPluginFactory.cpp" - "${AUWRAPPER_BASEDIR}/aucarbonview.mm" - "${AUWRAPPER_BASEDIR}/aucocoaview.mm" - "${AUWRAPPER_BASEDIR}/ausdk.mm" - "${AUWRAPPER_BASEDIR}/auwrapper.mm" - "${AUWRAPPER_BASEDIR}/NSDataIBStream.mm") - target_include_directories(${AUPLUGIN_PRJ_NAME} PRIVATE - "${CMAKE_CURRENT_BINARY_DIR}" - "${VST3SDK_BASEDIR}") - target_link_libraries(${AUPLUGIN_PRJ_NAME} PRIVATE - "${APPLE_FOUNDATION_LIBRARY}" - "${APPLE_COCOA_LIBRARY}" - "${APPLE_CARBON_LIBRARY}" - "${APPLE_AUDIOTOOLBOX_LIBRARY}" - "${APPLE_AUDIOUNIT_LIBRARY}" - "${APPLE_COREAUDIO_LIBRARY}" - "${APPLE_COREMIDI_LIBRARY}") - - target_link_libraries(${AUPLUGIN_PRJ_NAME} - PRIVATE sfizz-vst3-core) - set_target_properties(${AUPLUGIN_PRJ_NAME} PROPERTIES - OUTPUT_NAME "${PROJECT_NAME}" - PREFIX "") - - plugin_add_vst3sdk(${AUPLUGIN_PRJ_NAME}) - plugin_add_vstgui(${AUPLUGIN_PRJ_NAME}) - - # Get Core Audio utility classes if missing - set(CA_UTILITY_BASEDIR - "${CMAKE_CURRENT_SOURCE_DIR}/external/CoreAudioUtilityClasses") - if(EXISTS "${CA_UTILITY_BASEDIR}") - message(STATUS "The CoreAudioUtilityClasses are available locally") - else() - message(STATUS "The CoreAudioUtilityClasses are not available locally") - - set(CA_UTILITY_VERSION "1.1") - set(CA_UTILITY_ARCHIVE "CoreAudioUtilityClasses-${CA_UTILITY_VERSION}.tar.gz") - set(CA_UTILITY_DOWNLOAD_URL "https://github.com/sfztools/CoreAudioUtilityClasses/releases/download/v${CA_UTILITY_VERSION}/${CA_UTILITY_ARCHIVE}") - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/download/${CA_UTILITY_ARCHIVE}") - message(STATUS "The CoreAudioUtilityClasses archive is available") - else() - message(STATUS "The CoreAudioUtilityClasses archive is missing") - message(STATUS "Downloading: ${CA_UTILITY_DOWNLOAD_URL}") - - file(MAKE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/download") - file(DOWNLOAD "${CA_UTILITY_DOWNLOAD_URL}" - "${CMAKE_CURRENT_SOURCE_DIR}/download/${CA_UTILITY_ARCHIVE}") - endif() - message(STATUS "Extracting: ${CA_UTILITY_ARCHIVE}") - execute_process(COMMAND "${CMAKE_COMMAND}" "-E" "tar" "xvf" - "${CMAKE_CURRENT_SOURCE_DIR}/download/${CA_UTILITY_ARCHIVE}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external") - endif() - - # Add Core Audio utility classes - target_include_directories(${AUPLUGIN_PRJ_NAME} PRIVATE - "${CA_UTILITY_BASEDIR}/CoreAudio" - "${CA_UTILITY_BASEDIR}/CoreAudio/AudioUnits" - "${CA_UTILITY_BASEDIR}/CoreAudio/AudioUnits/AUPublic/AUBase" - "${CA_UTILITY_BASEDIR}/CoreAudio/AudioUnits/AUPublic/Utility" - "${CA_UTILITY_BASEDIR}/CoreAudio/PublicUtility") - - # Add VST hosting classes - target_link_libraries(${AUPLUGIN_PRJ_NAME} PRIVATE vst3sdk_hosting) - - # Add generated source - file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include") - target_include_directories(${AUPLUGIN_PRJ_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/include") - string(TIMESTAMP SFIZZ_AU_CLASS_PREFIX_NUMBER "%s" UTC) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/include/aucocoaclassprefix.h" - "#define SMTG_AU_NAMESPACE SMTGAUCocoa${SFIZZ_AU_CLASS_PREFIX_NUMBER}_") - - sfizz_enable_lto_if_needed(${AUPLUGIN_PRJ_NAME}) - - # Create the bundle - execute_process( - COMMAND "${CMAKE_COMMAND}" -E make_directory "${PROJECT_BINARY_DIR}/${AUPLUGIN_BUNDLE_NAME}/Contents/Resources") - copy_editor_resources( - ${AUPLUGIN_PRJ_NAME} - "${CMAKE_CURRENT_SOURCE_DIR}/../editor/resources" - "${PROJECT_BINARY_DIR}/${AUPLUGIN_BUNDLE_NAME}/Contents/Resources") - set_target_properties(${AUPLUGIN_PRJ_NAME} PROPERTIES - SUFFIX "" - LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${AUPLUGIN_BUNDLE_NAME}/Contents/MacOS/$<0:>") - file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/mac/PkgInfo" - DESTINATION "${PROJECT_BINARY_DIR}/${AUPLUGIN_BUNDLE_NAME}/Contents") - set(SFIZZ_AU_BUNDLE_EXECUTABLE "${PROJECT_NAME}") - set(SFIZZ_AU_BUNDLE_VERSION "${PROJECT_VERSION}") - set(SFIZZ_AU_BUNDLE_IDENTIFIER "tools.sfz.sfizz.au") - set(SFIZZ_AU_BUNDLE_TYPE "aumu") - set(SFIZZ_AU_BUNDLE_SUBTYPE "samp") - set(SFIZZ_AU_BUNDLE_MANUFACTURER "Sfzt") - set(SFIZZ_AU_BUNDLE_AUTHOR "SFZTools") - math(EXPR SFIZZ_AU_DECIMAL_VERSION - "${PROJECT_VERSION_MAJOR}*256*256 + ${PROJECT_VERSION_MINOR}*256 + ${PROJECT_VERSION_PATCH}") - execute_process( - COMMAND "sh" "-c" "echo 'obase=16;${SFIZZ_AU_DECIMAL_VERSION}' | bc" - OUTPUT_VARIABLE SFIZZ_AU_HEXADECIMAL_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.au.plist" - "${PROJECT_BINARY_DIR}/${AUPLUGIN_BUNDLE_NAME}/Contents/Info.plist" @ONLY) - - file(COPY "gpl-3.0.txt" - DESTINATION "${PROJECT_BINARY_DIR}/${AUPLUGIN_BUNDLE_NAME}/Contents/SharedSupport/License") - - # Add the resource fork - if(FALSE) - execute_process(COMMAND "xcrun" "--find" "Rez" - OUTPUT_VARIABLE OSX_REZ_COMMAND OUTPUT_STRIP_TRAILING_WHITESPACE) - file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include") - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mac/audiounitconfig.h.in" - "${CMAKE_CURRENT_BINARY_DIR}/include/audiounitconfig.h" @ONLY) - add_custom_command(TARGET ${AUPLUGIN_PRJ_NAME} POST_BUILD COMMAND - "${OSX_REZ_COMMAND}" - "-d" "SystemSevenOrLater=1" - "-script" "Roman" - "-d" "i386_YES" - "-d" "x86_64_YES" - "-is" "${CMAKE_OSX_SYSROOT}" - "-I" "${CMAKE_OSX_SYSROOT}/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers" - "-I" "/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Versions/A/Headers" - "-I" "/System/Library/Frameworks/AudioUnit.framework/Versions/A/Headers/" - "-I" "${CA_UTILITY_BASEDIR}/CoreAudio/AudioUnits/AUPublic/AUBase" - "-I" "${CMAKE_CURRENT_BINARY_DIR}/include" # generated audiounitconfig.h - "-o" "${PROJECT_BINARY_DIR}/${AUPLUGIN_BUNDLE_NAME}/Contents/Resources/${PROJECT_NAME}.rsrc" - "-useDF" - "${AUWRAPPER_BASEDIR}/auresource.r") - endif() - - # Installation - if(AUPLUGIN_INSTALL_DIR) - install(DIRECTORY "${PROJECT_BINARY_DIR}/${AUPLUGIN_BUNDLE_NAME}" - DESTINATION "${AUPLUGIN_INSTALL_DIR}" - COMPONENT "au" - USE_SOURCE_PERMISSIONS) - bundle_dylibs(au - "${AUPLUGIN_INSTALL_DIR}/${AUPLUGIN_BUNDLE_NAME}/Contents/MacOS/sfizz" - COMPONENT "au") - endif() -endif() - -# --- VST2 wrapper --- # - -if(SFIZZ_VST2) - set(VST2PLUGIN_PRJ_NAME "${PROJECT_NAME}_vst2") - set(VST2PLUGIN_BUNDLE_NAME "${PROJECT_NAME}.vst2") - - set(VST2SDK_BASEDIR "${CMAKE_CURRENT_SOURCE_DIR}/external/vstsdk2.4") - set(VST2WRAPPER_BASEDIR "${CMAKE_CURRENT_SOURCE_DIR}/external/VST_SDK/VST3_SDK/public.sdk/source/vst/vst2wrapper") - - if(NOT EXISTS "${VST2SDK_BASEDIR}/pluginterfaces/vst2.x/aeffect.h") - message(FATAL_ERROR "VST SDK 2.4 is missing. Make it available in the following folder: ${VST2SDK_BASEDIR}") - endif() - - add_library(${VST2PLUGIN_PRJ_NAME} MODULE - "VstPluginFactory.cpp" - "Vst2PluginFactory.cpp" - "Vst2PluginEntry.c" - "${VST2WRAPPER_BASEDIR}/vst2wrapper.cpp" - "${VST2WRAPPER_BASEDIR}/../basewrapper/basewrapper.cpp" - "${VST2SDK_BASEDIR}/public.sdk/source/vst2.x/audioeffect.cpp" - "${VST2SDK_BASEDIR}/public.sdk/source/vst2.x/audioeffectx.cpp") - target_include_directories(${VST2PLUGIN_PRJ_NAME} PRIVATE - "${CMAKE_CURRENT_BINARY_DIR}" - "${VST2SDK_BASEDIR}") - - if(NOT WIN32) - target_compile_definitions(${VST2PLUGIN_PRJ_NAME} PRIVATE "__cdecl=") - endif() - - target_link_libraries(${VST2PLUGIN_PRJ_NAME} - PRIVATE sfizz-vst3-core) - set_target_properties(${VST2PLUGIN_PRJ_NAME} PROPERTIES - OUTPUT_NAME "${PROJECT_NAME}" - PREFIX "") - - plugin_add_vst3sdk(${VST2PLUGIN_PRJ_NAME}) - plugin_add_vstgui(${VST2PLUGIN_PRJ_NAME}) - - # Add VST hosting classes - target_link_libraries(${VST2PLUGIN_PRJ_NAME} PRIVATE vst3sdk_hosting) - - sfizz_enable_lto_if_needed(${VST2PLUGIN_PRJ_NAME}) - - # Create the bundle - execute_process( - COMMAND "${CMAKE_COMMAND}" -E make_directory "${PROJECT_BINARY_DIR}/${VST2PLUGIN_BUNDLE_NAME}/Contents/Resources") - copy_editor_resources( - ${VST2PLUGIN_PRJ_NAME} - "${CMAKE_CURRENT_SOURCE_DIR}/../editor/resources" - "${PROJECT_BINARY_DIR}/${VST2PLUGIN_BUNDLE_NAME}/Contents/Resources") - set_target_properties(${VST2PLUGIN_PRJ_NAME} PROPERTIES - LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/${VST2PLUGIN_BUNDLE_NAME}/Contents/Binary/$<0:>") - - file(COPY "gpl-3.0.txt" - DESTINATION "${PROJECT_BINARY_DIR}/${VST2PLUGIN_BUNDLE_NAME}") - - if(MINGW) - set_target_properties(${VST2PLUGIN_PRJ_NAME} PROPERTIES LINK_FLAGS "-static") - endif() - - # Installation - if(VST2PLUGIN_INSTALL_DIR) - install(DIRECTORY "${PROJECT_BINARY_DIR}/${VST2PLUGIN_BUNDLE_NAME}" - DESTINATION "${VST2PLUGIN_INSTALL_DIR}" - COMPONENT "vst2" - USE_SOURCE_PERMISSIONS) - if(APPLE) - bundle_dylibs(vst2 - "${VST2PLUGIN_INSTALL_DIR}/${VST2PLUGIN_BUNDLE_NAME}/Contents/Binary/sfizz.${CMAKE_SHARED_MODULE_SUFFIX}" - COMPONENT "vst2") - endif() - endif() -endif() diff --git a/plugins/vst/IdleUpdateHandler.h b/plugins/vst/IdleUpdateHandler.h deleted file mode 100644 index 37488c9b1..000000000 --- a/plugins/vst/IdleUpdateHandler.h +++ /dev/null @@ -1,47 +0,0 @@ -// This file is part of VSTGUI. It is subject to the license terms -// in the LICENSE file found in the top-level directory of this -// distribution and at http://github.com/steinbergmedia/vstgui/LICENSE - -#pragma once -#include "base/source/updatehandler.h" -#include - -/// @cond ignore -namespace Steinberg { - -class IdleUpdateHandler -{ -public: - static void start () - { - auto& instance = get (); - if (++instance.users == 1) - { - instance.timer = VSTGUI::makeOwned ( - [] (VSTGUI::CVSTGUITimer*) { return UpdateHandler::instance ()->triggerDeferedUpdates (); }, - 1000 / 30); - } - } - - static void stop () - { - auto& instance = get (); - if (--instance.users == 0) - { - instance.timer = nullptr; - } - } - -protected: - static IdleUpdateHandler& get () - { - static IdleUpdateHandler gInstance; - return gInstance; - } - - VSTGUI::SharedPointer timer; - std::atomic users {0}; -}; - -} // namespace Steinberg -/// @endcond ignore diff --git a/plugins/vst/OrderedEventProcessor.h b/plugins/vst/OrderedEventProcessor.h deleted file mode 100644 index 4bc01f174..000000000 --- a/plugins/vst/OrderedEventProcessor.h +++ /dev/null @@ -1,37 +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 "pluginterfaces/vst/ivstevents.h" -#include "pluginterfaces/vst/ivstparameterchanges.h" -#include "pluginterfaces/vst/ivstaudioprocessor.h" -#include - -using namespace Steinberg; - -template -class OrderedEventProcessor { -public: - virtual ~OrderedEventProcessor() {} - - void initializeEventProcessor(const Vst::ProcessSetup& setup, int32 paramCount, int32 subdivSize = 128); - void processUnorderedEvents(int32 numSamples, Vst::IParameterChanges* pcs, Vst::IEventList* evs); - -private: - int32 paramCount_ { 0 }; - int32 subdivSize_ { 0 }; - struct SubdivChange { - SubdivChange(int32 offset, Vst::ParamID id, Vst::ParamValue value) - : offset(offset), id(std::move(id)), value(std::move(value)) {} - int32 offset; - Vst::ParamID id {}; - Vst::ParamValue value {}; - }; - std::vector subdivChanges_; - std::vector queuePositions_; -}; - -#include "OrderedEventProcessor.hpp" diff --git a/plugins/vst/OrderedEventProcessor.hpp b/plugins/vst/OrderedEventProcessor.hpp deleted file mode 100644 index c423d25bf..000000000 --- a/plugins/vst/OrderedEventProcessor.hpp +++ /dev/null @@ -1,103 +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 "OrderedEventProcessor.h" -#include -#include -#include - -template -void OrderedEventProcessor::initializeEventProcessor(const Vst::ProcessSetup& setup, int32 paramCount, int32 subdivSize) -{ - paramCount_ = paramCount; - subdivSize_ = subdivSize; - subdivChanges_.reserve(subdivSize * paramCount); - queuePositions_.reserve(paramCount); -} - -template -void OrderedEventProcessor::processUnorderedEvents(int32 numSamples, Vst::IParameterChanges* pcs, Vst::IEventList* evs) -{ - if (!pcs || !evs) - return; - - R& receiver = *static_cast(this); - int32 sampleIndex = 0; - int32 subdivNumber = 0; - const int32 subdivSize = subdivSize_; - if (subdivSize == 0) - return; - - int32 eventIdx = 0; - int32 eventCount = evs->getEventCount(); - Vst::Event event; - bool hasEvent = false; - if (eventCount > 0) { - evs->getEvent(eventIdx++, event); - hasEvent = true; - } - - // Assume that there would be as many parameter changes as there are parameters, but some hosts are nice - // and send multiple queues per parameter. Clamp the number of considered parameter queues to the number of parameters. - queuePositions_.clear(); - const int32 parameterCount = pcs->getParameterCount(); - const int32 queueCapacity = static_cast(queuePositions_.capacity()); - assert(queueCapacity >= parameterCount); - const int32 consideredQueueCount = std::min(queueCapacity, parameterCount); - queuePositions_.resize(consideredQueueCount, 0); - - while (sampleIndex < numSamples || subdivNumber == 0) { - const int32 subdivCurrentSize = std::min(numSamples - sampleIndex, subdivSize); - const int32 lastOffset = sampleIndex + subdivSize; - - // Queue all changes for the subdiv - subdivChanges_.clear(); - for (int32 qIdx = 0; qIdx < consideredQueueCount; ++qIdx) { - auto* vq = pcs->getParameterData(qIdx); - if (!vq) - continue; - - int32 offset; - Vst::ParamID id = vq->getParameterId(); - Vst::ParamValue value; - - int32& queuePosition = queuePositions_[qIdx]; - while (queuePosition < vq->getPointCount()) { - vq->getPoint(queuePosition, offset, value); - if (offset > lastOffset) - break; - - subdivChanges_.emplace_back(offset, id, value); - queuePosition++; - } - } - - // Sort the changes - std::sort(subdivChanges_.begin(), subdivChanges_.end(), [] (const SubdivChange& lhs, const SubdivChange& rhs) { - return lhs.offset < rhs.offset; - }); - - // Play the parameter changes, interleaving events as needed in between - for (const auto& change: subdivChanges_) { - while (hasEvent && event.sampleOffset < change.offset) { - receiver.playOrderedEvent(event); - hasEvent = (eventIdx < eventCount); - evs->getEvent(eventIdx++, event); - } - receiver.playOrderedParameter(change.offset, change.id, change.value); - } - - sampleIndex += subdivCurrentSize; - ++subdivNumber; - } - - // Play the remaining events - while (hasEvent) { - receiver.playOrderedEvent(event); - hasEvent = (eventIdx < eventCount); - evs->getEvent(eventIdx++, event); - } -} diff --git a/plugins/vst/SfizzVstController.cpp b/plugins/vst/SfizzVstController.cpp deleted file mode 100644 index 2aeb4d532..000000000 --- a/plugins/vst/SfizzVstController.cpp +++ /dev/null @@ -1,496 +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 "SfizzVstController.h" -#include "SfizzVstEditor.h" -#include "SfizzVstParameters.h" -#include "SfizzVstIDs.h" -#include "plugin/InstrumentDescription.h" -#include "base/source/fstreamer.h" -#include "base/source/updatehandler.h" -#include -#include -#include -#include - -enum { kProgramListID = 0 }; - -tresult PLUGIN_API SfizzVstControllerNoUi::initialize(FUnknown* context) -{ - tresult result = EditControllerEx1::initialize(context); - if (result != kResultTrue) - return result; - - // initialize the update handler - Steinberg::UpdateHandler::instance(); - - // initialize the thread checker - threadChecker_ = Vst::ThreadChecker::create(); - - // create update objects - queuedUpdates_ = Steinberg::owned(new QueuedUpdates); - sfzUpdate_ = Steinberg::owned(new SfzUpdate); - sfzDescriptionUpdate_ = Steinberg::owned(new SfzDescriptionUpdate); - scalaUpdate_ = Steinberg::owned(new ScalaUpdate); - playStateUpdate_ = Steinberg::owned(new PlayStateUpdate); - - // Unit - addUnit(new Vst::Unit(Steinberg::String("Root"), Vst::kRootUnitId, Vst::kNoParentUnitId, kProgramListID)); - - // Parameters - Vst::ParamID pid = 0; - - // Ordinary parameters - parameters.addParameter( - SfizzRange::getForParameter(kPidVolume).createParameter( - Steinberg::String("Volume"), pid++, Steinberg::String("dB"), - 0, Vst::ParameterInfo::kCanAutomate, Vst::kRootUnitId)); - parameters.addParameter( - SfizzRange::getForParameter(kPidNumVoices).createParameter( - Steinberg::String("Polyphony"), pid++, nullptr, - 0, Vst::ParameterInfo::kNoFlags, Vst::kRootUnitId)); - parameters.addParameter( - SfizzRange::getForParameter(kPidOversampling).createParameter( - Steinberg::String("Oversampling"), pid++, nullptr, - 0, Vst::ParameterInfo::kNoFlags, Vst::kRootUnitId)); - parameters.addParameter( - SfizzRange::getForParameter(kPidPreloadSize).createParameter( - Steinberg::String("Preload size"), pid++, nullptr, - 0, Vst::ParameterInfo::kNoFlags, Vst::kRootUnitId)); - parameters.addParameter( - SfizzRange::getForParameter(kPidScalaRootKey).createParameter( - Steinberg::String("Scala root key"), pid++, nullptr, - 0, Vst::ParameterInfo::kNoFlags, Vst::kRootUnitId)); - parameters.addParameter( - SfizzRange::getForParameter(kPidTuningFrequency).createParameter( - Steinberg::String("Tuning frequency"), pid++, Steinberg::String("Hz"), - 0, Vst::ParameterInfo::kNoFlags, Vst::kRootUnitId)); - parameters.addParameter( - SfizzRange::getForParameter(kPidStretchedTuning).createParameter( - Steinberg::String("Stretched tuning"), pid++, nullptr, - 0, Vst::ParameterInfo::kNoFlags, Vst::kRootUnitId)); - parameters.addParameter( - SfizzRange::getForParameter(kPidSampleQuality).createParameter( - Steinberg::String("Sample quality"), pid++, nullptr, - 0, Vst::ParameterInfo::kNoFlags, Vst::kRootUnitId)); - parameters.addParameter( - SfizzRange::getForParameter(kPidOscillatorQuality).createParameter( - Steinberg::String("Oscillator quality"), pid++, nullptr, - 0, Vst::ParameterInfo::kNoFlags, Vst::kRootUnitId)); - parameters.addParameter( - SfizzRange::getForParameter(kPidFreewheelingSampleQuality).createParameter( - Steinberg::String("Freewheeling sample quality"), pid++, nullptr, - 0, Vst::ParameterInfo::kNoFlags, Vst::kRootUnitId)); - parameters.addParameter( - SfizzRange::getForParameter(kPidFreewheelingOscillatorQuality).createParameter( - Steinberg::String("Freewheeling oscillator quality"), pid++, nullptr, - 0, Vst::ParameterInfo::kNoFlags, Vst::kRootUnitId)); - parameters.addParameter( - SfizzRange::getForParameter(kPidSustainCancelsRelease).createParameter( - Steinberg::String("Sustain cancels release"), pid++, nullptr, - 1, Vst::ParameterInfo::kNoFlags, Vst::kRootUnitId)); - - // MIDI special controllers - parameters.addParameter( - SfizzRange::getForParameter(kPidAftertouch).createParameter( - Steinberg::String("Aftertouch"), pid++, nullptr, - 0, Vst::ParameterInfo::kCanAutomate, Vst::kRootUnitId)); - parameters.addParameter( - SfizzRange::getForParameter(kPidPitchBend).createParameter( - Steinberg::String("Pitch bend"), pid++, nullptr, - 0, Vst::ParameterInfo::kCanAutomate, Vst::kRootUnitId)); - - // MIDI controllers - for (unsigned i = 0; i < sfz::config::numCCs; ++i) { - Steinberg::String title; - Steinberg::String shortTitle; - title.printf("Controller %u", i); - shortTitle.printf("CC%u", i); - - parameters.addParameter( - SfizzRange::getForParameter(kPidCC0 + i).createParameter( - title, pid++, nullptr, 0, Vst::ParameterInfo::kCanAutomate, - Vst::kRootUnitId, shortTitle)); - } - - // Volume levels - for (unsigned i = 0; i < 16; ++i) { - Steinberg::String title; - title.printf("Level %u", i); - - parameters.addParameter( - SfizzRange::getForParameter(kPidLevel0 + i).createParameter( - title, pid++, nullptr, 0, - Vst::ParameterInfo::kIsReadOnly|Vst::ParameterInfo::kIsHidden, Vst::kRootUnitId)); - } - - // Editor status - parameters.addParameter( - SfizzRange::getForParameter(kPidEditorOpen).createParameter( - Steinberg::String("Editor open"), pid++, nullptr, - 0, Vst::ParameterInfo::kIsReadOnly|Vst::ParameterInfo::kIsHidden, Vst::kRootUnitId)); - - // Initial MIDI mapping - for (int32 i = 0; i < Vst::kCountCtrlNumber; ++i) { - Vst::ParamID id = Vst::kNoParamId; - switch (i) { - case Vst::kAfterTouch: - id = kPidAftertouch; - break; - case Vst::kPitchBend: - id = kPidPitchBend; - break; - default: - if (i < 128) - id = kPidCC0 + i; - break; - } - midiMapping_[i] = id; - } - - // Program list - IPtr list = Steinberg::owned( - new Vst::ProgramListWithPitchNames(Steinberg::String("Programs"), kProgramListID, Vst::kRootUnitId)); - list->addProgram(Steinberg::String("Default")); - addProgramList(list); - list->addRef(); - - // Use linear knobs - setKnobMode(kLinearMode); - - return kResultTrue; -} - -tresult PLUGIN_API SfizzVstControllerNoUi::terminate() -{ - return EditControllerEx1::terminate(); -} - -tresult PLUGIN_API SfizzVstControllerNoUi::getMidiControllerAssignment(int32 busIndex, int16 channel, Vst::CtrlNumber midiControllerNumber, Vst::ParamID& id) -{ - if (midiControllerNumber < 0 || midiControllerNumber >= Vst::kCountCtrlNumber) { - id = Vst::kNoParamId; - return kResultFalse; - } - - id = midiMapping_[midiControllerNumber]; - if (id == Vst::kNoParamId) - return kResultFalse; - - return kResultTrue; -} - -int32 PLUGIN_API SfizzVstControllerNoUi::getKeyswitchCount(int32 busIndex, int16 channel) -{ - (void)channel; - - if (busIndex != 0) - return 0; - - return keyswitches_.size(); -} - -tresult PLUGIN_API SfizzVstControllerNoUi::getKeyswitchInfo(int32 busIndex, int16 channel, int32 keySwitchIndex, Vst::KeyswitchInfo& info) -{ - (void)channel; - - if (busIndex != 0) - return kResultFalse; - - if (keySwitchIndex < 0 || keySwitchIndex >= keyswitches_.size()) - return kResultFalse; - - info = keyswitches_[keySwitchIndex]; - return kResultTrue; -} - -tresult PLUGIN_API SfizzVstControllerNoUi::beginEditFromHost(Vst::ParamID paramID) -{ - // Note(jpc) implementing this interface is a workaround to make - // non-automatable parameters editable in Ardour (as of 6.6) - (void)paramID; - return kResultTrue; -} - -tresult PLUGIN_API SfizzVstControllerNoUi::endEditFromHost(Vst::ParamID paramID) -{ - (void)paramID; - return kResultTrue; -} - -tresult PLUGIN_API SfizzVstControllerNoUi::getParamStringByValue(Vst::ParamID tag, Vst::ParamValue valueNormalized, Vst::String128 string) -{ - switch (tag) { - case kPidOversampling: - { - const SfizzRange range = SfizzRange::getForParameter(tag); - const int factorLog2 = static_cast(range.denormalize(valueNormalized)); - Steinberg::String buf; - buf.printf("%dX", 1 << factorLog2); - buf.copyTo(string); - return kResultTrue; - } - } - - return EditControllerEx1::getParamStringByValue(tag, valueNormalized, string); -} - -tresult PLUGIN_API SfizzVstControllerNoUi::getParamValueByString(Vst::ParamID tag, Vst::TChar* string, Vst::ParamValue& valueNormalized) -{ - switch (tag) { - case kPidOversampling: - { - int32 factor; - if (!Steinberg::String::scanInt32(string, factor, false)) - factor = 1; - - const SfizzRange range = SfizzRange::getForParameter(tag); - valueNormalized = range.normalize(integerLog2(factor)); - return kResultTrue; - } - } - - return EditControllerEx1::getParamValueByString(tag, string, valueNormalized); -} - -tresult SfizzVstControllerNoUi::setParam(Vst::ParamID tag, float value) -{ - const SfizzRange range = SfizzRange::getForParameter(tag); - return setParamNormalized(tag, range.normalize(value)); -} - -tresult PLUGIN_API SfizzVstControllerNoUi::setComponentState(IBStream* stream) -{ - SfizzVstState s; - - tresult r = s.load(stream); - if (r != kResultTrue) - return r; - - setParam(kPidVolume, s.volume); - setParam(kPidNumVoices, s.numVoices); - setParam(kPidOversampling, s.oversamplingLog2); - setParam(kPidPreloadSize, s.preloadSize); - setParam(kPidScalaRootKey, s.scalaRootKey); - setParam(kPidTuningFrequency, s.tuningFrequency); - setParam(kPidStretchedTuning, s.stretchedTuning); - setParam(kPidSampleQuality, s.sampleQuality); - setParam(kPidOscillatorQuality, s.oscillatorQuality); - setParam(kPidFreewheelingSampleQuality, s.freewheelingSampleQuality); - setParam(kPidFreewheelingOscillatorQuality, s.freewheelingOscillatorQuality); - setParam(kPidSustainCancelsRelease, s.sustainCancelsRelease); - - uint32 ccLimit = uint32(std::min(s.controllers.size(), size_t(sfz::config::numCCs))); - for (uint32 cc = 0; cc < ccLimit; ++cc) { - if (absl::optional value = s.controllers[cc]) - setParam(kPidCC0 + cc, *value); - } - - sfzUpdate_->setPath(s.sfzFile); - sfzUpdate_->deferUpdate(); - scalaUpdate_->setPath(s.scalaFile); - scalaUpdate_->deferUpdate(); - - return kResultTrue; -} - -tresult SfizzVstControllerNoUi::notify(Vst::IMessage* message) -{ - // Note: is expected to be called from the controller thread only - - tresult result = EditControllerEx1::notify(message); - if (result != kResultFalse) - return result; - - if (!threadChecker_->test()) { - static std::atomic_bool warn_once_flag { false }; - if (!warn_once_flag.exchange(true)) - fprintf(stderr, "[sfizz] controller notification arrives from the wrong thread\n"); - } - - const char* id = message->getMessageID(); - - /// - if (!strcmp(id, SfzUpdate::getFClassID())) { - if (!sfzUpdate_->convertFromMessage(*message)) { - // assert(false); - return kResultFalse; - } - - // update the program name and notify - std::string name = fs::u8path(sfzUpdate_->getPath()).filename().u8string(); - if (absl::EndsWithIgnoreCase(name, ".sfz")) - name.resize(name.size() - 4); - setProgramName(kProgramListID, 0, Steinberg::String(name.c_str())); - - FUnknownPtr unitHandler(getComponentHandler()); - if (unitHandler) - unitHandler->notifyProgramListChange(kProgramListID, 0); - - // - sfzUpdate_->deferUpdate(); - } - else if (!strcmp(id, SfzDescriptionUpdate::getFClassID())) { - if (!sfzDescriptionUpdate_->convertFromMessage(*message)) { - assert(false); - return kResultFalse; - } - - // parse the description blob - const InstrumentDescription desc = parseDescriptionBlob( - sfzDescriptionUpdate_->getDescription()); - - // update pitch names and notify - Vst::ProgramListWithPitchNames* list = - static_cast(getProgramList(kProgramListID)); - for (int16 pitch = 0; pitch < 128; ++pitch) { - Steinberg::String pitchName; - if (desc.keyUsed.test(pitch) && !desc.keyLabel[pitch].empty()) - pitchName = Steinberg::String(desc.keyLabel[pitch].c_str()); - else if (desc.keyswitchUsed.test(pitch) && !desc.keyswitchLabel[pitch].empty()) - pitchName = Steinberg::String(desc.keyswitchLabel[pitch].c_str()); - - list->setPitchName(0, pitch, pitchName); - } - - FUnknownPtr unitHandler(getComponentHandler()); - if (unitHandler) - unitHandler->notifyProgramListChange(kProgramListID, 0); - - // update the key switches and notify - size_t idKeyswitch = 0; - for (int16 pitch = 0; pitch < 128; ++pitch) - idKeyswitch += desc.keyswitchUsed.test(pitch); - keyswitches_.resize(idKeyswitch); - - idKeyswitch = 0; - for (int16 pitch = 0; pitch < 128; ++pitch) { - if (!desc.keyswitchUsed.test(pitch)) - continue; - Vst::KeyswitchInfo info {}; - info.typeId = Vst::kNoteOnKeyswitchTypeID; - Steinberg::String(desc.keyswitchLabel[pitch].c_str()).copyTo(info.title); - Steinberg::String(desc.keyswitchLabel[pitch].c_str()).copyTo(info.shortTitle); - info.keyswitchMin = pitch; // TODO reexamine this when supporting keyswitch groups - info.keyswitchMax = pitch; // TODO reexamine this when supporting keyswitch groups - info.keyRemapped = pitch; - info.unitId = Vst::kRootUnitId; - info.flags = 0; - keyswitches_[idKeyswitch++] = info; - } - - if (Vst::IComponentHandler* componentHandler = getComponentHandler()) - componentHandler->restartComponent(Vst::kKeyswitchChanged); - - // update the parameter titles and notify - for (uint32 cc = 0; cc < sfz::config::numCCs; ++cc) { - Vst::ParamID pid = kPidCC0 + cc; - Vst::Parameter* param = getParameterObject(pid); - Vst::ParameterInfo& info = param->getInfo(); - Steinberg::String title; - Steinberg::String shortTitle; - if (!desc.ccLabel[cc].empty()) { - title = desc.ccLabel[cc].c_str(); - shortTitle = title; - } - else { - title.printf("Controller %u", cc); - shortTitle.printf("CC%u", cc); - } - title.copyTo(info.title); - shortTitle.copyTo(info.shortTitle); - } - - if (Vst::IComponentHandler* componentHandler = getComponentHandler()) - componentHandler->restartComponent(Vst::kParamTitlesChanged); - - // - sfzDescriptionUpdate_->deferUpdate(); - } - else if (!strcmp(id, ScalaUpdate::getFClassID())) { - if (!scalaUpdate_->convertFromMessage(*message)) { - assert(false); - return kResultFalse; - } - scalaUpdate_->deferUpdate(); - } - else if (!strcmp(id, PlayStateUpdate::getFClassID())) { - if (!playStateUpdate_->convertFromMessage(*message)) { - assert(false); - return kResultFalse; - } - playStateUpdate_->deferUpdate(); - } - else if (!strcmp(id, OSCUpdate::getFClassID())) { - IPtr update = OSCUpdate::createFromMessage(*message); - if (!update) { - assert(false); - return kResultFalse; - } - queuedUpdates_->enqueue(update); - queuedUpdates_->deferUpdate(); - } - else if (!strcmp(id, NoteUpdate::getFClassID())) { - IPtr update = NoteUpdate::createFromMessage(*message); - if (!update) { - assert(false); - return kResultFalse; - } - queuedUpdates_->enqueue(update); - queuedUpdates_->deferUpdate(); - } - else if (!strcmp(id, AutomationUpdate::getFClassID())) { - IPtr update = AutomationUpdate::createFromMessage(*message); - if (!update) { - assert(false); - return kResultFalse; - } - for (AutomationUpdate::Item item : update->getItems()) - setParam(item.first, item.second); - } - - return result; -} - -// --- Controller with UI --- // - -IPlugView* PLUGIN_API SfizzVstController::createView(FIDString _name) -{ - ConstString name(_name); - - fprintf(stderr, "[sfizz] about to create view: %s\n", _name); - - if (name != Vst::ViewType::kEditor) - return nullptr; - - std::vector updates; - updates.push_back(queuedUpdates_); - updates.push_back(sfzUpdate_); - updates.push_back(sfzDescriptionUpdate_); - updates.push_back(scalaUpdate_); - updates.push_back(playStateUpdate_); - for (uint32 i = 0, n = parameters.getParameterCount(); i < n; ++i) - updates.push_back(parameters.getParameterByIndex(i)); - - IPtr editor = Steinberg::owned( - new SfizzVstEditor(this, absl::MakeSpan(updates))); - - editor->remember(); - return editor; -} - -FUnknown* SfizzVstController::createInstance(void*) -{ - return static_cast(new SfizzVstController); -} - -template <> -FUnknown* createInstance(void* context) -{ - return SfizzVstController::createInstance(context); -} - -FUID SfizzVstController::cid = SfizzVstController_cid; diff --git a/plugins/vst/SfizzVstController.h b/plugins/vst/SfizzVstController.h deleted file mode 100644 index c26e4b18d..000000000 --- a/plugins/vst/SfizzVstController.h +++ /dev/null @@ -1,76 +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 "SfizzVstState.h" -#include "SfizzVstUpdates.h" -#include "public.sdk/source/vst/vsteditcontroller.h" -#include "public.sdk/source/vst/vstparameters.h" -#include "public.sdk/source/common/threadchecker.h" -#include "pluginterfaces/vst/ivstmidicontrollers.h" -#include "pluginterfaces/vst/ivstnoteexpression.h" -#include "vstgui/plugin-bindings/vst3editor.h" -#include -#include -class SfizzVstState; -class SfizzVstEditor; - -using namespace Steinberg; -using namespace VSTGUI; - -class SfizzVstControllerNoUi : public Vst::EditControllerEx1, - public Vst::IMidiMapping, - public Vst::IKeyswitchController, - public Vst::IEditControllerHostEditing { -public: - virtual ~SfizzVstControllerNoUi() {} - - tresult PLUGIN_API initialize(FUnknown* context) override; - tresult PLUGIN_API terminate() override; - - tresult PLUGIN_API getMidiControllerAssignment(int32 busIndex, int16 channel, Vst::CtrlNumber midiControllerNumber, Vst::ParamID& id) override; - - int32 PLUGIN_API getKeyswitchCount (int32 busIndex, int16 channel) override; - tresult PLUGIN_API getKeyswitchInfo (int32 busIndex, int16 channel, int32 keySwitchIndex, Vst::KeyswitchInfo& info) override; - - tresult PLUGIN_API beginEditFromHost(Vst::ParamID paramID) override; - tresult PLUGIN_API endEditFromHost(Vst::ParamID paramID) override; - - tresult PLUGIN_API getParamStringByValue(Vst::ParamID tag, Vst::ParamValue valueNormalized, Vst::String128 string) override; - tresult PLUGIN_API getParamValueByString(Vst::ParamID tag, Vst::TChar* string, Vst::ParamValue& valueNormalized) override; - - tresult setParam(Vst::ParamID tag, float value); - tresult PLUGIN_API setComponentState(IBStream* stream) override; - tresult PLUGIN_API notify(Vst::IMessage* message) override; - - // interfaces - OBJ_METHODS(SfizzVstControllerNoUi, Vst::EditControllerEx1) - DEFINE_INTERFACES - DEF_INTERFACE(Vst::IMidiMapping) - DEF_INTERFACE(Vst::IKeyswitchController) - DEF_INTERFACE(Vst::IEditControllerHostEditing) - END_DEFINE_INTERFACES(Vst::EditControllerEx1) - REFCOUNT_METHODS(Vst::EditControllerEx1) - -protected: - std::unique_ptr threadChecker_; - Steinberg::IPtr queuedUpdates_; - Steinberg::IPtr sfzUpdate_; - Steinberg::IPtr sfzDescriptionUpdate_; - Steinberg::IPtr scalaUpdate_; - Steinberg::IPtr playStateUpdate_; - Vst::ParamID midiMapping_[Vst::kCountCtrlNumber] {}; - std::vector keyswitches_; -}; - -class SfizzVstController : public SfizzVstControllerNoUi, public VSTGUI::VST3EditorDelegate { -public: - IPlugView* PLUGIN_API createView(FIDString name) override; - - static FUnknown* createInstance(void*); - - static FUID cid; -}; diff --git a/plugins/vst/SfizzVstEditor.cpp b/plugins/vst/SfizzVstEditor.cpp deleted file mode 100644 index c401535da..000000000 --- a/plugins/vst/SfizzVstEditor.cpp +++ /dev/null @@ -1,544 +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 "SfizzVstEditor.h" -#include "SfizzVstState.h" -#include "SfizzVstParameters.h" -#include "SfizzVstUpdates.h" -#include "editor/Editor.h" -#include "editor/EditIds.h" -#include "plugin/SfizzFileScan.h" -#include "plugin/InstrumentDescription.h" -#include "pluginterfaces/vst/ivsthostapplication.h" -#include "IdleUpdateHandler.h" -#if !defined(__APPLE__) && !defined(_WIN32) -#include "X11RunLoop.h" -#endif -#include -#include - -using namespace VSTGUI; - -static ViewRect sfizzUiViewRect { 0, 0, Editor::viewWidth, Editor::viewHeight }; - -enum { - kOscTempSize = 8192, - kOscQueueSize = 65536, - kNoteEventQueueSize = 8192, -}; - -SfizzVstEditor::SfizzVstEditor(SfizzVstController* controller, absl::Span updates) - : VSTGUIEditor(controller, &sfizzUiViewRect), - oscTemp_(new uint8_t[kOscTempSize]), - updates_(updates.begin(), updates.end()) -{ -} - -SfizzVstEditor::~SfizzVstEditor() -{ -} - -bool PLUGIN_API SfizzVstEditor::open(void* parent, const VSTGUI::PlatformType& platformType) -{ - fprintf(stderr, "[sfizz] about to open view with parent %p\n", parent); - - CRect wsize(0, 0, sfizzUiViewRect.getWidth(), sfizzUiViewRect.getHeight()); - CFrame *frame = new CFrame(wsize, this); - this->frame = frame; - - IPlatformFrameConfig* config = nullptr; - -#if !defined(__APPLE__) && !defined(_WIN32) - X11::FrameConfig x11config; - if (!_runLoop) - _runLoop = new RunLoop(plugFrame); - x11config.runLoop = _runLoop; - config = &x11config; -#endif - - Editor* editor = new Editor(*this); - editor_.reset(editor); - - if (!frame->open(parent, platformType, config)) { - fprintf(stderr, "[sfizz] error opening frame\n"); - return false; - } - - editor->open(*frame); - - for (FObject* update : updates_) - update->addDependent(this); - - threadChecker_ = Vst::ThreadChecker::create(); - - parametersToUpdate_.clear(); - - Steinberg::IdleUpdateHandler::start(); - - for (FObject* update : updates_) - update->deferUpdate(); - - // let the editor know about plugin format - absl::string_view pluginFormatName = "VST3"; - - if (FUnknownPtr app { controller->getHostContext() }) { - Vst::String128 name; - app->getName(name); - uiReceiveValue(EditId::PluginHost, std::string(Steinberg::String(name).text8())); - - void* interfacePtr; - if (app->queryInterface(Vst::IVst3ToAUWrapper_iid, &interfacePtr) == kResultTrue) - pluginFormatName = "Audio Unit"; - else if (app->queryInterface(Vst::IVst3ToVst2Wrapper_iid, &interfacePtr) == kResultTrue) - pluginFormatName = "VST2"; - else if (app->queryInterface(Vst::IVst3ToAAXWrapper_iid, &interfacePtr) == kResultTrue) - pluginFormatName = "AAX"; - } - - uiReceiveValue(EditId::PluginFormat, std::string(pluginFormatName)); - - absl::optional userFilesDir = SfizzPaths::getSfzConfigDefaultPath(); - uiReceiveValue(EditId::CanEditUserFilesDir, 1); - uiReceiveValue(EditId::UserFilesDir, userFilesDir.value_or(fs::path()).u8string()); - uiReceiveValue(EditId::FallbackFilesDir, SfizzPaths::getSfzFallbackDefaultPath().u8string()); - - updateEditorIsOpenParameter(); - - return true; -} - -void PLUGIN_API SfizzVstEditor::close() -{ - CFrame *frame = this->frame; - if (frame) { - Steinberg::IdleUpdateHandler::stop(); - - for (FObject* update : updates_) - update->removeDependent(this); - - if (editor_) { - editor_->close(); - editor_ = nullptr; - } - - if (frame->getNbReference() != 1) - frame->forget(); - else { - frame->close(); -#if !defined(__APPLE__) && !defined(_WIN32) - // if vstgui is done using the runloop, destroy it - if (!RunLoop::get()) - _runLoop = nullptr; -#endif - } - this->frame = nullptr; - } - - updateEditorIsOpenParameter(); -} - -void SfizzVstEditor::updateEditorIsOpenParameter() -{ - SfizzVstController* ctrl = getController(); - bool editorIsOpen = frame && frame->isVisible(); - ctrl->setParamNormalized(kPidEditorOpen, editorIsOpen); - ctrl->performEdit(kPidEditorOpen, editorIsOpen); -} - -/// -CMessageResult SfizzVstEditor::notify(CBaseObject* sender, const char* message) -{ - CMessageResult result = VSTGUIEditor::notify(sender, message); - - if (result != kMessageNotified) - return result; - -#if !defined(__APPLE__) && !defined(_WIN32) - if (message == CVSTGUITimer::kMsgTimer) { - SharedPointer runLoop = RunLoop::get(); - if (runLoop) { - // note(jpc) I don't find a reliable way to check if the host - // notifier of X11 events is working. If there is, remove this and - // avoid polluting Linux hosts which implement the loop correctly. - runLoop->processSomeEvents(); - } - } -#endif - - if (message == CVSTGUITimer::kMsgTimer) { - processParameterUpdates(); - updateEditorIsOpenParameter(); // Note(jpc) for Reaper, it can fail at open time - } - - return result; -} - -void PLUGIN_API SfizzVstEditor::update(FUnknown* changedUnknown, int32 message) -{ - if (processUpdate(changedUnknown, message)) - return; - - Vst::VSTGUIEditor::update(changedUnknown, message); -} - -bool SfizzVstEditor::processUpdate(FUnknown* changedUnknown, int32 message) -{ - if (QueuedUpdates* update = FCast(changedUnknown)) { - for (FObject* queuedUpdate : update->getUpdates(this)) - processUpdate(queuedUpdate, message); - return true; - } - - if (OSCUpdate* update = FCast(changedUnknown)) { - const uint8* oscData = update->data(); - uint32 oscSize = update->size(); - - const char* path; - const char* sig; - const sfizz_arg_t* args; - uint8_t buffer[1024]; - - uint32_t msgSize; - while ((msgSize = sfizz_extract_message(oscData, oscSize, buffer, sizeof(buffer), &path, &sig, &args)) > 0) { - uiReceiveMessage(path, sig, args); - oscData += msgSize; - oscSize -= msgSize; - } - - return true; - } - - if (NoteUpdate* update = FCast(changedUnknown)) { - const NoteUpdate::Item* events = update->events(); - uint32 count = update->count(); - for (uint32 i = 0; i < count; ++i) - uiReceiveValue(editIdForKey(events[i].first), events[i].second); - return true; - } - - if (SfzUpdate* update = FCast(changedUnknown)) { - const std::string path = update->getPath(); - uiReceiveValue(EditId::SfzFile, path); - return true; - } - - if (SfzDescriptionUpdate* update = FCast(changedUnknown)) { - const InstrumentDescription desc = parseDescriptionBlob(update->getDescription()); - - uiReceiveValue(EditId::UINumCurves, desc.numCurves); - uiReceiveValue(EditId::UINumMasters, desc.numMasters); - uiReceiveValue(EditId::UINumGroups, desc.numGroups); - uiReceiveValue(EditId::UINumRegions, desc.numRegions); - uiReceiveValue(EditId::UINumPreloadedSamples, desc.numSamples); - - const fs::path rootPath = fs::u8path(desc.rootPath); - const fs::path imagePath = rootPath / fs::u8path(desc.image); - uiReceiveValue(EditId::BackgroundImage, imagePath.u8string()); - - const fs::path ctrlImagePath = rootPath / fs::u8path(desc.image_controls); - uiReceiveValue(EditId::ControlsImage, ctrlImagePath.u8string()); - - for (unsigned key = 0; key < 128; ++key) { - bool keyUsed = desc.keyUsed.test(key); - bool keyswitchUsed = desc.keyswitchUsed.test(key); - uiReceiveValue(editIdForKeyUsed(int(key)), float(keyUsed)); - uiReceiveValue(editIdForKeyswitchUsed(int(key)), float(keyswitchUsed)); - if (keyUsed) - uiReceiveValue(editIdForKeyLabel(int(key)), desc.keyLabel[key]); - if (keyswitchUsed) - uiReceiveValue(editIdForKeyswitchLabel(int(key)), desc.keyswitchLabel[key]); - } - - for (unsigned cc = 0; cc < sfz::config::numCCs; ++cc) { - bool ccUsed = desc.ccUsed.test(cc) && !desc.sustainOrSostenuto.test(cc); - uiReceiveValue(editIdForCCUsed(int(cc)), float(ccUsed)); - if (ccUsed) { - uiReceiveValue(editIdForCCDefault(int(cc)), desc.ccDefault[cc]); - uiReceiveValue(editIdForCCLabel(int(cc)), desc.ccLabel[cc]); - } - } - return true; - } - - if (ScalaUpdate* update = FCast(changedUnknown)) { - const std::string path = update->getPath(); - uiReceiveValue(EditId::ScalaFile, path); - return true; - } - - if (PlayStateUpdate* update = FCast(changedUnknown)) { - const SfizzPlayState playState = update->getState(); - uiReceiveValue(EditId::UINumActiveVoices, playState.activeVoices); - return true; - } - - if (Vst::RangeParameter* param = Steinberg::FCast(changedUnknown)) { - // Note(jpc) some hosts send us the parameters in the wrong thread... - // store these parameters thread-safely and let the idle - // callback process them later - if (threadChecker_->test()) - updateParameter(param); - else { - static std::atomic_bool warn_once_flag { false }; - if (!warn_once_flag.exchange(true)) - fprintf(stderr, "[sfizz] using a thread-safety workaround for parameter updates\n"); - const Vst::ParamID id = param->getInfo().id; - std::lock_guard lock(parametersToUpdateMutex_); - parametersToUpdate_.insert(id); - } - return true; - } - - return false; -} - -void SfizzVstEditor::processParameterUpdates() -{ - auto extractNextParamID = [this]() -> Vst::ParamID { - Vst::ParamID id = Vst::kNoParamId; - std::lock_guard lock(parametersToUpdateMutex_); - auto it = parametersToUpdate_.begin(); - if (it != parametersToUpdate_.end()) { - id = *it; - parametersToUpdate_.erase(it); - } - return id; - }; - - for (Vst::ParamID id; (id = extractNextParamID()) != Vst::kNoParamId; ) - updateParameter(getController()->getParameterObject(id)); -} - -void SfizzVstEditor::updateParameter(Vst::Parameter* parameterToUpdate) -{ - if (Vst::RangeParameter* param = FCast(parameterToUpdate)) { - const Vst::ParamID id = param->getInfo().id; - const Vst::ParamValue value = param->getNormalized(); - const SfizzRange range = SfizzRange::getForParameter(id); - switch (id) { - case kPidVolume: - uiReceiveValue(EditId::Volume, range.denormalize(value)); - break; - case kPidNumVoices: - uiReceiveValue(EditId::Polyphony, range.denormalize(value)); - break; - case kPidOversampling: - uiReceiveValue(EditId::Oversampling, float(1u << (int32)range.denormalize(value))); - break; - case kPidPreloadSize: - uiReceiveValue(EditId::PreloadSize, range.denormalize(value)); - break; - case kPidScalaRootKey: - uiReceiveValue(EditId::ScalaRootKey, range.denormalize(value)); - break; - case kPidTuningFrequency: - uiReceiveValue(EditId::TuningFrequency, range.denormalize(value)); - break; - case kPidStretchedTuning: - uiReceiveValue(EditId::StretchTuning, range.denormalize(value)); - break; - case kPidSampleQuality: - uiReceiveValue(EditId::SampleQuality, range.denormalize(value)); - break; - case kPidOscillatorQuality: - uiReceiveValue(EditId::OscillatorQuality, range.denormalize(value)); - break; - case kPidFreewheelingSampleQuality: - uiReceiveValue(EditId::FreewheelingSampleQuality, range.denormalize(value)); - break; - case kPidFreewheelingOscillatorQuality: - uiReceiveValue(EditId::FreewheelingOscillatorQuality, range.denormalize(value)); - break; - case kPidSustainCancelsRelease: - uiReceiveValue(EditId::SustainCancelsRelease, range.denormalize(value)); - break; - case kPidNumOutputs: - uiReceiveValue(EditId::PluginOutputs, (int32)range.denormalize(value)); - break; - default: - if (id >= kPidCC0 && id <= kPidCCLast) { - int cc = int(id - kPidCC0); - uiReceiveValue(editIdForCC(cc), range.denormalize(value)); - } else if (id >= kPidLevel0 && id <= kPidLevelLast) { - int levelId = int(id - kPidLevel0); - uiReceiveValue(editIdForLevel(levelId), range.denormalize(value)); - } - break; - } - } -} - -/// -void SfizzVstEditor::uiSendValue(EditId id, const EditValue& v) -{ - if (id == EditId::SfzFile) - loadSfzFile(v.to_string()); - else if (id == EditId::ScalaFile) - loadScalaFile(v.to_string()); - else { - SfizzVstController* ctrl = getController(); - - auto normalizeAndSet = [ctrl](Vst::ParamID pid, float value) { - float normValue = SfizzRange::getForParameter(pid).normalize(value); - ctrl->setParamNormalized(pid, normValue); - ctrl->performEdit(pid, normValue); - }; - - switch (id) { - case EditId::Volume: - normalizeAndSet(kPidVolume, v.to_float()); - break; - case EditId::Polyphony: - normalizeAndSet(kPidNumVoices, v.to_float()); - break; - case EditId::Oversampling: - { - const int32 factor = static_cast(v.to_float()); - normalizeAndSet(kPidOversampling, integerLog2(factor)); - } - break; - case EditId::PreloadSize: - normalizeAndSet(kPidPreloadSize, v.to_float()); - break; - case EditId::ScalaRootKey: - normalizeAndSet(kPidScalaRootKey, v.to_float()); - break; - case EditId::TuningFrequency: - normalizeAndSet(kPidTuningFrequency, v.to_float()); - break; - case EditId::StretchTuning: - normalizeAndSet(kPidStretchedTuning, v.to_float()); - break; - case EditId::SampleQuality: - normalizeAndSet(kPidSampleQuality, v.to_float()); - break; - case EditId::OscillatorQuality: - normalizeAndSet(kPidOscillatorQuality, v.to_float()); - break; - case EditId::FreewheelingSampleQuality: - normalizeAndSet(kPidFreewheelingSampleQuality, v.to_float()); - break; - case EditId::FreewheelingOscillatorQuality: - normalizeAndSet(kPidFreewheelingOscillatorQuality, v.to_float()); - break; - case EditId::SustainCancelsRelease: - normalizeAndSet(kPidSustainCancelsRelease, v.to_float()); - break; - case EditId::UserFilesDir: - SfizzPaths::setSfzConfigDefaultPath(fs::u8path(v.to_string())); - break; - - default: - if (editIdIsCC(id)) - normalizeAndSet(kPidCC0 + ccForEditId(id), v.to_float()); - break; - } - } -} - -void SfizzVstEditor::uiBeginSend(EditId id) -{ - Vst::ParamID pid = parameterOfEditId(id); - if (pid != Vst::kNoParamId) - getController()->beginEdit(pid); -} - -void SfizzVstEditor::uiEndSend(EditId id) -{ - Vst::ParamID pid = parameterOfEditId(id); - if (pid != Vst::kNoParamId) - getController()->endEdit(pid); -} - -void SfizzVstEditor::uiSendMIDI(const uint8_t* data, uint32_t len) -{ - SfizzVstController* ctl = getController(); - - Steinberg::OPtr msg { ctl->allocateMessage() }; - if (!msg) { - fprintf(stderr, "[Sfizz] UI could not allocate message\n"); - return; - } - - msg->setMessageID("MidiMessage"); - Vst::IAttributeList* attr = msg->getAttributes(); - attr->setBinary("Data", data, len); - ctl->sendMessage(msg); -} - -void SfizzVstEditor::uiSendMessage(const char* path, const char* sig, const sfizz_arg_t* args) -{ - SfizzVstController* ctl = getController(); - - Steinberg::OPtr msg { ctl->allocateMessage() }; - if (!msg) { - fprintf(stderr, "[Sfizz] UI could not allocate message\n"); - return; - } - - uint8_t* oscTemp = oscTemp_.get(); - uint32_t oscSize = sfizz_prepare_message(oscTemp, kOscTempSize, path, sig, args); - if (oscSize <= kOscTempSize) { - msg->setMessageID("OscMessage"); - Vst::IAttributeList* attr = msg->getAttributes(); - attr->setBinary("Data", oscTemp, oscSize); - ctl->sendMessage(msg); - } -} - -/// -void SfizzVstEditor::loadSfzFile(const std::string& filePath) -{ - SfizzVstController* ctl = getController(); - - Steinberg::OPtr msg { ctl->allocateMessage() }; - if (!msg) { - fprintf(stderr, "[Sfizz] UI could not allocate message\n"); - return; - } - - msg->setMessageID("LoadSfz"); - Vst::IAttributeList* attr = msg->getAttributes(); - attr->setBinary("File", filePath.data(), filePath.size()); - ctl->sendMessage(msg); -} - -void SfizzVstEditor::loadScalaFile(const std::string& filePath) -{ - SfizzVstController* ctl = getController(); - - Steinberg::OPtr msg { ctl->allocateMessage() }; - if (!msg) { - fprintf(stderr, "[Sfizz] UI could not allocate message\n"); - return; - } - - msg->setMessageID("LoadScala"); - Vst::IAttributeList* attr = msg->getAttributes(); - attr->setBinary("File", filePath.data(), filePath.size()); - ctl->sendMessage(msg); -} - -Vst::ParamID SfizzVstEditor::parameterOfEditId(EditId id) -{ - switch (id) { - case EditId::Volume: return kPidVolume; - case EditId::Polyphony: return kPidNumVoices; - case EditId::Oversampling: return kPidOversampling; - case EditId::PreloadSize: return kPidPreloadSize; - case EditId::ScalaRootKey: return kPidScalaRootKey; - case EditId::TuningFrequency: return kPidTuningFrequency; - case EditId::StretchTuning: return kPidStretchedTuning; - case EditId::SampleQuality: return kPidSampleQuality; - case EditId::OscillatorQuality: return kPidOscillatorQuality; - default: - if (editIdIsCC(id)) - return kPidCC0 + ccForEditId(id); - else if (editIdIsLevel(id)) - return kPidLevel0 + levelForEditId(id); - return Vst::kNoParamId; - } -} diff --git a/plugins/vst/SfizzVstEditor.h b/plugins/vst/SfizzVstEditor.h deleted file mode 100644 index 9ced76591..000000000 --- a/plugins/vst/SfizzVstEditor.h +++ /dev/null @@ -1,85 +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 "SfizzVstController.h" -#include "editor/EditorController.h" -#include "public.sdk/source/vst/vstguieditor.h" -#include "public.sdk/source/common/threadchecker.h" -#include -#include -#include -class Editor; -#if !defined(__APPLE__) && !defined(_WIN32) -namespace VSTGUI { class RunLoop; } -#endif - -using namespace Steinberg; -using namespace VSTGUI; - -class SfizzVstEditor : public Vst::VSTGUIEditor, - public EditorController { -public: - using Self = SfizzVstEditor; - - SfizzVstEditor(SfizzVstController* controller, absl::Span updates); - ~SfizzVstEditor(); - - bool PLUGIN_API open(void* parent, const VSTGUI::PlatformType& platformType) override; - void PLUGIN_API close() override; - - SfizzVstController* getController() const - { - return static_cast(Vst::VSTGUIEditor::getController()); - } - - void updateEditorIsOpenParameter(); - - // VSTGUIEditor - CMessageResult notify(CBaseObject* sender, const char* message) override; - // FObject - void PLUGIN_API update(FUnknown* changedUnknown, int32 message) override; - - // -private: - bool processUpdate(FUnknown* changedUnknown, int32 message); - void processParameterUpdates(); - void updateParameter(Vst::Parameter* parameterToUpdate); - -protected: - // EditorController - void uiSendValue(EditId id, const EditValue& v) override; - void uiBeginSend(EditId id) override; - void uiEndSend(EditId id) override; - void uiSendMIDI(const uint8_t* data, uint32_t len) override; - void uiSendMessage(const char* path, const char* sig, const sfizz_arg_t* args) override; - -private: - void loadSfzFile(const std::string& filePath); - void loadScalaFile(const std::string& filePath); - - Vst::ParamID parameterOfEditId(EditId id); - - std::unique_ptr editor_; - -#if !defined(__APPLE__) && !defined(_WIN32) - SharedPointer _runLoop; -#endif - - // messaging - std::unique_ptr oscTemp_; - - // subscribed updates - std::vector> updates_; - - // thread safety - std::unique_ptr threadChecker_; - - // parameters to process, whose values have received changes - // Note(jpc) it's because hosts send us parameter updates in the wrong thread.. - std::set parametersToUpdate_; - std::mutex parametersToUpdateMutex_; -}; diff --git a/plugins/vst/SfizzVstIDs.h b/plugins/vst/SfizzVstIDs.h deleted file mode 100644 index eb4e73869..000000000 --- a/plugins/vst/SfizzVstIDs.h +++ /dev/null @@ -1,22 +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 - -/* - Note(jpc) Generated at random with uuidgen. - Can't find docs on it... maybe it's to register somewhere? - */ -#define SfizzVstProcessor_cid \ - Steinberg::FUID(0xe8fab718, 0x15ed46e3, 0x8b598310, 0x1e12993f) -#define SfizzVstProcessorMulti_cid \ - Steinberg::FUID(0xc9da9274, 0x43794873, 0xa900ed81, 0xd1946115) -#define SfizzVstController_cid \ - Steinberg::FUID(0x7129736c, 0xbc784134, 0xbb899d56, 0x2ebafe4f) - -template -Steinberg::FUnknown* createInstance(void*); diff --git a/plugins/vst/SfizzVstParameters.h b/plugins/vst/SfizzVstParameters.h deleted file mode 100644 index 07d3bb4c3..000000000 --- a/plugins/vst/SfizzVstParameters.h +++ /dev/null @@ -1,113 +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 "public.sdk/source/vst/vstparameters.h" -#include - -using namespace Steinberg; - -// parameters -enum { - kPidVolume, - kPidNumVoices, - kPidOversampling, - kPidPreloadSize, - kPidScalaRootKey, - kPidTuningFrequency, - kPidStretchedTuning, - kPidSampleQuality, - kPidOscillatorQuality, - kPidFreewheelingSampleQuality, - kPidFreewheelingOscillatorQuality, - kPidSustainCancelsRelease, - kPidAftertouch, - kPidPitchBend, - kPidCC0, - kPidCCLast = kPidCC0 + sfz::config::numCCs - 1, - kPidNumOutputs, - kPidLevel0, - kPidLevelLast = kPidLevel0 + 16, - kPidEditorOpen, - /* Reserved */ - kNumParameters, -}; - -struct SfizzRange { - float def = 0.0; - float min = 0.0; - float max = 1.0; - - constexpr SfizzRange() {} - constexpr SfizzRange(float def, float min, float max) : def(def), min(min), max(max) {} - - constexpr float normalize(float x) const noexcept - { - return (x - min) / (max - min); - } - - constexpr float denormalize(float x) const noexcept - { - return min + x * (max - min); - } - - Vst::RangeParameter* createParameter(const Vst::TChar *title, Vst::ParamID tag, const Vst::TChar *units = nullptr, int32 stepCount = 0, int32 flags = Vst::ParameterInfo::kCanAutomate, Vst::UnitID unitID = Vst::kRootUnitId, const Vst::TChar *shortTitle = nullptr) const - { - return new Vst::RangeParameter(title, tag, units, min, max, def, stepCount, flags, unitID, shortTitle); - } - - static SfizzRange getForParameter(Vst::ParamID id) - { - switch (id) { - case kPidVolume: - return {0.0, -60.0, +6.0}; - case kPidNumVoices: - return {64.0, 1.0, 256.0}; - case kPidOversampling: - return {0.0, 0.0, 3.0}; - case kPidPreloadSize: - return {8192.0, 1024.0, 65536.0}; - case kPidScalaRootKey: - return {60.0, 0.0, 127.0}; - case kPidTuningFrequency: - return {440.0, 300.0, 500.0}; - case kPidStretchedTuning: - return {0.0, 0.0, 1.0}; - case kPidSampleQuality: - return {2.0, 0.0, 10.0}; - case kPidOscillatorQuality: - return {1.0, 0.0, 3.0}; - case kPidFreewheelingSampleQuality: - return {10.0, 0.0, 10.0}; - case kPidFreewheelingOscillatorQuality: - return {3.0, 0.0, 3.0}; - case kPidSustainCancelsRelease: - return {0.0, 0.0, 1.0}; - case kPidAftertouch: - return {0.0, 0.0, 1.0}; - case kPidPitchBend: - return {0.0, -1.0, 1.0}; - case kPidEditorOpen: - return {0.0, 0.0, 1.0}; - case kPidNumOutputs: - return {2.0, 2.0, 16.0}; - default: - if (id >= kPidCC0 && id <= kPidCCLast) - return {0.0, 0.0, 1.0}; - else if (id >= kPidLevel0 && id <= kPidLevelLast) - return {0.0, 0.0, 1.0}; - throw std::runtime_error("Bad parameter ID"); - } - } -}; - -inline int32 integerLog2(int32 x) -{ - int32 l = 0; - for (; x > 1; x /= 2) ++l; - return l; -} diff --git a/plugins/vst/SfizzVstProcessor.cpp b/plugins/vst/SfizzVstProcessor.cpp deleted file mode 100644 index dc7ab601f..000000000 --- a/plugins/vst/SfizzVstProcessor.cpp +++ /dev/null @@ -1,981 +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 "SfizzVstProcessor.h" -#include "SfizzVstController.h" -#include "SfizzVstState.h" -#include "SfizzVstParameters.h" -#include "SfizzVstIDs.h" -#include "sfizz/import/sfizz_import.h" -#include "plugin/SfizzFileScan.h" -#include "plugin/InstrumentDescription.h" -#include "base/source/fstreamer.h" -#include "base/source/updatehandler.h" -#include "pluginterfaces/vst/ivstevents.h" -#include "pluginterfaces/vst/ivstparameterchanges.h" -#include -#include -#include - -static const char defaultSfzText[] = - "sample=*sine" "\n" - "ampeg_attack=0.02 ampeg_release=0.1" "\n"; - -enum { - kMidiEventMaximumSize = 4, - kOscTempSize = 8192, -}; - -static const char* kRingIdMidi = "Mid"; -static const char* kRingIdOsc = "Osc"; - -static const char* kMsgIdSetNumVoices = "SetNumVoices"; -static const char* kMsgIdSetOversampling = "SetOversampling"; -static const char* kMsgIdSetPreloadSize = "SetPreloadSize"; -static const char* kMsgIdReceiveOSC = "ReceiveOSC"; -static const char* kMsgIdNoteEvents = "NoteEvents"; - -static constexpr std::chrono::milliseconds kBackgroundIdleInterval { 20 }; - -SfizzVstProcessor::SfizzVstProcessor() - : _oscTemp(new uint8_t[kOscTempSize]), - _fifoToWorker(64 * 1024), _fifoMessageFromUi(64 * 1024) -{ - setControllerClass(SfizzVstController::cid); - - // ensure the SFZ path exists: - // the one specified in the configuration, otherwise the fallback - absl::optional configDefaultPath = SfizzPaths::getSfzConfigDefaultPath(); - if (configDefaultPath) { - std::error_code ec; - fs::create_directory(*configDefaultPath, ec); - } - else { - fs::path fallbackDefaultPath = SfizzPaths::getSfzFallbackDefaultPath(); - std::error_code ec; - fs::create_directory(fallbackDefaultPath, ec); - } -} - -SfizzVstProcessor::~SfizzVstProcessor() -{ - try { - stopBackgroundWork(); - } catch (const std::exception& e) { - fprintf(stderr, "Caught exception: %s\n", e.what()); - } -} - -tresult PLUGIN_API SfizzVstProcessor::initialize(FUnknown* context) -{ - tresult result = AudioEffect::initialize(context); - if (result != kResultTrue) - return result; - - // initialize the update handler - Steinberg::UpdateHandler::instance(); - - _queuedMessages = Steinberg::owned(new QueuedUpdates); - _playStateUpdate = Steinberg::owned(new PlayStateUpdate); - _sfzUpdate = Steinberg::owned(new SfzUpdate); - _sfzDescriptionUpdate = Steinberg::owned(new SfzDescriptionUpdate); - _scalaUpdate = Steinberg::owned(new ScalaUpdate); - _automationUpdate = Steinberg::owned(new AutomationUpdate); - - _queuedMessages->addDependent(this); - _playStateUpdate->addDependent(this); - _sfzUpdate->addDependent(this); - _sfzDescriptionUpdate->addDependent(this); - _scalaUpdate->addDependent(this); - _automationUpdate->addDependent(this); - - addAudioOutput(STR16("Audio Output 1"), Vst::SpeakerArr::kStereo); - addEventInput(STR16("Event Input"), 1); - - _state = SfizzVstState(); - - // allocate needed space to track CC values - _state.controllers.resize(sfz::config::numCCs); - - fprintf(stderr, "[sfizz] new synth\n"); - _synth.reset(new sfz::Sfizz); - - auto onMessage = +[](void* data, int delay, const char* path, const char* sig, const sfizz_arg_t* args) - { - auto *self = reinterpret_cast(data); - self->receiveOSC(delay, path, sig, args); - }; - _client = _synth->createClient(this); - _synth->setReceiveCallback(*_client, onMessage); - _synth->setBroadcastCallback(onMessage, this); - - _currentStretchedTuning = 0.0; - loadSfzFileOrDefault({}, false); - - _synth->bpmTempo(0, 120); - _timeSigNumerator = 4; - _timeSigDenominator = 4; - _synth->timeSignature(0, _timeSigNumerator, _timeSigDenominator); - _synth->timePosition(0, 0, 0); - _synth->playbackState(0, 0); - - _noteEventsCurrentCycle.fill(-1.0f); - - _editorIsOpen = false; - - return result; -} - -tresult PLUGIN_API SfizzVstProcessor::terminate() -{ - _queuedMessages->removeDependent(this); - _playStateUpdate->removeDependent(this); - _sfzUpdate->removeDependent(this); - _sfzDescriptionUpdate->removeDependent(this); - _scalaUpdate->removeDependent(this); - _automationUpdate->removeDependent(this); - - return AudioEffect::terminate(); -} - -tresult PLUGIN_API SfizzVstProcessor::setBusArrangements(Vst::SpeakerArrangement* inputs, int32 numIns, Vst::SpeakerArrangement* outputs, int32 numOuts) -{ - bool allStereo { true }; - for (unsigned o = 0; o < numOuts; ++o) - allStereo &= (outputs[o] == Vst::SpeakerArr::kStereo); - - if (!allStereo) - return kResultFalse; - - return AudioEffect::setBusArrangements(inputs, numIns, outputs, numOuts); -} - -tresult PLUGIN_API SfizzVstProcessor::connect(IConnectionPoint* other) -{ - tresult result = AudioEffect::connect(other); - if (result != kResultTrue) - return result; - - // when controller connects, send these messages that we couldn't earlier - _queuedMessages->deferUpdate(); - - return kResultTrue; -} - -tresult PLUGIN_API SfizzVstProcessor::setState(IBStream* stream) -{ - SfizzVstState s; - - tresult r = s.load(stream); - if (r != kResultTrue) - return r; - - // check the files to really exist, otherwise search them - for (std::string* statePath : { &s.sfzFile, &s.scalaFile }) { - if (statePath->empty()) - continue; - - fs::path pathOrig = fs::u8path(*statePath); - std::error_code ec; - if (fs::is_regular_file(pathOrig, ec)) - continue; - - fprintf(stderr, "[Sfizz] searching for missing file: %s\n", pathOrig.filename().u8string().c_str()); - - SfzFileScan& fileScan = SfzFileScan::getInstance(); - fs::path pathFound; - if (!fileScan.locateRealFile(pathOrig, pathFound)) - fprintf(stderr, "[Sfizz] file not found: %s\n", pathOrig.filename().u8string().c_str()); - else { - fprintf(stderr, "[Sfizz] file found: %s\n", pathFound.u8string().c_str()); - *statePath = pathFound.u8string(); - } - } - - // - std::lock_guard lock(_processMutex); - _state = s; - - // allocate needed space to track CC values - _state.controllers.resize(sfz::config::numCCs); - - syncStateToSynth(); - - return r; -} - -tresult PLUGIN_API SfizzVstProcessor::getState(IBStream* stream) -{ - std::lock_guard lock(_processMutex); - return _state.store(stream); -} - -void SfizzVstProcessor::syncStateToSynth() -{ - sfz::Sfizz* synth = _synth.get(); - - if (!synth) - return; - - loadSfzFileOrDefault(_state.sfzFile, true); - synth->setVolume(_state.volume); - synth->setNumVoices(_state.numVoices); - synth->setOversamplingFactor(1 << _state.oversamplingLog2); - synth->setPreloadSize(_state.preloadSize); - synth->loadScalaFile(_state.scalaFile); - synth->setScalaRootKey(_state.scalaRootKey); - synth->setTuningFrequency(_state.tuningFrequency); - synth->loadStretchTuningByRatio(_state.stretchedTuning); - if (_state.lastKeyswitch >= 0 && _state.lastKeyswitch <= 127) { - synth->hdNoteOn(0, _state.lastKeyswitch, 1.0f); - synth->hdNoteOff(1, _state.lastKeyswitch, 0.0f); - } -} - -tresult PLUGIN_API SfizzVstProcessor::canProcessSampleSize(int32 symbolicSampleSize) -{ - if (symbolicSampleSize != Vst::kSample32) - return kResultFalse; - - return kResultTrue; -} - -tresult PLUGIN_API SfizzVstProcessor::setActive(TBool state) -{ - sfz::Sfizz* synth = _synth.get(); - - if (bool(state) == _isActive) - return kResultTrue; - - if (!synth) - return kResultFalse; - - if (state) { - synth->setSampleRate(processSetup.sampleRate); - synth->setSamplesPerBlock(processSetup.maxSamplesPerBlock); - _rmsFollower.init(processSetup.sampleRate); - initializeEventProcessor(processSetup, kNumParameters); - startBackgroundWork(); - } else { - stopBackgroundWork(); - synth->allSoundOff(); - } - - _isActive = bool(state); - return kResultTrue; -} - -tresult PLUGIN_API SfizzVstProcessor::process(Vst::ProcessData& data) -{ - sfz::Sfizz& synth = *_synth; - - std::unique_lock lock(_processMutex, std::defer_lock); - if (data.processMode == Vst::kOffline) - lock.lock(); - else - (void)lock.try_lock(); - - if (data.processContext) - updateTimeInfo(*data.processContext); - - const uint32 numFrames = data.numSamples; - _canPerformEventsAndParameters = lock.owns_lock(); - bool editorWasOpen = _editorIsOpen; - processUnorderedEvents(numFrames, data.inputParameterChanges, data.inputEvents); - - if (data.numOutputs < 1) // flush mode - return kResultTrue; - - constexpr uint32 numChannels = 2; - constexpr uint32 maxChannels = 16; - float* outputs[maxChannels]; - const auto numMonoChannels = data.numOutputs * numChannels; - - for (unsigned o = 0; o < data.numOutputs; ++o) { - assert(data.outputs[o].numChannels == numChannels); - for (unsigned c = 0; c < numChannels; ++c) - outputs[numChannels * o + c] = data.outputs[o].channelBuffers32[c]; - } - - if (!editorWasOpen && _editorIsOpen) { - if (Vst::IParameterChanges* pcs = data.outputParameterChanges) { - int32 index; - if (Vst::IParamValueQueue* vq = pcs->addParameterData(kPidNumOutputs, index)) - vq->addPoint(0, SfizzRange::getForParameter(kPidNumOutputs).normalize(numMonoChannels), index); - } - } - - if (!lock.owns_lock()) { - for (unsigned c = 0; c < numChannels; ++c) - std::memset(outputs[c], 0, numFrames * sizeof(float)); - - for (unsigned o = 0; o < data.numOutputs; ++o) - data.outputs[o].silenceFlags = 3; - - return kResultTrue; - } - - if (data.processMode == Vst::kOffline) - synth.enableFreeWheeling(); - else - synth.disableFreeWheeling(); - - processMessagesFromUi(); - - synth.setVolume(_state.volume); - synth.setScalaRootKey(_state.scalaRootKey); - synth.setTuningFrequency(_state.tuningFrequency); - if (_currentStretchedTuning != _state.stretchedTuning) { - synth.loadStretchTuningByRatio(_state.stretchedTuning); - _currentStretchedTuning = _state.stretchedTuning; - } - synth.setSampleQuality(sfz::Sfizz::ProcessLive, _state.sampleQuality); - synth.setOscillatorQuality(sfz::Sfizz::ProcessLive, _state.oscillatorQuality); - synth.setSampleQuality(sfz::Sfizz::ProcessFreewheeling, _state.freewheelingSampleQuality); - synth.setOscillatorQuality(sfz::Sfizz::ProcessFreewheeling, _state.freewheelingOscillatorQuality); - synth.setSustainCancelsRelease(_state.sustainCancelsRelease); - - synth.renderBlock(outputs, numFrames, data.numOutputs); - - // Update levels, if editor is open, otherwise skip - RMSFollower& rmsFollower = _rmsFollower; - if (_editorIsOpen) { - rmsFollower.process((const float**)outputs, numFrames, numMonoChannels); - float levels[maxChannels]; - rmsFollower.getRMS(levels, numMonoChannels); - if (Vst::IParameterChanges* pcs = data.outputParameterChanges) { - int32 index; - for (int c = 0; c < numMonoChannels; ++c) { - if (Vst::IParamValueQueue* vq = pcs->addParameterData(kPidLevel0 + c, index)) - vq->addPoint(0, levels[c], index); - } - } - } - else - rmsFollower.clear(); - - // Request OSC updates - sfz::Client& client = *_client; - synth.sendMessage(client, 0, "/sw/last/current", "", nullptr); - - // - NoteUpdate::Item noteEvents[128]; - size_t numNoteEvents = 0; - for (uint32 key = 0; key < 128; ++key) { - float value = _noteEventsCurrentCycle[key]; - if (value < 0.0f) - continue; - noteEvents[numNoteEvents++] = std::make_pair(key, value); - _noteEventsCurrentCycle[key] = -1.0f; - } - if (numNoteEvents > 0) { - if (writeWorkerMessage(kMsgIdNoteEvents, noteEvents, numNoteEvents * sizeof(noteEvents[0]))) - _semaToWorker.post(); - } - - return kResultTrue; -} - -void SfizzVstProcessor::updateTimeInfo(const Vst::ProcessContext& context) -{ - sfz::Sfizz& synth = *_synth; - - if (context.state & context.kTempoValid) - synth.bpmTempo(0, static_cast(context.tempo)); - - if (context.state & context.kTimeSigValid) { - _timeSigNumerator = context.timeSigNumerator; - _timeSigDenominator = context.timeSigDenominator; - synth.timeSignature(0, _timeSigNumerator, _timeSigDenominator); - } - - if (context.state & context.kProjectTimeMusicValid) { - double beats = context.projectTimeMusic * 0.25 * _timeSigDenominator; - double bars = beats / _timeSigNumerator; - beats -= int(bars) * _timeSigNumerator; - synth.timePosition(0, int(bars), beats); - } - - synth.playbackState(0, (context.state & context.kPlaying) != 0); -} - -void SfizzVstProcessor::playOrderedParameter(int32 sampleOffset, Vst::ParamID id, Vst::ParamValue value) -{ - if (!_canPerformEventsAndParameters) - return; - - sfz::Sfizz& synth = *_synth; - const SfizzRange range = SfizzRange::getForParameter(id); - - switch (id) { - case kPidVolume: - _state.volume = range.denormalize(value); - break; - case kPidNumVoices: - { - int32 data = static_cast(range.denormalize(value)); - _state.numVoices = data; - if (writeWorkerMessage(kMsgIdSetNumVoices, &data, sizeof(data))) - _semaToWorker.post(); - } - break; - case kPidOversampling: - { - int32 data = static_cast(range.denormalize(value)); - _state.oversamplingLog2 = data; - if (writeWorkerMessage(kMsgIdSetOversampling, &data, sizeof(data))) - _semaToWorker.post(); - } - break; - case kPidPreloadSize: - { - int32 data = static_cast(range.denormalize(value)); - _state.preloadSize = data; - if (writeWorkerMessage(kMsgIdSetPreloadSize, &data, sizeof(data))) - _semaToWorker.post(); - } - break; - case kPidScalaRootKey: - _state.scalaRootKey = static_cast(range.denormalize(value)); - break; - case kPidTuningFrequency: - _state.tuningFrequency = range.denormalize(value); - break; - case kPidStretchedTuning: - _state.stretchedTuning = range.denormalize(value); - break; - case kPidSampleQuality: - _state.sampleQuality = static_cast(range.denormalize(value)); - break; - case kPidOscillatorQuality: - _state.oscillatorQuality = static_cast(range.denormalize(value)); - break; - case kPidFreewheelingSampleQuality: - _state.freewheelingSampleQuality = static_cast(range.denormalize(value)); - break; - case kPidFreewheelingOscillatorQuality: - _state.freewheelingOscillatorQuality = static_cast(range.denormalize(value)); - break; - case kPidSustainCancelsRelease: - _state.sustainCancelsRelease = (range.denormalize(value) > 0.0f); - break; - case kPidAftertouch: - synth.hdChannelAftertouch(sampleOffset, value); - break; - case kPidPitchBend: - synth.hdPitchWheel(sampleOffset, range.denormalize(value)); - break; - case kPidEditorOpen: - _editorIsOpen = value != 0; - break; - default: - if (id >= kPidCC0 && id <= kPidCCLast) { - int32 ccNumber = static_cast(id - kPidCC0); - synth.automateHdcc(sampleOffset, ccNumber, value); - _state.controllers[ccNumber] = value; - } - break; - } -} - -void SfizzVstProcessor::playOrderedEvent(const Vst::Event& event) -{ - if (!_canPerformEventsAndParameters) - return; - - sfz::Sfizz& synth = *_synth; - const int32 sampleOffset = event.sampleOffset; - - switch (event.type) { - case Vst::Event::kNoteOnEvent: { - int pitch = event.noteOn.pitch; - if (pitch < 0 || pitch >= 128) - break; - if (event.noteOn.velocity <= 0.0f) { - synth.noteOff(sampleOffset, pitch, 0); - _noteEventsCurrentCycle[pitch] = 0.0f; - } - else { - synth.hdNoteOn(sampleOffset, pitch, event.noteOn.velocity); - _noteEventsCurrentCycle[pitch] = event.noteOn.velocity; - } - break; - } - case Vst::Event::kNoteOffEvent: { - int pitch = event.noteOn.pitch; - if (pitch < 0 || pitch >= 128) - break; - synth.hdNoteOff(sampleOffset, pitch, event.noteOff.velocity); - _noteEventsCurrentCycle[pitch] = 0.0f; - break; - } - case Vst::Event::kPolyPressureEvent: { - int pitch = event.polyPressure.pitch; - if (pitch < 0 || pitch >= 128) - break; - synth.hdPolyAftertouch(sampleOffset, pitch, event.polyPressure.pressure); - break; - } - } -} - -void SfizzVstProcessor::processMessagesFromUi() -{ - sfz::Sfizz& synth = *_synth; - sfz::Client& client = *_client; - Ring_Buffer& fifo = _fifoMessageFromUi; - RTMessage header; - - while (fifo.peek(header) && fifo.size_used() >= sizeof(header) + header.size) { - fifo.discard(sizeof(header)); - - if (header.type == kRingIdMidi) { - if (header.size > kMidiEventMaximumSize) { - fifo.discard(header.size); - continue; - } - - uint8_t data[kMidiEventMaximumSize] = {}; - fifo.get(data, header.size); - - // interpret the MIDI message - switch (data[0] & 0xf0) { - case 0x80: - synth.noteOff(0, data[1] & 0x7f, data[2] & 0x7f); - break; - case 0x90: - synth.noteOn(0, data[1] & 0x7f, data[2] & 0x7f); - break; - case 0xb0: - synth.automateHdcc(0, data[1] & 0x7f, static_cast(data[2] & 0x7f) / 127.0f); - break; - case 0xe0: - synth.pitchWheel(0, (data[2] << 7) + data[1] - 8192); - break; - } - } - else if (header.type == kRingIdOsc) { - uint8_t* oscTemp = _oscTemp.get(); - - if (header.size > kOscTempSize) { - fifo.discard(header.size); - continue; - } - - fifo.get(oscTemp, header.size); - - const char* path; - const char* sig; - const sfizz_arg_t* args; - uint8_t buffer[1024]; - if (sfizz_extract_message(oscTemp, header.size, buffer, sizeof(buffer), &path, &sig, &args) > 0) - synth.sendMessage(client, 0, path, sig, args); - } - else { - assert(false); - return; - } - } -} - -tresult PLUGIN_API SfizzVstProcessor::notify(Vst::IMessage* message) -{ - // Note(jpc) this notification is not handled by the RT thread - - tresult result = AudioEffect::notify(message); - if (result != kResultFalse) - return result; - - const char* id = message->getMessageID(); - Vst::IAttributeList* attr = message->getAttributes(); - - if (!std::strcmp(id, "LoadSfz")) { - const void* data = nullptr; - uint32 size = 0; - result = attr->getBinary("File", data, size); - - if (result != kResultTrue) - return result; - - std::unique_lock lock(_processMutex); - _state.sfzFile.assign(static_cast(data), size); - loadSfzFileOrDefault(_state.sfzFile, false); - lock.unlock(); - } - else if (!std::strcmp(id, "LoadScala")) { - const void* data = nullptr; - uint32 size = 0; - result = attr->getBinary("File", data, size); - - if (result != kResultTrue) - return result; - - std::unique_lock lock(_processMutex); - _state.scalaFile.assign(static_cast(data), size); - _synth->loadScalaFile(_state.scalaFile); - lock.unlock(); - - _scalaUpdate->setPath(_state.scalaFile); - _scalaUpdate->deferUpdate(); - } - else if (!std::strcmp(id, "MidiMessage")) { - const void* data = nullptr; - uint32 size = 0; - result = attr->getBinary("Data", data, size); - if (size < kMidiEventMaximumSize) - writeMessage(_fifoMessageFromUi, kRingIdMidi, data, size); - } - else if (!std::strcmp(id, "OscMessage")) { - const void* data = nullptr; - uint32 size = 0; - result = attr->getBinary("Data", data, size); - writeMessage(_fifoMessageFromUi, kRingIdOsc, data, size); - } - - return result; -} - -void PLUGIN_API SfizzVstProcessor::update(FUnknown* changedUnknown, int32 message) -{ - if (processUpdate(changedUnknown, message)) - return; - - AudioEffect::update(changedUnknown, message); -} - -bool SfizzVstProcessor::processUpdate(FUnknown* changedUnknown, int32 message) -{ - if (QueuedUpdates* update = FCast(changedUnknown)) { - for (FObject* queuedUpdate : update->getUpdates(this)) - processUpdate(queuedUpdate, message); - return true; - } - - if (OSCUpdate* update = FCast(changedUnknown)) { - if (IPtr msg = update->convertToMessage(this)) - sendMessage(msg); - return true; - } - - if (PlayStateUpdate* update = FCast(changedUnknown)) { - if (IPtr msg = update->convertToMessage(this)) - sendMessage(msg); - return true; - } - - if (NoteUpdate* update = FCast(changedUnknown)) { - if (IPtr msg = update->convertToMessage(this)) - sendMessage(msg); - return true; - } - - if (SfzUpdate* update = FCast(changedUnknown)) { - if (IPtr msg = update->convertToMessage(this)) - sendMessage(msg); - return true; - } - - if (SfzDescriptionUpdate* update = FCast(changedUnknown)) { - if (IPtr msg = update->convertToMessage(this)) - sendMessage(msg); - return true; - } - - if (ScalaUpdate* update = FCast(changedUnknown)) { - if (IPtr msg = update->convertToMessage(this)) - sendMessage(msg); - return true; - } - - if (AutomationUpdate* update = FCast(changedUnknown)) { - if (IPtr msg = update->convertToMessage(this)) - sendMessage(msg); - return true; - } - - return false; -} - -void SfizzVstProcessor::receiveOSC(int delay, const char* path, const char* sig, const sfizz_arg_t* args) -{ - if (!strcmp(path, "/sw/last/current") && sig) - { - if (sig[0] == 'i') - _state.lastKeyswitch = args[0].i; - else if (sig[0] == 'N') - _state.lastKeyswitch = -1; - } - - uint8_t* oscTemp = _oscTemp.get(); - uint32 oscSize = sfizz_prepare_message(oscTemp, kOscTempSize, path, sig, args); - if (oscSize <= kOscTempSize) { - if (writeWorkerMessage(kMsgIdReceiveOSC, oscTemp, oscSize)) - _semaToWorker.post(); - } -} - -void SfizzVstProcessor::loadSfzFileOrDefault(const std::string& filePath, bool initParametersFromState) -{ - sfz::Sfizz& synth = *_synth; - - if (!filePath.empty()) { - sfizz_load_or_import_file(synth.handle(), filePath.c_str(), nullptr); - } - else { - synth.loadSfzString("default.sfz", defaultSfzText); - } - - const std::string descBlob = getDescriptionBlob(synth.handle()); - { - std::vector> newControllers(sfz::config::numCCs); - const std::vector> oldControllers = std::move(_state.controllers); - // collect initial CC from instrument - const InstrumentDescription desc = parseDescriptionBlob(descBlob); - for (uint32 cc = 0; cc < sfz::config::numCCs; ++cc) { - if (desc.ccUsed.test(cc)) - newControllers[cc] = desc.ccValue[cc]; - } - // set CC from existing state - if (initParametersFromState) { - for (uint32 cc = 0; cc < sfz::config::numCCs; ++cc) { - if (absl::optional value = oldControllers[cc]) { - newControllers[cc] = *value; - synth.automateHdcc(0, int(cc), *value); - } - } - } - _state.controllers = std::move(newControllers); - } - - // create a message which requests the controller to automate initial parameters - std::vector automationItems; - automationItems.reserve(sfz::config::numCCs); - for (uint32 cc = 0; cc < sfz::config::numCCs; ++cc) { - Vst::ParamID pid = kPidCC0 + cc; - float value = _state.controllers[cc].value_or(0.0f); - automationItems.emplace_back(pid, value); - } - - // send message - _sfzUpdate->setPath(filePath); - _sfzUpdate->deferUpdate(); - _sfzDescriptionUpdate->setDescription(descBlob); - _sfzDescriptionUpdate->deferUpdate(); - _automationUpdate->setItems(std::move(automationItems)); - _automationUpdate->deferUpdate(); -} - -void SfizzVstProcessor::doBackgroundWork() -{ - using Clock = std::chrono::steady_clock; - - bool haveDoneIdleWork = false; - Clock::time_point lastIdleWorkTime; - size_t idleCounter = 0; - - for (;;) { - bool isNotified = _semaToWorker.timed_wait(kBackgroundIdleInterval.count()); - - if (!_workRunning) { - // if the quit signal is sent, the semaphore is also signaled - // make sure the count is kept consistent - if (!isNotified) - _semaToWorker.wait(); - break; - } - - const char* id = nullptr; - RTMessagePtr msg; - - if (isNotified) { - msg = readWorkerMessage(); - if (!msg) { - fprintf(stderr, "[Sfizz] message synchronization error in worker\n"); - std::abort(); - } - id = msg->type; - } - - if (id == kMsgIdSetNumVoices) { - int32 value = *msg->payload(); - std::lock_guard lock(_processMutex); - _synth->setNumVoices(value); - } - else if (id == kMsgIdSetOversampling) { - int32 value = *msg->payload(); - std::lock_guard lock(_processMutex); - _synth->setOversamplingFactor(1 << value); - } - else if (id == kMsgIdSetPreloadSize) { - int32 value = *msg->payload(); - std::lock_guard lock(_processMutex); - _synth->setPreloadSize(value); - } - else if (id == kMsgIdReceiveOSC) { - IPtr update = Steinberg::owned( - new OSCUpdate(msg->payload(), msg->size)); - _queuedMessages->enqueue(update); - _queuedMessages->deferUpdate(); - } - else if (id == kMsgIdNoteEvents) { - IPtr update = Steinberg::owned( - new NoteUpdate(msg->payload(), msg->size / sizeof(NoteUpdate::Item))); - _queuedMessages->enqueue(update); - _queuedMessages->deferUpdate(); - } - - Clock::time_point currentTime = Clock::now(); - if (!haveDoneIdleWork || currentTime - lastIdleWorkTime > kBackgroundIdleInterval) { - doBackgroundIdle(idleCounter++); - haveDoneIdleWork = true; - lastIdleWorkTime = currentTime; - } - } -} - -void SfizzVstProcessor::doBackgroundIdle(size_t idleCounter) -{ - { - SfizzPlayState ps; - ps.activeVoices = _synth->getNumActiveVoices(); - _playStateUpdate->setState(ps); - _playStateUpdate->deferUpdate(); - } - - if (idleCounter % 25 == 0) { - if (_synth->shouldReloadFile()) { - fprintf(stderr, "[Sfizz] sfz file has changed, reloading\n"); - std::lock_guard lock(_processMutex); - loadSfzFileOrDefault(_state.sfzFile, false); - } - if (_synth->shouldReloadScala()) { - fprintf(stderr, "[Sfizz] scala file has changed, reloading\n"); - std::lock_guard lock(_processMutex); - _synth->loadScalaFile(_state.scalaFile); - } - } -} - -void SfizzVstProcessor::startBackgroundWork() -{ - if (_workRunning) - return; - - _workRunning = true; - _worker = std::thread([this]() { doBackgroundWork(); }); -} - -void SfizzVstProcessor::stopBackgroundWork() -{ - if (!_workRunning) - return; - - _workRunning = false; - _semaToWorker.post(); - _worker.join(); - - while (_semaToWorker.try_wait()) { - if (!discardWorkerMessage()) { - fprintf(stderr, "[Sfizz] message synchronization error in processor\n"); - std::abort(); - } - } -} - -bool SfizzVstProcessor::writeWorkerMessage(const char* type, const void* data, uintptr_t size) -{ - return writeMessage(_fifoToWorker, type, data, size); -} - -SfizzVstProcessor::RTMessagePtr SfizzVstProcessor::readWorkerMessage() -{ - RTMessage header; - - if (!_fifoToWorker.peek(header)) - return nullptr; - if (_fifoToWorker.size_used() < sizeof(header) + header.size) - return nullptr; - - RTMessagePtr msg { reinterpret_cast(std::malloc(sizeof(header) + header.size)) }; - if (!msg) - throw std::bad_alloc(); - - msg->type = header.type; - msg->size = header.size; - _fifoToWorker.discard(sizeof(header)); - _fifoToWorker.get(const_cast(msg->payload()), header.size); - - return msg; -} - -bool SfizzVstProcessor::discardWorkerMessage() -{ - RTMessage header; - - if (!_fifoToWorker.peek(header)) - return false; - if (_fifoToWorker.size_used() < sizeof(header) + header.size) - return false; - - _fifoToWorker.discard(sizeof(header) + header.size); - return true; -} - -bool SfizzVstProcessor::writeMessage(Ring_Buffer& fifo, const char* type, const void* data, uintptr_t size) -{ - RTMessage header; - header.type = type; - header.size = size; - - if (fifo.size_free() < sizeof(header) + size) - return false; - - fifo.put(header); - fifo.put(static_cast(data), size); - return true; -} - -FUnknown* SfizzVstProcessor::createInstance(void*) -{ - return static_cast(new SfizzVstProcessor); -} - -FUnknown* SfizzVstProcessorMulti::createInstance(void*) -{ - return static_cast(new SfizzVstProcessorMulti); -} - -template <> -FUnknown* createInstance(void* context) -{ - return SfizzVstProcessor::createInstance(context); -} - -tresult PLUGIN_API SfizzVstProcessorMulti::initialize(FUnknown* context) -{ - tresult res = SfizzVstProcessor::initialize(context); - if (res != kResultFalse) { - addAudioOutput(STR16("Audio Output 2"), Vst::SpeakerArr::kStereo); - addAudioOutput(STR16("Audio Output 3"), Vst::SpeakerArr::kStereo); - addAudioOutput(STR16("Audio Output 4"), Vst::SpeakerArr::kStereo); - addAudioOutput(STR16("Audio Output 5"), Vst::SpeakerArr::kStereo); - addAudioOutput(STR16("Audio Output 6"), Vst::SpeakerArr::kStereo); - addAudioOutput(STR16("Audio Output 7"), Vst::SpeakerArr::kStereo); - addAudioOutput(STR16("Audio Output 8"), Vst::SpeakerArr::kStereo); - } - _multi = true; - _rmsFollower.setNumOutputs(16); - return res; -} - -template <> -FUnknown* createInstance(void* context) -{ - return SfizzVstProcessorMulti::createInstance(context); -} - -FUID SfizzVstProcessor::cid = SfizzVstProcessor_cid; -FUID SfizzVstProcessorMulti::cid = SfizzVstProcessor_cid; diff --git a/plugins/vst/SfizzVstProcessor.h b/plugins/vst/SfizzVstProcessor.h deleted file mode 100644 index 0f983036e..000000000 --- a/plugins/vst/SfizzVstProcessor.h +++ /dev/null @@ -1,146 +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 "SfizzVstState.h" -#include "SfizzVstUpdates.h" -#include "OrderedEventProcessor.h" -#include "plugin/RMSFollower.h" -#include "sfizz/RTSemaphore.h" -#include "ring_buffer/ring_buffer.h" -#include "public.sdk/source/vst/vstaudioeffect.h" -#include -#include -#include -#include -#include -#include - -using namespace Steinberg; - -class SfizzVstProcessor : public Vst::AudioEffect, - public OrderedEventProcessor { -public: - SfizzVstProcessor(); - ~SfizzVstProcessor(); - - tresult PLUGIN_API initialize(FUnknown* context) override; - tresult PLUGIN_API terminate() override; - tresult PLUGIN_API setBusArrangements(Vst::SpeakerArrangement* inputs, int32 numIns, Vst::SpeakerArrangement* outputs, int32 numOuts) override; - - tresult PLUGIN_API connect(IConnectionPoint* other) override; - - tresult PLUGIN_API setState(IBStream* stream) override; - tresult PLUGIN_API getState(IBStream* stream) override; - void syncStateToSynth(); - - tresult PLUGIN_API canProcessSampleSize(int32 symbolicSampleSize) override; - tresult PLUGIN_API setActive(TBool state) override; - tresult PLUGIN_API process(Vst::ProcessData& data) override; - - // OrderedEventProcessor - void playOrderedParameter(int32 sampleOffset, Vst::ParamID id, Vst::ParamValue value); - void playOrderedEvent(const Vst::Event& event); - - void processMessagesFromUi(); - - tresult PLUGIN_API notify(Vst::IMessage* message) override; - void PLUGIN_API update(FUnknown* changedUnknown, int32 message) override; - - static FUnknown* createInstance(void*); - - static FUID cid; - - // --- Sfizz stuff here below --- -protected: - RMSFollower _rmsFollower {}; - bool _multi { false }; -private: - // synth state. acquire processMutex before accessing - std::unique_ptr _synth; - bool _isActive = false; - SfizzVstState _state; - float _currentStretchedTuning = 0; - - // whether allowed to perform events (owns the processing lock) - bool _canPerformEventsAndParameters {}; - - // level meters - bool _editorIsOpen = false; - - // updates - IPtr _queuedMessages; - IPtr _playStateUpdate; - IPtr _sfzUpdate; - IPtr _sfzDescriptionUpdate; - IPtr _scalaUpdate; - IPtr _automationUpdate; - bool processUpdate(FUnknown* changedUnknown, int32 message); - - // client - sfz::ClientPtr _client; - std::unique_ptr _oscTemp; - void receiveOSC(int delay, const char* path, const char* sig, const sfizz_arg_t* args); - - // misc - void loadSfzFileOrDefault(const std::string& filePath, bool initParametersFromState); - - // note event tracking - std::array _noteEventsCurrentCycle; // 0: off, >0: on, <0: no change - - // worker and thread sync - std::thread _worker; - volatile bool _workRunning = false; - Ring_Buffer _fifoToWorker; - RTSemaphore _semaToWorker; - Ring_Buffer _fifoMessageFromUi; - SpinMutex _processMutex; - - // time info - int _timeSigNumerator = 0; - int _timeSigDenominator = 0; - void updateTimeInfo(const Vst::ProcessContext& context); - - // messaging - struct RTMessage { - const char* type; - uintptr_t size; - // 32-bit aligned data after header - template const T* payload() const; - }; - struct RTMessageDelete { - void operator()(RTMessage* x) const noexcept { std::free(x); } - }; - typedef std::unique_ptr RTMessagePtr; - - // worker - void doBackgroundWork(); - void doBackgroundIdle(size_t idleCounter); - void startBackgroundWork(); - void stopBackgroundWork(); - // writer - bool writeWorkerMessage(const char* type, const void* data, uintptr_t size); - // reader - RTMessagePtr readWorkerMessage(); - bool discardWorkerMessage(); - - // generic - static bool writeMessage(Ring_Buffer& fifo, const char* type, const void* data, uintptr_t size); -}; - -class SfizzVstProcessorMulti : public SfizzVstProcessor { -public: - tresult PLUGIN_API initialize(FUnknown* context) override; - static FUnknown* createInstance(void*); - static FUID cid; -}; -//------------------------------------------------------------------------------ - -template const T* SfizzVstProcessor::RTMessage::payload() const -{ - return reinterpret_cast( - reinterpret_cast(this) + sizeof(*this)); -} diff --git a/plugins/vst/SfizzVstState.cpp b/plugins/vst/SfizzVstState.cpp deleted file mode 100644 index 091995915..000000000 --- a/plugins/vst/SfizzVstState.cpp +++ /dev/null @@ -1,187 +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 "SfizzVstState.h" -#include -#include -#include - -tresult SfizzVstState::load(IBStream* state) -{ - IBStreamer s(state, kLittleEndian); - - uint64 version = 0; - if (!s.readInt64u(version)) - return kResultFalse; - - if (version > currentStateVersion) - return kResultFalse; - - if (const char* str = s.readStr8()) - sfzFile = str; - else - return kResultFalse; - - if (!s.readFloat(volume)) - return kResultFalse; - - if (!s.readInt32(numVoices)) - return kResultFalse; - - if (!s.readInt32(oversamplingLog2)) - return kResultFalse; - - if (!s.readInt32(preloadSize)) - return kResultFalse; - - const SfizzVstState defaults; - - if (version >= 1) { - if (const char* str = s.readStr8()) - scalaFile = str; - else - return kResultFalse; - - if (!s.readInt32(scalaRootKey)) - return kResultFalse; - - if (!s.readFloat(tuningFrequency)) - return kResultFalse; - - if (!s.readFloat(stretchedTuning)) - return kResultFalse; - } - else { - scalaFile = defaults.scalaFile; - scalaRootKey = defaults.scalaRootKey; - tuningFrequency = defaults.tuningFrequency; - stretchedTuning = defaults.stretchedTuning; - } - - if (version >= 3) { - if (!s.readInt32(sampleQuality)) - return kResultFalse; - - if (!s.readInt32(oscillatorQuality)) - return kResultFalse; - } - else { - sampleQuality = defaults.sampleQuality; - oscillatorQuality = defaults.oscillatorQuality; - } - - if (version >= 5) { - if (!s.readInt32(freewheelingSampleQuality)) - return kResultFalse; - - if (!s.readInt32(freewheelingOscillatorQuality)) - return kResultFalse; - - if (!s.readBool(sustainCancelsRelease)) - return kResultFalse; - } - - if (version >= 4) { - if (!s.readInt32(lastKeyswitch)) - return kResultFalse; - } - else { - lastKeyswitch = -1; - } - - controllers.clear(); - if (version >= 2) { - uint32 count; - if (!s.readInt32u(count)) - return kResultFalse; - controllers.resize(0x10000); - uint32 size = 0; - for (uint32 i = 0; i < count; ++i) { - uint16 cc; - float value; - if (!s.readInt16u(cc) || !s.readFloat(value)) - return kResultFalse; - controllers[cc] = value; - size = std::max(size, uint32(cc) + 1); - } - controllers.resize(size); - controllers.shrink_to_fit(); - } - - return kResultTrue; -} - -tresult SfizzVstState::store(IBStream* state) const -{ - IBStreamer s(state, kLittleEndian); - - if (!s.writeInt64u(currentStateVersion)) - return kResultFalse; - - if (!s.writeStr8(sfzFile.c_str())) - return kResultFalse; - - if (!s.writeFloat(volume)) - return kResultFalse; - - if (!s.writeInt32(numVoices)) - return kResultFalse; - - if (!s.writeInt32(oversamplingLog2)) - return kResultFalse; - - if (!s.writeInt32(preloadSize)) - return kResultFalse; - - if (!s.writeStr8(scalaFile.c_str())) - return kResultFalse; - - if (!s.writeInt32(scalaRootKey)) - return kResultFalse; - - if (!s.writeFloat(tuningFrequency)) - return kResultFalse; - - if (!s.writeFloat(stretchedTuning)) - return kResultFalse; - - if (!s.writeInt32(sampleQuality)) - return kResultFalse; - - if (!s.writeInt32(oscillatorQuality)) - return kResultFalse; - - if (!s.writeInt32(freewheelingSampleQuality)) - return kResultFalse; - - if (!s.writeInt32(freewheelingOscillatorQuality)) - return kResultFalse; - - if (!s.writeBool(sustainCancelsRelease)) - return kResultFalse; - - if (!s.writeInt32(lastKeyswitch)) - return kResultFalse; - - { - uint32 ccCount = 0; - uint32 ccLimit = uint32(std::min(controllers.size(), size_t(0x10000))); - for (uint32_t cc = 0; cc < ccLimit; ++cc) - ccCount += controllers[cc] != absl::nullopt; - if (!s.writeInt32u(ccCount)) - return kResultFalse; - for (uint32_t cc = 0; cc < ccLimit; ++cc) { - if (absl::optional ccValue = controllers[cc]) { - if (!s.writeInt16u(uint16(cc)) || !s.writeFloat(*ccValue)) - return kResultFalse; - } - } - } - - return kResultTrue; -} - -constexpr uint64 SfizzVstState::currentStateVersion; diff --git a/plugins/vst/SfizzVstState.h b/plugins/vst/SfizzVstState.h deleted file mode 100644 index 3b43ccfa9..000000000 --- a/plugins/vst/SfizzVstState.h +++ /dev/null @@ -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 "base/source/fstreamer.h" -#include -#include -#include - -using namespace Steinberg; - -class SfizzVstState { -public: - SfizzVstState() { sfzFile.reserve(8192); scalaFile.reserve(8192); } - - std::string sfzFile; - float volume = 0; - int32 numVoices = 64; - int32 oversamplingLog2 = 0; - int32 preloadSize = 8192; - std::string scalaFile; - int32 scalaRootKey = 60; - float tuningFrequency = 440.0; - float stretchedTuning = 0.0; - int32 sampleQuality = 2; - int32 oscillatorQuality = 1; - int32 freewheelingSampleQuality = 10; - int32 freewheelingOscillatorQuality = 3; - bool sustainCancelsRelease = false; - int32 lastKeyswitch = -1; - std::vector> controllers; - - static constexpr uint64 currentStateVersion = 5; - - tresult load(IBStream* state); - tresult store(IBStream* state) const; -}; - -struct SfizzPlayState { - uint32 activeVoices; -}; diff --git a/plugins/vst/SfizzVstUpdates.cpp b/plugins/vst/SfizzVstUpdates.cpp deleted file mode 100644 index 5dfcfd3a6..000000000 --- a/plugins/vst/SfizzVstUpdates.cpp +++ /dev/null @@ -1,174 +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 "SfizzVstUpdates.h" -#include -#include - -void QueuedUpdates::enqueue(IPtr update) -{ - std::lock_guard lock(mutex_); - for (std::pair& item : updates_) - item.second.push_back(update); -} - -auto QueuedUpdates::getUpdates(IDependent* dep) -> List -{ - std::lock_guard lock(mutex_); - List list; - auto it = updates_.find(dep); - if (it != updates_.end()) - std::swap(list, it->second); - return list; -} - -void QueuedUpdates::addDependent(IDependent* dep) -{ - std::lock_guard lock(mutex_); - FObject::addDependent(dep); - updates_.emplace(dep, List()); -} - -void QueuedUpdates::removeDependent(IDependent* dep) -{ - std::lock_guard lock(mutex_); - FObject::removeDependent(dep); - updates_.erase(dep); -} - -/// -bool OSCUpdate::saveToAttributes(Vst::IAttributeList* attrs) const -{ - return attrs->setBinary("Data", data(), size()) == kResultTrue; -} - -bool OSCUpdate::loadFromAttributes(Vst::IAttributeList* attrs) -{ - const void* data; - uint32 size; - if (attrs->getBinary("Data", data, size) != kResultTrue) - return false; - const uint8* data8 = reinterpret_cast(data); - data_.assign(data8, data8 + size); - return true; -} - -/// -bool NoteUpdate::saveToAttributes(Vst::IAttributeList* attrs) const -{ - return attrs->setBinary("Events", events_.data(), events_.size() * sizeof(Item)) == kResultTrue; -} - -bool NoteUpdate::loadFromAttributes(Vst::IAttributeList* attrs) -{ - const void* binData = nullptr; - uint32 binSize = 0; - if (attrs->getBinary("Events", binData, binSize) != kResultTrue) - return false; - - const Item* events = reinterpret_cast(binData); - uint32 numEvents = binSize / sizeof(Item); - - events_.assign(events, events + numEvents); - return true; -} - -/// -bool FilePathUpdate::saveFilePathAttributes_(Vst::IAttributeList* attrs) const -{ - std::lock_guard lock(mutex_); - return attrs->setBinary("Path", path_.data(), path_.size()) == kResultTrue; -} - -bool FilePathUpdate::loadFilePathAttributes_(Vst::IAttributeList* attrs) -{ - const void* binData = nullptr; - uint32 binSize = 0; - if (attrs->getBinary("Path", binData, binSize) != kResultTrue) - return false; - std::lock_guard lock(mutex_); - path_.assign(reinterpret_cast(binData), binSize); - return true; -} - -/// -bool SfzUpdate::saveToAttributes(Vst::IAttributeList* attrs) const -{ - return saveFilePathAttributes_(attrs); -} - -bool SfzUpdate::loadFromAttributes(Vst::IAttributeList* attrs) -{ - return loadFilePathAttributes_(attrs); -} - -/// -bool ScalaUpdate::saveToAttributes(Vst::IAttributeList* attrs) const -{ - return saveFilePathAttributes_(attrs); -} - -bool ScalaUpdate::loadFromAttributes(Vst::IAttributeList* attrs) -{ - return loadFilePathAttributes_(attrs); -} - -/// -bool SfzDescriptionUpdate::saveToAttributes(Vst::IAttributeList* attrs) const -{ - std::lock_guard lock(mutex_); - return attrs->setBinary("Blob", description_.data(), description_.size()) == kResultTrue; -} - -bool SfzDescriptionUpdate::loadFromAttributes(Vst::IAttributeList* attrs) -{ - const void* binData = nullptr; - uint32 binSize = 0; - if (attrs->getBinary("Blob", binData, binSize) != kResultTrue) - return false; - std::lock_guard lock(mutex_); - description_.assign(reinterpret_cast(binData), binSize); - return true; -} - -/// -bool PlayStateUpdate::saveToAttributes(Vst::IAttributeList* attrs) const -{ - std::lock_guard lock(mutex_); - return attrs->setInt("ActiveVoices", state_.activeVoices) == kResultTrue; -} - -bool PlayStateUpdate::loadFromAttributes(Vst::IAttributeList* attrs) -{ - int64 activeVoices; - if (attrs->getInt("ActiveVoices", activeVoices) != kResultTrue) - return false; - std::lock_guard lock(mutex_); - state_.activeVoices = static_cast(activeVoices); - return true; -} - -/// -bool AutomationUpdate::saveToAttributes(Vst::IAttributeList* attrs) const -{ - std::lock_guard lock(mutex_); - return attrs->setBinary("Items", items_.data(), items_.size() * sizeof(Item)) == kResultTrue; -} - -bool AutomationUpdate::loadFromAttributes(Vst::IAttributeList* attrs) -{ - const void* binData = nullptr; - uint32 binSize = 0; - if (attrs->getBinary("Items", binData, binSize) != kResultTrue) - return false; - - const Item* events = reinterpret_cast(binData); - uint32 numEvents = binSize / sizeof(Item); - - std::lock_guard lock(mutex_); - items_.assign(events, events + numEvents); - return true; -} diff --git a/plugins/vst/SfizzVstUpdates.h b/plugins/vst/SfizzVstUpdates.h deleted file mode 100644 index 76357d5f3..000000000 --- a/plugins/vst/SfizzVstUpdates.h +++ /dev/null @@ -1,241 +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 "SfizzVstState.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/** - * @brief Update which is convertible with Vst::IMessage back and forth. - */ -template class IConvertibleToMessage { -public: - virtual ~IConvertibleToMessage() {} - - IPtr convertToMessage(Vst::ComponentBase* sender) const; - bool convertFromMessage(Vst::IMessage& message); - static IPtr createFromMessage(Vst::IMessage& message); - -protected: - virtual bool saveToAttributes(Vst::IAttributeList* attrs) const = 0; - virtual bool loadFromAttributes(Vst::IAttributeList* attrs) = 0; -}; - -/** - * @brief Update which notifies a FIFO queue of one-time updates - */ -class QueuedUpdates : public Steinberg::FObject { -public: - using List = std::vector>; - - void enqueue(IPtr update); - List getUpdates(IDependent* dep); - - void addDependent(IDependent* dep) override; - void removeDependent(IDependent* dep) override; - - OBJ_METHODS(QueuedUpdates, FObject) - -private: - std::mutex mutex_; - std::map updates_; -}; - -/** - * @brief Update which notifies a single OSC message - */ -class OSCUpdate : public Steinberg::FObject, - public IConvertibleToMessage { -public: - OSCUpdate() = default; - OSCUpdate(const uint8* data, uint32 size) : data_(data, data + size) {} - const uint8* data() const noexcept { return data_.data(); } - uint32_t size() const noexcept { return static_cast(data_.size()); } - - bool saveToAttributes(Vst::IAttributeList* attrs) const override; - bool loadFromAttributes(Vst::IAttributeList* attrs) override; - - OBJ_METHODS(OSCUpdate, FObject) - -private: - std::vector data_; -}; - -/** - * @brief Update which notifies one or more note on/off events - */ -class NoteUpdate : public Steinberg::FObject, - public IConvertibleToMessage { -public: - using Item = std::pair; - - NoteUpdate() = default; - NoteUpdate(const Item* items, uint32 count) : events_(items, items + count) {} - const Item* events() const noexcept { return events_.data(); } - const uint32 count() const noexcept { return static_cast(events_.size()); } - - bool saveToAttributes(Vst::IAttributeList* attrs) const override; - bool loadFromAttributes(Vst::IAttributeList* attrs) override; - - OBJ_METHODS(NoteUpdate, FObject) - -private: - std::vector events_; -}; - -/** - * @brief Abstract update which notifies change of a certain file path. - */ -class FilePathUpdate : public Steinberg::FObject { -protected: - FilePathUpdate() = default; - -public: - void setPath(std::string newPath) - { - std::lock_guard lock(mutex_); - path_ = std::move(newPath); - } - - std::string getPath() const - { - std::lock_guard lock(mutex_); - return path_; - } - - OBJ_METHODS(FilePathUpdate, FObject) - -protected: - bool saveFilePathAttributes_(Vst::IAttributeList* attrs) const; - bool loadFilePathAttributes_(Vst::IAttributeList* attrs); - -private: - std::string path_; - mutable std::mutex mutex_; -}; - -/** - * @brief Update which notifies a change of SFZ file. - */ -class SfzUpdate : public FilePathUpdate, - public IConvertibleToMessage { -public: - OBJ_METHODS(SfzUpdate, FilePathUpdate) - - bool saveToAttributes(Vst::IAttributeList* attrs) const override; - bool loadFromAttributes(Vst::IAttributeList* attrs) override; -}; - -/** - * @brief Update which notifies a change of scala file. - */ -class ScalaUpdate : public FilePathUpdate, - public IConvertibleToMessage { -public: - OBJ_METHODS(ScalaUpdate, FilePathUpdate) - - bool saveToAttributes(Vst::IAttributeList* attrs) const override; - bool loadFromAttributes(Vst::IAttributeList* attrs) override; -}; - -/** - * @brief Update which notifies a change of SFZ description. - */ -class SfzDescriptionUpdate : public Steinberg::FObject, - public IConvertibleToMessage { -public: - void setDescription(std::string newDescription) - { - std::lock_guard lock(mutex_); - description_ = std::move(newDescription); - } - - std::string getDescription() const - { - std::lock_guard lock(mutex_); - return description_; - } - - bool saveToAttributes(Vst::IAttributeList* attrs) const override; - bool loadFromAttributes(Vst::IAttributeList* attrs) override; - - OBJ_METHODS(SfzDescriptionUpdate, FObject) - -private: - std::string description_; - mutable std::mutex mutex_; -}; - -/** - * @brief Update which indicates the playing SFZ status. - */ -class PlayStateUpdate : public Steinberg::FObject, - public IConvertibleToMessage { -public: - void setState(SfizzPlayState newState) - { - std::lock_guard lock(mutex_); - state_ = std::move(newState); - } - - SfizzPlayState getState() const - { - std::lock_guard lock(mutex_); - return state_; - } - - bool saveToAttributes(Vst::IAttributeList* attrs) const override; - virtual bool loadFromAttributes(Vst::IAttributeList* attrs) override; - - OBJ_METHODS(PlayStateUpdate, FObject) - -private: - SfizzPlayState state_ {}; - mutable std::mutex mutex_; -}; - -/** - * @brief Update which automates a pack of parameters - */ -class AutomationUpdate : public Steinberg::FObject, - public IConvertibleToMessage { -public: - using Item = std::pair; - - AutomationUpdate() = default; - - void setItems(std::vector newItems) - { - std::lock_guard lock(mutex_); - items_ = std::move(newItems); - } - - std::vector getItems() const - { - std::lock_guard lock(mutex_); - return items_; - } - - bool saveToAttributes(Vst::IAttributeList* attrs) const override; - bool loadFromAttributes(Vst::IAttributeList* attrs) override; - - OBJ_METHODS(AutomationUpdate, FObject) - -private: - std::vector items_; - mutable std::mutex mutex_; -}; - -#include "SfizzVstUpdates.hpp" diff --git a/plugins/vst/SfizzVstUpdates.hpp b/plugins/vst/SfizzVstUpdates.hpp deleted file mode 100644 index 5b1ce1f93..000000000 --- a/plugins/vst/SfizzVstUpdates.hpp +++ /dev/null @@ -1,41 +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 "SfizzVstUpdates.h" - -template -IPtr IConvertibleToMessage::convertToMessage(Vst::ComponentBase* sender) const -{ - IPtr message = Steinberg::owned(sender->allocateMessage()); - if (!message) - return nullptr; - message->setMessageID(static_cast(this)->isA()); - if (!saveToAttributes(message->getAttributes())) - return nullptr; - return message; -} - -template -IPtr IConvertibleToMessage::createFromMessage(Vst::IMessage& message) -{ - IPtr object; - if (!strcmp(T::getFClassID(), message.getMessageID())) { - object = Steinberg::owned(new T); - if (!object->loadFromAttributes(message.getAttributes())) - object = nullptr; - } - return object; -} - -template -bool IConvertibleToMessage::convertFromMessage(Vst::IMessage& message) -{ - bool success = false; - if (!strcmp(T::getFClassID(), message.getMessageID())) - success = loadFromAttributes(message.getAttributes()); - return success; -} diff --git a/plugins/vst/Vst2PluginEntry.c b/plugins/vst/Vst2PluginEntry.c deleted file mode 100644 index 030ea2ca7..000000000 --- a/plugins/vst/Vst2PluginEntry.c +++ /dev/null @@ -1,41 +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 - -/* - Note: this file provides the traditional VST2 entry point `main` on Windows. - some hosts only detect this entry point. - - It's required to compile this file in C mode. - Under MinGW, having a signature for `main` which is different from the - standard one is a warning in C, and an error in C++. -*/ - -#include "pluginterfaces/base/fplatform.h" -#include - -typedef struct AEffect AEffect; -typedef int32_t VstInt32; -typedef intptr_t VstIntPtr; -typedef intptr_t (__cdecl *audioMasterCallback) (AEffect* effect, int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt); - -#if defined(_WIN32) -SMTG_EXPORT_SYMBOL AEffect* MAIN (audioMasterCallback audioMaster); - -#if defined(__GNUC__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wmain" -#endif - -SMTG_EXPORT_SYMBOL AEffect* main (audioMasterCallback audioMaster) -{ - return MAIN(audioMaster); -} - -#if defined(__GNUC__) -# pragma GCC diagnostic pop -#endif - -#endif diff --git a/plugins/vst/Vst2PluginFactory.cpp b/plugins/vst/Vst2PluginFactory.cpp deleted file mode 100644 index 98b6981a4..000000000 --- a/plugins/vst/Vst2PluginFactory.cpp +++ /dev/null @@ -1,18 +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 "SfizzVstIDs.h" -#include "public.sdk/source/vst/vst2wrapper/vst2wrapper.h" - -//------------------------------------------------------------------------ -::AudioEffect* createEffectInstance(audioMasterCallback audioMaster) -{ - return Steinberg::Vst::Vst2Wrapper::create( - GetPluginFactory(), - SfizzVstProcessor_cid, - 'Sfzz', - audioMaster); -} diff --git a/plugins/vst/VstPluginDefs.h.in b/plugins/vst/VstPluginDefs.h.in deleted file mode 100644 index c67283d88..000000000 --- a/plugins/vst/VstPluginDefs.h.in +++ /dev/null @@ -1,11 +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 VSTPLUGIN_NAME "@VSTPLUGIN_NAME@" -#define VSTPLUGIN_VENDOR "@VSTPLUGIN_VENDOR@" -#define VSTPLUGIN_URL "@VSTPLUGIN_URL@" -#define VSTPLUGIN_EMAIL "@VSTPLUGIN_EMAIL@" -#define VSTPLUGIN_VERSION "@PROJECT_VERSION@" diff --git a/plugins/vst/VstPluginFactory.cpp b/plugins/vst/VstPluginFactory.cpp deleted file mode 100644 index b0bad9518..000000000 --- a/plugins/vst/VstPluginFactory.cpp +++ /dev/null @@ -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 - -#include "SfizzVstIDs.h" -#include "VstPluginDefs.h" -#include "public.sdk/source/main/pluginfactory.h" -#include "pluginterfaces/vst/ivstcomponent.h" -#include "pluginterfaces/vst/ivstaudioprocessor.h" -#include "pluginterfaces/vst/ivsteditcontroller.h" - -class SfizzVstProcessor; -class SfizzVstProcessorMulti; -class SfizzVstController; - -BEGIN_FACTORY_DEF(VSTPLUGIN_VENDOR, - VSTPLUGIN_URL, - "mailto:" VSTPLUGIN_EMAIL) - -DEF_CLASS2 (INLINE_UID_FROM_FUID(SfizzVstProcessor_cid), - PClassInfo::kManyInstances, - kVstAudioEffectClass, - VSTPLUGIN_NAME, - Vst::kDistributable, - Vst::PlugType::kInstrumentSynth, - VSTPLUGIN_VERSION, - kVstVersionString, - createInstance) - -DEF_CLASS2 (INLINE_UID_FROM_FUID(SfizzVstProcessorMulti_cid), - PClassInfo::kManyInstances, - kVstAudioEffectClass, - VSTPLUGIN_NAME "-multi", - Vst::kDistributable, - Vst::PlugType::kInstrumentSynth, - VSTPLUGIN_VERSION, - kVstVersionString, - createInstance) - -DEF_CLASS2 (INLINE_UID_FROM_FUID(SfizzVstController_cid), - PClassInfo::kManyInstances, - kVstComponentControllerClass, - VSTPLUGIN_NAME, - 0, // not used here - "", // not used here - VSTPLUGIN_VERSION, - kVstVersionString, - createInstance) - -END_FACTORY diff --git a/plugins/vst/X11RunLoop.cpp b/plugins/vst/X11RunLoop.cpp deleted file mode 100644 index 2d8ded27e..000000000 --- a/plugins/vst/X11RunLoop.cpp +++ /dev/null @@ -1,231 +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 - -#if !defined(__APPLE__) && !defined(_WIN32) -#include "X11RunLoop.h" -#include "vstgui/lib/platform/linux/x11platform.h" -#include "base/source/fobject.h" -#include -#include -#include -#include - -namespace VSTGUI { - -struct RunLoop::Impl { - struct EventHandler; - struct TimerHandler; - - using EventHandlers = std::vector>; - using TimerHandlers = std::vector>; - - EventHandlers eventHandlers; - TimerHandlers timerHandlers; - Steinberg::FUnknownPtr runLoop; -}; - -//------------------------------------------------------------------------------ -struct RunLoop::Impl::EventHandler final : Steinberg::Linux::IEventHandler, public Steinberg::FObject { - X11::IEventHandler* handler { nullptr }; - bool alive { false }; - - void PLUGIN_API onFDIsSet(Steinberg::Linux::FileDescriptor) override; - - DELEGATE_REFCOUNT(Steinberg::FObject) - DEFINE_INTERFACES - DEF_INTERFACE(Steinberg::Linux::IEventHandler) - END_DEFINE_INTERFACES(Steinberg::FObject) -}; - -struct RunLoop::Impl::TimerHandler final : Steinberg::Linux::ITimerHandler, public Steinberg::FObject { - X11::ITimerHandler* handler { nullptr }; - bool alive { false }; - - void PLUGIN_API onTimer() override; - - DELEGATE_REFCOUNT(Steinberg::FObject) - DEFINE_INTERFACES - DEF_INTERFACE(Steinberg::Linux::ITimerHandler) - END_DEFINE_INTERFACES(Steinberg::FObject) -}; - -//------------------------------------------------------------------------------ -void PLUGIN_API RunLoop::Impl::EventHandler::onFDIsSet(Steinberg::Linux::FileDescriptor) -{ - SharedPointer runLoop = RunLoop::get(); - if (!runLoop) { - fprintf(stderr, "[x11] event has fired without active runloop\n"); - return; - } - - if (alive && handler) - handler->onEvent(); -} - -void PLUGIN_API RunLoop::Impl::TimerHandler::onTimer() -{ - SharedPointer runLoop = RunLoop::get(); - if (!runLoop) { - fprintf(stderr, "[x11] timer has fired without active runloop\n"); - return; - } - - if (alive && handler) - handler->onTimer(); -} - -//------------------------------------------------------------------------------ -RunLoop::RunLoop(Steinberg::FUnknown* runLoop) - : impl(new Impl) -{ - impl->runLoop = runLoop; -} - -RunLoop::~RunLoop() -{ - //dumpCurrentState(); - - if (0) { - // remove any leftover handlers - for (size_t i = 0; i < impl->eventHandlers.size(); ++i) { - const auto& eh = impl->eventHandlers[i]; - if (eh->alive && eh->handler) { - impl->runLoop->unregisterEventHandler(eh.get()); - } - } - for (size_t i = 0; i < impl->timerHandlers.size(); ++i) { - const auto& th = impl->timerHandlers[i]; - if (th->alive && th->handler) { - impl->runLoop->unregisterTimer(th.get()); - } - } - } -} - -SharedPointer RunLoop::get() -{ - return X11::RunLoop::get().cast(); -} - -void RunLoop::processSomeEvents() -{ - for (size_t i = 0; i < impl->eventHandlers.size(); ++i) { - const auto& eh = impl->eventHandlers[i]; - if (eh->alive && eh->handler) { - eh->handler->onEvent(); - } - } -} - -void RunLoop::dumpCurrentState() -{ - fprintf(stderr, "=== X11 runloop ===\n"); - - fprintf(stderr, "\t" "Event slots:\n"); - for (size_t i = 0, n = impl->eventHandlers.size(); i < n; ++i) { - Impl::EventHandler *eh = impl->eventHandlers[i].get(); - fprintf(stderr, "\t\t" "(%lu) alive=%d handler=%p type=%s\n", i, eh->alive, eh->handler, (eh->alive && eh->handler) ? typeid(*eh->handler).name() : ""); - } - - fprintf(stderr, "\t" "Timer slots:\n"); - for (size_t i = 0, n = impl->timerHandlers.size(); i < n; ++i) { - Impl::TimerHandler *th = impl->timerHandlers[i].get(); - fprintf(stderr, "\t\t" "(%lu) alive=%d handler=%p type=%s\n", i, th->alive, th->handler, (th->alive && th->handler) ? typeid(*th->handler).name() : ""); - } - - fprintf(stderr, "===/X11 runloop ===\n"); -} - -template -static void insertHandler(std::vector>& list, Steinberg::IPtr handler) -{ - size_t i = 0; - size_t n = list.size(); - while (i < n && list[i]->alive) - ++i; - if (i < n) - list[i] = handler; - else - list.emplace_back(handler); -} - -template -static size_t findHandler(const std::vector>& list, U* handler) -{ - for (size_t i = 0, n = list.size(); i < n; ++i) { - if (list[i]->alive && list[i]->handler == handler) - return i; - } - return ~size_t(0); -} - -bool RunLoop::registerEventHandler(int fd, X11::IEventHandler* handler) -{ - if (!impl->runLoop) - return false; - - auto smtgHandler = Steinberg::owned(new Impl::EventHandler); - smtgHandler->handler = handler; - smtgHandler->alive = true; - if (impl->runLoop->registerEventHandler(smtgHandler, fd) == Steinberg::kResultTrue) { - insertHandler(impl->eventHandlers, smtgHandler); - return true; - } - return false; -} - -bool RunLoop::unregisterEventHandler(X11::IEventHandler* handler) -{ - if (!impl->runLoop) - return false; - - size_t index = findHandler(impl->eventHandlers, handler); - if (index == ~size_t(0)) - return false; - - Impl::EventHandler *eh = impl->eventHandlers[index].get(); - if (impl->runLoop->unregisterEventHandler(eh) != Steinberg::kResultTrue) - return false; - - eh->alive = false; - return true; -} - -bool RunLoop::registerTimer(uint64_t interval, X11::ITimerHandler* handler) -{ - if (!impl->runLoop) - return false; - - auto smtgHandler = Steinberg::owned(new Impl::TimerHandler); - smtgHandler->handler = handler; - smtgHandler->alive = true; - if (impl->runLoop->registerTimer(smtgHandler, interval) == Steinberg::kResultTrue) { - insertHandler(impl->timerHandlers, smtgHandler); - return true; - } - return false; -} - -bool RunLoop::unregisterTimer(X11::ITimerHandler* handler) -{ - if (!impl->runLoop) - return false; - - size_t index = findHandler(impl->timerHandlers, handler); - if (index == ~size_t(0)) - return false; - - Impl::TimerHandler *th = impl->timerHandlers[index].get(); - if (impl->runLoop->unregisterTimer(th) != Steinberg::kResultTrue) - return false; - - th->alive = false; - return true; -} - -} // namespace VSTGUI - -#endif diff --git a/plugins/vst/X11RunLoop.h b/plugins/vst/X11RunLoop.h deleted file mode 100644 index 5755a06ba..000000000 --- a/plugins/vst/X11RunLoop.h +++ /dev/null @@ -1,51 +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 - -/* - This runloop connects to X11 VSTGUI, it connects VST3 and VSTGUI together. - The Windows and macOS runloops do not need this, the OS-provided - functionality is used instead. - - Previously, this was based on VSTGUI code provided by Steinberg. - This is replaced with a rewrite, because the original code has too many - issues. For example, it has no robustness in case handlers get added or - removed within the execution of the handler. - - This version allows to call event processing externally, in case the host - has a defective X11 event loop notifier. (some versions of Bitwig do) -*/ - -#pragma once -#if !defined(__APPLE__) && !defined(_WIN32) -#include "vstgui/lib/platform/linux/x11frame.h" -#include "pluginterfaces/gui/iplugview.h" -#include - -namespace VSTGUI { - -class RunLoop final : public X11::IRunLoop, public AtomicReferenceCounted { -public: - explicit RunLoop(Steinberg::FUnknown* runLoop); - ~RunLoop(); - - static SharedPointer get(); - - void processSomeEvents(); - void dumpCurrentState(); - - // X11::IRunLoop - bool registerEventHandler(int fd, X11::IEventHandler* handler) override; - bool unregisterEventHandler(X11::IEventHandler* handler) override; - bool registerTimer(uint64_t interval, X11::ITimerHandler* handler) override; - bool unregisterTimer(X11::ITimerHandler* handler) override; - - struct Impl; - std::unique_ptr impl; -}; - -} // namespace VSTGUI - -#endif diff --git a/plugins/vst/cmake/Vst3.cmake b/plugins/vst/cmake/Vst3.cmake deleted file mode 100644 index f461453fb..000000000 --- a/plugins/vst/cmake/Vst3.cmake +++ /dev/null @@ -1,129 +0,0 @@ -find_package(Threads REQUIRED) - -# --- VST3SDK --- -add_library(vst3sdk STATIC EXCLUDE_FROM_ALL - "${VST3SDK_BASEDIR}/base/source/baseiids.cpp" - "${VST3SDK_BASEDIR}/base/source/fbuffer.cpp" - "${VST3SDK_BASEDIR}/base/source/fdebug.cpp" - "${VST3SDK_BASEDIR}/base/source/fdynlib.cpp" - "${VST3SDK_BASEDIR}/base/source/fobject.cpp" - "${VST3SDK_BASEDIR}/base/source/fstreamer.cpp" - "${VST3SDK_BASEDIR}/base/source/fstring.cpp" - "${VST3SDK_BASEDIR}/base/source/timer.cpp" - "${VST3SDK_BASEDIR}/base/source/updatehandler.cpp" - "${VST3SDK_BASEDIR}/base/thread/source/fcondition.cpp" - "${VST3SDK_BASEDIR}/base/thread/source/flock.cpp" - "${VST3SDK_BASEDIR}/pluginterfaces/base/conststringtable.cpp" - "${VST3SDK_BASEDIR}/pluginterfaces/base/coreiids.cpp" - "${VST3SDK_BASEDIR}/pluginterfaces/base/funknown.cpp" - "${VST3SDK_BASEDIR}/pluginterfaces/base/ustring.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/common/commoniids.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/common/memorystream.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/common/pluginview.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/main/pluginfactory.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/vstaudioeffect.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/vstbus.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/vstcomponent.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/vstcomponentbase.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/vsteditcontroller.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/vstinitiids.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/vstnoteexpressiontypes.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/vstparameters.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/vstpresetfile.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/vstrepresentation.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/utility/stringconvert.cpp") -if(WIN32) - target_sources(vst3sdk PRIVATE - "${VST3SDK_BASEDIR}/public.sdk/source/common/threadchecker_win32.cpp") -elseif(APPLE) - target_sources(vst3sdk PRIVATE - "${VST3SDK_BASEDIR}/public.sdk/source/common/threadchecker_mac.mm") -else() - target_sources(vst3sdk PRIVATE - "${VST3SDK_BASEDIR}/public.sdk/source/common/threadchecker_linux.cpp") -endif() -target_include_directories(vst3sdk PUBLIC "${VST3SDK_BASEDIR}") -target_link_libraries(vst3sdk PUBLIC Threads::Threads) -if(APPLE) - target_link_libraries(vst3sdk PUBLIC ${APPLE_FOUNDATION_LIBRARY}) -endif() -if(MINGW) - target_compile_definitions(vst3sdk PUBLIC - "_NATIVE_WCHAR_T_DEFINED=1" "__wchar_t=wchar_t") -endif() -set(_vst_release_build_types MinSizeRel Release RelWithDebInfo) -if(CMAKE_BUILD_TYPE IN_LIST _vst_release_build_types) - target_compile_definitions(vst3sdk PUBLIC "RELEASE") -else() - target_compile_definitions(vst3sdk PUBLIC "DEVELOPMENT") -endif() - -function(plugin_add_vst3sdk NAME) - target_link_libraries("${NAME}" PRIVATE vst3sdk) - target_sources("${NAME}" PRIVATE - "${VST3SDK_BASEDIR}/public.sdk/source/main/moduleinit.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/main/pluginfactory.cpp") - if(WIN32) - target_sources("${NAME}" PRIVATE - "${VST3SDK_BASEDIR}/public.sdk/source/main/dllmain.cpp") - elseif(APPLE) - target_sources("${NAME}" PRIVATE - "${VST3SDK_BASEDIR}/public.sdk/source/main/macmain.cpp") - else() - target_sources("${NAME}" PRIVATE - "${VST3SDK_BASEDIR}/public.sdk/source/main/linuxmain.cpp") - endif() -endfunction() - -# --- VST3SDK hosting --- -add_library(vst3sdk_hosting STATIC EXCLUDE_FROM_ALL - "${VST3SDK_BASEDIR}/public.sdk/source/vst/hosting/connectionproxy.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/hosting/eventlist.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/hosting/hostclasses.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/hosting/parameterchanges.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/hosting/pluginterfacesupport.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/hosting/plugprovider.cpp" - "${VST3SDK_BASEDIR}/public.sdk/source/vst/hosting/processdata.cpp") -if(FALSE) - if(WIN32) - target_sources(vst3sdk_hosting PRIVATE - "${VST3SDK_BASEDIR}/public.sdk/source/vst/hosting/module_win32.cpp") - elseif(APPLE) - target_sources(vst3sdk_hosting PRIVATE - "${VST3SDK_BASEDIR}/public.sdk/source/vst/hosting/module_mac.mm") - else() - target_sources(vst3sdk_hosting PRIVATE - "${VST3SDK_BASEDIR}/public.sdk/source/vst/hosting/module_linux.cpp") - endif() -endif() -target_link_libraries(vst3sdk_hosting PUBLIC vst3sdk) - -# --- VSTGUI --- -add_library(vst3sdk_vstgui STATIC EXCLUDE_FROM_ALL - "${VST3SDK_BASEDIR}/public.sdk/source/vst/vstguieditor.cpp") -if(WIN32) - target_sources(vst3sdk_vstgui PRIVATE - "${VST3SDK_BASEDIR}/public.sdk/source/vst/vstgui_win32_bundle_support.cpp") - target_compile_definitions(vst3sdk_vstgui PRIVATE "SMTG_MODULE_IS_BUNDLE=1") -endif() -target_link_libraries(vst3sdk_vstgui PUBLIC vst3sdk sfizz::vstgui) - -function(plugin_add_vstgui NAME) - target_link_libraries("${NAME}" PRIVATE vst3sdk_vstgui) -endfunction() - -# --- Warning suppressions --- -foreach(_target vst3sdk_vstgui vst3sdk) - gw_target_warn("${_target}" PUBLIC - "-Wno-extra" - "-Wno-class-memaccess") - gw_target_warn("${_target}" PRIVATE - "-Wno-multichar" - "-Wno-reorder" - "-Wno-class-memaccess" - "-Wno-ignored-qualifiers" - "-Wno-unknown-pragmas" - "-Wno-unused-function" - "-Wno-unused-parameter" - "-Wno-unused-variable") -endforeach() diff --git a/plugins/vst/external/VST_SDK/VST3_SDK/base b/plugins/vst/external/VST_SDK/VST3_SDK/base deleted file mode 160000 index 985fe0192..000000000 --- a/plugins/vst/external/VST_SDK/VST3_SDK/base +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 985fe019276ee03c2751a1736ba3b390678e29f2 diff --git a/plugins/vst/external/VST_SDK/VST3_SDK/pluginterfaces b/plugins/vst/external/VST_SDK/VST3_SDK/pluginterfaces deleted file mode 160000 index 93cef1afb..000000000 --- a/plugins/vst/external/VST_SDK/VST3_SDK/pluginterfaces +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 93cef1afb7061e488625045ba5a82abaa83d27fe diff --git a/plugins/vst/external/VST_SDK/VST3_SDK/public.sdk b/plugins/vst/external/VST_SDK/VST3_SDK/public.sdk deleted file mode 160000 index 9589800ed..000000000 --- a/plugins/vst/external/VST_SDK/VST3_SDK/public.sdk +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9589800ed94573354bc29de45eec5744523fbfcb diff --git a/plugins/vst/external/ring_buffer/LICENSE b/plugins/vst/external/ring_buffer/LICENSE deleted file mode 100644 index 36b7cd93c..000000000 --- a/plugins/vst/external/ring_buffer/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -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, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/plugins/vst/external/ring_buffer/ring_buffer/ring_buffer.cpp b/plugins/vst/external/ring_buffer/ring_buffer/ring_buffer.cpp deleted file mode 100644 index bf0fcb9ce..000000000 --- a/plugins/vst/external/ring_buffer/ring_buffer/ring_buffer.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright Jean Pierre Cimalando 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include "ring_buffer.h" -#include -#include - -#if defined(__cpp_if_constexpr) -# define if_constexpr if constexpr -#else -# define if_constexpr if -#endif - -template -Ring_Buffer_Ex::Ring_Buffer_Ex(size_t capacity) - : cap_(capacity + 1), - rbdata_(new uint8_t[capacity + 1]) -{ -} - -template -Ring_Buffer_Ex::~Ring_Buffer_Ex() -{ -} - -template -size_t Ring_Buffer_Ex::size_used() const -{ - const size_t rp = rp_, wp = wp_, cap = cap_; - return wp + ((wp < rp) ? cap : 0) - rp; -} - -template -bool Ring_Buffer_Ex::discard(size_t len) -{ - return getbytes_ex_(nullptr, len, true); -} - -template -size_t Ring_Buffer_Ex::size_free() const -{ - const size_t rp = rp_, wp = wp_, cap = cap_; - return rp + ((rp <= wp) ? cap : 0) - wp - 1; -} - -template -bool Ring_Buffer_Ex::getbytes_(void *data, size_t len) -{ - return getbytes_ex_(data, len, true); -} - -template -bool Ring_Buffer_Ex::peekbytes_(void *data, size_t len) const -{ - auto *ncthis = const_cast *>(this); - return ncthis->getbytes_ex_(data, len, false); -} - -template -bool Ring_Buffer_Ex::getbytes_ex_(void *data, size_t len, bool advp) -{ - if (size_used() < len) - return false; - - const size_t rp = rp_, cap = cap_; - const uint8_t *src = rbdata_.get(); - uint8_t *dst = (uint8_t *)data; - - if (data) { - const size_t taillen = std::min(len, cap - rp); - if_constexpr (Atomic) - std::atomic_thread_fence(std::memory_order_acquire); - std::copy_n(&src[rp], taillen, dst); - std::copy_n(src, len - taillen, dst + taillen); - } - - if (advp) - rp_ = (rp + len < cap) ? (rp + len) : (rp + len - cap); - return true; -} - -template -bool Ring_Buffer_Ex::putbytes_(const void *data, size_t len) -{ - if (size_free() < len) - return false; - - const size_t wp = wp_, cap = cap_; - const uint8_t *src = (const uint8_t *)data; - uint8_t *dst = rbdata_.get(); - - const size_t taillen = std::min(len, cap - wp); - std::copy_n(src, taillen, &dst[wp]); - std::copy_n(src + taillen, len - taillen, dst); - if_constexpr (Atomic) - std::atomic_thread_fence(std::memory_order_release); - - wp_ = (wp + len < cap) ? (wp + len) : (wp + len - cap); - return true; -} - -template class Ring_Buffer_Ex; -template class Ring_Buffer_Ex; diff --git a/plugins/vst/external/ring_buffer/ring_buffer/ring_buffer.h b/plugins/vst/external/ring_buffer/ring_buffer/ring_buffer.h deleted file mode 100644 index 395ba9e0c..000000000 --- a/plugins/vst/external/ring_buffer/ring_buffer/ring_buffer.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright Jean Pierre Cimalando 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#pragma once -#include -#include -#include -#include -#include - -#if defined(__cpp_lib_atomic_is_always_lock_free) -static_assert( - std::atomic::is_always_lock_free, "atomic must be lock free"); -#endif - -//------------------------------------------------------------------------------ -template class Ring_Buffer_Ex; -typedef Ring_Buffer_Ex Ring_Buffer; - -//------------------------------------------------------------------------------ -template -class Basic_Ring_Buffer { -public: - // read operations - template bool get(T &x); - template bool get(T *x, size_t n); - template bool peek(T &x); - template bool peek(T *x, size_t n); - // write operations - template bool put(const T &x); - template bool put(const T *x, size_t n); -}; - -//------------------------------------------------------------------------------ -template -class Ring_Buffer_Ex final : - private Basic_Ring_Buffer> { -private: - typedef Basic_Ring_Buffer> Base; -public: - // initialization and cleanup - explicit Ring_Buffer_Ex(size_t capacity); - ~Ring_Buffer_Ex(); - // attributes - size_t capacity() const; - // read operations - size_t size_used() const; - bool discard(size_t len); - using Base::get; - using Base::peek; - // write operations - size_t size_free() const; - using Base::put; - -private: - size_t cap_{0}; - typename std::conditional, size_t>::type rp_{0}, wp_{0}; - std::unique_ptr rbdata_ {}; - friend Base; - bool getbytes_(void *data, size_t len); - bool peekbytes_(void *data, size_t len) const; - bool getbytes_ex_(void *data, size_t len, bool advp); - bool putbytes_(const void *data, size_t len); -}; - -//------------------------------------------------------------------------------ -#include "ring_buffer.tcc" diff --git a/plugins/vst/external/ring_buffer/ring_buffer/ring_buffer.tcc b/plugins/vst/external/ring_buffer/ring_buffer/ring_buffer.tcc deleted file mode 100644 index b53b17f4a..000000000 --- a/plugins/vst/external/ring_buffer/ring_buffer/ring_buffer.tcc +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright Jean Pierre Cimalando 2018. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#include "ring_buffer.h" - -template -inline size_t Ring_Buffer_Ex::capacity() const -{ - return cap_ - 1; -} - -//------------------------------------------------------------------------------ -template -template -inline bool Basic_Ring_Buffer::get(T &x) -{ - return get(&x, 1); -} - -template -template -inline bool Basic_Ring_Buffer::get(T *x, size_t n) -{ - // static_assert(std::is_trivially_copyable::value, "ring_buffer: T must be trivially copyable"); - RB *self = static_cast(this); - return self->getbytes_(x, n * sizeof(T)); -} - -template -template -inline bool Basic_Ring_Buffer::peek(T &x) -{ - return peek(&x, 1); -} - -template -template -inline bool Basic_Ring_Buffer::peek(T *x, size_t n) -{ - // static_assert(std::is_trivially_copyable::value, "ring_buffer: T must be trivially copyable"); - RB *self = static_cast(this); - return self->peekbytes_(x, n * sizeof(T)); -} - -template -template -inline bool Basic_Ring_Buffer::put(const T &x) -{ - return put(&x, 1); -} - -template -template -inline bool Basic_Ring_Buffer::put(const T *x, size_t n) -{ - // static_assert(std::is_trivially_copyable::value, "ring_buffer: T must be trivially copyable"); - RB *self = static_cast(this); - return self->putbytes_(x, n * sizeof(T)); -} diff --git a/plugins/vst/external/sfzt_auwrapper b/plugins/vst/external/sfzt_auwrapper deleted file mode 160000 index 014311ae4..000000000 --- a/plugins/vst/external/sfzt_auwrapper +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 014311ae45b86571e1ae3aaa03ebbd7db8b3a32e diff --git a/plugins/vst/gpl-3.0.txt b/plugins/vst/gpl-3.0.txt deleted file mode 100644 index f288702d2..000000000 --- a/plugins/vst/gpl-3.0.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/plugins/vst/mac/Info.au.plist b/plugins/vst/mac/Info.au.plist deleted file mode 100644 index f0a80fd2c..000000000 --- a/plugins/vst/mac/Info.au.plist +++ /dev/null @@ -1,50 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - @SFIZZ_AU_BUNDLE_EXECUTABLE@ - CFBundleIdentifier - @SFIZZ_AU_BUNDLE_IDENTIFIER@ - CFBundleName - sfizz - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleSignature - ???? - CFBundleVersion - @SFIZZ_AU_BUNDLE_VERSION@ - CSResourcesFileMapped - - AudioComponents - - - description - @PROJECT_NAME@ - factoryFunction - AUWrapperFactory - manufacturer - @SFIZZ_AU_BUNDLE_MANUFACTURER@ - name - @SFIZZ_AU_BUNDLE_AUTHOR@: @PROJECT_NAME@ - sandboxSafe - - type - @SFIZZ_AU_BUNDLE_TYPE@ - subtype - @SFIZZ_AU_BUNDLE_SUBTYPE@ - tags - - Sampler - Synthesizer - - version - @SFIZZ_AU_DECIMAL_VERSION@ - - - - diff --git a/plugins/vst/mac/Info.vst3.plist b/plugins/vst/mac/Info.vst3.plist deleted file mode 100644 index 7e3b3a732..000000000 --- a/plugins/vst/mac/Info.vst3.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - @SFIZZ_VST3_BUNDLE_EXECUTABLE@ - CFBundleIdentifier - tools.sfz.sfizz.vst - CFBundleName - sfizz - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - BNDL - CFBundleSignature - ???? - CFBundleVersion - @SFIZZ_VST3_BUNDLE_VERSION@ - CSResourcesFileMapped - - - diff --git a/plugins/vst/mac/PkgInfo b/plugins/vst/mac/PkgInfo deleted file mode 100644 index 19a9cf67e..000000000 --- a/plugins/vst/mac/PkgInfo +++ /dev/null @@ -1 +0,0 @@ -BNDL???? \ No newline at end of file diff --git a/plugins/vst/mac/audiounitconfig.h.in b/plugins/vst/mac/audiounitconfig.h.in deleted file mode 100644 index 0207e5851..000000000 --- a/plugins/vst/mac/audiounitconfig.h.in +++ /dev/null @@ -1,15 +0,0 @@ -#define kAudioUnitBundleIdentifier @SFIZZ_AU_BUNDLE_IDENTIFIER@ -#define kAudioUnitVersion 0x@SFIZZ_AU_HEXADECIMAL_VERSION@ -#define kAUPluginName @SFIZZ_AU_BUNDLE_AUTHOR@: @PROJECT_NAME@ -#define kAUPluginDescription @PROJECT_NAME@ -#define kAUPluginType @SFIZZ_AU_BUNDLE_TYPE@ -#define kAUPluginSubType @SFIZZ_AU_BUNDLE_SUBTYPE@ -#define kAUPluginManufacturer @SFIZZ_AU_BUNDLE_MANUFACTURER@ - -#define kAudioUnitName "@SFIZZ_AU_BUNDLE_AUTHOR@: @PROJECT_NAME@" -#define kAudioUnitDescription "@PROJECT_NAME@" -#define kAudioUnitType '@SFIZZ_AU_BUNDLE_TYPE@' -#define kAudioUnitComponentSubType '@SFIZZ_AU_BUNDLE_SUBTYPE@' -#define kAudioUnitComponentManuf '@SFIZZ_AU_BUNDLE_MANUFACTURER@' - -#define kAudioUnitCarbonView 1 diff --git a/plugins/vst/vst3.def b/plugins/vst/vst3.def deleted file mode 100644 index 279a6a5c2..000000000 --- a/plugins/vst/vst3.def +++ /dev/null @@ -1,4 +0,0 @@ -EXPORTS - GetPluginFactory - InitDll - ExitDll diff --git a/plugins/vst/vst3.version b/plugins/vst/vst3.version deleted file mode 100644 index f86d95c37..000000000 --- a/plugins/vst/vst3.version +++ /dev/null @@ -1,7 +0,0 @@ -VST3ABI_1.0 { - global: - *GetPluginFactory*; - *ModuleEntry*; - *ModuleExit*; - local: *; -}; diff --git a/plugins/vst/win/Plugin.ico b/plugins/vst/win/Plugin.ico deleted file mode 100644 index 516565763..000000000 Binary files a/plugins/vst/win/Plugin.ico and /dev/null differ diff --git a/plugins/vst/win/desktop.ini b/plugins/vst/win/desktop.ini deleted file mode 100644 index be3001a9b..000000000 --- a/plugins/vst/win/desktop.ini +++ /dev/null @@ -1,2 +0,0 @@ -[.ShellClassInfo] -IconResource=Plugin.ico,0 diff --git a/screenshot.png b/screenshot.png deleted file mode 100644 index 464cb9ca8..000000000 Binary files a/screenshot.png and /dev/null differ diff --git a/scripts/create_mac_icon.sh b/scripts/create_mac_icon.sh deleted file mode 100755 index 3467da939..000000000 --- a/scripts/create_mac_icon.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -e - -svg_file="$1" -test -z "$svg_file" && exit 1 - -sizes="32 48 128 256" - -rm -f "$svg_file".icon.*.png - -for size in $sizes; do - png_file="$svg_file".icon."$size".png - inkscape -e "$png_file" "$svg_file" -w "$size" -h "$size" - optipng "$png_file" -done - -png2icns "$svg_file".icns "$svg_file".icon.*.png -rm -f "$svg_file".icon.*.png diff --git a/scripts/create_windows_icon.sh b/scripts/create_windows_icon.sh deleted file mode 100755 index 710fbdc83..000000000 --- a/scripts/create_windows_icon.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -e - -svg_file="$1" -test -z "$svg_file" && exit 1 - -sizes="32 48 128 256" - -rm -f "$svg_file".icon.*.png - -for size in $sizes; do - png_file="$svg_file".icon."$size".png - inkscape -e "$png_file" "$svg_file" -w "$size" -h "$size" - optipng "$png_file" -done - -icotool -c -o "$svg_file".ico "$svg_file".icon.*.png -rm -f "$svg_file".icon.*.png diff --git a/scripts/generate_ui_fonts.sh b/scripts/generate_ui_fonts.sh deleted file mode 100755 index ff732e112..000000000 --- a/scripts/generate_ui_fonts.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -set -e - -if ! test -d "src"; then - echo "Please run this in the project root directory." - exit 1 -fi - -root="`pwd`" -fonts="$root/plugins/editor/resources/Fonts" - -cd scripts/misc-icons/ -./generate_icons_font.py -mv -f sfizz-misc-icons.ttf "$fonts" -cd ../../ - -if test ! -d plugins/editor/external/fluentui-system-icons; then - cd plugins/editor/external - git clone https://github.com/sfztools/fluentui-system-icons.git - cd fluentui-system-icons -else - cd plugins/editor/external/fluentui-system-icons - git checkout master - git pull origin master -fi - -./generate_icons_font.py -s regular -w 20 -n 'Sfizz Fluent System R20' \ - -o "$fonts/sfizz-fluentui-system-r20.ttf" -./generate_icons_font.py -s filled -w 20 -n 'Sfizz Fluent System F20' \ - -o "$fonts/sfizz-fluentui-system-f20.ttf" diff --git a/scripts/innosetup.iss.in b/scripts/innosetup.iss.in deleted file mode 100644 index ae23ab8c7..000000000 --- a/scripts/innosetup.iss.in +++ /dev/null @@ -1,77 +0,0 @@ -; -*- mode: iss; -*- -#define MyAppName "sfizz" -#define MyAppVersion "@PROJECT_VERSION@" -#define MyAppPublisher "sfizz Team" -#define MyAppURL "https://sfztools.github.io/sfizz/" - -#ifndef Arch -#define Arch "x64" -#endif - -[Setup] -AlwaysShowDirOnReadyPage=yes -; NOTE: The value of AppId uniquely identifies this application. -; Do not use the same AppId value in installers for other applications. -; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppId={{55FB694B-774A-4BB8-B08C-F6C015821ECC} -AppName={#MyAppName} -AppPublisher={#MyAppPublisher} -AppPublisherURL={#MyAppURL} -AppSupportURL={#MyAppURL} -AppUpdatesURL={#MyAppURL} -;AppVerName={#MyAppName} {#MyAppVersion} -AppVersion={#MyAppVersion} - -#if Arch=="x64" -ArchitecturesAllowed=x64 -ArchitecturesInstallIn64BitMode={#Arch} -#endif - -Compression=lzma -SolidCompression=yes -DefaultDirName={commonpf}\{#MyAppName} -DefaultGroupName={#MyAppPublisher} -;DisableDirPage=yes -LicenseFile="sfizz.lv2\LICENSE.md" -OutputBaseFileName={#MyAppName}-{#MyAppVersion}-msvc-{#Arch}-setup -OutputDir=. -UninstallFilesDir={app} -WizardImageFile=compiler:WizClassicImage-IS.bmp -WizardSmallImageFile=compiler:WizClassicSmallImage-IS.bmp - -[Languages] -Name: "english"; MessagesFile: "compiler:Default.isl" - -[Components] -Name: "main"; Description: "Shared files"; Types: full custom; Flags: fixed -Name: "lv2"; Description: "LV2 plugin"; Types: full custom; -Name: "vst3"; Description: "VST3 plugin"; Types: full custom; -Name: "puredata"; Description: "Puredata external"; Types: full custom; - -[Files] -Source: "sfizz.lv2\Contents\Binary\sfizz.dll"; Components: lv2; DestDir: "{commoncf}\LV2\sfizz.lv2\Contents\Binary"; Flags: ignoreversion -Source: "sfizz.lv2\Contents\Binary\sfizz_ui.dll"; Components: lv2; DestDir: "{commoncf}\LV2\sfizz.lv2\Contents\Binary"; Flags: ignoreversion -Source: "sfizz.lv2\Contents\Resources\*"; Components: lv2; DestDir: "{commoncf}\LV2\sfizz.lv2\Contents\Resources"; Flags: recursesubdirs -Source: "sfizz.lv2\manifest.ttl"; Components: lv2; DestDir: "{commoncf}\LV2\sfizz.lv2" -Source: "sfizz.lv2\sfizz.ttl"; Components: lv2; DestDir: "{commoncf}\LV2\sfizz.lv2" -Source: "sfizz.lv2\sfizz_ui.ttl"; Components: lv2; DestDir: "{commoncf}\LV2\sfizz.lv2" -Source: "sfizz.lv2\LICENSE.md"; Components: main; DestDir: "{app}" -Source: "sfizz.vst3\desktop.ini"; Components: vst3; DestDir: "{commoncf}\VST3\sfizz.vst3" -Source: "sfizz.vst3\Contents\@VST3_PACKAGE_ARCHITECTURE@-win\sfizz.vst3"; Components: vst3; DestDir: "{commoncf}\VST3\sfizz.vst3\Contents\@VST3_PACKAGE_ARCHITECTURE@-win"; Flags: ignoreversion -Source: "sfizz.vst3\Contents\Resources\*"; Components: vst3; DestDir: "{commoncf}\VST3\sfizz.vst3\Contents\Resources"; Flags: recursesubdirs -Source: "sfizz.vst3\Plugin.ico"; Components: vst3; DestDir: "{commoncf}\VST3\sfizz.vst3" -Source: "sfizz.vst3\gpl-3.0.txt"; Components: main; DestDir: "{app}" -Source: "pd\*"; Components: puredata; DestDir: "{commoncf}\Pd"; Flags: recursesubdirs -; Note(sfizz): OS older than Windows 10 require UI fonts to be installed system-wide -Source: "sfizz.vst3\Contents\Resources\Fonts\sfizz-fluentui-system-r20.ttf"; DestDir: "{fonts}"; FontInstall: "Sfizz Fluent System R20"; Flags: uninsneveruninstall; OnlyBelowVersion: 6.4 -Source: "sfizz.vst3\Contents\Resources\Fonts\sfizz-fluentui-system-f20.ttf"; DestDir: "{fonts}"; FontInstall: "Sfizz Fluent System F20"; Flags: uninsneveruninstall; OnlyBelowVersion: 6.4 -Source: "sfizz.vst3\Contents\Resources\Fonts\sfizz-misc-icons.ttf"; DestDir: "{fonts}"; FontInstall: "Sfizz Misc Icons"; Flags: uninsneveruninstall; OnlyBelowVersion: 6.4 -Source: "sfizz.vst3\Contents\Resources\Fonts\Roboto-Regular.ttf"; DestDir: "{fonts}"; FontInstall: "Roboto Regular"; Flags: uninsneveruninstall; OnlyBelowVersion: 6.4 -;Source: "setup\vc_redist.x64.exe"; DestDir: {tmp}; Flags: deleteafterinstall -; NOTE: Don't use "Flags: ignoreversion" on any shared system files - -;[Run] -;Filename: {tmp}\vc_redist.x64.exe; \ - Parameters: "/install /passive /norestart"; \ - StatusMsg: "Installing Microsoft Visual C++ 2015-2019 Redistributable (x64)..." -;Filename: {app}\{#MyAppExeName}; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent diff --git a/scripts/mingw_dwrite_3.h b/scripts/mingw_dwrite_3.h deleted file mode 100644 index d8e109b4f..000000000 --- a/scripts/mingw_dwrite_3.h +++ /dev/null @@ -1,12280 +0,0 @@ -/* A substitution header for MinGW-w64 8.0.0, manually edited, - which allows to build Vstgui custom font support. */ - -/*** Autogenerated by WIDL 5.16 from include/dwrite_3.idl - Do not edit ***/ - -#ifdef _WIN32 -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 475 -#endif -#include -#include -#endif - -#ifndef COM_NO_WINDOWS_H -#include -#include -#endif - -#ifndef __dwrite_3_h__ -#define __dwrite_3_h__ - -/* Forward declarations */ - -#ifndef __IDWriteFontDownloadListener_FWD_DEFINED__ -#define __IDWriteFontDownloadListener_FWD_DEFINED__ -typedef interface IDWriteFontDownloadListener IDWriteFontDownloadListener; -#ifdef __cplusplus -interface IDWriteFontDownloadListener; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontDownloadQueue_FWD_DEFINED__ -#define __IDWriteFontDownloadQueue_FWD_DEFINED__ -typedef interface IDWriteFontDownloadQueue IDWriteFontDownloadQueue; -#ifdef __cplusplus -interface IDWriteFontDownloadQueue; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteRenderingParams3_FWD_DEFINED__ -#define __IDWriteRenderingParams3_FWD_DEFINED__ -typedef interface IDWriteRenderingParams3 IDWriteRenderingParams3; -#ifdef __cplusplus -interface IDWriteRenderingParams3; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteStringList_FWD_DEFINED__ -#define __IDWriteStringList_FWD_DEFINED__ -typedef interface IDWriteStringList IDWriteStringList; -#ifdef __cplusplus -interface IDWriteStringList; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontSet_FWD_DEFINED__ -#define __IDWriteFontSet_FWD_DEFINED__ -typedef interface IDWriteFontSet IDWriteFontSet; -#ifdef __cplusplus -interface IDWriteFontSet; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontResource_FWD_DEFINED__ -#define __IDWriteFontResource_FWD_DEFINED__ -typedef interface IDWriteFontResource IDWriteFontResource; -#ifdef __cplusplus -interface IDWriteFontResource; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontSet1_FWD_DEFINED__ -#define __IDWriteFontSet1_FWD_DEFINED__ -typedef interface IDWriteFontSet1 IDWriteFontSet1; -#ifdef __cplusplus -interface IDWriteFontSet1; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFont3_FWD_DEFINED__ -#define __IDWriteFont3_FWD_DEFINED__ -typedef interface IDWriteFont3 IDWriteFont3; -#ifdef __cplusplus -interface IDWriteFont3; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontFamily1_FWD_DEFINED__ -#define __IDWriteFontFamily1_FWD_DEFINED__ -typedef interface IDWriteFontFamily1 IDWriteFontFamily1; -#ifdef __cplusplus -interface IDWriteFontFamily1; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontFamily2_FWD_DEFINED__ -#define __IDWriteFontFamily2_FWD_DEFINED__ -typedef interface IDWriteFontFamily2 IDWriteFontFamily2; -#ifdef __cplusplus -interface IDWriteFontFamily2; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontCollection1_FWD_DEFINED__ -#define __IDWriteFontCollection1_FWD_DEFINED__ -typedef interface IDWriteFontCollection1 IDWriteFontCollection1; -#ifdef __cplusplus -interface IDWriteFontCollection1; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontCollection2_FWD_DEFINED__ -#define __IDWriteFontCollection2_FWD_DEFINED__ -typedef interface IDWriteFontCollection2 IDWriteFontCollection2; -#ifdef __cplusplus -interface IDWriteFontCollection2; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontCollection3_FWD_DEFINED__ -#define __IDWriteFontCollection3_FWD_DEFINED__ -typedef interface IDWriteFontCollection3 IDWriteFontCollection3; -#ifdef __cplusplus -interface IDWriteFontCollection3; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontFaceReference_FWD_DEFINED__ -#define __IDWriteFontFaceReference_FWD_DEFINED__ -typedef interface IDWriteFontFaceReference IDWriteFontFaceReference; -#ifdef __cplusplus -interface IDWriteFontFaceReference; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontFaceReference1_FWD_DEFINED__ -#define __IDWriteFontFaceReference1_FWD_DEFINED__ -typedef interface IDWriteFontFaceReference1 IDWriteFontFaceReference1; -#ifdef __cplusplus -interface IDWriteFontFaceReference1; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontList1_FWD_DEFINED__ -#define __IDWriteFontList1_FWD_DEFINED__ -typedef interface IDWriteFontList1 IDWriteFontList1; -#ifdef __cplusplus -interface IDWriteFontList1; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontList2_FWD_DEFINED__ -#define __IDWriteFontList2_FWD_DEFINED__ -typedef interface IDWriteFontList2 IDWriteFontList2; -#ifdef __cplusplus -interface IDWriteFontList2; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontSet2_FWD_DEFINED__ -#define __IDWriteFontSet2_FWD_DEFINED__ -typedef interface IDWriteFontSet2 IDWriteFontSet2; -#ifdef __cplusplus -interface IDWriteFontSet2; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontSet3_FWD_DEFINED__ -#define __IDWriteFontSet3_FWD_DEFINED__ -typedef interface IDWriteFontSet3 IDWriteFontSet3; -#ifdef __cplusplus -interface IDWriteFontSet3; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontFace3_FWD_DEFINED__ -#define __IDWriteFontFace3_FWD_DEFINED__ -typedef interface IDWriteFontFace3 IDWriteFontFace3; -#ifdef __cplusplus -interface IDWriteFontFace3; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteTextFormat2_FWD_DEFINED__ -#define __IDWriteTextFormat2_FWD_DEFINED__ -typedef interface IDWriteTextFormat2 IDWriteTextFormat2; -#ifdef __cplusplus -interface IDWriteTextFormat2; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteTextFormat3_FWD_DEFINED__ -#define __IDWriteTextFormat3_FWD_DEFINED__ -typedef interface IDWriteTextFormat3 IDWriteTextFormat3; -#ifdef __cplusplus -interface IDWriteTextFormat3; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteTextLayout3_FWD_DEFINED__ -#define __IDWriteTextLayout3_FWD_DEFINED__ -typedef interface IDWriteTextLayout3 IDWriteTextLayout3; -#ifdef __cplusplus -interface IDWriteTextLayout3; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteTextLayout4_FWD_DEFINED__ -#define __IDWriteTextLayout4_FWD_DEFINED__ -typedef interface IDWriteTextLayout4 IDWriteTextLayout4; -#ifdef __cplusplus -interface IDWriteTextLayout4; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontFallback1_FWD_DEFINED__ -#define __IDWriteFontFallback1_FWD_DEFINED__ -typedef interface IDWriteFontFallback1 IDWriteFontFallback1; -#ifdef __cplusplus -interface IDWriteFontFallback1; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteGdiInterop1_FWD_DEFINED__ -#define __IDWriteGdiInterop1_FWD_DEFINED__ -typedef interface IDWriteGdiInterop1 IDWriteGdiInterop1; -#ifdef __cplusplus -interface IDWriteGdiInterop1; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontSetBuilder_FWD_DEFINED__ -#define __IDWriteFontSetBuilder_FWD_DEFINED__ -typedef interface IDWriteFontSetBuilder IDWriteFontSetBuilder; -#ifdef __cplusplus -interface IDWriteFontSetBuilder; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontSetBuilder1_FWD_DEFINED__ -#define __IDWriteFontSetBuilder1_FWD_DEFINED__ -typedef interface IDWriteFontSetBuilder1 IDWriteFontSetBuilder1; -#ifdef __cplusplus -interface IDWriteFontSetBuilder1; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontSetBuilder2_FWD_DEFINED__ -#define __IDWriteFontSetBuilder2_FWD_DEFINED__ -typedef interface IDWriteFontSetBuilder2 IDWriteFontSetBuilder2; -#ifdef __cplusplus -interface IDWriteFontSetBuilder2; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFactory3_FWD_DEFINED__ -#define __IDWriteFactory3_FWD_DEFINED__ -typedef interface IDWriteFactory3 IDWriteFactory3; -#ifdef __cplusplus -interface IDWriteFactory3; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontFace4_FWD_DEFINED__ -#define __IDWriteFontFace4_FWD_DEFINED__ -typedef interface IDWriteFontFace4 IDWriteFontFace4; -#ifdef __cplusplus -interface IDWriteFontFace4; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontFace5_FWD_DEFINED__ -#define __IDWriteFontFace5_FWD_DEFINED__ -typedef interface IDWriteFontFace5 IDWriteFontFace5; -#ifdef __cplusplus -interface IDWriteFontFace5; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteColorGlyphRunEnumerator1_FWD_DEFINED__ -#define __IDWriteColorGlyphRunEnumerator1_FWD_DEFINED__ -typedef interface IDWriteColorGlyphRunEnumerator1 IDWriteColorGlyphRunEnumerator1; -#ifdef __cplusplus -interface IDWriteColorGlyphRunEnumerator1; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFactory4_FWD_DEFINED__ -#define __IDWriteFactory4_FWD_DEFINED__ -typedef interface IDWriteFactory4 IDWriteFactory4; -#ifdef __cplusplus -interface IDWriteFactory4; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteAsyncResult_FWD_DEFINED__ -#define __IDWriteAsyncResult_FWD_DEFINED__ -typedef interface IDWriteAsyncResult IDWriteAsyncResult; -#ifdef __cplusplus -interface IDWriteAsyncResult; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteRemoteFontFileStream_FWD_DEFINED__ -#define __IDWriteRemoteFontFileStream_FWD_DEFINED__ -typedef interface IDWriteRemoteFontFileStream IDWriteRemoteFontFileStream; -#ifdef __cplusplus -interface IDWriteRemoteFontFileStream; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteRemoteFontFileLoader_FWD_DEFINED__ -#define __IDWriteRemoteFontFileLoader_FWD_DEFINED__ -typedef interface IDWriteRemoteFontFileLoader IDWriteRemoteFontFileLoader; -#ifdef __cplusplus -interface IDWriteRemoteFontFileLoader; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteInMemoryFontFileLoader_FWD_DEFINED__ -#define __IDWriteInMemoryFontFileLoader_FWD_DEFINED__ -typedef interface IDWriteInMemoryFontFileLoader IDWriteInMemoryFontFileLoader; -#ifdef __cplusplus -interface IDWriteInMemoryFontFileLoader; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFactory5_FWD_DEFINED__ -#define __IDWriteFactory5_FWD_DEFINED__ -typedef interface IDWriteFactory5 IDWriteFactory5; -#ifdef __cplusplus -interface IDWriteFactory5; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFactory6_FWD_DEFINED__ -#define __IDWriteFactory6_FWD_DEFINED__ -typedef interface IDWriteFactory6 IDWriteFactory6; -#ifdef __cplusplus -interface IDWriteFactory6; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFactory7_FWD_DEFINED__ -#define __IDWriteFactory7_FWD_DEFINED__ -typedef interface IDWriteFactory7 IDWriteFactory7; -#ifdef __cplusplus -interface IDWriteFactory7; -#endif /* __cplusplus */ -#endif - -/* Headers for imported files */ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __IDWriteFontFaceReference_FWD_DEFINED__ -#define __IDWriteFontFaceReference_FWD_DEFINED__ -typedef interface IDWriteFontFaceReference IDWriteFontFaceReference; -#ifdef __cplusplus -interface IDWriteFontFaceReference; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontFaceReference1_FWD_DEFINED__ -#define __IDWriteFontFaceReference1_FWD_DEFINED__ -typedef interface IDWriteFontFaceReference1 IDWriteFontFaceReference1; -#ifdef __cplusplus -interface IDWriteFontFaceReference1; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontFace3_FWD_DEFINED__ -#define __IDWriteFontFace3_FWD_DEFINED__ -typedef interface IDWriteFontFace3 IDWriteFontFace3; -#ifdef __cplusplus -interface IDWriteFontFace3; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontSet_FWD_DEFINED__ -#define __IDWriteFontSet_FWD_DEFINED__ -typedef interface IDWriteFontSet IDWriteFontSet; -#ifdef __cplusplus -interface IDWriteFontSet; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontDownloadQueue_FWD_DEFINED__ -#define __IDWriteFontDownloadQueue_FWD_DEFINED__ -typedef interface IDWriteFontDownloadQueue IDWriteFontDownloadQueue; -#ifdef __cplusplus -interface IDWriteFontDownloadQueue; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontFace5_FWD_DEFINED__ -#define __IDWriteFontFace5_FWD_DEFINED__ -typedef interface IDWriteFontFace5 IDWriteFontFace5; -#ifdef __cplusplus -interface IDWriteFontFace5; -#endif /* __cplusplus */ -#endif - -#ifndef __IDWriteFontList2_FWD_DEFINED__ -#define __IDWriteFontList2_FWD_DEFINED__ -typedef interface IDWriteFontList2 IDWriteFontList2; -#ifdef __cplusplus -interface IDWriteFontList2; -#endif /* __cplusplus */ -#endif - -#ifndef _WINGDI_ -typedef struct FONTSIGNATURE FONTSIGNATURE; -#endif /* _WINGDI_ */ -typedef enum DWRITE_LOCALITY { - DWRITE_LOCALITY_REMOTE = 0, - DWRITE_LOCALITY_PARTIAL = 1, - DWRITE_LOCALITY_LOCAL = 2 -} DWRITE_LOCALITY; -typedef enum DWRITE_RENDERING_MODE1 { - DWRITE_RENDERING_MODE1_DEFAULT = 0, - DWRITE_RENDERING_MODE1_ALIASED = 1, - DWRITE_RENDERING_MODE1_GDI_CLASSIC = 2, - DWRITE_RENDERING_MODE1_GDI_NATURAL = 3, - DWRITE_RENDERING_MODE1_NATURAL = 4, - DWRITE_RENDERING_MODE1_NATURAL_SYMMETRIC = 5, - DWRITE_RENDERING_MODE1_OUTLINE = 6, - DWRITE_RENDERING_MODE1_NATURAL_SYMMETRIC_DOWNSAMPLED = 7 -} DWRITE_RENDERING_MODE1; -typedef enum DWRITE_FONT_PROPERTY_ID { - DWRITE_FONT_PROPERTY_ID_NONE = 0, - DWRITE_FONT_PROPERTY_ID_WEIGHT_STRETCH_STYLE_FAMILY_NAME = 1, - DWRITE_FONT_PROPERTY_ID_TYPOGRAPHIC_FAMILY_NAME = 2, - DWRITE_FONT_PROPERTY_ID_WEIGHT_STRETCH_STYLE_FACE_NAME = 3, - DWRITE_FONT_PROPERTY_ID_FULL_NAME = 4, - DWRITE_FONT_PROPERTY_ID_WIN32_FAMILY_NAME = 5, - DWRITE_FONT_PROPERTY_ID_POSTSCRIPT_NAME = 6, - DWRITE_FONT_PROPERTY_ID_DESIGN_SCRIPT_LANGUAGE_TAG = 7, - DWRITE_FONT_PROPERTY_ID_SUPPORTED_SCRIPT_LANGUAGE_TAG = 8, - DWRITE_FONT_PROPERTY_ID_SEMANTIC_TAG = 9, - DWRITE_FONT_PROPERTY_ID_WEIGHT = 10, - DWRITE_FONT_PROPERTY_ID_STRETCH = 11, - DWRITE_FONT_PROPERTY_ID_STYLE = 12, - DWRITE_FONT_PROPERTY_ID_TYPOGRAPHIC_FACE_NAME = 13, - DWRITE_FONT_PROPERTY_ID_TOTAL = DWRITE_FONT_PROPERTY_ID_STYLE + 1, - DWRITE_FONT_PROPERTY_ID_TOTAL_RS3 = DWRITE_FONT_PROPERTY_ID_TYPOGRAPHIC_FACE_NAME + 1, - DWRITE_FONT_PROPERTY_ID_FAMILY_NAME = DWRITE_FONT_PROPERTY_ID_TYPOGRAPHIC_FAMILY_NAME, - DWRITE_FONT_PROPERTY_ID_PREFERRED_FAMILY_NAME = DWRITE_FONT_PROPERTY_ID_WEIGHT_STRETCH_STYLE_FAMILY_NAME, - DWRITE_FONT_PROPERTY_ID_FACE_NAME = DWRITE_FONT_PROPERTY_ID_WEIGHT_STRETCH_STYLE_FACE_NAME -} DWRITE_FONT_PROPERTY_ID; -typedef struct DWRITE_FONT_PROPERTY { - DWRITE_FONT_PROPERTY_ID propertyId; - const WCHAR *propertyValue; - const WCHAR *localeName; -} DWRITE_FONT_PROPERTY; -typedef enum DWRITE_FONT_AXIS_TAG { - DWRITE_FONT_AXIS_TAG_WEIGHT = 0x74686777, - DWRITE_FONT_AXIS_TAG_WIDTH = 0x68746477, - DWRITE_FONT_AXIS_TAG_SLANT = 0x746e6c73, - DWRITE_FONT_AXIS_TAG_OPTICAL_SIZE = 0x7a73706f, - DWRITE_FONT_AXIS_TAG_ITALIC = 0x6c617469 -} DWRITE_FONT_AXIS_TAG; -typedef enum DWRITE_FONT_SOURCE_TYPE { - DWRITE_FONT_SOURCE_TYPE_UNKNOWN = 0, - DWRITE_FONT_SOURCE_TYPE_PER_MACHINE = 1, - DWRITE_FONT_SOURCE_TYPE_PER_USER = 2, - DWRITE_FONT_SOURCE_TYPE_APPX_PACKAGE = 3, - DWRITE_FONT_SOURCE_TYPE_REMOTE_FONT_PROVIDER = 4 -} DWRITE_FONT_SOURCE_TYPE; -typedef struct DWRITE_FONT_AXIS_VALUE { - DWRITE_FONT_AXIS_TAG axisTag; - FLOAT value; -} DWRITE_FONT_AXIS_VALUE; -typedef struct DWRITE_FONT_AXIS_RANGE { - DWRITE_FONT_AXIS_TAG axisTag; - FLOAT minValue; - FLOAT maxValue; -} DWRITE_FONT_AXIS_RANGE; -typedef enum DWRITE_AUTOMATIC_FONT_AXES { - DWRITE_AUTOMATIC_FONT_AXES_NONE = 0, - DWRITE_AUTOMATIC_FONT_AXES_OPTICAL_SIZE = 1 -} DWRITE_AUTOMATIC_FONT_AXES; -typedef enum DWRITE_FONT_AXIS_ATTRIBUTES { - DWRITE_FONT_AXIS_ATTRIBUTES_NONE = 0, - DWRITE_FONT_AXIS_ATTRIBUTES_VARIABLE = 1, - DWRITE_FONT_AXIS_ATTRIBUTES_HIDDEN = 2 -} DWRITE_FONT_AXIS_ATTRIBUTES; -typedef enum DWRITE_FONT_FAMILY_MODEL { - DWRITE_FONT_FAMILY_MODEL_TYPOGRAPHIC = 0, - DWRITE_FONT_FAMILY_MODEL_WEIGHT_STRETCH_STYLE = 1 -} DWRITE_FONT_FAMILY_MODEL; -/***************************************************************************** - * IDWriteFontDownloadListener interface - */ -#ifndef __IDWriteFontDownloadListener_INTERFACE_DEFINED__ -#define __IDWriteFontDownloadListener_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontDownloadListener, 0xb06fe5b9, 0x43ec, 0x4393, 0x88,0x1b, 0xdb,0xe4,0xdc,0x72,0xfd,0xa7); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("b06fe5b9-43ec-4393-881b-dbe4dc72fda7") -IDWriteFontDownloadListener : public IUnknown -{ - virtual void STDMETHODCALLTYPE DownloadCompleted( - IDWriteFontDownloadQueue *queue, - IUnknown *context, - HRESULT result) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontDownloadListener, 0xb06fe5b9, 0x43ec, 0x4393, 0x88,0x1b, 0xdb,0xe4,0xdc,0x72,0xfd,0xa7) -#endif -#else -typedef struct IDWriteFontDownloadListenerVtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontDownloadListener *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontDownloadListener *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontDownloadListener *This); - - /*** IDWriteFontDownloadListener methods ***/ - void (STDMETHODCALLTYPE *DownloadCompleted)( - IDWriteFontDownloadListener *This, - IDWriteFontDownloadQueue *queue, - IUnknown *context, - HRESULT result); - - END_INTERFACE -} IDWriteFontDownloadListenerVtbl; - -interface IDWriteFontDownloadListener { - CONST_VTBL IDWriteFontDownloadListenerVtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontDownloadListener_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontDownloadListener_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontDownloadListener_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontDownloadListener methods ***/ -#define IDWriteFontDownloadListener_DownloadCompleted(This,queue,context,result) (This)->lpVtbl->DownloadCompleted(This,queue,context,result) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontDownloadListener_QueryInterface(IDWriteFontDownloadListener* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontDownloadListener_AddRef(IDWriteFontDownloadListener* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontDownloadListener_Release(IDWriteFontDownloadListener* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontDownloadListener methods ***/ -static FORCEINLINE void IDWriteFontDownloadListener_DownloadCompleted(IDWriteFontDownloadListener* This,IDWriteFontDownloadQueue *queue,IUnknown *context,HRESULT result) { - This->lpVtbl->DownloadCompleted(This,queue,context,result); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontDownloadListener_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontDownloadQueue interface - */ -#ifndef __IDWriteFontDownloadQueue_INTERFACE_DEFINED__ -#define __IDWriteFontDownloadQueue_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontDownloadQueue, 0xb71e6052, 0x5aea, 0x4fa3, 0x83,0x2e, 0xf6,0x0d,0x43,0x1f,0x7e,0x91); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("b71e6052-5aea-4fa3-832e-f60d431f7e91") -IDWriteFontDownloadQueue : public IUnknown -{ - virtual HRESULT STDMETHODCALLTYPE AddListener( - IDWriteFontDownloadListener *listener, - UINT32 *token) = 0; - - virtual HRESULT STDMETHODCALLTYPE RemoveListener( - UINT32 token) = 0; - - virtual WINBOOL STDMETHODCALLTYPE IsEmpty( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE BeginDownload( - IUnknown *context) = 0; - - virtual HRESULT STDMETHODCALLTYPE CancelDownload( - ) = 0; - - virtual UINT64 STDMETHODCALLTYPE GetGenerationCount( - ) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontDownloadQueue, 0xb71e6052, 0x5aea, 0x4fa3, 0x83,0x2e, 0xf6,0x0d,0x43,0x1f,0x7e,0x91) -#endif -#else -typedef struct IDWriteFontDownloadQueueVtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontDownloadQueue *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontDownloadQueue *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontDownloadQueue *This); - - /*** IDWriteFontDownloadQueue methods ***/ - HRESULT (STDMETHODCALLTYPE *AddListener)( - IDWriteFontDownloadQueue *This, - IDWriteFontDownloadListener *listener, - UINT32 *token); - - HRESULT (STDMETHODCALLTYPE *RemoveListener)( - IDWriteFontDownloadQueue *This, - UINT32 token); - - WINBOOL (STDMETHODCALLTYPE *IsEmpty)( - IDWriteFontDownloadQueue *This); - - HRESULT (STDMETHODCALLTYPE *BeginDownload)( - IDWriteFontDownloadQueue *This, - IUnknown *context); - - HRESULT (STDMETHODCALLTYPE *CancelDownload)( - IDWriteFontDownloadQueue *This); - - UINT64 (STDMETHODCALLTYPE *GetGenerationCount)( - IDWriteFontDownloadQueue *This); - - END_INTERFACE -} IDWriteFontDownloadQueueVtbl; - -interface IDWriteFontDownloadQueue { - CONST_VTBL IDWriteFontDownloadQueueVtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontDownloadQueue_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontDownloadQueue_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontDownloadQueue_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontDownloadQueue methods ***/ -#define IDWriteFontDownloadQueue_AddListener(This,listener,token) (This)->lpVtbl->AddListener(This,listener,token) -#define IDWriteFontDownloadQueue_RemoveListener(This,token) (This)->lpVtbl->RemoveListener(This,token) -#define IDWriteFontDownloadQueue_IsEmpty(This) (This)->lpVtbl->IsEmpty(This) -#define IDWriteFontDownloadQueue_BeginDownload(This,context) (This)->lpVtbl->BeginDownload(This,context) -#define IDWriteFontDownloadQueue_CancelDownload(This) (This)->lpVtbl->CancelDownload(This) -#define IDWriteFontDownloadQueue_GetGenerationCount(This) (This)->lpVtbl->GetGenerationCount(This) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontDownloadQueue_QueryInterface(IDWriteFontDownloadQueue* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontDownloadQueue_AddRef(IDWriteFontDownloadQueue* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontDownloadQueue_Release(IDWriteFontDownloadQueue* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontDownloadQueue methods ***/ -static FORCEINLINE HRESULT IDWriteFontDownloadQueue_AddListener(IDWriteFontDownloadQueue* This,IDWriteFontDownloadListener *listener,UINT32 *token) { - return This->lpVtbl->AddListener(This,listener,token); -} -static FORCEINLINE HRESULT IDWriteFontDownloadQueue_RemoveListener(IDWriteFontDownloadQueue* This,UINT32 token) { - return This->lpVtbl->RemoveListener(This,token); -} -static FORCEINLINE WINBOOL IDWriteFontDownloadQueue_IsEmpty(IDWriteFontDownloadQueue* This) { - return This->lpVtbl->IsEmpty(This); -} -static FORCEINLINE HRESULT IDWriteFontDownloadQueue_BeginDownload(IDWriteFontDownloadQueue* This,IUnknown *context) { - return This->lpVtbl->BeginDownload(This,context); -} -static FORCEINLINE HRESULT IDWriteFontDownloadQueue_CancelDownload(IDWriteFontDownloadQueue* This) { - return This->lpVtbl->CancelDownload(This); -} -static FORCEINLINE UINT64 IDWriteFontDownloadQueue_GetGenerationCount(IDWriteFontDownloadQueue* This) { - return This->lpVtbl->GetGenerationCount(This); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontDownloadQueue_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteRenderingParams3 interface - */ -#ifndef __IDWriteRenderingParams3_INTERFACE_DEFINED__ -#define __IDWriteRenderingParams3_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteRenderingParams3, 0xb7924baa, 0x391b, 0x412a, 0x8c,0x5c, 0xe4,0x4c,0xc2,0xd8,0x67,0xdc); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("b7924baa-391b-412a-8c5c-e44cc2d867dc") -IDWriteRenderingParams3 : public IDWriteRenderingParams2 -{ - virtual DWRITE_RENDERING_MODE1 STDMETHODCALLTYPE GetRenderingMode1( - ) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteRenderingParams3, 0xb7924baa, 0x391b, 0x412a, 0x8c,0x5c, 0xe4,0x4c,0xc2,0xd8,0x67,0xdc) -#endif -#else -typedef struct IDWriteRenderingParams3Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteRenderingParams3 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteRenderingParams3 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteRenderingParams3 *This); - - /*** IDWriteRenderingParams methods ***/ - FLOAT (STDMETHODCALLTYPE *GetGamma)( - IDWriteRenderingParams3 *This); - - FLOAT (STDMETHODCALLTYPE *GetEnhancedContrast)( - IDWriteRenderingParams3 *This); - - FLOAT (STDMETHODCALLTYPE *GetClearTypeLevel)( - IDWriteRenderingParams3 *This); - - DWRITE_PIXEL_GEOMETRY (STDMETHODCALLTYPE *GetPixelGeometry)( - IDWriteRenderingParams3 *This); - - DWRITE_RENDERING_MODE (STDMETHODCALLTYPE *GetRenderingMode)( - IDWriteRenderingParams3 *This); - - /*** IDWriteRenderingParams1 methods ***/ - FLOAT (STDMETHODCALLTYPE *GetGrayscaleEnhancedContrast)( - IDWriteRenderingParams3 *This); - - /*** IDWriteRenderingParams2 methods ***/ - DWRITE_GRID_FIT_MODE (STDMETHODCALLTYPE *GetGridFitMode)( - IDWriteRenderingParams3 *This); - - /*** IDWriteRenderingParams3 methods ***/ - DWRITE_RENDERING_MODE1 (STDMETHODCALLTYPE *GetRenderingMode1)( - IDWriteRenderingParams3 *This); - - END_INTERFACE -} IDWriteRenderingParams3Vtbl; - -interface IDWriteRenderingParams3 { - CONST_VTBL IDWriteRenderingParams3Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteRenderingParams3_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteRenderingParams3_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteRenderingParams3_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteRenderingParams methods ***/ -#define IDWriteRenderingParams3_GetGamma(This) (This)->lpVtbl->GetGamma(This) -#define IDWriteRenderingParams3_GetEnhancedContrast(This) (This)->lpVtbl->GetEnhancedContrast(This) -#define IDWriteRenderingParams3_GetClearTypeLevel(This) (This)->lpVtbl->GetClearTypeLevel(This) -#define IDWriteRenderingParams3_GetPixelGeometry(This) (This)->lpVtbl->GetPixelGeometry(This) -#define IDWriteRenderingParams3_GetRenderingMode(This) (This)->lpVtbl->GetRenderingMode(This) -/*** IDWriteRenderingParams1 methods ***/ -#define IDWriteRenderingParams3_GetGrayscaleEnhancedContrast(This) (This)->lpVtbl->GetGrayscaleEnhancedContrast(This) -/*** IDWriteRenderingParams2 methods ***/ -#define IDWriteRenderingParams3_GetGridFitMode(This) (This)->lpVtbl->GetGridFitMode(This) -/*** IDWriteRenderingParams3 methods ***/ -#define IDWriteRenderingParams3_GetRenderingMode1(This) (This)->lpVtbl->GetRenderingMode1(This) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteRenderingParams3_QueryInterface(IDWriteRenderingParams3* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteRenderingParams3_AddRef(IDWriteRenderingParams3* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteRenderingParams3_Release(IDWriteRenderingParams3* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteRenderingParams methods ***/ -static FORCEINLINE FLOAT IDWriteRenderingParams3_GetGamma(IDWriteRenderingParams3* This) { - return This->lpVtbl->GetGamma(This); -} -static FORCEINLINE FLOAT IDWriteRenderingParams3_GetEnhancedContrast(IDWriteRenderingParams3* This) { - return This->lpVtbl->GetEnhancedContrast(This); -} -static FORCEINLINE FLOAT IDWriteRenderingParams3_GetClearTypeLevel(IDWriteRenderingParams3* This) { - return This->lpVtbl->GetClearTypeLevel(This); -} -static FORCEINLINE DWRITE_PIXEL_GEOMETRY IDWriteRenderingParams3_GetPixelGeometry(IDWriteRenderingParams3* This) { - return This->lpVtbl->GetPixelGeometry(This); -} -static FORCEINLINE DWRITE_RENDERING_MODE IDWriteRenderingParams3_GetRenderingMode(IDWriteRenderingParams3* This) { - return This->lpVtbl->GetRenderingMode(This); -} -/*** IDWriteRenderingParams1 methods ***/ -static FORCEINLINE FLOAT IDWriteRenderingParams3_GetGrayscaleEnhancedContrast(IDWriteRenderingParams3* This) { - return This->lpVtbl->GetGrayscaleEnhancedContrast(This); -} -/*** IDWriteRenderingParams2 methods ***/ -static FORCEINLINE DWRITE_GRID_FIT_MODE IDWriteRenderingParams3_GetGridFitMode(IDWriteRenderingParams3* This) { - return This->lpVtbl->GetGridFitMode(This); -} -/*** IDWriteRenderingParams3 methods ***/ -static FORCEINLINE DWRITE_RENDERING_MODE1 IDWriteRenderingParams3_GetRenderingMode1(IDWriteRenderingParams3* This) { - return This->lpVtbl->GetRenderingMode1(This); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteRenderingParams3_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteStringList interface - */ -#ifndef __IDWriteStringList_INTERFACE_DEFINED__ -#define __IDWriteStringList_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteStringList, 0xcfee3140, 0x1257, 0x47ca, 0x8b,0x85, 0x31,0xbf,0xcf,0x3f,0x2d,0x0e); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("cfee3140-1257-47ca-8b85-31bfcf3f2d0e") -IDWriteStringList : public IUnknown -{ - virtual UINT32 STDMETHODCALLTYPE GetCount( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLocaleNameLength( - UINT32 index, - UINT32 *length) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLocaleName( - UINT32 index, - WCHAR *name, - UINT32 size) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetStringLength( - UINT32 index, - UINT32 *length) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetString( - UINT32 index, - WCHAR *string, - UINT32 size) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteStringList, 0xcfee3140, 0x1257, 0x47ca, 0x8b,0x85, 0x31,0xbf,0xcf,0x3f,0x2d,0x0e) -#endif -#else -typedef struct IDWriteStringListVtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteStringList *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteStringList *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteStringList *This); - - /*** IDWriteStringList methods ***/ - UINT32 (STDMETHODCALLTYPE *GetCount)( - IDWriteStringList *This); - - HRESULT (STDMETHODCALLTYPE *GetLocaleNameLength)( - IDWriteStringList *This, - UINT32 index, - UINT32 *length); - - HRESULT (STDMETHODCALLTYPE *GetLocaleName)( - IDWriteStringList *This, - UINT32 index, - WCHAR *name, - UINT32 size); - - HRESULT (STDMETHODCALLTYPE *GetStringLength)( - IDWriteStringList *This, - UINT32 index, - UINT32 *length); - - HRESULT (STDMETHODCALLTYPE *GetString)( - IDWriteStringList *This, - UINT32 index, - WCHAR *string, - UINT32 size); - - END_INTERFACE -} IDWriteStringListVtbl; - -interface IDWriteStringList { - CONST_VTBL IDWriteStringListVtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteStringList_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteStringList_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteStringList_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteStringList methods ***/ -#define IDWriteStringList_GetCount(This) (This)->lpVtbl->GetCount(This) -#define IDWriteStringList_GetLocaleNameLength(This,index,length) (This)->lpVtbl->GetLocaleNameLength(This,index,length) -#define IDWriteStringList_GetLocaleName(This,index,name,size) (This)->lpVtbl->GetLocaleName(This,index,name,size) -#define IDWriteStringList_GetStringLength(This,index,length) (This)->lpVtbl->GetStringLength(This,index,length) -#define IDWriteStringList_GetString(This,index,string,size) (This)->lpVtbl->GetString(This,index,string,size) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteStringList_QueryInterface(IDWriteStringList* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteStringList_AddRef(IDWriteStringList* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteStringList_Release(IDWriteStringList* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteStringList methods ***/ -static FORCEINLINE UINT32 IDWriteStringList_GetCount(IDWriteStringList* This) { - return This->lpVtbl->GetCount(This); -} -static FORCEINLINE HRESULT IDWriteStringList_GetLocaleNameLength(IDWriteStringList* This,UINT32 index,UINT32 *length) { - return This->lpVtbl->GetLocaleNameLength(This,index,length); -} -static FORCEINLINE HRESULT IDWriteStringList_GetLocaleName(IDWriteStringList* This,UINT32 index,WCHAR *name,UINT32 size) { - return This->lpVtbl->GetLocaleName(This,index,name,size); -} -static FORCEINLINE HRESULT IDWriteStringList_GetStringLength(IDWriteStringList* This,UINT32 index,UINT32 *length) { - return This->lpVtbl->GetStringLength(This,index,length); -} -static FORCEINLINE HRESULT IDWriteStringList_GetString(IDWriteStringList* This,UINT32 index,WCHAR *string,UINT32 size) { - return This->lpVtbl->GetString(This,index,string,size); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteStringList_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontSet interface - */ -#ifndef __IDWriteFontSet_INTERFACE_DEFINED__ -#define __IDWriteFontSet_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontSet, 0x53585141, 0xd9f8, 0x4095, 0x83,0x21, 0xd7,0x3c,0xf6,0xbd,0x11,0x6b); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("53585141-d9f8-4095-8321-d73cf6bd116b") -IDWriteFontSet : public IUnknown -{ - virtual UINT32 STDMETHODCALLTYPE GetFontCount( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontFaceReference( - UINT32 index, - IDWriteFontFaceReference **reference) = 0; - - virtual HRESULT STDMETHODCALLTYPE FindFontFaceReference( - IDWriteFontFaceReference *reference, - UINT32 *index, - WINBOOL *exists) = 0; - - virtual HRESULT STDMETHODCALLTYPE FindFontFace( - IDWriteFontFace *fontface, - UINT32 *index, - WINBOOL *exists) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPropertyValues( - DWRITE_FONT_PROPERTY_ID id, - IDWriteStringList **values) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPropertyValues( - DWRITE_FONT_PROPERTY_ID id, - const WCHAR *preferred_locales, - IDWriteStringList **values) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPropertyValues( - UINT32 index, - DWRITE_FONT_PROPERTY_ID id, - WINBOOL *exists, - IDWriteLocalizedStrings **values) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetPropertyOccurrenceCount( - const DWRITE_FONT_PROPERTY *property, - UINT32 *count) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMatchingFonts( - const WCHAR *family, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, - DWRITE_FONT_STYLE style, - IDWriteFontSet **fontset) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMatchingFonts( - const DWRITE_FONT_PROPERTY *props, - UINT32 count, - IDWriteFontSet **fontset) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontSet, 0x53585141, 0xd9f8, 0x4095, 0x83,0x21, 0xd7,0x3c,0xf6,0xbd,0x11,0x6b) -#endif -#else -typedef struct IDWriteFontSetVtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontSet *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontSet *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontSet *This); - - /*** IDWriteFontSet methods ***/ - UINT32 (STDMETHODCALLTYPE *GetFontCount)( - IDWriteFontSet *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFaceReference)( - IDWriteFontSet *This, - UINT32 index, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *FindFontFaceReference)( - IDWriteFontSet *This, - IDWriteFontFaceReference *reference, - UINT32 *index, - WINBOOL *exists); - - HRESULT (STDMETHODCALLTYPE *FindFontFace)( - IDWriteFontSet *This, - IDWriteFontFace *fontface, - UINT32 *index, - WINBOOL *exists); - - HRESULT (STDMETHODCALLTYPE *GetPropertyValues__)( - IDWriteFontSet *This, - DWRITE_FONT_PROPERTY_ID id, - IDWriteStringList **values); - - HRESULT (STDMETHODCALLTYPE *GetPropertyValues_)( - IDWriteFontSet *This, - DWRITE_FONT_PROPERTY_ID id, - const WCHAR *preferred_locales, - IDWriteStringList **values); - - HRESULT (STDMETHODCALLTYPE *GetPropertyValues)( - IDWriteFontSet *This, - UINT32 index, - DWRITE_FONT_PROPERTY_ID id, - WINBOOL *exists, - IDWriteLocalizedStrings **values); - - HRESULT (STDMETHODCALLTYPE *GetPropertyOccurrenceCount)( - IDWriteFontSet *This, - const DWRITE_FONT_PROPERTY *property, - UINT32 *count); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFonts_)( - IDWriteFontSet *This, - const WCHAR *family, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, - DWRITE_FONT_STYLE style, - IDWriteFontSet **fontset); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFonts)( - IDWriteFontSet *This, - const DWRITE_FONT_PROPERTY *props, - UINT32 count, - IDWriteFontSet **fontset); - - END_INTERFACE -} IDWriteFontSetVtbl; - -interface IDWriteFontSet { - CONST_VTBL IDWriteFontSetVtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontSet_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontSet_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontSet_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontSet methods ***/ -#define IDWriteFontSet_GetFontCount(This) (This)->lpVtbl->GetFontCount(This) -#define IDWriteFontSet_GetFontFaceReference(This,index,reference) (This)->lpVtbl->GetFontFaceReference(This,index,reference) -#define IDWriteFontSet_FindFontFaceReference(This,reference,index,exists) (This)->lpVtbl->FindFontFaceReference(This,reference,index,exists) -#define IDWriteFontSet_FindFontFace(This,fontface,index,exists) (This)->lpVtbl->FindFontFace(This,fontface,index,exists) -#define IDWriteFontSet_GetPropertyValues__(This,id,values) (This)->lpVtbl->GetPropertyValues__(This,id,values) -#define IDWriteFontSet_GetPropertyValues_(This,id,preferred_locales,values) (This)->lpVtbl->GetPropertyValues_(This,id,preferred_locales,values) -#define IDWriteFontSet_GetPropertyValues(This,index,id,exists,values) (This)->lpVtbl->GetPropertyValues(This,index,id,exists,values) -#define IDWriteFontSet_GetPropertyOccurrenceCount(This,property,count) (This)->lpVtbl->GetPropertyOccurrenceCount(This,property,count) -#define IDWriteFontSet_GetMatchingFonts_(This,family,weight,stretch,style,fontset) (This)->lpVtbl->GetMatchingFonts_(This,family,weight,stretch,style,fontset) -#define IDWriteFontSet_GetMatchingFonts(This,props,count,fontset) (This)->lpVtbl->GetMatchingFonts(This,props,count,fontset) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontSet_QueryInterface(IDWriteFontSet* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontSet_AddRef(IDWriteFontSet* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontSet_Release(IDWriteFontSet* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontSet methods ***/ -static FORCEINLINE UINT32 IDWriteFontSet_GetFontCount(IDWriteFontSet* This) { - return This->lpVtbl->GetFontCount(This); -} -static FORCEINLINE HRESULT IDWriteFontSet_GetFontFaceReference(IDWriteFontSet* This,UINT32 index,IDWriteFontFaceReference **reference) { - return This->lpVtbl->GetFontFaceReference(This,index,reference); -} -static FORCEINLINE HRESULT IDWriteFontSet_FindFontFaceReference(IDWriteFontSet* This,IDWriteFontFaceReference *reference,UINT32 *index,WINBOOL *exists) { - return This->lpVtbl->FindFontFaceReference(This,reference,index,exists); -} -static FORCEINLINE HRESULT IDWriteFontSet_FindFontFace(IDWriteFontSet* This,IDWriteFontFace *fontface,UINT32 *index,WINBOOL *exists) { - return This->lpVtbl->FindFontFace(This,fontface,index,exists); -} -static FORCEINLINE HRESULT IDWriteFontSet_GetPropertyValues__(IDWriteFontSet* This,DWRITE_FONT_PROPERTY_ID id,IDWriteStringList **values) { - return This->lpVtbl->GetPropertyValues__(This,id,values); -} -static FORCEINLINE HRESULT IDWriteFontSet_GetPropertyValues_(IDWriteFontSet* This,DWRITE_FONT_PROPERTY_ID id,const WCHAR *preferred_locales,IDWriteStringList **values) { - return This->lpVtbl->GetPropertyValues_(This,id,preferred_locales,values); -} -static FORCEINLINE HRESULT IDWriteFontSet_GetPropertyValues(IDWriteFontSet* This,UINT32 index,DWRITE_FONT_PROPERTY_ID id,WINBOOL *exists,IDWriteLocalizedStrings **values) { - return This->lpVtbl->GetPropertyValues(This,index,id,exists,values); -} -static FORCEINLINE HRESULT IDWriteFontSet_GetPropertyOccurrenceCount(IDWriteFontSet* This,const DWRITE_FONT_PROPERTY *property,UINT32 *count) { - return This->lpVtbl->GetPropertyOccurrenceCount(This,property,count); -} -static FORCEINLINE HRESULT IDWriteFontSet_GetMatchingFonts_(IDWriteFontSet* This,const WCHAR *family,DWRITE_FONT_WEIGHT weight,DWRITE_FONT_STRETCH stretch,DWRITE_FONT_STYLE style,IDWriteFontSet **fontset) { - return This->lpVtbl->GetMatchingFonts_(This,family,weight,stretch,style,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet_GetMatchingFonts(IDWriteFontSet* This,const DWRITE_FONT_PROPERTY *props,UINT32 count,IDWriteFontSet **fontset) { - return This->lpVtbl->GetMatchingFonts(This,props,count,fontset); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontSet_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontResource interface - */ -#ifndef __IDWriteFontResource_INTERFACE_DEFINED__ -#define __IDWriteFontResource_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontResource, 0x1f803a76, 0x6871, 0x48e8, 0x98,0x7f, 0xb9,0x75,0x55,0x1c,0x50,0xf2); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("1f803a76-6871-48e8-987f-b975551c50f2") -IDWriteFontResource : public IUnknown -{ - virtual HRESULT STDMETHODCALLTYPE GetFontFile( - IDWriteFontFile **fontfile) = 0; - - virtual UINT32 STDMETHODCALLTYPE GetFontFaceIndex( - ) = 0; - - virtual UINT32 STDMETHODCALLTYPE GetFontAxisCount( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetDefaultFontAxisValues( - const DWRITE_FONT_AXIS_VALUE *values, - UINT32 num_values) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontAxisRanges( - const DWRITE_FONT_AXIS_RANGE *ranges, - UINT32 num_ranges) = 0; - - virtual DWRITE_FONT_AXIS_ATTRIBUTES STDMETHODCALLTYPE GetFontAxisAttributes( - UINT32 axis) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAxisNames( - UINT32 axis, - IDWriteLocalizedStrings **names) = 0; - - virtual UINT32 STDMETHODCALLTYPE GetAxisValueNameCount( - UINT32 axis) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetAxisValueNames( - UINT32 axis, - UINT32 axis_value, - DWRITE_FONT_AXIS_RANGE *axis_range, - IDWriteLocalizedStrings **names) = 0; - - virtual WINBOOL STDMETHODCALLTYPE HasVariations( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateFontFace( - DWRITE_FONT_SIMULATIONS simulations, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontFace5 **fontface) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateFontFaceReference( - DWRITE_FONT_SIMULATIONS simulations, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontFaceReference1 **reference) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontResource, 0x1f803a76, 0x6871, 0x48e8, 0x98,0x7f, 0xb9,0x75,0x55,0x1c,0x50,0xf2) -#endif -#else -typedef struct IDWriteFontResourceVtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontResource *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontResource *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontResource *This); - - /*** IDWriteFontResource methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontFile)( - IDWriteFontResource *This, - IDWriteFontFile **fontfile); - - UINT32 (STDMETHODCALLTYPE *GetFontFaceIndex)( - IDWriteFontResource *This); - - UINT32 (STDMETHODCALLTYPE *GetFontAxisCount)( - IDWriteFontResource *This); - - HRESULT (STDMETHODCALLTYPE *GetDefaultFontAxisValues)( - IDWriteFontResource *This, - const DWRITE_FONT_AXIS_VALUE *values, - UINT32 num_values); - - HRESULT (STDMETHODCALLTYPE *GetFontAxisRanges)( - IDWriteFontResource *This, - const DWRITE_FONT_AXIS_RANGE *ranges, - UINT32 num_ranges); - - DWRITE_FONT_AXIS_ATTRIBUTES (STDMETHODCALLTYPE *GetFontAxisAttributes)( - IDWriteFontResource *This, - UINT32 axis); - - HRESULT (STDMETHODCALLTYPE *GetAxisNames)( - IDWriteFontResource *This, - UINT32 axis, - IDWriteLocalizedStrings **names); - - UINT32 (STDMETHODCALLTYPE *GetAxisValueNameCount)( - IDWriteFontResource *This, - UINT32 axis); - - HRESULT (STDMETHODCALLTYPE *GetAxisValueNames)( - IDWriteFontResource *This, - UINT32 axis, - UINT32 axis_value, - DWRITE_FONT_AXIS_RANGE *axis_range, - IDWriteLocalizedStrings **names); - - WINBOOL (STDMETHODCALLTYPE *HasVariations)( - IDWriteFontResource *This); - - HRESULT (STDMETHODCALLTYPE *CreateFontFace)( - IDWriteFontResource *This, - DWRITE_FONT_SIMULATIONS simulations, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontFace5 **fontface); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceReference)( - IDWriteFontResource *This, - DWRITE_FONT_SIMULATIONS simulations, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontFaceReference1 **reference); - - END_INTERFACE -} IDWriteFontResourceVtbl; - -interface IDWriteFontResource { - CONST_VTBL IDWriteFontResourceVtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontResource_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontResource_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontResource_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontResource methods ***/ -#define IDWriteFontResource_GetFontFile(This,fontfile) (This)->lpVtbl->GetFontFile(This,fontfile) -#define IDWriteFontResource_GetFontFaceIndex(This) (This)->lpVtbl->GetFontFaceIndex(This) -#define IDWriteFontResource_GetFontAxisCount(This) (This)->lpVtbl->GetFontAxisCount(This) -#define IDWriteFontResource_GetDefaultFontAxisValues(This,values,num_values) (This)->lpVtbl->GetDefaultFontAxisValues(This,values,num_values) -#define IDWriteFontResource_GetFontAxisRanges(This,ranges,num_ranges) (This)->lpVtbl->GetFontAxisRanges(This,ranges,num_ranges) -#define IDWriteFontResource_GetFontAxisAttributes(This,axis) (This)->lpVtbl->GetFontAxisAttributes(This,axis) -#define IDWriteFontResource_GetAxisNames(This,axis,names) (This)->lpVtbl->GetAxisNames(This,axis,names) -#define IDWriteFontResource_GetAxisValueNameCount(This,axis) (This)->lpVtbl->GetAxisValueNameCount(This,axis) -#define IDWriteFontResource_GetAxisValueNames(This,axis,axis_value,axis_range,names) (This)->lpVtbl->GetAxisValueNames(This,axis,axis_value,axis_range,names) -#define IDWriteFontResource_HasVariations(This) (This)->lpVtbl->HasVariations(This) -#define IDWriteFontResource_CreateFontFace(This,simulations,axis_values,num_values,fontface) (This)->lpVtbl->CreateFontFace(This,simulations,axis_values,num_values,fontface) -#define IDWriteFontResource_CreateFontFaceReference(This,simulations,axis_values,num_values,reference) (This)->lpVtbl->CreateFontFaceReference(This,simulations,axis_values,num_values,reference) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontResource_QueryInterface(IDWriteFontResource* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontResource_AddRef(IDWriteFontResource* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontResource_Release(IDWriteFontResource* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontResource methods ***/ -static FORCEINLINE HRESULT IDWriteFontResource_GetFontFile(IDWriteFontResource* This,IDWriteFontFile **fontfile) { - return This->lpVtbl->GetFontFile(This,fontfile); -} -static FORCEINLINE UINT32 IDWriteFontResource_GetFontFaceIndex(IDWriteFontResource* This) { - return This->lpVtbl->GetFontFaceIndex(This); -} -static FORCEINLINE UINT32 IDWriteFontResource_GetFontAxisCount(IDWriteFontResource* This) { - return This->lpVtbl->GetFontAxisCount(This); -} -static FORCEINLINE HRESULT IDWriteFontResource_GetDefaultFontAxisValues(IDWriteFontResource* This,const DWRITE_FONT_AXIS_VALUE *values,UINT32 num_values) { - return This->lpVtbl->GetDefaultFontAxisValues(This,values,num_values); -} -static FORCEINLINE HRESULT IDWriteFontResource_GetFontAxisRanges(IDWriteFontResource* This,const DWRITE_FONT_AXIS_RANGE *ranges,UINT32 num_ranges) { - return This->lpVtbl->GetFontAxisRanges(This,ranges,num_ranges); -} -static FORCEINLINE DWRITE_FONT_AXIS_ATTRIBUTES IDWriteFontResource_GetFontAxisAttributes(IDWriteFontResource* This,UINT32 axis) { - return This->lpVtbl->GetFontAxisAttributes(This,axis); -} -static FORCEINLINE HRESULT IDWriteFontResource_GetAxisNames(IDWriteFontResource* This,UINT32 axis,IDWriteLocalizedStrings **names) { - return This->lpVtbl->GetAxisNames(This,axis,names); -} -static FORCEINLINE UINT32 IDWriteFontResource_GetAxisValueNameCount(IDWriteFontResource* This,UINT32 axis) { - return This->lpVtbl->GetAxisValueNameCount(This,axis); -} -static FORCEINLINE HRESULT IDWriteFontResource_GetAxisValueNames(IDWriteFontResource* This,UINT32 axis,UINT32 axis_value,DWRITE_FONT_AXIS_RANGE *axis_range,IDWriteLocalizedStrings **names) { - return This->lpVtbl->GetAxisValueNames(This,axis,axis_value,axis_range,names); -} -static FORCEINLINE WINBOOL IDWriteFontResource_HasVariations(IDWriteFontResource* This) { - return This->lpVtbl->HasVariations(This); -} -static FORCEINLINE HRESULT IDWriteFontResource_CreateFontFace(IDWriteFontResource* This,DWRITE_FONT_SIMULATIONS simulations,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values,IDWriteFontFace5 **fontface) { - return This->lpVtbl->CreateFontFace(This,simulations,axis_values,num_values,fontface); -} -static FORCEINLINE HRESULT IDWriteFontResource_CreateFontFaceReference(IDWriteFontResource* This,DWRITE_FONT_SIMULATIONS simulations,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values,IDWriteFontFaceReference1 **reference) { - return This->lpVtbl->CreateFontFaceReference(This,simulations,axis_values,num_values,reference); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontResource_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontSet1 interface - */ -#ifndef __IDWriteFontSet1_INTERFACE_DEFINED__ -#define __IDWriteFontSet1_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontSet1, 0x7e9fda85, 0x6c92, 0x4053, 0xbc,0x47, 0x7a,0xe3,0x53,0x0d,0xb4,0xd3); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("7e9fda85-6c92-4053-bc47-7ae3530db4d3") -IDWriteFontSet1 : public IDWriteFontSet -{ - virtual HRESULT STDMETHODCALLTYPE GetMatchingFonts( - const DWRITE_FONT_PROPERTY *property, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontSet1 **fontset) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFirstFontResources( - IDWriteFontSet1 **fontset) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFilteredFonts( - const UINT32 *indices, - UINT32 num_indices, - IDWriteFontSet1 **fontset) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFilteredFonts( - const DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - WINBOOL select_any_range, - IDWriteFontSet1 **fontset) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFilteredFonts( - const DWRITE_FONT_PROPERTY *props, - UINT32 num_properties, - WINBOOL select_any_property, - IDWriteFontSet1 **fontset) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFilteredFontIndices( - const DWRITE_FONT_AXIS_RANGE *ranges, - UINT32 num_ranges, - WINBOOL select_any_range, - UINT32 *indices, - UINT32 num_indices, - UINT32 *actual_num_indices) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFilteredFontIndices( - const DWRITE_FONT_PROPERTY *props, - UINT32 num_properties, - WINBOOL select_any_range, - UINT32 *indices, - UINT32 num_indices, - UINT32 *actual_num_indices) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontAxisRanges( - UINT32 font_index, - DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - UINT32 *actual_num_ranges) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontAxisRanges( - DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - UINT32 *actual_num_ranges) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontFaceReference( - UINT32 index, - IDWriteFontFaceReference1 **reference) = 0; - - using IDWriteFontSet::GetFontFaceReference; - - virtual HRESULT STDMETHODCALLTYPE CreateFontResource( - UINT32 index, - IDWriteFontResource **resource) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateFontFace( - UINT32 index, - IDWriteFontFace5 **fontface) = 0; - - virtual DWRITE_LOCALITY STDMETHODCALLTYPE GetFontLocality( - UINT32 index) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontSet1, 0x7e9fda85, 0x6c92, 0x4053, 0xbc,0x47, 0x7a,0xe3,0x53,0x0d,0xb4,0xd3) -#endif -#else -typedef struct IDWriteFontSet1Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontSet1 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontSet1 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontSet1 *This); - - /*** IDWriteFontSet methods ***/ - UINT32 (STDMETHODCALLTYPE *GetFontCount)( - IDWriteFontSet1 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFaceReference)( - IDWriteFontSet1 *This, - UINT32 index, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *FindFontFaceReference)( - IDWriteFontSet1 *This, - IDWriteFontFaceReference *reference, - UINT32 *index, - WINBOOL *exists); - - HRESULT (STDMETHODCALLTYPE *FindFontFace)( - IDWriteFontSet1 *This, - IDWriteFontFace *fontface, - UINT32 *index, - WINBOOL *exists); - - HRESULT (STDMETHODCALLTYPE *GetPropertyValues__)( - IDWriteFontSet1 *This, - DWRITE_FONT_PROPERTY_ID id, - IDWriteStringList **values); - - HRESULT (STDMETHODCALLTYPE *GetPropertyValues_)( - IDWriteFontSet1 *This, - DWRITE_FONT_PROPERTY_ID id, - const WCHAR *preferred_locales, - IDWriteStringList **values); - - HRESULT (STDMETHODCALLTYPE *GetPropertyValues)( - IDWriteFontSet1 *This, - UINT32 index, - DWRITE_FONT_PROPERTY_ID id, - WINBOOL *exists, - IDWriteLocalizedStrings **values); - - HRESULT (STDMETHODCALLTYPE *GetPropertyOccurrenceCount)( - IDWriteFontSet1 *This, - const DWRITE_FONT_PROPERTY *property, - UINT32 *count); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFonts_)( - IDWriteFontSet1 *This, - const WCHAR *family, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, - DWRITE_FONT_STYLE style, - IDWriteFontSet **fontset); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFonts)( - IDWriteFontSet1 *This, - const DWRITE_FONT_PROPERTY *props, - UINT32 count, - IDWriteFontSet **fontset); - - /*** IDWriteFontSet1 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFontSet1_GetMatchingFonts)( - IDWriteFontSet1 *This, - const DWRITE_FONT_PROPERTY *property, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFirstFontResources)( - IDWriteFontSet1 *This, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFonts__)( - IDWriteFontSet1 *This, - const UINT32 *indices, - UINT32 num_indices, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFonts_)( - IDWriteFontSet1 *This, - const DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - WINBOOL select_any_range, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFonts)( - IDWriteFontSet1 *This, - const DWRITE_FONT_PROPERTY *props, - UINT32 num_properties, - WINBOOL select_any_property, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFontIndices_)( - IDWriteFontSet1 *This, - const DWRITE_FONT_AXIS_RANGE *ranges, - UINT32 num_ranges, - WINBOOL select_any_range, - UINT32 *indices, - UINT32 num_indices, - UINT32 *actual_num_indices); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFontIndices)( - IDWriteFontSet1 *This, - const DWRITE_FONT_PROPERTY *props, - UINT32 num_properties, - WINBOOL select_any_range, - UINT32 *indices, - UINT32 num_indices, - UINT32 *actual_num_indices); - - HRESULT (STDMETHODCALLTYPE *GetFontAxisRanges_)( - IDWriteFontSet1 *This, - UINT32 font_index, - DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - UINT32 *actual_num_ranges); - - HRESULT (STDMETHODCALLTYPE *GetFontAxisRanges)( - IDWriteFontSet1 *This, - DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - UINT32 *actual_num_ranges); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontSet1_GetFontFaceReference)( - IDWriteFontSet1 *This, - UINT32 index, - IDWriteFontFaceReference1 **reference); - - HRESULT (STDMETHODCALLTYPE *CreateFontResource)( - IDWriteFontSet1 *This, - UINT32 index, - IDWriteFontResource **resource); - - HRESULT (STDMETHODCALLTYPE *CreateFontFace)( - IDWriteFontSet1 *This, - UINT32 index, - IDWriteFontFace5 **fontface); - - DWRITE_LOCALITY (STDMETHODCALLTYPE *GetFontLocality)( - IDWriteFontSet1 *This, - UINT32 index); - - END_INTERFACE -} IDWriteFontSet1Vtbl; - -interface IDWriteFontSet1 { - CONST_VTBL IDWriteFontSet1Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontSet1_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontSet1_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontSet1_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontSet methods ***/ -#define IDWriteFontSet1_GetFontCount(This) (This)->lpVtbl->GetFontCount(This) -#define IDWriteFontSet1_FindFontFaceReference(This,reference,index,exists) (This)->lpVtbl->FindFontFaceReference(This,reference,index,exists) -#define IDWriteFontSet1_FindFontFace(This,fontface,index,exists) (This)->lpVtbl->FindFontFace(This,fontface,index,exists) -#define IDWriteFontSet1_GetPropertyValues__(This,id,values) (This)->lpVtbl->GetPropertyValues__(This,id,values) -#define IDWriteFontSet1_GetPropertyValues_(This,id,preferred_locales,values) (This)->lpVtbl->GetPropertyValues_(This,id,preferred_locales,values) -#define IDWriteFontSet1_GetPropertyValues(This,index,id,exists,values) (This)->lpVtbl->GetPropertyValues(This,index,id,exists,values) -#define IDWriteFontSet1_GetPropertyOccurrenceCount(This,property,count) (This)->lpVtbl->GetPropertyOccurrenceCount(This,property,count) -#define IDWriteFontSet1_GetMatchingFonts_(This,family,weight,stretch,style,fontset) (This)->lpVtbl->GetMatchingFonts_(This,family,weight,stretch,style,fontset) -/*** IDWriteFontSet1 methods ***/ -#define IDWriteFontSet1_GetMatchingFonts(This,property,axis_values,num_values,fontset) (This)->lpVtbl->IDWriteFontSet1_GetMatchingFonts(This,property,axis_values,num_values,fontset) -#define IDWriteFontSet1_GetFirstFontResources(This,fontset) (This)->lpVtbl->GetFirstFontResources(This,fontset) -#define IDWriteFontSet1_GetFilteredFonts__(This,indices,num_indices,fontset) (This)->lpVtbl->GetFilteredFonts__(This,indices,num_indices,fontset) -#define IDWriteFontSet1_GetFilteredFonts_(This,axis_ranges,num_ranges,select_any_range,fontset) (This)->lpVtbl->GetFilteredFonts_(This,axis_ranges,num_ranges,select_any_range,fontset) -#define IDWriteFontSet1_GetFilteredFonts(This,props,num_properties,select_any_property,fontset) (This)->lpVtbl->GetFilteredFonts(This,props,num_properties,select_any_property,fontset) -#define IDWriteFontSet1_GetFilteredFontIndices_(This,ranges,num_ranges,select_any_range,indices,num_indices,actual_num_indices) (This)->lpVtbl->GetFilteredFontIndices_(This,ranges,num_ranges,select_any_range,indices,num_indices,actual_num_indices) -#define IDWriteFontSet1_GetFilteredFontIndices(This,props,num_properties,select_any_range,indices,num_indices,actual_num_indices) (This)->lpVtbl->GetFilteredFontIndices(This,props,num_properties,select_any_range,indices,num_indices,actual_num_indices) -#define IDWriteFontSet1_GetFontAxisRanges_(This,font_index,axis_ranges,num_ranges,actual_num_ranges) (This)->lpVtbl->GetFontAxisRanges_(This,font_index,axis_ranges,num_ranges,actual_num_ranges) -#define IDWriteFontSet1_GetFontAxisRanges(This,axis_ranges,num_ranges,actual_num_ranges) (This)->lpVtbl->GetFontAxisRanges(This,axis_ranges,num_ranges,actual_num_ranges) -#define IDWriteFontSet1_GetFontFaceReference(This,index,reference) (This)->lpVtbl->IDWriteFontSet1_GetFontFaceReference(This,index,reference) -#define IDWriteFontSet1_CreateFontResource(This,index,resource) (This)->lpVtbl->CreateFontResource(This,index,resource) -#define IDWriteFontSet1_CreateFontFace(This,index,fontface) (This)->lpVtbl->CreateFontFace(This,index,fontface) -#define IDWriteFontSet1_GetFontLocality(This,index) (This)->lpVtbl->GetFontLocality(This,index) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontSet1_QueryInterface(IDWriteFontSet1* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontSet1_AddRef(IDWriteFontSet1* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontSet1_Release(IDWriteFontSet1* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontSet methods ***/ -static FORCEINLINE UINT32 IDWriteFontSet1_GetFontCount(IDWriteFontSet1* This) { - return This->lpVtbl->GetFontCount(This); -} -static FORCEINLINE HRESULT IDWriteFontSet1_FindFontFaceReference(IDWriteFontSet1* This,IDWriteFontFaceReference *reference,UINT32 *index,WINBOOL *exists) { - return This->lpVtbl->FindFontFaceReference(This,reference,index,exists); -} -static FORCEINLINE HRESULT IDWriteFontSet1_FindFontFace(IDWriteFontSet1* This,IDWriteFontFace *fontface,UINT32 *index,WINBOOL *exists) { - return This->lpVtbl->FindFontFace(This,fontface,index,exists); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetPropertyValues__(IDWriteFontSet1* This,DWRITE_FONT_PROPERTY_ID id,IDWriteStringList **values) { - return This->lpVtbl->GetPropertyValues__(This,id,values); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetPropertyValues_(IDWriteFontSet1* This,DWRITE_FONT_PROPERTY_ID id,const WCHAR *preferred_locales,IDWriteStringList **values) { - return This->lpVtbl->GetPropertyValues_(This,id,preferred_locales,values); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetPropertyValues(IDWriteFontSet1* This,UINT32 index,DWRITE_FONT_PROPERTY_ID id,WINBOOL *exists,IDWriteLocalizedStrings **values) { - return This->lpVtbl->GetPropertyValues(This,index,id,exists,values); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetPropertyOccurrenceCount(IDWriteFontSet1* This,const DWRITE_FONT_PROPERTY *property,UINT32 *count) { - return This->lpVtbl->GetPropertyOccurrenceCount(This,property,count); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetMatchingFonts_(IDWriteFontSet1* This,const WCHAR *family,DWRITE_FONT_WEIGHT weight,DWRITE_FONT_STRETCH stretch,DWRITE_FONT_STYLE style,IDWriteFontSet **fontset) { - return This->lpVtbl->GetMatchingFonts_(This,family,weight,stretch,style,fontset); -} -/*** IDWriteFontSet1 methods ***/ -static FORCEINLINE HRESULT IDWriteFontSet1_GetMatchingFonts(IDWriteFontSet1* This,const DWRITE_FONT_PROPERTY *property,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values,IDWriteFontSet1 **fontset) { - return This->lpVtbl->IDWriteFontSet1_GetMatchingFonts(This,property,axis_values,num_values,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetFirstFontResources(IDWriteFontSet1* This,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFirstFontResources(This,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetFilteredFonts__(IDWriteFontSet1* This,const UINT32 *indices,UINT32 num_indices,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFilteredFonts__(This,indices,num_indices,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetFilteredFonts_(IDWriteFontSet1* This,const DWRITE_FONT_AXIS_RANGE *axis_ranges,UINT32 num_ranges,WINBOOL select_any_range,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFilteredFonts_(This,axis_ranges,num_ranges,select_any_range,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetFilteredFonts(IDWriteFontSet1* This,const DWRITE_FONT_PROPERTY *props,UINT32 num_properties,WINBOOL select_any_property,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFilteredFonts(This,props,num_properties,select_any_property,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetFilteredFontIndices_(IDWriteFontSet1* This,const DWRITE_FONT_AXIS_RANGE *ranges,UINT32 num_ranges,WINBOOL select_any_range,UINT32 *indices,UINT32 num_indices,UINT32 *actual_num_indices) { - return This->lpVtbl->GetFilteredFontIndices_(This,ranges,num_ranges,select_any_range,indices,num_indices,actual_num_indices); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetFilteredFontIndices(IDWriteFontSet1* This,const DWRITE_FONT_PROPERTY *props,UINT32 num_properties,WINBOOL select_any_range,UINT32 *indices,UINT32 num_indices,UINT32 *actual_num_indices) { - return This->lpVtbl->GetFilteredFontIndices(This,props,num_properties,select_any_range,indices,num_indices,actual_num_indices); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetFontAxisRanges_(IDWriteFontSet1* This,UINT32 font_index,DWRITE_FONT_AXIS_RANGE *axis_ranges,UINT32 num_ranges,UINT32 *actual_num_ranges) { - return This->lpVtbl->GetFontAxisRanges_(This,font_index,axis_ranges,num_ranges,actual_num_ranges); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetFontAxisRanges(IDWriteFontSet1* This,DWRITE_FONT_AXIS_RANGE *axis_ranges,UINT32 num_ranges,UINT32 *actual_num_ranges) { - return This->lpVtbl->GetFontAxisRanges(This,axis_ranges,num_ranges,actual_num_ranges); -} -static FORCEINLINE HRESULT IDWriteFontSet1_GetFontFaceReference(IDWriteFontSet1* This,UINT32 index,IDWriteFontFaceReference1 **reference) { - return This->lpVtbl->IDWriteFontSet1_GetFontFaceReference(This,index,reference); -} -static FORCEINLINE HRESULT IDWriteFontSet1_CreateFontResource(IDWriteFontSet1* This,UINT32 index,IDWriteFontResource **resource) { - return This->lpVtbl->CreateFontResource(This,index,resource); -} -static FORCEINLINE HRESULT IDWriteFontSet1_CreateFontFace(IDWriteFontSet1* This,UINT32 index,IDWriteFontFace5 **fontface) { - return This->lpVtbl->CreateFontFace(This,index,fontface); -} -static FORCEINLINE DWRITE_LOCALITY IDWriteFontSet1_GetFontLocality(IDWriteFontSet1* This,UINT32 index) { - return This->lpVtbl->GetFontLocality(This,index); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontSet1_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFont3 interface - */ -#ifndef __IDWriteFont3_INTERFACE_DEFINED__ -#define __IDWriteFont3_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFont3, 0x29748ed6, 0x8c9c, 0x4a6a, 0xbe,0x0b, 0xd9,0x12,0xe8,0x53,0x89,0x44); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("29748ed6-8c9c-4a6a-be0b-d912e8538944") -IDWriteFont3 : public IDWriteFont2 -{ - virtual HRESULT STDMETHODCALLTYPE CreateFontFace( - IDWriteFontFace3 **fontface) = 0; - - using IDWriteFont::CreateFontFace; - - virtual WINBOOL STDMETHODCALLTYPE Equals( - IDWriteFont *font) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontFaceReference( - IDWriteFontFaceReference **reference) = 0; - - virtual WINBOOL STDMETHODCALLTYPE HasCharacter( - UINT32 character) = 0; - - using IDWriteFont::HasCharacter; - - virtual DWRITE_LOCALITY STDMETHODCALLTYPE GetLocality( - ) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFont3, 0x29748ed6, 0x8c9c, 0x4a6a, 0xbe,0x0b, 0xd9,0x12,0xe8,0x53,0x89,0x44) -#endif -#else -typedef struct IDWriteFont3Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFont3 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFont3 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFont3 *This); - - /*** IDWriteFont methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontFamily)( - IDWriteFont3 *This, - IDWriteFontFamily **family); - - DWRITE_FONT_WEIGHT (STDMETHODCALLTYPE *GetWeight)( - IDWriteFont3 *This); - - DWRITE_FONT_STRETCH (STDMETHODCALLTYPE *GetStretch)( - IDWriteFont3 *This); - - DWRITE_FONT_STYLE (STDMETHODCALLTYPE *GetStyle)( - IDWriteFont3 *This); - - WINBOOL (STDMETHODCALLTYPE *IsSymbolFont)( - IDWriteFont3 *This); - - HRESULT (STDMETHODCALLTYPE *GetFaceNames)( - IDWriteFont3 *This, - IDWriteLocalizedStrings **names); - - HRESULT (STDMETHODCALLTYPE *GetInformationalStrings)( - IDWriteFont3 *This, - DWRITE_INFORMATIONAL_STRING_ID stringid, - IDWriteLocalizedStrings **strings, - WINBOOL *exists); - - DWRITE_FONT_SIMULATIONS (STDMETHODCALLTYPE *GetSimulations)( - IDWriteFont3 *This); - - void (STDMETHODCALLTYPE *GetMetrics)( - IDWriteFont3 *This, - DWRITE_FONT_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *HasCharacter)( - IDWriteFont3 *This, - UINT32 value, - WINBOOL *exists); - - HRESULT (STDMETHODCALLTYPE *CreateFontFace)( - IDWriteFont3 *This, - IDWriteFontFace **face); - - /*** IDWriteFont1 methods ***/ - void (STDMETHODCALLTYPE *IDWriteFont1_GetMetrics)( - IDWriteFont3 *This, - DWRITE_FONT_METRICS1 *metrics); - - void (STDMETHODCALLTYPE *GetPanose)( - IDWriteFont3 *This, - DWRITE_PANOSE *panose); - - HRESULT (STDMETHODCALLTYPE *GetUnicodeRanges)( - IDWriteFont3 *This, - UINT32 max_count, - DWRITE_UNICODE_RANGE *ranges, - UINT32 *count); - - WINBOOL (STDMETHODCALLTYPE *IsMonospacedFont)( - IDWriteFont3 *This); - - /*** IDWriteFont2 methods ***/ - WINBOOL (STDMETHODCALLTYPE *IsColorFont)( - IDWriteFont3 *This); - - /*** IDWriteFont3 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFont3_CreateFontFace)( - IDWriteFont3 *This, - IDWriteFontFace3 **fontface); - - WINBOOL (STDMETHODCALLTYPE *Equals)( - IDWriteFont3 *This, - IDWriteFont *font); - - HRESULT (STDMETHODCALLTYPE *GetFontFaceReference)( - IDWriteFont3 *This, - IDWriteFontFaceReference **reference); - - WINBOOL (STDMETHODCALLTYPE *IDWriteFont3_HasCharacter)( - IDWriteFont3 *This, - UINT32 character); - - DWRITE_LOCALITY (STDMETHODCALLTYPE *GetLocality)( - IDWriteFont3 *This); - - END_INTERFACE -} IDWriteFont3Vtbl; - -interface IDWriteFont3 { - CONST_VTBL IDWriteFont3Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFont3_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFont3_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFont3_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFont methods ***/ -#define IDWriteFont3_GetFontFamily(This,family) (This)->lpVtbl->GetFontFamily(This,family) -#define IDWriteFont3_GetWeight(This) (This)->lpVtbl->GetWeight(This) -#define IDWriteFont3_GetStretch(This) (This)->lpVtbl->GetStretch(This) -#define IDWriteFont3_GetStyle(This) (This)->lpVtbl->GetStyle(This) -#define IDWriteFont3_IsSymbolFont(This) (This)->lpVtbl->IsSymbolFont(This) -#define IDWriteFont3_GetFaceNames(This,names) (This)->lpVtbl->GetFaceNames(This,names) -#define IDWriteFont3_GetInformationalStrings(This,stringid,strings,exists) (This)->lpVtbl->GetInformationalStrings(This,stringid,strings,exists) -#define IDWriteFont3_GetSimulations(This) (This)->lpVtbl->GetSimulations(This) -/*** IDWriteFont1 methods ***/ -#define IDWriteFont3_GetMetrics(This,metrics) (This)->lpVtbl->IDWriteFont1_GetMetrics(This,metrics) -#define IDWriteFont3_GetPanose(This,panose) (This)->lpVtbl->GetPanose(This,panose) -#define IDWriteFont3_GetUnicodeRanges(This,max_count,ranges,count) (This)->lpVtbl->GetUnicodeRanges(This,max_count,ranges,count) -#define IDWriteFont3_IsMonospacedFont(This) (This)->lpVtbl->IsMonospacedFont(This) -/*** IDWriteFont2 methods ***/ -#define IDWriteFont3_IsColorFont(This) (This)->lpVtbl->IsColorFont(This) -/*** IDWriteFont3 methods ***/ -#define IDWriteFont3_CreateFontFace(This,fontface) (This)->lpVtbl->IDWriteFont3_CreateFontFace(This,fontface) -#define IDWriteFont3_Equals(This,font) (This)->lpVtbl->Equals(This,font) -#define IDWriteFont3_GetFontFaceReference(This,reference) (This)->lpVtbl->GetFontFaceReference(This,reference) -#define IDWriteFont3_HasCharacter(This,character) (This)->lpVtbl->IDWriteFont3_HasCharacter(This,character) -#define IDWriteFont3_GetLocality(This) (This)->lpVtbl->GetLocality(This) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFont3_QueryInterface(IDWriteFont3* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFont3_AddRef(IDWriteFont3* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFont3_Release(IDWriteFont3* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFont methods ***/ -static FORCEINLINE HRESULT IDWriteFont3_GetFontFamily(IDWriteFont3* This,IDWriteFontFamily **family) { - return This->lpVtbl->GetFontFamily(This,family); -} -static FORCEINLINE DWRITE_FONT_WEIGHT IDWriteFont3_GetWeight(IDWriteFont3* This) { - return This->lpVtbl->GetWeight(This); -} -static FORCEINLINE DWRITE_FONT_STRETCH IDWriteFont3_GetStretch(IDWriteFont3* This) { - return This->lpVtbl->GetStretch(This); -} -static FORCEINLINE DWRITE_FONT_STYLE IDWriteFont3_GetStyle(IDWriteFont3* This) { - return This->lpVtbl->GetStyle(This); -} -static FORCEINLINE WINBOOL IDWriteFont3_IsSymbolFont(IDWriteFont3* This) { - return This->lpVtbl->IsSymbolFont(This); -} -static FORCEINLINE HRESULT IDWriteFont3_GetFaceNames(IDWriteFont3* This,IDWriteLocalizedStrings **names) { - return This->lpVtbl->GetFaceNames(This,names); -} -static FORCEINLINE HRESULT IDWriteFont3_GetInformationalStrings(IDWriteFont3* This,DWRITE_INFORMATIONAL_STRING_ID stringid,IDWriteLocalizedStrings **strings,WINBOOL *exists) { - return This->lpVtbl->GetInformationalStrings(This,stringid,strings,exists); -} -static FORCEINLINE DWRITE_FONT_SIMULATIONS IDWriteFont3_GetSimulations(IDWriteFont3* This) { - return This->lpVtbl->GetSimulations(This); -} -/*** IDWriteFont1 methods ***/ -static FORCEINLINE void IDWriteFont3_GetMetrics(IDWriteFont3* This,DWRITE_FONT_METRICS1 *metrics) { - This->lpVtbl->IDWriteFont1_GetMetrics(This,metrics); -} -static FORCEINLINE void IDWriteFont3_GetPanose(IDWriteFont3* This,DWRITE_PANOSE *panose) { - This->lpVtbl->GetPanose(This,panose); -} -static FORCEINLINE HRESULT IDWriteFont3_GetUnicodeRanges(IDWriteFont3* This,UINT32 max_count,DWRITE_UNICODE_RANGE *ranges,UINT32 *count) { - return This->lpVtbl->GetUnicodeRanges(This,max_count,ranges,count); -} -static FORCEINLINE WINBOOL IDWriteFont3_IsMonospacedFont(IDWriteFont3* This) { - return This->lpVtbl->IsMonospacedFont(This); -} -/*** IDWriteFont2 methods ***/ -static FORCEINLINE WINBOOL IDWriteFont3_IsColorFont(IDWriteFont3* This) { - return This->lpVtbl->IsColorFont(This); -} -/*** IDWriteFont3 methods ***/ -static FORCEINLINE HRESULT IDWriteFont3_CreateFontFace(IDWriteFont3* This,IDWriteFontFace3 **fontface) { - return This->lpVtbl->IDWriteFont3_CreateFontFace(This,fontface); -} -static FORCEINLINE WINBOOL IDWriteFont3_Equals(IDWriteFont3* This,IDWriteFont *font) { - return This->lpVtbl->Equals(This,font); -} -static FORCEINLINE HRESULT IDWriteFont3_GetFontFaceReference(IDWriteFont3* This,IDWriteFontFaceReference **reference) { - return This->lpVtbl->GetFontFaceReference(This,reference); -} -static FORCEINLINE WINBOOL IDWriteFont3_HasCharacter(IDWriteFont3* This,UINT32 character) { - return This->lpVtbl->IDWriteFont3_HasCharacter(This,character); -} -static FORCEINLINE DWRITE_LOCALITY IDWriteFont3_GetLocality(IDWriteFont3* This) { - return This->lpVtbl->GetLocality(This); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFont3_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontFamily1 interface - */ -#ifndef __IDWriteFontFamily1_INTERFACE_DEFINED__ -#define __IDWriteFontFamily1_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontFamily1, 0xda20d8ef, 0x812a, 0x4c43, 0x98,0x02, 0x62,0xec,0x4a,0xbd,0x7a,0xdf); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("da20d8ef-812a-4c43-9802-62ec4abd7adf") -IDWriteFontFamily1 : public IDWriteFontFamily -{ - virtual DWRITE_LOCALITY STDMETHODCALLTYPE GetFontLocality( - UINT32 index) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFont( - UINT32 index, - IDWriteFont3 **font) = 0; - - using IDWriteFontFamily::GetFont; - - virtual HRESULT STDMETHODCALLTYPE GetFontFaceReference( - UINT32 index, - IDWriteFontFaceReference **reference) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontFamily1, 0xda20d8ef, 0x812a, 0x4c43, 0x98,0x02, 0x62,0xec,0x4a,0xbd,0x7a,0xdf) -#endif -#else -typedef struct IDWriteFontFamily1Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontFamily1 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontFamily1 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontFamily1 *This); - - /*** IDWriteFontList methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontCollection)( - IDWriteFontFamily1 *This, - IDWriteFontCollection **collection); - - UINT32 (STDMETHODCALLTYPE *GetFontCount)( - IDWriteFontFamily1 *This); - - HRESULT (STDMETHODCALLTYPE *GetFont)( - IDWriteFontFamily1 *This, - UINT32 index, - IDWriteFont **font); - - /*** IDWriteFontFamily methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFamilyNames)( - IDWriteFontFamily1 *This, - IDWriteLocalizedStrings **names); - - HRESULT (STDMETHODCALLTYPE *GetFirstMatchingFont)( - IDWriteFontFamily1 *This, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, - DWRITE_FONT_STYLE style, - IDWriteFont **font); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFonts)( - IDWriteFontFamily1 *This, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, - DWRITE_FONT_STYLE style, - IDWriteFontList **fonts); - - /*** IDWriteFontFamily1 methods ***/ - DWRITE_LOCALITY (STDMETHODCALLTYPE *GetFontLocality)( - IDWriteFontFamily1 *This, - UINT32 index); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFamily1_GetFont)( - IDWriteFontFamily1 *This, - UINT32 index, - IDWriteFont3 **font); - - HRESULT (STDMETHODCALLTYPE *GetFontFaceReference)( - IDWriteFontFamily1 *This, - UINT32 index, - IDWriteFontFaceReference **reference); - - END_INTERFACE -} IDWriteFontFamily1Vtbl; - -interface IDWriteFontFamily1 { - CONST_VTBL IDWriteFontFamily1Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontFamily1_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontFamily1_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontFamily1_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontList methods ***/ -#define IDWriteFontFamily1_GetFontCollection(This,collection) (This)->lpVtbl->GetFontCollection(This,collection) -#define IDWriteFontFamily1_GetFontCount(This) (This)->lpVtbl->GetFontCount(This) -/*** IDWriteFontFamily methods ***/ -#define IDWriteFontFamily1_GetFamilyNames(This,names) (This)->lpVtbl->GetFamilyNames(This,names) -#define IDWriteFontFamily1_GetFirstMatchingFont(This,weight,stretch,style,font) (This)->lpVtbl->GetFirstMatchingFont(This,weight,stretch,style,font) -#define IDWriteFontFamily1_GetMatchingFonts(This,weight,stretch,style,fonts) (This)->lpVtbl->GetMatchingFonts(This,weight,stretch,style,fonts) -/*** IDWriteFontFamily1 methods ***/ -#define IDWriteFontFamily1_GetFontLocality(This,index) (This)->lpVtbl->GetFontLocality(This,index) -#define IDWriteFontFamily1_GetFont(This,index,font) (This)->lpVtbl->IDWriteFontFamily1_GetFont(This,index,font) -#define IDWriteFontFamily1_GetFontFaceReference(This,index,reference) (This)->lpVtbl->GetFontFaceReference(This,index,reference) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontFamily1_QueryInterface(IDWriteFontFamily1* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontFamily1_AddRef(IDWriteFontFamily1* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontFamily1_Release(IDWriteFontFamily1* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontList methods ***/ -static FORCEINLINE HRESULT IDWriteFontFamily1_GetFontCollection(IDWriteFontFamily1* This,IDWriteFontCollection **collection) { - return This->lpVtbl->GetFontCollection(This,collection); -} -static FORCEINLINE UINT32 IDWriteFontFamily1_GetFontCount(IDWriteFontFamily1* This) { - return This->lpVtbl->GetFontCount(This); -} -/*** IDWriteFontFamily methods ***/ -static FORCEINLINE HRESULT IDWriteFontFamily1_GetFamilyNames(IDWriteFontFamily1* This,IDWriteLocalizedStrings **names) { - return This->lpVtbl->GetFamilyNames(This,names); -} -static FORCEINLINE HRESULT IDWriteFontFamily1_GetFirstMatchingFont(IDWriteFontFamily1* This,DWRITE_FONT_WEIGHT weight,DWRITE_FONT_STRETCH stretch,DWRITE_FONT_STYLE style,IDWriteFont **font) { - return This->lpVtbl->GetFirstMatchingFont(This,weight,stretch,style,font); -} -static FORCEINLINE HRESULT IDWriteFontFamily1_GetMatchingFonts(IDWriteFontFamily1* This,DWRITE_FONT_WEIGHT weight,DWRITE_FONT_STRETCH stretch,DWRITE_FONT_STYLE style,IDWriteFontList **fonts) { - return This->lpVtbl->GetMatchingFonts(This,weight,stretch,style,fonts); -} -/*** IDWriteFontFamily1 methods ***/ -static FORCEINLINE DWRITE_LOCALITY IDWriteFontFamily1_GetFontLocality(IDWriteFontFamily1* This,UINT32 index) { - return This->lpVtbl->GetFontLocality(This,index); -} -static FORCEINLINE HRESULT IDWriteFontFamily1_GetFont(IDWriteFontFamily1* This,UINT32 index,IDWriteFont3 **font) { - return This->lpVtbl->IDWriteFontFamily1_GetFont(This,index,font); -} -static FORCEINLINE HRESULT IDWriteFontFamily1_GetFontFaceReference(IDWriteFontFamily1* This,UINT32 index,IDWriteFontFaceReference **reference) { - return This->lpVtbl->GetFontFaceReference(This,index,reference); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontFamily1_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontFamily2 interface - */ -#ifndef __IDWriteFontFamily2_INTERFACE_DEFINED__ -#define __IDWriteFontFamily2_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontFamily2, 0x3ed49e77, 0xa398, 0x4261, 0xb9,0xcf, 0xc1,0x26,0xc2,0x13,0x1e,0xf3); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("3ed49e77-a398-4261-b9cf-c126c2131ef3") -IDWriteFontFamily2 : public IDWriteFontFamily1 -{ - virtual HRESULT STDMETHODCALLTYPE GetMatchingFonts( - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontList2 **fontlist) = 0; - - using IDWriteFontFamily::GetMatchingFonts; - - virtual HRESULT STDMETHODCALLTYPE GetFontSet( - IDWriteFontSet1 **fontset) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontFamily2, 0x3ed49e77, 0xa398, 0x4261, 0xb9,0xcf, 0xc1,0x26,0xc2,0x13,0x1e,0xf3) -#endif -#else -typedef struct IDWriteFontFamily2Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontFamily2 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontFamily2 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontFamily2 *This); - - /*** IDWriteFontList methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontCollection)( - IDWriteFontFamily2 *This, - IDWriteFontCollection **collection); - - UINT32 (STDMETHODCALLTYPE *GetFontCount)( - IDWriteFontFamily2 *This); - - HRESULT (STDMETHODCALLTYPE *GetFont)( - IDWriteFontFamily2 *This, - UINT32 index, - IDWriteFont **font); - - /*** IDWriteFontFamily methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFamilyNames)( - IDWriteFontFamily2 *This, - IDWriteLocalizedStrings **names); - - HRESULT (STDMETHODCALLTYPE *GetFirstMatchingFont)( - IDWriteFontFamily2 *This, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, - DWRITE_FONT_STYLE style, - IDWriteFont **font); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFonts)( - IDWriteFontFamily2 *This, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, - DWRITE_FONT_STYLE style, - IDWriteFontList **fonts); - - /*** IDWriteFontFamily1 methods ***/ - DWRITE_LOCALITY (STDMETHODCALLTYPE *GetFontLocality)( - IDWriteFontFamily2 *This, - UINT32 index); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFamily1_GetFont)( - IDWriteFontFamily2 *This, - UINT32 index, - IDWriteFont3 **font); - - HRESULT (STDMETHODCALLTYPE *GetFontFaceReference)( - IDWriteFontFamily2 *This, - UINT32 index, - IDWriteFontFaceReference **reference); - - /*** IDWriteFontFamily2 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFontFamily2_GetMatchingFonts)( - IDWriteFontFamily2 *This, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontList2 **fontlist); - - HRESULT (STDMETHODCALLTYPE *GetFontSet)( - IDWriteFontFamily2 *This, - IDWriteFontSet1 **fontset); - - END_INTERFACE -} IDWriteFontFamily2Vtbl; - -interface IDWriteFontFamily2 { - CONST_VTBL IDWriteFontFamily2Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontFamily2_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontFamily2_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontFamily2_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontList methods ***/ -#define IDWriteFontFamily2_GetFontCollection(This,collection) (This)->lpVtbl->GetFontCollection(This,collection) -#define IDWriteFontFamily2_GetFontCount(This) (This)->lpVtbl->GetFontCount(This) -/*** IDWriteFontFamily methods ***/ -#define IDWriteFontFamily2_GetFamilyNames(This,names) (This)->lpVtbl->GetFamilyNames(This,names) -#define IDWriteFontFamily2_GetFirstMatchingFont(This,weight,stretch,style,font) (This)->lpVtbl->GetFirstMatchingFont(This,weight,stretch,style,font) -/*** IDWriteFontFamily1 methods ***/ -#define IDWriteFontFamily2_GetFontLocality(This,index) (This)->lpVtbl->GetFontLocality(This,index) -#define IDWriteFontFamily2_GetFont(This,index,font) (This)->lpVtbl->IDWriteFontFamily1_GetFont(This,index,font) -#define IDWriteFontFamily2_GetFontFaceReference(This,index,reference) (This)->lpVtbl->GetFontFaceReference(This,index,reference) -/*** IDWriteFontFamily2 methods ***/ -#define IDWriteFontFamily2_GetMatchingFonts(This,axis_values,num_values,fontlist) (This)->lpVtbl->IDWriteFontFamily2_GetMatchingFonts(This,axis_values,num_values,fontlist) -#define IDWriteFontFamily2_GetFontSet(This,fontset) (This)->lpVtbl->GetFontSet(This,fontset) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontFamily2_QueryInterface(IDWriteFontFamily2* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontFamily2_AddRef(IDWriteFontFamily2* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontFamily2_Release(IDWriteFontFamily2* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontList methods ***/ -static FORCEINLINE HRESULT IDWriteFontFamily2_GetFontCollection(IDWriteFontFamily2* This,IDWriteFontCollection **collection) { - return This->lpVtbl->GetFontCollection(This,collection); -} -static FORCEINLINE UINT32 IDWriteFontFamily2_GetFontCount(IDWriteFontFamily2* This) { - return This->lpVtbl->GetFontCount(This); -} -/*** IDWriteFontFamily methods ***/ -static FORCEINLINE HRESULT IDWriteFontFamily2_GetFamilyNames(IDWriteFontFamily2* This,IDWriteLocalizedStrings **names) { - return This->lpVtbl->GetFamilyNames(This,names); -} -static FORCEINLINE HRESULT IDWriteFontFamily2_GetFirstMatchingFont(IDWriteFontFamily2* This,DWRITE_FONT_WEIGHT weight,DWRITE_FONT_STRETCH stretch,DWRITE_FONT_STYLE style,IDWriteFont **font) { - return This->lpVtbl->GetFirstMatchingFont(This,weight,stretch,style,font); -} -/*** IDWriteFontFamily1 methods ***/ -static FORCEINLINE DWRITE_LOCALITY IDWriteFontFamily2_GetFontLocality(IDWriteFontFamily2* This,UINT32 index) { - return This->lpVtbl->GetFontLocality(This,index); -} -static FORCEINLINE HRESULT IDWriteFontFamily2_GetFont(IDWriteFontFamily2* This,UINT32 index,IDWriteFont3 **font) { - return This->lpVtbl->IDWriteFontFamily1_GetFont(This,index,font); -} -static FORCEINLINE HRESULT IDWriteFontFamily2_GetFontFaceReference(IDWriteFontFamily2* This,UINT32 index,IDWriteFontFaceReference **reference) { - return This->lpVtbl->GetFontFaceReference(This,index,reference); -} -/*** IDWriteFontFamily2 methods ***/ -static FORCEINLINE HRESULT IDWriteFontFamily2_GetMatchingFonts(IDWriteFontFamily2* This,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values,IDWriteFontList2 **fontlist) { - return This->lpVtbl->IDWriteFontFamily2_GetMatchingFonts(This,axis_values,num_values,fontlist); -} -static FORCEINLINE HRESULT IDWriteFontFamily2_GetFontSet(IDWriteFontFamily2* This,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFontSet(This,fontset); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontFamily2_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontCollection1 interface - */ -#ifndef __IDWriteFontCollection1_INTERFACE_DEFINED__ -#define __IDWriteFontCollection1_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontCollection1, 0x53585141, 0xd9f8, 0x4095, 0x83,0x21, 0xd7,0x3c,0xf6,0xbd,0x11,0x6c); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("53585141-d9f8-4095-8321-d73cf6bd116c") -IDWriteFontCollection1 : public IDWriteFontCollection -{ - virtual HRESULT STDMETHODCALLTYPE GetFontSet( - IDWriteFontSet **fontset) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontFamily( - UINT32 index, - IDWriteFontFamily1 **family) = 0; - - using IDWriteFontCollection::GetFontFamily; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontCollection1, 0x53585141, 0xd9f8, 0x4095, 0x83,0x21, 0xd7,0x3c,0xf6,0xbd,0x11,0x6c) -#endif -#else -typedef struct IDWriteFontCollection1Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontCollection1 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontCollection1 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontCollection1 *This); - - /*** IDWriteFontCollection methods ***/ - UINT32 (STDMETHODCALLTYPE *GetFontFamilyCount)( - IDWriteFontCollection1 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFamily)( - IDWriteFontCollection1 *This, - UINT32 index, - IDWriteFontFamily **family); - - HRESULT (STDMETHODCALLTYPE *FindFamilyName)( - IDWriteFontCollection1 *This, - const WCHAR *name, - UINT32 *index, - WINBOOL *exists); - - HRESULT (STDMETHODCALLTYPE *GetFontFromFontFace)( - IDWriteFontCollection1 *This, - IDWriteFontFace *face, - IDWriteFont **font); - - /*** IDWriteFontCollection1 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontSet)( - IDWriteFontCollection1 *This, - IDWriteFontSet **fontset); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontCollection1_GetFontFamily)( - IDWriteFontCollection1 *This, - UINT32 index, - IDWriteFontFamily1 **family); - - END_INTERFACE -} IDWriteFontCollection1Vtbl; - -interface IDWriteFontCollection1 { - CONST_VTBL IDWriteFontCollection1Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontCollection1_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontCollection1_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontCollection1_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontCollection methods ***/ -#define IDWriteFontCollection1_GetFontFamilyCount(This) (This)->lpVtbl->GetFontFamilyCount(This) -#define IDWriteFontCollection1_FindFamilyName(This,name,index,exists) (This)->lpVtbl->FindFamilyName(This,name,index,exists) -#define IDWriteFontCollection1_GetFontFromFontFace(This,face,font) (This)->lpVtbl->GetFontFromFontFace(This,face,font) -/*** IDWriteFontCollection1 methods ***/ -#define IDWriteFontCollection1_GetFontSet(This,fontset) (This)->lpVtbl->GetFontSet(This,fontset) -#define IDWriteFontCollection1_GetFontFamily(This,index,family) (This)->lpVtbl->IDWriteFontCollection1_GetFontFamily(This,index,family) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontCollection1_QueryInterface(IDWriteFontCollection1* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontCollection1_AddRef(IDWriteFontCollection1* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontCollection1_Release(IDWriteFontCollection1* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontCollection methods ***/ -static FORCEINLINE UINT32 IDWriteFontCollection1_GetFontFamilyCount(IDWriteFontCollection1* This) { - return This->lpVtbl->GetFontFamilyCount(This); -} -static FORCEINLINE HRESULT IDWriteFontCollection1_FindFamilyName(IDWriteFontCollection1* This,const WCHAR *name,UINT32 *index,WINBOOL *exists) { - return This->lpVtbl->FindFamilyName(This,name,index,exists); -} -static FORCEINLINE HRESULT IDWriteFontCollection1_GetFontFromFontFace(IDWriteFontCollection1* This,IDWriteFontFace *face,IDWriteFont **font) { - return This->lpVtbl->GetFontFromFontFace(This,face,font); -} -/*** IDWriteFontCollection1 methods ***/ -static FORCEINLINE HRESULT IDWriteFontCollection1_GetFontSet(IDWriteFontCollection1* This,IDWriteFontSet **fontset) { - return This->lpVtbl->GetFontSet(This,fontset); -} -static FORCEINLINE HRESULT IDWriteFontCollection1_GetFontFamily(IDWriteFontCollection1* This,UINT32 index,IDWriteFontFamily1 **family) { - return This->lpVtbl->IDWriteFontCollection1_GetFontFamily(This,index,family); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontCollection1_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontCollection2 interface - */ -#ifndef __IDWriteFontCollection2_INTERFACE_DEFINED__ -#define __IDWriteFontCollection2_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontCollection2, 0x514039c6, 0x4617, 0x4064, 0xbf,0x8b, 0x92,0xea,0x83,0xe5,0x06,0xe0); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("514039c6-4617-4064-bf8b-92ea83e506e0") -IDWriteFontCollection2 : public IDWriteFontCollection1 -{ - virtual HRESULT STDMETHODCALLTYPE GetFontFamily( - UINT32 index, - IDWriteFontFamily2 **family) = 0; - - using IDWriteFontCollection::GetFontFamily; - using IDWriteFontCollection1::GetFontFamily; - - virtual HRESULT STDMETHODCALLTYPE GetMatchingFonts( - const WCHAR *familyname, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontList2 **fontlist) = 0; - - virtual DWRITE_FONT_FAMILY_MODEL STDMETHODCALLTYPE GetFontFamilyModel( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontSet( - IDWriteFontSet1 **fontset) = 0; - - using IDWriteFontCollection1::GetFontSet; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontCollection2, 0x514039c6, 0x4617, 0x4064, 0xbf,0x8b, 0x92,0xea,0x83,0xe5,0x06,0xe0) -#endif -#else -typedef struct IDWriteFontCollection2Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontCollection2 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontCollection2 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontCollection2 *This); - - /*** IDWriteFontCollection methods ***/ - UINT32 (STDMETHODCALLTYPE *GetFontFamilyCount)( - IDWriteFontCollection2 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFamily)( - IDWriteFontCollection2 *This, - UINT32 index, - IDWriteFontFamily **family); - - HRESULT (STDMETHODCALLTYPE *FindFamilyName)( - IDWriteFontCollection2 *This, - const WCHAR *name, - UINT32 *index, - WINBOOL *exists); - - HRESULT (STDMETHODCALLTYPE *GetFontFromFontFace)( - IDWriteFontCollection2 *This, - IDWriteFontFace *face, - IDWriteFont **font); - - /*** IDWriteFontCollection1 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontSet)( - IDWriteFontCollection2 *This, - IDWriteFontSet **fontset); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontCollection1_GetFontFamily)( - IDWriteFontCollection2 *This, - UINT32 index, - IDWriteFontFamily1 **family); - - /*** IDWriteFontCollection2 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFontCollection2_GetFontFamily)( - IDWriteFontCollection2 *This, - UINT32 index, - IDWriteFontFamily2 **family); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFonts)( - IDWriteFontCollection2 *This, - const WCHAR *familyname, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontList2 **fontlist); - - DWRITE_FONT_FAMILY_MODEL (STDMETHODCALLTYPE *GetFontFamilyModel)( - IDWriteFontCollection2 *This); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontCollection2_GetFontSet)( - IDWriteFontCollection2 *This, - IDWriteFontSet1 **fontset); - - END_INTERFACE -} IDWriteFontCollection2Vtbl; - -interface IDWriteFontCollection2 { - CONST_VTBL IDWriteFontCollection2Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontCollection2_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontCollection2_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontCollection2_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontCollection methods ***/ -#define IDWriteFontCollection2_GetFontFamilyCount(This) (This)->lpVtbl->GetFontFamilyCount(This) -#define IDWriteFontCollection2_FindFamilyName(This,name,index,exists) (This)->lpVtbl->FindFamilyName(This,name,index,exists) -#define IDWriteFontCollection2_GetFontFromFontFace(This,face,font) (This)->lpVtbl->GetFontFromFontFace(This,face,font) -/*** IDWriteFontCollection1 methods ***/ -/*** IDWriteFontCollection2 methods ***/ -#define IDWriteFontCollection2_GetFontFamily(This,index,family) (This)->lpVtbl->IDWriteFontCollection2_GetFontFamily(This,index,family) -#define IDWriteFontCollection2_GetMatchingFonts(This,familyname,axis_values,num_values,fontlist) (This)->lpVtbl->GetMatchingFonts(This,familyname,axis_values,num_values,fontlist) -#define IDWriteFontCollection2_GetFontFamilyModel(This) (This)->lpVtbl->GetFontFamilyModel(This) -#define IDWriteFontCollection2_GetFontSet(This,fontset) (This)->lpVtbl->IDWriteFontCollection2_GetFontSet(This,fontset) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontCollection2_QueryInterface(IDWriteFontCollection2* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontCollection2_AddRef(IDWriteFontCollection2* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontCollection2_Release(IDWriteFontCollection2* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontCollection methods ***/ -static FORCEINLINE UINT32 IDWriteFontCollection2_GetFontFamilyCount(IDWriteFontCollection2* This) { - return This->lpVtbl->GetFontFamilyCount(This); -} -static FORCEINLINE HRESULT IDWriteFontCollection2_FindFamilyName(IDWriteFontCollection2* This,const WCHAR *name,UINT32 *index,WINBOOL *exists) { - return This->lpVtbl->FindFamilyName(This,name,index,exists); -} -static FORCEINLINE HRESULT IDWriteFontCollection2_GetFontFromFontFace(IDWriteFontCollection2* This,IDWriteFontFace *face,IDWriteFont **font) { - return This->lpVtbl->GetFontFromFontFace(This,face,font); -} -/*** IDWriteFontCollection1 methods ***/ -/*** IDWriteFontCollection2 methods ***/ -static FORCEINLINE HRESULT IDWriteFontCollection2_GetFontFamily(IDWriteFontCollection2* This,UINT32 index,IDWriteFontFamily2 **family) { - return This->lpVtbl->IDWriteFontCollection2_GetFontFamily(This,index,family); -} -static FORCEINLINE HRESULT IDWriteFontCollection2_GetMatchingFonts(IDWriteFontCollection2* This,const WCHAR *familyname,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values,IDWriteFontList2 **fontlist) { - return This->lpVtbl->GetMatchingFonts(This,familyname,axis_values,num_values,fontlist); -} -static FORCEINLINE DWRITE_FONT_FAMILY_MODEL IDWriteFontCollection2_GetFontFamilyModel(IDWriteFontCollection2* This) { - return This->lpVtbl->GetFontFamilyModel(This); -} -static FORCEINLINE HRESULT IDWriteFontCollection2_GetFontSet(IDWriteFontCollection2* This,IDWriteFontSet1 **fontset) { - return This->lpVtbl->IDWriteFontCollection2_GetFontSet(This,fontset); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontCollection2_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontCollection3 interface - */ -#ifndef __IDWriteFontCollection3_INTERFACE_DEFINED__ -#define __IDWriteFontCollection3_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontCollection3, 0xa4d055a6, 0xf9e3, 0x4e25, 0x93,0xb7, 0x9e,0x30,0x9f,0x3a,0xf8,0xe9); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("a4d055a6-f9e3-4e25-93b7-9e309f3af8e9") -IDWriteFontCollection3 : public IDWriteFontCollection2 -{ - virtual HANDLE STDMETHODCALLTYPE GetExpirationEvent( - ) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontCollection3, 0xa4d055a6, 0xf9e3, 0x4e25, 0x93,0xb7, 0x9e,0x30,0x9f,0x3a,0xf8,0xe9) -#endif -#else -typedef struct IDWriteFontCollection3Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontCollection3 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontCollection3 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontCollection3 *This); - - /*** IDWriteFontCollection methods ***/ - UINT32 (STDMETHODCALLTYPE *GetFontFamilyCount)( - IDWriteFontCollection3 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFamily)( - IDWriteFontCollection3 *This, - UINT32 index, - IDWriteFontFamily **family); - - HRESULT (STDMETHODCALLTYPE *FindFamilyName)( - IDWriteFontCollection3 *This, - const WCHAR *name, - UINT32 *index, - WINBOOL *exists); - - HRESULT (STDMETHODCALLTYPE *GetFontFromFontFace)( - IDWriteFontCollection3 *This, - IDWriteFontFace *face, - IDWriteFont **font); - - /*** IDWriteFontCollection1 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontSet)( - IDWriteFontCollection3 *This, - IDWriteFontSet **fontset); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontCollection1_GetFontFamily)( - IDWriteFontCollection3 *This, - UINT32 index, - IDWriteFontFamily1 **family); - - /*** IDWriteFontCollection2 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFontCollection2_GetFontFamily)( - IDWriteFontCollection3 *This, - UINT32 index, - IDWriteFontFamily2 **family); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFonts)( - IDWriteFontCollection3 *This, - const WCHAR *familyname, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontList2 **fontlist); - - DWRITE_FONT_FAMILY_MODEL (STDMETHODCALLTYPE *GetFontFamilyModel)( - IDWriteFontCollection3 *This); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontCollection2_GetFontSet)( - IDWriteFontCollection3 *This, - IDWriteFontSet1 **fontset); - - /*** IDWriteFontCollection3 methods ***/ - HANDLE (STDMETHODCALLTYPE *GetExpirationEvent)( - IDWriteFontCollection3 *This); - - END_INTERFACE -} IDWriteFontCollection3Vtbl; - -interface IDWriteFontCollection3 { - CONST_VTBL IDWriteFontCollection3Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontCollection3_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontCollection3_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontCollection3_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontCollection methods ***/ -#define IDWriteFontCollection3_GetFontFamilyCount(This) (This)->lpVtbl->GetFontFamilyCount(This) -#define IDWriteFontCollection3_FindFamilyName(This,name,index,exists) (This)->lpVtbl->FindFamilyName(This,name,index,exists) -#define IDWriteFontCollection3_GetFontFromFontFace(This,face,font) (This)->lpVtbl->GetFontFromFontFace(This,face,font) -/*** IDWriteFontCollection1 methods ***/ -/*** IDWriteFontCollection2 methods ***/ -#define IDWriteFontCollection3_GetFontFamily(This,index,family) (This)->lpVtbl->IDWriteFontCollection2_GetFontFamily(This,index,family) -#define IDWriteFontCollection3_GetMatchingFonts(This,familyname,axis_values,num_values,fontlist) (This)->lpVtbl->GetMatchingFonts(This,familyname,axis_values,num_values,fontlist) -#define IDWriteFontCollection3_GetFontFamilyModel(This) (This)->lpVtbl->GetFontFamilyModel(This) -#define IDWriteFontCollection3_GetFontSet(This,fontset) (This)->lpVtbl->IDWriteFontCollection2_GetFontSet(This,fontset) -/*** IDWriteFontCollection3 methods ***/ -#define IDWriteFontCollection3_GetExpirationEvent(This) (This)->lpVtbl->GetExpirationEvent(This) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontCollection3_QueryInterface(IDWriteFontCollection3* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontCollection3_AddRef(IDWriteFontCollection3* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontCollection3_Release(IDWriteFontCollection3* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontCollection methods ***/ -static FORCEINLINE UINT32 IDWriteFontCollection3_GetFontFamilyCount(IDWriteFontCollection3* This) { - return This->lpVtbl->GetFontFamilyCount(This); -} -static FORCEINLINE HRESULT IDWriteFontCollection3_FindFamilyName(IDWriteFontCollection3* This,const WCHAR *name,UINT32 *index,WINBOOL *exists) { - return This->lpVtbl->FindFamilyName(This,name,index,exists); -} -static FORCEINLINE HRESULT IDWriteFontCollection3_GetFontFromFontFace(IDWriteFontCollection3* This,IDWriteFontFace *face,IDWriteFont **font) { - return This->lpVtbl->GetFontFromFontFace(This,face,font); -} -/*** IDWriteFontCollection1 methods ***/ -/*** IDWriteFontCollection2 methods ***/ -static FORCEINLINE HRESULT IDWriteFontCollection3_GetFontFamily(IDWriteFontCollection3* This,UINT32 index,IDWriteFontFamily2 **family) { - return This->lpVtbl->IDWriteFontCollection2_GetFontFamily(This,index,family); -} -static FORCEINLINE HRESULT IDWriteFontCollection3_GetMatchingFonts(IDWriteFontCollection3* This,const WCHAR *familyname,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values,IDWriteFontList2 **fontlist) { - return This->lpVtbl->GetMatchingFonts(This,familyname,axis_values,num_values,fontlist); -} -static FORCEINLINE DWRITE_FONT_FAMILY_MODEL IDWriteFontCollection3_GetFontFamilyModel(IDWriteFontCollection3* This) { - return This->lpVtbl->GetFontFamilyModel(This); -} -static FORCEINLINE HRESULT IDWriteFontCollection3_GetFontSet(IDWriteFontCollection3* This,IDWriteFontSet1 **fontset) { - return This->lpVtbl->IDWriteFontCollection2_GetFontSet(This,fontset); -} -/*** IDWriteFontCollection3 methods ***/ -static FORCEINLINE HANDLE IDWriteFontCollection3_GetExpirationEvent(IDWriteFontCollection3* This) { - return This->lpVtbl->GetExpirationEvent(This); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontCollection3_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontFaceReference interface - */ -#ifndef __IDWriteFontFaceReference_INTERFACE_DEFINED__ -#define __IDWriteFontFaceReference_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontFaceReference, 0x5e7fa7ca, 0xdde3, 0x424c, 0x89,0xf0, 0x9f,0xcd,0x6f,0xed,0x58,0xcd); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("5e7fa7ca-dde3-424c-89f0-9fcd6fed58cd") -IDWriteFontFaceReference : public IUnknown -{ - virtual HRESULT STDMETHODCALLTYPE CreateFontFace( - IDWriteFontFace3 **fontface) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateFontFaceWithSimulations( - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFace3 **fontface) = 0; - - virtual WINBOOL STDMETHODCALLTYPE Equals( - IDWriteFontFaceReference *reference) = 0; - - virtual UINT32 STDMETHODCALLTYPE GetFontFaceIndex( - ) = 0; - - virtual DWRITE_FONT_SIMULATIONS STDMETHODCALLTYPE GetSimulations( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontFile( - IDWriteFontFile **fontfile) = 0; - - virtual UINT64 STDMETHODCALLTYPE GetLocalFileSize( - ) = 0; - - virtual UINT64 STDMETHODCALLTYPE GetFileSize( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFileTime( - FILETIME *writetime) = 0; - - virtual DWRITE_LOCALITY STDMETHODCALLTYPE GetLocality( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnqueueFontDownloadRequest( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnqueueCharacterDownloadRequest( - const WCHAR *chars, - UINT32 count) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnqueueGlyphDownloadRequest( - const UINT16 *glyphs, - UINT32 count) = 0; - - virtual HRESULT STDMETHODCALLTYPE EnqueueFileFragmentDownloadRequest( - UINT64 offset, - UINT64 size) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontFaceReference, 0x5e7fa7ca, 0xdde3, 0x424c, 0x89,0xf0, 0x9f,0xcd,0x6f,0xed,0x58,0xcd) -#endif -#else -typedef struct IDWriteFontFaceReferenceVtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontFaceReference *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontFaceReference *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontFaceReference *This); - - /*** IDWriteFontFaceReference methods ***/ - HRESULT (STDMETHODCALLTYPE *CreateFontFace)( - IDWriteFontFaceReference *This, - IDWriteFontFace3 **fontface); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceWithSimulations)( - IDWriteFontFaceReference *This, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFace3 **fontface); - - WINBOOL (STDMETHODCALLTYPE *Equals)( - IDWriteFontFaceReference *This, - IDWriteFontFaceReference *reference); - - UINT32 (STDMETHODCALLTYPE *GetFontFaceIndex)( - IDWriteFontFaceReference *This); - - DWRITE_FONT_SIMULATIONS (STDMETHODCALLTYPE *GetSimulations)( - IDWriteFontFaceReference *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFile)( - IDWriteFontFaceReference *This, - IDWriteFontFile **fontfile); - - UINT64 (STDMETHODCALLTYPE *GetLocalFileSize)( - IDWriteFontFaceReference *This); - - UINT64 (STDMETHODCALLTYPE *GetFileSize)( - IDWriteFontFaceReference *This); - - HRESULT (STDMETHODCALLTYPE *GetFileTime)( - IDWriteFontFaceReference *This, - FILETIME *writetime); - - DWRITE_LOCALITY (STDMETHODCALLTYPE *GetLocality)( - IDWriteFontFaceReference *This); - - HRESULT (STDMETHODCALLTYPE *EnqueueFontDownloadRequest)( - IDWriteFontFaceReference *This); - - HRESULT (STDMETHODCALLTYPE *EnqueueCharacterDownloadRequest)( - IDWriteFontFaceReference *This, - const WCHAR *chars, - UINT32 count); - - HRESULT (STDMETHODCALLTYPE *EnqueueGlyphDownloadRequest)( - IDWriteFontFaceReference *This, - const UINT16 *glyphs, - UINT32 count); - - HRESULT (STDMETHODCALLTYPE *EnqueueFileFragmentDownloadRequest)( - IDWriteFontFaceReference *This, - UINT64 offset, - UINT64 size); - - END_INTERFACE -} IDWriteFontFaceReferenceVtbl; - -interface IDWriteFontFaceReference { - CONST_VTBL IDWriteFontFaceReferenceVtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontFaceReference_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontFaceReference_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontFaceReference_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontFaceReference methods ***/ -#define IDWriteFontFaceReference_CreateFontFace(This,fontface) (This)->lpVtbl->CreateFontFace(This,fontface) -#define IDWriteFontFaceReference_CreateFontFaceWithSimulations(This,simulations,fontface) (This)->lpVtbl->CreateFontFaceWithSimulations(This,simulations,fontface) -#define IDWriteFontFaceReference_Equals(This,reference) (This)->lpVtbl->Equals(This,reference) -#define IDWriteFontFaceReference_GetFontFaceIndex(This) (This)->lpVtbl->GetFontFaceIndex(This) -#define IDWriteFontFaceReference_GetSimulations(This) (This)->lpVtbl->GetSimulations(This) -#define IDWriteFontFaceReference_GetFontFile(This,fontfile) (This)->lpVtbl->GetFontFile(This,fontfile) -#define IDWriteFontFaceReference_GetLocalFileSize(This) (This)->lpVtbl->GetLocalFileSize(This) -#define IDWriteFontFaceReference_GetFileSize(This) (This)->lpVtbl->GetFileSize(This) -#define IDWriteFontFaceReference_GetFileTime(This,writetime) (This)->lpVtbl->GetFileTime(This,writetime) -#define IDWriteFontFaceReference_GetLocality(This) (This)->lpVtbl->GetLocality(This) -#define IDWriteFontFaceReference_EnqueueFontDownloadRequest(This) (This)->lpVtbl->EnqueueFontDownloadRequest(This) -#define IDWriteFontFaceReference_EnqueueCharacterDownloadRequest(This,chars,count) (This)->lpVtbl->EnqueueCharacterDownloadRequest(This,chars,count) -#define IDWriteFontFaceReference_EnqueueGlyphDownloadRequest(This,glyphs,count) (This)->lpVtbl->EnqueueGlyphDownloadRequest(This,glyphs,count) -#define IDWriteFontFaceReference_EnqueueFileFragmentDownloadRequest(This,offset,size) (This)->lpVtbl->EnqueueFileFragmentDownloadRequest(This,offset,size) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontFaceReference_QueryInterface(IDWriteFontFaceReference* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontFaceReference_AddRef(IDWriteFontFaceReference* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontFaceReference_Release(IDWriteFontFaceReference* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontFaceReference methods ***/ -static FORCEINLINE HRESULT IDWriteFontFaceReference_CreateFontFace(IDWriteFontFaceReference* This,IDWriteFontFace3 **fontface) { - return This->lpVtbl->CreateFontFace(This,fontface); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference_CreateFontFaceWithSimulations(IDWriteFontFaceReference* This,DWRITE_FONT_SIMULATIONS simulations,IDWriteFontFace3 **fontface) { - return This->lpVtbl->CreateFontFaceWithSimulations(This,simulations,fontface); -} -static FORCEINLINE WINBOOL IDWriteFontFaceReference_Equals(IDWriteFontFaceReference* This,IDWriteFontFaceReference *reference) { - return This->lpVtbl->Equals(This,reference); -} -static FORCEINLINE UINT32 IDWriteFontFaceReference_GetFontFaceIndex(IDWriteFontFaceReference* This) { - return This->lpVtbl->GetFontFaceIndex(This); -} -static FORCEINLINE DWRITE_FONT_SIMULATIONS IDWriteFontFaceReference_GetSimulations(IDWriteFontFaceReference* This) { - return This->lpVtbl->GetSimulations(This); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference_GetFontFile(IDWriteFontFaceReference* This,IDWriteFontFile **fontfile) { - return This->lpVtbl->GetFontFile(This,fontfile); -} -static FORCEINLINE UINT64 IDWriteFontFaceReference_GetLocalFileSize(IDWriteFontFaceReference* This) { - return This->lpVtbl->GetLocalFileSize(This); -} -static FORCEINLINE UINT64 IDWriteFontFaceReference_GetFileSize(IDWriteFontFaceReference* This) { - return This->lpVtbl->GetFileSize(This); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference_GetFileTime(IDWriteFontFaceReference* This,FILETIME *writetime) { - return This->lpVtbl->GetFileTime(This,writetime); -} -static FORCEINLINE DWRITE_LOCALITY IDWriteFontFaceReference_GetLocality(IDWriteFontFaceReference* This) { - return This->lpVtbl->GetLocality(This); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference_EnqueueFontDownloadRequest(IDWriteFontFaceReference* This) { - return This->lpVtbl->EnqueueFontDownloadRequest(This); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference_EnqueueCharacterDownloadRequest(IDWriteFontFaceReference* This,const WCHAR *chars,UINT32 count) { - return This->lpVtbl->EnqueueCharacterDownloadRequest(This,chars,count); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference_EnqueueGlyphDownloadRequest(IDWriteFontFaceReference* This,const UINT16 *glyphs,UINT32 count) { - return This->lpVtbl->EnqueueGlyphDownloadRequest(This,glyphs,count); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference_EnqueueFileFragmentDownloadRequest(IDWriteFontFaceReference* This,UINT64 offset,UINT64 size) { - return This->lpVtbl->EnqueueFileFragmentDownloadRequest(This,offset,size); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontFaceReference_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontFaceReference1 interface - */ -#ifndef __IDWriteFontFaceReference1_INTERFACE_DEFINED__ -#define __IDWriteFontFaceReference1_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontFaceReference1, 0xc081fe77, 0x2fd1, 0x41ac, 0xa5,0xa3, 0x34,0x98,0x3c,0x4b,0xa6,0x1a); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("c081fe77-2fd1-41ac-a5a3-34983c4ba61a") -IDWriteFontFaceReference1 : public IDWriteFontFaceReference -{ - virtual HRESULT STDMETHODCALLTYPE CreateFontFace( - IDWriteFontFace5 **fontface) = 0; - - using IDWriteFontFaceReference::CreateFontFace; - - virtual UINT32 STDMETHODCALLTYPE GetFontAxisValueCount( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontAxisValues( - DWRITE_FONT_AXIS_VALUE *values, - UINT32 num_values) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontFaceReference1, 0xc081fe77, 0x2fd1, 0x41ac, 0xa5,0xa3, 0x34,0x98,0x3c,0x4b,0xa6,0x1a) -#endif -#else -typedef struct IDWriteFontFaceReference1Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontFaceReference1 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontFaceReference1 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontFaceReference1 *This); - - /*** IDWriteFontFaceReference methods ***/ - HRESULT (STDMETHODCALLTYPE *CreateFontFace)( - IDWriteFontFaceReference1 *This, - IDWriteFontFace3 **fontface); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceWithSimulations)( - IDWriteFontFaceReference1 *This, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFace3 **fontface); - - WINBOOL (STDMETHODCALLTYPE *Equals)( - IDWriteFontFaceReference1 *This, - IDWriteFontFaceReference *reference); - - UINT32 (STDMETHODCALLTYPE *GetFontFaceIndex)( - IDWriteFontFaceReference1 *This); - - DWRITE_FONT_SIMULATIONS (STDMETHODCALLTYPE *GetSimulations)( - IDWriteFontFaceReference1 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFile)( - IDWriteFontFaceReference1 *This, - IDWriteFontFile **fontfile); - - UINT64 (STDMETHODCALLTYPE *GetLocalFileSize)( - IDWriteFontFaceReference1 *This); - - UINT64 (STDMETHODCALLTYPE *GetFileSize)( - IDWriteFontFaceReference1 *This); - - HRESULT (STDMETHODCALLTYPE *GetFileTime)( - IDWriteFontFaceReference1 *This, - FILETIME *writetime); - - DWRITE_LOCALITY (STDMETHODCALLTYPE *GetLocality)( - IDWriteFontFaceReference1 *This); - - HRESULT (STDMETHODCALLTYPE *EnqueueFontDownloadRequest)( - IDWriteFontFaceReference1 *This); - - HRESULT (STDMETHODCALLTYPE *EnqueueCharacterDownloadRequest)( - IDWriteFontFaceReference1 *This, - const WCHAR *chars, - UINT32 count); - - HRESULT (STDMETHODCALLTYPE *EnqueueGlyphDownloadRequest)( - IDWriteFontFaceReference1 *This, - const UINT16 *glyphs, - UINT32 count); - - HRESULT (STDMETHODCALLTYPE *EnqueueFileFragmentDownloadRequest)( - IDWriteFontFaceReference1 *This, - UINT64 offset, - UINT64 size); - - /*** IDWriteFontFaceReference1 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFontFaceReference1_CreateFontFace)( - IDWriteFontFaceReference1 *This, - IDWriteFontFace5 **fontface); - - UINT32 (STDMETHODCALLTYPE *GetFontAxisValueCount)( - IDWriteFontFaceReference1 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontAxisValues)( - IDWriteFontFaceReference1 *This, - DWRITE_FONT_AXIS_VALUE *values, - UINT32 num_values); - - END_INTERFACE -} IDWriteFontFaceReference1Vtbl; - -interface IDWriteFontFaceReference1 { - CONST_VTBL IDWriteFontFaceReference1Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontFaceReference1_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontFaceReference1_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontFaceReference1_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontFaceReference methods ***/ -#define IDWriteFontFaceReference1_CreateFontFaceWithSimulations(This,simulations,fontface) (This)->lpVtbl->CreateFontFaceWithSimulations(This,simulations,fontface) -#define IDWriteFontFaceReference1_Equals(This,reference) (This)->lpVtbl->Equals(This,reference) -#define IDWriteFontFaceReference1_GetFontFaceIndex(This) (This)->lpVtbl->GetFontFaceIndex(This) -#define IDWriteFontFaceReference1_GetSimulations(This) (This)->lpVtbl->GetSimulations(This) -#define IDWriteFontFaceReference1_GetFontFile(This,fontfile) (This)->lpVtbl->GetFontFile(This,fontfile) -#define IDWriteFontFaceReference1_GetLocalFileSize(This) (This)->lpVtbl->GetLocalFileSize(This) -#define IDWriteFontFaceReference1_GetFileSize(This) (This)->lpVtbl->GetFileSize(This) -#define IDWriteFontFaceReference1_GetFileTime(This,writetime) (This)->lpVtbl->GetFileTime(This,writetime) -#define IDWriteFontFaceReference1_GetLocality(This) (This)->lpVtbl->GetLocality(This) -#define IDWriteFontFaceReference1_EnqueueFontDownloadRequest(This) (This)->lpVtbl->EnqueueFontDownloadRequest(This) -#define IDWriteFontFaceReference1_EnqueueCharacterDownloadRequest(This,chars,count) (This)->lpVtbl->EnqueueCharacterDownloadRequest(This,chars,count) -#define IDWriteFontFaceReference1_EnqueueGlyphDownloadRequest(This,glyphs,count) (This)->lpVtbl->EnqueueGlyphDownloadRequest(This,glyphs,count) -#define IDWriteFontFaceReference1_EnqueueFileFragmentDownloadRequest(This,offset,size) (This)->lpVtbl->EnqueueFileFragmentDownloadRequest(This,offset,size) -/*** IDWriteFontFaceReference1 methods ***/ -#define IDWriteFontFaceReference1_CreateFontFace(This,fontface) (This)->lpVtbl->IDWriteFontFaceReference1_CreateFontFace(This,fontface) -#define IDWriteFontFaceReference1_GetFontAxisValueCount(This) (This)->lpVtbl->GetFontAxisValueCount(This) -#define IDWriteFontFaceReference1_GetFontAxisValues(This,values,num_values) (This)->lpVtbl->GetFontAxisValues(This,values,num_values) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontFaceReference1_QueryInterface(IDWriteFontFaceReference1* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontFaceReference1_AddRef(IDWriteFontFaceReference1* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontFaceReference1_Release(IDWriteFontFaceReference1* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontFaceReference methods ***/ -static FORCEINLINE HRESULT IDWriteFontFaceReference1_CreateFontFaceWithSimulations(IDWriteFontFaceReference1* This,DWRITE_FONT_SIMULATIONS simulations,IDWriteFontFace3 **fontface) { - return This->lpVtbl->CreateFontFaceWithSimulations(This,simulations,fontface); -} -static FORCEINLINE WINBOOL IDWriteFontFaceReference1_Equals(IDWriteFontFaceReference1* This,IDWriteFontFaceReference *reference) { - return This->lpVtbl->Equals(This,reference); -} -static FORCEINLINE UINT32 IDWriteFontFaceReference1_GetFontFaceIndex(IDWriteFontFaceReference1* This) { - return This->lpVtbl->GetFontFaceIndex(This); -} -static FORCEINLINE DWRITE_FONT_SIMULATIONS IDWriteFontFaceReference1_GetSimulations(IDWriteFontFaceReference1* This) { - return This->lpVtbl->GetSimulations(This); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference1_GetFontFile(IDWriteFontFaceReference1* This,IDWriteFontFile **fontfile) { - return This->lpVtbl->GetFontFile(This,fontfile); -} -static FORCEINLINE UINT64 IDWriteFontFaceReference1_GetLocalFileSize(IDWriteFontFaceReference1* This) { - return This->lpVtbl->GetLocalFileSize(This); -} -static FORCEINLINE UINT64 IDWriteFontFaceReference1_GetFileSize(IDWriteFontFaceReference1* This) { - return This->lpVtbl->GetFileSize(This); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference1_GetFileTime(IDWriteFontFaceReference1* This,FILETIME *writetime) { - return This->lpVtbl->GetFileTime(This,writetime); -} -static FORCEINLINE DWRITE_LOCALITY IDWriteFontFaceReference1_GetLocality(IDWriteFontFaceReference1* This) { - return This->lpVtbl->GetLocality(This); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference1_EnqueueFontDownloadRequest(IDWriteFontFaceReference1* This) { - return This->lpVtbl->EnqueueFontDownloadRequest(This); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference1_EnqueueCharacterDownloadRequest(IDWriteFontFaceReference1* This,const WCHAR *chars,UINT32 count) { - return This->lpVtbl->EnqueueCharacterDownloadRequest(This,chars,count); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference1_EnqueueGlyphDownloadRequest(IDWriteFontFaceReference1* This,const UINT16 *glyphs,UINT32 count) { - return This->lpVtbl->EnqueueGlyphDownloadRequest(This,glyphs,count); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference1_EnqueueFileFragmentDownloadRequest(IDWriteFontFaceReference1* This,UINT64 offset,UINT64 size) { - return This->lpVtbl->EnqueueFileFragmentDownloadRequest(This,offset,size); -} -/*** IDWriteFontFaceReference1 methods ***/ -static FORCEINLINE HRESULT IDWriteFontFaceReference1_CreateFontFace(IDWriteFontFaceReference1* This,IDWriteFontFace5 **fontface) { - return This->lpVtbl->IDWriteFontFaceReference1_CreateFontFace(This,fontface); -} -static FORCEINLINE UINT32 IDWriteFontFaceReference1_GetFontAxisValueCount(IDWriteFontFaceReference1* This) { - return This->lpVtbl->GetFontAxisValueCount(This); -} -static FORCEINLINE HRESULT IDWriteFontFaceReference1_GetFontAxisValues(IDWriteFontFaceReference1* This,DWRITE_FONT_AXIS_VALUE *values,UINT32 num_values) { - return This->lpVtbl->GetFontAxisValues(This,values,num_values); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontFaceReference1_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontList1 interface - */ -#ifndef __IDWriteFontList1_INTERFACE_DEFINED__ -#define __IDWriteFontList1_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontList1, 0xda20d8ef, 0x812a, 0x4c43, 0x98,0x02, 0x62,0xec,0x4a,0xbd,0x7a,0xde); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("da20d8ef-812a-4c43-9802-62ec4abd7ade") -IDWriteFontList1 : public IDWriteFontList -{ - virtual DWRITE_LOCALITY STDMETHODCALLTYPE GetFontLocality( - UINT32 index) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFont( - UINT32 index, - IDWriteFont3 **font) = 0; - - using IDWriteFontList::GetFont; - - virtual HRESULT STDMETHODCALLTYPE GetFontFaceReference( - UINT32 index, - IDWriteFontFaceReference **reference) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontList1, 0xda20d8ef, 0x812a, 0x4c43, 0x98,0x02, 0x62,0xec,0x4a,0xbd,0x7a,0xde) -#endif -#else -typedef struct IDWriteFontList1Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontList1 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontList1 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontList1 *This); - - /*** IDWriteFontList methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontCollection)( - IDWriteFontList1 *This, - IDWriteFontCollection **collection); - - UINT32 (STDMETHODCALLTYPE *GetFontCount)( - IDWriteFontList1 *This); - - HRESULT (STDMETHODCALLTYPE *GetFont)( - IDWriteFontList1 *This, - UINT32 index, - IDWriteFont **font); - - /*** IDWriteFontList1 methods ***/ - DWRITE_LOCALITY (STDMETHODCALLTYPE *GetFontLocality)( - IDWriteFontList1 *This, - UINT32 index); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontList1_GetFont)( - IDWriteFontList1 *This, - UINT32 index, - IDWriteFont3 **font); - - HRESULT (STDMETHODCALLTYPE *GetFontFaceReference)( - IDWriteFontList1 *This, - UINT32 index, - IDWriteFontFaceReference **reference); - - END_INTERFACE -} IDWriteFontList1Vtbl; - -interface IDWriteFontList1 { - CONST_VTBL IDWriteFontList1Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontList1_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontList1_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontList1_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontList methods ***/ -#define IDWriteFontList1_GetFontCollection(This,collection) (This)->lpVtbl->GetFontCollection(This,collection) -#define IDWriteFontList1_GetFontCount(This) (This)->lpVtbl->GetFontCount(This) -/*** IDWriteFontList1 methods ***/ -#define IDWriteFontList1_GetFontLocality(This,index) (This)->lpVtbl->GetFontLocality(This,index) -#define IDWriteFontList1_GetFont(This,index,font) (This)->lpVtbl->IDWriteFontList1_GetFont(This,index,font) -#define IDWriteFontList1_GetFontFaceReference(This,index,reference) (This)->lpVtbl->GetFontFaceReference(This,index,reference) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontList1_QueryInterface(IDWriteFontList1* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontList1_AddRef(IDWriteFontList1* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontList1_Release(IDWriteFontList1* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontList methods ***/ -static FORCEINLINE HRESULT IDWriteFontList1_GetFontCollection(IDWriteFontList1* This,IDWriteFontCollection **collection) { - return This->lpVtbl->GetFontCollection(This,collection); -} -static FORCEINLINE UINT32 IDWriteFontList1_GetFontCount(IDWriteFontList1* This) { - return This->lpVtbl->GetFontCount(This); -} -/*** IDWriteFontList1 methods ***/ -static FORCEINLINE DWRITE_LOCALITY IDWriteFontList1_GetFontLocality(IDWriteFontList1* This,UINT32 index) { - return This->lpVtbl->GetFontLocality(This,index); -} -static FORCEINLINE HRESULT IDWriteFontList1_GetFont(IDWriteFontList1* This,UINT32 index,IDWriteFont3 **font) { - return This->lpVtbl->IDWriteFontList1_GetFont(This,index,font); -} -static FORCEINLINE HRESULT IDWriteFontList1_GetFontFaceReference(IDWriteFontList1* This,UINT32 index,IDWriteFontFaceReference **reference) { - return This->lpVtbl->GetFontFaceReference(This,index,reference); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontList1_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontList2 interface - */ -#ifndef __IDWriteFontList2_INTERFACE_DEFINED__ -#define __IDWriteFontList2_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontList2, 0xc0763a34, 0x77af, 0x445a, 0xb7,0x35, 0x08,0xc3,0x7b,0x0a,0x5b,0xf5); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("c0763a34-77af-445a-b735-08c37b0a5bf5") -IDWriteFontList2 : public IDWriteFontList1 -{ - virtual HRESULT STDMETHODCALLTYPE GetFontSet( - IDWriteFontSet1 **fontset) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontList2, 0xc0763a34, 0x77af, 0x445a, 0xb7,0x35, 0x08,0xc3,0x7b,0x0a,0x5b,0xf5) -#endif -#else -typedef struct IDWriteFontList2Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontList2 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontList2 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontList2 *This); - - /*** IDWriteFontList methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontCollection)( - IDWriteFontList2 *This, - IDWriteFontCollection **collection); - - UINT32 (STDMETHODCALLTYPE *GetFontCount)( - IDWriteFontList2 *This); - - HRESULT (STDMETHODCALLTYPE *GetFont)( - IDWriteFontList2 *This, - UINT32 index, - IDWriteFont **font); - - /*** IDWriteFontList1 methods ***/ - DWRITE_LOCALITY (STDMETHODCALLTYPE *GetFontLocality)( - IDWriteFontList2 *This, - UINT32 index); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontList1_GetFont)( - IDWriteFontList2 *This, - UINT32 index, - IDWriteFont3 **font); - - HRESULT (STDMETHODCALLTYPE *GetFontFaceReference)( - IDWriteFontList2 *This, - UINT32 index, - IDWriteFontFaceReference **reference); - - /*** IDWriteFontList2 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontSet)( - IDWriteFontList2 *This, - IDWriteFontSet1 **fontset); - - END_INTERFACE -} IDWriteFontList2Vtbl; - -interface IDWriteFontList2 { - CONST_VTBL IDWriteFontList2Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontList2_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontList2_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontList2_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontList methods ***/ -#define IDWriteFontList2_GetFontCollection(This,collection) (This)->lpVtbl->GetFontCollection(This,collection) -#define IDWriteFontList2_GetFontCount(This) (This)->lpVtbl->GetFontCount(This) -/*** IDWriteFontList1 methods ***/ -#define IDWriteFontList2_GetFontLocality(This,index) (This)->lpVtbl->GetFontLocality(This,index) -#define IDWriteFontList2_GetFont(This,index,font) (This)->lpVtbl->IDWriteFontList1_GetFont(This,index,font) -#define IDWriteFontList2_GetFontFaceReference(This,index,reference) (This)->lpVtbl->GetFontFaceReference(This,index,reference) -/*** IDWriteFontList2 methods ***/ -#define IDWriteFontList2_GetFontSet(This,fontset) (This)->lpVtbl->GetFontSet(This,fontset) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontList2_QueryInterface(IDWriteFontList2* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontList2_AddRef(IDWriteFontList2* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontList2_Release(IDWriteFontList2* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontList methods ***/ -static FORCEINLINE HRESULT IDWriteFontList2_GetFontCollection(IDWriteFontList2* This,IDWriteFontCollection **collection) { - return This->lpVtbl->GetFontCollection(This,collection); -} -static FORCEINLINE UINT32 IDWriteFontList2_GetFontCount(IDWriteFontList2* This) { - return This->lpVtbl->GetFontCount(This); -} -/*** IDWriteFontList1 methods ***/ -static FORCEINLINE DWRITE_LOCALITY IDWriteFontList2_GetFontLocality(IDWriteFontList2* This,UINT32 index) { - return This->lpVtbl->GetFontLocality(This,index); -} -static FORCEINLINE HRESULT IDWriteFontList2_GetFont(IDWriteFontList2* This,UINT32 index,IDWriteFont3 **font) { - return This->lpVtbl->IDWriteFontList1_GetFont(This,index,font); -} -static FORCEINLINE HRESULT IDWriteFontList2_GetFontFaceReference(IDWriteFontList2* This,UINT32 index,IDWriteFontFaceReference **reference) { - return This->lpVtbl->GetFontFaceReference(This,index,reference); -} -/*** IDWriteFontList2 methods ***/ -static FORCEINLINE HRESULT IDWriteFontList2_GetFontSet(IDWriteFontList2* This,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFontSet(This,fontset); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontList2_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontSet2 interface - */ -#ifndef __IDWriteFontSet2_INTERFACE_DEFINED__ -#define __IDWriteFontSet2_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontSet2, 0xdc7ead19, 0xe54c, 0x43af, 0xb2,0xda, 0x4e,0x2b,0x79,0xba,0x3f,0x7f); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("dc7ead19-e54c-43af-b2da-4e2b79ba3f7f") -IDWriteFontSet2 : public IDWriteFontSet1 -{ - virtual HANDLE STDMETHODCALLTYPE GetExpirationEvent( - ) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontSet2, 0xdc7ead19, 0xe54c, 0x43af, 0xb2,0xda, 0x4e,0x2b,0x79,0xba,0x3f,0x7f) -#endif -#else -typedef struct IDWriteFontSet2Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontSet2 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontSet2 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontSet2 *This); - - /*** IDWriteFontSet methods ***/ - UINT32 (STDMETHODCALLTYPE *GetFontCount)( - IDWriteFontSet2 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFaceReference)( - IDWriteFontSet2 *This, - UINT32 index, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *FindFontFaceReference)( - IDWriteFontSet2 *This, - IDWriteFontFaceReference *reference, - UINT32 *index, - WINBOOL *exists); - - HRESULT (STDMETHODCALLTYPE *FindFontFace)( - IDWriteFontSet2 *This, - IDWriteFontFace *fontface, - UINT32 *index, - WINBOOL *exists); - - HRESULT (STDMETHODCALLTYPE *GetPropertyValues__)( - IDWriteFontSet2 *This, - DWRITE_FONT_PROPERTY_ID id, - IDWriteStringList **values); - - HRESULT (STDMETHODCALLTYPE *GetPropertyValues_)( - IDWriteFontSet2 *This, - DWRITE_FONT_PROPERTY_ID id, - const WCHAR *preferred_locales, - IDWriteStringList **values); - - HRESULT (STDMETHODCALLTYPE *GetPropertyValues)( - IDWriteFontSet2 *This, - UINT32 index, - DWRITE_FONT_PROPERTY_ID id, - WINBOOL *exists, - IDWriteLocalizedStrings **values); - - HRESULT (STDMETHODCALLTYPE *GetPropertyOccurrenceCount)( - IDWriteFontSet2 *This, - const DWRITE_FONT_PROPERTY *property, - UINT32 *count); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFonts_)( - IDWriteFontSet2 *This, - const WCHAR *family, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, - DWRITE_FONT_STYLE style, - IDWriteFontSet **fontset); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFonts)( - IDWriteFontSet2 *This, - const DWRITE_FONT_PROPERTY *props, - UINT32 count, - IDWriteFontSet **fontset); - - /*** IDWriteFontSet1 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFontSet1_GetMatchingFonts)( - IDWriteFontSet2 *This, - const DWRITE_FONT_PROPERTY *property, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFirstFontResources)( - IDWriteFontSet2 *This, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFonts__)( - IDWriteFontSet2 *This, - const UINT32 *indices, - UINT32 num_indices, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFonts_)( - IDWriteFontSet2 *This, - const DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - WINBOOL select_any_range, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFonts)( - IDWriteFontSet2 *This, - const DWRITE_FONT_PROPERTY *props, - UINT32 num_properties, - WINBOOL select_any_property, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFontIndices_)( - IDWriteFontSet2 *This, - const DWRITE_FONT_AXIS_RANGE *ranges, - UINT32 num_ranges, - WINBOOL select_any_range, - UINT32 *indices, - UINT32 num_indices, - UINT32 *actual_num_indices); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFontIndices)( - IDWriteFontSet2 *This, - const DWRITE_FONT_PROPERTY *props, - UINT32 num_properties, - WINBOOL select_any_range, - UINT32 *indices, - UINT32 num_indices, - UINT32 *actual_num_indices); - - HRESULT (STDMETHODCALLTYPE *GetFontAxisRanges_)( - IDWriteFontSet2 *This, - UINT32 font_index, - DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - UINT32 *actual_num_ranges); - - HRESULT (STDMETHODCALLTYPE *GetFontAxisRanges)( - IDWriteFontSet2 *This, - DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - UINT32 *actual_num_ranges); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontSet1_GetFontFaceReference)( - IDWriteFontSet2 *This, - UINT32 index, - IDWriteFontFaceReference1 **reference); - - HRESULT (STDMETHODCALLTYPE *CreateFontResource)( - IDWriteFontSet2 *This, - UINT32 index, - IDWriteFontResource **resource); - - HRESULT (STDMETHODCALLTYPE *CreateFontFace)( - IDWriteFontSet2 *This, - UINT32 index, - IDWriteFontFace5 **fontface); - - DWRITE_LOCALITY (STDMETHODCALLTYPE *GetFontLocality)( - IDWriteFontSet2 *This, - UINT32 index); - - /*** IDWriteFontSet2 methods ***/ - HANDLE (STDMETHODCALLTYPE *GetExpirationEvent)( - IDWriteFontSet2 *This); - - END_INTERFACE -} IDWriteFontSet2Vtbl; - -interface IDWriteFontSet2 { - CONST_VTBL IDWriteFontSet2Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontSet2_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontSet2_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontSet2_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontSet methods ***/ -#define IDWriteFontSet2_GetFontCount(This) (This)->lpVtbl->GetFontCount(This) -#define IDWriteFontSet2_FindFontFaceReference(This,reference,index,exists) (This)->lpVtbl->FindFontFaceReference(This,reference,index,exists) -#define IDWriteFontSet2_FindFontFace(This,fontface,index,exists) (This)->lpVtbl->FindFontFace(This,fontface,index,exists) -#define IDWriteFontSet2_GetPropertyValues__(This,id,values) (This)->lpVtbl->GetPropertyValues__(This,id,values) -#define IDWriteFontSet2_GetPropertyValues_(This,id,preferred_locales,values) (This)->lpVtbl->GetPropertyValues_(This,id,preferred_locales,values) -#define IDWriteFontSet2_GetPropertyValues(This,index,id,exists,values) (This)->lpVtbl->GetPropertyValues(This,index,id,exists,values) -#define IDWriteFontSet2_GetPropertyOccurrenceCount(This,property,count) (This)->lpVtbl->GetPropertyOccurrenceCount(This,property,count) -#define IDWriteFontSet2_GetMatchingFonts_(This,family,weight,stretch,style,fontset) (This)->lpVtbl->GetMatchingFonts_(This,family,weight,stretch,style,fontset) -/*** IDWriteFontSet1 methods ***/ -#define IDWriteFontSet2_GetMatchingFonts(This,property,axis_values,num_values,fontset) (This)->lpVtbl->IDWriteFontSet1_GetMatchingFonts(This,property,axis_values,num_values,fontset) -#define IDWriteFontSet2_GetFirstFontResources(This,fontset) (This)->lpVtbl->GetFirstFontResources(This,fontset) -#define IDWriteFontSet2_GetFilteredFonts__(This,indices,num_indices,fontset) (This)->lpVtbl->GetFilteredFonts__(This,indices,num_indices,fontset) -#define IDWriteFontSet2_GetFilteredFonts_(This,axis_ranges,num_ranges,select_any_range,fontset) (This)->lpVtbl->GetFilteredFonts_(This,axis_ranges,num_ranges,select_any_range,fontset) -#define IDWriteFontSet2_GetFilteredFonts(This,props,num_properties,select_any_property,fontset) (This)->lpVtbl->GetFilteredFonts(This,props,num_properties,select_any_property,fontset) -#define IDWriteFontSet2_GetFilteredFontIndices_(This,ranges,num_ranges,select_any_range,indices,num_indices,actual_num_indices) (This)->lpVtbl->GetFilteredFontIndices_(This,ranges,num_ranges,select_any_range,indices,num_indices,actual_num_indices) -#define IDWriteFontSet2_GetFilteredFontIndices(This,props,num_properties,select_any_range,indices,num_indices,actual_num_indices) (This)->lpVtbl->GetFilteredFontIndices(This,props,num_properties,select_any_range,indices,num_indices,actual_num_indices) -#define IDWriteFontSet2_GetFontAxisRanges_(This,font_index,axis_ranges,num_ranges,actual_num_ranges) (This)->lpVtbl->GetFontAxisRanges_(This,font_index,axis_ranges,num_ranges,actual_num_ranges) -#define IDWriteFontSet2_GetFontAxisRanges(This,axis_ranges,num_ranges,actual_num_ranges) (This)->lpVtbl->GetFontAxisRanges(This,axis_ranges,num_ranges,actual_num_ranges) -#define IDWriteFontSet2_GetFontFaceReference(This,index,reference) (This)->lpVtbl->IDWriteFontSet1_GetFontFaceReference(This,index,reference) -#define IDWriteFontSet2_CreateFontResource(This,index,resource) (This)->lpVtbl->CreateFontResource(This,index,resource) -#define IDWriteFontSet2_CreateFontFace(This,index,fontface) (This)->lpVtbl->CreateFontFace(This,index,fontface) -#define IDWriteFontSet2_GetFontLocality(This,index) (This)->lpVtbl->GetFontLocality(This,index) -/*** IDWriteFontSet2 methods ***/ -#define IDWriteFontSet2_GetExpirationEvent(This) (This)->lpVtbl->GetExpirationEvent(This) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontSet2_QueryInterface(IDWriteFontSet2* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontSet2_AddRef(IDWriteFontSet2* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontSet2_Release(IDWriteFontSet2* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontSet methods ***/ -static FORCEINLINE UINT32 IDWriteFontSet2_GetFontCount(IDWriteFontSet2* This) { - return This->lpVtbl->GetFontCount(This); -} -static FORCEINLINE HRESULT IDWriteFontSet2_FindFontFaceReference(IDWriteFontSet2* This,IDWriteFontFaceReference *reference,UINT32 *index,WINBOOL *exists) { - return This->lpVtbl->FindFontFaceReference(This,reference,index,exists); -} -static FORCEINLINE HRESULT IDWriteFontSet2_FindFontFace(IDWriteFontSet2* This,IDWriteFontFace *fontface,UINT32 *index,WINBOOL *exists) { - return This->lpVtbl->FindFontFace(This,fontface,index,exists); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetPropertyValues__(IDWriteFontSet2* This,DWRITE_FONT_PROPERTY_ID id,IDWriteStringList **values) { - return This->lpVtbl->GetPropertyValues__(This,id,values); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetPropertyValues_(IDWriteFontSet2* This,DWRITE_FONT_PROPERTY_ID id,const WCHAR *preferred_locales,IDWriteStringList **values) { - return This->lpVtbl->GetPropertyValues_(This,id,preferred_locales,values); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetPropertyValues(IDWriteFontSet2* This,UINT32 index,DWRITE_FONT_PROPERTY_ID id,WINBOOL *exists,IDWriteLocalizedStrings **values) { - return This->lpVtbl->GetPropertyValues(This,index,id,exists,values); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetPropertyOccurrenceCount(IDWriteFontSet2* This,const DWRITE_FONT_PROPERTY *property,UINT32 *count) { - return This->lpVtbl->GetPropertyOccurrenceCount(This,property,count); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetMatchingFonts_(IDWriteFontSet2* This,const WCHAR *family,DWRITE_FONT_WEIGHT weight,DWRITE_FONT_STRETCH stretch,DWRITE_FONT_STYLE style,IDWriteFontSet **fontset) { - return This->lpVtbl->GetMatchingFonts_(This,family,weight,stretch,style,fontset); -} -/*** IDWriteFontSet1 methods ***/ -static FORCEINLINE HRESULT IDWriteFontSet2_GetMatchingFonts(IDWriteFontSet2* This,const DWRITE_FONT_PROPERTY *property,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values,IDWriteFontSet1 **fontset) { - return This->lpVtbl->IDWriteFontSet1_GetMatchingFonts(This,property,axis_values,num_values,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetFirstFontResources(IDWriteFontSet2* This,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFirstFontResources(This,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetFilteredFonts__(IDWriteFontSet2* This,const UINT32 *indices,UINT32 num_indices,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFilteredFonts__(This,indices,num_indices,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetFilteredFonts_(IDWriteFontSet2* This,const DWRITE_FONT_AXIS_RANGE *axis_ranges,UINT32 num_ranges,WINBOOL select_any_range,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFilteredFonts_(This,axis_ranges,num_ranges,select_any_range,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetFilteredFonts(IDWriteFontSet2* This,const DWRITE_FONT_PROPERTY *props,UINT32 num_properties,WINBOOL select_any_property,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFilteredFonts(This,props,num_properties,select_any_property,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetFilteredFontIndices_(IDWriteFontSet2* This,const DWRITE_FONT_AXIS_RANGE *ranges,UINT32 num_ranges,WINBOOL select_any_range,UINT32 *indices,UINT32 num_indices,UINT32 *actual_num_indices) { - return This->lpVtbl->GetFilteredFontIndices_(This,ranges,num_ranges,select_any_range,indices,num_indices,actual_num_indices); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetFilteredFontIndices(IDWriteFontSet2* This,const DWRITE_FONT_PROPERTY *props,UINT32 num_properties,WINBOOL select_any_range,UINT32 *indices,UINT32 num_indices,UINT32 *actual_num_indices) { - return This->lpVtbl->GetFilteredFontIndices(This,props,num_properties,select_any_range,indices,num_indices,actual_num_indices); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetFontAxisRanges_(IDWriteFontSet2* This,UINT32 font_index,DWRITE_FONT_AXIS_RANGE *axis_ranges,UINT32 num_ranges,UINT32 *actual_num_ranges) { - return This->lpVtbl->GetFontAxisRanges_(This,font_index,axis_ranges,num_ranges,actual_num_ranges); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetFontAxisRanges(IDWriteFontSet2* This,DWRITE_FONT_AXIS_RANGE *axis_ranges,UINT32 num_ranges,UINT32 *actual_num_ranges) { - return This->lpVtbl->GetFontAxisRanges(This,axis_ranges,num_ranges,actual_num_ranges); -} -static FORCEINLINE HRESULT IDWriteFontSet2_GetFontFaceReference(IDWriteFontSet2* This,UINT32 index,IDWriteFontFaceReference1 **reference) { - return This->lpVtbl->IDWriteFontSet1_GetFontFaceReference(This,index,reference); -} -static FORCEINLINE HRESULT IDWriteFontSet2_CreateFontResource(IDWriteFontSet2* This,UINT32 index,IDWriteFontResource **resource) { - return This->lpVtbl->CreateFontResource(This,index,resource); -} -static FORCEINLINE HRESULT IDWriteFontSet2_CreateFontFace(IDWriteFontSet2* This,UINT32 index,IDWriteFontFace5 **fontface) { - return This->lpVtbl->CreateFontFace(This,index,fontface); -} -static FORCEINLINE DWRITE_LOCALITY IDWriteFontSet2_GetFontLocality(IDWriteFontSet2* This,UINT32 index) { - return This->lpVtbl->GetFontLocality(This,index); -} -/*** IDWriteFontSet2 methods ***/ -static FORCEINLINE HANDLE IDWriteFontSet2_GetExpirationEvent(IDWriteFontSet2* This) { - return This->lpVtbl->GetExpirationEvent(This); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontSet2_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontSet3 interface - */ -#ifndef __IDWriteFontSet3_INTERFACE_DEFINED__ -#define __IDWriteFontSet3_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontSet3, 0x7c073ef2, 0xa7f4, 0x4045, 0x8c,0x32, 0x8a,0xb8,0xae,0x64,0x0f,0x90); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("7c073ef2-a7f4-4045-8c32-8ab8ae640f90") -IDWriteFontSet3 : public IDWriteFontSet2 -{ - virtual DWRITE_FONT_SOURCE_TYPE STDMETHODCALLTYPE GetFontSourceType( - UINT32 index) = 0; - - virtual UINT32 STDMETHODCALLTYPE GetFontSourceNameLength( - UINT32 index) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontSourceName( - UINT32 index, - WCHAR *buffer, - UINT32 buffer_size) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontSet3, 0x7c073ef2, 0xa7f4, 0x4045, 0x8c,0x32, 0x8a,0xb8,0xae,0x64,0x0f,0x90) -#endif -#else -typedef struct IDWriteFontSet3Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontSet3 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontSet3 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontSet3 *This); - - /*** IDWriteFontSet methods ***/ - UINT32 (STDMETHODCALLTYPE *GetFontCount)( - IDWriteFontSet3 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFaceReference)( - IDWriteFontSet3 *This, - UINT32 index, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *FindFontFaceReference)( - IDWriteFontSet3 *This, - IDWriteFontFaceReference *reference, - UINT32 *index, - WINBOOL *exists); - - HRESULT (STDMETHODCALLTYPE *FindFontFace)( - IDWriteFontSet3 *This, - IDWriteFontFace *fontface, - UINT32 *index, - WINBOOL *exists); - - HRESULT (STDMETHODCALLTYPE *GetPropertyValues__)( - IDWriteFontSet3 *This, - DWRITE_FONT_PROPERTY_ID id, - IDWriteStringList **values); - - HRESULT (STDMETHODCALLTYPE *GetPropertyValues_)( - IDWriteFontSet3 *This, - DWRITE_FONT_PROPERTY_ID id, - const WCHAR *preferred_locales, - IDWriteStringList **values); - - HRESULT (STDMETHODCALLTYPE *GetPropertyValues)( - IDWriteFontSet3 *This, - UINT32 index, - DWRITE_FONT_PROPERTY_ID id, - WINBOOL *exists, - IDWriteLocalizedStrings **values); - - HRESULT (STDMETHODCALLTYPE *GetPropertyOccurrenceCount)( - IDWriteFontSet3 *This, - const DWRITE_FONT_PROPERTY *property, - UINT32 *count); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFonts_)( - IDWriteFontSet3 *This, - const WCHAR *family, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, - DWRITE_FONT_STYLE style, - IDWriteFontSet **fontset); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFonts)( - IDWriteFontSet3 *This, - const DWRITE_FONT_PROPERTY *props, - UINT32 count, - IDWriteFontSet **fontset); - - /*** IDWriteFontSet1 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFontSet1_GetMatchingFonts)( - IDWriteFontSet3 *This, - const DWRITE_FONT_PROPERTY *property, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFirstFontResources)( - IDWriteFontSet3 *This, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFonts__)( - IDWriteFontSet3 *This, - const UINT32 *indices, - UINT32 num_indices, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFonts_)( - IDWriteFontSet3 *This, - const DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - WINBOOL select_any_range, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFonts)( - IDWriteFontSet3 *This, - const DWRITE_FONT_PROPERTY *props, - UINT32 num_properties, - WINBOOL select_any_property, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFontIndices_)( - IDWriteFontSet3 *This, - const DWRITE_FONT_AXIS_RANGE *ranges, - UINT32 num_ranges, - WINBOOL select_any_range, - UINT32 *indices, - UINT32 num_indices, - UINT32 *actual_num_indices); - - HRESULT (STDMETHODCALLTYPE *GetFilteredFontIndices)( - IDWriteFontSet3 *This, - const DWRITE_FONT_PROPERTY *props, - UINT32 num_properties, - WINBOOL select_any_range, - UINT32 *indices, - UINT32 num_indices, - UINT32 *actual_num_indices); - - HRESULT (STDMETHODCALLTYPE *GetFontAxisRanges_)( - IDWriteFontSet3 *This, - UINT32 font_index, - DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - UINT32 *actual_num_ranges); - - HRESULT (STDMETHODCALLTYPE *GetFontAxisRanges)( - IDWriteFontSet3 *This, - DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - UINT32 *actual_num_ranges); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontSet1_GetFontFaceReference)( - IDWriteFontSet3 *This, - UINT32 index, - IDWriteFontFaceReference1 **reference); - - HRESULT (STDMETHODCALLTYPE *CreateFontResource)( - IDWriteFontSet3 *This, - UINT32 index, - IDWriteFontResource **resource); - - HRESULT (STDMETHODCALLTYPE *CreateFontFace)( - IDWriteFontSet3 *This, - UINT32 index, - IDWriteFontFace5 **fontface); - - DWRITE_LOCALITY (STDMETHODCALLTYPE *GetFontLocality)( - IDWriteFontSet3 *This, - UINT32 index); - - /*** IDWriteFontSet2 methods ***/ - HANDLE (STDMETHODCALLTYPE *GetExpirationEvent)( - IDWriteFontSet3 *This); - - /*** IDWriteFontSet3 methods ***/ - DWRITE_FONT_SOURCE_TYPE (STDMETHODCALLTYPE *GetFontSourceType)( - IDWriteFontSet3 *This, - UINT32 index); - - UINT32 (STDMETHODCALLTYPE *GetFontSourceNameLength)( - IDWriteFontSet3 *This, - UINT32 index); - - HRESULT (STDMETHODCALLTYPE *GetFontSourceName)( - IDWriteFontSet3 *This, - UINT32 index, - WCHAR *buffer, - UINT32 buffer_size); - - END_INTERFACE -} IDWriteFontSet3Vtbl; - -interface IDWriteFontSet3 { - CONST_VTBL IDWriteFontSet3Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontSet3_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontSet3_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontSet3_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontSet methods ***/ -#define IDWriteFontSet3_GetFontCount(This) (This)->lpVtbl->GetFontCount(This) -#define IDWriteFontSet3_FindFontFaceReference(This,reference,index,exists) (This)->lpVtbl->FindFontFaceReference(This,reference,index,exists) -#define IDWriteFontSet3_FindFontFace(This,fontface,index,exists) (This)->lpVtbl->FindFontFace(This,fontface,index,exists) -#define IDWriteFontSet3_GetPropertyValues__(This,id,values) (This)->lpVtbl->GetPropertyValues__(This,id,values) -#define IDWriteFontSet3_GetPropertyValues_(This,id,preferred_locales,values) (This)->lpVtbl->GetPropertyValues_(This,id,preferred_locales,values) -#define IDWriteFontSet3_GetPropertyValues(This,index,id,exists,values) (This)->lpVtbl->GetPropertyValues(This,index,id,exists,values) -#define IDWriteFontSet3_GetPropertyOccurrenceCount(This,property,count) (This)->lpVtbl->GetPropertyOccurrenceCount(This,property,count) -#define IDWriteFontSet3_GetMatchingFonts_(This,family,weight,stretch,style,fontset) (This)->lpVtbl->GetMatchingFonts_(This,family,weight,stretch,style,fontset) -/*** IDWriteFontSet1 methods ***/ -#define IDWriteFontSet3_GetMatchingFonts(This,property,axis_values,num_values,fontset) (This)->lpVtbl->IDWriteFontSet1_GetMatchingFonts(This,property,axis_values,num_values,fontset) -#define IDWriteFontSet3_GetFirstFontResources(This,fontset) (This)->lpVtbl->GetFirstFontResources(This,fontset) -#define IDWriteFontSet3_GetFilteredFonts__(This,indices,num_indices,fontset) (This)->lpVtbl->GetFilteredFonts__(This,indices,num_indices,fontset) -#define IDWriteFontSet3_GetFilteredFonts_(This,axis_ranges,num_ranges,select_any_range,fontset) (This)->lpVtbl->GetFilteredFonts_(This,axis_ranges,num_ranges,select_any_range,fontset) -#define IDWriteFontSet3_GetFilteredFonts(This,props,num_properties,select_any_property,fontset) (This)->lpVtbl->GetFilteredFonts(This,props,num_properties,select_any_property,fontset) -#define IDWriteFontSet3_GetFilteredFontIndices_(This,ranges,num_ranges,select_any_range,indices,num_indices,actual_num_indices) (This)->lpVtbl->GetFilteredFontIndices_(This,ranges,num_ranges,select_any_range,indices,num_indices,actual_num_indices) -#define IDWriteFontSet3_GetFilteredFontIndices(This,props,num_properties,select_any_range,indices,num_indices,actual_num_indices) (This)->lpVtbl->GetFilteredFontIndices(This,props,num_properties,select_any_range,indices,num_indices,actual_num_indices) -#define IDWriteFontSet3_GetFontAxisRanges_(This,font_index,axis_ranges,num_ranges,actual_num_ranges) (This)->lpVtbl->GetFontAxisRanges_(This,font_index,axis_ranges,num_ranges,actual_num_ranges) -#define IDWriteFontSet3_GetFontAxisRanges(This,axis_ranges,num_ranges,actual_num_ranges) (This)->lpVtbl->GetFontAxisRanges(This,axis_ranges,num_ranges,actual_num_ranges) -#define IDWriteFontSet3_GetFontFaceReference(This,index,reference) (This)->lpVtbl->IDWriteFontSet1_GetFontFaceReference(This,index,reference) -#define IDWriteFontSet3_CreateFontResource(This,index,resource) (This)->lpVtbl->CreateFontResource(This,index,resource) -#define IDWriteFontSet3_CreateFontFace(This,index,fontface) (This)->lpVtbl->CreateFontFace(This,index,fontface) -#define IDWriteFontSet3_GetFontLocality(This,index) (This)->lpVtbl->GetFontLocality(This,index) -/*** IDWriteFontSet2 methods ***/ -#define IDWriteFontSet3_GetExpirationEvent(This) (This)->lpVtbl->GetExpirationEvent(This) -/*** IDWriteFontSet3 methods ***/ -#define IDWriteFontSet3_GetFontSourceType(This,index) (This)->lpVtbl->GetFontSourceType(This,index) -#define IDWriteFontSet3_GetFontSourceNameLength(This,index) (This)->lpVtbl->GetFontSourceNameLength(This,index) -#define IDWriteFontSet3_GetFontSourceName(This,index,buffer,buffer_size) (This)->lpVtbl->GetFontSourceName(This,index,buffer,buffer_size) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontSet3_QueryInterface(IDWriteFontSet3* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontSet3_AddRef(IDWriteFontSet3* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontSet3_Release(IDWriteFontSet3* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontSet methods ***/ -static FORCEINLINE UINT32 IDWriteFontSet3_GetFontCount(IDWriteFontSet3* This) { - return This->lpVtbl->GetFontCount(This); -} -static FORCEINLINE HRESULT IDWriteFontSet3_FindFontFaceReference(IDWriteFontSet3* This,IDWriteFontFaceReference *reference,UINT32 *index,WINBOOL *exists) { - return This->lpVtbl->FindFontFaceReference(This,reference,index,exists); -} -static FORCEINLINE HRESULT IDWriteFontSet3_FindFontFace(IDWriteFontSet3* This,IDWriteFontFace *fontface,UINT32 *index,WINBOOL *exists) { - return This->lpVtbl->FindFontFace(This,fontface,index,exists); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetPropertyValues__(IDWriteFontSet3* This,DWRITE_FONT_PROPERTY_ID id,IDWriteStringList **values) { - return This->lpVtbl->GetPropertyValues__(This,id,values); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetPropertyValues_(IDWriteFontSet3* This,DWRITE_FONT_PROPERTY_ID id,const WCHAR *preferred_locales,IDWriteStringList **values) { - return This->lpVtbl->GetPropertyValues_(This,id,preferred_locales,values); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetPropertyValues(IDWriteFontSet3* This,UINT32 index,DWRITE_FONT_PROPERTY_ID id,WINBOOL *exists,IDWriteLocalizedStrings **values) { - return This->lpVtbl->GetPropertyValues(This,index,id,exists,values); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetPropertyOccurrenceCount(IDWriteFontSet3* This,const DWRITE_FONT_PROPERTY *property,UINT32 *count) { - return This->lpVtbl->GetPropertyOccurrenceCount(This,property,count); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetMatchingFonts_(IDWriteFontSet3* This,const WCHAR *family,DWRITE_FONT_WEIGHT weight,DWRITE_FONT_STRETCH stretch,DWRITE_FONT_STYLE style,IDWriteFontSet **fontset) { - return This->lpVtbl->GetMatchingFonts_(This,family,weight,stretch,style,fontset); -} -/*** IDWriteFontSet1 methods ***/ -static FORCEINLINE HRESULT IDWriteFontSet3_GetMatchingFonts(IDWriteFontSet3* This,const DWRITE_FONT_PROPERTY *property,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values,IDWriteFontSet1 **fontset) { - return This->lpVtbl->IDWriteFontSet1_GetMatchingFonts(This,property,axis_values,num_values,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetFirstFontResources(IDWriteFontSet3* This,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFirstFontResources(This,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetFilteredFonts__(IDWriteFontSet3* This,const UINT32 *indices,UINT32 num_indices,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFilteredFonts__(This,indices,num_indices,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetFilteredFonts_(IDWriteFontSet3* This,const DWRITE_FONT_AXIS_RANGE *axis_ranges,UINT32 num_ranges,WINBOOL select_any_range,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFilteredFonts_(This,axis_ranges,num_ranges,select_any_range,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetFilteredFonts(IDWriteFontSet3* This,const DWRITE_FONT_PROPERTY *props,UINT32 num_properties,WINBOOL select_any_property,IDWriteFontSet1 **fontset) { - return This->lpVtbl->GetFilteredFonts(This,props,num_properties,select_any_property,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetFilteredFontIndices_(IDWriteFontSet3* This,const DWRITE_FONT_AXIS_RANGE *ranges,UINT32 num_ranges,WINBOOL select_any_range,UINT32 *indices,UINT32 num_indices,UINT32 *actual_num_indices) { - return This->lpVtbl->GetFilteredFontIndices_(This,ranges,num_ranges,select_any_range,indices,num_indices,actual_num_indices); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetFilteredFontIndices(IDWriteFontSet3* This,const DWRITE_FONT_PROPERTY *props,UINT32 num_properties,WINBOOL select_any_range,UINT32 *indices,UINT32 num_indices,UINT32 *actual_num_indices) { - return This->lpVtbl->GetFilteredFontIndices(This,props,num_properties,select_any_range,indices,num_indices,actual_num_indices); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetFontAxisRanges_(IDWriteFontSet3* This,UINT32 font_index,DWRITE_FONT_AXIS_RANGE *axis_ranges,UINT32 num_ranges,UINT32 *actual_num_ranges) { - return This->lpVtbl->GetFontAxisRanges_(This,font_index,axis_ranges,num_ranges,actual_num_ranges); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetFontAxisRanges(IDWriteFontSet3* This,DWRITE_FONT_AXIS_RANGE *axis_ranges,UINT32 num_ranges,UINT32 *actual_num_ranges) { - return This->lpVtbl->GetFontAxisRanges(This,axis_ranges,num_ranges,actual_num_ranges); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetFontFaceReference(IDWriteFontSet3* This,UINT32 index,IDWriteFontFaceReference1 **reference) { - return This->lpVtbl->IDWriteFontSet1_GetFontFaceReference(This,index,reference); -} -static FORCEINLINE HRESULT IDWriteFontSet3_CreateFontResource(IDWriteFontSet3* This,UINT32 index,IDWriteFontResource **resource) { - return This->lpVtbl->CreateFontResource(This,index,resource); -} -static FORCEINLINE HRESULT IDWriteFontSet3_CreateFontFace(IDWriteFontSet3* This,UINT32 index,IDWriteFontFace5 **fontface) { - return This->lpVtbl->CreateFontFace(This,index,fontface); -} -static FORCEINLINE DWRITE_LOCALITY IDWriteFontSet3_GetFontLocality(IDWriteFontSet3* This,UINT32 index) { - return This->lpVtbl->GetFontLocality(This,index); -} -/*** IDWriteFontSet2 methods ***/ -static FORCEINLINE HANDLE IDWriteFontSet3_GetExpirationEvent(IDWriteFontSet3* This) { - return This->lpVtbl->GetExpirationEvent(This); -} -/*** IDWriteFontSet3 methods ***/ -static FORCEINLINE DWRITE_FONT_SOURCE_TYPE IDWriteFontSet3_GetFontSourceType(IDWriteFontSet3* This,UINT32 index) { - return This->lpVtbl->GetFontSourceType(This,index); -} -static FORCEINLINE UINT32 IDWriteFontSet3_GetFontSourceNameLength(IDWriteFontSet3* This,UINT32 index) { - return This->lpVtbl->GetFontSourceNameLength(This,index); -} -static FORCEINLINE HRESULT IDWriteFontSet3_GetFontSourceName(IDWriteFontSet3* This,UINT32 index,WCHAR *buffer,UINT32 buffer_size) { - return This->lpVtbl->GetFontSourceName(This,index,buffer,buffer_size); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontSet3_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontFace3 interface - */ -#ifndef __IDWriteFontFace3_INTERFACE_DEFINED__ -#define __IDWriteFontFace3_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontFace3, 0xd37d7598, 0x09be, 0x4222, 0xa2,0x36, 0x20,0x81,0x34,0x1c,0xc1,0xf2); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("d37d7598-09be-4222-a236-2081341cc1f2") -IDWriteFontFace3 : public IDWriteFontFace2 -{ - virtual HRESULT STDMETHODCALLTYPE GetFontFaceReference( - IDWriteFontFaceReference **reference) = 0; - - virtual void STDMETHODCALLTYPE GetPanose( - DWRITE_PANOSE *panose) = 0; - - virtual DWRITE_FONT_WEIGHT STDMETHODCALLTYPE GetWeight( - ) = 0; - - virtual DWRITE_FONT_STRETCH STDMETHODCALLTYPE GetStretch( - ) = 0; - - virtual DWRITE_FONT_STYLE STDMETHODCALLTYPE GetStyle( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFamilyNames( - IDWriteLocalizedStrings **names) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFaceNames( - IDWriteLocalizedStrings **names) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetInformationalStrings( - DWRITE_INFORMATIONAL_STRING_ID stringid, - IDWriteLocalizedStrings **strings, - WINBOOL *exists) = 0; - - virtual WINBOOL STDMETHODCALLTYPE HasCharacter( - UINT32 character) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetRecommendedRenderingMode( - FLOAT emsize, - FLOAT dpi_x, - FLOAT dpi_y, - const DWRITE_MATRIX *transform, - WINBOOL is_sideways, - DWRITE_OUTLINE_THRESHOLD threshold, - DWRITE_MEASURING_MODE measuring_mode, - IDWriteRenderingParams *params, - DWRITE_RENDERING_MODE1 *rendering_mode, - DWRITE_GRID_FIT_MODE *gridfit_mode) = 0; - - virtual WINBOOL STDMETHODCALLTYPE IsCharacterLocal( - UINT32 character) = 0; - - virtual WINBOOL STDMETHODCALLTYPE IsGlyphLocal( - UINT16 glyph) = 0; - - virtual HRESULT STDMETHODCALLTYPE AreCharactersLocal( - const WCHAR *characters, - UINT32 count, - WINBOOL enqueue_if_not, - WINBOOL *are_local) = 0; - - virtual HRESULT STDMETHODCALLTYPE AreGlyphsLocal( - const UINT16 *glyphs, - UINT32 count, - WINBOOL enqueue_if_not, - WINBOOL *are_local) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontFace3, 0xd37d7598, 0x09be, 0x4222, 0xa2,0x36, 0x20,0x81,0x34,0x1c,0xc1,0xf2) -#endif -#else -typedef struct IDWriteFontFace3Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontFace3 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontFace3 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontFace3 *This); - - /*** IDWriteFontFace methods ***/ - DWRITE_FONT_FACE_TYPE (STDMETHODCALLTYPE *GetType)( - IDWriteFontFace3 *This); - - HRESULT (STDMETHODCALLTYPE *GetFiles)( - IDWriteFontFace3 *This, - UINT32 *number_of_files, - IDWriteFontFile **fontfiles); - - UINT32 (STDMETHODCALLTYPE *GetIndex)( - IDWriteFontFace3 *This); - - DWRITE_FONT_SIMULATIONS (STDMETHODCALLTYPE *GetSimulations)( - IDWriteFontFace3 *This); - - WINBOOL (STDMETHODCALLTYPE *IsSymbolFont)( - IDWriteFontFace3 *This); - - void (STDMETHODCALLTYPE *GetMetrics)( - IDWriteFontFace3 *This, - DWRITE_FONT_METRICS *metrics); - - UINT16 (STDMETHODCALLTYPE *GetGlyphCount)( - IDWriteFontFace3 *This); - - HRESULT (STDMETHODCALLTYPE *GetDesignGlyphMetrics)( - IDWriteFontFace3 *This, - const UINT16 *glyph_indices, - UINT32 glyph_count, - DWRITE_GLYPH_METRICS *metrics, - WINBOOL is_sideways); - - HRESULT (STDMETHODCALLTYPE *GetGlyphIndices)( - IDWriteFontFace3 *This, - const UINT32 *codepoints, - UINT32 count, - UINT16 *glyph_indices); - - HRESULT (STDMETHODCALLTYPE *TryGetFontTable)( - IDWriteFontFace3 *This, - UINT32 table_tag, - const void **table_data, - UINT32 *table_size, - void **context, - WINBOOL *exists); - - void (STDMETHODCALLTYPE *ReleaseFontTable)( - IDWriteFontFace3 *This, - void *table_context); - - HRESULT (STDMETHODCALLTYPE *GetGlyphRunOutline)( - IDWriteFontFace3 *This, - FLOAT emSize, - const UINT16 *glyph_indices, - const FLOAT *glyph_advances, - const DWRITE_GLYPH_OFFSET *glyph_offsets, - UINT32 glyph_count, - WINBOOL is_sideways, - WINBOOL is_rtl, - IDWriteGeometrySink *geometrysink); - - HRESULT (STDMETHODCALLTYPE *GetRecommendedRenderingMode)( - IDWriteFontFace3 *This, - FLOAT emSize, - FLOAT pixels_per_dip, - DWRITE_MEASURING_MODE mode, - IDWriteRenderingParams *params, - DWRITE_RENDERING_MODE *rendering_mode); - - using IDWriteFontFace2::GetRecommendedRenderingMode; - - HRESULT (STDMETHODCALLTYPE *GetGdiCompatibleMetrics)( - IDWriteFontFace3 *This, - FLOAT emSize, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - DWRITE_FONT_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *GetGdiCompatibleGlyphMetrics)( - IDWriteFontFace3 *This, - FLOAT emSize, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - WINBOOL use_gdi_natural, - const UINT16 *glyph_indices, - UINT32 glyph_count, - DWRITE_GLYPH_METRICS *metrics, - WINBOOL is_sideways); - - /*** IDWriteFontFace1 methods ***/ - void (STDMETHODCALLTYPE *IDWriteFontFace1_GetMetrics)( - IDWriteFontFace3 *This, - DWRITE_FONT_METRICS1 *metrics); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFace1_GetGdiCompatibleMetrics)( - IDWriteFontFace3 *This, - FLOAT em_size, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - DWRITE_FONT_METRICS1 *metrics); - - void (STDMETHODCALLTYPE *GetCaretMetrics)( - IDWriteFontFace3 *This, - DWRITE_CARET_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *GetUnicodeRanges)( - IDWriteFontFace3 *This, - UINT32 max_count, - DWRITE_UNICODE_RANGE *ranges, - UINT32 *count); - - WINBOOL (STDMETHODCALLTYPE *IsMonospacedFont)( - IDWriteFontFace3 *This); - - HRESULT (STDMETHODCALLTYPE *GetDesignGlyphAdvances)( - IDWriteFontFace3 *This, - UINT32 glyph_count, - const UINT16 *indices, - INT32 *advances, - WINBOOL is_sideways); - - HRESULT (STDMETHODCALLTYPE *GetGdiCompatibleGlyphAdvances)( - IDWriteFontFace3 *This, - FLOAT em_size, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - WINBOOL use_gdi_natural, - WINBOOL is_sideways, - UINT32 glyph_count, - const UINT16 *indices, - INT32 *advances); - - HRESULT (STDMETHODCALLTYPE *GetKerningPairAdjustments)( - IDWriteFontFace3 *This, - UINT32 glyph_count, - const UINT16 *indices, - INT32 *adjustments); - - WINBOOL (STDMETHODCALLTYPE *HasKerningPairs)( - IDWriteFontFace3 *This); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFace1_GetRecommendedRenderingMode)( - IDWriteFontFace3 *This, - FLOAT font_emsize, - FLOAT dpiX, - FLOAT dpiY, - const DWRITE_MATRIX *transform, - WINBOOL is_sideways, - DWRITE_OUTLINE_THRESHOLD threshold, - DWRITE_MEASURING_MODE measuring_mode, - DWRITE_RENDERING_MODE *rendering_mode); - - HRESULT (STDMETHODCALLTYPE *GetVerticalGlyphVariants)( - IDWriteFontFace3 *This, - UINT32 glyph_count, - const UINT16 *nominal_indices, - UINT16 *vertical_indices); - - WINBOOL (STDMETHODCALLTYPE *HasVerticalGlyphVariants)( - IDWriteFontFace3 *This); - - /*** IDWriteFontFace2 methods ***/ - WINBOOL (STDMETHODCALLTYPE *IsColorFont)( - IDWriteFontFace3 *This); - - UINT32 (STDMETHODCALLTYPE *GetColorPaletteCount)( - IDWriteFontFace3 *This); - - UINT32 (STDMETHODCALLTYPE *GetPaletteEntryCount)( - IDWriteFontFace3 *This); - - HRESULT (STDMETHODCALLTYPE *GetPaletteEntries)( - IDWriteFontFace3 *This, - UINT32 palette_index, - UINT32 first_entry_index, - UINT32 entry_count, - DWRITE_COLOR_F *entries); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFace2_GetRecommendedRenderingMode)( - IDWriteFontFace3 *This, - FLOAT fontEmSize, - FLOAT dpiX, - FLOAT dpiY, - const DWRITE_MATRIX *transform, - WINBOOL is_sideways, - DWRITE_OUTLINE_THRESHOLD threshold, - DWRITE_MEASURING_MODE measuringmode, - IDWriteRenderingParams *params, - DWRITE_RENDERING_MODE *renderingmode, - DWRITE_GRID_FIT_MODE *gridfitmode); - - /*** IDWriteFontFace3 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontFaceReference)( - IDWriteFontFace3 *This, - IDWriteFontFaceReference **reference); - - void (STDMETHODCALLTYPE *GetPanose)( - IDWriteFontFace3 *This, - DWRITE_PANOSE *panose); - - DWRITE_FONT_WEIGHT (STDMETHODCALLTYPE *GetWeight)( - IDWriteFontFace3 *This); - - DWRITE_FONT_STRETCH (STDMETHODCALLTYPE *GetStretch)( - IDWriteFontFace3 *This); - - DWRITE_FONT_STYLE (STDMETHODCALLTYPE *GetStyle)( - IDWriteFontFace3 *This); - - HRESULT (STDMETHODCALLTYPE *GetFamilyNames)( - IDWriteFontFace3 *This, - IDWriteLocalizedStrings **names); - - HRESULT (STDMETHODCALLTYPE *GetFaceNames)( - IDWriteFontFace3 *This, - IDWriteLocalizedStrings **names); - - HRESULT (STDMETHODCALLTYPE *GetInformationalStrings)( - IDWriteFontFace3 *This, - DWRITE_INFORMATIONAL_STRING_ID stringid, - IDWriteLocalizedStrings **strings, - WINBOOL *exists); - - WINBOOL (STDMETHODCALLTYPE *HasCharacter)( - IDWriteFontFace3 *This, - UINT32 character); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFace3_GetRecommendedRenderingMode)( - IDWriteFontFace3 *This, - FLOAT emsize, - FLOAT dpi_x, - FLOAT dpi_y, - const DWRITE_MATRIX *transform, - WINBOOL is_sideways, - DWRITE_OUTLINE_THRESHOLD threshold, - DWRITE_MEASURING_MODE measuring_mode, - IDWriteRenderingParams *params, - DWRITE_RENDERING_MODE1 *rendering_mode, - DWRITE_GRID_FIT_MODE *gridfit_mode); - - WINBOOL (STDMETHODCALLTYPE *IsCharacterLocal)( - IDWriteFontFace3 *This, - UINT32 character); - - WINBOOL (STDMETHODCALLTYPE *IsGlyphLocal)( - IDWriteFontFace3 *This, - UINT16 glyph); - - HRESULT (STDMETHODCALLTYPE *AreCharactersLocal)( - IDWriteFontFace3 *This, - const WCHAR *characters, - UINT32 count, - WINBOOL enqueue_if_not, - WINBOOL *are_local); - - HRESULT (STDMETHODCALLTYPE *AreGlyphsLocal)( - IDWriteFontFace3 *This, - const UINT16 *glyphs, - UINT32 count, - WINBOOL enqueue_if_not, - WINBOOL *are_local); - - END_INTERFACE -} IDWriteFontFace3Vtbl; - -interface IDWriteFontFace3 { - CONST_VTBL IDWriteFontFace3Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontFace3_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontFace3_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontFace3_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontFace methods ***/ -#define IDWriteFontFace3_GetType(This) (This)->lpVtbl->GetType(This) -#define IDWriteFontFace3_GetFiles(This,number_of_files,fontfiles) (This)->lpVtbl->GetFiles(This,number_of_files,fontfiles) -#define IDWriteFontFace3_GetIndex(This) (This)->lpVtbl->GetIndex(This) -#define IDWriteFontFace3_GetSimulations(This) (This)->lpVtbl->GetSimulations(This) -#define IDWriteFontFace3_IsSymbolFont(This) (This)->lpVtbl->IsSymbolFont(This) -#define IDWriteFontFace3_GetGlyphCount(This) (This)->lpVtbl->GetGlyphCount(This) -#define IDWriteFontFace3_GetDesignGlyphMetrics(This,glyph_indices,glyph_count,metrics,is_sideways) (This)->lpVtbl->GetDesignGlyphMetrics(This,glyph_indices,glyph_count,metrics,is_sideways) -#define IDWriteFontFace3_GetGlyphIndices(This,codepoints,count,glyph_indices) (This)->lpVtbl->GetGlyphIndices(This,codepoints,count,glyph_indices) -#define IDWriteFontFace3_TryGetFontTable(This,table_tag,table_data,table_size,context,exists) (This)->lpVtbl->TryGetFontTable(This,table_tag,table_data,table_size,context,exists) -#define IDWriteFontFace3_ReleaseFontTable(This,table_context) (This)->lpVtbl->ReleaseFontTable(This,table_context) -#define IDWriteFontFace3_GetGlyphRunOutline(This,emSize,glyph_indices,glyph_advances,glyph_offsets,glyph_count,is_sideways,is_rtl,geometrysink) (This)->lpVtbl->GetGlyphRunOutline(This,emSize,glyph_indices,glyph_advances,glyph_offsets,glyph_count,is_sideways,is_rtl,geometrysink) -#define IDWriteFontFace3_GetGdiCompatibleGlyphMetrics(This,emSize,pixels_per_dip,transform,use_gdi_natural,glyph_indices,glyph_count,metrics,is_sideways) (This)->lpVtbl->GetGdiCompatibleGlyphMetrics(This,emSize,pixels_per_dip,transform,use_gdi_natural,glyph_indices,glyph_count,metrics,is_sideways) -/*** IDWriteFontFace1 methods ***/ -#define IDWriteFontFace3_GetMetrics(This,metrics) (This)->lpVtbl->IDWriteFontFace1_GetMetrics(This,metrics) -#define IDWriteFontFace3_GetGdiCompatibleMetrics(This,em_size,pixels_per_dip,transform,metrics) (This)->lpVtbl->IDWriteFontFace1_GetGdiCompatibleMetrics(This,em_size,pixels_per_dip,transform,metrics) -#define IDWriteFontFace3_GetCaretMetrics(This,metrics) (This)->lpVtbl->GetCaretMetrics(This,metrics) -#define IDWriteFontFace3_GetUnicodeRanges(This,max_count,ranges,count) (This)->lpVtbl->GetUnicodeRanges(This,max_count,ranges,count) -#define IDWriteFontFace3_IsMonospacedFont(This) (This)->lpVtbl->IsMonospacedFont(This) -#define IDWriteFontFace3_GetDesignGlyphAdvances(This,glyph_count,indices,advances,is_sideways) (This)->lpVtbl->GetDesignGlyphAdvances(This,glyph_count,indices,advances,is_sideways) -#define IDWriteFontFace3_GetGdiCompatibleGlyphAdvances(This,em_size,pixels_per_dip,transform,use_gdi_natural,is_sideways,glyph_count,indices,advances) (This)->lpVtbl->GetGdiCompatibleGlyphAdvances(This,em_size,pixels_per_dip,transform,use_gdi_natural,is_sideways,glyph_count,indices,advances) -#define IDWriteFontFace3_GetKerningPairAdjustments(This,glyph_count,indices,adjustments) (This)->lpVtbl->GetKerningPairAdjustments(This,glyph_count,indices,adjustments) -#define IDWriteFontFace3_HasKerningPairs(This) (This)->lpVtbl->HasKerningPairs(This) -#define IDWriteFontFace3_GetVerticalGlyphVariants(This,glyph_count,nominal_indices,vertical_indices) (This)->lpVtbl->GetVerticalGlyphVariants(This,glyph_count,nominal_indices,vertical_indices) -#define IDWriteFontFace3_HasVerticalGlyphVariants(This) (This)->lpVtbl->HasVerticalGlyphVariants(This) -/*** IDWriteFontFace2 methods ***/ -#define IDWriteFontFace3_IsColorFont(This) (This)->lpVtbl->IsColorFont(This) -#define IDWriteFontFace3_GetColorPaletteCount(This) (This)->lpVtbl->GetColorPaletteCount(This) -#define IDWriteFontFace3_GetPaletteEntryCount(This) (This)->lpVtbl->GetPaletteEntryCount(This) -#define IDWriteFontFace3_GetPaletteEntries(This,palette_index,first_entry_index,entry_count,entries) (This)->lpVtbl->GetPaletteEntries(This,palette_index,first_entry_index,entry_count,entries) -/*** IDWriteFontFace3 methods ***/ -#define IDWriteFontFace3_GetFontFaceReference(This,reference) (This)->lpVtbl->GetFontFaceReference(This,reference) -#define IDWriteFontFace3_GetPanose(This,panose) (This)->lpVtbl->GetPanose(This,panose) -#define IDWriteFontFace3_GetWeight(This) (This)->lpVtbl->GetWeight(This) -#define IDWriteFontFace3_GetStretch(This) (This)->lpVtbl->GetStretch(This) -#define IDWriteFontFace3_GetStyle(This) (This)->lpVtbl->GetStyle(This) -#define IDWriteFontFace3_GetFamilyNames(This,names) (This)->lpVtbl->GetFamilyNames(This,names) -#define IDWriteFontFace3_GetFaceNames(This,names) (This)->lpVtbl->GetFaceNames(This,names) -#define IDWriteFontFace3_GetInformationalStrings(This,stringid,strings,exists) (This)->lpVtbl->GetInformationalStrings(This,stringid,strings,exists) -#define IDWriteFontFace3_HasCharacter(This,character) (This)->lpVtbl->HasCharacter(This,character) -#define IDWriteFontFace3_GetRecommendedRenderingMode(This,emsize,dpi_x,dpi_y,transform,is_sideways,threshold,measuring_mode,params,rendering_mode,gridfit_mode) (This)->lpVtbl->IDWriteFontFace3_GetRecommendedRenderingMode(This,emsize,dpi_x,dpi_y,transform,is_sideways,threshold,measuring_mode,params,rendering_mode,gridfit_mode) -#define IDWriteFontFace3_IsCharacterLocal(This,character) (This)->lpVtbl->IsCharacterLocal(This,character) -#define IDWriteFontFace3_IsGlyphLocal(This,glyph) (This)->lpVtbl->IsGlyphLocal(This,glyph) -#define IDWriteFontFace3_AreCharactersLocal(This,characters,count,enqueue_if_not,are_local) (This)->lpVtbl->AreCharactersLocal(This,characters,count,enqueue_if_not,are_local) -#define IDWriteFontFace3_AreGlyphsLocal(This,glyphs,count,enqueue_if_not,are_local) (This)->lpVtbl->AreGlyphsLocal(This,glyphs,count,enqueue_if_not,are_local) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontFace3_QueryInterface(IDWriteFontFace3* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontFace3_AddRef(IDWriteFontFace3* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontFace3_Release(IDWriteFontFace3* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontFace methods ***/ -static FORCEINLINE DWRITE_FONT_FACE_TYPE IDWriteFontFace3_GetType(IDWriteFontFace3* This) { - return This->lpVtbl->GetType(This); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetFiles(IDWriteFontFace3* This,UINT32 *number_of_files,IDWriteFontFile **fontfiles) { - return This->lpVtbl->GetFiles(This,number_of_files,fontfiles); -} -static FORCEINLINE UINT32 IDWriteFontFace3_GetIndex(IDWriteFontFace3* This) { - return This->lpVtbl->GetIndex(This); -} -static FORCEINLINE DWRITE_FONT_SIMULATIONS IDWriteFontFace3_GetSimulations(IDWriteFontFace3* This) { - return This->lpVtbl->GetSimulations(This); -} -static FORCEINLINE WINBOOL IDWriteFontFace3_IsSymbolFont(IDWriteFontFace3* This) { - return This->lpVtbl->IsSymbolFont(This); -} -static FORCEINLINE UINT16 IDWriteFontFace3_GetGlyphCount(IDWriteFontFace3* This) { - return This->lpVtbl->GetGlyphCount(This); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetDesignGlyphMetrics(IDWriteFontFace3* This,const UINT16 *glyph_indices,UINT32 glyph_count,DWRITE_GLYPH_METRICS *metrics,WINBOOL is_sideways) { - return This->lpVtbl->GetDesignGlyphMetrics(This,glyph_indices,glyph_count,metrics,is_sideways); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetGlyphIndices(IDWriteFontFace3* This,const UINT32 *codepoints,UINT32 count,UINT16 *glyph_indices) { - return This->lpVtbl->GetGlyphIndices(This,codepoints,count,glyph_indices); -} -static FORCEINLINE HRESULT IDWriteFontFace3_TryGetFontTable(IDWriteFontFace3* This,UINT32 table_tag,const void **table_data,UINT32 *table_size,void **context,WINBOOL *exists) { - return This->lpVtbl->TryGetFontTable(This,table_tag,table_data,table_size,context,exists); -} -static FORCEINLINE void IDWriteFontFace3_ReleaseFontTable(IDWriteFontFace3* This,void *table_context) { - This->lpVtbl->ReleaseFontTable(This,table_context); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetGlyphRunOutline(IDWriteFontFace3* This,FLOAT emSize,const UINT16 *glyph_indices,const FLOAT *glyph_advances,const DWRITE_GLYPH_OFFSET *glyph_offsets,UINT32 glyph_count,WINBOOL is_sideways,WINBOOL is_rtl,IDWriteGeometrySink *geometrysink) { - return This->lpVtbl->GetGlyphRunOutline(This,emSize,glyph_indices,glyph_advances,glyph_offsets,glyph_count,is_sideways,is_rtl,geometrysink); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetGdiCompatibleGlyphMetrics(IDWriteFontFace3* This,FLOAT emSize,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,WINBOOL use_gdi_natural,const UINT16 *glyph_indices,UINT32 glyph_count,DWRITE_GLYPH_METRICS *metrics,WINBOOL is_sideways) { - return This->lpVtbl->GetGdiCompatibleGlyphMetrics(This,emSize,pixels_per_dip,transform,use_gdi_natural,glyph_indices,glyph_count,metrics,is_sideways); -} -/*** IDWriteFontFace1 methods ***/ -static FORCEINLINE void IDWriteFontFace3_GetMetrics(IDWriteFontFace3* This,DWRITE_FONT_METRICS1 *metrics) { - This->lpVtbl->IDWriteFontFace1_GetMetrics(This,metrics); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetGdiCompatibleMetrics(IDWriteFontFace3* This,FLOAT em_size,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,DWRITE_FONT_METRICS1 *metrics) { - return This->lpVtbl->IDWriteFontFace1_GetGdiCompatibleMetrics(This,em_size,pixels_per_dip,transform,metrics); -} -static FORCEINLINE void IDWriteFontFace3_GetCaretMetrics(IDWriteFontFace3* This,DWRITE_CARET_METRICS *metrics) { - This->lpVtbl->GetCaretMetrics(This,metrics); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetUnicodeRanges(IDWriteFontFace3* This,UINT32 max_count,DWRITE_UNICODE_RANGE *ranges,UINT32 *count) { - return This->lpVtbl->GetUnicodeRanges(This,max_count,ranges,count); -} -static FORCEINLINE WINBOOL IDWriteFontFace3_IsMonospacedFont(IDWriteFontFace3* This) { - return This->lpVtbl->IsMonospacedFont(This); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetDesignGlyphAdvances(IDWriteFontFace3* This,UINT32 glyph_count,const UINT16 *indices,INT32 *advances,WINBOOL is_sideways) { - return This->lpVtbl->GetDesignGlyphAdvances(This,glyph_count,indices,advances,is_sideways); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetGdiCompatibleGlyphAdvances(IDWriteFontFace3* This,FLOAT em_size,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,WINBOOL use_gdi_natural,WINBOOL is_sideways,UINT32 glyph_count,const UINT16 *indices,INT32 *advances) { - return This->lpVtbl->GetGdiCompatibleGlyphAdvances(This,em_size,pixels_per_dip,transform,use_gdi_natural,is_sideways,glyph_count,indices,advances); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetKerningPairAdjustments(IDWriteFontFace3* This,UINT32 glyph_count,const UINT16 *indices,INT32 *adjustments) { - return This->lpVtbl->GetKerningPairAdjustments(This,glyph_count,indices,adjustments); -} -static FORCEINLINE WINBOOL IDWriteFontFace3_HasKerningPairs(IDWriteFontFace3* This) { - return This->lpVtbl->HasKerningPairs(This); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetVerticalGlyphVariants(IDWriteFontFace3* This,UINT32 glyph_count,const UINT16 *nominal_indices,UINT16 *vertical_indices) { - return This->lpVtbl->GetVerticalGlyphVariants(This,glyph_count,nominal_indices,vertical_indices); -} -static FORCEINLINE WINBOOL IDWriteFontFace3_HasVerticalGlyphVariants(IDWriteFontFace3* This) { - return This->lpVtbl->HasVerticalGlyphVariants(This); -} -/*** IDWriteFontFace2 methods ***/ -static FORCEINLINE WINBOOL IDWriteFontFace3_IsColorFont(IDWriteFontFace3* This) { - return This->lpVtbl->IsColorFont(This); -} -static FORCEINLINE UINT32 IDWriteFontFace3_GetColorPaletteCount(IDWriteFontFace3* This) { - return This->lpVtbl->GetColorPaletteCount(This); -} -static FORCEINLINE UINT32 IDWriteFontFace3_GetPaletteEntryCount(IDWriteFontFace3* This) { - return This->lpVtbl->GetPaletteEntryCount(This); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetPaletteEntries(IDWriteFontFace3* This,UINT32 palette_index,UINT32 first_entry_index,UINT32 entry_count,DWRITE_COLOR_F *entries) { - return This->lpVtbl->GetPaletteEntries(This,palette_index,first_entry_index,entry_count,entries); -} -/*** IDWriteFontFace3 methods ***/ -static FORCEINLINE HRESULT IDWriteFontFace3_GetFontFaceReference(IDWriteFontFace3* This,IDWriteFontFaceReference **reference) { - return This->lpVtbl->GetFontFaceReference(This,reference); -} -static FORCEINLINE void IDWriteFontFace3_GetPanose(IDWriteFontFace3* This,DWRITE_PANOSE *panose) { - This->lpVtbl->GetPanose(This,panose); -} -static FORCEINLINE DWRITE_FONT_WEIGHT IDWriteFontFace3_GetWeight(IDWriteFontFace3* This) { - return This->lpVtbl->GetWeight(This); -} -static FORCEINLINE DWRITE_FONT_STRETCH IDWriteFontFace3_GetStretch(IDWriteFontFace3* This) { - return This->lpVtbl->GetStretch(This); -} -static FORCEINLINE DWRITE_FONT_STYLE IDWriteFontFace3_GetStyle(IDWriteFontFace3* This) { - return This->lpVtbl->GetStyle(This); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetFamilyNames(IDWriteFontFace3* This,IDWriteLocalizedStrings **names) { - return This->lpVtbl->GetFamilyNames(This,names); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetFaceNames(IDWriteFontFace3* This,IDWriteLocalizedStrings **names) { - return This->lpVtbl->GetFaceNames(This,names); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetInformationalStrings(IDWriteFontFace3* This,DWRITE_INFORMATIONAL_STRING_ID stringid,IDWriteLocalizedStrings **strings,WINBOOL *exists) { - return This->lpVtbl->GetInformationalStrings(This,stringid,strings,exists); -} -static FORCEINLINE WINBOOL IDWriteFontFace3_HasCharacter(IDWriteFontFace3* This,UINT32 character) { - return This->lpVtbl->HasCharacter(This,character); -} -static FORCEINLINE HRESULT IDWriteFontFace3_GetRecommendedRenderingMode(IDWriteFontFace3* This,FLOAT emsize,FLOAT dpi_x,FLOAT dpi_y,const DWRITE_MATRIX *transform,WINBOOL is_sideways,DWRITE_OUTLINE_THRESHOLD threshold,DWRITE_MEASURING_MODE measuring_mode,IDWriteRenderingParams *params,DWRITE_RENDERING_MODE1 *rendering_mode,DWRITE_GRID_FIT_MODE *gridfit_mode) { - return This->lpVtbl->IDWriteFontFace3_GetRecommendedRenderingMode(This,emsize,dpi_x,dpi_y,transform,is_sideways,threshold,measuring_mode,params,rendering_mode,gridfit_mode); -} -static FORCEINLINE WINBOOL IDWriteFontFace3_IsCharacterLocal(IDWriteFontFace3* This,UINT32 character) { - return This->lpVtbl->IsCharacterLocal(This,character); -} -static FORCEINLINE WINBOOL IDWriteFontFace3_IsGlyphLocal(IDWriteFontFace3* This,UINT16 glyph) { - return This->lpVtbl->IsGlyphLocal(This,glyph); -} -static FORCEINLINE HRESULT IDWriteFontFace3_AreCharactersLocal(IDWriteFontFace3* This,const WCHAR *characters,UINT32 count,WINBOOL enqueue_if_not,WINBOOL *are_local) { - return This->lpVtbl->AreCharactersLocal(This,characters,count,enqueue_if_not,are_local); -} -static FORCEINLINE HRESULT IDWriteFontFace3_AreGlyphsLocal(IDWriteFontFace3* This,const UINT16 *glyphs,UINT32 count,WINBOOL enqueue_if_not,WINBOOL *are_local) { - return This->lpVtbl->AreGlyphsLocal(This,glyphs,count,enqueue_if_not,are_local); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontFace3_INTERFACE_DEFINED__ */ - -typedef struct DWRITE_LINE_METRICS1 { - UINT32 length; - UINT32 trailingWhitespaceLength; - UINT32 newlineLength; - FLOAT height; - FLOAT baseline; - WINBOOL isTrimmed; - FLOAT leadingBefore; - FLOAT leadingAfter; -} DWRITE_LINE_METRICS1; -typedef enum DWRITE_FONT_LINE_GAP_USAGE { - DWRITE_FONT_LINE_GAP_USAGE_DEFAULT = 0, - DWRITE_FONT_LINE_GAP_USAGE_DISABLED = 1, - DWRITE_FONT_LINE_GAP_USAGE_ENABLED = 2 -} DWRITE_FONT_LINE_GAP_USAGE; -typedef struct DWRITE_LINE_SPACING { - DWRITE_LINE_SPACING_METHOD method; - FLOAT height; - FLOAT baseline; - FLOAT leadingBefore; - DWRITE_FONT_LINE_GAP_USAGE fontLineGapUsage; -} DWRITE_LINE_SPACING; -/***************************************************************************** - * IDWriteTextFormat2 interface - */ -#ifndef __IDWriteTextFormat2_INTERFACE_DEFINED__ -#define __IDWriteTextFormat2_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteTextFormat2, 0xf67e0edd, 0x9e3d, 0x4ecc, 0x8c,0x32, 0x41,0x83,0x25,0x3d,0xfe,0x70); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("f67e0edd-9e3d-4ecc-8c32-4183253dfe70") -IDWriteTextFormat2 : public IDWriteTextFormat1 -{ - virtual HRESULT STDMETHODCALLTYPE SetLineSpacing( - const DWRITE_LINE_SPACING *spacing) = 0; - - using IDWriteTextFormat1::SetLineSpacing; - - virtual HRESULT STDMETHODCALLTYPE GetLineSpacing( - DWRITE_LINE_SPACING *spacing) = 0; - - using IDWriteTextFormat1::GetLineSpacing; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteTextFormat2, 0xf67e0edd, 0x9e3d, 0x4ecc, 0x8c,0x32, 0x41,0x83,0x25,0x3d,0xfe,0x70) -#endif -#else -typedef struct IDWriteTextFormat2Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteTextFormat2 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteTextFormat2 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteTextFormat2 *This); - - /*** IDWriteTextFormat methods ***/ - HRESULT (STDMETHODCALLTYPE *SetTextAlignment)( - IDWriteTextFormat2 *This, - DWRITE_TEXT_ALIGNMENT alignment); - - HRESULT (STDMETHODCALLTYPE *SetParagraphAlignment)( - IDWriteTextFormat2 *This, - DWRITE_PARAGRAPH_ALIGNMENT alignment); - - HRESULT (STDMETHODCALLTYPE *SetWordWrapping)( - IDWriteTextFormat2 *This, - DWRITE_WORD_WRAPPING wrapping); - - HRESULT (STDMETHODCALLTYPE *SetReadingDirection)( - IDWriteTextFormat2 *This, - DWRITE_READING_DIRECTION direction); - - HRESULT (STDMETHODCALLTYPE *SetFlowDirection)( - IDWriteTextFormat2 *This, - DWRITE_FLOW_DIRECTION direction); - - HRESULT (STDMETHODCALLTYPE *SetIncrementalTabStop)( - IDWriteTextFormat2 *This, - FLOAT tabstop); - - HRESULT (STDMETHODCALLTYPE *SetTrimming)( - IDWriteTextFormat2 *This, - const DWRITE_TRIMMING *trimming, - IDWriteInlineObject *trimming_sign); - - HRESULT (STDMETHODCALLTYPE *SetLineSpacing)( - IDWriteTextFormat2 *This, - DWRITE_LINE_SPACING_METHOD spacing, - FLOAT line_spacing, - FLOAT baseline); - - DWRITE_TEXT_ALIGNMENT (STDMETHODCALLTYPE *GetTextAlignment)( - IDWriteTextFormat2 *This); - - DWRITE_PARAGRAPH_ALIGNMENT (STDMETHODCALLTYPE *GetParagraphAlignment)( - IDWriteTextFormat2 *This); - - DWRITE_WORD_WRAPPING (STDMETHODCALLTYPE *GetWordWrapping)( - IDWriteTextFormat2 *This); - - DWRITE_READING_DIRECTION (STDMETHODCALLTYPE *GetReadingDirection)( - IDWriteTextFormat2 *This); - - DWRITE_FLOW_DIRECTION (STDMETHODCALLTYPE *GetFlowDirection)( - IDWriteTextFormat2 *This); - - FLOAT (STDMETHODCALLTYPE *GetIncrementalTabStop)( - IDWriteTextFormat2 *This); - - HRESULT (STDMETHODCALLTYPE *GetTrimming)( - IDWriteTextFormat2 *This, - DWRITE_TRIMMING *options, - IDWriteInlineObject **trimming_sign); - - HRESULT (STDMETHODCALLTYPE *GetLineSpacing)( - IDWriteTextFormat2 *This, - DWRITE_LINE_SPACING_METHOD *method, - FLOAT *spacing, - FLOAT *baseline); - - HRESULT (STDMETHODCALLTYPE *GetFontCollection)( - IDWriteTextFormat2 *This, - IDWriteFontCollection **collection); - - UINT32 (STDMETHODCALLTYPE *GetFontFamilyNameLength)( - IDWriteTextFormat2 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFamilyName)( - IDWriteTextFormat2 *This, - WCHAR *name, - UINT32 size); - - DWRITE_FONT_WEIGHT (STDMETHODCALLTYPE *GetFontWeight)( - IDWriteTextFormat2 *This); - - DWRITE_FONT_STYLE (STDMETHODCALLTYPE *GetFontStyle)( - IDWriteTextFormat2 *This); - - DWRITE_FONT_STRETCH (STDMETHODCALLTYPE *GetFontStretch)( - IDWriteTextFormat2 *This); - - FLOAT (STDMETHODCALLTYPE *GetFontSize)( - IDWriteTextFormat2 *This); - - UINT32 (STDMETHODCALLTYPE *GetLocaleNameLength)( - IDWriteTextFormat2 *This); - - HRESULT (STDMETHODCALLTYPE *GetLocaleName)( - IDWriteTextFormat2 *This, - WCHAR *name, - UINT32 size); - - /*** IDWriteTextFormat1 methods ***/ - HRESULT (STDMETHODCALLTYPE *SetVerticalGlyphOrientation)( - IDWriteTextFormat2 *This, - DWRITE_VERTICAL_GLYPH_ORIENTATION orientation); - - DWRITE_VERTICAL_GLYPH_ORIENTATION (STDMETHODCALLTYPE *GetVerticalGlyphOrientation)( - IDWriteTextFormat2 *This); - - HRESULT (STDMETHODCALLTYPE *SetLastLineWrapping)( - IDWriteTextFormat2 *This, - WINBOOL lastline_wrapping_enabled); - - WINBOOL (STDMETHODCALLTYPE *GetLastLineWrapping)( - IDWriteTextFormat2 *This); - - HRESULT (STDMETHODCALLTYPE *SetOpticalAlignment)( - IDWriteTextFormat2 *This, - DWRITE_OPTICAL_ALIGNMENT alignment); - - DWRITE_OPTICAL_ALIGNMENT (STDMETHODCALLTYPE *GetOpticalAlignment)( - IDWriteTextFormat2 *This); - - HRESULT (STDMETHODCALLTYPE *SetFontFallback)( - IDWriteTextFormat2 *This, - IDWriteFontFallback *fallback); - - HRESULT (STDMETHODCALLTYPE *GetFontFallback)( - IDWriteTextFormat2 *This, - IDWriteFontFallback **fallback); - - /*** IDWriteTextFormat2 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteTextFormat2_SetLineSpacing)( - IDWriteTextFormat2 *This, - const DWRITE_LINE_SPACING *spacing); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextFormat2_GetLineSpacing)( - IDWriteTextFormat2 *This, - DWRITE_LINE_SPACING *spacing); - - END_INTERFACE -} IDWriteTextFormat2Vtbl; - -interface IDWriteTextFormat2 { - CONST_VTBL IDWriteTextFormat2Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteTextFormat2_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteTextFormat2_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteTextFormat2_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteTextFormat methods ***/ -#define IDWriteTextFormat2_SetTextAlignment(This,alignment) (This)->lpVtbl->SetTextAlignment(This,alignment) -#define IDWriteTextFormat2_SetParagraphAlignment(This,alignment) (This)->lpVtbl->SetParagraphAlignment(This,alignment) -#define IDWriteTextFormat2_SetWordWrapping(This,wrapping) (This)->lpVtbl->SetWordWrapping(This,wrapping) -#define IDWriteTextFormat2_SetReadingDirection(This,direction) (This)->lpVtbl->SetReadingDirection(This,direction) -#define IDWriteTextFormat2_SetFlowDirection(This,direction) (This)->lpVtbl->SetFlowDirection(This,direction) -#define IDWriteTextFormat2_SetIncrementalTabStop(This,tabstop) (This)->lpVtbl->SetIncrementalTabStop(This,tabstop) -#define IDWriteTextFormat2_SetTrimming(This,trimming,trimming_sign) (This)->lpVtbl->SetTrimming(This,trimming,trimming_sign) -#define IDWriteTextFormat2_GetTextAlignment(This) (This)->lpVtbl->GetTextAlignment(This) -#define IDWriteTextFormat2_GetParagraphAlignment(This) (This)->lpVtbl->GetParagraphAlignment(This) -#define IDWriteTextFormat2_GetWordWrapping(This) (This)->lpVtbl->GetWordWrapping(This) -#define IDWriteTextFormat2_GetReadingDirection(This) (This)->lpVtbl->GetReadingDirection(This) -#define IDWriteTextFormat2_GetFlowDirection(This) (This)->lpVtbl->GetFlowDirection(This) -#define IDWriteTextFormat2_GetIncrementalTabStop(This) (This)->lpVtbl->GetIncrementalTabStop(This) -#define IDWriteTextFormat2_GetTrimming(This,options,trimming_sign) (This)->lpVtbl->GetTrimming(This,options,trimming_sign) -#define IDWriteTextFormat2_GetFontCollection(This,collection) (This)->lpVtbl->GetFontCollection(This,collection) -#define IDWriteTextFormat2_GetFontFamilyNameLength(This) (This)->lpVtbl->GetFontFamilyNameLength(This) -#define IDWriteTextFormat2_GetFontFamilyName(This,name,size) (This)->lpVtbl->GetFontFamilyName(This,name,size) -#define IDWriteTextFormat2_GetFontWeight(This) (This)->lpVtbl->GetFontWeight(This) -#define IDWriteTextFormat2_GetFontStyle(This) (This)->lpVtbl->GetFontStyle(This) -#define IDWriteTextFormat2_GetFontStretch(This) (This)->lpVtbl->GetFontStretch(This) -#define IDWriteTextFormat2_GetFontSize(This) (This)->lpVtbl->GetFontSize(This) -#define IDWriteTextFormat2_GetLocaleNameLength(This) (This)->lpVtbl->GetLocaleNameLength(This) -#define IDWriteTextFormat2_GetLocaleName(This,name,size) (This)->lpVtbl->GetLocaleName(This,name,size) -/*** IDWriteTextFormat1 methods ***/ -#define IDWriteTextFormat2_SetVerticalGlyphOrientation(This,orientation) (This)->lpVtbl->SetVerticalGlyphOrientation(This,orientation) -#define IDWriteTextFormat2_GetVerticalGlyphOrientation(This) (This)->lpVtbl->GetVerticalGlyphOrientation(This) -#define IDWriteTextFormat2_SetLastLineWrapping(This,lastline_wrapping_enabled) (This)->lpVtbl->SetLastLineWrapping(This,lastline_wrapping_enabled) -#define IDWriteTextFormat2_GetLastLineWrapping(This) (This)->lpVtbl->GetLastLineWrapping(This) -#define IDWriteTextFormat2_SetOpticalAlignment(This,alignment) (This)->lpVtbl->SetOpticalAlignment(This,alignment) -#define IDWriteTextFormat2_GetOpticalAlignment(This) (This)->lpVtbl->GetOpticalAlignment(This) -#define IDWriteTextFormat2_SetFontFallback(This,fallback) (This)->lpVtbl->SetFontFallback(This,fallback) -#define IDWriteTextFormat2_GetFontFallback(This,fallback) (This)->lpVtbl->GetFontFallback(This,fallback) -/*** IDWriteTextFormat2 methods ***/ -#define IDWriteTextFormat2_SetLineSpacing(This,spacing) (This)->lpVtbl->IDWriteTextFormat2_SetLineSpacing(This,spacing) -#define IDWriteTextFormat2_GetLineSpacing(This,spacing) (This)->lpVtbl->IDWriteTextFormat2_GetLineSpacing(This,spacing) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteTextFormat2_QueryInterface(IDWriteTextFormat2* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteTextFormat2_AddRef(IDWriteTextFormat2* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteTextFormat2_Release(IDWriteTextFormat2* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteTextFormat methods ***/ -static FORCEINLINE HRESULT IDWriteTextFormat2_SetTextAlignment(IDWriteTextFormat2* This,DWRITE_TEXT_ALIGNMENT alignment) { - return This->lpVtbl->SetTextAlignment(This,alignment); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_SetParagraphAlignment(IDWriteTextFormat2* This,DWRITE_PARAGRAPH_ALIGNMENT alignment) { - return This->lpVtbl->SetParagraphAlignment(This,alignment); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_SetWordWrapping(IDWriteTextFormat2* This,DWRITE_WORD_WRAPPING wrapping) { - return This->lpVtbl->SetWordWrapping(This,wrapping); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_SetReadingDirection(IDWriteTextFormat2* This,DWRITE_READING_DIRECTION direction) { - return This->lpVtbl->SetReadingDirection(This,direction); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_SetFlowDirection(IDWriteTextFormat2* This,DWRITE_FLOW_DIRECTION direction) { - return This->lpVtbl->SetFlowDirection(This,direction); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_SetIncrementalTabStop(IDWriteTextFormat2* This,FLOAT tabstop) { - return This->lpVtbl->SetIncrementalTabStop(This,tabstop); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_SetTrimming(IDWriteTextFormat2* This,const DWRITE_TRIMMING *trimming,IDWriteInlineObject *trimming_sign) { - return This->lpVtbl->SetTrimming(This,trimming,trimming_sign); -} -static FORCEINLINE DWRITE_TEXT_ALIGNMENT IDWriteTextFormat2_GetTextAlignment(IDWriteTextFormat2* This) { - return This->lpVtbl->GetTextAlignment(This); -} -static FORCEINLINE DWRITE_PARAGRAPH_ALIGNMENT IDWriteTextFormat2_GetParagraphAlignment(IDWriteTextFormat2* This) { - return This->lpVtbl->GetParagraphAlignment(This); -} -static FORCEINLINE DWRITE_WORD_WRAPPING IDWriteTextFormat2_GetWordWrapping(IDWriteTextFormat2* This) { - return This->lpVtbl->GetWordWrapping(This); -} -static FORCEINLINE DWRITE_READING_DIRECTION IDWriteTextFormat2_GetReadingDirection(IDWriteTextFormat2* This) { - return This->lpVtbl->GetReadingDirection(This); -} -static FORCEINLINE DWRITE_FLOW_DIRECTION IDWriteTextFormat2_GetFlowDirection(IDWriteTextFormat2* This) { - return This->lpVtbl->GetFlowDirection(This); -} -static FORCEINLINE FLOAT IDWriteTextFormat2_GetIncrementalTabStop(IDWriteTextFormat2* This) { - return This->lpVtbl->GetIncrementalTabStop(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_GetTrimming(IDWriteTextFormat2* This,DWRITE_TRIMMING *options,IDWriteInlineObject **trimming_sign) { - return This->lpVtbl->GetTrimming(This,options,trimming_sign); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_GetFontCollection(IDWriteTextFormat2* This,IDWriteFontCollection **collection) { - return This->lpVtbl->GetFontCollection(This,collection); -} -static FORCEINLINE UINT32 IDWriteTextFormat2_GetFontFamilyNameLength(IDWriteTextFormat2* This) { - return This->lpVtbl->GetFontFamilyNameLength(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_GetFontFamilyName(IDWriteTextFormat2* This,WCHAR *name,UINT32 size) { - return This->lpVtbl->GetFontFamilyName(This,name,size); -} -static FORCEINLINE DWRITE_FONT_WEIGHT IDWriteTextFormat2_GetFontWeight(IDWriteTextFormat2* This) { - return This->lpVtbl->GetFontWeight(This); -} -static FORCEINLINE DWRITE_FONT_STYLE IDWriteTextFormat2_GetFontStyle(IDWriteTextFormat2* This) { - return This->lpVtbl->GetFontStyle(This); -} -static FORCEINLINE DWRITE_FONT_STRETCH IDWriteTextFormat2_GetFontStretch(IDWriteTextFormat2* This) { - return This->lpVtbl->GetFontStretch(This); -} -static FORCEINLINE FLOAT IDWriteTextFormat2_GetFontSize(IDWriteTextFormat2* This) { - return This->lpVtbl->GetFontSize(This); -} -static FORCEINLINE UINT32 IDWriteTextFormat2_GetLocaleNameLength(IDWriteTextFormat2* This) { - return This->lpVtbl->GetLocaleNameLength(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_GetLocaleName(IDWriteTextFormat2* This,WCHAR *name,UINT32 size) { - return This->lpVtbl->GetLocaleName(This,name,size); -} -/*** IDWriteTextFormat1 methods ***/ -static FORCEINLINE HRESULT IDWriteTextFormat2_SetVerticalGlyphOrientation(IDWriteTextFormat2* This,DWRITE_VERTICAL_GLYPH_ORIENTATION orientation) { - return This->lpVtbl->SetVerticalGlyphOrientation(This,orientation); -} -static FORCEINLINE DWRITE_VERTICAL_GLYPH_ORIENTATION IDWriteTextFormat2_GetVerticalGlyphOrientation(IDWriteTextFormat2* This) { - return This->lpVtbl->GetVerticalGlyphOrientation(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_SetLastLineWrapping(IDWriteTextFormat2* This,WINBOOL lastline_wrapping_enabled) { - return This->lpVtbl->SetLastLineWrapping(This,lastline_wrapping_enabled); -} -static FORCEINLINE WINBOOL IDWriteTextFormat2_GetLastLineWrapping(IDWriteTextFormat2* This) { - return This->lpVtbl->GetLastLineWrapping(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_SetOpticalAlignment(IDWriteTextFormat2* This,DWRITE_OPTICAL_ALIGNMENT alignment) { - return This->lpVtbl->SetOpticalAlignment(This,alignment); -} -static FORCEINLINE DWRITE_OPTICAL_ALIGNMENT IDWriteTextFormat2_GetOpticalAlignment(IDWriteTextFormat2* This) { - return This->lpVtbl->GetOpticalAlignment(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_SetFontFallback(IDWriteTextFormat2* This,IDWriteFontFallback *fallback) { - return This->lpVtbl->SetFontFallback(This,fallback); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_GetFontFallback(IDWriteTextFormat2* This,IDWriteFontFallback **fallback) { - return This->lpVtbl->GetFontFallback(This,fallback); -} -/*** IDWriteTextFormat2 methods ***/ -static FORCEINLINE HRESULT IDWriteTextFormat2_SetLineSpacing(IDWriteTextFormat2* This,const DWRITE_LINE_SPACING *spacing) { - return This->lpVtbl->IDWriteTextFormat2_SetLineSpacing(This,spacing); -} -static FORCEINLINE HRESULT IDWriteTextFormat2_GetLineSpacing(IDWriteTextFormat2* This,DWRITE_LINE_SPACING *spacing) { - return This->lpVtbl->IDWriteTextFormat2_GetLineSpacing(This,spacing); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteTextFormat2_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteTextFormat3 interface - */ -#ifndef __IDWriteTextFormat3_INTERFACE_DEFINED__ -#define __IDWriteTextFormat3_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteTextFormat3, 0x6d3b5641, 0xe550, 0x430d, 0xa8,0x5b, 0xb7,0xbf,0x48,0xa9,0x34,0x27); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("6d3b5641-e550-430d-a85b-b7bf48a93427") -IDWriteTextFormat3 : public IDWriteTextFormat2 -{ - virtual HRESULT STDMETHODCALLTYPE SetFontAxisValues( - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values) = 0; - - virtual UINT32 STDMETHODCALLTYPE GetFontAxisValueCount( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontAxisValues( - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values) = 0; - - virtual DWRITE_AUTOMATIC_FONT_AXES STDMETHODCALLTYPE GetAutomaticFontAxes( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAutomaticFontAxes( - DWRITE_AUTOMATIC_FONT_AXES axes) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteTextFormat3, 0x6d3b5641, 0xe550, 0x430d, 0xa8,0x5b, 0xb7,0xbf,0x48,0xa9,0x34,0x27) -#endif -#else -typedef struct IDWriteTextFormat3Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteTextFormat3 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteTextFormat3 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteTextFormat3 *This); - - /*** IDWriteTextFormat methods ***/ - HRESULT (STDMETHODCALLTYPE *SetTextAlignment)( - IDWriteTextFormat3 *This, - DWRITE_TEXT_ALIGNMENT alignment); - - HRESULT (STDMETHODCALLTYPE *SetParagraphAlignment)( - IDWriteTextFormat3 *This, - DWRITE_PARAGRAPH_ALIGNMENT alignment); - - HRESULT (STDMETHODCALLTYPE *SetWordWrapping)( - IDWriteTextFormat3 *This, - DWRITE_WORD_WRAPPING wrapping); - - HRESULT (STDMETHODCALLTYPE *SetReadingDirection)( - IDWriteTextFormat3 *This, - DWRITE_READING_DIRECTION direction); - - HRESULT (STDMETHODCALLTYPE *SetFlowDirection)( - IDWriteTextFormat3 *This, - DWRITE_FLOW_DIRECTION direction); - - HRESULT (STDMETHODCALLTYPE *SetIncrementalTabStop)( - IDWriteTextFormat3 *This, - FLOAT tabstop); - - HRESULT (STDMETHODCALLTYPE *SetTrimming)( - IDWriteTextFormat3 *This, - const DWRITE_TRIMMING *trimming, - IDWriteInlineObject *trimming_sign); - - HRESULT (STDMETHODCALLTYPE *SetLineSpacing)( - IDWriteTextFormat3 *This, - DWRITE_LINE_SPACING_METHOD spacing, - FLOAT line_spacing, - FLOAT baseline); - - DWRITE_TEXT_ALIGNMENT (STDMETHODCALLTYPE *GetTextAlignment)( - IDWriteTextFormat3 *This); - - DWRITE_PARAGRAPH_ALIGNMENT (STDMETHODCALLTYPE *GetParagraphAlignment)( - IDWriteTextFormat3 *This); - - DWRITE_WORD_WRAPPING (STDMETHODCALLTYPE *GetWordWrapping)( - IDWriteTextFormat3 *This); - - DWRITE_READING_DIRECTION (STDMETHODCALLTYPE *GetReadingDirection)( - IDWriteTextFormat3 *This); - - DWRITE_FLOW_DIRECTION (STDMETHODCALLTYPE *GetFlowDirection)( - IDWriteTextFormat3 *This); - - FLOAT (STDMETHODCALLTYPE *GetIncrementalTabStop)( - IDWriteTextFormat3 *This); - - HRESULT (STDMETHODCALLTYPE *GetTrimming)( - IDWriteTextFormat3 *This, - DWRITE_TRIMMING *options, - IDWriteInlineObject **trimming_sign); - - HRESULT (STDMETHODCALLTYPE *GetLineSpacing)( - IDWriteTextFormat3 *This, - DWRITE_LINE_SPACING_METHOD *method, - FLOAT *spacing, - FLOAT *baseline); - - HRESULT (STDMETHODCALLTYPE *GetFontCollection)( - IDWriteTextFormat3 *This, - IDWriteFontCollection **collection); - - UINT32 (STDMETHODCALLTYPE *GetFontFamilyNameLength)( - IDWriteTextFormat3 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFamilyName)( - IDWriteTextFormat3 *This, - WCHAR *name, - UINT32 size); - - DWRITE_FONT_WEIGHT (STDMETHODCALLTYPE *GetFontWeight)( - IDWriteTextFormat3 *This); - - DWRITE_FONT_STYLE (STDMETHODCALLTYPE *GetFontStyle)( - IDWriteTextFormat3 *This); - - DWRITE_FONT_STRETCH (STDMETHODCALLTYPE *GetFontStretch)( - IDWriteTextFormat3 *This); - - FLOAT (STDMETHODCALLTYPE *GetFontSize)( - IDWriteTextFormat3 *This); - - UINT32 (STDMETHODCALLTYPE *GetLocaleNameLength)( - IDWriteTextFormat3 *This); - - HRESULT (STDMETHODCALLTYPE *GetLocaleName)( - IDWriteTextFormat3 *This, - WCHAR *name, - UINT32 size); - - /*** IDWriteTextFormat1 methods ***/ - HRESULT (STDMETHODCALLTYPE *SetVerticalGlyphOrientation)( - IDWriteTextFormat3 *This, - DWRITE_VERTICAL_GLYPH_ORIENTATION orientation); - - DWRITE_VERTICAL_GLYPH_ORIENTATION (STDMETHODCALLTYPE *GetVerticalGlyphOrientation)( - IDWriteTextFormat3 *This); - - HRESULT (STDMETHODCALLTYPE *SetLastLineWrapping)( - IDWriteTextFormat3 *This, - WINBOOL lastline_wrapping_enabled); - - WINBOOL (STDMETHODCALLTYPE *GetLastLineWrapping)( - IDWriteTextFormat3 *This); - - HRESULT (STDMETHODCALLTYPE *SetOpticalAlignment)( - IDWriteTextFormat3 *This, - DWRITE_OPTICAL_ALIGNMENT alignment); - - DWRITE_OPTICAL_ALIGNMENT (STDMETHODCALLTYPE *GetOpticalAlignment)( - IDWriteTextFormat3 *This); - - HRESULT (STDMETHODCALLTYPE *SetFontFallback)( - IDWriteTextFormat3 *This, - IDWriteFontFallback *fallback); - - HRESULT (STDMETHODCALLTYPE *GetFontFallback)( - IDWriteTextFormat3 *This, - IDWriteFontFallback **fallback); - - /*** IDWriteTextFormat2 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteTextFormat2_SetLineSpacing)( - IDWriteTextFormat3 *This, - const DWRITE_LINE_SPACING *spacing); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextFormat2_GetLineSpacing)( - IDWriteTextFormat3 *This, - DWRITE_LINE_SPACING *spacing); - - /*** IDWriteTextFormat3 methods ***/ - HRESULT (STDMETHODCALLTYPE *SetFontAxisValues)( - IDWriteTextFormat3 *This, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values); - - UINT32 (STDMETHODCALLTYPE *GetFontAxisValueCount)( - IDWriteTextFormat3 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontAxisValues)( - IDWriteTextFormat3 *This, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values); - - DWRITE_AUTOMATIC_FONT_AXES (STDMETHODCALLTYPE *GetAutomaticFontAxes)( - IDWriteTextFormat3 *This); - - HRESULT (STDMETHODCALLTYPE *SetAutomaticFontAxes)( - IDWriteTextFormat3 *This, - DWRITE_AUTOMATIC_FONT_AXES axes); - - END_INTERFACE -} IDWriteTextFormat3Vtbl; - -interface IDWriteTextFormat3 { - CONST_VTBL IDWriteTextFormat3Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteTextFormat3_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteTextFormat3_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteTextFormat3_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteTextFormat methods ***/ -#define IDWriteTextFormat3_SetTextAlignment(This,alignment) (This)->lpVtbl->SetTextAlignment(This,alignment) -#define IDWriteTextFormat3_SetParagraphAlignment(This,alignment) (This)->lpVtbl->SetParagraphAlignment(This,alignment) -#define IDWriteTextFormat3_SetWordWrapping(This,wrapping) (This)->lpVtbl->SetWordWrapping(This,wrapping) -#define IDWriteTextFormat3_SetReadingDirection(This,direction) (This)->lpVtbl->SetReadingDirection(This,direction) -#define IDWriteTextFormat3_SetFlowDirection(This,direction) (This)->lpVtbl->SetFlowDirection(This,direction) -#define IDWriteTextFormat3_SetIncrementalTabStop(This,tabstop) (This)->lpVtbl->SetIncrementalTabStop(This,tabstop) -#define IDWriteTextFormat3_SetTrimming(This,trimming,trimming_sign) (This)->lpVtbl->SetTrimming(This,trimming,trimming_sign) -#define IDWriteTextFormat3_GetTextAlignment(This) (This)->lpVtbl->GetTextAlignment(This) -#define IDWriteTextFormat3_GetParagraphAlignment(This) (This)->lpVtbl->GetParagraphAlignment(This) -#define IDWriteTextFormat3_GetWordWrapping(This) (This)->lpVtbl->GetWordWrapping(This) -#define IDWriteTextFormat3_GetReadingDirection(This) (This)->lpVtbl->GetReadingDirection(This) -#define IDWriteTextFormat3_GetFlowDirection(This) (This)->lpVtbl->GetFlowDirection(This) -#define IDWriteTextFormat3_GetIncrementalTabStop(This) (This)->lpVtbl->GetIncrementalTabStop(This) -#define IDWriteTextFormat3_GetTrimming(This,options,trimming_sign) (This)->lpVtbl->GetTrimming(This,options,trimming_sign) -#define IDWriteTextFormat3_GetFontCollection(This,collection) (This)->lpVtbl->GetFontCollection(This,collection) -#define IDWriteTextFormat3_GetFontFamilyNameLength(This) (This)->lpVtbl->GetFontFamilyNameLength(This) -#define IDWriteTextFormat3_GetFontFamilyName(This,name,size) (This)->lpVtbl->GetFontFamilyName(This,name,size) -#define IDWriteTextFormat3_GetFontWeight(This) (This)->lpVtbl->GetFontWeight(This) -#define IDWriteTextFormat3_GetFontStyle(This) (This)->lpVtbl->GetFontStyle(This) -#define IDWriteTextFormat3_GetFontStretch(This) (This)->lpVtbl->GetFontStretch(This) -#define IDWriteTextFormat3_GetFontSize(This) (This)->lpVtbl->GetFontSize(This) -#define IDWriteTextFormat3_GetLocaleNameLength(This) (This)->lpVtbl->GetLocaleNameLength(This) -#define IDWriteTextFormat3_GetLocaleName(This,name,size) (This)->lpVtbl->GetLocaleName(This,name,size) -/*** IDWriteTextFormat1 methods ***/ -#define IDWriteTextFormat3_SetVerticalGlyphOrientation(This,orientation) (This)->lpVtbl->SetVerticalGlyphOrientation(This,orientation) -#define IDWriteTextFormat3_GetVerticalGlyphOrientation(This) (This)->lpVtbl->GetVerticalGlyphOrientation(This) -#define IDWriteTextFormat3_SetLastLineWrapping(This,lastline_wrapping_enabled) (This)->lpVtbl->SetLastLineWrapping(This,lastline_wrapping_enabled) -#define IDWriteTextFormat3_GetLastLineWrapping(This) (This)->lpVtbl->GetLastLineWrapping(This) -#define IDWriteTextFormat3_SetOpticalAlignment(This,alignment) (This)->lpVtbl->SetOpticalAlignment(This,alignment) -#define IDWriteTextFormat3_GetOpticalAlignment(This) (This)->lpVtbl->GetOpticalAlignment(This) -#define IDWriteTextFormat3_SetFontFallback(This,fallback) (This)->lpVtbl->SetFontFallback(This,fallback) -#define IDWriteTextFormat3_GetFontFallback(This,fallback) (This)->lpVtbl->GetFontFallback(This,fallback) -/*** IDWriteTextFormat2 methods ***/ -#define IDWriteTextFormat3_SetLineSpacing(This,spacing) (This)->lpVtbl->IDWriteTextFormat2_SetLineSpacing(This,spacing) -#define IDWriteTextFormat3_GetLineSpacing(This,spacing) (This)->lpVtbl->IDWriteTextFormat2_GetLineSpacing(This,spacing) -/*** IDWriteTextFormat3 methods ***/ -#define IDWriteTextFormat3_SetFontAxisValues(This,axis_values,num_values) (This)->lpVtbl->SetFontAxisValues(This,axis_values,num_values) -#define IDWriteTextFormat3_GetFontAxisValueCount(This) (This)->lpVtbl->GetFontAxisValueCount(This) -#define IDWriteTextFormat3_GetFontAxisValues(This,axis_values,num_values) (This)->lpVtbl->GetFontAxisValues(This,axis_values,num_values) -#define IDWriteTextFormat3_GetAutomaticFontAxes(This) (This)->lpVtbl->GetAutomaticFontAxes(This) -#define IDWriteTextFormat3_SetAutomaticFontAxes(This,axes) (This)->lpVtbl->SetAutomaticFontAxes(This,axes) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteTextFormat3_QueryInterface(IDWriteTextFormat3* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteTextFormat3_AddRef(IDWriteTextFormat3* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteTextFormat3_Release(IDWriteTextFormat3* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteTextFormat methods ***/ -static FORCEINLINE HRESULT IDWriteTextFormat3_SetTextAlignment(IDWriteTextFormat3* This,DWRITE_TEXT_ALIGNMENT alignment) { - return This->lpVtbl->SetTextAlignment(This,alignment); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_SetParagraphAlignment(IDWriteTextFormat3* This,DWRITE_PARAGRAPH_ALIGNMENT alignment) { - return This->lpVtbl->SetParagraphAlignment(This,alignment); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_SetWordWrapping(IDWriteTextFormat3* This,DWRITE_WORD_WRAPPING wrapping) { - return This->lpVtbl->SetWordWrapping(This,wrapping); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_SetReadingDirection(IDWriteTextFormat3* This,DWRITE_READING_DIRECTION direction) { - return This->lpVtbl->SetReadingDirection(This,direction); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_SetFlowDirection(IDWriteTextFormat3* This,DWRITE_FLOW_DIRECTION direction) { - return This->lpVtbl->SetFlowDirection(This,direction); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_SetIncrementalTabStop(IDWriteTextFormat3* This,FLOAT tabstop) { - return This->lpVtbl->SetIncrementalTabStop(This,tabstop); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_SetTrimming(IDWriteTextFormat3* This,const DWRITE_TRIMMING *trimming,IDWriteInlineObject *trimming_sign) { - return This->lpVtbl->SetTrimming(This,trimming,trimming_sign); -} -static FORCEINLINE DWRITE_TEXT_ALIGNMENT IDWriteTextFormat3_GetTextAlignment(IDWriteTextFormat3* This) { - return This->lpVtbl->GetTextAlignment(This); -} -static FORCEINLINE DWRITE_PARAGRAPH_ALIGNMENT IDWriteTextFormat3_GetParagraphAlignment(IDWriteTextFormat3* This) { - return This->lpVtbl->GetParagraphAlignment(This); -} -static FORCEINLINE DWRITE_WORD_WRAPPING IDWriteTextFormat3_GetWordWrapping(IDWriteTextFormat3* This) { - return This->lpVtbl->GetWordWrapping(This); -} -static FORCEINLINE DWRITE_READING_DIRECTION IDWriteTextFormat3_GetReadingDirection(IDWriteTextFormat3* This) { - return This->lpVtbl->GetReadingDirection(This); -} -static FORCEINLINE DWRITE_FLOW_DIRECTION IDWriteTextFormat3_GetFlowDirection(IDWriteTextFormat3* This) { - return This->lpVtbl->GetFlowDirection(This); -} -static FORCEINLINE FLOAT IDWriteTextFormat3_GetIncrementalTabStop(IDWriteTextFormat3* This) { - return This->lpVtbl->GetIncrementalTabStop(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_GetTrimming(IDWriteTextFormat3* This,DWRITE_TRIMMING *options,IDWriteInlineObject **trimming_sign) { - return This->lpVtbl->GetTrimming(This,options,trimming_sign); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_GetFontCollection(IDWriteTextFormat3* This,IDWriteFontCollection **collection) { - return This->lpVtbl->GetFontCollection(This,collection); -} -static FORCEINLINE UINT32 IDWriteTextFormat3_GetFontFamilyNameLength(IDWriteTextFormat3* This) { - return This->lpVtbl->GetFontFamilyNameLength(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_GetFontFamilyName(IDWriteTextFormat3* This,WCHAR *name,UINT32 size) { - return This->lpVtbl->GetFontFamilyName(This,name,size); -} -static FORCEINLINE DWRITE_FONT_WEIGHT IDWriteTextFormat3_GetFontWeight(IDWriteTextFormat3* This) { - return This->lpVtbl->GetFontWeight(This); -} -static FORCEINLINE DWRITE_FONT_STYLE IDWriteTextFormat3_GetFontStyle(IDWriteTextFormat3* This) { - return This->lpVtbl->GetFontStyle(This); -} -static FORCEINLINE DWRITE_FONT_STRETCH IDWriteTextFormat3_GetFontStretch(IDWriteTextFormat3* This) { - return This->lpVtbl->GetFontStretch(This); -} -static FORCEINLINE FLOAT IDWriteTextFormat3_GetFontSize(IDWriteTextFormat3* This) { - return This->lpVtbl->GetFontSize(This); -} -static FORCEINLINE UINT32 IDWriteTextFormat3_GetLocaleNameLength(IDWriteTextFormat3* This) { - return This->lpVtbl->GetLocaleNameLength(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_GetLocaleName(IDWriteTextFormat3* This,WCHAR *name,UINT32 size) { - return This->lpVtbl->GetLocaleName(This,name,size); -} -/*** IDWriteTextFormat1 methods ***/ -static FORCEINLINE HRESULT IDWriteTextFormat3_SetVerticalGlyphOrientation(IDWriteTextFormat3* This,DWRITE_VERTICAL_GLYPH_ORIENTATION orientation) { - return This->lpVtbl->SetVerticalGlyphOrientation(This,orientation); -} -static FORCEINLINE DWRITE_VERTICAL_GLYPH_ORIENTATION IDWriteTextFormat3_GetVerticalGlyphOrientation(IDWriteTextFormat3* This) { - return This->lpVtbl->GetVerticalGlyphOrientation(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_SetLastLineWrapping(IDWriteTextFormat3* This,WINBOOL lastline_wrapping_enabled) { - return This->lpVtbl->SetLastLineWrapping(This,lastline_wrapping_enabled); -} -static FORCEINLINE WINBOOL IDWriteTextFormat3_GetLastLineWrapping(IDWriteTextFormat3* This) { - return This->lpVtbl->GetLastLineWrapping(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_SetOpticalAlignment(IDWriteTextFormat3* This,DWRITE_OPTICAL_ALIGNMENT alignment) { - return This->lpVtbl->SetOpticalAlignment(This,alignment); -} -static FORCEINLINE DWRITE_OPTICAL_ALIGNMENT IDWriteTextFormat3_GetOpticalAlignment(IDWriteTextFormat3* This) { - return This->lpVtbl->GetOpticalAlignment(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_SetFontFallback(IDWriteTextFormat3* This,IDWriteFontFallback *fallback) { - return This->lpVtbl->SetFontFallback(This,fallback); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_GetFontFallback(IDWriteTextFormat3* This,IDWriteFontFallback **fallback) { - return This->lpVtbl->GetFontFallback(This,fallback); -} -/*** IDWriteTextFormat2 methods ***/ -static FORCEINLINE HRESULT IDWriteTextFormat3_SetLineSpacing(IDWriteTextFormat3* This,const DWRITE_LINE_SPACING *spacing) { - return This->lpVtbl->IDWriteTextFormat2_SetLineSpacing(This,spacing); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_GetLineSpacing(IDWriteTextFormat3* This,DWRITE_LINE_SPACING *spacing) { - return This->lpVtbl->IDWriteTextFormat2_GetLineSpacing(This,spacing); -} -/*** IDWriteTextFormat3 methods ***/ -static FORCEINLINE HRESULT IDWriteTextFormat3_SetFontAxisValues(IDWriteTextFormat3* This,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values) { - return This->lpVtbl->SetFontAxisValues(This,axis_values,num_values); -} -static FORCEINLINE UINT32 IDWriteTextFormat3_GetFontAxisValueCount(IDWriteTextFormat3* This) { - return This->lpVtbl->GetFontAxisValueCount(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_GetFontAxisValues(IDWriteTextFormat3* This,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values) { - return This->lpVtbl->GetFontAxisValues(This,axis_values,num_values); -} -static FORCEINLINE DWRITE_AUTOMATIC_FONT_AXES IDWriteTextFormat3_GetAutomaticFontAxes(IDWriteTextFormat3* This) { - return This->lpVtbl->GetAutomaticFontAxes(This); -} -static FORCEINLINE HRESULT IDWriteTextFormat3_SetAutomaticFontAxes(IDWriteTextFormat3* This,DWRITE_AUTOMATIC_FONT_AXES axes) { - return This->lpVtbl->SetAutomaticFontAxes(This,axes); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteTextFormat3_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteTextLayout3 interface - */ -#ifndef __IDWriteTextLayout3_INTERFACE_DEFINED__ -#define __IDWriteTextLayout3_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteTextLayout3, 0x07ddcd52, 0x020e, 0x4de8, 0xac,0x33, 0x6c,0x95,0x3d,0x83,0xf9,0x2d); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("07ddcd52-020e-4de8-ac33-6c953d83f92d") -IDWriteTextLayout3 : public IDWriteTextLayout2 -{ - virtual HRESULT STDMETHODCALLTYPE InvalidateLayout( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetLineSpacing( - const DWRITE_LINE_SPACING *spacing) = 0; - - using IDWriteTextLayout2::SetLineSpacing; - - virtual HRESULT STDMETHODCALLTYPE GetLineSpacing( - DWRITE_LINE_SPACING *spacing) = 0; - - using IDWriteTextLayout2::GetLineSpacing; - - virtual HRESULT STDMETHODCALLTYPE GetLineMetrics( - DWRITE_LINE_METRICS1 *metrics, - UINT32 max_count, - UINT32 *count) = 0; - - using IDWriteTextLayout2::GetLineMetrics; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteTextLayout3, 0x07ddcd52, 0x020e, 0x4de8, 0xac,0x33, 0x6c,0x95,0x3d,0x83,0xf9,0x2d) -#endif -#else -typedef struct IDWriteTextLayout3Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteTextLayout3 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteTextLayout3 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteTextLayout3 *This); - - /*** IDWriteTextFormat methods ***/ - HRESULT (STDMETHODCALLTYPE *SetTextAlignment)( - IDWriteTextLayout3 *This, - DWRITE_TEXT_ALIGNMENT alignment); - - HRESULT (STDMETHODCALLTYPE *SetParagraphAlignment)( - IDWriteTextLayout3 *This, - DWRITE_PARAGRAPH_ALIGNMENT alignment); - - HRESULT (STDMETHODCALLTYPE *SetWordWrapping)( - IDWriteTextLayout3 *This, - DWRITE_WORD_WRAPPING wrapping); - - HRESULT (STDMETHODCALLTYPE *SetReadingDirection)( - IDWriteTextLayout3 *This, - DWRITE_READING_DIRECTION direction); - - HRESULT (STDMETHODCALLTYPE *SetFlowDirection)( - IDWriteTextLayout3 *This, - DWRITE_FLOW_DIRECTION direction); - - HRESULT (STDMETHODCALLTYPE *SetIncrementalTabStop)( - IDWriteTextLayout3 *This, - FLOAT tabstop); - - HRESULT (STDMETHODCALLTYPE *SetTrimming)( - IDWriteTextLayout3 *This, - const DWRITE_TRIMMING *trimming, - IDWriteInlineObject *trimming_sign); - - HRESULT (STDMETHODCALLTYPE *SetLineSpacing)( - IDWriteTextLayout3 *This, - DWRITE_LINE_SPACING_METHOD spacing, - FLOAT line_spacing, - FLOAT baseline); - - DWRITE_TEXT_ALIGNMENT (STDMETHODCALLTYPE *GetTextAlignment)( - IDWriteTextLayout3 *This); - - DWRITE_PARAGRAPH_ALIGNMENT (STDMETHODCALLTYPE *GetParagraphAlignment)( - IDWriteTextLayout3 *This); - - DWRITE_WORD_WRAPPING (STDMETHODCALLTYPE *GetWordWrapping)( - IDWriteTextLayout3 *This); - - DWRITE_READING_DIRECTION (STDMETHODCALLTYPE *GetReadingDirection)( - IDWriteTextLayout3 *This); - - DWRITE_FLOW_DIRECTION (STDMETHODCALLTYPE *GetFlowDirection)( - IDWriteTextLayout3 *This); - - FLOAT (STDMETHODCALLTYPE *GetIncrementalTabStop)( - IDWriteTextLayout3 *This); - - HRESULT (STDMETHODCALLTYPE *GetTrimming)( - IDWriteTextLayout3 *This, - DWRITE_TRIMMING *options, - IDWriteInlineObject **trimming_sign); - - HRESULT (STDMETHODCALLTYPE *GetLineSpacing)( - IDWriteTextLayout3 *This, - DWRITE_LINE_SPACING_METHOD *method, - FLOAT *spacing, - FLOAT *baseline); - - HRESULT (STDMETHODCALLTYPE *GetFontCollection)( - IDWriteTextLayout3 *This, - IDWriteFontCollection **collection); - - UINT32 (STDMETHODCALLTYPE *GetFontFamilyNameLength)( - IDWriteTextLayout3 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFamilyName)( - IDWriteTextLayout3 *This, - WCHAR *name, - UINT32 size); - - DWRITE_FONT_WEIGHT (STDMETHODCALLTYPE *GetFontWeight)( - IDWriteTextLayout3 *This); - - DWRITE_FONT_STYLE (STDMETHODCALLTYPE *GetFontStyle)( - IDWriteTextLayout3 *This); - - DWRITE_FONT_STRETCH (STDMETHODCALLTYPE *GetFontStretch)( - IDWriteTextLayout3 *This); - - FLOAT (STDMETHODCALLTYPE *GetFontSize)( - IDWriteTextLayout3 *This); - - UINT32 (STDMETHODCALLTYPE *GetLocaleNameLength)( - IDWriteTextLayout3 *This); - - HRESULT (STDMETHODCALLTYPE *GetLocaleName)( - IDWriteTextLayout3 *This, - WCHAR *name, - UINT32 size); - - /*** IDWriteTextLayout methods ***/ - HRESULT (STDMETHODCALLTYPE *SetMaxWidth)( - IDWriteTextLayout3 *This, - FLOAT maxWidth); - - HRESULT (STDMETHODCALLTYPE *SetMaxHeight)( - IDWriteTextLayout3 *This, - FLOAT maxHeight); - - HRESULT (STDMETHODCALLTYPE *SetFontCollection)( - IDWriteTextLayout3 *This, - IDWriteFontCollection *collection, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetFontFamilyName)( - IDWriteTextLayout3 *This, - const WCHAR *name, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetFontWeight)( - IDWriteTextLayout3 *This, - DWRITE_FONT_WEIGHT weight, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetFontStyle)( - IDWriteTextLayout3 *This, - DWRITE_FONT_STYLE style, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetFontStretch)( - IDWriteTextLayout3 *This, - DWRITE_FONT_STRETCH stretch, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetFontSize)( - IDWriteTextLayout3 *This, - FLOAT size, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetUnderline)( - IDWriteTextLayout3 *This, - WINBOOL underline, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetStrikethrough)( - IDWriteTextLayout3 *This, - WINBOOL strikethrough, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetDrawingEffect)( - IDWriteTextLayout3 *This, - IUnknown *effect, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetInlineObject)( - IDWriteTextLayout3 *This, - IDWriteInlineObject *object, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetTypography)( - IDWriteTextLayout3 *This, - IDWriteTypography *typography, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetLocaleName)( - IDWriteTextLayout3 *This, - const WCHAR *locale, - DWRITE_TEXT_RANGE range); - - FLOAT (STDMETHODCALLTYPE *GetMaxWidth)( - IDWriteTextLayout3 *This); - - FLOAT (STDMETHODCALLTYPE *GetMaxHeight)( - IDWriteTextLayout3 *This); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontCollection)( - IDWriteTextLayout3 *This, - UINT32 pos, - IDWriteFontCollection **collection, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontFamilyNameLength)( - IDWriteTextLayout3 *This, - UINT32 pos, - UINT32 *len, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontFamilyName)( - IDWriteTextLayout3 *This, - UINT32 position, - WCHAR *name, - UINT32 name_size, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontWeight)( - IDWriteTextLayout3 *This, - UINT32 position, - DWRITE_FONT_WEIGHT *weight, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontStyle)( - IDWriteTextLayout3 *This, - UINT32 currentPosition, - DWRITE_FONT_STYLE *style, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontStretch)( - IDWriteTextLayout3 *This, - UINT32 position, - DWRITE_FONT_STRETCH *stretch, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontSize)( - IDWriteTextLayout3 *This, - UINT32 position, - FLOAT *size, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *GetUnderline)( - IDWriteTextLayout3 *This, - UINT32 position, - WINBOOL *has_underline, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *GetStrikethrough)( - IDWriteTextLayout3 *This, - UINT32 position, - WINBOOL *has_strikethrough, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *GetDrawingEffect)( - IDWriteTextLayout3 *This, - UINT32 position, - IUnknown **effect, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *GetInlineObject)( - IDWriteTextLayout3 *This, - UINT32 position, - IDWriteInlineObject **object, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *GetTypography)( - IDWriteTextLayout3 *This, - UINT32 position, - IDWriteTypography **typography, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetLocaleNameLength)( - IDWriteTextLayout3 *This, - UINT32 position, - UINT32 *length, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetLocaleName)( - IDWriteTextLayout3 *This, - UINT32 position, - WCHAR *name, - UINT32 name_size, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *Draw)( - IDWriteTextLayout3 *This, - void *context, - IDWriteTextRenderer *renderer, - FLOAT originX, - FLOAT originY); - - HRESULT (STDMETHODCALLTYPE *GetLineMetrics)( - IDWriteTextLayout3 *This, - DWRITE_LINE_METRICS *metrics, - UINT32 max_count, - UINT32 *actual_count); - - HRESULT (STDMETHODCALLTYPE *GetMetrics)( - IDWriteTextLayout3 *This, - DWRITE_TEXT_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *GetOverhangMetrics)( - IDWriteTextLayout3 *This, - DWRITE_OVERHANG_METRICS *overhangs); - - HRESULT (STDMETHODCALLTYPE *GetClusterMetrics)( - IDWriteTextLayout3 *This, - DWRITE_CLUSTER_METRICS *metrics, - UINT32 max_count, - UINT32 *act_count); - - HRESULT (STDMETHODCALLTYPE *DetermineMinWidth)( - IDWriteTextLayout3 *This, - FLOAT *min_width); - - HRESULT (STDMETHODCALLTYPE *HitTestPoint)( - IDWriteTextLayout3 *This, - FLOAT pointX, - FLOAT pointY, - WINBOOL *is_trailinghit, - WINBOOL *is_inside, - DWRITE_HIT_TEST_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *HitTestTextPosition)( - IDWriteTextLayout3 *This, - UINT32 textPosition, - WINBOOL is_trailinghit, - FLOAT *pointX, - FLOAT *pointY, - DWRITE_HIT_TEST_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *HitTestTextRange)( - IDWriteTextLayout3 *This, - UINT32 textPosition, - UINT32 textLength, - FLOAT originX, - FLOAT originY, - DWRITE_HIT_TEST_METRICS *metrics, - UINT32 max_metricscount, - UINT32 *actual_metricscount); - - /*** IDWriteTextLayout1 methods ***/ - HRESULT (STDMETHODCALLTYPE *SetPairKerning)( - IDWriteTextLayout3 *This, - WINBOOL is_pairkerning_enabled, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *GetPairKerning)( - IDWriteTextLayout3 *This, - UINT32 position, - WINBOOL *is_pairkerning_enabled, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *SetCharacterSpacing)( - IDWriteTextLayout3 *This, - FLOAT leading_spacing, - FLOAT trailing_spacing, - FLOAT minimum_advance_width, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *GetCharacterSpacing)( - IDWriteTextLayout3 *This, - UINT32 position, - FLOAT *leading_spacing, - FLOAT *trailing_spacing, - FLOAT *minimum_advance_width, - DWRITE_TEXT_RANGE *range); - - /*** IDWriteTextLayout2 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout2_GetMetrics)( - IDWriteTextLayout3 *This, - DWRITE_TEXT_METRICS1 *metrics); - - HRESULT (STDMETHODCALLTYPE *SetVerticalGlyphOrientation)( - IDWriteTextLayout3 *This, - DWRITE_VERTICAL_GLYPH_ORIENTATION orientation); - - DWRITE_VERTICAL_GLYPH_ORIENTATION (STDMETHODCALLTYPE *GetVerticalGlyphOrientation)( - IDWriteTextLayout3 *This); - - HRESULT (STDMETHODCALLTYPE *SetLastLineWrapping)( - IDWriteTextLayout3 *This, - WINBOOL lastline_wrapping_enabled); - - WINBOOL (STDMETHODCALLTYPE *GetLastLineWrapping)( - IDWriteTextLayout3 *This); - - HRESULT (STDMETHODCALLTYPE *SetOpticalAlignment)( - IDWriteTextLayout3 *This, - DWRITE_OPTICAL_ALIGNMENT alignment); - - DWRITE_OPTICAL_ALIGNMENT (STDMETHODCALLTYPE *GetOpticalAlignment)( - IDWriteTextLayout3 *This); - - HRESULT (STDMETHODCALLTYPE *SetFontFallback)( - IDWriteTextLayout3 *This, - IDWriteFontFallback *fallback); - - HRESULT (STDMETHODCALLTYPE *GetFontFallback)( - IDWriteTextLayout3 *This, - IDWriteFontFallback **fallback); - - /*** IDWriteTextLayout3 methods ***/ - HRESULT (STDMETHODCALLTYPE *InvalidateLayout)( - IDWriteTextLayout3 *This); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout3_SetLineSpacing)( - IDWriteTextLayout3 *This, - const DWRITE_LINE_SPACING *spacing); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout3_GetLineSpacing)( - IDWriteTextLayout3 *This, - DWRITE_LINE_SPACING *spacing); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout3_GetLineMetrics)( - IDWriteTextLayout3 *This, - DWRITE_LINE_METRICS1 *metrics, - UINT32 max_count, - UINT32 *count); - - END_INTERFACE -} IDWriteTextLayout3Vtbl; - -interface IDWriteTextLayout3 { - CONST_VTBL IDWriteTextLayout3Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteTextLayout3_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteTextLayout3_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteTextLayout3_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteTextFormat methods ***/ -#define IDWriteTextLayout3_SetTextAlignment(This,alignment) (This)->lpVtbl->SetTextAlignment(This,alignment) -#define IDWriteTextLayout3_SetParagraphAlignment(This,alignment) (This)->lpVtbl->SetParagraphAlignment(This,alignment) -#define IDWriteTextLayout3_SetWordWrapping(This,wrapping) (This)->lpVtbl->SetWordWrapping(This,wrapping) -#define IDWriteTextLayout3_SetReadingDirection(This,direction) (This)->lpVtbl->SetReadingDirection(This,direction) -#define IDWriteTextLayout3_SetFlowDirection(This,direction) (This)->lpVtbl->SetFlowDirection(This,direction) -#define IDWriteTextLayout3_SetIncrementalTabStop(This,tabstop) (This)->lpVtbl->SetIncrementalTabStop(This,tabstop) -#define IDWriteTextLayout3_SetTrimming(This,trimming,trimming_sign) (This)->lpVtbl->SetTrimming(This,trimming,trimming_sign) -#define IDWriteTextLayout3_GetTextAlignment(This) (This)->lpVtbl->GetTextAlignment(This) -#define IDWriteTextLayout3_GetParagraphAlignment(This) (This)->lpVtbl->GetParagraphAlignment(This) -#define IDWriteTextLayout3_GetWordWrapping(This) (This)->lpVtbl->GetWordWrapping(This) -#define IDWriteTextLayout3_GetReadingDirection(This) (This)->lpVtbl->GetReadingDirection(This) -#define IDWriteTextLayout3_GetFlowDirection(This) (This)->lpVtbl->GetFlowDirection(This) -#define IDWriteTextLayout3_GetIncrementalTabStop(This) (This)->lpVtbl->GetIncrementalTabStop(This) -#define IDWriteTextLayout3_GetTrimming(This,options,trimming_sign) (This)->lpVtbl->GetTrimming(This,options,trimming_sign) -/*** IDWriteTextLayout methods ***/ -#define IDWriteTextLayout3_SetMaxWidth(This,maxWidth) (This)->lpVtbl->SetMaxWidth(This,maxWidth) -#define IDWriteTextLayout3_SetMaxHeight(This,maxHeight) (This)->lpVtbl->SetMaxHeight(This,maxHeight) -#define IDWriteTextLayout3_SetFontCollection(This,collection,range) (This)->lpVtbl->SetFontCollection(This,collection,range) -#define IDWriteTextLayout3_SetFontFamilyName(This,name,range) (This)->lpVtbl->SetFontFamilyName(This,name,range) -#define IDWriteTextLayout3_SetFontWeight(This,weight,range) (This)->lpVtbl->SetFontWeight(This,weight,range) -#define IDWriteTextLayout3_SetFontStyle(This,style,range) (This)->lpVtbl->SetFontStyle(This,style,range) -#define IDWriteTextLayout3_SetFontStretch(This,stretch,range) (This)->lpVtbl->SetFontStretch(This,stretch,range) -#define IDWriteTextLayout3_SetFontSize(This,size,range) (This)->lpVtbl->SetFontSize(This,size,range) -#define IDWriteTextLayout3_SetUnderline(This,underline,range) (This)->lpVtbl->SetUnderline(This,underline,range) -#define IDWriteTextLayout3_SetStrikethrough(This,strikethrough,range) (This)->lpVtbl->SetStrikethrough(This,strikethrough,range) -#define IDWriteTextLayout3_SetDrawingEffect(This,effect,range) (This)->lpVtbl->SetDrawingEffect(This,effect,range) -#define IDWriteTextLayout3_SetInlineObject(This,object,range) (This)->lpVtbl->SetInlineObject(This,object,range) -#define IDWriteTextLayout3_SetTypography(This,typography,range) (This)->lpVtbl->SetTypography(This,typography,range) -#define IDWriteTextLayout3_SetLocaleName(This,locale,range) (This)->lpVtbl->SetLocaleName(This,locale,range) -#define IDWriteTextLayout3_GetMaxWidth(This) (This)->lpVtbl->GetMaxWidth(This) -#define IDWriteTextLayout3_GetMaxHeight(This) (This)->lpVtbl->GetMaxHeight(This) -#define IDWriteTextLayout3_GetFontCollection(This,pos,collection,range) (This)->lpVtbl->IDWriteTextLayout_GetFontCollection(This,pos,collection,range) -#define IDWriteTextLayout3_GetFontFamilyNameLength(This,pos,len,range) (This)->lpVtbl->IDWriteTextLayout_GetFontFamilyNameLength(This,pos,len,range) -#define IDWriteTextLayout3_GetFontFamilyName(This,position,name,name_size,range) (This)->lpVtbl->IDWriteTextLayout_GetFontFamilyName(This,position,name,name_size,range) -#define IDWriteTextLayout3_GetFontWeight(This,position,weight,range) (This)->lpVtbl->IDWriteTextLayout_GetFontWeight(This,position,weight,range) -#define IDWriteTextLayout3_GetFontStyle(This,currentPosition,style,range) (This)->lpVtbl->IDWriteTextLayout_GetFontStyle(This,currentPosition,style,range) -#define IDWriteTextLayout3_GetFontStretch(This,position,stretch,range) (This)->lpVtbl->IDWriteTextLayout_GetFontStretch(This,position,stretch,range) -#define IDWriteTextLayout3_GetFontSize(This,position,size,range) (This)->lpVtbl->IDWriteTextLayout_GetFontSize(This,position,size,range) -#define IDWriteTextLayout3_GetUnderline(This,position,has_underline,range) (This)->lpVtbl->GetUnderline(This,position,has_underline,range) -#define IDWriteTextLayout3_GetStrikethrough(This,position,has_strikethrough,range) (This)->lpVtbl->GetStrikethrough(This,position,has_strikethrough,range) -#define IDWriteTextLayout3_GetDrawingEffect(This,position,effect,range) (This)->lpVtbl->GetDrawingEffect(This,position,effect,range) -#define IDWriteTextLayout3_GetInlineObject(This,position,object,range) (This)->lpVtbl->GetInlineObject(This,position,object,range) -#define IDWriteTextLayout3_GetTypography(This,position,typography,range) (This)->lpVtbl->GetTypography(This,position,typography,range) -#define IDWriteTextLayout3_GetLocaleNameLength(This,position,length,range) (This)->lpVtbl->IDWriteTextLayout_GetLocaleNameLength(This,position,length,range) -#define IDWriteTextLayout3_GetLocaleName(This,position,name,name_size,range) (This)->lpVtbl->IDWriteTextLayout_GetLocaleName(This,position,name,name_size,range) -#define IDWriteTextLayout3_Draw(This,context,renderer,originX,originY) (This)->lpVtbl->Draw(This,context,renderer,originX,originY) -#define IDWriteTextLayout3_GetOverhangMetrics(This,overhangs) (This)->lpVtbl->GetOverhangMetrics(This,overhangs) -#define IDWriteTextLayout3_GetClusterMetrics(This,metrics,max_count,act_count) (This)->lpVtbl->GetClusterMetrics(This,metrics,max_count,act_count) -#define IDWriteTextLayout3_DetermineMinWidth(This,min_width) (This)->lpVtbl->DetermineMinWidth(This,min_width) -#define IDWriteTextLayout3_HitTestPoint(This,pointX,pointY,is_trailinghit,is_inside,metrics) (This)->lpVtbl->HitTestPoint(This,pointX,pointY,is_trailinghit,is_inside,metrics) -#define IDWriteTextLayout3_HitTestTextPosition(This,textPosition,is_trailinghit,pointX,pointY,metrics) (This)->lpVtbl->HitTestTextPosition(This,textPosition,is_trailinghit,pointX,pointY,metrics) -#define IDWriteTextLayout3_HitTestTextRange(This,textPosition,textLength,originX,originY,metrics,max_metricscount,actual_metricscount) (This)->lpVtbl->HitTestTextRange(This,textPosition,textLength,originX,originY,metrics,max_metricscount,actual_metricscount) -/*** IDWriteTextLayout1 methods ***/ -#define IDWriteTextLayout3_SetPairKerning(This,is_pairkerning_enabled,range) (This)->lpVtbl->SetPairKerning(This,is_pairkerning_enabled,range) -#define IDWriteTextLayout3_GetPairKerning(This,position,is_pairkerning_enabled,range) (This)->lpVtbl->GetPairKerning(This,position,is_pairkerning_enabled,range) -#define IDWriteTextLayout3_SetCharacterSpacing(This,leading_spacing,trailing_spacing,minimum_advance_width,range) (This)->lpVtbl->SetCharacterSpacing(This,leading_spacing,trailing_spacing,minimum_advance_width,range) -#define IDWriteTextLayout3_GetCharacterSpacing(This,position,leading_spacing,trailing_spacing,minimum_advance_width,range) (This)->lpVtbl->GetCharacterSpacing(This,position,leading_spacing,trailing_spacing,minimum_advance_width,range) -/*** IDWriteTextLayout2 methods ***/ -#define IDWriteTextLayout3_GetMetrics(This,metrics) (This)->lpVtbl->IDWriteTextLayout2_GetMetrics(This,metrics) -#define IDWriteTextLayout3_SetVerticalGlyphOrientation(This,orientation) (This)->lpVtbl->SetVerticalGlyphOrientation(This,orientation) -#define IDWriteTextLayout3_GetVerticalGlyphOrientation(This) (This)->lpVtbl->GetVerticalGlyphOrientation(This) -#define IDWriteTextLayout3_SetLastLineWrapping(This,lastline_wrapping_enabled) (This)->lpVtbl->SetLastLineWrapping(This,lastline_wrapping_enabled) -#define IDWriteTextLayout3_GetLastLineWrapping(This) (This)->lpVtbl->GetLastLineWrapping(This) -#define IDWriteTextLayout3_SetOpticalAlignment(This,alignment) (This)->lpVtbl->SetOpticalAlignment(This,alignment) -#define IDWriteTextLayout3_GetOpticalAlignment(This) (This)->lpVtbl->GetOpticalAlignment(This) -#define IDWriteTextLayout3_SetFontFallback(This,fallback) (This)->lpVtbl->SetFontFallback(This,fallback) -#define IDWriteTextLayout3_GetFontFallback(This,fallback) (This)->lpVtbl->GetFontFallback(This,fallback) -/*** IDWriteTextLayout3 methods ***/ -#define IDWriteTextLayout3_InvalidateLayout(This) (This)->lpVtbl->InvalidateLayout(This) -#define IDWriteTextLayout3_SetLineSpacing(This,spacing) (This)->lpVtbl->IDWriteTextLayout3_SetLineSpacing(This,spacing) -#define IDWriteTextLayout3_GetLineSpacing(This,spacing) (This)->lpVtbl->IDWriteTextLayout3_GetLineSpacing(This,spacing) -#define IDWriteTextLayout3_GetLineMetrics(This,metrics,max_count,count) (This)->lpVtbl->IDWriteTextLayout3_GetLineMetrics(This,metrics,max_count,count) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout3_QueryInterface(IDWriteTextLayout3* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteTextLayout3_AddRef(IDWriteTextLayout3* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteTextLayout3_Release(IDWriteTextLayout3* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteTextFormat methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout3_SetTextAlignment(IDWriteTextLayout3* This,DWRITE_TEXT_ALIGNMENT alignment) { - return This->lpVtbl->SetTextAlignment(This,alignment); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetParagraphAlignment(IDWriteTextLayout3* This,DWRITE_PARAGRAPH_ALIGNMENT alignment) { - return This->lpVtbl->SetParagraphAlignment(This,alignment); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetWordWrapping(IDWriteTextLayout3* This,DWRITE_WORD_WRAPPING wrapping) { - return This->lpVtbl->SetWordWrapping(This,wrapping); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetReadingDirection(IDWriteTextLayout3* This,DWRITE_READING_DIRECTION direction) { - return This->lpVtbl->SetReadingDirection(This,direction); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetFlowDirection(IDWriteTextLayout3* This,DWRITE_FLOW_DIRECTION direction) { - return This->lpVtbl->SetFlowDirection(This,direction); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetIncrementalTabStop(IDWriteTextLayout3* This,FLOAT tabstop) { - return This->lpVtbl->SetIncrementalTabStop(This,tabstop); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetTrimming(IDWriteTextLayout3* This,const DWRITE_TRIMMING *trimming,IDWriteInlineObject *trimming_sign) { - return This->lpVtbl->SetTrimming(This,trimming,trimming_sign); -} -static FORCEINLINE DWRITE_TEXT_ALIGNMENT IDWriteTextLayout3_GetTextAlignment(IDWriteTextLayout3* This) { - return This->lpVtbl->GetTextAlignment(This); -} -static FORCEINLINE DWRITE_PARAGRAPH_ALIGNMENT IDWriteTextLayout3_GetParagraphAlignment(IDWriteTextLayout3* This) { - return This->lpVtbl->GetParagraphAlignment(This); -} -static FORCEINLINE DWRITE_WORD_WRAPPING IDWriteTextLayout3_GetWordWrapping(IDWriteTextLayout3* This) { - return This->lpVtbl->GetWordWrapping(This); -} -static FORCEINLINE DWRITE_READING_DIRECTION IDWriteTextLayout3_GetReadingDirection(IDWriteTextLayout3* This) { - return This->lpVtbl->GetReadingDirection(This); -} -static FORCEINLINE DWRITE_FLOW_DIRECTION IDWriteTextLayout3_GetFlowDirection(IDWriteTextLayout3* This) { - return This->lpVtbl->GetFlowDirection(This); -} -static FORCEINLINE FLOAT IDWriteTextLayout3_GetIncrementalTabStop(IDWriteTextLayout3* This) { - return This->lpVtbl->GetIncrementalTabStop(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetTrimming(IDWriteTextLayout3* This,DWRITE_TRIMMING *options,IDWriteInlineObject **trimming_sign) { - return This->lpVtbl->GetTrimming(This,options,trimming_sign); -} -/*** IDWriteTextLayout methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout3_SetMaxWidth(IDWriteTextLayout3* This,FLOAT maxWidth) { - return This->lpVtbl->SetMaxWidth(This,maxWidth); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetMaxHeight(IDWriteTextLayout3* This,FLOAT maxHeight) { - return This->lpVtbl->SetMaxHeight(This,maxHeight); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetFontCollection(IDWriteTextLayout3* This,IDWriteFontCollection *collection,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontCollection(This,collection,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetFontFamilyName(IDWriteTextLayout3* This,const WCHAR *name,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontFamilyName(This,name,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetFontWeight(IDWriteTextLayout3* This,DWRITE_FONT_WEIGHT weight,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontWeight(This,weight,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetFontStyle(IDWriteTextLayout3* This,DWRITE_FONT_STYLE style,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontStyle(This,style,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetFontStretch(IDWriteTextLayout3* This,DWRITE_FONT_STRETCH stretch,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontStretch(This,stretch,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetFontSize(IDWriteTextLayout3* This,FLOAT size,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontSize(This,size,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetUnderline(IDWriteTextLayout3* This,WINBOOL underline,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetUnderline(This,underline,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetStrikethrough(IDWriteTextLayout3* This,WINBOOL strikethrough,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetStrikethrough(This,strikethrough,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetDrawingEffect(IDWriteTextLayout3* This,IUnknown *effect,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetDrawingEffect(This,effect,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetInlineObject(IDWriteTextLayout3* This,IDWriteInlineObject *object,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetInlineObject(This,object,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetTypography(IDWriteTextLayout3* This,IDWriteTypography *typography,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetTypography(This,typography,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetLocaleName(IDWriteTextLayout3* This,const WCHAR *locale,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetLocaleName(This,locale,range); -} -static FORCEINLINE FLOAT IDWriteTextLayout3_GetMaxWidth(IDWriteTextLayout3* This) { - return This->lpVtbl->GetMaxWidth(This); -} -static FORCEINLINE FLOAT IDWriteTextLayout3_GetMaxHeight(IDWriteTextLayout3* This) { - return This->lpVtbl->GetMaxHeight(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetFontCollection(IDWriteTextLayout3* This,UINT32 pos,IDWriteFontCollection **collection,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontCollection(This,pos,collection,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetFontFamilyNameLength(IDWriteTextLayout3* This,UINT32 pos,UINT32 *len,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontFamilyNameLength(This,pos,len,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetFontFamilyName(IDWriteTextLayout3* This,UINT32 position,WCHAR *name,UINT32 name_size,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontFamilyName(This,position,name,name_size,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetFontWeight(IDWriteTextLayout3* This,UINT32 position,DWRITE_FONT_WEIGHT *weight,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontWeight(This,position,weight,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetFontStyle(IDWriteTextLayout3* This,UINT32 currentPosition,DWRITE_FONT_STYLE *style,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontStyle(This,currentPosition,style,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetFontStretch(IDWriteTextLayout3* This,UINT32 position,DWRITE_FONT_STRETCH *stretch,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontStretch(This,position,stretch,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetFontSize(IDWriteTextLayout3* This,UINT32 position,FLOAT *size,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontSize(This,position,size,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetUnderline(IDWriteTextLayout3* This,UINT32 position,WINBOOL *has_underline,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetUnderline(This,position,has_underline,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetStrikethrough(IDWriteTextLayout3* This,UINT32 position,WINBOOL *has_strikethrough,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetStrikethrough(This,position,has_strikethrough,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetDrawingEffect(IDWriteTextLayout3* This,UINT32 position,IUnknown **effect,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetDrawingEffect(This,position,effect,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetInlineObject(IDWriteTextLayout3* This,UINT32 position,IDWriteInlineObject **object,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetInlineObject(This,position,object,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetTypography(IDWriteTextLayout3* This,UINT32 position,IDWriteTypography **typography,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetTypography(This,position,typography,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetLocaleNameLength(IDWriteTextLayout3* This,UINT32 position,UINT32 *length,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetLocaleNameLength(This,position,length,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetLocaleName(IDWriteTextLayout3* This,UINT32 position,WCHAR *name,UINT32 name_size,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetLocaleName(This,position,name,name_size,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_Draw(IDWriteTextLayout3* This,void *context,IDWriteTextRenderer *renderer,FLOAT originX,FLOAT originY) { - return This->lpVtbl->Draw(This,context,renderer,originX,originY); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetOverhangMetrics(IDWriteTextLayout3* This,DWRITE_OVERHANG_METRICS *overhangs) { - return This->lpVtbl->GetOverhangMetrics(This,overhangs); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetClusterMetrics(IDWriteTextLayout3* This,DWRITE_CLUSTER_METRICS *metrics,UINT32 max_count,UINT32 *act_count) { - return This->lpVtbl->GetClusterMetrics(This,metrics,max_count,act_count); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_DetermineMinWidth(IDWriteTextLayout3* This,FLOAT *min_width) { - return This->lpVtbl->DetermineMinWidth(This,min_width); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_HitTestPoint(IDWriteTextLayout3* This,FLOAT pointX,FLOAT pointY,WINBOOL *is_trailinghit,WINBOOL *is_inside,DWRITE_HIT_TEST_METRICS *metrics) { - return This->lpVtbl->HitTestPoint(This,pointX,pointY,is_trailinghit,is_inside,metrics); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_HitTestTextPosition(IDWriteTextLayout3* This,UINT32 textPosition,WINBOOL is_trailinghit,FLOAT *pointX,FLOAT *pointY,DWRITE_HIT_TEST_METRICS *metrics) { - return This->lpVtbl->HitTestTextPosition(This,textPosition,is_trailinghit,pointX,pointY,metrics); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_HitTestTextRange(IDWriteTextLayout3* This,UINT32 textPosition,UINT32 textLength,FLOAT originX,FLOAT originY,DWRITE_HIT_TEST_METRICS *metrics,UINT32 max_metricscount,UINT32 *actual_metricscount) { - return This->lpVtbl->HitTestTextRange(This,textPosition,textLength,originX,originY,metrics,max_metricscount,actual_metricscount); -} -/*** IDWriteTextLayout1 methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout3_SetPairKerning(IDWriteTextLayout3* This,WINBOOL is_pairkerning_enabled,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetPairKerning(This,is_pairkerning_enabled,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetPairKerning(IDWriteTextLayout3* This,UINT32 position,WINBOOL *is_pairkerning_enabled,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetPairKerning(This,position,is_pairkerning_enabled,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetCharacterSpacing(IDWriteTextLayout3* This,FLOAT leading_spacing,FLOAT trailing_spacing,FLOAT minimum_advance_width,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetCharacterSpacing(This,leading_spacing,trailing_spacing,minimum_advance_width,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetCharacterSpacing(IDWriteTextLayout3* This,UINT32 position,FLOAT *leading_spacing,FLOAT *trailing_spacing,FLOAT *minimum_advance_width,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetCharacterSpacing(This,position,leading_spacing,trailing_spacing,minimum_advance_width,range); -} -/*** IDWriteTextLayout2 methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout3_GetMetrics(IDWriteTextLayout3* This,DWRITE_TEXT_METRICS1 *metrics) { - return This->lpVtbl->IDWriteTextLayout2_GetMetrics(This,metrics); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetVerticalGlyphOrientation(IDWriteTextLayout3* This,DWRITE_VERTICAL_GLYPH_ORIENTATION orientation) { - return This->lpVtbl->SetVerticalGlyphOrientation(This,orientation); -} -static FORCEINLINE DWRITE_VERTICAL_GLYPH_ORIENTATION IDWriteTextLayout3_GetVerticalGlyphOrientation(IDWriteTextLayout3* This) { - return This->lpVtbl->GetVerticalGlyphOrientation(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetLastLineWrapping(IDWriteTextLayout3* This,WINBOOL lastline_wrapping_enabled) { - return This->lpVtbl->SetLastLineWrapping(This,lastline_wrapping_enabled); -} -static FORCEINLINE WINBOOL IDWriteTextLayout3_GetLastLineWrapping(IDWriteTextLayout3* This) { - return This->lpVtbl->GetLastLineWrapping(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetOpticalAlignment(IDWriteTextLayout3* This,DWRITE_OPTICAL_ALIGNMENT alignment) { - return This->lpVtbl->SetOpticalAlignment(This,alignment); -} -static FORCEINLINE DWRITE_OPTICAL_ALIGNMENT IDWriteTextLayout3_GetOpticalAlignment(IDWriteTextLayout3* This) { - return This->lpVtbl->GetOpticalAlignment(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetFontFallback(IDWriteTextLayout3* This,IDWriteFontFallback *fallback) { - return This->lpVtbl->SetFontFallback(This,fallback); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetFontFallback(IDWriteTextLayout3* This,IDWriteFontFallback **fallback) { - return This->lpVtbl->GetFontFallback(This,fallback); -} -/*** IDWriteTextLayout3 methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout3_InvalidateLayout(IDWriteTextLayout3* This) { - return This->lpVtbl->InvalidateLayout(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_SetLineSpacing(IDWriteTextLayout3* This,const DWRITE_LINE_SPACING *spacing) { - return This->lpVtbl->IDWriteTextLayout3_SetLineSpacing(This,spacing); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetLineSpacing(IDWriteTextLayout3* This,DWRITE_LINE_SPACING *spacing) { - return This->lpVtbl->IDWriteTextLayout3_GetLineSpacing(This,spacing); -} -static FORCEINLINE HRESULT IDWriteTextLayout3_GetLineMetrics(IDWriteTextLayout3* This,DWRITE_LINE_METRICS1 *metrics,UINT32 max_count,UINT32 *count) { - return This->lpVtbl->IDWriteTextLayout3_GetLineMetrics(This,metrics,max_count,count); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteTextLayout3_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteTextLayout4 interface - */ -#ifndef __IDWriteTextLayout4_INTERFACE_DEFINED__ -#define __IDWriteTextLayout4_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteTextLayout4, 0x05a9bf42, 0x223f, 0x4441, 0xb5,0xfb, 0x82,0x63,0x68,0x5f,0x55,0xe9); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("05a9bf42-223f-4441-b5fb-8263685f55e9") -IDWriteTextLayout4 : public IDWriteTextLayout3 -{ - virtual HRESULT STDMETHODCALLTYPE SetFontAxisValues( - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - DWRITE_TEXT_RANGE range) = 0; - - virtual UINT32 STDMETHODCALLTYPE GetFontAxisValueCount( - UINT32 pos) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontAxisValues( - UINT32 pos, - DWRITE_FONT_AXIS_VALUE *values, - UINT32 num_values, - DWRITE_TEXT_RANGE *range) = 0; - - virtual DWRITE_AUTOMATIC_FONT_AXES STDMETHODCALLTYPE GetAutomaticFontAxes( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE SetAutomaticFontAxes( - DWRITE_AUTOMATIC_FONT_AXES axes) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteTextLayout4, 0x05a9bf42, 0x223f, 0x4441, 0xb5,0xfb, 0x82,0x63,0x68,0x5f,0x55,0xe9) -#endif -#else -typedef struct IDWriteTextLayout4Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteTextLayout4 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteTextLayout4 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteTextLayout4 *This); - - /*** IDWriteTextFormat methods ***/ - HRESULT (STDMETHODCALLTYPE *SetTextAlignment)( - IDWriteTextLayout4 *This, - DWRITE_TEXT_ALIGNMENT alignment); - - HRESULT (STDMETHODCALLTYPE *SetParagraphAlignment)( - IDWriteTextLayout4 *This, - DWRITE_PARAGRAPH_ALIGNMENT alignment); - - HRESULT (STDMETHODCALLTYPE *SetWordWrapping)( - IDWriteTextLayout4 *This, - DWRITE_WORD_WRAPPING wrapping); - - HRESULT (STDMETHODCALLTYPE *SetReadingDirection)( - IDWriteTextLayout4 *This, - DWRITE_READING_DIRECTION direction); - - HRESULT (STDMETHODCALLTYPE *SetFlowDirection)( - IDWriteTextLayout4 *This, - DWRITE_FLOW_DIRECTION direction); - - HRESULT (STDMETHODCALLTYPE *SetIncrementalTabStop)( - IDWriteTextLayout4 *This, - FLOAT tabstop); - - HRESULT (STDMETHODCALLTYPE *SetTrimming)( - IDWriteTextLayout4 *This, - const DWRITE_TRIMMING *trimming, - IDWriteInlineObject *trimming_sign); - - HRESULT (STDMETHODCALLTYPE *SetLineSpacing)( - IDWriteTextLayout4 *This, - DWRITE_LINE_SPACING_METHOD spacing, - FLOAT line_spacing, - FLOAT baseline); - - DWRITE_TEXT_ALIGNMENT (STDMETHODCALLTYPE *GetTextAlignment)( - IDWriteTextLayout4 *This); - - DWRITE_PARAGRAPH_ALIGNMENT (STDMETHODCALLTYPE *GetParagraphAlignment)( - IDWriteTextLayout4 *This); - - DWRITE_WORD_WRAPPING (STDMETHODCALLTYPE *GetWordWrapping)( - IDWriteTextLayout4 *This); - - DWRITE_READING_DIRECTION (STDMETHODCALLTYPE *GetReadingDirection)( - IDWriteTextLayout4 *This); - - DWRITE_FLOW_DIRECTION (STDMETHODCALLTYPE *GetFlowDirection)( - IDWriteTextLayout4 *This); - - FLOAT (STDMETHODCALLTYPE *GetIncrementalTabStop)( - IDWriteTextLayout4 *This); - - HRESULT (STDMETHODCALLTYPE *GetTrimming)( - IDWriteTextLayout4 *This, - DWRITE_TRIMMING *options, - IDWriteInlineObject **trimming_sign); - - HRESULT (STDMETHODCALLTYPE *GetLineSpacing)( - IDWriteTextLayout4 *This, - DWRITE_LINE_SPACING_METHOD *method, - FLOAT *spacing, - FLOAT *baseline); - - HRESULT (STDMETHODCALLTYPE *GetFontCollection)( - IDWriteTextLayout4 *This, - IDWriteFontCollection **collection); - - UINT32 (STDMETHODCALLTYPE *GetFontFamilyNameLength)( - IDWriteTextLayout4 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontFamilyName)( - IDWriteTextLayout4 *This, - WCHAR *name, - UINT32 size); - - DWRITE_FONT_WEIGHT (STDMETHODCALLTYPE *GetFontWeight)( - IDWriteTextLayout4 *This); - - DWRITE_FONT_STYLE (STDMETHODCALLTYPE *GetFontStyle)( - IDWriteTextLayout4 *This); - - DWRITE_FONT_STRETCH (STDMETHODCALLTYPE *GetFontStretch)( - IDWriteTextLayout4 *This); - - FLOAT (STDMETHODCALLTYPE *GetFontSize)( - IDWriteTextLayout4 *This); - - UINT32 (STDMETHODCALLTYPE *GetLocaleNameLength)( - IDWriteTextLayout4 *This); - - HRESULT (STDMETHODCALLTYPE *GetLocaleName)( - IDWriteTextLayout4 *This, - WCHAR *name, - UINT32 size); - - /*** IDWriteTextLayout methods ***/ - HRESULT (STDMETHODCALLTYPE *SetMaxWidth)( - IDWriteTextLayout4 *This, - FLOAT maxWidth); - - HRESULT (STDMETHODCALLTYPE *SetMaxHeight)( - IDWriteTextLayout4 *This, - FLOAT maxHeight); - - HRESULT (STDMETHODCALLTYPE *SetFontCollection)( - IDWriteTextLayout4 *This, - IDWriteFontCollection *collection, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetFontFamilyName)( - IDWriteTextLayout4 *This, - const WCHAR *name, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetFontWeight)( - IDWriteTextLayout4 *This, - DWRITE_FONT_WEIGHT weight, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetFontStyle)( - IDWriteTextLayout4 *This, - DWRITE_FONT_STYLE style, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetFontStretch)( - IDWriteTextLayout4 *This, - DWRITE_FONT_STRETCH stretch, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetFontSize)( - IDWriteTextLayout4 *This, - FLOAT size, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetUnderline)( - IDWriteTextLayout4 *This, - WINBOOL underline, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetStrikethrough)( - IDWriteTextLayout4 *This, - WINBOOL strikethrough, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetDrawingEffect)( - IDWriteTextLayout4 *This, - IUnknown *effect, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetInlineObject)( - IDWriteTextLayout4 *This, - IDWriteInlineObject *object, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetTypography)( - IDWriteTextLayout4 *This, - IDWriteTypography *typography, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *SetLocaleName)( - IDWriteTextLayout4 *This, - const WCHAR *locale, - DWRITE_TEXT_RANGE range); - - FLOAT (STDMETHODCALLTYPE *GetMaxWidth)( - IDWriteTextLayout4 *This); - - FLOAT (STDMETHODCALLTYPE *GetMaxHeight)( - IDWriteTextLayout4 *This); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontCollection)( - IDWriteTextLayout4 *This, - UINT32 pos, - IDWriteFontCollection **collection, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontFamilyNameLength)( - IDWriteTextLayout4 *This, - UINT32 pos, - UINT32 *len, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontFamilyName)( - IDWriteTextLayout4 *This, - UINT32 position, - WCHAR *name, - UINT32 name_size, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontWeight)( - IDWriteTextLayout4 *This, - UINT32 position, - DWRITE_FONT_WEIGHT *weight, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontStyle)( - IDWriteTextLayout4 *This, - UINT32 currentPosition, - DWRITE_FONT_STYLE *style, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontStretch)( - IDWriteTextLayout4 *This, - UINT32 position, - DWRITE_FONT_STRETCH *stretch, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetFontSize)( - IDWriteTextLayout4 *This, - UINT32 position, - FLOAT *size, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *GetUnderline)( - IDWriteTextLayout4 *This, - UINT32 position, - WINBOOL *has_underline, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *GetStrikethrough)( - IDWriteTextLayout4 *This, - UINT32 position, - WINBOOL *has_strikethrough, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *GetDrawingEffect)( - IDWriteTextLayout4 *This, - UINT32 position, - IUnknown **effect, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *GetInlineObject)( - IDWriteTextLayout4 *This, - UINT32 position, - IDWriteInlineObject **object, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *GetTypography)( - IDWriteTextLayout4 *This, - UINT32 position, - IDWriteTypography **typography, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetLocaleNameLength)( - IDWriteTextLayout4 *This, - UINT32 position, - UINT32 *length, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout_GetLocaleName)( - IDWriteTextLayout4 *This, - UINT32 position, - WCHAR *name, - UINT32 name_size, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *Draw)( - IDWriteTextLayout4 *This, - void *context, - IDWriteTextRenderer *renderer, - FLOAT originX, - FLOAT originY); - - HRESULT (STDMETHODCALLTYPE *GetLineMetrics)( - IDWriteTextLayout4 *This, - DWRITE_LINE_METRICS *metrics, - UINT32 max_count, - UINT32 *actual_count); - - HRESULT (STDMETHODCALLTYPE *GetMetrics)( - IDWriteTextLayout4 *This, - DWRITE_TEXT_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *GetOverhangMetrics)( - IDWriteTextLayout4 *This, - DWRITE_OVERHANG_METRICS *overhangs); - - HRESULT (STDMETHODCALLTYPE *GetClusterMetrics)( - IDWriteTextLayout4 *This, - DWRITE_CLUSTER_METRICS *metrics, - UINT32 max_count, - UINT32 *act_count); - - HRESULT (STDMETHODCALLTYPE *DetermineMinWidth)( - IDWriteTextLayout4 *This, - FLOAT *min_width); - - HRESULT (STDMETHODCALLTYPE *HitTestPoint)( - IDWriteTextLayout4 *This, - FLOAT pointX, - FLOAT pointY, - WINBOOL *is_trailinghit, - WINBOOL *is_inside, - DWRITE_HIT_TEST_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *HitTestTextPosition)( - IDWriteTextLayout4 *This, - UINT32 textPosition, - WINBOOL is_trailinghit, - FLOAT *pointX, - FLOAT *pointY, - DWRITE_HIT_TEST_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *HitTestTextRange)( - IDWriteTextLayout4 *This, - UINT32 textPosition, - UINT32 textLength, - FLOAT originX, - FLOAT originY, - DWRITE_HIT_TEST_METRICS *metrics, - UINT32 max_metricscount, - UINT32 *actual_metricscount); - - /*** IDWriteTextLayout1 methods ***/ - HRESULT (STDMETHODCALLTYPE *SetPairKerning)( - IDWriteTextLayout4 *This, - WINBOOL is_pairkerning_enabled, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *GetPairKerning)( - IDWriteTextLayout4 *This, - UINT32 position, - WINBOOL *is_pairkerning_enabled, - DWRITE_TEXT_RANGE *range); - - HRESULT (STDMETHODCALLTYPE *SetCharacterSpacing)( - IDWriteTextLayout4 *This, - FLOAT leading_spacing, - FLOAT trailing_spacing, - FLOAT minimum_advance_width, - DWRITE_TEXT_RANGE range); - - HRESULT (STDMETHODCALLTYPE *GetCharacterSpacing)( - IDWriteTextLayout4 *This, - UINT32 position, - FLOAT *leading_spacing, - FLOAT *trailing_spacing, - FLOAT *minimum_advance_width, - DWRITE_TEXT_RANGE *range); - - /*** IDWriteTextLayout2 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout2_GetMetrics)( - IDWriteTextLayout4 *This, - DWRITE_TEXT_METRICS1 *metrics); - - HRESULT (STDMETHODCALLTYPE *SetVerticalGlyphOrientation)( - IDWriteTextLayout4 *This, - DWRITE_VERTICAL_GLYPH_ORIENTATION orientation); - - DWRITE_VERTICAL_GLYPH_ORIENTATION (STDMETHODCALLTYPE *GetVerticalGlyphOrientation)( - IDWriteTextLayout4 *This); - - HRESULT (STDMETHODCALLTYPE *SetLastLineWrapping)( - IDWriteTextLayout4 *This, - WINBOOL lastline_wrapping_enabled); - - WINBOOL (STDMETHODCALLTYPE *GetLastLineWrapping)( - IDWriteTextLayout4 *This); - - HRESULT (STDMETHODCALLTYPE *SetOpticalAlignment)( - IDWriteTextLayout4 *This, - DWRITE_OPTICAL_ALIGNMENT alignment); - - DWRITE_OPTICAL_ALIGNMENT (STDMETHODCALLTYPE *GetOpticalAlignment)( - IDWriteTextLayout4 *This); - - HRESULT (STDMETHODCALLTYPE *SetFontFallback)( - IDWriteTextLayout4 *This, - IDWriteFontFallback *fallback); - - HRESULT (STDMETHODCALLTYPE *GetFontFallback)( - IDWriteTextLayout4 *This, - IDWriteFontFallback **fallback); - - /*** IDWriteTextLayout3 methods ***/ - HRESULT (STDMETHODCALLTYPE *InvalidateLayout)( - IDWriteTextLayout4 *This); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout3_SetLineSpacing)( - IDWriteTextLayout4 *This, - const DWRITE_LINE_SPACING *spacing); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout3_GetLineSpacing)( - IDWriteTextLayout4 *This, - DWRITE_LINE_SPACING *spacing); - - HRESULT (STDMETHODCALLTYPE *IDWriteTextLayout3_GetLineMetrics)( - IDWriteTextLayout4 *This, - DWRITE_LINE_METRICS1 *metrics, - UINT32 max_count, - UINT32 *count); - - /*** IDWriteTextLayout4 methods ***/ - HRESULT (STDMETHODCALLTYPE *SetFontAxisValues)( - IDWriteTextLayout4 *This, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - DWRITE_TEXT_RANGE range); - - UINT32 (STDMETHODCALLTYPE *GetFontAxisValueCount)( - IDWriteTextLayout4 *This, - UINT32 pos); - - HRESULT (STDMETHODCALLTYPE *GetFontAxisValues)( - IDWriteTextLayout4 *This, - UINT32 pos, - DWRITE_FONT_AXIS_VALUE *values, - UINT32 num_values, - DWRITE_TEXT_RANGE *range); - - DWRITE_AUTOMATIC_FONT_AXES (STDMETHODCALLTYPE *GetAutomaticFontAxes)( - IDWriteTextLayout4 *This); - - HRESULT (STDMETHODCALLTYPE *SetAutomaticFontAxes)( - IDWriteTextLayout4 *This, - DWRITE_AUTOMATIC_FONT_AXES axes); - - END_INTERFACE -} IDWriteTextLayout4Vtbl; - -interface IDWriteTextLayout4 { - CONST_VTBL IDWriteTextLayout4Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteTextLayout4_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteTextLayout4_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteTextLayout4_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteTextFormat methods ***/ -#define IDWriteTextLayout4_SetTextAlignment(This,alignment) (This)->lpVtbl->SetTextAlignment(This,alignment) -#define IDWriteTextLayout4_SetParagraphAlignment(This,alignment) (This)->lpVtbl->SetParagraphAlignment(This,alignment) -#define IDWriteTextLayout4_SetWordWrapping(This,wrapping) (This)->lpVtbl->SetWordWrapping(This,wrapping) -#define IDWriteTextLayout4_SetReadingDirection(This,direction) (This)->lpVtbl->SetReadingDirection(This,direction) -#define IDWriteTextLayout4_SetFlowDirection(This,direction) (This)->lpVtbl->SetFlowDirection(This,direction) -#define IDWriteTextLayout4_SetIncrementalTabStop(This,tabstop) (This)->lpVtbl->SetIncrementalTabStop(This,tabstop) -#define IDWriteTextLayout4_SetTrimming(This,trimming,trimming_sign) (This)->lpVtbl->SetTrimming(This,trimming,trimming_sign) -#define IDWriteTextLayout4_GetTextAlignment(This) (This)->lpVtbl->GetTextAlignment(This) -#define IDWriteTextLayout4_GetParagraphAlignment(This) (This)->lpVtbl->GetParagraphAlignment(This) -#define IDWriteTextLayout4_GetWordWrapping(This) (This)->lpVtbl->GetWordWrapping(This) -#define IDWriteTextLayout4_GetReadingDirection(This) (This)->lpVtbl->GetReadingDirection(This) -#define IDWriteTextLayout4_GetFlowDirection(This) (This)->lpVtbl->GetFlowDirection(This) -#define IDWriteTextLayout4_GetIncrementalTabStop(This) (This)->lpVtbl->GetIncrementalTabStop(This) -#define IDWriteTextLayout4_GetTrimming(This,options,trimming_sign) (This)->lpVtbl->GetTrimming(This,options,trimming_sign) -/*** IDWriteTextLayout methods ***/ -#define IDWriteTextLayout4_SetMaxWidth(This,maxWidth) (This)->lpVtbl->SetMaxWidth(This,maxWidth) -#define IDWriteTextLayout4_SetMaxHeight(This,maxHeight) (This)->lpVtbl->SetMaxHeight(This,maxHeight) -#define IDWriteTextLayout4_SetFontCollection(This,collection,range) (This)->lpVtbl->SetFontCollection(This,collection,range) -#define IDWriteTextLayout4_SetFontFamilyName(This,name,range) (This)->lpVtbl->SetFontFamilyName(This,name,range) -#define IDWriteTextLayout4_SetFontWeight(This,weight,range) (This)->lpVtbl->SetFontWeight(This,weight,range) -#define IDWriteTextLayout4_SetFontStyle(This,style,range) (This)->lpVtbl->SetFontStyle(This,style,range) -#define IDWriteTextLayout4_SetFontStretch(This,stretch,range) (This)->lpVtbl->SetFontStretch(This,stretch,range) -#define IDWriteTextLayout4_SetFontSize(This,size,range) (This)->lpVtbl->SetFontSize(This,size,range) -#define IDWriteTextLayout4_SetUnderline(This,underline,range) (This)->lpVtbl->SetUnderline(This,underline,range) -#define IDWriteTextLayout4_SetStrikethrough(This,strikethrough,range) (This)->lpVtbl->SetStrikethrough(This,strikethrough,range) -#define IDWriteTextLayout4_SetDrawingEffect(This,effect,range) (This)->lpVtbl->SetDrawingEffect(This,effect,range) -#define IDWriteTextLayout4_SetInlineObject(This,object,range) (This)->lpVtbl->SetInlineObject(This,object,range) -#define IDWriteTextLayout4_SetTypography(This,typography,range) (This)->lpVtbl->SetTypography(This,typography,range) -#define IDWriteTextLayout4_SetLocaleName(This,locale,range) (This)->lpVtbl->SetLocaleName(This,locale,range) -#define IDWriteTextLayout4_GetMaxWidth(This) (This)->lpVtbl->GetMaxWidth(This) -#define IDWriteTextLayout4_GetMaxHeight(This) (This)->lpVtbl->GetMaxHeight(This) -#define IDWriteTextLayout4_GetFontCollection(This,pos,collection,range) (This)->lpVtbl->IDWriteTextLayout_GetFontCollection(This,pos,collection,range) -#define IDWriteTextLayout4_GetFontFamilyNameLength(This,pos,len,range) (This)->lpVtbl->IDWriteTextLayout_GetFontFamilyNameLength(This,pos,len,range) -#define IDWriteTextLayout4_GetFontFamilyName(This,position,name,name_size,range) (This)->lpVtbl->IDWriteTextLayout_GetFontFamilyName(This,position,name,name_size,range) -#define IDWriteTextLayout4_GetFontWeight(This,position,weight,range) (This)->lpVtbl->IDWriteTextLayout_GetFontWeight(This,position,weight,range) -#define IDWriteTextLayout4_GetFontStyle(This,currentPosition,style,range) (This)->lpVtbl->IDWriteTextLayout_GetFontStyle(This,currentPosition,style,range) -#define IDWriteTextLayout4_GetFontStretch(This,position,stretch,range) (This)->lpVtbl->IDWriteTextLayout_GetFontStretch(This,position,stretch,range) -#define IDWriteTextLayout4_GetFontSize(This,position,size,range) (This)->lpVtbl->IDWriteTextLayout_GetFontSize(This,position,size,range) -#define IDWriteTextLayout4_GetUnderline(This,position,has_underline,range) (This)->lpVtbl->GetUnderline(This,position,has_underline,range) -#define IDWriteTextLayout4_GetStrikethrough(This,position,has_strikethrough,range) (This)->lpVtbl->GetStrikethrough(This,position,has_strikethrough,range) -#define IDWriteTextLayout4_GetDrawingEffect(This,position,effect,range) (This)->lpVtbl->GetDrawingEffect(This,position,effect,range) -#define IDWriteTextLayout4_GetInlineObject(This,position,object,range) (This)->lpVtbl->GetInlineObject(This,position,object,range) -#define IDWriteTextLayout4_GetTypography(This,position,typography,range) (This)->lpVtbl->GetTypography(This,position,typography,range) -#define IDWriteTextLayout4_GetLocaleNameLength(This,position,length,range) (This)->lpVtbl->IDWriteTextLayout_GetLocaleNameLength(This,position,length,range) -#define IDWriteTextLayout4_GetLocaleName(This,position,name,name_size,range) (This)->lpVtbl->IDWriteTextLayout_GetLocaleName(This,position,name,name_size,range) -#define IDWriteTextLayout4_Draw(This,context,renderer,originX,originY) (This)->lpVtbl->Draw(This,context,renderer,originX,originY) -#define IDWriteTextLayout4_GetOverhangMetrics(This,overhangs) (This)->lpVtbl->GetOverhangMetrics(This,overhangs) -#define IDWriteTextLayout4_GetClusterMetrics(This,metrics,max_count,act_count) (This)->lpVtbl->GetClusterMetrics(This,metrics,max_count,act_count) -#define IDWriteTextLayout4_DetermineMinWidth(This,min_width) (This)->lpVtbl->DetermineMinWidth(This,min_width) -#define IDWriteTextLayout4_HitTestPoint(This,pointX,pointY,is_trailinghit,is_inside,metrics) (This)->lpVtbl->HitTestPoint(This,pointX,pointY,is_trailinghit,is_inside,metrics) -#define IDWriteTextLayout4_HitTestTextPosition(This,textPosition,is_trailinghit,pointX,pointY,metrics) (This)->lpVtbl->HitTestTextPosition(This,textPosition,is_trailinghit,pointX,pointY,metrics) -#define IDWriteTextLayout4_HitTestTextRange(This,textPosition,textLength,originX,originY,metrics,max_metricscount,actual_metricscount) (This)->lpVtbl->HitTestTextRange(This,textPosition,textLength,originX,originY,metrics,max_metricscount,actual_metricscount) -/*** IDWriteTextLayout1 methods ***/ -#define IDWriteTextLayout4_SetPairKerning(This,is_pairkerning_enabled,range) (This)->lpVtbl->SetPairKerning(This,is_pairkerning_enabled,range) -#define IDWriteTextLayout4_GetPairKerning(This,position,is_pairkerning_enabled,range) (This)->lpVtbl->GetPairKerning(This,position,is_pairkerning_enabled,range) -#define IDWriteTextLayout4_SetCharacterSpacing(This,leading_spacing,trailing_spacing,minimum_advance_width,range) (This)->lpVtbl->SetCharacterSpacing(This,leading_spacing,trailing_spacing,minimum_advance_width,range) -#define IDWriteTextLayout4_GetCharacterSpacing(This,position,leading_spacing,trailing_spacing,minimum_advance_width,range) (This)->lpVtbl->GetCharacterSpacing(This,position,leading_spacing,trailing_spacing,minimum_advance_width,range) -/*** IDWriteTextLayout2 methods ***/ -#define IDWriteTextLayout4_GetMetrics(This,metrics) (This)->lpVtbl->IDWriteTextLayout2_GetMetrics(This,metrics) -#define IDWriteTextLayout4_SetVerticalGlyphOrientation(This,orientation) (This)->lpVtbl->SetVerticalGlyphOrientation(This,orientation) -#define IDWriteTextLayout4_GetVerticalGlyphOrientation(This) (This)->lpVtbl->GetVerticalGlyphOrientation(This) -#define IDWriteTextLayout4_SetLastLineWrapping(This,lastline_wrapping_enabled) (This)->lpVtbl->SetLastLineWrapping(This,lastline_wrapping_enabled) -#define IDWriteTextLayout4_GetLastLineWrapping(This) (This)->lpVtbl->GetLastLineWrapping(This) -#define IDWriteTextLayout4_SetOpticalAlignment(This,alignment) (This)->lpVtbl->SetOpticalAlignment(This,alignment) -#define IDWriteTextLayout4_GetOpticalAlignment(This) (This)->lpVtbl->GetOpticalAlignment(This) -#define IDWriteTextLayout4_SetFontFallback(This,fallback) (This)->lpVtbl->SetFontFallback(This,fallback) -#define IDWriteTextLayout4_GetFontFallback(This,fallback) (This)->lpVtbl->GetFontFallback(This,fallback) -/*** IDWriteTextLayout3 methods ***/ -#define IDWriteTextLayout4_InvalidateLayout(This) (This)->lpVtbl->InvalidateLayout(This) -#define IDWriteTextLayout4_SetLineSpacing(This,spacing) (This)->lpVtbl->IDWriteTextLayout3_SetLineSpacing(This,spacing) -#define IDWriteTextLayout4_GetLineSpacing(This,spacing) (This)->lpVtbl->IDWriteTextLayout3_GetLineSpacing(This,spacing) -#define IDWriteTextLayout4_GetLineMetrics(This,metrics,max_count,count) (This)->lpVtbl->IDWriteTextLayout3_GetLineMetrics(This,metrics,max_count,count) -/*** IDWriteTextLayout4 methods ***/ -#define IDWriteTextLayout4_SetFontAxisValues(This,axis_values,num_values,range) (This)->lpVtbl->SetFontAxisValues(This,axis_values,num_values,range) -#define IDWriteTextLayout4_GetFontAxisValueCount(This,pos) (This)->lpVtbl->GetFontAxisValueCount(This,pos) -#define IDWriteTextLayout4_GetFontAxisValues(This,pos,values,num_values,range) (This)->lpVtbl->GetFontAxisValues(This,pos,values,num_values,range) -#define IDWriteTextLayout4_GetAutomaticFontAxes(This) (This)->lpVtbl->GetAutomaticFontAxes(This) -#define IDWriteTextLayout4_SetAutomaticFontAxes(This,axes) (This)->lpVtbl->SetAutomaticFontAxes(This,axes) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout4_QueryInterface(IDWriteTextLayout4* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteTextLayout4_AddRef(IDWriteTextLayout4* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteTextLayout4_Release(IDWriteTextLayout4* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteTextFormat methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout4_SetTextAlignment(IDWriteTextLayout4* This,DWRITE_TEXT_ALIGNMENT alignment) { - return This->lpVtbl->SetTextAlignment(This,alignment); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetParagraphAlignment(IDWriteTextLayout4* This,DWRITE_PARAGRAPH_ALIGNMENT alignment) { - return This->lpVtbl->SetParagraphAlignment(This,alignment); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetWordWrapping(IDWriteTextLayout4* This,DWRITE_WORD_WRAPPING wrapping) { - return This->lpVtbl->SetWordWrapping(This,wrapping); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetReadingDirection(IDWriteTextLayout4* This,DWRITE_READING_DIRECTION direction) { - return This->lpVtbl->SetReadingDirection(This,direction); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetFlowDirection(IDWriteTextLayout4* This,DWRITE_FLOW_DIRECTION direction) { - return This->lpVtbl->SetFlowDirection(This,direction); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetIncrementalTabStop(IDWriteTextLayout4* This,FLOAT tabstop) { - return This->lpVtbl->SetIncrementalTabStop(This,tabstop); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetTrimming(IDWriteTextLayout4* This,const DWRITE_TRIMMING *trimming,IDWriteInlineObject *trimming_sign) { - return This->lpVtbl->SetTrimming(This,trimming,trimming_sign); -} -static FORCEINLINE DWRITE_TEXT_ALIGNMENT IDWriteTextLayout4_GetTextAlignment(IDWriteTextLayout4* This) { - return This->lpVtbl->GetTextAlignment(This); -} -static FORCEINLINE DWRITE_PARAGRAPH_ALIGNMENT IDWriteTextLayout4_GetParagraphAlignment(IDWriteTextLayout4* This) { - return This->lpVtbl->GetParagraphAlignment(This); -} -static FORCEINLINE DWRITE_WORD_WRAPPING IDWriteTextLayout4_GetWordWrapping(IDWriteTextLayout4* This) { - return This->lpVtbl->GetWordWrapping(This); -} -static FORCEINLINE DWRITE_READING_DIRECTION IDWriteTextLayout4_GetReadingDirection(IDWriteTextLayout4* This) { - return This->lpVtbl->GetReadingDirection(This); -} -static FORCEINLINE DWRITE_FLOW_DIRECTION IDWriteTextLayout4_GetFlowDirection(IDWriteTextLayout4* This) { - return This->lpVtbl->GetFlowDirection(This); -} -static FORCEINLINE FLOAT IDWriteTextLayout4_GetIncrementalTabStop(IDWriteTextLayout4* This) { - return This->lpVtbl->GetIncrementalTabStop(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetTrimming(IDWriteTextLayout4* This,DWRITE_TRIMMING *options,IDWriteInlineObject **trimming_sign) { - return This->lpVtbl->GetTrimming(This,options,trimming_sign); -} -/*** IDWriteTextLayout methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout4_SetMaxWidth(IDWriteTextLayout4* This,FLOAT maxWidth) { - return This->lpVtbl->SetMaxWidth(This,maxWidth); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetMaxHeight(IDWriteTextLayout4* This,FLOAT maxHeight) { - return This->lpVtbl->SetMaxHeight(This,maxHeight); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetFontCollection(IDWriteTextLayout4* This,IDWriteFontCollection *collection,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontCollection(This,collection,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetFontFamilyName(IDWriteTextLayout4* This,const WCHAR *name,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontFamilyName(This,name,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetFontWeight(IDWriteTextLayout4* This,DWRITE_FONT_WEIGHT weight,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontWeight(This,weight,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetFontStyle(IDWriteTextLayout4* This,DWRITE_FONT_STYLE style,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontStyle(This,style,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetFontStretch(IDWriteTextLayout4* This,DWRITE_FONT_STRETCH stretch,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontStretch(This,stretch,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetFontSize(IDWriteTextLayout4* This,FLOAT size,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontSize(This,size,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetUnderline(IDWriteTextLayout4* This,WINBOOL underline,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetUnderline(This,underline,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetStrikethrough(IDWriteTextLayout4* This,WINBOOL strikethrough,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetStrikethrough(This,strikethrough,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetDrawingEffect(IDWriteTextLayout4* This,IUnknown *effect,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetDrawingEffect(This,effect,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetInlineObject(IDWriteTextLayout4* This,IDWriteInlineObject *object,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetInlineObject(This,object,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetTypography(IDWriteTextLayout4* This,IDWriteTypography *typography,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetTypography(This,typography,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetLocaleName(IDWriteTextLayout4* This,const WCHAR *locale,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetLocaleName(This,locale,range); -} -static FORCEINLINE FLOAT IDWriteTextLayout4_GetMaxWidth(IDWriteTextLayout4* This) { - return This->lpVtbl->GetMaxWidth(This); -} -static FORCEINLINE FLOAT IDWriteTextLayout4_GetMaxHeight(IDWriteTextLayout4* This) { - return This->lpVtbl->GetMaxHeight(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetFontCollection(IDWriteTextLayout4* This,UINT32 pos,IDWriteFontCollection **collection,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontCollection(This,pos,collection,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetFontFamilyNameLength(IDWriteTextLayout4* This,UINT32 pos,UINT32 *len,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontFamilyNameLength(This,pos,len,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetFontFamilyName(IDWriteTextLayout4* This,UINT32 position,WCHAR *name,UINT32 name_size,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontFamilyName(This,position,name,name_size,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetFontWeight(IDWriteTextLayout4* This,UINT32 position,DWRITE_FONT_WEIGHT *weight,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontWeight(This,position,weight,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetFontStyle(IDWriteTextLayout4* This,UINT32 currentPosition,DWRITE_FONT_STYLE *style,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontStyle(This,currentPosition,style,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetFontStretch(IDWriteTextLayout4* This,UINT32 position,DWRITE_FONT_STRETCH *stretch,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontStretch(This,position,stretch,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetFontSize(IDWriteTextLayout4* This,UINT32 position,FLOAT *size,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetFontSize(This,position,size,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetUnderline(IDWriteTextLayout4* This,UINT32 position,WINBOOL *has_underline,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetUnderline(This,position,has_underline,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetStrikethrough(IDWriteTextLayout4* This,UINT32 position,WINBOOL *has_strikethrough,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetStrikethrough(This,position,has_strikethrough,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetDrawingEffect(IDWriteTextLayout4* This,UINT32 position,IUnknown **effect,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetDrawingEffect(This,position,effect,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetInlineObject(IDWriteTextLayout4* This,UINT32 position,IDWriteInlineObject **object,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetInlineObject(This,position,object,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetTypography(IDWriteTextLayout4* This,UINT32 position,IDWriteTypography **typography,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetTypography(This,position,typography,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetLocaleNameLength(IDWriteTextLayout4* This,UINT32 position,UINT32 *length,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetLocaleNameLength(This,position,length,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetLocaleName(IDWriteTextLayout4* This,UINT32 position,WCHAR *name,UINT32 name_size,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->IDWriteTextLayout_GetLocaleName(This,position,name,name_size,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_Draw(IDWriteTextLayout4* This,void *context,IDWriteTextRenderer *renderer,FLOAT originX,FLOAT originY) { - return This->lpVtbl->Draw(This,context,renderer,originX,originY); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetOverhangMetrics(IDWriteTextLayout4* This,DWRITE_OVERHANG_METRICS *overhangs) { - return This->lpVtbl->GetOverhangMetrics(This,overhangs); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetClusterMetrics(IDWriteTextLayout4* This,DWRITE_CLUSTER_METRICS *metrics,UINT32 max_count,UINT32 *act_count) { - return This->lpVtbl->GetClusterMetrics(This,metrics,max_count,act_count); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_DetermineMinWidth(IDWriteTextLayout4* This,FLOAT *min_width) { - return This->lpVtbl->DetermineMinWidth(This,min_width); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_HitTestPoint(IDWriteTextLayout4* This,FLOAT pointX,FLOAT pointY,WINBOOL *is_trailinghit,WINBOOL *is_inside,DWRITE_HIT_TEST_METRICS *metrics) { - return This->lpVtbl->HitTestPoint(This,pointX,pointY,is_trailinghit,is_inside,metrics); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_HitTestTextPosition(IDWriteTextLayout4* This,UINT32 textPosition,WINBOOL is_trailinghit,FLOAT *pointX,FLOAT *pointY,DWRITE_HIT_TEST_METRICS *metrics) { - return This->lpVtbl->HitTestTextPosition(This,textPosition,is_trailinghit,pointX,pointY,metrics); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_HitTestTextRange(IDWriteTextLayout4* This,UINT32 textPosition,UINT32 textLength,FLOAT originX,FLOAT originY,DWRITE_HIT_TEST_METRICS *metrics,UINT32 max_metricscount,UINT32 *actual_metricscount) { - return This->lpVtbl->HitTestTextRange(This,textPosition,textLength,originX,originY,metrics,max_metricscount,actual_metricscount); -} -/*** IDWriteTextLayout1 methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout4_SetPairKerning(IDWriteTextLayout4* This,WINBOOL is_pairkerning_enabled,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetPairKerning(This,is_pairkerning_enabled,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetPairKerning(IDWriteTextLayout4* This,UINT32 position,WINBOOL *is_pairkerning_enabled,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetPairKerning(This,position,is_pairkerning_enabled,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetCharacterSpacing(IDWriteTextLayout4* This,FLOAT leading_spacing,FLOAT trailing_spacing,FLOAT minimum_advance_width,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetCharacterSpacing(This,leading_spacing,trailing_spacing,minimum_advance_width,range); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetCharacterSpacing(IDWriteTextLayout4* This,UINT32 position,FLOAT *leading_spacing,FLOAT *trailing_spacing,FLOAT *minimum_advance_width,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetCharacterSpacing(This,position,leading_spacing,trailing_spacing,minimum_advance_width,range); -} -/*** IDWriteTextLayout2 methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout4_GetMetrics(IDWriteTextLayout4* This,DWRITE_TEXT_METRICS1 *metrics) { - return This->lpVtbl->IDWriteTextLayout2_GetMetrics(This,metrics); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetVerticalGlyphOrientation(IDWriteTextLayout4* This,DWRITE_VERTICAL_GLYPH_ORIENTATION orientation) { - return This->lpVtbl->SetVerticalGlyphOrientation(This,orientation); -} -static FORCEINLINE DWRITE_VERTICAL_GLYPH_ORIENTATION IDWriteTextLayout4_GetVerticalGlyphOrientation(IDWriteTextLayout4* This) { - return This->lpVtbl->GetVerticalGlyphOrientation(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetLastLineWrapping(IDWriteTextLayout4* This,WINBOOL lastline_wrapping_enabled) { - return This->lpVtbl->SetLastLineWrapping(This,lastline_wrapping_enabled); -} -static FORCEINLINE WINBOOL IDWriteTextLayout4_GetLastLineWrapping(IDWriteTextLayout4* This) { - return This->lpVtbl->GetLastLineWrapping(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetOpticalAlignment(IDWriteTextLayout4* This,DWRITE_OPTICAL_ALIGNMENT alignment) { - return This->lpVtbl->SetOpticalAlignment(This,alignment); -} -static FORCEINLINE DWRITE_OPTICAL_ALIGNMENT IDWriteTextLayout4_GetOpticalAlignment(IDWriteTextLayout4* This) { - return This->lpVtbl->GetOpticalAlignment(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetFontFallback(IDWriteTextLayout4* This,IDWriteFontFallback *fallback) { - return This->lpVtbl->SetFontFallback(This,fallback); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetFontFallback(IDWriteTextLayout4* This,IDWriteFontFallback **fallback) { - return This->lpVtbl->GetFontFallback(This,fallback); -} -/*** IDWriteTextLayout3 methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout4_InvalidateLayout(IDWriteTextLayout4* This) { - return This->lpVtbl->InvalidateLayout(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetLineSpacing(IDWriteTextLayout4* This,const DWRITE_LINE_SPACING *spacing) { - return This->lpVtbl->IDWriteTextLayout3_SetLineSpacing(This,spacing); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetLineSpacing(IDWriteTextLayout4* This,DWRITE_LINE_SPACING *spacing) { - return This->lpVtbl->IDWriteTextLayout3_GetLineSpacing(This,spacing); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetLineMetrics(IDWriteTextLayout4* This,DWRITE_LINE_METRICS1 *metrics,UINT32 max_count,UINT32 *count) { - return This->lpVtbl->IDWriteTextLayout3_GetLineMetrics(This,metrics,max_count,count); -} -/*** IDWriteTextLayout4 methods ***/ -static FORCEINLINE HRESULT IDWriteTextLayout4_SetFontAxisValues(IDWriteTextLayout4* This,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values,DWRITE_TEXT_RANGE range) { - return This->lpVtbl->SetFontAxisValues(This,axis_values,num_values,range); -} -static FORCEINLINE UINT32 IDWriteTextLayout4_GetFontAxisValueCount(IDWriteTextLayout4* This,UINT32 pos) { - return This->lpVtbl->GetFontAxisValueCount(This,pos); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_GetFontAxisValues(IDWriteTextLayout4* This,UINT32 pos,DWRITE_FONT_AXIS_VALUE *values,UINT32 num_values,DWRITE_TEXT_RANGE *range) { - return This->lpVtbl->GetFontAxisValues(This,pos,values,num_values,range); -} -static FORCEINLINE DWRITE_AUTOMATIC_FONT_AXES IDWriteTextLayout4_GetAutomaticFontAxes(IDWriteTextLayout4* This) { - return This->lpVtbl->GetAutomaticFontAxes(This); -} -static FORCEINLINE HRESULT IDWriteTextLayout4_SetAutomaticFontAxes(IDWriteTextLayout4* This,DWRITE_AUTOMATIC_FONT_AXES axes) { - return This->lpVtbl->SetAutomaticFontAxes(This,axes); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteTextLayout4_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontFallback1 interface - */ -#ifndef __IDWriteFontFallback1_INTERFACE_DEFINED__ -#define __IDWriteFontFallback1_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontFallback1, 0x2397599d, 0xdd0d, 0x4681, 0xbd,0x6a, 0xf4,0xf3,0x1e,0xaa,0xde,0x77); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("2397599d-dd0d-4681-bd6a-f4f31eaade77") -IDWriteFontFallback1 : public IDWriteFontFallback -{ - virtual HRESULT STDMETHODCALLTYPE MapCharacters( - IDWriteTextAnalysisSource *source, - UINT32 pos, - UINT32 length, - IDWriteFontCollection *base_collection, - const WCHAR *familyname, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - UINT32 *mapped_length, - FLOAT *scale, - IDWriteFontFace5 **fontface) = 0; - - using IDWriteFontFallback::MapCharacters; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontFallback1, 0x2397599d, 0xdd0d, 0x4681, 0xbd,0x6a, 0xf4,0xf3,0x1e,0xaa,0xde,0x77) -#endif -#else -typedef struct IDWriteFontFallback1Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontFallback1 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontFallback1 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontFallback1 *This); - - /*** IDWriteFontFallback methods ***/ - HRESULT (STDMETHODCALLTYPE *MapCharacters)( - IDWriteFontFallback1 *This, - IDWriteTextAnalysisSource *source, - UINT32 position, - UINT32 length, - IDWriteFontCollection *basecollection, - const WCHAR *baseFamilyName, - DWRITE_FONT_WEIGHT baseWeight, - DWRITE_FONT_STYLE baseStyle, - DWRITE_FONT_STRETCH baseStretch, - UINT32 *mappedLength, - IDWriteFont **mappedFont, - FLOAT *scale); - - /*** IDWriteFontFallback1 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFontFallback1_MapCharacters)( - IDWriteFontFallback1 *This, - IDWriteTextAnalysisSource *source, - UINT32 pos, - UINT32 length, - IDWriteFontCollection *base_collection, - const WCHAR *familyname, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - UINT32 *mapped_length, - FLOAT *scale, - IDWriteFontFace5 **fontface); - - END_INTERFACE -} IDWriteFontFallback1Vtbl; - -interface IDWriteFontFallback1 { - CONST_VTBL IDWriteFontFallback1Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontFallback1_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontFallback1_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontFallback1_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontFallback methods ***/ -/*** IDWriteFontFallback1 methods ***/ -#define IDWriteFontFallback1_MapCharacters(This,source,pos,length,base_collection,familyname,axis_values,num_values,mapped_length,scale,fontface) (This)->lpVtbl->IDWriteFontFallback1_MapCharacters(This,source,pos,length,base_collection,familyname,axis_values,num_values,mapped_length,scale,fontface) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontFallback1_QueryInterface(IDWriteFontFallback1* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontFallback1_AddRef(IDWriteFontFallback1* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontFallback1_Release(IDWriteFontFallback1* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontFallback methods ***/ -/*** IDWriteFontFallback1 methods ***/ -static FORCEINLINE HRESULT IDWriteFontFallback1_MapCharacters(IDWriteFontFallback1* This,IDWriteTextAnalysisSource *source,UINT32 pos,UINT32 length,IDWriteFontCollection *base_collection,const WCHAR *familyname,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values,UINT32 *mapped_length,FLOAT *scale,IDWriteFontFace5 **fontface) { - return This->lpVtbl->IDWriteFontFallback1_MapCharacters(This,source,pos,length,base_collection,familyname,axis_values,num_values,mapped_length,scale,fontface); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontFallback1_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteGdiInterop1 interface - */ -#ifndef __IDWriteGdiInterop1_INTERFACE_DEFINED__ -#define __IDWriteGdiInterop1_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteGdiInterop1, 0x4556be70, 0x3abd, 0x4f70, 0x90,0xbe, 0x42,0x17,0x80,0xa6,0xf5,0x15); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("4556be70-3abd-4f70-90be-421780a6f515") -IDWriteGdiInterop1 : public IDWriteGdiInterop -{ - virtual HRESULT STDMETHODCALLTYPE CreateFontFromLOGFONT( - const LOGFONTW *logfont, - IDWriteFontCollection *collection, - IDWriteFont **font) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontSignature( - IDWriteFontFace *fontface, - FONTSIGNATURE *fontsig) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontSignature( - IDWriteFont *font, - FONTSIGNATURE *fontsig) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetMatchingFontsByLOGFONT( - const LOGFONTW *logfont, - IDWriteFontSet *fontset, - IDWriteFontSet **subset) = 0; - - using IDWriteGdiInterop::CreateFontFromLOGFONT; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteGdiInterop1, 0x4556be70, 0x3abd, 0x4f70, 0x90,0xbe, 0x42,0x17,0x80,0xa6,0xf5,0x15) -#endif -#else -typedef struct IDWriteGdiInterop1Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteGdiInterop1 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteGdiInterop1 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteGdiInterop1 *This); - - /*** IDWriteGdiInterop methods ***/ - HRESULT (STDMETHODCALLTYPE *CreateFontFromLOGFONT)( - IDWriteGdiInterop1 *This, - const LOGFONTW *logfont, - IDWriteFont **font); - - HRESULT (STDMETHODCALLTYPE *ConvertFontToLOGFONT)( - IDWriteGdiInterop1 *This, - IDWriteFont *font, - LOGFONTW *logfont, - WINBOOL *is_systemfont); - - HRESULT (STDMETHODCALLTYPE *ConvertFontFaceToLOGFONT)( - IDWriteGdiInterop1 *This, - IDWriteFontFace *font, - LOGFONTW *logfont); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceFromHdc)( - IDWriteGdiInterop1 *This, - HDC hdc, - IDWriteFontFace **fontface); - - HRESULT (STDMETHODCALLTYPE *CreateBitmapRenderTarget)( - IDWriteGdiInterop1 *This, - HDC hdc, - UINT32 width, - UINT32 height, - IDWriteBitmapRenderTarget **target); - - /*** IDWriteGdiInterop1 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteGdiInterop1_CreateFontFromLOGFONT)( - IDWriteGdiInterop1 *This, - const LOGFONTW *logfont, - IDWriteFontCollection *collection, - IDWriteFont **font); - - HRESULT (STDMETHODCALLTYPE *GetFontSignature_)( - IDWriteGdiInterop1 *This, - IDWriteFontFace *fontface, - FONTSIGNATURE *fontsig); - - HRESULT (STDMETHODCALLTYPE *GetFontSignature)( - IDWriteGdiInterop1 *This, - IDWriteFont *font, - FONTSIGNATURE *fontsig); - - HRESULT (STDMETHODCALLTYPE *GetMatchingFontsByLOGFONT)( - IDWriteGdiInterop1 *This, - const LOGFONTW *logfont, - IDWriteFontSet *fontset, - IDWriteFontSet **subset); - - END_INTERFACE -} IDWriteGdiInterop1Vtbl; - -interface IDWriteGdiInterop1 { - CONST_VTBL IDWriteGdiInterop1Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteGdiInterop1_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteGdiInterop1_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteGdiInterop1_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteGdiInterop methods ***/ -#define IDWriteGdiInterop1_ConvertFontToLOGFONT(This,font,logfont,is_systemfont) (This)->lpVtbl->ConvertFontToLOGFONT(This,font,logfont,is_systemfont) -#define IDWriteGdiInterop1_ConvertFontFaceToLOGFONT(This,font,logfont) (This)->lpVtbl->ConvertFontFaceToLOGFONT(This,font,logfont) -#define IDWriteGdiInterop1_CreateFontFaceFromHdc(This,hdc,fontface) (This)->lpVtbl->CreateFontFaceFromHdc(This,hdc,fontface) -#define IDWriteGdiInterop1_CreateBitmapRenderTarget(This,hdc,width,height,target) (This)->lpVtbl->CreateBitmapRenderTarget(This,hdc,width,height,target) -/*** IDWriteGdiInterop1 methods ***/ -#define IDWriteGdiInterop1_CreateFontFromLOGFONT(This,logfont,collection,font) (This)->lpVtbl->IDWriteGdiInterop1_CreateFontFromLOGFONT(This,logfont,collection,font) -#define IDWriteGdiInterop1_GetFontSignature_(This,fontface,fontsig) (This)->lpVtbl->GetFontSignature_(This,fontface,fontsig) -#define IDWriteGdiInterop1_GetFontSignature(This,font,fontsig) (This)->lpVtbl->GetFontSignature(This,font,fontsig) -#define IDWriteGdiInterop1_GetMatchingFontsByLOGFONT(This,logfont,fontset,subset) (This)->lpVtbl->GetMatchingFontsByLOGFONT(This,logfont,fontset,subset) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteGdiInterop1_QueryInterface(IDWriteGdiInterop1* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteGdiInterop1_AddRef(IDWriteGdiInterop1* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteGdiInterop1_Release(IDWriteGdiInterop1* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteGdiInterop methods ***/ -static FORCEINLINE HRESULT IDWriteGdiInterop1_ConvertFontToLOGFONT(IDWriteGdiInterop1* This,IDWriteFont *font,LOGFONTW *logfont,WINBOOL *is_systemfont) { - return This->lpVtbl->ConvertFontToLOGFONT(This,font,logfont,is_systemfont); -} -static FORCEINLINE HRESULT IDWriteGdiInterop1_ConvertFontFaceToLOGFONT(IDWriteGdiInterop1* This,IDWriteFontFace *font,LOGFONTW *logfont) { - return This->lpVtbl->ConvertFontFaceToLOGFONT(This,font,logfont); -} -static FORCEINLINE HRESULT IDWriteGdiInterop1_CreateFontFaceFromHdc(IDWriteGdiInterop1* This,HDC hdc,IDWriteFontFace **fontface) { - return This->lpVtbl->CreateFontFaceFromHdc(This,hdc,fontface); -} -static FORCEINLINE HRESULT IDWriteGdiInterop1_CreateBitmapRenderTarget(IDWriteGdiInterop1* This,HDC hdc,UINT32 width,UINT32 height,IDWriteBitmapRenderTarget **target) { - return This->lpVtbl->CreateBitmapRenderTarget(This,hdc,width,height,target); -} -/*** IDWriteGdiInterop1 methods ***/ -static FORCEINLINE HRESULT IDWriteGdiInterop1_CreateFontFromLOGFONT(IDWriteGdiInterop1* This,const LOGFONTW *logfont,IDWriteFontCollection *collection,IDWriteFont **font) { - return This->lpVtbl->IDWriteGdiInterop1_CreateFontFromLOGFONT(This,logfont,collection,font); -} -static FORCEINLINE HRESULT IDWriteGdiInterop1_GetFontSignature_(IDWriteGdiInterop1* This,IDWriteFontFace *fontface,FONTSIGNATURE *fontsig) { - return This->lpVtbl->GetFontSignature_(This,fontface,fontsig); -} -static FORCEINLINE HRESULT IDWriteGdiInterop1_GetFontSignature(IDWriteGdiInterop1* This,IDWriteFont *font,FONTSIGNATURE *fontsig) { - return This->lpVtbl->GetFontSignature(This,font,fontsig); -} -static FORCEINLINE HRESULT IDWriteGdiInterop1_GetMatchingFontsByLOGFONT(IDWriteGdiInterop1* This,const LOGFONTW *logfont,IDWriteFontSet *fontset,IDWriteFontSet **subset) { - return This->lpVtbl->GetMatchingFontsByLOGFONT(This,logfont,fontset,subset); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteGdiInterop1_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontSetBuilder interface - */ -#ifndef __IDWriteFontSetBuilder_INTERFACE_DEFINED__ -#define __IDWriteFontSetBuilder_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontSetBuilder, 0x2f642afe, 0x9c68, 0x4f40, 0xb8,0xbe, 0x45,0x74,0x01,0xaf,0xcb,0x3d); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("2f642afe-9c68-4f40-b8be-457401afcb3d") -IDWriteFontSetBuilder : public IUnknown -{ - virtual HRESULT STDMETHODCALLTYPE AddFontFaceReference( - IDWriteFontFaceReference *ref, - const DWRITE_FONT_PROPERTY *props, - UINT32 prop_count) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddFontFaceReference( - IDWriteFontFaceReference *ref) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddFontSet( - IDWriteFontSet *fontset) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateFontSet( - IDWriteFontSet **fontset) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontSetBuilder, 0x2f642afe, 0x9c68, 0x4f40, 0xb8,0xbe, 0x45,0x74,0x01,0xaf,0xcb,0x3d) -#endif -#else -typedef struct IDWriteFontSetBuilderVtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontSetBuilder *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontSetBuilder *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontSetBuilder *This); - - /*** IDWriteFontSetBuilder methods ***/ - HRESULT (STDMETHODCALLTYPE *AddFontFaceReference_)( - IDWriteFontSetBuilder *This, - IDWriteFontFaceReference *ref, - const DWRITE_FONT_PROPERTY *props, - UINT32 prop_count); - - HRESULT (STDMETHODCALLTYPE *AddFontFaceReference)( - IDWriteFontSetBuilder *This, - IDWriteFontFaceReference *ref); - - HRESULT (STDMETHODCALLTYPE *AddFontSet)( - IDWriteFontSetBuilder *This, - IDWriteFontSet *fontset); - - HRESULT (STDMETHODCALLTYPE *CreateFontSet)( - IDWriteFontSetBuilder *This, - IDWriteFontSet **fontset); - - END_INTERFACE -} IDWriteFontSetBuilderVtbl; - -interface IDWriteFontSetBuilder { - CONST_VTBL IDWriteFontSetBuilderVtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontSetBuilder_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontSetBuilder_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontSetBuilder_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontSetBuilder methods ***/ -#define IDWriteFontSetBuilder_AddFontFaceReference_(This,ref,props,prop_count) (This)->lpVtbl->AddFontFaceReference_(This,ref,props,prop_count) -#define IDWriteFontSetBuilder_AddFontFaceReference(This,ref) (This)->lpVtbl->AddFontFaceReference(This,ref) -#define IDWriteFontSetBuilder_AddFontSet(This,fontset) (This)->lpVtbl->AddFontSet(This,fontset) -#define IDWriteFontSetBuilder_CreateFontSet(This,fontset) (This)->lpVtbl->CreateFontSet(This,fontset) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontSetBuilder_QueryInterface(IDWriteFontSetBuilder* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontSetBuilder_AddRef(IDWriteFontSetBuilder* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontSetBuilder_Release(IDWriteFontSetBuilder* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontSetBuilder methods ***/ -static FORCEINLINE HRESULT IDWriteFontSetBuilder_AddFontFaceReference_(IDWriteFontSetBuilder* This,IDWriteFontFaceReference *ref,const DWRITE_FONT_PROPERTY *props,UINT32 prop_count) { - return This->lpVtbl->AddFontFaceReference_(This,ref,props,prop_count); -} -static FORCEINLINE HRESULT IDWriteFontSetBuilder_AddFontFaceReference(IDWriteFontSetBuilder* This,IDWriteFontFaceReference *ref) { - return This->lpVtbl->AddFontFaceReference(This,ref); -} -static FORCEINLINE HRESULT IDWriteFontSetBuilder_AddFontSet(IDWriteFontSetBuilder* This,IDWriteFontSet *fontset) { - return This->lpVtbl->AddFontSet(This,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSetBuilder_CreateFontSet(IDWriteFontSetBuilder* This,IDWriteFontSet **fontset) { - return This->lpVtbl->CreateFontSet(This,fontset); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontSetBuilder_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontSetBuilder1 interface - */ -#ifndef __IDWriteFontSetBuilder1_INTERFACE_DEFINED__ -#define __IDWriteFontSetBuilder1_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontSetBuilder1, 0x3ff7715f, 0x3cdc, 0x4dc6, 0x9b,0x72, 0xec,0x56,0x21,0xdc,0xca,0xfd); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("3ff7715f-3cdc-4dc6-9b72-ec5621dccafd") -IDWriteFontSetBuilder1 : public IDWriteFontSetBuilder -{ - virtual HRESULT STDMETHODCALLTYPE AddFontFile( - IDWriteFontFile *file) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontSetBuilder1, 0x3ff7715f, 0x3cdc, 0x4dc6, 0x9b,0x72, 0xec,0x56,0x21,0xdc,0xca,0xfd) -#endif -#else -typedef struct IDWriteFontSetBuilder1Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontSetBuilder1 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontSetBuilder1 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontSetBuilder1 *This); - - /*** IDWriteFontSetBuilder methods ***/ - HRESULT (STDMETHODCALLTYPE *AddFontFaceReference_)( - IDWriteFontSetBuilder1 *This, - IDWriteFontFaceReference *ref, - const DWRITE_FONT_PROPERTY *props, - UINT32 prop_count); - - HRESULT (STDMETHODCALLTYPE *AddFontFaceReference)( - IDWriteFontSetBuilder1 *This, - IDWriteFontFaceReference *ref); - - HRESULT (STDMETHODCALLTYPE *AddFontSet)( - IDWriteFontSetBuilder1 *This, - IDWriteFontSet *fontset); - - HRESULT (STDMETHODCALLTYPE *CreateFontSet)( - IDWriteFontSetBuilder1 *This, - IDWriteFontSet **fontset); - - /*** IDWriteFontSetBuilder1 methods ***/ - HRESULT (STDMETHODCALLTYPE *AddFontFile)( - IDWriteFontSetBuilder1 *This, - IDWriteFontFile *file); - - END_INTERFACE -} IDWriteFontSetBuilder1Vtbl; - -interface IDWriteFontSetBuilder1 { - CONST_VTBL IDWriteFontSetBuilder1Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontSetBuilder1_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontSetBuilder1_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontSetBuilder1_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontSetBuilder methods ***/ -#define IDWriteFontSetBuilder1_AddFontFaceReference_(This,ref,props,prop_count) (This)->lpVtbl->AddFontFaceReference_(This,ref,props,prop_count) -#define IDWriteFontSetBuilder1_AddFontFaceReference(This,ref) (This)->lpVtbl->AddFontFaceReference(This,ref) -#define IDWriteFontSetBuilder1_AddFontSet(This,fontset) (This)->lpVtbl->AddFontSet(This,fontset) -#define IDWriteFontSetBuilder1_CreateFontSet(This,fontset) (This)->lpVtbl->CreateFontSet(This,fontset) -/*** IDWriteFontSetBuilder1 methods ***/ -#define IDWriteFontSetBuilder1_AddFontFile(This,file) (This)->lpVtbl->AddFontFile(This,file) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontSetBuilder1_QueryInterface(IDWriteFontSetBuilder1* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontSetBuilder1_AddRef(IDWriteFontSetBuilder1* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontSetBuilder1_Release(IDWriteFontSetBuilder1* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontSetBuilder methods ***/ -static FORCEINLINE HRESULT IDWriteFontSetBuilder1_AddFontFaceReference_(IDWriteFontSetBuilder1* This,IDWriteFontFaceReference *ref,const DWRITE_FONT_PROPERTY *props,UINT32 prop_count) { - return This->lpVtbl->AddFontFaceReference_(This,ref,props,prop_count); -} -static FORCEINLINE HRESULT IDWriteFontSetBuilder1_AddFontFaceReference(IDWriteFontSetBuilder1* This,IDWriteFontFaceReference *ref) { - return This->lpVtbl->AddFontFaceReference(This,ref); -} -static FORCEINLINE HRESULT IDWriteFontSetBuilder1_AddFontSet(IDWriteFontSetBuilder1* This,IDWriteFontSet *fontset) { - return This->lpVtbl->AddFontSet(This,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSetBuilder1_CreateFontSet(IDWriteFontSetBuilder1* This,IDWriteFontSet **fontset) { - return This->lpVtbl->CreateFontSet(This,fontset); -} -/*** IDWriteFontSetBuilder1 methods ***/ -static FORCEINLINE HRESULT IDWriteFontSetBuilder1_AddFontFile(IDWriteFontSetBuilder1* This,IDWriteFontFile *file) { - return This->lpVtbl->AddFontFile(This,file); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontSetBuilder1_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontSetBuilder2 interface - */ -#ifndef __IDWriteFontSetBuilder2_INTERFACE_DEFINED__ -#define __IDWriteFontSetBuilder2_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontSetBuilder2, 0xee5ba612, 0xb131, 0x463c, 0x8f,0x4f, 0x31,0x89,0xb9,0x40,0x1e,0x45); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("ee5ba612-b131-463c-8f4f-3189b9401e45") -IDWriteFontSetBuilder2 : public IDWriteFontSetBuilder1 -{ - virtual HRESULT STDMETHODCALLTYPE AddFont( - IDWriteFontFile *fontfile, - UINT32 face_index, - DWRITE_FONT_SIMULATIONS simulations, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - const DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - const DWRITE_FONT_PROPERTY *props, - UINT32 num_properties) = 0; - - virtual HRESULT STDMETHODCALLTYPE AddFontFile( - const WCHAR *filepath) = 0; - - using IDWriteFontSetBuilder1::AddFontFile; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontSetBuilder2, 0xee5ba612, 0xb131, 0x463c, 0x8f,0x4f, 0x31,0x89,0xb9,0x40,0x1e,0x45) -#endif -#else -typedef struct IDWriteFontSetBuilder2Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontSetBuilder2 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontSetBuilder2 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontSetBuilder2 *This); - - /*** IDWriteFontSetBuilder methods ***/ - HRESULT (STDMETHODCALLTYPE *AddFontFaceReference_)( - IDWriteFontSetBuilder2 *This, - IDWriteFontFaceReference *ref, - const DWRITE_FONT_PROPERTY *props, - UINT32 prop_count); - - HRESULT (STDMETHODCALLTYPE *AddFontFaceReference)( - IDWriteFontSetBuilder2 *This, - IDWriteFontFaceReference *ref); - - HRESULT (STDMETHODCALLTYPE *AddFontSet)( - IDWriteFontSetBuilder2 *This, - IDWriteFontSet *fontset); - - HRESULT (STDMETHODCALLTYPE *CreateFontSet)( - IDWriteFontSetBuilder2 *This, - IDWriteFontSet **fontset); - - /*** IDWriteFontSetBuilder1 methods ***/ - HRESULT (STDMETHODCALLTYPE *AddFontFile)( - IDWriteFontSetBuilder2 *This, - IDWriteFontFile *file); - - /*** IDWriteFontSetBuilder2 methods ***/ - HRESULT (STDMETHODCALLTYPE *AddFont)( - IDWriteFontSetBuilder2 *This, - IDWriteFontFile *fontfile, - UINT32 face_index, - DWRITE_FONT_SIMULATIONS simulations, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_values, - const DWRITE_FONT_AXIS_RANGE *axis_ranges, - UINT32 num_ranges, - const DWRITE_FONT_PROPERTY *props, - UINT32 num_properties); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontSetBuilder2_AddFontFile)( - IDWriteFontSetBuilder2 *This, - const WCHAR *filepath); - - END_INTERFACE -} IDWriteFontSetBuilder2Vtbl; - -interface IDWriteFontSetBuilder2 { - CONST_VTBL IDWriteFontSetBuilder2Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontSetBuilder2_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontSetBuilder2_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontSetBuilder2_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontSetBuilder methods ***/ -#define IDWriteFontSetBuilder2_AddFontFaceReference_(This,ref,props,prop_count) (This)->lpVtbl->AddFontFaceReference_(This,ref,props,prop_count) -#define IDWriteFontSetBuilder2_AddFontFaceReference(This,ref) (This)->lpVtbl->AddFontFaceReference(This,ref) -#define IDWriteFontSetBuilder2_AddFontSet(This,fontset) (This)->lpVtbl->AddFontSet(This,fontset) -#define IDWriteFontSetBuilder2_CreateFontSet(This,fontset) (This)->lpVtbl->CreateFontSet(This,fontset) -/*** IDWriteFontSetBuilder1 methods ***/ -/*** IDWriteFontSetBuilder2 methods ***/ -#define IDWriteFontSetBuilder2_AddFont(This,fontfile,face_index,simulations,axis_values,num_values,axis_ranges,num_ranges,props,num_properties) (This)->lpVtbl->AddFont(This,fontfile,face_index,simulations,axis_values,num_values,axis_ranges,num_ranges,props,num_properties) -#define IDWriteFontSetBuilder2_AddFontFile(This,filepath) (This)->lpVtbl->IDWriteFontSetBuilder2_AddFontFile(This,filepath) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontSetBuilder2_QueryInterface(IDWriteFontSetBuilder2* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontSetBuilder2_AddRef(IDWriteFontSetBuilder2* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontSetBuilder2_Release(IDWriteFontSetBuilder2* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontSetBuilder methods ***/ -static FORCEINLINE HRESULT IDWriteFontSetBuilder2_AddFontFaceReference_(IDWriteFontSetBuilder2* This,IDWriteFontFaceReference *ref,const DWRITE_FONT_PROPERTY *props,UINT32 prop_count) { - return This->lpVtbl->AddFontFaceReference_(This,ref,props,prop_count); -} -static FORCEINLINE HRESULT IDWriteFontSetBuilder2_AddFontFaceReference(IDWriteFontSetBuilder2* This,IDWriteFontFaceReference *ref) { - return This->lpVtbl->AddFontFaceReference(This,ref); -} -static FORCEINLINE HRESULT IDWriteFontSetBuilder2_AddFontSet(IDWriteFontSetBuilder2* This,IDWriteFontSet *fontset) { - return This->lpVtbl->AddFontSet(This,fontset); -} -static FORCEINLINE HRESULT IDWriteFontSetBuilder2_CreateFontSet(IDWriteFontSetBuilder2* This,IDWriteFontSet **fontset) { - return This->lpVtbl->CreateFontSet(This,fontset); -} -/*** IDWriteFontSetBuilder1 methods ***/ -/*** IDWriteFontSetBuilder2 methods ***/ -static FORCEINLINE HRESULT IDWriteFontSetBuilder2_AddFont(IDWriteFontSetBuilder2* This,IDWriteFontFile *fontfile,UINT32 face_index,DWRITE_FONT_SIMULATIONS simulations,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_values,const DWRITE_FONT_AXIS_RANGE *axis_ranges,UINT32 num_ranges,const DWRITE_FONT_PROPERTY *props,UINT32 num_properties) { - return This->lpVtbl->AddFont(This,fontfile,face_index,simulations,axis_values,num_values,axis_ranges,num_ranges,props,num_properties); -} -static FORCEINLINE HRESULT IDWriteFontSetBuilder2_AddFontFile(IDWriteFontSetBuilder2* This,const WCHAR *filepath) { - return This->lpVtbl->IDWriteFontSetBuilder2_AddFontFile(This,filepath); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontSetBuilder2_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFactory3 interface - */ -#ifndef __IDWriteFactory3_INTERFACE_DEFINED__ -#define __IDWriteFactory3_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFactory3, 0x9a1b41c3, 0xd3bb, 0x466a, 0x87,0xfc, 0xfe,0x67,0x55,0x6a,0x3b,0x65); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("9a1b41c3-d3bb-466a-87fc-fe67556a3b65") -IDWriteFactory3 : public IDWriteFactory2 -{ - virtual HRESULT STDMETHODCALLTYPE CreateGlyphRunAnalysis( - const DWRITE_GLYPH_RUN *run, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE1 rendering_mode, - DWRITE_MEASURING_MODE measuring_mode, - DWRITE_GRID_FIT_MODE gridfit_mode, - DWRITE_TEXT_ANTIALIAS_MODE antialias_mode, - FLOAT origin_x, - FLOAT origin_y, - IDWriteGlyphRunAnalysis **analysis) = 0; - - using IDWriteFactory::CreateGlyphRunAnalysis; - using IDWriteFactory2::CreateGlyphRunAnalysis; - - virtual HRESULT STDMETHODCALLTYPE CreateCustomRenderingParams( - FLOAT gamma, - FLOAT enhanced_contrast, - FLOAT grayscale_enhanced_contrast, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY pixel_geometry, - DWRITE_RENDERING_MODE1 rendering_mode, - DWRITE_GRID_FIT_MODE gridfit_mode, - IDWriteRenderingParams3 **params) = 0; - - using IDWriteFactory::CreateCustomRenderingParams; - using IDWriteFactory1::CreateCustomRenderingParams; - using IDWriteFactory2::CreateCustomRenderingParams; - - virtual HRESULT STDMETHODCALLTYPE CreateFontFaceReference( - IDWriteFontFile *file, - UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFaceReference **reference) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateFontFaceReference( - const WCHAR *path, - const FILETIME *writetime, - UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFaceReference **reference) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSystemFontSet( - IDWriteFontSet **fontset) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateFontSetBuilder( - IDWriteFontSetBuilder **builder) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateFontCollectionFromFontSet( - IDWriteFontSet *fontset, - IDWriteFontCollection1 **collection) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSystemFontCollection( - WINBOOL include_downloadable, - IDWriteFontCollection1 **collection, - WINBOOL check_for_updates) = 0; - - using IDWriteFactory::GetSystemFontCollection; - - virtual HRESULT STDMETHODCALLTYPE GetFontDownloadQueue( - IDWriteFontDownloadQueue **queue) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFactory3, 0x9a1b41c3, 0xd3bb, 0x466a, 0x87,0xfc, 0xfe,0x67,0x55,0x6a,0x3b,0x65) -#endif -#else -typedef struct IDWriteFactory3Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFactory3 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFactory3 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFactory3 *This); - - /*** IDWriteFactory methods ***/ - HRESULT (STDMETHODCALLTYPE *GetSystemFontCollection)( - IDWriteFactory3 *This, - IDWriteFontCollection **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *CreateCustomFontCollection)( - IDWriteFactory3 *This, - IDWriteFontCollectionLoader *loader, - const void *key, - UINT32 key_size, - IDWriteFontCollection **collection); - - HRESULT (STDMETHODCALLTYPE *RegisterFontCollectionLoader)( - IDWriteFactory3 *This, - IDWriteFontCollectionLoader *loader); - - HRESULT (STDMETHODCALLTYPE *UnregisterFontCollectionLoader)( - IDWriteFactory3 *This, - IDWriteFontCollectionLoader *loader); - - HRESULT (STDMETHODCALLTYPE *CreateFontFileReference)( - IDWriteFactory3 *This, - const WCHAR *path, - const FILETIME *writetime, - IDWriteFontFile **font_file); - - HRESULT (STDMETHODCALLTYPE *CreateCustomFontFileReference)( - IDWriteFactory3 *This, - const void *reference_key, - UINT32 key_size, - IDWriteFontFileLoader *loader, - IDWriteFontFile **font_file); - - HRESULT (STDMETHODCALLTYPE *CreateFontFace)( - IDWriteFactory3 *This, - DWRITE_FONT_FACE_TYPE facetype, - UINT32 files_number, - IDWriteFontFile *const *font_files, - UINT32 index, - DWRITE_FONT_SIMULATIONS sim_flags, - IDWriteFontFace **font_face); - - HRESULT (STDMETHODCALLTYPE *CreateRenderingParams)( - IDWriteFactory3 *This, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *CreateMonitorRenderingParams)( - IDWriteFactory3 *This, - HMONITOR monitor, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *CreateCustomRenderingParams)( - IDWriteFactory3 *This, - FLOAT gamma, - FLOAT enhancedContrast, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY geometry, - DWRITE_RENDERING_MODE mode, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *RegisterFontFileLoader)( - IDWriteFactory3 *This, - IDWriteFontFileLoader *loader); - - HRESULT (STDMETHODCALLTYPE *UnregisterFontFileLoader)( - IDWriteFactory3 *This, - IDWriteFontFileLoader *loader); - - HRESULT (STDMETHODCALLTYPE *CreateTextFormat)( - IDWriteFactory3 *This, - const WCHAR *family_name, - IDWriteFontCollection *collection, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STYLE style, - DWRITE_FONT_STRETCH stretch, - FLOAT size, - const WCHAR *locale, - IDWriteTextFormat **format); - - HRESULT (STDMETHODCALLTYPE *CreateTypography)( - IDWriteFactory3 *This, - IDWriteTypography **typography); - - HRESULT (STDMETHODCALLTYPE *GetGdiInterop)( - IDWriteFactory3 *This, - IDWriteGdiInterop **gdi_interop); - - HRESULT (STDMETHODCALLTYPE *CreateTextLayout)( - IDWriteFactory3 *This, - const WCHAR *string, - UINT32 len, - IDWriteTextFormat *format, - FLOAT max_width, - FLOAT max_height, - IDWriteTextLayout **layout); - - HRESULT (STDMETHODCALLTYPE *CreateGdiCompatibleTextLayout)( - IDWriteFactory3 *This, - const WCHAR *string, - UINT32 len, - IDWriteTextFormat *format, - FLOAT layout_width, - FLOAT layout_height, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - WINBOOL use_gdi_natural, - IDWriteTextLayout **layout); - - HRESULT (STDMETHODCALLTYPE *CreateEllipsisTrimmingSign)( - IDWriteFactory3 *This, - IDWriteTextFormat *format, - IDWriteInlineObject **trimming_sign); - - HRESULT (STDMETHODCALLTYPE *CreateTextAnalyzer)( - IDWriteFactory3 *This, - IDWriteTextAnalyzer **analyzer); - - HRESULT (STDMETHODCALLTYPE *CreateNumberSubstitution)( - IDWriteFactory3 *This, - DWRITE_NUMBER_SUBSTITUTION_METHOD method, - const WCHAR *locale, - WINBOOL ignore_user_override, - IDWriteNumberSubstitution **substitution); - - HRESULT (STDMETHODCALLTYPE *CreateGlyphRunAnalysis)( - IDWriteFactory3 *This, - const DWRITE_GLYPH_RUN *glyph_run, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE rendering_mode, - DWRITE_MEASURING_MODE measuring_mode, - FLOAT baseline_x, - FLOAT baseline_y, - IDWriteGlyphRunAnalysis **analysis); - - /*** IDWriteFactory1 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetEudcFontCollection)( - IDWriteFactory3 *This, - IDWriteFontCollection **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory1_CreateCustomRenderingParams)( - IDWriteFactory3 *This, - FLOAT gamma, - FLOAT enhcontrast, - FLOAT enhcontrast_grayscale, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY geometry, - DWRITE_RENDERING_MODE mode, - IDWriteRenderingParams1 **params); - - /*** IDWriteFactory2 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetSystemFontFallback)( - IDWriteFactory3 *This, - IDWriteFontFallback **fallback); - - HRESULT (STDMETHODCALLTYPE *CreateFontFallbackBuilder)( - IDWriteFactory3 *This, - IDWriteFontFallbackBuilder **fallbackbuilder); - - HRESULT (STDMETHODCALLTYPE *TranslateColorGlyphRun)( - IDWriteFactory3 *This, - FLOAT originX, - FLOAT originY, - const DWRITE_GLYPH_RUN *run, - const DWRITE_GLYPH_RUN_DESCRIPTION *rundescr, - DWRITE_MEASURING_MODE mode, - const DWRITE_MATRIX *transform, - UINT32 palette_index, - IDWriteColorGlyphRunEnumerator **colorlayers); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory2_CreateCustomRenderingParams)( - IDWriteFactory3 *This, - FLOAT gamma, - FLOAT contrast, - FLOAT grayscalecontrast, - FLOAT cleartypeLevel, - DWRITE_PIXEL_GEOMETRY pixelGeometry, - DWRITE_RENDERING_MODE renderingMode, - DWRITE_GRID_FIT_MODE gridFitMode, - IDWriteRenderingParams2 **params); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory2_CreateGlyphRunAnalysis)( - IDWriteFactory3 *This, - const DWRITE_GLYPH_RUN *run, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE renderingMode, - DWRITE_MEASURING_MODE measuringMode, - DWRITE_GRID_FIT_MODE gridFitMode, - DWRITE_TEXT_ANTIALIAS_MODE antialiasMode, - FLOAT originX, - FLOAT originY, - IDWriteGlyphRunAnalysis **analysis); - - /*** IDWriteFactory3 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_CreateGlyphRunAnalysis)( - IDWriteFactory3 *This, - const DWRITE_GLYPH_RUN *run, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE1 rendering_mode, - DWRITE_MEASURING_MODE measuring_mode, - DWRITE_GRID_FIT_MODE gridfit_mode, - DWRITE_TEXT_ANTIALIAS_MODE antialias_mode, - FLOAT origin_x, - FLOAT origin_y, - IDWriteGlyphRunAnalysis **analysis); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_CreateCustomRenderingParams)( - IDWriteFactory3 *This, - FLOAT gamma, - FLOAT enhanced_contrast, - FLOAT grayscale_enhanced_contrast, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY pixel_geometry, - DWRITE_RENDERING_MODE1 rendering_mode, - DWRITE_GRID_FIT_MODE gridfit_mode, - IDWriteRenderingParams3 **params); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceReference_)( - IDWriteFactory3 *This, - IDWriteFontFile *file, - UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceReference)( - IDWriteFactory3 *This, - const WCHAR *path, - const FILETIME *writetime, - UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *GetSystemFontSet)( - IDWriteFactory3 *This, - IDWriteFontSet **fontset); - - HRESULT (STDMETHODCALLTYPE *CreateFontSetBuilder)( - IDWriteFactory3 *This, - IDWriteFontSetBuilder **builder); - - HRESULT (STDMETHODCALLTYPE *CreateFontCollectionFromFontSet)( - IDWriteFactory3 *This, - IDWriteFontSet *fontset, - IDWriteFontCollection1 **collection); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_GetSystemFontCollection)( - IDWriteFactory3 *This, - WINBOOL include_downloadable, - IDWriteFontCollection1 **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *GetFontDownloadQueue)( - IDWriteFactory3 *This, - IDWriteFontDownloadQueue **queue); - - END_INTERFACE -} IDWriteFactory3Vtbl; - -interface IDWriteFactory3 { - CONST_VTBL IDWriteFactory3Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFactory3_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFactory3_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFactory3_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFactory methods ***/ -#define IDWriteFactory3_CreateCustomFontCollection(This,loader,key,key_size,collection) (This)->lpVtbl->CreateCustomFontCollection(This,loader,key,key_size,collection) -#define IDWriteFactory3_RegisterFontCollectionLoader(This,loader) (This)->lpVtbl->RegisterFontCollectionLoader(This,loader) -#define IDWriteFactory3_UnregisterFontCollectionLoader(This,loader) (This)->lpVtbl->UnregisterFontCollectionLoader(This,loader) -#define IDWriteFactory3_CreateFontFileReference(This,path,writetime,font_file) (This)->lpVtbl->CreateFontFileReference(This,path,writetime,font_file) -#define IDWriteFactory3_CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file) (This)->lpVtbl->CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file) -#define IDWriteFactory3_CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face) (This)->lpVtbl->CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face) -#define IDWriteFactory3_CreateRenderingParams(This,params) (This)->lpVtbl->CreateRenderingParams(This,params) -#define IDWriteFactory3_CreateMonitorRenderingParams(This,monitor,params) (This)->lpVtbl->CreateMonitorRenderingParams(This,monitor,params) -#define IDWriteFactory3_RegisterFontFileLoader(This,loader) (This)->lpVtbl->RegisterFontFileLoader(This,loader) -#define IDWriteFactory3_UnregisterFontFileLoader(This,loader) (This)->lpVtbl->UnregisterFontFileLoader(This,loader) -#define IDWriteFactory3_CreateTextFormat(This,family_name,collection,weight,style,stretch,size,locale,format) (This)->lpVtbl->CreateTextFormat(This,family_name,collection,weight,style,stretch,size,locale,format) -#define IDWriteFactory3_CreateTypography(This,typography) (This)->lpVtbl->CreateTypography(This,typography) -#define IDWriteFactory3_GetGdiInterop(This,gdi_interop) (This)->lpVtbl->GetGdiInterop(This,gdi_interop) -#define IDWriteFactory3_CreateTextLayout(This,string,len,format,max_width,max_height,layout) (This)->lpVtbl->CreateTextLayout(This,string,len,format,max_width,max_height,layout) -#define IDWriteFactory3_CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout) (This)->lpVtbl->CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout) -#define IDWriteFactory3_CreateEllipsisTrimmingSign(This,format,trimming_sign) (This)->lpVtbl->CreateEllipsisTrimmingSign(This,format,trimming_sign) -#define IDWriteFactory3_CreateTextAnalyzer(This,analyzer) (This)->lpVtbl->CreateTextAnalyzer(This,analyzer) -#define IDWriteFactory3_CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution) (This)->lpVtbl->CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution) -/*** IDWriteFactory1 methods ***/ -#define IDWriteFactory3_GetEudcFontCollection(This,collection,check_for_updates) (This)->lpVtbl->GetEudcFontCollection(This,collection,check_for_updates) -/*** IDWriteFactory2 methods ***/ -#define IDWriteFactory3_GetSystemFontFallback(This,fallback) (This)->lpVtbl->GetSystemFontFallback(This,fallback) -#define IDWriteFactory3_CreateFontFallbackBuilder(This,fallbackbuilder) (This)->lpVtbl->CreateFontFallbackBuilder(This,fallbackbuilder) -#define IDWriteFactory3_TranslateColorGlyphRun(This,originX,originY,run,rundescr,mode,transform,palette_index,colorlayers) (This)->lpVtbl->TranslateColorGlyphRun(This,originX,originY,run,rundescr,mode,transform,palette_index,colorlayers) -/*** IDWriteFactory3 methods ***/ -#define IDWriteFactory3_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis) (This)->lpVtbl->IDWriteFactory3_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis) -#define IDWriteFactory3_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params) (This)->lpVtbl->IDWriteFactory3_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params) -#define IDWriteFactory3_CreateFontFaceReference_(This,file,index,simulations,reference) (This)->lpVtbl->CreateFontFaceReference_(This,file,index,simulations,reference) -#define IDWriteFactory3_CreateFontFaceReference(This,path,writetime,index,simulations,reference) (This)->lpVtbl->CreateFontFaceReference(This,path,writetime,index,simulations,reference) -#define IDWriteFactory3_GetSystemFontSet(This,fontset) (This)->lpVtbl->GetSystemFontSet(This,fontset) -#define IDWriteFactory3_CreateFontSetBuilder(This,builder) (This)->lpVtbl->CreateFontSetBuilder(This,builder) -#define IDWriteFactory3_CreateFontCollectionFromFontSet(This,fontset,collection) (This)->lpVtbl->CreateFontCollectionFromFontSet(This,fontset,collection) -#define IDWriteFactory3_GetSystemFontCollection(This,include_downloadable,collection,check_for_updates) (This)->lpVtbl->IDWriteFactory3_GetSystemFontCollection(This,include_downloadable,collection,check_for_updates) -#define IDWriteFactory3_GetFontDownloadQueue(This,queue) (This)->lpVtbl->GetFontDownloadQueue(This,queue) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFactory3_QueryInterface(IDWriteFactory3* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFactory3_AddRef(IDWriteFactory3* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFactory3_Release(IDWriteFactory3* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFactory methods ***/ -static FORCEINLINE HRESULT IDWriteFactory3_CreateCustomFontCollection(IDWriteFactory3* This,IDWriteFontCollectionLoader *loader,const void *key,UINT32 key_size,IDWriteFontCollection **collection) { - return This->lpVtbl->CreateCustomFontCollection(This,loader,key,key_size,collection); -} -static FORCEINLINE HRESULT IDWriteFactory3_RegisterFontCollectionLoader(IDWriteFactory3* This,IDWriteFontCollectionLoader *loader) { - return This->lpVtbl->RegisterFontCollectionLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory3_UnregisterFontCollectionLoader(IDWriteFactory3* This,IDWriteFontCollectionLoader *loader) { - return This->lpVtbl->UnregisterFontCollectionLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateFontFileReference(IDWriteFactory3* This,const WCHAR *path,const FILETIME *writetime,IDWriteFontFile **font_file) { - return This->lpVtbl->CreateFontFileReference(This,path,writetime,font_file); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateCustomFontFileReference(IDWriteFactory3* This,const void *reference_key,UINT32 key_size,IDWriteFontFileLoader *loader,IDWriteFontFile **font_file) { - return This->lpVtbl->CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateFontFace(IDWriteFactory3* This,DWRITE_FONT_FACE_TYPE facetype,UINT32 files_number,IDWriteFontFile *const *font_files,UINT32 index,DWRITE_FONT_SIMULATIONS sim_flags,IDWriteFontFace **font_face) { - return This->lpVtbl->CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateRenderingParams(IDWriteFactory3* This,IDWriteRenderingParams **params) { - return This->lpVtbl->CreateRenderingParams(This,params); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateMonitorRenderingParams(IDWriteFactory3* This,HMONITOR monitor,IDWriteRenderingParams **params) { - return This->lpVtbl->CreateMonitorRenderingParams(This,monitor,params); -} -static FORCEINLINE HRESULT IDWriteFactory3_RegisterFontFileLoader(IDWriteFactory3* This,IDWriteFontFileLoader *loader) { - return This->lpVtbl->RegisterFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory3_UnregisterFontFileLoader(IDWriteFactory3* This,IDWriteFontFileLoader *loader) { - return This->lpVtbl->UnregisterFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateTextFormat(IDWriteFactory3* This,const WCHAR *family_name,IDWriteFontCollection *collection,DWRITE_FONT_WEIGHT weight,DWRITE_FONT_STYLE style,DWRITE_FONT_STRETCH stretch,FLOAT size,const WCHAR *locale,IDWriteTextFormat **format) { - return This->lpVtbl->CreateTextFormat(This,family_name,collection,weight,style,stretch,size,locale,format); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateTypography(IDWriteFactory3* This,IDWriteTypography **typography) { - return This->lpVtbl->CreateTypography(This,typography); -} -static FORCEINLINE HRESULT IDWriteFactory3_GetGdiInterop(IDWriteFactory3* This,IDWriteGdiInterop **gdi_interop) { - return This->lpVtbl->GetGdiInterop(This,gdi_interop); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateTextLayout(IDWriteFactory3* This,const WCHAR *string,UINT32 len,IDWriteTextFormat *format,FLOAT max_width,FLOAT max_height,IDWriteTextLayout **layout) { - return This->lpVtbl->CreateTextLayout(This,string,len,format,max_width,max_height,layout); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateGdiCompatibleTextLayout(IDWriteFactory3* This,const WCHAR *string,UINT32 len,IDWriteTextFormat *format,FLOAT layout_width,FLOAT layout_height,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,WINBOOL use_gdi_natural,IDWriteTextLayout **layout) { - return This->lpVtbl->CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateEllipsisTrimmingSign(IDWriteFactory3* This,IDWriteTextFormat *format,IDWriteInlineObject **trimming_sign) { - return This->lpVtbl->CreateEllipsisTrimmingSign(This,format,trimming_sign); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateTextAnalyzer(IDWriteFactory3* This,IDWriteTextAnalyzer **analyzer) { - return This->lpVtbl->CreateTextAnalyzer(This,analyzer); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateNumberSubstitution(IDWriteFactory3* This,DWRITE_NUMBER_SUBSTITUTION_METHOD method,const WCHAR *locale,WINBOOL ignore_user_override,IDWriteNumberSubstitution **substitution) { - return This->lpVtbl->CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution); -} -/*** IDWriteFactory1 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory3_GetEudcFontCollection(IDWriteFactory3* This,IDWriteFontCollection **collection,WINBOOL check_for_updates) { - return This->lpVtbl->GetEudcFontCollection(This,collection,check_for_updates); -} -/*** IDWriteFactory2 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory3_GetSystemFontFallback(IDWriteFactory3* This,IDWriteFontFallback **fallback) { - return This->lpVtbl->GetSystemFontFallback(This,fallback); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateFontFallbackBuilder(IDWriteFactory3* This,IDWriteFontFallbackBuilder **fallbackbuilder) { - return This->lpVtbl->CreateFontFallbackBuilder(This,fallbackbuilder); -} -static FORCEINLINE HRESULT IDWriteFactory3_TranslateColorGlyphRun(IDWriteFactory3* This,FLOAT originX,FLOAT originY,const DWRITE_GLYPH_RUN *run,const DWRITE_GLYPH_RUN_DESCRIPTION *rundescr,DWRITE_MEASURING_MODE mode,const DWRITE_MATRIX *transform,UINT32 palette_index,IDWriteColorGlyphRunEnumerator **colorlayers) { - return This->lpVtbl->TranslateColorGlyphRun(This,originX,originY,run,rundescr,mode,transform,palette_index,colorlayers); -} -/*** IDWriteFactory3 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory3_CreateGlyphRunAnalysis(IDWriteFactory3* This,const DWRITE_GLYPH_RUN *run,const DWRITE_MATRIX *transform,DWRITE_RENDERING_MODE1 rendering_mode,DWRITE_MEASURING_MODE measuring_mode,DWRITE_GRID_FIT_MODE gridfit_mode,DWRITE_TEXT_ANTIALIAS_MODE antialias_mode,FLOAT origin_x,FLOAT origin_y,IDWriteGlyphRunAnalysis **analysis) { - return This->lpVtbl->IDWriteFactory3_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateCustomRenderingParams(IDWriteFactory3* This,FLOAT gamma,FLOAT enhanced_contrast,FLOAT grayscale_enhanced_contrast,FLOAT cleartype_level,DWRITE_PIXEL_GEOMETRY pixel_geometry,DWRITE_RENDERING_MODE1 rendering_mode,DWRITE_GRID_FIT_MODE gridfit_mode,IDWriteRenderingParams3 **params) { - return This->lpVtbl->IDWriteFactory3_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateFontFaceReference_(IDWriteFactory3* This,IDWriteFontFile *file,UINT32 index,DWRITE_FONT_SIMULATIONS simulations,IDWriteFontFaceReference **reference) { - return This->lpVtbl->CreateFontFaceReference_(This,file,index,simulations,reference); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateFontFaceReference(IDWriteFactory3* This,const WCHAR *path,const FILETIME *writetime,UINT32 index,DWRITE_FONT_SIMULATIONS simulations,IDWriteFontFaceReference **reference) { - return This->lpVtbl->CreateFontFaceReference(This,path,writetime,index,simulations,reference); -} -static FORCEINLINE HRESULT IDWriteFactory3_GetSystemFontSet(IDWriteFactory3* This,IDWriteFontSet **fontset) { - return This->lpVtbl->GetSystemFontSet(This,fontset); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateFontSetBuilder(IDWriteFactory3* This,IDWriteFontSetBuilder **builder) { - return This->lpVtbl->CreateFontSetBuilder(This,builder); -} -static FORCEINLINE HRESULT IDWriteFactory3_CreateFontCollectionFromFontSet(IDWriteFactory3* This,IDWriteFontSet *fontset,IDWriteFontCollection1 **collection) { - return This->lpVtbl->CreateFontCollectionFromFontSet(This,fontset,collection); -} -static FORCEINLINE HRESULT IDWriteFactory3_GetSystemFontCollection(IDWriteFactory3* This,WINBOOL include_downloadable,IDWriteFontCollection1 **collection,WINBOOL check_for_updates) { - return This->lpVtbl->IDWriteFactory3_GetSystemFontCollection(This,include_downloadable,collection,check_for_updates); -} -static FORCEINLINE HRESULT IDWriteFactory3_GetFontDownloadQueue(IDWriteFactory3* This,IDWriteFontDownloadQueue **queue) { - return This->lpVtbl->GetFontDownloadQueue(This,queue); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFactory3_INTERFACE_DEFINED__ */ - -typedef struct DWRITE_GLYPH_IMAGE_DATA { - const void *imageData; - UINT32 imageDataSize; - UINT32 uniqueDataId; - UINT32 pixelsPerEm; - D2D1_SIZE_U pixelSize; - D2D1_POINT_2L horizontalLeftOrigin; - D2D1_POINT_2L horizontalRightOrigin; - D2D1_POINT_2L verticalTopOrigin; - D2D1_POINT_2L verticalBottomOrigin; -} DWRITE_GLYPH_IMAGE_DATA; -/***************************************************************************** - * IDWriteFontFace4 interface - */ -#ifndef __IDWriteFontFace4_INTERFACE_DEFINED__ -#define __IDWriteFontFace4_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontFace4, 0x27f2a904, 0x4eb8, 0x441d, 0x96,0x78, 0x05,0x63,0xf5,0x3e,0x3e,0x2f); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("27f2a904-4eb8-441d-9678-0563f53e3e2f") -IDWriteFontFace4 : public IDWriteFontFace3 -{ - virtual HRESULT STDMETHODCALLTYPE GetGlyphImageFormats( - UINT16 glyph, - UINT32 ppem_first, - UINT32 ppem_last, - DWRITE_GLYPH_IMAGE_FORMATS *formats) = 0; - - virtual DWRITE_GLYPH_IMAGE_FORMATS STDMETHODCALLTYPE GetGlyphImageFormats( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetGlyphImageData( - UINT16 glyph, - UINT32 ppem, - DWRITE_GLYPH_IMAGE_FORMATS format, - DWRITE_GLYPH_IMAGE_DATA *data, - void **context) = 0; - - virtual void STDMETHODCALLTYPE ReleaseGlyphImageData( - void *context) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontFace4, 0x27f2a904, 0x4eb8, 0x441d, 0x96,0x78, 0x05,0x63,0xf5,0x3e,0x3e,0x2f) -#endif -#else -typedef struct IDWriteFontFace4Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontFace4 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontFace4 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontFace4 *This); - - /*** IDWriteFontFace methods ***/ - DWRITE_FONT_FACE_TYPE (STDMETHODCALLTYPE *GetType)( - IDWriteFontFace4 *This); - - HRESULT (STDMETHODCALLTYPE *GetFiles)( - IDWriteFontFace4 *This, - UINT32 *number_of_files, - IDWriteFontFile **fontfiles); - - UINT32 (STDMETHODCALLTYPE *GetIndex)( - IDWriteFontFace4 *This); - - DWRITE_FONT_SIMULATIONS (STDMETHODCALLTYPE *GetSimulations)( - IDWriteFontFace4 *This); - - WINBOOL (STDMETHODCALLTYPE *IsSymbolFont)( - IDWriteFontFace4 *This); - - void (STDMETHODCALLTYPE *GetMetrics)( - IDWriteFontFace4 *This, - DWRITE_FONT_METRICS *metrics); - - UINT16 (STDMETHODCALLTYPE *GetGlyphCount)( - IDWriteFontFace4 *This); - - HRESULT (STDMETHODCALLTYPE *GetDesignGlyphMetrics)( - IDWriteFontFace4 *This, - const UINT16 *glyph_indices, - UINT32 glyph_count, - DWRITE_GLYPH_METRICS *metrics, - WINBOOL is_sideways); - - HRESULT (STDMETHODCALLTYPE *GetGlyphIndices)( - IDWriteFontFace4 *This, - const UINT32 *codepoints, - UINT32 count, - UINT16 *glyph_indices); - - HRESULT (STDMETHODCALLTYPE *TryGetFontTable)( - IDWriteFontFace4 *This, - UINT32 table_tag, - const void **table_data, - UINT32 *table_size, - void **context, - WINBOOL *exists); - - void (STDMETHODCALLTYPE *ReleaseFontTable)( - IDWriteFontFace4 *This, - void *table_context); - - HRESULT (STDMETHODCALLTYPE *GetGlyphRunOutline)( - IDWriteFontFace4 *This, - FLOAT emSize, - const UINT16 *glyph_indices, - const FLOAT *glyph_advances, - const DWRITE_GLYPH_OFFSET *glyph_offsets, - UINT32 glyph_count, - WINBOOL is_sideways, - WINBOOL is_rtl, - IDWriteGeometrySink *geometrysink); - - HRESULT (STDMETHODCALLTYPE *GetRecommendedRenderingMode)( - IDWriteFontFace4 *This, - FLOAT emSize, - FLOAT pixels_per_dip, - DWRITE_MEASURING_MODE mode, - IDWriteRenderingParams *params, - DWRITE_RENDERING_MODE *rendering_mode); - - HRESULT (STDMETHODCALLTYPE *GetGdiCompatibleMetrics)( - IDWriteFontFace4 *This, - FLOAT emSize, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - DWRITE_FONT_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *GetGdiCompatibleGlyphMetrics)( - IDWriteFontFace4 *This, - FLOAT emSize, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - WINBOOL use_gdi_natural, - const UINT16 *glyph_indices, - UINT32 glyph_count, - DWRITE_GLYPH_METRICS *metrics, - WINBOOL is_sideways); - - /*** IDWriteFontFace1 methods ***/ - void (STDMETHODCALLTYPE *IDWriteFontFace1_GetMetrics)( - IDWriteFontFace4 *This, - DWRITE_FONT_METRICS1 *metrics); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFace1_GetGdiCompatibleMetrics)( - IDWriteFontFace4 *This, - FLOAT em_size, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - DWRITE_FONT_METRICS1 *metrics); - - void (STDMETHODCALLTYPE *GetCaretMetrics)( - IDWriteFontFace4 *This, - DWRITE_CARET_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *GetUnicodeRanges)( - IDWriteFontFace4 *This, - UINT32 max_count, - DWRITE_UNICODE_RANGE *ranges, - UINT32 *count); - - WINBOOL (STDMETHODCALLTYPE *IsMonospacedFont)( - IDWriteFontFace4 *This); - - HRESULT (STDMETHODCALLTYPE *GetDesignGlyphAdvances)( - IDWriteFontFace4 *This, - UINT32 glyph_count, - const UINT16 *indices, - INT32 *advances, - WINBOOL is_sideways); - - HRESULT (STDMETHODCALLTYPE *GetGdiCompatibleGlyphAdvances)( - IDWriteFontFace4 *This, - FLOAT em_size, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - WINBOOL use_gdi_natural, - WINBOOL is_sideways, - UINT32 glyph_count, - const UINT16 *indices, - INT32 *advances); - - HRESULT (STDMETHODCALLTYPE *GetKerningPairAdjustments)( - IDWriteFontFace4 *This, - UINT32 glyph_count, - const UINT16 *indices, - INT32 *adjustments); - - WINBOOL (STDMETHODCALLTYPE *HasKerningPairs)( - IDWriteFontFace4 *This); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFace1_GetRecommendedRenderingMode)( - IDWriteFontFace4 *This, - FLOAT font_emsize, - FLOAT dpiX, - FLOAT dpiY, - const DWRITE_MATRIX *transform, - WINBOOL is_sideways, - DWRITE_OUTLINE_THRESHOLD threshold, - DWRITE_MEASURING_MODE measuring_mode, - DWRITE_RENDERING_MODE *rendering_mode); - - HRESULT (STDMETHODCALLTYPE *GetVerticalGlyphVariants)( - IDWriteFontFace4 *This, - UINT32 glyph_count, - const UINT16 *nominal_indices, - UINT16 *vertical_indices); - - WINBOOL (STDMETHODCALLTYPE *HasVerticalGlyphVariants)( - IDWriteFontFace4 *This); - - /*** IDWriteFontFace2 methods ***/ - WINBOOL (STDMETHODCALLTYPE *IsColorFont)( - IDWriteFontFace4 *This); - - UINT32 (STDMETHODCALLTYPE *GetColorPaletteCount)( - IDWriteFontFace4 *This); - - UINT32 (STDMETHODCALLTYPE *GetPaletteEntryCount)( - IDWriteFontFace4 *This); - - HRESULT (STDMETHODCALLTYPE *GetPaletteEntries)( - IDWriteFontFace4 *This, - UINT32 palette_index, - UINT32 first_entry_index, - UINT32 entry_count, - DWRITE_COLOR_F *entries); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFace2_GetRecommendedRenderingMode)( - IDWriteFontFace4 *This, - FLOAT fontEmSize, - FLOAT dpiX, - FLOAT dpiY, - const DWRITE_MATRIX *transform, - WINBOOL is_sideways, - DWRITE_OUTLINE_THRESHOLD threshold, - DWRITE_MEASURING_MODE measuringmode, - IDWriteRenderingParams *params, - DWRITE_RENDERING_MODE *renderingmode, - DWRITE_GRID_FIT_MODE *gridfitmode); - - /*** IDWriteFontFace3 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontFaceReference)( - IDWriteFontFace4 *This, - IDWriteFontFaceReference **reference); - - void (STDMETHODCALLTYPE *GetPanose)( - IDWriteFontFace4 *This, - DWRITE_PANOSE *panose); - - DWRITE_FONT_WEIGHT (STDMETHODCALLTYPE *GetWeight)( - IDWriteFontFace4 *This); - - DWRITE_FONT_STRETCH (STDMETHODCALLTYPE *GetStretch)( - IDWriteFontFace4 *This); - - DWRITE_FONT_STYLE (STDMETHODCALLTYPE *GetStyle)( - IDWriteFontFace4 *This); - - HRESULT (STDMETHODCALLTYPE *GetFamilyNames)( - IDWriteFontFace4 *This, - IDWriteLocalizedStrings **names); - - HRESULT (STDMETHODCALLTYPE *GetFaceNames)( - IDWriteFontFace4 *This, - IDWriteLocalizedStrings **names); - - HRESULT (STDMETHODCALLTYPE *GetInformationalStrings)( - IDWriteFontFace4 *This, - DWRITE_INFORMATIONAL_STRING_ID stringid, - IDWriteLocalizedStrings **strings, - WINBOOL *exists); - - WINBOOL (STDMETHODCALLTYPE *HasCharacter)( - IDWriteFontFace4 *This, - UINT32 character); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFace3_GetRecommendedRenderingMode)( - IDWriteFontFace4 *This, - FLOAT emsize, - FLOAT dpi_x, - FLOAT dpi_y, - const DWRITE_MATRIX *transform, - WINBOOL is_sideways, - DWRITE_OUTLINE_THRESHOLD threshold, - DWRITE_MEASURING_MODE measuring_mode, - IDWriteRenderingParams *params, - DWRITE_RENDERING_MODE1 *rendering_mode, - DWRITE_GRID_FIT_MODE *gridfit_mode); - - WINBOOL (STDMETHODCALLTYPE *IsCharacterLocal)( - IDWriteFontFace4 *This, - UINT32 character); - - WINBOOL (STDMETHODCALLTYPE *IsGlyphLocal)( - IDWriteFontFace4 *This, - UINT16 glyph); - - HRESULT (STDMETHODCALLTYPE *AreCharactersLocal)( - IDWriteFontFace4 *This, - const WCHAR *characters, - UINT32 count, - WINBOOL enqueue_if_not, - WINBOOL *are_local); - - HRESULT (STDMETHODCALLTYPE *AreGlyphsLocal)( - IDWriteFontFace4 *This, - const UINT16 *glyphs, - UINT32 count, - WINBOOL enqueue_if_not, - WINBOOL *are_local); - - /*** IDWriteFontFace4 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetGlyphImageFormats_)( - IDWriteFontFace4 *This, - UINT16 glyph, - UINT32 ppem_first, - UINT32 ppem_last, - DWRITE_GLYPH_IMAGE_FORMATS *formats); - - DWRITE_GLYPH_IMAGE_FORMATS (STDMETHODCALLTYPE *GetGlyphImageFormats)( - IDWriteFontFace4 *This); - - HRESULT (STDMETHODCALLTYPE *GetGlyphImageData)( - IDWriteFontFace4 *This, - UINT16 glyph, - UINT32 ppem, - DWRITE_GLYPH_IMAGE_FORMATS format, - DWRITE_GLYPH_IMAGE_DATA *data, - void **context); - - void (STDMETHODCALLTYPE *ReleaseGlyphImageData)( - IDWriteFontFace4 *This, - void *context); - - END_INTERFACE -} IDWriteFontFace4Vtbl; - -interface IDWriteFontFace4 { - CONST_VTBL IDWriteFontFace4Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontFace4_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontFace4_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontFace4_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontFace methods ***/ -#define IDWriteFontFace4_GetType(This) (This)->lpVtbl->GetType(This) -#define IDWriteFontFace4_GetFiles(This,number_of_files,fontfiles) (This)->lpVtbl->GetFiles(This,number_of_files,fontfiles) -#define IDWriteFontFace4_GetIndex(This) (This)->lpVtbl->GetIndex(This) -#define IDWriteFontFace4_GetSimulations(This) (This)->lpVtbl->GetSimulations(This) -#define IDWriteFontFace4_IsSymbolFont(This) (This)->lpVtbl->IsSymbolFont(This) -#define IDWriteFontFace4_GetGlyphCount(This) (This)->lpVtbl->GetGlyphCount(This) -#define IDWriteFontFace4_GetDesignGlyphMetrics(This,glyph_indices,glyph_count,metrics,is_sideways) (This)->lpVtbl->GetDesignGlyphMetrics(This,glyph_indices,glyph_count,metrics,is_sideways) -#define IDWriteFontFace4_GetGlyphIndices(This,codepoints,count,glyph_indices) (This)->lpVtbl->GetGlyphIndices(This,codepoints,count,glyph_indices) -#define IDWriteFontFace4_TryGetFontTable(This,table_tag,table_data,table_size,context,exists) (This)->lpVtbl->TryGetFontTable(This,table_tag,table_data,table_size,context,exists) -#define IDWriteFontFace4_ReleaseFontTable(This,table_context) (This)->lpVtbl->ReleaseFontTable(This,table_context) -#define IDWriteFontFace4_GetGlyphRunOutline(This,emSize,glyph_indices,glyph_advances,glyph_offsets,glyph_count,is_sideways,is_rtl,geometrysink) (This)->lpVtbl->GetGlyphRunOutline(This,emSize,glyph_indices,glyph_advances,glyph_offsets,glyph_count,is_sideways,is_rtl,geometrysink) -#define IDWriteFontFace4_GetGdiCompatibleGlyphMetrics(This,emSize,pixels_per_dip,transform,use_gdi_natural,glyph_indices,glyph_count,metrics,is_sideways) (This)->lpVtbl->GetGdiCompatibleGlyphMetrics(This,emSize,pixels_per_dip,transform,use_gdi_natural,glyph_indices,glyph_count,metrics,is_sideways) -/*** IDWriteFontFace1 methods ***/ -#define IDWriteFontFace4_GetMetrics(This,metrics) (This)->lpVtbl->IDWriteFontFace1_GetMetrics(This,metrics) -#define IDWriteFontFace4_GetGdiCompatibleMetrics(This,em_size,pixels_per_dip,transform,metrics) (This)->lpVtbl->IDWriteFontFace1_GetGdiCompatibleMetrics(This,em_size,pixels_per_dip,transform,metrics) -#define IDWriteFontFace4_GetCaretMetrics(This,metrics) (This)->lpVtbl->GetCaretMetrics(This,metrics) -#define IDWriteFontFace4_GetUnicodeRanges(This,max_count,ranges,count) (This)->lpVtbl->GetUnicodeRanges(This,max_count,ranges,count) -#define IDWriteFontFace4_IsMonospacedFont(This) (This)->lpVtbl->IsMonospacedFont(This) -#define IDWriteFontFace4_GetDesignGlyphAdvances(This,glyph_count,indices,advances,is_sideways) (This)->lpVtbl->GetDesignGlyphAdvances(This,glyph_count,indices,advances,is_sideways) -#define IDWriteFontFace4_GetGdiCompatibleGlyphAdvances(This,em_size,pixels_per_dip,transform,use_gdi_natural,is_sideways,glyph_count,indices,advances) (This)->lpVtbl->GetGdiCompatibleGlyphAdvances(This,em_size,pixels_per_dip,transform,use_gdi_natural,is_sideways,glyph_count,indices,advances) -#define IDWriteFontFace4_GetKerningPairAdjustments(This,glyph_count,indices,adjustments) (This)->lpVtbl->GetKerningPairAdjustments(This,glyph_count,indices,adjustments) -#define IDWriteFontFace4_HasKerningPairs(This) (This)->lpVtbl->HasKerningPairs(This) -#define IDWriteFontFace4_GetVerticalGlyphVariants(This,glyph_count,nominal_indices,vertical_indices) (This)->lpVtbl->GetVerticalGlyphVariants(This,glyph_count,nominal_indices,vertical_indices) -#define IDWriteFontFace4_HasVerticalGlyphVariants(This) (This)->lpVtbl->HasVerticalGlyphVariants(This) -/*** IDWriteFontFace2 methods ***/ -#define IDWriteFontFace4_IsColorFont(This) (This)->lpVtbl->IsColorFont(This) -#define IDWriteFontFace4_GetColorPaletteCount(This) (This)->lpVtbl->GetColorPaletteCount(This) -#define IDWriteFontFace4_GetPaletteEntryCount(This) (This)->lpVtbl->GetPaletteEntryCount(This) -#define IDWriteFontFace4_GetPaletteEntries(This,palette_index,first_entry_index,entry_count,entries) (This)->lpVtbl->GetPaletteEntries(This,palette_index,first_entry_index,entry_count,entries) -/*** IDWriteFontFace3 methods ***/ -#define IDWriteFontFace4_GetFontFaceReference(This,reference) (This)->lpVtbl->GetFontFaceReference(This,reference) -#define IDWriteFontFace4_GetPanose(This,panose) (This)->lpVtbl->GetPanose(This,panose) -#define IDWriteFontFace4_GetWeight(This) (This)->lpVtbl->GetWeight(This) -#define IDWriteFontFace4_GetStretch(This) (This)->lpVtbl->GetStretch(This) -#define IDWriteFontFace4_GetStyle(This) (This)->lpVtbl->GetStyle(This) -#define IDWriteFontFace4_GetFamilyNames(This,names) (This)->lpVtbl->GetFamilyNames(This,names) -#define IDWriteFontFace4_GetFaceNames(This,names) (This)->lpVtbl->GetFaceNames(This,names) -#define IDWriteFontFace4_GetInformationalStrings(This,stringid,strings,exists) (This)->lpVtbl->GetInformationalStrings(This,stringid,strings,exists) -#define IDWriteFontFace4_HasCharacter(This,character) (This)->lpVtbl->HasCharacter(This,character) -#define IDWriteFontFace4_GetRecommendedRenderingMode(This,emsize,dpi_x,dpi_y,transform,is_sideways,threshold,measuring_mode,params,rendering_mode,gridfit_mode) (This)->lpVtbl->IDWriteFontFace3_GetRecommendedRenderingMode(This,emsize,dpi_x,dpi_y,transform,is_sideways,threshold,measuring_mode,params,rendering_mode,gridfit_mode) -#define IDWriteFontFace4_IsCharacterLocal(This,character) (This)->lpVtbl->IsCharacterLocal(This,character) -#define IDWriteFontFace4_IsGlyphLocal(This,glyph) (This)->lpVtbl->IsGlyphLocal(This,glyph) -#define IDWriteFontFace4_AreCharactersLocal(This,characters,count,enqueue_if_not,are_local) (This)->lpVtbl->AreCharactersLocal(This,characters,count,enqueue_if_not,are_local) -#define IDWriteFontFace4_AreGlyphsLocal(This,glyphs,count,enqueue_if_not,are_local) (This)->lpVtbl->AreGlyphsLocal(This,glyphs,count,enqueue_if_not,are_local) -/*** IDWriteFontFace4 methods ***/ -#define IDWriteFontFace4_GetGlyphImageFormats_(This,glyph,ppem_first,ppem_last,formats) (This)->lpVtbl->GetGlyphImageFormats_(This,glyph,ppem_first,ppem_last,formats) -#define IDWriteFontFace4_GetGlyphImageFormats(This) (This)->lpVtbl->GetGlyphImageFormats(This) -#define IDWriteFontFace4_GetGlyphImageData(This,glyph,ppem,format,data,context) (This)->lpVtbl->GetGlyphImageData(This,glyph,ppem,format,data,context) -#define IDWriteFontFace4_ReleaseGlyphImageData(This,context) (This)->lpVtbl->ReleaseGlyphImageData(This,context) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontFace4_QueryInterface(IDWriteFontFace4* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontFace4_AddRef(IDWriteFontFace4* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontFace4_Release(IDWriteFontFace4* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontFace methods ***/ -static FORCEINLINE DWRITE_FONT_FACE_TYPE IDWriteFontFace4_GetType(IDWriteFontFace4* This) { - return This->lpVtbl->GetType(This); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetFiles(IDWriteFontFace4* This,UINT32 *number_of_files,IDWriteFontFile **fontfiles) { - return This->lpVtbl->GetFiles(This,number_of_files,fontfiles); -} -static FORCEINLINE UINT32 IDWriteFontFace4_GetIndex(IDWriteFontFace4* This) { - return This->lpVtbl->GetIndex(This); -} -static FORCEINLINE DWRITE_FONT_SIMULATIONS IDWriteFontFace4_GetSimulations(IDWriteFontFace4* This) { - return This->lpVtbl->GetSimulations(This); -} -static FORCEINLINE WINBOOL IDWriteFontFace4_IsSymbolFont(IDWriteFontFace4* This) { - return This->lpVtbl->IsSymbolFont(This); -} -static FORCEINLINE UINT16 IDWriteFontFace4_GetGlyphCount(IDWriteFontFace4* This) { - return This->lpVtbl->GetGlyphCount(This); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetDesignGlyphMetrics(IDWriteFontFace4* This,const UINT16 *glyph_indices,UINT32 glyph_count,DWRITE_GLYPH_METRICS *metrics,WINBOOL is_sideways) { - return This->lpVtbl->GetDesignGlyphMetrics(This,glyph_indices,glyph_count,metrics,is_sideways); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetGlyphIndices(IDWriteFontFace4* This,const UINT32 *codepoints,UINT32 count,UINT16 *glyph_indices) { - return This->lpVtbl->GetGlyphIndices(This,codepoints,count,glyph_indices); -} -static FORCEINLINE HRESULT IDWriteFontFace4_TryGetFontTable(IDWriteFontFace4* This,UINT32 table_tag,const void **table_data,UINT32 *table_size,void **context,WINBOOL *exists) { - return This->lpVtbl->TryGetFontTable(This,table_tag,table_data,table_size,context,exists); -} -static FORCEINLINE void IDWriteFontFace4_ReleaseFontTable(IDWriteFontFace4* This,void *table_context) { - This->lpVtbl->ReleaseFontTable(This,table_context); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetGlyphRunOutline(IDWriteFontFace4* This,FLOAT emSize,const UINT16 *glyph_indices,const FLOAT *glyph_advances,const DWRITE_GLYPH_OFFSET *glyph_offsets,UINT32 glyph_count,WINBOOL is_sideways,WINBOOL is_rtl,IDWriteGeometrySink *geometrysink) { - return This->lpVtbl->GetGlyphRunOutline(This,emSize,glyph_indices,glyph_advances,glyph_offsets,glyph_count,is_sideways,is_rtl,geometrysink); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetGdiCompatibleGlyphMetrics(IDWriteFontFace4* This,FLOAT emSize,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,WINBOOL use_gdi_natural,const UINT16 *glyph_indices,UINT32 glyph_count,DWRITE_GLYPH_METRICS *metrics,WINBOOL is_sideways) { - return This->lpVtbl->GetGdiCompatibleGlyphMetrics(This,emSize,pixels_per_dip,transform,use_gdi_natural,glyph_indices,glyph_count,metrics,is_sideways); -} -/*** IDWriteFontFace1 methods ***/ -static FORCEINLINE void IDWriteFontFace4_GetMetrics(IDWriteFontFace4* This,DWRITE_FONT_METRICS1 *metrics) { - This->lpVtbl->IDWriteFontFace1_GetMetrics(This,metrics); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetGdiCompatibleMetrics(IDWriteFontFace4* This,FLOAT em_size,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,DWRITE_FONT_METRICS1 *metrics) { - return This->lpVtbl->IDWriteFontFace1_GetGdiCompatibleMetrics(This,em_size,pixels_per_dip,transform,metrics); -} -static FORCEINLINE void IDWriteFontFace4_GetCaretMetrics(IDWriteFontFace4* This,DWRITE_CARET_METRICS *metrics) { - This->lpVtbl->GetCaretMetrics(This,metrics); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetUnicodeRanges(IDWriteFontFace4* This,UINT32 max_count,DWRITE_UNICODE_RANGE *ranges,UINT32 *count) { - return This->lpVtbl->GetUnicodeRanges(This,max_count,ranges,count); -} -static FORCEINLINE WINBOOL IDWriteFontFace4_IsMonospacedFont(IDWriteFontFace4* This) { - return This->lpVtbl->IsMonospacedFont(This); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetDesignGlyphAdvances(IDWriteFontFace4* This,UINT32 glyph_count,const UINT16 *indices,INT32 *advances,WINBOOL is_sideways) { - return This->lpVtbl->GetDesignGlyphAdvances(This,glyph_count,indices,advances,is_sideways); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetGdiCompatibleGlyphAdvances(IDWriteFontFace4* This,FLOAT em_size,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,WINBOOL use_gdi_natural,WINBOOL is_sideways,UINT32 glyph_count,const UINT16 *indices,INT32 *advances) { - return This->lpVtbl->GetGdiCompatibleGlyphAdvances(This,em_size,pixels_per_dip,transform,use_gdi_natural,is_sideways,glyph_count,indices,advances); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetKerningPairAdjustments(IDWriteFontFace4* This,UINT32 glyph_count,const UINT16 *indices,INT32 *adjustments) { - return This->lpVtbl->GetKerningPairAdjustments(This,glyph_count,indices,adjustments); -} -static FORCEINLINE WINBOOL IDWriteFontFace4_HasKerningPairs(IDWriteFontFace4* This) { - return This->lpVtbl->HasKerningPairs(This); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetVerticalGlyphVariants(IDWriteFontFace4* This,UINT32 glyph_count,const UINT16 *nominal_indices,UINT16 *vertical_indices) { - return This->lpVtbl->GetVerticalGlyphVariants(This,glyph_count,nominal_indices,vertical_indices); -} -static FORCEINLINE WINBOOL IDWriteFontFace4_HasVerticalGlyphVariants(IDWriteFontFace4* This) { - return This->lpVtbl->HasVerticalGlyphVariants(This); -} -/*** IDWriteFontFace2 methods ***/ -static FORCEINLINE WINBOOL IDWriteFontFace4_IsColorFont(IDWriteFontFace4* This) { - return This->lpVtbl->IsColorFont(This); -} -static FORCEINLINE UINT32 IDWriteFontFace4_GetColorPaletteCount(IDWriteFontFace4* This) { - return This->lpVtbl->GetColorPaletteCount(This); -} -static FORCEINLINE UINT32 IDWriteFontFace4_GetPaletteEntryCount(IDWriteFontFace4* This) { - return This->lpVtbl->GetPaletteEntryCount(This); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetPaletteEntries(IDWriteFontFace4* This,UINT32 palette_index,UINT32 first_entry_index,UINT32 entry_count,DWRITE_COLOR_F *entries) { - return This->lpVtbl->GetPaletteEntries(This,palette_index,first_entry_index,entry_count,entries); -} -/*** IDWriteFontFace3 methods ***/ -static FORCEINLINE HRESULT IDWriteFontFace4_GetFontFaceReference(IDWriteFontFace4* This,IDWriteFontFaceReference **reference) { - return This->lpVtbl->GetFontFaceReference(This,reference); -} -static FORCEINLINE void IDWriteFontFace4_GetPanose(IDWriteFontFace4* This,DWRITE_PANOSE *panose) { - This->lpVtbl->GetPanose(This,panose); -} -static FORCEINLINE DWRITE_FONT_WEIGHT IDWriteFontFace4_GetWeight(IDWriteFontFace4* This) { - return This->lpVtbl->GetWeight(This); -} -static FORCEINLINE DWRITE_FONT_STRETCH IDWriteFontFace4_GetStretch(IDWriteFontFace4* This) { - return This->lpVtbl->GetStretch(This); -} -static FORCEINLINE DWRITE_FONT_STYLE IDWriteFontFace4_GetStyle(IDWriteFontFace4* This) { - return This->lpVtbl->GetStyle(This); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetFamilyNames(IDWriteFontFace4* This,IDWriteLocalizedStrings **names) { - return This->lpVtbl->GetFamilyNames(This,names); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetFaceNames(IDWriteFontFace4* This,IDWriteLocalizedStrings **names) { - return This->lpVtbl->GetFaceNames(This,names); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetInformationalStrings(IDWriteFontFace4* This,DWRITE_INFORMATIONAL_STRING_ID stringid,IDWriteLocalizedStrings **strings,WINBOOL *exists) { - return This->lpVtbl->GetInformationalStrings(This,stringid,strings,exists); -} -static FORCEINLINE WINBOOL IDWriteFontFace4_HasCharacter(IDWriteFontFace4* This,UINT32 character) { - return This->lpVtbl->HasCharacter(This,character); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetRecommendedRenderingMode(IDWriteFontFace4* This,FLOAT emsize,FLOAT dpi_x,FLOAT dpi_y,const DWRITE_MATRIX *transform,WINBOOL is_sideways,DWRITE_OUTLINE_THRESHOLD threshold,DWRITE_MEASURING_MODE measuring_mode,IDWriteRenderingParams *params,DWRITE_RENDERING_MODE1 *rendering_mode,DWRITE_GRID_FIT_MODE *gridfit_mode) { - return This->lpVtbl->IDWriteFontFace3_GetRecommendedRenderingMode(This,emsize,dpi_x,dpi_y,transform,is_sideways,threshold,measuring_mode,params,rendering_mode,gridfit_mode); -} -static FORCEINLINE WINBOOL IDWriteFontFace4_IsCharacterLocal(IDWriteFontFace4* This,UINT32 character) { - return This->lpVtbl->IsCharacterLocal(This,character); -} -static FORCEINLINE WINBOOL IDWriteFontFace4_IsGlyphLocal(IDWriteFontFace4* This,UINT16 glyph) { - return This->lpVtbl->IsGlyphLocal(This,glyph); -} -static FORCEINLINE HRESULT IDWriteFontFace4_AreCharactersLocal(IDWriteFontFace4* This,const WCHAR *characters,UINT32 count,WINBOOL enqueue_if_not,WINBOOL *are_local) { - return This->lpVtbl->AreCharactersLocal(This,characters,count,enqueue_if_not,are_local); -} -static FORCEINLINE HRESULT IDWriteFontFace4_AreGlyphsLocal(IDWriteFontFace4* This,const UINT16 *glyphs,UINT32 count,WINBOOL enqueue_if_not,WINBOOL *are_local) { - return This->lpVtbl->AreGlyphsLocal(This,glyphs,count,enqueue_if_not,are_local); -} -/*** IDWriteFontFace4 methods ***/ -static FORCEINLINE HRESULT IDWriteFontFace4_GetGlyphImageFormats_(IDWriteFontFace4* This,UINT16 glyph,UINT32 ppem_first,UINT32 ppem_last,DWRITE_GLYPH_IMAGE_FORMATS *formats) { - return This->lpVtbl->GetGlyphImageFormats_(This,glyph,ppem_first,ppem_last,formats); -} -static FORCEINLINE DWRITE_GLYPH_IMAGE_FORMATS IDWriteFontFace4_GetGlyphImageFormats(IDWriteFontFace4* This) { - return This->lpVtbl->GetGlyphImageFormats(This); -} -static FORCEINLINE HRESULT IDWriteFontFace4_GetGlyphImageData(IDWriteFontFace4* This,UINT16 glyph,UINT32 ppem,DWRITE_GLYPH_IMAGE_FORMATS format,DWRITE_GLYPH_IMAGE_DATA *data,void **context) { - return This->lpVtbl->GetGlyphImageData(This,glyph,ppem,format,data,context); -} -static FORCEINLINE void IDWriteFontFace4_ReleaseGlyphImageData(IDWriteFontFace4* This,void *context) { - This->lpVtbl->ReleaseGlyphImageData(This,context); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontFace4_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFontFace5 interface - */ -#ifndef __IDWriteFontFace5_INTERFACE_DEFINED__ -#define __IDWriteFontFace5_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFontFace5, 0x98eff3a5, 0xb667, 0x479a, 0xb1,0x45, 0xe2,0xfa,0x5b,0x9f,0xdc,0x29); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("98eff3a5-b667-479a-b145-e2fa5b9fdc29") -IDWriteFontFace5 : public IDWriteFontFace4 -{ - virtual UINT32 STDMETHODCALLTYPE GetFontAxisValueCount( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontAxisValues( - DWRITE_FONT_AXIS_VALUE *values, - UINT32 value_count) = 0; - - virtual WINBOOL STDMETHODCALLTYPE HasVariations( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFontResource( - IDWriteFontResource **resource) = 0; - - virtual WINBOOL STDMETHODCALLTYPE Equals( - IDWriteFontFace *fontface) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFontFace5, 0x98eff3a5, 0xb667, 0x479a, 0xb1,0x45, 0xe2,0xfa,0x5b,0x9f,0xdc,0x29) -#endif -#else -typedef struct IDWriteFontFace5Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFontFace5 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFontFace5 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFontFace5 *This); - - /*** IDWriteFontFace methods ***/ - DWRITE_FONT_FACE_TYPE (STDMETHODCALLTYPE *GetType)( - IDWriteFontFace5 *This); - - HRESULT (STDMETHODCALLTYPE *GetFiles)( - IDWriteFontFace5 *This, - UINT32 *number_of_files, - IDWriteFontFile **fontfiles); - - UINT32 (STDMETHODCALLTYPE *GetIndex)( - IDWriteFontFace5 *This); - - DWRITE_FONT_SIMULATIONS (STDMETHODCALLTYPE *GetSimulations)( - IDWriteFontFace5 *This); - - WINBOOL (STDMETHODCALLTYPE *IsSymbolFont)( - IDWriteFontFace5 *This); - - void (STDMETHODCALLTYPE *GetMetrics)( - IDWriteFontFace5 *This, - DWRITE_FONT_METRICS *metrics); - - UINT16 (STDMETHODCALLTYPE *GetGlyphCount)( - IDWriteFontFace5 *This); - - HRESULT (STDMETHODCALLTYPE *GetDesignGlyphMetrics)( - IDWriteFontFace5 *This, - const UINT16 *glyph_indices, - UINT32 glyph_count, - DWRITE_GLYPH_METRICS *metrics, - WINBOOL is_sideways); - - HRESULT (STDMETHODCALLTYPE *GetGlyphIndices)( - IDWriteFontFace5 *This, - const UINT32 *codepoints, - UINT32 count, - UINT16 *glyph_indices); - - HRESULT (STDMETHODCALLTYPE *TryGetFontTable)( - IDWriteFontFace5 *This, - UINT32 table_tag, - const void **table_data, - UINT32 *table_size, - void **context, - WINBOOL *exists); - - void (STDMETHODCALLTYPE *ReleaseFontTable)( - IDWriteFontFace5 *This, - void *table_context); - - HRESULT (STDMETHODCALLTYPE *GetGlyphRunOutline)( - IDWriteFontFace5 *This, - FLOAT emSize, - const UINT16 *glyph_indices, - const FLOAT *glyph_advances, - const DWRITE_GLYPH_OFFSET *glyph_offsets, - UINT32 glyph_count, - WINBOOL is_sideways, - WINBOOL is_rtl, - IDWriteGeometrySink *geometrysink); - - HRESULT (STDMETHODCALLTYPE *GetRecommendedRenderingMode)( - IDWriteFontFace5 *This, - FLOAT emSize, - FLOAT pixels_per_dip, - DWRITE_MEASURING_MODE mode, - IDWriteRenderingParams *params, - DWRITE_RENDERING_MODE *rendering_mode); - - HRESULT (STDMETHODCALLTYPE *GetGdiCompatibleMetrics)( - IDWriteFontFace5 *This, - FLOAT emSize, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - DWRITE_FONT_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *GetGdiCompatibleGlyphMetrics)( - IDWriteFontFace5 *This, - FLOAT emSize, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - WINBOOL use_gdi_natural, - const UINT16 *glyph_indices, - UINT32 glyph_count, - DWRITE_GLYPH_METRICS *metrics, - WINBOOL is_sideways); - - /*** IDWriteFontFace1 methods ***/ - void (STDMETHODCALLTYPE *IDWriteFontFace1_GetMetrics)( - IDWriteFontFace5 *This, - DWRITE_FONT_METRICS1 *metrics); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFace1_GetGdiCompatibleMetrics)( - IDWriteFontFace5 *This, - FLOAT em_size, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - DWRITE_FONT_METRICS1 *metrics); - - void (STDMETHODCALLTYPE *GetCaretMetrics)( - IDWriteFontFace5 *This, - DWRITE_CARET_METRICS *metrics); - - HRESULT (STDMETHODCALLTYPE *GetUnicodeRanges)( - IDWriteFontFace5 *This, - UINT32 max_count, - DWRITE_UNICODE_RANGE *ranges, - UINT32 *count); - - WINBOOL (STDMETHODCALLTYPE *IsMonospacedFont)( - IDWriteFontFace5 *This); - - HRESULT (STDMETHODCALLTYPE *GetDesignGlyphAdvances)( - IDWriteFontFace5 *This, - UINT32 glyph_count, - const UINT16 *indices, - INT32 *advances, - WINBOOL is_sideways); - - HRESULT (STDMETHODCALLTYPE *GetGdiCompatibleGlyphAdvances)( - IDWriteFontFace5 *This, - FLOAT em_size, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - WINBOOL use_gdi_natural, - WINBOOL is_sideways, - UINT32 glyph_count, - const UINT16 *indices, - INT32 *advances); - - HRESULT (STDMETHODCALLTYPE *GetKerningPairAdjustments)( - IDWriteFontFace5 *This, - UINT32 glyph_count, - const UINT16 *indices, - INT32 *adjustments); - - WINBOOL (STDMETHODCALLTYPE *HasKerningPairs)( - IDWriteFontFace5 *This); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFace1_GetRecommendedRenderingMode)( - IDWriteFontFace5 *This, - FLOAT font_emsize, - FLOAT dpiX, - FLOAT dpiY, - const DWRITE_MATRIX *transform, - WINBOOL is_sideways, - DWRITE_OUTLINE_THRESHOLD threshold, - DWRITE_MEASURING_MODE measuring_mode, - DWRITE_RENDERING_MODE *rendering_mode); - - HRESULT (STDMETHODCALLTYPE *GetVerticalGlyphVariants)( - IDWriteFontFace5 *This, - UINT32 glyph_count, - const UINT16 *nominal_indices, - UINT16 *vertical_indices); - - WINBOOL (STDMETHODCALLTYPE *HasVerticalGlyphVariants)( - IDWriteFontFace5 *This); - - /*** IDWriteFontFace2 methods ***/ - WINBOOL (STDMETHODCALLTYPE *IsColorFont)( - IDWriteFontFace5 *This); - - UINT32 (STDMETHODCALLTYPE *GetColorPaletteCount)( - IDWriteFontFace5 *This); - - UINT32 (STDMETHODCALLTYPE *GetPaletteEntryCount)( - IDWriteFontFace5 *This); - - HRESULT (STDMETHODCALLTYPE *GetPaletteEntries)( - IDWriteFontFace5 *This, - UINT32 palette_index, - UINT32 first_entry_index, - UINT32 entry_count, - DWRITE_COLOR_F *entries); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFace2_GetRecommendedRenderingMode)( - IDWriteFontFace5 *This, - FLOAT fontEmSize, - FLOAT dpiX, - FLOAT dpiY, - const DWRITE_MATRIX *transform, - WINBOOL is_sideways, - DWRITE_OUTLINE_THRESHOLD threshold, - DWRITE_MEASURING_MODE measuringmode, - IDWriteRenderingParams *params, - DWRITE_RENDERING_MODE *renderingmode, - DWRITE_GRID_FIT_MODE *gridfitmode); - - /*** IDWriteFontFace3 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetFontFaceReference)( - IDWriteFontFace5 *This, - IDWriteFontFaceReference **reference); - - void (STDMETHODCALLTYPE *GetPanose)( - IDWriteFontFace5 *This, - DWRITE_PANOSE *panose); - - DWRITE_FONT_WEIGHT (STDMETHODCALLTYPE *GetWeight)( - IDWriteFontFace5 *This); - - DWRITE_FONT_STRETCH (STDMETHODCALLTYPE *GetStretch)( - IDWriteFontFace5 *This); - - DWRITE_FONT_STYLE (STDMETHODCALLTYPE *GetStyle)( - IDWriteFontFace5 *This); - - HRESULT (STDMETHODCALLTYPE *GetFamilyNames)( - IDWriteFontFace5 *This, - IDWriteLocalizedStrings **names); - - HRESULT (STDMETHODCALLTYPE *GetFaceNames)( - IDWriteFontFace5 *This, - IDWriteLocalizedStrings **names); - - HRESULT (STDMETHODCALLTYPE *GetInformationalStrings)( - IDWriteFontFace5 *This, - DWRITE_INFORMATIONAL_STRING_ID stringid, - IDWriteLocalizedStrings **strings, - WINBOOL *exists); - - WINBOOL (STDMETHODCALLTYPE *HasCharacter)( - IDWriteFontFace5 *This, - UINT32 character); - - HRESULT (STDMETHODCALLTYPE *IDWriteFontFace3_GetRecommendedRenderingMode)( - IDWriteFontFace5 *This, - FLOAT emsize, - FLOAT dpi_x, - FLOAT dpi_y, - const DWRITE_MATRIX *transform, - WINBOOL is_sideways, - DWRITE_OUTLINE_THRESHOLD threshold, - DWRITE_MEASURING_MODE measuring_mode, - IDWriteRenderingParams *params, - DWRITE_RENDERING_MODE1 *rendering_mode, - DWRITE_GRID_FIT_MODE *gridfit_mode); - - WINBOOL (STDMETHODCALLTYPE *IsCharacterLocal)( - IDWriteFontFace5 *This, - UINT32 character); - - WINBOOL (STDMETHODCALLTYPE *IsGlyphLocal)( - IDWriteFontFace5 *This, - UINT16 glyph); - - HRESULT (STDMETHODCALLTYPE *AreCharactersLocal)( - IDWriteFontFace5 *This, - const WCHAR *characters, - UINT32 count, - WINBOOL enqueue_if_not, - WINBOOL *are_local); - - HRESULT (STDMETHODCALLTYPE *AreGlyphsLocal)( - IDWriteFontFace5 *This, - const UINT16 *glyphs, - UINT32 count, - WINBOOL enqueue_if_not, - WINBOOL *are_local); - - /*** IDWriteFontFace4 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetGlyphImageFormats_)( - IDWriteFontFace5 *This, - UINT16 glyph, - UINT32 ppem_first, - UINT32 ppem_last, - DWRITE_GLYPH_IMAGE_FORMATS *formats); - - DWRITE_GLYPH_IMAGE_FORMATS (STDMETHODCALLTYPE *GetGlyphImageFormats)( - IDWriteFontFace5 *This); - - HRESULT (STDMETHODCALLTYPE *GetGlyphImageData)( - IDWriteFontFace5 *This, - UINT16 glyph, - UINT32 ppem, - DWRITE_GLYPH_IMAGE_FORMATS format, - DWRITE_GLYPH_IMAGE_DATA *data, - void **context); - - void (STDMETHODCALLTYPE *ReleaseGlyphImageData)( - IDWriteFontFace5 *This, - void *context); - - /*** IDWriteFontFace5 methods ***/ - UINT32 (STDMETHODCALLTYPE *GetFontAxisValueCount)( - IDWriteFontFace5 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontAxisValues)( - IDWriteFontFace5 *This, - DWRITE_FONT_AXIS_VALUE *values, - UINT32 value_count); - - WINBOOL (STDMETHODCALLTYPE *HasVariations)( - IDWriteFontFace5 *This); - - HRESULT (STDMETHODCALLTYPE *GetFontResource)( - IDWriteFontFace5 *This, - IDWriteFontResource **resource); - - WINBOOL (STDMETHODCALLTYPE *Equals)( - IDWriteFontFace5 *This, - IDWriteFontFace *fontface); - - END_INTERFACE -} IDWriteFontFace5Vtbl; - -interface IDWriteFontFace5 { - CONST_VTBL IDWriteFontFace5Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFontFace5_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFontFace5_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFontFace5_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontFace methods ***/ -#define IDWriteFontFace5_GetType(This) (This)->lpVtbl->GetType(This) -#define IDWriteFontFace5_GetFiles(This,number_of_files,fontfiles) (This)->lpVtbl->GetFiles(This,number_of_files,fontfiles) -#define IDWriteFontFace5_GetIndex(This) (This)->lpVtbl->GetIndex(This) -#define IDWriteFontFace5_GetSimulations(This) (This)->lpVtbl->GetSimulations(This) -#define IDWriteFontFace5_IsSymbolFont(This) (This)->lpVtbl->IsSymbolFont(This) -#define IDWriteFontFace5_GetGlyphCount(This) (This)->lpVtbl->GetGlyphCount(This) -#define IDWriteFontFace5_GetDesignGlyphMetrics(This,glyph_indices,glyph_count,metrics,is_sideways) (This)->lpVtbl->GetDesignGlyphMetrics(This,glyph_indices,glyph_count,metrics,is_sideways) -#define IDWriteFontFace5_GetGlyphIndices(This,codepoints,count,glyph_indices) (This)->lpVtbl->GetGlyphIndices(This,codepoints,count,glyph_indices) -#define IDWriteFontFace5_TryGetFontTable(This,table_tag,table_data,table_size,context,exists) (This)->lpVtbl->TryGetFontTable(This,table_tag,table_data,table_size,context,exists) -#define IDWriteFontFace5_ReleaseFontTable(This,table_context) (This)->lpVtbl->ReleaseFontTable(This,table_context) -#define IDWriteFontFace5_GetGlyphRunOutline(This,emSize,glyph_indices,glyph_advances,glyph_offsets,glyph_count,is_sideways,is_rtl,geometrysink) (This)->lpVtbl->GetGlyphRunOutline(This,emSize,glyph_indices,glyph_advances,glyph_offsets,glyph_count,is_sideways,is_rtl,geometrysink) -#define IDWriteFontFace5_GetGdiCompatibleGlyphMetrics(This,emSize,pixels_per_dip,transform,use_gdi_natural,glyph_indices,glyph_count,metrics,is_sideways) (This)->lpVtbl->GetGdiCompatibleGlyphMetrics(This,emSize,pixels_per_dip,transform,use_gdi_natural,glyph_indices,glyph_count,metrics,is_sideways) -/*** IDWriteFontFace1 methods ***/ -#define IDWriteFontFace5_GetMetrics(This,metrics) (This)->lpVtbl->IDWriteFontFace1_GetMetrics(This,metrics) -#define IDWriteFontFace5_GetGdiCompatibleMetrics(This,em_size,pixels_per_dip,transform,metrics) (This)->lpVtbl->IDWriteFontFace1_GetGdiCompatibleMetrics(This,em_size,pixels_per_dip,transform,metrics) -#define IDWriteFontFace5_GetCaretMetrics(This,metrics) (This)->lpVtbl->GetCaretMetrics(This,metrics) -#define IDWriteFontFace5_GetUnicodeRanges(This,max_count,ranges,count) (This)->lpVtbl->GetUnicodeRanges(This,max_count,ranges,count) -#define IDWriteFontFace5_IsMonospacedFont(This) (This)->lpVtbl->IsMonospacedFont(This) -#define IDWriteFontFace5_GetDesignGlyphAdvances(This,glyph_count,indices,advances,is_sideways) (This)->lpVtbl->GetDesignGlyphAdvances(This,glyph_count,indices,advances,is_sideways) -#define IDWriteFontFace5_GetGdiCompatibleGlyphAdvances(This,em_size,pixels_per_dip,transform,use_gdi_natural,is_sideways,glyph_count,indices,advances) (This)->lpVtbl->GetGdiCompatibleGlyphAdvances(This,em_size,pixels_per_dip,transform,use_gdi_natural,is_sideways,glyph_count,indices,advances) -#define IDWriteFontFace5_GetKerningPairAdjustments(This,glyph_count,indices,adjustments) (This)->lpVtbl->GetKerningPairAdjustments(This,glyph_count,indices,adjustments) -#define IDWriteFontFace5_HasKerningPairs(This) (This)->lpVtbl->HasKerningPairs(This) -#define IDWriteFontFace5_GetVerticalGlyphVariants(This,glyph_count,nominal_indices,vertical_indices) (This)->lpVtbl->GetVerticalGlyphVariants(This,glyph_count,nominal_indices,vertical_indices) -#define IDWriteFontFace5_HasVerticalGlyphVariants(This) (This)->lpVtbl->HasVerticalGlyphVariants(This) -/*** IDWriteFontFace2 methods ***/ -#define IDWriteFontFace5_IsColorFont(This) (This)->lpVtbl->IsColorFont(This) -#define IDWriteFontFace5_GetColorPaletteCount(This) (This)->lpVtbl->GetColorPaletteCount(This) -#define IDWriteFontFace5_GetPaletteEntryCount(This) (This)->lpVtbl->GetPaletteEntryCount(This) -#define IDWriteFontFace5_GetPaletteEntries(This,palette_index,first_entry_index,entry_count,entries) (This)->lpVtbl->GetPaletteEntries(This,palette_index,first_entry_index,entry_count,entries) -/*** IDWriteFontFace3 methods ***/ -#define IDWriteFontFace5_GetFontFaceReference(This,reference) (This)->lpVtbl->GetFontFaceReference(This,reference) -#define IDWriteFontFace5_GetPanose(This,panose) (This)->lpVtbl->GetPanose(This,panose) -#define IDWriteFontFace5_GetWeight(This) (This)->lpVtbl->GetWeight(This) -#define IDWriteFontFace5_GetStretch(This) (This)->lpVtbl->GetStretch(This) -#define IDWriteFontFace5_GetStyle(This) (This)->lpVtbl->GetStyle(This) -#define IDWriteFontFace5_GetFamilyNames(This,names) (This)->lpVtbl->GetFamilyNames(This,names) -#define IDWriteFontFace5_GetFaceNames(This,names) (This)->lpVtbl->GetFaceNames(This,names) -#define IDWriteFontFace5_GetInformationalStrings(This,stringid,strings,exists) (This)->lpVtbl->GetInformationalStrings(This,stringid,strings,exists) -#define IDWriteFontFace5_HasCharacter(This,character) (This)->lpVtbl->HasCharacter(This,character) -#define IDWriteFontFace5_GetRecommendedRenderingMode(This,emsize,dpi_x,dpi_y,transform,is_sideways,threshold,measuring_mode,params,rendering_mode,gridfit_mode) (This)->lpVtbl->IDWriteFontFace3_GetRecommendedRenderingMode(This,emsize,dpi_x,dpi_y,transform,is_sideways,threshold,measuring_mode,params,rendering_mode,gridfit_mode) -#define IDWriteFontFace5_IsCharacterLocal(This,character) (This)->lpVtbl->IsCharacterLocal(This,character) -#define IDWriteFontFace5_IsGlyphLocal(This,glyph) (This)->lpVtbl->IsGlyphLocal(This,glyph) -#define IDWriteFontFace5_AreCharactersLocal(This,characters,count,enqueue_if_not,are_local) (This)->lpVtbl->AreCharactersLocal(This,characters,count,enqueue_if_not,are_local) -#define IDWriteFontFace5_AreGlyphsLocal(This,glyphs,count,enqueue_if_not,are_local) (This)->lpVtbl->AreGlyphsLocal(This,glyphs,count,enqueue_if_not,are_local) -/*** IDWriteFontFace4 methods ***/ -#define IDWriteFontFace5_GetGlyphImageFormats_(This,glyph,ppem_first,ppem_last,formats) (This)->lpVtbl->GetGlyphImageFormats_(This,glyph,ppem_first,ppem_last,formats) -#define IDWriteFontFace5_GetGlyphImageFormats(This) (This)->lpVtbl->GetGlyphImageFormats(This) -#define IDWriteFontFace5_GetGlyphImageData(This,glyph,ppem,format,data,context) (This)->lpVtbl->GetGlyphImageData(This,glyph,ppem,format,data,context) -#define IDWriteFontFace5_ReleaseGlyphImageData(This,context) (This)->lpVtbl->ReleaseGlyphImageData(This,context) -/*** IDWriteFontFace5 methods ***/ -#define IDWriteFontFace5_GetFontAxisValueCount(This) (This)->lpVtbl->GetFontAxisValueCount(This) -#define IDWriteFontFace5_GetFontAxisValues(This,values,value_count) (This)->lpVtbl->GetFontAxisValues(This,values,value_count) -#define IDWriteFontFace5_HasVariations(This) (This)->lpVtbl->HasVariations(This) -#define IDWriteFontFace5_GetFontResource(This,resource) (This)->lpVtbl->GetFontResource(This,resource) -#define IDWriteFontFace5_Equals(This,fontface) (This)->lpVtbl->Equals(This,fontface) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFontFace5_QueryInterface(IDWriteFontFace5* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFontFace5_AddRef(IDWriteFontFace5* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFontFace5_Release(IDWriteFontFace5* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontFace methods ***/ -static FORCEINLINE DWRITE_FONT_FACE_TYPE IDWriteFontFace5_GetType(IDWriteFontFace5* This) { - return This->lpVtbl->GetType(This); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetFiles(IDWriteFontFace5* This,UINT32 *number_of_files,IDWriteFontFile **fontfiles) { - return This->lpVtbl->GetFiles(This,number_of_files,fontfiles); -} -static FORCEINLINE UINT32 IDWriteFontFace5_GetIndex(IDWriteFontFace5* This) { - return This->lpVtbl->GetIndex(This); -} -static FORCEINLINE DWRITE_FONT_SIMULATIONS IDWriteFontFace5_GetSimulations(IDWriteFontFace5* This) { - return This->lpVtbl->GetSimulations(This); -} -static FORCEINLINE WINBOOL IDWriteFontFace5_IsSymbolFont(IDWriteFontFace5* This) { - return This->lpVtbl->IsSymbolFont(This); -} -static FORCEINLINE UINT16 IDWriteFontFace5_GetGlyphCount(IDWriteFontFace5* This) { - return This->lpVtbl->GetGlyphCount(This); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetDesignGlyphMetrics(IDWriteFontFace5* This,const UINT16 *glyph_indices,UINT32 glyph_count,DWRITE_GLYPH_METRICS *metrics,WINBOOL is_sideways) { - return This->lpVtbl->GetDesignGlyphMetrics(This,glyph_indices,glyph_count,metrics,is_sideways); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetGlyphIndices(IDWriteFontFace5* This,const UINT32 *codepoints,UINT32 count,UINT16 *glyph_indices) { - return This->lpVtbl->GetGlyphIndices(This,codepoints,count,glyph_indices); -} -static FORCEINLINE HRESULT IDWriteFontFace5_TryGetFontTable(IDWriteFontFace5* This,UINT32 table_tag,const void **table_data,UINT32 *table_size,void **context,WINBOOL *exists) { - return This->lpVtbl->TryGetFontTable(This,table_tag,table_data,table_size,context,exists); -} -static FORCEINLINE void IDWriteFontFace5_ReleaseFontTable(IDWriteFontFace5* This,void *table_context) { - This->lpVtbl->ReleaseFontTable(This,table_context); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetGlyphRunOutline(IDWriteFontFace5* This,FLOAT emSize,const UINT16 *glyph_indices,const FLOAT *glyph_advances,const DWRITE_GLYPH_OFFSET *glyph_offsets,UINT32 glyph_count,WINBOOL is_sideways,WINBOOL is_rtl,IDWriteGeometrySink *geometrysink) { - return This->lpVtbl->GetGlyphRunOutline(This,emSize,glyph_indices,glyph_advances,glyph_offsets,glyph_count,is_sideways,is_rtl,geometrysink); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetGdiCompatibleGlyphMetrics(IDWriteFontFace5* This,FLOAT emSize,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,WINBOOL use_gdi_natural,const UINT16 *glyph_indices,UINT32 glyph_count,DWRITE_GLYPH_METRICS *metrics,WINBOOL is_sideways) { - return This->lpVtbl->GetGdiCompatibleGlyphMetrics(This,emSize,pixels_per_dip,transform,use_gdi_natural,glyph_indices,glyph_count,metrics,is_sideways); -} -/*** IDWriteFontFace1 methods ***/ -static FORCEINLINE void IDWriteFontFace5_GetMetrics(IDWriteFontFace5* This,DWRITE_FONT_METRICS1 *metrics) { - This->lpVtbl->IDWriteFontFace1_GetMetrics(This,metrics); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetGdiCompatibleMetrics(IDWriteFontFace5* This,FLOAT em_size,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,DWRITE_FONT_METRICS1 *metrics) { - return This->lpVtbl->IDWriteFontFace1_GetGdiCompatibleMetrics(This,em_size,pixels_per_dip,transform,metrics); -} -static FORCEINLINE void IDWriteFontFace5_GetCaretMetrics(IDWriteFontFace5* This,DWRITE_CARET_METRICS *metrics) { - This->lpVtbl->GetCaretMetrics(This,metrics); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetUnicodeRanges(IDWriteFontFace5* This,UINT32 max_count,DWRITE_UNICODE_RANGE *ranges,UINT32 *count) { - return This->lpVtbl->GetUnicodeRanges(This,max_count,ranges,count); -} -static FORCEINLINE WINBOOL IDWriteFontFace5_IsMonospacedFont(IDWriteFontFace5* This) { - return This->lpVtbl->IsMonospacedFont(This); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetDesignGlyphAdvances(IDWriteFontFace5* This,UINT32 glyph_count,const UINT16 *indices,INT32 *advances,WINBOOL is_sideways) { - return This->lpVtbl->GetDesignGlyphAdvances(This,glyph_count,indices,advances,is_sideways); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetGdiCompatibleGlyphAdvances(IDWriteFontFace5* This,FLOAT em_size,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,WINBOOL use_gdi_natural,WINBOOL is_sideways,UINT32 glyph_count,const UINT16 *indices,INT32 *advances) { - return This->lpVtbl->GetGdiCompatibleGlyphAdvances(This,em_size,pixels_per_dip,transform,use_gdi_natural,is_sideways,glyph_count,indices,advances); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetKerningPairAdjustments(IDWriteFontFace5* This,UINT32 glyph_count,const UINT16 *indices,INT32 *adjustments) { - return This->lpVtbl->GetKerningPairAdjustments(This,glyph_count,indices,adjustments); -} -static FORCEINLINE WINBOOL IDWriteFontFace5_HasKerningPairs(IDWriteFontFace5* This) { - return This->lpVtbl->HasKerningPairs(This); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetVerticalGlyphVariants(IDWriteFontFace5* This,UINT32 glyph_count,const UINT16 *nominal_indices,UINT16 *vertical_indices) { - return This->lpVtbl->GetVerticalGlyphVariants(This,glyph_count,nominal_indices,vertical_indices); -} -static FORCEINLINE WINBOOL IDWriteFontFace5_HasVerticalGlyphVariants(IDWriteFontFace5* This) { - return This->lpVtbl->HasVerticalGlyphVariants(This); -} -/*** IDWriteFontFace2 methods ***/ -static FORCEINLINE WINBOOL IDWriteFontFace5_IsColorFont(IDWriteFontFace5* This) { - return This->lpVtbl->IsColorFont(This); -} -static FORCEINLINE UINT32 IDWriteFontFace5_GetColorPaletteCount(IDWriteFontFace5* This) { - return This->lpVtbl->GetColorPaletteCount(This); -} -static FORCEINLINE UINT32 IDWriteFontFace5_GetPaletteEntryCount(IDWriteFontFace5* This) { - return This->lpVtbl->GetPaletteEntryCount(This); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetPaletteEntries(IDWriteFontFace5* This,UINT32 palette_index,UINT32 first_entry_index,UINT32 entry_count,DWRITE_COLOR_F *entries) { - return This->lpVtbl->GetPaletteEntries(This,palette_index,first_entry_index,entry_count,entries); -} -/*** IDWriteFontFace3 methods ***/ -static FORCEINLINE HRESULT IDWriteFontFace5_GetFontFaceReference(IDWriteFontFace5* This,IDWriteFontFaceReference **reference) { - return This->lpVtbl->GetFontFaceReference(This,reference); -} -static FORCEINLINE void IDWriteFontFace5_GetPanose(IDWriteFontFace5* This,DWRITE_PANOSE *panose) { - This->lpVtbl->GetPanose(This,panose); -} -static FORCEINLINE DWRITE_FONT_WEIGHT IDWriteFontFace5_GetWeight(IDWriteFontFace5* This) { - return This->lpVtbl->GetWeight(This); -} -static FORCEINLINE DWRITE_FONT_STRETCH IDWriteFontFace5_GetStretch(IDWriteFontFace5* This) { - return This->lpVtbl->GetStretch(This); -} -static FORCEINLINE DWRITE_FONT_STYLE IDWriteFontFace5_GetStyle(IDWriteFontFace5* This) { - return This->lpVtbl->GetStyle(This); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetFamilyNames(IDWriteFontFace5* This,IDWriteLocalizedStrings **names) { - return This->lpVtbl->GetFamilyNames(This,names); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetFaceNames(IDWriteFontFace5* This,IDWriteLocalizedStrings **names) { - return This->lpVtbl->GetFaceNames(This,names); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetInformationalStrings(IDWriteFontFace5* This,DWRITE_INFORMATIONAL_STRING_ID stringid,IDWriteLocalizedStrings **strings,WINBOOL *exists) { - return This->lpVtbl->GetInformationalStrings(This,stringid,strings,exists); -} -static FORCEINLINE WINBOOL IDWriteFontFace5_HasCharacter(IDWriteFontFace5* This,UINT32 character) { - return This->lpVtbl->HasCharacter(This,character); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetRecommendedRenderingMode(IDWriteFontFace5* This,FLOAT emsize,FLOAT dpi_x,FLOAT dpi_y,const DWRITE_MATRIX *transform,WINBOOL is_sideways,DWRITE_OUTLINE_THRESHOLD threshold,DWRITE_MEASURING_MODE measuring_mode,IDWriteRenderingParams *params,DWRITE_RENDERING_MODE1 *rendering_mode,DWRITE_GRID_FIT_MODE *gridfit_mode) { - return This->lpVtbl->IDWriteFontFace3_GetRecommendedRenderingMode(This,emsize,dpi_x,dpi_y,transform,is_sideways,threshold,measuring_mode,params,rendering_mode,gridfit_mode); -} -static FORCEINLINE WINBOOL IDWriteFontFace5_IsCharacterLocal(IDWriteFontFace5* This,UINT32 character) { - return This->lpVtbl->IsCharacterLocal(This,character); -} -static FORCEINLINE WINBOOL IDWriteFontFace5_IsGlyphLocal(IDWriteFontFace5* This,UINT16 glyph) { - return This->lpVtbl->IsGlyphLocal(This,glyph); -} -static FORCEINLINE HRESULT IDWriteFontFace5_AreCharactersLocal(IDWriteFontFace5* This,const WCHAR *characters,UINT32 count,WINBOOL enqueue_if_not,WINBOOL *are_local) { - return This->lpVtbl->AreCharactersLocal(This,characters,count,enqueue_if_not,are_local); -} -static FORCEINLINE HRESULT IDWriteFontFace5_AreGlyphsLocal(IDWriteFontFace5* This,const UINT16 *glyphs,UINT32 count,WINBOOL enqueue_if_not,WINBOOL *are_local) { - return This->lpVtbl->AreGlyphsLocal(This,glyphs,count,enqueue_if_not,are_local); -} -/*** IDWriteFontFace4 methods ***/ -static FORCEINLINE HRESULT IDWriteFontFace5_GetGlyphImageFormats_(IDWriteFontFace5* This,UINT16 glyph,UINT32 ppem_first,UINT32 ppem_last,DWRITE_GLYPH_IMAGE_FORMATS *formats) { - return This->lpVtbl->GetGlyphImageFormats_(This,glyph,ppem_first,ppem_last,formats); -} -static FORCEINLINE DWRITE_GLYPH_IMAGE_FORMATS IDWriteFontFace5_GetGlyphImageFormats(IDWriteFontFace5* This) { - return This->lpVtbl->GetGlyphImageFormats(This); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetGlyphImageData(IDWriteFontFace5* This,UINT16 glyph,UINT32 ppem,DWRITE_GLYPH_IMAGE_FORMATS format,DWRITE_GLYPH_IMAGE_DATA *data,void **context) { - return This->lpVtbl->GetGlyphImageData(This,glyph,ppem,format,data,context); -} -static FORCEINLINE void IDWriteFontFace5_ReleaseGlyphImageData(IDWriteFontFace5* This,void *context) { - This->lpVtbl->ReleaseGlyphImageData(This,context); -} -/*** IDWriteFontFace5 methods ***/ -static FORCEINLINE UINT32 IDWriteFontFace5_GetFontAxisValueCount(IDWriteFontFace5* This) { - return This->lpVtbl->GetFontAxisValueCount(This); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetFontAxisValues(IDWriteFontFace5* This,DWRITE_FONT_AXIS_VALUE *values,UINT32 value_count) { - return This->lpVtbl->GetFontAxisValues(This,values,value_count); -} -static FORCEINLINE WINBOOL IDWriteFontFace5_HasVariations(IDWriteFontFace5* This) { - return This->lpVtbl->HasVariations(This); -} -static FORCEINLINE HRESULT IDWriteFontFace5_GetFontResource(IDWriteFontFace5* This,IDWriteFontResource **resource) { - return This->lpVtbl->GetFontResource(This,resource); -} -static FORCEINLINE WINBOOL IDWriteFontFace5_Equals(IDWriteFontFace5* This,IDWriteFontFace *fontface) { - return This->lpVtbl->Equals(This,fontface); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFontFace5_INTERFACE_DEFINED__ */ - -typedef struct DWRITE_COLOR_GLYPH_RUN1 { - DWRITE_GLYPH_RUN glyphRun; - DWRITE_GLYPH_RUN_DESCRIPTION *glyphRunDescription; - FLOAT baselineOriginX; - FLOAT baselineOriginY; - DWRITE_COLOR_F runColor; - UINT16 paletteIndex; - DWRITE_GLYPH_IMAGE_FORMATS glyphImageFormat; - DWRITE_MEASURING_MODE measuringMode; -} DWRITE_COLOR_GLYPH_RUN1; -/***************************************************************************** - * IDWriteColorGlyphRunEnumerator1 interface - */ -#ifndef __IDWriteColorGlyphRunEnumerator1_INTERFACE_DEFINED__ -#define __IDWriteColorGlyphRunEnumerator1_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteColorGlyphRunEnumerator1, 0x7c5f86da, 0xc7a1, 0x4f05, 0xb8,0xe1, 0x55,0xa1,0x79,0xfe,0x5a,0x35); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("7c5f86da-c7a1-4f05-b8e1-55a179fe5a35") -IDWriteColorGlyphRunEnumerator1 : public IDWriteColorGlyphRunEnumerator -{ - virtual HRESULT STDMETHODCALLTYPE GetCurrentRun( - const DWRITE_COLOR_GLYPH_RUN1 **run) = 0; - - using IDWriteColorGlyphRunEnumerator::GetCurrentRun; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteColorGlyphRunEnumerator1, 0x7c5f86da, 0xc7a1, 0x4f05, 0xb8,0xe1, 0x55,0xa1,0x79,0xfe,0x5a,0x35) -#endif -#else -typedef struct IDWriteColorGlyphRunEnumerator1Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteColorGlyphRunEnumerator1 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteColorGlyphRunEnumerator1 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteColorGlyphRunEnumerator1 *This); - - /*** IDWriteColorGlyphRunEnumerator methods ***/ - HRESULT (STDMETHODCALLTYPE *MoveNext)( - IDWriteColorGlyphRunEnumerator1 *This, - WINBOOL *hasRun); - - HRESULT (STDMETHODCALLTYPE *GetCurrentRun)( - IDWriteColorGlyphRunEnumerator1 *This, - const DWRITE_COLOR_GLYPH_RUN **run); - - /*** IDWriteColorGlyphRunEnumerator1 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteColorGlyphRunEnumerator1_GetCurrentRun)( - IDWriteColorGlyphRunEnumerator1 *This, - const DWRITE_COLOR_GLYPH_RUN1 **run); - - END_INTERFACE -} IDWriteColorGlyphRunEnumerator1Vtbl; - -interface IDWriteColorGlyphRunEnumerator1 { - CONST_VTBL IDWriteColorGlyphRunEnumerator1Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteColorGlyphRunEnumerator1_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteColorGlyphRunEnumerator1_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteColorGlyphRunEnumerator1_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteColorGlyphRunEnumerator methods ***/ -#define IDWriteColorGlyphRunEnumerator1_MoveNext(This,hasRun) (This)->lpVtbl->MoveNext(This,hasRun) -/*** IDWriteColorGlyphRunEnumerator1 methods ***/ -#define IDWriteColorGlyphRunEnumerator1_GetCurrentRun(This,run) (This)->lpVtbl->IDWriteColorGlyphRunEnumerator1_GetCurrentRun(This,run) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteColorGlyphRunEnumerator1_QueryInterface(IDWriteColorGlyphRunEnumerator1* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteColorGlyphRunEnumerator1_AddRef(IDWriteColorGlyphRunEnumerator1* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteColorGlyphRunEnumerator1_Release(IDWriteColorGlyphRunEnumerator1* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteColorGlyphRunEnumerator methods ***/ -static FORCEINLINE HRESULT IDWriteColorGlyphRunEnumerator1_MoveNext(IDWriteColorGlyphRunEnumerator1* This,WINBOOL *hasRun) { - return This->lpVtbl->MoveNext(This,hasRun); -} -/*** IDWriteColorGlyphRunEnumerator1 methods ***/ -static FORCEINLINE HRESULT IDWriteColorGlyphRunEnumerator1_GetCurrentRun(IDWriteColorGlyphRunEnumerator1* This,const DWRITE_COLOR_GLYPH_RUN1 **run) { - return This->lpVtbl->IDWriteColorGlyphRunEnumerator1_GetCurrentRun(This,run); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteColorGlyphRunEnumerator1_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFactory4 interface - */ -#ifndef __IDWriteFactory4_INTERFACE_DEFINED__ -#define __IDWriteFactory4_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFactory4, 0x4b0b5bd3, 0x0797, 0x4549, 0x8a,0xc5, 0xfe,0x91,0x5c,0xc5,0x38,0x56); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("4b0b5bd3-0797-4549-8ac5-fe915cc53856") -IDWriteFactory4 : public IDWriteFactory3 -{ - virtual HRESULT STDMETHODCALLTYPE TranslateColorGlyphRun( - D2D1_POINT_2F baseline_origin, - const DWRITE_GLYPH_RUN *run, - const DWRITE_GLYPH_RUN_DESCRIPTION *run_desc, - DWRITE_GLYPH_IMAGE_FORMATS desired_formats, - DWRITE_MEASURING_MODE measuring_mode, - const DWRITE_MATRIX *transform, - UINT32 palette, - IDWriteColorGlyphRunEnumerator1 **layers) = 0; - - using IDWriteFactory2::TranslateColorGlyphRun; - - virtual HRESULT STDMETHODCALLTYPE ComputeGlyphOrigins( - const DWRITE_GLYPH_RUN *run, - D2D1_POINT_2F baseline_origin, - D2D1_POINT_2F *origins) = 0; - - virtual HRESULT STDMETHODCALLTYPE ComputeGlyphOrigins( - const DWRITE_GLYPH_RUN *run, - DWRITE_MEASURING_MODE measuring_mode, - D2D1_POINT_2F baseline_origin, - const DWRITE_MATRIX *transform, - D2D1_POINT_2F *origins) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFactory4, 0x4b0b5bd3, 0x0797, 0x4549, 0x8a,0xc5, 0xfe,0x91,0x5c,0xc5,0x38,0x56) -#endif -#else -typedef struct IDWriteFactory4Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFactory4 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFactory4 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFactory4 *This); - - /*** IDWriteFactory methods ***/ - HRESULT (STDMETHODCALLTYPE *GetSystemFontCollection)( - IDWriteFactory4 *This, - IDWriteFontCollection **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *CreateCustomFontCollection)( - IDWriteFactory4 *This, - IDWriteFontCollectionLoader *loader, - const void *key, - UINT32 key_size, - IDWriteFontCollection **collection); - - HRESULT (STDMETHODCALLTYPE *RegisterFontCollectionLoader)( - IDWriteFactory4 *This, - IDWriteFontCollectionLoader *loader); - - HRESULT (STDMETHODCALLTYPE *UnregisterFontCollectionLoader)( - IDWriteFactory4 *This, - IDWriteFontCollectionLoader *loader); - - HRESULT (STDMETHODCALLTYPE *CreateFontFileReference)( - IDWriteFactory4 *This, - const WCHAR *path, - const FILETIME *writetime, - IDWriteFontFile **font_file); - - HRESULT (STDMETHODCALLTYPE *CreateCustomFontFileReference)( - IDWriteFactory4 *This, - const void *reference_key, - UINT32 key_size, - IDWriteFontFileLoader *loader, - IDWriteFontFile **font_file); - - HRESULT (STDMETHODCALLTYPE *CreateFontFace)( - IDWriteFactory4 *This, - DWRITE_FONT_FACE_TYPE facetype, - UINT32 files_number, - IDWriteFontFile *const *font_files, - UINT32 index, - DWRITE_FONT_SIMULATIONS sim_flags, - IDWriteFontFace **font_face); - - HRESULT (STDMETHODCALLTYPE *CreateRenderingParams)( - IDWriteFactory4 *This, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *CreateMonitorRenderingParams)( - IDWriteFactory4 *This, - HMONITOR monitor, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *CreateCustomRenderingParams)( - IDWriteFactory4 *This, - FLOAT gamma, - FLOAT enhancedContrast, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY geometry, - DWRITE_RENDERING_MODE mode, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *RegisterFontFileLoader)( - IDWriteFactory4 *This, - IDWriteFontFileLoader *loader); - - HRESULT (STDMETHODCALLTYPE *UnregisterFontFileLoader)( - IDWriteFactory4 *This, - IDWriteFontFileLoader *loader); - - HRESULT (STDMETHODCALLTYPE *CreateTextFormat)( - IDWriteFactory4 *This, - const WCHAR *family_name, - IDWriteFontCollection *collection, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STYLE style, - DWRITE_FONT_STRETCH stretch, - FLOAT size, - const WCHAR *locale, - IDWriteTextFormat **format); - - HRESULT (STDMETHODCALLTYPE *CreateTypography)( - IDWriteFactory4 *This, - IDWriteTypography **typography); - - HRESULT (STDMETHODCALLTYPE *GetGdiInterop)( - IDWriteFactory4 *This, - IDWriteGdiInterop **gdi_interop); - - HRESULT (STDMETHODCALLTYPE *CreateTextLayout)( - IDWriteFactory4 *This, - const WCHAR *string, - UINT32 len, - IDWriteTextFormat *format, - FLOAT max_width, - FLOAT max_height, - IDWriteTextLayout **layout); - - HRESULT (STDMETHODCALLTYPE *CreateGdiCompatibleTextLayout)( - IDWriteFactory4 *This, - const WCHAR *string, - UINT32 len, - IDWriteTextFormat *format, - FLOAT layout_width, - FLOAT layout_height, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - WINBOOL use_gdi_natural, - IDWriteTextLayout **layout); - - HRESULT (STDMETHODCALLTYPE *CreateEllipsisTrimmingSign)( - IDWriteFactory4 *This, - IDWriteTextFormat *format, - IDWriteInlineObject **trimming_sign); - - HRESULT (STDMETHODCALLTYPE *CreateTextAnalyzer)( - IDWriteFactory4 *This, - IDWriteTextAnalyzer **analyzer); - - HRESULT (STDMETHODCALLTYPE *CreateNumberSubstitution)( - IDWriteFactory4 *This, - DWRITE_NUMBER_SUBSTITUTION_METHOD method, - const WCHAR *locale, - WINBOOL ignore_user_override, - IDWriteNumberSubstitution **substitution); - - HRESULT (STDMETHODCALLTYPE *CreateGlyphRunAnalysis)( - IDWriteFactory4 *This, - const DWRITE_GLYPH_RUN *glyph_run, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE rendering_mode, - DWRITE_MEASURING_MODE measuring_mode, - FLOAT baseline_x, - FLOAT baseline_y, - IDWriteGlyphRunAnalysis **analysis); - - /*** IDWriteFactory1 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetEudcFontCollection)( - IDWriteFactory4 *This, - IDWriteFontCollection **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory1_CreateCustomRenderingParams)( - IDWriteFactory4 *This, - FLOAT gamma, - FLOAT enhcontrast, - FLOAT enhcontrast_grayscale, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY geometry, - DWRITE_RENDERING_MODE mode, - IDWriteRenderingParams1 **params); - - /*** IDWriteFactory2 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetSystemFontFallback)( - IDWriteFactory4 *This, - IDWriteFontFallback **fallback); - - HRESULT (STDMETHODCALLTYPE *CreateFontFallbackBuilder)( - IDWriteFactory4 *This, - IDWriteFontFallbackBuilder **fallbackbuilder); - - HRESULT (STDMETHODCALLTYPE *TranslateColorGlyphRun)( - IDWriteFactory4 *This, - FLOAT originX, - FLOAT originY, - const DWRITE_GLYPH_RUN *run, - const DWRITE_GLYPH_RUN_DESCRIPTION *rundescr, - DWRITE_MEASURING_MODE mode, - const DWRITE_MATRIX *transform, - UINT32 palette_index, - IDWriteColorGlyphRunEnumerator **colorlayers); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory2_CreateCustomRenderingParams)( - IDWriteFactory4 *This, - FLOAT gamma, - FLOAT contrast, - FLOAT grayscalecontrast, - FLOAT cleartypeLevel, - DWRITE_PIXEL_GEOMETRY pixelGeometry, - DWRITE_RENDERING_MODE renderingMode, - DWRITE_GRID_FIT_MODE gridFitMode, - IDWriteRenderingParams2 **params); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory2_CreateGlyphRunAnalysis)( - IDWriteFactory4 *This, - const DWRITE_GLYPH_RUN *run, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE renderingMode, - DWRITE_MEASURING_MODE measuringMode, - DWRITE_GRID_FIT_MODE gridFitMode, - DWRITE_TEXT_ANTIALIAS_MODE antialiasMode, - FLOAT originX, - FLOAT originY, - IDWriteGlyphRunAnalysis **analysis); - - /*** IDWriteFactory3 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_CreateGlyphRunAnalysis)( - IDWriteFactory4 *This, - const DWRITE_GLYPH_RUN *run, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE1 rendering_mode, - DWRITE_MEASURING_MODE measuring_mode, - DWRITE_GRID_FIT_MODE gridfit_mode, - DWRITE_TEXT_ANTIALIAS_MODE antialias_mode, - FLOAT origin_x, - FLOAT origin_y, - IDWriteGlyphRunAnalysis **analysis); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_CreateCustomRenderingParams)( - IDWriteFactory4 *This, - FLOAT gamma, - FLOAT enhanced_contrast, - FLOAT grayscale_enhanced_contrast, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY pixel_geometry, - DWRITE_RENDERING_MODE1 rendering_mode, - DWRITE_GRID_FIT_MODE gridfit_mode, - IDWriteRenderingParams3 **params); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceReference_)( - IDWriteFactory4 *This, - IDWriteFontFile *file, - UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceReference)( - IDWriteFactory4 *This, - const WCHAR *path, - const FILETIME *writetime, - UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *GetSystemFontSet)( - IDWriteFactory4 *This, - IDWriteFontSet **fontset); - - HRESULT (STDMETHODCALLTYPE *CreateFontSetBuilder)( - IDWriteFactory4 *This, - IDWriteFontSetBuilder **builder); - - HRESULT (STDMETHODCALLTYPE *CreateFontCollectionFromFontSet)( - IDWriteFactory4 *This, - IDWriteFontSet *fontset, - IDWriteFontCollection1 **collection); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_GetSystemFontCollection)( - IDWriteFactory4 *This, - WINBOOL include_downloadable, - IDWriteFontCollection1 **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *GetFontDownloadQueue)( - IDWriteFactory4 *This, - IDWriteFontDownloadQueue **queue); - - /*** IDWriteFactory4 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory4_TranslateColorGlyphRun)( - IDWriteFactory4 *This, - D2D1_POINT_2F baseline_origin, - const DWRITE_GLYPH_RUN *run, - const DWRITE_GLYPH_RUN_DESCRIPTION *run_desc, - DWRITE_GLYPH_IMAGE_FORMATS desired_formats, - DWRITE_MEASURING_MODE measuring_mode, - const DWRITE_MATRIX *transform, - UINT32 palette, - IDWriteColorGlyphRunEnumerator1 **layers); - - HRESULT (STDMETHODCALLTYPE *ComputeGlyphOrigins_)( - IDWriteFactory4 *This, - const DWRITE_GLYPH_RUN *run, - D2D1_POINT_2F baseline_origin, - D2D1_POINT_2F *origins); - - HRESULT (STDMETHODCALLTYPE *ComputeGlyphOrigins)( - IDWriteFactory4 *This, - const DWRITE_GLYPH_RUN *run, - DWRITE_MEASURING_MODE measuring_mode, - D2D1_POINT_2F baseline_origin, - const DWRITE_MATRIX *transform, - D2D1_POINT_2F *origins); - - END_INTERFACE -} IDWriteFactory4Vtbl; - -interface IDWriteFactory4 { - CONST_VTBL IDWriteFactory4Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFactory4_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFactory4_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFactory4_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFactory methods ***/ -#define IDWriteFactory4_CreateCustomFontCollection(This,loader,key,key_size,collection) (This)->lpVtbl->CreateCustomFontCollection(This,loader,key,key_size,collection) -#define IDWriteFactory4_RegisterFontCollectionLoader(This,loader) (This)->lpVtbl->RegisterFontCollectionLoader(This,loader) -#define IDWriteFactory4_UnregisterFontCollectionLoader(This,loader) (This)->lpVtbl->UnregisterFontCollectionLoader(This,loader) -#define IDWriteFactory4_CreateFontFileReference(This,path,writetime,font_file) (This)->lpVtbl->CreateFontFileReference(This,path,writetime,font_file) -#define IDWriteFactory4_CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file) (This)->lpVtbl->CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file) -#define IDWriteFactory4_CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face) (This)->lpVtbl->CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face) -#define IDWriteFactory4_CreateRenderingParams(This,params) (This)->lpVtbl->CreateRenderingParams(This,params) -#define IDWriteFactory4_CreateMonitorRenderingParams(This,monitor,params) (This)->lpVtbl->CreateMonitorRenderingParams(This,monitor,params) -#define IDWriteFactory4_RegisterFontFileLoader(This,loader) (This)->lpVtbl->RegisterFontFileLoader(This,loader) -#define IDWriteFactory4_UnregisterFontFileLoader(This,loader) (This)->lpVtbl->UnregisterFontFileLoader(This,loader) -#define IDWriteFactory4_CreateTextFormat(This,family_name,collection,weight,style,stretch,size,locale,format) (This)->lpVtbl->CreateTextFormat(This,family_name,collection,weight,style,stretch,size,locale,format) -#define IDWriteFactory4_CreateTypography(This,typography) (This)->lpVtbl->CreateTypography(This,typography) -#define IDWriteFactory4_GetGdiInterop(This,gdi_interop) (This)->lpVtbl->GetGdiInterop(This,gdi_interop) -#define IDWriteFactory4_CreateTextLayout(This,string,len,format,max_width,max_height,layout) (This)->lpVtbl->CreateTextLayout(This,string,len,format,max_width,max_height,layout) -#define IDWriteFactory4_CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout) (This)->lpVtbl->CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout) -#define IDWriteFactory4_CreateEllipsisTrimmingSign(This,format,trimming_sign) (This)->lpVtbl->CreateEllipsisTrimmingSign(This,format,trimming_sign) -#define IDWriteFactory4_CreateTextAnalyzer(This,analyzer) (This)->lpVtbl->CreateTextAnalyzer(This,analyzer) -#define IDWriteFactory4_CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution) (This)->lpVtbl->CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution) -/*** IDWriteFactory1 methods ***/ -#define IDWriteFactory4_GetEudcFontCollection(This,collection,check_for_updates) (This)->lpVtbl->GetEudcFontCollection(This,collection,check_for_updates) -/*** IDWriteFactory2 methods ***/ -#define IDWriteFactory4_GetSystemFontFallback(This,fallback) (This)->lpVtbl->GetSystemFontFallback(This,fallback) -#define IDWriteFactory4_CreateFontFallbackBuilder(This,fallbackbuilder) (This)->lpVtbl->CreateFontFallbackBuilder(This,fallbackbuilder) -/*** IDWriteFactory3 methods ***/ -#define IDWriteFactory4_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis) (This)->lpVtbl->IDWriteFactory3_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis) -#define IDWriteFactory4_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params) (This)->lpVtbl->IDWriteFactory3_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params) -#define IDWriteFactory4_CreateFontFaceReference_(This,file,index,simulations,reference) (This)->lpVtbl->CreateFontFaceReference_(This,file,index,simulations,reference) -#define IDWriteFactory4_CreateFontFaceReference(This,path,writetime,index,simulations,reference) (This)->lpVtbl->CreateFontFaceReference(This,path,writetime,index,simulations,reference) -#define IDWriteFactory4_GetSystemFontSet(This,fontset) (This)->lpVtbl->GetSystemFontSet(This,fontset) -#define IDWriteFactory4_CreateFontSetBuilder(This,builder) (This)->lpVtbl->CreateFontSetBuilder(This,builder) -#define IDWriteFactory4_CreateFontCollectionFromFontSet(This,fontset,collection) (This)->lpVtbl->CreateFontCollectionFromFontSet(This,fontset,collection) -#define IDWriteFactory4_GetSystemFontCollection(This,include_downloadable,collection,check_for_updates) (This)->lpVtbl->IDWriteFactory3_GetSystemFontCollection(This,include_downloadable,collection,check_for_updates) -#define IDWriteFactory4_GetFontDownloadQueue(This,queue) (This)->lpVtbl->GetFontDownloadQueue(This,queue) -/*** IDWriteFactory4 methods ***/ -#define IDWriteFactory4_TranslateColorGlyphRun(This,baseline_origin,run,run_desc,desired_formats,measuring_mode,transform,palette,layers) (This)->lpVtbl->IDWriteFactory4_TranslateColorGlyphRun(This,baseline_origin,run,run_desc,desired_formats,measuring_mode,transform,palette,layers) -#define IDWriteFactory4_ComputeGlyphOrigins_(This,run,baseline_origin,origins) (This)->lpVtbl->ComputeGlyphOrigins_(This,run,baseline_origin,origins) -#define IDWriteFactory4_ComputeGlyphOrigins(This,run,measuring_mode,baseline_origin,transform,origins) (This)->lpVtbl->ComputeGlyphOrigins(This,run,measuring_mode,baseline_origin,transform,origins) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFactory4_QueryInterface(IDWriteFactory4* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFactory4_AddRef(IDWriteFactory4* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFactory4_Release(IDWriteFactory4* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFactory methods ***/ -static FORCEINLINE HRESULT IDWriteFactory4_CreateCustomFontCollection(IDWriteFactory4* This,IDWriteFontCollectionLoader *loader,const void *key,UINT32 key_size,IDWriteFontCollection **collection) { - return This->lpVtbl->CreateCustomFontCollection(This,loader,key,key_size,collection); -} -static FORCEINLINE HRESULT IDWriteFactory4_RegisterFontCollectionLoader(IDWriteFactory4* This,IDWriteFontCollectionLoader *loader) { - return This->lpVtbl->RegisterFontCollectionLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory4_UnregisterFontCollectionLoader(IDWriteFactory4* This,IDWriteFontCollectionLoader *loader) { - return This->lpVtbl->UnregisterFontCollectionLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateFontFileReference(IDWriteFactory4* This,const WCHAR *path,const FILETIME *writetime,IDWriteFontFile **font_file) { - return This->lpVtbl->CreateFontFileReference(This,path,writetime,font_file); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateCustomFontFileReference(IDWriteFactory4* This,const void *reference_key,UINT32 key_size,IDWriteFontFileLoader *loader,IDWriteFontFile **font_file) { - return This->lpVtbl->CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateFontFace(IDWriteFactory4* This,DWRITE_FONT_FACE_TYPE facetype,UINT32 files_number,IDWriteFontFile *const *font_files,UINT32 index,DWRITE_FONT_SIMULATIONS sim_flags,IDWriteFontFace **font_face) { - return This->lpVtbl->CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateRenderingParams(IDWriteFactory4* This,IDWriteRenderingParams **params) { - return This->lpVtbl->CreateRenderingParams(This,params); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateMonitorRenderingParams(IDWriteFactory4* This,HMONITOR monitor,IDWriteRenderingParams **params) { - return This->lpVtbl->CreateMonitorRenderingParams(This,monitor,params); -} -static FORCEINLINE HRESULT IDWriteFactory4_RegisterFontFileLoader(IDWriteFactory4* This,IDWriteFontFileLoader *loader) { - return This->lpVtbl->RegisterFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory4_UnregisterFontFileLoader(IDWriteFactory4* This,IDWriteFontFileLoader *loader) { - return This->lpVtbl->UnregisterFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateTextFormat(IDWriteFactory4* This,const WCHAR *family_name,IDWriteFontCollection *collection,DWRITE_FONT_WEIGHT weight,DWRITE_FONT_STYLE style,DWRITE_FONT_STRETCH stretch,FLOAT size,const WCHAR *locale,IDWriteTextFormat **format) { - return This->lpVtbl->CreateTextFormat(This,family_name,collection,weight,style,stretch,size,locale,format); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateTypography(IDWriteFactory4* This,IDWriteTypography **typography) { - return This->lpVtbl->CreateTypography(This,typography); -} -static FORCEINLINE HRESULT IDWriteFactory4_GetGdiInterop(IDWriteFactory4* This,IDWriteGdiInterop **gdi_interop) { - return This->lpVtbl->GetGdiInterop(This,gdi_interop); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateTextLayout(IDWriteFactory4* This,const WCHAR *string,UINT32 len,IDWriteTextFormat *format,FLOAT max_width,FLOAT max_height,IDWriteTextLayout **layout) { - return This->lpVtbl->CreateTextLayout(This,string,len,format,max_width,max_height,layout); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateGdiCompatibleTextLayout(IDWriteFactory4* This,const WCHAR *string,UINT32 len,IDWriteTextFormat *format,FLOAT layout_width,FLOAT layout_height,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,WINBOOL use_gdi_natural,IDWriteTextLayout **layout) { - return This->lpVtbl->CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateEllipsisTrimmingSign(IDWriteFactory4* This,IDWriteTextFormat *format,IDWriteInlineObject **trimming_sign) { - return This->lpVtbl->CreateEllipsisTrimmingSign(This,format,trimming_sign); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateTextAnalyzer(IDWriteFactory4* This,IDWriteTextAnalyzer **analyzer) { - return This->lpVtbl->CreateTextAnalyzer(This,analyzer); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateNumberSubstitution(IDWriteFactory4* This,DWRITE_NUMBER_SUBSTITUTION_METHOD method,const WCHAR *locale,WINBOOL ignore_user_override,IDWriteNumberSubstitution **substitution) { - return This->lpVtbl->CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution); -} -/*** IDWriteFactory1 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory4_GetEudcFontCollection(IDWriteFactory4* This,IDWriteFontCollection **collection,WINBOOL check_for_updates) { - return This->lpVtbl->GetEudcFontCollection(This,collection,check_for_updates); -} -/*** IDWriteFactory2 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory4_GetSystemFontFallback(IDWriteFactory4* This,IDWriteFontFallback **fallback) { - return This->lpVtbl->GetSystemFontFallback(This,fallback); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateFontFallbackBuilder(IDWriteFactory4* This,IDWriteFontFallbackBuilder **fallbackbuilder) { - return This->lpVtbl->CreateFontFallbackBuilder(This,fallbackbuilder); -} -/*** IDWriteFactory3 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory4_CreateGlyphRunAnalysis(IDWriteFactory4* This,const DWRITE_GLYPH_RUN *run,const DWRITE_MATRIX *transform,DWRITE_RENDERING_MODE1 rendering_mode,DWRITE_MEASURING_MODE measuring_mode,DWRITE_GRID_FIT_MODE gridfit_mode,DWRITE_TEXT_ANTIALIAS_MODE antialias_mode,FLOAT origin_x,FLOAT origin_y,IDWriteGlyphRunAnalysis **analysis) { - return This->lpVtbl->IDWriteFactory3_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateCustomRenderingParams(IDWriteFactory4* This,FLOAT gamma,FLOAT enhanced_contrast,FLOAT grayscale_enhanced_contrast,FLOAT cleartype_level,DWRITE_PIXEL_GEOMETRY pixel_geometry,DWRITE_RENDERING_MODE1 rendering_mode,DWRITE_GRID_FIT_MODE gridfit_mode,IDWriteRenderingParams3 **params) { - return This->lpVtbl->IDWriteFactory3_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateFontFaceReference_(IDWriteFactory4* This,IDWriteFontFile *file,UINT32 index,DWRITE_FONT_SIMULATIONS simulations,IDWriteFontFaceReference **reference) { - return This->lpVtbl->CreateFontFaceReference_(This,file,index,simulations,reference); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateFontFaceReference(IDWriteFactory4* This,const WCHAR *path,const FILETIME *writetime,UINT32 index,DWRITE_FONT_SIMULATIONS simulations,IDWriteFontFaceReference **reference) { - return This->lpVtbl->CreateFontFaceReference(This,path,writetime,index,simulations,reference); -} -static FORCEINLINE HRESULT IDWriteFactory4_GetSystemFontSet(IDWriteFactory4* This,IDWriteFontSet **fontset) { - return This->lpVtbl->GetSystemFontSet(This,fontset); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateFontSetBuilder(IDWriteFactory4* This,IDWriteFontSetBuilder **builder) { - return This->lpVtbl->CreateFontSetBuilder(This,builder); -} -static FORCEINLINE HRESULT IDWriteFactory4_CreateFontCollectionFromFontSet(IDWriteFactory4* This,IDWriteFontSet *fontset,IDWriteFontCollection1 **collection) { - return This->lpVtbl->CreateFontCollectionFromFontSet(This,fontset,collection); -} -static FORCEINLINE HRESULT IDWriteFactory4_GetSystemFontCollection(IDWriteFactory4* This,WINBOOL include_downloadable,IDWriteFontCollection1 **collection,WINBOOL check_for_updates) { - return This->lpVtbl->IDWriteFactory3_GetSystemFontCollection(This,include_downloadable,collection,check_for_updates); -} -static FORCEINLINE HRESULT IDWriteFactory4_GetFontDownloadQueue(IDWriteFactory4* This,IDWriteFontDownloadQueue **queue) { - return This->lpVtbl->GetFontDownloadQueue(This,queue); -} -/*** IDWriteFactory4 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory4_TranslateColorGlyphRun(IDWriteFactory4* This,D2D1_POINT_2F baseline_origin,const DWRITE_GLYPH_RUN *run,const DWRITE_GLYPH_RUN_DESCRIPTION *run_desc,DWRITE_GLYPH_IMAGE_FORMATS desired_formats,DWRITE_MEASURING_MODE measuring_mode,const DWRITE_MATRIX *transform,UINT32 palette,IDWriteColorGlyphRunEnumerator1 **layers) { - return This->lpVtbl->IDWriteFactory4_TranslateColorGlyphRun(This,baseline_origin,run,run_desc,desired_formats,measuring_mode,transform,palette,layers); -} -static FORCEINLINE HRESULT IDWriteFactory4_ComputeGlyphOrigins_(IDWriteFactory4* This,const DWRITE_GLYPH_RUN *run,D2D1_POINT_2F baseline_origin,D2D1_POINT_2F *origins) { - return This->lpVtbl->ComputeGlyphOrigins_(This,run,baseline_origin,origins); -} -static FORCEINLINE HRESULT IDWriteFactory4_ComputeGlyphOrigins(IDWriteFactory4* This,const DWRITE_GLYPH_RUN *run,DWRITE_MEASURING_MODE measuring_mode,D2D1_POINT_2F baseline_origin,const DWRITE_MATRIX *transform,D2D1_POINT_2F *origins) { - return This->lpVtbl->ComputeGlyphOrigins(This,run,measuring_mode,baseline_origin,transform,origins); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFactory4_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteAsyncResult interface - */ -#ifndef __IDWriteAsyncResult_INTERFACE_DEFINED__ -#define __IDWriteAsyncResult_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteAsyncResult, 0xce25f8fd, 0x863b, 0x4d13, 0x96,0x51, 0xc1,0xf8,0x8d,0xc7,0x3f,0xe2); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("ce25f8fd-863b-4d13-9651-c1f88dc73fe2") -IDWriteAsyncResult : public IUnknown -{ - virtual HANDLE STDMETHODCALLTYPE GetWaitHandle( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetResult( - ) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteAsyncResult, 0xce25f8fd, 0x863b, 0x4d13, 0x96,0x51, 0xc1,0xf8,0x8d,0xc7,0x3f,0xe2) -#endif -#else -typedef struct IDWriteAsyncResultVtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteAsyncResult *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteAsyncResult *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteAsyncResult *This); - - /*** IDWriteAsyncResult methods ***/ - HANDLE (STDMETHODCALLTYPE *GetWaitHandle)( - IDWriteAsyncResult *This); - - HRESULT (STDMETHODCALLTYPE *GetResult)( - IDWriteAsyncResult *This); - - END_INTERFACE -} IDWriteAsyncResultVtbl; - -interface IDWriteAsyncResult { - CONST_VTBL IDWriteAsyncResultVtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteAsyncResult_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteAsyncResult_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteAsyncResult_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteAsyncResult methods ***/ -#define IDWriteAsyncResult_GetWaitHandle(This) (This)->lpVtbl->GetWaitHandle(This) -#define IDWriteAsyncResult_GetResult(This) (This)->lpVtbl->GetResult(This) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteAsyncResult_QueryInterface(IDWriteAsyncResult* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteAsyncResult_AddRef(IDWriteAsyncResult* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteAsyncResult_Release(IDWriteAsyncResult* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteAsyncResult methods ***/ -static FORCEINLINE HANDLE IDWriteAsyncResult_GetWaitHandle(IDWriteAsyncResult* This) { - return This->lpVtbl->GetWaitHandle(This); -} -static FORCEINLINE HRESULT IDWriteAsyncResult_GetResult(IDWriteAsyncResult* This) { - return This->lpVtbl->GetResult(This); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteAsyncResult_INTERFACE_DEFINED__ */ - -typedef struct DWRITE_FILE_FRAGMENT { - UINT64 fileOffset; - UINT64 fragmentSize; -} DWRITE_FILE_FRAGMENT; -/***************************************************************************** - * IDWriteRemoteFontFileStream interface - */ -#ifndef __IDWriteRemoteFontFileStream_INTERFACE_DEFINED__ -#define __IDWriteRemoteFontFileStream_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteRemoteFontFileStream, 0x4db3757a, 0x2c72, 0x4ed9, 0xb2,0xb6, 0x1a,0xba,0xbe,0x1a,0xff,0x9c); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("4db3757a-2c72-4ed9-b2b6-1ababe1aff9c") -IDWriteRemoteFontFileStream : public IDWriteFontFileStream -{ - virtual HRESULT STDMETHODCALLTYPE GetLocalFileSize( - UINT64 *size) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetFileFragmentLocality( - UINT64 offset, - UINT64 size, - WINBOOL *is_local, - UINT64 *partial_size) = 0; - - virtual DWRITE_LOCALITY STDMETHODCALLTYPE GetLocality( - ) = 0; - - virtual HRESULT STDMETHODCALLTYPE BeginDownload( - const GUID *operation_id, - const DWRITE_FILE_FRAGMENT *fragments, - UINT32 fragment_count, - IDWriteAsyncResult **async_result) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteRemoteFontFileStream, 0x4db3757a, 0x2c72, 0x4ed9, 0xb2,0xb6, 0x1a,0xba,0xbe,0x1a,0xff,0x9c) -#endif -#else -typedef struct IDWriteRemoteFontFileStreamVtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteRemoteFontFileStream *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteRemoteFontFileStream *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteRemoteFontFileStream *This); - - /*** IDWriteFontFileStream methods ***/ - HRESULT (STDMETHODCALLTYPE *ReadFileFragment)( - IDWriteRemoteFontFileStream *This, - const void **fragment_start, - UINT64 offset, - UINT64 fragment_size, - void **fragment_context); - - void (STDMETHODCALLTYPE *ReleaseFileFragment)( - IDWriteRemoteFontFileStream *This, - void *fragment_context); - - HRESULT (STDMETHODCALLTYPE *GetFileSize)( - IDWriteRemoteFontFileStream *This, - UINT64 *size); - - HRESULT (STDMETHODCALLTYPE *GetLastWriteTime)( - IDWriteRemoteFontFileStream *This, - UINT64 *last_writetime); - - /*** IDWriteRemoteFontFileStream methods ***/ - HRESULT (STDMETHODCALLTYPE *GetLocalFileSize)( - IDWriteRemoteFontFileStream *This, - UINT64 *size); - - HRESULT (STDMETHODCALLTYPE *GetFileFragmentLocality)( - IDWriteRemoteFontFileStream *This, - UINT64 offset, - UINT64 size, - WINBOOL *is_local, - UINT64 *partial_size); - - DWRITE_LOCALITY (STDMETHODCALLTYPE *GetLocality)( - IDWriteRemoteFontFileStream *This); - - HRESULT (STDMETHODCALLTYPE *BeginDownload)( - IDWriteRemoteFontFileStream *This, - const GUID *operation_id, - const DWRITE_FILE_FRAGMENT *fragments, - UINT32 fragment_count, - IDWriteAsyncResult **async_result); - - END_INTERFACE -} IDWriteRemoteFontFileStreamVtbl; - -interface IDWriteRemoteFontFileStream { - CONST_VTBL IDWriteRemoteFontFileStreamVtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteRemoteFontFileStream_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteRemoteFontFileStream_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteRemoteFontFileStream_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontFileStream methods ***/ -#define IDWriteRemoteFontFileStream_ReadFileFragment(This,fragment_start,offset,fragment_size,fragment_context) (This)->lpVtbl->ReadFileFragment(This,fragment_start,offset,fragment_size,fragment_context) -#define IDWriteRemoteFontFileStream_ReleaseFileFragment(This,fragment_context) (This)->lpVtbl->ReleaseFileFragment(This,fragment_context) -#define IDWriteRemoteFontFileStream_GetFileSize(This,size) (This)->lpVtbl->GetFileSize(This,size) -#define IDWriteRemoteFontFileStream_GetLastWriteTime(This,last_writetime) (This)->lpVtbl->GetLastWriteTime(This,last_writetime) -/*** IDWriteRemoteFontFileStream methods ***/ -#define IDWriteRemoteFontFileStream_GetLocalFileSize(This,size) (This)->lpVtbl->GetLocalFileSize(This,size) -#define IDWriteRemoteFontFileStream_GetFileFragmentLocality(This,offset,size,is_local,partial_size) (This)->lpVtbl->GetFileFragmentLocality(This,offset,size,is_local,partial_size) -#define IDWriteRemoteFontFileStream_GetLocality(This) (This)->lpVtbl->GetLocality(This) -#define IDWriteRemoteFontFileStream_BeginDownload(This,operation_id,fragments,fragment_count,async_result) (This)->lpVtbl->BeginDownload(This,operation_id,fragments,fragment_count,async_result) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteRemoteFontFileStream_QueryInterface(IDWriteRemoteFontFileStream* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteRemoteFontFileStream_AddRef(IDWriteRemoteFontFileStream* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteRemoteFontFileStream_Release(IDWriteRemoteFontFileStream* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontFileStream methods ***/ -static FORCEINLINE HRESULT IDWriteRemoteFontFileStream_ReadFileFragment(IDWriteRemoteFontFileStream* This,const void **fragment_start,UINT64 offset,UINT64 fragment_size,void **fragment_context) { - return This->lpVtbl->ReadFileFragment(This,fragment_start,offset,fragment_size,fragment_context); -} -static FORCEINLINE void IDWriteRemoteFontFileStream_ReleaseFileFragment(IDWriteRemoteFontFileStream* This,void *fragment_context) { - This->lpVtbl->ReleaseFileFragment(This,fragment_context); -} -static FORCEINLINE HRESULT IDWriteRemoteFontFileStream_GetFileSize(IDWriteRemoteFontFileStream* This,UINT64 *size) { - return This->lpVtbl->GetFileSize(This,size); -} -static FORCEINLINE HRESULT IDWriteRemoteFontFileStream_GetLastWriteTime(IDWriteRemoteFontFileStream* This,UINT64 *last_writetime) { - return This->lpVtbl->GetLastWriteTime(This,last_writetime); -} -/*** IDWriteRemoteFontFileStream methods ***/ -static FORCEINLINE HRESULT IDWriteRemoteFontFileStream_GetLocalFileSize(IDWriteRemoteFontFileStream* This,UINT64 *size) { - return This->lpVtbl->GetLocalFileSize(This,size); -} -static FORCEINLINE HRESULT IDWriteRemoteFontFileStream_GetFileFragmentLocality(IDWriteRemoteFontFileStream* This,UINT64 offset,UINT64 size,WINBOOL *is_local,UINT64 *partial_size) { - return This->lpVtbl->GetFileFragmentLocality(This,offset,size,is_local,partial_size); -} -static FORCEINLINE DWRITE_LOCALITY IDWriteRemoteFontFileStream_GetLocality(IDWriteRemoteFontFileStream* This) { - return This->lpVtbl->GetLocality(This); -} -static FORCEINLINE HRESULT IDWriteRemoteFontFileStream_BeginDownload(IDWriteRemoteFontFileStream* This,const GUID *operation_id,const DWRITE_FILE_FRAGMENT *fragments,UINT32 fragment_count,IDWriteAsyncResult **async_result) { - return This->lpVtbl->BeginDownload(This,operation_id,fragments,fragment_count,async_result); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteRemoteFontFileStream_INTERFACE_DEFINED__ */ - -typedef enum DWRITE_CONTAINER_TYPE { - DWRITE_CONTAINER_TYPE_UNKNOWN = 0, - DWRITE_CONTAINER_TYPE_WOFF = 1, - DWRITE_CONTAINER_TYPE_WOFF2 = 2 -} DWRITE_CONTAINER_TYPE; -/***************************************************************************** - * IDWriteRemoteFontFileLoader interface - */ -#ifndef __IDWriteRemoteFontFileLoader_INTERFACE_DEFINED__ -#define __IDWriteRemoteFontFileLoader_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteRemoteFontFileLoader, 0x68648c83, 0x6ede, 0x46c0, 0xab,0x46, 0x20,0x08,0x3a,0x88,0x7f,0xde); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("68648c83-6ede-46c0-ab46-20083a887fde") -IDWriteRemoteFontFileLoader : public IDWriteFontFileLoader -{ - virtual HRESULT STDMETHODCALLTYPE CreateRemoteStreamFromKey( - const void *key, - UINT32 key_size, - IDWriteRemoteFontFileStream **stream) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetLocalityFromKey( - const void *key, - UINT32 key_size, - DWRITE_LOCALITY *locality) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateFontFileReferenceFromUrl( - IDWriteFactory *factory, - const WCHAR *base_url, - const WCHAR *file_url, - IDWriteFontFile **fontfile) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteRemoteFontFileLoader, 0x68648c83, 0x6ede, 0x46c0, 0xab,0x46, 0x20,0x08,0x3a,0x88,0x7f,0xde) -#endif -#else -typedef struct IDWriteRemoteFontFileLoaderVtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteRemoteFontFileLoader *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteRemoteFontFileLoader *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteRemoteFontFileLoader *This); - - /*** IDWriteFontFileLoader methods ***/ - HRESULT (STDMETHODCALLTYPE *CreateStreamFromKey)( - IDWriteRemoteFontFileLoader *This, - const void *key, - UINT32 key_size, - IDWriteFontFileStream **stream); - - /*** IDWriteRemoteFontFileLoader methods ***/ - HRESULT (STDMETHODCALLTYPE *CreateRemoteStreamFromKey)( - IDWriteRemoteFontFileLoader *This, - const void *key, - UINT32 key_size, - IDWriteRemoteFontFileStream **stream); - - HRESULT (STDMETHODCALLTYPE *GetLocalityFromKey)( - IDWriteRemoteFontFileLoader *This, - const void *key, - UINT32 key_size, - DWRITE_LOCALITY *locality); - - HRESULT (STDMETHODCALLTYPE *CreateFontFileReferenceFromUrl)( - IDWriteRemoteFontFileLoader *This, - IDWriteFactory *factory, - const WCHAR *base_url, - const WCHAR *file_url, - IDWriteFontFile **fontfile); - - END_INTERFACE -} IDWriteRemoteFontFileLoaderVtbl; - -interface IDWriteRemoteFontFileLoader { - CONST_VTBL IDWriteRemoteFontFileLoaderVtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteRemoteFontFileLoader_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteRemoteFontFileLoader_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteRemoteFontFileLoader_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontFileLoader methods ***/ -#define IDWriteRemoteFontFileLoader_CreateStreamFromKey(This,key,key_size,stream) (This)->lpVtbl->CreateStreamFromKey(This,key,key_size,stream) -/*** IDWriteRemoteFontFileLoader methods ***/ -#define IDWriteRemoteFontFileLoader_CreateRemoteStreamFromKey(This,key,key_size,stream) (This)->lpVtbl->CreateRemoteStreamFromKey(This,key,key_size,stream) -#define IDWriteRemoteFontFileLoader_GetLocalityFromKey(This,key,key_size,locality) (This)->lpVtbl->GetLocalityFromKey(This,key,key_size,locality) -#define IDWriteRemoteFontFileLoader_CreateFontFileReferenceFromUrl(This,factory,base_url,file_url,fontfile) (This)->lpVtbl->CreateFontFileReferenceFromUrl(This,factory,base_url,file_url,fontfile) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteRemoteFontFileLoader_QueryInterface(IDWriteRemoteFontFileLoader* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteRemoteFontFileLoader_AddRef(IDWriteRemoteFontFileLoader* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteRemoteFontFileLoader_Release(IDWriteRemoteFontFileLoader* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontFileLoader methods ***/ -static FORCEINLINE HRESULT IDWriteRemoteFontFileLoader_CreateStreamFromKey(IDWriteRemoteFontFileLoader* This,const void *key,UINT32 key_size,IDWriteFontFileStream **stream) { - return This->lpVtbl->CreateStreamFromKey(This,key,key_size,stream); -} -/*** IDWriteRemoteFontFileLoader methods ***/ -static FORCEINLINE HRESULT IDWriteRemoteFontFileLoader_CreateRemoteStreamFromKey(IDWriteRemoteFontFileLoader* This,const void *key,UINT32 key_size,IDWriteRemoteFontFileStream **stream) { - return This->lpVtbl->CreateRemoteStreamFromKey(This,key,key_size,stream); -} -static FORCEINLINE HRESULT IDWriteRemoteFontFileLoader_GetLocalityFromKey(IDWriteRemoteFontFileLoader* This,const void *key,UINT32 key_size,DWRITE_LOCALITY *locality) { - return This->lpVtbl->GetLocalityFromKey(This,key,key_size,locality); -} -static FORCEINLINE HRESULT IDWriteRemoteFontFileLoader_CreateFontFileReferenceFromUrl(IDWriteRemoteFontFileLoader* This,IDWriteFactory *factory,const WCHAR *base_url,const WCHAR *file_url,IDWriteFontFile **fontfile) { - return This->lpVtbl->CreateFontFileReferenceFromUrl(This,factory,base_url,file_url,fontfile); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteRemoteFontFileLoader_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteInMemoryFontFileLoader interface - */ -#ifndef __IDWriteInMemoryFontFileLoader_INTERFACE_DEFINED__ -#define __IDWriteInMemoryFontFileLoader_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteInMemoryFontFileLoader, 0xdc102f47, 0xa12d, 0x4b1c, 0x82,0x2d, 0x9e,0x11,0x7e,0x33,0x04,0x3f); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("dc102f47-a12d-4b1c-822d-9e117e33043f") -IDWriteInMemoryFontFileLoader : public IDWriteFontFileLoader -{ - virtual HRESULT STDMETHODCALLTYPE CreateInMemoryFontFileReference( - IDWriteFactory *factory, - const void *data, - UINT32 data_size, - IUnknown *owner, - IDWriteFontFile **fontfile) = 0; - - virtual UINT32 STDMETHODCALLTYPE GetFileCount( - ) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteInMemoryFontFileLoader, 0xdc102f47, 0xa12d, 0x4b1c, 0x82,0x2d, 0x9e,0x11,0x7e,0x33,0x04,0x3f) -#endif -#else -typedef struct IDWriteInMemoryFontFileLoaderVtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteInMemoryFontFileLoader *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteInMemoryFontFileLoader *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteInMemoryFontFileLoader *This); - - /*** IDWriteFontFileLoader methods ***/ - HRESULT (STDMETHODCALLTYPE *CreateStreamFromKey)( - IDWriteInMemoryFontFileLoader *This, - const void *key, - UINT32 key_size, - IDWriteFontFileStream **stream); - - /*** IDWriteInMemoryFontFileLoader methods ***/ - HRESULT (STDMETHODCALLTYPE *CreateInMemoryFontFileReference)( - IDWriteInMemoryFontFileLoader *This, - IDWriteFactory *factory, - const void *data, - UINT32 data_size, - IUnknown *owner, - IDWriteFontFile **fontfile); - - UINT32 (STDMETHODCALLTYPE *GetFileCount)( - IDWriteInMemoryFontFileLoader *This); - - END_INTERFACE -} IDWriteInMemoryFontFileLoaderVtbl; - -interface IDWriteInMemoryFontFileLoader { - CONST_VTBL IDWriteInMemoryFontFileLoaderVtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteInMemoryFontFileLoader_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteInMemoryFontFileLoader_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteInMemoryFontFileLoader_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFontFileLoader methods ***/ -#define IDWriteInMemoryFontFileLoader_CreateStreamFromKey(This,key,key_size,stream) (This)->lpVtbl->CreateStreamFromKey(This,key,key_size,stream) -/*** IDWriteInMemoryFontFileLoader methods ***/ -#define IDWriteInMemoryFontFileLoader_CreateInMemoryFontFileReference(This,factory,data,data_size,owner,fontfile) (This)->lpVtbl->CreateInMemoryFontFileReference(This,factory,data,data_size,owner,fontfile) -#define IDWriteInMemoryFontFileLoader_GetFileCount(This) (This)->lpVtbl->GetFileCount(This) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteInMemoryFontFileLoader_QueryInterface(IDWriteInMemoryFontFileLoader* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteInMemoryFontFileLoader_AddRef(IDWriteInMemoryFontFileLoader* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteInMemoryFontFileLoader_Release(IDWriteInMemoryFontFileLoader* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFontFileLoader methods ***/ -static FORCEINLINE HRESULT IDWriteInMemoryFontFileLoader_CreateStreamFromKey(IDWriteInMemoryFontFileLoader* This,const void *key,UINT32 key_size,IDWriteFontFileStream **stream) { - return This->lpVtbl->CreateStreamFromKey(This,key,key_size,stream); -} -/*** IDWriteInMemoryFontFileLoader methods ***/ -static FORCEINLINE HRESULT IDWriteInMemoryFontFileLoader_CreateInMemoryFontFileReference(IDWriteInMemoryFontFileLoader* This,IDWriteFactory *factory,const void *data,UINT32 data_size,IUnknown *owner,IDWriteFontFile **fontfile) { - return This->lpVtbl->CreateInMemoryFontFileReference(This,factory,data,data_size,owner,fontfile); -} -static FORCEINLINE UINT32 IDWriteInMemoryFontFileLoader_GetFileCount(IDWriteInMemoryFontFileLoader* This) { - return This->lpVtbl->GetFileCount(This); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteInMemoryFontFileLoader_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFactory5 interface - */ -#ifndef __IDWriteFactory5_INTERFACE_DEFINED__ -#define __IDWriteFactory5_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFactory5, 0x958db99a, 0xbe2a, 0x4f09, 0xaf,0x7d, 0x65,0x18,0x98,0x03,0xd1,0xd3); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("958db99a-be2a-4f09-af7d-65189803d1d3") -IDWriteFactory5 : public IDWriteFactory4 -{ - virtual HRESULT STDMETHODCALLTYPE CreateFontSetBuilder( - IDWriteFontSetBuilder1 **fontset_builder) = 0; - - using IDWriteFactory3::CreateFontSetBuilder; - - virtual HRESULT STDMETHODCALLTYPE CreateInMemoryFontFileLoader( - IDWriteInMemoryFontFileLoader **loader) = 0; - - virtual HRESULT STDMETHODCALLTYPE CreateHttpFontFileLoader( - const WCHAR *referrer_url, - const WCHAR *extra_headers, - IDWriteRemoteFontFileLoader **loader) = 0; - - virtual DWRITE_CONTAINER_TYPE STDMETHODCALLTYPE AnalyzeContainerType( - const void *data, - UINT32 data_size) = 0; - - virtual HRESULT STDMETHODCALLTYPE UnpackFontFile( - DWRITE_CONTAINER_TYPE container_type, - const void *data, - UINT32 data_size, - IDWriteFontFileStream **stream) = 0; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFactory5, 0x958db99a, 0xbe2a, 0x4f09, 0xaf,0x7d, 0x65,0x18,0x98,0x03,0xd1,0xd3) -#endif -#else -typedef struct IDWriteFactory5Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFactory5 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFactory5 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFactory5 *This); - - /*** IDWriteFactory methods ***/ - HRESULT (STDMETHODCALLTYPE *GetSystemFontCollection)( - IDWriteFactory5 *This, - IDWriteFontCollection **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *CreateCustomFontCollection)( - IDWriteFactory5 *This, - IDWriteFontCollectionLoader *loader, - const void *key, - UINT32 key_size, - IDWriteFontCollection **collection); - - HRESULT (STDMETHODCALLTYPE *RegisterFontCollectionLoader)( - IDWriteFactory5 *This, - IDWriteFontCollectionLoader *loader); - - HRESULT (STDMETHODCALLTYPE *UnregisterFontCollectionLoader)( - IDWriteFactory5 *This, - IDWriteFontCollectionLoader *loader); - - HRESULT (STDMETHODCALLTYPE *CreateFontFileReference)( - IDWriteFactory5 *This, - const WCHAR *path, - const FILETIME *writetime, - IDWriteFontFile **font_file); - - HRESULT (STDMETHODCALLTYPE *CreateCustomFontFileReference)( - IDWriteFactory5 *This, - const void *reference_key, - UINT32 key_size, - IDWriteFontFileLoader *loader, - IDWriteFontFile **font_file); - - HRESULT (STDMETHODCALLTYPE *CreateFontFace)( - IDWriteFactory5 *This, - DWRITE_FONT_FACE_TYPE facetype, - UINT32 files_number, - IDWriteFontFile *const *font_files, - UINT32 index, - DWRITE_FONT_SIMULATIONS sim_flags, - IDWriteFontFace **font_face); - - HRESULT (STDMETHODCALLTYPE *CreateRenderingParams)( - IDWriteFactory5 *This, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *CreateMonitorRenderingParams)( - IDWriteFactory5 *This, - HMONITOR monitor, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *CreateCustomRenderingParams)( - IDWriteFactory5 *This, - FLOAT gamma, - FLOAT enhancedContrast, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY geometry, - DWRITE_RENDERING_MODE mode, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *RegisterFontFileLoader)( - IDWriteFactory5 *This, - IDWriteFontFileLoader *loader); - - HRESULT (STDMETHODCALLTYPE *UnregisterFontFileLoader)( - IDWriteFactory5 *This, - IDWriteFontFileLoader *loader); - - HRESULT (STDMETHODCALLTYPE *CreateTextFormat)( - IDWriteFactory5 *This, - const WCHAR *family_name, - IDWriteFontCollection *collection, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STYLE style, - DWRITE_FONT_STRETCH stretch, - FLOAT size, - const WCHAR *locale, - IDWriteTextFormat **format); - - HRESULT (STDMETHODCALLTYPE *CreateTypography)( - IDWriteFactory5 *This, - IDWriteTypography **typography); - - HRESULT (STDMETHODCALLTYPE *GetGdiInterop)( - IDWriteFactory5 *This, - IDWriteGdiInterop **gdi_interop); - - HRESULT (STDMETHODCALLTYPE *CreateTextLayout)( - IDWriteFactory5 *This, - const WCHAR *string, - UINT32 len, - IDWriteTextFormat *format, - FLOAT max_width, - FLOAT max_height, - IDWriteTextLayout **layout); - - HRESULT (STDMETHODCALLTYPE *CreateGdiCompatibleTextLayout)( - IDWriteFactory5 *This, - const WCHAR *string, - UINT32 len, - IDWriteTextFormat *format, - FLOAT layout_width, - FLOAT layout_height, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - WINBOOL use_gdi_natural, - IDWriteTextLayout **layout); - - HRESULT (STDMETHODCALLTYPE *CreateEllipsisTrimmingSign)( - IDWriteFactory5 *This, - IDWriteTextFormat *format, - IDWriteInlineObject **trimming_sign); - - HRESULT (STDMETHODCALLTYPE *CreateTextAnalyzer)( - IDWriteFactory5 *This, - IDWriteTextAnalyzer **analyzer); - - HRESULT (STDMETHODCALLTYPE *CreateNumberSubstitution)( - IDWriteFactory5 *This, - DWRITE_NUMBER_SUBSTITUTION_METHOD method, - const WCHAR *locale, - WINBOOL ignore_user_override, - IDWriteNumberSubstitution **substitution); - - HRESULT (STDMETHODCALLTYPE *CreateGlyphRunAnalysis)( - IDWriteFactory5 *This, - const DWRITE_GLYPH_RUN *glyph_run, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE rendering_mode, - DWRITE_MEASURING_MODE measuring_mode, - FLOAT baseline_x, - FLOAT baseline_y, - IDWriteGlyphRunAnalysis **analysis); - - /*** IDWriteFactory1 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetEudcFontCollection)( - IDWriteFactory5 *This, - IDWriteFontCollection **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory1_CreateCustomRenderingParams)( - IDWriteFactory5 *This, - FLOAT gamma, - FLOAT enhcontrast, - FLOAT enhcontrast_grayscale, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY geometry, - DWRITE_RENDERING_MODE mode, - IDWriteRenderingParams1 **params); - - /*** IDWriteFactory2 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetSystemFontFallback)( - IDWriteFactory5 *This, - IDWriteFontFallback **fallback); - - HRESULT (STDMETHODCALLTYPE *CreateFontFallbackBuilder)( - IDWriteFactory5 *This, - IDWriteFontFallbackBuilder **fallbackbuilder); - - HRESULT (STDMETHODCALLTYPE *TranslateColorGlyphRun)( - IDWriteFactory5 *This, - FLOAT originX, - FLOAT originY, - const DWRITE_GLYPH_RUN *run, - const DWRITE_GLYPH_RUN_DESCRIPTION *rundescr, - DWRITE_MEASURING_MODE mode, - const DWRITE_MATRIX *transform, - UINT32 palette_index, - IDWriteColorGlyphRunEnumerator **colorlayers); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory2_CreateCustomRenderingParams)( - IDWriteFactory5 *This, - FLOAT gamma, - FLOAT contrast, - FLOAT grayscalecontrast, - FLOAT cleartypeLevel, - DWRITE_PIXEL_GEOMETRY pixelGeometry, - DWRITE_RENDERING_MODE renderingMode, - DWRITE_GRID_FIT_MODE gridFitMode, - IDWriteRenderingParams2 **params); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory2_CreateGlyphRunAnalysis)( - IDWriteFactory5 *This, - const DWRITE_GLYPH_RUN *run, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE renderingMode, - DWRITE_MEASURING_MODE measuringMode, - DWRITE_GRID_FIT_MODE gridFitMode, - DWRITE_TEXT_ANTIALIAS_MODE antialiasMode, - FLOAT originX, - FLOAT originY, - IDWriteGlyphRunAnalysis **analysis); - - /*** IDWriteFactory3 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_CreateGlyphRunAnalysis)( - IDWriteFactory5 *This, - const DWRITE_GLYPH_RUN *run, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE1 rendering_mode, - DWRITE_MEASURING_MODE measuring_mode, - DWRITE_GRID_FIT_MODE gridfit_mode, - DWRITE_TEXT_ANTIALIAS_MODE antialias_mode, - FLOAT origin_x, - FLOAT origin_y, - IDWriteGlyphRunAnalysis **analysis); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_CreateCustomRenderingParams)( - IDWriteFactory5 *This, - FLOAT gamma, - FLOAT enhanced_contrast, - FLOAT grayscale_enhanced_contrast, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY pixel_geometry, - DWRITE_RENDERING_MODE1 rendering_mode, - DWRITE_GRID_FIT_MODE gridfit_mode, - IDWriteRenderingParams3 **params); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceReference_)( - IDWriteFactory5 *This, - IDWriteFontFile *file, - UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceReference)( - IDWriteFactory5 *This, - const WCHAR *path, - const FILETIME *writetime, - UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *GetSystemFontSet)( - IDWriteFactory5 *This, - IDWriteFontSet **fontset); - - HRESULT (STDMETHODCALLTYPE *CreateFontSetBuilder)( - IDWriteFactory5 *This, - IDWriteFontSetBuilder **builder); - - HRESULT (STDMETHODCALLTYPE *CreateFontCollectionFromFontSet)( - IDWriteFactory5 *This, - IDWriteFontSet *fontset, - IDWriteFontCollection1 **collection); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_GetSystemFontCollection)( - IDWriteFactory5 *This, - WINBOOL include_downloadable, - IDWriteFontCollection1 **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *GetFontDownloadQueue)( - IDWriteFactory5 *This, - IDWriteFontDownloadQueue **queue); - - /*** IDWriteFactory4 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory4_TranslateColorGlyphRun)( - IDWriteFactory5 *This, - D2D1_POINT_2F baseline_origin, - const DWRITE_GLYPH_RUN *run, - const DWRITE_GLYPH_RUN_DESCRIPTION *run_desc, - DWRITE_GLYPH_IMAGE_FORMATS desired_formats, - DWRITE_MEASURING_MODE measuring_mode, - const DWRITE_MATRIX *transform, - UINT32 palette, - IDWriteColorGlyphRunEnumerator1 **layers); - - HRESULT (STDMETHODCALLTYPE *ComputeGlyphOrigins_)( - IDWriteFactory5 *This, - const DWRITE_GLYPH_RUN *run, - D2D1_POINT_2F baseline_origin, - D2D1_POINT_2F *origins); - - HRESULT (STDMETHODCALLTYPE *ComputeGlyphOrigins)( - IDWriteFactory5 *This, - const DWRITE_GLYPH_RUN *run, - DWRITE_MEASURING_MODE measuring_mode, - D2D1_POINT_2F baseline_origin, - const DWRITE_MATRIX *transform, - D2D1_POINT_2F *origins); - - /*** IDWriteFactory5 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory5_CreateFontSetBuilder)( - IDWriteFactory5 *This, - IDWriteFontSetBuilder1 **fontset_builder); - - HRESULT (STDMETHODCALLTYPE *CreateInMemoryFontFileLoader)( - IDWriteFactory5 *This, - IDWriteInMemoryFontFileLoader **loader); - - HRESULT (STDMETHODCALLTYPE *CreateHttpFontFileLoader)( - IDWriteFactory5 *This, - const WCHAR *referrer_url, - const WCHAR *extra_headers, - IDWriteRemoteFontFileLoader **loader); - - DWRITE_CONTAINER_TYPE (STDMETHODCALLTYPE *AnalyzeContainerType)( - IDWriteFactory5 *This, - const void *data, - UINT32 data_size); - - HRESULT (STDMETHODCALLTYPE *UnpackFontFile)( - IDWriteFactory5 *This, - DWRITE_CONTAINER_TYPE container_type, - const void *data, - UINT32 data_size, - IDWriteFontFileStream **stream); - - END_INTERFACE -} IDWriteFactory5Vtbl; - -interface IDWriteFactory5 { - CONST_VTBL IDWriteFactory5Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFactory5_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFactory5_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFactory5_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFactory methods ***/ -#define IDWriteFactory5_CreateCustomFontCollection(This,loader,key,key_size,collection) (This)->lpVtbl->CreateCustomFontCollection(This,loader,key,key_size,collection) -#define IDWriteFactory5_RegisterFontCollectionLoader(This,loader) (This)->lpVtbl->RegisterFontCollectionLoader(This,loader) -#define IDWriteFactory5_UnregisterFontCollectionLoader(This,loader) (This)->lpVtbl->UnregisterFontCollectionLoader(This,loader) -#define IDWriteFactory5_CreateFontFileReference(This,path,writetime,font_file) (This)->lpVtbl->CreateFontFileReference(This,path,writetime,font_file) -#define IDWriteFactory5_CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file) (This)->lpVtbl->CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file) -#define IDWriteFactory5_CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face) (This)->lpVtbl->CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face) -#define IDWriteFactory5_CreateRenderingParams(This,params) (This)->lpVtbl->CreateRenderingParams(This,params) -#define IDWriteFactory5_CreateMonitorRenderingParams(This,monitor,params) (This)->lpVtbl->CreateMonitorRenderingParams(This,monitor,params) -#define IDWriteFactory5_RegisterFontFileLoader(This,loader) (This)->lpVtbl->RegisterFontFileLoader(This,loader) -#define IDWriteFactory5_UnregisterFontFileLoader(This,loader) (This)->lpVtbl->UnregisterFontFileLoader(This,loader) -#define IDWriteFactory5_CreateTextFormat(This,family_name,collection,weight,style,stretch,size,locale,format) (This)->lpVtbl->CreateTextFormat(This,family_name,collection,weight,style,stretch,size,locale,format) -#define IDWriteFactory5_CreateTypography(This,typography) (This)->lpVtbl->CreateTypography(This,typography) -#define IDWriteFactory5_GetGdiInterop(This,gdi_interop) (This)->lpVtbl->GetGdiInterop(This,gdi_interop) -#define IDWriteFactory5_CreateTextLayout(This,string,len,format,max_width,max_height,layout) (This)->lpVtbl->CreateTextLayout(This,string,len,format,max_width,max_height,layout) -#define IDWriteFactory5_CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout) (This)->lpVtbl->CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout) -#define IDWriteFactory5_CreateEllipsisTrimmingSign(This,format,trimming_sign) (This)->lpVtbl->CreateEllipsisTrimmingSign(This,format,trimming_sign) -#define IDWriteFactory5_CreateTextAnalyzer(This,analyzer) (This)->lpVtbl->CreateTextAnalyzer(This,analyzer) -#define IDWriteFactory5_CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution) (This)->lpVtbl->CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution) -/*** IDWriteFactory1 methods ***/ -#define IDWriteFactory5_GetEudcFontCollection(This,collection,check_for_updates) (This)->lpVtbl->GetEudcFontCollection(This,collection,check_for_updates) -/*** IDWriteFactory2 methods ***/ -#define IDWriteFactory5_GetSystemFontFallback(This,fallback) (This)->lpVtbl->GetSystemFontFallback(This,fallback) -#define IDWriteFactory5_CreateFontFallbackBuilder(This,fallbackbuilder) (This)->lpVtbl->CreateFontFallbackBuilder(This,fallbackbuilder) -/*** IDWriteFactory3 methods ***/ -#define IDWriteFactory5_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis) (This)->lpVtbl->IDWriteFactory3_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis) -#define IDWriteFactory5_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params) (This)->lpVtbl->IDWriteFactory3_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params) -#define IDWriteFactory5_CreateFontFaceReference_(This,file,index,simulations,reference) (This)->lpVtbl->CreateFontFaceReference_(This,file,index,simulations,reference) -#define IDWriteFactory5_CreateFontFaceReference(This,path,writetime,index,simulations,reference) (This)->lpVtbl->CreateFontFaceReference(This,path,writetime,index,simulations,reference) -#define IDWriteFactory5_GetSystemFontSet(This,fontset) (This)->lpVtbl->GetSystemFontSet(This,fontset) -#define IDWriteFactory5_CreateFontCollectionFromFontSet(This,fontset,collection) (This)->lpVtbl->CreateFontCollectionFromFontSet(This,fontset,collection) -#define IDWriteFactory5_GetSystemFontCollection(This,include_downloadable,collection,check_for_updates) (This)->lpVtbl->IDWriteFactory3_GetSystemFontCollection(This,include_downloadable,collection,check_for_updates) -#define IDWriteFactory5_GetFontDownloadQueue(This,queue) (This)->lpVtbl->GetFontDownloadQueue(This,queue) -/*** IDWriteFactory4 methods ***/ -#define IDWriteFactory5_TranslateColorGlyphRun(This,baseline_origin,run,run_desc,desired_formats,measuring_mode,transform,palette,layers) (This)->lpVtbl->IDWriteFactory4_TranslateColorGlyphRun(This,baseline_origin,run,run_desc,desired_formats,measuring_mode,transform,palette,layers) -#define IDWriteFactory5_ComputeGlyphOrigins_(This,run,baseline_origin,origins) (This)->lpVtbl->ComputeGlyphOrigins_(This,run,baseline_origin,origins) -#define IDWriteFactory5_ComputeGlyphOrigins(This,run,measuring_mode,baseline_origin,transform,origins) (This)->lpVtbl->ComputeGlyphOrigins(This,run,measuring_mode,baseline_origin,transform,origins) -/*** IDWriteFactory5 methods ***/ -#define IDWriteFactory5_CreateFontSetBuilder(This,fontset_builder) (This)->lpVtbl->IDWriteFactory5_CreateFontSetBuilder(This,fontset_builder) -#define IDWriteFactory5_CreateInMemoryFontFileLoader(This,loader) (This)->lpVtbl->CreateInMemoryFontFileLoader(This,loader) -#define IDWriteFactory5_CreateHttpFontFileLoader(This,referrer_url,extra_headers,loader) (This)->lpVtbl->CreateHttpFontFileLoader(This,referrer_url,extra_headers,loader) -#define IDWriteFactory5_AnalyzeContainerType(This,data,data_size) (This)->lpVtbl->AnalyzeContainerType(This,data,data_size) -#define IDWriteFactory5_UnpackFontFile(This,container_type,data,data_size,stream) (This)->lpVtbl->UnpackFontFile(This,container_type,data,data_size,stream) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFactory5_QueryInterface(IDWriteFactory5* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFactory5_AddRef(IDWriteFactory5* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFactory5_Release(IDWriteFactory5* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFactory methods ***/ -static FORCEINLINE HRESULT IDWriteFactory5_CreateCustomFontCollection(IDWriteFactory5* This,IDWriteFontCollectionLoader *loader,const void *key,UINT32 key_size,IDWriteFontCollection **collection) { - return This->lpVtbl->CreateCustomFontCollection(This,loader,key,key_size,collection); -} -static FORCEINLINE HRESULT IDWriteFactory5_RegisterFontCollectionLoader(IDWriteFactory5* This,IDWriteFontCollectionLoader *loader) { - return This->lpVtbl->RegisterFontCollectionLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory5_UnregisterFontCollectionLoader(IDWriteFactory5* This,IDWriteFontCollectionLoader *loader) { - return This->lpVtbl->UnregisterFontCollectionLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateFontFileReference(IDWriteFactory5* This,const WCHAR *path,const FILETIME *writetime,IDWriteFontFile **font_file) { - return This->lpVtbl->CreateFontFileReference(This,path,writetime,font_file); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateCustomFontFileReference(IDWriteFactory5* This,const void *reference_key,UINT32 key_size,IDWriteFontFileLoader *loader,IDWriteFontFile **font_file) { - return This->lpVtbl->CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateFontFace(IDWriteFactory5* This,DWRITE_FONT_FACE_TYPE facetype,UINT32 files_number,IDWriteFontFile *const *font_files,UINT32 index,DWRITE_FONT_SIMULATIONS sim_flags,IDWriteFontFace **font_face) { - return This->lpVtbl->CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateRenderingParams(IDWriteFactory5* This,IDWriteRenderingParams **params) { - return This->lpVtbl->CreateRenderingParams(This,params); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateMonitorRenderingParams(IDWriteFactory5* This,HMONITOR monitor,IDWriteRenderingParams **params) { - return This->lpVtbl->CreateMonitorRenderingParams(This,monitor,params); -} -static FORCEINLINE HRESULT IDWriteFactory5_RegisterFontFileLoader(IDWriteFactory5* This,IDWriteFontFileLoader *loader) { - return This->lpVtbl->RegisterFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory5_UnregisterFontFileLoader(IDWriteFactory5* This,IDWriteFontFileLoader *loader) { - return This->lpVtbl->UnregisterFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateTextFormat(IDWriteFactory5* This,const WCHAR *family_name,IDWriteFontCollection *collection,DWRITE_FONT_WEIGHT weight,DWRITE_FONT_STYLE style,DWRITE_FONT_STRETCH stretch,FLOAT size,const WCHAR *locale,IDWriteTextFormat **format) { - return This->lpVtbl->CreateTextFormat(This,family_name,collection,weight,style,stretch,size,locale,format); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateTypography(IDWriteFactory5* This,IDWriteTypography **typography) { - return This->lpVtbl->CreateTypography(This,typography); -} -static FORCEINLINE HRESULT IDWriteFactory5_GetGdiInterop(IDWriteFactory5* This,IDWriteGdiInterop **gdi_interop) { - return This->lpVtbl->GetGdiInterop(This,gdi_interop); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateTextLayout(IDWriteFactory5* This,const WCHAR *string,UINT32 len,IDWriteTextFormat *format,FLOAT max_width,FLOAT max_height,IDWriteTextLayout **layout) { - return This->lpVtbl->CreateTextLayout(This,string,len,format,max_width,max_height,layout); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateGdiCompatibleTextLayout(IDWriteFactory5* This,const WCHAR *string,UINT32 len,IDWriteTextFormat *format,FLOAT layout_width,FLOAT layout_height,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,WINBOOL use_gdi_natural,IDWriteTextLayout **layout) { - return This->lpVtbl->CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateEllipsisTrimmingSign(IDWriteFactory5* This,IDWriteTextFormat *format,IDWriteInlineObject **trimming_sign) { - return This->lpVtbl->CreateEllipsisTrimmingSign(This,format,trimming_sign); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateTextAnalyzer(IDWriteFactory5* This,IDWriteTextAnalyzer **analyzer) { - return This->lpVtbl->CreateTextAnalyzer(This,analyzer); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateNumberSubstitution(IDWriteFactory5* This,DWRITE_NUMBER_SUBSTITUTION_METHOD method,const WCHAR *locale,WINBOOL ignore_user_override,IDWriteNumberSubstitution **substitution) { - return This->lpVtbl->CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution); -} -/*** IDWriteFactory1 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory5_GetEudcFontCollection(IDWriteFactory5* This,IDWriteFontCollection **collection,WINBOOL check_for_updates) { - return This->lpVtbl->GetEudcFontCollection(This,collection,check_for_updates); -} -/*** IDWriteFactory2 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory5_GetSystemFontFallback(IDWriteFactory5* This,IDWriteFontFallback **fallback) { - return This->lpVtbl->GetSystemFontFallback(This,fallback); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateFontFallbackBuilder(IDWriteFactory5* This,IDWriteFontFallbackBuilder **fallbackbuilder) { - return This->lpVtbl->CreateFontFallbackBuilder(This,fallbackbuilder); -} -/*** IDWriteFactory3 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory5_CreateGlyphRunAnalysis(IDWriteFactory5* This,const DWRITE_GLYPH_RUN *run,const DWRITE_MATRIX *transform,DWRITE_RENDERING_MODE1 rendering_mode,DWRITE_MEASURING_MODE measuring_mode,DWRITE_GRID_FIT_MODE gridfit_mode,DWRITE_TEXT_ANTIALIAS_MODE antialias_mode,FLOAT origin_x,FLOAT origin_y,IDWriteGlyphRunAnalysis **analysis) { - return This->lpVtbl->IDWriteFactory3_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateCustomRenderingParams(IDWriteFactory5* This,FLOAT gamma,FLOAT enhanced_contrast,FLOAT grayscale_enhanced_contrast,FLOAT cleartype_level,DWRITE_PIXEL_GEOMETRY pixel_geometry,DWRITE_RENDERING_MODE1 rendering_mode,DWRITE_GRID_FIT_MODE gridfit_mode,IDWriteRenderingParams3 **params) { - return This->lpVtbl->IDWriteFactory3_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateFontFaceReference_(IDWriteFactory5* This,IDWriteFontFile *file,UINT32 index,DWRITE_FONT_SIMULATIONS simulations,IDWriteFontFaceReference **reference) { - return This->lpVtbl->CreateFontFaceReference_(This,file,index,simulations,reference); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateFontFaceReference(IDWriteFactory5* This,const WCHAR *path,const FILETIME *writetime,UINT32 index,DWRITE_FONT_SIMULATIONS simulations,IDWriteFontFaceReference **reference) { - return This->lpVtbl->CreateFontFaceReference(This,path,writetime,index,simulations,reference); -} -static FORCEINLINE HRESULT IDWriteFactory5_GetSystemFontSet(IDWriteFactory5* This,IDWriteFontSet **fontset) { - return This->lpVtbl->GetSystemFontSet(This,fontset); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateFontCollectionFromFontSet(IDWriteFactory5* This,IDWriteFontSet *fontset,IDWriteFontCollection1 **collection) { - return This->lpVtbl->CreateFontCollectionFromFontSet(This,fontset,collection); -} -static FORCEINLINE HRESULT IDWriteFactory5_GetSystemFontCollection(IDWriteFactory5* This,WINBOOL include_downloadable,IDWriteFontCollection1 **collection,WINBOOL check_for_updates) { - return This->lpVtbl->IDWriteFactory3_GetSystemFontCollection(This,include_downloadable,collection,check_for_updates); -} -static FORCEINLINE HRESULT IDWriteFactory5_GetFontDownloadQueue(IDWriteFactory5* This,IDWriteFontDownloadQueue **queue) { - return This->lpVtbl->GetFontDownloadQueue(This,queue); -} -/*** IDWriteFactory4 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory5_TranslateColorGlyphRun(IDWriteFactory5* This,D2D1_POINT_2F baseline_origin,const DWRITE_GLYPH_RUN *run,const DWRITE_GLYPH_RUN_DESCRIPTION *run_desc,DWRITE_GLYPH_IMAGE_FORMATS desired_formats,DWRITE_MEASURING_MODE measuring_mode,const DWRITE_MATRIX *transform,UINT32 palette,IDWriteColorGlyphRunEnumerator1 **layers) { - return This->lpVtbl->IDWriteFactory4_TranslateColorGlyphRun(This,baseline_origin,run,run_desc,desired_formats,measuring_mode,transform,palette,layers); -} -static FORCEINLINE HRESULT IDWriteFactory5_ComputeGlyphOrigins_(IDWriteFactory5* This,const DWRITE_GLYPH_RUN *run,D2D1_POINT_2F baseline_origin,D2D1_POINT_2F *origins) { - return This->lpVtbl->ComputeGlyphOrigins_(This,run,baseline_origin,origins); -} -static FORCEINLINE HRESULT IDWriteFactory5_ComputeGlyphOrigins(IDWriteFactory5* This,const DWRITE_GLYPH_RUN *run,DWRITE_MEASURING_MODE measuring_mode,D2D1_POINT_2F baseline_origin,const DWRITE_MATRIX *transform,D2D1_POINT_2F *origins) { - return This->lpVtbl->ComputeGlyphOrigins(This,run,measuring_mode,baseline_origin,transform,origins); -} -/*** IDWriteFactory5 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory5_CreateFontSetBuilder(IDWriteFactory5* This,IDWriteFontSetBuilder1 **fontset_builder) { - return This->lpVtbl->IDWriteFactory5_CreateFontSetBuilder(This,fontset_builder); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateInMemoryFontFileLoader(IDWriteFactory5* This,IDWriteInMemoryFontFileLoader **loader) { - return This->lpVtbl->CreateInMemoryFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory5_CreateHttpFontFileLoader(IDWriteFactory5* This,const WCHAR *referrer_url,const WCHAR *extra_headers,IDWriteRemoteFontFileLoader **loader) { - return This->lpVtbl->CreateHttpFontFileLoader(This,referrer_url,extra_headers,loader); -} -static FORCEINLINE DWRITE_CONTAINER_TYPE IDWriteFactory5_AnalyzeContainerType(IDWriteFactory5* This,const void *data,UINT32 data_size) { - return This->lpVtbl->AnalyzeContainerType(This,data,data_size); -} -static FORCEINLINE HRESULT IDWriteFactory5_UnpackFontFile(IDWriteFactory5* This,DWRITE_CONTAINER_TYPE container_type,const void *data,UINT32 data_size,IDWriteFontFileStream **stream) { - return This->lpVtbl->UnpackFontFile(This,container_type,data,data_size,stream); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFactory5_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFactory6 interface - */ -#ifndef __IDWriteFactory6_INTERFACE_DEFINED__ -#define __IDWriteFactory6_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFactory6, 0xf3744d80, 0x21f7, 0x42eb, 0xb3,0x5d, 0x99,0x5b,0xc7,0x2f,0xc2,0x23); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("f3744d80-21f7-42eb-b35d-995bc72fc223") -IDWriteFactory6 : public IDWriteFactory5 -{ - virtual HRESULT STDMETHODCALLTYPE CreateFontFaceReference( - IDWriteFontFile *file, - UINT32 face_index, - DWRITE_FONT_SIMULATIONS simulations, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_axis, - IDWriteFontFaceReference1 **face_ref) = 0; - - using IDWriteFactory5::CreateFontFaceReference; - - virtual HRESULT STDMETHODCALLTYPE CreateFontResource( - IDWriteFontFile *file, - UINT32 face_index, - IDWriteFontResource **resource) = 0; - - virtual HRESULT STDMETHODCALLTYPE GetSystemFontSet( - WINBOOL include_downloadable, - IDWriteFontSet1 **fontset) = 0; - - using IDWriteFactory3::GetSystemFontSet; - - virtual HRESULT STDMETHODCALLTYPE GetSystemFontCollection( - WINBOOL include_downloadable, - DWRITE_FONT_FAMILY_MODEL family_model, - IDWriteFontCollection2 **collection) = 0; - - using IDWriteFactory3::GetSystemFontCollection; - - virtual HRESULT STDMETHODCALLTYPE CreateFontCollectionFromFontSet( - IDWriteFontSet *fontset, - DWRITE_FONT_FAMILY_MODEL family_model, - IDWriteFontCollection2 **collection) = 0; - - using IDWriteFactory5::CreateFontCollectionFromFontSet; - - virtual HRESULT STDMETHODCALLTYPE CreateFontSetBuilder( - IDWriteFontSetBuilder2 **builder) = 0; - - using IDWriteFactory3::CreateFontSetBuilder; - using IDWriteFactory5::CreateFontSetBuilder; - - virtual HRESULT STDMETHODCALLTYPE CreateTextFormat( - const WCHAR *familyname, - IDWriteFontCollection *collection, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_axis, - FLOAT fontsize, - const WCHAR *localename, - IDWriteTextFormat3 **format) = 0; - - using IDWriteFactory::CreateTextFormat; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFactory6, 0xf3744d80, 0x21f7, 0x42eb, 0xb3,0x5d, 0x99,0x5b,0xc7,0x2f,0xc2,0x23) -#endif -#else -typedef struct IDWriteFactory6Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFactory6 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFactory6 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFactory6 *This); - - /*** IDWriteFactory methods ***/ - HRESULT (STDMETHODCALLTYPE *GetSystemFontCollection)( - IDWriteFactory6 *This, - IDWriteFontCollection **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *CreateCustomFontCollection)( - IDWriteFactory6 *This, - IDWriteFontCollectionLoader *loader, - const void *key, - UINT32 key_size, - IDWriteFontCollection **collection); - - HRESULT (STDMETHODCALLTYPE *RegisterFontCollectionLoader)( - IDWriteFactory6 *This, - IDWriteFontCollectionLoader *loader); - - HRESULT (STDMETHODCALLTYPE *UnregisterFontCollectionLoader)( - IDWriteFactory6 *This, - IDWriteFontCollectionLoader *loader); - - HRESULT (STDMETHODCALLTYPE *CreateFontFileReference)( - IDWriteFactory6 *This, - const WCHAR *path, - const FILETIME *writetime, - IDWriteFontFile **font_file); - - HRESULT (STDMETHODCALLTYPE *CreateCustomFontFileReference)( - IDWriteFactory6 *This, - const void *reference_key, - UINT32 key_size, - IDWriteFontFileLoader *loader, - IDWriteFontFile **font_file); - - HRESULT (STDMETHODCALLTYPE *CreateFontFace)( - IDWriteFactory6 *This, - DWRITE_FONT_FACE_TYPE facetype, - UINT32 files_number, - IDWriteFontFile *const *font_files, - UINT32 index, - DWRITE_FONT_SIMULATIONS sim_flags, - IDWriteFontFace **font_face); - - HRESULT (STDMETHODCALLTYPE *CreateRenderingParams)( - IDWriteFactory6 *This, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *CreateMonitorRenderingParams)( - IDWriteFactory6 *This, - HMONITOR monitor, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *CreateCustomRenderingParams)( - IDWriteFactory6 *This, - FLOAT gamma, - FLOAT enhancedContrast, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY geometry, - DWRITE_RENDERING_MODE mode, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *RegisterFontFileLoader)( - IDWriteFactory6 *This, - IDWriteFontFileLoader *loader); - - HRESULT (STDMETHODCALLTYPE *UnregisterFontFileLoader)( - IDWriteFactory6 *This, - IDWriteFontFileLoader *loader); - - HRESULT (STDMETHODCALLTYPE *CreateTextFormat)( - IDWriteFactory6 *This, - const WCHAR *family_name, - IDWriteFontCollection *collection, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STYLE style, - DWRITE_FONT_STRETCH stretch, - FLOAT size, - const WCHAR *locale, - IDWriteTextFormat **format); - - HRESULT (STDMETHODCALLTYPE *CreateTypography)( - IDWriteFactory6 *This, - IDWriteTypography **typography); - - HRESULT (STDMETHODCALLTYPE *GetGdiInterop)( - IDWriteFactory6 *This, - IDWriteGdiInterop **gdi_interop); - - HRESULT (STDMETHODCALLTYPE *CreateTextLayout)( - IDWriteFactory6 *This, - const WCHAR *string, - UINT32 len, - IDWriteTextFormat *format, - FLOAT max_width, - FLOAT max_height, - IDWriteTextLayout **layout); - - HRESULT (STDMETHODCALLTYPE *CreateGdiCompatibleTextLayout)( - IDWriteFactory6 *This, - const WCHAR *string, - UINT32 len, - IDWriteTextFormat *format, - FLOAT layout_width, - FLOAT layout_height, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - WINBOOL use_gdi_natural, - IDWriteTextLayout **layout); - - HRESULT (STDMETHODCALLTYPE *CreateEllipsisTrimmingSign)( - IDWriteFactory6 *This, - IDWriteTextFormat *format, - IDWriteInlineObject **trimming_sign); - - HRESULT (STDMETHODCALLTYPE *CreateTextAnalyzer)( - IDWriteFactory6 *This, - IDWriteTextAnalyzer **analyzer); - - HRESULT (STDMETHODCALLTYPE *CreateNumberSubstitution)( - IDWriteFactory6 *This, - DWRITE_NUMBER_SUBSTITUTION_METHOD method, - const WCHAR *locale, - WINBOOL ignore_user_override, - IDWriteNumberSubstitution **substitution); - - HRESULT (STDMETHODCALLTYPE *CreateGlyphRunAnalysis)( - IDWriteFactory6 *This, - const DWRITE_GLYPH_RUN *glyph_run, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE rendering_mode, - DWRITE_MEASURING_MODE measuring_mode, - FLOAT baseline_x, - FLOAT baseline_y, - IDWriteGlyphRunAnalysis **analysis); - - /*** IDWriteFactory1 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetEudcFontCollection)( - IDWriteFactory6 *This, - IDWriteFontCollection **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory1_CreateCustomRenderingParams)( - IDWriteFactory6 *This, - FLOAT gamma, - FLOAT enhcontrast, - FLOAT enhcontrast_grayscale, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY geometry, - DWRITE_RENDERING_MODE mode, - IDWriteRenderingParams1 **params); - - /*** IDWriteFactory2 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetSystemFontFallback)( - IDWriteFactory6 *This, - IDWriteFontFallback **fallback); - - HRESULT (STDMETHODCALLTYPE *CreateFontFallbackBuilder)( - IDWriteFactory6 *This, - IDWriteFontFallbackBuilder **fallbackbuilder); - - HRESULT (STDMETHODCALLTYPE *TranslateColorGlyphRun)( - IDWriteFactory6 *This, - FLOAT originX, - FLOAT originY, - const DWRITE_GLYPH_RUN *run, - const DWRITE_GLYPH_RUN_DESCRIPTION *rundescr, - DWRITE_MEASURING_MODE mode, - const DWRITE_MATRIX *transform, - UINT32 palette_index, - IDWriteColorGlyphRunEnumerator **colorlayers); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory2_CreateCustomRenderingParams)( - IDWriteFactory6 *This, - FLOAT gamma, - FLOAT contrast, - FLOAT grayscalecontrast, - FLOAT cleartypeLevel, - DWRITE_PIXEL_GEOMETRY pixelGeometry, - DWRITE_RENDERING_MODE renderingMode, - DWRITE_GRID_FIT_MODE gridFitMode, - IDWriteRenderingParams2 **params); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory2_CreateGlyphRunAnalysis)( - IDWriteFactory6 *This, - const DWRITE_GLYPH_RUN *run, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE renderingMode, - DWRITE_MEASURING_MODE measuringMode, - DWRITE_GRID_FIT_MODE gridFitMode, - DWRITE_TEXT_ANTIALIAS_MODE antialiasMode, - FLOAT originX, - FLOAT originY, - IDWriteGlyphRunAnalysis **analysis); - - /*** IDWriteFactory3 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_CreateGlyphRunAnalysis)( - IDWriteFactory6 *This, - const DWRITE_GLYPH_RUN *run, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE1 rendering_mode, - DWRITE_MEASURING_MODE measuring_mode, - DWRITE_GRID_FIT_MODE gridfit_mode, - DWRITE_TEXT_ANTIALIAS_MODE antialias_mode, - FLOAT origin_x, - FLOAT origin_y, - IDWriteGlyphRunAnalysis **analysis); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_CreateCustomRenderingParams)( - IDWriteFactory6 *This, - FLOAT gamma, - FLOAT enhanced_contrast, - FLOAT grayscale_enhanced_contrast, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY pixel_geometry, - DWRITE_RENDERING_MODE1 rendering_mode, - DWRITE_GRID_FIT_MODE gridfit_mode, - IDWriteRenderingParams3 **params); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceReference_)( - IDWriteFactory6 *This, - IDWriteFontFile *file, - UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceReference)( - IDWriteFactory6 *This, - const WCHAR *path, - const FILETIME *writetime, - UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *GetSystemFontSet)( - IDWriteFactory6 *This, - IDWriteFontSet **fontset); - - HRESULT (STDMETHODCALLTYPE *CreateFontSetBuilder)( - IDWriteFactory6 *This, - IDWriteFontSetBuilder **builder); - - HRESULT (STDMETHODCALLTYPE *CreateFontCollectionFromFontSet)( - IDWriteFactory6 *This, - IDWriteFontSet *fontset, - IDWriteFontCollection1 **collection); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_GetSystemFontCollection)( - IDWriteFactory6 *This, - WINBOOL include_downloadable, - IDWriteFontCollection1 **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *GetFontDownloadQueue)( - IDWriteFactory6 *This, - IDWriteFontDownloadQueue **queue); - - /*** IDWriteFactory4 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory4_TranslateColorGlyphRun)( - IDWriteFactory6 *This, - D2D1_POINT_2F baseline_origin, - const DWRITE_GLYPH_RUN *run, - const DWRITE_GLYPH_RUN_DESCRIPTION *run_desc, - DWRITE_GLYPH_IMAGE_FORMATS desired_formats, - DWRITE_MEASURING_MODE measuring_mode, - const DWRITE_MATRIX *transform, - UINT32 palette, - IDWriteColorGlyphRunEnumerator1 **layers); - - HRESULT (STDMETHODCALLTYPE *ComputeGlyphOrigins_)( - IDWriteFactory6 *This, - const DWRITE_GLYPH_RUN *run, - D2D1_POINT_2F baseline_origin, - D2D1_POINT_2F *origins); - - HRESULT (STDMETHODCALLTYPE *ComputeGlyphOrigins)( - IDWriteFactory6 *This, - const DWRITE_GLYPH_RUN *run, - DWRITE_MEASURING_MODE measuring_mode, - D2D1_POINT_2F baseline_origin, - const DWRITE_MATRIX *transform, - D2D1_POINT_2F *origins); - - /*** IDWriteFactory5 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory5_CreateFontSetBuilder)( - IDWriteFactory6 *This, - IDWriteFontSetBuilder1 **fontset_builder); - - HRESULT (STDMETHODCALLTYPE *CreateInMemoryFontFileLoader)( - IDWriteFactory6 *This, - IDWriteInMemoryFontFileLoader **loader); - - HRESULT (STDMETHODCALLTYPE *CreateHttpFontFileLoader)( - IDWriteFactory6 *This, - const WCHAR *referrer_url, - const WCHAR *extra_headers, - IDWriteRemoteFontFileLoader **loader); - - DWRITE_CONTAINER_TYPE (STDMETHODCALLTYPE *AnalyzeContainerType)( - IDWriteFactory6 *This, - const void *data, - UINT32 data_size); - - HRESULT (STDMETHODCALLTYPE *UnpackFontFile)( - IDWriteFactory6 *This, - DWRITE_CONTAINER_TYPE container_type, - const void *data, - UINT32 data_size, - IDWriteFontFileStream **stream); - - /*** IDWriteFactory6 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory6_CreateFontFaceReference)( - IDWriteFactory6 *This, - IDWriteFontFile *file, - UINT32 face_index, - DWRITE_FONT_SIMULATIONS simulations, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_axis, - IDWriteFontFaceReference1 **face_ref); - - HRESULT (STDMETHODCALLTYPE *CreateFontResource)( - IDWriteFactory6 *This, - IDWriteFontFile *file, - UINT32 face_index, - IDWriteFontResource **resource); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory6_GetSystemFontSet)( - IDWriteFactory6 *This, - WINBOOL include_downloadable, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory6_GetSystemFontCollection)( - IDWriteFactory6 *This, - WINBOOL include_downloadable, - DWRITE_FONT_FAMILY_MODEL family_model, - IDWriteFontCollection2 **collection); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory6_CreateFontCollectionFromFontSet)( - IDWriteFactory6 *This, - IDWriteFontSet *fontset, - DWRITE_FONT_FAMILY_MODEL family_model, - IDWriteFontCollection2 **collection); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory6_CreateFontSetBuilder)( - IDWriteFactory6 *This, - IDWriteFontSetBuilder2 **builder); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory6_CreateTextFormat)( - IDWriteFactory6 *This, - const WCHAR *familyname, - IDWriteFontCollection *collection, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_axis, - FLOAT fontsize, - const WCHAR *localename, - IDWriteTextFormat3 **format); - - END_INTERFACE -} IDWriteFactory6Vtbl; - -interface IDWriteFactory6 { - CONST_VTBL IDWriteFactory6Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFactory6_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFactory6_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFactory6_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFactory methods ***/ -#define IDWriteFactory6_CreateCustomFontCollection(This,loader,key,key_size,collection) (This)->lpVtbl->CreateCustomFontCollection(This,loader,key,key_size,collection) -#define IDWriteFactory6_RegisterFontCollectionLoader(This,loader) (This)->lpVtbl->RegisterFontCollectionLoader(This,loader) -#define IDWriteFactory6_UnregisterFontCollectionLoader(This,loader) (This)->lpVtbl->UnregisterFontCollectionLoader(This,loader) -#define IDWriteFactory6_CreateFontFileReference(This,path,writetime,font_file) (This)->lpVtbl->CreateFontFileReference(This,path,writetime,font_file) -#define IDWriteFactory6_CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file) (This)->lpVtbl->CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file) -#define IDWriteFactory6_CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face) (This)->lpVtbl->CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face) -#define IDWriteFactory6_CreateRenderingParams(This,params) (This)->lpVtbl->CreateRenderingParams(This,params) -#define IDWriteFactory6_CreateMonitorRenderingParams(This,monitor,params) (This)->lpVtbl->CreateMonitorRenderingParams(This,monitor,params) -#define IDWriteFactory6_RegisterFontFileLoader(This,loader) (This)->lpVtbl->RegisterFontFileLoader(This,loader) -#define IDWriteFactory6_UnregisterFontFileLoader(This,loader) (This)->lpVtbl->UnregisterFontFileLoader(This,loader) -#define IDWriteFactory6_CreateTypography(This,typography) (This)->lpVtbl->CreateTypography(This,typography) -#define IDWriteFactory6_GetGdiInterop(This,gdi_interop) (This)->lpVtbl->GetGdiInterop(This,gdi_interop) -#define IDWriteFactory6_CreateTextLayout(This,string,len,format,max_width,max_height,layout) (This)->lpVtbl->CreateTextLayout(This,string,len,format,max_width,max_height,layout) -#define IDWriteFactory6_CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout) (This)->lpVtbl->CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout) -#define IDWriteFactory6_CreateEllipsisTrimmingSign(This,format,trimming_sign) (This)->lpVtbl->CreateEllipsisTrimmingSign(This,format,trimming_sign) -#define IDWriteFactory6_CreateTextAnalyzer(This,analyzer) (This)->lpVtbl->CreateTextAnalyzer(This,analyzer) -#define IDWriteFactory6_CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution) (This)->lpVtbl->CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution) -/*** IDWriteFactory1 methods ***/ -#define IDWriteFactory6_GetEudcFontCollection(This,collection,check_for_updates) (This)->lpVtbl->GetEudcFontCollection(This,collection,check_for_updates) -/*** IDWriteFactory2 methods ***/ -#define IDWriteFactory6_GetSystemFontFallback(This,fallback) (This)->lpVtbl->GetSystemFontFallback(This,fallback) -#define IDWriteFactory6_CreateFontFallbackBuilder(This,fallbackbuilder) (This)->lpVtbl->CreateFontFallbackBuilder(This,fallbackbuilder) -/*** IDWriteFactory3 methods ***/ -#define IDWriteFactory6_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis) (This)->lpVtbl->IDWriteFactory3_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis) -#define IDWriteFactory6_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params) (This)->lpVtbl->IDWriteFactory3_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params) -#define IDWriteFactory6_CreateFontFaceReference_(This,file,index,simulations,reference) (This)->lpVtbl->CreateFontFaceReference_(This,file,index,simulations,reference) -#define IDWriteFactory6_GetFontDownloadQueue(This,queue) (This)->lpVtbl->GetFontDownloadQueue(This,queue) -/*** IDWriteFactory4 methods ***/ -#define IDWriteFactory6_TranslateColorGlyphRun(This,baseline_origin,run,run_desc,desired_formats,measuring_mode,transform,palette,layers) (This)->lpVtbl->IDWriteFactory4_TranslateColorGlyphRun(This,baseline_origin,run,run_desc,desired_formats,measuring_mode,transform,palette,layers) -#define IDWriteFactory6_ComputeGlyphOrigins_(This,run,baseline_origin,origins) (This)->lpVtbl->ComputeGlyphOrigins_(This,run,baseline_origin,origins) -#define IDWriteFactory6_ComputeGlyphOrigins(This,run,measuring_mode,baseline_origin,transform,origins) (This)->lpVtbl->ComputeGlyphOrigins(This,run,measuring_mode,baseline_origin,transform,origins) -/*** IDWriteFactory5 methods ***/ -#define IDWriteFactory6_CreateInMemoryFontFileLoader(This,loader) (This)->lpVtbl->CreateInMemoryFontFileLoader(This,loader) -#define IDWriteFactory6_CreateHttpFontFileLoader(This,referrer_url,extra_headers,loader) (This)->lpVtbl->CreateHttpFontFileLoader(This,referrer_url,extra_headers,loader) -#define IDWriteFactory6_AnalyzeContainerType(This,data,data_size) (This)->lpVtbl->AnalyzeContainerType(This,data,data_size) -#define IDWriteFactory6_UnpackFontFile(This,container_type,data,data_size,stream) (This)->lpVtbl->UnpackFontFile(This,container_type,data,data_size,stream) -/*** IDWriteFactory6 methods ***/ -#define IDWriteFactory6_CreateFontFaceReference(This,file,face_index,simulations,axis_values,num_axis,face_ref) (This)->lpVtbl->IDWriteFactory6_CreateFontFaceReference(This,file,face_index,simulations,axis_values,num_axis,face_ref) -#define IDWriteFactory6_CreateFontResource(This,file,face_index,resource) (This)->lpVtbl->CreateFontResource(This,file,face_index,resource) -#define IDWriteFactory6_GetSystemFontSet(This,include_downloadable,fontset) (This)->lpVtbl->IDWriteFactory6_GetSystemFontSet(This,include_downloadable,fontset) -#define IDWriteFactory6_GetSystemFontCollection(This,include_downloadable,family_model,collection) (This)->lpVtbl->IDWriteFactory6_GetSystemFontCollection(This,include_downloadable,family_model,collection) -#define IDWriteFactory6_CreateFontCollectionFromFontSet(This,fontset,family_model,collection) (This)->lpVtbl->IDWriteFactory6_CreateFontCollectionFromFontSet(This,fontset,family_model,collection) -#define IDWriteFactory6_CreateFontSetBuilder(This,builder) (This)->lpVtbl->IDWriteFactory6_CreateFontSetBuilder(This,builder) -#define IDWriteFactory6_CreateTextFormat(This,familyname,collection,axis_values,num_axis,fontsize,localename,format) (This)->lpVtbl->IDWriteFactory6_CreateTextFormat(This,familyname,collection,axis_values,num_axis,fontsize,localename,format) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFactory6_QueryInterface(IDWriteFactory6* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFactory6_AddRef(IDWriteFactory6* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFactory6_Release(IDWriteFactory6* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFactory methods ***/ -static FORCEINLINE HRESULT IDWriteFactory6_CreateCustomFontCollection(IDWriteFactory6* This,IDWriteFontCollectionLoader *loader,const void *key,UINT32 key_size,IDWriteFontCollection **collection) { - return This->lpVtbl->CreateCustomFontCollection(This,loader,key,key_size,collection); -} -static FORCEINLINE HRESULT IDWriteFactory6_RegisterFontCollectionLoader(IDWriteFactory6* This,IDWriteFontCollectionLoader *loader) { - return This->lpVtbl->RegisterFontCollectionLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory6_UnregisterFontCollectionLoader(IDWriteFactory6* This,IDWriteFontCollectionLoader *loader) { - return This->lpVtbl->UnregisterFontCollectionLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateFontFileReference(IDWriteFactory6* This,const WCHAR *path,const FILETIME *writetime,IDWriteFontFile **font_file) { - return This->lpVtbl->CreateFontFileReference(This,path,writetime,font_file); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateCustomFontFileReference(IDWriteFactory6* This,const void *reference_key,UINT32 key_size,IDWriteFontFileLoader *loader,IDWriteFontFile **font_file) { - return This->lpVtbl->CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateFontFace(IDWriteFactory6* This,DWRITE_FONT_FACE_TYPE facetype,UINT32 files_number,IDWriteFontFile *const *font_files,UINT32 index,DWRITE_FONT_SIMULATIONS sim_flags,IDWriteFontFace **font_face) { - return This->lpVtbl->CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateRenderingParams(IDWriteFactory6* This,IDWriteRenderingParams **params) { - return This->lpVtbl->CreateRenderingParams(This,params); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateMonitorRenderingParams(IDWriteFactory6* This,HMONITOR monitor,IDWriteRenderingParams **params) { - return This->lpVtbl->CreateMonitorRenderingParams(This,monitor,params); -} -static FORCEINLINE HRESULT IDWriteFactory6_RegisterFontFileLoader(IDWriteFactory6* This,IDWriteFontFileLoader *loader) { - return This->lpVtbl->RegisterFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory6_UnregisterFontFileLoader(IDWriteFactory6* This,IDWriteFontFileLoader *loader) { - return This->lpVtbl->UnregisterFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateTypography(IDWriteFactory6* This,IDWriteTypography **typography) { - return This->lpVtbl->CreateTypography(This,typography); -} -static FORCEINLINE HRESULT IDWriteFactory6_GetGdiInterop(IDWriteFactory6* This,IDWriteGdiInterop **gdi_interop) { - return This->lpVtbl->GetGdiInterop(This,gdi_interop); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateTextLayout(IDWriteFactory6* This,const WCHAR *string,UINT32 len,IDWriteTextFormat *format,FLOAT max_width,FLOAT max_height,IDWriteTextLayout **layout) { - return This->lpVtbl->CreateTextLayout(This,string,len,format,max_width,max_height,layout); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateGdiCompatibleTextLayout(IDWriteFactory6* This,const WCHAR *string,UINT32 len,IDWriteTextFormat *format,FLOAT layout_width,FLOAT layout_height,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,WINBOOL use_gdi_natural,IDWriteTextLayout **layout) { - return This->lpVtbl->CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateEllipsisTrimmingSign(IDWriteFactory6* This,IDWriteTextFormat *format,IDWriteInlineObject **trimming_sign) { - return This->lpVtbl->CreateEllipsisTrimmingSign(This,format,trimming_sign); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateTextAnalyzer(IDWriteFactory6* This,IDWriteTextAnalyzer **analyzer) { - return This->lpVtbl->CreateTextAnalyzer(This,analyzer); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateNumberSubstitution(IDWriteFactory6* This,DWRITE_NUMBER_SUBSTITUTION_METHOD method,const WCHAR *locale,WINBOOL ignore_user_override,IDWriteNumberSubstitution **substitution) { - return This->lpVtbl->CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution); -} -/*** IDWriteFactory1 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory6_GetEudcFontCollection(IDWriteFactory6* This,IDWriteFontCollection **collection,WINBOOL check_for_updates) { - return This->lpVtbl->GetEudcFontCollection(This,collection,check_for_updates); -} -/*** IDWriteFactory2 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory6_GetSystemFontFallback(IDWriteFactory6* This,IDWriteFontFallback **fallback) { - return This->lpVtbl->GetSystemFontFallback(This,fallback); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateFontFallbackBuilder(IDWriteFactory6* This,IDWriteFontFallbackBuilder **fallbackbuilder) { - return This->lpVtbl->CreateFontFallbackBuilder(This,fallbackbuilder); -} -/*** IDWriteFactory3 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory6_CreateGlyphRunAnalysis(IDWriteFactory6* This,const DWRITE_GLYPH_RUN *run,const DWRITE_MATRIX *transform,DWRITE_RENDERING_MODE1 rendering_mode,DWRITE_MEASURING_MODE measuring_mode,DWRITE_GRID_FIT_MODE gridfit_mode,DWRITE_TEXT_ANTIALIAS_MODE antialias_mode,FLOAT origin_x,FLOAT origin_y,IDWriteGlyphRunAnalysis **analysis) { - return This->lpVtbl->IDWriteFactory3_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateCustomRenderingParams(IDWriteFactory6* This,FLOAT gamma,FLOAT enhanced_contrast,FLOAT grayscale_enhanced_contrast,FLOAT cleartype_level,DWRITE_PIXEL_GEOMETRY pixel_geometry,DWRITE_RENDERING_MODE1 rendering_mode,DWRITE_GRID_FIT_MODE gridfit_mode,IDWriteRenderingParams3 **params) { - return This->lpVtbl->IDWriteFactory3_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateFontFaceReference_(IDWriteFactory6* This,IDWriteFontFile *file,UINT32 index,DWRITE_FONT_SIMULATIONS simulations,IDWriteFontFaceReference **reference) { - return This->lpVtbl->CreateFontFaceReference_(This,file,index,simulations,reference); -} -static FORCEINLINE HRESULT IDWriteFactory6_GetFontDownloadQueue(IDWriteFactory6* This,IDWriteFontDownloadQueue **queue) { - return This->lpVtbl->GetFontDownloadQueue(This,queue); -} -/*** IDWriteFactory4 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory6_TranslateColorGlyphRun(IDWriteFactory6* This,D2D1_POINT_2F baseline_origin,const DWRITE_GLYPH_RUN *run,const DWRITE_GLYPH_RUN_DESCRIPTION *run_desc,DWRITE_GLYPH_IMAGE_FORMATS desired_formats,DWRITE_MEASURING_MODE measuring_mode,const DWRITE_MATRIX *transform,UINT32 palette,IDWriteColorGlyphRunEnumerator1 **layers) { - return This->lpVtbl->IDWriteFactory4_TranslateColorGlyphRun(This,baseline_origin,run,run_desc,desired_formats,measuring_mode,transform,palette,layers); -} -static FORCEINLINE HRESULT IDWriteFactory6_ComputeGlyphOrigins_(IDWriteFactory6* This,const DWRITE_GLYPH_RUN *run,D2D1_POINT_2F baseline_origin,D2D1_POINT_2F *origins) { - return This->lpVtbl->ComputeGlyphOrigins_(This,run,baseline_origin,origins); -} -static FORCEINLINE HRESULT IDWriteFactory6_ComputeGlyphOrigins(IDWriteFactory6* This,const DWRITE_GLYPH_RUN *run,DWRITE_MEASURING_MODE measuring_mode,D2D1_POINT_2F baseline_origin,const DWRITE_MATRIX *transform,D2D1_POINT_2F *origins) { - return This->lpVtbl->ComputeGlyphOrigins(This,run,measuring_mode,baseline_origin,transform,origins); -} -/*** IDWriteFactory5 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory6_CreateInMemoryFontFileLoader(IDWriteFactory6* This,IDWriteInMemoryFontFileLoader **loader) { - return This->lpVtbl->CreateInMemoryFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateHttpFontFileLoader(IDWriteFactory6* This,const WCHAR *referrer_url,const WCHAR *extra_headers,IDWriteRemoteFontFileLoader **loader) { - return This->lpVtbl->CreateHttpFontFileLoader(This,referrer_url,extra_headers,loader); -} -static FORCEINLINE DWRITE_CONTAINER_TYPE IDWriteFactory6_AnalyzeContainerType(IDWriteFactory6* This,const void *data,UINT32 data_size) { - return This->lpVtbl->AnalyzeContainerType(This,data,data_size); -} -static FORCEINLINE HRESULT IDWriteFactory6_UnpackFontFile(IDWriteFactory6* This,DWRITE_CONTAINER_TYPE container_type,const void *data,UINT32 data_size,IDWriteFontFileStream **stream) { - return This->lpVtbl->UnpackFontFile(This,container_type,data,data_size,stream); -} -/*** IDWriteFactory6 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory6_CreateFontFaceReference(IDWriteFactory6* This,IDWriteFontFile *file,UINT32 face_index,DWRITE_FONT_SIMULATIONS simulations,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_axis,IDWriteFontFaceReference1 **face_ref) { - return This->lpVtbl->IDWriteFactory6_CreateFontFaceReference(This,file,face_index,simulations,axis_values,num_axis,face_ref); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateFontResource(IDWriteFactory6* This,IDWriteFontFile *file,UINT32 face_index,IDWriteFontResource **resource) { - return This->lpVtbl->CreateFontResource(This,file,face_index,resource); -} -static FORCEINLINE HRESULT IDWriteFactory6_GetSystemFontSet(IDWriteFactory6* This,WINBOOL include_downloadable,IDWriteFontSet1 **fontset) { - return This->lpVtbl->IDWriteFactory6_GetSystemFontSet(This,include_downloadable,fontset); -} -static FORCEINLINE HRESULT IDWriteFactory6_GetSystemFontCollection(IDWriteFactory6* This,WINBOOL include_downloadable,DWRITE_FONT_FAMILY_MODEL family_model,IDWriteFontCollection2 **collection) { - return This->lpVtbl->IDWriteFactory6_GetSystemFontCollection(This,include_downloadable,family_model,collection); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateFontCollectionFromFontSet(IDWriteFactory6* This,IDWriteFontSet *fontset,DWRITE_FONT_FAMILY_MODEL family_model,IDWriteFontCollection2 **collection) { - return This->lpVtbl->IDWriteFactory6_CreateFontCollectionFromFontSet(This,fontset,family_model,collection); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateFontSetBuilder(IDWriteFactory6* This,IDWriteFontSetBuilder2 **builder) { - return This->lpVtbl->IDWriteFactory6_CreateFontSetBuilder(This,builder); -} -static FORCEINLINE HRESULT IDWriteFactory6_CreateTextFormat(IDWriteFactory6* This,const WCHAR *familyname,IDWriteFontCollection *collection,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_axis,FLOAT fontsize,const WCHAR *localename,IDWriteTextFormat3 **format) { - return This->lpVtbl->IDWriteFactory6_CreateTextFormat(This,familyname,collection,axis_values,num_axis,fontsize,localename,format); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFactory6_INTERFACE_DEFINED__ */ - -/***************************************************************************** - * IDWriteFactory7 interface - */ -#ifndef __IDWriteFactory7_INTERFACE_DEFINED__ -#define __IDWriteFactory7_INTERFACE_DEFINED__ - -DEFINE_GUID(IID_IDWriteFactory7, 0x35d0e0b3, 0x9076, 0x4d2e, 0xa0,0x16, 0xa9,0x1b,0x56,0x8a,0x06,0xb4); -#if defined(__cplusplus) && !defined(CINTERFACE) -MIDL_INTERFACE("35d0e0b3-9076-4d2e-a016-a91b568a06b4") -IDWriteFactory7 : public IDWriteFactory6 -{ - virtual HRESULT STDMETHODCALLTYPE GetSystemFontSet( - WINBOOL include_downloadable, - IDWriteFontSet2 **fontset) = 0; - - using IDWriteFactory6::GetSystemFontSet; - - virtual HRESULT STDMETHODCALLTYPE GetSystemFontCollection( - WINBOOL include_downloadable, - DWRITE_FONT_FAMILY_MODEL family_model, - IDWriteFontCollection3 **collection) = 0; - - using IDWriteFactory6::GetSystemFontCollection; - -}; -#ifdef __CRT_UUID_DECL -__CRT_UUID_DECL(IDWriteFactory7, 0x35d0e0b3, 0x9076, 0x4d2e, 0xa0,0x16, 0xa9,0x1b,0x56,0x8a,0x06,0xb4) -#endif -#else -typedef struct IDWriteFactory7Vtbl { - BEGIN_INTERFACE - - /*** IUnknown methods ***/ - HRESULT (STDMETHODCALLTYPE *QueryInterface)( - IDWriteFactory7 *This, - REFIID riid, - void **ppvObject); - - ULONG (STDMETHODCALLTYPE *AddRef)( - IDWriteFactory7 *This); - - ULONG (STDMETHODCALLTYPE *Release)( - IDWriteFactory7 *This); - - /*** IDWriteFactory methods ***/ - HRESULT (STDMETHODCALLTYPE *GetSystemFontCollection)( - IDWriteFactory7 *This, - IDWriteFontCollection **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *CreateCustomFontCollection)( - IDWriteFactory7 *This, - IDWriteFontCollectionLoader *loader, - const void *key, - UINT32 key_size, - IDWriteFontCollection **collection); - - HRESULT (STDMETHODCALLTYPE *RegisterFontCollectionLoader)( - IDWriteFactory7 *This, - IDWriteFontCollectionLoader *loader); - - HRESULT (STDMETHODCALLTYPE *UnregisterFontCollectionLoader)( - IDWriteFactory7 *This, - IDWriteFontCollectionLoader *loader); - - HRESULT (STDMETHODCALLTYPE *CreateFontFileReference)( - IDWriteFactory7 *This, - const WCHAR *path, - const FILETIME *writetime, - IDWriteFontFile **font_file); - - HRESULT (STDMETHODCALLTYPE *CreateCustomFontFileReference)( - IDWriteFactory7 *This, - const void *reference_key, - UINT32 key_size, - IDWriteFontFileLoader *loader, - IDWriteFontFile **font_file); - - HRESULT (STDMETHODCALLTYPE *CreateFontFace)( - IDWriteFactory7 *This, - DWRITE_FONT_FACE_TYPE facetype, - UINT32 files_number, - IDWriteFontFile *const *font_files, - UINT32 index, - DWRITE_FONT_SIMULATIONS sim_flags, - IDWriteFontFace **font_face); - - HRESULT (STDMETHODCALLTYPE *CreateRenderingParams)( - IDWriteFactory7 *This, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *CreateMonitorRenderingParams)( - IDWriteFactory7 *This, - HMONITOR monitor, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *CreateCustomRenderingParams)( - IDWriteFactory7 *This, - FLOAT gamma, - FLOAT enhancedContrast, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY geometry, - DWRITE_RENDERING_MODE mode, - IDWriteRenderingParams **params); - - HRESULT (STDMETHODCALLTYPE *RegisterFontFileLoader)( - IDWriteFactory7 *This, - IDWriteFontFileLoader *loader); - - HRESULT (STDMETHODCALLTYPE *UnregisterFontFileLoader)( - IDWriteFactory7 *This, - IDWriteFontFileLoader *loader); - - HRESULT (STDMETHODCALLTYPE *CreateTextFormat)( - IDWriteFactory7 *This, - const WCHAR *family_name, - IDWriteFontCollection *collection, - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STYLE style, - DWRITE_FONT_STRETCH stretch, - FLOAT size, - const WCHAR *locale, - IDWriteTextFormat **format); - - HRESULT (STDMETHODCALLTYPE *CreateTypography)( - IDWriteFactory7 *This, - IDWriteTypography **typography); - - HRESULT (STDMETHODCALLTYPE *GetGdiInterop)( - IDWriteFactory7 *This, - IDWriteGdiInterop **gdi_interop); - - HRESULT (STDMETHODCALLTYPE *CreateTextLayout)( - IDWriteFactory7 *This, - const WCHAR *string, - UINT32 len, - IDWriteTextFormat *format, - FLOAT max_width, - FLOAT max_height, - IDWriteTextLayout **layout); - - HRESULT (STDMETHODCALLTYPE *CreateGdiCompatibleTextLayout)( - IDWriteFactory7 *This, - const WCHAR *string, - UINT32 len, - IDWriteTextFormat *format, - FLOAT layout_width, - FLOAT layout_height, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - WINBOOL use_gdi_natural, - IDWriteTextLayout **layout); - - HRESULT (STDMETHODCALLTYPE *CreateEllipsisTrimmingSign)( - IDWriteFactory7 *This, - IDWriteTextFormat *format, - IDWriteInlineObject **trimming_sign); - - HRESULT (STDMETHODCALLTYPE *CreateTextAnalyzer)( - IDWriteFactory7 *This, - IDWriteTextAnalyzer **analyzer); - - HRESULT (STDMETHODCALLTYPE *CreateNumberSubstitution)( - IDWriteFactory7 *This, - DWRITE_NUMBER_SUBSTITUTION_METHOD method, - const WCHAR *locale, - WINBOOL ignore_user_override, - IDWriteNumberSubstitution **substitution); - - HRESULT (STDMETHODCALLTYPE *CreateGlyphRunAnalysis)( - IDWriteFactory7 *This, - const DWRITE_GLYPH_RUN *glyph_run, - FLOAT pixels_per_dip, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE rendering_mode, - DWRITE_MEASURING_MODE measuring_mode, - FLOAT baseline_x, - FLOAT baseline_y, - IDWriteGlyphRunAnalysis **analysis); - - /*** IDWriteFactory1 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetEudcFontCollection)( - IDWriteFactory7 *This, - IDWriteFontCollection **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory1_CreateCustomRenderingParams)( - IDWriteFactory7 *This, - FLOAT gamma, - FLOAT enhcontrast, - FLOAT enhcontrast_grayscale, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY geometry, - DWRITE_RENDERING_MODE mode, - IDWriteRenderingParams1 **params); - - /*** IDWriteFactory2 methods ***/ - HRESULT (STDMETHODCALLTYPE *GetSystemFontFallback)( - IDWriteFactory7 *This, - IDWriteFontFallback **fallback); - - HRESULT (STDMETHODCALLTYPE *CreateFontFallbackBuilder)( - IDWriteFactory7 *This, - IDWriteFontFallbackBuilder **fallbackbuilder); - - HRESULT (STDMETHODCALLTYPE *TranslateColorGlyphRun)( - IDWriteFactory7 *This, - FLOAT originX, - FLOAT originY, - const DWRITE_GLYPH_RUN *run, - const DWRITE_GLYPH_RUN_DESCRIPTION *rundescr, - DWRITE_MEASURING_MODE mode, - const DWRITE_MATRIX *transform, - UINT32 palette_index, - IDWriteColorGlyphRunEnumerator **colorlayers); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory2_CreateCustomRenderingParams)( - IDWriteFactory7 *This, - FLOAT gamma, - FLOAT contrast, - FLOAT grayscalecontrast, - FLOAT cleartypeLevel, - DWRITE_PIXEL_GEOMETRY pixelGeometry, - DWRITE_RENDERING_MODE renderingMode, - DWRITE_GRID_FIT_MODE gridFitMode, - IDWriteRenderingParams2 **params); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory2_CreateGlyphRunAnalysis)( - IDWriteFactory7 *This, - const DWRITE_GLYPH_RUN *run, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE renderingMode, - DWRITE_MEASURING_MODE measuringMode, - DWRITE_GRID_FIT_MODE gridFitMode, - DWRITE_TEXT_ANTIALIAS_MODE antialiasMode, - FLOAT originX, - FLOAT originY, - IDWriteGlyphRunAnalysis **analysis); - - /*** IDWriteFactory3 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_CreateGlyphRunAnalysis)( - IDWriteFactory7 *This, - const DWRITE_GLYPH_RUN *run, - const DWRITE_MATRIX *transform, - DWRITE_RENDERING_MODE1 rendering_mode, - DWRITE_MEASURING_MODE measuring_mode, - DWRITE_GRID_FIT_MODE gridfit_mode, - DWRITE_TEXT_ANTIALIAS_MODE antialias_mode, - FLOAT origin_x, - FLOAT origin_y, - IDWriteGlyphRunAnalysis **analysis); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_CreateCustomRenderingParams)( - IDWriteFactory7 *This, - FLOAT gamma, - FLOAT enhanced_contrast, - FLOAT grayscale_enhanced_contrast, - FLOAT cleartype_level, - DWRITE_PIXEL_GEOMETRY pixel_geometry, - DWRITE_RENDERING_MODE1 rendering_mode, - DWRITE_GRID_FIT_MODE gridfit_mode, - IDWriteRenderingParams3 **params); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceReference_)( - IDWriteFactory7 *This, - IDWriteFontFile *file, - UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *CreateFontFaceReference)( - IDWriteFactory7 *This, - const WCHAR *path, - const FILETIME *writetime, - UINT32 index, - DWRITE_FONT_SIMULATIONS simulations, - IDWriteFontFaceReference **reference); - - HRESULT (STDMETHODCALLTYPE *GetSystemFontSet)( - IDWriteFactory7 *This, - IDWriteFontSet **fontset); - - HRESULT (STDMETHODCALLTYPE *CreateFontSetBuilder)( - IDWriteFactory7 *This, - IDWriteFontSetBuilder **builder); - - HRESULT (STDMETHODCALLTYPE *CreateFontCollectionFromFontSet)( - IDWriteFactory7 *This, - IDWriteFontSet *fontset, - IDWriteFontCollection1 **collection); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory3_GetSystemFontCollection)( - IDWriteFactory7 *This, - WINBOOL include_downloadable, - IDWriteFontCollection1 **collection, - WINBOOL check_for_updates); - - HRESULT (STDMETHODCALLTYPE *GetFontDownloadQueue)( - IDWriteFactory7 *This, - IDWriteFontDownloadQueue **queue); - - /*** IDWriteFactory4 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory4_TranslateColorGlyphRun)( - IDWriteFactory7 *This, - D2D1_POINT_2F baseline_origin, - const DWRITE_GLYPH_RUN *run, - const DWRITE_GLYPH_RUN_DESCRIPTION *run_desc, - DWRITE_GLYPH_IMAGE_FORMATS desired_formats, - DWRITE_MEASURING_MODE measuring_mode, - const DWRITE_MATRIX *transform, - UINT32 palette, - IDWriteColorGlyphRunEnumerator1 **layers); - - HRESULT (STDMETHODCALLTYPE *ComputeGlyphOrigins_)( - IDWriteFactory7 *This, - const DWRITE_GLYPH_RUN *run, - D2D1_POINT_2F baseline_origin, - D2D1_POINT_2F *origins); - - HRESULT (STDMETHODCALLTYPE *ComputeGlyphOrigins)( - IDWriteFactory7 *This, - const DWRITE_GLYPH_RUN *run, - DWRITE_MEASURING_MODE measuring_mode, - D2D1_POINT_2F baseline_origin, - const DWRITE_MATRIX *transform, - D2D1_POINT_2F *origins); - - /*** IDWriteFactory5 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory5_CreateFontSetBuilder)( - IDWriteFactory7 *This, - IDWriteFontSetBuilder1 **fontset_builder); - - HRESULT (STDMETHODCALLTYPE *CreateInMemoryFontFileLoader)( - IDWriteFactory7 *This, - IDWriteInMemoryFontFileLoader **loader); - - HRESULT (STDMETHODCALLTYPE *CreateHttpFontFileLoader)( - IDWriteFactory7 *This, - const WCHAR *referrer_url, - const WCHAR *extra_headers, - IDWriteRemoteFontFileLoader **loader); - - DWRITE_CONTAINER_TYPE (STDMETHODCALLTYPE *AnalyzeContainerType)( - IDWriteFactory7 *This, - const void *data, - UINT32 data_size); - - HRESULT (STDMETHODCALLTYPE *UnpackFontFile)( - IDWriteFactory7 *This, - DWRITE_CONTAINER_TYPE container_type, - const void *data, - UINT32 data_size, - IDWriteFontFileStream **stream); - - /*** IDWriteFactory6 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory6_CreateFontFaceReference)( - IDWriteFactory7 *This, - IDWriteFontFile *file, - UINT32 face_index, - DWRITE_FONT_SIMULATIONS simulations, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_axis, - IDWriteFontFaceReference1 **face_ref); - - HRESULT (STDMETHODCALLTYPE *CreateFontResource)( - IDWriteFactory7 *This, - IDWriteFontFile *file, - UINT32 face_index, - IDWriteFontResource **resource); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory6_GetSystemFontSet)( - IDWriteFactory7 *This, - WINBOOL include_downloadable, - IDWriteFontSet1 **fontset); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory6_GetSystemFontCollection)( - IDWriteFactory7 *This, - WINBOOL include_downloadable, - DWRITE_FONT_FAMILY_MODEL family_model, - IDWriteFontCollection2 **collection); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory6_CreateFontCollectionFromFontSet)( - IDWriteFactory7 *This, - IDWriteFontSet *fontset, - DWRITE_FONT_FAMILY_MODEL family_model, - IDWriteFontCollection2 **collection); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory6_CreateFontSetBuilder)( - IDWriteFactory7 *This, - IDWriteFontSetBuilder2 **builder); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory6_CreateTextFormat)( - IDWriteFactory7 *This, - const WCHAR *familyname, - IDWriteFontCollection *collection, - const DWRITE_FONT_AXIS_VALUE *axis_values, - UINT32 num_axis, - FLOAT fontsize, - const WCHAR *localename, - IDWriteTextFormat3 **format); - - /*** IDWriteFactory7 methods ***/ - HRESULT (STDMETHODCALLTYPE *IDWriteFactory7_GetSystemFontSet)( - IDWriteFactory7 *This, - WINBOOL include_downloadable, - IDWriteFontSet2 **fontset); - - HRESULT (STDMETHODCALLTYPE *IDWriteFactory7_GetSystemFontCollection)( - IDWriteFactory7 *This, - WINBOOL include_downloadable, - DWRITE_FONT_FAMILY_MODEL family_model, - IDWriteFontCollection3 **collection); - - END_INTERFACE -} IDWriteFactory7Vtbl; - -interface IDWriteFactory7 { - CONST_VTBL IDWriteFactory7Vtbl* lpVtbl; -}; - -#ifdef COBJMACROS -#ifndef WIDL_C_INLINE_WRAPPERS -/*** IUnknown methods ***/ -#define IDWriteFactory7_QueryInterface(This,riid,ppvObject) (This)->lpVtbl->QueryInterface(This,riid,ppvObject) -#define IDWriteFactory7_AddRef(This) (This)->lpVtbl->AddRef(This) -#define IDWriteFactory7_Release(This) (This)->lpVtbl->Release(This) -/*** IDWriteFactory methods ***/ -#define IDWriteFactory7_CreateCustomFontCollection(This,loader,key,key_size,collection) (This)->lpVtbl->CreateCustomFontCollection(This,loader,key,key_size,collection) -#define IDWriteFactory7_RegisterFontCollectionLoader(This,loader) (This)->lpVtbl->RegisterFontCollectionLoader(This,loader) -#define IDWriteFactory7_UnregisterFontCollectionLoader(This,loader) (This)->lpVtbl->UnregisterFontCollectionLoader(This,loader) -#define IDWriteFactory7_CreateFontFileReference(This,path,writetime,font_file) (This)->lpVtbl->CreateFontFileReference(This,path,writetime,font_file) -#define IDWriteFactory7_CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file) (This)->lpVtbl->CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file) -#define IDWriteFactory7_CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face) (This)->lpVtbl->CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face) -#define IDWriteFactory7_CreateRenderingParams(This,params) (This)->lpVtbl->CreateRenderingParams(This,params) -#define IDWriteFactory7_CreateMonitorRenderingParams(This,monitor,params) (This)->lpVtbl->CreateMonitorRenderingParams(This,monitor,params) -#define IDWriteFactory7_RegisterFontFileLoader(This,loader) (This)->lpVtbl->RegisterFontFileLoader(This,loader) -#define IDWriteFactory7_UnregisterFontFileLoader(This,loader) (This)->lpVtbl->UnregisterFontFileLoader(This,loader) -#define IDWriteFactory7_CreateTypography(This,typography) (This)->lpVtbl->CreateTypography(This,typography) -#define IDWriteFactory7_GetGdiInterop(This,gdi_interop) (This)->lpVtbl->GetGdiInterop(This,gdi_interop) -#define IDWriteFactory7_CreateTextLayout(This,string,len,format,max_width,max_height,layout) (This)->lpVtbl->CreateTextLayout(This,string,len,format,max_width,max_height,layout) -#define IDWriteFactory7_CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout) (This)->lpVtbl->CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout) -#define IDWriteFactory7_CreateEllipsisTrimmingSign(This,format,trimming_sign) (This)->lpVtbl->CreateEllipsisTrimmingSign(This,format,trimming_sign) -#define IDWriteFactory7_CreateTextAnalyzer(This,analyzer) (This)->lpVtbl->CreateTextAnalyzer(This,analyzer) -#define IDWriteFactory7_CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution) (This)->lpVtbl->CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution) -/*** IDWriteFactory1 methods ***/ -#define IDWriteFactory7_GetEudcFontCollection(This,collection,check_for_updates) (This)->lpVtbl->GetEudcFontCollection(This,collection,check_for_updates) -/*** IDWriteFactory2 methods ***/ -#define IDWriteFactory7_GetSystemFontFallback(This,fallback) (This)->lpVtbl->GetSystemFontFallback(This,fallback) -#define IDWriteFactory7_CreateFontFallbackBuilder(This,fallbackbuilder) (This)->lpVtbl->CreateFontFallbackBuilder(This,fallbackbuilder) -/*** IDWriteFactory3 methods ***/ -#define IDWriteFactory7_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis) (This)->lpVtbl->IDWriteFactory3_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis) -#define IDWriteFactory7_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params) (This)->lpVtbl->IDWriteFactory3_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params) -#define IDWriteFactory7_CreateFontFaceReference_(This,file,index,simulations,reference) (This)->lpVtbl->CreateFontFaceReference_(This,file,index,simulations,reference) -#define IDWriteFactory7_GetFontDownloadQueue(This,queue) (This)->lpVtbl->GetFontDownloadQueue(This,queue) -/*** IDWriteFactory4 methods ***/ -#define IDWriteFactory7_TranslateColorGlyphRun(This,baseline_origin,run,run_desc,desired_formats,measuring_mode,transform,palette,layers) (This)->lpVtbl->IDWriteFactory4_TranslateColorGlyphRun(This,baseline_origin,run,run_desc,desired_formats,measuring_mode,transform,palette,layers) -#define IDWriteFactory7_ComputeGlyphOrigins_(This,run,baseline_origin,origins) (This)->lpVtbl->ComputeGlyphOrigins_(This,run,baseline_origin,origins) -#define IDWriteFactory7_ComputeGlyphOrigins(This,run,measuring_mode,baseline_origin,transform,origins) (This)->lpVtbl->ComputeGlyphOrigins(This,run,measuring_mode,baseline_origin,transform,origins) -/*** IDWriteFactory5 methods ***/ -#define IDWriteFactory7_CreateInMemoryFontFileLoader(This,loader) (This)->lpVtbl->CreateInMemoryFontFileLoader(This,loader) -#define IDWriteFactory7_CreateHttpFontFileLoader(This,referrer_url,extra_headers,loader) (This)->lpVtbl->CreateHttpFontFileLoader(This,referrer_url,extra_headers,loader) -#define IDWriteFactory7_AnalyzeContainerType(This,data,data_size) (This)->lpVtbl->AnalyzeContainerType(This,data,data_size) -#define IDWriteFactory7_UnpackFontFile(This,container_type,data,data_size,stream) (This)->lpVtbl->UnpackFontFile(This,container_type,data,data_size,stream) -/*** IDWriteFactory6 methods ***/ -#define IDWriteFactory7_CreateFontFaceReference(This,file,face_index,simulations,axis_values,num_axis,face_ref) (This)->lpVtbl->IDWriteFactory6_CreateFontFaceReference(This,file,face_index,simulations,axis_values,num_axis,face_ref) -#define IDWriteFactory7_CreateFontResource(This,file,face_index,resource) (This)->lpVtbl->CreateFontResource(This,file,face_index,resource) -#define IDWriteFactory7_CreateFontCollectionFromFontSet(This,fontset,family_model,collection) (This)->lpVtbl->IDWriteFactory6_CreateFontCollectionFromFontSet(This,fontset,family_model,collection) -#define IDWriteFactory7_CreateFontSetBuilder(This,builder) (This)->lpVtbl->IDWriteFactory6_CreateFontSetBuilder(This,builder) -#define IDWriteFactory7_CreateTextFormat(This,familyname,collection,axis_values,num_axis,fontsize,localename,format) (This)->lpVtbl->IDWriteFactory6_CreateTextFormat(This,familyname,collection,axis_values,num_axis,fontsize,localename,format) -/*** IDWriteFactory7 methods ***/ -#define IDWriteFactory7_GetSystemFontSet(This,include_downloadable,fontset) (This)->lpVtbl->IDWriteFactory7_GetSystemFontSet(This,include_downloadable,fontset) -#define IDWriteFactory7_GetSystemFontCollection(This,include_downloadable,family_model,collection) (This)->lpVtbl->IDWriteFactory7_GetSystemFontCollection(This,include_downloadable,family_model,collection) -#else -/*** IUnknown methods ***/ -static FORCEINLINE HRESULT IDWriteFactory7_QueryInterface(IDWriteFactory7* This,REFIID riid,void **ppvObject) { - return This->lpVtbl->QueryInterface(This,riid,ppvObject); -} -static FORCEINLINE ULONG IDWriteFactory7_AddRef(IDWriteFactory7* This) { - return This->lpVtbl->AddRef(This); -} -static FORCEINLINE ULONG IDWriteFactory7_Release(IDWriteFactory7* This) { - return This->lpVtbl->Release(This); -} -/*** IDWriteFactory methods ***/ -static FORCEINLINE HRESULT IDWriteFactory7_CreateCustomFontCollection(IDWriteFactory7* This,IDWriteFontCollectionLoader *loader,const void *key,UINT32 key_size,IDWriteFontCollection **collection) { - return This->lpVtbl->CreateCustomFontCollection(This,loader,key,key_size,collection); -} -static FORCEINLINE HRESULT IDWriteFactory7_RegisterFontCollectionLoader(IDWriteFactory7* This,IDWriteFontCollectionLoader *loader) { - return This->lpVtbl->RegisterFontCollectionLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory7_UnregisterFontCollectionLoader(IDWriteFactory7* This,IDWriteFontCollectionLoader *loader) { - return This->lpVtbl->UnregisterFontCollectionLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateFontFileReference(IDWriteFactory7* This,const WCHAR *path,const FILETIME *writetime,IDWriteFontFile **font_file) { - return This->lpVtbl->CreateFontFileReference(This,path,writetime,font_file); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateCustomFontFileReference(IDWriteFactory7* This,const void *reference_key,UINT32 key_size,IDWriteFontFileLoader *loader,IDWriteFontFile **font_file) { - return This->lpVtbl->CreateCustomFontFileReference(This,reference_key,key_size,loader,font_file); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateFontFace(IDWriteFactory7* This,DWRITE_FONT_FACE_TYPE facetype,UINT32 files_number,IDWriteFontFile *const *font_files,UINT32 index,DWRITE_FONT_SIMULATIONS sim_flags,IDWriteFontFace **font_face) { - return This->lpVtbl->CreateFontFace(This,facetype,files_number,font_files,index,sim_flags,font_face); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateRenderingParams(IDWriteFactory7* This,IDWriteRenderingParams **params) { - return This->lpVtbl->CreateRenderingParams(This,params); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateMonitorRenderingParams(IDWriteFactory7* This,HMONITOR monitor,IDWriteRenderingParams **params) { - return This->lpVtbl->CreateMonitorRenderingParams(This,monitor,params); -} -static FORCEINLINE HRESULT IDWriteFactory7_RegisterFontFileLoader(IDWriteFactory7* This,IDWriteFontFileLoader *loader) { - return This->lpVtbl->RegisterFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory7_UnregisterFontFileLoader(IDWriteFactory7* This,IDWriteFontFileLoader *loader) { - return This->lpVtbl->UnregisterFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateTypography(IDWriteFactory7* This,IDWriteTypography **typography) { - return This->lpVtbl->CreateTypography(This,typography); -} -static FORCEINLINE HRESULT IDWriteFactory7_GetGdiInterop(IDWriteFactory7* This,IDWriteGdiInterop **gdi_interop) { - return This->lpVtbl->GetGdiInterop(This,gdi_interop); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateTextLayout(IDWriteFactory7* This,const WCHAR *string,UINT32 len,IDWriteTextFormat *format,FLOAT max_width,FLOAT max_height,IDWriteTextLayout **layout) { - return This->lpVtbl->CreateTextLayout(This,string,len,format,max_width,max_height,layout); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateGdiCompatibleTextLayout(IDWriteFactory7* This,const WCHAR *string,UINT32 len,IDWriteTextFormat *format,FLOAT layout_width,FLOAT layout_height,FLOAT pixels_per_dip,const DWRITE_MATRIX *transform,WINBOOL use_gdi_natural,IDWriteTextLayout **layout) { - return This->lpVtbl->CreateGdiCompatibleTextLayout(This,string,len,format,layout_width,layout_height,pixels_per_dip,transform,use_gdi_natural,layout); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateEllipsisTrimmingSign(IDWriteFactory7* This,IDWriteTextFormat *format,IDWriteInlineObject **trimming_sign) { - return This->lpVtbl->CreateEllipsisTrimmingSign(This,format,trimming_sign); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateTextAnalyzer(IDWriteFactory7* This,IDWriteTextAnalyzer **analyzer) { - return This->lpVtbl->CreateTextAnalyzer(This,analyzer); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateNumberSubstitution(IDWriteFactory7* This,DWRITE_NUMBER_SUBSTITUTION_METHOD method,const WCHAR *locale,WINBOOL ignore_user_override,IDWriteNumberSubstitution **substitution) { - return This->lpVtbl->CreateNumberSubstitution(This,method,locale,ignore_user_override,substitution); -} -/*** IDWriteFactory1 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory7_GetEudcFontCollection(IDWriteFactory7* This,IDWriteFontCollection **collection,WINBOOL check_for_updates) { - return This->lpVtbl->GetEudcFontCollection(This,collection,check_for_updates); -} -/*** IDWriteFactory2 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory7_GetSystemFontFallback(IDWriteFactory7* This,IDWriteFontFallback **fallback) { - return This->lpVtbl->GetSystemFontFallback(This,fallback); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateFontFallbackBuilder(IDWriteFactory7* This,IDWriteFontFallbackBuilder **fallbackbuilder) { - return This->lpVtbl->CreateFontFallbackBuilder(This,fallbackbuilder); -} -/*** IDWriteFactory3 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory7_CreateGlyphRunAnalysis(IDWriteFactory7* This,const DWRITE_GLYPH_RUN *run,const DWRITE_MATRIX *transform,DWRITE_RENDERING_MODE1 rendering_mode,DWRITE_MEASURING_MODE measuring_mode,DWRITE_GRID_FIT_MODE gridfit_mode,DWRITE_TEXT_ANTIALIAS_MODE antialias_mode,FLOAT origin_x,FLOAT origin_y,IDWriteGlyphRunAnalysis **analysis) { - return This->lpVtbl->IDWriteFactory3_CreateGlyphRunAnalysis(This,run,transform,rendering_mode,measuring_mode,gridfit_mode,antialias_mode,origin_x,origin_y,analysis); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateCustomRenderingParams(IDWriteFactory7* This,FLOAT gamma,FLOAT enhanced_contrast,FLOAT grayscale_enhanced_contrast,FLOAT cleartype_level,DWRITE_PIXEL_GEOMETRY pixel_geometry,DWRITE_RENDERING_MODE1 rendering_mode,DWRITE_GRID_FIT_MODE gridfit_mode,IDWriteRenderingParams3 **params) { - return This->lpVtbl->IDWriteFactory3_CreateCustomRenderingParams(This,gamma,enhanced_contrast,grayscale_enhanced_contrast,cleartype_level,pixel_geometry,rendering_mode,gridfit_mode,params); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateFontFaceReference_(IDWriteFactory7* This,IDWriteFontFile *file,UINT32 index,DWRITE_FONT_SIMULATIONS simulations,IDWriteFontFaceReference **reference) { - return This->lpVtbl->CreateFontFaceReference_(This,file,index,simulations,reference); -} -static FORCEINLINE HRESULT IDWriteFactory7_GetFontDownloadQueue(IDWriteFactory7* This,IDWriteFontDownloadQueue **queue) { - return This->lpVtbl->GetFontDownloadQueue(This,queue); -} -/*** IDWriteFactory4 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory7_TranslateColorGlyphRun(IDWriteFactory7* This,D2D1_POINT_2F baseline_origin,const DWRITE_GLYPH_RUN *run,const DWRITE_GLYPH_RUN_DESCRIPTION *run_desc,DWRITE_GLYPH_IMAGE_FORMATS desired_formats,DWRITE_MEASURING_MODE measuring_mode,const DWRITE_MATRIX *transform,UINT32 palette,IDWriteColorGlyphRunEnumerator1 **layers) { - return This->lpVtbl->IDWriteFactory4_TranslateColorGlyphRun(This,baseline_origin,run,run_desc,desired_formats,measuring_mode,transform,palette,layers); -} -static FORCEINLINE HRESULT IDWriteFactory7_ComputeGlyphOrigins_(IDWriteFactory7* This,const DWRITE_GLYPH_RUN *run,D2D1_POINT_2F baseline_origin,D2D1_POINT_2F *origins) { - return This->lpVtbl->ComputeGlyphOrigins_(This,run,baseline_origin,origins); -} -static FORCEINLINE HRESULT IDWriteFactory7_ComputeGlyphOrigins(IDWriteFactory7* This,const DWRITE_GLYPH_RUN *run,DWRITE_MEASURING_MODE measuring_mode,D2D1_POINT_2F baseline_origin,const DWRITE_MATRIX *transform,D2D1_POINT_2F *origins) { - return This->lpVtbl->ComputeGlyphOrigins(This,run,measuring_mode,baseline_origin,transform,origins); -} -/*** IDWriteFactory5 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory7_CreateInMemoryFontFileLoader(IDWriteFactory7* This,IDWriteInMemoryFontFileLoader **loader) { - return This->lpVtbl->CreateInMemoryFontFileLoader(This,loader); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateHttpFontFileLoader(IDWriteFactory7* This,const WCHAR *referrer_url,const WCHAR *extra_headers,IDWriteRemoteFontFileLoader **loader) { - return This->lpVtbl->CreateHttpFontFileLoader(This,referrer_url,extra_headers,loader); -} -static FORCEINLINE DWRITE_CONTAINER_TYPE IDWriteFactory7_AnalyzeContainerType(IDWriteFactory7* This,const void *data,UINT32 data_size) { - return This->lpVtbl->AnalyzeContainerType(This,data,data_size); -} -static FORCEINLINE HRESULT IDWriteFactory7_UnpackFontFile(IDWriteFactory7* This,DWRITE_CONTAINER_TYPE container_type,const void *data,UINT32 data_size,IDWriteFontFileStream **stream) { - return This->lpVtbl->UnpackFontFile(This,container_type,data,data_size,stream); -} -/*** IDWriteFactory6 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory7_CreateFontFaceReference(IDWriteFactory7* This,IDWriteFontFile *file,UINT32 face_index,DWRITE_FONT_SIMULATIONS simulations,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_axis,IDWriteFontFaceReference1 **face_ref) { - return This->lpVtbl->IDWriteFactory6_CreateFontFaceReference(This,file,face_index,simulations,axis_values,num_axis,face_ref); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateFontResource(IDWriteFactory7* This,IDWriteFontFile *file,UINT32 face_index,IDWriteFontResource **resource) { - return This->lpVtbl->CreateFontResource(This,file,face_index,resource); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateFontCollectionFromFontSet(IDWriteFactory7* This,IDWriteFontSet *fontset,DWRITE_FONT_FAMILY_MODEL family_model,IDWriteFontCollection2 **collection) { - return This->lpVtbl->IDWriteFactory6_CreateFontCollectionFromFontSet(This,fontset,family_model,collection); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateFontSetBuilder(IDWriteFactory7* This,IDWriteFontSetBuilder2 **builder) { - return This->lpVtbl->IDWriteFactory6_CreateFontSetBuilder(This,builder); -} -static FORCEINLINE HRESULT IDWriteFactory7_CreateTextFormat(IDWriteFactory7* This,const WCHAR *familyname,IDWriteFontCollection *collection,const DWRITE_FONT_AXIS_VALUE *axis_values,UINT32 num_axis,FLOAT fontsize,const WCHAR *localename,IDWriteTextFormat3 **format) { - return This->lpVtbl->IDWriteFactory6_CreateTextFormat(This,familyname,collection,axis_values,num_axis,fontsize,localename,format); -} -/*** IDWriteFactory7 methods ***/ -static FORCEINLINE HRESULT IDWriteFactory7_GetSystemFontSet(IDWriteFactory7* This,WINBOOL include_downloadable,IDWriteFontSet2 **fontset) { - return This->lpVtbl->IDWriteFactory7_GetSystemFontSet(This,include_downloadable,fontset); -} -static FORCEINLINE HRESULT IDWriteFactory7_GetSystemFontCollection(IDWriteFactory7* This,WINBOOL include_downloadable,DWRITE_FONT_FAMILY_MODEL family_model,IDWriteFontCollection3 **collection) { - return This->lpVtbl->IDWriteFactory7_GetSystemFontCollection(This,include_downloadable,family_model,collection); -} -#endif -#endif - -#endif - - -#endif /* __IDWriteFactory7_INTERFACE_DEFINED__ */ - -/* Begin additional prototypes for all interfaces */ - - -/* End additional prototypes */ - -#ifdef __cplusplus -} -#endif - -#endif /* __dwrite_3_h__ */ diff --git a/scripts/misc-icons/LICENSE.md b/scripts/misc-icons/LICENSE.md deleted file mode 100644 index da5b88793..000000000 --- a/scripts/misc-icons/LICENSE.md +++ /dev/null @@ -1,30 +0,0 @@ -# CC0 1.0 Universal - -## Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an “owner”) of an original work of authorship and/or a database (each, a “Work”). - -Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works (“Commons”) that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the “Affirmer”), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights (“Copyright and Related Rights”). Copyright and Related Rights include, but are not limited to, the following: - 1. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; - 2. moral rights retained by the original author(s) and/or performer(s); - 3. publicity and privacy rights pertaining to a person’s image or likeness depicted in a Work; - 4. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(i), below; - 5. rights protecting the extraction, dissemination, use and reuse of data in a Work; - 6. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and - 7. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the “Waiver”). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer’s heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer’s express Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer’s express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer’s Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the “License”). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer’s express Statement of Purpose. - -4. Limitations and Disclaimers. - 1. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. - 2. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. - 3. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person’s Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. - 4. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. - -For more information, please see http://creativecommons.org/publicdomain/zero/1.0/. diff --git a/scripts/misc-icons/README.md b/scripts/misc-icons/README.md deleted file mode 100644 index 33061e0ac..000000000 --- a/scripts/misc-icons/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Misc Icons - -Currently these SVG icons are used in the about dialog, the script with the json -to generate the related truetype font. - -The GitHub, Discord and Open Collective SVG comes from the [Simple Icons] -collection. - -All the icons are licensed under the [Creative Common 0 License], -see the included [license] file. - -[license]: LICENSE.md -[Simple Icons]: https://github.com/simple-icons/simple-icons/ -[Creative Common 0 License]: https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/scripts/misc-icons/generate_icons_font.json b/scripts/misc-icons/generate_icons_font.json deleted file mode 100644 index ea09d7a16..000000000 --- a/scripts/misc-icons/generate_icons_font.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "glyph_map": { - "0xe000": "sfztools", - "0xe001": "github", - "0xe002": "discord", - "0xe003": "opencollective", - "0xe004": "sfzformat" - } -} diff --git a/scripts/misc-icons/generate_icons_font.py b/scripts/misc-icons/generate_icons_font.py deleted file mode 100755 index a17d5a48f..000000000 --- a/scripts/misc-icons/generate_icons_font.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/fontforge - -import fontforge -import optparse -import json -import os -import sys - -CONFIG_FILE = os.path.splitext(__file__)[0] + '.json' -DATA = json.load(open(CONFIG_FILE)) - -def main(): - parser = optparse.OptionParser() - parser.add_option("-o", dest="output", - help="set the output file", - metavar="output") - parser.add_option("-n", dest="name", - help="set the font name", - metavar="name") - - (options, args) = parser.parse_args() - - output = options.output - name = options.name - - if output is None: - output = 'sfizz-misc-icons.ttf' - if name is None: - name = 'Sfizz Misc Icons' - - ### - sys.stderr.write('* Font name: %s\n' % (name)) - sys.stderr.write('* Output to: %s\n' % (output)) - - ### - font = fontforge.font() - font.familyname = name - font.fullname = name - font.descent = 0 - - for (unicode, asset_name) in DATA['glyph_map'].items(): - unicode = int(unicode, 16) - asset_path = 'icons/%s.svg' % (asset_name) - - glyph = font.createChar(unicode) - glyph.importOutlines(asset_path) - glyph.width = 800 - glyph.vwidth = 800 - - #font.save('sfizz-misc-icons.sfd') - font.generate(output) - -if __name__ == '__main__': - main() diff --git a/scripts/misc-icons/icons/discord.svg b/scripts/misc-icons/icons/discord.svg deleted file mode 100644 index 85d98498a..000000000 --- a/scripts/misc-icons/icons/discord.svg +++ /dev/null @@ -1 +0,0 @@ -Discord icon \ No newline at end of file diff --git a/scripts/misc-icons/icons/github.svg b/scripts/misc-icons/icons/github.svg deleted file mode 100644 index 38997125e..000000000 --- a/scripts/misc-icons/icons/github.svg +++ /dev/null @@ -1 +0,0 @@ -GitHub icon \ No newline at end of file diff --git a/scripts/misc-icons/icons/opencollective.svg b/scripts/misc-icons/icons/opencollective.svg deleted file mode 100644 index ba98a24cc..000000000 --- a/scripts/misc-icons/icons/opencollective.svg +++ /dev/null @@ -1 +0,0 @@ -Open Collective icon \ No newline at end of file diff --git a/scripts/misc-icons/icons/sfzformat.svg b/scripts/misc-icons/icons/sfzformat.svg deleted file mode 100644 index 490e15d78..000000000 --- a/scripts/misc-icons/icons/sfzformat.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/scripts/misc-icons/icons/sfztools.svg b/scripts/misc-icons/icons/sfztools.svg deleted file mode 100644 index 67f62bdf1..000000000 --- a/scripts/misc-icons/icons/sfztools.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/scripts/package-osx-bundles.sh b/scripts/package-osx-bundles.sh deleted file mode 100755 index b858f9861..000000000 --- a/scripts/package-osx-bundles.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# Adapted from Distrho's package-osx-bundles.sh script - -set -e - -if [ -d build ]; then - cd build -else - echo "Please run this script from the root folder" - exit -fi - -rm -rf au -rm -rf lv2 -rm -rf vst3 - -mkdir au lv2 vst3 -mv sfizz.component au/ -mv sfizz.lv2 lv2/ -mv sfizz.vst3 vst3/ - -pkgbuild \ - --identifier "sfz.tools.sfizz.au.bundle" \ - --install-location "/Library/Audio/Plug-Ins/Components/" \ - --root "${PWD}/au/" \ - sfz-tools-sfizz-au-bundle.pkg - -pkgbuild \ - --identifier "sfz.tools.sfizz.lv2.bundle" \ - --install-location "/Library/Audio/Plug-Ins/LV2/" \ - --root "${PWD}/lv2/" \ - sfz-tools-sfizz-lv2-bundle.pkg - -pkgbuild \ - --identifier "sfz.tools.sfizz.vst3.bundle" \ - --install-location "/Library/Audio/Plug-Ins/VST3/" \ - --root "${PWD}/vst3/" \ - sfz-tools-sfizz-vst3-bundle.pkg - -cd .. diff --git a/scripts/plugin.pkg/package.xml b/scripts/plugin.pkg/package.xml deleted file mode 100644 index 51e64e99e..000000000 --- a/scripts/plugin.pkg/package.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - sfizz - - - - - - sfz-tools-sfizz-au-bundle.pkg - - - sfz-tools-sfizz-lv2-bundle.pkg - - - sfz-tools-sfizz-vst3-bundle.pkg - - - - - - - diff --git a/scripts/plugin.pkg/welcome.txt b/scripts/plugin.pkg/welcome.txt deleted file mode 100644 index 2db111519..000000000 --- a/scripts/plugin.pkg/welcome.txt +++ /dev/null @@ -1,3 +0,0 @@ -OSX installer for sfizz - -sfizz is a sample-based musical synthesizer. \ No newline at end of file diff --git a/scripts/run_clang_tidy.sh b/scripts/run_clang_tidy.sh index 7a997a6cd..b89926720 100755 --- a/scripts/run_clang_tidy.sh +++ b/scripts/run_clang_tidy.sh @@ -23,13 +23,7 @@ clang-tidy \ src/sfizz/effects/Filter.cpp \ src/sfizz/effects/Lofi.cpp \ src/sfizz/effects/Nothing.cpp \ - plugins/vst/SfizzVstController.cpp \ - plugins/vst/SfizzVstProcessor.cpp \ - plugins/vst/SfizzVstEditor.cpp \ - plugins/vst/SfizzVstState.cpp \ -- -Iexternal/abseil-cpp -Iexternal/jsl/include -Iexternal/filesystem/include -Iexternal/atomic_queue/include -Iexternal/threadpool -Isrc/external/hiir -Isrc/external/pugixml/src \ -Iexternal/st_audiofile/src -Iexternal/st_audiofile/thirdparty/dr_libs \ -Isrc/sfizz -Isrc -Isrc/sfizz/utility/bit_array -Isrc/sfizz/utility/spin_mutex -Isrc/external/spline -Isrc/external/cpuid/src -Iexternal/simde \ - -Iplugins/common -Iplugins/vst -Iplugins/vst/external/VST_SDK/VST3_SDK -Iplugins/editor/external/vstgui4 -Iplugins/vst/external/ring_buffer \ - -Iplugins/editor/src \ -DNDEBUG -std=c++17 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ad6dadcb7..11edc55bc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -306,10 +306,11 @@ if(SFIZZ_IMPLEMENT_CXX17_ALIGNED_NEW_SUPPORT) endif() sfizz_enable_fast_math(sfizz_internal) +# TODO: sfz::config::numCCs generated with CMake # Check that sfizz and cmake-side definitions are matching file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/sfizz_match_definitions.cpp" " #include \"Config.h\" -static_assert(sfz::config::numCCs == ${SFIZZ_NUM_CCS}, \"SFIZZ_NUM_CCS did not match\"); +static_assert(sfz::config::numCCs == ${MIDI_CC_MAX}, \"MIDI_CC_MAX did not match\"); ") add_library(sfizz_match_definitions STATIC "${CMAKE_CURRENT_BINARY_DIR}/sfizz_match_definitions.cpp") target_link_libraries(sfizz_match_definitions PRIVATE sfizz::internal) @@ -437,11 +438,5 @@ target_sources(sfizz_internal PRIVATE "sfizz/effects/gen/gate.hxx" "sfizz/effects/gen/limiter.hxx") -# Windows installer -if(WIN32) - include(VSTConfig) - configure_file(${PROJECT_SOURCE_DIR}/scripts/innosetup.iss.in ${PROJECT_BINARY_DIR}/innosetup.iss @ONLY) -endif() - # Doxygen configure_file(${PROJECT_SOURCE_DIR}/scripts/doxygen/Doxyfile.in ${PROJECT_SOURCE_DIR}/Doxyfile @ONLY)