-
Notifications
You must be signed in to change notification settings - Fork 327
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
Pa_SelectHostApis to specify which host APIs will be initialized at startup #10
Comments
Comment by @RossBencina Updated after marking #13 as a duplicate. Note that making host API Ids a bit-mask rather than a sequential enumeration would limit us to 31 host apis in the future, but I sincerely hope we will never get to the point of supporting 31 host APIs anyway. Note that because some API functions return a HostAPI ID or a -ve error code, we can't use the high bit for an API id. The default mask should be set so that if Pa_SetHostApiInitializationMask() isn't called, all available APIs are initialized. |
Comment by @RossBencina Another option is for Pa_SetHostApiInitializationMask() to take an array of host API type ids. That would allow initialization order/defaults to also be selected. We may also want to consider an API that supports both masking (disabling) certain APIs, and one that supports enabling only a set of APIs. Another thing that might be needed is a way to query which APIs are available/compiled in. |
Comment by @RossBencina TRAC migration: propagating ticket status from TRAC |
Comment by @RossBencina I've comitted a prototype implementation to the ticket-10-select-host-apis branch. Here's the commit message: An implementation of runtime host API selection (see ticket #10). See the changes to portaudio.h for documentation for the API. Note that unlike other proposals, this version of the interface allows the client to specify the order of host API initialization. The API is excercised by patest_select_hostapis.c. To reviewers: please verify that the implementation of Pa_SelectHostApis, Pa_GetSelectedHostApis and Pa_GetAvailableHostApis in pa_front.c matches the documentation in portaudio.h |
Comment by @RossBencina Notes on the current API design in the ticket-10-select-host-apis branch: I chose not to use a bitmask because that wouldn't allow the initialization order to be specified. It would have also lead to either (1) a messy API (mapping type ids to a bitmask) or (2) having to make a breaking change to make type ids use unique bits. I added a function to query the available host APIs, as per a request on the mailing list (seems reasonable), and a function to query which host APIs are selected (for completeness). Note that Pa_SelectHostApis will fail if you specify a host API that is not in the available host APIs list. |
Comment by @RossBencina Daniel Schrmann provided this feedback on the mailing list: I have skimmed to the diffs and have some comments:
Kind regards, Daniel |
Comment by @RossBencina Changes 3 September 9039daf..90fa011
The latest diff vs master can always be reviewed here: |
Comment by @RossBencina From my point of view, what is needed now is further code review and testing. The only outstanding issue is to select a better name than "available" for Pa_GetAvailableHostApis and Pa_GetAvailableHostApisCount. If anyone has any other comments please let us know. |
Comment by @RossBencina Added #253 to cover detecting installed host apis at runtime |
Issue created by @RossBencina
Change host API Ids to a bit mask and provide a function
Pa_SelectHostApis( hostApis, capacity, count)
which can be called prior to Pa_Initialize() to determine which APIs will be initialized.
This could avoid initializing unwanted APIs (and all sorts of problems on Windows with buggy drivers when trying to init DirectSound and ASIO and MME all for the same app.
Earlier versions of this proposal proposed Pa_SetHostApiInitializationMask() with a bitmask to specify which host apis to initialize.
A prototype implementation is now available on the git "ticket-10-select-host-apis" branch. See the documentation in portaudio.h for details. See comments below for notes on the evolution of the prototype.
https://app.assembla.com/spaces/portaudio/git/compare/portaudio:ticket-10-select-host-apis...portaudio:master
The text was updated successfully, but these errors were encountered: