travisvroman / kohi

A game engine made as part of the Kohi Game Engine series on YouTube (and Twitch!), where we make a game engine from the ground up using C and Vulkan.
https://kohiengine.com
Apache License 2.0
1.02k stars 97 forks source link

[BUG] OpenAL error 40964 AL_INVALID_OPERATION #209

Open vanlueckn opened 9 months ago

vanlueckn commented 9 months ago

Describe the bug I tried to use the new audio plugin (openal). On my system i get this error:

[ERROR]: OpenAL error 40964: 'AL_INVALID_OPERATION'
[INFO]: OpenAL Device acquired.
[ERROR]: OpenAL error 40964: 'AL_INVALID_OPERATION'

To Reproduce Steps to reproduce the behavior:

  1. Compile Kohi
  2. Run Kohi
  3. See error in log

Expected behavior Audio plugin should not throw this error

Screenshots image

Desktop (please complete the following information):

Additional context

I debugged the audio plugin with a few breakpoints. The first error is issued by plugin->internal_state->device = alcOpenDevice(0);.

vanlueckn commented 9 months ago

In the official example openal does not check for errors before creating the context (OpenAL Programmers Guide - see page 10.

The alGetError function of openal-soft seems to set error to AL_INVALID_OPERATION if no context was selected. OpenAL Soft is the standard openal implementation in many linux distros, this explains why the error does only appear on my system.

travisvroman commented 2 months ago

@vanlueckn Thanks for submitting this!

Catching up on issues - apologies for the delay! I've known about this for a while. It doesn't affect the operation of the sound, so it hasn't been a priority to fix. It is on my list to revisit though.