org.lwjgl.openal.AL11 Java Examples
The following examples show how to use
org.lwjgl.openal.AL11.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SoundPhysics.java From Sound-Physics with GNU General Public License v3.0 | 6 votes |
private static void setEnvironment(int sourceID, float sendGain0, float sendGain1, float sendGain2, float sendGain3, float sendCutoff0, float sendCutoff1, float sendCutoff2, float sendCutoff3, float directCutoff, float directGain) { //Set reverb send filter values and set source to send to all reverb fx slots EFX10.alFilterf(sendFilter0, EFX10.AL_LOWPASS_GAIN, sendGain0); EFX10.alFilterf(sendFilter0, EFX10.AL_LOWPASS_GAINHF, sendCutoff0); AL11.alSource3i(sourceID, EFX10.AL_AUXILIARY_SEND_FILTER, auxFXSlot0, 0, sendFilter0); EFX10.alFilterf(sendFilter1, EFX10.AL_LOWPASS_GAIN, sendGain1); EFX10.alFilterf(sendFilter1, EFX10.AL_LOWPASS_GAINHF, sendCutoff1); AL11.alSource3i(sourceID, EFX10.AL_AUXILIARY_SEND_FILTER, auxFXSlot1, 1, sendFilter1); EFX10.alFilterf(sendFilter2, EFX10.AL_LOWPASS_GAIN, sendGain2); EFX10.alFilterf(sendFilter2, EFX10.AL_LOWPASS_GAINHF, sendCutoff2); AL11.alSource3i(sourceID, EFX10.AL_AUXILIARY_SEND_FILTER, auxFXSlot2, 2, sendFilter2); EFX10.alFilterf(sendFilter3, EFX10.AL_LOWPASS_GAIN, sendGain3); EFX10.alFilterf(sendFilter3, EFX10.AL_LOWPASS_GAINHF, sendCutoff3); AL11.alSource3i(sourceID, EFX10.AL_AUXILIARY_SEND_FILTER, auxFXSlot3, 3, sendFilter3); EFX10.alFilterf(directFilter0, EFX10.AL_LOWPASS_GAIN, directGain); EFX10.alFilterf(directFilter0, EFX10.AL_LOWPASS_GAINHF, directCutoff); AL10.alSourcei(sourceID, EFX10.AL_DIRECT_FILTER, directFilter0); AL10.alSourcef(sourceID, EFX10.AL_AIR_ABSORPTION_FACTOR, SoundPhysicsCore.Config.airAbsorption); }
Example #2
Source File: AudioImpl.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.openal.Audio#setPosition(float) */ public boolean setPosition(float position) { position = position % length; AL10.alSourcef(store.getSource(index), AL11.AL_SEC_OFFSET, position); if (AL10.alGetError() != 0) { return false; } return true; }
Example #3
Source File: Mini2DxOpenALMusic.java From mini2Dx with Apache License 2.0 | 5 votes |
public void setPosition (float position) { if (audio.noDevice) return; if (sourceID == -1) return; boolean wasPlaying = isPlaying; isPlaying = false; alSourceStop(sourceID); alSourceUnqueueBuffers(sourceID, buffers); while (renderedSecondsQueue.size > 0) { renderedSeconds = renderedSecondsQueue.pop(); } if (position <= renderedSeconds) { reset(); renderedSeconds = 0; } while (renderedSeconds < (position - maxSecondsPerBuffer)) { if (read(tempBytes) <= 0) break; renderedSeconds += maxSecondsPerBuffer; } renderedSecondsQueue.add(renderedSeconds); boolean filled = false; for (int i = 0; i < bufferCount; i++) { int bufferID = buffers.get(i); if (!fill(bufferID)) break; filled = true; alSourceQueueBuffers(sourceID, bufferID); } renderedSecondsQueue.pop(); if (!filled) { stop(); if (onCompletionListener != null) onCompletionListener.onCompletion(this); } alSourcef(sourceID, AL11.AL_SEC_OFFSET, position - renderedSeconds); if (wasPlaying) { alSourcePlay(sourceID); isPlaying = true; } }
Example #4
Source File: Mini2DxOpenALMusic.java From mini2Dx with Apache License 2.0 | 5 votes |
public void setPosition (float position) { if (audio.noDevice) return; if (sourceID == -1) return; boolean wasPlaying = isPlaying; isPlaying = false; alSourceStop(sourceID); alSourceUnqueueBuffers(sourceID, buffers); while (renderedSecondsQueue.size > 0) { renderedSeconds = renderedSecondsQueue.pop(); } if (position <= renderedSeconds) { reset(); renderedSeconds = 0; } while (renderedSeconds < (position - maxSecondsPerBuffer)) { if (read(tempBytes) <= 0) break; renderedSeconds += maxSecondsPerBuffer; } renderedSecondsQueue.add(renderedSeconds); boolean filled = false; for (int i = 0; i < bufferCount; i++) { int bufferID = buffers.get(i); if (!fill(bufferID)) break; filled = true; alSourceQueueBuffers(sourceID, bufferID); } renderedSecondsQueue.pop(); if (!filled) { stop(); if (onCompletionListener != null) onCompletionListener.onCompletion(this); } alSourcef(sourceID, AL11.AL_SEC_OFFSET, position - renderedSeconds); if (wasPlaying) { alSourcePlay(sourceID); isPlaying = true; } }
Example #5
Source File: LwjglAudioRenderer.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private void clearChannel(int index){ // make room at this channel if (chanSrcs[index] != null){ AudioNode src = chanSrcs[index]; int sourceId = channels[index]; alSourceStop(sourceId); if (src.getAudioData() instanceof AudioStream){ AudioStream str = (AudioStream) src.getAudioData(); ib.position(0).limit(STREAMING_BUFFER_COUNT); ib.put(str.getIds()).flip(); alSourceUnqueueBuffers(sourceId, ib); }else if (src.getAudioData() instanceof AudioBuffer){ alSourcei(sourceId, AL_BUFFER, 0); } if (src.getDryFilter() != null && supportEfx){ // detach filter alSourcei(sourceId, EFX10.AL_DIRECT_FILTER, EFX10.AL_FILTER_NULL); } if (src.isPositional()){ AudioNode pas = (AudioNode) src; if (pas.isReverbEnabled() && supportEfx) { AL11.alSource3i(sourceId, EFX10.AL_AUXILIARY_SEND_FILTER, 0, 0, EFX10.AL_FILTER_NULL); } } chanSrcs[index] = null; } }
Example #6
Source File: TestDoppler.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp(){ audioRenderer.setEnvironment(Environment.Dungeon); AL10.alDistanceModel(AL11.AL_EXPONENT_DISTANCE); ufo = new AudioNode(assetManager, "Sound/Effects/Beep.ogg", false); ufo.setPositional(true); ufo.setLooping(true); ufo.setReverbEnabled(true); ufo.setRefDistance(100000000); ufo.setMaxDistance(100000000); ufo.play(); }
Example #7
Source File: OpenALStreamPlayer.java From opsu-dance with GNU General Public License v3.0 | 4 votes |
/** * Return the current playing position in the sound * * @return The current position in seconds. */ public float getALPosition() { float playedTime = ((float) playedPos / (float) sampleSize) / sampleRate; float timePosition = playedTime + AL10.alGetSourcef(source, AL11.AL_SEC_OFFSET); return timePosition; }
Example #8
Source File: LwjglAL.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void alSource3i(int source, int param, int value1, int value2, int value3) { AL11.alSource3i(source, param, value1, value2, value3); }
Example #9
Source File: LwjglAL.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void alSource3i(final int source, final int param, final int value1, final int value2, final int value3) { AL11.alSource3i(source, param, value1, value2, value3); }
Example #10
Source File: OpenALStreamPlayer.java From opsu with GNU General Public License v3.0 | 4 votes |
/** * Return the current playing position in the sound * * @return The current position in seconds. */ public float getALPosition() { float playedTime = ((float) playedPos / (float) sampleSize) / sampleRate; float timePosition = playedTime + AL10.alGetSourcef(source, AL11.AL_SEC_OFFSET); return timePosition; }
Example #11
Source File: AudioImpl.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @see org.newdawn.slick.openal.Audio#getPosition() */ public float getPosition() { return AL10.alGetSourcef(store.getSource(index), AL11.AL_SEC_OFFSET); }
Example #12
Source File: Mini2DxOpenALAudioDevice.java From mini2Dx with Apache License 2.0 | 4 votes |
public float getPosition () { if (sourceID == -1) return 0; return renderedSeconds + alGetSourcef(sourceID, AL11.AL_SEC_OFFSET); }
Example #13
Source File: Mini2DxOpenALMusic.java From mini2Dx with Apache License 2.0 | 4 votes |
public float getPosition () { if (audio.noDevice) return 0; if (sourceID == -1) return 0; return renderedSeconds + alGetSourcef(sourceID, AL11.AL_SEC_OFFSET); }
Example #14
Source File: Mini2DxOpenALAudioDevice.java From mini2Dx with Apache License 2.0 | 4 votes |
public float getPosition () { if (sourceID == -1) return 0; return renderedSeconds + alGetSourcef(sourceID, AL11.AL_SEC_OFFSET); }
Example #15
Source File: Mini2DxOpenALMusic.java From mini2Dx with Apache License 2.0 | 4 votes |
public float getPosition () { if (audio.noDevice) return 0; if (sourceID == -1) return 0; return renderedSeconds + alGetSourcef(sourceID, AL11.AL_SEC_OFFSET); }
Example #16
Source File: OpenALStreamPlayer.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * Return the current playing position in the sound * * @return The current position in seconds. */ public float getPosition() { return positionOffset + AL10.alGetSourcef(source, AL11.AL_SEC_OFFSET); }