Fix speaker name conflicts with miniaudio macros in unity builds

This commit is contained in:
vittorioromeo 2024-06-10 23:02:16 +02:00 committed by Vittorio Romeo
parent eabea655c5
commit 571eee359f

View File

@ -108,27 +108,25 @@ bool SoundFileWriterWav::open(const std::filesystem::path& filename,
} }
else else
{ {
// NOLINTBEGIN(readability-identifier-naming)
// For WAVE channel mapping refer to: https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn653308(v=vs.85)#default-channel-ordering // For WAVE channel mapping refer to: https://learn.microsoft.com/en-us/previous-versions/windows/hardware/design/dn653308(v=vs.85)#default-channel-ordering
static constexpr auto SPEAKER_FRONT_LEFT = 0x1u; static constexpr auto speakerFrontLeft = 0x1u;
static constexpr auto SPEAKER_FRONT_RIGHT = 0x2u; static constexpr auto speakerFrontRight = 0x2u;
static constexpr auto SPEAKER_FRONT_CENTER = 0x4u; static constexpr auto speakerFrontCenter = 0x4u;
static constexpr auto SPEAKER_LOW_FREQUENCY = 0x8u; static constexpr auto speakerLowFrequency = 0x8u;
static constexpr auto SPEAKER_BACK_LEFT = 0x10u; static constexpr auto speakerBackLeft = 0x10u;
static constexpr auto SPEAKER_BACK_RIGHT = 0x20u; static constexpr auto speakerBackRight = 0x20u;
static constexpr auto SPEAKER_FRONT_LEFT_OF_CENTER = 0x40u; static constexpr auto speakerFrontLeftOfCenter = 0x40u;
static constexpr auto SPEAKER_FRONT_RIGHT_OF_CENTER = 0x80u; static constexpr auto speakerFrontRightOfCenter = 0x80u;
static constexpr auto SPEAKER_BACK_CENTER = 0x100u; static constexpr auto speakerBackCenter = 0x100u;
static constexpr auto SPEAKER_SIDE_LEFT = 0x200u; static constexpr auto speakerSideLeft = 0x200u;
static constexpr auto SPEAKER_SIDE_RIGHT = 0x400u; static constexpr auto speakerSideRight = 0x400u;
static constexpr auto SPEAKER_TOP_CENTER = 0x800u; static constexpr auto speakerTopCenter = 0x800u;
static constexpr auto SPEAKER_TOP_FRONT_LEFT = 0x1000u; static constexpr auto speakerTopFrontLeft = 0x1000u;
static constexpr auto SPEAKER_TOP_FRONT_CENTER = 0x2000u; static constexpr auto speakerTopFrontCenter = 0x2000u;
static constexpr auto SPEAKER_TOP_FRONT_RIGHT = 0x4000u; static constexpr auto speakerTopFrontRight = 0x4000u;
static constexpr auto SPEAKER_TOP_BACK_LEFT = 0x8000u; static constexpr auto speakerTopBackLeft = 0x8000u;
static constexpr auto SPEAKER_TOP_BACK_CENTER = 0x10000u; static constexpr auto speakerTopBackCenter = 0x10000u;
static constexpr auto SPEAKER_TOP_BACK_RIGHT = 0x20000u; static constexpr auto speakerTopBackRight = 0x20000u;
// NOLINTEND(readability-identifier-naming)
struct SupportedChannel struct SupportedChannel
{ {
@ -137,24 +135,24 @@ bool SoundFileWriterWav::open(const std::filesystem::path& filename,
}; };
std::vector<SupportedChannel> std::vector<SupportedChannel>
targetChannelMap{{SPEAKER_FRONT_LEFT, SoundChannel::FrontLeft}, targetChannelMap{{speakerFrontLeft, SoundChannel::FrontLeft},
{SPEAKER_FRONT_RIGHT, SoundChannel::FrontRight}, {speakerFrontRight, SoundChannel::FrontRight},
{SPEAKER_FRONT_CENTER, SoundChannel::FrontCenter}, {speakerFrontCenter, SoundChannel::FrontCenter},
{SPEAKER_LOW_FREQUENCY, SoundChannel::LowFrequencyEffects}, {speakerLowFrequency, SoundChannel::LowFrequencyEffects},
{SPEAKER_BACK_LEFT, SoundChannel::BackLeft}, {speakerBackLeft, SoundChannel::BackLeft},
{SPEAKER_BACK_RIGHT, SoundChannel::BackRight}, {speakerBackRight, SoundChannel::BackRight},
{SPEAKER_FRONT_LEFT_OF_CENTER, SoundChannel::FrontLeftOfCenter}, {speakerFrontLeftOfCenter, SoundChannel::FrontLeftOfCenter},
{SPEAKER_FRONT_RIGHT_OF_CENTER, SoundChannel::FrontRightOfCenter}, {speakerFrontRightOfCenter, SoundChannel::FrontRightOfCenter},
{SPEAKER_BACK_CENTER, SoundChannel::BackCenter}, {speakerBackCenter, SoundChannel::BackCenter},
{SPEAKER_SIDE_LEFT, SoundChannel::SideLeft}, {speakerSideLeft, SoundChannel::SideLeft},
{SPEAKER_SIDE_RIGHT, SoundChannel::SideRight}, {speakerSideRight, SoundChannel::SideRight},
{SPEAKER_TOP_CENTER, SoundChannel::TopCenter}, {speakerTopCenter, SoundChannel::TopCenter},
{SPEAKER_TOP_FRONT_LEFT, SoundChannel::TopFrontLeft}, {speakerTopFrontLeft, SoundChannel::TopFrontLeft},
{SPEAKER_TOP_FRONT_CENTER, SoundChannel::TopFrontCenter}, {speakerTopFrontCenter, SoundChannel::TopFrontCenter},
{SPEAKER_TOP_FRONT_RIGHT, SoundChannel::TopFrontRight}, {speakerTopFrontRight, SoundChannel::TopFrontRight},
{SPEAKER_TOP_BACK_LEFT, SoundChannel::TopBackLeft}, {speakerTopBackLeft, SoundChannel::TopBackLeft},
{SPEAKER_TOP_BACK_CENTER, SoundChannel::TopBackCenter}, {speakerTopBackCenter, SoundChannel::TopBackCenter},
{SPEAKER_TOP_BACK_RIGHT, SoundChannel::TopBackRight}}; {speakerTopBackRight, SoundChannel::TopBackRight}};
// Check for duplicate channel entries // Check for duplicate channel entries
{ {