Exemplo n.º 1
0
/*
    alcGetThreadContext

    Returns the currently active thread-local Context
*/
ALCcontext * ALCAPIENTRY alcGetThreadContext(void)
{
    ALCcontext *pContext = NULL;

    SuspendContext(NULL);

    pContext = tls_get(LocalContext);
    if(pContext && !IsContext(pContext))
    {
        tls_set(LocalContext, NULL);
        pContext = NULL;
    }

    ProcessContext(NULL);

    return pContext;
}
Exemplo n.º 2
0
/*
    alcMakeCurrent

    Makes the given Context the active Context for the current thread
*/
ALCboolean ALCAPIENTRY alcMakeCurrent(ALCcontext *context)
{
    ALboolean bReturn = AL_TRUE;

    SuspendContext(NULL);

    // context must be a valid Context or NULL
    if(context == NULL || IsContext(context))
        tls_set(LocalContext, context);
    else
    {
        alcSetError(ALC_INVALID_CONTEXT);
        bReturn = AL_FALSE;
    }

    ProcessContext(NULL);

    return bReturn;
}
// ---------------------------------------------------------------------------
// CXIMPConfigurationItemBase::ConfigurationStatus()
// ---------------------------------------------------------------------------
//
EXPORT_C CXIMPConfigurationItemBase::TConfigurationStatus 
           CXIMPConfigurationItemBase::ConfigurationStatus( MXIMPPscContext* aContext )
    {
    // Calculate situation
    TInt count = iConfigContexts.Count() + iConfigItems.Count();
    TBool contextFound = IsContext( aContext );
    if( count == 0 )
        {
        return ENotConfiguredAtAll;
        }
    else if( contextFound )
        {
        if( count == 1 )
            {
            return EConfiguredForCtxOnly;
            }
        return EConfiguredForCtxAndOthers;
        }
    return EConfiguredForOtherCtxOnly;
    }
Exemplo n.º 4
0
/*
    alcDestroyContext

    Remove a Context
*/
ALCAPI ALCvoid ALCAPIENTRY alcDestroyContext(ALCcontext *context)
{
    ALCcontext **list;

    InitAL();

    // Lock context list
    SuspendContext(NULL);

    if (IsContext(context))
    {
        // Lock context
        SuspendContext(context);

        ReleaseALSources(context);
        ReleaseALAuxiliaryEffectSlots(context);

        context->Device->Context = NULL;

        list = &g_pContextList;
        while(*list != context)
            list = &(*list)->next;

        *list = (*list)->next;
        g_ulContextCount--;

        // Unlock context
        ProcessContext(context);

        ExitContext(context);

        // Free memory (MUST do this after ProcessContext)
        memset(context, 0, sizeof(ALCcontext));
        free(context);
    }
    else
        SetALCError(ALC_INVALID_CONTEXT);

    ProcessContext(NULL);
}
Exemplo n.º 5
0
/*
    alcMakeContextCurrent

    Makes the given Context the active Context
*/
ALCAPI ALCboolean ALCAPIENTRY alcMakeContextCurrent(ALCcontext *context)
{
    ALCcontext *ALContext;
    ALboolean bReturn = AL_TRUE;

    InitAL();

    SuspendContext(NULL);

    // context must be a valid Context or NULL
    if ((IsContext(context)) || (context == NULL))
    {
        if ((ALContext=alcGetCurrentContext()))
        {
            SuspendContext(ALContext);
            ALContext->InUse=AL_FALSE;
            ProcessContext(ALContext);
        }

        if ((ALContext=context) && (ALContext->Device))
        {
            SuspendContext(ALContext);
            ALContext->InUse=AL_TRUE;
            ProcessContext(ALContext);
        }
    }
    else
    {
        SetALCError(ALC_INVALID_CONTEXT);
        bReturn = AL_FALSE;
    }

    ProcessContext(NULL);

    return bReturn;
}
Exemplo n.º 6
0
/*
    alcDestroyContext

    Remove a Context
*/
ALCAPI ALCvoid ALCAPIENTRY alcDestroyContext(ALCcontext *context)
{
    ALCcontext **list;
    ALuint i;

    if (IsContext(context))
    {
        ALCdevice *Device = context->Device;

        if(Device->NumContexts == 1)
            ALCdevice_StopPlayback(Device);

        SuspendContext(NULL);

        for(i = 0;i < Device->NumContexts-1;i++)
        {
            if(Device->Contexts[i] == context)
            {
                memmove(&Device->Contexts[i], &Device->Contexts[i+1],
                        (Device->NumContexts-i-1) * sizeof(*Device->Contexts));
                break;
            }
        }
        Device->NumContexts--;

        // Lock context
        SuspendContext(context);

        if(context->SourceCount > 0)
        {
#ifdef _DEBUG
            AL_PRINT("alcDestroyContext(): deleting %d Source(s)\n", context->SourceCount);
#endif
            ReleaseALSources(context);
        }
        if(context->AuxiliaryEffectSlotCount > 0)
        {
#ifdef _DEBUG
            AL_PRINT("alcDestroyContext(): deleting %d AuxiliaryEffectSlot(s)\n", context->AuxiliaryEffectSlotCount);
#endif
            ReleaseALAuxiliaryEffectSlots(context);
        }

        list = &g_pContextList;
        while(*list != context)
            list = &(*list)->next;

        *list = (*list)->next;
        g_ulContextCount--;

        // Unlock context
        ProcessContext(context);
        ProcessContext(NULL);

        ExitContext(context);

        // Free memory (MUST do this after ProcessContext)
        memset(context, 0, sizeof(ALCcontext));
        free(context);
    }
    else
        alcSetError(ALC_INVALID_CONTEXT);
}