aboutsummaryrefslogtreecommitdiffstats
path: root/al/source.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'al/source.cpp')
-rw-r--r--al/source.cpp272
1 files changed, 136 insertions, 136 deletions
diff --git a/al/source.cpp b/al/source.cpp
index 8e323445..7a739d3d 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -553,7 +553,7 @@ void InitVoice(Voice *voice, ALsource *source, ALbufferQueueItem *BufferList, AL
VoiceChange *GetVoiceChanger(ALCcontext *ctx)
{
VoiceChange *vchg{ctx->mVoiceChangeTail};
- if(vchg == ctx->mCurrentVoiceChange.load(std::memory_order_acquire)) [[unlikely]]
+ if(vchg == ctx->mCurrentVoiceChange.load(std::memory_order_acquire)) UNLIKELY
{
ctx->allocVoiceChanges();
vchg = ctx->mVoiceChangeTail;
@@ -575,7 +575,7 @@ void SendVoiceChanges(ALCcontext *ctx, VoiceChange *tail)
const bool connected{device->Connected.load(std::memory_order_acquire)};
device->waitForMix();
- if(!connected) [[unlikely]]
+ if(!connected) UNLIKELY
{
if(ctx->mStopVoicesOnDisconnect.load(std::memory_order_acquire))
{
@@ -613,7 +613,7 @@ bool SetVoiceOffset(Voice *oldvoice, const VoicePos &vpos, ALsource *source, ALC
}
++vidx;
}
- if(!newvoice) [[unlikely]]
+ if(!newvoice) UNLIKELY
{
auto &allvoices = *context->mVoices.load(std::memory_order_relaxed);
if(allvoices.size() == voicelist.size())
@@ -670,7 +670,7 @@ bool SetVoiceOffset(Voice *oldvoice, const VoicePos &vpos, ALsource *source, ALC
/* If the old voice still has a sourceID, it's still active and the change-
* over will work on the next update.
*/
- if(oldvoice->mSourceID.load(std::memory_order_acquire) != 0u) [[likely]]
+ if(oldvoice->mSourceID.load(std::memory_order_acquire) != 0u) LIKELY
return true;
/* Otherwise, if the new voice's state is not pending, the change-over
@@ -723,14 +723,14 @@ bool EnsureSources(ALCcontext *context, size_t needed)
while(needed > count)
{
- if(context->mSourceList.size() >= 1<<25) [[unlikely]]
+ if(context->mSourceList.size() >= 1<<25) UNLIKELY
return false;
context->mSourceList.emplace_back();
auto sublist = context->mSourceList.end() - 1;
sublist->FreeMask = ~0_u64;
sublist->Sources = static_cast<ALsource*>(al_calloc(alignof(ALsource), sizeof(ALsource)*64));
- if(!sublist->Sources) [[unlikely]]
+ if(!sublist->Sources) UNLIKELY
{
context->mSourceList.pop_back();
return false;
@@ -790,10 +790,10 @@ inline ALsource *LookupSource(ALCcontext *context, ALuint id) noexcept
const size_t lidx{(id-1) >> 6};
const ALuint slidx{(id-1) & 0x3f};
- if(lidx >= context->mSourceList.size()) [[unlikely]]
+ if(lidx >= context->mSourceList.size()) UNLIKELY
return nullptr;
SourceSubList &sublist{context->mSourceList[lidx]};
- if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]]
+ if(sublist.FreeMask & (1_u64 << slidx)) UNLIKELY
return nullptr;
return sublist.Sources + slidx;
}
@@ -803,10 +803,10 @@ inline ALbuffer *LookupBuffer(ALCdevice *device, ALuint id) noexcept
const size_t lidx{(id-1) >> 6};
const ALuint slidx{(id-1) & 0x3f};
- if(lidx >= device->BufferList.size()) [[unlikely]]
+ if(lidx >= device->BufferList.size()) UNLIKELY
return nullptr;
BufferSubList &sublist = device->BufferList[lidx];
- if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]]
+ if(sublist.FreeMask & (1_u64 << slidx)) UNLIKELY
return nullptr;
return sublist.Buffers + slidx;
}
@@ -816,10 +816,10 @@ inline ALfilter *LookupFilter(ALCdevice *device, ALuint id) noexcept
const size_t lidx{(id-1) >> 6};
const ALuint slidx{(id-1) & 0x3f};
- if(lidx >= device->FilterList.size()) [[unlikely]]
+ if(lidx >= device->FilterList.size()) UNLIKELY
return nullptr;
FilterSubList &sublist = device->FilterList[lidx];
- if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]]
+ if(sublist.FreeMask & (1_u64 << slidx)) UNLIKELY
return nullptr;
return sublist.Filters + slidx;
}
@@ -829,10 +829,10 @@ inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) noexcept
const size_t lidx{(id-1) >> 6};
const ALuint slidx{(id-1) & 0x3f};
- if(lidx >= context->mEffectSlotList.size()) [[unlikely]]
+ if(lidx >= context->mEffectSlotList.size()) UNLIKELY
return nullptr;
EffectSlotSubList &sublist{context->mEffectSlotList[lidx]};
- if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]]
+ if(sublist.FreeMask & (1_u64 << slidx)) UNLIKELY
return nullptr;
return sublist.EffectSlots + slidx;
}
@@ -1212,14 +1212,14 @@ auto GetCheckers(ALCcontext *const Context, const SourceProp prop, const al::spa
return std::make_pair(
[=](size_t expect) -> void
{
- if(values.size() == expect || values.size() == MaxValues) [[likely]] return;
+ if(values.size() == expect || values.size() == MaxValues) LIKELY return;
Context->setError(AL_INVALID_ENUM, "Property 0x%04x expects %zu value(s), got %zu",
prop, expect, values.size());
throw check_size_exception{};
},
[Context](bool passed) -> void
{
- if(passed) [[likely]] return;
+ if(passed) LIKELY return;
Context->setError(AL_INVALID_VALUE, "Value out of range");
throw check_value_exception{};
}
@@ -1931,7 +1931,7 @@ auto GetSizeChecker(ALCcontext *const Context, const SourceProp prop, const al::
{
return [=](size_t expect) -> void
{
- if(values.size() == expect || values.size() == MaxValues) [[likely]] return;
+ if(values.size() == expect || values.size() == MaxValues) LIKELY return;
Context->setError(AL_INVALID_ENUM, "Property 0x%04x expects %zu value(s), got %zu",
prop, expect, values.size());
throw check_size_exception{};
@@ -2506,7 +2506,7 @@ void StartSources(ALCcontext *const context, const al::span<ALsource*> srchandle
/* If the device is disconnected, and voices stop on disconnect, go right
* to stopped.
*/
- if(!device->Connected.load(std::memory_order_acquire)) [[unlikely]]
+ if(!device->Connected.load(std::memory_order_acquire)) UNLIKELY
{
if(context->mStopVoicesOnDisconnect.load(std::memory_order_acquire))
{
@@ -2532,7 +2532,7 @@ void StartSources(ALCcontext *const context, const al::span<ALsource*> srchandle
if(free_voices == srchandles.size())
break;
}
- if(srchandles.size() != free_voices) [[unlikely]]
+ if(srchandles.size() != free_voices) UNLIKELY
{
const size_t inc_amount{srchandles.size() - free_voices};
auto &allvoices = *context->mVoices.load(std::memory_order_relaxed);
@@ -2558,7 +2558,7 @@ void StartSources(ALCcontext *const context, const al::span<ALsource*> srchandle
auto BufferList = std::find_if(source->mQueue.begin(), source->mQueue.end(), find_buffer);
/* If there's nothing to play, go right to stopped. */
- if(BufferList == source->mQueue.end()) [[unlikely]]
+ if(BufferList == source->mQueue.end()) UNLIKELY
{
/* NOTE: A source without any playable buffers should not have a
* Voice since it shouldn't be in a playing or paused state. So
@@ -2664,7 +2664,7 @@ void StartSources(ALCcontext *const context, const al::span<ALsource*> srchandle
cur->mSourceID = source->id;
cur->mState = VChangeState::Play;
}
- if(tail) [[likely]]
+ if(tail) LIKELY
SendVoiceChanges(context, tail);
}
@@ -2674,11 +2674,11 @@ AL_API void AL_APIENTRY alGenSources(ALsizei n, ALuint *sources)
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
- if(n < 0) [[unlikely]]
+ if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Generating %d sources", n);
- if(n <= 0) [[unlikely]] return;
+ if(n <= 0) UNLIKELY return;
std::unique_lock<std::mutex> srclock{context->mSourceLock};
ALCdevice *device{context->mALDevice.get()};
@@ -2724,11 +2724,11 @@ AL_API void AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources)
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
- if(n < 0) [[unlikely]]
+ if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Deleting %d sources", n);
- if(n <= 0) [[unlikely]] return;
+ if(n <= 0) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
@@ -2738,7 +2738,7 @@ START_API_FUNC
const ALuint *sources_end = sources + n;
auto invsrc = std::find_if_not(sources, sources_end, validate_source);
- if(invsrc != sources_end) [[unlikely]]
+ if(invsrc != sources_end) UNLIKELY
return context->setError(AL_INVALID_NAME, "Invalid source ID %u", *invsrc);
/* All good. Delete source IDs. */
@@ -2755,7 +2755,7 @@ AL_API ALboolean AL_APIENTRY alIsSource(ALuint source)
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(context) [[likely]]
+ if(context) LIKELY
{
std::lock_guard<std::mutex> _{context->mSourceLock};
if(LookupSource(context.get(), source) != nullptr)
@@ -2770,12 +2770,12 @@ AL_API void AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value)
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else
SetSourcefv(Source, context.get(), static_cast<SourceProp>(param), {&value, 1u});
@@ -2786,12 +2786,12 @@ AL_API void AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1,
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else
{
@@ -2805,14 +2805,14 @@ AL_API void AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat *v
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!values) [[unlikely]]
+ else if(!values) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
SetSourcefv(Source, context.get(), static_cast<SourceProp>(param), {values, MaxValues});
@@ -2824,12 +2824,12 @@ AL_API void AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble valu
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else
{
@@ -2843,12 +2843,12 @@ AL_API void AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble val
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else
{
@@ -2863,14 +2863,14 @@ AL_API void AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdoub
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!values) [[unlikely]]
+ else if(!values) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
{
@@ -2888,12 +2888,12 @@ AL_API void AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value)
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else
SetSourceiv(Source, context.get(), static_cast<SourceProp>(param), {&value, 1u});
@@ -2904,12 +2904,12 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, AL
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else
{
@@ -2923,14 +2923,14 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *val
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!values) [[unlikely]]
+ else if(!values) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
SetSourceiv(Source, context.get(), static_cast<SourceProp>(param), {values, MaxValues});
@@ -2942,12 +2942,12 @@ AL_API void AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else
SetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), {&value, 1u});
@@ -2958,12 +2958,12 @@ AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOF
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else
{
@@ -2977,14 +2977,14 @@ AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALin
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mPropLock};
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!values) [[unlikely]]
+ else if(!values) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
SetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), {values, MaxValues});
@@ -2996,13 +2996,13 @@ AL_API void AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *value
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!value) [[unlikely]]
+ else if(!value) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
{
@@ -3017,13 +3017,13 @@ AL_API void AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *valu
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!(value1 && value2 && value3)) [[unlikely]]
+ else if(!(value1 && value2 && value3)) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
{
@@ -3042,13 +3042,13 @@ AL_API void AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *valu
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!values) [[unlikely]]
+ else if(!values) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
{
@@ -3068,13 +3068,13 @@ AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble *
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!value) [[unlikely]]
+ else if(!value) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
GetSourcedv(Source, context.get(), static_cast<SourceProp>(param), {value, 1u});
@@ -3085,13 +3085,13 @@ AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!(value1 && value2 && value3)) [[unlikely]]
+ else if(!(value1 && value2 && value3)) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
{
@@ -3110,13 +3110,13 @@ AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!values) [[unlikely]]
+ else if(!values) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
GetSourcedv(Source, context.get(), static_cast<SourceProp>(param), {values, MaxValues});
@@ -3128,13 +3128,13 @@ AL_API void AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value)
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!value) [[unlikely]]
+ else if(!value) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
GetSourceiv(Source, context.get(), static_cast<SourceProp>(param), {value, 1u});
@@ -3145,13 +3145,13 @@ AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!(value1 && value2 && value3)) [[unlikely]]
+ else if(!(value1 && value2 && value3)) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
{
@@ -3170,13 +3170,13 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!values) [[unlikely]]
+ else if(!values) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
GetSourceiv(Source, context.get(), static_cast<SourceProp>(param), {values, MaxValues});
@@ -3188,13 +3188,13 @@ AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64S
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!value) [[unlikely]]
+ else if(!value) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
GetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), {value, 1u});
@@ -3205,13 +3205,13 @@ AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!(value1 && value2 && value3)) [[unlikely]]
+ else if(!(value1 && value2 && value3)) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
{
@@ -3230,13 +3230,13 @@ AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
- if(!Source) [[unlikely]]
+ if(!Source) UNLIKELY
context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
- else if(!values) [[unlikely]]
+ else if(!values) UNLIKELY
context->setError(AL_INVALID_VALUE, "NULL pointer");
else
GetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), {values, MaxValues});
@@ -3248,7 +3248,7 @@ AL_API void AL_APIENTRY alSourcePlay(ALuint source)
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *srchandle{LookupSource(context.get(), source)};
@@ -3263,9 +3263,9 @@ void AL_APIENTRY alSourcePlayAtTimeSOFT(ALuint source, ALint64SOFT start_time)
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
- if(start_time < 0) [[unlikely]]
+ if(start_time < 0) UNLIKELY
return context->setError(AL_INVALID_VALUE, "Invalid time point %" PRId64, start_time);
std::lock_guard<std::mutex> _{context->mSourceLock};
@@ -3281,16 +3281,16 @@ AL_API void AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
- if(n < 0) [[unlikely]]
+ if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Playing %d sources", n);
- if(n <= 0) [[unlikely]] return;
+ if(n <= 0) UNLIKELY return;
al::vector<ALsource*> extra_sources;
std::array<ALsource*,8> source_storage;
al::span<ALsource*> srchandles;
- if(static_cast<ALuint>(n) <= source_storage.size()) [[likely]]
+ if(static_cast<ALuint>(n) <= source_storage.size()) LIKELY
srchandles = {source_storage.data(), static_cast<ALuint>(n)};
else
{
@@ -3302,7 +3302,7 @@ START_API_FUNC
for(auto &srchdl : srchandles)
{
srchdl = LookupSource(context.get(), *sources);
- if(!srchdl) [[unlikely]]
+ if(!srchdl) UNLIKELY
return context->setError(AL_INVALID_NAME, "Invalid source ID %u", *sources);
++sources;
}
@@ -3315,19 +3315,19 @@ void AL_APIENTRY alSourcePlayAtTimevSOFT(ALsizei n, const ALuint *sources, ALint
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
- if(n < 0) [[unlikely]]
+ if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Playing %d sources", n);
- if(n <= 0) [[unlikely]] return;
+ if(n <= 0) UNLIKELY return;
- if(start_time < 0) [[unlikely]]
+ if(start_time < 0) UNLIKELY
return context->setError(AL_INVALID_VALUE, "Invalid time point %" PRId64, start_time);
al::vector<ALsource*> extra_sources;
std::array<ALsource*,8> source_storage;
al::span<ALsource*> srchandles;
- if(static_cast<ALuint>(n) <= source_storage.size()) [[likely]]
+ if(static_cast<ALuint>(n) <= source_storage.size()) LIKELY
srchandles = {source_storage.data(), static_cast<ALuint>(n)};
else
{
@@ -3358,16 +3358,16 @@ AL_API void AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources)
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
- if(n < 0) [[unlikely]]
+ if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Pausing %d sources", n);
- if(n <= 0) [[unlikely]] return;
+ if(n <= 0) UNLIKELY return;
al::vector<ALsource*> extra_sources;
std::array<ALsource*,8> source_storage;
al::span<ALsource*> srchandles;
- if(static_cast<ALuint>(n) <= source_storage.size()) [[likely]]
+ if(static_cast<ALuint>(n) <= source_storage.size()) LIKELY
srchandles = {source_storage.data(), static_cast<ALuint>(n)};
else
{
@@ -3406,7 +3406,7 @@ START_API_FUNC
cur->mState = VChangeState::Pause;
}
}
- if(tail) [[likely]]
+ if(tail) LIKELY
{
SendVoiceChanges(context.get(), tail);
/* Second, now that the voice changes have been sent, because it's
@@ -3434,16 +3434,16 @@ AL_API void AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources)
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
- if(n < 0) [[unlikely]]
+ if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Stopping %d sources", n);
- if(n <= 0) [[unlikely]] return;
+ if(n <= 0) UNLIKELY return;
al::vector<ALsource*> extra_sources;
std::array<ALsource*,8> source_storage;
al::span<ALsource*> srchandles;
- if(static_cast<ALuint>(n) <= source_storage.size()) [[likely]]
+ if(static_cast<ALuint>(n) <= source_storage.size()) LIKELY
srchandles = {source_storage.data(), static_cast<ALuint>(n)};
else
{
@@ -3482,7 +3482,7 @@ START_API_FUNC
source->OffsetType = AL_NONE;
source->VoiceIdx = INVALID_VOICE_IDX;
}
- if(tail) [[likely]]
+ if(tail) LIKELY
SendVoiceChanges(context.get(), tail);
}
END_API_FUNC
@@ -3497,16 +3497,16 @@ AL_API void AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources)
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
- if(n < 0) [[unlikely]]
+ if(n < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Rewinding %d sources", n);
- if(n <= 0) [[unlikely]] return;
+ if(n <= 0) UNLIKELY return;
al::vector<ALsource*> extra_sources;
std::array<ALsource*,8> source_storage;
al::span<ALsource*> srchandles;
- if(static_cast<ALuint>(n) <= source_storage.size()) [[likely]]
+ if(static_cast<ALuint>(n) <= source_storage.size()) LIKELY
srchandles = {source_storage.data(), static_cast<ALuint>(n)};
else
{
@@ -3547,7 +3547,7 @@ START_API_FUNC
source->OffsetType = AL_NONE;
source->VoiceIdx = INVALID_VOICE_IDX;
}
- if(tail) [[likely]]
+ if(tail) LIKELY
SendVoiceChanges(context.get(), tail);
}
END_API_FUNC
@@ -3557,19 +3557,19 @@ AL_API void AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALuin
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
- if(nb < 0) [[unlikely]]
+ if(nb < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Queueing %d buffers", nb);
- if(nb <= 0) [[unlikely]] return;
+ if(nb <= 0) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *source{LookupSource(context.get(),src)};
- if(!source) [[unlikely]]
+ if(!source) UNLIKELY
return context->setError(AL_INVALID_NAME, "Invalid source ID %u", src);
/* Can't queue on a Static Source */
- if(source->SourceType == AL_STATIC) [[unlikely]]
+ if(source->SourceType == AL_STATIC) UNLIKELY
return context->setError(AL_INVALID_OPERATION, "Queueing onto static source %u", src);
/* Check for a valid Buffer, for its frequency and format */
@@ -3637,7 +3637,7 @@ START_API_FUNC
fmt_mismatch |= BufferFmt->mAmbiOrder != buffer->mAmbiOrder;
fmt_mismatch |= BufferFmt->OriginalType != buffer->OriginalType;
}
- if(fmt_mismatch) [[unlikely]]
+ if(fmt_mismatch) UNLIKELY
{
context->setError(AL_INVALID_OPERATION, "Queueing buffer with mismatched format");
@@ -3673,26 +3673,26 @@ AL_API void AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint *b
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
- if(nb < 0) [[unlikely]]
+ if(nb < 0) UNLIKELY
context->setError(AL_INVALID_VALUE, "Unqueueing %d buffers", nb);
- if(nb <= 0) [[unlikely]] return;
+ if(nb <= 0) UNLIKELY return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *source{LookupSource(context.get(),src)};
- if(!source) [[unlikely]]
+ if(!source) UNLIKELY
return context->setError(AL_INVALID_NAME, "Invalid source ID %u", src);
- if(source->SourceType != AL_STREAMING) [[unlikely]]
+ if(source->SourceType != AL_STREAMING) UNLIKELY
return context->setError(AL_INVALID_VALUE, "Unqueueing from a non-streaming source %u",
src);
- if(source->Looping) [[unlikely]]
+ if(source->Looping) UNLIKELY
return context->setError(AL_INVALID_VALUE, "Unqueueing from looping source %u", src);
/* Make sure enough buffers have been processed to unqueue. */
uint processed{0u};
- if(source->state != AL_INITIAL) [[likely]]
+ if(source->state != AL_INITIAL) LIKELY
{
VoiceBufferItem *Current{nullptr};
if(Voice *voice{GetSourceVoice(source, context.get())})
@@ -3704,7 +3704,7 @@ START_API_FUNC
++processed;
}
}
- if(processed < static_cast<ALuint>(nb)) [[unlikely]]
+ if(processed < static_cast<ALuint>(nb)) UNLIKELY
return context->setError(AL_INVALID_VALUE, "Unqueueing %d buffer%s (only %u processed)",
nb, (nb==1)?"":"s", processed);
@@ -3727,7 +3727,7 @@ AL_API void AL_APIENTRY alSourceQueueBufferLayersSOFT(ALuint, ALsizei, const ALu
START_API_FUNC
{
ContextRef context{GetContextRef()};
- if(!context) [[unlikely]] return;
+ if(!context) UNLIKELY return;
context->setError(AL_INVALID_OPERATION, "alSourceQueueBufferLayersSOFT not supported");
}