PortAudio  2.0
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
pa_win_wdmks.c File Reference

Portaudio WDM-KS host API. More...

#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <wchar.h>
#include "pa_util.h"
#include "pa_allocation.h"
#include "pa_hostapi.h"
#include "pa_stream.h"
#include "pa_cpuload.h"
#include "pa_process.h"
#include "portaudio.h"
#include "pa_debugprint.h"
#include "pa_memorybarrier.h"
#include "pa_ringbuffer.h"
#include "pa_trace.h"
#include "pa_win_waveformat.h"
#include "pa_win_wdmks.h"
#include <windows.h>
#include <winioctl.h>
#include <process.h>
#include <math.h>
#include <setupapi.h>
#include <mmreg.h>
#include <ks.h>
#include <ksmedia.h>

Data Structures

struct  PaWinWDMKSAvRtEntryPoints
 
struct  __PaWinWdmMuxedInput
 
struct  __PaWinWdmPin
 
struct  __PaWinWdmFilter
 
struct  __PaWinWdmDeviceInfo
 
struct  __PaWinWdmHostApiRepresentation
 
struct  __DATAPACKET
 
struct  __PaIOPacket
 
struct  __PaWinWdmIOInfo
 
struct  __PaWinWdmStream
 
struct  __PaProcessThreadInfo
 
struct  __PaWinWDMScanDeviceInfosResults
 
struct  __PaUsbTerminalGUIDToName
 
struct  PaNameHashIndex
 
struct  PaNameHashObject
 

Macros

#define PA_LOGE_
 
#define PA_LOGL_
 
#define DRV_QUERYDEVICEINTERFACE   (DRV_RESERVED + 12)
 
#define DRV_QUERYDEVICEINTERFACESIZE   (DRV_RESERVED + 13)
 
#define PA_HP_TRACE(x)   PaUtil_AddHighSpeedLogMessage x ;
 
#define PA_WDMKS_USE_CATEGORY_FOR_PIN_NAMES   1
 
#define CREATE_THREAD_FUNCTION   (HANDLE)_beginthreadex
 
#define PA_THREAD_FUNC   static unsigned WINAPI
 
#define EXTERN_C   extern
 
#define MAXIMUM_NUMBER_OF_CHANNELS   256
 

Typedefs

typedef DWORD WINAPI KSCREATEPIN (HANDLE, PKSPIN_CONNECT, ACCESS_MASK, PHANDLE)
 
typedef enum _PA_AVRT_PRIORITY PA_AVRT_PRIORITY
 
typedef enum _PA_AVRT_PRIORITYPPA_AVRT_PRIORITY
 
typedef struct __PaWinWdmFilter PaWinWdmFilter
 
typedef struct __PaWinWdmPin PaWinWdmPin
 
typedef struct __PaWinWdmStream PaWinWdmStream
 
typedef PaError(* FunctionGetPinAudioPosition )(PaWinWdmPin *, unsigned long *)
 
typedef void(* FunctionMemoryBarrier )(void)
 
typedef struct
__PaProcessThreadInfo 
PaProcessThreadInfo
 
typedef PaError(* FunctionPinHandler )(PaProcessThreadInfo *pInfo, unsigned eventIndex)
 
typedef enum __PaStreamStartEnum PaStreamStartEnum
 
typedef struct __PaWinWdmMuxedInput PaWinWdmMuxedInput
 
typedef struct __PaWinWdmDeviceInfo PaWinWdmDeviceInfo
 
typedef struct
__PaWinWdmHostApiRepresentation 
PaWinWdmHostApiRepresentation
 
typedef struct __DATAPACKET DATAPACKET
 
typedef struct __PaIOPacket PaIOPacket
 
typedef struct __PaWinWdmIOInfo PaWinWdmIOInfo
 
typedef struct
__PaWinWDMScanDeviceInfosResults 
PaWinWDMScanDeviceInfosResults
 
typedef const
KSTOPOLOGY_CONNECTION *(* 
TFnGetConnection )(const KSTOPOLOGY_CONNECTION *, PaWinWdmFilter *, int)
 
typedef struct
__PaUsbTerminalGUIDToName 
PaUsbTerminalGUIDToName
 
typedef enum _tag_EAlias EAlias
 
typedef struct PaNameHashIndex PaNameHashIndex
 
typedef struct PaNameHashObject PaNameHashObject
 
typedef void(* TSetInputFrameCount )(PaUtilBufferProcessor *, unsigned long)
 
typedef void(* TSetInputChannel )(PaUtilBufferProcessor *, unsigned int, void *, unsigned int)
 

Enumerations

enum  _PA_AVRT_PRIORITY { PA_AVRT_PRIORITY_LOW = -1, PA_AVRT_PRIORITY_NORMAL, PA_AVRT_PRIORITY_HIGH, PA_AVRT_PRIORITY_CRITICAL }
 
enum  __PaStreamStartEnum { StreamStart_kOk, StreamStart_kFailed, StreamStart_kCnt }
 
enum  _tag_EAlias { Alias_kRender = (1<<0), Alias_kCapture = (1<<1), Alias_kRealtime = (1<<2) }
 

Functions

PaError PaWinWdm_Initialize (PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index)
 
PA_THREAD_FUNC ProcessingThread (void *)
 

Variables

HMODULE DllKsUser = NULL
 
KSCREATEPINFunctionKsCreatePin = NULL
 

Detailed Description

Portaudio WDM-KS host API.

Note
This is the implementation of the Portaudio host API using the Windows WDM/Kernel Streaming API in order to enable very low latency playback and recording on all modern Windows platforms (e.g. 2K, XP, Vista, Win7) Note: This API accesses the device drivers below the usual KMIXER component which is normally used to enable multi-client mixing and format conversion. That means that it will lock out all other users of a device for the duration of active stream using those devices

Macro Definition Documentation

#define CREATE_THREAD_FUNCTION   (HANDLE)_beginthreadex
#define DRV_QUERYDEVICEINTERFACE   (DRV_RESERVED + 12)
#define DRV_QUERYDEVICEINTERFACESIZE   (DRV_RESERVED + 13)
#define EXTERN_C   extern
#define MAXIMUM_NUMBER_OF_CHANNELS   256
#define PA_HP_TRACE (   x)    PaUtil_AddHighSpeedLogMessage x ;

Referenced by ProcessingThread().

#define PA_LOGE_
#define PA_LOGL_
#define PA_THREAD_FUNC   static unsigned WINAPI
#define PA_WDMKS_USE_CATEGORY_FOR_PIN_NAMES   1

Typedef Documentation

typedef struct __DATAPACKET DATAPACKET
typedef enum _tag_EAlias EAlias
typedef PaError(* FunctionGetPinAudioPosition)(PaWinWdmPin *, unsigned long *)
typedef void(* FunctionMemoryBarrier)(void)
typedef PaError(* FunctionPinHandler)(PaProcessThreadInfo *pInfo, unsigned eventIndex)
typedef DWORD WINAPI KSCREATEPIN(HANDLE, PKSPIN_CONNECT, ACCESS_MASK, PHANDLE)
typedef struct __PaIOPacket PaIOPacket
typedef struct __PaWinWdmPin PaWinWdmPin
typedef const KSTOPOLOGY_CONNECTION*(* TFnGetConnection)(const KSTOPOLOGY_CONNECTION *, PaWinWdmFilter *, int)
typedef void(* TSetInputChannel)(PaUtilBufferProcessor *, unsigned int, void *, unsigned int)
typedef void(* TSetInputFrameCount)(PaUtilBufferProcessor *, unsigned long)

Enumeration Type Documentation

Enumerator
StreamStart_kOk 
StreamStart_kFailed 
StreamStart_kCnt 
Enumerator
PA_AVRT_PRIORITY_LOW 
PA_AVRT_PRIORITY_NORMAL 
PA_AVRT_PRIORITY_HIGH 
PA_AVRT_PRIORITY_CRITICAL 
Enumerator
Alias_kRender 
Alias_kCapture 
Alias_kRealtime 

Function Documentation

PaError PaWinWdm_Initialize ( PaUtilHostApiRepresentation **  hostApi,
PaHostApiIndex  index 
)
PA_THREAD_FUNC ProcessingThread ( void *  pParam)

References __PaWinWdmStream::capture, __PaProcessThreadInfo::captureTail, __PaProcessThreadInfo::cbResult, PaStreamCallbackTimeInfo::currentTime, __PaWinWdmFilter::devInfo, __PaWinWdmStream::eventAbort, __PaWinWdmIOInfo::events, __PaWinWdmStream::eventStreamStart, FALSE, __PaWinWdmPin::fnEventHandler, __PaWinWdmPin::fnSubmitHandler, __PaWinWdmIOInfo::framesPerBuffer, HANDLE(), PaStreamCallbackTimeInfo::inputBufferAdcTime, __PaWinWdmIOInfo::noOfPackets, PaStreamCallbackTimeInfo::outputBufferDacTime, PA_DEBUG, PA_HP_TRACE, PA_LOGE_, PA_LOGL_, paComplete, paContinue, paInputOverflow, paNoError, paOutputUnderflow, __PaWinWdmPin::parentFilter, paTimedOut, paUnanticipatedHostError, PaUtil_AllocateMemory(), PaUtil_DiscardHighSpeedLog, PaUtil_DumpHighSpeedLog, PaUtil_FreeMemory(), PaUtil_GetRingBufferWriteAvailable(), PaUtil_InitializeHighSpeedLog, __PaProcessThreadInfo::pending, __PaWinWdmPin::pinKsSubType, __PaProcessThreadInfo::pinsStarted, __PaWinWdmIOInfo::pPin, __PaProcessThreadInfo::priming, __PaWinWdmStream::render, __PaProcessThreadInfo::renderHead, __PaProcessThreadInfo::renderTail, __PaWinWdmStream::ringBuffer, PaStreamInfo::sampleRate, __PaProcessThreadInfo::stream, __PaWinWdmStream::streamAbort, __PaWinWdmStream::streamActive, PaUtilStreamRepresentation::streamFinishedCallback, PaUtilStreamRepresentation::streamInfo, PaWinWDMKSDeviceInfo::streamingType, __PaWinWdmStream::streamRepresentation, StreamStart_kFailed, StreamStart_kOk, __PaWinWdmStream::streamStop, SubType_kPolled, __PaWinWdmStream::threadResult, __PaProcessThreadInfo::ti, __PaProcessThreadInfo::timeout, TRUE, Type_kWaveCyclic, __PaProcessThreadInfo::underover, PaUtilStreamRepresentation::userData, and __PaWinWdmStream::userOutputChannels.

Variable Documentation

HMODULE DllKsUser = NULL

Referenced by PaWinWdm_Initialize().

KSCREATEPIN * FunctionKsCreatePin = NULL

Referenced by PaWinWdm_Initialize().