PortAudio
2.0
|
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <new>
#include <windows.h>
#include <mmsystem.h>
#include "portaudio.h"
#include "pa_asio.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_ringbuffer.h"
#include "pa_win_coinitialize.h"
#include "pa_win_util.h"
#include "asiosys.h"
#include "asio.h"
#include "asiodrivers.h"
#include "iasiothiscallresolver.h"
Data Structures | |
struct | PaAsioDriverInfo |
struct | PaAsioHostApiRepresentation |
struct | PaAsioDeviceInfo |
struct | PaAsioStreamBlockingState |
struct | PaAsioStream |
Macros | |
#define | WIN32 |
#define | CARBON_COMPATIBLE (0) |
#define | PA_ASIO_SET_LAST_HOST_ERROR(errorCode, errorText) PaUtil_SetLastHostErrorInfo( paASIO, errorCode, errorText ) |
#define | PA_ASIO_SET_LAST_SYSTEM_ERROR(errorCode) PaAsio_SetLastSystemError( errorCode ) |
#define | PA_ASIO_SET_LAST_ASIO_ERROR(asioError) PaUtil_SetLastHostErrorInfo( paASIO, asioError, PaAsio_GetAsioErrorText( asioError ) ) |
#define | PA_SWAP32_(x) ((x>>24) | ((x>>8)&0xFF00) | ((x<<8)&0xFF0000) | (x<<24)); |
#define | PA_SWAP_(x, y) temp=x; x = y; y = temp; |
#define | PA_DEFAULTSAMPLERATESEARCHORDER_COUNT_ 13 /* must be the same number of elements as in the array below */ |
#define | ASIO64toDouble(a) ((a).lo + (a).hi * twoRaisedTo32) |
Typedefs | |
typedef struct PaAsioDriverInfo | PaAsioDriverInfo |
typedef void | PaAsioBufferConverter (void *, long, long) |
typedef struct PaAsioDeviceInfo | PaAsioDeviceInfo |
typedef BOOL(WINAPI * | IsDebuggerPresentPtr )(VOID) |
typedef struct PaAsioStreamBlockingState | PaAsioStreamBlockingState |
typedef struct PaAsioStream | PaAsioStream |
Functions | |
PaError | PaAsio_Initialize (PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex) |
void | AsioSampleTypeLOG (ASIOSampleType type) |
PaError | PaAsio_GetAvailableBufferSizes (PaDeviceIndex device, long *minBufferSizeFrames, long *maxBufferSizeFrames, long *preferredBufferSizeFrames, long *granularity) |
PaError | PaAsio_ShowControlPanel (PaDeviceIndex device, void *systemSpecific) |
PaError | PaAsio_GetInputChannelName (PaDeviceIndex device, int channelIndex, const char **channelName) |
PaError | PaAsio_GetOutputChannelName (PaDeviceIndex device, int channelIndex, const char **channelName) |
PaError | PaAsio_SetStreamSampleRate (PaStream *s, double sampleRate) |
Variables | |
AsioDrivers * | asioDrivers |
IsDebuggerPresentPtr | IsDebuggerPresent_ = 0 |
const double | twoRaisedTo32 = 4294967296. |
Note that specific support for paInputUnderflow, paOutputOverflow and paNeverDropInput is not necessary or possible with this driver due to the synchronous full duplex double-buffered architecture of ASIO.
#define ASIO64toDouble | ( | a | ) | ((a).lo + (a).hi * twoRaisedTo32) |
#define CARBON_COMPATIBLE (0) |
#define PA_ASIO_SET_LAST_ASIO_ERROR | ( | asioError | ) | PaUtil_SetLastHostErrorInfo( paASIO, asioError, PaAsio_GetAsioErrorText( asioError ) ) |
Referenced by PaAsio_ShowControlPanel().
#define PA_ASIO_SET_LAST_HOST_ERROR | ( | errorCode, | |
errorText | |||
) | PaUtil_SetLastHostErrorInfo( paASIO, errorCode, errorText ) |
#define PA_ASIO_SET_LAST_SYSTEM_ERROR | ( | errorCode | ) | PaAsio_SetLastSystemError( errorCode ) |
#define PA_DEFAULTSAMPLERATESEARCHORDER_COUNT_ 13 /* must be the same number of elements as in the array below */ |
#define PA_SWAP32_ | ( | x | ) | ((x>>24) | ((x>>8)&0xFF00) | ((x<<8)&0xFF0000) | (x<<24)); |
#define PA_SWAP_ | ( | x, | |
y | |||
) | temp=x; x = y; y = temp; |
#define WIN32 |
typedef void PaAsioBufferConverter(void *, long, long) |
typedef struct PaAsioDeviceInfo PaAsioDeviceInfo |
typedef struct PaAsioDriverInfo PaAsioDriverInfo |
typedef struct PaAsioStream PaAsioStream |
typedef struct PaAsioStreamBlockingState PaAsioStreamBlockingState |
A data structure specifically for storing blocking i/o related data.
void AsioSampleTypeLOG | ( | ASIOSampleType | type | ) |
References PA_DEBUG.
PaError PaAsio_GetAvailableBufferSizes | ( | PaDeviceIndex | device, |
long * | minBufferSizeFrames, | ||
long * | maxBufferSizeFrames, | ||
long * | preferredBufferSizeFrames, | ||
long * | granularity | ||
) |
Retrieve legal native buffer sizes for the specified device, in sample frames.
device | The global index of the device about which the query is being made. |
minBufferSizeFrames | A pointer to the location which will receive the minimum buffer size value. |
maxBufferSizeFrames | A pointer to the location which will receive the maximum buffer size value. |
preferredBufferSizeFrames | A pointer to the location which will receive the preferred buffer size value. |
granularity | A pointer to the location which will receive the "granularity". This value determines the step size used to compute the legal values between minBufferSizeFrames and maxBufferSizeFrames. If granularity is -1 then available buffer size values are powers of two. |
References PaAsioDeviceInfo::bufferGranularity, PaUtilHostApiRepresentation::deviceInfos, PaAsioDeviceInfo::maxBufferSize, PaAsioDeviceInfo::minBufferSize, paASIO, paNoError, PaUtil_DeviceIndexToHostApiDeviceIndex(), PaUtil_GetHostApiRepresentation(), and PaAsioDeviceInfo::preferredBufferSize.
PaError PaAsio_GetInputChannelName | ( | PaDeviceIndex | device, |
int | channelIndex, | ||
const char ** | channelName | ||
) |
Retrieve a pointer to a string containing the name of the specified input channel. The string is valid until Pa_Terminate is called.
The string will be no longer than 32 characters including the null terminator.
References PaAsioDeviceInfo::asioChannelInfos, PaAsioDeviceInfo::commonDeviceInfo, PaUtilHostApiRepresentation::deviceInfos, PaDeviceInfo::maxInputChannels, paASIO, paInvalidChannelCount, paNoError, PaUtil_DeviceIndexToHostApiDeviceIndex(), and PaUtil_GetHostApiRepresentation().
PaError PaAsio_GetOutputChannelName | ( | PaDeviceIndex | device, |
int | channelIndex, | ||
const char ** | channelName | ||
) |
Retrieve a pointer to a string containing the name of the specified input channel. The string is valid until Pa_Terminate is called.
The string will be no longer than 32 characters including the null terminator.
References PaAsioDeviceInfo::asioChannelInfos, PaAsioDeviceInfo::commonDeviceInfo, PaUtilHostApiRepresentation::deviceInfos, PaDeviceInfo::maxInputChannels, PaDeviceInfo::maxOutputChannels, paASIO, paInvalidChannelCount, paNoError, PaUtil_DeviceIndexToHostApiDeviceIndex(), and PaUtil_GetHostApiRepresentation().
PaError PaAsio_Initialize | ( | PaUtilHostApiRepresentation ** | hostApi, |
PaHostApiIndex | hostApiIndex | ||
) |
References PaAsioHostApiRepresentation::allocations, asioDrivers, PaAsioHostApiRepresentation::asioDrivers, PaAsioHostApiRepresentation::blockingStreamInterface, PaAsioHostApiRepresentation::callbackStreamInterface, PaAsioHostApiRepresentation::comInitializationResult, PaAsioDeviceInfo::commonDeviceInfo, PaDeviceInfo::hostApi, PaUtilHostApiRepresentation::info, PaAsioHostApiRepresentation::inheritedHostApiRep, IsDebuggerPresent_, PaDeviceInfo::name, PaAsioHostApiRepresentation::openAsioDeviceIndex, PA_DEBUG, paASIO, paInsufficientMemory, paNoDevice, paNoError, PaUtil_AllocateZeroInitializedMemory(), PaUtil_CreateAllocationGroup(), PaUtil_DestroyAllocationGroup(), PaUtil_DummyGetCpuLoad(), PaUtil_DummyGetReadAvailable(), PaUtil_DummyGetWriteAvailable(), PaUtil_DummyRead(), PaUtil_DummyWrite(), PaUtil_FreeAllAllocations(), PaUtil_FreeMemory(), PaUtil_GroupAllocateZeroInitializedMemory(), PaUtil_InitializeStreamInterface(), PaWinUtil_CoInitialize(), PaWinUtil_CoUninitialize(), PaHostApiInfo::structVersion, PaDeviceInfo::structVersion, and PaAsioHostApiRepresentation::systemSpecific.
Set the sample rate of an open paASIO stream.
stream | The stream to operate on. |
sampleRate | The new sample rate. |
Note that this function may fail if the stream is already running and the ASIO driver does not support switching the sample rate of a running stream.
Returns paIncompatibleStreamHostApi if stream is not a paASIO stream.
References paBadStreamPtr, and paNoError.
PaError PaAsio_ShowControlPanel | ( | PaDeviceIndex | device, |
void * | systemSpecific | ||
) |
Display the ASIO control panel for the specified device.
device | The global index of the device whose control panel is to be displayed. |
systemSpecific | On Windows, the calling application's main window handle, on Macintosh this value should be zero. |
References PaAsioHostApiRepresentation::asioDrivers, PaAsioDeviceInfo::commonDeviceInfo, PaUtilHostApiRepresentation::deviceInfos, PaDeviceInfo::name, PaAsioHostApiRepresentation::openAsioDeviceIndex, PA_ASIO_SET_LAST_ASIO_ERROR, PA_DEBUG, paASIO, paDeviceUnavailable, paNoDevice, paNoError, paUnanticipatedHostError, PaUtil_DeviceIndexToHostApiDeviceIndex(), PaUtil_GetHostApiRepresentation(), PaWinUtil_CoInitialize(), and PaWinUtil_CoUninitialize().
AsioDrivers* asioDrivers |
Referenced by PaAsio_Initialize().
IsDebuggerPresentPtr IsDebuggerPresent_ = 0 |
Referenced by PaAsio_Initialize().
const double twoRaisedTo32 = 4294967296. |