VST3: fetch midi mappings all at once, use it for note/sound-off
[carla.git] / source / modules / juce_audio_basics / buffers / juce_AudioChannelSet.h
blob3c96befa278a0b8d8feb36f2c6e56f0d133f2d2c
1 /*
2 ==============================================================================
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
20 ==============================================================================
23 namespace juce
26 //==============================================================================
27 /**
28 Represents a set of audio channel types.
30 For example, you might have a set of left + right channels, which is a stereo
31 channel set. It is a collection of values from the AudioChannelSet::ChannelType
32 enum, where each type may only occur once within the set.
34 The documentation below lists which AudioChannelSet corresponds to which native
35 layouts used by AAX, VST2/VST3 and CoreAudio/AU. The layout tags in CoreAudio
36 are particularly confusing. For example, the layout which is labeled as "7.1 SDDS"
37 in Logic Pro, corresponds to CoreAudio/AU's kAudioChannelLayoutTag_DTS_7_0 tag, whereas
38 AAX's DTS 7.1 Layout corresponds to CoreAudio/AU's
39 kAudioChannelLayoutTag_MPEG_7_1_A format, etc. Please do not use the CoreAudio tag
40 as an indication to the actual layout of the speakers.
42 @see Bus
44 @tags{Audio}
46 class JUCE_API AudioChannelSet
48 public:
49 /** Creates an empty channel set.
50 You can call addChannel to add channels to the set.
52 AudioChannelSet() = default;
54 /** Creates a zero-channel set which can be used to indicate that a
55 bus is disabled. */
56 static AudioChannelSet JUCE_CALLTYPE disabled();
58 //==============================================================================
59 /** Creates a one-channel mono set (centre).
61 Is equivalent to: kMonoAAX (VST), AAX_eStemFormat_Mono (AAX), kAudioChannelLayoutTag_Mono (CoreAudio)
63 static AudioChannelSet JUCE_CALLTYPE mono();
66 /** Creates a set containing a stereo set (left, right).
68 Is equivalent to: kStereo (VST), AAX_eStemFormat_Stereo (AAX), kAudioChannelLayoutTag_Stereo (CoreAudio)
70 static AudioChannelSet JUCE_CALLTYPE stereo();
73 //==============================================================================
74 /** Creates a set containing an LCR set (left, right, centre).
76 Is equivalent to: k30Cine (VST), AAX_eStemFormat_LCR (AAX), kAudioChannelLayoutTag_MPEG_3_0_A (CoreAudio)
78 This format is referred to as "LRC" in Cubase.
79 This format is referred to as "LCR" in Pro Tools.
81 static AudioChannelSet JUCE_CALLTYPE createLCR();
84 /** Creates a set containing an LRS set (left, right, surround).
86 Is equivalent to: k30Music (VST), n/a (AAX), kAudioChannelLayoutTag_ITU_2_1 (CoreAudio)
88 This format is referred to as "LRS" in Cubase.
90 static AudioChannelSet JUCE_CALLTYPE createLRS();
93 /** Creates a set containing an LCRS set (left, right, centre, surround).
95 Is equivalent to: k40Cine (VST), AAX_eStemFormat_LCRS (AAX), kAudioChannelLayoutTag_MPEG_4_0_A (CoreAudio)
97 This format is referred to as "LCRS (Pro Logic)" in Logic Pro.
98 This format is referred to as "LRCS" in Cubase.
99 This format is referred to as "LCRS" in Pro Tools.
101 static AudioChannelSet JUCE_CALLTYPE createLCRS();
104 //==============================================================================
105 /** Creates a set for a 5.0 surround setup (left, right, centre, leftSurround, rightSurround).
107 Is equivalent to: k50 (VST), AAX_eStemFormat_5_0 (AAX), kAudioChannelLayoutTag_MPEG_5_0_A (CoreAudio)
109 This format is referred to as "5.0" in Cubase.
110 This format is referred to as "5.0" in Pro Tools.
112 static AudioChannelSet JUCE_CALLTYPE create5point0();
115 /** Creates a set for a 5.1 surround setup (left, right, centre, leftSurround, rightSurround, LFE).
117 Is equivalent to: k51 (VST), AAX_eStemFormat_5_1 (AAX), kAudioChannelLayoutTag_MPEG_5_1_A (CoreAudio)
119 This format is referred to as "5.1 (ITU 775)" in Logic Pro.
120 This format is referred to as "5.1" in Cubase.
121 This format is referred to as "5.1" in Pro Tools.
123 static AudioChannelSet JUCE_CALLTYPE create5point1();
126 /** Creates a set for a 6.0 Cine surround setup (left, right, centre, leftSurround, rightSurround, centreSurround).
128 Is equivalent to: k60Cine (VST), AAX_eStemFormat_6_0 (AAX), kAudioChannelLayoutTag_AudioUnit_6_0 (CoreAudio)
130 Logic Pro incorrectly uses this for the surround format labeled "6.1 (ES/EX)".
131 This format is referred to as "6.0 Cine" in Cubase.
132 This format is referred to as "6.0" in Pro Tools.
134 static AudioChannelSet JUCE_CALLTYPE create6point0();
137 /** Creates a set for a 6.1 Cine surround setup (left, right, centre, leftSurround, rightSurround, centreSurround, LFE).
139 Is equivalent to: k61Cine (VST), AAX_eStemFormat_6_1 (AAX), kAudioChannelLayoutTag_MPEG_6_1_A (CoreAudio)
141 This format is referred to as "6.1" in Pro Tools.
143 static AudioChannelSet JUCE_CALLTYPE create6point1();
146 /** Creates a set for a 6.0 Music surround setup (left, right, leftSurround, rightSurround, leftSurroundSide, rightSurroundSide).
148 Is equivalent to: k60Music (VST), n/a (AAX), kAudioChannelLayoutTag_DTS_6_0_A (CoreAudio)
150 This format is referred to as "6.0 Music" in Cubase.
152 static AudioChannelSet JUCE_CALLTYPE create6point0Music();
155 /** Creates a set for a 6.0 Music surround setup (left, right, leftSurround, rightSurround, leftSurroundSide, rightSurroundSide, LFE).
157 Is equivalent to: k61Music (VST), n/a (AAX), kAudioChannelLayoutTag_DTS_6_1_A (CoreAudio)
159 static AudioChannelSet JUCE_CALLTYPE create6point1Music();
162 /** Creates a set for a DTS 7.0 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear).
164 Is equivalent to: k70Music (VST), AAX_eStemFormat_7_0_DTS (AAX), kAudioChannelLayoutTag_AudioUnit_7_0 (CoreAudio)
166 This format is referred to as "7.0" in Pro Tools.
168 static AudioChannelSet JUCE_CALLTYPE create7point0();
171 /** Creates a set for a SDDS 7.0 surround setup (left, right, centre, leftSurround, rightSurround, leftCentre, rightCentre).
173 Is equivalent to: k70Cine (VST), AAX_eStemFormat_7_0_SDDS (AAX), kAudioChannelLayoutTag_AudioUnit_7_0_Front (CoreAudio)
175 This format is referred to as "7.0 SDDS" in Pro Tools.
177 static AudioChannelSet JUCE_CALLTYPE create7point0SDDS();
180 /** Creates a set for a DTS 7.1 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, LFE).
182 Is equivalent to: k71CineSideFill (VST), AAX_eStemFormat_7_1_DTS (AAX), kAudioChannelLayoutTag_MPEG_7_1_C/kAudioChannelLayoutTag_ITU_3_4_1 (CoreAudio)
184 This format is referred to as "7.1 (3/4.1)" in Logic Pro.
185 This format is referred to as "7.1" in Pro Tools.
187 static AudioChannelSet JUCE_CALLTYPE create7point1();
190 /** Creates a set for a 7.1 surround setup (left, right, centre, leftSurround, rightSurround, leftCentre, rightCentre, LFE).
192 Is equivalent to: k71Cine (VST), AAX_eStemFormat_7_1_SDDS (AAX), kAudioChannelLayoutTag_MPEG_7_1_A (CoreAudio)
194 This format is referred to as "7.1 (SDDS)" in Logic Pro.
195 This format is referred to as "7.1 SDDS" in Pro Tools.
197 static AudioChannelSet JUCE_CALLTYPE create7point1SDDS();
199 /** Creates a set for a 5.1.2 surround setup (left, right, centre, LFE, leftSurround, rightSurround, topSideLeft, topSideRight).
201 Is equivalent to: kAudioChannelLayoutTag_Atmos_5_1_2 (CoreAudio).
203 static AudioChannelSet JUCE_CALLTYPE create5point1point2();
205 /** Creates a set for a 5.1.4 surround setup (left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, topRearLeft, topRearRight).
207 Is equivalent to: kAudioChannelLayoutTag_Atmos_5_1_4 (CoreAudio).
209 static AudioChannelSet JUCE_CALLTYPE create5point1point4();
211 /** Creates a set for Dolby Atmos 7.0.2 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, topSideLeft, topSideRight).
213 Is equivalent to: n/a (VST), AAX_eStemFormat_7_0_2 (AAX), n/a (CoreAudio)
215 static AudioChannelSet JUCE_CALLTYPE create7point0point2();
217 /** Creates a set for Dolby Atmos 7.1.2 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, LFE, topSideLeft, topSideRight).
219 Is equivalent to: k71_2 (VST), AAX_eStemFormat_7_1_2 (AAX), kAudioChannelLayoutTag_Atmos_7_1_2 (CoreAudio)
221 static AudioChannelSet JUCE_CALLTYPE create7point1point2();
223 /** Creates a set for Dolby Atmos 7.0.4 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, topFrontLeft, topFrontRight, topRearLeft, topRearRight).
225 Is equivalent to: n/a (VST), n/a (AAX), n/a (CoreAudio)
227 static AudioChannelSet JUCE_CALLTYPE create7point0point4();
229 /** Creates a set for Dolby Atmos 7.1.4 surround setup (left, right, centre, leftSurroundSide, rightSurroundSide, leftSurroundRear, rightSurroundRear, LFE, topFrontLeft, topFrontRight, topRearLeft, topRearRight).
231 Is equivalent to: k71_4 (VST), n/a (AAX), kAudioChannelLayoutTag_Atmos_7_1_4 (CoreAudio)
233 static AudioChannelSet JUCE_CALLTYPE create7point1point4();
235 /** 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).
237 Is equivalent to: k71_6 (VST), n/a (AAX), n/a (CoreAudio)
239 static AudioChannelSet JUCE_CALLTYPE create7point1point6();
241 /** 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).
243 Note that the VST3 layout arranges the front speakers "L Lc C Rc R", but the JUCE layout
244 uses the arrangement "wideLeft left centre right wideRight". To maintain the relative
245 positions of the speakers, the channels will be remapped accordingly. This means that the
246 VST3 host's "L" channel will be received on a JUCE plugin's "wideLeft" channel, the
247 "Lc" channel will be received on a JUCE plugin's "left" channel, and so on.
249 Is equivalent to: k91_6 (VST3), kAudioChannelLayoutTag_Atmos_9_1_6 (CoreAudio).
251 static AudioChannelSet JUCE_CALLTYPE create9point1point6();
253 //==============================================================================
254 /** Creates a set for quadraphonic surround setup (left, right, leftSurround, rightSurround)
256 Is equivalent to: k40Music (VST), AAX_eStemFormat_Quad (AAX), kAudioChannelLayoutTag_Quadraphonic (CoreAudio)
258 This format is referred to as "Quadraphonic" in Logic Pro.
259 This format is referred to as "Quadro" in Cubase.
260 This format is referred to as "Quad" in Pro Tools.
262 static AudioChannelSet JUCE_CALLTYPE quadraphonic();
265 /** Creates a set for pentagonal surround setup (left, right, centre, leftSurroundRear, rightSurroundRear).
267 Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Pentagonal (CoreAudio)
269 static AudioChannelSet JUCE_CALLTYPE pentagonal();
272 /** Creates a set for hexagonal surround setup (left, right, leftSurroundRear, rightSurroundRear, centre, surroundCentre).
274 Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Hexagonal (CoreAudio)
276 static AudioChannelSet JUCE_CALLTYPE hexagonal();
279 /** Creates a set for octagonal surround setup (left, right, leftSurround, rightSurround, centre, centreSurround, wideLeft, wideRight).
281 Is equivalent to: n/a (VST), n/a (AAX), kAudioChannelLayoutTag_Octagonal (CoreAudio)
283 static AudioChannelSet JUCE_CALLTYPE octagonal();
285 //==============================================================================
286 /** Creates a set for ACN, SN3D normalised ambisonic surround setups with a given order.
288 Is equivalent to: kAmbiXXXOrderACN (VST), AAX_eStemFormat_Ambi_XXX_ACN (AAX), kAudioChannelLayoutTag_HOA_ACN_SN3D (CoreAudio)
290 static AudioChannelSet JUCE_CALLTYPE ambisonic (int order = 1);
292 /** Returns the order of the ambisonic layout represented by this AudioChannelSet. If the
293 AudioChannelSet is not an ambisonic layout, then this method will return -1.
295 int getAmbisonicOrder() const;
297 //==============================================================================
298 /** Creates a set of untyped discrete channels. */
299 static AudioChannelSet JUCE_CALLTYPE discreteChannels (int numChannels);
301 /** Create a canonical channel set for a given number of channels.
302 For example, numChannels = 1 will return mono, numChannels = 2 will return stereo, etc. */
303 static AudioChannelSet JUCE_CALLTYPE canonicalChannelSet (int numChannels);
305 /** Create a channel set for a given number of channels which is non-discrete.
306 If numChannels is larger than the number of channels of the surround format
307 with the maximum amount of channels (currently 7.1 Surround), then this
308 function returns an empty set.*/
309 static AudioChannelSet JUCE_CALLTYPE namedChannelSet (int numChannels);
311 /** Return an array of channel sets which have a given number of channels */
312 static Array<AudioChannelSet> JUCE_CALLTYPE channelSetsWithNumberOfChannels (int numChannels);
314 //==============================================================================
315 /** Represents different audio channel types. */
316 enum ChannelType
318 unknown = 0, /**< Unknown channel type. */
320 //==============================================================================
321 left = 1, /**< L channel. */
322 right = 2, /**< R channel. */
323 centre = 3, /**< C channel. (Sometimes M for mono) */
325 //==============================================================================
326 LFE = 4, /**< LFE channel. */
327 leftSurround = 5, /**< Ls channel. */
328 rightSurround = 6, /**< Rs channel. */
329 leftCentre = 7, /**< Lc (AAX/VST), Lc used as Lss in AU for most layouts. */
330 rightCentre = 8, /**< Rc (AAX/VST), Rc used as Rss in AU for most layouts. */
331 centreSurround = 9, /**< Cs/S channel. */
332 surround = centreSurround, /**< Same as Centre Surround channel. */
333 leftSurroundSide = 10, /**< Lss (AXX), Side Left "Sl" (VST), Left Centre "LC" (AU) channel. */
334 rightSurroundSide = 11, /**< Rss (AXX), Side right "Sr" (VST), Right Centre "Rc" (AU) channel. */
335 topMiddle = 12, /**< Top Middle channel. */
336 topFrontLeft = 13, /**< Top Front Left channel. */
337 topFrontCentre = 14, /**< Top Front Centre channel. */
338 topFrontRight = 15, /**< Top Front Right channel. */
339 topRearLeft = 16, /**< Top Rear Left channel. */
340 topRearCentre = 17, /**< Top Rear Centre channel. */
341 topRearRight = 18, /**< Top Rear Right channel. */
342 LFE2 = 19, /**< Second LFE channel. */
343 leftSurroundRear = 20, /**< Lsr (AAX), Lcs (VST), Rls (AU) channel. */
344 rightSurroundRear = 21, /**< Rsr (AAX), Rcs (VST), Rrs (AU) channel. */
345 wideLeft = 22, /**< Wide Left channel. */
346 wideRight = 23, /**< Wide Right channel. */
348 //==============================================================================
349 // Used by Dolby Atmos 7.0.2 and 7.1.2
350 topSideLeft = 28, /**< Lts (AAX), Tsl (VST), Ltm (AU) channel for Dolby Atmos. */
351 topSideRight = 29, /**< Rts (AAX), Tsr (VST), Rtm (AU) channel for Dolby Atmos. */
353 //==============================================================================
354 // Ambisonic ACN formats - all channels are SN3D normalised
356 // zero-th and first-order ambisonic ACN
357 ambisonicACN0 = 24, /**< Zero-th ambisonic channel number 0. */
358 ambisonicACN1 = 25, /**< First-order ambisonic channel number 1. */
359 ambisonicACN2 = 26, /**< First-order ambisonic channel number 2. */
360 ambisonicACN3 = 27, /**< First-order ambisonic channel number 3. */
362 // second-order ambisonic
363 ambisonicACN4 = 30, /**< Second-order ambisonic channel number 4. */
364 ambisonicACN5 = 31, /**< Second-order ambisonic channel number 5. */
365 ambisonicACN6 = 32, /**< Second-order ambisonic channel number 6. */
366 ambisonicACN7 = 33, /**< Second-order ambisonic channel number 7. */
367 ambisonicACN8 = 34, /**< Second-order ambisonic channel number 8. */
369 // third-order ambisonic
370 ambisonicACN9 = 35, /**< Third-order ambisonic channel number 9. */
371 ambisonicACN10 = 36, /**< Third-order ambisonic channel number 10. */
372 ambisonicACN11 = 37, /**< Third-order ambisonic channel number 11. */
373 ambisonicACN12 = 38, /**< Third-order ambisonic channel number 12. */
374 ambisonicACN13 = 39, /**< Third-order ambisonic channel number 13. */
375 ambisonicACN14 = 40, /**< Third-order ambisonic channel number 14. */
376 ambisonicACN15 = 41, /**< Third-order ambisonic channel number 15. */
378 // fourth-order ambisonic
379 ambisonicACN16 = 42, /**< Fourth-order ambisonic channel number 16. */
380 ambisonicACN17 = 43, /**< Fourth-order ambisonic channel number 17. */
381 ambisonicACN18 = 44, /**< Fourth-order ambisonic channel number 18. */
382 ambisonicACN19 = 45, /**< Fourth-order ambisonic channel number 19. */
383 ambisonicACN20 = 46, /**< Fourth-order ambisonic channel number 20. */
384 ambisonicACN21 = 47, /**< Fourth-order ambisonic channel number 21. */
385 ambisonicACN22 = 48, /**< Fourth-order ambisonic channel number 22. */
386 ambisonicACN23 = 49, /**< Fourth-order ambisonic channel number 23. */
387 ambisonicACN24 = 50, /**< Fourth-order ambisonic channel number 24. */
389 // fifth-order ambisonic
390 ambisonicACN25 = 51, /**< Fifth-order ambisonic channel number 25. */
391 ambisonicACN26 = 52, /**< Fifth-order ambisonic channel number 26. */
392 ambisonicACN27 = 53, /**< Fifth-order ambisonic channel number 27. */
393 ambisonicACN28 = 54, /**< Fifth-order ambisonic channel number 28. */
394 ambisonicACN29 = 55, /**< Fifth-order ambisonic channel number 29. */
395 ambisonicACN30 = 56, /**< Fifth-order ambisonic channel number 30. */
396 ambisonicACN31 = 57, /**< Fifth-order ambisonic channel number 31. */
397 ambisonicACN32 = 58, /**< Fifth-order ambisonic channel number 32. */
398 ambisonicACN33 = 59, /**< Fifth-order ambisonic channel number 33. */
399 ambisonicACN34 = 60, /**< Fifth-order ambisonic channel number 34. */
400 ambisonicACN35 = 61, /**< Fifth-order ambisonic channel number 35. */
402 //==============================================================================
403 ambisonicW = ambisonicACN0, /**< Same as zero-th ambisonic channel number 0. */
404 ambisonicX = ambisonicACN3, /**< Same as first-order ambisonic channel number 3. */
405 ambisonicY = ambisonicACN1, /**< Same as first-order ambisonic channel number 1. */
406 ambisonicZ = ambisonicACN2, /**< Same as first-order ambisonic channel number 2. */
408 //==============================================================================
409 bottomFrontLeft = 62, /**< Bottom Front Left (Bfl) */
410 bottomFrontCentre = 63, /**< Bottom Front Centre (Bfc) */
411 bottomFrontRight = 64, /**< Bottom Front Right (Bfr) */
413 proximityLeft = 65, /**< Proximity Left (Pl) */
414 proximityRight = 66, /**< Proximity Right (Pr) */
416 bottomSideLeft = 67, /**< Bottom Side Left (Bsl) */
417 bottomSideRight = 68, /**< Bottom Side Right (Bsr) */
418 bottomRearLeft = 69, /**< Bottom Rear Left (Brl) */
419 bottomRearCentre = 70, /**< Bottom Rear Center (Brc) */
420 bottomRearRight = 71, /**< Bottom Rear Right (Brr) */
422 //==============================================================================
423 discreteChannel0 = 128 /**< Non-typed individual channels are indexed upwards from this value. */
426 /** Returns the name of a given channel type. For example, this method may return "Surround Left". */
427 static String JUCE_CALLTYPE getChannelTypeName (ChannelType);
429 /** Returns the abbreviated name of a channel type. For example, this method may return "Ls". */
430 static String JUCE_CALLTYPE getAbbreviatedChannelTypeName (ChannelType);
432 /** Returns the channel type from an abbreviated name. */
433 static ChannelType JUCE_CALLTYPE getChannelTypeFromAbbreviation (const String& abbreviation);
435 //==============================================================================
436 enum
438 maxChannelsOfNamedLayout = 36
441 /** Adds a channel to the set. */
442 void addChannel (ChannelType newChannelType);
444 /** Removes a channel from the set. */
445 void removeChannel (ChannelType newChannelType);
447 /** Returns the number of channels in the set. */
448 int size() const noexcept;
450 /** Returns true if there are no channels in the set. */
451 bool isDisabled() const noexcept { return size() == 0; }
453 /** Returns an array of all the types in this channel set. */
454 Array<ChannelType> getChannelTypes() const;
456 /** Returns the type of one of the channels in the set, by index. */
457 ChannelType getTypeOfChannel (int channelIndex) const noexcept;
459 /** Returns the index for a particular channel-type.
460 Will return -1 if the this set does not contain a channel of this type. */
461 int getChannelIndexForType (ChannelType type) const noexcept;
463 /** Returns a string containing a whitespace-separated list of speaker types
464 corresponding to each channel. For example in a 5.1 arrangement,
465 the string may be "L R C Lfe Ls Rs". If the speaker arrangement is unknown,
466 the returned string will be empty.*/
467 String getSpeakerArrangementAsString() const;
469 /** Returns an AudioChannelSet from a string returned by getSpeakerArrangementAsString
471 @see getSpeakerArrangementAsString */
472 static AudioChannelSet fromAbbreviatedString (const String& set);
474 /** Returns the description of the current layout. For example, this method may return
475 "Quadraphonic". Note that the returned string may not be unique. */
476 String getDescription() const;
478 /** Returns if this is a channel layout made-up of discrete channels. */
479 bool isDiscreteLayout() const noexcept;
481 /** Intersect two channel layouts. */
482 void intersect (const AudioChannelSet& other) { channels &= other.channels; }
484 /** Creates a channel set for a list of channel types. This function will assert
485 if you supply a duplicate channel.
487 Note that this method ignores the order in which the channels are given, i.e.
488 two arrays with the same elements but in a different order will still result
489 in the same channel set.
491 static AudioChannelSet JUCE_CALLTYPE channelSetWithChannels (const Array<ChannelType>&);
493 //==============================================================================
494 // Conversion between wave and juce channel layout identifiers
496 /** Create an AudioChannelSet from a WAVEFORMATEXTENSIBLE channelMask (typically used
497 in .wav files). */
498 static AudioChannelSet JUCE_CALLTYPE fromWaveChannelMask (int32 dwChannelMask);
500 /** Returns a WAVEFORMATEXTENSIBLE channelMask representation (typically used in .wav
501 files) of the receiver.
503 Returns -1 if the receiver cannot be represented in a WAVEFORMATEXTENSIBLE channelMask
504 representation.
506 int32 getWaveChannelMask() const noexcept;
508 //==============================================================================
509 bool operator== (const AudioChannelSet&) const noexcept;
510 bool operator!= (const AudioChannelSet&) const noexcept;
511 bool operator< (const AudioChannelSet&) const noexcept;
513 private:
514 //==============================================================================
515 BigInteger channels;
517 //==============================================================================
518 explicit AudioChannelSet (uint32);
519 explicit AudioChannelSet (const std::initializer_list<ChannelType>&);
521 //==============================================================================
522 static int JUCE_CALLTYPE getAmbisonicOrderForNumChannels (int);
525 } // namespace juce