aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alError.h10
-rw-r--r--OpenAL32/alAuxEffectSlot.c71
-rw-r--r--OpenAL32/alBuffer.c208
-rw-r--r--OpenAL32/alEffect.c28
-rw-r--r--OpenAL32/alError.c30
-rw-r--r--OpenAL32/alExtension.c2
-rw-r--r--OpenAL32/alFilter.c136
-rw-r--r--OpenAL32/alListener.c13
-rw-r--r--OpenAL32/alSource.c266
-rw-r--r--OpenAL32/alState.c65
-rw-r--r--OpenAL32/event.c6
11 files changed, 434 insertions, 401 deletions
diff --git a/OpenAL32/Include/alError.h b/OpenAL32/Include/alError.h
index 3dc16103..479697f2 100644
--- a/OpenAL32/Include/alError.h
+++ b/OpenAL32/Include/alError.h
@@ -9,15 +9,15 @@ extern "C" {
extern ALboolean TrapALError;
-ALvoid alSetError(ALCcontext *context, ALenum errorCode, ALuint objid, const char *msg);
+void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...);
-#define SETERR_GOTO(ctx, err, objid, msg, lbl) do { \
- alSetError((ctx), (err), (objid), (msg)); \
+#define SETERR_GOTO(ctx, err, lbl, ...) do { \
+ alSetError((ctx), (err), __VA_ARGS__); \
goto lbl; \
} while(0)
-#define SETERR_RETURN(ctx, err, objid, msg, retval) do { \
- alSetError((ctx), (err), (objid), (msg)); \
+#define SETERR_RETURN(ctx, err, retval, ...) do { \
+ alSetError((ctx), (err), __VA_ARGS__); \
return retval; \
} while(0)
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index a8186f07..d2039097 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -73,7 +73,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo
if(!context) return;
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Generating negative effect slots", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Generating %d effect slots", n);
tmpslots = al_malloc(DEF_ALIGN, sizeof(ALeffectslot*)*n);
LockEffectSlotsWrite(context);
@@ -87,7 +87,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo
UnlockEffectSlotsWrite(context);
alDeleteAuxiliaryEffectSlots(cur, effectslots);
- SETERR_GOTO(context, err, 0, "Effect slot object allocation failed", done);
+ SETERR_GOTO(context, err, done, "Effect slot object allocation failed");
}
err = NewThunkEntry(&slot->id);
@@ -103,7 +103,7 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo
UnlockEffectSlotsWrite(context);
alDeleteAuxiliaryEffectSlots(cur, effectslots);
- SETERR_GOTO(context, err, 0, "Failed to set effect slot ID", done);
+ SETERR_GOTO(context, err, done, "Failed to set effect slot ID");
}
aluInitEffectPanning(slot);
@@ -149,15 +149,15 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *
LockEffectSlotsWrite(context);
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Deleting negative effect slots",
- done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d effect slots", n);
for(i = 0;i < n;i++)
{
if((slot=LookupEffectSlot(context, effectslots[i])) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, effectslots[i], "Invalid effect slot ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u",
+ effectslots[i]);
if(ReadRef(&slot->ref) != 0)
- SETERR_GOTO(context, AL_INVALID_OPERATION, effectslots[i],
- "Deleting in-use effect slot", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Deleting in-use effect slot %u",
+ effectslots[i]);
}
// All effectslots are valid
@@ -240,7 +240,7 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
WriteLock(&context->PropLock);
LockEffectSlotsRead(context);
if((slot=LookupEffectSlot(context, effectslot)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot);
switch(param)
{
case AL_EFFECTSLOT_EFFECT:
@@ -251,25 +251,25 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param
if(!(value == 0 || effect != NULL))
{
UnlockEffectsRead(device);
- SETERR_GOTO(context, AL_INVALID_VALUE, effectslot, "Invalid effect ID", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Invalid effect ID %u", value);
}
err = InitializeEffect(context, slot, effect);
UnlockEffectsRead(device);
if(err != AL_NO_ERROR)
- SETERR_GOTO(context, err, effectslot, "Effect initialization failed", done);
+ SETERR_GOTO(context, err, done, "Effect initialization failed");
break;
case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
if(!(value == AL_TRUE || value == AL_FALSE))
- SETERR_GOTO(context, AL_INVALID_VALUE, effectslot,
- "Effect slot auxiliary send auto out of range", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done,
+ "Effect slot auxiliary send auto out of range");
slot->AuxSendAuto = value;
break;
default:
- SETERR_GOTO(context, AL_INVALID_ENUM, effectslot, "Invalid effect slot integer property",
- done);
+ SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid effect slot integer property 0x%04x",
+ param);
}
DO_UPDATEPROPS();
@@ -296,12 +296,12 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum para
LockEffectSlotsRead(context);
if(LookupEffectSlot(context, effectslot) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot);
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM, effectslot,
- "Invalid effect slot integer-vector property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid effect slot integer-vector property 0x%04x",
+ param);
}
done:
@@ -320,19 +320,18 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param
WriteLock(&context->PropLock);
LockEffectSlotsRead(context);
if((slot=LookupEffectSlot(context, effectslot)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot);
switch(param)
{
case AL_EFFECTSLOT_GAIN:
if(!(value >= 0.0f && value <= 1.0f))
- SETERR_GOTO(context, AL_INVALID_VALUE, effectslot, "Effect slot gain out of range",
- done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Effect slot gain out of range");
slot->Gain = value;
break;
default:
- SETERR_GOTO(context, AL_INVALID_ENUM, effectslot, "Invalid effect slot float property",
- done);
+ SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid effect slot float property 0x%04x",
+ param);
}
DO_UPDATEPROPS();
@@ -358,12 +357,12 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum para
LockEffectSlotsRead(context);
if(LookupEffectSlot(context, effectslot) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot);
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM, effectslot,
- "Invalid effect slot float-vector property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid effect slot float-vector property 0x%04x",
+ param);
}
done:
@@ -381,7 +380,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum pa
LockEffectSlotsRead(context);
if((slot=LookupEffectSlot(context, effectslot)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot);
switch(param)
{
case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO:
@@ -389,7 +388,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum pa
break;
default:
- alSetError(context, AL_INVALID_ENUM, effectslot, "Invalid effect slot integer property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid effect slot integer property 0x%04x", param);
}
done:
@@ -414,12 +413,12 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum p
LockEffectSlotsRead(context);
if(LookupEffectSlot(context, effectslot) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot);
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM, effectslot,
- "Invalid effect slot integer-vector property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid effect slot integer-vector property 0x%04x",
+ param);
}
done:
@@ -437,7 +436,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum pa
LockEffectSlotsRead(context);
if((slot=LookupEffectSlot(context, effectslot)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot);
switch(param)
{
case AL_EFFECTSLOT_GAIN:
@@ -445,7 +444,7 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum pa
break;
default:
- alSetError(context, AL_INVALID_ENUM, effectslot, "Invalid effect slot float property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid effect slot float property 0x%04x", param);
}
done:
@@ -469,12 +468,12 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum p
LockEffectSlotsRead(context);
if(LookupEffectSlot(context, effectslot) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, effectslot, "Invalid effect slot ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot);
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM, effectslot,
- "Invalid effect slot float-vector property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid effect slot float-vector property 0x%04x",
+ param);
}
done:
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index 922c379c..0ef4bf69 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -66,7 +66,7 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers)
if(!context) return;
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Generating negative buffers", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Generating %d buffers", n);
for(cur = 0;cur < n;cur++)
{
@@ -98,7 +98,7 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers)
LockBuffersWrite(device);
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Deleting negative buffers", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d buffers", n);
for(i = 0;i < n;i++)
{
@@ -107,9 +107,10 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers)
/* Check for valid Buffer ID */
if((ALBuf=LookupBuffer(device, buffers[i])) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffers[i], "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffers[i]);
if(ReadRef(&ALBuf->ref) != 0)
- SETERR_GOTO(context, AL_INVALID_OPERATION, buffers[i], "Deleting in-use buffer", done);
+ SETERR_GOTO(context, AL_INVALID_OPERATION, done, "Deleting in-use buffer %u",
+ buffers[i]);
}
for(i = 0;i < n;i++)
@@ -161,19 +162,20 @@ AL_API void AL_APIENTRY alBufferStorageSOFT(ALuint buffer, ALenum format, const
device = context->Device;
LockBuffersRead(device);
if((albuf=LookupBuffer(device, buffer)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
- if(!(size >= 0)) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Negative storage size", done);
- if(!(freq > 0)) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid sample rate", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
+ if(!(size >= 0)) SETERR_GOTO(context, AL_INVALID_VALUE, done, "Negative storage size %d", size);
+ if(!(freq > 0)) SETERR_GOTO(context, AL_INVALID_VALUE, done, "Invalid sample rate %d", freq);
if((flags&INVALID_STORAGE_MASK) != 0)
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid storage flags", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Invalid storage flags 0x%x",
+ flags&INVALID_STORAGE_MASK);
if((flags&AL_MAP_PERSISTENT_BIT_SOFT) && !(flags&MAP_READ_WRITE_FLAGS))
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer,
- "Declaring persistently mapped storage without read or write access", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done,
+ "Declaring persistently mapped storage without read or write access");
if(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE)
- SETERR_GOTO(context, AL_INVALID_ENUM, buffer, "Invalid format", done);
+ SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid format 0x%04x", format);
align = SanitizeAlignment(srctype, ATOMIC_LOAD_SEQ(&albuf->UnpackAlign));
- if(align < 1) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid unpack alignment", done);
+ if(align < 1) SETERR_GOTO(context, AL_INVALID_VALUE, done, "Invalid unpack alignment");
switch(srctype)
{
@@ -195,7 +197,8 @@ AL_API void AL_APIENTRY alBufferStorageSOFT(ALuint buffer, ALenum format, const
break;
}
if((size%framesize) != 0)
- alSetError(context, AL_INVALID_VALUE, buffer, "Data size is not a frame multiple");
+ alSetError(context, AL_INVALID_VALUE, "Data size %d is not a multiple of frame size %d",
+ size, framesize);
else
LoadData(context, albuf, freq, size/framesize*align, srcchannels, srctype, data, align,
flags);
@@ -218,32 +221,33 @@ AL_API void* AL_APIENTRY alMapBufferSOFT(ALuint buffer, ALsizei offset, ALsizei
device = context->Device;
LockBuffersRead(device);
if((albuf=LookupBuffer(device, buffer)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
if((access&~MAP_ACCESS_FLAGS) != 0)
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid map flags", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Invalid map flags 0x%x",
+ access&~MAP_ACCESS_FLAGS);
if(!(access&MAP_READ_WRITE_FLAGS))
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer,
- "Mapping buffer without read or write access", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done,
+ "Mapping buffer without read or write access");
WriteLock(&albuf->lock);
if(ReadRef(&albuf->ref) != 0 && !(access&AL_MAP_PERSISTENT_BIT_SOFT))
- SETERR_GOTO(context, AL_INVALID_OPERATION, buffer,
- "Mapping in-use buffer without persistent mapping", unlock_done);
+ SETERR_GOTO(context, AL_INVALID_OPERATION, unlock_done,
+ "Mapping in-use buffer without persistent mapping");
if(albuf->MappedAccess != 0)
- SETERR_GOTO(context, AL_INVALID_OPERATION, buffer, "Mapping already-mapped buffer",
- unlock_done);
+ SETERR_GOTO(context, AL_INVALID_OPERATION, unlock_done, "Mapping already-mapped buffer");
if((access&AL_MAP_READ_BIT_SOFT) && !(albuf->Access&AL_MAP_READ_BIT_SOFT))
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer,
- "Mapping buffer for reading without read access", unlock_done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, unlock_done,
+ "Mapping buffer for reading without read access");
if((access&AL_MAP_WRITE_BIT_SOFT) && !(albuf->Access&AL_MAP_WRITE_BIT_SOFT))
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer,
- "Mapping buffer for writing without write access", unlock_done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, unlock_done,
+ "Mapping buffer for writing without write access");
if((access&AL_MAP_PERSISTENT_BIT_SOFT) && !(albuf->Access&AL_MAP_PERSISTENT_BIT_SOFT))
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer,
- "Mapping buffer persistently without persistent access", unlock_done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, unlock_done,
+ "Mapping buffer persistently without persistent access");
if(offset < 0 || offset >= albuf->OriginalSize ||
length <= 0 || length > albuf->OriginalSize - offset)
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Mapping out of range", unlock_done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, unlock_done, "Mapping invalid range %d+%d",
+ offset, length);
retval = (ALbyte*)albuf->data + offset;
albuf->MappedAccess = access;
@@ -272,11 +276,11 @@ AL_API void AL_APIENTRY alUnmapBufferSOFT(ALuint buffer)
device = context->Device;
LockBuffersRead(device);
if((albuf=LookupBuffer(device, buffer)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
WriteLock(&albuf->lock);
if(albuf->MappedAccess == 0)
- alSetError(context, AL_INVALID_OPERATION, albuf->id, "Unmapping an unmapped buffer");
+ alSetError(context, AL_INVALID_OPERATION, "Unmapping an unmapped buffer %u", buffer);
else
{
albuf->MappedAccess = 0;
@@ -302,15 +306,15 @@ AL_API void AL_APIENTRY alFlushMappedBufferSOFT(ALuint buffer, ALsizei offset, A
device = context->Device;
LockBuffersRead(device);
if((albuf=LookupBuffer(device, buffer)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
WriteLock(&albuf->lock);
if(albuf->MappedAccess == 0 || !(albuf->MappedAccess&AL_MAP_WRITE_BIT_SOFT))
- alSetError(context, AL_INVALID_OPERATION, albuf->id,
- "Flushing a buffer not mapped for writing");
+ alSetError(context, AL_INVALID_OPERATION, "Flushing buffer %u not mapped for writing",
+ buffer);
else if(offset < albuf->MappedOffset || offset >= albuf->MappedOffset+albuf->MappedSize ||
length <= 0 || length > albuf->MappedOffset+albuf->MappedSize-offset)
- alSetError(context, AL_INVALID_VALUE, albuf->id, "Flushing an invalid range");
+ alSetError(context, AL_INVALID_VALUE, "Flushing an invalid range %d+%d", offset, length);
else
{
/* FIXME: Need to use some method of double-buffering for the mixer and
@@ -346,22 +350,22 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, cons
device = context->Device;
LockBuffersRead(device);
if((albuf=LookupBuffer(device, buffer)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
if(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE)
- SETERR_GOTO(context, AL_INVALID_ENUM, buffer, "Invalid format", done);
+ SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid format 0x%04x", format);
WriteLock(&albuf->lock);
align = SanitizeAlignment(srctype, ATOMIC_LOAD_SEQ(&albuf->UnpackAlign));
- if(align < 1) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid unpack alignment", done);
+ if(align < 1) SETERR_GOTO(context, AL_INVALID_VALUE, unlock_done, "Invalid unpack alignment");
if((long)srcchannels != (long)albuf->FmtChannels || srctype != albuf->OriginalType)
- SETERR_GOTO(context, AL_INVALID_ENUM, buffer, "Unpacking data with mismatched format",
- unlock_done);
+ SETERR_GOTO(context, AL_INVALID_ENUM, unlock_done,
+ "Unpacking data with mismatched format");
if(align != albuf->OriginalAlign)
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Unpacking data with mismatched alignment",
- unlock_done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, unlock_done,
+ "Unpacking data with mismatched alignment");
if(albuf->MappedAccess != 0)
- SETERR_GOTO(context, AL_INVALID_OPERATION, buffer, "Unpacking data into mapped buffer",
- unlock_done);
+ SETERR_GOTO(context, AL_INVALID_OPERATION, unlock_done,
+ "Unpacking data into mapped buffer");
num_chans = ChannelsFromFmt(albuf->FmtChannels);
frame_size = num_chans * BytesFromFmt(albuf->FmtType);
@@ -374,9 +378,10 @@ AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, cons
if(offset < 0 || length < 0 || offset > albuf->OriginalSize ||
length > albuf->OriginalSize-offset)
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Data sub-range out of range", unlock_done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, unlock_done, "Invalid data sub-range %d+%d",
+ offset, length);
if((offset%byte_align) != 0 || (length%byte_align) != 0)
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid sub-range alignment", unlock_done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, unlock_done, "Invalid sub-range alignment");
/* offset -> byte offset, length -> sample count */
offset = offset/byte_align * frame_size;
@@ -411,7 +416,7 @@ AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint UNUSED(buffer),
context = GetContextRef();
if(!context) return;
- alSetError(context, AL_INVALID_OPERATION, 0, "alBufferSamplesSOFT not supported");
+ alSetError(context, AL_INVALID_OPERATION, "alBufferSamplesSOFT not supported");
ALCcontext_DecRef(context);
}
@@ -425,7 +430,7 @@ AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint UNUSED(buffer),
context = GetContextRef();
if(!context) return;
- alSetError(context, AL_INVALID_OPERATION, 0, "alBufferSubSamplesSOFT not supported");
+ alSetError(context, AL_INVALID_OPERATION, "alBufferSubSamplesSOFT not supported");
ALCcontext_DecRef(context);
}
@@ -439,7 +444,7 @@ AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint UNUSED(buffer),
context = GetContextRef();
if(!context) return;
- alSetError(context, AL_INVALID_OPERATION, 0, "alGetBufferSamplesSOFT not supported");
+ alSetError(context, AL_INVALID_OPERATION, "alGetBufferSamplesSOFT not supported");
ALCcontext_DecRef(context);
}
@@ -451,7 +456,7 @@ AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum UNUSED(format)
context = GetContextRef();
if(!context) return AL_FALSE;
- alSetError(context, AL_INVALID_OPERATION, 0, "alIsBufferFormatSupportedSOFT not supported");
+ alSetError(context, AL_INVALID_OPERATION, "alIsBufferFormatSupportedSOFT not supported");
ALCcontext_DecRef(context);
return AL_FALSE;
@@ -469,12 +474,12 @@ AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum param, ALfloat UNUSED(va
device = context->Device;
LockBuffersRead(device);
if(LookupBuffer(device, buffer) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer float property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid buffer float property 0x%04x", param);
}
done:
@@ -494,12 +499,12 @@ AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum param, ALfloat UNUSED(v
device = context->Device;
LockBuffersRead(device);
if(LookupBuffer(device, buffer) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer 3-float property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid buffer 3-float property 0x%04x", param);
}
done:
@@ -519,13 +524,13 @@ AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum param, const ALfloat *v
device = context->Device;
LockBuffersRead(device);
if(LookupBuffer(device, buffer) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
- if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done);
+ if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer");
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer float-vector property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid buffer float-vector property 0x%04x", param);
}
done:
@@ -546,26 +551,26 @@ AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value)
device = context->Device;
LockBuffersRead(device);
if((albuf=LookupBuffer(device, buffer)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
switch(param)
{
case AL_UNPACK_BLOCK_ALIGNMENT_SOFT:
if(!(value >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer,
- "Negative buffer unpack block alignment", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done,
+ "Buffer unpack block alignment %d is invalid", value);
ATOMIC_STORE_SEQ(&albuf->UnpackAlign, value);
break;
case AL_PACK_BLOCK_ALIGNMENT_SOFT:
if(!(value >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Negative buffer pack block alignment",
- done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done,
+ "Buffer pack block alignment %d is invalid", value);
ATOMIC_STORE_SEQ(&albuf->PackAlign, value);
break;
default:
- alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer integer property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid buffer integer property 0x%04x", param);
}
done:
@@ -584,12 +589,12 @@ AL_API void AL_APIENTRY alBuffer3i(ALuint buffer, ALenum param, ALint UNUSED(val
device = context->Device;
if(LookupBuffer(device, buffer) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer 3-integer property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid buffer 3-integer property 0x%04x", param);
}
done:
@@ -620,9 +625,9 @@ AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *val
device = context->Device;
LockBuffersRead(device);
if((albuf=LookupBuffer(device, buffer)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
- if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done);
+ if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer");
switch(param)
{
case AL_LOOP_POINTS_SOFT:
@@ -630,14 +635,15 @@ AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *val
if(ReadRef(&albuf->ref) != 0)
{
WriteUnlock(&albuf->lock);
- SETERR_GOTO(context, AL_INVALID_OPERATION, buffer,
- "Modifying in-use buffer loop points", done);
+ SETERR_GOTO(context, AL_INVALID_OPERATION, done,
+ "Modifying in-use buffer loop points");
}
if(values[0] >= values[1] || values[0] < 0 ||
values[1] > albuf->SampleLen)
{
WriteUnlock(&albuf->lock);
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "Invalid loop point range", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Invalid loop point range %d -> %d",
+ values[0], values[1]);
}
albuf->LoopStart = values[0];
@@ -646,7 +652,8 @@ AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *val
break;
default:
- alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer integer-vector property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid buffer integer-vector property 0x%04x",
+ param);
}
done:
@@ -667,13 +674,13 @@ AL_API ALvoid AL_APIENTRY alGetBufferf(ALuint buffer, ALenum param, ALfloat *val
device = context->Device;
LockBuffersRead(device);
if((albuf=LookupBuffer(device, buffer)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
- if(!value) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done);
+ if(!value) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer");
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer float property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid buffer float property 0x%04x", param);
}
done:
@@ -693,14 +700,14 @@ AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *valu
device = context->Device;
LockBuffersRead(device);
if(LookupBuffer(device, buffer) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
if(!value1 || !value2 || !value3)
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer");
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer 3-float property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid buffer 3-float property 0x%04x", param);
}
done:
@@ -727,13 +734,13 @@ AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum param, ALfloat *valu
device = context->Device;
LockBuffersRead(device);
if(LookupBuffer(device, buffer) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
- if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done);
+ if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer");
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer float-vector property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid buffer float-vector property 0x%04x", param);
}
done:
@@ -754,9 +761,9 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value
device = context->Device;
LockBuffersRead(device);
if((albuf=LookupBuffer(device, buffer)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
- if(!value) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done);
+ if(!value) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer");
switch(param)
{
case AL_FREQUENCY:
@@ -787,7 +794,7 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value
break;
default:
- alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer integer property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid buffer integer property 0x%04x", param);
}
done:
@@ -807,14 +814,14 @@ AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1
device = context->Device;
LockBuffersRead(device);
if(LookupBuffer(device, buffer) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
if(!value1 || !value2 || !value3)
- SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer");
switch(param)
{
default:
- alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer 3-integer property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid buffer 3-integer property 0x%04x", param);
}
done:
@@ -850,9 +857,9 @@ AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values
device = context->Device;
LockBuffersRead(device);
if((albuf=LookupBuffer(device, buffer)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, buffer, "Invalid buffer ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid buffer ID %u", buffer);
- if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, buffer, "NULL pointer", done);
+ if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer");
switch(param)
{
case AL_LOOP_POINTS_SOFT:
@@ -863,7 +870,8 @@ AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values
break;
default:
- alSetError(context, AL_INVALID_ENUM, buffer, "Invalid buffer integer-vector property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid buffer integer-vector property 0x%04x",
+ param);
}
done:
@@ -898,7 +906,7 @@ static void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei
case UserFmtBFormat3D: DstChannels = FmtBFormat3D; break;
}
if(UNLIKELY((long)SrcChannels != (long)DstChannels))
- SETERR_RETURN(context, AL_INVALID_ENUM, ALBuf->id, "Invalid format",);
+ SETERR_RETURN(context, AL_INVALID_ENUM,, "Invalid format");
/* IMA4 and MSADPCM convert to 16-bit short. */
switch(SrcType)
@@ -916,23 +924,22 @@ static void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei
if(access != 0)
{
if(UNLIKELY((long)SrcType != (long)DstType))
- SETERR_RETURN(context, AL_INVALID_VALUE, ALBuf->id,
- "Format cannot be mapped or preserved",);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Format cannot be mapped or preserved");
}
NumChannels = ChannelsFromFmt(DstChannels);
FrameSize = NumChannels * BytesFromFmt(DstType);
if(UNLIKELY(frames > INT_MAX/FrameSize))
- SETERR_RETURN(context, AL_OUT_OF_MEMORY, ALBuf->id, "Buffer size too large",);
+ SETERR_RETURN(context, AL_OUT_OF_MEMORY,,
+ "Buffer size overflow, %d frames x %d bytes per frame", frames, FrameSize);
newsize = frames*FrameSize;
WriteLock(&ALBuf->lock);
if(UNLIKELY(ReadRef(&ALBuf->ref) != 0 || ALBuf->MappedAccess != 0))
{
WriteUnlock(&ALBuf->lock);
- SETERR_RETURN(context, AL_INVALID_OPERATION, ALBuf->id,
- "Modifying storage for in-use buffer",);
+ SETERR_RETURN(context, AL_INVALID_OPERATION,, "Modifying storage for in-use buffer");
}
if((access&AL_PRESERVE_DATA_BIT_SOFT))
@@ -941,14 +948,12 @@ static void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei
if(UNLIKELY(ALBuf->FmtChannels != DstChannels || ALBuf->OriginalType != SrcType))
{
WriteUnlock(&ALBuf->lock);
- SETERR_RETURN(context, AL_INVALID_VALUE, ALBuf->id,
- "Preserving data of mismatched format",);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched format");
}
if(UNLIKELY(ALBuf->OriginalAlign != align))
{
WriteUnlock(&ALBuf->lock);
- SETERR_RETURN(context, AL_INVALID_VALUE, ALBuf->id,
- "Preserving data of mismatched alignment",);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched alignment");
}
}
@@ -966,7 +971,8 @@ static void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei
if(UNLIKELY(!temp && newsize))
{
WriteUnlock(&ALBuf->lock);
- SETERR_RETURN(context, AL_OUT_OF_MEMORY, ALBuf->id, "Failed to allocate storage",);
+ SETERR_RETURN(context, AL_OUT_OF_MEMORY,, "Failed to allocate %d bytes of storage",
+ newsize);
}
if((access&AL_PRESERVE_DATA_BIT_SOFT))
{
@@ -1204,7 +1210,7 @@ ALbuffer *NewBuffer(ALCcontext *context)
buffer = al_calloc(16, sizeof(ALbuffer));
if(!buffer)
- SETERR_RETURN(context, AL_OUT_OF_MEMORY, 0, "Failed to allocate buffer object", NULL);
+ SETERR_RETURN(context, AL_OUT_OF_MEMORY, NULL, "Failed to allocate buffer object");
RWLockInit(&buffer->lock);
buffer->Access = 0;
buffer->MappedAccess = 0;
@@ -1218,7 +1224,7 @@ ALbuffer *NewBuffer(ALCcontext *context)
memset(buffer, 0, sizeof(ALbuffer));
al_free(buffer);
- SETERR_RETURN(context, err, 0, "Failed to set buffer ID", NULL);
+ SETERR_RETURN(context, err, NULL, "Failed to set buffer ID");
}
return buffer;
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c
index 5f6e661a..ab42112c 100644
--- a/OpenAL32/alEffect.c
+++ b/OpenAL32/alEffect.c
@@ -69,7 +69,7 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
if(!context) return;
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Generating negative effects", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Generating %d effects", n);
device = context->Device;
for(cur = 0;cur < n;cur++)
@@ -80,7 +80,7 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
{
al_free(effect);
alDeleteEffects(cur, effects);
- SETERR_GOTO(context, err, 0, "Failed to allocate effect object", done);
+ SETERR_GOTO(context, err, done, "Failed to allocate effect object");
}
err = NewThunkEntry(&effect->id);
@@ -93,7 +93,7 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
al_free(effect);
alDeleteEffects(cur, effects);
- SETERR_GOTO(context, err, 0, "Failed to set effect ID", done);
+ SETERR_GOTO(context, err, done, "Failed to set effect ID");
}
effects[cur] = effect->id;
@@ -116,11 +116,11 @@ AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects)
device = context->Device;
LockEffectsWrite(device);
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Deleting negative effects", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d effects", n);
for(i = 0;i < n;i++)
{
if(effects[i] && LookupEffect(device, effects[i]) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, effects[i], "Invalid effect ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect ID %u", effects[i]);
}
for(i = 0;i < n;i++)
{
@@ -167,7 +167,7 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value)
Device = Context->Device;
LockEffectsWrite(Device);
if((ALEffect=LookupEffect(Device, effect)) == NULL)
- alSetError(Context, AL_INVALID_NAME, effect, "Invalid effect ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
if(param == AL_EFFECT_TYPE)
@@ -184,7 +184,7 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value)
if(isOk)
InitEffectParams(ALEffect, value);
else
- alSetError(Context, AL_INVALID_VALUE, effect, "Effect type not supported");
+ alSetError(Context, AL_INVALID_VALUE, "Effect type 0x%04x not supported", value);
}
else
{
@@ -216,7 +216,7 @@ AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *v
Device = Context->Device;
LockEffectsWrite(Device);
if((ALEffect=LookupEffect(Device, effect)) == NULL)
- alSetError(Context, AL_INVALID_NAME, effect, "Invalid effect ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
/* Call the appropriate handler */
@@ -239,7 +239,7 @@ AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat value)
Device = Context->Device;
LockEffectsWrite(Device);
if((ALEffect=LookupEffect(Device, effect)) == NULL)
- alSetError(Context, AL_INVALID_NAME, effect, "Invalid effect ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
/* Call the appropriate handler */
@@ -262,7 +262,7 @@ AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat
Device = Context->Device;
LockEffectsWrite(Device);
if((ALEffect=LookupEffect(Device, effect)) == NULL)
- alSetError(Context, AL_INVALID_NAME, effect, "Invalid effect ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
/* Call the appropriate handler */
@@ -285,7 +285,7 @@ AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *value
Device = Context->Device;
LockEffectsRead(Device);
if((ALEffect=LookupEffect(Device, effect)) == NULL)
- alSetError(Context, AL_INVALID_NAME, effect, "Invalid effect ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
if(param == AL_EFFECT_TYPE)
@@ -320,7 +320,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *valu
Device = Context->Device;
LockEffectsRead(Device);
if((ALEffect=LookupEffect(Device, effect)) == NULL)
- alSetError(Context, AL_INVALID_NAME, effect, "Invalid effect ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
/* Call the appropriate handler */
@@ -343,7 +343,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *val
Device = Context->Device;
LockEffectsRead(Device);
if((ALEffect=LookupEffect(Device, effect)) == NULL)
- alSetError(Context, AL_INVALID_NAME, effect, "Invalid effect ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
/* Call the appropriate handler */
@@ -366,7 +366,7 @@ AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *va
Device = Context->Device;
LockEffectsRead(Device);
if((ALEffect=LookupEffect(Device, effect)) == NULL)
- alSetError(Context, AL_INVALID_NAME, effect, "Invalid effect ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect);
else
{
/* Call the appropriate handler */
diff --git a/OpenAL32/alError.c b/OpenAL32/alError.c
index 8d138aa2..fe0e02be 100644
--- a/OpenAL32/alError.c
+++ b/OpenAL32/alError.c
@@ -21,6 +21,7 @@
#include "config.h"
#include <signal.h>
+#include <stdarg.h>
#ifdef HAVE_WINDOWS_H
#define WIN32_LEAN_AND_MEAN
@@ -33,12 +34,32 @@
ALboolean TrapALError = AL_FALSE;
-ALvoid alSetError(ALCcontext *context, ALenum errorCode, ALuint objid, const char *msg)
+void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...)
{
ALenum curerr = AL_NO_ERROR;
+ char message[1024] = { 0 };
+ va_list args;
+ int msglen;
- WARN("Error generated on context %p, code 0x%04x, object %u, \"%s\"\n",
- context, errorCode, objid, msg);
+ va_start(args, msg);
+ msglen = vsnprintf(message, sizeof(message), msg, args);
+ va_end(args);
+
+ if(msglen < 0 || (size_t)msglen >= sizeof(message))
+ {
+ message[sizeof(message)-1] = 0;
+ msglen = strlen(message);
+ }
+ if(msglen > 0)
+ msg = message;
+ else
+ {
+ msg = "<internal error constructing message>";
+ msglen = strlen(msg);
+ }
+
+ WARN("Error generated on context %p, code 0x%04x, \"%s\"\n",
+ context, errorCode, message);
if(TrapALError)
{
#ifdef _WIN32
@@ -55,7 +76,7 @@ ALvoid alSetError(ALCcontext *context, ALenum errorCode, ALuint objid, const cha
{
almtx_lock(&context->EventLock);
if((context->EnabledEvts&EventType_Error) && context->EventCb)
- (*context->EventCb)(AL_EVENT_TYPE_ERROR_SOFT, objid, errorCode, strlen(msg), msg,
+ (*context->EventCb)(AL_EVENT_TYPE_ERROR_SOFT, 0, errorCode, msglen, msg,
context->EventParam);
almtx_unlock(&context->EventLock);
}
@@ -86,6 +107,5 @@ AL_API ALenum AL_APIENTRY alGetError(void)
errorCode = ATOMIC_EXCHANGE_SEQ(&context->LastError, AL_NO_ERROR);
ALCcontext_DecRef(context);
-
return errorCode;
}
diff --git a/OpenAL32/alExtension.c b/OpenAL32/alExtension.c
index 9b6e5a97..f6378c70 100644
--- a/OpenAL32/alExtension.c
+++ b/OpenAL32/alExtension.c
@@ -46,7 +46,7 @@ AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName)
if(!context) return AL_FALSE;
if(!extName)
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "NULL pointer", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer");
len = strlen(extName);
ptr = context->ExtensionList;
diff --git a/OpenAL32/alFilter.c b/OpenAL32/alFilter.c
index 24b0e607..34f2f271 100644
--- a/OpenAL32/alFilter.c
+++ b/OpenAL32/alFilter.c
@@ -55,7 +55,7 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters)
if(!context) return;
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Generating negative filters", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Generating %d filters", n);
device = context->Device;
for(cur = 0;cur < n;cur++)
@@ -64,7 +64,7 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters)
if(!filter)
{
alDeleteFilters(cur, filters);
- SETERR_GOTO(context, AL_OUT_OF_MEMORY, 0, "Failed to allocate filter object", done);
+ SETERR_GOTO(context, AL_OUT_OF_MEMORY, done, "Failed to allocate filter object");
}
InitFilterParams(filter, AL_FILTER_NULL);
@@ -78,7 +78,7 @@ AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters)
al_free(filter);
alDeleteFilters(cur, filters);
- SETERR_GOTO(context, err, 0, "Failed ot set filter ID", done);
+ SETERR_GOTO(context, err, done, "Failed ot set filter ID");
}
filters[cur] = filter->id;
@@ -101,11 +101,11 @@ AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters)
device = context->Device;
LockFiltersWrite(device);
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Deleting negative filters", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d filters", n);
for(i = 0;i < n;i++)
{
if(filters[i] && LookupFilter(device, filters[i]) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, filters[i], "Invalid filter ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid filter ID %u", filters[i]);
}
for(i = 0;i < n;i++)
{
@@ -152,7 +152,7 @@ AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint value)
Device = Context->Device;
LockFiltersWrite(Device);
if((ALFilter=LookupFilter(Device, filter)) == NULL)
- alSetError(Context, AL_INVALID_NAME, filter, "Invalid filter ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
if(param == AL_FILTER_TYPE)
@@ -161,7 +161,7 @@ AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint value)
value == AL_FILTER_HIGHPASS || value == AL_FILTER_BANDPASS)
InitFilterParams(ALFilter, value);
else
- alSetError(Context, AL_INVALID_VALUE, filter, "Filter type not supported");
+ alSetError(Context, AL_INVALID_VALUE, "Invalid filter type 0x%04x", value);
}
else
{
@@ -193,7 +193,7 @@ AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *v
Device = Context->Device;
LockFiltersWrite(Device);
if((ALFilter=LookupFilter(Device, filter)) == NULL)
- alSetError(Context, AL_INVALID_NAME, filter, "Invalid filter ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
/* Call the appropriate handler */
@@ -216,7 +216,7 @@ AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat value)
Device = Context->Device;
LockFiltersWrite(Device);
if((ALFilter=LookupFilter(Device, filter)) == NULL)
- alSetError(Context, AL_INVALID_NAME, filter, "Invalid filter ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
/* Call the appropriate handler */
@@ -239,7 +239,7 @@ AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat
Device = Context->Device;
LockFiltersWrite(Device);
if((ALFilter=LookupFilter(Device, filter)) == NULL)
- alSetError(Context, AL_INVALID_NAME, filter, "Invalid filter ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
/* Call the appropriate handler */
@@ -262,7 +262,7 @@ AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *value
Device = Context->Device;
LockFiltersRead(Device);
if((ALFilter=LookupFilter(Device, filter)) == NULL)
- alSetError(Context, AL_INVALID_NAME, filter, "Invalid filter ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
if(param == AL_FILTER_TYPE)
@@ -297,7 +297,7 @@ AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *valu
Device = Context->Device;
LockFiltersRead(Device);
if((ALFilter=LookupFilter(Device, filter)) == NULL)
- alSetError(Context, AL_INVALID_NAME, filter, "Invalid filter ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
/* Call the appropriate handler */
@@ -320,7 +320,7 @@ AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *val
Device = Context->Device;
LockFiltersRead(Device);
if((ALFilter=LookupFilter(Device, filter)) == NULL)
- alSetError(Context, AL_INVALID_NAME, filter, "Invalid filter ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
/* Call the appropriate handler */
@@ -343,7 +343,7 @@ AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *va
Device = Context->Device;
LockFiltersRead(Device);
if((ALFilter=LookupFilter(Device, filter)) == NULL)
- alSetError(Context, AL_INVALID_NAME, filter, "Invalid filter ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter);
else
{
/* Call the appropriate handler */
@@ -435,37 +435,37 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g
}
-static void ALlowpass_setParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid low-pass integer property"); }
-static void ALlowpass_setParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid low-pass integer-vector property"); }
+static void ALlowpass_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint UNUSED(val))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer property 0x%04x", param); }
+static void ALlowpass_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALint *UNUSED(vals))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer-vector property 0x%04x", param); }
static void ALlowpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val)
{
switch(param)
{
case AL_LOWPASS_GAIN:
if(!(val >= AL_LOWPASS_MIN_GAIN && val <= AL_LOWPASS_MAX_GAIN))
- SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "Low-pass gain out of range",);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Low-pass gain %f out of range", val);
filter->Gain = val;
break;
case AL_LOWPASS_GAINHF:
if(!(val >= AL_LOWPASS_MIN_GAINHF && val <= AL_LOWPASS_MAX_GAINHF))
- SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "Low-pass gainhf out of range",);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Low-pass gainhf %f out of range", val);
filter->GainHF = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid low-pass float property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass float property 0x%04x", param);
}
}
static void ALlowpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals)
{ ALlowpass_setParamf(filter, context, param, vals[0]); }
-static void ALlowpass_getParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid low-pass integer property"); }
-static void ALlowpass_getParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid low-pass integer-vector property"); }
+static void ALlowpass_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(val))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer property 0x%04x", param); }
+static void ALlowpass_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(vals))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer-vector property 0x%04x", param); }
static void ALlowpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val)
{
switch(param)
@@ -479,7 +479,7 @@ static void ALlowpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum pa
break;
default:
- alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid low-pass float property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass float property 0x%04x", param);
}
}
static void ALlowpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals)
@@ -488,37 +488,37 @@ static void ALlowpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum p
DEFINE_ALFILTER_VTABLE(ALlowpass);
-static void ALhighpass_setParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid high-pass integer property"); }
-static void ALhighpass_setParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid high-pass integer-vector property"); }
+static void ALhighpass_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint UNUSED(val))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer property 0x%04x", param); }
+static void ALhighpass_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALint *UNUSED(vals))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer-vector property 0x%04x", param); }
static void ALhighpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val)
{
switch(param)
{
case AL_HIGHPASS_GAIN:
if(!(val >= AL_HIGHPASS_MIN_GAIN && val <= AL_HIGHPASS_MAX_GAIN))
- SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "High-pass gain out of range",);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "High-pass gain out of range");
filter->Gain = val;
break;
case AL_HIGHPASS_GAINLF:
if(!(val >= AL_HIGHPASS_MIN_GAINLF && val <= AL_HIGHPASS_MAX_GAINLF))
- SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "High-pass gainlf out of range",);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "High-pass gainlf out of range");
filter->GainLF = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid high-pass float property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass float property 0x%04x", param);
}
}
static void ALhighpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals)
{ ALhighpass_setParamf(filter, context, param, vals[0]); }
-static void ALhighpass_getParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid high-pass integer property"); }
-static void ALhighpass_getParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid high-pass integer-vector property"); }
+static void ALhighpass_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(val))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer property 0x%04x", param); }
+static void ALhighpass_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(vals))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer-vector property 0x%04x", param); }
static void ALhighpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val)
{
switch(param)
@@ -532,7 +532,7 @@ static void ALhighpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum p
break;
default:
- alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid high-pass float property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass float property 0x%04x", param);
}
}
static void ALhighpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals)
@@ -541,43 +541,43 @@ static void ALhighpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum
DEFINE_ALFILTER_VTABLE(ALhighpass);
-static void ALbandpass_setParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid band-pass integer property"); }
-static void ALbandpass_setParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid band-pass integer-vector property"); }
+static void ALbandpass_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint UNUSED(val))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer property 0x%04x", param); }
+static void ALbandpass_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALint *UNUSED(vals))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer-vector property 0x%04x", param); }
static void ALbandpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val)
{
switch(param)
{
case AL_BANDPASS_GAIN:
if(!(val >= AL_BANDPASS_MIN_GAIN && val <= AL_BANDPASS_MAX_GAIN))
- SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "Band-pass gain out of range",);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Band-pass gain out of range");
filter->Gain = val;
break;
case AL_BANDPASS_GAINHF:
if(!(val >= AL_BANDPASS_MIN_GAINHF && val <= AL_BANDPASS_MAX_GAINHF))
- SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "Band-pass gainhf out of range",);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Band-pass gainhf out of range");
filter->GainHF = val;
break;
case AL_BANDPASS_GAINLF:
if(!(val >= AL_BANDPASS_MIN_GAINLF && val <= AL_BANDPASS_MAX_GAINLF))
- SETERR_RETURN(context, AL_INVALID_VALUE, filter->id, "Band-pass gainlf out of range",);
+ SETERR_RETURN(context, AL_INVALID_VALUE,, "Band-pass gainlf out of range");
filter->GainLF = val;
break;
default:
- alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid band-pass float property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass float property 0x%04x", param);
}
}
static void ALbandpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals)
{ ALbandpass_setParamf(filter, context, param, vals[0]); }
-static void ALbandpass_getParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid band-pass integer property"); }
-static void ALbandpass_getParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid band-pass integer-vector property"); }
+static void ALbandpass_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(val))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer property 0x%04x", param); }
+static void ALbandpass_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(vals))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer-vector property 0x%04x", param); }
static void ALbandpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val)
{
switch(param)
@@ -595,7 +595,7 @@ static void ALbandpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum p
break;
default:
- alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid band-pass float property");
+ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass float property 0x%04x", param);
}
}
static void ALbandpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals)
@@ -604,23 +604,23 @@ static void ALbandpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum
DEFINE_ALFILTER_VTABLE(ALbandpass);
-static void ALnullfilter_setParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); }
-static void ALnullfilter_setParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); }
-static void ALnullfilter_setParamf(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALfloat UNUSED(val))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); }
-static void ALnullfilter_setParamfv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), const ALfloat *UNUSED(vals))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); }
-
-static void ALnullfilter_getParami(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); }
-static void ALnullfilter_getParamiv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); }
-static void ALnullfilter_getParamf(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALfloat *UNUSED(val))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); }
-static void ALnullfilter_getParamfv(ALfilter *filter, ALCcontext *context, ALenum UNUSED(param), ALfloat *UNUSED(vals))
-{ alSetError(context, AL_INVALID_ENUM, filter->id, "Invalid null filter property"); }
+static void ALnullfilter_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint UNUSED(val))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+static void ALnullfilter_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALint *UNUSED(vals))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+static void ALnullfilter_setParamf(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALfloat UNUSED(val))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+static void ALnullfilter_setParamfv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALfloat *UNUSED(vals))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+
+static void ALnullfilter_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(val))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+static void ALnullfilter_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(vals))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+static void ALnullfilter_getParamf(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALfloat *UNUSED(val))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
+static void ALnullfilter_getParamfv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALfloat *UNUSED(vals))
+{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); }
DEFINE_ALFILTER_VTABLE(ALnullfilter);
diff --git a/OpenAL32/alListener.c b/OpenAL32/alListener.c
index 51ab6fc9..6d1db2fb 100644
--- a/OpenAL32/alListener.c
+++ b/OpenAL32/alListener.c
@@ -48,15 +48,14 @@ AL_API ALvoid AL_APIENTRY alListenerf(ALenum param, ALfloat value)
{
case AL_GAIN:
if(!(value >= 0.0f && isfinite(value)))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Listener gain out of range", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "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_GOTO(context, AL_INVALID_VALUE, 0, "Listener meters per unit out of range",
- done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener meters per unit out of range");
context->MetersPerUnit = value;
if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire))
UpdateContextProps(context);
@@ -88,7 +87,7 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat val
{
case AL_POSITION:
if(!(isfinite(value1) && isfinite(value2) && isfinite(value3)))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Listener position out of range", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener position out of range");
listener->Position[0] = value1;
listener->Position[1] = value2;
listener->Position[2] = value3;
@@ -97,7 +96,7 @@ AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat val
case AL_VELOCITY:
if(!(isfinite(value1) && isfinite(value2) && isfinite(value3)))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Listener velocity out of range", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener velocity out of range");
listener->Velocity[0] = value1;
listener->Velocity[1] = value2;
listener->Velocity[2] = value3;
@@ -140,13 +139,13 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values)
listener = context->Listener;
WriteLock(&context->PropLock);
- if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, 0, "NULL pointer", done);
+ if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer");
switch(param)
{
case AL_ORIENTATION:
if(!(isfinite(values[0]) && isfinite(values[1]) && isfinite(values[2]) &&
isfinite(values[3]) && isfinite(values[4]) && isfinite(values[5])))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Listener orientation out of range", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener orientation out of range");
/* AT then UP */
listener->Forward[0] = values[0];
listener->Forward[1] = values[1];
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index c60b6a01..898e54d6 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -453,8 +453,7 @@ static ALint Int64ValsByProp(ALenum prop)
#define CHECKVAL(x) do { \
if(!(x)) \
{ \
- alSetError(Context, AL_INVALID_VALUE, Source->id, \
- "Value out of range"); \
+ alSetError(Context, AL_INVALID_VALUE, "Value out of range"); \
return AL_FALSE; \
} \
} while(0)
@@ -481,8 +480,8 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p
case AL_SEC_OFFSET_LATENCY_SOFT:
case AL_SEC_OFFSET_CLOCK_SOFT:
/* Query only */
- SETERR_RETURN(Context, AL_INVALID_OPERATION, Source->id,
- "Setting read-only source property", AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE,
+ "Setting read-only source property 0x%04x", prop);
case AL_PITCH:
CHECKVAL(*values >= 0.0f);
@@ -606,8 +605,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p
{
WriteUnlock(&Source->queue_lock);
ALCdevice_Unlock(Context->Device);
- SETERR_RETURN(Context, AL_INVALID_VALUE, Source->id, "Invalid offset",
- AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid offset");
}
WriteUnlock(&Source->queue_lock);
}
@@ -700,7 +698,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p
}
ERR("Unexpected property: 0x%04x\n", prop);
- SETERR_RETURN(Context, AL_INVALID_ENUM, Source->id, "Invalid source float property", AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source float property 0x%04x", prop);
}
static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALint *values)
@@ -722,8 +720,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
case AL_SAMPLE_LENGTH_SOFT:
case AL_SEC_LENGTH_SOFT:
/* Query only */
- SETERR_RETURN(Context, AL_INVALID_OPERATION, Source->id,
- "Setting read-only source property", AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE,
+ "Setting read-only source property 0x%04x", prop);
case AL_SOURCE_RELATIVE:
CHECKVAL(*values == AL_FALSE || *values == AL_TRUE);
@@ -763,8 +761,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
if(!(*values == 0 || (buffer=LookupBuffer(device, *values)) != NULL))
{
UnlockBuffersRead(device);
- SETERR_RETURN(Context, AL_INVALID_VALUE, Source->id, "Invalid buffer ID",
- AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid buffer ID %u",
+ *values);
}
WriteLock(&Source->queue_lock);
@@ -773,8 +771,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
{
WriteUnlock(&Source->queue_lock);
UnlockBuffersRead(device);
- SETERR_RETURN(Context, AL_INVALID_OPERATION, Source->id,
- "Setting non-persistently mapped buffer", AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE,
+ "Setting non-persistently mapped buffer %u", buffer->id);
}
else
{
@@ -783,8 +781,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
{
WriteUnlock(&Source->queue_lock);
UnlockBuffersRead(device);
- SETERR_RETURN(Context, AL_INVALID_OPERATION, Source->id,
- "Setting buffer on playing or paused source", AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE,
+ "Setting buffer on playing or paused source %u", Source->id);
}
}
@@ -849,8 +847,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
{
WriteUnlock(&Source->queue_lock);
ALCdevice_Unlock(Context->Device);
- SETERR_RETURN(Context, AL_INVALID_VALUE, Source->id,
- "Invalid source offset", AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE,
+ "Invalid source offset");
}
WriteUnlock(&Source->queue_lock);
}
@@ -863,8 +861,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
if(!(*values == 0 || (filter=LookupFilter(device, *values)) != NULL))
{
UnlockFiltersRead(device);
- SETERR_RETURN(Context, AL_INVALID_VALUE, Source->id, "Invalid filter ID",
- AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid filter ID %u",
+ *values);
}
if(!filter)
@@ -946,16 +944,24 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
case AL_AUXILIARY_SEND_FILTER:
LockEffectSlotsRead(Context);
+ if(!(values[0] == 0 || (slot=LookupEffectSlot(Context, values[0])) != NULL))
+ {
+ UnlockEffectSlotsRead(Context);
+ SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid effect ID %u",
+ values[0]);
+ }
+ if(!((ALuint)values[1] < (ALuint)device->NumAuxSends))
+ {
+ UnlockEffectSlotsRead(Context);
+ SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid send %u", values[1]);
+ }
LockFiltersRead(device);
- if(!((ALuint)values[1] < (ALuint)device->NumAuxSends &&
- (values[0] == 0 || (slot=LookupEffectSlot(Context, values[0])) != NULL) &&
- (values[2] == 0 || (filter=LookupFilter(device, values[2])) != NULL)))
+ if(!(values[2] == 0 || (filter=LookupFilter(device, values[2])) != NULL))
{
UnlockFiltersRead(device);
UnlockEffectSlotsRead(Context);
- /* TODO: Fix message */
- SETERR_RETURN(Context, AL_INVALID_VALUE, Source->id, "Invalid send parameter",
- AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid filter ID %u",
+ values[2]);
}
if(!filter)
@@ -1054,8 +1060,8 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
}
ERR("Unexpected property: 0x%04x\n", prop);
- SETERR_RETURN(Context, AL_INVALID_ENUM, Source->id, "Invalid source integer property",
- AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer property 0x%04x",
+ prop);
}
static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALint64SOFT *values)
@@ -1075,8 +1081,8 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp
case AL_SAMPLE_LENGTH_SOFT:
case AL_SEC_LENGTH_SOFT:
/* Query only */
- SETERR_RETURN(Context, AL_INVALID_OPERATION, Source->id,
- "Setting read-only source property", AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE,
+ "Setting read-only source property 0x%04x", prop);
/* 1x int */
case AL_SOURCE_RELATIVE:
@@ -1160,8 +1166,8 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp
}
ERR("Unexpected property: 0x%04x\n", prop);
- SETERR_RETURN(Context, AL_INVALID_ENUM, Source->id, "Invalid source integer64 property",
- AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer64 property 0x%04x",
+ prop);
}
#undef CHECKVAL
@@ -1358,8 +1364,8 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p
}
ERR("Unexpected property: 0x%04x\n", prop);
- SETERR_RETURN(Context, AL_INVALID_ENUM, Source->id, "Invalid source double property",
- AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source double property 0x%04x",
+ prop);
}
static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint *values)
@@ -1603,8 +1609,8 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
}
ERR("Unexpected property: 0x%04x\n", prop);
- SETERR_RETURN(Context, AL_INVALID_ENUM, Source->id, "Invalid source integer property",
- AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer property 0x%04x",
+ prop);
}
static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64 *values)
@@ -1736,8 +1742,8 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp
}
ERR("Unexpected property: 0x%04x\n", prop);
- SETERR_RETURN(Context, AL_INVALID_ENUM, Source->id, "Invalid source integer64 property",
- AL_FALSE);
+ SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer64 property 0x%04x",
+ prop);
}
@@ -1752,7 +1758,7 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources)
if(!context) return;
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Generating negative sources", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Generating %d sources", n);
device = context->Device;
for(cur = 0;cur < n;cur++)
{
@@ -1760,7 +1766,7 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources)
if(!source)
{
alDeleteSources(cur, sources);
- SETERR_GOTO(context, AL_OUT_OF_MEMORY,0, "Failed to allocate source object", done);
+ SETERR_GOTO(context, AL_OUT_OF_MEMORY, done, "Failed to allocate source object");
}
InitSourceParams(source, device->NumAuxSends);
@@ -1774,7 +1780,7 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources)
al_free(source);
alDeleteSources(cur, sources);
- SETERR_GOTO(context, err, 0, "Failed to set source ID", done);
+ SETERR_GOTO(context, err, done, "Failed to set source ID");
}
sources[cur] = source->id;
@@ -1797,13 +1803,13 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources)
LockSourcesWrite(context);
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Deleting negative sources", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d sources", n);
/* Check that all Sources are valid */
for(i = 0;i < n;i++)
{
if(LookupSource(context, sources[i]) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, sources[i], "Invalid source ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]);
}
device = context->Device;
for(i = 0;i < n;i++)
@@ -1863,9 +1869,9 @@ AL_API ALvoid AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value)
WriteLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(FloatValsByProp(param) == 1))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid float property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid float property 0x%04x", param);
else
SetSourcefv(Source, Context, param, &value);
UnlockSourcesRead(Context);
@@ -1885,9 +1891,9 @@ AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1
WriteLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(FloatValsByProp(param) == 3))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid 3-float property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid 3-float property 0x%04x", param);
else
{
ALfloat fvals[3] = { value1, value2, value3 };
@@ -1910,11 +1916,11 @@ AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat
WriteLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(FloatValsByProp(param) > 0))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid float-vector property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid float-vector property 0x%04x", param);
else
SetSourcefv(Source, Context, param, values);
UnlockSourcesRead(Context);
@@ -1935,9 +1941,9 @@ AL_API ALvoid AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble va
WriteLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(DoubleValsByProp(param) == 1))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid double property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid double property 0x%04x", param);
else
{
ALfloat fval = (ALfloat)value;
@@ -1960,9 +1966,9 @@ AL_API ALvoid AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble v
WriteLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(DoubleValsByProp(param) == 3))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid 3-double property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid 3-double property 0x%04x", param);
else
{
ALfloat fvals[3] = { (ALfloat)value1, (ALfloat)value2, (ALfloat)value3 };
@@ -1986,11 +1992,11 @@ AL_API ALvoid AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdo
WriteLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!((count=DoubleValsByProp(param)) > 0 && count <= 6))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid double-vector property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid double-vector property 0x%04x", param);
else
{
ALfloat fvals[6];
@@ -2018,9 +2024,9 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value)
WriteLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(IntValsByProp(param) == 1))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid integer property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid integer property 0x%04x", param);
else
SetSourceiv(Source, Context, param, &value);
UnlockSourcesRead(Context);
@@ -2040,9 +2046,9 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, AL
WriteLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(IntValsByProp(param) == 3))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid 3-integer property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid 3-integer property 0x%04x", param);
else
{
ALint ivals[3] = { value1, value2, value3 };
@@ -2065,11 +2071,11 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *val
WriteLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(IntValsByProp(param) > 0))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid integer-vector property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid integer-vector property 0x%04x", param);
else
SetSourceiv(Source, Context, param, values);
UnlockSourcesRead(Context);
@@ -2090,9 +2096,9 @@ AL_API ALvoid AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SO
WriteLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(Int64ValsByProp(param) == 1))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid integer64 property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid integer64 property 0x%04x", param);
else
SetSourcei64v(Source, Context, param, &value);
UnlockSourcesRead(Context);
@@ -2112,9 +2118,9 @@ AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOF
WriteLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(Int64ValsByProp(param) == 3))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid 3-integer64 property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid 3-integer64 property 0x%04x", param);
else
{
ALint64SOFT i64vals[3] = { value1, value2, value3 };
@@ -2137,11 +2143,11 @@ AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALin
WriteLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(Int64ValsByProp(param) > 0))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid integer64-vector property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid integer64-vector property 0x%04x", param);
else
SetSourcei64v(Source, Context, param, values);
UnlockSourcesRead(Context);
@@ -2162,11 +2168,11 @@ AL_API ALvoid AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *val
ReadLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!value)
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(FloatValsByProp(param) == 1))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid float property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid float property 0x%04x", param);
else
{
ALdouble dval;
@@ -2191,11 +2197,11 @@ AL_API ALvoid AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *va
ReadLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(value1 && value2 && value3))
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(FloatValsByProp(param) == 3))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid 3-float property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid 3-float property 0x%04x", param);
else
{
ALdouble dvals[3];
@@ -2225,11 +2231,11 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *va
ReadLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!((count=FloatValsByProp(param)) > 0 && count <= 6))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid float-vector property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid float-vector property 0x%04x", param);
else
{
ALdouble dvals[6];
@@ -2258,11 +2264,11 @@ AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble *
ReadLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!value)
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(DoubleValsByProp(param) == 1))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid double property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid double property 0x%04x", param);
else
GetSourcedv(Source, Context, param, value);
UnlockSourcesRead(Context);
@@ -2282,11 +2288,11 @@ AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble
ReadLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(value1 && value2 && value3))
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(DoubleValsByProp(param) == 3))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid 3-double property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid 3-double property 0x%04x", param);
else
{
ALdouble dvals[3];
@@ -2314,11 +2320,11 @@ AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble
ReadLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(DoubleValsByProp(param) > 0))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid double-vector property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid double-vector property 0x%04x", param);
else
GetSourcedv(Source, Context, param, values);
UnlockSourcesRead(Context);
@@ -2339,11 +2345,11 @@ AL_API ALvoid AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value
ReadLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!value)
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(IntValsByProp(param) == 1))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid integer property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid integer property 0x%04x", param);
else
GetSourceiv(Source, Context, param, value);
UnlockSourcesRead(Context);
@@ -2364,11 +2370,11 @@ AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1
ReadLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(value1 && value2 && value3))
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(IntValsByProp(param) == 3))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid 3-integer property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid 3-integer property 0x%04x", param);
else
{
ALint ivals[3];
@@ -2397,11 +2403,11 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values
ReadLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(IntValsByProp(param) > 0))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid integer-vector property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid integer-vector property 0x%04x", param);
else
GetSourceiv(Source, Context, param, values);
UnlockSourcesRead(Context);
@@ -2422,11 +2428,11 @@ AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64S
ReadLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!value)
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(Int64ValsByProp(param) == 1))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid integer64 property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid integer64 property 0x%04x", param);
else
GetSourcei64v(Source, Context, param, value);
UnlockSourcesRead(Context);
@@ -2446,11 +2452,11 @@ AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64
ReadLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!(value1 && value2 && value3))
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(Int64ValsByProp(param) == 3))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid 3-integer64 property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid 3-integer64 property 0x%04x", param);
else
{
ALint64 i64vals[3];
@@ -2478,11 +2484,11 @@ AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64
ReadLock(&Context->PropLock);
LockSourcesRead(Context);
if((Source=LookupSource(Context, source)) == NULL)
- alSetError(Context, AL_INVALID_NAME, source, "Invalid source ID");
+ alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source);
else if(!values)
- alSetError(Context, AL_INVALID_VALUE, source, "NULL pointer");
+ alSetError(Context, AL_INVALID_VALUE, "NULL pointer");
else if(!(Int64ValsByProp(param) > 0))
- alSetError(Context, AL_INVALID_ENUM, source, "Invalid integer64-vector property");
+ alSetError(Context, AL_INVALID_ENUM, "Invalid integer64-vector property 0x%04x", param);
else
GetSourcei64v(Source, Context, param, values);
UnlockSourcesRead(Context);
@@ -2509,11 +2515,11 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
LockSourcesRead(context);
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Playing negative sources", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Playing %d sources", n);
for(i = 0;i < n;i++)
{
if(!LookupSource(context, sources[i]))
- SETERR_GOTO(context, AL_INVALID_NAME, sources[i], "Invalid source ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]);
}
device = context->Device;
@@ -2536,7 +2542,8 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
if(context->MaxVoices >= newcount)
{
ALCdevice_Unlock(device);
- SETERR_GOTO(context, AL_OUT_OF_MEMORY, 0, "Max voice count overflow", done);
+ SETERR_GOTO(context, AL_OUT_OF_MEMORY, done,
+ "Overflow increasing voice count %d -> %d", context->MaxVoices, newcount);
}
AllocateVoices(context, newcount, device->NumAuxSends);
}
@@ -2696,11 +2703,11 @@ AL_API ALvoid AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources)
LockSourcesRead(context);
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Pausing negative sources", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Pausing %d sources", n);
for(i = 0;i < n;i++)
{
if(!LookupSource(context, sources[i]))
- SETERR_GOTO(context, AL_INVALID_NAME, sources[i], "Invalid source ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]);
}
device = context->Device;
@@ -2743,11 +2750,11 @@ AL_API ALvoid AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources)
LockSourcesRead(context);
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Stopping negative sources", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Stopping %d sources", n);
for(i = 0;i < n;i++)
{
if(!LookupSource(context, sources[i]))
- SETERR_GOTO(context, AL_INVALID_NAME, sources[i], "Invalid source ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]);
}
device = context->Device;
@@ -2793,11 +2800,11 @@ AL_API ALvoid AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources)
LockSourcesRead(context);
if(!(n >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Rewinding negative sources", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Rewinding %d sources", n);
for(i = 0;i < n;i++)
{
if(!LookupSource(context, sources[i]))
- SETERR_GOTO(context, AL_INVALID_NAME, sources[i], "Invalid source ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]);
}
device = context->Device;
@@ -2847,16 +2854,16 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu
LockSourcesRead(context);
if(!(nb >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, src, "Queueing negative buffers", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Queueing %d buffers", nb);
if((source=LookupSource(context, src)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, src, "Invalid source ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", src);
WriteLock(&source->queue_lock);
if(source->SourceType == AL_STATIC)
{
WriteUnlock(&source->queue_lock);
/* Can't queue on a Static Source */
- SETERR_GOTO(context, AL_INVALID_OPERATION, src, "Queueing onto a static source", done);
+ SETERR_GOTO(context, AL_INVALID_OPERATION, done, "Queueing onto static source %u", src);
}
/* Check for a valid Buffer, for its frequency and format */
@@ -2881,7 +2888,8 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu
if(buffers[i] && (buffer=LookupBuffer(device, buffers[i])) == NULL)
{
WriteUnlock(&source->queue_lock);
- SETERR_GOTO(context, AL_INVALID_NAME, src, "Invalid buffer ID", buffer_error);
+ SETERR_GOTO(context, AL_INVALID_NAME, buffer_error, "Queueing invalid buffer ID %u",
+ buffers[i]);
}
if(!BufferListStart)
@@ -2911,8 +2919,8 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu
if(buffer->MappedAccess != 0 && !(buffer->MappedAccess&AL_MAP_PERSISTENT_BIT_SOFT))
{
WriteUnlock(&source->queue_lock);
- SETERR_GOTO(context, AL_INVALID_OPERATION, src,
- "Queueing non-persistently mapped buffer", buffer_error);
+ SETERR_GOTO(context, AL_INVALID_OPERATION, buffer_error,
+ "Queueing non-persistently mapped buffer %u", buffer->id);
}
if(BufferFmt == NULL)
@@ -2922,8 +2930,7 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu
BufferFmt->OriginalType != buffer->OriginalType)
{
WriteUnlock(&source->queue_lock);
- alSetError(context, AL_INVALID_OPERATION, src,
- "Queueing buffer with mismatched format");
+ alSetError(context, AL_INVALID_OPERATION, "Queueing buffer with mismatched format");
buffer_error:
/* A buffer failed (invalid ID or format), so unlock and release
@@ -2994,10 +3001,9 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint
LockSourcesRead(context);
if(!(nb >= 0))
- SETERR_GOTO(context, AL_INVALID_VALUE, src, "Unqueueing negative buffers", done);
-
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing %d buffers", nb);
if((source=LookupSource(context, src)) == NULL)
- SETERR_GOTO(context, AL_INVALID_NAME, src, "Invalid source ID", done);
+ SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", src);
/* Nothing to unqueue. */
if(nb == 0) goto done;
@@ -3006,13 +3012,13 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint
if(source->Looping)
{
WriteUnlock(&source->queue_lock);
- SETERR_GOTO(context, AL_INVALID_VALUE, src, "Unqueueing from a looping source", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing from looping source %u", src);
}
if(source->SourceType != AL_STREAMING)
{
WriteUnlock(&source->queue_lock);
- SETERR_GOTO(context, AL_INVALID_VALUE, src, "Unqueueing from a non-streaming source",
- done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing from a non-streaming source %u",
+ src);
}
/* Find the new buffer queue head */
@@ -3034,7 +3040,7 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint
if(i != nb)
{
WriteUnlock(&source->queue_lock);
- SETERR_GOTO(context, AL_INVALID_VALUE, src, "Unqueueing pending buffers", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing pending buffers");
}
/* Swap it, and cut the new head from the old. */
diff --git a/OpenAL32/alState.c b/OpenAL32/alState.c
index 9c49b2e8..1d442a1c 100644
--- a/OpenAL32/alState.c
+++ b/OpenAL32/alState.c
@@ -697,14 +697,15 @@ AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value)
if(!context) return;
if(!(value >= 0.0f && isfinite(value)))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Doppler factor out of range", done);
-
- WriteLock(&context->PropLock);
- context->DopplerFactor = value;
- DO_UPDATEPROPS();
- WriteUnlock(&context->PropLock);
+ alSetError(context, AL_INVALID_VALUE, "Doppler factor out of range");
+ else
+ {
+ WriteLock(&context->PropLock);
+ context->DopplerFactor = value;
+ DO_UPDATEPROPS();
+ WriteUnlock(&context->PropLock);
+ }
-done:
ALCcontext_DecRef(context);
}
@@ -727,14 +728,15 @@ AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value)
}
if(!(value >= 0.0f && isfinite(value)))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Doppler velocity out of range", done);
-
- WriteLock(&context->PropLock);
- context->DopplerVelocity = value;
- DO_UPDATEPROPS();
- WriteUnlock(&context->PropLock);
+ alSetError(context, AL_INVALID_VALUE, "Doppler velocity out of range");
+ else
+ {
+ WriteLock(&context->PropLock);
+ context->DopplerVelocity = value;
+ DO_UPDATEPROPS();
+ WriteUnlock(&context->PropLock);
+ }
-done:
ALCcontext_DecRef(context);
}
@@ -746,14 +748,15 @@ AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat value)
if(!context) return;
if(!(value > 0.0f && isfinite(value)))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Speed of sound out of range", done);
-
- WriteLock(&context->PropLock);
- context->SpeedOfSound = value;
- DO_UPDATEPROPS();
- WriteUnlock(&context->PropLock);
+ alSetError(context, AL_INVALID_VALUE, "Speed of sound out of range");
+ else
+ {
+ WriteLock(&context->PropLock);
+ context->SpeedOfSound = value;
+ DO_UPDATEPROPS();
+ WriteUnlock(&context->PropLock);
+ }
-done:
ALCcontext_DecRef(context);
}
@@ -768,15 +771,16 @@ AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value)
value == AL_LINEAR_DISTANCE || value == AL_LINEAR_DISTANCE_CLAMPED ||
value == AL_EXPONENT_DISTANCE || value == AL_EXPONENT_DISTANCE_CLAMPED ||
value == AL_NONE))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Distance model out of range", done);
-
- WriteLock(&context->PropLock);
- context->DistanceModel = value;
- if(!context->SourceDistanceModel)
- DO_UPDATEPROPS();
- WriteUnlock(&context->PropLock);
+ alSetError(context, AL_INVALID_VALUE, "Distance model out of range");
+ else
+ {
+ WriteLock(&context->PropLock);
+ context->DistanceModel = value;
+ if(!context->SourceDistanceModel)
+ DO_UPDATEPROPS();
+ WriteUnlock(&context->PropLock);
+ }
-done:
ALCcontext_DecRef(context);
}
@@ -825,7 +829,7 @@ AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index)
{
case AL_RESAMPLER_NAME_SOFT:
if(index < 0 || (size_t)index >= COUNTOF(ResamplerNames))
- SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Resampler name index out of range", done);
+ SETERR_GOTO(context, AL_INVALID_VALUE, done, "Resampler name index out of range");
value = ResamplerNames[index];
break;
@@ -835,7 +839,6 @@ AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index)
done:
ALCcontext_DecRef(context);
-
return value;
}
diff --git a/OpenAL32/event.c b/OpenAL32/event.c
index 06db8713..3b70c9f3 100644
--- a/OpenAL32/event.c
+++ b/OpenAL32/event.c
@@ -17,9 +17,9 @@ AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, A
context = GetContextRef();
if(!context) return;
- if(count < 0) SETERR_GOTO(context, AL_INVALID_VALUE, 0, "Controlling negative events", done);
+ if(count < 0) SETERR_GOTO(context, AL_INVALID_VALUE, done, "Controlling %d events", count);
if(count == 0) goto done;
- if(!types) SETERR_GOTO(context, AL_INVALID_VALUE, 0, "NULL pointer", done);
+ if(!types) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer");
for(i = 0;i < count;i++)
{
@@ -34,7 +34,7 @@ AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, A
else if(types[i] == AL_EVENT_TYPE_DEPRECATED_SOFT)
flags |= EventType_Deprecated;
else
- SETERR_GOTO(context, AL_INVALID_ENUM, 0, "Invalid event type", done);
+ SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid event type 0x%04x", types[i]);
}
almtx_lock(&context->EventLock);