PortAudio  2.0
Functions

Win32 implementation of platform-specific PaUtil support functions. More...

#include <windows.h>
#include <mmsystem.h>
#include "pa_util.h"

Functions

void * PaUtil_AllocateZeroInitializedMemory (long size)
 
void PaUtil_FreeMemory (void *block)
 
int PaUtil_CountCurrentlyAllocatedBlocks (void)
 
void Pa_Sleep (long msec)
 
void PaUtil_InitializeClock (void)
 
double PaUtil_GetTime (void)
 
void PaWinUtil_SetLastSystemErrorInfo (PaHostApiTypeId hostApiType, long winError)
 

Detailed Description

Win32 implementation of platform-specific PaUtil support functions.

Function Documentation

void Pa_Sleep ( long  msec)

Put the caller to sleep for at least 'msec' milliseconds. This function is provided only as a convenience for authors of portable code (such as the tests and examples in the PortAudio distribution.)

The function may sleep longer than requested so don't rely on this for accurate musical timing.

Referenced by AudioDeviceSetPropertyNowAndWaitForChange(), main(), PaQa_RunLoopbackFullDuplex(), PaQa_WaitForStream(), paqaCheckLatency(), PlaySine(), ReadStream(), TestOnce(), TestStopMode(), waitUntilBlioWriteBufferIsEmpty(), and WriteStream().

void* PaUtil_AllocateZeroInitializedMemory ( 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.
void PaUtil_FreeMemory ( void *  block)
double PaUtil_GetTime ( void  )

Return the system time in seconds. Used to implement CPU load functions

Note
Do not make assumptions about which underlying clock is used to implement PaUtil_GetTime, or use the current implementation as a guide. Do not use this function when a specific clock is required (e.g. when using platform APIs such as pthreads). If you need to use a specific clock, use a native API that returns that clock.
See Also
PaUtil_InitializeClock

Referenced by PaUnixThread_New(), PaUtil_BeginCpuLoadMeasurement(), PaUtil_EndCpuLoadMeasurement(), PaWinWdm_Initialize(), ProcessingThreadProc(), and waitUntilBlioWriteBufferIsEmpty().

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 PaWinUtil_SetLastSystemErrorInfo ( PaHostApiTypeId  hostApiType,
long  winError 
)

Convert a Windows error code into a PaError. Sets the host-api specific error information if needed.

Parameters
hostApiTypeThe calling host api type. Used when reporting paUnanticipatedHostError
winErrorA Windows error code.

References PaUtil_SetLastHostErrorInfo().

Referenced by PaWinUtil_CoInitialize().