public void alBufferData(int buffer, int format, ByteBuffer data, int size, int frequency) { joalAl.alBufferData(buffer, format, data, size, frequency); }
public void alDeleteBuffers(int numBuffers, IntBuffer buffers) { joalAl.alDeleteBuffers(numBuffers, buffers); }
public void alDeleteSources(int numSources, IntBuffer sources) { joalAl.alDeleteSources(numSources, sources); }
hasSOFTBufferSamples = al.alIsExtensionPresent(AL_SOFT_buffer_samples); hasALC_thread_local_context = alc.alcIsExtensionPresent(null, ALC_EXT_thread_local_context) || alc.alcIsExtensionPresent(device, ALC_EXT_thread_local_context) ; preferredAudioFormat = new AudioFormat(querySampleRate(), DefaultFormat.sampleSize, DefaultFormat.channelCount, DefaultFormat.signed, DefaultFormat.fixedP, DefaultFormat.planar, DefaultFormat.littleEndian); if( DEBUG ) { System.out.println("ALAudioSink: OpenAL Extensions:"+al.alGetString(ALConstants.AL_EXTENSIONS)); clearPreALError("init."+checkErrIter++); System.out.println("ALAudioSink: Null device OpenAL Extensions:"+alc.alcGetString(null, ALCConstants.ALC_EXTENSIONS)); al.alGenSources(1, alSource, 0); final int err = al.alGetError(); if( ALConstants.AL_NO_ERROR != err ) { alSource = null;
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(); } }
samplesPerChannel, alChannelLayout, alSampleType, bytes); } else { al.alBufferData(alFrame.alBuffer, alFormat, bytes, byteCount, chosenFormat.sampleRate); al.alSourceQueueBuffers(alSource[0], 1, alBufferNames, 0); final int alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while queueing buffer "+toHexString(alBufferNames[0])+". "+this);
int i=0; do { al.alGetSourcei(alSource[0], ALConstants.AL_BUFFERS_PROCESSED, val, 0); alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while quering processed buffers at source. "+this); al.alSourceUnqueueBuffers(alSource[0], releaseBufferCount, buffers, 0); alErr = al.alGetError(); if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while dequeueing "+releaseBufferCount+" buffers. "+this);
al.alGenBuffers(frameGrowAmount, newALBufferNames, 0); final int err = al.alGetError(); if( ALConstants.AL_NO_ERROR != err ) { if( DEBUG ) {
public int alGetSourcei(int source, int param) { IntBuffer ib = BufferUtils.createIntBuffer(1); joalAl.alGetSourcei(source, param, ib); return ib.get(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 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 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 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); } } } }
public int alGenSources() { IntBuffer ib = BufferUtils.createIntBuffer(1); joalAl.alGenSources(1, ib); return ib.get(0); }
public void alSourceStop(int source) { joalAl.alSourceStop(source); }
public void alGenBuffers(int numBuffers, IntBuffer buffers) { joalAl.alGenBuffers(numBuffers, buffers); }
public void alSourcePause(int source) { joalAl.alSourcePause(source); }
public void alSourcePlay(int source) { joalAl.alSourcePlay(source); }
public void alSourceQueueBuffers(int source, int numBuffers, IntBuffer buffers) { joalAl.alSourceQueueBuffers(source, numBuffers, buffers); }
hasSOFTBufferSamples = al.alIsExtensionPresent(AL_SOFT_buffer_samples); hasALC_thread_local_context = alc.alcIsExtensionPresent(null, ALC_EXT_thread_local_context) || alc.alcIsExtensionPresent(device, ALC_EXT_thread_local_context) ; preferredAudioFormat = new AudioFormat(querySampleRate(), DefaultFormat.sampleSize, DefaultFormat.channelCount, DefaultFormat.signed, DefaultFormat.fixedP, DefaultFormat.planar, DefaultFormat.littleEndian); if( DEBUG ) { System.out.println("ALAudioSink: OpenAL Extensions:"+al.alGetString(ALConstants.AL_EXTENSIONS)); clearPreALError("init."+checkErrIter++); System.out.println("ALAudioSink: Null device OpenAL Extensions:"+alc.alcGetString(null, ALCConstants.ALC_EXTENSIONS)); al.alGenSources(1, alSource, 0); final int err = al.alGetError(); if( ALConstants.AL_NO_ERROR != err ) { alSource = null;