public int alGetSourcei(int source, int param) { IntBuffer ib = BufferUtils.createIntBuffer(1); joalAl.alGetSourcei(source, param, ib); return ib.get(0); }
/** * Gets the number of buffers currently queued on this source. * @return the number of buffers currently queued on this source. */ public int getBuffersQueued() { final int[] result = new int[1]; al.alGetSourcei(sourceID, ALConstants.AL_BUFFERS_QUEUED, result, 0); return result[0]; }
/** * Determines if the position of the source is relative to the listener. * The default is false. * @return true if the position of the source is relative * to the listener, false if the position of the source is relative to the * world. */ public boolean isSourceRelative() { final int[] result = new int[1]; al.alGetSourcei(sourceID, ALConstants.AL_SOURCE_RELATIVE, result, 0); return result[0] == 1; }
/** * Determines whether or not this source is playing. * * @return {@code true} if this source is playing. */ public boolean isPlaying() { final int[] result = new int[1]; al.alGetSourcei(sourceID, ALConstants.AL_SOURCE_STATE, result, 0); return result[0] == ALConstants.AL_PLAYING; }
/** * Gets the number of buffers already processed on this source. * @return the number of buffers already processed on this source. */ public int getBuffersProcessed() { final int[] result = new int[1]; al.alGetSourcei(sourceID, ALConstants.AL_BUFFERS_PROCESSED, result, 0); return result[0]; }
/** * indicates whether looping is turned on or off. * * @return true-looping is on, false-looping is off */ public boolean getLooping() { final boolean result = false; final int[] tmp = new int[1]; al.alGetSourcei(sourceID, ALConstants.AL_LOOPING, tmp, 0); return tmp[0] == ALConstants.AL_TRUE; }
public int alGetSourcei(int source, int param) { IntBuffer ib = BufferUtils.createIntBuffer(1); joalAl.alGetSourcei(source, param, ib); return ib.get(0); }
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 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 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 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); } }
int i=0; do { al.alGetSourcei(alSource[0], ALConstants.AL_BUFFERS_PROCESSED, val, 0); alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) {
int i=0; do { al.alGetSourcei(alSource[0], ALConstants.AL_BUFFERS_PROCESSED, val, 0); alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) {