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.

juce_AudioChannelSet.h 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2022 - Raw Material Software Limited
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. The code included in this file is provided under the terms of the ISC license
  8. http://www.isc.org/downloads/software-support-policy/isc-license. Permission
  9. To use, copy, modify, and/or distribute this software for any purpose with or
  10. without fee is hereby granted provided that the above copyright notice and
  11. this permission notice appear in all copies.
  12. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  13. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  14. DISCLAIMED.
  15. ==============================================================================
  16. */
  17. namespace juce
  18. {
  19. //==============================================================================
  20. /**
  21. Represents a set of audio channel types.
  22. For example, you might have a set of left + right channels, which is a stereo
  23. channel set. It is a collection of values from the AudioChannelSet::ChannelType
  24. enum, where each type may only occur once within the set.
  25. The documentation below lists which AudioChannelSet corresponds to which native
  26. layouts used by AAX, VST2/VST3 and CoreAudio/AU. The layout tags in CoreAudio
  27. are particularly confusing. For example, the layout which is labeled as "7.1 SDDS"
  28. in Logic Pro, corresponds to CoreAudio/AU's kAudioChannelLayoutTag_DTS_7_0 tag, whereas
  29. AAX's DTS 7.1 Layout corresponds to CoreAudio/AU's
  30. kAudioChannelLayoutTag_MPEG_7_1_A format, etc. Please do not use the CoreAudio tag
  31. as an indication to the actual layout of the speakers.
  32. @see Bus
  33. @tags{Audio}
  34. */
  35. class JUCE_API AudioChannelSet
  36. {
  37. public:
  38. /** Creates an empty channel set.
  39. You can call addChannel to add channels to the set.
  40. */
  41. AudioChannelSet() = default;
  42. /** Creates a zero-channel set which can be used to indicate that a
  43. bus is disabled. */
  44. static AudioChannelSet JUCE_CALLTYPE disabled();
  45. //==============================================================================
  46. /** Creates a one-channel mono set (centre).
  47. Is equivalent to: kMonoAAX (VST), AAX_eStemFormat_Mono (AAX), kAudioChannelLayoutTag_Mono (CoreAudio)
  48. */
  49. static AudioChannelSet JUCE_CALLTYPE mono();
  50. /** Creates a set containing a stereo set (left, right).
  51. Is equivalent to: kStereo (VST), AAX_eStemFormat_Stereo (AAX), kAudioChannelLayoutTag_Stereo (CoreAudio)
  52. */
  53. static AudioChannelSet JUCE_CALLTYPE stereo();
  54. //==============================================================================
  55. /** Creates a set containing an LCR set (left, right, centre).
  56. Is equivalent to: k30Cine (VST), AAX_eStemFormat_LCR (AAX), kAudioChannelLayoutTag_MPEG_3_0_A (CoreAudio)
  57. This format is referred to as "LRC" in Cubase.
  58. This format is referred to as "LCR" in Pro Tools.
  59. */
  60. static AudioChannelSet JUCE_CALLTYPE createLCR();
  61. /** Creates a set containing an LRS set (left, right, surround).
  62. Is equivalent to: k30Music (VST), n/a (AAX), kAudioChannelLayoutTag_ITU_2_1 (CoreAudio)
  63. This format is referred to as "LRS" in Cubase.
  64. */
  65. static AudioChannelSet JUCE_CALLTYPE createLRS();
  66. /** Creates a set containing an LCRS set (left, right, centre, surround).
  67. Is equivalent to: k40Cine (VST), AAX_eStemFormat_LCRS (AAX), kAudioChannelLayoutTag_MPEG_4_0_A (CoreAudio)
  68. This format is referred to as "LCRS (Pro Logic)" in Logic Pro.
  69. This format is referred to as "LRCS" in Cubase.
  70. This format is referred to as "LCRS" in Pro Tools.
  71. */
  72. static AudioChannelSet JUCE_CALLTYPE createLCRS();
  73. //==============================================================================
  74. /** Creates a set for a 5.0 surround setup (left, right, centre, leftSurround, rightSurround).
  75. Is equivalent to: k50 (VST), AAX_eStemFormat_5_0 (AAX), kAudioChannelLayoutTag_MPEG_5_0_A (CoreAudio)
  76. This format is referred to as "5.0" in Cubase.
  77. This format is referred to as "5.0" in Pro Tools.
  78. */
  79. static AudioChannelSet JUCE_CALLTYPE create5point0();
  80. /** Creates a set for a 5.1 surround setup (left, right, centre, leftSurround, rightSurround, LFE).
  81. Is equivalent to: k51 (VST), AAX_eStemFormat_5_1 (AAX), kAudioChannelLayoutTag_MPEG_5_1_A (CoreAudio)
  82. This format is referred to as "5.1 (ITU 775)" in Logic Pro.
  83. This format is referred to as "5.1" in Cubase.
  84. This format is referred to as "5.1" in Pro Tools.
  85. */
  86. static AudioChannelSet JUCE_CALLTYPE create5point1();
  87. /** Creates a set for a 6.0 Cine surround setup (left, right, centre, leftSurround, rightSurround, centreSurround).
  88. Is equivalent to: k60Cine (VST), AAX_eStemFormat_6_0 (AAX), kAudioChannelLayoutTag_AudioUnit_6_0 (CoreAudio)
  89. Logic Pro incorrectly uses this for the surround format labeled "6.1 (ES/EX)".
  90. This format is referred to as "6.0 Cine" in Cubase.
  91. This format is referred to as "6.0" in Pro Tools.
  92. */
  93. static AudioChannelSet JUCE_CALLTYPE create6point0();
  94. /** Creates a set for a 6.1 Cine surround setup (left, right, centre, leftSurround, rightSurround, centreSurround, LFE).
  95. Is equivalent to: k61Cine (VST), AAX_eStemFormat_6_1 (AAX), kAudioChannelLayoutTag_MPEG_6_1_A (CoreAudio)
  96. This format is referred to as "6.1" in Pro Tools.
  97. */
  98. static AudioChannelSet JUCE_CALLTYPE create6point1();
  99. /** Creates a set for a 6.0 Music surround setup (left, right, leftSurround, rightSurround, leftSurroundSide, rightSurroundSide).
  100. Is equivalent to: k60Music (VST), n/a (AAX), kAudioChannelLayoutTag_DTS_6_0_A (CoreAudio)
  101. This format is referred to as "6.0 Music" in Cubase.
  102. */
  103. static AudioChannelSet JUCE_CALLTYPE create6point0Music();
  104. /** Creates a set for a 6.0 Music surround setup (left, right, leftSurround, rightSurround, leftSurroundSide, rightSurroundSide, LFE).
  105. Is equivalent to: k61Music (VST), n/a (AAX), kAudioChannelLayoutTag_DTS_6_1_A (CoreAudio)
  106. */
  107. static AudioChannelSet JUCE_CALLTYPE create6point1Music();
  108. /** Creates a set for a DTS 7.0 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear).
  109. Is equivalent to: k70Music (VST), AAX_eStemFormat_7_0_DTS (AAX), kAudioChannelLayoutTag_AudioUnit_7_0 (CoreAudio)
  110. This format is referred to as "7.0" in Pro Tools.
  111. */
  112. static AudioChannelSet JUCE_CALLTYPE create7point0();
  113. /** Creates a set for a SDDS 7.0 surround setup (left, right, centre, leftSurround, rightSurround, leftCentre, rightCentre).
  114. Is equivalent to: k70Cine (VST), AAX_eStemFormat_7_0_SDDS (AAX), kAudioChannelLayoutTag_AudioUnit_7_0_Front (CoreAudio)
  115. This format is referred to as "7.0 SDDS" in Pro Tools.
  116. */
  117. static AudioChannelSet JUCE_CALLTYPE create7point0SDDS();
  118. /** Creates a set for a DTS 7.1 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, LFE).
  119. Is equivalent to: k71CineSideFill (VST), AAX_eStemFormat_7_1_DTS (AAX), kAudioChannelLayoutTag_MPEG_7_1_C/kAudioChannelLayoutTag_ITU_3_4_1 (CoreAudio)
  120. This format is referred to as "7.1 (3/4.1)" in Logic Pro.
  121. This format is referred to as "7.1" in Pro Tools.
  122. */
  123. static AudioChannelSet JUCE_CALLTYPE create7point1();
  124. /** Creates a set for a 7.1 surround setup (left, right, centre, leftSurround, rightSurround, leftCentre, rightCentre, LFE).
  125. Is equivalent to: k71Cine (VST), AAX_eStemFormat_7_1_SDDS (AAX), kAudioChannelLayoutTag_MPEG_7_1_A (CoreAudio)
  126. This format is referred to as "7.1 (SDDS)" in Logic Pro.
  127. This format is referred to as "7.1 SDDS" in Pro Tools.
  128. */
  129. static AudioChannelSet JUCE_CALLTYPE create7point1SDDS();
  130. /** Creates a set for a 5.1.2 surround setup (left, right, centre, LFE, leftSurround, rightSurround, topSideLeft, topSideRight).
  131. Is equivalent to: kAudioChannelLayoutTag_Atmos_5_1_2 (CoreAudio).
  132. */
  133. static AudioChannelSet JUCE_CALLTYPE create5point1point2();
  134. /** Creates a set for a 5.1.4 surround setup (left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, topRearLeft, topRearRight).
  135. Is equivalent to: kAudioChannelLayoutTag_Atmos_5_1_4 (CoreAudio).
  136. */
  137. static AudioChannelSet JUCE_CALLTYPE create5point1point4();
  138. /** Creates a set for Dolby Atmos 7.0.2 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, topSideLeft, topSideRight).
  139. Is equivalent to: n/a (VST), AAX_eStemFormat_7_0_2 (AAX), n/a (CoreAudio)
  140. */
  141. static AudioChannelSet JUCE_CALLTYPE create7point0point2();
  142. /** Creates a set for Dolby Atmos 7.1.2 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, LFE, topSideLeft, topSideRight).
  143. Is equivalent to: k71_2 (VST), AAX_eStemFormat_7_1_2 (AAX), kAudioChannelLayoutTag_Atmos_7_1_2 (CoreAudio)
  144. */
  145. static AudioChannelSet JUCE_CALLTYPE create7point1point2();
  146. /** Creates a set for Dolby Atmos 7.0.4 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, topFrontLeft, topFrontRight, topRearLeft, topRearRight).
  147. Is equivalent to: n/a (VST), n/a (AAX), n/a (CoreAudio)
  148. */
  149. static AudioChannelSet JUCE_CALLTYPE create7point0point4();
  150. /** Creates a set for Dolby Atmos 7.1.4 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, LFE, topFrontLeft, topFrontRight, topRearLeft, topRearRight).
  151. Is equivalent to: k71_4 (VST), n/a (AAX), kAudioChannelLayoutTag_Atmos_7_1_4 (CoreAudio)
  152. */
  153. static AudioChannelSet JUCE_CALLTYPE create7point1point4();
  154. /** Creates a set for Dolby Atmos 7.1.6 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, LFE, topFrontLeft, topFrontRight, topSideLeft, topSideRight, topRearLeft, topRearRight).
  155. Is equivalent to: k71_6 (VST), n/a (AAX), n/a (CoreAudio)
  156. */
  157. static AudioChannelSet JUCE_CALLTYPE create7point1point6();
  158. /** Creates a set for a 9.1.6 surround setup (left, right, centre, LFE, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, wideLeft, wideRight, topFrontLeft, topFrontRight, topSideLeft, topSideRight, topRearLeft, topRearRight).
  159. Note that the VST3 layout arranges the front speakers "L Lc C Rc R", but the JUCE layout
  160. uses the arrangement "wideLeft left centre right wideRight". To maintain the relative
  161. positions of the speakers, the channels will be remapped accordingly. This means that the
  162. VST3 host's "L" channel will be received on a JUCE plugin's "wideLeft" channel, the
  163. "Lc" channel will be received on a JUCE plugin's "left" channel, and so on.
  164. Is equivalent to: k91_6 (VST3), kAudioChannelLayoutTag_Atmos_9_1_6 (CoreAudio).
  165. */
  166. static AudioChannelSet JUCE_CALLTYPE create9point1point6();
  167. //==============================================================================
  168. /** Creates a set for quadraphonic surround setup (left, right, leftSurround, rightSurround)
  169. Is equivalent to: k40Music (VST), AAX_eStemFormat_Quad (AAX), kAudioChannelLayoutTag_Quadraphonic (CoreAudio)
  170. This format is referred to as "Quadraphonic" in Logic Pro.
  171. This format is referred to as "Quadro" in Cubase.
  172. This format is referred to as "Quad" in Pro Tools.
  173. */
  174. static AudioChannelSet JUCE_CALLTYPE quadraphonic();
  175. /** Creates a set for pentagonal surround setup (left, right, centre, leftSurroundRear, rightSurroundRear).
  176. Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Pentagonal (CoreAudio)
  177. */
  178. static AudioChannelSet JUCE_CALLTYPE pentagonal();
  179. /** Creates a set for hexagonal surround setup (left, right, leftSurroundRear, rightSurroundRear, centre, surroundCentre).
  180. Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Hexagonal (CoreAudio)
  181. */
  182. static AudioChannelSet JUCE_CALLTYPE hexagonal();
  183. /** Creates a set for octagonal surround setup (left, right, leftSurround, rightSurround, centre, centreSurround, wideLeft, wideRight).
  184. Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Octagonal (CoreAudio)
  185. */
  186. static AudioChannelSet JUCE_CALLTYPE octagonal();
  187. //==============================================================================
  188. /** Creates a set for ACN, SN3D normalised ambisonic surround setups with a given order.
  189. Is equivalent to: kAmbiXXXOrderACN (VST), AAX_eStemFormat_Ambi_XXX_ACN (AAX), kAudioChannelLayoutTag_HOA_ACN_SN3D (CoreAudio)
  190. */
  191. static AudioChannelSet JUCE_CALLTYPE ambisonic (int order = 1);
  192. /** Returns the order of the ambisonic layout represented by this AudioChannelSet. If the
  193. AudioChannelSet is not an ambisonic layout, then this method will return -1.
  194. */
  195. int getAmbisonicOrder() const;
  196. //==============================================================================
  197. /** Creates a set of untyped discrete channels. */
  198. static AudioChannelSet JUCE_CALLTYPE discreteChannels (int numChannels);
  199. /** Create a canonical channel set for a given number of channels.
  200. For example, numChannels = 1 will return mono, numChannels = 2 will return stereo, etc. */
  201. static AudioChannelSet JUCE_CALLTYPE canonicalChannelSet (int numChannels);
  202. /** Create a channel set for a given number of channels which is non-discrete.
  203. If numChannels is larger than the number of channels of the surround format
  204. with the maximum amount of channels (currently 7.1 Surround), then this
  205. function returns an empty set.*/
  206. static AudioChannelSet JUCE_CALLTYPE namedChannelSet (int numChannels);
  207. /** Return an array of channel sets which have a given number of channels */
  208. static Array<AudioChannelSet> JUCE_CALLTYPE channelSetsWithNumberOfChannels (int numChannels);
  209. //==============================================================================
  210. /** Represents different audio channel types. */
  211. enum ChannelType
  212. {
  213. unknown = 0, /**< Unknown channel type. */
  214. //==============================================================================
  215. left = 1, /**< L channel. */
  216. right = 2, /**< R channel. */
  217. centre = 3, /**< C channel. (Sometimes M for mono) */
  218. //==============================================================================
  219. LFE = 4, /**< LFE channel. */
  220. leftSurround = 5, /**< Ls channel. */
  221. rightSurround = 6, /**< Rs channel. */
  222. leftCentre = 7, /**< Lc (AAX/VST), Lc used as Lss in AU for most layouts. */
  223. rightCentre = 8, /**< Rc (AAX/VST), Rc used as Rss in AU for most layouts. */
  224. centreSurround = 9, /**< Cs/S channel. */
  225. surround = centreSurround, /**< Same as Centre Surround channel. */
  226. leftSurroundSide = 10, /**< Lss (AXX), Side Left "Sl" (VST), Left Centre "LC" (AU) channel. */
  227. rightSurroundSide = 11, /**< Rss (AXX), Side right "Sr" (VST), Right Centre "Rc" (AU) channel. */
  228. topMiddle = 12, /**< Top Middle channel. */
  229. topFrontLeft = 13, /**< Top Front Left channel. */
  230. topFrontCentre = 14, /**< Top Front Centre channel. */
  231. topFrontRight = 15, /**< Top Front Right channel. */
  232. topRearLeft = 16, /**< Top Rear Left channel. */
  233. topRearCentre = 17, /**< Top Rear Centre channel. */
  234. topRearRight = 18, /**< Top Rear Right channel. */
  235. LFE2 = 19, /**< Second LFE channel. */
  236. leftSurroundRear = 20, /**< Lsr (AAX), Lcs (VST), Rls (AU) channel. */
  237. rightSurroundRear = 21, /**< Rsr (AAX), Rcs (VST), Rrs (AU) channel. */
  238. wideLeft = 22, /**< Wide Left channel. */
  239. wideRight = 23, /**< Wide Right channel. */
  240. //==============================================================================
  241. // Used by Dolby Atmos 7.0.2 and 7.1.2
  242. topSideLeft = 28, /**< Lts (AAX), Tsl (VST), Ltm (AU) channel for Dolby Atmos. */
  243. topSideRight = 29, /**< Rts (AAX), Tsr (VST), Rtm (AU) channel for Dolby Atmos. */
  244. //==============================================================================
  245. // Ambisonic ACN formats - all channels are SN3D normalised
  246. // zero-th and first-order ambisonic ACN
  247. ambisonicACN0 = 24, /**< Zero-th ambisonic channel number 0. */
  248. ambisonicACN1 = 25, /**< First-order ambisonic channel number 1. */
  249. ambisonicACN2 = 26, /**< First-order ambisonic channel number 2. */
  250. ambisonicACN3 = 27, /**< First-order ambisonic channel number 3. */
  251. // second-order ambisonic
  252. ambisonicACN4 = 30, /**< Second-order ambisonic channel number 4. */
  253. ambisonicACN5 = 31, /**< Second-order ambisonic channel number 5. */
  254. ambisonicACN6 = 32, /**< Second-order ambisonic channel number 6. */
  255. ambisonicACN7 = 33, /**< Second-order ambisonic channel number 7. */
  256. ambisonicACN8 = 34, /**< Second-order ambisonic channel number 8. */
  257. // third-order ambisonic
  258. ambisonicACN9 = 35, /**< Third-order ambisonic channel number 9. */
  259. ambisonicACN10 = 36, /**< Third-order ambisonic channel number 10. */
  260. ambisonicACN11 = 37, /**< Third-order ambisonic channel number 11. */
  261. ambisonicACN12 = 38, /**< Third-order ambisonic channel number 12. */
  262. ambisonicACN13 = 39, /**< Third-order ambisonic channel number 13. */
  263. ambisonicACN14 = 40, /**< Third-order ambisonic channel number 14. */
  264. ambisonicACN15 = 41, /**< Third-order ambisonic channel number 15. */
  265. // fourth-order ambisonic
  266. ambisonicACN16 = 42, /**< Fourth-order ambisonic channel number 16. */
  267. ambisonicACN17 = 43, /**< Fourth-order ambisonic channel number 17. */
  268. ambisonicACN18 = 44, /**< Fourth-order ambisonic channel number 18. */
  269. ambisonicACN19 = 45, /**< Fourth-order ambisonic channel number 19. */
  270. ambisonicACN20 = 46, /**< Fourth-order ambisonic channel number 20. */
  271. ambisonicACN21 = 47, /**< Fourth-order ambisonic channel number 21. */
  272. ambisonicACN22 = 48, /**< Fourth-order ambisonic channel number 22. */
  273. ambisonicACN23 = 49, /**< Fourth-order ambisonic channel number 23. */
  274. ambisonicACN24 = 50, /**< Fourth-order ambisonic channel number 24. */
  275. // fifth-order ambisonic
  276. ambisonicACN25 = 51, /**< Fifth-order ambisonic channel number 25. */
  277. ambisonicACN26 = 52, /**< Fifth-order ambisonic channel number 26. */
  278. ambisonicACN27 = 53, /**< Fifth-order ambisonic channel number 27. */
  279. ambisonicACN28 = 54, /**< Fifth-order ambisonic channel number 28. */
  280. ambisonicACN29 = 55, /**< Fifth-order ambisonic channel number 29. */
  281. ambisonicACN30 = 56, /**< Fifth-order ambisonic channel number 30. */
  282. ambisonicACN31 = 57, /**< Fifth-order ambisonic channel number 31. */
  283. ambisonicACN32 = 58, /**< Fifth-order ambisonic channel number 32. */
  284. ambisonicACN33 = 59, /**< Fifth-order ambisonic channel number 33. */
  285. ambisonicACN34 = 60, /**< Fifth-order ambisonic channel number 34. */
  286. ambisonicACN35 = 61, /**< Fifth-order ambisonic channel number 35. */
  287. //==============================================================================
  288. ambisonicW = ambisonicACN0, /**< Same as zero-th ambisonic channel number 0. */
  289. ambisonicX = ambisonicACN3, /**< Same as first-order ambisonic channel number 3. */
  290. ambisonicY = ambisonicACN1, /**< Same as first-order ambisonic channel number 1. */
  291. ambisonicZ = ambisonicACN2, /**< Same as first-order ambisonic channel number 2. */
  292. //==============================================================================
  293. bottomFrontLeft = 62, /**< Bottom Front Left (Bfl) */
  294. bottomFrontCentre = 63, /**< Bottom Front Centre (Bfc) */
  295. bottomFrontRight = 64, /**< Bottom Front Right (Bfr) */
  296. proximityLeft = 65, /**< Proximity Left (Pl) */
  297. proximityRight = 66, /**< Proximity Right (Pr) */
  298. bottomSideLeft = 67, /**< Bottom Side Left (Bsl) */
  299. bottomSideRight = 68, /**< Bottom Side Right (Bsr) */
  300. bottomRearLeft = 69, /**< Bottom Rear Left (Brl) */
  301. bottomRearCentre = 70, /**< Bottom Rear Center (Brc) */
  302. bottomRearRight = 71, /**< Bottom Rear Right (Brr) */
  303. //==============================================================================
  304. discreteChannel0 = 128 /**< Non-typed individual channels are indexed upwards from this value. */
  305. };
  306. /** Returns the name of a given channel type. For example, this method may return "Surround Left". */
  307. static String JUCE_CALLTYPE getChannelTypeName (ChannelType);
  308. /** Returns the abbreviated name of a channel type. For example, this method may return "Ls". */
  309. static String JUCE_CALLTYPE getAbbreviatedChannelTypeName (ChannelType);
  310. /** Returns the channel type from an abbreviated name. */
  311. static ChannelType JUCE_CALLTYPE getChannelTypeFromAbbreviation (const String& abbreviation);
  312. //==============================================================================
  313. enum
  314. {
  315. maxChannelsOfNamedLayout = 36
  316. };
  317. /** Adds a channel to the set. */
  318. void addChannel (ChannelType newChannelType);
  319. /** Removes a channel from the set. */
  320. void removeChannel (ChannelType newChannelType);
  321. /** Returns the number of channels in the set. */
  322. int size() const noexcept;
  323. /** Returns true if there are no channels in the set. */
  324. bool isDisabled() const noexcept { return size() == 0; }
  325. /** Returns an array of all the types in this channel set. */
  326. Array<ChannelType> getChannelTypes() const;
  327. /** Returns the type of one of the channels in the set, by index. */
  328. ChannelType getTypeOfChannel (int channelIndex) const noexcept;
  329. /** Returns the index for a particular channel-type.
  330. Will return -1 if the this set does not contain a channel of this type. */
  331. int getChannelIndexForType (ChannelType type) const noexcept;
  332. /** Returns a string containing a whitespace-separated list of speaker types
  333. corresponding to each channel. For example in a 5.1 arrangement,
  334. the string may be "L R C Lfe Ls Rs". If the speaker arrangement is unknown,
  335. the returned string will be empty.*/
  336. String getSpeakerArrangementAsString() const;
  337. /** Returns an AudioChannelSet from a string returned by getSpeakerArrangementAsString
  338. @see getSpeakerArrangementAsString */
  339. static AudioChannelSet fromAbbreviatedString (const String& set);
  340. /** Returns the description of the current layout. For example, this method may return
  341. "Quadraphonic". Note that the returned string may not be unique. */
  342. String getDescription() const;
  343. /** Returns if this is a channel layout made-up of discrete channels. */
  344. bool isDiscreteLayout() const noexcept;
  345. /** Intersect two channel layouts. */
  346. void intersect (const AudioChannelSet& other) { channels &= other.channels; }
  347. /** Creates a channel set for a list of channel types. This function will assert
  348. if you supply a duplicate channel.
  349. Note that this method ignores the order in which the channels are given, i.e.
  350. two arrays with the same elements but in a different order will still result
  351. in the same channel set.
  352. */
  353. static AudioChannelSet JUCE_CALLTYPE channelSetWithChannels (const Array<ChannelType>&);
  354. //==============================================================================
  355. // Conversion between wave and juce channel layout identifiers
  356. /** Create an AudioChannelSet from a WAVEFORMATEXTENSIBLE channelMask (typically used
  357. in .wav files). */
  358. static AudioChannelSet JUCE_CALLTYPE fromWaveChannelMask (int32 dwChannelMask);
  359. /** Returns a WAVEFORMATEXTENSIBLE channelMask representation (typically used in .wav
  360. files) of the receiver.
  361. Returns -1 if the receiver cannot be represented in a WAVEFORMATEXTENSIBLE channelMask
  362. representation.
  363. */
  364. int32 getWaveChannelMask() const noexcept;
  365. //==============================================================================
  366. bool operator== (const AudioChannelSet&) const noexcept;
  367. bool operator!= (const AudioChannelSet&) const noexcept;
  368. bool operator< (const AudioChannelSet&) const noexcept;
  369. private:
  370. //==============================================================================
  371. BigInteger channels;
  372. //==============================================================================
  373. explicit AudioChannelSet (uint32);
  374. explicit AudioChannelSet (const std::initializer_list<ChannelType>&);
  375. //==============================================================================
  376. static int JUCE_CALLTYPE getAmbisonicOrderForNumChannels (int);
  377. };
  378. } // namespace juce