Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

201 lines
14KB

  1. /*
  2. ==============================================================================
  3. This file is part of the Water library.
  4. Copyright (c) 2015 ROLI Ltd.
  5. Copyright (C) 2018 Filipe Coelho <falktx@falktx.com>
  6. Permission is granted to use this software under the terms of either:
  7. a) the GPL v2 (or any later version)
  8. b) the Affero GPL v3
  9. Details of these licenses can be found at: www.gnu.org/licenses
  10. Water is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ==============================================================================
  14. */
  15. #ifndef WATER_WAV_AUDIOFORMAT_H_INCLUDED
  16. #define WATER_WAV_AUDIOFORMAT_H_INCLUDED
  17. #include "../audioformat/AudioFormat.h"
  18. #include "../containers/Array.h"
  19. #include "CarlaJuceUtils.hpp"
  20. namespace water {
  21. //==============================================================================
  22. /**
  23. Reads and Writes WAV format audio files.
  24. @see AudioFormat
  25. */
  26. class WavAudioFormat : public AudioFormat
  27. {
  28. public:
  29. //==============================================================================
  30. /** Creates a format object. */
  31. WavAudioFormat();
  32. /** Destructor. */
  33. ~WavAudioFormat();
  34. //==============================================================================
  35. // BWAV chunk properties:
  36. static const char* const bwavDescription; /**< Metadata property name used in BWAV chunks. */
  37. static const char* const bwavOriginator; /**< Metadata property name used in BWAV chunks. */
  38. static const char* const bwavOriginatorRef; /**< Metadata property name used in BWAV chunks. */
  39. static const char* const bwavOriginationDate; /**< Metadata property name used in BWAV chunks. The format should be: yyyy-mm-dd */
  40. static const char* const bwavOriginationTime; /**< Metadata property name used in BWAV chunks. The format should be: format is: hh-mm-ss */
  41. static const char* const bwavCodingHistory; /**< Metadata property name used in BWAV chunks. */
  42. /** Metadata property name used in BWAV chunks.
  43. This is the number of samples from the start of an edit that the
  44. file is supposed to begin at. Seems like an obvious mistake to
  45. only allow a file to occur in an edit once, but that's the way
  46. it is..
  47. @see AudioFormatReader::metadataValues, createWriterFor
  48. */
  49. static const char* const bwavTimeReference;
  50. #if 0
  51. /** Utility function to fill out the appropriate metadata for a BWAV file.
  52. This just makes it easier than using the property names directly, and it
  53. fills out the time and date in the right format.
  54. */
  55. static StringPairArray createBWAVMetadata (const String& description,
  56. const String& originator,
  57. const String& originatorRef,
  58. Time dateAndTime,
  59. int64 timeReferenceSamples,
  60. const String& codingHistory);
  61. #endif
  62. //==============================================================================
  63. // 'acid' chunk properties:
  64. static const char* const acidOneShot; /**< Metadata property name used in acid chunks. */
  65. static const char* const acidRootSet; /**< Metadata property name used in acid chunks. */
  66. static const char* const acidStretch; /**< Metadata property name used in acid chunks. */
  67. static const char* const acidDiskBased; /**< Metadata property name used in acid chunks. */
  68. static const char* const acidizerFlag; /**< Metadata property name used in acid chunks. */
  69. static const char* const acidRootNote; /**< Metadata property name used in acid chunks. */
  70. static const char* const acidBeats; /**< Metadata property name used in acid chunks. */
  71. static const char* const acidDenominator; /**< Metadata property name used in acid chunks. */
  72. static const char* const acidNumerator; /**< Metadata property name used in acid chunks. */
  73. static const char* const acidTempo; /**< Metadata property name used in acid chunks. */
  74. //==============================================================================
  75. // INFO chunk properties:
  76. static const char* const riffInfoArchivalLocation; /**< Metadata property name used in INFO chunks. */
  77. static const char* const riffInfoArtist; /**< Metadata property name used in INFO chunks. */
  78. static const char* const riffInfoBaseURL; /**< Metadata property name used in INFO chunks. */
  79. static const char* const riffInfoCinematographer; /**< Metadata property name used in INFO chunks. */
  80. static const char* const riffInfoComment; /**< Metadata property name used in INFO chunks. */
  81. static const char* const riffInfoComments; /**< Metadata property name used in INFO chunks. */
  82. static const char* const riffInfoCommissioned; /**< Metadata property name used in INFO chunks. */
  83. static const char* const riffInfoCopyright; /**< Metadata property name used in INFO chunks. */
  84. static const char* const riffInfoCostumeDesigner; /**< Metadata property name used in INFO chunks. */
  85. static const char* const riffInfoCountry; /**< Metadata property name used in INFO chunks. */
  86. static const char* const riffInfoCropped; /**< Metadata property name used in INFO chunks. */
  87. static const char* const riffInfoDateCreated; /**< Metadata property name used in INFO chunks. */
  88. static const char* const riffInfoDateTimeOriginal; /**< Metadata property name used in INFO chunks. */
  89. static const char* const riffInfoDefaultAudioStream; /**< Metadata property name used in INFO chunks. */
  90. static const char* const riffInfoDimension; /**< Metadata property name used in INFO chunks. */
  91. static const char* const riffInfoDirectory; /**< Metadata property name used in INFO chunks. */
  92. static const char* const riffInfoDistributedBy; /**< Metadata property name used in INFO chunks. */
  93. static const char* const riffInfoDotsPerInch; /**< Metadata property name used in INFO chunks. */
  94. static const char* const riffInfoEditedBy; /**< Metadata property name used in INFO chunks. */
  95. static const char* const riffInfoEighthLanguage; /**< Metadata property name used in INFO chunks. */
  96. static const char* const riffInfoEncodedBy; /**< Metadata property name used in INFO chunks. */
  97. static const char* const riffInfoEndTimecode; /**< Metadata property name used in INFO chunks. */
  98. static const char* const riffInfoEngineer; /**< Metadata property name used in INFO chunks. */
  99. static const char* const riffInfoFifthLanguage; /**< Metadata property name used in INFO chunks. */
  100. static const char* const riffInfoFirstLanguage; /**< Metadata property name used in INFO chunks. */
  101. static const char* const riffInfoFourthLanguage; /**< Metadata property name used in INFO chunks. */
  102. static const char* const riffInfoGenre; /**< Metadata property name used in INFO chunks. */
  103. static const char* const riffInfoKeywords; /**< Metadata property name used in INFO chunks. */
  104. static const char* const riffInfoLanguage; /**< Metadata property name used in INFO chunks. */
  105. static const char* const riffInfoLength; /**< Metadata property name used in INFO chunks. */
  106. static const char* const riffInfoLightness; /**< Metadata property name used in INFO chunks. */
  107. static const char* const riffInfoLocation; /**< Metadata property name used in INFO chunks. */
  108. static const char* const riffInfoLogoIconURL; /**< Metadata property name used in INFO chunks. */
  109. static const char* const riffInfoLogoURL; /**< Metadata property name used in INFO chunks. */
  110. static const char* const riffInfoMedium; /**< Metadata property name used in INFO chunks. */
  111. static const char* const riffInfoMoreInfoBannerImage; /**< Metadata property name used in INFO chunks. */
  112. static const char* const riffInfoMoreInfoBannerURL; /**< Metadata property name used in INFO chunks. */
  113. static const char* const riffInfoMoreInfoText; /**< Metadata property name used in INFO chunks. */
  114. static const char* const riffInfoMoreInfoURL; /**< Metadata property name used in INFO chunks. */
  115. static const char* const riffInfoMusicBy; /**< Metadata property name used in INFO chunks. */
  116. static const char* const riffInfoNinthLanguage; /**< Metadata property name used in INFO chunks. */
  117. static const char* const riffInfoNumberOfParts; /**< Metadata property name used in INFO chunks. */
  118. static const char* const riffInfoOrganisation; /**< Metadata property name used in INFO chunks. */
  119. static const char* const riffInfoPart; /**< Metadata property name used in INFO chunks. */
  120. static const char* const riffInfoProducedBy; /**< Metadata property name used in INFO chunks. */
  121. static const char* const riffInfoProductionDesigner; /**< Metadata property name used in INFO chunks. */
  122. static const char* const riffInfoProductionStudio; /**< Metadata property name used in INFO chunks. */
  123. static const char* const riffInfoRate; /**< Metadata property name used in INFO chunks. */
  124. static const char* const riffInfoRated; /**< Metadata property name used in INFO chunks. */
  125. static const char* const riffInfoRating; /**< Metadata property name used in INFO chunks. */
  126. static const char* const riffInfoRippedBy; /**< Metadata property name used in INFO chunks. */
  127. static const char* const riffInfoSecondaryGenre; /**< Metadata property name used in INFO chunks. */
  128. static const char* const riffInfoSecondLanguage; /**< Metadata property name used in INFO chunks. */
  129. static const char* const riffInfoSeventhLanguage; /**< Metadata property name used in INFO chunks. */
  130. static const char* const riffInfoSharpness; /**< Metadata property name used in INFO chunks. */
  131. static const char* const riffInfoSixthLanguage; /**< Metadata property name used in INFO chunks. */
  132. static const char* const riffInfoSoftware; /**< Metadata property name used in INFO chunks. */
  133. static const char* const riffInfoSoundSchemeTitle; /**< Metadata property name used in INFO chunks. */
  134. static const char* const riffInfoSource; /**< Metadata property name used in INFO chunks. */
  135. static const char* const riffInfoSourceFrom; /**< Metadata property name used in INFO chunks. */
  136. static const char* const riffInfoStarring_ISTR; /**< Metadata property name used in INFO chunks. */
  137. static const char* const riffInfoStarring_STAR; /**< Metadata property name used in INFO chunks. */
  138. static const char* const riffInfoStartTimecode; /**< Metadata property name used in INFO chunks. */
  139. static const char* const riffInfoStatistics; /**< Metadata property name used in INFO chunks. */
  140. static const char* const riffInfoSubject; /**< Metadata property name used in INFO chunks. */
  141. static const char* const riffInfoTapeName; /**< Metadata property name used in INFO chunks. */
  142. static const char* const riffInfoTechnician; /**< Metadata property name used in INFO chunks. */
  143. static const char* const riffInfoThirdLanguage; /**< Metadata property name used in INFO chunks. */
  144. static const char* const riffInfoTimeCode; /**< Metadata property name used in INFO chunks. */
  145. static const char* const riffInfoTitle; /**< Metadata property name used in INFO chunks. */
  146. static const char* const riffInfoTrackNumber; /**< Metadata property name used in INFO chunks. */
  147. static const char* const riffInfoURL; /**< Metadata property name used in INFO chunks. */
  148. static const char* const riffInfoVegasVersionMajor; /**< Metadata property name used in INFO chunks. */
  149. static const char* const riffInfoVegasVersionMinor; /**< Metadata property name used in INFO chunks. */
  150. static const char* const riffInfoVersion; /**< Metadata property name used in INFO chunks. */
  151. static const char* const riffInfoWatermarkURL; /**< Metadata property name used in INFO chunks. */
  152. static const char* const riffInfoWrittenBy; /**< Metadata property name used in INFO chunks. */
  153. static const char* const riffInfoYear; /**< Metadata property name used in INFO chunks. */
  154. //==============================================================================
  155. /** Metadata property name used when reading an ISRC code from an AXML chunk. */
  156. static const char* const ISRC;
  157. /** Metadata property name used when reading a WAV file with a Tracktion chunk. */
  158. static const char* const tracktionLoopInfo;
  159. //==============================================================================
  160. Array<int> getPossibleSampleRates() override;
  161. Array<int> getPossibleBitDepths() override;
  162. bool canDoStereo() override;
  163. bool canDoMono() override;
  164. //==============================================================================
  165. AudioFormatReader* createReaderFor (InputStream* sourceStream,
  166. bool deleteStreamIfOpeningFails) override;
  167. private:
  168. CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WavAudioFormat)
  169. };
  170. }
  171. #endif // WATER_WAV_AUDIOFORMAT_H_INCLUDED