Example #1
0
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;

        DeinitEffectSlot(temp);

        FreeThunkEntry(temp->id);
        memset(temp, 0, sizeof(ALeffectslot));
        al_free(temp);
    }
}
Example #2
0
AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *effectslots)
{
    ALCcontext *context;
    ALeffectslot *slot;
    ALsizei i;

    context = GetContextRef();
    if(!context) return;

    LockEffectSlotList(context);
    if(n < 0)
        SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d effect slots", n);
    if(n == 0) goto done;

    for(i = 0;i < n;i++)
    {
        if((slot=LookupEffectSlot(context, effectslots[i])) == NULL)
            SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u",
                        effectslots[i]);
        if(ReadRef(&slot->ref) != 0)
            SETERR_GOTO(context, AL_INVALID_NAME, done, "Deleting in-use effect slot %u",
                        effectslots[i]);
    }

    // All effectslots are valid
    RemoveActiveEffectSlots(effectslots, n, context);
    for(i = 0;i < n;i++)
    {
        if((slot=LookupEffectSlot(context, effectslots[i])) == NULL)
            continue;
        VECTOR_ELEM(context->EffectSlotList, effectslots[i]-1) = NULL;

        DeinitEffectSlot(slot);

        memset(slot, 0, sizeof(*slot));
        al_free(slot);
    }

done:
    UnlockEffectSlotList(context);
    ALCcontext_DecRef(context);
}
Example #3
0
ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *context)
{
    ALeffectslotPtr *iter = VECTOR_BEGIN(context->EffectSlotList);
    ALeffectslotPtr *end = VECTOR_END(context->EffectSlotList);
    size_t leftover = 0;

    for(;iter != end;iter++)
    {
        ALeffectslot *slot = *iter;
        if(!slot) continue;
        *iter = NULL;

        DeinitEffectSlot(slot);

        memset(slot, 0, sizeof(*slot));
        al_free(slot);
        ++leftover;
    }
    if(leftover > 0)
        WARN("(%p) Deleted "SZFMT" AuxiliaryEffectSlot%s\n", context, leftover, (leftover==1)?"":"s");
}
Example #4
0
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);
}