-
-
Notifications
You must be signed in to change notification settings - Fork 361
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
mal_enumerate_devices alsa returns only null and pulse #2
Comments
Thanks for your feedback on this. I'll get onto this later tonight when I get a chance. |
I've taken a look at this and I didn't realize how bad I was handling device enumeration! Take a look at branch "issue_2" for work on improving this. Still work in progress. So far what I've done is basically just simplified the whole thing and return every device without trying to strip anything. The problem with this is that it's so unfriendly for the end user... What do you think of the idea of giving applications the option to choose whether or not they want verbose device enumeration or compact enumeration? What I'm thinking of doing is adding a mal_context_config structure which is passed into mal_context_init() and would look something like this: typedef struct
{
mal_log_proc onLog;
struct
{
mal_bool32 useVerbsoseDeviceEnumeration; // <-- Defaults to false.
} alsa;
} mal_context_config; When useVerboseDeviceEnumeration is set to true it will return every device that ALSA returns. When set to false it returns only unique devices based on card/dev pairs and uses "hw:%d,%d" when opening the device. Do you think that API design seems reasonable? |
Now it's listing them all but there are still some problems.
Here I had to advance the
if
with that name which seems to work because I don't see that "Failed 1" printed but then I get this
which seems related to issue 1 maybe? Because if I do
when |
Thanks for your feedback! Indeed, I didn't have the time to properly test that stuff last night. I've implemented bug fixes in the issue_2 branch. The prioritization logic works in my head... Take the devices below as an example: NAME: front:CARD=I82801AAICH,DEV=0 (hw:0,0) Note how these have the same "hw:0,0" ID. If, for example, the end-user specifically wants to use the "front" device, wouldn't you want to try opening that specific device first, as the highest priority? If I were to change the priority so that the "hw:0,0" device is attempted first, wouldn't the user lose control of the specific device that's opened? How would it distinguish between the "front" device and the "surround21" device? My idea was to try the specific device selection first, and then fall back to the more general "hw:0,0" selection if that fails.
That's intended behaviour. My idea was to have it so the NAME property is used verbatim as the device identifier in snd_pcm_open(), then falling back to "hw:%d,%d" upon failure. Is using the NAME property verbatim as the device ID for snd_pcm_open() valid, do you know? The preferPlugHW config is just a suggestion. It's not going to be used for the "default" nor "pulse" devices and I'm not considering it a critical error if a device cannot be converted to "plughw" format. It's interesting that you are getting the same error as that from issue #1. I've got a potential fix in that branch so hopefully that'll be cleaned up soon, after which I'll get that merged into the issue_2 branch as well. I've also decided to commit to that API design - I think it'll be good for extensibility like you say, and it'll allow me to add backend-specific configs in the future to give applications more control. I've not yet had a chance to implement that, though. Thanks for taking the time to help figure this out! |
Yes, yes, you are right, I thought about that after I wrote the message and this way, I think, it should also read multichannel configs from
and I thought that's how it has to be but, I guess not really.
works alright,
gives
works,
works,
gives
works alright,
this just hangs, it's the same one that gives the issue_1 assertion,
works, and the front also works. Thank you for your work, I really appreciate it! |
Thanks for your work on testing this! I don't fully understand what's going on with that failed assertion. It's most likely that I'm just doing something wrong, but I can't reproduce it so it's been hard to figure it out.
I'll fix this one. mini_al should Just Work no matter how the device is configured - it should just do a channel conversion in this case. |
* By default, device enumeration will now only enumerate over unique card/device pairs. Applications can enable verbose device enumeration by setting the alsa.useVerboseDeviceInteration context config variable. * By default, the "null" device is excluded from enumeration. This can be changed by setting the alsa.includeNullDevice context config variable. Relates to issue #2.
I went ahead and pushed some work to improve device enumeration. See the commit message for details. I'll leave this issue open pending a fix for the channel map assertion, but I'll refer you to issue #1 for continued discussion about the mmap error. Thanks for your help with this! |
A fix for the chmap assertion error is in the new version on the master branch. Thanks for your help testing all of that for me. I ended up changing the logic for opening devices again. It's a bit simpler now and doesn't use the "plughw" fallback stuff any more. |
On Manjaro
mal_enumerate_devices
returns onlynull
andpulse
, I looked over your code and I understand what you want to achieve inmal_enumerate_devices__alsa
the problem is that on my system this checkif (colonPos == -1 || (colonPos == 2 && (NAME[0]=='h' && NAME[1]=='w')))
can only be true fornull
orpulse
because these don't contain:
and there's no entry starting withhw:something
.I wrote this function to check my entries:
and they look like this:
Now I agree that it prints every kind of thing every card can do but there must be a middle ground so that you can enumerate and choose at run time what card you want to push sound through.
I am using it with your
dr_flac.h
and it's pretty solid other than this problem.Versions
The text was updated successfully, but these errors were encountered: