public int alGetError() { return joalAl.alGetError(); }
public int alGetError() { return joalAl.alGetError(); }
private final int getSourceState(final boolean ignoreError) { final int[] val = new int[1]; al.alGetSourcei(alSource[0], ALConstants.AL_SOURCE_STATE, val, 0); final int alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) { final String msg = getThreadName()+": ALError "+toHexString(alErr)+" while querying SOURCE_STATE. "+this; if( ignoreError ) { if( DEBUG ) { System.err.println(msg); } } else { throw new RuntimeException(msg); } } return val[0]; }
private boolean checkALError(final String prefix) { final int alcErr = alc.alcGetError(device); final int alErr = al.alGetError(); final boolean ok = ALCConstants.ALC_NO_ERROR == alcErr && ALConstants.AL_NO_ERROR == alErr; if( DEBUG ) { System.err.println("ALAudioSink."+prefix+": ok "+ok+", err [alc "+toHexString(alcErr)+", al "+toHexString(alErr)+"]"); } return ok; }
private boolean checkALError(final String prefix) { final int alcErr = alc.alcGetError(device); final int alErr = al.alGetError(); final boolean ok = ALCConstants.ALC_NO_ERROR == alcErr && ALConstants.AL_NO_ERROR == alErr; if( DEBUG ) { System.err.println("ALAudioSink."+prefix+": ok "+ok+", err [alc "+toHexString(alcErr)+", al "+toHexString(alErr)+"]"); } return ok; }
private final int getSourceState(final boolean ignoreError) { final int[] val = new int[1]; al.alGetSourcei(alSource[0], ALConstants.AL_SOURCE_STATE, val, 0); final int alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) { final String msg = getThreadName()+": ALError "+toHexString(alErr)+" while querying SOURCE_STATE. "+this; if( ignoreError ) { if( DEBUG ) { System.err.println(msg); } } else { throw new RuntimeException(msg); } } return val[0]; }
private final void playImpl() { if( playRequested && ALConstants.AL_PLAYING != getSourceState(false) ) { al.alSourcePlay(alSource[0]); final int alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while start playing. "+this); } } }
private final void playImpl() { if( playRequested && ALConstants.AL_PLAYING != getSourceState(false) ) { al.alSourcePlay(alSource[0]); final int alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while start playing. "+this); } } }
private final void pauseImpl() { if( isPlayingImpl0() ) { playRequested = false; al.alSourcePause(alSource[0]); final int alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while pausing. "+this); } } } private final void stopImpl(final boolean ignoreError) {
private final void pauseImpl() { if( isPlayingImpl0() ) { playRequested = false; al.alSourcePause(alSource[0]); final int alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while pausing. "+this); } } } private final void stopImpl(final boolean ignoreError) {
private final int querySampleRate() { final int sampleRate; final int[] value = new int[1]; alc.alcGetIntegerv(device, ALCConstants.ALC_FREQUENCY, 1, value, 0); final int alcErr = alc.alcGetError(device); final int alErr = al.alGetError(); if ( ALCConstants.ALC_NO_ERROR == alcErr && ALConstants.AL_NO_ERROR == alErr && 0 != value[0] ) { sampleRate = value[0]; } else { sampleRate = DefaultFormat.sampleRate; } if( DEBUG ) { System.err.println("ALAudioSink.querySampleRate: err [alc "+toHexString(alcErr)+", al "+toHexString(alErr)+"], freq: "+value[0]+" -> "+sampleRate); } return sampleRate; }
private final int querySampleRate() { final int sampleRate; final int[] value = new int[1]; alc.alcGetIntegerv(device, ALCConstants.ALC_FREQUENCY, 1, value, 0); final int alcErr = alc.alcGetError(device); final int alErr = al.alGetError(); if ( ALCConstants.ALC_NO_ERROR == alcErr && ALConstants.AL_NO_ERROR == alErr && 0 != value[0] ) { sampleRate = value[0]; } else { sampleRate = DefaultFormat.sampleRate; } if( DEBUG ) { System.err.println("ALAudioSink.querySampleRate: err [alc "+toHexString(alcErr)+", al "+toHexString(alErr)+"], freq: "+value[0]+" -> "+sampleRate); } return sampleRate; }
private final void stopImpl(final boolean ignoreError) { if( ALConstants.AL_STOPPED != getSourceState(ignoreError) ) { playRequested = false; al.alSourceStop(alSource[0]); final int alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) { final String msg = "ALError "+toHexString(alErr)+" while stopping. "+this; if( ignoreError ) { if( DEBUG ) { System.err.println(getThreadName()+": "+msg); } } else { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while stopping. "+this); } } } }
private final void stopImpl(final boolean ignoreError) { if( ALConstants.AL_STOPPED != getSourceState(ignoreError) ) { playRequested = false; al.alSourceStop(alSource[0]); final int alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) { final String msg = "ALError "+toHexString(alErr)+" while stopping. "+this; if( ignoreError ) { if( DEBUG ) { System.err.println(getThreadName()+": "+msg); } } else { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while stopping. "+this); } } } }
private final void dequeueForceAll() { if(DEBUG_TRACE) { System.err.println("< _FLUSH_ <- "+shortString()+" @ "+getThreadName()); } final int[] val=new int[1]; al.alSourcei(alSource[0], ALConstants.AL_BUFFER, 0); // explicit force zero buffer! if(DEBUG_TRACE) { al.alGetSourcei(alSource[0], ALConstants.AL_BUFFERS_PROCESSED, val, 0); } final int alErr = al.alGetError(); while ( !alFramesPlaying.isEmpty() ) { final ALAudioFrame releasedBuffer = alFramesPlaying.get(); if( null == releasedBuffer ) { throw new InternalError("Internal Error: "+this); } alBufferBytesQueued -= releasedBuffer.getByteSize(); if( !alFramesAvail.put(releasedBuffer) ) { throw new InternalError("Internal Error: "+this); } } alBufferBytesQueued = 0; if(DEBUG_TRACE) { System.err.println("<< _FLUSH_ [al "+val[0]+", err "+toHexString(alErr)+"] <- "+shortString()+" @ "+getThreadName()); ExceptionUtils.dumpStack(System.err); } }
private final void dequeueForceAll() { if(DEBUG_TRACE) { System.err.println("< _FLUSH_ <- "+shortString()+" @ "+getThreadName()); } final int[] val=new int[1]; al.alSourcei(alSource[0], ALConstants.AL_BUFFER, 0); // explicit force zero buffer! if(DEBUG_TRACE) { al.alGetSourcei(alSource[0], ALConstants.AL_BUFFERS_PROCESSED, val, 0); } final int alErr = al.alGetError(); while ( !alFramesPlaying.isEmpty() ) { final ALAudioFrame releasedBuffer = alFramesPlaying.get(); if( null == releasedBuffer ) { throw new InternalError("Internal Error: "+this); } alBufferBytesQueued -= releasedBuffer.getByteSize(); if( !alFramesAvail.put(releasedBuffer) ) { throw new InternalError("Internal Error: "+this); } } alBufferBytesQueued = 0; if(DEBUG_TRACE) { System.err.println("<< _FLUSH_ [al "+val[0]+", err "+toHexString(alErr)+"] <- "+shortString()+" @ "+getThreadName()); Thread.dumpStack(); } }
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() {
final int err = al.alGetError(); if( ALConstants.AL_NO_ERROR != err ) { if( DEBUG ) {
final int err = al.alGetError(); if( ALConstants.AL_NO_ERROR != err ) { if( DEBUG ) {