OpenShot Audio Library | OpenShotAudio 0.4.0
juce_AudioChannelSet.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
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.
15
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.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
46class JUCE_API AudioChannelSet
47{
48public:
52 AudioChannelSet() = default;
53
56 static AudioChannelSet JUCE_CALLTYPE disabled();
57
58 //==============================================================================
63 static AudioChannelSet JUCE_CALLTYPE mono();
64
65
70 static AudioChannelSet JUCE_CALLTYPE stereo();
71
72
73 //==============================================================================
81 static AudioChannelSet JUCE_CALLTYPE createLCR();
82
83
90 static AudioChannelSet JUCE_CALLTYPE createLRS();
91
92
101 static AudioChannelSet JUCE_CALLTYPE createLCRS();
102
103
104 //==============================================================================
112 static AudioChannelSet JUCE_CALLTYPE create5point0();
113
114
123 static AudioChannelSet JUCE_CALLTYPE create5point1();
124
125
134 static AudioChannelSet JUCE_CALLTYPE create6point0();
135
136
143 static AudioChannelSet JUCE_CALLTYPE create6point1();
144
145
152 static AudioChannelSet JUCE_CALLTYPE create6point0Music();
153
154
159 static AudioChannelSet JUCE_CALLTYPE create6point1Music();
160
161
168 static AudioChannelSet JUCE_CALLTYPE create7point0();
169
170
177 static AudioChannelSet JUCE_CALLTYPE create7point0SDDS();
178
179
187 static AudioChannelSet JUCE_CALLTYPE create7point1();
188
189
197 static AudioChannelSet JUCE_CALLTYPE create7point1SDDS();
198
203 static AudioChannelSet JUCE_CALLTYPE create5point0point2();
204
209 static AudioChannelSet JUCE_CALLTYPE create5point1point2();
210
215 static AudioChannelSet JUCE_CALLTYPE create5point0point4();
216
221 static AudioChannelSet JUCE_CALLTYPE create5point1point4();
222
227 static AudioChannelSet JUCE_CALLTYPE create7point0point2();
228
233 static AudioChannelSet JUCE_CALLTYPE create7point1point2();
234
239 static AudioChannelSet JUCE_CALLTYPE create7point0point4();
240
245 static AudioChannelSet JUCE_CALLTYPE create7point1point4();
246
251 static AudioChannelSet JUCE_CALLTYPE create7point0point6();
252
257 static AudioChannelSet JUCE_CALLTYPE create7point1point6();
258
263 static AudioChannelSet JUCE_CALLTYPE create9point0point4();
264
269 static AudioChannelSet JUCE_CALLTYPE create9point1point4();
270
275 static AudioChannelSet JUCE_CALLTYPE create9point0point6();
276
287 static AudioChannelSet JUCE_CALLTYPE create9point1point6();
288
289 //==============================================================================
298 static AudioChannelSet JUCE_CALLTYPE quadraphonic();
299
300
305 static AudioChannelSet JUCE_CALLTYPE pentagonal();
306
307
312 static AudioChannelSet JUCE_CALLTYPE hexagonal();
313
314
319 static AudioChannelSet JUCE_CALLTYPE octagonal();
320
321 //==============================================================================
326 static AudioChannelSet JUCE_CALLTYPE ambisonic (int order = 1);
327
331 int getAmbisonicOrder() const;
332
333 //==============================================================================
335 static AudioChannelSet JUCE_CALLTYPE discreteChannels (int numChannels);
336
339 static AudioChannelSet JUCE_CALLTYPE canonicalChannelSet (int numChannels);
340
345 static AudioChannelSet JUCE_CALLTYPE namedChannelSet (int numChannels);
346
348 static Array<AudioChannelSet> JUCE_CALLTYPE channelSetsWithNumberOfChannels (int numChannels);
349
350 //==============================================================================
353 {
354 unknown = 0,
356 //==============================================================================
357 left = 1,
358 right = 2,
359 centre = 3,
361 //==============================================================================
362 LFE = 4,
363 leftSurround = 5,
364 rightSurround = 6,
365 leftCentre = 7,
366 rightCentre = 8,
367 centreSurround = 9,
368 surround = centreSurround,
369 leftSurroundSide = 10,
370 rightSurroundSide = 11,
371 topMiddle = 12,
372 topFrontLeft = 13,
373 topFrontCentre = 14,
374 topFrontRight = 15,
375 topRearLeft = 16,
376 topRearCentre = 17,
377 topRearRight = 18,
378 LFE2 = 19,
379 leftSurroundRear = 20,
380 rightSurroundRear = 21,
381 wideLeft = 22,
382 wideRight = 23,
384 //==============================================================================
385 // Used by Dolby Atmos 7.0.2 and 7.1.2
386 topSideLeft = 28,
387 topSideRight = 29,
389 //==============================================================================
390 // Ambisonic ACN formats - all channels are SN3D normalised
391
392 // zero-th and first-order ambisonic ACN
393 ambisonicACN0 = 24,
394 ambisonicACN1 = 25,
395 ambisonicACN2 = 26,
396 ambisonicACN3 = 27,
398 // second-order ambisonic
399 ambisonicACN4 = 30,
400 ambisonicACN5 = 31,
401 ambisonicACN6 = 32,
402 ambisonicACN7 = 33,
403 ambisonicACN8 = 34,
405 // third-order ambisonic
406 ambisonicACN9 = 35,
407 ambisonicACN10 = 36,
408 ambisonicACN11 = 37,
409 ambisonicACN12 = 38,
410 ambisonicACN13 = 39,
411 ambisonicACN14 = 40,
412 ambisonicACN15 = 41,
414 // fourth-order ambisonic
415 ambisonicACN16 = 42,
416 ambisonicACN17 = 43,
417 ambisonicACN18 = 44,
418 ambisonicACN19 = 45,
419 ambisonicACN20 = 46,
420 ambisonicACN21 = 47,
421 ambisonicACN22 = 48,
422 ambisonicACN23 = 49,
423 ambisonicACN24 = 50,
425 // fifth-order ambisonic
426 ambisonicACN25 = 51,
427 ambisonicACN26 = 52,
428 ambisonicACN27 = 53,
429 ambisonicACN28 = 54,
430 ambisonicACN29 = 55,
431 ambisonicACN30 = 56,
432 ambisonicACN31 = 57,
433 ambisonicACN32 = 58,
434 ambisonicACN33 = 59,
435 ambisonicACN34 = 60,
436 ambisonicACN35 = 61,
438 //==============================================================================
439 ambisonicW = ambisonicACN0,
440 ambisonicX = ambisonicACN3,
441 ambisonicY = ambisonicACN1,
442 ambisonicZ = ambisonicACN2,
444 //==============================================================================
445 bottomFrontLeft = 62,
446 bottomFrontCentre = 63,
447 bottomFrontRight = 64,
449 proximityLeft = 65,
450 proximityRight = 66,
452 bottomSideLeft = 67,
453 bottomSideRight = 68,
454 bottomRearLeft = 69,
455 bottomRearCentre = 70,
456 bottomRearRight = 71,
458 //==============================================================================
459
460 // sixth-order ambisonic
461 ambisonicACN36 = 72,
462 ambisonicACN37 = 73,
463 ambisonicACN38 = 74,
464 ambisonicACN39 = 75,
465 ambisonicACN40 = 76,
466 ambisonicACN41 = 77,
467 ambisonicACN42 = 78,
468 ambisonicACN43 = 79,
469 ambisonicACN44 = 80,
470 ambisonicACN45 = 81,
471 ambisonicACN46 = 82,
472 ambisonicACN47 = 83,
473 ambisonicACN48 = 84,
475 // seventh-order ambisonic
476 ambisonicACN49 = 85,
477 ambisonicACN50 = 86,
478 ambisonicACN51 = 87,
479 ambisonicACN52 = 88,
480 ambisonicACN53 = 89,
481 ambisonicACN54 = 90,
482 ambisonicACN55 = 91,
483 ambisonicACN56 = 92,
484 ambisonicACN57 = 93,
485 ambisonicACN58 = 94,
486 ambisonicACN59 = 95,
487 ambisonicACN60 = 96,
488 ambisonicACN61 = 97,
489 ambisonicACN62 = 98,
490 ambisonicACN63 = 99,
492 //==============================================================================
493 discreteChannel0 = 128
494 };
495
497 static String JUCE_CALLTYPE getChannelTypeName (ChannelType);
498
500 static String JUCE_CALLTYPE getAbbreviatedChannelTypeName (ChannelType);
501
503 static ChannelType JUCE_CALLTYPE getChannelTypeFromAbbreviation (const String& abbreviation);
504
505 //==============================================================================
506 enum
507 {
508 maxChannelsOfNamedLayout = 64
509 };
510
512 void addChannel (ChannelType newChannelType);
513
515 void removeChannel (ChannelType newChannelType);
516
518 int size() const noexcept;
519
521 bool isDisabled() const noexcept { return size() == 0; }
522
524 Array<ChannelType> getChannelTypes() const;
525
527 ChannelType getTypeOfChannel (int channelIndex) const noexcept;
528
531 int getChannelIndexForType (ChannelType type) const noexcept;
532
537 String getSpeakerArrangementAsString() const;
538
542 static AudioChannelSet fromAbbreviatedString (const String& set);
543
546 String getDescription() const;
547
549 bool isDiscreteLayout() const noexcept;
550
552 void intersect (const AudioChannelSet& other) { channels &= other.channels; }
553
561 static AudioChannelSet JUCE_CALLTYPE channelSetWithChannels (const Array<ChannelType>&);
562
563 //==============================================================================
564 // Conversion between wave and juce channel layout identifiers
565
568 static AudioChannelSet JUCE_CALLTYPE fromWaveChannelMask (int32 dwChannelMask);
569
576 int32 getWaveChannelMask() const noexcept;
577
578 //==============================================================================
582 static int getAmbisonicOrderForNumChannels (int numChannels, int maxOrderToCheck = 7);
583
584 //==============================================================================
585 bool operator== (const AudioChannelSet&) const noexcept;
586 bool operator!= (const AudioChannelSet&) const noexcept;
587 bool operator< (const AudioChannelSet&) const noexcept;
588
589private:
590 //==============================================================================
591 BigInteger channels;
592
593 //==============================================================================
594 explicit AudioChannelSet (uint32);
595 explicit AudioChannelSet (const std::initializer_list<ChannelType>&);
596
597};
598
599} // namespace juce