SDL2 can not initialize sound driver

|Distributor ID:|Ubuntu| |Description:|Ubuntu 21.04| |Release:|21.04| |Codename:|hirsute|

I tried to initialize the sound driver but it didn't work. Here's the code:

std::cout << SDL_GetNumAudioDrivers() << std::endl;
for (int i = 0; i < SDL_GetNumAudioDrivers(); ++i) { const char* driver_name = SDL_GetAudioDriver(i); if (SDL_AudioInit(driver_name)) { printf(“Audio driver failed to initialize: %s\n”, driver_name); continue; }else{ printf(“Audio driver initialize success: %s\n”, driver_name);
//break; } SDL_AudioQuit();
}

gave the conclusion:

3
Audio driver failed to initialize: dsp
Audio driver initialize success: disk
Audio driver initialize success: dummy

First, it's strange that SDL2 doesn't see pulseaudio. Secondly, even with successful initialization of the dummy and disk drivers, I do not hear any sounds.

have any idea why this is happening?

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like