forked from Celemony/ARA_API
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ARAVST3.h
214 lines (184 loc) · 11.3 KB
/
ARAVST3.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
//------------------------------------------------------------------------------
//! \file ARAVST3.h
//! Celemony extension to the Steinberg VST3.7 SDK to integrate ARA into VST3 plug-ins
//! \project ARA API Specification
//! \copyright Copyright (c) 2012-2021, Celemony Software GmbH, All Rights Reserved.
//! Developed in cooperation with PreSonus Software Ltd.
//! \license Licensed under the Apache License, Version 2.0 (the "License");
//! you may not use this file except in compliance with the License.
//! You may obtain a copy of the License at
//!
//! http://www.apache.org/licenses/LICENSE-2.0
//!
//! Unless required by applicable law or agreed to in writing, software
//! distributed under the License is distributed on an "AS IS" BASIS,
//! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//! See the License for the specific language governing permissions and
//! limitations under the License.
//------------------------------------------------------------------------------
#ifndef ARAVST3_h
#define ARAVST3_h
/***************************************************************************************************/
// This is a Celemony extension to the Steinberg VST3.7.1 SDK to integrate ARA into VST3 plug-ins
// VST is a trademark of Steinberg Media Technologies GmbH
/***************************************************************************************************/
#include "ARAInterface.h"
//! Locally suppress some warnings that may be enabled in some context these headers are compiled.
//@{
#if !defined (ARA_DISABLE_VST3_WARNINGS_BEGIN) || !defined (ARA_DISABLE_VST3_WARNINGS_END)
#if defined (_MSC_VER)
#define ARA_DISABLE_VST3_WARNINGS_BEGIN \
__pragma (warning(push)) \
__pragma (warning(disable : 4310)) /*cast truncates constant value*/\
__pragma (warning(disable : 4365)) /*signed/unsigned mismatch*/\
__pragma (warning(disable : 4996)) /*function may be unsafe*/\
__pragma (warning(disable : 6011)) /*dereferencing NULL pointer*/\
__pragma (warning(disable : 6031)) /*return value ignored*/\
__pragma (warning(disable : 6308)) /*'realloc' may return null pointer*/\
__pragma (warning(disable : 6330)) /*'const char' passed when 'unsigned char' is required*/\
__pragma (warning(disable : 6385)) /*readable size is smaller than bytes may be read*/\
__pragma (warning(disable : 6386)) /*buffer overrun*/\
__pragma (warning(disable : 26434)) /*function hides a non-virtual function*/\
__pragma (warning(disable : 26435)) /*virtual functions should specify exactly one of virtual, override, or final*/\
__pragma (warning(disable : 26439)) /*if your function may not throw, declare it noexcept*/\
__pragma (warning(disable : 26443)) /*overriding destructor should not use explicit 'override' or 'virtual' specifiers*/\
__pragma (warning(disable : 26451)) /*arithmetic overflow*/\
__pragma (warning(disable : 26456)) /*hiding base methods that aren't virtual is error prone*/\
__pragma (warning(disable : 26461)) /*pointer argument can be marked as a pointer to const*/\
__pragma (warning(disable : 26496)) /*variable is assigned only once, mark it as const*/\
__pragma (warning(disable : 26812)) /*enum type is unscoped*/\
__pragma (warning(disable : 26814)) /*const variable can be computed at compile-time*/\
__pragma (warning(disable : 28199)) /*using possibly uninitialized memory*/\
__pragma (warning(disable : 28251)) /*inconsistent annotation for function*/
#define ARA_DISABLE_VST3_WARNINGS_END \
__pragma (warning(pop))
#elif defined (__GNUC__)
#define ARA_DISABLE_VST3_PRAGMA_PACK_WARNINGS
#if defined (__has_warning)
#if __has_warning ("-Wpragma-pack")
#undef ARA_DISABLE_VST3_PRAGMA_PACK_WARNINGS
#define ARA_DISABLE_VST3_PRAGMA_PACK_WARNINGS _Pragma ("GCC diagnostic ignored \"-Wpragma-pack\"")
#endif
#endif
#if defined (__clang__)
#define ARA_DISABLE_VST3_GCC_VARIANT_WARNINGS \
_Pragma ("GCC diagnostic ignored \"-Wshadow-field\"") \
_Pragma ("GCC diagnostic ignored \"-Wshadow-field-in-constructor\"") \
_Pragma ("GCC diagnostic ignored \"-Winconsistent-missing-destructor-override\"") \
_Pragma ("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"") \
_Pragma ("GCC diagnostic ignored \"-Wreserved-id-macro\"")
#else
#define ARA_DISABLE_VST3_GCC_VARIANT_WARNINGS \
_Pragma ("GCC diagnostic ignored \"-Wshadow\"") \
_Pragma ("GCC diagnostic ignored \"-Wclass-memaccess\"")
#endif
#define ARA_DISABLE_VST3_WARNINGS_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wnon-virtual-dtor\"") \
_Pragma ("GCC diagnostic ignored \"-Wunused-parameter\"") \
_Pragma ("GCC diagnostic ignored \"-Wsign-conversion\"") \
_Pragma ("GCC diagnostic ignored \"-Wold-style-cast\"") \
_Pragma ("GCC diagnostic ignored \"-Wextra-semi\"") \
_Pragma ("GCC diagnostic ignored \"-Wignored-qualifiers\"") \
_Pragma ("GCC diagnostic ignored \"-Wundef\"") \
ARA_DISABLE_VST3_PRAGMA_PACK_WARNINGS \
ARA_DISABLE_VST3_GCC_VARIANT_WARNINGS
#define ARA_DISABLE_VST3_WARNINGS_END \
_Pragma ("GCC diagnostic pop")
#else
#define ARA_DISABLE_VST3_WARNINGS_BEGIN
#define ARA_DISABLE_VST3_WARNINGS_END
#endif
#endif
//@}
ARA_DISABLE_VST3_WARNINGS_BEGIN
#include "pluginterfaces/base/funknown.h"
#include "pluginterfaces/base/falignpush.h"
namespace ARA
{
//! @defgroup Companion_APIs Companion APIs
//! @{
//! @defgroup VST3 VST3
//! @{
/***************************************************************************************************/
//! Interface class to be implemented by an object provided by the VST3 factory.
//! The host can use the VST3 factory to directly obtain the ARA factory, which allows for creating
//! and maintaining the model independently of any IAudioProcessor instances, enabling tasks such as
//! automatic tempo detection or audio-to-MIDI conversion.
//! For rendering and editing the model however, there must be an associated IAudioProcessor class
//! provided in the same binary.
//! This match is usually trivial because there typically is only one such class in the binary, but
//! there are cases such as WaveShell where multiple plug-ins live in the same binary, and only a
//! subset of those plug-ins support ARA. In this scenario, the plug-in must use the same class name
//! for the matching pair of ARA::IMainFactory and IAudioProcessor classes - this enables the host
//! to quickly identify the matching pairs without having to create instances of all the
//! IAudioProcessor classes to query their IPlugInEntryPoint::getFactory ()->factoryID to perform
//! the matching.
class IMainFactory: public Steinberg::FUnknown
{
public:
//! Get the ARA factory.
//! The returned pointer must remain valid throughout the lifetime of the object that provided it.
//! The returned ARAFactory must be equal to the ARAFactory provided by the associated
//! IAudioProcessor class through its IPlugInEntryPoint.
virtual const ARAFactory* PLUGIN_API getFactory () = 0;
static const Steinberg::FUID iid;
};
//! Class category name for the ARA::IMainFactory.
#if !defined (kARAMainFactoryClass)
#define kARAMainFactoryClass "ARA Main Factory Class"
#endif
DECLARE_CLASS_IID (IMainFactory, 0xDB2A1669, 0xFAFD42A5, 0xA82F864F, 0x7B6872EA)
/***************************************************************************************************/
//! Interface class to be implemented by the VST3 IAudioProcessor component (kVstAudioEffectClass).
class IPlugInEntryPoint: public Steinberg::FUnknown
{
public:
//! Get the ARA factory.
//! The returned pointer must remain valid throughout the lifetime of the object that provided it.
//! The returned ARAFactory must be equal to the ARAFactory provided by the associated IMainFactory.
//! To prevent ambiguities, the name of the plug-in as stored in the PClassInfo.name of this
//! class must match the ARAFactory.plugInName returned here.
virtual const ARAFactory* PLUGIN_API getFactory () = 0;
//! Bind the VST3 instance to an ARA document controller, switching it from "normal" operation
//! to ARA mode, and exposing the ARA plug-in extension.
//! Note that since ARA 2.0, this call has been deprecated and replaced with
//! bindToDocumentControllerWithRoles ().
//! This deprecated call is equivalent to the new call with no known roles set, however all
//! ARA 1.x hosts are in fact using all instances with playback renderer, edit renderer and
//! editor view role enabled, so plug-ins implementing ARA 1 backwards compatibility can
//! safely assume those three roles to be enabled if this call was made.
//! Same call order rules as bindToDocumentControllerWithRoles () apply.
ARA_DEPRECATED (2_0_Draft) virtual const ARAPlugInExtensionInstance* PLUGIN_API bindToDocumentController (ARADocumentControllerRef documentControllerRef) = 0;
static const Steinberg::FUID iid;
};
DECLARE_CLASS_IID (IPlugInEntryPoint, 0x12814E54, 0xA1CE4076, 0x82B96813, 0x16950BD6)
//! ARA 2 extension of IPlugInEntryPoint
class ARA_ADDENDUM (2_0_Draft) IPlugInEntryPoint2: public Steinberg::FUnknown
{
public:
//! Extended version of bindToDocumentController ():
//! bind the VST3 instance to an ARA document controller, switching it from "normal" operation
//! to ARA mode with the assigned roles, and exposing the ARA plug-in extension.
//! \p knownRoles encodes all roles that the host considered in its implementation and will explicitly
//! assign to some plug-in instance(s), while \p assignedRoles describes the roles that this specific
//! instance will fulfill.
//! This may be called only once during the lifetime of the IAudioProcessor component, before
//! the first call to setActive () or setState () or getProcessContextRequirements () or the
//! creation of the GUI (see IPlugView).
//! The ARA document controller must remain valid as long as the plug-in is in use - rendering,
//! showing its UI, etc. However, when tearing down the plug-in, the actual order for deleting
//! the IAudioProcessor instance and for deleting ARA document controller is undefined.
//! Plug-ins must handle both potential destruction orders to allow for a simpler reference
//! counting implementation on the host side.
virtual const ARAPlugInExtensionInstance* PLUGIN_API bindToDocumentControllerWithRoles (ARADocumentControllerRef documentControllerRef,
ARAPlugInInstanceRoleFlags knownRoles, ARAPlugInInstanceRoleFlags assignedRoles) = 0;
static const Steinberg::FUID iid;
};
DECLARE_CLASS_IID (IPlugInEntryPoint2, 0xCD9A5913, 0xC9EB46D7, 0x96CA53AD, 0xD1DB89F5)
//! @}
//! @}
} // namespace ARA
#include "pluginterfaces/base/falignpop.h"
ARA_DISABLE_VST3_WARNINGS_END
#endif // ARAVST3_h