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;
}