Java Code Examples for org.lwjgl.openal.AL#createCapabilities()

The following examples show how to use org.lwjgl.openal.AL#createCapabilities() . 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: SoundManager.java    From lwjglbook with Apache License 2.0 6 votes vote down vote up
public void init() throws Exception {
    this.device = alcOpenDevice((ByteBuffer) null);
    if (device == NULL) {
        throw new IllegalStateException("Failed to open the default OpenAL device.");
    }
    ALCCapabilities deviceCaps = ALC.createCapabilities(device);
    this.context = alcCreateContext(device, (IntBuffer) null);
    if (context == NULL) {
        throw new IllegalStateException("Failed to create OpenAL context.");
    }
    alcMakeContextCurrent(context);
    AL.createCapabilities(deviceCaps);
}
 
Example 2
Source File: SoundManager.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
public void init() throws Exception {
    this.device = alcOpenDevice((ByteBuffer) null);
    if (device == NULL) {
        throw new IllegalStateException("Failed to open the default OpenAL device.");
    }
    ALCCapabilities deviceCaps = ALC.createCapabilities(device);
    this.context = alcCreateContext(device, (IntBuffer) null);
    if (context == NULL) {
        throw new IllegalStateException("Failed to create OpenAL context.");
    }
    alcMakeContextCurrent(context);
    AL.createCapabilities(deviceCaps);
}
 
Example 3
Source File: SoundManager.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
public void init() throws Exception {
    this.device = alcOpenDevice((ByteBuffer) null);
    if (device == NULL) {
        throw new IllegalStateException("Failed to open the default OpenAL device.");
    }
    ALCCapabilities deviceCaps = ALC.createCapabilities(device);
    this.context = alcCreateContext(device, (IntBuffer) null);
    if (context == NULL) {
        throw new IllegalStateException("Failed to create OpenAL context.");
    }
    alcMakeContextCurrent(context);
    AL.createCapabilities(deviceCaps);
}
 
Example 4
Source File: SoundManager.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
public void init() throws Exception {
    this.device = alcOpenDevice((ByteBuffer) null);
    if (device == NULL) {
        throw new IllegalStateException("Failed to open the default OpenAL device.");
    }
    ALCCapabilities deviceCaps = ALC.createCapabilities(device);
    this.context = alcCreateContext(device, (IntBuffer) null);
    if (context == NULL) {
        throw new IllegalStateException("Failed to create OpenAL context.");
    }
    alcMakeContextCurrent(context);
    AL.createCapabilities(deviceCaps);
}
 
Example 5
Source File: SoundManager.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
public void init() throws Exception {
    this.device = alcOpenDevice((ByteBuffer) null);
    if (device == NULL) {
        throw new IllegalStateException("Failed to open the default OpenAL device.");
    }
    ALCCapabilities deviceCaps = ALC.createCapabilities(device);
    this.context = alcCreateContext(device, (IntBuffer) null);
    if (context == NULL) {
        throw new IllegalStateException("Failed to create OpenAL context.");
    }
    alcMakeContextCurrent(context);
    AL.createCapabilities(deviceCaps);
}
 
Example 6
Source File: SoundManager.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
public void init() throws Exception {
    this.device = alcOpenDevice((ByteBuffer) null);
    if (device == NULL) {
        throw new IllegalStateException("Failed to open the default OpenAL device.");
    }
    ALCCapabilities deviceCaps = ALC.createCapabilities(device);
    this.context = alcCreateContext(device, (IntBuffer) null);
    if (context == NULL) {
        throw new IllegalStateException("Failed to create OpenAL context.");
    }
    alcMakeContextCurrent(context);
    AL.createCapabilities(deviceCaps);
}
 
Example 7
Source File: SoundManager.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
public void init() throws Exception {
    this.device = alcOpenDevice((ByteBuffer) null);
    if (device == NULL) {
        throw new IllegalStateException("Failed to open the default OpenAL device.");
    }
    ALCCapabilities deviceCaps = ALC.createCapabilities(device);
    this.context = alcCreateContext(device, (IntBuffer) null);
    if (context == NULL) {
        throw new IllegalStateException("Failed to create OpenAL context.");
    }
    alcMakeContextCurrent(context);
    AL.createCapabilities(deviceCaps);
}
 
Example 8
Source File: SoundManager.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
public void init() throws Exception {
    this.device = alcOpenDevice((ByteBuffer) null);
    if (device == NULL) {
        throw new IllegalStateException("Failed to open the default OpenAL device.");
    }
    ALCCapabilities deviceCaps = ALC.createCapabilities(device);
    this.context = alcCreateContext(device, (IntBuffer) null);
    if (context == NULL) {
        throw new IllegalStateException("Failed to create OpenAL context.");
    }
    alcMakeContextCurrent(context);
    AL.createCapabilities(deviceCaps);
}
 
Example 9
Source File: SoundManager.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
public void init() throws Exception {
    this.device = alcOpenDevice((ByteBuffer) null);
    if (device == NULL) {
        throw new IllegalStateException("Failed to open the default OpenAL device.");
    }
    ALCCapabilities deviceCaps = ALC.createCapabilities(device);
    this.context = alcCreateContext(device, (IntBuffer) null);
    if (context == NULL) {
        throw new IllegalStateException("Failed to create OpenAL context.");
    }
    alcMakeContextCurrent(context);
    AL.createCapabilities(deviceCaps);
}
 
Example 10
Source File: SoundManager.java    From lwjglbook with Apache License 2.0 5 votes vote down vote up
public void init() throws Exception {
    this.device = alcOpenDevice((ByteBuffer) null);
    if (device == NULL) {
        throw new IllegalStateException("Failed to open the default OpenAL device.");
    }
    ALCCapabilities deviceCaps = ALC.createCapabilities(device);
    this.context = alcCreateContext(device, (IntBuffer) null);
    if (context == NULL) {
        throw new IllegalStateException("Failed to create OpenAL context.");
    }
    alcMakeContextCurrent(context);
    AL.createCapabilities(deviceCaps);
}
 
Example 11
Source File: Mini2DxOpenALAudio.java    From mini2Dx with Apache License 2.0 4 votes vote down vote up
public Mini2DxOpenALAudio (int simultaneousSources, int deviceBufferCount, int deviceBufferSize) {
	this.deviceBufferSize = deviceBufferSize;
	this.deviceBufferCount = deviceBufferCount;

	registerSound("ogg", Mini2DxOgg.Sound.class);
	registerMusic("ogg", Mini2DxOgg.Music.class);
	registerSound("wav", Mini2DxWav.Sound.class);
	registerMusic("wav", Mini2DxWav.Music.class);
	registerSound("mp3", Mini2DxMp3.Sound.class);
	registerMusic("mp3", Mini2DxMp3.Music.class);

	device = alcOpenDevice((ByteBuffer)null);
	if (device == 0L) {
		noDevice = true;
		return;
	}
	ALCCapabilities deviceCapabilities = ALC.createCapabilities(device);
	context = alcCreateContext(device, (IntBuffer)null);
	if (context == 0L) {
		alcCloseDevice(device);
		noDevice = true;
		return;
	}
	if (!alcMakeContextCurrent(context)) {
		noDevice = true;
		return;
	}
	AL.createCapabilities(deviceCapabilities);

	allSources = new IntArray(false, simultaneousSources);
	for (int i = 0; i < simultaneousSources; i++) {
		int sourceID = alGenSources();
		if (alGetError() != AL_NO_ERROR) break;
		allSources.add(sourceID);
	}
	idleSources = new IntArray(allSources);
	soundIdToSource = new LongMap<Integer>();
	sourceToSoundId = new IntMap<Long>();

	FloatBuffer orientation = (FloatBuffer)BufferUtils.createFloatBuffer(6)
			.put(new float[] {0.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f}).flip();
	alListenerfv(AL_ORIENTATION, orientation);
	FloatBuffer velocity = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] {0.0f, 0.0f, 0.0f}).flip();
	alListenerfv(AL_VELOCITY, velocity);
	FloatBuffer position = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] {0.0f, 0.0f, 0.0f}).flip();
	alListenerfv(AL_POSITION, position);

	recentSounds = new Mini2DxOpenALSound[simultaneousSources];
	recentSoundIds = new LongArray(simultaneousSources);
}