32AudioChannelSet::AudioChannelSet (
const Array<ChannelType>& c)
34 for (
auto channel : c)
38bool AudioChannelSet::operator== (
const AudioChannelSet& other)
const noexcept {
return channels == other.channels; }
39bool AudioChannelSet::operator!= (
const AudioChannelSet& other)
const noexcept {
return channels != other.channels; }
40bool AudioChannelSet::operator< (
const AudioChannelSet& other)
const noexcept {
return channels < other.channels; }
44 if (type >= discreteChannel0)
45 return "Discrete " +
String (type - discreteChannel0 + 1);
49 case left:
return NEEDS_TRANS(
"Left");
50 case right:
return NEEDS_TRANS(
"Right");
51 case centre:
return NEEDS_TRANS(
"Centre");
52 case LFE:
return NEEDS_TRANS(
"LFE");
53 case leftSurround:
return NEEDS_TRANS(
"Left Surround");
54 case rightSurround:
return NEEDS_TRANS(
"Right Surround");
55 case leftCentre:
return NEEDS_TRANS(
"Left Centre");
56 case rightCentre:
return NEEDS_TRANS(
"Right Centre");
57 case centreSurround:
return NEEDS_TRANS(
"Centre Surround");
58 case leftSurroundRear:
return NEEDS_TRANS(
"Left Surround Rear");
59 case rightSurroundRear:
return NEEDS_TRANS(
"Right Surround Rear");
60 case topMiddle:
return NEEDS_TRANS(
"Top Middle");
61 case topFrontLeft:
return NEEDS_TRANS(
"Top Front Left");
62 case topFrontCentre:
return NEEDS_TRANS(
"Top Front Centre");
63 case topFrontRight:
return NEEDS_TRANS(
"Top Front Right");
64 case topRearLeft:
return NEEDS_TRANS(
"Top Rear Left");
65 case topRearCentre:
return NEEDS_TRANS(
"Top Rear Centre");
66 case topRearRight:
return NEEDS_TRANS(
"Top Rear Right");
67 case wideLeft:
return NEEDS_TRANS(
"Wide Left");
68 case wideRight:
return NEEDS_TRANS(
"Wide Right");
69 case LFE2:
return NEEDS_TRANS(
"LFE 2");
70 case leftSurroundSide:
return NEEDS_TRANS(
"Left Surround Side");
71 case rightSurroundSide:
return NEEDS_TRANS(
"Right Surround Side");
72 case ambisonicW:
return NEEDS_TRANS(
"Ambisonic W");
73 case ambisonicX:
return NEEDS_TRANS(
"Ambisonic X");
74 case ambisonicY:
return NEEDS_TRANS(
"Ambisonic Y");
75 case ambisonicZ:
return NEEDS_TRANS(
"Ambisonic Z");
76 case topSideLeft:
return NEEDS_TRANS(
"Top Side Left");
77 case topSideRight:
return NEEDS_TRANS(
"Top Side Right");
78 case ambisonicACN4:
return NEEDS_TRANS(
"Ambisonic 4");
79 case ambisonicACN5:
return NEEDS_TRANS(
"Ambisonic 5");
80 case ambisonicACN6:
return NEEDS_TRANS(
"Ambisonic 6");
81 case ambisonicACN7:
return NEEDS_TRANS(
"Ambisonic 7");
82 case ambisonicACN8:
return NEEDS_TRANS(
"Ambisonic 8");
83 case ambisonicACN9:
return NEEDS_TRANS(
"Ambisonic 9");
84 case ambisonicACN10:
return NEEDS_TRANS(
"Ambisonic 10");
85 case ambisonicACN11:
return NEEDS_TRANS(
"Ambisonic 11");
86 case ambisonicACN12:
return NEEDS_TRANS(
"Ambisonic 12");
87 case ambisonicACN13:
return NEEDS_TRANS(
"Ambisonic 13");
88 case ambisonicACN14:
return NEEDS_TRANS(
"Ambisonic 14");
89 case ambisonicACN15:
return NEEDS_TRANS(
"Ambisonic 15");
90 case bottomFrontLeft:
return NEEDS_TRANS(
"Bottom Front Left");
91 case bottomFrontCentre:
return NEEDS_TRANS(
"Bottom Front Centre");
92 case bottomFrontRight:
return NEEDS_TRANS(
"Bottom Front Right");
93 case bottomSideLeft:
return NEEDS_TRANS(
"Bottom Side Left");
94 case bottomSideRight:
return NEEDS_TRANS(
"Bottom Side Right");
95 case bottomRearLeft:
return NEEDS_TRANS(
"Bottom Rear Left");
96 case bottomRearCentre:
return NEEDS_TRANS(
"Bottom Rear Centre");
97 case bottomRearRight:
return NEEDS_TRANS(
"Bottom Rear Right");
98 case discreteChannel0:
return NEEDS_TRANS(
"Discrete channel");
107 if (type >= discreteChannel0)
108 return String (type - discreteChannel0 + 1);
112 case left:
return "L";
113 case right:
return "R";
114 case centre:
return "C";
115 case LFE:
return "Lfe";
116 case leftSurround:
return "Ls";
117 case rightSurround:
return "Rs";
118 case leftCentre:
return "Lc";
119 case rightCentre:
return "Rc";
120 case centreSurround:
return "Cs";
121 case leftSurroundRear:
return "Lrs";
122 case rightSurroundRear:
return "Rrs";
123 case topMiddle:
return "Tm";
124 case topFrontLeft:
return "Tfl";
125 case topFrontCentre:
return "Tfc";
126 case topFrontRight:
return "Tfr";
127 case topRearLeft:
return "Trl";
128 case topRearCentre:
return "Trc";
129 case topRearRight:
return "Trr";
130 case wideLeft:
return "Wl";
131 case wideRight:
return "Wr";
132 case LFE2:
return "Lfe2";
133 case leftSurroundSide:
return "Lss";
134 case rightSurroundSide:
return "Rss";
135 case ambisonicACN0:
return "ACN0";
136 case ambisonicACN1:
return "ACN1";
137 case ambisonicACN2:
return "ACN2";
138 case ambisonicACN3:
return "ACN3";
139 case ambisonicACN4:
return "ACN4";
140 case ambisonicACN5:
return "ACN5";
141 case ambisonicACN6:
return "ACN6";
142 case ambisonicACN7:
return "ACN7";
143 case ambisonicACN8:
return "ACN8";
144 case ambisonicACN9:
return "ACN9";
145 case ambisonicACN10:
return "ACN10";
146 case ambisonicACN11:
return "ACN11";
147 case ambisonicACN12:
return "ACN12";
148 case ambisonicACN13:
return "ACN13";
149 case ambisonicACN14:
return "ACN14";
150 case ambisonicACN15:
return "ACN15";
151 case topSideLeft:
return "Tsl";
152 case topSideRight:
return "Tsr";
153 case bottomFrontLeft:
return "Bfl";
154 case bottomFrontCentre:
return "Bfc";
155 case bottomFrontRight:
return "Bfr";
156 case bottomSideLeft:
return "Bsl";
157 case bottomSideRight:
return "Bsr";
158 case bottomRearLeft:
return "Brl";
159 case bottomRearCentre:
return "Brc";
160 case bottomRearRight:
return "Brr";
164 if (type >= ambisonicACN4 && type <= ambisonicACN35)
165 return "ACN" +
String (type - ambisonicACN4 + 4);
172 if (
abbr.length() > 0 && (
abbr[0] >=
'0' &&
abbr[0] <=
'9'))
174 +
abbr.getIntValue() - 1);
176 if (
abbr ==
"L")
return left;
177 if (
abbr ==
"R")
return right;
178 if (
abbr ==
"C")
return centre;
179 if (
abbr ==
"Lfe")
return LFE;
180 if (
abbr ==
"Ls")
return leftSurround;
181 if (
abbr ==
"Rs")
return rightSurround;
182 if (
abbr ==
"Lc")
return leftCentre;
183 if (
abbr ==
"Rc")
return rightCentre;
184 if (
abbr ==
"Cs")
return centreSurround;
185 if (
abbr ==
"Lrs")
return leftSurroundRear;
186 if (
abbr ==
"Rrs")
return rightSurroundRear;
187 if (
abbr ==
"Tm")
return topMiddle;
188 if (
abbr ==
"Tfl")
return topFrontLeft;
189 if (
abbr ==
"Tfc")
return topFrontCentre;
190 if (
abbr ==
"Tfr")
return topFrontRight;
191 if (
abbr ==
"Trl")
return topRearLeft;
192 if (
abbr ==
"Trc")
return topRearCentre;
193 if (
abbr ==
"Trr")
return topRearRight;
194 if (
abbr ==
"Wl")
return wideLeft;
195 if (
abbr ==
"Wr")
return wideRight;
196 if (
abbr ==
"Lfe2")
return LFE2;
197 if (
abbr ==
"Lss")
return leftSurroundSide;
198 if (
abbr ==
"Rss")
return rightSurroundSide;
199 if (
abbr ==
"W")
return ambisonicW;
200 if (
abbr ==
"X")
return ambisonicX;
201 if (
abbr ==
"Y")
return ambisonicY;
202 if (
abbr ==
"Z")
return ambisonicZ;
203 if (
abbr ==
"ACN0")
return ambisonicACN0;
204 if (
abbr ==
"ACN1")
return ambisonicACN1;
205 if (
abbr ==
"ACN2")
return ambisonicACN2;
206 if (
abbr ==
"ACN3")
return ambisonicACN3;
207 if (
abbr ==
"ACN4")
return ambisonicACN4;
208 if (
abbr ==
"ACN5")
return ambisonicACN5;
209 if (
abbr ==
"ACN6")
return ambisonicACN6;
210 if (
abbr ==
"ACN7")
return ambisonicACN7;
211 if (
abbr ==
"ACN8")
return ambisonicACN8;
212 if (
abbr ==
"ACN9")
return ambisonicACN9;
213 if (
abbr ==
"ACN10")
return ambisonicACN10;
214 if (
abbr ==
"ACN11")
return ambisonicACN11;
215 if (
abbr ==
"ACN12")
return ambisonicACN12;
216 if (
abbr ==
"ACN13")
return ambisonicACN13;
217 if (
abbr ==
"ACN14")
return ambisonicACN14;
218 if (
abbr ==
"ACN15")
return ambisonicACN15;
219 if (
abbr ==
"Tsl")
return topSideLeft;
220 if (
abbr ==
"Tsr")
return topSideRight;
221 if (
abbr ==
"Bfl")
return bottomFrontLeft;
222 if (
abbr ==
"Bfc")
return bottomFrontCentre;
223 if (
abbr ==
"Bfr")
return bottomFrontRight;
224 if (
abbr ==
"Bsl")
return bottomSideLeft;
225 if (
abbr ==
"Bsr")
return bottomSideRight;
226 if (
abbr ==
"Brl")
return bottomRearLeft;
227 if (
abbr ==
"Brc")
return bottomRearCentre;
228 if (
abbr ==
"Brr")
return bottomRearRight;
232String AudioChannelSet::getSpeakerArrangementAsString()
const
236 for (
auto&
speaker : getChannelTypes())
238 auto name = getAbbreviatedChannelTypeName (
speaker);
240 if (name.isNotEmpty())
251 for (
auto&
abbr : StringArray::fromTokens (
str,
true))
253 auto type = getChannelTypeFromAbbreviation (
abbr);
262String AudioChannelSet::getDescription()
const
264 if (isDiscreteLayout())
return "Discrete #" +
String (size());
265 if (*
this == disabled())
return "Disabled";
266 if (*
this == mono())
return "Mono";
267 if (*
this == stereo())
return "Stereo";
269 if (*
this == createLCR())
return "LCR";
270 if (*
this == createLRS())
return "LRS";
271 if (*
this == createLCRS())
return "LCRS";
273 if (*
this == create5point0())
return "5.0 Surround";
274 if (*
this == create5point1())
return "5.1 Surround";
275 if (*
this == create6point0())
return "6.0 Surround";
276 if (*
this == create6point1())
return "6.1 Surround";
277 if (*
this == create6point0Music())
return "6.0 (Music) Surround";
278 if (*
this == create6point1Music())
return "6.1 (Music) Surround";
279 if (*
this == create7point0())
return "7.0 Surround";
280 if (*
this == create7point1())
return "7.1 Surround";
281 if (*
this == create7point0SDDS())
return "7.0 Surround SDDS";
282 if (*
this == create7point1SDDS())
return "7.1 Surround SDDS";
283 if (*
this == create7point0point2())
return "7.0.2 Surround";
284 if (*
this == create7point1point2())
return "7.1.2 Surround";
286 if (*
this == quadraphonic())
return "Quadraphonic";
287 if (*
this == pentagonal())
return "Pentagonal";
288 if (*
this == hexagonal())
return "Hexagonal";
289 if (*
this == octagonal())
return "Octagonal";
293 auto order = getAmbisonicOrder();
301 case 1:
suffix =
"st";
break;
302 case 2:
suffix =
"nd";
break;
303 case 3:
suffix =
"rd";
break;
304 default:
suffix =
"th";
break;
316 for (
auto&
speaker : getChannelTypes())
325 return channels.countNumberOfSetBits();
330 int bit = channels.findNextSetBit(0);
333 bit = channels.findNextSetBit (
bit + 1);
342 for (
int bit = channels.findNextSetBit (0);
bit >= 0;
bit = channels.findNextSetBit (
bit + 1))
357 for (
int bit = channels.findNextSetBit(0);
bit >= 0;
bit = channels.findNextSetBit (
bit + 1))
366 jassert (
bit >= 0 &&
bit < 1024);
367 channels.setBit (
bit);
373 jassert (
bit >= 0 &&
bit < 1024);
374 channels.clearBit (
bit);
383AudioChannelSet AudioChannelSet::create5point0() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround)); }
384AudioChannelSet AudioChannelSet::create5point1() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurround) | (1u << rightSurround)); }
385AudioChannelSet AudioChannelSet::create6point0() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << centreSurround)); }
386AudioChannelSet AudioChannelSet::create6point1() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurround) | (1u << rightSurround) | (1u << centreSurround)); }
387AudioChannelSet AudioChannelSet::create6point0Music() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftSurroundSide) | (1u << rightSurroundSide)); }
388AudioChannelSet AudioChannelSet::create6point1Music() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << LFE) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftSurroundSide) | (1u << rightSurroundSide)); }
389AudioChannelSet AudioChannelSet::create7point0() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); }
390AudioChannelSet AudioChannelSet::create7point0SDDS() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftCentre) | (1u << rightCentre)); }
391AudioChannelSet AudioChannelSet::create7point1() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); }
392AudioChannelSet AudioChannelSet::create7point1SDDS() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurround) | (1u << rightSurround) | (1u << leftCentre) | (1u << rightCentre)); }
394AudioChannelSet AudioChannelSet::pentagonal() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); }
395AudioChannelSet AudioChannelSet::hexagonal() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << centreSurround) | (1u << leftSurroundRear) | (1u << rightSurroundRear)); }
396AudioChannelSet AudioChannelSet::octagonal() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurround) | (1u << rightSurround) | (1u << centreSurround) | (1u << wideLeft) | (1u << wideRight)); }
397AudioChannelSet AudioChannelSet::create7point0point2() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << leftSurroundRear) | (1u << rightSurroundRear) | (1u << topSideLeft) | (1u << topSideRight)); }
398AudioChannelSet AudioChannelSet::create7point1point2() {
return AudioChannelSet ((1u << left) | (1u << right) | (1u << centre) | (1u << LFE) | (1u << leftSurroundSide) | (1u << rightSurroundSide) | (1u << leftSurroundRear) | (1u << rightSurroundRear) | (1u << topSideLeft) | (1u << topSideRight)); }
402 jassert (isPositiveAndBelow (order, 6));
407 AudioChannelSet set ((1u << ambisonicACN0) | (1u << ambisonicACN1) | (1u << ambisonicACN2) | (1u << ambisonicACN3));
415int AudioChannelSet::getAmbisonicOrder()
const
428 s.channels.
setRange (discreteChannel0, numChannels,
true);
434 if (numChannels == 1)
return AudioChannelSet::mono();
435 if (numChannels == 2)
return AudioChannelSet::stereo();
436 if (numChannels == 3)
return AudioChannelSet::createLCR();
437 if (numChannels == 4)
return AudioChannelSet::quadraphonic();
438 if (numChannels == 5)
return AudioChannelSet::create5point0();
439 if (numChannels == 6)
return AudioChannelSet::create5point1();
440 if (numChannels == 7)
return AudioChannelSet::create7point0();
441 if (numChannels == 8)
return AudioChannelSet::create7point1();
443 return discreteChannels (numChannels);
448 if (numChannels == 1)
return AudioChannelSet::mono();
449 if (numChannels == 2)
return AudioChannelSet::stereo();
450 if (numChannels == 3)
return AudioChannelSet::createLCR();
451 if (numChannels == 4)
return AudioChannelSet::quadraphonic();
452 if (numChannels == 5)
return AudioChannelSet::create5point0();
453 if (numChannels == 6)
return AudioChannelSet::create5point1();
454 if (numChannels == 7)
return AudioChannelSet::create7point0();
455 if (numChannels == 8)
return AudioChannelSet::create7point1();
464 if (numChannels != 0)
466 retval.
add (AudioChannelSet::discreteChannels (numChannels));
468 if (numChannels == 1)
472 else if (numChannels == 2)
476 else if (numChannels == 3)
478 retval.
add (AudioChannelSet::createLCR());
479 retval.
add (AudioChannelSet::createLRS());
481 else if (numChannels == 4)
483 retval.
add (AudioChannelSet::quadraphonic());
484 retval.
add (AudioChannelSet::createLCRS());
486 else if (numChannels == 5)
488 retval.
add (AudioChannelSet::create5point0());
489 retval.
add (AudioChannelSet::pentagonal());
491 else if (numChannels == 6)
493 retval.
add (AudioChannelSet::create5point1());
494 retval.
add (AudioChannelSet::create6point0());
495 retval.
add (AudioChannelSet::create6point0Music());
496 retval.
add (AudioChannelSet::hexagonal());
498 else if (numChannels == 7)
500 retval.
add (AudioChannelSet::create7point0());
501 retval.
add (AudioChannelSet::create7point0SDDS());
502 retval.
add (AudioChannelSet::create6point1());
503 retval.
add (AudioChannelSet::create6point1Music());
505 else if (numChannels == 8)
507 retval.
add (AudioChannelSet::create7point1());
508 retval.
add (AudioChannelSet::create7point1SDDS());
509 retval.
add (AudioChannelSet::octagonal());
512 auto order = getAmbisonicOrderForNumChannels (numChannels);
514 retval.
add (AudioChannelSet::ambisonic (order));
526 jassert (! set.channels[
static_cast<int> (
ch)]);
542 if (channels.getHighestBit() > topRearRight)
545 return (channels.toInteger() >> 1);
549int JUCE_CALLTYPE AudioChannelSet::getAmbisonicOrderForNumChannels (
int numChannels)
551 auto sqrtMinusOne = std::sqrt (
static_cast<float> (numChannels)) - 1.0f;
565class AudioChannelSetUnitTest :
public UnitTest
568 AudioChannelSetUnitTest()
569 : UnitTest (
"AudioChannelSetUnitTest", UnitTestCategories::audio)
572 void runTest()
override
574 auto max = AudioChannelSet::maxChannelsOfNamedLayout;
576 beginTest (
"maxChannelsOfNamedLayout is non-discrete");
577 expect (AudioChannelSet::channelSetsWithNumberOfChannels (max).size() >= 2);
579 beginTest (
"channelSetsWithNumberOfChannels returns correct speaker count");
581 for (
auto ch = 1; ch <= max; ++ch)
583 auto channelSets = AudioChannelSet::channelSetsWithNumberOfChannels (ch);
585 for (
auto set : channelSets)
586 expect (set.size() == ch);
590 beginTest (
"Ambisonics");
594 mask |= (1ull << AudioChannelSet::ambisonicACN0);
595 checkAmbisonic (mask, 0,
"0th Order Ambisonics");
597 mask |= (1ull << AudioChannelSet::ambisonicACN1) | (1ull << AudioChannelSet::ambisonicACN2) | (1ull << AudioChannelSet::ambisonicACN3);
598 checkAmbisonic (mask, 1,
"1st Order Ambisonics");
600 mask |= (1ull << AudioChannelSet::ambisonicACN4) | (1ull << AudioChannelSet::ambisonicACN5) | (1ull << AudioChannelSet::ambisonicACN6)
601 | (1ull << AudioChannelSet::ambisonicACN7) | (1ull << AudioChannelSet::ambisonicACN8);
602 checkAmbisonic (mask, 2,
"2nd Order Ambisonics");
604 mask |= (1ull << AudioChannelSet::ambisonicACN9) | (1ull << AudioChannelSet::ambisonicACN10) | (1ull << AudioChannelSet::ambisonicACN11)
605 | (1ull << AudioChannelSet::ambisonicACN12) | (1ull << AudioChannelSet::ambisonicACN13) | (1ull << AudioChannelSet::ambisonicACN14)
606 | (1ull << AudioChannelSet::ambisonicACN15);
607 checkAmbisonic (mask, 3,
"3rd Order Ambisonics");
609 mask |= (1ull << AudioChannelSet::ambisonicACN16) | (1ull << AudioChannelSet::ambisonicACN17) | (1ull << AudioChannelSet::ambisonicACN18)
610 | (1ull << AudioChannelSet::ambisonicACN19) | (1ull << AudioChannelSet::ambisonicACN20) | (1ull << AudioChannelSet::ambisonicACN21)
611 | (1ull << AudioChannelSet::ambisonicACN22) | (1ull << AudioChannelSet::ambisonicACN23) | (1ull << AudioChannelSet::ambisonicACN24);
612 checkAmbisonic (mask, 4,
"4th Order Ambisonics");
614 mask |= (1ull << AudioChannelSet::ambisonicACN25) | (1ull << AudioChannelSet::ambisonicACN26) | (1ull << AudioChannelSet::ambisonicACN27)
615 | (1ull << AudioChannelSet::ambisonicACN28) | (1ull << AudioChannelSet::ambisonicACN29) | (1ull << AudioChannelSet::ambisonicACN30)
616 | (1ull << AudioChannelSet::ambisonicACN31) | (1ull << AudioChannelSet::ambisonicACN32) | (1ull << AudioChannelSet::ambisonicACN33)
617 | (1ull << AudioChannelSet::ambisonicACN34) | (1ull << AudioChannelSet::ambisonicACN35);
618 checkAmbisonic (mask, 5,
"5th Order Ambisonics");
623 void checkAmbisonic (uint64 mask,
int order,
const char* layoutName)
625 auto expected = AudioChannelSet::ambisonic (order);
626 auto numChannels = expected.
size();
628 expect (numChannels == BigInteger ((int64) mask).countNumberOfSetBits());
629 expect (channelSetFromMask (mask) == expected);
631 expect (order == expected.getAmbisonicOrder());
632 expect (expected.getDescription() == layoutName);
634 auto layouts = AudioChannelSet::channelSetsWithNumberOfChannels (numChannels);
635 expect (layouts.contains (expected));
637 for (
auto layout : layouts)
638 expect (layout.getAmbisonicOrder() == (layout == expected ? order : -1));
641 static AudioChannelSet channelSetFromMask (uint64 mask)
643 Array<AudioChannelSet::ChannelType> channels;
644 for (
int bit = 0; bit <= 62; ++bit)
645 if ((mask & (1ull << bit)) != 0)
646 channels.add (
static_cast<AudioChannelSet::ChannelType
> (bit));
648 return AudioChannelSet::channelSetWithChannels (channels);
652static AudioChannelSetUnitTest audioChannelSetUnitTest;
int size() const noexcept
void add(const ElementType &newElement)
AudioChannelSet()=default
void addChannel(ChannelType newChannelType)
void setRange(int startBit, int numBits, bool shouldBeSet)