aboutsummaryrefslogtreecommitdiffstats
path: root/al
diff options
context:
space:
mode:
Diffstat (limited to 'al')
-rw-r--r--al/auxeffectslot.cpp77
-rw-r--r--al/buffer.cpp185
-rw-r--r--al/effect.cpp29
-rw-r--r--al/error.cpp19
-rw-r--r--al/error.h24
-rw-r--r--al/event.cpp7
-rw-r--r--al/extension.cpp3
-rw-r--r--al/filter.cpp81
-rw-r--r--al/listener.cpp52
-rw-r--r--al/source.cpp230
-rw-r--r--al/state.cpp57
11 files changed, 359 insertions, 405 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index 880c970d..2d10efde 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -40,7 +40,6 @@
#include "alspan.h"
#include "alu.h"
#include "effect.h"
-#include "error.h"
#include "fpu_modes.h"
#include "inprogext.h"
#include "logging.h"
@@ -164,7 +163,7 @@ ALeffectslot *AllocEffectSlot(ALCcontext *context)
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
if(context->mNumEffectSlots >= device->AuxiliaryEffectSlotMax)
{
- alSetError(context, AL_OUT_OF_MEMORY, "Exceeding %u effect slot limit",
+ context->setError(AL_OUT_OF_MEMORY, "Exceeding %u effect slot limit",
device->AuxiliaryEffectSlotMax);
return nullptr;
}
@@ -187,7 +186,7 @@ ALeffectslot *AllocEffectSlot(ALCcontext *context)
*/
if(UNLIKELY(context->mEffectSlotList.size() >= 1<<25))
{
- alSetError(context, AL_OUT_OF_MEMORY, "Too many effect slots allocated");
+ context->setError(AL_OUT_OF_MEMORY, "Too many effect slots allocated");
return nullptr;
}
context->mEffectSlotList.emplace_back();
@@ -198,7 +197,7 @@ ALeffectslot *AllocEffectSlot(ALCcontext *context)
if(UNLIKELY(!sublist->EffectSlots))
{
context->mEffectSlotList.pop_back();
- alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate effect slot batch");
+ context->setError(AL_OUT_OF_MEMORY, "Failed to allocate effect slot batch");
return nullptr;
}
@@ -211,7 +210,7 @@ ALeffectslot *AllocEffectSlot(ALCcontext *context)
if(err != AL_NO_ERROR)
{
al::destroy_at(slot);
- alSetError(context, err, "Effect slot object initialization failed");
+ context->setError(err, "Effect slot object initialization failed");
return nullptr;
}
aluInitEffectPanning(slot, device);
@@ -264,7 +263,7 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(n < 0)
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Generating %d effect slots", n);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Generating %d effect slots", n);
if(n == 0) return;
if(n == 1)
@@ -307,7 +306,7 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(n < 0)
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Deleting %d effect slots", n);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Deleting %d effect slots", n);
if(n == 0) return;
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
@@ -318,12 +317,12 @@ START_API_FUNC
ALeffectslot *slot{LookupEffectSlot(context.get(), id)};
if(!slot)
{
- alSetError(context.get(), AL_INVALID_NAME, "Invalid effect slot ID %u", id);
+ context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", id);
return true;
}
if(ReadRef(&slot->ref) != 0)
{
- alSetError(context.get(), AL_INVALID_NAME, "Deleting in-use effect slot %u", id);
+ context->setError(AL_INVALID_NAME, "Deleting in-use effect slot %u", id);
return true;
}
return false;
@@ -369,7 +368,7 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mEffectSlotLock};
ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
if(UNLIKELY(!slot))
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
ALeffectslot *target{};
ALCdevice *device{};
@@ -382,34 +381,34 @@ START_API_FUNC
{ std::lock_guard<std::mutex> ___{device->EffectLock};
ALeffect *effect{value ? LookupEffect(device, value) : nullptr};
if(!(value == 0 || effect != nullptr))
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Invalid effect ID %u", value);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid effect ID %u", value);
err = InitializeEffect(context.get(), slot, effect);
}
if(err != AL_NO_ERROR)
{
- alSetError(context.get(), err, "Effect initialization failed");
+ context->setError(err, "Effect initialization failed");
return;
}
break;
case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
if(!(value == AL_TRUE || value == AL_FALSE))
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,,
- "Effect slot auxiliary send auto out of range");
+ SETERR_RETURN(context, AL_INVALID_VALUE,,
+ "Effect slot auxiliary send auto out of range");
slot->AuxSendAuto = value;
break;
case AL_EFFECTSLOT_TARGET_SOFT:
target = (value ? LookupEffectSlot(context.get(), value) : nullptr);
if(value && !target)
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Invalid effect slot target ID");
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid effect slot target ID");
if(target)
{
ALeffectslot *checker{target};
while(checker && checker != slot)
checker = checker->Target;
if(checker)
- SETERR_RETURN(context.get(), AL_INVALID_OPERATION,,
+ SETERR_RETURN(context, AL_INVALID_OPERATION,,
"Setting target of effect slot ID %u to %u creates circular chain", slot->id,
target->id);
}
@@ -431,8 +430,8 @@ START_API_FUNC
break;
default:
- SETERR_RETURN(context.get(), AL_INVALID_ENUM,,
- "Invalid effect slot integer property 0x%04x", param);
+ SETERR_RETURN(context, AL_INVALID_ENUM,, "Invalid effect slot integer property 0x%04x",
+ param);
}
DO_UPDATEPROPS();
}
@@ -456,13 +455,13 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
if(UNLIKELY(!slot))
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
switch(param)
{
default:
- SETERR_RETURN(context.get(), AL_INVALID_ENUM,,
- "Invalid effect slot integer-vector property 0x%04x", param);
+ SETERR_RETURN(context, AL_INVALID_ENUM,,
+ "Invalid effect slot integer-vector property 0x%04x", param);
}
}
END_API_FUNC
@@ -477,19 +476,19 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mEffectSlotLock};
ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
if(UNLIKELY(!slot))
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
switch(param)
{
case AL_EFFECTSLOT_GAIN:
if(!(value >= 0.0f && value <= 1.0f))
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Effect slot gain out of range");
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Effect slot gain out of range");
slot->Gain = value;
break;
default:
- SETERR_RETURN(context.get(), AL_INVALID_ENUM,, "Invalid effect slot float property 0x%04x",
- param);
+ SETERR_RETURN(context, AL_INVALID_ENUM,, "Invalid effect slot float property 0x%04x",
+ param);
}
DO_UPDATEPROPS();
}
@@ -511,13 +510,13 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
if(UNLIKELY(!slot))
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
switch(param)
{
default:
- SETERR_RETURN(context.get(), AL_INVALID_ENUM,,
- "Invalid effect slot float-vector property 0x%04x", param);
+ SETERR_RETURN(context, AL_INVALID_ENUM,,
+ "Invalid effect slot float-vector property 0x%04x", param);
}
}
END_API_FUNC
@@ -532,7 +531,7 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
if(UNLIKELY(!slot))
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
switch(param)
{
@@ -545,8 +544,7 @@ START_API_FUNC
break;
default:
- SETERR_RETURN(context.get(), AL_INVALID_ENUM,,
- "Invalid effect slot integer property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid effect slot integer property 0x%04x", param);
}
}
END_API_FUNC
@@ -569,13 +567,13 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
if(UNLIKELY(!slot))
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
switch(param)
{
default:
- SETERR_RETURN(context.get(), AL_INVALID_ENUM,,
- "Invalid effect slot integer-vector property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid effect slot integer-vector property 0x%04x",
+ param);
}
}
END_API_FUNC
@@ -589,7 +587,7 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
if(UNLIKELY(!slot))
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
switch(param)
{
@@ -598,8 +596,7 @@ START_API_FUNC
break;
default:
- SETERR_RETURN(context.get(), AL_INVALID_ENUM,,
- "Invalid effect slot float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid effect slot float property 0x%04x", param);
}
}
END_API_FUNC
@@ -620,13 +617,13 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mEffectSlotLock};
ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot);
if(UNLIKELY(!slot))
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot);
switch(param)
{
default:
- SETERR_RETURN(context.get(), AL_INVALID_ENUM,,
- "Invalid effect slot float-vector property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid effect slot float-vector property 0x%04x",
+ param);
}
}
END_API_FUNC
diff --git a/al/buffer.cpp b/al/buffer.cpp
index d4f2d179..d6d743d0 100644
--- a/al/buffer.cpp
+++ b/al/buffer.cpp
@@ -48,7 +48,6 @@
#include "alnumeric.h"
#include "aloptional.h"
#include "atomic.h"
-#include "error.h"
#include "inprogext.h"
#include "opthelpers.h"
@@ -269,7 +268,7 @@ ALbuffer *AllocBuffer(ALCcontext *context)
*/
if(UNLIKELY(device->BufferList.size() >= 1<<25))
{
- alSetError(context, AL_OUT_OF_MEMORY, "Too many buffers allocated");
+ context->setError(AL_OUT_OF_MEMORY, "Too many buffers allocated");
return nullptr;
}
device->BufferList.emplace_back();
@@ -279,7 +278,7 @@ ALbuffer *AllocBuffer(ALCcontext *context)
if(UNLIKELY(!sublist->Buffers))
{
device->BufferList.pop_back();
- alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate buffer batch");
+ context->setError(AL_OUT_OF_MEMORY, "Failed to allocate buffer batch");
return nullptr;
}
@@ -611,7 +610,7 @@ START_API_FUNC
if(UNLIKELY(n < 0))
{
- alSetError(context.get(), AL_INVALID_VALUE, "Generating %d buffers", n);
+ context->setError(AL_INVALID_VALUE, "Generating %d buffers", n);
return;
}
@@ -651,7 +650,7 @@ START_API_FUNC
if(UNLIKELY(n < 0))
{
- alSetError(context.get(), AL_INVALID_VALUE, "Deleting %d buffers", n);
+ context->setError(AL_INVALID_VALUE, "Deleting %d buffers", n);
return;
}
if(UNLIKELY(n == 0))
@@ -669,12 +668,12 @@ START_API_FUNC
ALbuffer *ALBuf = LookupBuffer(device, bid);
if(UNLIKELY(!ALBuf))
{
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", bid);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", bid);
return true;
}
if(UNLIKELY(ReadRef(&ALBuf->ref) != 0))
{
- alSetError(context.get(), AL_INVALID_OPERATION, "Deleting in-use buffer %u", bid);
+ context->setError(AL_INVALID_OPERATION, "Deleting in-use buffer %u", bid);
return true;
}
return false;
@@ -726,22 +725,22 @@ START_API_FUNC
ALbuffer *albuf = LookupBuffer(device, buffer);
if(UNLIKELY(!albuf))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else if(UNLIKELY(size < 0))
- alSetError(context.get(), AL_INVALID_VALUE, "Negative storage size %d", size);
+ context->setError(AL_INVALID_VALUE, "Negative storage size %d", size);
else if(UNLIKELY(freq < 1))
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid sample rate %d", freq);
+ context->setError(AL_INVALID_VALUE, "Invalid sample rate %d", freq);
else if(UNLIKELY((flags&INVALID_STORAGE_MASK) != 0))
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid storage flags 0x%x",
- flags&INVALID_STORAGE_MASK);
+ context->setError(AL_INVALID_VALUE, "Invalid storage flags 0x%x",
+ flags&INVALID_STORAGE_MASK);
else if(UNLIKELY((flags&AL_MAP_PERSISTENT_BIT_SOFT) && !(flags&MAP_READ_WRITE_FLAGS)))
- alSetError(context.get(), AL_INVALID_VALUE,
- "Declaring persistently mapped storage without read or write access");
+ context->setError(AL_INVALID_VALUE,
+ "Declaring persistently mapped storage without read or write access");
else
{
auto usrfmt = DecomposeUserFormat(format);
if(UNLIKELY(!usrfmt))
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid format 0x%04x", format);
+ context->setError(AL_INVALID_ENUM, "Invalid format 0x%04x", format);
else
LoadData(context.get(), albuf, freq, size, usrfmt->channels, usrfmt->type,
static_cast<const al::byte*>(data), flags);
@@ -760,33 +759,33 @@ START_API_FUNC
ALbuffer *albuf = LookupBuffer(device, buffer);
if(UNLIKELY(!albuf))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else if(UNLIKELY((access&INVALID_MAP_FLAGS) != 0))
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid map flags 0x%x", access&INVALID_MAP_FLAGS);
+ context->setError(AL_INVALID_VALUE, "Invalid map flags 0x%x", access&INVALID_MAP_FLAGS);
else if(UNLIKELY(!(access&MAP_READ_WRITE_FLAGS)))
- alSetError(context.get(), AL_INVALID_VALUE, "Mapping buffer %u without read or write access",
- buffer);
+ context->setError(AL_INVALID_VALUE, "Mapping buffer %u without read or write access",
+ buffer);
else
{
ALbitfieldSOFT unavailable = (albuf->Access^access) & access;
if(UNLIKELY(ReadRef(&albuf->ref) != 0 && !(access&AL_MAP_PERSISTENT_BIT_SOFT)))
- alSetError(context.get(), AL_INVALID_OPERATION,
- "Mapping in-use buffer %u without persistent mapping", buffer);
+ context->setError(AL_INVALID_OPERATION,
+ "Mapping in-use buffer %u without persistent mapping", buffer);
else if(UNLIKELY(albuf->MappedAccess != 0))
- alSetError(context.get(), AL_INVALID_OPERATION, "Mapping already-mapped buffer %u", buffer);
+ context->setError(AL_INVALID_OPERATION, "Mapping already-mapped buffer %u", buffer);
else if(UNLIKELY((unavailable&AL_MAP_READ_BIT_SOFT)))
- alSetError(context.get(), AL_INVALID_VALUE,
- "Mapping buffer %u for reading without read access", buffer);
+ context->setError(AL_INVALID_VALUE,
+ "Mapping buffer %u for reading without read access", buffer);
else if(UNLIKELY((unavailable&AL_MAP_WRITE_BIT_SOFT)))
- alSetError(context.get(), AL_INVALID_VALUE,
- "Mapping buffer %u for writing without write access", buffer);
+ context->setError(AL_INVALID_VALUE,
+ "Mapping buffer %u for writing without write access", buffer);
else if(UNLIKELY((unavailable&AL_MAP_PERSISTENT_BIT_SOFT)))
- alSetError(context.get(), AL_INVALID_VALUE,
- "Mapping buffer %u persistently without persistent access", buffer);
+ context->setError(AL_INVALID_VALUE,
+ "Mapping buffer %u persistently without persistent access", buffer);
else if(UNLIKELY(offset < 0 || offset >= albuf->OriginalSize ||
length <= 0 || length > albuf->OriginalSize - offset))
- alSetError(context.get(), AL_INVALID_VALUE, "Mapping invalid range %d+%d for buffer %u",
- offset, length, buffer);
+ context->setError(AL_INVALID_VALUE, "Mapping invalid range %d+%d for buffer %u",
+ offset, length, buffer);
else
{
void *retval = albuf->mData.data() + offset;
@@ -812,9 +811,9 @@ START_API_FUNC
ALbuffer *albuf = LookupBuffer(device, buffer);
if(UNLIKELY(!albuf))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else if(albuf->MappedAccess == 0)
- alSetError(context.get(), AL_INVALID_OPERATION, "Unmapping unmapped buffer %u", buffer);
+ context->setError(AL_INVALID_OPERATION, "Unmapping unmapped buffer %u", buffer);
else
{
albuf->MappedAccess = 0;
@@ -835,15 +834,15 @@ START_API_FUNC
ALbuffer *albuf = LookupBuffer(device, buffer);
if(UNLIKELY(!albuf))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else if(UNLIKELY(!(albuf->MappedAccess&AL_MAP_WRITE_BIT_SOFT)))
- alSetError(context.get(), AL_INVALID_OPERATION,
- "Flushing buffer %u while not mapped for writing", buffer);
+ context->setError(AL_INVALID_OPERATION, "Flushing buffer %u while not mapped for writing",
+ buffer);
else if(UNLIKELY(offset < albuf->MappedOffset ||
offset >= albuf->MappedOffset+albuf->MappedSize ||
length <= 0 || length > albuf->MappedOffset+albuf->MappedSize-offset))
- alSetError(context.get(), AL_INVALID_VALUE, "Flushing invalid range %d+%d on buffer %u",
- offset, length, buffer);
+ context->setError(AL_INVALID_VALUE, "Flushing invalid range %d+%d on buffer %u", offset,
+ length, buffer);
else
{
/* FIXME: Need to use some method of double-buffering for the mixer and
@@ -868,32 +867,30 @@ START_API_FUNC
ALbuffer *albuf = LookupBuffer(device, buffer);
if(UNLIKELY(!albuf))
{
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
return;
}
auto usrfmt = DecomposeUserFormat(format);
if(UNLIKELY(!usrfmt))
{
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid format 0x%04x", format);
+ context->setError(AL_INVALID_ENUM, "Invalid format 0x%04x", format);
return;
}
ALsizei unpack_align{albuf->UnpackAlign.load()};
ALsizei align{SanitizeAlignment(usrfmt->type, unpack_align)};
if(UNLIKELY(align < 1))
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid unpack alignment %d", unpack_align);
+ context->setError(AL_INVALID_VALUE, "Invalid unpack alignment %d", unpack_align);
else if(UNLIKELY(long{usrfmt->channels} != long{albuf->mFmtChannels} ||
usrfmt->type != albuf->OriginalType))
- alSetError(context.get(), AL_INVALID_ENUM,
- "Unpacking data with mismatched format");
+ context->setError(AL_INVALID_ENUM, "Unpacking data with mismatched format");
else if(UNLIKELY(align != albuf->OriginalAlign))
- alSetError(context.get(), AL_INVALID_VALUE,
- "Unpacking data with alignment %u does not match original alignment %u",
- align, albuf->OriginalAlign);
+ context->setError(AL_INVALID_VALUE,
+ "Unpacking data with alignment %u does not match original alignment %u", align,
+ albuf->OriginalAlign);
else if(UNLIKELY(albuf->MappedAccess != 0))
- alSetError(context.get(), AL_INVALID_OPERATION, "Unpacking data into mapped buffer %u",
- buffer);
+ context->setError(AL_INVALID_OPERATION, "Unpacking data into mapped buffer %u", buffer);
else
{
ALsizei num_chans{ChannelsFromFmt(albuf->mFmtChannels)};
@@ -906,14 +903,14 @@ START_API_FUNC
if(UNLIKELY(offset < 0 || length < 0 || offset > albuf->OriginalSize ||
length > albuf->OriginalSize-offset))
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid data sub-range %d+%d on buffer %u",
- offset, length, buffer);
+ context->setError(AL_INVALID_VALUE, "Invalid data sub-range %d+%d on buffer %u",
+ offset, length, buffer);
else if(UNLIKELY((offset%byte_align) != 0))
- alSetError(context.get(), AL_INVALID_VALUE,
+ context->setError(AL_INVALID_VALUE,
"Sub-range offset %d is not a multiple of frame size %d (%d unpack alignment)",
offset, byte_align, align);
else if(UNLIKELY((length%byte_align) != 0))
- alSetError(context.get(), AL_INVALID_VALUE,
+ context->setError(AL_INVALID_VALUE,
"Sub-range length %d is not a multiple of frame size %d (%d unpack alignment)",
length, byte_align, align);
else
@@ -948,7 +945,7 @@ START_API_FUNC
ContextRef context{GetContextRef()};
if(UNLIKELY(!context)) return;
- alSetError(context.get(), AL_INVALID_OPERATION, "alBufferSamplesSOFT not supported");
+ context->setError(AL_INVALID_OPERATION, "alBufferSamplesSOFT not supported");
}
END_API_FUNC
@@ -959,7 +956,7 @@ START_API_FUNC
ContextRef context{GetContextRef()};
if(UNLIKELY(!context)) return;
- alSetError(context.get(), AL_INVALID_OPERATION, "alBufferSubSamplesSOFT not supported");
+ context->setError(AL_INVALID_OPERATION, "alBufferSubSamplesSOFT not supported");
}
END_API_FUNC
@@ -970,7 +967,7 @@ START_API_FUNC
ContextRef context{GetContextRef()};
if(UNLIKELY(!context)) return;
- alSetError(context.get(), AL_INVALID_OPERATION, "alGetBufferSamplesSOFT not supported");
+ context->setError(AL_INVALID_OPERATION, "alGetBufferSamplesSOFT not supported");
}
END_API_FUNC
@@ -980,7 +977,7 @@ START_API_FUNC
ContextRef context{GetContextRef()};
if(!context) return AL_FALSE;
- alSetError(context.get(), AL_INVALID_OPERATION, "alIsBufferFormatSupportedSOFT not supported");
+ context->setError(AL_INVALID_OPERATION, "alIsBufferFormatSupportedSOFT not supported");
return AL_FALSE;
}
END_API_FUNC
@@ -996,11 +993,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{device->BufferLock};
if(UNLIKELY(LookupBuffer(device, buffer) == nullptr))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else switch(param)
{
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid buffer float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid buffer float property 0x%04x", param);
}
}
END_API_FUNC
@@ -1016,11 +1013,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{device->BufferLock};
if(UNLIKELY(LookupBuffer(device, buffer) == nullptr))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else switch(param)
{
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid buffer 3-float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid buffer 3-float property 0x%04x", param);
}
}
END_API_FUNC
@@ -1035,13 +1032,13 @@ START_API_FUNC
std::lock_guard<std::mutex> _{device->BufferLock};
if(UNLIKELY(LookupBuffer(device, buffer) == nullptr))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else if(UNLIKELY(!values))
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid buffer float-vector property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid buffer float-vector property 0x%04x", param);
}
}
END_API_FUNC
@@ -1058,25 +1055,25 @@ START_API_FUNC
ALbuffer *albuf = LookupBuffer(device, buffer);
if(UNLIKELY(!albuf))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else switch(param)
{
case AL_UNPACK_BLOCK_ALIGNMENT_SOFT:
if(UNLIKELY(value < 0))
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid unpack block alignment %d", value);
+ context->setError(AL_INVALID_VALUE, "Invalid unpack block alignment %d", value);
else
albuf->UnpackAlign.store(value);
break;
case AL_PACK_BLOCK_ALIGNMENT_SOFT:
if(UNLIKELY(value < 0))
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid pack block alignment %d", value);
+ context->setError(AL_INVALID_VALUE, "Invalid pack block alignment %d", value);
else
albuf->PackAlign.store(value);
break;
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid buffer integer property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid buffer integer property 0x%04x", param);
}
}
END_API_FUNC
@@ -1092,11 +1089,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{device->BufferLock};
if(UNLIKELY(LookupBuffer(device, buffer) == nullptr))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else switch(param)
{
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid buffer 3-integer property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid buffer 3-integer property 0x%04x", param);
}
}
END_API_FUNC
@@ -1123,18 +1120,18 @@ START_API_FUNC
ALbuffer *albuf = LookupBuffer(device, buffer);
if(UNLIKELY(!albuf))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else if(UNLIKELY(!values))
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
case AL_LOOP_POINTS_SOFT:
if(UNLIKELY(ReadRef(&albuf->ref) != 0))
- alSetError(context.get(), AL_INVALID_OPERATION, "Modifying in-use buffer %u's loop points",
- buffer);
+ context->setError(AL_INVALID_OPERATION, "Modifying in-use buffer %u's loop points",
+ buffer);
else if(UNLIKELY(values[0] >= values[1] || values[0] < 0 || values[1] > albuf->SampleLen))
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid loop point range %d -> %d o buffer %u",
- values[0], values[1], buffer);
+ context->setError(AL_INVALID_VALUE, "Invalid loop point range %d -> %d on buffer %u",
+ values[0], values[1], buffer);
else
{
albuf->LoopStart = values[0];
@@ -1143,8 +1140,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid buffer integer-vector property 0x%04x",
- param);
+ context->setError(AL_INVALID_ENUM, "Invalid buffer integer-vector property 0x%04x", param);
}
}
END_API_FUNC
@@ -1161,13 +1157,13 @@ START_API_FUNC
ALbuffer *albuf = LookupBuffer(device, buffer);
if(UNLIKELY(!albuf))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else if(UNLIKELY(!value))
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid buffer float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid buffer float property 0x%04x", param);
}
}
END_API_FUNC
@@ -1182,13 +1178,13 @@ START_API_FUNC
std::lock_guard<std::mutex> _{device->BufferLock};
if(UNLIKELY(LookupBuffer(device, buffer) == nullptr))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else if(UNLIKELY(!value1 || !value2 || !value3))
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid buffer 3-float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid buffer 3-float property 0x%04x", param);
}
}
END_API_FUNC
@@ -1210,13 +1206,13 @@ START_API_FUNC
std::lock_guard<std::mutex> _{device->BufferLock};
if(UNLIKELY(LookupBuffer(device, buffer) == nullptr))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else if(UNLIKELY(!values))
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid buffer float-vector property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid buffer float-vector property 0x%04x", param);
}
}
END_API_FUNC
@@ -1232,9 +1228,9 @@ START_API_FUNC
std::lock_guard<std::mutex> _{device->BufferLock};
ALbuffer *albuf = LookupBuffer(device, buffer);
if(UNLIKELY(!albuf))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else if(UNLIKELY(!value))
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
case AL_FREQUENCY:
@@ -1262,7 +1258,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid buffer integer property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid buffer integer property 0x%04x", param);
}
}
END_API_FUNC
@@ -1276,13 +1272,13 @@ START_API_FUNC
ALCdevice *device = context->mDevice;
std::lock_guard<std::mutex> _{device->BufferLock};
if(UNLIKELY(LookupBuffer(device, buffer) == nullptr))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else if(UNLIKELY(!value1 || !value2 || !value3))
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid buffer 3-integer property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid buffer 3-integer property 0x%04x", param);
}
}
END_API_FUNC
@@ -1312,9 +1308,9 @@ START_API_FUNC
std::lock_guard<std::mutex> _{device->BufferLock};
ALbuffer *albuf = LookupBuffer(device, buffer);
if(UNLIKELY(!albuf))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
+ context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer);
else if(UNLIKELY(!values))
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
case AL_LOOP_POINTS_SOFT:
@@ -1323,8 +1319,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid buffer integer-vector property 0x%04x",
- param);
+ context->setError(AL_INVALID_ENUM, "Invalid buffer integer-vector property 0x%04x", param);
}
}
END_API_FUNC
diff --git a/al/effect.cpp b/al/effect.cpp
index b6291129..2d72916e 100644
--- a/al/effect.cpp
+++ b/al/effect.cpp
@@ -43,7 +43,6 @@
#include "almalloc.h"
#include "alnumeric.h"
#include "effects/base.h"
-#include "error.h"
#include "logging.h"
#include "opthelpers.h"
#include "vector.h"
@@ -161,7 +160,7 @@ ALeffect *AllocEffect(ALCcontext *context)
*/
if(UNLIKELY(device->EffectList.size() >= 1<<25))
{
- alSetError(context, AL_OUT_OF_MEMORY, "Too many effects allocated");
+ context->setError(AL_OUT_OF_MEMORY, "Too many effects allocated");
return nullptr;
}
device->EffectList.emplace_back();
@@ -171,7 +170,7 @@ ALeffect *AllocEffect(ALCcontext *context)
if(UNLIKELY(!sublist->Effects))
{
device->EffectList.pop_back();
- alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate effect batch");
+ context->setError(AL_OUT_OF_MEMORY, "Failed to allocate effect batch");
return nullptr;
}
@@ -224,7 +223,7 @@ START_API_FUNC
if(UNLIKELY(n < 0))
{
- alSetError(context.get(), AL_INVALID_VALUE, "Generating %d effects", n);
+ context->setError(AL_INVALID_VALUE, "Generating %d effects", n);
return;
}
@@ -264,7 +263,7 @@ START_API_FUNC
if(UNLIKELY(n < 0))
{
- alSetError(context.get(), AL_INVALID_VALUE, "Deleting %d effects", n);
+ context->setError(AL_INVALID_VALUE, "Deleting %d effects", n);
return;
}
if(UNLIKELY(n == 0))
@@ -282,7 +281,7 @@ START_API_FUNC
ALeffect *effect{LookupEffect(device, eid)};
if(UNLIKELY(!effect))
{
- alSetError(context.get(), AL_INVALID_NAME, "Invalid effect ID %u", eid);
+ context->setError(AL_INVALID_NAME, "Invalid effect ID %u", eid);
return true;
}
return false;
@@ -328,7 +327,7 @@ START_API_FUNC
ALeffect *aleffect{LookupEffect(device, effect)};
if(UNLIKELY(!aleffect))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid effect ID %u", effect);
+ context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
if(param == AL_EFFECT_TYPE)
@@ -349,7 +348,7 @@ START_API_FUNC
if(isOk)
InitEffectParams(aleffect, value);
else
- alSetError(context.get(), AL_INVALID_VALUE, "Effect type 0x%04x not supported", value);
+ context->setError(AL_INVALID_VALUE, "Effect type 0x%04x not supported", value);
}
else
{
@@ -378,7 +377,7 @@ START_API_FUNC
ALeffect *aleffect{LookupEffect(device, effect)};
if(UNLIKELY(!aleffect))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid effect ID %u", effect);
+ context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
/* Call the appropriate handler */
@@ -398,7 +397,7 @@ START_API_FUNC
ALeffect *aleffect{LookupEffect(device, effect)};
if(UNLIKELY(!aleffect))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid effect ID %u", effect);
+ context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
/* Call the appropriate handler */
@@ -418,7 +417,7 @@ START_API_FUNC
ALeffect *aleffect{LookupEffect(device, effect)};
if(UNLIKELY(!aleffect))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid effect ID %u", effect);
+ context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
/* Call the appropriate handler */
@@ -438,7 +437,7 @@ START_API_FUNC
const ALeffect *aleffect{LookupEffect(device, effect)};
if(UNLIKELY(!aleffect))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid effect ID %u", effect);
+ context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
if(param == AL_EFFECT_TYPE)
@@ -470,7 +469,7 @@ START_API_FUNC
const ALeffect *aleffect{LookupEffect(device, effect)};
if(UNLIKELY(!aleffect))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid effect ID %u", effect);
+ context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
/* Call the appropriate handler */
@@ -490,7 +489,7 @@ START_API_FUNC
const ALeffect *aleffect{LookupEffect(device, effect)};
if(UNLIKELY(!aleffect))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid effect ID %u", effect);
+ context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
/* Call the appropriate handler */
@@ -510,7 +509,7 @@ START_API_FUNC
const ALeffect *aleffect{LookupEffect(device, effect)};
if(UNLIKELY(!aleffect))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid effect ID %u", effect);
+ context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
/* Call the appropriate handler */
diff --git a/al/error.cpp b/al/error.cpp
index f5ec9f52..8bd78fe2 100644
--- a/al/error.cpp
+++ b/al/error.cpp
@@ -20,8 +20,6 @@
#include "config.h"
-#include "error.h"
-
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -49,7 +47,7 @@
bool TrapALError{false};
-void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...)
+void ALCcontext::setError(ALenum errorCode, const char *msg, ...)
{
auto message = al::vector<char>(256);
@@ -69,7 +67,7 @@ void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...)
else msg = "<internal error constructing message>";
msglen = static_cast<int>(strlen(msg));
- WARN("Error generated on context %p, code 0x%04x, \"%s\"\n", context, errorCode, msg);
+ WARN("Error generated on context %p, code 0x%04x, \"%s\"\n", this, errorCode, msg);
if(TrapALError)
{
#ifdef _WIN32
@@ -82,14 +80,13 @@ void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...)
}
ALenum curerr{AL_NO_ERROR};
- context->mLastError.compare_exchange_strong(curerr, errorCode);
- if((context->mEnabledEvts.load(std::memory_order_relaxed)&EventType_Error))
+ mLastError.compare_exchange_strong(curerr, errorCode);
+ if((mEnabledEvts.load(std::memory_order_relaxed)&EventType_Error))
{
- std::lock_guard<std::mutex> _{context->mEventCbLock};
- ALbitfieldSOFT enabledevts{context->mEnabledEvts.load(std::memory_order_relaxed)};
- if((enabledevts&EventType_Error) && context->mEventCb)
- (*context->mEventCb)(AL_EVENT_TYPE_ERROR_SOFT, 0, errorCode, msglen, msg,
- context->mEventParam);
+ std::lock_guard<std::mutex> _{mEventCbLock};
+ ALbitfieldSOFT enabledevts{mEnabledEvts.load(std::memory_order_relaxed)};
+ if((enabledevts&EventType_Error) && mEventCb)
+ (*mEventCb)(AL_EVENT_TYPE_ERROR_SOFT, 0, errorCode, msglen, msg, mEventParam);
}
}
diff --git a/al/error.h b/al/error.h
deleted file mode 100644
index 6408b60c..00000000
--- a/al/error.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef AL_ERROR_H
-#define AL_ERROR_H
-
-#include "AL/al.h"
-#include "AL/alc.h"
-
-#include "logging.h"
-
-
-extern bool TrapALError;
-
-void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...) DECL_FORMAT(printf, 3, 4);
-
-#define SETERR_GOTO(ctx, err, lbl, ...) do { \
- alSetError((ctx), (err), __VA_ARGS__); \
- goto lbl; \
-} while(0)
-
-#define SETERR_RETURN(ctx, err, retval, ...) do { \
- alSetError((ctx), (err), __VA_ARGS__); \
- return retval; \
-} while(0)
-
-#endif
diff --git a/al/event.cpp b/al/event.cpp
index b2710561..0d41e713 100644
--- a/al/event.cpp
+++ b/al/event.cpp
@@ -21,7 +21,6 @@
#include "alexcpt.h"
#include "almalloc.h"
#include "effects/base.h"
-#include "error.h"
#include "inprogext.h"
#include "logging.h"
#include "opthelpers.h"
@@ -145,9 +144,9 @@ START_API_FUNC
ContextRef context{GetContextRef()};
if(UNLIKELY(!context)) return;
- if(count < 0) SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Controlling %d events", count);
+ if(count < 0) SETERR_RETURN(context, AL_INVALID_VALUE,, "Controlling %d events", count);
if(count == 0) return;
- if(!types) SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "NULL pointer");
+ if(!types) SETERR_RETURN(context, AL_INVALID_VALUE,, "NULL pointer");
ALbitfieldSOFT flags{0};
const ALenum *types_end = types+count;
@@ -172,7 +171,7 @@ START_API_FUNC
}
);
if(bad_type != types_end)
- SETERR_RETURN(context.get(), AL_INVALID_ENUM,, "Invalid event type 0x%04x", *bad_type);
+ SETERR_RETURN(context, AL_INVALID_ENUM,, "Invalid event type 0x%04x", *bad_type);
if(enable)
{
diff --git a/al/extension.cpp b/al/extension.cpp
index c190ad03..1b36e3db 100644
--- a/al/extension.cpp
+++ b/al/extension.cpp
@@ -29,7 +29,6 @@
#include "alcontext.h"
#include "alexcpt.h"
-#include "error.h"
#include "opthelpers.h"
@@ -40,7 +39,7 @@ START_API_FUNC
if(UNLIKELY(!context)) return AL_FALSE;
if(!extName)
- SETERR_RETURN(context.get(), AL_INVALID_VALUE, AL_FALSE, "NULL pointer");
+ SETERR_RETURN(context, AL_INVALID_VALUE, AL_FALSE, "NULL pointer");
size_t len{strlen(extName)};
const char *ptr{context->mExtensionList};
diff --git a/al/filter.cpp b/al/filter.cpp
index d9fce069..5009daae 100644
--- a/al/filter.cpp
+++ b/al/filter.cpp
@@ -36,7 +36,6 @@
#include "alexcpt.h"
#include "almalloc.h"
#include "alnumeric.h"
-#include "error.h"
#include "opthelpers.h"
#include "vector.h"
@@ -47,9 +46,9 @@ namespace {
#define FILTER_MAX_GAIN 4.0f /* +12dB */
void ALlowpass_setParami(ALfilter*, ALCcontext *context, ALenum param, ALint)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid low-pass integer property 0x%04x", param); }
void ALlowpass_setParamiv(ALfilter*, ALCcontext *context, ALenum param, const ALint*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer-vector property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid low-pass integer-vector property 0x%04x", param); }
void ALlowpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val)
{
switch(param)
@@ -67,16 +66,16 @@ void ALlowpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, AL
break;
default:
- alSetError(context, AL_INVALID_ENUM, "Invalid low-pass float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid low-pass float property 0x%04x", param);
}
}
void ALlowpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals)
{ ALlowpass_setParamf(filter, context, param, vals[0]); }
void ALlowpass_getParami(ALfilter*, ALCcontext *context, ALenum param, ALint*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid low-pass integer property 0x%04x", param); }
void ALlowpass_getParamiv(ALfilter*, ALCcontext *context, ALenum param, ALint*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer-vector property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid low-pass integer-vector property 0x%04x", param); }
void ALlowpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val)
{
switch(param)
@@ -90,7 +89,7 @@ void ALlowpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, AL
break;
default:
- alSetError(context, AL_INVALID_ENUM, "Invalid low-pass float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid low-pass float property 0x%04x", param);
}
}
void ALlowpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals)
@@ -100,9 +99,9 @@ DEFINE_ALFILTER_VTABLE(ALlowpass);
void ALhighpass_setParami(ALfilter*, ALCcontext *context, ALenum param, ALint)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid high-pass integer property 0x%04x", param); }
void ALhighpass_setParamiv(ALfilter*, ALCcontext *context, ALenum param, const ALint*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer-vector property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid high-pass integer-vector property 0x%04x", param); }
void ALhighpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val)
{
switch(param)
@@ -120,16 +119,16 @@ void ALhighpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, A
break;
default:
- alSetError(context, AL_INVALID_ENUM, "Invalid high-pass float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid high-pass float property 0x%04x", param);
}
}
void ALhighpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals)
{ ALhighpass_setParamf(filter, context, param, vals[0]); }
void ALhighpass_getParami(ALfilter*, ALCcontext *context, ALenum param, ALint*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid high-pass integer property 0x%04x", param); }
void ALhighpass_getParamiv(ALfilter*, ALCcontext *context, ALenum param, ALint*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer-vector property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid high-pass integer-vector property 0x%04x", param); }
void ALhighpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val)
{
switch(param)
@@ -143,7 +142,7 @@ void ALhighpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, A
break;
default:
- alSetError(context, AL_INVALID_ENUM, "Invalid high-pass float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid high-pass float property 0x%04x", param);
}
}
void ALhighpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals)
@@ -153,9 +152,9 @@ DEFINE_ALFILTER_VTABLE(ALhighpass);
void ALbandpass_setParami(ALfilter*, ALCcontext *context, ALenum param, ALint)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid band-pass integer property 0x%04x", param); }
void ALbandpass_setParamiv(ALfilter*, ALCcontext *context, ALenum param, const ALint*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer-vector property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid band-pass integer-vector property 0x%04x", param); }
void ALbandpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val)
{
switch(param)
@@ -179,16 +178,16 @@ void ALbandpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, A
break;
default:
- alSetError(context, AL_INVALID_ENUM, "Invalid band-pass float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid band-pass float property 0x%04x", param);
}
}
void ALbandpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals)
{ ALbandpass_setParamf(filter, context, param, vals[0]); }
void ALbandpass_getParami(ALfilter*, ALCcontext *context, ALenum param, ALint*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid band-pass integer property 0x%04x", param); }
void ALbandpass_getParamiv(ALfilter*, ALCcontext *context, ALenum param, ALint*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer-vector property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid band-pass integer-vector property 0x%04x", param); }
void ALbandpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val)
{
switch(param)
@@ -206,7 +205,7 @@ void ALbandpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, A
break;
default:
- alSetError(context, AL_INVALID_ENUM, "Invalid band-pass float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid band-pass float property 0x%04x", param);
}
}
void ALbandpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals)
@@ -216,22 +215,22 @@ DEFINE_ALFILTER_VTABLE(ALbandpass);
void ALnullfilter_setParami(ALfilter*, ALCcontext *context, ALenum param, ALint)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
void ALnullfilter_setParamiv(ALfilter*, ALCcontext *context, ALenum param, const ALint*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
void ALnullfilter_setParamf(ALfilter*, ALCcontext *context, ALenum param, ALfloat)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
void ALnullfilter_setParamfv(ALfilter*, ALCcontext *context, ALenum param, const ALfloat*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
void ALnullfilter_getParami(ALfilter*, ALCcontext *context, ALenum param, ALint*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
void ALnullfilter_getParamiv(ALfilter*, ALCcontext *context, ALenum param, ALint*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
void ALnullfilter_getParamf(ALfilter*, ALCcontext *context, ALenum param, ALfloat*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
void ALnullfilter_getParamfv(ALfilter*, ALCcontext *context, ALenum param, ALfloat*)
-{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+{ context->setError(AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
DEFINE_ALFILTER_VTABLE(ALnullfilter);
@@ -301,7 +300,7 @@ ALfilter *AllocFilter(ALCcontext *context)
*/
if(UNLIKELY(device->FilterList.size() >= 1<<25))
{
- alSetError(context, AL_OUT_OF_MEMORY, "Too many filters allocated");
+ context->setError(AL_OUT_OF_MEMORY, "Too many filters allocated");
return nullptr;
}
device->FilterList.emplace_back();
@@ -311,7 +310,7 @@ ALfilter *AllocFilter(ALCcontext *context)
if(UNLIKELY(!sublist->Filters))
{
device->FilterList.pop_back();
- alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate filter batch");
+ context->setError(AL_OUT_OF_MEMORY, "Failed to allocate filter batch");
return nullptr;
}
@@ -365,7 +364,7 @@ START_API_FUNC
if(UNLIKELY(n < 0))
{
- alSetError(context.get(), AL_INVALID_VALUE, "Generating %d filters", n);
+ context->setError(AL_INVALID_VALUE, "Generating %d filters", n);
return;
}
@@ -405,7 +404,7 @@ START_API_FUNC
if(UNLIKELY(n < 0))
{
- alSetError(context.get(), AL_INVALID_VALUE, "Deleting %d filters", n);
+ context->setError(AL_INVALID_VALUE, "Deleting %d filters", n);
return;
}
if(UNLIKELY(n == 0))
@@ -423,7 +422,7 @@ START_API_FUNC
ALfilter *filter{LookupFilter(device, fid)};
if(UNLIKELY(!filter))
{
- alSetError(context.get(), AL_INVALID_NAME, "Invalid filter ID %u", fid);
+ context->setError(AL_INVALID_NAME, "Invalid filter ID %u", fid);
return true;
}
return false;
@@ -470,7 +469,7 @@ START_API_FUNC
ALfilter *alfilt{LookupFilter(device, filter)};
if(UNLIKELY(!alfilt))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid filter ID %u", filter);
+ context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
if(param == AL_FILTER_TYPE)
@@ -479,7 +478,7 @@ START_API_FUNC
value == AL_FILTER_HIGHPASS || value == AL_FILTER_BANDPASS)
InitFilterParams(alfilt, value);
else
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid filter type 0x%04x", value);
+ context->setError(AL_INVALID_VALUE, "Invalid filter type 0x%04x", value);
}
else
{
@@ -508,7 +507,7 @@ START_API_FUNC
ALfilter *alfilt{LookupFilter(device, filter)};
if(UNLIKELY(!alfilt))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid filter ID %u", filter);
+ context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
/* Call the appropriate handler */
@@ -528,7 +527,7 @@ START_API_FUNC
ALfilter *alfilt{LookupFilter(device, filter)};
if(UNLIKELY(!alfilt))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid filter ID %u", filter);
+ context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
/* Call the appropriate handler */
@@ -548,7 +547,7 @@ START_API_FUNC
ALfilter *alfilt{LookupFilter(device, filter)};
if(UNLIKELY(!alfilt))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid filter ID %u", filter);
+ context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
/* Call the appropriate handler */
@@ -568,7 +567,7 @@ START_API_FUNC
ALfilter *alfilt{LookupFilter(device, filter)};
if(UNLIKELY(!alfilt))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid filter ID %u", filter);
+ context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
if(param == AL_FILTER_TYPE)
@@ -600,7 +599,7 @@ START_API_FUNC
ALfilter *alfilt{LookupFilter(device, filter)};
if(UNLIKELY(!alfilt))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid filter ID %u", filter);
+ context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
/* Call the appropriate handler */
@@ -620,7 +619,7 @@ START_API_FUNC
ALfilter *alfilt{LookupFilter(device, filter)};
if(UNLIKELY(!alfilt))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid filter ID %u", filter);
+ context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
/* Call the appropriate handler */
@@ -640,7 +639,7 @@ START_API_FUNC
ALfilter *alfilt{LookupFilter(device, filter)};
if(UNLIKELY(!alfilt))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid filter ID %u", filter);
+ context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
/* Call the appropriate handler */
diff --git a/al/listener.cpp b/al/listener.cpp
index ba0a7268..3a1f32a4 100644
--- a/al/listener.cpp
+++ b/al/listener.cpp
@@ -31,7 +31,6 @@
#include "alexcpt.h"
#include "almalloc.h"
#include "atomic.h"
-#include "error.h"
#include "opthelpers.h"
@@ -55,15 +54,14 @@ START_API_FUNC
{
case AL_GAIN:
if(!(value >= 0.0f && std::isfinite(value)))
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Listener gain out of range");
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Listener gain out of range");
listener.Gain = value;
DO_UPDATEPROPS();
break;
case AL_METERS_PER_UNIT:
if(!(value >= AL_MIN_METERS_PER_UNIT && value <= AL_MAX_METERS_PER_UNIT))
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,,
- "Listener meters per unit out of range");
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Listener meters per unit out of range");
context->mMetersPerUnit = value;
if(!context->mDeferUpdates.load(std::memory_order_acquire))
UpdateContextProps(context.get());
@@ -72,7 +70,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid listener float property");
+ context->setError(AL_INVALID_ENUM, "Invalid listener float property");
}
}
END_API_FUNC
@@ -89,7 +87,7 @@ START_API_FUNC
{
case AL_POSITION:
if(!(std::isfinite(value1) && std::isfinite(value2) && std::isfinite(value3)))
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Listener position out of range");
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Listener position out of range");
listener.Position[0] = value1;
listener.Position[1] = value2;
listener.Position[2] = value3;
@@ -98,7 +96,7 @@ START_API_FUNC
case AL_VELOCITY:
if(!(std::isfinite(value1) && std::isfinite(value2) && std::isfinite(value3)))
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Listener velocity out of range");
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Listener velocity out of range");
listener.Velocity[0] = value1;
listener.Velocity[1] = value2;
listener.Velocity[2] = value3;
@@ -106,7 +104,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid listener 3-float property");
+ context->setError(AL_INVALID_ENUM, "Invalid listener 3-float property");
}
}
END_API_FUNC
@@ -135,13 +133,13 @@ START_API_FUNC
ALlistener &listener = context->mListener;
std::lock_guard<std::mutex> _{context->mPropLock};
- if(!values) SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "NULL pointer");
+ if(!values) SETERR_RETURN(context, AL_INVALID_VALUE,, "NULL pointer");
switch(param)
{
case AL_ORIENTATION:
if(!(std::isfinite(values[0]) && std::isfinite(values[1]) && std::isfinite(values[2]) &&
std::isfinite(values[3]) && std::isfinite(values[4]) && std::isfinite(values[5])))
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Listener orientation out of range");
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Listener orientation out of range");
/* AT then UP */
listener.OrientAt[0] = values[0];
listener.OrientAt[1] = values[1];
@@ -153,7 +151,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid listener float-vector property");
+ context->setError(AL_INVALID_ENUM, "Invalid listener float-vector property");
}
}
END_API_FUNC
@@ -169,7 +167,7 @@ START_API_FUNC
switch(param)
{
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid listener integer property");
+ context->setError(AL_INVALID_ENUM, "Invalid listener integer property");
}
}
END_API_FUNC
@@ -192,7 +190,7 @@ START_API_FUNC
switch(param)
{
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid listener 3-integer property");
+ context->setError(AL_INVALID_ENUM, "Invalid listener 3-integer property");
}
}
END_API_FUNC
@@ -227,11 +225,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mPropLock};
if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid listener integer-vector property");
+ context->setError(AL_INVALID_ENUM, "Invalid listener integer-vector property");
}
}
END_API_FUNC
@@ -246,7 +244,7 @@ START_API_FUNC
ALlistener &listener = context->mListener;
std::lock_guard<std::mutex> _{context->mPropLock};
if(!value)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
case AL_GAIN:
@@ -258,7 +256,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid listener float property");
+ context->setError(AL_INVALID_ENUM, "Invalid listener float property");
}
}
END_API_FUNC
@@ -272,7 +270,7 @@ START_API_FUNC
ALlistener &listener = context->mListener;
std::lock_guard<std::mutex> _{context->mPropLock};
if(!value1 || !value2 || !value3)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
case AL_POSITION:
@@ -288,7 +286,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid listener 3-float property");
+ context->setError(AL_INVALID_ENUM, "Invalid listener 3-float property");
}
}
END_API_FUNC
@@ -315,7 +313,7 @@ START_API_FUNC
ALlistener &listener = context->mListener;
std::lock_guard<std::mutex> _{context->mPropLock};
if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
case AL_ORIENTATION:
@@ -329,7 +327,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid listener float-vector property");
+ context->setError(AL_INVALID_ENUM, "Invalid listener float-vector property");
}
}
END_API_FUNC
@@ -343,11 +341,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mPropLock};
if(!value)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid listener integer property");
+ context->setError(AL_INVALID_ENUM, "Invalid listener integer property");
}
}
END_API_FUNC
@@ -361,7 +359,7 @@ START_API_FUNC
ALlistener &listener = context->mListener;
std::lock_guard<std::mutex> _{context->mPropLock};
if(!value1 || !value2 || !value3)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
case AL_POSITION:
@@ -377,7 +375,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid listener 3-integer property");
+ context->setError(AL_INVALID_ENUM, "Invalid listener 3-integer property");
}
}
END_API_FUNC
@@ -399,7 +397,7 @@ START_API_FUNC
ALlistener &listener = context->mListener;
std::lock_guard<std::mutex> _{context->mPropLock};
if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(param)
{
case AL_ORIENTATION:
@@ -413,7 +411,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid listener integer-vector property");
+ context->setError(AL_INVALID_ENUM, "Invalid listener integer-vector property");
}
}
END_API_FUNC
diff --git a/al/source.cpp b/al/source.cpp
index 35d3bb84..ab509804 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -57,7 +57,6 @@
#include "backends/base.h"
#include "bformatdec.h"
#include "buffer.h"
-#include "error.h"
#include "event.h"
#include "filter.h"
#include "filters/nfc.h"
@@ -488,7 +487,7 @@ ALsource *AllocSource(ALCcontext *context)
std::lock_guard<std::mutex> _{context->mSourceLock};
if(context->mNumSources >= device->SourcesMax)
{
- alSetError(context, AL_OUT_OF_MEMORY, "Exceeding %u source limit", device->SourcesMax);
+ context->setError(AL_OUT_OF_MEMORY, "Exceeding %u source limit", device->SourcesMax);
return nullptr;
}
auto sublist = std::find_if(context->mSourceList.begin(), context->mSourceList.end(),
@@ -510,7 +509,7 @@ ALsource *AllocSource(ALCcontext *context)
*/
if(UNLIKELY(context->mSourceList.size() >= 1<<25))
{
- alSetError(context, AL_OUT_OF_MEMORY, "Too many sources allocated");
+ context->setError(AL_OUT_OF_MEMORY, "Too many sources allocated");
return nullptr;
}
context->mSourceList.emplace_back();
@@ -521,7 +520,7 @@ ALsource *AllocSource(ALCcontext *context)
if(UNLIKELY(!sublist->Sources))
{
context->mSourceList.pop_back();
- alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate source batch");
+ context->setError(AL_OUT_OF_MEMORY, "Failed to allocate source batch");
return nullptr;
}
@@ -993,7 +992,7 @@ ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop,
#define CHECKVAL(x) do { \
if(!(x)) \
{ \
- alSetError(Context, AL_INVALID_VALUE, "Value out of range"); \
+ Context->setError(AL_INVALID_VALUE, "Value out of range"); \
return AL_FALSE; \
} \
} while(0)
@@ -1225,7 +1224,8 @@ ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, co
}
ERR("Unexpected property: 0x%04x\n", prop);
- SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source float property 0x%04x", prop);
+ Context->setError(AL_INVALID_ENUM, "Invalid source float property 0x%04x", prop);
+ return AL_FALSE;
}
ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALint *values)
@@ -1548,8 +1548,8 @@ ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, co
}
ERR("Unexpected property: 0x%04x\n", prop);
- SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer property 0x%04x",
- prop);
+ Context->setError(AL_INVALID_ENUM, "Invalid source integer property 0x%04x", prop);
+ return AL_FALSE;
}
ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALint64SOFT *values)
@@ -1651,8 +1651,8 @@ ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop,
}
ERR("Unexpected property: 0x%04x\n", prop);
- SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer64 property 0x%04x",
- prop);
+ Context->setError(AL_INVALID_ENUM, "Invalid source integer64 property 0x%04x", prop);
+ return AL_FALSE;
}
#undef CHECKVAL
@@ -1824,8 +1824,8 @@ ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp prop, AL
}
ERR("Unexpected property: 0x%04x\n", prop);
- SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source double property 0x%04x",
- prop);
+ Context->setError(AL_INVALID_ENUM, "Invalid source double property 0x%04x", prop);
+ return AL_FALSE;
}
ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint *values)
@@ -1991,8 +1991,8 @@ ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, AL
}
ERR("Unexpected property: 0x%04x\n", prop);
- SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer property 0x%04x",
- prop);
+ Context->setError(AL_INVALID_ENUM, "Invalid source integer property 0x%04x", prop);
+ return AL_FALSE;
}
ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64SOFT *values)
@@ -2123,8 +2123,8 @@ ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop,
}
ERR("Unexpected property: 0x%04x\n", prop);
- SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer64 property 0x%04x",
- prop);
+ Context->setError(AL_INVALID_ENUM, "Invalid source integer64 property 0x%04x", prop);
+ return AL_FALSE;
}
} // namespace
@@ -2136,7 +2136,7 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(n < 0)
- alSetError(context.get(), AL_INVALID_VALUE, "Generating %d sources", n);
+ context->setError(AL_INVALID_VALUE, "Generating %d sources", n);
else if(n == 1)
{
ALsource *source = AllocSource(context.get());
@@ -2170,7 +2170,7 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(n < 0)
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Deleting %d sources", n);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Deleting %d sources", n);
std::lock_guard<std::mutex> _{context->mSourceLock};
@@ -2181,7 +2181,7 @@ START_API_FUNC
{
if(!LookupSource(context.get(), sid))
{
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", sid);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", sid);
return false;
}
return true;
@@ -2226,9 +2226,9 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(FloatValsByProp(param) != 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid float property 0x%04x", param);
else
SetSourcefv(Source, context.get(), static_cast<SourceProp>(param), &value);
}
@@ -2244,9 +2244,9 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(FloatValsByProp(param) != 3)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid 3-float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid 3-float property 0x%04x", param);
else
{
ALfloat fvals[3] = { value1, value2, value3 };
@@ -2265,11 +2265,11 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(FloatValsByProp(param) < 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid float-vector property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid float-vector property 0x%04x", param);
else
SetSourcefv(Source, context.get(), static_cast<SourceProp>(param), values);
}
@@ -2286,9 +2286,9 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(DoubleValsByProp(param) != 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid double property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid double property 0x%04x", param);
else
{
ALfloat fval = static_cast<ALfloat>(value);
@@ -2307,9 +2307,9 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(DoubleValsByProp(param) != 3)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid 3-double property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid 3-double property 0x%04x", param);
else {
ALfloat fvals[3] = {static_cast<ALfloat>(value1),
static_cast<ALfloat>(value2),
@@ -2329,14 +2329,14 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else
{
ALint count{DoubleValsByProp(param)};
if(count < 1 || count > 6)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid double-vector property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid double-vector property 0x%04x", param);
else
{
ALfloat fvals[6];
@@ -2361,9 +2361,9 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(IntValsByProp(param) != 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid integer property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid integer property 0x%04x", param);
else
SetSourceiv(Source, context.get(), static_cast<SourceProp>(param), &value);
}
@@ -2379,9 +2379,9 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(IntValsByProp(param) != 3)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid 3-integer property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid 3-integer property 0x%04x", param);
else
{
ALint ivals[3] = { value1, value2, value3 };
@@ -2400,11 +2400,11 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source = LookupSource(context.get(), source);
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(IntValsByProp(param) < 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid integer-vector property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid integer-vector property 0x%04x", param);
else
SetSourceiv(Source, context.get(), static_cast<SourceProp>(param), values);
}
@@ -2421,9 +2421,9 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(Int64ValsByProp(param) != 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid integer64 property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid integer64 property 0x%04x", param);
else
SetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), &value);
}
@@ -2439,9 +2439,9 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(Int64ValsByProp(param) != 3)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid 3-integer64 property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid 3-integer64 property 0x%04x", param);
else
{
ALint64SOFT i64vals[3] = { value1, value2, value3 };
@@ -2460,11 +2460,11 @@ START_API_FUNC
std::lock_guard<std::mutex> __{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(Int64ValsByProp(param) < 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid integer64-vector property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid integer64-vector property 0x%04x", param);
else
SetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), values);
}
@@ -2480,11 +2480,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!value)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(FloatValsByProp(param) != 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid float property 0x%04x", param);
else
{
ALdouble dval;
@@ -2503,11 +2503,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(value1 && value2 && value3))
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(FloatValsByProp(param) != 3)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid 3-float property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid 3-float property 0x%04x", param);
else
{
ALdouble dvals[3];
@@ -2530,14 +2530,14 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else
{
ALint count{FloatValsByProp(param)};
if(count < 1 && count > 6)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid float-vector property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid float-vector property 0x%04x", param);
else
{
ALdouble dvals[6];
@@ -2561,11 +2561,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!value)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(DoubleValsByProp(param) != 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid double property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid double property 0x%04x", param);
else
GetSourcedv(Source, context.get(), static_cast<SourceProp>(param), value);
}
@@ -2580,11 +2580,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(value1 && value2 && value3))
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(DoubleValsByProp(param) != 3)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid 3-double property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid 3-double property 0x%04x", param);
else
{
ALdouble dvals[3];
@@ -2607,11 +2607,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(DoubleValsByProp(param) < 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid double-vector property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid double-vector property 0x%04x", param);
else
GetSourcedv(Source, context.get(), static_cast<SourceProp>(param), values);
}
@@ -2627,11 +2627,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!value)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(IntValsByProp(param) != 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid integer property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid integer property 0x%04x", param);
else
GetSourceiv(Source, context.get(), static_cast<SourceProp>(param), value);
}
@@ -2646,11 +2646,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(value1 && value2 && value3))
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(IntValsByProp(param) != 3)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid 3-integer property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid 3-integer property 0x%04x", param);
else
{
ALint ivals[3];
@@ -2673,11 +2673,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(IntValsByProp(param) < 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid integer-vector property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid integer-vector property 0x%04x", param);
else
GetSourceiv(Source, context.get(), static_cast<SourceProp>(param), values);
}
@@ -2693,11 +2693,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!value)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(Int64ValsByProp(param) != 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid integer64 property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid integer64 property 0x%04x", param);
else
GetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), value);
}
@@ -2712,11 +2712,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(value1 && value2 && value3))
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(Int64ValsByProp(param) != 3)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid 3-integer64 property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid 3-integer64 property 0x%04x", param);
else
{
ALint64SOFT i64vals[3];
@@ -2739,11 +2739,11 @@ START_API_FUNC
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *Source{LookupSource(context.get(), source)};
if(UNLIKELY(!Source))
- alSetError(context.get(), AL_INVALID_NAME, "Invalid source ID %u", source);
+ context->setError(AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else if(Int64ValsByProp(param) < 1)
- alSetError(context.get(), AL_INVALID_ENUM, "Invalid integer64-vector property 0x%04x", param);
+ context->setError(AL_INVALID_ENUM, "Invalid integer64-vector property 0x%04x", param);
else
GetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), values);
}
@@ -2762,7 +2762,7 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(n < 0)
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Playing %d sources", n);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Playing %d sources", n);
if(n == 0) return;
al::vector<ALsource*> extra_sources;
@@ -2779,7 +2779,7 @@ START_API_FUNC
{
srchandles[i] = LookupSource(context.get(), sources[i]);
if(!srchandles[i])
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", sources[i]);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid source ID %u", sources[i]);
}
ALCdevice *device{context->mDevice};
@@ -2823,7 +2823,7 @@ START_API_FUNC
/* Allocate more voices to get enough. */
const size_t alloc_count{need_voices - rem_voices};
if(UNLIKELY(context->mVoices->size() > std::numeric_limits<ALsizei>::max()-alloc_count))
- SETERR_RETURN(context.get(), AL_OUT_OF_MEMORY,,
+ SETERR_RETURN(context, AL_OUT_OF_MEMORY,,
"Overflow increasing voice count to %zu + %zu", context->mVoices->size(),
alloc_count);
@@ -3024,7 +3024,7 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(n < 0)
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Pausing %d sources", n);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Pausing %d sources", n);
if(n == 0) return;
al::vector<ALsource*> extra_sources;
@@ -3041,7 +3041,7 @@ START_API_FUNC
{
srchandles[i] = LookupSource(context.get(), sources[i]);
if(!srchandles[i])
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", sources[i]);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid source ID %u", sources[i]);
}
ALCdevice *device{context->mDevice};
@@ -3079,7 +3079,7 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(n < 0)
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Stopping %d sources", n);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Stopping %d sources", n);
if(n == 0) return;
al::vector<ALsource*> extra_sources;
@@ -3096,7 +3096,7 @@ START_API_FUNC
{
srchandles[i] = LookupSource(context.get(), sources[i]);
if(!srchandles[i])
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", sources[i]);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid source ID %u", sources[i]);
}
ALCdevice *device{context->mDevice};
@@ -3141,7 +3141,7 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(n < 0)
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Rewinding %d sources", n);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Rewinding %d sources", n);
if(n == 0) return;
al::vector<ALsource*> extra_sources;
@@ -3158,7 +3158,7 @@ START_API_FUNC
{
srchandles[i] = LookupSource(context.get(), sources[i]);
if(!srchandles[i])
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", sources[i]);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid source ID %u", sources[i]);
}
ALCdevice *device{context->mDevice};
@@ -3197,17 +3197,17 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(nb < 0)
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Queueing %d buffers", nb);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Queueing %d buffers", nb);
if(nb == 0) return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *source{LookupSource(context.get(),src)};
if(UNLIKELY(!source))
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", src);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid source ID %u", src);
/* Can't queue on a Static Source */
if(UNLIKELY(source->SourceType == AL_STATIC))
- SETERR_RETURN(context.get(), AL_INVALID_OPERATION,, "Queueing onto static source %u", src);
+ SETERR_RETURN(context, AL_INVALID_OPERATION,, "Queueing onto static source %u", src);
/* Check for a valid Buffer, for its frequency and format */
ALCdevice *device{context->mDevice};
@@ -3232,8 +3232,7 @@ START_API_FUNC
ALbuffer *buffer{nullptr};
if(buffers[i] && (buffer=LookupBuffer(device, buffers[i])) == nullptr)
{
- alSetError(context.get(), AL_INVALID_NAME, "Queueing invalid buffer ID %u",
- buffers[i]);
+ context->setError(AL_INVALID_NAME, "Queueing invalid buffer ID %u", buffers[i]);
goto buffer_error;
}
@@ -3260,8 +3259,8 @@ START_API_FUNC
if(buffer->MappedAccess != 0 && !(buffer->MappedAccess&AL_MAP_PERSISTENT_BIT_SOFT))
{
- alSetError(context.get(), AL_INVALID_OPERATION,
- "Queueing non-persistently mapped buffer %u", buffer->id);
+ context->setError(AL_INVALID_OPERATION, "Queueing non-persistently mapped buffer %u",
+ buffer->id);
goto buffer_error;
}
@@ -3271,8 +3270,7 @@ START_API_FUNC
BufferFmt->mFmtChannels != buffer->mFmtChannels ||
BufferFmt->OriginalType != buffer->OriginalType)
{
- alSetError(context.get(), AL_INVALID_OPERATION,
- "Queueing buffer with mismatched format");
+ context->setError(AL_INVALID_OPERATION, "Queueing buffer with mismatched format");
buffer_error:
/* A buffer failed (invalid ID or format), so unlock and release
@@ -3316,17 +3314,17 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(nb < 0)
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Queueing %d buffer layers", nb);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Queueing %d buffer layers", nb);
if(nb == 0) return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *source{LookupSource(context.get(),src)};
if(UNLIKELY(!source))
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", src);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid source ID %u", src);
/* Can't queue on a Static Source */
if(UNLIKELY(source->SourceType == AL_STATIC))
- SETERR_RETURN(context.get(), AL_INVALID_OPERATION,, "Queueing onto static source %u", src);
+ SETERR_RETURN(context, AL_INVALID_OPERATION,, "Queueing onto static source %u", src);
/* Check for a valid Buffer, for its frequency and format */
ALCdevice *device{context->mDevice};
@@ -3356,8 +3354,7 @@ START_API_FUNC
ALbuffer *buffer{nullptr};
if(buffers[i] && (buffer=LookupBuffer(device, buffers[i])) == nullptr)
{
- alSetError(context.get(), AL_INVALID_NAME, "Queueing invalid buffer ID %u",
- buffers[i]);
+ context->setError(AL_INVALID_NAME, "Queueing invalid buffer ID %u", buffers[i]);
goto buffer_error;
}
@@ -3370,8 +3367,8 @@ START_API_FUNC
if(buffer->MappedAccess != 0 && !(buffer->MappedAccess&AL_MAP_PERSISTENT_BIT_SOFT))
{
- alSetError(context.get(), AL_INVALID_OPERATION,
- "Queueing non-persistently mapped buffer %u", buffer->id);
+ context->setError(AL_INVALID_OPERATION, "Queueing non-persistently mapped buffer %u",
+ buffer->id);
goto buffer_error;
}
@@ -3381,8 +3378,7 @@ START_API_FUNC
BufferFmt->mFmtChannels != buffer->mFmtChannels ||
BufferFmt->OriginalType != buffer->OriginalType)
{
- alSetError(context.get(), AL_INVALID_OPERATION,
- "Queueing buffer with mismatched format");
+ context->setError(AL_INVALID_OPERATION, "Queueing buffer with mismatched format");
buffer_error:
/* A buffer failed (invalid ID or format), so unlock and release
@@ -3426,19 +3422,19 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(nb < 0)
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Unqueueing %d buffers", nb);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Unqueueing %d buffers", nb);
if(nb == 0) return;
std::lock_guard<std::mutex> _{context->mSourceLock};
ALsource *source{LookupSource(context.get(),src)};
if(UNLIKELY(!source))
- SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", src);
+ SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid source ID %u", src);
if(UNLIKELY(source->Looping))
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Unqueueing from looping source %u", src);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Unqueueing from looping source %u", src);
if(UNLIKELY(source->SourceType != AL_STREAMING))
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,,
- "Unqueueing from a non-streaming source %u", src);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Unqueueing from a non-streaming source %u",
+ src);
/* Make sure enough buffers have been processed to unqueue. */
ALbufferlistitem *BufferList{source->queue};
@@ -3449,7 +3445,7 @@ START_API_FUNC
else if(source->state == AL_INITIAL)
Current = BufferList;
if(UNLIKELY(BufferList == Current))
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Unqueueing pending buffers");
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Unqueueing pending buffers");
ALsizei i{BufferList->num_buffers};
while(i < nb)
@@ -3459,7 +3455,7 @@ START_API_FUNC
*/
ALbufferlistitem *next{BufferList->next.load(std::memory_order_relaxed)};
if(UNLIKELY(!next) || UNLIKELY(next == Current))
- SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Unqueueing pending buffers");
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Unqueueing pending buffers");
BufferList = next;
i += BufferList->num_buffers;
diff --git a/al/state.cpp b/al/state.cpp
index 903ab614..3f2f8b79 100644
--- a/al/state.cpp
+++ b/al/state.cpp
@@ -102,7 +102,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid enable property 0x%04x", capability);
+ context->setError(AL_INVALID_VALUE, "Invalid enable property 0x%04x", capability);
}
}
END_API_FUNC
@@ -122,7 +122,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid disable property 0x%04x", capability);
+ context->setError(AL_INVALID_VALUE, "Invalid disable property 0x%04x", capability);
}
}
END_API_FUNC
@@ -142,7 +142,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid is enabled property 0x%04x", capability);
+ context->setError(AL_INVALID_VALUE, "Invalid is enabled property 0x%04x", capability);
}
return value;
@@ -199,7 +199,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid boolean property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid boolean property 0x%04x", pname);
}
return value;
@@ -250,7 +250,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid double property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid double property 0x%04x", pname);
}
return value;
@@ -301,7 +301,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid float property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid float property 0x%04x", pname);
}
return value;
@@ -352,7 +352,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid integer property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid integer property 0x%04x", pname);
}
return value;
@@ -403,7 +403,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid integer64 property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid integer64 property 0x%04x", pname);
}
return value;
@@ -429,7 +429,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid pointer property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid pointer property 0x%04x", pname);
}
return value;
@@ -460,11 +460,11 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(pname)
{
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid boolean-vector property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid boolean-vector property 0x%04x", pname);
}
}
END_API_FUNC
@@ -493,11 +493,11 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(pname)
{
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid double-vector property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid double-vector property 0x%04x", pname);
}
}
END_API_FUNC
@@ -526,11 +526,11 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(pname)
{
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid float-vector property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid float-vector property 0x%04x", pname);
}
}
END_API_FUNC
@@ -559,11 +559,11 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(pname)
{
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid integer-vector property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid integer-vector property 0x%04x", pname);
}
}
END_API_FUNC
@@ -592,11 +592,11 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(pname)
{
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid integer64-vector property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid integer64-vector property 0x%04x", pname);
}
}
END_API_FUNC
@@ -619,11 +619,11 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(!values)
- alSetError(context.get(), AL_INVALID_VALUE, "NULL pointer");
+ context->setError(AL_INVALID_VALUE, "NULL pointer");
else switch(pname)
{
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid pointer-vector property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid pointer-vector property 0x%04x", pname);
}
}
END_API_FUNC
@@ -678,7 +678,7 @@ START_API_FUNC
break;
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid string property 0x%04x", pname);
+ context->setError(AL_INVALID_VALUE, "Invalid string property 0x%04x", pname);
}
return value;
}
@@ -691,7 +691,7 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(!(value >= 0.0f && std::isfinite(value)))
- alSetError(context.get(), AL_INVALID_VALUE, "Doppler factor %f out of range", value);
+ context->setError(AL_INVALID_VALUE, "Doppler factor %f out of range", value);
else
{
std::lock_guard<std::mutex> _{context->mPropLock};
@@ -720,7 +720,7 @@ START_API_FUNC
}
if(!(value >= 0.0f && std::isfinite(value)))
- alSetError(context.get(), AL_INVALID_VALUE, "Doppler velocity %f out of range", value);
+ context->setError(AL_INVALID_VALUE, "Doppler velocity %f out of range", value);
else
{
std::lock_guard<std::mutex> _{context->mPropLock};
@@ -737,7 +737,7 @@ START_API_FUNC
if(UNLIKELY(!context)) return;
if(!(value > 0.0f && std::isfinite(value)))
- alSetError(context.get(), AL_INVALID_VALUE, "Speed of sound %f out of range", value);
+ context->setError(AL_INVALID_VALUE, "Speed of sound %f out of range", value);
else
{
std::lock_guard<std::mutex> _{context->mPropLock};
@@ -757,7 +757,7 @@ START_API_FUNC
value == AL_LINEAR_DISTANCE || value == AL_LINEAR_DISTANCE_CLAMPED ||
value == AL_EXPONENT_DISTANCE || value == AL_EXPONENT_DISTANCE_CLAMPED ||
value == AL_NONE))
- alSetError(context.get(), AL_INVALID_VALUE, "Distance model 0x%04x out of range", value);
+ context->setError(AL_INVALID_VALUE, "Distance model 0x%04x out of range", value);
else
{
std::lock_guard<std::mutex> _{context->mPropLock};
@@ -808,14 +808,13 @@ START_API_FUNC
{
case AL_RESAMPLER_NAME_SOFT:
if(index < 0 || static_cast<size_t>(index) >= al::size(ResamplerNames))
- alSetError(context.get(), AL_INVALID_VALUE, "Resampler name index %d out of range",
- index);
+ context->setError(AL_INVALID_VALUE, "Resampler name index %d out of range", index);
else
value = ResamplerNames[index];
break;
default:
- alSetError(context.get(), AL_INVALID_VALUE, "Invalid string indexed property");
+ context->setError(AL_INVALID_VALUE, "Invalid string indexed property");
}
return value;
}