PortAudio
2.0
|
#include <pa_hostapi.h>
Data Fields | |
PaUtilPrivatePaFrontHostApiInfo | privatePaFrontInfo |
PaHostApiInfo | info |
PaDeviceInfo ** | deviceInfos |
void(* | Terminate )(struct PaUtilHostApiRepresentation *hostApi) |
PaError(* | OpenStream )(struct PaUtilHostApiRepresentation *hostApi, PaStream **stream, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate, unsigned long framesPerCallback, PaStreamFlags streamFlags, PaStreamCallback *streamCallback, void *userData) |
PaError(* | IsFormatSupported )(struct PaUtilHostApiRepresentation *hostApi, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate) |
A structure representing the interface to a host API. Contains both concrete data and pointers to functions which implement the interface.
PaDeviceInfo** PaUtilHostApiRepresentation::deviceInfos |
PaHostApiInfo PaUtilHostApiRepresentation::info |
The host api implementation should populate the info field. In the case of info.defaultInputDevice and info.defaultOutputDevice the values stored should be 0 based indices within the host api's own device index range (0 to deviceCount). These values will be converted to global device indices by pa_front after PaUtilHostApiInitializer() returns.
Referenced by PaAsio_Initialize(), PaJack_Initialize(), PaMacCore_Initialize(), PaOSS_Initialize(), PaSkeleton_Initialize(), PaUtil_DeviceIndexToHostApiDeviceIndex(), PaWasapi_Initialize(), PaWinDs_Initialize(), PaWinMme_Initialize(), and PaWinWdm_Initialize().
PaError(* PaUtilHostApiRepresentation::IsFormatSupported)(struct PaUtilHostApiRepresentation *hostApi, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate) |
Referenced by Pa_IsFormatSupported(), PaMacCore_Initialize(), and PaSkeleton_Initialize().
PaError(* PaUtilHostApiRepresentation::OpenStream)(struct PaUtilHostApiRepresentation *hostApi, PaStream **stream, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate, unsigned long framesPerCallback, PaStreamFlags streamFlags, PaStreamCallback *streamCallback, void *userData) |
The inputParameters and outputParameters pointers should not be saved as they will not remain valid after OpenStream is called.
The following guarantees are made about parameters to (*OpenStream)():
[NOTE: the following list up to *END PA FRONT VALIDATIONS* should be kept in sync with the one for ValidateOpenStreamParameters and Pa_OpenStream in pa_front.c] PaHostApiRepresentation *hostApi - is valid for this implementation PaStream** stream - is non-null - at least one of inputParameters & outputParmeters is valid (not NULL) - if inputParameters & outputParmeters are both valid, that inputParameters->device & outputParmeters->device both use the same host api PaDeviceIndex inputParameters->device - is within range (0 to Pa_CountDevices-1) Or: - is paUseHostApiSpecificDeviceSpecification and inputParameters->hostApiSpecificStreamInfo is non-NULL and refers to a valid host api int inputParameters->numChannels - if inputParameters->device is not paUseHostApiSpecificDeviceSpecification, numInputChannels is > 0 - upper bound is NOT validated against device capabilities PaSampleFormat inputParameters->sampleFormat - is one of the sample formats defined in portaudio.h void *inputParameters->hostApiSpecificStreamInfo - if supplied its hostApi field matches the input device's host Api PaDeviceIndex outputParmeters->device - is within range (0 to Pa_CountDevices-1) int outputParmeters->numChannels - if inputDevice is valid, numInputChannels is > 0 - upper bound is NOT validated against device capabilities PaSampleFormat outputParmeters->sampleFormat - is one of the sample formats defined in portaudio.h void *outputParmeters->hostApiSpecificStreamInfo - if supplied its hostApi field matches the output device's host Api double sampleRate - is not an 'absurd' rate (less than 1000. or greater than 384000.) - sampleRate is NOT validated against device capabilities PaStreamFlags streamFlags - unused platform neutral flags are zero - paNeverDropInput is only used for full-duplex callback streams with variable buffer size (paFramesPerBufferUnspecified) [*END PA FRONT VALIDATIONS*]
The following validations MUST be performed by (*OpenStream)():
- check that input device can support numInputChannels - check that input device can support inputSampleFormat, or that we have the capability to convert from outputSampleFormat to a native format - if inputStreamInfo is supplied, validate its contents, or return an error if no inputStreamInfo is expected - check that output device can support numOutputChannels - check that output device can support outputSampleFormat, or that we have the capability to convert from outputSampleFormat to a native format - if outputStreamInfo is supplied, validate its contents, or return an error if no outputStreamInfo is expected - if a full duplex stream is requested, check that the combination of input and output parameters is supported - check that the device supports sampleRate - alter sampleRate to a close allowable rate if necessary - validate inputLatency and outputLatency - validate any platform specific flags, if flags are supplied they must be valid.
Referenced by Pa_OpenStream(), PaMacCore_Initialize(), and PaSkeleton_Initialize().
PaUtilPrivatePaFrontHostApiInfo PaUtilHostApiRepresentation::privatePaFrontInfo |
Referenced by PaUtil_DeviceIndexToHostApiDeviceIndex().
void(* PaUtilHostApiRepresentation::Terminate)(struct PaUtilHostApiRepresentation *hostApi) |
(*Terminate)() is guaranteed to be called with a valid <hostApi> parameter, which was previously returned from the same implementation's initializer.
Referenced by PaMacCore_Initialize(), and PaSkeleton_Initialize().