aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/alc.cpp12
-rw-r--r--OpenAL32/Include/alMain.h19
2 files changed, 16 insertions, 15 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp
index 5de9bd49..5b6d3bb3 100644
--- a/Alc/alc.cpp
+++ b/Alc/alc.cpp
@@ -1185,7 +1185,7 @@ static void ProbeCaptureDeviceList(void)
/************************************************
* Device format information
************************************************/
-const ALCchar *DevFmtTypeString(enum DevFmtType type)
+const ALCchar *DevFmtTypeString(DevFmtType type) noexcept
{
switch(type)
{
@@ -1199,7 +1199,7 @@ const ALCchar *DevFmtTypeString(enum DevFmtType type)
}
return "(unknown type)";
}
-const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans)
+const ALCchar *DevFmtChannelsString(DevFmtChannels chans) noexcept
{
switch(chans)
{
@@ -1215,7 +1215,7 @@ const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans)
return "(unknown channels)";
}
-ALsizei BytesFromDevFmt(enum DevFmtType type)
+ALsizei BytesFromDevFmt(DevFmtType type) noexcept
{
switch(type)
{
@@ -1229,7 +1229,7 @@ ALsizei BytesFromDevFmt(enum DevFmtType type)
}
return 0;
}
-ALsizei ChannelsFromDevFmt(enum DevFmtChannels chans, ALsizei ambiorder)
+ALsizei ChannelsFromDevFmt(DevFmtChannels chans, ALsizei ambiorder) noexcept
{
switch(chans)
{
@@ -1240,9 +1240,7 @@ ALsizei ChannelsFromDevFmt(enum DevFmtChannels chans, ALsizei ambiorder)
case DevFmtX51Rear: return 6;
case DevFmtX61: return 7;
case DevFmtX71: return 8;
- case DevFmtAmbi3D: return (ambiorder >= 3) ? 16 :
- (ambiorder == 2) ? 9 :
- (ambiorder == 1) ? 4 : 1;
+ case DevFmtAmbi3D: return (ambiorder+1) * (ambiorder+1);
}
return 0;
}
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)
{