AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots) { ALCcontext *Context; Context = GetContextRef(); if(!Context) return; if(n < 0 || IsBadWritePtr((void*)effectslots, n * sizeof(ALuint))) alSetError(Context, AL_INVALID_VALUE); else { ALenum err; ALsizei i; err = ResizeEffectSlotArray(Context, n); if(err != AL_NO_ERROR) { alSetError(Context, err); n = 0; } for(i = 0;i < n;i++) { ALeffectslot *slot = calloc(1, sizeof(ALeffectslot)); if(!slot || InitEffectSlot(slot) != AL_NO_ERROR) { free(slot); // We must have run out or memory alSetError(Context, AL_OUT_OF_MEMORY); alDeleteAuxiliaryEffectSlots(i, effectslots); break; } LockContext(Context); err = ResizeEffectSlotArray(Context, 1); if(err == AL_NO_ERROR) Context->ActiveEffectSlots[Context->ActiveEffectSlotCount++] = slot; UnlockContext(Context); if(err == AL_NO_ERROR) err = NewThunkEntry(&slot->effectslot); if(err == AL_NO_ERROR) err = InsertUIntMapEntry(&Context->EffectSlotMap, slot->effectslot, slot); if(err != AL_NO_ERROR) { RemoveEffectSlotArray(Context, slot); FreeThunkEntry(slot->effectslot); ALeffectState_Destroy(slot->EffectState); free(slot); alSetError(Context, err); alDeleteAuxiliaryEffectSlots(i, effectslots); break; } effectslots[i] = slot->effectslot; } } ALCcontext_DecRef(Context); }
AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters) { ALCcontext *Context; ALfilter *Filter; ALsizei i; Context = GetContextRef(); if(!Context) return; al_try { ALCdevice *device = Context->Device; CHECK_VALUE(Context, n >= 0); for(i = 0;i < n;i++) { if(filters[i] && LookupFilter(device, filters[i]) == NULL) al_throwerr(Context, AL_INVALID_NAME); } for(i = 0;i < n;i++) { if((Filter=RemoveFilter(device, filters[i])) == NULL) continue; FreeThunkEntry(Filter->id); memset(Filter, 0, sizeof(*Filter)); free(Filter); } } al_endtry; ALCcontext_DecRef(Context); }
AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects) { ALCcontext *Context; ALeffect *Effect; ALsizei i; Context = GetContextRef(); if(!Context) return; al_try { ALCdevice *device = Context->Device; CHECK_VALUE(Context, n >= 0); for(i = 0;i < n;i++) { if(effects[i] && LookupEffect(device, effects[i]) == NULL) al_throwerr(Context, AL_INVALID_NAME); } for(i = 0;i < n;i++) { if((Effect=RemoveEffect(device, effects[i])) == NULL) continue; FreeThunkEntry(Effect->id); memset(Effect, 0, sizeof(*Effect)); free(Effect); } } al_endtry; ALCcontext_DecRef(Context); }
AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters) { ALCdevice *device; ALCcontext *context; ALfilter *filter; ALsizei i; context = GetContextRef(); if(!context) return; if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); device = context->Device; for(i = 0;i < n;i++) { if(filters[i] && LookupFilter(device, filters[i]) == NULL) SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); } for(i = 0;i < n;i++) { if((filter=RemoveFilter(device, filters[i])) == NULL) continue; FreeThunkEntry(filter->id); memset(filter, 0, sizeof(*filter)); free(filter); } done: ALCcontext_DecRef(context); }
ALbuffer *NewBuffer(ALCcontext *context) { ALCdevice *device = context->Device; ALbuffer *buffer; ALenum err; buffer = calloc(1, sizeof(ALbuffer)); if(!buffer) SET_ERROR_AND_RETURN_VALUE(context, AL_OUT_OF_MEMORY, NULL); RWLockInit(&buffer->lock); err = NewThunkEntry(&buffer->id); if(err == AL_NO_ERROR) err = InsertUIntMapEntry(&device->BufferMap, buffer->id, buffer); if(err != AL_NO_ERROR) { FreeThunkEntry(buffer->id); memset(buffer, 0, sizeof(ALbuffer)); free(buffer); SET_ERROR_AND_RETURN_VALUE(context, err, NULL); } return buffer; }
AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects) { ALCdevice *device; ALCcontext *context; ALeffect *effect; ALsizei i; context = GetContextRef(); if(!context) return; if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); device = context->Device; for(i = 0;i < n;i++) { if(effects[i] && LookupEffect(device, effects[i]) == NULL) SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); } for(i = 0;i < n;i++) { if((effect=RemoveEffect(device, effects[i])) == NULL) continue; FreeThunkEntry(effect->id); memset(effect, 0, sizeof(*effect)); free(effect); } done: ALCcontext_DecRef(context); }
AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots) { ALCcontext *context; VECTOR(ALeffectslot*) slotvec; ALsizei cur; ALenum err; context = GetContextRef(); if(!context) return; VECTOR_INIT(slotvec); if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); if(!VECTOR_RESERVE(slotvec, n)) SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); for(cur = 0;cur < n;cur++) { ALeffectslot *slot = al_calloc(16, sizeof(ALeffectslot)); err = AL_OUT_OF_MEMORY; if(!slot || (err=InitEffectSlot(slot)) != AL_NO_ERROR) { al_free(slot); alDeleteAuxiliaryEffectSlots(cur, effectslots); SET_ERROR_AND_GOTO(context, err, done); } err = NewThunkEntry(&slot->id); if(err == AL_NO_ERROR) err = InsertUIntMapEntry(&context->EffectSlotMap, slot->id, slot); if(err != AL_NO_ERROR) { FreeThunkEntry(slot->id); DELETE_OBJ(slot->Params.EffectState); al_free(slot); alDeleteAuxiliaryEffectSlots(cur, effectslots); SET_ERROR_AND_GOTO(context, err, done); } aluInitEffectPanning(slot); VECTOR_PUSH_BACK(slotvec, slot); effectslots[cur] = slot->id; } err = AddEffectSlotArray(context, VECTOR_BEGIN(slotvec), n); if(err != AL_NO_ERROR) { alDeleteAuxiliaryEffectSlots(cur, effectslots); SET_ERROR_AND_GOTO(context, err, done); } done: VECTOR_DEINIT(slotvec); ALCcontext_DecRef(context); }
void DeleteBuffer(ALCdevice *device, ALbuffer *buffer) { RemoveBuffer(device, buffer->id); FreeThunkEntry(buffer->id); free(buffer->data); memset(buffer, 0, sizeof(*buffer)); free(buffer); }
static void ALsfpreset_Destruct(ALsfpreset *self) { ALsizei i; FreeThunkEntry(self->id); self->id = 0; for(i = 0;i < self->NumSounds;i++) DecrementRef(&self->Sounds[i]->ref); free(self->Sounds); self->Sounds = NULL; self->NumSounds = 0; }
AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots) { ALCcontext *context; ALeffectslot *first, *last; ALsizei cur; ALenum err; context = GetContextRef(); if(!context) return; if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); first = last = NULL; for(cur = 0;cur < n;cur++) { ALeffectslot *slot = al_calloc(16, sizeof(ALeffectslot)); err = AL_OUT_OF_MEMORY; if(!slot || (err=InitEffectSlot(slot)) != AL_NO_ERROR) { al_free(slot); alDeleteAuxiliaryEffectSlots(cur, effectslots); SET_ERROR_AND_GOTO(context, err, done); } err = NewThunkEntry(&slot->id); if(err == AL_NO_ERROR) err = InsertUIntMapEntry(&context->EffectSlotMap, slot->id, slot); if(err != AL_NO_ERROR) { FreeThunkEntry(slot->id); DELETE_OBJ(slot->Params.EffectState); al_free(slot); alDeleteAuxiliaryEffectSlots(cur, effectslots); SET_ERROR_AND_GOTO(context, err, done); } aluInitEffectPanning(slot); if(!first) first = slot; if(last) ATOMIC_STORE(&last->next, slot); last = slot; effectslots[cur] = slot->id; } AddEffectSlotList(context, first, last); done: ALCcontext_DecRef(context); }
AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots) { ALCcontext *Context; ALsizei cur = 0; Context = GetContextRef(); if(!Context) return; al_try { ALenum err; CHECK_VALUE(Context, n >= 0); for(cur = 0;cur < n;cur++) { ALeffectslot *slot = al_calloc(16, sizeof(ALeffectslot)); err = AL_OUT_OF_MEMORY; if(!slot || (err=InitEffectSlot(slot)) != AL_NO_ERROR) { al_free(slot); al_throwerr(Context, err); break; } err = NewThunkEntry(&slot->id); if(err == AL_NO_ERROR) err = InsertUIntMapEntry(&Context->EffectSlotMap, slot->id, slot); if(err != AL_NO_ERROR) { FreeThunkEntry(slot->id); ALeffectState_Destroy(slot->EffectState); al_free(slot); al_throwerr(Context, err); } effectslots[cur] = slot->id; } err = AddEffectSlotArray(Context, n, effectslots); if(err != AL_NO_ERROR) al_throwerr(Context, err); } al_catchany() { if(cur > 0) alDeleteAuxiliaryEffectSlots(cur, effectslots); } al_endtry; ALCcontext_DecRef(Context); }
ALvoid ReleaseALFilters(ALCdevice *device) { ALsizei i; for(i = 0;i < device->FilterMap.size;i++) { ALfilter *temp = device->FilterMap.array[i].value; device->FilterMap.array[i].value = NULL; // Release filter structure FreeThunkEntry(temp->id); memset(temp, 0, sizeof(ALfilter)); free(temp); } }
ALvoid ReleaseALEffects(ALCdevice *device) { ALsizei i; for(i = 0;i < device->EffectMap.size;i++) { ALeffect *temp = device->EffectMap.array[i].value; device->EffectMap.array[i].value = NULL; // Release effect structure FreeThunkEntry(temp->id); memset(temp, 0, sizeof(ALeffect)); free(temp); } }
ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context) { ALsizei pos; for(pos = 0;pos < Context->EffectSlotMap.size;pos++) { ALeffectslot *temp = Context->EffectSlotMap.array[pos].value; Context->EffectSlotMap.array[pos].value = NULL; DELETE_OBJ(temp->EffectState); FreeThunkEntry(temp->id); memset(temp, 0, sizeof(ALeffectslot)); al_free(temp); } }
/* * ReleaseALBuffers() * * INTERNAL: Called to destroy any buffers that still exist on the device */ ALvoid ReleaseALBuffers(ALCdevice *device) { ALsizei i; for(i = 0;i < device->BufferMap.size;i++) { ALbuffer *temp = device->BufferMap.array[i].value; device->BufferMap.array[i].value = NULL; free(temp->data); FreeThunkEntry(temp->id); memset(temp, 0, sizeof(ALbuffer)); free(temp); } }
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) { ALCcontext *Context; ALsizei cur = 0; Context = GetContextRef(); if(!Context) return; al_try { ALCdevice *device = Context->Device; ALenum err; CHECK_VALUE(Context, n >= 0); for(cur = 0;cur < n;cur++) { ALeffect *effect = calloc(1, sizeof(ALeffect)); err = AL_OUT_OF_MEMORY; if(!effect || (err=InitEffect(effect)) != AL_NO_ERROR) { free(effect); al_throwerr(Context, err); } err = NewThunkEntry(&effect->id); if(err == AL_NO_ERROR) err = InsertUIntMapEntry(&device->EffectMap, effect->id, effect); if(err != AL_NO_ERROR) { FreeThunkEntry(effect->id); memset(effect, 0, sizeof(ALeffect)); free(effect); al_throwerr(Context, err); } effects[cur] = effect->id; } } al_catchany() { if(cur > 0) alDeleteEffects(cur, effects); } al_endtry; ALCcontext_DecRef(Context); }
AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots) { ALCcontext *Context; ALeffectslot *EffectSlot; ALsizei i; Context = GetContextRef(); if(!Context) return; if(n < 0) alSetError(Context, AL_INVALID_VALUE); else { // Check that all effectslots are valid for(i = 0;i < n;i++) { if((EffectSlot=LookupEffectSlot(Context, effectslots[i])) == NULL) { alSetError(Context, AL_INVALID_NAME); n = 0; break; } else if(EffectSlot->ref != 0) { alSetError(Context, AL_INVALID_OPERATION); n = 0; break; } } // All effectslots are valid for(i = 0;i < n;i++) { // Recheck that the effectslot is valid, because there could be duplicated names if((EffectSlot=RemoveEffectSlot(Context, effectslots[i])) == NULL) continue; FreeThunkEntry(EffectSlot->effectslot); RemoveEffectSlotArray(Context, EffectSlot); ALeffectState_Destroy(EffectSlot->EffectState); memset(EffectSlot, 0, sizeof(ALeffectslot)); free(EffectSlot); } } ALCcontext_DecRef(Context); }
ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context) { ALsizei pos; for(pos = 0;pos < Context->EffectSlotMap.size;pos++) { ALeffectslot *temp = Context->EffectSlotMap.array[pos].value; Context->EffectSlotMap.array[pos].value = NULL; // Release effectslot structure ALeffectState_Destroy(temp->EffectState); FreeThunkEntry(temp->effectslot); memset(temp, 0, sizeof(ALeffectslot)); free(temp); } }
static void ALsoundfont_Destruct(ALsoundfont *self) { ALsizei i; FreeThunkEntry(self->id); self->id = 0; for(i = 0;i < self->NumPresets;i++) { DecrementRef(&self->Presets[i]->ref); self->Presets[i] = NULL; } free(self->Presets); self->Presets = NULL; self->NumPresets = 0; }
AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) { ALCcontext *Context; ALsizei i; Context = GetContextRef(); if(!Context) return; if(n < 0 || IsBadWritePtr((void*)filters, n * sizeof(ALuint))) alSetError(Context, AL_INVALID_VALUE); else { ALCdevice *device = Context->Device; ALenum err; for(i = 0;i < n;i++) { ALfilter *filter = calloc(1, sizeof(ALfilter)); if(!filter) { alSetError(Context, AL_OUT_OF_MEMORY); alDeleteFilters(i, filters); break; } InitFilterParams(filter, AL_FILTER_NULL); err = NewThunkEntry(&filter->filter); if(err == AL_NO_ERROR) err = InsertUIntMapEntry(&device->FilterMap, filter->filter, filter); if(err != AL_NO_ERROR) { FreeThunkEntry(filter->filter); memset(filter, 0, sizeof(ALfilter)); free(filter); alSetError(Context, err); alDeleteFilters(i, filters); break; } filters[i] = filter->filter; } } ALCcontext_DecRef(Context); }
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) { ALCcontext *Context; ALsizei i; Context = GetContextRef(); if(!Context) return; if(n < 0 || IsBadWritePtr((void*)effects, n * sizeof(ALuint))) alSetError(Context, AL_INVALID_VALUE); else { ALCdevice *device = Context->Device; ALenum err; for(i = 0;i < n;i++) { ALeffect *effect = calloc(1, sizeof(ALeffect)); if(!effect || InitEffect(effect) != AL_NO_ERROR) { free(effect); alSetError(Context, AL_OUT_OF_MEMORY); alDeleteEffects(i, effects); break; } err = NewThunkEntry(&effect->effect); if(err == AL_NO_ERROR) err = InsertUIntMapEntry(&device->EffectMap, effect->effect, effect); if(err != AL_NO_ERROR) { FreeThunkEntry(effect->effect); memset(effect, 0, sizeof(ALeffect)); free(effect); alSetError(Context, err); alDeleteEffects(i, effects); break; } effects[i] = effect->effect; } } ALCcontext_DecRef(Context); }
AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) { ALCcontext *Context; ALsizei cur = 0; Context = GetContextRef(); if(!Context) return; al_try { ALCdevice *device = Context->Device; ALenum err; CHECK_VALUE(Context, n >= 0); for(cur = 0;cur < n;cur++) { ALfilter *filter = calloc(1, sizeof(ALfilter)); if(!filter) al_throwerr(Context, AL_OUT_OF_MEMORY); InitFilterParams(filter, AL_FILTER_NULL); err = NewThunkEntry(&filter->id); if(err == AL_NO_ERROR) err = InsertUIntMapEntry(&device->FilterMap, filter->id, filter); if(err != AL_NO_ERROR) { FreeThunkEntry(filter->id); memset(filter, 0, sizeof(ALfilter)); free(filter); al_throwerr(Context, err); } filters[cur] = filter->id; } } al_catchany() { if(cur > 0) alDeleteFilters(cur, filters); } al_endtry; ALCcontext_DecRef(Context); }
AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) { ALCdevice *device; ALCcontext *context; ALsizei cur; context = GetContextRef(); if(!context) return; if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); device = context->Device; for(cur = 0;cur < n;cur++) { ALeffect *effect = calloc(1, sizeof(ALeffect)); ALenum err = AL_OUT_OF_MEMORY; if(!effect || (err=InitEffect(effect)) != AL_NO_ERROR) { free(effect); alDeleteEffects(cur, effects); SET_ERROR_AND_GOTO(context, err, done); } err = NewThunkEntry(&effect->id); if(err == AL_NO_ERROR) err = InsertUIntMapEntry(&device->EffectMap, effect->id, effect); if(err != AL_NO_ERROR) { FreeThunkEntry(effect->id); memset(effect, 0, sizeof(ALeffect)); free(effect); alDeleteEffects(cur, effects); SET_ERROR_AND_GOTO(context, err, done); } effects[cur] = effect->id; } done: ALCcontext_DecRef(context); }
AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) { ALCdevice *device; ALCcontext *context; ALsizei cur = 0; ALenum err; context = GetContextRef(); if(!context) return; if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); device = context->Device; for(cur = 0;cur < n;cur++) { ALfilter *filter = calloc(1, sizeof(ALfilter)); if(!filter) { alDeleteFilters(cur, filters); SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); } InitFilterParams(filter, AL_FILTER_NULL); err = NewThunkEntry(&filter->id); if(err == AL_NO_ERROR) err = InsertUIntMapEntry(&device->FilterMap, filter->id, filter); if(err != AL_NO_ERROR) { FreeThunkEntry(filter->id); memset(filter, 0, sizeof(ALfilter)); free(filter); alDeleteFilters(cur, filters); SET_ERROR_AND_GOTO(context, err, done); } filters[cur] = filter->id; } done: ALCcontext_DecRef(context); }
AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) { ALCdevice *device; ALCcontext *context; ALsizei cur = 0; ALenum err; context = GetContextRef(); if(!context) return; if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); device = context->Device; for(cur = 0; cur < n; cur++) { ALbuffer *buffer = calloc(1, sizeof(ALbuffer)); if(!buffer) { alDeleteBuffers(cur, buffers); SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); } RWLockInit(&buffer->lock); err = NewThunkEntry(&buffer->id); if(err == AL_NO_ERROR) err = InsertUIntMapEntry(&device->BufferMap, buffer->id, buffer); if(err != AL_NO_ERROR) { FreeThunkEntry(buffer->id); memset(buffer, 0, sizeof(ALbuffer)); free(buffer); alDeleteBuffers(cur, buffers); SET_ERROR_AND_GOTO(context, err, done); } buffers[cur] = buffer->id; } done: ALCcontext_DecRef(context); }
AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters) { ALCcontext *Context; ALCdevice *device; ALfilter *ALFilter; ALsizei i; Context = GetContextRef(); if(!Context) return; device = Context->Device; if(n < 0) alSetError(Context, AL_INVALID_VALUE); else { // Check that all filters are valid for(i = 0;i < n;i++) { if(!filters[i]) continue; if(LookupFilter(device->FilterMap, filters[i]) == NULL) { alSetError(Context, AL_INVALID_NAME); n = 0; break; } } for(i = 0;i < n;i++) { // Recheck that the filter is valid, because there could be duplicated names if((ALFilter=RemoveFilter(device->FilterMap, filters[i])) == NULL) continue; FreeThunkEntry(ALFilter->filter); memset(ALFilter, 0, sizeof(ALfilter)); free(ALFilter); } } ALCcontext_DecRef(Context); }
AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects) { ALCcontext *Context; ALCdevice *device; ALeffect *ALEffect; ALsizei i; Context = GetContextRef(); if(!Context) return; device = Context->Device; if(n < 0) alSetError(Context, AL_INVALID_VALUE); else { // Check that all effects are valid for(i = 0;i < n;i++) { if(!effects[i]) continue; if(LookupEffect(device, effects[i]) == NULL) { alSetError(Context, AL_INVALID_NAME); n = 0; break; } } for(i = 0;i < n;i++) { // Recheck that the effect is valid, because there could be duplicated names if((ALEffect=RemoveEffect(device, effects[i])) == NULL) continue; FreeThunkEntry(ALEffect->effect); memset(ALEffect, 0, sizeof(ALeffect)); free(ALEffect); } } ALCcontext_DecRef(Context); }
AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers) { ALCdevice *device; ALCcontext *context; ALbuffer *ALBuf; ALsizei i; context = GetContextRef(); if(!context) return; if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); device = context->Device; for(i = 0; i < n; i++) { if(!buffers[i]) continue; /* Check for valid Buffer ID */ if((ALBuf=LookupBuffer(device, buffers[i])) == NULL) SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); if(ReadRef(&ALBuf->ref) != 0) SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); } for(i = 0; i < n; i++) { if((ALBuf=RemoveBuffer(device, buffers[i])) == NULL) continue; FreeThunkEntry(ALBuf->id); free(ALBuf->data); memset(ALBuf, 0, sizeof(*ALBuf)); free(ALBuf); } done: ALCcontext_DecRef(context); }
AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots) { ALCcontext *context; ALeffectslot *slot; ALsizei i; context = GetContextRef(); if(!context) return; LockEffectSlotsWrite(context); if(!(n >= 0)) SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); for(i = 0;i < n;i++) { if((slot=LookupEffectSlot(context, effectslots[i])) == NULL) SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); if(ReadRef(&slot->ref) != 0) SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); } // All effectslots are valid for(i = 0;i < n;i++) { if((slot=RemoveEffectSlot(context, effectslots[i])) == NULL) continue; FreeThunkEntry(slot->id); RemoveEffectSlotList(context, slot); DeinitEffectSlot(slot); memset(slot, 0, sizeof(*slot)); al_free(slot); } done: UnlockEffectSlotsWrite(context); ALCcontext_DecRef(context); }
AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots) { ALCcontext *Context; ALeffectslot *slot; ALsizei i; Context = GetContextRef(); if(!Context) return; al_try { CHECK_VALUE(Context, n >= 0); for(i = 0;i < n;i++) { if((slot=LookupEffectSlot(Context, effectslots[i])) == NULL) al_throwerr(Context, AL_INVALID_NAME); if(slot->ref != 0) al_throwerr(Context, AL_INVALID_OPERATION); } // All effectslots are valid for(i = 0;i < n;i++) { if((slot=RemoveEffectSlot(Context, effectslots[i])) == NULL) continue; FreeThunkEntry(slot->id); RemoveEffectSlotArray(Context, slot); ALeffectState_Destroy(slot->EffectState); memset(slot, 0, sizeof(*slot)); al_free(slot); } } al_endtry; ALCcontext_DecRef(Context); }