ARAVST3.h 11 KB

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