/** * Makes the specified context the current context. * * @param context the context to make current. */ public static void makeContextCurrent(final Context context) { ALCcontext realContext = null; if (context != null) { realContext = context.realContext; } alc.alcMakeContextCurrent(realContext); }
private final void unlockContext() { if( hasALC_thread_local_context ) { alExt.alcSetThreadContext(null); } else { alc.alcMakeContextCurrent(null); } lock.unlock(); } private final void destroyContext() {
private final void unlockContext() { if( hasALC_thread_local_context ) { alExt.alcSetThreadContext(null); } else { alc.alcMakeContextCurrent(null); } lock.unlock(); } private final void destroyContext() {
/** Shuts down the OpenAL Utility Toolkit; releases and destroys the internal OpenAL context and closes the output device. Must be called from the same thread as alutInit(). Most applications should not need to call this; only those which wish to toggle sound on / off at run time by initializing and un-initializing OpenAL need to call it. */ public static synchronized void alutExit() throws ALException { if (context == null) { throw new ALException("Not initialized"); } alc.alcMakeContextCurrent(null); alc.alcDestroyContext(context); alc.alcCloseDevice(device); context = null; device = null; initializingThread = null; }
private final void lockContext() { lock.lock(); if( hasALC_thread_local_context ) { alExt.alcSetThreadContext(context); } else { alc.alcMakeContextCurrent(context); } final int alcErr = alc.alcGetError(null); if( ALCConstants.ALC_NO_ERROR != alcErr ) { final String err = getThreadName()+": ALCError "+toHexString(alcErr)+" while makeCurrent. "+this; System.err.println(err); Thread.dumpStack(); lock.unlock(); throw new RuntimeException(err); } final int alErr = al.alGetError(); if( ALCConstants.ALC_NO_ERROR != alErr ) { if( DEBUG ) { System.err.println(getThreadName()+": Prev - ALError "+toHexString(alErr)+" @ makeCurrent. "+this); Thread.dumpStack(); } } } private final void unlockContext() {
private final void lockContext() { lock.lock(); if( hasALC_thread_local_context ) { alExt.alcSetThreadContext(context); } else { alc.alcMakeContextCurrent(context); } final int alcErr = alc.alcGetError(null); if( ALCConstants.ALC_NO_ERROR != alcErr ) { final String err = getThreadName()+": ALCError "+toHexString(alcErr)+" while makeCurrent. "+this; System.err.println(err); ExceptionUtils.dumpStack(System.err); lock.unlock(); throw new RuntimeException(err); } final int alErr = al.alGetError(); if( ALCConstants.ALC_NO_ERROR != alErr ) { if( DEBUG ) { System.err.println(getThreadName()+": Prev - ALError "+toHexString(alErr)+" @ makeCurrent. "+this); ExceptionUtils.dumpStack(System.err); } } } private final void unlockContext() {
throw new ALException("Error creating OpenAL context"); alc.alcMakeContextCurrent(c); if (alc.alcGetError(d) != 0) { alc.alcDestroyContext(c);