ARAPlugInDispatch.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. //------------------------------------------------------------------------------
  2. //! \file ARAPlugInDispatch.h
  3. //! C-to-C++ adapter for implementing ARA plug-ins
  4. //! \project ARA SDK Library
  5. //! \copyright Copyright (c) 2012-2021, Celemony Software GmbH, All Rights Reserved.
  6. //! \license Licensed under the Apache License, Version 2.0 (the "License");
  7. //! you may not use this file except in compliance with the License.
  8. //! You may obtain a copy of the License at
  9. //!
  10. //! http://www.apache.org/licenses/LICENSE-2.0
  11. //!
  12. //! Unless required by applicable law or agreed to in writing, software
  13. //! distributed under the License is distributed on an "AS IS" BASIS,
  14. //! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. //! See the License for the specific language governing permissions and
  16. //! limitations under the License.
  17. //------------------------------------------------------------------------------
  18. #ifndef ARAPlugInDispatch_h
  19. #define ARAPlugInDispatch_h
  20. #include "ARA_Library/Dispatch/ARADispatchBase.h"
  21. namespace ARA {
  22. namespace PlugIn {
  23. //! @addtogroup ARA_Library_PlugIn_Dispatch
  24. //! @{
  25. /*******************************************************************************/
  26. /** Optional ARA 1 backwards compatibility.
  27. Plug-ins can choose support ARA 1 hosts in addition to ARA 2 hosts.
  28. Plug-ins will have to implement a lot of fallbacks in addition to the support
  29. provided by this implementation:
  30. - create dummy region sequences for the playback regions, utilizing the
  31. context information provided via the companion APIs
  32. - implicitly derive ARA selection state from companion API actions
  33. */
  34. /*******************************************************************************/
  35. #if !defined (ARA_SUPPORT_VERSION_1)
  36. #define ARA_SUPPORT_VERSION_1 0
  37. #endif
  38. #if ARA_SUPPORT_VERSION_1 && ARA_CPU_ARM
  39. #error "ARA v1 is not supported on ARM architecture"
  40. #endif
  41. /*******************************************************************************/
  42. /** Type safe conversions to/from ref: toRef () and fromRef<> ().
  43. This macro defines custom overloads of the toRef () and fromRef<> () conversion functions
  44. which act as type safe casts between your implementation class pointers and the opaque refs
  45. that the ARA API uses.
  46. fromRef<>() additionally allows for optional up-casting from base to derived classes if needed.
  47. The first macro argument is your implementation class, followed by all ref types that you
  48. want this class to comply with.
  49. \br
  50. Whenever using your C++ object pointers as plug-in refs, you should apply the conversion macros like so:
  51. \code{.cpp}
  52. // declare the conversion in the appropriate header
  53. class MyAudioSource;
  54. ARA_MAP_REF (MyAudioSource, ARAAudioSourceRef)
  55. // whenever exporting refs to the host, use toRef ()
  56. MyAudioSource* audioSource = ...;
  57. ARAAudioSourceRef audioSourceRef = toRef (audioSource);
  58. // whenever the host passes a plug-in ref back to you, use fromRef<> ()
  59. ARAAudioSourceRef audioSourceRef; // usually provided as argument to a function call
  60. MyAudioSource* audioSource = fromRef (audioSourceRef);
  61. \endcode
  62. */
  63. /*******************************************************************************/
  64. #if !defined (ARA_MAP_REF)
  65. #define ARA_MAP_REF(ClassType, FirstRefType, ...) \
  66. static inline ARA::ToRefConversionHelper<ClassType, FirstRefType, ##__VA_ARGS__> toRef (const ClassType* ptr) noexcept { return ARA::ToRefConversionHelper<ClassType, FirstRefType, ##__VA_ARGS__> { ptr }; } \
  67. template <typename DesiredClassType = ClassType, typename RefType, typename std::enable_if<std::is_constructible<ARA::FromRefConversionHelper<ClassType, FirstRefType, ##__VA_ARGS__>, RefType>::value, bool>::type = true> \
  68. static inline DesiredClassType* fromRef (RefType ref) noexcept { ClassType* object { ARA::FromRefConversionHelper<ClassType, FirstRefType, ##__VA_ARGS__> (ref) }; return static_cast<DesiredClassType*> (object); }
  69. #endif
  70. /*******************************************************************************/
  71. /** Tag objects maintained by the host to prevent accidentally copying/moving them. */
  72. /*******************************************************************************/
  73. #if !defined (ARA_HOST_MANAGED_OBJECT)
  74. #define ARA_HOST_MANAGED_OBJECT ARA_DISABLE_COPY_AND_MOVE
  75. #endif
  76. /*******************************************************************************/
  77. // Properties
  78. /** Template to conveniently evaluate pointers to ARA variable-sized properties structs. */
  79. /*******************************************************************************/
  80. template <typename StructType>
  81. using PropertiesPtr = SizedStructPtr<StructType>;
  82. //! @defgroup ARA_Library_Host_Dispatch_Plug-In_Interfaces Plug-In Interfaces
  83. //! @{
  84. /*******************************************************************************/
  85. // DocumentController
  86. /** Base class for implementing ARADocumentControllerInterface. */
  87. /*******************************************************************************/
  88. class DocumentControllerInterface
  89. {
  90. public:
  91. virtual ~DocumentControllerInterface () = default;
  92. //! @name Destruction
  93. //@{
  94. //! \copydoc ARADocumentControllerInterface::destroyDocumentController
  95. virtual void destroyDocumentController () noexcept = 0;
  96. //@}
  97. //! @name Factory
  98. //! \copydoc ARADocumentControllerInterface::getFactory
  99. virtual const ARAFactory* getFactory () const noexcept = 0;
  100. //@}
  101. //! @name Update Management
  102. //@{
  103. //! \copydoc ARADocumentControllerInterface::beginEditing
  104. virtual void beginEditing () noexcept = 0;
  105. //! \copydoc ARADocumentControllerInterface::endEditing
  106. virtual void endEditing () noexcept = 0;
  107. //! \copydoc ARADocumentControllerInterface::notifyModelUpdates
  108. virtual void notifyModelUpdates () noexcept = 0;
  109. //@}
  110. //! @name Archiving
  111. //@{
  112. //! \copydoc ARADocumentControllerInterface::restoreObjectsFromArchive
  113. virtual bool restoreObjectsFromArchive (ARAArchiveReaderHostRef archiveReaderHostRef, const ARARestoreObjectsFilter* filter) noexcept = 0;
  114. //! \copydoc ARADocumentControllerInterface::storeObjectsToArchive
  115. virtual bool storeObjectsToArchive (ARAArchiveWriterHostRef archiveWriterHostRef, const ARAStoreObjectsFilter* filter) noexcept = 0;
  116. //! \copydoc ARADocumentControllerInterface::storeAudioSourceToAudioFileChunk
  117. virtual bool storeAudioSourceToAudioFileChunk (ARAArchiveWriterHostRef archiveWriterHostRef, ARAAudioSourceRef audioSourceRef, ARAPersistentID* documentArchiveID, bool* openAutomatically) noexcept = 0;
  118. //@}
  119. //! @name Document Management
  120. //@{
  121. //! \copydoc ARADocumentControllerInterface::updateDocumentProperties
  122. virtual void updateDocumentProperties (PropertiesPtr<ARADocumentProperties> properties) noexcept = 0;
  123. //@}
  124. //! @name Musical Context Management
  125. //@{
  126. //! \copydoc ARADocumentControllerInterface::createMusicalContext
  127. virtual ARAMusicalContextRef createMusicalContext (ARAMusicalContextHostRef hostRef, PropertiesPtr<ARAMusicalContextProperties> properties) noexcept = 0;
  128. //! \copydoc ARADocumentControllerInterface::updateMusicalContextProperties
  129. virtual void updateMusicalContextProperties (ARAMusicalContextRef musicalContextRef, PropertiesPtr<ARAMusicalContextProperties> properties) noexcept = 0;
  130. //! \copydoc ARADocumentControllerInterface::updateMusicalContextContent
  131. virtual void updateMusicalContextContent (ARAMusicalContextRef musicalContextRef, const ARAContentTimeRange* range, ContentUpdateScopes scopeFlags) noexcept = 0;
  132. //! \copydoc ARADocumentControllerInterface::destroyMusicalContext
  133. virtual void destroyMusicalContext (ARAMusicalContextRef musicalContextRef) noexcept = 0;
  134. //@}
  135. //! @name Region Sequence Management
  136. //@{
  137. //! \copydoc ARADocumentControllerInterface::createRegionSequence
  138. virtual ARARegionSequenceRef createRegionSequence (ARARegionSequenceHostRef hostRef, PropertiesPtr<ARARegionSequenceProperties> properties) noexcept = 0;
  139. //! \copydoc ARADocumentControllerInterface::updateRegionSequenceProperties
  140. virtual void updateRegionSequenceProperties (ARARegionSequenceRef regionSequence, PropertiesPtr<ARARegionSequenceProperties> properties) noexcept = 0;
  141. //! \copydoc ARADocumentControllerInterface::destroyRegionSequence
  142. virtual void destroyRegionSequence (ARARegionSequenceRef regionSequence) noexcept = 0;
  143. //@}
  144. //! @name Audio Source Management
  145. //@{
  146. //! \copydoc ARADocumentControllerInterface::createAudioSource
  147. virtual ARAAudioSourceRef createAudioSource (ARAAudioSourceHostRef hostRef, PropertiesPtr<ARAAudioSourceProperties> properties) noexcept = 0;
  148. //! \copydoc ARADocumentControllerInterface::updateAudioSourceProperties
  149. virtual void updateAudioSourceProperties (ARAAudioSourceRef audioSourceRef, PropertiesPtr<ARAAudioSourceProperties> properties) noexcept = 0;
  150. //! \copydoc ARADocumentControllerInterface::updateAudioSourceContent
  151. virtual void updateAudioSourceContent (ARAAudioSourceRef audioSourceRef, const ARAContentTimeRange* range, ContentUpdateScopes scopeFlags) noexcept = 0;
  152. //! \copydoc ARADocumentControllerInterface::enableAudioSourceSamplesAccess
  153. virtual void enableAudioSourceSamplesAccess (ARAAudioSourceRef audioSourceRef, bool enable) noexcept = 0;
  154. //! \copydoc ARADocumentControllerInterface::deactivateAudioSourceForUndoHistory
  155. virtual void deactivateAudioSourceForUndoHistory (ARAAudioSourceRef audioSourceRef, bool deactivate) noexcept = 0;
  156. //! \copydoc ARADocumentControllerInterface::destroyAudioSource
  157. virtual void destroyAudioSource (ARAAudioSourceRef audioSourceRef) noexcept = 0;
  158. //@}
  159. //! @name Audio Modification Management
  160. //@{
  161. //! \copydoc ARADocumentControllerInterface::createAudioModification
  162. virtual ARAAudioModificationRef createAudioModification (ARAAudioSourceRef audioSourceRef, ARAAudioModificationHostRef hostRef, PropertiesPtr<ARAAudioModificationProperties> properties) noexcept = 0;
  163. //! \copydoc ARADocumentControllerInterface::cloneAudioModification
  164. virtual ARAAudioModificationRef cloneAudioModification (ARAAudioModificationRef audioModificationRef, ARAAudioModificationHostRef hostRef, PropertiesPtr<ARAAudioModificationProperties> properties) noexcept = 0;
  165. //! \copydoc ARADocumentControllerInterface::updateAudioModificationProperties
  166. virtual void updateAudioModificationProperties (ARAAudioModificationRef audioModificationRef, PropertiesPtr<ARAAudioModificationProperties> properties) noexcept = 0;
  167. //! \copydoc ARADocumentControllerInterface::deactivateAudioModificationForUndoHistory
  168. virtual void deactivateAudioModificationForUndoHistory (ARAAudioModificationRef audioModificationRef, bool deactivate) noexcept = 0;
  169. //! \copydoc ARADocumentControllerInterface::destroyAudioModification
  170. virtual void destroyAudioModification (ARAAudioModificationRef audioModificationRef) noexcept = 0;
  171. //@}
  172. //! @name Playback Region Management
  173. //@{
  174. //! \copydoc ARADocumentControllerInterface::createPlaybackRegion
  175. virtual ARAPlaybackRegionRef createPlaybackRegion (ARAAudioModificationRef audioModificationRef, ARAPlaybackRegionHostRef hostRef, PropertiesPtr<ARAPlaybackRegionProperties> properties) noexcept = 0;
  176. //! \copydoc ARADocumentControllerInterface::updatePlaybackRegionProperties
  177. virtual void updatePlaybackRegionProperties (ARAPlaybackRegionRef playbackRegionRef, PropertiesPtr<ARAPlaybackRegionProperties> properties) noexcept = 0;
  178. //! \copydoc ARADocumentControllerInterface::destroyPlaybackRegion
  179. virtual void destroyPlaybackRegion (ARAPlaybackRegionRef playbackRegionRef) noexcept = 0;
  180. //! \copydoc ARADocumentControllerInterface::getPlaybackRegionHeadAndTailTime
  181. virtual void getPlaybackRegionHeadAndTailTime (ARAPlaybackRegionRef playbackRegionRef, ARATimeDuration* headTime, ARATimeDuration* tailTime) noexcept = 0;
  182. //@}
  183. //! @name Content Reader Management
  184. //@{
  185. //! \copydoc ARADocumentControllerInterface::isAudioSourceContentAvailable
  186. virtual bool isAudioSourceContentAvailable (ARAAudioSourceRef audioSourceRef, ARAContentType type) noexcept = 0;
  187. //! \copydoc ARADocumentControllerInterface::getAudioSourceContentGrade
  188. virtual ARAContentGrade getAudioSourceContentGrade (ARAAudioSourceRef audioSourceRef, ARAContentType type) noexcept = 0;
  189. //! \copydoc ARADocumentControllerInterface::createAudioSourceContentReader
  190. virtual ARAContentReaderRef createAudioSourceContentReader (ARAAudioSourceRef audioSourceRef, ARAContentType type, const ARAContentTimeRange* range) noexcept = 0;
  191. //! \copydoc ARADocumentControllerInterface::isAudioModificationContentAvailable
  192. virtual bool isAudioModificationContentAvailable (ARAAudioModificationRef audioModificationRef, ARAContentType type) noexcept = 0;
  193. //! \copydoc ARADocumentControllerInterface::getAudioModificationContentGrade
  194. virtual ARAContentGrade getAudioModificationContentGrade (ARAAudioModificationRef audioModificationRef, ARAContentType type) noexcept = 0;
  195. //! \copydoc ARADocumentControllerInterface::createAudioModificationContentReader
  196. virtual ARAContentReaderRef createAudioModificationContentReader (ARAAudioModificationRef audioModificationRef, ARAContentType type, const ARAContentTimeRange* range) noexcept = 0;
  197. //! \copydoc ARADocumentControllerInterface::isPlaybackRegionContentAvailable
  198. virtual bool isPlaybackRegionContentAvailable (ARAPlaybackRegionRef playbackRegionRef, ARAContentType type) noexcept = 0;
  199. //! \copydoc ARADocumentControllerInterface::getPlaybackRegionContentGrade
  200. virtual ARAContentGrade getPlaybackRegionContentGrade (ARAPlaybackRegionRef playbackRegionRef, ARAContentType type) noexcept = 0;
  201. //! \copydoc ARADocumentControllerInterface::createPlaybackRegionContentReader
  202. virtual ARAContentReaderRef createPlaybackRegionContentReader (ARAPlaybackRegionRef playbackRegionRef, ARAContentType type, const ARAContentTimeRange* range) noexcept = 0;
  203. //! \copydoc ARADocumentControllerInterface::getContentReaderEventCount
  204. virtual ARAInt32 getContentReaderEventCount (ARAContentReaderRef contentReaderRef) noexcept = 0;
  205. //! \copydoc ARADocumentControllerInterface::getContentReaderDataForEvent
  206. virtual const void* getContentReaderDataForEvent (ARAContentReaderRef contentReaderRef, ARAInt32 eventIndex) noexcept = 0;
  207. //! \copydoc ARADocumentControllerInterface::destroyContentReader
  208. virtual void destroyContentReader (ARAContentReaderRef contentReaderRef) noexcept = 0;
  209. //@}
  210. //! @name Controlling Analysis
  211. //@{
  212. //! \copydoc ARADocumentControllerInterface::isAudioSourceContentAnalysisIncomplete
  213. virtual bool isAudioSourceContentAnalysisIncomplete (ARAAudioSourceRef audioSourceRef, ARAContentType contentType) noexcept = 0;
  214. //! \copydoc ARADocumentControllerInterface::requestAudioSourceContentAnalysis
  215. virtual void requestAudioSourceContentAnalysis (ARAAudioSourceRef audioSourceRef, ARASize contentTypesCount, const ARAContentType contentTypes[]) noexcept = 0;
  216. //! \copydoc ARADocumentControllerInterface::getProcessingAlgorithmsCount
  217. virtual ARAInt32 getProcessingAlgorithmsCount () noexcept = 0;
  218. //! \copydoc ARADocumentControllerInterface::getProcessingAlgorithmProperties
  219. virtual const ARAProcessingAlgorithmProperties* getProcessingAlgorithmProperties (ARAInt32 algorithmIndex) noexcept = 0;
  220. //! \copydoc ARADocumentControllerInterface::getProcessingAlgorithmForAudioSource
  221. virtual ARAInt32 getProcessingAlgorithmForAudioSource (ARAAudioSourceRef audioSourceRef) noexcept = 0;
  222. //! \copydoc ARADocumentControllerInterface::requestProcessingAlgorithmForAudioSource
  223. virtual void requestProcessingAlgorithmForAudioSource (ARAAudioSourceRef audioSourceRef, ARAInt32 algorithmIndex) noexcept = 0;
  224. //@}
  225. //! @name License Management
  226. //@{
  227. //! \copydoc ARADocumentControllerInterface::isLicensedForCapabilities
  228. virtual bool isLicensedForCapabilities (bool runModalActivationDialogIfNeeded, ARASize contentTypesCount, const ARAContentType contentTypes[], ARAPlaybackTransformationFlags transformationFlags) noexcept = 0;
  229. //@}
  230. };
  231. ARA_MAP_REF (DocumentControllerInterface, ARADocumentControllerRef)
  232. /*******************************************************************************/
  233. // DocumentControllerInstance
  234. /** Wrapper class for the ARADocumentControllerInstance. */
  235. /*******************************************************************************/
  236. class DocumentControllerInstance : public SizedStruct<ARA_STRUCT_MEMBER (ARADocumentControllerInstance, documentControllerInterface)>
  237. {
  238. public:
  239. explicit DocumentControllerInstance (DocumentControllerInterface* documentController) noexcept;
  240. DocumentControllerInterface* getDocumentController () const noexcept
  241. { return fromRef (documentControllerRef); }
  242. };
  243. /*******************************************************************************/
  244. // PlaybackRendererInterface
  245. /** Base class for implementing ARAPlaybackRendererInterface. */
  246. /*******************************************************************************/
  247. class PlaybackRendererInterface
  248. {
  249. public:
  250. virtual ~PlaybackRendererInterface () = default;
  251. //! @name Assigning the playback region(s) for playback rendering
  252. //! For details, see \ref Assigning_ARAPlaybackRendererInterface_Regions "ARAPlaybackRendererInterface".
  253. //@{
  254. virtual void addPlaybackRegion (ARAPlaybackRegionRef playbackRegionRef) noexcept = 0;
  255. virtual void removePlaybackRegion (ARAPlaybackRegionRef playbackRegionRef) noexcept = 0;
  256. //@}
  257. };
  258. ARA_MAP_REF (PlaybackRendererInterface, ARAPlaybackRendererRef)
  259. /*******************************************************************************/
  260. // EditorRendererInterface
  261. /** Base class for implementing ARAEditorRendererInterface. */
  262. /*******************************************************************************/
  263. class EditorRendererInterface
  264. {
  265. public:
  266. virtual ~EditorRendererInterface () = default;
  267. //! @name Assigning the playback region(s) for preview while editing
  268. //! For details, see \ref Assigning_ARAEditorRendererInterface_Regions "ARAEditorRendererInterface".
  269. //@{
  270. virtual void addPlaybackRegion (ARAPlaybackRegionRef playbackRegionRef) noexcept = 0;
  271. virtual void removePlaybackRegion (ARAPlaybackRegionRef playbackRegionRef) noexcept = 0;
  272. virtual void addRegionSequence (ARARegionSequenceRef regionSequenceRef) noexcept = 0;
  273. virtual void removeRegionSequence (ARARegionSequenceRef regionSequenceRef) noexcept = 0;
  274. //@}
  275. };
  276. ARA_MAP_REF (EditorRendererInterface, ARAEditorRendererRef)
  277. /*******************************************************************************/
  278. // EditorViewInterface
  279. /** Base class for implementing ARAEditorViewInterface. */
  280. /*******************************************************************************/
  281. class EditorViewInterface
  282. {
  283. public:
  284. virtual ~EditorViewInterface () = default;
  285. //! @name Host UI notifications
  286. //@{
  287. //! \copydoc ARAEditorViewInterface::notifySelection
  288. virtual void notifySelection (SizedStructPtr<ARAViewSelection> selection) noexcept = 0;
  289. //! \copydoc ARAEditorViewInterface::notifyHideRegionSequences
  290. virtual void notifyHideRegionSequences (ARASize regionSequenceRefsCount, const ARARegionSequenceRef regionSequenceRefs[]) noexcept = 0;
  291. //@}
  292. };
  293. ARA_MAP_REF (EditorViewInterface, ARAEditorViewRef)
  294. /*******************************************************************************/
  295. // PlugInExtensionInstance
  296. /** Wrapper class for ARAPlugInExtensionInstance. */
  297. /*******************************************************************************/
  298. class PlugInExtensionInstance : public SizedStruct<ARA_STRUCT_MEMBER (ARAPlugInExtensionInstance, editorViewInterface)>
  299. {
  300. public:
  301. explicit PlugInExtensionInstance (PlaybackRendererInterface* playbackRenderer, EditorRendererInterface* editorRenderer, EditorViewInterface* editorView) noexcept;
  302. PlaybackRendererInterface* getPlaybackRenderer () const noexcept
  303. { return fromRef (playbackRendererRef); }
  304. EditorRendererInterface* getEditorRenderer () const noexcept
  305. { return fromRef (editorRendererRef); }
  306. EditorViewInterface* getEditorView () const noexcept
  307. { return fromRef (editorViewRef); }
  308. #if ARA_SUPPORT_VERSION_1
  309. void setPlaybackRegion (ARAPlaybackRegionRef playbackRegionRef) noexcept;
  310. void removePlaybackRegion (ARAPlaybackRegionRef playbackRegionRef) noexcept;
  311. private:
  312. ARAPlaybackRegionRef _playbackRegionRef { nullptr }; // only valid if _hasPlaybackRegion is true
  313. bool _hasPlaybackRegion { false };
  314. #endif
  315. };
  316. //! @}
  317. //! @addtogroup ARA_Library_Host_Dispatch_Host_Interface_Wrappers Host Interface Wrappers
  318. //! Wrappers for the interfaces used to communicate with and control the ARA host.
  319. //! @{
  320. /*******************************************************************************/
  321. // HostAudioAccessController
  322. /** Wrapper class for the ARAAudioAccessControllerInterface provided by the host. */
  323. /*******************************************************************************/
  324. class HostAudioAccessController : public InterfaceInstance<ARAAudioAccessControllerHostRef, ARAAudioAccessControllerInterface>
  325. {
  326. public:
  327. explicit HostAudioAccessController (const ARADocumentControllerHostInstance* instance) noexcept
  328. : BaseType { instance->audioAccessControllerHostRef, instance->audioAccessControllerInterface }
  329. {}
  330. //! \copydoc ARAAudioAccessControllerInterface::createAudioReaderForSource
  331. ARAAudioReaderHostRef createAudioReaderForSource (ARAAudioSourceHostRef audioSourceHostRef, bool use64BitSamples) noexcept;
  332. //! \copydoc ARAAudioAccessControllerInterface::readAudioSamples
  333. bool readAudioSamples (ARAAudioReaderHostRef audioReaderHostRef,
  334. ARASamplePosition samplePosition, ARASampleCount samplesPerChannel, void* const buffers[]) noexcept;
  335. //! \copydoc ARAAudioAccessControllerInterface::destroyAudioReader
  336. void destroyAudioReader (ARAAudioReaderHostRef audioReaderHostRef) noexcept;
  337. };
  338. /*******************************************************************************/
  339. // HostArchivingController
  340. /** Wrapper class for the ARAArchivingControllerInterface provided by the host. */
  341. /*******************************************************************************/
  342. class HostArchivingController : public InterfaceInstance<ARAArchivingControllerHostRef, ARAArchivingControllerInterface>
  343. {
  344. public:
  345. explicit HostArchivingController (const ARADocumentControllerHostInstance* instance) noexcept
  346. : BaseType { instance->archivingControllerHostRef, instance->archivingControllerInterface }
  347. {}
  348. //! \copydoc ARAArchivingControllerInterface::getArchiveSize
  349. ARASize getArchiveSize (ARAArchiveReaderHostRef archiveReaderHostRef) noexcept;
  350. //! \copydoc ARAArchivingControllerInterface::readBytesFromArchive
  351. bool readBytesFromArchive (ARAArchiveReaderHostRef archiveReaderHostRef,
  352. ARASize position, ARASize length, ARAByte buffer[]) noexcept;
  353. //! \copydoc ARAArchivingControllerInterface::writeBytesToArchive
  354. bool writeBytesToArchive (ARAArchiveWriterHostRef archiveWriterHostRef,
  355. ARASize position, ARASize length, const ARAByte buffer[]) noexcept;
  356. //! \copydoc ARAArchivingControllerInterface::notifyDocumentArchivingProgress
  357. void notifyDocumentArchivingProgress (float value) noexcept;
  358. //! \copydoc ARAArchivingControllerInterface::notifyDocumentUnarchivingProgress
  359. void notifyDocumentUnarchivingProgress (float value) noexcept;
  360. //! \copydoc ARAArchivingControllerInterface::getDocumentArchiveID
  361. ARAPersistentID getDocumentArchiveID (ARAArchiveReaderHostRef archiveReaderHostRef) noexcept;
  362. };
  363. /*******************************************************************************/
  364. // HostContentAccessController
  365. /** Wrapper class for the ARAContentAccessControllerInterface by the host.
  366. Note that ARAPlug.h includes convenient wrappers for content readers via the HostContentReader
  367. classes that allow to use them with stl iterators and also provide additional validation.
  368. */
  369. /*******************************************************************************/
  370. class HostContentAccessController : public InterfaceInstance<ARAContentAccessControllerHostRef, ARAContentAccessControllerInterface>
  371. {
  372. public:
  373. explicit HostContentAccessController (const ARADocumentControllerHostInstance* instance) noexcept
  374. : BaseType { instance->contentAccessControllerHostRef, instance->contentAccessControllerInterface }
  375. {}
  376. //! \copydoc ARAContentAccessControllerInterface::isMusicalContextContentAvailable
  377. bool isMusicalContextContentAvailable (ARAMusicalContextHostRef musicalContextHostRef, ARAContentType contentType) noexcept;
  378. //! \copydoc ARAContentAccessControllerInterface::getMusicalContextContentGrade
  379. ARAContentGrade getMusicalContextContentGrade (ARAMusicalContextHostRef musicalContextHostRef, ARAContentType contentType) noexcept;
  380. //! \copydoc ARAContentAccessControllerInterface::createMusicalContextContentReader
  381. ARAContentReaderHostRef createMusicalContextContentReader (ARAMusicalContextHostRef musicalContextHostRef,
  382. ARAContentType contentType, const ARAContentTimeRange* range) noexcept;
  383. //! \copydoc ARAContentAccessControllerInterface::isAudioSourceContentAvailable
  384. bool isAudioSourceContentAvailable (ARAAudioSourceHostRef audioSourceHostRef, ARAContentType contentType) noexcept;
  385. //! \copydoc ARAContentAccessControllerInterface::getAudioSourceContentGrade
  386. ARAContentGrade getAudioSourceContentGrade (ARAAudioSourceHostRef audioSourceHostRef, ARAContentType contentType) noexcept;
  387. //! \copydoc ARAContentAccessControllerInterface::createAudioSourceContentReader
  388. ARAContentReaderHostRef createAudioSourceContentReader (ARAAudioSourceHostRef audioSourceHostRef,
  389. ARAContentType contentType, const ARAContentTimeRange* range) noexcept;
  390. //! \copydoc ARAContentAccessControllerInterface::getContentReaderEventCount
  391. ARAInt32 getContentReaderEventCount (ARAContentReaderHostRef contentReaderHostRef) noexcept;
  392. //! \copydoc ARAContentAccessControllerInterface::getContentReaderDataForEvent
  393. const void* getContentReaderDataForEvent (ARAContentReaderHostRef contentReaderHostRef, ARAInt32 eventIndex) noexcept;
  394. //! \copydoc ARAContentAccessControllerInterface::destroyContentReader
  395. void destroyContentReader (ARAContentReaderHostRef contentReaderHostRef) noexcept;
  396. };
  397. /*******************************************************************************/
  398. // HostModelUpdateController
  399. /** Wrapper class for the ARAModelUpdateControllerInterface provided by the host. */
  400. /*******************************************************************************/
  401. class HostModelUpdateController : public InterfaceInstance<ARAModelUpdateControllerHostRef, ARAModelUpdateControllerInterface>
  402. {
  403. public:
  404. explicit HostModelUpdateController (const ARADocumentControllerHostInstance* instance) noexcept
  405. : BaseType { instance->modelUpdateControllerHostRef, instance->modelUpdateControllerInterface }
  406. {}
  407. //! \copydoc ARAModelUpdateControllerInterface::notifyAudioSourceAnalysisProgress
  408. void notifyAudioSourceAnalysisProgress (ARAAudioSourceHostRef audioSourceHostRef,
  409. ARAAnalysisProgressState state, float value) noexcept;
  410. //! \copydoc ARAModelUpdateControllerInterface::notifyAudioSourceContentChanged
  411. void notifyAudioSourceContentChanged (ARAAudioSourceHostRef audioSourceHostRef,
  412. const ARAContentTimeRange* range, ContentUpdateScopes scopeFlags) noexcept;
  413. //! \copydoc ARAModelUpdateControllerInterface::notifyAudioModificationContentChanged
  414. void notifyAudioModificationContentChanged (ARAAudioModificationHostRef audioModificationHostRef,
  415. const ARAContentTimeRange* range, ContentUpdateScopes scopeFlags) noexcept;
  416. //! \copydoc ARAModelUpdateControllerInterface::notifyPlaybackRegionContentChanged
  417. void notifyPlaybackRegionContentChanged (ARAPlaybackRegionHostRef playbackRegionHostRef,
  418. const ARAContentTimeRange* range, ContentUpdateScopes scopeFlags) noexcept;
  419. };
  420. /*******************************************************************************/
  421. // HostPlaybackController
  422. /** Wrapper class for the ARAPlaybackControllerInterface provided by the host. */
  423. /*******************************************************************************/
  424. class HostPlaybackController : public InterfaceInstance<ARAPlaybackControllerHostRef, ARAPlaybackControllerInterface>
  425. {
  426. public:
  427. explicit HostPlaybackController (const ARADocumentControllerHostInstance* instance) noexcept
  428. : BaseType { instance->playbackControllerHostRef, instance->playbackControllerInterface }
  429. {}
  430. //! \copydoc ARAPlaybackControllerInterface::requestStartPlayback
  431. void requestStartPlayback () noexcept;
  432. //! \copydoc ARAPlaybackControllerInterface::requestStopPlayback
  433. void requestStopPlayback () noexcept;
  434. //! \copydoc ARAPlaybackControllerInterface::requestSetPlaybackPosition
  435. void requestSetPlaybackPosition (ARATimePosition timePosition) noexcept;
  436. //! \copydoc ARAPlaybackControllerInterface::requestSetCycleRange
  437. void requestSetCycleRange (ARATimePosition startTime, ARATimeDuration duration) noexcept;
  438. //! \copydoc ARAPlaybackControllerInterface::requestEnableCycle
  439. void requestEnableCycle (bool enable) noexcept;
  440. };
  441. //! @} ARA_Library_Host_Dispatch_Host_Interface_Wrappers
  442. //! @} ARA_Library_PlugIn_Dispatch
  443. } // namespace PlugIn
  444. } // namespace ARA
  445. #endif // ARAPlugInDispatch_h