@Override public void destroyALC() { if (context != 0) { ALC10.alcDestroyContext(context); context = 0; } if (device != 0) { ALC10.alcCloseDevice(device); device = 0; } }
@Override public void createALC() { device = ALC10.alcOpenDevice((ByteBuffer) null); ALCCapabilities deviceCaps = ALC.createCapabilities(device); context = ALC10.alcCreateContext(device, (IntBuffer) null); ALC10.alcMakeContextCurrent(context); AL.createCapabilities(deviceCaps); }
public OpenALManager(AudioConfig config) throws OpenALException, LWJGLException { logger.info("Initializing OpenAL audio manager"); config.subscribe(configListener); AL.create(); AL10.alGetError(); logger.info("OpenAL {} initialized!", AL10.alGetString(AL10.AL_VERSION)); ALCcontext context = ALC10.alcGetCurrentContext(); ALCdevice device = ALC10.alcGetContextsDevice(context); logger.info("Using OpenAL: {} by {}", AL10.alGetString(AL10.AL_RENDERER), AL10.alGetString(AL10.AL_VENDOR)); logger.info("Using device: {}", ALC10.alcGetString(device, ALC10.ALC_DEVICE_SPECIFIER)); logger.info("Available AL extensions: {}", AL10.alGetString(AL10.AL_EXTENSIONS)); logger.info("Available ALC extensions: {}", ALC10.alcGetString(device, ALC10.ALC_EXTENSIONS)); IntBuffer buffer = BufferUtils.createIntBuffer(1); ALC10.alcGetInteger(device, ALC11.ALC_MONO_SOURCES, buffer); logger.info("Max mono sources: {}", buffer.get(0)); buffer.rewind(); ALC10.alcGetInteger(device, ALC11.ALC_STEREO_SOURCES, buffer); logger.info("Max stereo sources: {}", buffer.get(0)); buffer.rewind(); ALC10.alcGetInteger(device, ALC10.ALC_FREQUENCY, buffer); logger.info("Mixer frequency: {}", buffer.get(0)); buffer.rewind(); AL10.alDistanceModel(AL10.AL_INVERSE_DISTANCE_CLAMPED); // Initialize sound pools pools.put("sfx", new OpenALSoundPool(30)); // effects pool pools.put("music", new OpenALStreamingSoundPool(2)); // music pool pools.get("sfx").setVolume(config.getSoundVolume()); pools.get("music").setVolume(config.getMusicVolume()); }
public boolean alcIsExtensionPresent(String extension) { ALCcontext context = ALC10.alcGetCurrentContext(); ALCdevice device = ALC10.alcGetContextsDevice(context); return ALC10.alcIsExtensionPresent(device, extension); }
public String alcGetString(int parameter) { ALCcontext context = ALC10.alcGetCurrentContext(); ALCdevice device = ALC10.alcGetContextsDevice(context); return ALC10.alcGetString(device, parameter); }
registerMusic("mp3", Mp3.Music.class); device = alcOpenDevice((ByteBuffer)null); if (device == 0L) { noDevice = true; context = alcCreateContext(device, (IntBuffer)null); if (context == 0L) { alcCloseDevice(device); noDevice = true; return; if (!alcMakeContextCurrent(context)) { noDevice = true; return;
public void alcGetInteger(int param, IntBuffer buffer, int size) { if (buffer.position() != 0) throw new AssertionError(); if (buffer.limit() != size) throw new AssertionError(); ALCcontext context = ALC10.alcGetCurrentContext(); ALCdevice device = ALC10.alcGetContextsDevice(context); ALC10.alcGetInteger(device, param, buffer); }
public int hleAudioInputBlocking(int maxSamples, int frequency, TPointer buffer) { if (!inputDeviceInitialized) { IntBuffer majorVersion = BufferUtils.createIntBuffer(1); IntBuffer minorVersion = BufferUtils.createIntBuffer(1); ALC10.alcGetInteger(null, ALC10.ALC_MAJOR_VERSION, majorVersion); ALC10.alcGetInteger(null, ALC10.ALC_MINOR_VERSION, minorVersion); log.info(String.format("OpenAL Version %d.%d, extensions %s", majorVersion.get(0), minorVersion.get(0), ALC10.alcGetString(null, ALC10.ALC_EXTENSIONS))); inputDevice = ALC11.alcCaptureOpenDevice(null, frequency, AL10.AL_FORMAT_MONO16, 10 * 1024); if (inputDevice != null) { ALC11.alcCaptureStart(inputDevice); } else { log.warn(String.format("No audio input device available, faking.")); } inputDeviceInitialized = true; } blockThreadInput(buffer.getAddress(), maxSamples, frequency); return 0; }
@Override public String alcGetString(final int parameter) { return ALC10.alcGetString(device, parameter); }
@Override public boolean alcIsExtensionPresent(final String extension) { return ALC10.alcIsExtensionPresent(device, extension); }
public int hleAudioGetInputLength() { if (inputDevice == null) { return 0; } if (samplesBuffer == null) { samplesBuffer = BufferUtils.createIntBuffer(1); } ALC10.alcGetInteger(inputDevice, ALC11.ALC_CAPTURE_SAMPLES, samplesBuffer); return samplesBuffer.get(0); }
registerMusic("mp3", Mp3.Music.class); device = alcOpenDevice((ByteBuffer)null); if (device == 0L) { noDevice = true; context = alcCreateContext(device, (IntBuffer)null); if (context == 0L) { alcCloseDevice(device); noDevice = true; return; if (!alcMakeContextCurrent(context)) { noDevice = true; return;
public String alcGetString(int parameter) { ALCcontext context = ALC10.alcGetCurrentContext(); ALCdevice device = ALC10.alcGetContextsDevice(context); return ALC10.alcGetString(device, parameter); }
public boolean alcIsExtensionPresent(String extension) { ALCcontext context = ALC10.alcGetCurrentContext(); ALCdevice device = ALC10.alcGetContextsDevice(context); return ALC10.alcIsExtensionPresent(device, extension); }
public void alcGetInteger(int param, IntBuffer buffer, int size) { if (buffer.position() != 0) throw new AssertionError(); if (buffer.limit() != size) throw new AssertionError(); ALCcontext context = ALC10.alcGetCurrentContext(); ALCdevice device = ALC10.alcGetContextsDevice(context); ALC10.alcGetInteger(device, param, buffer); }
public String alcGetString(final int parameter) { return ALC10.alcGetString(device, parameter); }
public boolean alcIsExtensionPresent(final String extension) { return ALC10.alcIsExtensionPresent(device, extension); }
public void createALC() { device = ALC10.alcOpenDevice((ByteBuffer) null); ALCCapabilities deviceCaps = ALC.createCapabilities(device); context = ALC10.alcCreateContext(device, (IntBuffer) null); ALC10.alcMakeContextCurrent(context); AL.createCapabilities(deviceCaps); }
public void dispose () { if (noDevice) return; for (int i = 0, n = allSources.size; i < n; i++) { int sourceID = allSources.get(i); int state = alGetSourcei(sourceID, AL_SOURCE_STATE); if (state != AL_STOPPED) alSourceStop(sourceID); alDeleteSources(sourceID); } sourceToSoundId.clear(); soundIdToSource.clear(); alcDestroyContext(context); alcCloseDevice(device); }
registerMusic("mp3", Mp3.Music.class); device = alcOpenDevice((ByteBuffer)null); if (device == 0L) { noDevice = true; context = alcCreateContext(device, (IntBuffer)null); if (context == 0L) { alcCloseDevice(device); noDevice = true; return; if (!alcMakeContextCurrent(context)) { noDevice = true; return;