/[pcsx2_0.9.7]/branch/r3113_0.9.7_beta/3rdparty/portaudio/src/common/pa_hostapi.h
ViewVC logotype

Contents of /branch/r3113_0.9.7_beta/3rdparty/portaudio/src/common/pa_hostapi.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations) (download)
Tue Sep 7 03:29:01 2010 UTC (9 years, 5 months ago) by william
File MIME type: text/plain
File size: 10382 byte(s)
branching from upstream revision (http://pcsx2.googlecode.com/svn/trunk
): r3113 to
https://svn.netsolutions.dnsalias.com/websvn/ps2/pcsx2/pcsx2_0.9.7/branch/r3113_0.9.7_beta
1 #ifndef PA_HOSTAPI_H
2 #define PA_HOSTAPI_H
3 /*
4 * $Id: pa_hostapi.h 1339 2008-02-15 07:50:33Z rossb $
5 * Portable Audio I/O Library
6 * host api representation
7 *
8 * Based on the Open Source API proposed by Ross Bencina
9 * Copyright (c) 1999-2008 Ross Bencina, 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
42 /** @file
43 @ingroup common_src
44
45 @brief Interfaces and representation structures used by pa_front.c
46 to manage and communicate with host API implementations.
47 */
48
49
50 #include "portaudio.h"
51
52 #ifdef __cplusplus
53 extern "C"
54 {
55 #endif /* __cplusplus */
56
57
58 /** **FOR THE USE OF pa_front.c ONLY**
59 Do NOT use fields in this structure, they my change at any time.
60 Use functions defined in pa_util.h if you think you need functionality
61 which can be derived from here.
62 */
63 typedef struct PaUtilPrivatePaFrontHostApiInfo {
64
65
66 unsigned long baseDeviceIndex;
67 }PaUtilPrivatePaFrontHostApiInfo;
68
69
70 /** The common header for all data structures whose pointers are passed through
71 the hostApiSpecificStreamInfo field of the PaStreamParameters structure.
72 Note that in order to keep the public PortAudio interface clean, this structure
73 is not used explicitly when declaring hostApiSpecificStreamInfo data structures.
74 However, some code in pa_front depends on the first 3 members being equivalent
75 with this structure.
76 @see PaStreamParameters
77 */
78 typedef struct PaUtilHostApiSpecificStreamInfoHeader
79 {
80 unsigned long size; /**< size of whole structure including this header */
81 PaHostApiTypeId hostApiType; /**< host API for which this data is intended */
82 unsigned long version; /**< structure version */
83 } PaUtilHostApiSpecificStreamInfoHeader;
84
85
86
87 /** A structure representing the interface to a host API. Contains both
88 concrete data and pointers to functions which implement the interface.
89 */
90 typedef struct PaUtilHostApiRepresentation {
91 PaUtilPrivatePaFrontHostApiInfo privatePaFrontInfo;
92
93 /** The host api implementation should populate the info field. In the
94 case of info.defaultInputDevice and info.defaultOutputDevice the
95 values stored should be 0 based indices within the host api's own
96 device index range (0 to deviceCount). These values will be converted
97 to global device indices by pa_front after PaUtilHostApiInitializer()
98 returns.
99 */
100 PaHostApiInfo info;
101
102 PaDeviceInfo** deviceInfos;
103
104 /**
105 (*Terminate)() is guaranteed to be called with a valid <hostApi>
106 parameter, which was previously returned from the same implementation's
107 initializer.
108 */
109 void (*Terminate)( struct PaUtilHostApiRepresentation *hostApi );
110
111 /**
112 The inputParameters and outputParameters pointers should not be saved
113 as they will not remain valid after OpenStream is called.
114
115
116 The following guarantees are made about parameters to (*OpenStream)():
117
118 [NOTE: the following list up to *END PA FRONT VALIDATIONS* should be
119 kept in sync with the one for ValidateOpenStreamParameters and
120 Pa_OpenStream in pa_front.c]
121
122 PaHostApiRepresentation *hostApi
123 - is valid for this implementation
124
125 PaStream** stream
126 - is non-null
127
128 - at least one of inputParameters & outputParmeters is valid (not NULL)
129
130 - if inputParameters & outputParmeters are both valid, that
131 inputParameters->device & outputParmeters->device both use the same host api
132
133 PaDeviceIndex inputParameters->device
134 - is within range (0 to Pa_CountDevices-1) Or:
135 - is paUseHostApiSpecificDeviceSpecification and
136 inputParameters->hostApiSpecificStreamInfo is non-NULL and refers
137 to a valid host api
138
139 int inputParameters->numChannels
140 - if inputParameters->device is not paUseHostApiSpecificDeviceSpecification, numInputChannels is > 0
141 - upper bound is NOT validated against device capabilities
142
143 PaSampleFormat inputParameters->sampleFormat
144 - is one of the sample formats defined in portaudio.h
145
146 void *inputParameters->hostApiSpecificStreamInfo
147 - if supplied its hostApi field matches the input device's host Api
148
149 PaDeviceIndex outputParmeters->device
150 - is within range (0 to Pa_CountDevices-1)
151
152 int outputParmeters->numChannels
153 - if inputDevice is valid, numInputChannels is > 0
154 - upper bound is NOT validated against device capabilities
155
156 PaSampleFormat outputParmeters->sampleFormat
157 - is one of the sample formats defined in portaudio.h
158
159 void *outputParmeters->hostApiSpecificStreamInfo
160 - if supplied its hostApi field matches the output device's host Api
161
162 double sampleRate
163 - is not an 'absurd' rate (less than 1000. or greater than 200000.)
164 - sampleRate is NOT validated against device capabilities
165
166 PaStreamFlags streamFlags
167 - unused platform neutral flags are zero
168 - paNeverDropInput is only used for full-duplex callback streams
169 with variable buffer size (paFramesPerBufferUnspecified)
170
171 [*END PA FRONT VALIDATIONS*]
172
173
174 The following validations MUST be performed by (*OpenStream)():
175
176 - check that input device can support numInputChannels
177
178 - check that input device can support inputSampleFormat, or that
179 we have the capability to convert from outputSampleFormat to
180 a native format
181
182 - if inputStreamInfo is supplied, validate its contents,
183 or return an error if no inputStreamInfo is expected
184
185 - check that output device can support numOutputChannels
186
187 - check that output device can support outputSampleFormat, or that
188 we have the capability to convert from outputSampleFormat to
189 a native format
190
191 - if outputStreamInfo is supplied, validate its contents,
192 or return an error if no outputStreamInfo is expected
193
194 - if a full duplex stream is requested, check that the combination
195 of input and output parameters is supported
196
197 - check that the device supports sampleRate
198
199 - alter sampleRate to a close allowable rate if necessary
200
201 - validate inputLatency and outputLatency
202
203 - validate any platform specific flags, if flags are supplied they
204 must be valid.
205 */
206 PaError (*OpenStream)( struct PaUtilHostApiRepresentation *hostApi,
207 PaStream** stream,
208 const PaStreamParameters *inputParameters,
209 const PaStreamParameters *outputParameters,
210 double sampleRate,
211 unsigned long framesPerCallback,
212 PaStreamFlags streamFlags,
213 PaStreamCallback *streamCallback,
214 void *userData );
215
216
217 PaError (*IsFormatSupported)( struct PaUtilHostApiRepresentation *hostApi,
218 const PaStreamParameters *inputParameters,
219 const PaStreamParameters *outputParameters,
220 double sampleRate );
221 } PaUtilHostApiRepresentation;
222
223
224 /** Prototype for the initialization function which must be implemented by every
225 host API.
226
227 This function should only return an error other than paNoError if it encounters
228 an unexpected and fatal error (memory allocation error for example). In general,
229 there may be conditions under which it returns a NULL interface pointer and also
230 returns paNoError. For example, if the ASIO implementation detects that ASIO is
231 not installed, it should return a NULL interface, and paNoError.
232
233 @see paHostApiInitializers
234 */
235 typedef PaError PaUtilHostApiInitializer( PaUtilHostApiRepresentation**, PaHostApiIndex );
236
237
238 /** paHostApiInitializers is a NULL-terminated array of host API initialization
239 functions. These functions are called by pa_front.c to initialize the host APIs
240 when the client calls Pa_Initialize().
241
242 There is a platform specific file which defines paHostApiInitializers for that
243 platform, pa_win/pa_win_hostapis.c contains the Win32 definitions for example.
244 */
245 extern PaUtilHostApiInitializer *paHostApiInitializers[];
246
247
248 /** The index of the default host API in the paHostApiInitializers array.
249
250 There is a platform specific file which defines paDefaultHostApiIndex for that
251 platform, see pa_win/pa_win_hostapis.c for example.
252 */
253 extern int paDefaultHostApiIndex;
254
255
256 #ifdef __cplusplus
257 }
258 #endif /* __cplusplus */
259 #endif /* PA_HOSTAPI_H */

  ViewVC Help
Powered by ViewVC 1.1.22