From 7cda37a67c8f147536c53f0073df9a9e61d40587 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 4 May 2023 08:03:40 -0700 Subject: Replace al::optional with std::optional --- al/source.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'al/source.cpp') diff --git a/al/source.cpp b/al/source.cpp index f51c3bca..2b0540b4 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -55,7 +56,6 @@ #include "alc/inprogext.h" #include "almalloc.h" #include "alnumeric.h" -#include "aloptional.h" #include "alspan.h" #include "atomic.h" #include "auxeffectslot.h" @@ -395,8 +395,8 @@ struct VoicePos { * using the givem offset type and offset. If the offset is out of range, * returns an empty optional. */ -al::optional GetSampleOffset(al::deque &BufferList, ALenum OffsetType, - double Offset) +std::optional GetSampleOffset(al::deque &BufferList, + ALenum OffsetType, double Offset) { /* Find the first valid Buffer in the Queue */ const ALbuffer *BufferFmt{nullptr}; @@ -406,7 +406,7 @@ al::optional GetSampleOffset(al::deque &BufferList, if(BufferFmt) break; } if(!BufferFmt) UNLIKELY - return al::nullopt; + return std::nullopt; /* Get sample frame offset */ int64_t offset{}; @@ -452,12 +452,12 @@ al::optional GetSampleOffset(al::deque &BufferList, if(offset < 0) { if(offset < std::numeric_limits::min()) - return al::nullopt; + return std::nullopt; return VoicePos{static_cast(offset), frac, &BufferList.front()}; } if(BufferFmt->mCallback) - return al::nullopt; + return std::nullopt; int64_t totalBufferLen{0}; for(auto &item : BufferList) @@ -473,7 +473,7 @@ al::optional GetSampleOffset(al::deque &BufferList, } /* Offset is out of range of the queue */ - return al::nullopt; + return std::nullopt; } @@ -798,7 +798,7 @@ inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) noexcept } -al::optional StereoModeFromEnum(ALenum mode) +std::optional StereoModeFromEnum(ALenum mode) { switch(mode) { @@ -806,7 +806,7 @@ al::optional StereoModeFromEnum(ALenum mode) case AL_SUPER_STEREO_SOFT: return SourceStereo::Enhanced; } WARN("Unsupported stereo mode: 0x%04x\n", mode); - return al::nullopt; + return std::nullopt; } ALenum EnumFromStereoMode(SourceStereo mode) { @@ -818,7 +818,7 @@ ALenum EnumFromStereoMode(SourceStereo mode) throw std::runtime_error{"Invalid SourceStereo: "+std::to_string(int(mode))}; } -al::optional SpatializeModeFromEnum(ALenum mode) +std::optional SpatializeModeFromEnum(ALenum mode) { switch(mode) { @@ -827,7 +827,7 @@ al::optional SpatializeModeFromEnum(ALenum mode) case AL_AUTO_SOFT: return SpatializeMode::Auto; } WARN("Unsupported spatialize mode: 0x%04x\n", mode); - return al::nullopt; + return std::nullopt; } ALenum EnumFromSpatializeMode(SpatializeMode mode) { @@ -840,7 +840,7 @@ ALenum EnumFromSpatializeMode(SpatializeMode mode) throw std::runtime_error{"Invalid SpatializeMode: "+std::to_string(int(mode))}; } -al::optional DirectModeFromEnum(ALenum mode) +std::optional DirectModeFromEnum(ALenum mode) { switch(mode) { @@ -849,7 +849,7 @@ al::optional DirectModeFromEnum(ALenum mode) case AL_REMIX_UNMATCHED_SOFT: return DirectMode::RemixMismatch; } WARN("Unsupported direct mode: 0x%04x\n", mode); - return al::nullopt; + return std::nullopt; } ALenum EnumFromDirectMode(DirectMode mode) { @@ -862,7 +862,7 @@ ALenum EnumFromDirectMode(DirectMode mode) throw std::runtime_error{"Invalid DirectMode: "+std::to_string(int(mode))}; } -al::optional DistanceModelFromALenum(ALenum model) +std::optional DistanceModelFromALenum(ALenum model) { switch(model) { @@ -874,7 +874,7 @@ al::optional DistanceModelFromALenum(ALenum model) case AL_EXPONENT_DISTANCE: return DistanceModel::Exponent; case AL_EXPONENT_DISTANCE_CLAMPED: return DistanceModel::ExponentClamped; } - return al::nullopt; + return std::nullopt; } ALenum ALenumFromDistanceModel(DistanceModel model) { -- cgit v1.2.3