When running my audio application, ported from Windows, on Ubuntu Virtualbox, it reports the following:
Devices found:
OpenAL Soft
OpenAL Soft 40964 in alcOpenDevice: AL_INVALID_OPERATION
The line it runs on:
ALCdevice device = alcOpenDevice( NULL ); // Also tried "OpenAL Soft"
Ubuntu audio is working properly. What am I missing?
CMakeLists:
target_link_libraries( ${PROJECT_NAME}
"myengine"
"openal"
)
I installed libopenal1
on the target VM
CodePudding user response:
Apparently, the alGetError()
will return this error before a context is created. Starting from alcMakeContextCurrent()
I can use this function to check for errors.
It now plays audio!
So for alcOpenDevice()
and alcCreateContext()
I had to comment out the alGetError()
error checking. Though I could still check whether the device was opened successfully using if( !device )