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

This commit is contained in:
Ross Bencina 2016-08-30 18:10:38 +10:00
commit b8d4bd665d
6 changed files with 390 additions and 28 deletions

View file

@ -338,12 +338,22 @@ typedef struct PaUtilHostApiRepresentation {
*/
typedef PaError PaUtilHostApiInitializer( PaUtilHostApiRepresentation**, PaHostApiIndex );
/** Associate a PaHostApiTypeId with each host API initialization function.
*/
typedef struct {
PaHostApiTypeId hostApiType;
PaUtilHostApiInitializer *initFunction;
} PaUtilHostApiInitializerEntry;
/** paHostApiInitializers is a NULL-terminated array of host API initialization
functions. These functions are called by pa_front.c to initialize the host APIs
when the client calls Pa_Initialize().
entries, each containing an initialization function. The initialization
functions are called by pa_front.c to initialize the host APIs when the client
calls Pa_Initialize().
The initialization functions are invoked in order.
By default initialization functions are invoked in order. The initialization
order may be modified by the client using Pa_SelectHostApis().
The first successfully initialized host API that has a default input *or* output
device is used as the default PortAudio host API. This is based on the logic that
@ -353,7 +363,7 @@ typedef PaError PaUtilHostApiInitializer( PaUtilHostApiRepresentation**, PaHostA
There is a platform specific file that defines paHostApiInitializers for that
platform, pa_win/pa_win_hostapis.c contains the Win32 definitions for example.
*/
extern PaUtilHostApiInitializer *paHostApiInitializers[];
extern PaUtilHostApiInitializerEntry paHostApiInitializers[];
#ifdef __cplusplus