Hot questions for Using Lightweight Java Game Library in openal
I'm coding to manage OpenAL in java using lwjgl 3 and when I create the ALContext with this line:
ALContext alContext = ALContext.create();
When I execute the console prints this advice
AL lib: (EE) UpdateDeviceParams: Failed to set 44100hz, got 48000hz instead
Any idea about whats wrong?
By the way, it's getting really hard coding with lwjgl 3, the only place I found some kind of guide is here lwjgl github
On my ASUS desktop, I have Realtek HD Audio Manager setting the Default Audio format to
24Bits 44800 Hz, thus my open AL applications are not able to request a
44100 Hz device. Changing that default format to
44100 will help solve the problem.
I wish it could help, because it did take me a lot of time to figure this out!
According to my understanding of OpenAL objects, a OpenAL Buffer belongs to a device, and not a context. If I want to create a buffer I do so with alGenBuffers(), but I am not sure which device this buffer will be created on. How do I choose which device to create the buffer on?
OpenAL Buffer belongs to a device, and not a context
When you create a buffer using
alGenBuffers(), then the buffer is indeed created on a specific device. In short, when calling
alGenBuffers() it gets the active context's device. The buffer is then created on that device.
How do I choose which device to create the buffer on?
Thus, you need to get another device and create a new context with that device:
ALCdevice *device = alcOpenDevice(...); ALCcontext *context = alcCreateContext(device, NULL);
Then make this new context the current active context:
alBufferData(), etc. is applied to that active context and in turn applied to the active context's device.