8#define HEPHAUDIO_CH_MASK_MONO (HephAudio::AudioChannelMask::FrontCenter)
9#define HEPHAUDIO_CH_MASK_STEREO (HephAudio::AudioChannelMask::FrontLeft | HephAudio::AudioChannelMask::FrontRight)
10#define HEPHAUDIO_CH_MASK_2_POINT_1 (HEPHAUDIO_CH_MASK_STEREO | HephAudio::AudioChannelMask::LowFrequency)
11#define HEPHAUDIO_CH_MASK_2_1 (HEPHAUDIO_CH_MASK_STEREO | HephAudio::AudioChannelMask::BackCenter)
12#define HEPHAUDIO_CH_MASK_SURROUND (HEPHAUDIO_CH_MASK_STEREO | HephAudio::AudioChannelMask::FrontCenter)
13#define HEPHAUDIO_CH_MASK_3_POINT_1 (HEPHAUDIO_CH_MASK_SURROUND | HephAudio::AudioChannelMask::LowFrequency)
14#define HEPHAUDIO_CH_MASK_4_POINT_0 (HEPHAUDIO_CH_MASK_SURROUND | HephAudio::AudioChannelMask::BackCenter)
15#define HEPHAUDIO_CH_MASK_2_2 (HEPHAUDIO_CH_MASK_STEREO | HephAudio::AudioChannelMask::SideLeft | HephAudio::AudioChannelMask::SideRight)
16#define HEPHAUDIO_CH_MASK_QUAD (HEPHAUDIO_CH_MASK_STEREO | HephAudio::AudioChannelMask::BackLeft | HephAudio::AudioChannelMask::BackRight)
17#define HEPHAUDIO_CH_MASK_4_POINT_1 (HEPHAUDIO_CH_MASK_4_POINT_0 | HephAudio::AudioChannelMask::LowFrequency)
18#define HEPHAUDIO_CH_MASK_5_POINT_0 (HEPHAUDIO_CH_MASK_SURROUND | HephAudio::AudioChannelMask::SideLeft | HephAudio::AudioChannelMask::SideRight)
19#define HEPHAUDIO_CH_MASK_5_POINT_0_BACK (HEPHAUDIO_CH_MASK_SURROUND | HephAudio::AudioChannelMask::BackLeft | HephAudio::AudioChannelMask::BackRight)
20#define HEPHAUDIO_CH_MASK_5_POINT_1 (HEPHAUDIO_CH_MASK_5_POINT_0 | HephAudio::AudioChannelMask::LowFrequency)
21#define HEPHAUDIO_CH_MASK_5_POINT_1_BACK (HEPHAUDIO_CH_MASK_5_POINT_0_BACK | HephAudio::AudioChannelMask::LowFrequency)
22#define HEPHAUDIO_CH_MASK_6_POINT_0 (HEPHAUDIO_CH_MASK_5_POINT_0 | HephAudio::AudioChannelMask::BackCenter)
23#define HEPHAUDIO_CH_MASK_6_POINT_0_FRONT (HEPHAUDIO_CH_MASK_2_2 | HephAudio::AudioChannelMask::FrontLeftOfCenter | HephAudio::AudioChannelMask::FrontRightOfCenter)
24#define HEPHAUDIO_CH_MASK_HEXAGONAL (HEPHAUDIO_CH_MASK_5_POINT_0_BACK | HephAudio::AudioChannelMask::BackCenter)
25#define HEPHAUDIO_CH_MASK_6_POINT_1 (HEPHAUDIO_CH_MASK_5_POINT_1 | HephAudio::AudioChannelMask::BackCenter)
26#define HEPHAUDIO_CH_MASK_6_POINT_1_BACK (HEPHAUDIO_CH_MASK_5_POINT_1_BACK | HephAudio::AudioChannelMask::BackCenter)
27#define HEPHAUDIO_CH_MASK_6_POINT_1_FRONT (HEPHAUDIO_CH_MASK_6_POINT_0_FRONT | HephAudio::AudioChannelMask::LowFrequency)
28#define HEPHAUDIO_CH_MASK_7_POINT_0 (HEPHAUDIO_CH_MASK_5_POINT_0 | HephAudio::AudioChannelMask::BackLeft | HephAudio::AudioChannelMask::BackRight)
29#define HEPHAUDIO_CH_MASK_7_POINT_0_FRONT (HEPHAUDIO_CH_MASK_5_POINT_0 | HephAudio::AudioChannelMask::FrontLeftOfCenter | HephAudio::AudioChannelMask::FrontRightOfCenter)
30#define HEPHAUDIO_CH_MASK_7_POINT_1 (HEPHAUDIO_CH_MASK_5_POINT_1 | HephAudio::AudioChannelMask::BackLeft | HephAudio::AudioChannelMask::BackRight)
31#define HEPHAUDIO_CH_MASK_7_POINT_1_WIDE (HEPHAUDIO_CH_MASK_5_POINT_1 | HephAudio::AudioChannelMask::FrontLeftOfCenter | HephAudio::AudioChannelMask::FrontRightOfCenter)
32#define HEPHAUDIO_CH_MASK_7_POINT_1_WIDE_BACK (HEPHAUDIO_CH_MASK_5_POINT_1_BACK | HephAudio::AudioChannelMask::FrontLeftOfCenter | HephAudio::AudioChannelMask::FrontRightOfCenter)
33#define HEPHAUDIO_CH_MASK_OCTAGONAL (HEPHAUDIO_CH_MASK_5_POINT_0 | HephAudio::AudioChannelMask::BackLeft | HephAudio::AudioChannelMask::BackCenter | HephAudio::AudioChannelMask::BackRight)
35#define HEPHAUDIO_CH_LAYOUT_MONO HephAudio::AudioChannelLayout(1, HEPHAUDIO_CH_MASK_MONO)
36#define HEPHAUDIO_CH_LAYOUT_STEREO HephAudio::AudioChannelLayout(2, HEPHAUDIO_CH_MASK_STEREO)
37#define HEPHAUDIO_CH_LAYOUT_2_POINT_1 HephAudio::AudioChannelLayout(3, HEPHAUDIO_CH_MASK_2_POINT_1)
38#define HEPHAUDIO_CH_LAYOUT_2_1 HephAudio::AudioChannelLayout(3, HEPHAUDIO_CH_MASK_2_1)
39#define HEPHAUDIO_CH_LAYOUT_SURROUND HephAudio::AudioChannelLayout(3, HEPHAUDIO_CH_MASK_SURROUND)
40#define HEPHAUDIO_CH_LAYOUT_3_POINT_1 HephAudio::AudioChannelLayout(4, HEPHAUDIO_CH_MASK_3_POINT_1)
41#define HEPHAUDIO_CH_LAYOUT_4_POINT_0 HephAudio::AudioChannelLayout(4, HEPHAUDIO_CH_MASK_4_POINT_0)
42#define HEPHAUDIO_CH_LAYOUT_2_2 HephAudio::AudioChannelLayout(4, HEPHAUDIO_CH_MASK_2_2)
43#define HEPHAUDIO_CH_LAYOUT_QUAD HephAudio::AudioChannelLayout(4, HEPHAUDIO_CH_MASK_QUAD)
44#define HEPHAUDIO_CH_LAYOUT_4_POINT_1 HephAudio::AudioChannelLayout(5, HEPHAUDIO_CH_MASK_4_POINT_1)
45#define HEPHAUDIO_CH_LAYOUT_5_POINT_0 HephAudio::AudioChannelLayout(5, HEPHAUDIO_CH_MASK_5_POINT_0)
46#define HEPHAUDIO_CH_LAYOUT_5_POINT_0_BACK HephAudio::AudioChannelLayout(5, HEPHAUDIO_CH_MASK_5_POINT_0_BACK)
47#define HEPHAUDIO_CH_LAYOUT_5_POINT_1 HephAudio::AudioChannelLayout(6, HEPHAUDIO_CH_MASK_5_POINT_1)
48#define HEPHAUDIO_CH_LAYOUT_5_POINT_1_BACK HephAudio::AudioChannelLayout(6, HEPHAUDIO_CH_MASK_5_POINT_1_BACK)
49#define HEPHAUDIO_CH_LAYOUT_6_POINT_0 HephAudio::AudioChannelLayout(6, HEPHAUDIO_CH_MASK_6_POINT_0)
50#define HEPHAUDIO_CH_LAYOUT_6_POINT_0_FRONT HephAudio::AudioChannelLayout(6, HEPHAUDIO_CH_MASK_6_POINT_0_FRONT)
51#define HEPHAUDIO_CH_LAYOUT_HEXAGONAL HephAudio::AudioChannelLayout(6, HEPHAUDIO_CH_MASK_HEXAGONAL)
52#define HEPHAUDIO_CH_LAYOUT_6_POINT_1 HephAudio::AudioChannelLayout(7, HEPHAUDIO_CH_MASK_6_POINT_1)
53#define HEPHAUDIO_CH_LAYOUT_6_POINT_1_BACK HephAudio::AudioChannelLayout(7, HEPHAUDIO_CH_MASK_6_POINT_1_BACK)
54#define HEPHAUDIO_CH_LAYOUT_6_POINT_1_FRONT HephAudio::AudioChannelLayout(7, HEPHAUDIO_CH_MASK_6_POINT_1_FRONT)
55#define HEPHAUDIO_CH_LAYOUT_7_POINT_0 HephAudio::AudioChannelLayout(7, HEPHAUDIO_CH_MASK_7_POINT_0)
56#define HEPHAUDIO_CH_LAYOUT_7_POINT_0_FRONT HephAudio::AudioChannelLayout(7, HEPHAUDIO_CH_MASK_7_POINT_0_FRONT)
57#define HEPHAUDIO_CH_LAYOUT_7_POINT_1 HephAudio::AudioChannelLayout(8, HEPHAUDIO_CH_MASK_7_POINT_1)
58#define HEPHAUDIO_CH_LAYOUT_7_POINT_1_WIDE HephAudio::AudioChannelLayout(8, HEPHAUDIO_CH_MASK_7_POINT_1_WIDE)
59#define HEPHAUDIO_CH_LAYOUT_7_POINT_1_WIDE_BACK HephAudio::AudioChannelLayout(8, HEPHAUDIO_CH_MASK_7_POINT_1_WIDE_BACK)
60#define HEPHAUDIO_CH_LAYOUT_OCTAGONAL HephAudio::AudioChannelLayout(8, HEPHAUDIO_CH_MASK_OCTAGONAL)
78 FrontLeftOfCenter = 0x40,
79 FrontRightOfCenter = 0x80,
84 TopFrontLeft = 0x1000,
85 TopFrontCenter = 0x2000,
86 TopFrontRight = 0x4000,
88 TopBackCenter = 0x10000,
89 TopBackRight = 0x20000
93 inline constexpr AudioChannelMask operator|(
const AudioChannelMask& lhs,
const AudioChannelMask& rhs)
95 return (AudioChannelMask)(((int)lhs) | ((int)rhs));
98 inline constexpr AudioChannelMask& operator|=(AudioChannelMask& lhs,
const AudioChannelMask& rhs)
104 inline constexpr AudioChannelMask operator&(
const AudioChannelMask& lhs,
const AudioChannelMask& rhs)
106 return (AudioChannelMask)(((int)lhs) & ((int)rhs));
109 inline constexpr AudioChannelMask& operator&=(AudioChannelMask& lhs,
const AudioChannelMask& rhs)
115 inline constexpr AudioChannelMask operator^(
const AudioChannelMask& lhs,
const AudioChannelMask& rhs)
117 return (AudioChannelMask)(((int)lhs) ^ ((int)rhs));
120 inline constexpr AudioChannelMask& operator^=(AudioChannelMask& lhs,
const AudioChannelMask& rhs)
128 return (AudioChannelMask)(~((int)lhs));
162 return this->count == rhs.
count && this->mask == rhs.
mask;
165 constexpr bool operator!=(
const AudioChannelLayout& rhs)
const
167 return this->count != rhs.count || this->mask != rhs.mask;
176 switch (channelCount)
179 return HEPHAUDIO_CH_MASK_MONO;
181 return HEPHAUDIO_CH_MASK_STEREO;
183 return HEPHAUDIO_CH_MASK_SURROUND;
185 return HEPHAUDIO_CH_MASK_4_POINT_0;
187 return HEPHAUDIO_CH_MASK_5_POINT_0;
189 return HEPHAUDIO_CH_MASK_5_POINT_1;
191 return HEPHAUDIO_CH_MASK_7_POINT_0;
193 return HEPHAUDIO_CH_MASK_7_POINT_1;
195 return AudioChannelMask::Unknown;
205 return AudioChannelLayout(channelCount, AudioChannelLayout::DefaultChannelMask(channelCount));
214 uint16_t channelCount = 0;
215 uint32_t mask32 = (uint32_t)mask;
216 for (
size_t i = 0; i < 32; i++)
233 return AudioChannelLayout::GetChannelCount(layout.
mask);
AudioChannelMask
Definition AudioChannelLayout.h:70
#define HEPH_API
Definition HephShared.h:132
stores information about the channel layout.
Definition AudioChannelLayout.h:136
static constexpr uint16_t GetChannelCount(AudioChannelMask mask)
Definition AudioChannelLayout.h:212
static constexpr uint16_t GetChannelCount(const AudioChannelLayout &layout)
Definition AudioChannelLayout.h:231
static constexpr AudioChannelMask DefaultChannelMask(uint16_t channelCount)
Definition AudioChannelLayout.h:174
static std::vector< AudioChannelMask > GetChannelMapping(const AudioChannelLayout &layout)
static constexpr AudioChannelLayout DefaultChannelLayout(uint16_t channelCount)
Definition AudioChannelLayout.h:203
constexpr AudioChannelLayout()
Definition AudioChannelLayout.h:150
constexpr AudioChannelLayout(uint16_t count, AudioChannelMask mask)
Definition AudioChannelLayout.h:158
static std::vector< AudioChannelMask > GetChannelMapping(AudioChannelMask mask)
uint16_t count
Definition AudioChannelLayout.h:141
AudioChannelMask mask
Definition AudioChannelLayout.h:147