80 Commits

Author SHA1 Message Date
Xaymar f302cdb454 Update README.md 2025-08-18 02:48:56 +02:00
Xaymar b45852aec5 Clean and proper directory structure 2025-08-18 02:48:56 +02:00
Xaymar 857104607e Minor documentation improvements 2025-08-18 02:21:18 +02:00
Xaymar aa51612da9 Document vst_effect_supports_t.conformsToWindowRules 2025-08-18 02:21:18 +02:00
Xaymar ab604beafc Use README.md as the documentation main page 2025-08-18 02:21:17 +02:00
Xaymar 7ae4d26695 Effect 0x3B/0x3C: Define virtual key codes
These are probably not all but they are the ones that I could actually make happen.
2025-08-18 02:21:17 +02:00
Xaymar 6af3de922c Some documentation updates 2025-08-18 02:21:16 +02:00
Xaymar cfa826070c 'cinttypes' doesn't exist prior to C++11 2025-08-18 02:21:15 +02:00
Xaymar fbeab32e30 Add @todo tags to anything that needs work 2025-08-18 02:21:02 +02:00
Xaymar 607ba4d5be Fix up C99 support again
We still require a C++ compiler that treats C header files as actual C code.
2025-08-18 02:19:58 +02:00
Xaymar 07e88f033c Host 0x17: Query which thread is currently active
Quite useful for threading and memory safety.
2025-08-18 02:19:57 +02:00
Xaymar 899315f481 Host 0x1F/0x31: Query current input/output speaker arrangement
Seems to be completely unsupported in VST 2.4 hosts and all prior hosts seem to just return the exact data we output from VST_EFFECT_OPCODE_GET_SPEAKER_ARRANGEMENT.
2025-08-18 02:19:56 +02:00
Xaymar 0cf417c5d7 Host 0x13/0x14: Current input/output sample latency 2025-08-18 02:18:43 +02:00
Xaymar 287967df71 Host 0x11/0x12: Current effect sample rate and block size
Some hosts can randomly "forget" to send these updates to the effect and that's why we can ask the host for them. Most modern ones though do properly handle all of this.
2025-08-18 02:18:42 +02:00
Xaymar 4d7978a786 Host 0x27: Query current host language
Seems to use a custom format instead of something like ISO 639 which predates VST 2.x by quite a long time. Reinventing the wheel goes back a long time it seems.
2025-08-18 02:18:42 +02:00
Xaymar 6f752c2afc Host 0x29: Retrieves the path of the currently loaded effect
Unsure what this does with container plug-ins. Does it return the container file?
2025-08-18 02:18:41 +02:00
Xaymar a6d1ae6999 Host 0x2A: Plug-in requests a full refresh of information
A plug-in may call this if they believe important information has changed such as the number of parameters. This seems to work together with VST_HOST_OPCODE_IO_MODIFIED.
2025-08-18 02:18:41 +02:00
Xaymar 2cfed28193 Host 0x2B/0x2C: Intended behavior appears to be locking/unlocking
These calls seem to prevent compatible hosts from emitting parameter changes entirely. This is like a file lock where it prevents other processes from modifying things they shouldn't.
2025-08-18 02:18:40 +02:00
Xaymar 0a9bae5e40 Add "editFile" to vst_host_supports_t
This one looked like a function lookup for a LoadLibrary call. Turns out it's an actual support query!
2025-08-18 02:18:40 +02:00
Xaymar cec86e58dd Host 0x1E: Request a resize of the window containing our custom editor
The host is not required to accept our request and may ignore it.
2025-08-18 02:18:39 +02:00
Xaymar 3a9af11188 Slightly improve overall documentation 2025-08-18 02:18:39 +02:00
Xaymar cdcb0d905b Add documentation to VST_EVENT_TYPE_04 and VST_EVENT_TYPE_05 2025-08-18 01:56:13 +02:00
Xaymar 50e451ab9f vst_event_midi_sysex_t is event type 6 not 5 2025-08-18 01:56:12 +02:00
Xaymar 1648f45295 Empty field in vst_events_t is likely padding
Based on where things are in the structure this is likely to be a remnant of the past. Can't verify that though.
2025-08-18 01:55:43 +02:00
Xaymar e9f88c7fad Add MIDI and MIDI SysEx event structures (#2, #3)
Thanks to a cheap MIDI keyboard I was able to figure out most of the structure with ease.
2025-08-18 01:55:13 +02:00
Xaymar 3cb139a14a Initial work towards event handling support (#3)
The VST 2.x API seems to support some sort of event handling functionality used to implement MIDI (#2) and External Processing (#5). The vst_event_t structure is currently unclear.
2025-08-18 01:54:22 +02:00
Xaymar ff7f380234 Add modern C++ style C header include
It does the exact same as all the modern C header includes, which is to include the actual C header as is!
2025-08-15 21:20:20 +02:00
Xaymar f8ca1b081c Strip out old vst3sdk support as it's unsupported by Steinberg now
Seems like the functionality to make a VST 3.x + 2.x plug-in is now no longer in their SDK or at least I can't find it. Since that code likely relied on things that were GPLv3 or Steinberg Proprietary licensed, it's better if I remove it.
2025-08-15 21:19:44 +02:00
Xaymar e9fcf1408b Host 0x0E -> 0x0D: Missed one of the off-by-1 errors
This explains why my test code using the header wasn't working.
2025-08-08 02:38:09 +02:00
Xaymar d23a117ecc Add editorconfig file for automatically trimming whitespace 2025-08-08 02:38:09 +02:00
Xaymar c9629ad8d3 Fix all host opcodes being offset by 1 or two 2025-08-08 01:54:21 +02:00
Xaymar 87b3e2bcfc Hopefully fix documentation not updating on push 2025-08-06 05:19:28 +02:00
Xaymar 9dd8de817f Update README 2025-08-06 05:18:17 +02:00
Xaymar 41a24b0f07 Mac OS exclusivity isn't an important thing either 2025-08-06 04:21:22 +02:00
Xaymar 0049af4720 VST version changes aren't important enough to warrant red boxes 2025-08-06 04:17:56 +02:00
Xaymar 35125a732b Various fixes for documentation 2025-08-06 04:14:15 +02:00
Xaymar 21998dbbc0 Fix wrong reference to VST_HOST where we wanted VST_EFFECT 2025-08-06 04:07:08 +02:00
Xaymar fa02ffef09 Fix incorrect type definition in vst.hpp 2025-08-06 04:06:23 +02:00
Xaymar ce354e3824 Fix duplicate definition of VST_EFFECT_OPCODE_43 2025-08-06 04:05:31 +02:00
Xaymar 5e65ee89ca Fix incorrect definition for vst_host_callback_t 2025-08-06 03:56:51 +02:00
Xaymar 3c7322c90d Oops: VST_EFFECT_OPCODE_PARAM_PROPERTIES is actually 0x38
Late night coding while sleepy tends to invite mistakes.
2025-08-06 03:46:49 +02:00
Xaymar 3beabeef6d Add vst.hpp to automatically generated docs 2025-08-06 03:33:52 +02:00
Xaymar 6a1e5be101 Automatically generate documentation for hosting via Github Pages
In addition to the extensive header documentation available lets also have doxygen generate proper HTML for the web.
2025-08-06 03:22:14 +02:00
Xaymar f5779515c2 More documentation improvements 2025-08-06 02:51:57 +02:00
Xaymar 4b0f52863f More documentation improvments 2025-08-06 02:29:41 +02:00
Xaymar b49fb7872d More C99 compat improvements and doxygen support 2025-08-06 00:49:20 +02:00
Xaymar 06245409e8 Improve documentation for speakers and vkey op-codes 2025-08-05 23:56:02 +02:00
Xaymar adc0352d59 Float parameters are sometimes required to be normalized within 0.0 and 1.0 2025-08-05 15:58:38 +02:00
Xaymar 86838d1e67 Add further documentation to vst_parameter_properties_t 2025-08-05 15:39:29 +02:00
Xaymar 1c13d4b88a Forgot to append the _t 2025-08-05 08:27:09 +02:00
Xaymar 31fde8b4c8 Fix C++ and C compilation errors
Now both languages should compile fully again. The whole string list is a bit hacky but it works.
2025-08-05 08:22:09 +02:00
Xaymar ddcca1549b Fix recently introduced C compatibility issues 2025-08-05 08:10:14 +02:00
Xaymar b7c86d3766 Better understanding of vst_effect_supports.bypass 2025-08-05 07:56:40 +02:00
Xaymar 33b3f9c9b6 More container related things. 2025-08-05 07:41:52 +02:00
Xaymar 7e5da0b551 Stream handling and some better documentation 2025-08-05 07:26:55 +02:00
Xaymar c8a0a3b129 Lots of progress on container plug-ins 2025-08-05 07:05:55 +02:00
Xaymar 1371dd8233 Lots of new host stuff discovered automatically. 2025-08-05 06:04:18 +02:00
Xaymar 9ec0cc6d39 Some op codes only happened on MacOS 2025-08-05 05:30:19 +02:00
Xaymar 9d44f308dc Stuff related to VST_EFFECT_OPCODE_SUPPORTS 2025-08-05 05:27:08 +02:00
Xaymar 519bb9d4a2 Add some more discovered things about effects 2025-08-05 05:21:04 +02:00
Xaymar 48d5070d63 Strictly follow proper naming conventions for types
Anything that creates a "type" must be suffixed by _t.
2025-08-05 04:40:03 +02:00
Xaymar 0e09d69e63 Fix incorrect description for vst_effect.num_params 2025-08-05 04:35:50 +02:00
Xaymar f79cab72c5 Explain why it's called unformatted chunk data 2025-08-05 04:35:02 +02:00
Xaymar 21a22b8dcb Significant progress on parameters 2025-08-05 04:31:40 +02:00
Xaymar 1e6b6e51ed Siginificant discoveries related to speaker information. 2025-08-05 04:23:59 +02:00
Xaymar 57b38a074d Fix some coding and split C++ code, improve speakers and parameters 2025-08-05 04:07:37 +02:00
Xaymar 89664f5ab7 Formatting and update copyright name as of a few weeks ago 2025-08-05 03:43:28 +02:00
Xaymar 7340510ac4 More effect flags, better chunk data description 2025-08-05 03:16:21 +02:00
Xaymar 432e312022 Some formatting and fixes
- Swap out a lot of macros for enums which somehow generated better code?
- The program name callbacks only have 24 bytes, not 64 bytes. Woops.
- Set/Get chunk data now has the correct descriptions.
- Fixed description for VST_EFFECT_OPCODE_TRANSLATE_ERROR.
- Fixed return codes for VST_EFFECT_OPCODE_SUPPORTS.
2025-08-05 03:00:28 +02:00
Xaymar 5b74f31ec4 Some formatting 2025-08-05 02:29:11 +02:00
Xaymar 40a5fb8ff4 More effect parameters discovered through mass testing
Automatically testing thousands of plugins has its benefits.
2025-08-05 02:14:45 +02:00
Xaymar c5d209d605 Some older Windows versions crash when using cdecl calls 2025-08-05 01:46:40 +02:00
Xaymar f676cd8883 Alignment for 32-bit plugins is incorrect but it's not 4 bytes 2025-08-05 01:44:50 +02:00
Xaymar 6c17021d2f New guesses at what the categories are. 2025-08-05 01:25:52 +02:00
Michael Fabian 'Xaymar' Dirks 78c190af78 Remove useless return statement 2024-03-12 21:32:05 +01:00
Michael Fabian 'Xaymar' Dirks 6fb0fdbcc4 Fix crash with editor 2024-03-11 20:23:54 +01:00
Michael Fabian 'Xaymar' Dirks 9249b6b166 Most of these are implemented by vst2wrapper 2024-03-11 15:24:14 +01:00
Michael Fabian 'Xaymar' Dirks cc426bada4 Fix up a variety of API issues
The wrapper now successfully loads.
2024-03-11 12:06:22 +01:00
Michael Fabian 'Xaymar' Dirks b780509704 Attempt to recreate vst2wrapper compatible headers
The entirety of the content here is based on 'vst.h', 'VST 3 SDK' and 'VSTGUI'. Due to the license header provided in the files investigated, the final license for these files is the BSD 3-Clause license. It was about a day and a half of work, but it is almost in working condition.

While not all features/functionality is present, the main functionality that makes vst2wrapper compile is there. So with any luck I'll be able to figure out the rest with ease.
2024-03-11 10:33:28 +01:00
Michael Fabian 'Xaymar' Dirks 621843c949 Add discovered extra parameter information
Appears to be VST 2.0+ exclusive, not used in VST 1.x hosts.
2022-07-24 23:29:05 +02:00
10 changed files with 6403 additions and 952 deletions
+116
View File
@@ -0,0 +1,116 @@
# AUTOGENERATED COPYRIGHT HEADER START
# Copyright (C) 2018-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
# AUTOGENERATED COPYRIGHT HEADER END
# Basic Formatting
TabWidth: 4
UseTab: ForContinuationAndIndentation
ColumnLimit: 65535
#- 0 does not respect the original line breaks!
# Language
Language: Cpp
Standard: c++17
# Indentation
AccessModifierOffset: 0
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
IndentCaseLabels: false
#IndentPPDirectives: true
IndentWidth: 4
IndentWrappedFunctionNames: true
NamespaceIndentation: All
# Includes
#IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"warning-disable.hpp"$'
Priority: 50
- Regex: '^(<|")(config.hpp|common.hpp|ui-common.hpp|strings.hpp|version.hpp|obs.h)("|>)'
Priority: 100
- Regex: '^<obs-'
Priority: 150
- Regex: '^<'
Priority: 200
- Regex: '^<Q'
Priority: 250
- Regex: '^"'
Priority: 300
- Regex: '.moc"$'
Priority: 300
- Regex: '^"warning-enable.hpp"$'
Priority: 500
SortIncludes: true
# Alignment
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
DerivePointerAlignment: false
PointerAlignment: Left
# Wrapping and Breaking
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
# AfterExternBlock: false
AfterFunction: true
AfterNamespace: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
#BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
Cpp11BracedListStyle: true
# Spaces
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
#SpaceBeforeCpp11BracedList: false
#SpaceBeforeCtorInitializerColon: true
#SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
#SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
# Other
CommentPragmas: '^(!FIXME!|!TODO!|ToDo:)'
CompactNamespaces: false
DisableFormat: false
FixNamespaceComments: true
#ForEachMacros: ''
KeepEmptyLinesAtTheStartOfBlocks: false
ReflowComments: false
SortUsingDeclarations: true
+17
View File
@@ -0,0 +1,17 @@
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file.
[*]
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = tab
indent_size = 4
[*.{md,yml,yaml}]
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 2
+86
View File
@@ -0,0 +1,86 @@
name: Generate Documentation
on:
push:
branches:
- 'root'
- '!documentation'
paths:
- '.github/workflows/documentation.yml'
- 'vst.h'
- 'vst.hpp'
- 'Doxyfile'
jobs:
docs:
name: "Generate Documentation"
runs-on: ubuntu-latest
steps:
- name: "Set up Git"
shell: bash
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'xaymar@users.noreply.github.com'
git config --global pull.ff only
git config --global pull.rebase true
- name: "Clone"
uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: 0
- name: "Clone Documentation Cache"
id: doc_cache
continue-on-error: true
uses: actions/checkout@v3
with:
ref: 'documentation'
path: 'build/docs/html'
submodules: 'recursive'
fetch-depth: 0
- name: "Initialize Documentation Cache"
if: steps.doc_cache.outcome == 'failure'
shell: bash
run: |
mkdir -p build/docs/html
pushd build/docs/html
git init
git switch --orphan documentation
git remote remove origin
git remote add -t documentation origin ${{ github.repositoryUrl }}
popd
- name: "Install Prerequisites"
shell: bash
run: |
sudo apt-get install -y clang-19 clang-tools-19 doxygen graphviz
- name: "Generate Documentation"
shell: bash
run: |
doxygen Doxyfile
- name: "Update Documentation"
shell: bash
run: |
pushd build/docs/html
git add .
git --no-pager diff --patch --minimal HEAD -- || true
git update-index --refresh
if ! git diff-index --quiet HEAD -- &> /dev/null; then
git commit -a -m "${{ github.sha }}"
# Only push from master branch.
if [[ "${{ github.ref }}" == "refs/heads/root" ]]; then
git push --set-upstream origin documentation
echo "Documentation has been updated!"
else
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
fi
else
echo "Documentation is still up to date."
fi
popd
+2
View File
@@ -0,0 +1,2 @@
/docs
/build
+2989
View File
File diff suppressed because it is too large Load Diff
+24 -7
View File
@@ -1,9 +1,23 @@
# About the Project
This is a completely "clean room" untainted reverse engineered "SDK" for the VST 2.x interface. It was reverse engineered from binaries where no license restricting the reverse engineering was attached, or where the legal system explicitly allowed reverse engineering for the purpose of interoperability.
## At a glance
- Full reimplementation of the VST 2.x SDK.
- Header-only, so no code/object dependencies!
- Written for C99 / C++20 with (optional) backwards support down to C89 / C++98.
- Documentation available [online](https://xaymar.github.io/vst2sdk) _and_ offline with clean JavaDoc comments.
- Liberally licensed so it is usable in commercial products.
- Technically as clean room as it can legally get, but ask a lawyer first anyway.
- I don't provide licenses to Steinberg VsT, their logos, or anything.
## As seen in
[DISTRHO Plugin Framework](https://github.com/DISTRHO/DPF), [StompTuner](https://github.com/brummer10/StompTuner), [DF Zita Rev1](https://github.com/SpotlightKid/dfzitarev1), [TonPlugIns](https://github.com/Vhonowslend/TonPlugIns), [ToneTwistPlugs](https://github.com/brummer10/ToneTwistPlugs), [DF JPverb](https://github.com/SpotlightKid/dfjpverb), [CChorus](https://github.com/SpotlightKid/cchorus), [Dynation](https://github.com/vertver/Dynation) and likely more.
*(Want to be listed here? Open an Issue or Pull Request!)*
# Frequently Asked Questions
## Is this legal? Can I use this in my own product?
**Disclaimer:** I am not a lawyer. The information presented below is purely from available copyright laws that I could find about this topic. You should always consult with a lawyer first before including this in your product.
**Disclaimer:** I am not a lawyer. Consult a real lawyer before including this in a paid product. The information presented below is purely from available copyright laws that I could find about this topic. You should always consult with a lawyer first before including this in your product.
As this only enables interoperability with existing VST 2.x programs and addons, it is considered to be reverse engineering in the name of interoperability. In most of the developed world, this is considered completely legal and is fine to be used by anyone, as long as it is not the only function of the product.
@@ -12,10 +26,13 @@ Note that this does not grant any patent licenses, nor does it grant you any rig
## Why recreate an SDK for something officially abandoned by the creators?
There is a ton of software that is only capable of loading VST2.x audio effects, and Steinberg has made no effort to create a VST3-to-VST2-adapter for that software. Notable software includes Audacity and OBS Studio, which both likely felt restricted by the license additions Steinberg added to the GPL license.
## How did you reverse engineer this?
The reverse engineering was done with various tools (mostly disassemblers to x86 assembly code), hooking into system APIs, attempting to mimic functionality through observation and testing, and other methods. Primarily Visual Studio Code was used to write the header files, and Visual Studio 2019 Express was used to create fake VST plugins/hosts to figure out actual behavior.
## What was used to create this clean room project?
**Disclaimer:** I am not a lawyer. Consult a real lawyer before including this in a paid product.
### Which binaries were disassembled?
* A fake VST2 host (using this header) was created to verify against existing plugins.
* A fake VST2 plugin (using this header) was created to verify against existing hosts.
* OBS Studio and Audacity were used to verify compatability between closed source and open source VST hosts.
The initial version was created through the best available legal clean room reverse engineering method available. The whole process went through several rounds of the "telephone" game involving external developers and lawyers before the final document arrived on my desk. This initial version was barely functional as a lot of context ended up missing resulting in quite basic functionality.
This version went through several development cycles before settling on what I've now labelled as `v0.1.1`. It was stable and worked for the most part but lacked a lot of features. I've used it as a base for my own plug-ins and had quite a bit of success with it but the incompleteness of the recreated SDK was noticable. Eventually I recreated VST 3.x SDK compatible headers using the VST 3.x SDK which caused the license to upgrade from BSD 2-clause to BSD 3-clause - now known as `v0.2.0`.
As of late July/early August 2025, I had a found a bit of interest in this SDK again and didn't want to leave it in the incomplete state it was. I've recreated the fake plug-in and host that I used before and decided to automate behavior scanning: What do hosts or plug-ins expect us to do? What do they call? Etc. This was then let loose on several thousand available plug-ins and has resulted in the `v0.3.0` update to the SDK. As far as I can tell the SDK now has almost all functionality that VST 2.x plug-ins and hosts could want.
There's still a bit of work to do but it won't be easy as almost all of it involves structured data for which I can only guess. Progress is being made, but it's so much slower compared to when I had pages of telephone game documentation to work off of. Still better than nothing!
+30
View File
@@ -0,0 +1,30 @@
/* An attempt at an untained clean room reimplementation of the widely popular VST 2.x SDK.
* Copyright (c) 2020 Xaymar Dirks <info@xaymar.com> (previously known as Michael Fabian Dirks)
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "vst.h"
#ifdef __cplusplus
}
#endif
+3100
View File
File diff suppressed because it is too large Load Diff
+39
View File
@@ -0,0 +1,39 @@
/* An attempt at an untained clean room reimplementation of the widely popular VST 2.x SDK.
* Copyright (c) 2020 Xaymar Dirks <info@xaymar.com> (previously known as Michael Fabian Dirks)
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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.
*/
// Please refer to README.md and LICENSE for further information.
// Protect against double inclusion in practically every compiler available.
#pragma once
#ifndef VST2SDK_VST_HPP
#define VST2SDK_VST_HPP
#include "vst.h"
// Variable size variant of vst_speaker_arrangement.
template<size_t T>
struct vst_speaker_arrangement_dynamic_t {
VST_SPEAKER_ARRANGEMENT_TYPE type; // See VST_SPEAKER_ARRANGEMENT_TYPE
int32_t channels; // Number of channels in speakers.
vst_speaker_properties_t speakers[T]; // Array of speaker properties, actual size defined by channels.
};
#endif
-945
View File
@@ -1,945 +0,0 @@
// This was created from released VST2.x plugins, and is technically under the 2-clause BSD license.
// Depending on which country you are in, Steinberg can do fuck all about this. Notable countries for
// this are most members of the United States of America, the entirety of Europe, Japan, and Russia.
// Consult a lawyer if you don't know if clean room reverse engineering is allowed in your country.
// See README.md for all information.
// Known additional information:
// - Function call standard seems to be stdcall.
// - Everything is aligned to 8 bytes.
// VST Versioning:
// - Base-10, thus can't store many version numbers.
// - Always four components, with the major one being able to store the most numbers.
// - Format is A...ABCD, so 1.2.3.4 would turn into 1234.
#pragma once
#ifndef VST2SDK_VST_H
#define VST2SDK_VST_H
#define VST_FUNCTION_INTERFACE __stdcall
#define VST_ALIGNMENT 8
#define VST_MAGICNUMBER 'VstP'
#define VST_VENDOR_BUFFER_SIZE 64 // Vendor
#define VST_PRODUCT_BUFFER_SIZE 64 // Product
#define VST_EFFECT_BUFFER_SIZE 32 // Effect
#define VST_NAME_BUFFER_SIZE 64 // Names
#define VST_MAX_CHANNELS 32 // Couldn't find any audio editing software which would attempt to add more channels.
#pragma pack(push, VST_ALIGNMENT)
#ifdef __cplusplus
#include <cinttypes>
extern "C" {
#else
#include <inttypes.h>
#endif
/*******************************************************************************
|* Enumeration
|*/
enum VST_VERSION {
VST_VERSION_1 = 0, // Anything before 2.0, used by official plug-ins.
VST_VERSION_1_0_0_0 = 1000, // 1.0, used by some third-party plug-ins.
VST_VERSION_1_1_0_0 = 1100, // 1.1, used by some third-party plug-ins.
VST_VERSION_2 = 2, // 2.0, used by official plug-ins.
VST_VERSION_2_0_0_0 = 2000, // 2.0, used by some third-party plug-ins.
VST_VERSION_2_1_0_0 = 2100, // 2.1
VST_VERSION_2_2_0_0 = 2200, // 2.2
VST_VERSION_2_3_0_0 = 2300, // 2.3
VST_VERSION_2_4_0_0 = 2400, // 2.4
// Pad to force 32-bit number.
_VST_VERSION_PAD = 0xFFFFFFFFul,
};
enum VST_CATEGORY {
VST_CATEGORY_UNCATEGORIZED = 0x00,
VST_CATEGORY_01 = 0x01,
VST_CATEGORY_02 = 0x02,
VST_CATEGORY_03 = 0x03,
VST_CATEGORY_04 = 0x04,
VST_CATEGORY_05 = 0x05,
VST_CATEGORY_06 = 0x06,
VST_CATEGORY_07 = 0x07,
VST_CATEGORY_RESTORATION = 0x08, // Denoising and similar effects.
VST_CATEGORY_09 = 0x09,
VST_CATEGORY_CONTAINER = 0x0A, // Plugin contains more than one Plugin.
VST_CATEGORY_0B = 0x0B,
VST_CATEGORY_MAX, // Not part of specification, marks maximum category.
// Pad to force 32-bit number.
_VST_CATEGORY_PAD = 0xFFFFFFFFul,
};
enum VST_EFFECT_OPCODE {
/* Create/Initialize the effect (if it has not been created already).
*
* @return Always 0.
*/
VST_EFFECT_OPCODE_00 = 0x00,
VST_EFFECT_OPCODE_CREATE = 0x00,
VST_EFFECT_OPCODE_INITIALIZE = 0x00,
/* Destroy the effect (if there is any) and free its memory.
*
* This should destroy the actual object created by VST_ENTRYPOINT.
*
* @return Always 0.
*/
VST_EFFECT_OPCODE_01 = 0x01,
VST_EFFECT_OPCODE_DESTROY = 0x01,
/* Set Program
*
*
*/
VST_EFFECT_OPCODE_02 = 0x02,
/* Get Program
*
*
*/
VST_EFFECT_OPCODE_03 = 0x03,
/* Set Program Name
*
*
*/
VST_EFFECT_OPCODE_04 = 0x04,
/* Get Program Name
*
* "Returns 0. If ptr is valid, sets the first byte of ptr to 0 then returns 0."
*/
VST_EFFECT_OPCODE_05 = 0x05,
/* Get the value? label for the parameter.
*
* @param p_int1 Parameter index.
* @param p_ptr 'char[8]'
* @return 0 on success, 1 on failure.
*/
VST_EFFECT_OPCODE_06 = 0x06,
VST_EFFECT_OPCODE_PARAM_GETLABEL = 0x06,
/* Get the string value for the parameter.
*
* @param p_int1 Parameter index.
* @param p_ptr 'char[8]'
* @return 0 on success, 1 on failure.
*/
VST_EFFECT_OPCODE_07 = 0x07,
VST_EFFECT_OPCODE_PARAM_GETVALUE = 0x07,
/* Get the name for the parameter.
*
* @param p_int1 Parameter index.
* @param p_ptr 'char[8]'
* @return 0 on success, 1 on failure.
*/
VST_EFFECT_OPCODE_08 = 0x08,
VST_EFFECT_OPCODE_PARAM_GETNAME = 0x08,
/*
*
*
*/
VST_EFFECT_OPCODE_09 = 0x09,
/* Set the new sample rate for the plugin to use.
*
* @param p_float New sample rate as a float (double on 64-bit because register upgrades).
*/
VST_EFFECT_OPCODE_0A = 0x0A,
VST_EFFECT_OPCODE_SETSAMPLERATE = 0x0A,
VST_EFFECT_OPCODE_SET_SAMPLE_RATE = 0x0A,
/* Sets the block size, which is the maximum number of samples passed into the effect via process calls.
*
* @param p_int2 The maximum number of samples to be passed in.
*/
VST_EFFECT_OPCODE_0B = 0x0B,
VST_EFFECT_OPCODE_SETBLOCKSIZE = 0x0B,
VST_EFFECT_OPCODE_SET_BLOCK_SIZE = 0x0B,
/* Effect processing should be suspended/paused.
*
* Unclear if this is should result in a flush of buffers.
*
* @param p_int2 0 if the effect should suspend processing, 1 if it should resume.
*/
VST_EFFECT_OPCODE_0C = 0x0C,
VST_EFFECT_OPCODE_SUSPEND = 0x0C,
/* Retrieve the client rect size of the plugins window.
* If no window has been created, returns the default rect.
*
* @param p_ptr Pointer of type 'struct vst_rect*'.
* @return On success, returns 1 and updates p_ptr to the rect. On failure, returns 0.
*/
VST_EFFECT_OPCODE_0D = 0x0D,
VST_EFFECT_OPCODE_WINDOW_GETRECT = 0x0D,
/* Create the window for the plugin.
*
* @param p_ptr HWND of the parent window.
* @return 0 on failure, or HWND on success.
*/
VST_EFFECT_OPCODE_0E = 0x0E,
VST_EFFECT_OPCODE_WINDOW_CREATE = 0x0E,
/* Destroy the plugins window.
*
* @return Always 0.
*/
VST_EFFECT_OPCODE_0F = 0x0F,
VST_EFFECT_OPCODE_WINDOW_DESTROY = 0x0F,
/*
*
*
*/
VST_EFFECT_OPCODE_10 = 0x10,
/*
*
*
*/
VST_EFFECT_OPCODE_11 = 0x11,
/*
*
*
*/
VST_EFFECT_OPCODE_12 = 0x12,
/*
*
*
*/
VST_EFFECT_OPCODE_13 = 0x13,
/*
*
*
*/
VST_EFFECT_OPCODE_14 = 0x14,
/*
*
*
*/
VST_EFFECT_OPCODE_15 = 0x15,
/* Always returns the FourCC 'NvEF' (0x4E764566).
*/
VST_EFFECT_OPCODE_16 = 0x16,
/* Get Chunk
*
*
*/
VST_EFFECT_OPCODE_17 = 0x17,
/* Set Chunk
*
*
*/
VST_EFFECT_OPCODE_18 = 0x18,
// VST2.x starts here.
/*
*
*
*/
VST_EFFECT_OPCODE_19 = 0x19,
/* Can the parameter be automated?
*
* @param p_int1 Index of the parameter.
* @return 1 if the parameter can be automated, otherwise 0.
*/
VST_EFFECT_OPCODE_1A = 0x1A,
VST_EFFECT_OPCODE_PARAM_ISAUTOMATABLE = 0x1A,
/*
*
*
*/
VST_EFFECT_OPCODE_1B = 0x1B,
/*
*
*
*/
VST_EFFECT_OPCODE_1C = 0x1C,
/*
*
*
*/
VST_EFFECT_OPCODE_1D = 0x1D, // See VST_EFFECT_OPCODE_05
/*
*
*
*/
VST_EFFECT_OPCODE_1E = 0x1E,
/* Input connected.
*
*
*/
VST_EFFECT_OPCODE_1F = 0x1F,
/* Input disconnected.
*
*
*/
VST_EFFECT_OPCODE_20 = 0x20,
/* Retrieve the name of the input channel at the given index.
*
* @param p_int1 Index of the input to get the name for.
* @param p_ptr Pointer to a char* buffer able to hold at minimum 20 characters. Might need to be 32 even.
* @return 0 on failure, 1 on success.
*/
VST_EFFECT_OPCODE_21 = 0x21,
VST_EFFECT_OPCODE_INPUT_GETCHANNELNAME = 0x21,
VST_EFFECT_OPCODE_INPUT_CHANNEL_NAME = 0x21,
/* Retrieve the name of the output channel at the given index.
*
* @param p_int1 Index of the output to get the name for.
* @param p_ptr Pointer to a char* buffer able to hold at minimum 20 characters. Might need to be 32 even.
* @return 0 on failure, 1 on success.
*/
VST_EFFECT_OPCODE_22 = 0x22,
VST_EFFECT_OPCODE_OUTPUT_GETCHANNELNAME = 0x22,
VST_EFFECT_OPCODE_OUTPUT_CHANNEL_NAME = 0x22,
/* Retrieve category of this effect.
*
* @return The category that this effect is in, see VST_CATEGORY.
*/
VST_EFFECT_OPCODE_23 = 0x23,
VST_EFFECT_OPCODE_EFFECT_CATEGORY = 0x23,
/*
*
*
*/
VST_EFFECT_OPCODE_24 = 0x24,
/*
*
*
*/
VST_EFFECT_OPCODE_25 = 0x25,
/*
*
*
*/
VST_EFFECT_OPCODE_26 = 0x26,
/*
*
*
*/
VST_EFFECT_OPCODE_27 = 0x27,
/*
*
*
*/
VST_EFFECT_OPCODE_28 = 0x28,
/*
*
*
*/
VST_EFFECT_OPCODE_29 = 0x29,
/* Set the speaker arrangement
*
* @param p_int2 (vst_speaker_arrangement*) Pointer to a pointer to the speaker arrangement for the input.
* @param p_ptr (vst_speaker_arrangement*) Pointer to a pointer to the speaker arrangement for the output.
*/
VST_EFFECT_OPCODE_2A = 0x2A,
VST_EFFECT_OPCODE_SET_SPEAKER_ARRANGEMENT = 0x2A,
/*
*
*
*/
VST_EFFECT_OPCODE_2B = 0x2B,
/* Enable/Disable bypassing the effect.
*
* @param p_int2 Zero if bypassing the effect is disabled, otherwise 1.
*/
VST_EFFECT_OPCODE_2C = 0x2C,
VST_EFFECT_OPCODE_BYPASS = 0x2C,
/* Retrieve the effect name into the ptr buffer.
*
* @param p_ptr char[64] Buffer containing a zero-terminated effect information string. May be shorter than 64 bytes on older hosts.
* @return Always 0, even on failure.
*/
VST_EFFECT_OPCODE_2D = 0x2D,
VST_EFFECT_OPCODE_GETNAME = 0x2D,
VST_EFFECT_OPCODE_EFFECT_NAME = 0x2D,
/* Translate an error code to a string.
*
* @param p_ptr char[256] Buffer that should contain a zero-terminated error string.
*/
VST_EFFECT_OPCODE_2E = 0x2E,
VST_EFFECT_OPCODE_TRANSLATE_ERROR = 0x2E,
/* Retrieve the vendor name into the ptr buffer.
*
* @param p_ptr char[64] Buffer containing a zero-terminated vendor information string. May be shorter than 64 bytes on older hosts.
* @return Always 0, even on failure.
*/
VST_EFFECT_OPCODE_2F = 0x2F,
VST_EFFECT_OPCODE_GETVENDOR = 0x2F,
VST_EFFECT_OPCODE_VENDOR_NAME = 0x2F,
/* See VST_EFFECT_OPCODE_GETNAME
*
* Rarely used, if at all even supported. Not sure what the purpose of this is even.
*/
VST_EFFECT_OPCODE_30 = 0x30,
VST_EFFECT_OPCODE_GETNAME2 = 0x30,
VST_EFFECT_OPCODE_PRODUCT_NAME = 0x30,
/* Retrieve the vendor version in return value.
*
* @return Version.
*/
VST_EFFECT_OPCODE_31 = 0x31,
VST_EFFECT_OPCODE_GETVENDORVERSION = 0x31,
VST_EFFECT_OPCODE_VENDOR_VERSION = 0x31,
/* User defined OP Code, for custom interaction.
*
*/
VST_EFFECT_OPCODE_32 = 0x32,
VST_EFFECT_OPCODE_CUSTOM = 0x32,
/* Test for support of a specific named feature.
*
* @param p_ptr Pointer to a zero-terminated buffer containing the feature name.
* @return Non-zero if the feature is supported, otherwise 0.
*/
VST_EFFECT_OPCODE_33 = 0x33,
VST_EFFECT_OPCODE_SUPPORTS = 0x33,
/* Number of samples that are at the tail at the end of playback.
*
* @return 0 or 1 for no tail, > 1 for number of samples to tail.
*/
VST_EFFECT_OPCODE_34 = 0x34,
VST_EFFECT_OPCODE_GETTAILSAMPLES = 0x34,
VST_EFFECT_OPCODE_TAIL_SAMPLES = 0x34,
/*
*
*
*/
VST_EFFECT_OPCODE_35 = 0x35,
/*
*
*
*/
VST_EFFECT_OPCODE_36 = 0x36,
/*
*
*
*/
VST_EFFECT_OPCODE_37 = 0x37,
/*
*
*
*/
VST_EFFECT_OPCODE_38 = 0x38,
/*
*
*
*/
VST_EFFECT_OPCODE_39 = 0x39,
/* Retrieve the VST Version supported.
*
* @return Return 0 for <2.0, 2 for 2.0, 2100 for 2.1, 2200 for 2.2, 2300 for 2.3, etc.
*/
VST_EFFECT_OPCODE_3A = 0x3A,
VST_EFFECT_OPCODE_VST_VERSION = 0x3A,
// VST 2.1 or later
/*
*
*
*/
VST_EFFECT_OPCODE_3B = 0x3B,
/*
*
*
*/
VST_EFFECT_OPCODE_3C = 0x3C,
/*
*
*
*/
VST_EFFECT_OPCODE_3D = 0x3D,
/*
*
*
*/
VST_EFFECT_OPCODE_3E = 0x3E,
/*
*
*
*/
VST_EFFECT_OPCODE_3F = 0x3F,
/*
*
*
*/
VST_EFFECT_OPCODE_40 = 0x40,
/*
*
*
*/
VST_EFFECT_OPCODE_41 = 0x41,
/*
*
*
*/
VST_EFFECT_OPCODE_42 = 0x42,
/*
*
*
*/
VST_EFFECT_OPCODE_43 = 0x43,
/*
*
*
*/
VST_EFFECT_OPCODE_44 = 0x44,
// VST 2.3 or later
/* Retrieve the speaker arrangement.
*
* @param p_int2 (vst_speaker_arrangement**) Pointer to a pointer to the speaker arrangement for the input.
* @param p_ptr (vst_speaker_arrangement**) Pointer to a pointer to the speaker arrangement for the output.
*/
VST_EFFECT_OPCODE_45 = 0x45,
VST_EFFECT_OPCODE_GET_SPEAKER_ARRANGEMENT = 0x45,
/*
*
*
*/
VST_EFFECT_OPCODE_46 = 0x46,
/* Begin processing of audio.
*
*
*
*/
VST_EFFECT_OPCODE_PROCESS_BEGIN = 0x47,
/* End processing of audio.
*
*
*
*/
VST_EFFECT_OPCODE_PROCESS_END = 0x48,
/*
*
*
*/
VST_EFFECT_OPCODE_49 = 0x49,
/*
*
*
*/
VST_EFFECT_OPCODE_4A = 0x4A,
/*
*
*
*/
VST_EFFECT_OPCODE_4B = 0x4B,
/*
*
*
*/
VST_EFFECT_OPCODE_4C = 0x4C,
// VST 2.4 or later
/*
*
*
*/
VST_EFFECT_OPCODE_4D = 0x4D,
/*
*
*
*/
VST_EFFECT_OPCODE_4E = 0x4E,
/*
*
*
*/
VST_EFFECT_OPCODE_4F = 0x4F,
// Highest number of known OPCODE.
VST_EFFECT_OPCODE_MAX,
// Pad to force 32-bit number.
_VST_EFFECT_OPCODE_PAD = 0xFFFFFFFFul,
};
enum VST_HOST_OPCODE {
/*
* @param int1 -1 or Parameter Index
* @return Expected to return... something.
*/
VST_HOST_OPCODE_00 = 0x00, // cb(vst, 0x00, ?, 0, 0);
VST_HOST_OPCODE_01 = 0x01,
VST_HOST_OPCODE_02 = 0x02, // bool cb(0, 0x02, 0, 0, 0);
VST_HOST_OPCODE_03 = 0x03,
VST_HOST_OPCODE_04 = 0x04,
VST_HOST_OPCODE_05 = 0x05,
VST_HOST_OPCODE_06 = 0x06,
VST_HOST_OPCODE_07 = 0x07,
VST_HOST_OPCODE_08 = 0x08,
VST_HOST_OPCODE_09 = 0x09,
VST_HOST_OPCODE_0A = 0x0A,
VST_HOST_OPCODE_0B = 0x0B,
VST_HOST_OPCODE_0C = 0x0C,
VST_HOST_OPCODE_0D = 0x0D,
VST_HOST_OPCODE_0E = 0x0E,
VST_HOST_OPCODE_0F = 0x0F,
VST_HOST_OPCODE_10 = 0x10,
VST_HOST_OPCODE_11 = 0x11,
VST_HOST_OPCODE_12 = 0x12,
VST_HOST_OPCODE_13 = 0x13,
VST_HOST_OPCODE_14 = 0x14,
VST_HOST_OPCODE_15 = 0x15,
VST_HOST_OPCODE_16 = 0x16,
VST_HOST_OPCODE_17 = 0x17,
VST_HOST_OPCODE_18 = 0x18,
VST_HOST_OPCODE_19 = 0x19,
VST_HOST_OPCODE_1A = 0x1A,
VST_HOST_OPCODE_1B = 0x1B,
VST_HOST_OPCODE_1C = 0x1C,
VST_HOST_OPCODE_1D = 0x1D,
VST_HOST_OPCODE_1E = 0x1E,
VST_HOST_OPCODE_1F = 0x1F,
VST_HOST_OPCODE_20 = 0x20,
VST_HOST_OPCODE_21 = 0x21,
VST_HOST_OPCODE_22 = 0x22,
VST_HOST_OPCODE_23 = 0x23,
VST_HOST_OPCODE_24 = 0x24,
VST_HOST_OPCODE_25 = 0x25,
VST_HOST_OPCODE_26 = 0x26,
VST_HOST_OPCODE_27 = 0x27,
VST_HOST_OPCODE_28 = 0x28,
VST_HOST_OPCODE_29 = 0x29,
VST_HOST_OPCODE_2A = 0x2A,
/* Parameter gained focus.
*
* @param int1 Parameter index.
*/
VST_HOST_OPCODE_2B = 0x2B,
/* Parameter lost focus.
*
* @param int1 Parameter index.
*/
VST_HOST_OPCODE_2C = 0x2C,
VST_HOST_OPCODE_2D = 0x2D,
VST_HOST_OPCODE_2E = 0x2E,
VST_HOST_OPCODE_2F = 0x2F,
// Highest number of known OPCODE.
VST_HOST_OPCODE_MAX,
// Pad to force 32-bit number.
_VST_HOST_OPCODE_PAD = 0xFFFFFFFFul,
};
enum VST_ARRANGEMENT_TYPE {
/* Custom speaker arrangement.
*
* Accidentally discovered through random testing.
*/
VST_ARRANGEMENT_TYPE_CUSTOM = -2,
/* Unknown/Empty speaker layout.
*
*/
VST_ARRANGEMENT_TYPE_UNKNOWN = -1,
/* Mono
*/
VST_ARRANGEMENT_TYPE_MONO = 0,
/* Stereo
*/
VST_ARRANGEMENT_TYPE_STEREO = 1,
/* 5.1
*/
VST_ARRANGEMENT_TYPE_5_1 = 0x0F,
// Pad to force 32-bit number.
_VST_ARRANGEMENT_TYPE_PAD = 0xFFFFFFFFul,
};
enum VST_SPEAKER_TYPE {
VST_SPEAKER_TYPE_MONO = 0,
VST_SPEAKER_TYPE_LEFT = 1,
VST_SPEAKER_TYPE_RIGHT = 2,
VST_SPEAKER_TYPE_CENTER = 3,
VST_SPEAKER_TYPE_LFE = 4,
VST_SPEAKER_TYPE_LEFT_SIDE = 5,
VST_SPEAKER_TYPE_RIGHT_SIDE = 6,
// Pad to force 32-bit number.
_VST_SPEAKER_TYPE_PAD = 0xFFFFFFFFul,
};
/*******************************************************************************
|* Structures
|*/
struct vst_rect {
int16_t left;
int16_t top;
int16_t right;
int16_t bottom;
};
struct vst_effect {
int32_t magic_number; // Should always be VST_MAGICNUMBER
// 64-bit adds 4-byte padding here to align pointers.
/* Control the VST through an opcode and up to four parameters.
*
* @param this Pointer to the effect itself.
* @param opcode The opcode to run, see VST_EFFECT_OPCODES.
* @param p_int1 Parameter, see VST_EFFECT_OPCODES.
* @param p_int2 Parameter, see VST_EFFECT_OPCODES.
* @param p_ptr Parameter, see VST_EFFECT_OPCODES.
* @param p_float Parameter, see VST_EFFECT_OPCODES.
*/
intptr_t(VST_FUNCTION_INTERFACE* control)(vst_effect* pthis, VST_EFFECT_OPCODE opcode, int32_t p_int1,
intptr_t p_int2, void* p_ptr, float p_float);
/* Process the given number of samples in inputs and outputs.
*
* Different to process_float how? Never seen any difference.
*
* @param pthis Pointer to the effect itself.
* @param inputs Pointer to an array of 'const float[samples]' with size numInputs.
* @param outputs Pointer to an array of 'float[samples]' with size numOutputs.
* @param samples Number of samples per channel in inputs.
*/
void(VST_FUNCTION_INTERFACE* process)(vst_effect* pthis, const float* const* inputs, float** outputs,
int32_t samples);
/* Updates the value for the parameter at the given index, or does nothing if out of bounds.
*
* @param pthis Pointer to the effect itself.
* @param index Parameter index.
* @param value New value for the parameter.
*/
void(VST_FUNCTION_INTERFACE* set_parameter)(vst_effect* pthis, uint32_t index, float value);
/* Returns the value stored for the parameter at index, or 0 if out of bounds.
*
* @param pthis Pointer to the effect itself.
* @param index Parameter index.
* @return float Value of the parameter.
*/
float(VST_FUNCTION_INTERFACE* get_parameter)(vst_effect* pthis, uint32_t index);
int32_t num_programs; // Number of possible programs.
int32_t num_params; // Number of possible parameters.
int32_t num_inputs; // Number of inputs.
int32_t num_outputs; // Number of outputs.
/* Bitflags
*
* Bit Description
* 1 Effect has "Editor"
* 2 Unknown (Found in: ReaDelay)
* 3 Unknown (Found in: ReaDelay)
* 4 Unknown (Found in: ReaDelay)
* 5 Has process_float (Found in: ReaDelay, ReaComp, ReaControlMIDI, ReaStream, ReaFir)
* 6 Unknown (Found in: ReaControlMIDI, ReaStream, ReaFir)
* 10 Unknown (Found in: ReaFir)
* 13 Has process_double (Found in: ReaControlMIDI)
*/
int32_t flags;
// 64-bit adds 4-byte padding here to align pointers.
void* _unknown_ptr_00[2];
/* Initial delay before processing of samples can actually begin in Samples.
*
* Should be updated before or during handling the 0x47 control call.
*/
int32_t delay;
int32_t _unknown_int32_00[2]; // Unknown int32_t values.
float _unknown_float_00; // Seems to always be 1.0
void* effect_internal; // Pointer to Plugin internal data
void* host_internal; // Pointer to Host internal data.
/* Id of the plugin.
*
* Due to this not being enough for uniqueness, it should not be used alone
* for indexing. Ideally you want to index like this:
* [unique_id][module_name][version][flags]
* If any of the checks after unique_id fail, you default to the first
* possible choice.
*/
int32_t unique_id;
/* Plugin version
*
* Unrelated to the minimum VST Version, but often the same.
*/
int32_t version;
// There is no padding here if everything went right.
/* Process the given number of single samples in inputs and outputs.
*
* @param pthis Pointer to the effect itself.
* @param inputs Pointer to an array of 'const float[samples]' with size numInputs.
* @param outputs Pointer to an array of 'float[samples]' with size numOutputs.
* @param samples Number of samples per channel in inputs.
*/
void(VST_FUNCTION_INTERFACE* process_float)(vst_effect* pthis, const float* const* inputs, float** outputs,
int32_t samples);
/* Process the given number of double samples in inputs and outputs.
*
* Used only by 2.4 hosts and plugins, possibly restricted to said version.
*
* @param pthis Pointer to the effect itself.
* @param inputs Pointer to an array of 'const double[samples]' with size numInputs.
* @param outputs Pointer to an array of 'double[samples]' with size numOutputs.
* @param samples Number of samples per channel in inputs.
*/
void(VST_FUNCTION_INTERFACE* process_double)(vst_effect* pthis, const double* const* inputs, double** outputs,
int32_t samples);
// Everything after this is unknown and was present in reacomp-standalone.dll.
uint8_t _unknown[56]; // 56-bytes of something. Could also just be 52-bytes.
};
struct vst_speaker_properties {
float _unknown_00; // 10.0 if LFE, otherwise random? Never exceeds -PI to PI range.
float _unknown_04; // 10.0 if LFE, otherwise random? Never exceeds -PI to PI range.
float _unknown_08; // 0.0 if LFE, otherwise 1.0.
float _unknown_0C;
char name[VST_NAME_BUFFER_SIZE];
VST_SPEAKER_TYPE type;
uint8_t _unknown[28]; // Padding detected from testing.
};
struct vst_speaker_arrangement {
VST_ARRANGEMENT_TYPE type; // See VST_SPEAKER_ARRANGEMENT_TYPE
int32_t channels; // Number of channels in speakers.
vst_speaker_properties speakers[VST_MAX_CHANNELS]; // Array of speaker properties, actual size defined by channels.
};
/* Callback used by the plugin to interface with the host.
*
* @param opcode See VST_HOST_OPCODE
* @param p_str Zero terminated string or null on call.
* @return ?
*/
typedef intptr_t (*vst_host_callback)(vst_effect* plugin, VST_HOST_OPCODE opcode, int32_t p_int1, int64_t p_int2,
const char* p_str, int32_t p_int3);
static const char* vst_host_string[] = {
"GetResourcePath", // ReaControlMIDI
"get_ini_file", // ReaControlMIDI
"resolve_fn", // ReaControlMIDI
};
/* Entry point for VST2.x plugins.
*
* @return A new instance of the VST2.x effect.
*/
#define VST_ENTRYPOINT vst_effect* VSTPluginMain(vst_host_callback callback)
#define VST_ENTRYPOINT_WINDOWS \
vst_effect* MAIN(vst_host_callback callback) \
{ \
return VSTPluginMain(callback); \
}
#define VST_ENTRYPOINT_MACOS \
vst_effect* main_macho(vst_host_callback callback) \
{ \
return VSTPluginMain(callback); \
}
#ifdef __cplusplus
}
#endif
// Variable size variant of vst_speaker_arrangement.
#ifdef __cplusplus
template<size_t T>
struct vst_speaker_arrangement_t {
VST_ARRANGEMENT_TYPE type; // See VST_SPEAKER_ARRANGEMENT_TYPE
int32_t channels; // Number of channels in speakers.
vst_speaker_properties speakers[T]; // Array of speaker properties, actual size defined by channels.
};
#endif
#pragma pack(pop)
#endif