PortAudio 2.0
pa_win_ds.c File Reference
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <initguid.h>
#include <windows.h>
#include <objbase.h>
#include <dsound.h>
#include <process.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 "pa_debugprint.h"
#include "pa_win_util.h"
#include "pa_win_ds.h"
#include "pa_win_ds_dynlink.h"
#include "pa_win_waveformat.h"
#include "pa_win_wdmks_utils.h"
#include "pa_win_coinitialize.h"
#include "pa_win_version.h"

Data Structures

struct  PaWinDsDeviceInfo
 
struct  PaWinDsHostApiRepresentation
 
struct  PaWinDsStream
 
struct  DSDeviceNameAndGUID
 
struct  DSDeviceNameAndGUIDVector
 
struct  DSDeviceNamesAndGUIDs
 

Macros

#define _WIN32_WINNT   0x0400 /* required to get waitable timer APIs */
 
#define DIRECTSOUND_VERSION   0x0300
 
#define CREATE_THREAD   (HANDLE)_beginthreadex
 
#define CLOSE_THREAD_HANDLE   CloseHandle /* NOTE: _beginthreadex requires handle to be closed with CloseHandle */
 
#define PA_THREAD_FUNC   static unsigned WINAPI
 
#define PA_THREAD_ID   unsigned
 
#define PA_WIN_DS_USE_WAITABLE_TIMER_OBJECT   /* use waitable timer where possible, otherwise we use a WaitForSingleObject timeout */
 
#define DWORD_PTR   unsigned long
 
#define PRINT(x)
 
#define ERR_RPT(x)
 
#define DBUG(x)
 
#define DBUGX(x)
 
#define PA_USE_HIGH_LATENCY   (0)
 
#define PA_DS_WIN_9X_DEFAULT_LATENCY_   (.140)
 
#define PA_DS_WIN_NT_DEFAULT_LATENCY_   (.280)
 
#define PA_DS_WIN_WDM_DEFAULT_LATENCY_   (.120)
 
#define PA_DS_MINIMUM_POLLING_PERIOD_SECONDS   (0.001) /* 1ms */
 
#define PA_DS_MAXIMUM_POLLING_PERIOD_SECONDS   (0.100) /* 100ms */
 
#define PA_DS_POLLING_JITTER_SECONDS   (0.001) /* 1ms */
 
#define SECONDS_PER_MSEC   (0.001)
 
#define MSECS_PER_SECOND   (1000)
 
#define PA_DS_SET_LAST_DIRECTSOUND_ERROR(hr)
 
#define PA_LATENCY_ENV_NAME   ("PA_MIN_LATENCY_MSEC")
 
#define PA_ENV_BUF_SIZE   (32)
 
#define PA_DEFAULTSAMPLERATESEARCHORDER_COUNT_   (13) /* must match array length below */
 
#define DSSPEAKER_7POINT1   0x00000007
 
#define DSSPEAKER_7POINT1_SURROUND   0x00000008
 
#define DSSPEAKER_5POINT1_SURROUND   0x00000009
 
#define WAVE_FORMAT_48M08   0x00001000 /* 48 kHz, Mono, 8-bit */
 
#define WAVE_FORMAT_48S08   0x00002000 /* 48 kHz, Stereo, 8-bit */
 
#define WAVE_FORMAT_48M16   0x00004000 /* 48 kHz, Mono, 16-bit */
 
#define WAVE_FORMAT_48S16   0x00008000 /* 48 kHz, Stereo, 16-bit */
 
#define WAVE_FORMAT_96M08   0x00010000 /* 96 kHz, Mono, 8-bit */
 
#define WAVE_FORMAT_96S08   0x00020000 /* 96 kHz, Stereo, 8-bit */
 
#define WAVE_FORMAT_96M16   0x00040000 /* 96 kHz, Mono, 16-bit */
 
#define WAVE_FORMAT_96S16   0x00080000 /* 96 kHz, Stereo, 16-bit */
 

Typedefs

typedef struct PaWinDsDeviceInfo PaWinDsDeviceInfo
 
typedef struct PaWinDsStream PaWinDsStream
 
typedef struct DSDeviceNameAndGUID DSDeviceNameAndGUID
 
typedef struct DSDeviceNameAndGUIDVector DSDeviceNameAndGUIDVector
 
typedef struct DSDeviceNamesAndGUIDs DSDeviceNamesAndGUIDs
 

Functions

PA_THREAD_FUNC ProcessingThreadProc (void *pArg)
 
PaError PaWinDs_Initialize (PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index)
 

Variables

GUID IID_IRolandVSCEmulated1 = {0xc2ad1800, 0xb243, 0x11ce, 0xa8, 0xa4, 0x00, 0xaa, 0x00, 0x6c, 0x45, 0x01}
 
GUID IID_IRolandVSCEmulated2 = {0xc2ad1800, 0xb243, 0x11ce, 0xa8, 0xa4, 0x00, 0xaa, 0x00, 0x6c, 0x45, 0x02}
 

Macro Definition Documentation

◆ _WIN32_WINNT

#define _WIN32_WINNT   0x0400 /* required to get waitable timer APIs */

◆ CLOSE_THREAD_HANDLE

#define CLOSE_THREAD_HANDLE   CloseHandle /* NOTE: _beginthreadex requires handle to be closed with CloseHandle */

◆ CREATE_THREAD

#define CREATE_THREAD   (HANDLE)_beginthreadex

◆ DBUG

#define DBUG ( x)
Value:
#define PRINT(x)
Definition pa_win_ds.c:145

◆ DBUGX

#define DBUGX ( x)
Value:

◆ DIRECTSOUND_VERSION

#define DIRECTSOUND_VERSION   0x0300

◆ DSSPEAKER_5POINT1_SURROUND

#define DSSPEAKER_5POINT1_SURROUND   0x00000009

◆ DSSPEAKER_7POINT1

#define DSSPEAKER_7POINT1   0x00000007

◆ DSSPEAKER_7POINT1_SURROUND

#define DSSPEAKER_7POINT1_SURROUND   0x00000008

◆ DWORD_PTR

#define DWORD_PTR   unsigned long

Referenced by ProcessingThreadProc().

◆ ERR_RPT

#define ERR_RPT ( x)
Value:

◆ MSECS_PER_SECOND

#define MSECS_PER_SECOND   (1000)

Referenced by ProcessingThreadProc().

◆ PA_DEFAULTSAMPLERATESEARCHORDER_COUNT_

#define PA_DEFAULTSAMPLERATESEARCHORDER_COUNT_   (13) /* must match array length below */

◆ PA_DS_MAXIMUM_POLLING_PERIOD_SECONDS

#define PA_DS_MAXIMUM_POLLING_PERIOD_SECONDS   (0.100) /* 100ms */

◆ PA_DS_MINIMUM_POLLING_PERIOD_SECONDS

#define PA_DS_MINIMUM_POLLING_PERIOD_SECONDS   (0.001) /* 1ms */

◆ PA_DS_POLLING_JITTER_SECONDS

#define PA_DS_POLLING_JITTER_SECONDS   (0.001) /* 1ms */

◆ PA_DS_SET_LAST_DIRECTSOUND_ERROR

#define PA_DS_SET_LAST_DIRECTSOUND_ERROR ( hr)
Value:
PaUtil_SetLastHostErrorInfo( paDirectSound, hr, "DirectSound error" )
void PaUtil_SetLastHostErrorInfo(PaHostApiTypeId hostApiType, long errorCode, const char *errorText)
Definition pa_front.c:142
@ paDirectSound
Definition portaudio.h:280

◆ PA_DS_WIN_9X_DEFAULT_LATENCY_

#define PA_DS_WIN_9X_DEFAULT_LATENCY_   (.140)

◆ PA_DS_WIN_NT_DEFAULT_LATENCY_

#define PA_DS_WIN_NT_DEFAULT_LATENCY_   (.280)

◆ PA_DS_WIN_WDM_DEFAULT_LATENCY_

#define PA_DS_WIN_WDM_DEFAULT_LATENCY_   (.120)

◆ PA_ENV_BUF_SIZE

#define PA_ENV_BUF_SIZE   (32)

◆ PA_LATENCY_ENV_NAME

#define PA_LATENCY_ENV_NAME   ("PA_MIN_LATENCY_MSEC")

◆ PA_THREAD_FUNC

#define PA_THREAD_FUNC   static unsigned WINAPI

◆ PA_THREAD_ID

#define PA_THREAD_ID   unsigned

◆ PA_USE_HIGH_LATENCY

#define PA_USE_HIGH_LATENCY   (0)

◆ PA_WIN_DS_USE_WAITABLE_TIMER_OBJECT

#define PA_WIN_DS_USE_WAITABLE_TIMER_OBJECT   /* use waitable timer where possible, otherwise we use a WaitForSingleObject timeout */

◆ PRINT

#define PRINT ( x)
Value:
#define PA_DEBUG(x)
Definition pa_debugprint.h:99

◆ SECONDS_PER_MSEC

#define SECONDS_PER_MSEC   (0.001)

◆ WAVE_FORMAT_48M08

#define WAVE_FORMAT_48M08   0x00001000 /* 48 kHz, Mono, 8-bit */

◆ WAVE_FORMAT_48M16

#define WAVE_FORMAT_48M16   0x00004000 /* 48 kHz, Mono, 16-bit */

◆ WAVE_FORMAT_48S08

#define WAVE_FORMAT_48S08   0x00002000 /* 48 kHz, Stereo, 8-bit */

◆ WAVE_FORMAT_48S16

#define WAVE_FORMAT_48S16   0x00008000 /* 48 kHz, Stereo, 16-bit */

◆ WAVE_FORMAT_96M08

#define WAVE_FORMAT_96M08   0x00010000 /* 96 kHz, Mono, 8-bit */

◆ WAVE_FORMAT_96M16

#define WAVE_FORMAT_96M16   0x00040000 /* 96 kHz, Mono, 16-bit */

◆ WAVE_FORMAT_96S08

#define WAVE_FORMAT_96S08   0x00020000 /* 96 kHz, Stereo, 8-bit */

◆ WAVE_FORMAT_96S16

#define WAVE_FORMAT_96S16   0x00080000 /* 96 kHz, Stereo, 16-bit */

Typedef Documentation

◆ DSDeviceNameAndGUID

typedef struct DSDeviceNameAndGUID DSDeviceNameAndGUID

◆ DSDeviceNameAndGUIDVector

typedef struct DSDeviceNameAndGUIDVector DSDeviceNameAndGUIDVector

◆ DSDeviceNamesAndGUIDs

typedef struct DSDeviceNamesAndGUIDs DSDeviceNamesAndGUIDs

◆ PaWinDsDeviceInfo

typedef struct PaWinDsDeviceInfo PaWinDsDeviceInfo

◆ PaWinDsStream

typedef struct PaWinDsStream PaWinDsStream

Function Documentation

◆ PaWinDs_Initialize()

◆ ProcessingThreadProc()

Variable Documentation

◆ IID_IRolandVSCEmulated1

GUID IID_IRolandVSCEmulated1 = {0xc2ad1800, 0xb243, 0x11ce, 0xa8, 0xa4, 0x00, 0xaa, 0x00, 0x6c, 0x45, 0x01}

◆ IID_IRolandVSCEmulated2

GUID IID_IRolandVSCEmulated2 = {0xc2ad1800, 0xb243, 0x11ce, 0xa8, 0xa4, 0x00, 0xaa, 0x00, 0x6c, 0x45, 0x02}