PortAudio 2.0
portaudio.h
Go to the documentation of this file.
1#ifndef PORTAUDIO_H
2#define PORTAUDIO_H
3/*
4 * $Id: portaudio.h 1859 2012-09-01 00:10:13Z philburk $
5 * PortAudio Portable Real-Time Audio Library
6 * PortAudio API Header File
7 * Latest version available at: http://www.portaudio.com/
8 *
9 * Copyright (c) 1999-2002 Ross Bencina and Phil Burk
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining
12 * a copy of this software and associated documentation files
13 * (the "Software"), to deal in the Software without restriction,
14 * including without limitation the rights to use, copy, modify, merge,
15 * publish, distribute, sublicense, and/or sell copies of the Software,
16 * and to permit persons to whom the Software is furnished to do so,
17 * subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice shall be
20 * included in all copies or substantial portions of the Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
26 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
27 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31/*
32 * The text above constitutes the entire PortAudio license; however,
33 * the PortAudio community also makes the following non-binding requests:
34 *
35 * Any person wishing to distribute modifications to the Software is
36 * requested to send the modifications to the original developer so that
37 * they can be incorporated into the canonical version. It is also
38 * requested that these non-binding requests be included along with the
39 * license above.
40 */
41
48#ifdef __cplusplus
49extern "C"
50{
51#endif /* __cplusplus */
52
53
57int Pa_GetVersion( void );
58
59
63const char* Pa_GetVersionText( void );
64
65
70typedef int PaError;
71typedef enum PaErrorCode
72{
73 paNoError = 0,
74
75 paNotInitialized = -10000,
76 paUnanticipatedHostError,
77 paInvalidChannelCount,
78 paInvalidSampleRate,
79 paInvalidDevice,
80 paInvalidFlag,
81 paSampleFormatNotSupported,
82 paBadIODeviceCombination,
83 paInsufficientMemory,
84 paBufferTooBig,
85 paBufferTooSmall,
86 paNullCallback,
87 paBadStreamPtr,
88 paTimedOut,
89 paInternalError,
90 paDeviceUnavailable,
91 paIncompatibleHostApiSpecificStreamInfo,
92 paStreamIsStopped,
93 paStreamIsNotStopped,
94 paInputOverflowed,
95 paOutputUnderflowed,
96 paHostApiNotFound,
97 paInvalidHostApi,
98 paCanNotReadFromACallbackStream,
99 paCanNotWriteToACallbackStream,
100 paCanNotReadFromAnOutputOnlyStream,
101 paCanNotWriteToAnInputOnlyStream,
102 paIncompatibleStreamHostApi,
103 paBadBufferPtr
104} PaErrorCode;
105
106
110const char *Pa_GetErrorText( PaError errorCode );
111
112
133
134
152
153
154
161typedef int PaDeviceIndex;
162
163
169#define paNoDevice ((PaDeviceIndex)-1)
170
171
177#define paUseHostApiSpecificDeviceSpecification ((PaDeviceIndex)-2)
178
179
180/* Host API enumeration mechanism */
181
187typedef int PaHostApiIndex;
188
189
200
201
211
212
224typedef enum PaHostApiTypeId
225{
226 paInDevelopment=0, /* use while developing support for a new host API */
227 paDirectSound=1,
228 paMME=2,
229 paASIO=3,
230 paSoundManager=4,
231 paCoreAudio=5,
232 paOSS=7,
233 paALSA=8,
234 paAL=9,
235 paBeOS=10,
236 paWDMKS=11,
237 paJACK=12,
238 paWASAPI=13,
239 paAudioScienceHPI=14
241
242
245typedef struct PaHostApiInfo
246{
252 const char *name;
253
260
266
272
274
275
290
291
308
309
332 int hostApiDeviceIndex );
333
334
335
338typedef struct PaHostErrorInfo{
341 const char *errorText;
343
344
359
360
361
362/* Device enumeration and capabilities */
363
372
373
381
382
399
400
409typedef double PaTime;
410
411
433typedef unsigned long PaSampleFormat;
434
435
436#define paFloat32 ((PaSampleFormat) 0x00000001)
437#define paInt32 ((PaSampleFormat) 0x00000002)
438#define paInt24 ((PaSampleFormat) 0x00000004)
439#define paInt16 ((PaSampleFormat) 0x00000008)
440#define paInt8 ((PaSampleFormat) 0x00000010)
441#define paUInt8 ((PaSampleFormat) 0x00000020)
442#define paCustomFormat ((PaSampleFormat) 0x00010000)
444#define paNonInterleaved ((PaSampleFormat) 0x80000000)
449typedef struct PaDeviceInfo
450{
451 int structVersion; /* this is struct version 2 */
452 const char *name;
455 int maxInputChannels;
456 int maxOutputChannels;
457
460 PaTime defaultLowOutputLatency;
463 PaTime defaultHighOutputLatency;
464
465 double defaultSampleRate;
467
468
483
484
487typedef struct PaStreamParameters
488{
496
503
509
522
529
531
532
534#define paFormatIsSupported (0)
535
559 const PaStreamParameters *outputParameters,
560 double sampleRate );
561
562
563
564/* Streaming types and functions */
565
566
584typedef void PaStream;
585
586
591#define paFramesPerBufferUnspecified (0)
592
593
602typedef unsigned long PaStreamFlags;
603
605#define paNoFlag ((PaStreamFlags) 0)
606
610#define paClipOff ((PaStreamFlags) 0x00000001)
611
615#define paDitherOff ((PaStreamFlags) 0x00000002)
616
626#define paNeverDropInput ((PaStreamFlags) 0x00000004)
627
634#define paPrimeOutputBuffersUsingStreamCallback ((PaStreamFlags) 0x00000008)
635
639#define paPlatformSpecificFlags ((PaStreamFlags)0xFFFF0000)
640
653
654
661typedef unsigned long PaStreamCallbackFlags;
662
670#define paInputUnderflow ((PaStreamCallbackFlags) 0x00000001)
671
679#define paInputOverflow ((PaStreamCallbackFlags) 0x00000002)
680
685#define paOutputUnderflow ((PaStreamCallbackFlags) 0x00000004)
686
690#define paOutputOverflow ((PaStreamCallbackFlags) 0x00000008)
691
696#define paPrimingOutput ((PaStreamCallbackFlags) 0x00000010)
697
703{
706 paAbort=2
708
709
780 const void *input, void *output,
781 unsigned long frameCount,
782 const PaStreamCallbackTimeInfo* timeInfo,
783 PaStreamCallbackFlags statusFlags,
784 void *userData );
785
786
842 const PaStreamParameters *inputParameters,
843 const PaStreamParameters *outputParameters,
844 double sampleRate,
845 unsigned long framesPerBuffer,
846 PaStreamFlags streamFlags,
847 PaStreamCallback *streamCallback,
848 void *userData );
849
850
882 int numInputChannels,
883 int numOutputChannels,
884 PaSampleFormat sampleFormat,
885 double sampleRate,
886 unsigned long framesPerBuffer,
887 PaStreamCallback *streamCallback,
888 void *userData );
889
890
895
896
911typedef void PaStreamFinishedCallback( void *userData );
912
913
933
934
938
939
944
945
950
951
965
966
981
982
983
988typedef struct PaStreamInfo
989{
992
1000
1008
1017
1019
1020
1035
1036
1053
1054
1072
1073
1096 void *buffer,
1097 unsigned long frames );
1098
1099
1123 const void *buffer,
1124 unsigned long frames );
1125
1126
1136
1137
1147
1148
1149/* Miscellaneous utilities */
1150
1151
1158
1159
1167void Pa_Sleep( long msec );
1168
1169
1170
1171#ifdef __cplusplus
1172}
1173#endif /* __cplusplus */
1174#endif /* PORTAUDIO_H */
PaError Pa_WriteStream(PaStream *stream, const void *buffer, unsigned long frames)
PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex(PaHostApiTypeId type)
PaError Pa_OpenDefaultStream(PaStream **stream, int numInputChannels, int numOutputChannels, PaSampleFormat sampleFormat, double sampleRate, unsigned long framesPerBuffer, PaStreamCallback *streamCallback, void *userData)
PaError Pa_ReadStream(PaStream *stream, void *buffer, unsigned long frames)
PaError Pa_Terminate(void)
PaError Pa_AbortStream(PaStream *stream)
struct PaStreamCallbackTimeInfo PaStreamCallbackTimeInfo
void PaStream
Definition: portaudio.h:584
PaHostApiIndex Pa_GetHostApiCount(void)
void Pa_Sleep(long msec)
const PaHostErrorInfo * Pa_GetLastHostErrorInfo(void)
PaError Pa_IsStreamActive(PaStream *stream)
signed long Pa_GetStreamWriteAvailable(PaStream *stream)
PaTime Pa_GetStreamTime(PaStream *stream)
unsigned long PaStreamFlags
Definition: portaudio.h:602
PaError Pa_OpenStream(PaStream **stream, const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate, unsigned long framesPerBuffer, PaStreamFlags streamFlags, PaStreamCallback *streamCallback, void *userData)
unsigned long PaSampleFormat
Definition: portaudio.h:433
int PaError
Definition: portaudio.h:70
PaError Pa_IsStreamStopped(PaStream *stream)
PaError Pa_GetSampleSize(PaSampleFormat format)
PaDeviceIndex Pa_HostApiDeviceIndexToDeviceIndex(PaHostApiIndex hostApi, int hostApiDeviceIndex)
unsigned long PaStreamCallbackFlags
Definition: portaudio.h:661
const char * Pa_GetVersionText(void)
struct PaStreamInfo PaStreamInfo
int Pa_GetVersion(void)
struct PaDeviceInfo PaDeviceInfo
PaError Pa_StartStream(PaStream *stream)
double Pa_GetStreamCpuLoad(PaStream *stream)
int PaStreamCallback(const void *input, void *output, unsigned long frameCount, const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
Definition: portaudio.h:779
PaHostApiTypeId
Definition: portaudio.h:225
PaError Pa_CloseStream(PaStream *stream)
struct PaStreamParameters PaStreamParameters
PaError Pa_SetStreamFinishedCallback(PaStream *stream, PaStreamFinishedCallback *streamFinishedCallback)
struct PaHostErrorInfo PaHostErrorInfo
void PaStreamFinishedCallback(void *userData)
Definition: portaudio.h:911
const PaDeviceInfo * Pa_GetDeviceInfo(PaDeviceIndex device)
const PaStreamInfo * Pa_GetStreamInfo(PaStream *stream)
PaError Pa_IsFormatSupported(const PaStreamParameters *inputParameters, const PaStreamParameters *outputParameters, double sampleRate)
PaError Pa_Initialize(void)
PaDeviceIndex Pa_GetDefaultInputDevice(void)
PaDeviceIndex Pa_GetDeviceCount(void)
signed long Pa_GetStreamReadAvailable(PaStream *stream)
int PaDeviceIndex
Definition: portaudio.h:161
PaDeviceIndex Pa_GetDefaultOutputDevice(void)
struct PaHostApiInfo PaHostApiInfo
PaHostApiIndex Pa_GetDefaultHostApi(void)
const char * Pa_GetErrorText(PaError errorCode)
PaStreamCallbackResult
Definition: portaudio.h:703
@ paComplete
Definition: portaudio.h:705
@ paAbort
Definition: portaudio.h:706
@ paContinue
Definition: portaudio.h:704
int PaHostApiIndex
Definition: portaudio.h:187
double PaTime
Definition: portaudio.h:409
PaError Pa_StopStream(PaStream *stream)
const PaHostApiInfo * Pa_GetHostApiInfo(PaHostApiIndex hostApi)
PaTime defaultHighInputLatency
Definition: portaudio.h:462
PaTime defaultLowInputLatency
Definition: portaudio.h:459
PaHostApiIndex hostApi
Definition: portaudio.h:453
int structVersion
Definition: portaudio.h:248
PaHostApiTypeId type
Definition: portaudio.h:250
PaDeviceIndex defaultOutputDevice
Definition: portaudio.h:271
const char * name
Definition: portaudio.h:252
PaDeviceIndex defaultInputDevice
Definition: portaudio.h:265
const char * errorText
Definition: portaudio.h:341
PaHostApiTypeId hostApiType
Definition: portaudio.h:339
PaTime inputLatency
Definition: portaudio.h:999
PaTime outputLatency
Definition: portaudio.h:1007
int structVersion
Definition: portaudio.h:991
double sampleRate
Definition: portaudio.h:1016
PaTime suggestedLatency
Definition: portaudio.h:521
PaSampleFormat sampleFormat
Definition: portaudio.h:508
PaDeviceIndex device
Definition: portaudio.h:495
void * hostApiSpecificStreamInfo
Definition: portaudio.h:528

Generated for PortAudio by  doxygen1.9.2