166 return InvalidChannelIndex;
169 int value =
static_cast<int>(mChannelMask);
178 return InvalidChannelIndex;
204 case 2:
return ChannelMap(ChannelMask::Stereo);
207 case 5:
return ChannelMap(ChannelMask::Surround_4_1);
208 case 6:
return ChannelMap(ChannelMask::Surround_5_1);
209 case 7:
return ChannelMap(ChannelMask::Surround_6_1);
210 case 8:
return ChannelMap(ChannelMask::Surround_7_1);
212 JPL_ASSERT(
"ChannelMap can be created from channel count up to 8 channels.");
217 template<
class Predicate>
221 int value =
static_cast<int>(mChannelMask);
224 static_assert(std::invocable<Predicate, EChannel, uint32> ||
225 std::invocable<Predicate, EChannel>,
"Invalid predicate signature.");
228 if constexpr (std::invocable<Predicate, EChannel, uint32>)
244 uint32 mChannelMask = ChannelMask::Invalid;
255 : Name(ChannelMask::ToString(channelMask))
256 , Layout(
ChannelMap::FromChannelMask(channelMask))
262 JPL_INLINE
bool operator==(const
NamedChannelMask& other) const noexcept {
return other.Layout == Layout; }
270 struct [[nodiscard]] hash<
JPL::ChannelMap>
274 return channelMap.mChannelMask;
285 case ChannelMask::Invalid:
return "INVALID";
286 case ChannelMask::Mono:
return "Mono";
287 case ChannelMask::Stereo:
return "Stereo";
288 case ChannelMask::LCR:
return "LCR";
289 case ChannelMask::LRS:
return "LRS";
290 case ChannelMask::LCRS:
return "LCRS";
291 case ChannelMask::Quad:
return "Quad";
293 case ChannelMask::Octagonal:
return "Octagonal";
294 case ChannelMask::Surround_4_1:
return "Surround 4.1";
295 case ChannelMask::Surround_5_0:
return "Surround 5.0";
296 case ChannelMask::Surround_5_1:
return "Surround 5.1";
297 case ChannelMask::Surround_6_0:
return "Surround 6.0";
298 case ChannelMask::Surround_6_1:
return "Surround 6.1";
299 case ChannelMask::Surround_7_0:
return "Surround 7.0";
300 case ChannelMask::Surround_7_1:
return "Surround 7.1";
301 case ChannelMask::Surround_5_0_2:
return "Surround 5.0.2";
302 case ChannelMask::Surround_5_1_2:
return "Surround 5.1.2";
303 case ChannelMask::Surround_5_0_4:
return "Surround 5.0.4";
304 case ChannelMask::Surround_5_1_4:
return "Surround 5.1.4";
305 case ChannelMask::Surround_7_0_2:
return "Surround 7.0.2";
306 case ChannelMask::Surround_7_1_2:
return "Surround 7.1.2";
307 case ChannelMask::Surround_7_0_4:
return "Surround 7.0.4";
308 case ChannelMask::Surround_7_1_4:
return "Surround 7.1.4";
309 case ChannelMask::Surround_7_0_6:
return "Surround 7.0.6";
310 case ChannelMask::Surround_7_1_6:
return "Surround 7.1.6";
311 case ChannelMask::Surround_9_0_4:
return "Surround 9.0.4";
312 case ChannelMask::Surround_9_1_4:
return "Surround 9.1.4";
313 case ChannelMask::Surround_9_0_6:
return "Surround 9.0.6";
314 case ChannelMask::Surround_9_1_6:
return "Surround 9.1.6";
#define JPL_BIT(x)
Definition Core.h:359
#define JPL_ASSERT(inExpression,...)
Main assert macro, usage: JPL_ASSERT(condition, message) or JPL_ASSERT(condition)
Definition ErrorReporting.h:76
Definition ChannelMap.h:150
constexpr uint32 GetNumChannels() const noexcept
Definition ChannelMap.h:162
constexpr bool IsValid() const noexcept
Definition ChannelMap.h:160
constexpr bool operator==(const ChannelMap &other) const noexcept
Definition ChannelMap.h:239
static constexpr ChannelMap FromNumChannels(uint32 numChannels)
Definition ChannelMap.h:199
static constexpr ChannelMap FromChannelMask(uint32 channelMask)
Definition ChannelMap.h:198
constexpr bool operator!=(const ChannelMap &other) const noexcept
Definition ChannelMap.h:240
constexpr ChannelMap()=default
constexpr uint32 GetChannelMask() const
Definition ChannelMap.h:194
constexpr bool HasTopChannels() const noexcept
Definition ChannelMap.h:159
constexpr EChannel GetChannelAtIndex(uint32 index) const
Definition ChannelMap.h:181
constexpr uint32 GetChannelIndex(EChannel channel) const
Definition ChannelMap.h:163
constexpr bool HasLFE() const noexcept
Definition ChannelMap.h:158
constexpr bool Has(EChannel channel) const noexcept
Definition ChannelMap.h:157
constexpr void ForEachChannel(Predicate predicate) const
Definition ChannelMap.h:218
JPL_INLINE std::string_view ToString(uint32 channelMask)
Definition ChannelMap.h:281
Definition AcousticMaterial.h:36
std::uint32_t uint32
Definition Core.h:311
EChannel
Definition ChannelMap.h:39
@ TOP_Channels
Definition ChannelMap.h:75
@ TopBackLeft
Definition ChannelMap.h:67
@ TopFrontRight
Definition ChannelMap.h:61
@ BackCenter
Definition ChannelMap.h:53
@ TopSideRight
Definition ChannelMap.h:65
@ Invalid
Definition ChannelMap.h:78
@ TopFrontCenter
Definition ChannelMap.h:60
@ TopSideLeft
Definition ChannelMap.h:64
@ FrontLeftCenter
Definition ChannelMap.h:48
@ TopBackCenter
Definition ChannelMap.h:68
@ SideRight
Definition ChannelMap.h:46
@ SideLeft
Definition ChannelMap.h:45
@ FrontCenter
Definition ChannelMap.h:42
@ WideRight
Definition ChannelMap.h:56
@ BackRight
Definition ChannelMap.h:52
@ NUM_GroundChannels
Definition ChannelMap.h:73
@ NUM_TopChannels
Definition ChannelMap.h:76
@ TopBackRight
Definition ChannelMap.h:69
@ BackLeft
Definition ChannelMap.h:51
@ FrontRightCenter
Definition ChannelMap.h:49
@ TopCenter
Definition ChannelMap.h:58
@ LFE
Definition ChannelMap.h:43
@ FrontLeft
Definition ChannelMap.h:40
@ WideLeft
Definition ChannelMap.h:55
@ TopFrontLeft
Definition ChannelMap.h:59
@ FrontRight
Definition ChannelMap.h:41
JPL_INLINE simd min(const simd &a, const simd &b) noexcept
Element-wise min.
Definition SIMD.h:1813
Definition ChannelMap.h:268
Utility to hold some channel mask with a name.
Definition ChannelMap.h:250
NamedChannelMask(uint32 channelMask)
Definition ChannelMap.h:254
std::string_view Name
Definition ChannelMap.h:251
ChannelMap Layout
Definition ChannelMap.h:252
NamedChannelMask() noexcept=default
constexpr std::size_t operator()(const JPL::ChannelMap &channelMap) const
Definition ChannelMap.h:272