diff options
author | Chris Robinson <[email protected]> | 2018-12-19 03:13:15 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-12-19 03:13:15 -0800 |
commit | b49e8985a47f384dfde0ddd04d97426e3c37f480 (patch) | |
tree | ab59376d106642348372d9f7a41621405a54211c /OpenAL32/Include | |
parent | fbd47961d54fdc9fa14e9fe9310b578bfbc84e56 (diff) |
Don't hardcode the channel count from the device ambisonic order
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alMain.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index b4fc67dd..da9b51ac 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -502,12 +502,10 @@ template<> struct DevFmtTypeTraits<DevFmtFloat> { using Type = ALfloat; }; -ALsizei BytesFromDevFmt(enum DevFmtType type); -ALsizei ChannelsFromDevFmt(enum DevFmtChannels chans, ALsizei ambiorder); -inline ALsizei FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type, ALsizei ambiorder) -{ - return ChannelsFromDevFmt(chans, ambiorder) * BytesFromDevFmt(type); -} +ALsizei BytesFromDevFmt(DevFmtType type) noexcept; +ALsizei ChannelsFromDevFmt(DevFmtChannels chans, ALsizei ambiorder) noexcept; +inline ALsizei FrameSizeFromDevFmt(DevFmtChannels chans, DevFmtType type, ALsizei ambiorder) noexcept +{ return ChannelsFromDevFmt(chans, ambiorder) * BytesFromDevFmt(type); } enum class AmbiLayout { FuMa = ALC_FUMA_SOFT, /* FuMa channel order */ @@ -810,6 +808,11 @@ struct ALCdevice_struct { ALCdevice_struct& operator=(const ALCdevice_struct&) = delete; ~ALCdevice_struct(); + ALsizei bytesFromFmt() const noexcept { return BytesFromDevFmt(FmtType); } + ALsizei channelsFromFmt() const noexcept { return ChannelsFromDevFmt(FmtChans, mAmbiOrder); } + ALsizei frameSizeFromFmt() const noexcept + { return FrameSizeFromDevFmt(FmtChans, FmtType, mAmbiOrder); } + DEF_NEWDEL(ALCdevice) }; @@ -889,8 +892,8 @@ void SetRTPriority(void); void SetDefaultChannelOrder(ALCdevice *device); void SetDefaultWFXChannelOrder(ALCdevice *device); -const ALCchar *DevFmtTypeString(DevFmtType type); -const ALCchar *DevFmtChannelsString(DevFmtChannels chans); +const ALCchar *DevFmtTypeString(DevFmtType type) noexcept; +const ALCchar *DevFmtChannelsString(DevFmtChannels chans) noexcept; inline ALint GetChannelIndex(const Channel (&names)[MAX_OUTPUT_CHANNELS], Channel chan) { |