| Summary: | failed SDL_OpenAudioDevice and SDL_GetAudioDeviceName with plain ALSA | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Balashoff Vadim <vvb.backup> |
| Component: | audio | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED WORKSFORME | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | lomax, sezeroz |
| Version: | 2.0.4 | Keywords: | target-2.0.12 |
| Hardware: | x86_64 | ||
| OS: | Linux | ||
|
Description
Balashoff Vadim
2019-08-30 18:43:25 UTC
Right before the call to SDL_OpenAudio(), can you put this:
printf("audio driver is %s\n", SDL_GetCurrentAudioDriver());
And see what it reports? It's weird that the ALSA driver didn't actually report an error message when failing, and I just want to make sure you didn't end up somewhere else by accident.
--ryan.
> printf("audio driver is %s\n", SDL_GetCurrentAudioDriver());
audio driver is (null)
Error opening audio device:
I've test it on two different computers: Core i7 (one integrated soundcard) and Z440 (two soundcards). Same output on both of them.
On both of computers mplayer and many games play sound fine (many of games use SDL as output).
> audio driver is (null)
Did you call SDL_Init(SDL_INIT_AUDIO) at the start of your program? The example code at the wiki doesn't either, although it's meant to be just a snippet and not a complete program.
--ryan.
> Did you call SDL_Init(SDL_INIT_AUDIO) at the start of your program?
Following code output empty line.
#include <SDL2/SDL.h>
#include <iostream>
int main()
{
SDL_Init( SDL_INIT_EVERYTHING );
std::cout << SDL_GetError() << std::endl;
atexit( SDL_Quit );
int count = SDL_GetNumAudioDevices(0);
for (int i = 0; i < count; ++i)
{
std::cout << "Device " << i << ": " << SDL_GetAudioDeviceName(i, 0) << std::endl;
}
return 0;
}
I believe myself to also be affected by this bug; I get "Unable to open mixer: 'No such audio device'" on two separate systems when trying to use SDL2_mixer, neither of which have Pulseaudio installed. Other applications using the audio hardware through ALSA work perfectly fine, though I cannot say anything about other software using SDL2 - I'm not sure I have any installed. > I believe myself to also be affected by this bug
I was wrong; I had just misconfigured my build. SDL2-2.0.10 works fine with the ALSA driver and a USB soundcard for me.
We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc). As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change! Thanks, --ryan. We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc). As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change! Thanks, --ryan.
Honestly, I suspect the original report was due to an SDL accidentally build without ALSA support.
Balashoff, if you're inclined, if you rebuild SDL from scratch, the configure script should write something like this at the end of its run:
Audio drivers : disk dummy [...] alsa(dynamic)
Somewhere on that line it should say "alsa" or "alsa(dynamic)" if SDL is built with ALSA support.
(if you didn't build SDL from scratch, let's figure out where it got built, too.)
--ryan.
Resolving this bug as WORKSFORME. If you are still having this problem, please check my comments about making sure ALSA support was built into SDL, and if necessary, please reopen this bug! Thanks, --ryan. |