-
Notifications
You must be signed in to change notification settings - Fork 74
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
Hardware initialization fails (Device or resource is busy) #63
Comments
Well, I think I understand what you're getting at. Good catch - I never managed to reproduce the Maybe I'll find some time the week after next to put something like this in. If you manage to create a patch, that would be much appreciated. |
Hi @larsimmisch @hauptmech, any further work in this area? Seems like the fundamental design and API needs changing, or perhaps don't finalize hw params ( |
I am having this same problem, I tried to implement the approach listed above however get the following:
|
The diff above was not complete, only meant to communicate the idea. Attached are my files. |
In the end, I decided to make |
pedantically, nothing prevents reconfiguring a prepared stream, so @hauptmech's point is technically invalid, though i suppose bugs might exist. also, it's not very efficient. but one could also avoid the problem without deprecating the old api, at the cost of a behavior change: switch to lazy setup, invoking it only upon the first read/write/etc., or when requested explicitly via a new function. anyway, what's done is done. |
pyalsaaudio hardware initialization fails because it is written with a misunderstanding of how alsa hardware initialization works. It needs to be rewritten...
Issues #61, #60, #47, #46, #43, #34 are probably due to this.
From the alsa_lib documentation (ie code):
pyalsaaudio is trying to set the hardware configuration multiple times, and getting -EBUSY (Device or resource busy) because the state of the audio device is SND_PCM_STATE_PREPARED and configuration is no longer possible.
Basically you must set all of the hardware configuration as you like it, and then call snd_pcm_hw_params() once and only once at the end.
I don't have time to offer a patch but the following diff shows my approach:
The text was updated successfully, but these errors were encountered: