PortAudio  2.0
Functions

Prototypes for utility functions used by PortAudio implementations. More...

#include "portaudio.h"

Go to the source code of this file.

Functions

PaError PaUtil_GetHostApiRepresentation (struct PaUtilHostApiRepresentation **hostApi, PaHostApiTypeId type)
 
PaError PaUtil_DeviceIndexToHostApiDeviceIndex (PaDeviceIndex *hostApiDevice, PaDeviceIndex device, struct PaUtilHostApiRepresentation *hostApi)
 
void PaUtil_SetLastHostErrorInfo (PaHostApiTypeId hostApiType, long errorCode, const char *errorText)
 
void * PaUtil_AllocateMemory (long size)
 
void PaUtil_FreeMemory (void *block)
 
int PaUtil_CountCurrentlyAllocatedBlocks (void)
 
void PaUtil_InitializeClock (void)
 
double PaUtil_GetTime (void)
 

Detailed Description

Prototypes for utility functions used by PortAudio implementations.

Some functions declared here are defined in pa_front.c while others are implemented separately for each platform.

Function Documentation

void* PaUtil_AllocateMemory ( long  size)
int PaUtil_CountCurrentlyAllocatedBlocks ( void  )

Return the number of currently allocated blocks. This function can be used for detecting memory leaks.

Note
Allocations will only be tracked if PA_TRACK_MEMORY is #defined. If it isn't, this function will always return 0.
PaError PaUtil_DeviceIndexToHostApiDeviceIndex ( PaDeviceIndex hostApiDevice,
PaDeviceIndex  device,
struct PaUtilHostApiRepresentation hostApi 
)

Convert a PortAudio device index into a host API specific device index.

Parameters
hostApiDevicePointer to a device index, on success this will recieve the converted device index value.
deviceThe PortAudio device index to convert.
hostApiThe host api which the index should be converted for.
Returns
On success returns PaNoError and places the converted index in the hostApiDevice parameter.

References PaUtilPrivatePaFrontHostApiInfo::baseDeviceIndex, PaHostApiInfo::deviceCount, PaUtilHostApiRepresentation::info, paInvalidDevice, paNoError, and PaUtilHostApiRepresentation::privatePaFrontInfo.

Referenced by PaAsio_GetAvailableBufferSizes(), PaAsio_GetInputChannelName(), PaAsio_GetOutputChannelName(), PaAsio_ShowControlPanel(), PaMacCore_GetBufferSizeRange(), PaWasapi_GetDeviceDefaultFormat(), PaWasapi_GetDeviceMixFormat(), PaWasapi_GetDeviceRole(), PaWasapi_GetJackCount(), and PaWasapi_GetJackDescription().

void PaUtil_FreeMemory ( void *  block)
PaError PaUtil_GetHostApiRepresentation ( struct PaUtilHostApiRepresentation **  hostApi,
PaHostApiTypeId  type 
)

Retrieve a specific host API representation. This function can be used by implementations to retrieve a pointer to their representation in host api specific extension functions which aren't passed a rep pointer by pa_front.c.

Parameters
hostApiA pointer to a host API represenation pointer. Apon success this will receive the requested representation pointer.
typeA valid host API type identifier.
Returns
An error code. If the result is PaNoError then a pointer to the requested host API representation will be stored in *hostApi. If the host API specified by type is not found, this function returns paHostApiNotFound.

References PA_IS_INITIALISED_, paHostApiNotFound, paNoError, and paNotInitialized.

Referenced by PaAsio_GetAvailableBufferSizes(), PaAsio_GetInputChannelName(), PaAsio_GetOutputChannelName(), PaAsio_ShowControlPanel(), PaJack_GetClientName(), PaMacCore_GetBufferSizeRange(), and PaMacCore_GetChannelName().

double PaUtil_GetTime ( void  )
void PaUtil_InitializeClock ( void  )

Initialize the clock used by PaUtil_GetTime(). Call this before calling PaUtil_GetTime.

See Also
PaUtil_GetTime

Referenced by Pa_Initialize().

void PaUtil_SetLastHostErrorInfo ( PaHostApiTypeId  hostApiType,
long  errorCode,
const char *  errorText 
)

Set the host error information returned by Pa_GetLastHostErrorInfo. This function and the paUnanticipatedHostError error code should be used as a last resort. Implementors should use existing PA error codes where possible, or nominate new ones. Note that at it is always better to use PaUtil_SetLastHostErrorInfo() and paUnanticipatedHostError than to return an ambiguous or inaccurate PaError code.

Parameters
hostApiTypeThe host API which encountered the error (ie of the caller)
errorCodeThe error code returned by the native API function.
errorTextA string describing the error. PaUtil_SetLastHostErrorInfo makes a copy of the string, so it is not necessary for the pointer to remain valid after the call to PaUtil_SetLastHostErrorInfo() returns.

References PaHostErrorInfo::errorCode, PaHostErrorInfo::hostApiType, and PA_LAST_HOST_ERROR_TEXT_LENGTH_.

Referenced by PaMacCore_SetError(), PaMacCore_SetUnixError(), and PaWinUtil_CoInitialize().