ARAHostDispatch.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. //------------------------------------------------------------------------------
  2. //! \file ARAHostDispatch.h
  3. //! C-to-C++ adapter for implementing ARA hosts
  4. //! Originally written and contributed to the ARA SDK by PreSonus Software Ltd.
  5. //! \project ARA SDK Library
  6. //! \copyright Copyright (c) 2012-2021, Celemony Software GmbH, All Rights Reserved.
  7. //! Developed in cooperation with PreSonus Software Ltd.
  8. //! \license Licensed under the Apache License, Version 2.0 (the "License");
  9. //! you may not use this file except in compliance with the License.
  10. //! You may obtain a copy of the License at
  11. //!
  12. //! http://www.apache.org/licenses/LICENSE-2.0
  13. //!
  14. //! Unless required by applicable law or agreed to in writing, software
  15. //! distributed under the License is distributed on an "AS IS" BASIS,
  16. //! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. //! See the License for the specific language governing permissions and
  18. //! limitations under the License.
  19. //------------------------------------------------------------------------------
  20. #ifndef ARAHostDispatch_h
  21. #define ARAHostDispatch_h
  22. #include "ARA_Library/Dispatch/ARADispatchBase.h"
  23. #include "ARA_Library/Dispatch/ARAContentReader.h"
  24. namespace ARA {
  25. namespace Host {
  26. //! @addtogroup ARA_Library_Host_Dispatch
  27. //! @{
  28. /*******************************************************************************/
  29. /** Optional ARA 1 backwards compatibility.
  30. Host can choose support ARA 1 plug-ins in addition to ARA 2 plug-ins.
  31. This results in several restrictions being implicitly imposed when using such plug-ins
  32. through the implementation provided here:
  33. - each plug-in instance assumes all possible roles (see ARAPlugInInstanceRoleFlags)
  34. - each plug-in instance only is associated with at most one playback region at any time
  35. - the ARA 1 API is mapped to PlaybackRenderer*, the other interfaces will not be provided
  36. - archiving must use ARA 1 style monolithic persistency calls
  37. */
  38. /*******************************************************************************/
  39. #if !defined (ARA_SUPPORT_VERSION_1)
  40. #define ARA_SUPPORT_VERSION_1 0
  41. #endif
  42. #if ARA_SUPPORT_VERSION_1 && ARA_CPU_ARM
  43. #error "ARA v1 is not supported on ARM architecture"
  44. #endif
  45. /*******************************************************************************/
  46. /** Type safe conversions to/from host ref: toHostRef () and fromHostRef<> ().
  47. This macro defines custom overloads of the toHostRef () and fromHostRef<> () conversion functions
  48. which act as type safe casts between your implementation class pointers and the opaque host refs
  49. that the ARA API uses.
  50. fromHostRef<>() additionally allows for optional up-casting from base to derived classes if needed.
  51. The first macro argument is your implementation class, followed by all host ref types that you
  52. want this class to comply with.
  53. \br
  54. Whenever using your C++ object pointers as host refs, you should apply the conversion macros like so:
  55. \code{.cpp}
  56. // declare the conversion in the appropriate header
  57. class MyHostAudioSource;
  58. ARA_MAP_HOST_REF (MyHostAudioSource, ARAAudioSourceHostRef)
  59. // whenever exporting host refs to the plug-in, use toHostRef ()
  60. MyHostAudioSource* audioSource = ...;
  61. ARAAudioSourceHostRef audioSourceHostRef = toHostRef (audioSource);
  62. // whenever the plug-in passes a host ref back to you, use fromHostRef<> ()
  63. ARAAudioSourceHostRef audioSourceHostRef; // usually provided as argument to a function call
  64. MyHostAudioSource* audioSource = fromHostRef (audioSourceHostRef);
  65. \endcode
  66. */
  67. /*******************************************************************************/
  68. #if !defined (ARA_MAP_HOST_REF)
  69. #define ARA_MAP_HOST_REF(HostClassType, FirstHostRefType, ...) \
  70. static inline ARA::ToRefConversionHelper<HostClassType, FirstHostRefType, ##__VA_ARGS__> toHostRef (const HostClassType* ptr) noexcept { return ARA::ToRefConversionHelper<HostClassType, FirstHostRefType, ##__VA_ARGS__> { ptr }; } \
  71. template <typename DesiredHostClassType = HostClassType, typename HostRefType, typename std::enable_if<std::is_constructible<ARA::FromRefConversionHelper<HostClassType, FirstHostRefType, ##__VA_ARGS__>, HostRefType>::value, bool>::type = true> \
  72. static inline DesiredHostClassType* fromHostRef (HostRefType ref) noexcept { HostClassType* object { ARA::FromRefConversionHelper<HostClassType, FirstHostRefType, ##__VA_ARGS__> (ref) }; return static_cast<DesiredHostClassType*> (object); }
  73. #endif
  74. /*******************************************************************************/
  75. /** Tag objects maintained by the plug-in to prevent accidentally copying/moving them. */
  76. /*******************************************************************************/
  77. #if !defined (ARA_PLUGIN_MANAGED_OBJECT)
  78. #define ARA_PLUGIN_MANAGED_OBJECT ARA_DISABLE_COPY_AND_MOVE
  79. #endif
  80. /*******************************************************************************/
  81. // Properties
  82. /** C++ wrapper for ARA variable-sized properties structs, ensures their proper initialization. */
  83. /*******************************************************************************/
  84. #if defined (__cpp_template_auto)
  85. template <auto member>
  86. using Properties = SizedStruct<member>;
  87. #else
  88. template <typename StructType, typename MemberType, MemberType StructType::*member>
  89. using Properties = SizedStruct<StructType, MemberType, member>;
  90. #endif
  91. //! @addtogroup ARA_Library_Host_Dispatch_Host_Interfaces Host Interfaces
  92. //! @{
  93. /*******************************************************************************/
  94. // AudioAccessController
  95. /** Base class for implementing ARAAudioAccessControllerInterface. */
  96. /*******************************************************************************/
  97. class AudioAccessControllerInterface
  98. {
  99. public:
  100. virtual ~AudioAccessControllerInterface () = default;
  101. //! \copydoc ARAAudioAccessControllerInterface::createAudioReaderForSource
  102. virtual ARAAudioReaderHostRef createAudioReaderForSource (ARAAudioSourceHostRef audioSourceHostRef, bool use64BitSamples) noexcept = 0;
  103. //! \copydoc ARAAudioAccessControllerInterface::readAudioSamples
  104. virtual bool readAudioSamples (ARAAudioReaderHostRef audioReaderHostRef, ARASamplePosition samplePosition, ARASampleCount samplesPerChannel, void* const buffers[]) noexcept = 0;
  105. //! \copydoc ARAAudioAccessControllerInterface::destroyAudioReader
  106. virtual void destroyAudioReader (ARAAudioReaderHostRef audioReaderHostRef) noexcept = 0;
  107. };
  108. ARA_MAP_HOST_REF (AudioAccessControllerInterface, ARAAudioAccessControllerHostRef)
  109. /*******************************************************************************/
  110. // ArchivingController
  111. /** Base class for implementing ARAArchivingControllerInterface. */
  112. /*******************************************************************************/
  113. class ArchivingControllerInterface
  114. {
  115. public:
  116. virtual ~ArchivingControllerInterface () = default;
  117. //! \copydoc ARAArchivingControllerInterface::getArchiveSize
  118. virtual ARASize getArchiveSize (ARAArchiveReaderHostRef archiveReaderHostRef) noexcept = 0;
  119. //! \copydoc ARAArchivingControllerInterface::readBytesFromArchive
  120. virtual bool readBytesFromArchive (ARAArchiveReaderHostRef archiveReaderHostRef, ARASize position, ARASize length, ARAByte buffer[]) noexcept = 0;
  121. //! \copydoc ARAArchivingControllerInterface::writeBytesToArchive
  122. virtual bool writeBytesToArchive (ARAArchiveWriterHostRef archiveWriterHostRef, ARASize position, ARASize length, const ARAByte buffer[]) noexcept = 0;
  123. //! \copydoc ARAArchivingControllerInterface::notifyDocumentArchivingProgress
  124. virtual void notifyDocumentArchivingProgress (float value) noexcept = 0;
  125. //! \copydoc ARAArchivingControllerInterface::notifyDocumentUnarchivingProgress
  126. virtual void notifyDocumentUnarchivingProgress (float value) noexcept = 0;
  127. //! \copydoc ARAArchivingControllerInterface::getDocumentArchiveID
  128. virtual ARAPersistentID getDocumentArchiveID (ARAArchiveReaderHostRef archiveReaderHostRef) noexcept = 0;
  129. };
  130. ARA_MAP_HOST_REF (ArchivingControllerInterface, ARAArchivingControllerHostRef)
  131. /*******************************************************************************/
  132. // ContentAccessController
  133. /** Base class for implementing ARAContentAccessControllerInterface. */
  134. /*******************************************************************************/
  135. class ContentAccessControllerInterface
  136. {
  137. public:
  138. virtual ~ContentAccessControllerInterface () = default;
  139. //! \copydoc ARAContentAccessControllerInterface::isMusicalContextContentAvailable
  140. virtual bool isMusicalContextContentAvailable (ARAMusicalContextHostRef musicalContextHostRef, ARAContentType type) noexcept = 0;
  141. //! \copydoc ARAContentAccessControllerInterface::getMusicalContextContentGrade
  142. virtual ARAContentGrade getMusicalContextContentGrade (ARAMusicalContextHostRef musicalContextHostRef, ARAContentType type) noexcept = 0;
  143. //! \copydoc ARAContentAccessControllerInterface::createMusicalContextContentReader
  144. virtual ARAContentReaderHostRef createMusicalContextContentReader (ARAMusicalContextHostRef musicalContextHostRef, ARAContentType type, const ARAContentTimeRange* range) noexcept = 0;
  145. //! \copydoc ARAContentAccessControllerInterface::isAudioSourceContentAvailable
  146. virtual bool isAudioSourceContentAvailable (ARAAudioSourceHostRef audioSourceHostRef, ARAContentType type) noexcept = 0;
  147. //! \copydoc ARAContentAccessControllerInterface::getAudioSourceContentGrade
  148. virtual ARAContentGrade getAudioSourceContentGrade (ARAAudioSourceHostRef audioSourceHostRef, ARAContentType type) noexcept = 0;
  149. //! \copydoc ARAContentAccessControllerInterface::createAudioSourceContentReader
  150. virtual ARAContentReaderHostRef createAudioSourceContentReader (ARAAudioSourceHostRef audioSourceHostRef, ARAContentType type, const ARAContentTimeRange* range) noexcept = 0;
  151. //! \copydoc ARAContentAccessControllerInterface::getContentReaderEventCount
  152. virtual ARAInt32 getContentReaderEventCount (ARAContentReaderHostRef contentReaderHostRef) noexcept = 0;
  153. //! \copydoc ARAContentAccessControllerInterface::getContentReaderDataForEvent
  154. virtual const void* getContentReaderDataForEvent (ARAContentReaderHostRef contentReaderHostRef, ARAInt32 eventIndex) noexcept = 0;
  155. //! \copydoc ARAContentAccessControllerInterface::destroyContentReader
  156. virtual void destroyContentReader (ARAContentReaderHostRef contentReaderHostRef) noexcept = 0;
  157. };
  158. ARA_MAP_HOST_REF (ContentAccessControllerInterface, ARAContentAccessControllerHostRef)
  159. /*******************************************************************************/
  160. // ModelUpdateController
  161. /** Base class for implementing ARAModelUpdateControllerInterface. */
  162. /*******************************************************************************/
  163. class ModelUpdateControllerInterface
  164. {
  165. public:
  166. virtual ~ModelUpdateControllerInterface () = default;
  167. //! \copydoc ARAModelUpdateControllerInterface::notifyAudioSourceAnalysisProgress
  168. virtual void notifyAudioSourceAnalysisProgress (ARAAudioSourceHostRef audioSourceHostRef, ARAAnalysisProgressState state, float value) noexcept = 0;
  169. //! \copydoc ARAModelUpdateControllerInterface::notifyAudioSourceContentChanged
  170. virtual void notifyAudioSourceContentChanged (ARAAudioSourceHostRef audioSourceHostRef, const ARAContentTimeRange* range, ContentUpdateScopes scopeFlags) noexcept = 0;
  171. //! \copydoc ARAModelUpdateControllerInterface::notifyAudioModificationContentChanged
  172. virtual void notifyAudioModificationContentChanged (ARAAudioModificationHostRef audioModificationHostRef, const ARAContentTimeRange* range, ContentUpdateScopes scopeFlags) noexcept = 0;
  173. //! \copydoc ARAModelUpdateControllerInterface::notifyPlaybackRegionContentChanged
  174. virtual void notifyPlaybackRegionContentChanged (ARAPlaybackRegionHostRef playbackRegionHostRef, const ARAContentTimeRange* range, ContentUpdateScopes scopeFlags) noexcept = 0;
  175. };
  176. ARA_MAP_HOST_REF (ModelUpdateControllerInterface, ARAModelUpdateControllerHostRef)
  177. /*******************************************************************************/
  178. // PlaybackController
  179. /** Base class for implementing ARAPlaybackControllerInterface. */
  180. /*******************************************************************************/
  181. class PlaybackControllerInterface
  182. {
  183. public:
  184. virtual ~PlaybackControllerInterface () = default;
  185. //! \copydoc ARAPlaybackControllerInterface::requestStartPlayback
  186. virtual void requestStartPlayback () noexcept = 0;
  187. //! \copydoc ARAPlaybackControllerInterface::requestStopPlayback
  188. virtual void requestStopPlayback () noexcept = 0;
  189. //! \copydoc ARAPlaybackControllerInterface::requestSetPlaybackPosition
  190. virtual void requestSetPlaybackPosition (ARATimePosition timePosition) noexcept = 0;
  191. //! \copydoc ARAPlaybackControllerInterface::requestSetCycleRange
  192. virtual void requestSetCycleRange (ARATimePosition startTime, ARATimeDuration duration) noexcept = 0;
  193. //! \copydoc ARAPlaybackControllerInterface::requestEnableCycle
  194. virtual void requestEnableCycle (bool enable) noexcept = 0;
  195. };
  196. ARA_MAP_HOST_REF (PlaybackControllerInterface, ARAPlaybackControllerHostRef)
  197. /*******************************************************************************/
  198. // DocumentControllerHostInstance
  199. /** Wrapper class for the ARADocumentControllerHostInstance. */
  200. /*******************************************************************************/
  201. class DocumentControllerHostInstance : public SizedStruct<ARA_STRUCT_MEMBER (ARADocumentControllerHostInstance, playbackControllerInterface)>
  202. {
  203. public:
  204. #if __cplusplus >= 201402L
  205. constexpr
  206. #endif
  207. DocumentControllerHostInstance () noexcept : BaseType {} {}
  208. DocumentControllerHostInstance (AudioAccessControllerInterface* audioAccessController,
  209. ArchivingControllerInterface* archivingController,
  210. ContentAccessControllerInterface* contentAccessController = nullptr,
  211. ModelUpdateControllerInterface* modelUpdateController = nullptr,
  212. PlaybackControllerInterface* playbackController = nullptr) noexcept;
  213. AudioAccessControllerInterface* getAudioAccessController () const noexcept
  214. { return fromHostRef (audioAccessControllerHostRef); }
  215. void setAudioAccessController (AudioAccessControllerInterface* audioAccessController) noexcept;
  216. ArchivingControllerInterface* getArchivingController () const noexcept
  217. { return fromHostRef (archivingControllerHostRef); }
  218. void setArchivingController (ArchivingControllerInterface* archivingController) noexcept;
  219. ContentAccessControllerInterface* getContentAccessController () const noexcept
  220. { return fromHostRef (contentAccessControllerHostRef); }
  221. void setContentAccessController (ContentAccessControllerInterface* contentAccessController) noexcept;
  222. ModelUpdateControllerInterface* getModelUpdateController () const noexcept
  223. { return fromHostRef (modelUpdateControllerHostRef); }
  224. void setModelUpdateController (ModelUpdateControllerInterface* modelUpdateController) noexcept;
  225. PlaybackControllerInterface* getPlaybackController () const noexcept
  226. { return fromHostRef (playbackControllerHostRef); }
  227. void setPlaybackController (PlaybackControllerInterface* playbackController) noexcept;
  228. };
  229. //! @} ARA_Library_Host_Dispatch_Host_Interfaces
  230. //! @defgroup ARA_Library_Host_Dispatch_Plug-In_Interface_Wrappers Plug-In Interface Wrappers
  231. //! Wrappers for the interfaces used to communicate with and control ARA plug-ins.
  232. //! @{
  233. /*******************************************************************************/
  234. // DocumentController
  235. /** Wrapper class for the plug-in ARADocumentControllerInterface. */
  236. /*******************************************************************************/
  237. class DocumentController : public InterfaceInstance<ARADocumentControllerRef, ARADocumentControllerInterface>
  238. {
  239. public:
  240. explicit DocumentController (const ARADocumentControllerInstance* instance) noexcept
  241. : BaseType { instance->documentControllerRef, instance->documentControllerInterface }
  242. {}
  243. //! @name Destruction
  244. //@{
  245. //! \copydoc ARADocumentControllerInterface::destroyDocumentController
  246. void destroyDocumentController () noexcept;
  247. //@}
  248. //! @name Factory
  249. //@{
  250. //! \copydoc ARADocumentControllerInterface::getFactory
  251. const ARAFactory* getFactory () noexcept;
  252. //@}
  253. //! @name Update Management
  254. //@{
  255. //! \copydoc ARADocumentControllerInterface::beginEditing
  256. void beginEditing () noexcept;
  257. //! \copydoc ARADocumentControllerInterface::endEditing
  258. void endEditing () noexcept;
  259. //! \copydoc ARADocumentControllerInterface::notifyModelUpdates
  260. void notifyModelUpdates () noexcept;
  261. //@}
  262. //! @name Archiving
  263. //@{
  264. // deprecated ARA 1 monolithic persistency calls, must be used unless requiring plug-ins to support kARAAPIGeneration_2_0_Final
  265. //! \copydoc ARADocumentControllerInterface::beginRestoringDocumentFromArchive
  266. ARA_DEPRECATED(2_0_Final) bool beginRestoringDocumentFromArchive (ARAArchiveReaderHostRef archiveReaderHostRef) noexcept;
  267. //! \copydoc ARADocumentControllerInterface::endRestoringDocumentFromArchive
  268. ARA_DEPRECATED(2_0_Final) bool endRestoringDocumentFromArchive (ARAArchiveReaderHostRef archiveReaderHostRef) noexcept;
  269. //! \copydoc ARADocumentControllerInterface::storeDocumentToArchive
  270. ARA_DEPRECATED(2_0_Final) bool storeDocumentToArchive (ARAArchiveWriterHostRef archiveWriterHostRef) noexcept;
  271. //! If supporting both types of persistency, this call can be used to pick the appropriate type for the given plug-in.
  272. ARA_DEPRECATED(2_0_Final) bool supportsPartialPersistency () noexcept;
  273. // new ARA 2 partial persistency calls, may only be used for plug-ins that support the new ARA 2 persistency,
  274. // which is part of kARAAPIGeneration_2_0_Final (but not yet present in kARAAPIGeneration_2_0_Draft !)
  275. //! \copydoc ARADocumentControllerInterface::restoreObjectsFromArchive
  276. bool restoreObjectsFromArchive (ARAArchiveReaderHostRef archiveReaderHostRef, const ARARestoreObjectsFilter* filter) noexcept;
  277. //! \copydoc ARADocumentControllerInterface::storeObjectsToArchive
  278. bool storeObjectsToArchive (ARAArchiveWriterHostRef archiveWriterHostRef, const ARAStoreObjectsFilter* filter) noexcept;
  279. //! Test whether storeAudioSourceToAudioFileChunk () is supported by the plug-in.
  280. bool supportsStoringAudioFileChunks () noexcept;
  281. //! \copydoc ARADocumentControllerInterface::storeAudioSourceToAudioFileChunk
  282. bool storeAudioSourceToAudioFileChunk (ARAArchiveWriterHostRef archiveWriterHostRef, ARAAudioSourceRef audioSourceRef, ARAPersistentID* documentArchiveID, bool* openAutomatically) noexcept;
  283. //@}
  284. //! @name Document Management
  285. //@{
  286. //! \copydoc ARADocumentControllerInterface::updateDocumentProperties
  287. void updateDocumentProperties (const ARADocumentProperties* properties) noexcept;
  288. //@}
  289. //! @name Musical Context Management
  290. //@{
  291. //! \copydoc ARADocumentControllerInterface::createMusicalContext
  292. ARAMusicalContextRef createMusicalContext (ARAMusicalContextHostRef hostRef, const ARAMusicalContextProperties* properties) noexcept;
  293. //! \copydoc ARADocumentControllerInterface::updateMusicalContextProperties
  294. void updateMusicalContextProperties (ARAMusicalContextRef musicalContextRef, const ARAMusicalContextProperties* properties) noexcept;
  295. //! \copydoc ARADocumentControllerInterface::updateMusicalContextContent
  296. void updateMusicalContextContent (ARAMusicalContextRef musicalContextRef, const ARAContentTimeRange* range, ContentUpdateScopes scopeFlags) noexcept;
  297. //! \copydoc ARADocumentControllerInterface::destroyMusicalContext
  298. void destroyMusicalContext (ARAMusicalContextRef musicalContextRef) noexcept;
  299. //@}
  300. //! @name Region Sequence Management
  301. //! (resolves to no-ops for pre-ARA-2.0 plug-ins)
  302. //@{
  303. //! \copydoc ARADocumentControllerInterface::createRegionSequence
  304. ARARegionSequenceRef createRegionSequence (ARARegionSequenceHostRef hostRef, const ARARegionSequenceProperties* properties) noexcept;
  305. //! \copydoc ARADocumentControllerInterface::updateRegionSequenceProperties
  306. void updateRegionSequenceProperties (ARARegionSequenceRef regionSequenceRef, const ARARegionSequenceProperties* properties) noexcept;
  307. //! \copydoc ARADocumentControllerInterface::destroyRegionSequence
  308. void destroyRegionSequence (ARARegionSequenceRef regionSequenceRef) noexcept;
  309. //@}
  310. //! @name Audio Source Management
  311. //@{
  312. //! \copydoc ARADocumentControllerInterface::createAudioSource
  313. ARAAudioSourceRef createAudioSource (ARAAudioSourceHostRef hostRef, const ARAAudioSourceProperties* properties) noexcept;
  314. //! \copydoc ARADocumentControllerInterface::updateAudioSourceProperties
  315. void updateAudioSourceProperties (ARAAudioSourceRef audioSourceRef, const ARAAudioSourceProperties* properties) noexcept;
  316. //! \copydoc ARADocumentControllerInterface::updateAudioSourceContent
  317. void updateAudioSourceContent (ARAAudioSourceRef audioSourceRef, const ARAContentTimeRange* range, ContentUpdateScopes scopeFlags) noexcept;
  318. //! \copydoc ARADocumentControllerInterface::enableAudioSourceSamplesAccess
  319. void enableAudioSourceSamplesAccess (ARAAudioSourceRef audioSourceRef, bool enable) noexcept;
  320. //! \copydoc ARADocumentControllerInterface::deactivateAudioSourceForUndoHistory
  321. void deactivateAudioSourceForUndoHistory (ARAAudioSourceRef audioSourceRef, bool deactivate) noexcept;
  322. //! \copydoc ARADocumentControllerInterface::destroyAudioSource
  323. void destroyAudioSource (ARAAudioSourceRef audioSourceRef) noexcept;
  324. //@}
  325. //! @name Audio Modification Management
  326. //@{
  327. //! \copydoc ARADocumentControllerInterface::createAudioModification
  328. ARAAudioModificationRef createAudioModification (ARAAudioSourceRef audioSourceRef, ARAAudioModificationHostRef hostRef, const ARAAudioModificationProperties* properties) noexcept;
  329. //! \copydoc ARADocumentControllerInterface::cloneAudioModification
  330. ARAAudioModificationRef cloneAudioModification (ARAAudioModificationRef audioModificationRef, ARAAudioModificationHostRef hostRef, const ARAAudioModificationProperties* properties) noexcept;
  331. //! \copydoc ARADocumentControllerInterface::updateAudioModificationProperties
  332. void updateAudioModificationProperties (ARAAudioModificationRef audioModificationRef, const ARAAudioModificationProperties* properties) noexcept;
  333. //! \copydoc ARADocumentControllerInterface::deactivateAudioModificationForUndoHistory
  334. void deactivateAudioModificationForUndoHistory (ARAAudioModificationRef audioModificationRef, bool deactivate) noexcept;
  335. //! \copydoc ARADocumentControllerInterface::destroyAudioModification
  336. void destroyAudioModification (ARAAudioModificationRef audioModificationRef) noexcept;
  337. //@}
  338. //! @name Playback Region Management
  339. //! (getPlaybackRegionHeadAndTailTime () resolves to no-op for pre-ARA-2.0 plug-ins and always returns 0.0 as times)
  340. //@{
  341. //! \copydoc ARADocumentControllerInterface::createPlaybackRegion
  342. ARAPlaybackRegionRef createPlaybackRegion (ARAAudioModificationRef audioModificationRef, ARAPlaybackRegionHostRef hostRef, const ARAPlaybackRegionProperties* properties) noexcept;
  343. //! \copydoc ARADocumentControllerInterface::updatePlaybackRegionProperties
  344. void updatePlaybackRegionProperties (ARAPlaybackRegionRef playbackRegionRef, const ARAPlaybackRegionProperties* properties) noexcept;
  345. //! \copydoc ARADocumentControllerInterface::getPlaybackRegionHeadAndTailTime
  346. void getPlaybackRegionHeadAndTailTime (ARAPlaybackRegionRef playbackRegionRef, ARATimeDuration* headTime, ARATimeDuration* tailTime) noexcept;
  347. //! \copydoc ARADocumentControllerInterface::destroyPlaybackRegion
  348. void destroyPlaybackRegion (ARAPlaybackRegionRef playbackRegionRef) noexcept;
  349. //@}
  350. //! @name Content Reader Management
  351. //! See ContentReader<> class below which conveniently wraps some of these calls.
  352. //@{
  353. //! \copydoc ARADocumentControllerInterface::isAudioSourceContentAvailable
  354. bool isAudioSourceContentAvailable (ARAAudioSourceRef audioSourceRef, ARAContentType type) noexcept;
  355. //! \copydoc ARADocumentControllerInterface::getAudioSourceContentGrade
  356. ARAContentGrade getAudioSourceContentGrade (ARAAudioSourceRef audioSourceRef, ARAContentType type) noexcept;
  357. //! \copydoc ARADocumentControllerInterface::createAudioSourceContentReader
  358. ARAContentReaderRef createAudioSourceContentReader (ARAAudioSourceRef audioSourceRef, ARAContentType type, const ARAContentTimeRange* range) noexcept;
  359. //! \copydoc ARADocumentControllerInterface::isAudioModificationContentAvailable
  360. bool isAudioModificationContentAvailable (ARAAudioModificationRef audioModificationRef, ARAContentType type) noexcept;
  361. //! \copydoc ARADocumentControllerInterface::getAudioModificationContentGrade
  362. ARAContentGrade getAudioModificationContentGrade (ARAAudioModificationRef audioModificationRef, ARAContentType type) noexcept;
  363. //! \copydoc ARADocumentControllerInterface::createAudioModificationContentReader
  364. ARAContentReaderRef createAudioModificationContentReader (ARAAudioModificationRef audioModificationRef, ARAContentType type, const ARAContentTimeRange* range) noexcept;
  365. //! \copydoc ARADocumentControllerInterface::isPlaybackRegionContentAvailable
  366. bool isPlaybackRegionContentAvailable (ARAPlaybackRegionRef playbackRegionRef, ARAContentType type) noexcept;
  367. //! \copydoc ARADocumentControllerInterface::getPlaybackRegionContentGrade
  368. ARAContentGrade getPlaybackRegionContentGrade (ARAPlaybackRegionRef playbackRegionRef, ARAContentType type) noexcept;
  369. //! \copydoc ARADocumentControllerInterface::createPlaybackRegionContentReader
  370. ARAContentReaderRef createPlaybackRegionContentReader (ARAPlaybackRegionRef playbackRegionRef, ARAContentType type, const ARAContentTimeRange* range) noexcept;
  371. //! \copydoc ARADocumentControllerInterface::getContentReaderEventCount
  372. ARAInt32 getContentReaderEventCount (ARAContentReaderRef contentReaderRef) noexcept;
  373. //! \copydoc ARADocumentControllerInterface::getContentReaderDataForEvent
  374. const void* getContentReaderDataForEvent (ARAContentReaderRef contentReaderRef, ARAInt32 eventIndex) noexcept;
  375. //! \copydoc ARADocumentControllerInterface::destroyContentReader
  376. void destroyContentReader (ARAContentReaderRef contentReaderRef) noexcept;
  377. //@}
  378. //! @name Controlling Analysis
  379. //@{
  380. //! \copydoc ARADocumentControllerInterface::isAudioSourceContentAnalysisIncomplete
  381. bool isAudioSourceContentAnalysisIncomplete (ARAAudioSourceRef audioSourceRef, ARAContentType contentType) noexcept;
  382. //! \copydoc ARADocumentControllerInterface::requestAudioSourceContentAnalysis
  383. void requestAudioSourceContentAnalysis (ARAAudioSourceRef audioSourceRef, ARASize contentTypesCount, const ARAContentType contentTypes[]) noexcept;
  384. //! Test whether the plug-in supports managing processing algorithms.
  385. bool supportsProcessingAlgorithms () noexcept;
  386. //! \copydoc ARADocumentControllerInterface::getProcessingAlgorithmsCount
  387. ARAInt32 getProcessingAlgorithmsCount () noexcept;
  388. //! \copydoc ARADocumentControllerInterface::getProcessingAlgorithmProperties
  389. //! Supporting processing algorithms is optional, make sure to test supportsProcessingAlgorithms()
  390. //! before calling this function.
  391. const ARAProcessingAlgorithmProperties* getProcessingAlgorithmProperties (ARAInt32 algorithmIndex) noexcept;
  392. //! \copydoc ARADocumentControllerInterface::getProcessingAlgorithmForAudioSource
  393. ARAInt32 getProcessingAlgorithmForAudioSource (ARAAudioSourceRef audioSourceRef) noexcept;
  394. //! \copydoc ARADocumentControllerInterface::requestProcessingAlgorithmForAudioSource
  395. void requestProcessingAlgorithmForAudioSource (ARAAudioSourceRef audioSourceRef, ARAInt32 algorithmIndex) noexcept;
  396. //@}
  397. //! @name License Management
  398. //@{
  399. //! \copydoc ARADocumentControllerInterface::isLicensedForCapabilities
  400. //! Returns true if plug-in does not support the optional license management.
  401. bool isLicensedForCapabilities (bool runModalActivationDialogIfNeeded, ARASize contentTypesCount, const ARAContentType contentTypes[], ARAPlaybackTransformationFlags transformationFlags) noexcept;
  402. //@}
  403. };
  404. /*******************************************************************************/
  405. // DocumentControllerInstance
  406. /** Optional wrapper class for the plug-in binary ARADocumentControllerInstance.
  407. \deprecated Hosts should to instead use DocumentController directly.
  408. */
  409. /*******************************************************************************/
  410. ARA_DEPRECATED(2_0_Final) class DocumentControllerInstance
  411. {
  412. public:
  413. explicit DocumentControllerInstance (const ARADocumentControllerInstance* instance) noexcept
  414. : _controller { instance }
  415. {}
  416. DocumentController& getController () noexcept
  417. { return _controller; }
  418. private:
  419. DocumentController _controller;
  420. };
  421. /*******************************************************************************/
  422. // ContentReader
  423. /** Wrapper class for convenient and type safe content reading.
  424. \tparam contentType The type of ARA content event that can be read.*/
  425. /*******************************************************************************/
  426. template <ARAContentType contentType>
  427. using ContentReader = ARA::ContentReader<contentType, DocumentController, ARAContentReaderRef>;
  428. /*******************************************************************************/
  429. // PlaybackRenderer (ARA 2.0)
  430. /** Wrapper class for the ARAPlaybackRendererInterface provided by the plug-in. */
  431. /*******************************************************************************/
  432. class PlaybackRenderer : public InterfaceInstance<ARAPlaybackRendererRef, ARAPlaybackRendererInterface>
  433. {
  434. public:
  435. #if ARA_SUPPORT_VERSION_1
  436. explicit PlaybackRenderer (const ARAPlugInExtensionInstance* instance);
  437. ~PlaybackRenderer ();
  438. #else
  439. explicit PlaybackRenderer (const ARAPlugInExtensionInstance* instance) noexcept
  440. : BaseType { instance->playbackRendererRef, instance->playbackRendererInterface }
  441. {}
  442. #endif
  443. //! @name Assigning the playback region(s) for playback rendering
  444. //! For details, see \ref Assigning_ARAPlaybackRendererInterface_Regions "ARAPlaybackRendererInterface".
  445. //@{
  446. void addPlaybackRegion (ARAPlaybackRegionRef playbackRegionRef) noexcept;
  447. void removePlaybackRegion (ARAPlaybackRegionRef playbackRegionRef) noexcept;
  448. //@}
  449. };
  450. //************************************************************************************************
  451. // EditorRenderer (ARA 2.0)
  452. /** Wrapper class for the ARAEditorRendererInterface provided by the plug-in. */
  453. //************************************************************************************************
  454. class EditorRenderer : public InterfaceInstance<ARAEditorRendererRef, ARAEditorRendererInterface>
  455. {
  456. public:
  457. #if ARA_SUPPORT_VERSION_1
  458. explicit EditorRenderer (const ARAPlugInExtensionInstance* instance) noexcept;
  459. #else
  460. explicit EditorRenderer (const ARAPlugInExtensionInstance* instance) noexcept
  461. : BaseType { instance->editorRendererRef, instance->editorRendererInterface }
  462. {}
  463. #endif
  464. //! @name Assigning the playback region(s) for preview while editing
  465. //! For details, see \ref Assigning_ARAEditorRendererInterface_Regions "ARAEditorRendererInterface".
  466. //@{
  467. void addPlaybackRegion (ARAPlaybackRegionRef playbackRegionRef) noexcept;
  468. void removePlaybackRegion (ARAPlaybackRegionRef playbackRegionRef) noexcept;
  469. void addRegionSequence (ARARegionSequenceRef regionSequenceRef) noexcept;
  470. void removeRegionSequence (ARARegionSequenceRef regionSequenceRef) noexcept;
  471. //@}
  472. };
  473. //************************************************************************************************
  474. // EditorView (ARA 2.0)
  475. /** Wrapper class for the ARAEditorViewInterface provided by the plug-in. */
  476. //************************************************************************************************
  477. class EditorView : public InterfaceInstance<ARAEditorViewRef, ARAEditorViewInterface>
  478. {
  479. public:
  480. #if ARA_SUPPORT_VERSION_1
  481. explicit EditorView (const ARAPlugInExtensionInstance* instance) noexcept;
  482. #else
  483. explicit EditorView (const ARAPlugInExtensionInstance* instance) noexcept
  484. : BaseType { instance->editorViewRef, instance->editorViewInterface }
  485. {}
  486. #endif
  487. //! @name Host UI notifications
  488. //@{
  489. //! \copydoc ARAEditorViewInterface::notifySelection
  490. void notifySelection (const ARAViewSelection* selection) noexcept;
  491. //! \copydoc ARAEditorViewInterface::notifyHideRegionSequences
  492. void notifyHideRegionSequences (ARASize regionSequenceRefsCount, const ARARegionSequenceRef regionSequenceRefs[]) noexcept;
  493. //@}
  494. };
  495. //! @} ARA_Library_Host_Dispatch_Plug-In_Interface_Wrappers
  496. /*******************************************************************************/
  497. // PlugInExtensionInstance
  498. /** Optional wrapper class for the ARAPlugInExtensionInstance provided by the plug-in.
  499. \deprecated Hosts should to instead use PlaybackRenderer, EditorRenderer and EditorView directly.
  500. */
  501. /*******************************************************************************/
  502. ARA_DEPRECATED(2_0_Final) class PlugInExtensionInstance
  503. {
  504. public:
  505. #if ARA_SUPPORT_VERSION_1
  506. explicit PlugInExtensionInstance (const ARAPlugInExtensionInstance* instance)
  507. #else
  508. explicit PlugInExtensionInstance (const ARAPlugInExtensionInstance* instance) noexcept
  509. #endif
  510. : _playbackRenderer { instance },
  511. _editorRenderer { instance },
  512. _editorView { instance }
  513. {}
  514. PlaybackRenderer* getPlaybackRenderer () noexcept
  515. { return (_playbackRenderer.isProvided ()) ? &_playbackRenderer : nullptr; }
  516. EditorRenderer* getEditorRenderer () noexcept
  517. { return (_editorRenderer.isProvided ()) ? &_editorRenderer : nullptr; }
  518. EditorView* getEditorView () noexcept
  519. { return (_editorView.isProvided ()) ? &_editorView : nullptr; }
  520. private:
  521. PlaybackRenderer _playbackRenderer;
  522. EditorRenderer _editorRenderer;
  523. EditorView _editorView;
  524. };
  525. //! @} ARA_Library_Host_Dispatch_Plug-In_Interface_Wrappers
  526. } // namespace Host
  527. } // namespace ARA
  528. #endif // ARAHostDispatch_h