Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment SDL_AUDIODRIVER may have invalid values #5818

Closed
ericoporto opened this issue Jun 18, 2022 · 4 comments
Closed

Environment SDL_AUDIODRIVER may have invalid values #5818

ericoporto opened this issue Jun 18, 2022 · 4 comments
Assignees
Milestone

Comments

@ericoporto
Copy link
Contributor

If someone has used an SDL1 software or driver, on Windows, they may have set an environment variable of SDL_AUDIODRIVER to dsound, but it now has been renamed as directsound. Since the environment variables don't have a version number SDL2_..., you may hit an audio driver system that doesn't initialize.

https://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlenvvars.html

It would be useful if SDL_InitSubSystem(SDL_INIT_AUDIO) would not fail in an invalid environment variable, and instead attempt known good audio drivers before failing - like wasapi, directsound and winmm in Windows, but not dummy or disk.

@sulix
Copy link
Contributor

sulix commented Jun 18, 2022

We do handle the difference between "pulse" and "pulseaudio" as of #4693 — perhaps something similar could be done (though avoiding directsound may be worth doing on more modern systems…)

@ericoporto
Copy link
Contributor Author

ericoporto commented Jun 18, 2022

It would be good if SDL3 has these versioned to avoid clashing (e.g.: SDL3_AUDIODRIVER )

I was sketching this for AGS: ericoporto/ags@30b7185

But it felt like it was supposed to be in SDL2 instead. MojoAL and other libraries don't have a way to reuse a device because they also pass additional information when opening for things like frequency, which gets checked by SDL2. Essentially I would like SDL2 to only fail if neither of the sensible audio drivers works - this may be a different issue, but just thought I should inform the context.

though avoiding directsound may be worth doing on more modern systems

I think people are avoiding WASAPI because of #5538 , since the bug reports about this environment variable came from people with discreet audio cards.

@sezero
Copy link
Contributor

sezero commented Jun 18, 2022

(though avoiding directsound may be worth doing on more modern systems…)

sdl12-compat probably needs that

@slouken
Copy link
Collaborator

slouken commented Jun 18, 2022

We do handle the difference between "pulse" and "pulseaudio" as of #4693 — perhaps something similar could be done (though avoiding directsound may be worth doing on more modern systems…)

Yep, I'll go ahead and implement this.

@slouken slouken self-assigned this Jun 18, 2022
@slouken slouken added this to the 2.24.0 milestone Jun 18, 2022
sezero pushed a commit to sezero/SDL that referenced this issue Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants