ARAAudioFileChunks.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. //------------------------------------------------------------------------------
  2. //! \file ARAAudioFileChunks.h
  3. //! definition of the audio file chunks related to ARA partial persistency
  4. //! \project ARA API Specification
  5. //! \copyright Copyright (c) 2018-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 ARAAudioFileChunks_h
  20. #define ARAAudioFileChunks_h
  21. #include "ARAInterface.h"
  22. #if defined(__cplusplus) && !(ARA_DOXYGEN_BUILD)
  23. namespace ARA
  24. {
  25. extern "C"
  26. {
  27. #endif
  28. /***************************************************************************************************/
  29. //! @defgroup ARAAudioFileChunks ARA Audio File Chunks
  30. //!
  31. //! To allow for distributing persistent ARA audio source state information together with the
  32. //! underlying audio file in a way that is transparent to the plug-ins and can be supported by all
  33. //! hosts, ARA 2.0 defines a format for embedding such states into standardized audio file chunks.
  34. //! From there, they can be imported into any ARA document using @ref Partial_Document_Persistency.
  35. //! \br
  36. //! The most obvious use case for this is that it enables audio content providers to ship audio
  37. //! files with properly validated, ready-to-use audio source analysis for multiple plug-ins (or
  38. //! incompatible versions of a plug-in if needed).
  39. //! For example, this allows for loading polyphonic audio loops into Melodyne without time-consuming
  40. //! analysis and very quickly adjusting them to follow the song key and chord progression, making
  41. //! the published audio material much more versatile to use in various productions.
  42. //! Other scenarios where such file chunks are used include exporting data from one plug-in to
  43. //! another, or adding ARA objects to a host document via dragging and dropping audio files from
  44. //! a plug-in that either generates these files on the fly (e.g. export of layers in SpectraLayers)
  45. //! or copies them from a built-in sound library.
  46. //! \br
  47. //! The ARA chunk should be evaluated by the host both when adding a new audio file to the
  48. //! arrangement and when applying a new/different ARA plug-in for a region/file already used in
  49. //! the arrangement.
  50. //! Note that after loading the data, ARA content readers can be used to extract more information
  51. //! about the audio source - such as tempo map, time and key signatures, etc.
  52. //! \br
  53. //! Plug-in vendors shall optimize the encoding of the audio source state information for audio file
  54. //! chunks according to very different criteria compared to encoding the same state for regular
  55. //! ARA song document archives:
  56. //! The audio file states are going to be widely distributed and will be used over a long period
  57. //! of time in very different contexts, whereas song documents are typically only used on a single
  58. //! machine for a rather short time. Audio file archives therefore should emphasize small data size
  59. //! over en-/decoding speed - encoding is only done once, and decoding only happens for a single
  60. //! audio source at a time (compared to hundreds of audio sources in a typical song archive).
  61. //! Even more important, audio file archives are likely going to be used across a wide range of
  62. //! products versions and shall be stable across a long time. The encoding should therefore be as
  63. //! much backwards compatible as possible, potentially even using different encoding based on the
  64. //! current state of the audio source: if e.g. a particular non-backwards compatible feature of
  65. //! the plug-in is not used in the given state, the plug-in can choose an older format to store
  66. //! the data than if that particular feature was utilized.
  67. //! For these reasons, audio file chunks will typically not use the ARAFactory::documentArchiveID
  68. //! but instead one of the IDs listed in ARAFactory::compatibleDocumentArchiveIDs.
  69. //! \br
  70. //! Creating audio file chunks may not be meaningful nor supported for any given plug-in. If for
  71. //! example the plug-in does not perform any costly analysis and has no relevant editable audio
  72. //! source state, there is no reason to create audio file chunks for it. Therefore, creating such
  73. //! chunks is currently done only through dedicated authoring tools (such as Melodyne's standalone
  74. //! version) and not directly available in ARA host applications.
  75. //! \br
  76. //! Covering both AIFF and WAVE formats, ARA stores its data by extending iXML chunks as specified
  77. //! here: http://www.ixml.info
  78. //! Inside the iXML document, there's a custom tag \<ARA\> that encloses a dictionary of audio
  79. //! source archives, encoded as array tagged \<audioSources\>. Each entry in the array is intended
  80. //! for a different plug-in (or incompatible version fo a plug-in) and contains the tag
  81. //! \<documentArchiveID\> which also functions as the key for the dictionary, and associated data
  82. //! which includes the actual binary archive and meta information, for example:
  83. //! \code{.xml}
  84. //! <ARA>
  85. //! <audioSources>
  86. //! <audioSource>
  87. //! <documentArchiveID>com.celemony.ara.audiosourcedescription.13</documentArchiveID>
  88. //! <openAutomatically>false</openAutomatically>
  89. //! <suggestedPlugIn>
  90. //! <plugInName>Melodyne</plugInName>
  91. //! <lowestSupportedVersion>5.0.0</lowestSupportedVersion>
  92. //! <manufacturerName>Celemony</manufacturerName>
  93. //! <informationURL>https://www.celemony.com</informationURL>
  94. //! </suggestedPlugIn>
  95. //! <persistentID>59D4874F-FA5A-4FE8-BAC6-0E8BC5F6184A</persistentID>
  96. //! <archiveData>TW9pbiBEdQ==</archiveData>
  97. //! </audioSource>
  98. //! <!-- ... potentially more archives keyed by different documentArchiveIDs here ... -->
  99. //! </audioSources>
  100. //! </ARA>
  101. //! \endcode
  102. //! @{
  103. #if defined(__cplusplus)
  104. //! Name of the XML element that contains the vendor-specific iXML sub-tree for ARA.
  105. constexpr auto kARAXMLName_ARAVendorKeyword { "ARA" };
  106. //! Name of the XML element that contains the dictionary of audio source archives inside the ARA sub-tree.
  107. constexpr auto kARAXMLName_AudioSources { "audioSources" };
  108. //! Name of each XML element inside the dictionary of audio source archives.
  109. constexpr auto kARAXMLName_AudioSource { "audioSource" };
  110. //! Name of the XML element inside an audio source archive that acts as unique dictionary key
  111. //! for the list of audio source archives and identifies the opaque archive content.
  112. //! string value, see ARAFactory::documentArchiveID and ARAFactory::compatibleDocumentArchiveIDs.
  113. constexpr auto kARAXMLName_DocumentArchiveID { "documentArchiveID" };
  114. //! Name of the XML element inside an audio source archive that indicates whether the host should
  115. //! immediately load the archive data into a new audio source object and create an audio modification
  116. //! and playback region for it, or else import the audio file without ARA initially and only load
  117. //! the ARA archive later on demand when the user manually requests it by adding a matching plug-in.
  118. //! boolean value ("true" or "false").
  119. constexpr auto kARAXMLName_OpenAutomatically { "openAutomatically" };
  120. //! Name of the XML element inside an audio source archive that provides user-readable information
  121. //! about the plug-in for which the archive was originally created. This can be used for proper
  122. //! error messages, e.g. if openAutomatically is true but no plug-in compatible with the archive's
  123. //! given documentArchiveID is installed.
  124. constexpr auto kARAXMLName_SuggestedPlugIn { "suggestedPlugIn" };
  125. //! Name of the XML element inside an audio source archive that encodes the persistent ID that
  126. //! was assigned to the audio source when creating the archive. When loading the archive, the
  127. //! plug-in will use this persistent ID to find the target object to extract the state to.
  128. //! string value, see ARAAudioSourceProperties::persistentID, see ARARestoreObjectsFilter.
  129. constexpr auto kARAXMLName_PersistentID { "persistentID" };
  130. //! Name of the XML element inside an audio source archive that encodes the actual binary data
  131. //! of the archive in Base64 format, with the possible addition of line feeds as allowed by MIME.
  132. //! Note that it is preferred to encode without line feeds, but decoders must handle both cases.
  133. //! string value, see ARAArchivingControllerInterface, see https://tools.ietf.org/html/rfc4648.
  134. constexpr auto kARAXMLName_ArchiveData { "archiveData" };
  135. //! Name of the XML element inside a suggested plug-in element that encodes the plug-in name as string.
  136. constexpr auto kARAXMLName_PlugInName { "plugInName" };
  137. //! Name of the XML element inside a suggested plug-in element that encodes the minimum version
  138. //! of the plug-in that is compatible with this archive as string.
  139. constexpr auto kARAXMLName_LowestSupportedVersion { "lowestSupportedVersion" };
  140. //! Name of the XML element inside a suggested plug-in element that encodes the plug-in manufacturer as string.
  141. constexpr auto kARAXMLName_ManufacturerName { "manufacturerName" };
  142. //! Name of the XML element inside a suggested plug-in element that encodes the plug-in information URL as string.
  143. constexpr auto kARAXMLName_InformationURL { "informationURL" };
  144. #else
  145. #define kARAXMLName_ARAVendorKeyword "ARA"
  146. #define kARAXMLName_AudioSources "audioSources"
  147. #define kARAXMLName_AudioSource "audioSource"
  148. #define kARAXMLName_DocumentArchiveID "documentArchiveID"
  149. #define kARAXMLName_OpenAutomatically "openAutomatically"
  150. #define kARAXMLName_SuggestedPlugIn "suggestedPlugIn"
  151. #define kARAXMLName_PersistentID "persistentID"
  152. #define kARAXMLName_ArchiveData "archiveData"
  153. #define kARAXMLName_PlugInName "plugInName"
  154. #define kARAXMLName_LowestSupportedVersion "lowestSupportedVersion"
  155. #define kARAXMLName_ManufacturerName "manufacturerName"
  156. #define kARAXMLName_InformationURL "informationURL"
  157. #endif
  158. //! @}
  159. #if defined(__cplusplus) && !(ARA_DOXYGEN_BUILD)
  160. } // extern "C"
  161. } // namespace ARA
  162. #endif
  163. #endif // ARAAudioFileChunks_h