Debian Codegraph @

external/portaudio/pa_front.c

raw symbols SCIP
1 /*
2 * $Id$
3 * Portable Audio I/O Library Multi-Host API front end
4 * Validate function parameters and manage multiple host APIs.
5 *
6 * Based on the Open Source API proposed by Ross Bencina
7 * Copyright (c) 1999-2008 Ross Bencina, Phil Burk
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining
10 * a copy of this software and associated documentation files
11 * (the "Software"), to deal in the Software without restriction,
12 * including without limitation the rights to use, copy, modify, merge,
13 * publish, distribute, sublicense, and/or sell copies of the Software,
14 * and to permit persons to whom the Software is furnished to do so,
15 * subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be
18 * included in all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
24 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
25 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 */
28
29 /*
30 * The text above constitutes the entire PortAudio license; however,
31 * the PortAudio community also makes the following non-binding requests:
32 *
33 * Any person wishing to distribute modifications to the Software is
34 * requested to send the modifications to the original developer so that
35 * they can be incorporated into the canonical version. It is also
36 * requested that these non-binding requests be included along with the
37 * license above.
38 */
39
40 /** @file
41 @ingroup common_src
42
43 @brief Implements PortAudio API functions defined in portaudio.h, checks
44 some errors, delegates platform-specific behavior to host API implementations.
45
46 Implements the functions defined in the PortAudio API (portaudio.h),
47 validates some parameters and checks for state inconsistencies before
48 forwarding API requests to specific Host API implementations (via the
49 interface declared in pa_hostapi.h), and Streams (via the interface
50 declared in pa_stream.h).
51
52 This file manages initialization and termination of Host API
53 implementations via initializer functions stored in the paHostApiInitializers
54 global array (usually defined in an os-specific pa_[os]_hostapis.c file).
55
56 This file maintains a list of all open streams and closes them at Pa_Terminate().
57
58 Some utility functions declared in pa_util.h are implemented in this file.
59
60 All PortAudio API functions can be conditionally compiled with logging code.
61 To compile with logging, define the PA_LOG_API_CALLS precompiler symbol.
62 */
63
64
65 #include <stdio.h>
66 #include <memory.h>
67 #include <string.h>
68 #include <stdlib.h> /* needed for strtol() */
69 #include <assert.h> /* needed by PA_VALIDATE_ENDIANNESS */
70
71 #include "portaudio.h"cxx . . $ `<file>/external/portaudio/portaudio.h`/
72 #include "pa_util.h"cxx . . $ `<file>/external/portaudio/pa_util.h`/
73 #include "pa_endianness.h"cxx . . $ `<file>/external/portaudio/pa_endianness.h`/
74 #include "pa_types.h"cxx . . $ `<file>/external/portaudio/pa_types.h`/
75 #include "pa_hostapi.h"cxx . . $ `<file>/external/portaudio/pa_hostapi.h`/
76 #include "pa_stream.h"cxx . . $ `<file>/external/portaudio/pa_stream.h`/
77 #include "pa_trace.h"cxx . . $ `<file>/external/portaudio/pa_trace.h`/ /* still useful?*/
78 #include "pa_debugprint.h"cxx . . $ `<file>/external/portaudio/pa_debugprint.h`/
79
80 #ifndef PA_GIT_REVISION
81 #include "pa_gitrevision.h"cxx . . $ `<file>/external/portaudio/pa_gitrevision.h`/
82 #endif
83
84 /**
85 * This is incremented if we make incompatible API changes.
86 * This version scheme is based loosely on http://semver.org/
87 */
88 #define paVersionMajorcxx . . $ `external/portaudio/pa_front.c:88:9`! 19
89
90 /**
91 * This is incremented when we add functionality in a backwards-compatible manner.
92 * Or it is set to zero when paVersionMajor is incremented.
93 */
94 #define paVersionMinorcxx . . $ `external/portaudio/pa_front.c:94:9`! 7
95
96 /**
97 * This is incremented when we make backwards-compatible bug fixes.
98 * Or it is set to zero when paVersionMinor changes.
99 */
100 #define paVersionSubMinorcxx . . $ `external/portaudio/pa_front.c:100:9`! 0
101
102 /**
103 * This is a combination of paVersionMajor, paVersionMinor and paVersionSubMinor.
104 * It will always increase so that version numbers can be compared as integers to
105 * see which is later.
106 */
107 #define paVersioncxx . . $ `external/portaudio/pa_front.c:107:9`! paMakeVersionNumbercxx . . $ `external/portaudio/portaudio.h:81:9`!(paVersionMajorcxx . . $ `external/portaudio/pa_front.c:88:9`!, paVersionMinorcxx . . $ `external/portaudio/pa_front.c:94:9`!, paVersionSubMinorcxx . . $ `external/portaudio/pa_front.c:100:9`!)
108
109 #define STRINGIFYcxx . . $ `external/portaudio/pa_front.c:109:9`!(x) #x
110 #define TOSTRINGcxx . . $ `external/portaudio/pa_front.c:110:9`!(x) STRINGIFYcxx . . $ `external/portaudio/pa_front.c:109:9`!(x)
111
112 #define PA_VERSION_STRING_cxx . . $ `external/portaudio/pa_front.c:112:9`! TOSTRINGcxx . . $ `external/portaudio/pa_front.c:110:9`!(paVersionMajorcxx . . $ `external/portaudio/pa_front.c:88:9`!) "." TOSTRINGcxx . . $ `external/portaudio/pa_front.c:110:9`!(paVersionMinorcxx . . $ `external/portaudio/pa_front.c:94:9`!) "." TOSTRINGcxx . . $ `external/portaudio/pa_front.c:110:9`!(paVersionSubMinorcxx . . $ `external/portaudio/pa_front.c:100:9`!)
113 #define PA_VERSION_TEXT_cxx . . $ `external/portaudio/pa_front.c:113:9`! "PortAudio V" PA_VERSION_STRING_cxx . . $ `external/portaudio/pa_front.c:112:9`! "-devel, revision " TOSTRINGcxx . . $ `external/portaudio/pa_front.c:110:9`!(PA_GIT_REVISIONcxx . . $ `external/portaudio/pa_gitrevision.h:1:9`!)
114
115 int Pa_GetVersioncxx . . $ Pa_GetVersion(b126dc7c1de90089).( void )
116 {
117 return paVersioncxx . . $ `external/portaudio/pa_front.c:107:9`!;
118 }
119
120 const char* Pa_GetVersionTextcxx . . $ Pa_GetVersionText(33a1f659e94feb42).( void )
121 {
122 return PA_VERSION_TEXT_cxx . . $ `external/portaudio/pa_front.c:113:9`!;
123 }
124
125 static PaVersionInfocxx . . $ PaVersionInfo# versionInfo_cxx . . $ versionInfo_. = {
126 /*.versionMajor =*/ paVersionMajorcxx . . $ `external/portaudio/pa_front.c:88:9`!,
127 /*.versionMinor =*/ paVersionMinorcxx . . $ `external/portaudio/pa_front.c:94:9`!,
128 /*.versionSubMinor =*/ paVersionSubMinorcxx . . $ `external/portaudio/pa_front.c:100:9`!,
129 /*.versionControlRevision =*/ TOSTRINGcxx . . $ `external/portaudio/pa_front.c:110:9`!(PA_GIT_REVISIONcxx . . $ `external/portaudio/pa_gitrevision.h:1:9`!),
130 /*.versionText =*/ PA_VERSION_TEXT_cxx . . $ `external/portaudio/pa_front.c:113:9`!
131 };
132
133 const PaVersionInfocxx . . $ PaVersionInfo#* Pa_GetVersionInfocxx . . $ Pa_GetVersionInfo(cc51974518d5abdc).( void )
134 {
135 return &versionInfo_cxx . . $ versionInfo_.;
136 }
137
138 #define PA_LAST_HOST_ERROR_TEXT_LENGTH_cxx . . $ `external/portaudio/pa_front.c:138:9`! 1024
139
140 static char lastHostErrorText_cxx . . $ lastHostErrorText_.[ PA_LAST_HOST_ERROR_TEXT_LENGTH_cxx . . $ `external/portaudio/pa_front.c:138:9`! + 1 ] = {0};
141
142 static PaHostErrorInfocxx . . $ PaHostErrorInfo# lastHostErrorInfo_cxx . . $ lastHostErrorInfo_. = { (PaHostApiTypeIdcxx . . $ PaHostApiTypeId#)-1, 0, lastHostErrorText_cxx . . $ lastHostErrorText_. };
143
144
145 void PaUtil_SetLastHostErrorInfocxx . . $ PaUtil_SetLastHostErrorInfo(3000fca3c08738dd).( PaHostApiTypeIdcxx . . $ PaHostApiTypeId# hostApiType, long errorCode,
146 const char *errorText )
147 {
148 lastHostErrorInfo_cxx . . $ lastHostErrorInfo_..hostApiTypecxx . . $ PaHostErrorInfo#hostApiType. = hostApiType;
149 lastHostErrorInfo_cxx . . $ lastHostErrorInfo_..errorCodecxx . . $ PaHostErrorInfo#errorCode. = errorCode;
150
151 strncpycxx . . $ strncpy(255158a415b673b0).( lastHostErrorText_cxx . . $ lastHostErrorText_., errorText, PA_LAST_HOST_ERROR_TEXT_LENGTH_cxx . . $ `external/portaudio/pa_front.c:138:9`! );
152 }
153
154
155
156 static PaUtilHostApiRepresentationcxx . . $ PaUtilHostApiRepresentation# **hostApis_cxx . . $ hostApis_. = 0;
157 static int hostApisCount_cxx . . $ hostApisCount_. = 0;
158 static int defaultHostApiIndex_cxx . . $ defaultHostApiIndex_. = 0;
159 static int initializationCount_cxx . . $ initializationCount_. = 0;
160 static int deviceCount_cxx . . $ deviceCount_. = 0;
161
162 PaUtilStreamRepresentationcxx . . $ PaUtilStreamRepresentation# *firstOpenStream_cxx . . $ firstOpenStream_. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
163
164
165 #define PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! (initializationCount_ != 0)
166
167
168 static int CountHostApiInitializerscxx . . $ CountHostApiInitializers(b126dc7c1de90089).( void )
169 {
170 int result = 0;
171
172 while( paHostApiInitializerscxx . . $ paHostApiInitializers.[ result ] != 0 )
173 ++result;
174 return result;
175 }
176
177
178 static void TerminateHostApiscxx . . $ TerminateHostApis(49f6e7a06ebc5aa8).( void )
179 {
180 /* terminate in reverse order from initialization */
181 PA_DEBUGcxx . . $ `external/portaudio/pa_debugprint.h:99:9`!(("TerminateHostApis in \n"));
182
183 while( hostApisCount_cxx . . $ hostApisCount_. > 0 )
184 {
185 --hostApisCount_cxx . . $ hostApisCount_.;
186 hostApis_cxx . . $ hostApis_.[hostApisCount_cxx . . $ hostApisCount_.]->Terminatecxx . . $ PaUtilHostApiRepresentation#Terminate.( hostApis_cxx . . $ hostApis_.[hostApisCount_cxx . . $ hostApisCount_.] );
187 }
188 hostApisCount_cxx . . $ hostApisCount_. = 0;
189 defaultHostApiIndex_cxx . . $ defaultHostApiIndex_. = 0;
190 deviceCount_cxx . . $ deviceCount_. = 0;
191
192 if( hostApis_cxx . . $ hostApis_. != 0 )
193 PaUtil_FreeMemorycxx . . $ PaUtil_FreeMemory(5d22bdacc48458e8).( hostApis_cxx . . $ hostApis_. );
194 hostApis_cxx . . $ hostApis_. = 0;
195
196 PA_DEBUGcxx . . $ `external/portaudio/pa_debugprint.h:99:9`!(("TerminateHostApis out\n"));
197 }
198
199
200 static PaErrorcxx . . $ PaError# InitializeHostApiscxx . . $ InitializeHostApis(b126dc7c1de90089).( void )
201 {
202 PaErrorcxx . . $ PaError# result = paNoErrorcxx . . $ paNoError.;
203 int i, initializerCount, baseDeviceIndex;
204
205 initializerCount = CountHostApiInitializerscxx . . $ CountHostApiInitializers(b126dc7c1de90089).();
206
207 hostApis_cxx . . $ hostApis_. = (PaUtilHostApiRepresentationcxx . . $ PaUtilHostApiRepresentation#**)PaUtil_AllocateMemorycxx . . $ PaUtil_AllocateMemory(1de1fe46563a6a2a).(
208 sizeof(PaUtilHostApiRepresentationcxx . . $ PaUtilHostApiRepresentation#*) * initializerCount );
209 if( !hostApis_cxx . . $ hostApis_. )
210 {
211 result = paInsufficientMemorycxx . . $ paInsufficientMemory.;
212 goto error;
213 }
214
215 hostApisCount_cxx . . $ hostApisCount_. = 0;
216 defaultHostApiIndex_cxx . . $ defaultHostApiIndex_. = -1; /* indicates that we haven't determined the default host API yet */
217 deviceCount_cxx . . $ deviceCount_. = 0;
218 baseDeviceIndex = 0;
219
220 for( i=0; i< initializerCount; ++i )
221 {
222 hostApis_cxx . . $ hostApis_.[hostApisCount_cxx . . $ hostApisCount_.] = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
223
224 PA_DEBUGcxx . . $ `external/portaudio/pa_debugprint.h:99:9`!(( "before paHostApiInitializers[%d].\n",i));
225
226 result = paHostApiInitializerscxx . . $ paHostApiInitializers.[i]( &hostApis_cxx . . $ hostApis_.[hostApisCount_cxx . . $ hostApisCount_.], hostApisCount_cxx . . $ hostApisCount_. );
227 if( result != paNoErrorcxx . . $ paNoError. )
228 goto error;
229
230 PA_DEBUGcxx . . $ `external/portaudio/pa_debugprint.h:99:9`!(( "after paHostApiInitializers[%d].\n",i));
231
232 if( hostApis_cxx . . $ hostApis_.[hostApisCount_cxx . . $ hostApisCount_.] )
233 {
234 PaUtilHostApiRepresentationcxx . . $ PaUtilHostApiRepresentation#* hostApi = hostApis_cxx . . $ hostApis_.[hostApisCount_cxx . . $ hostApisCount_.];
235 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!( hostApi->info.defaultInputDevice < hostApi->info.deviceCount );
236 assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!( hostApi->info.defaultOutputDevice < hostApi->info.deviceCount );
237
238 /* the first successfully initialized host API with a default input *or*
239 output device is used as the default host API.
240 */
241 if( (defaultHostApiIndex_cxx . . $ defaultHostApiIndex_. == -1) &&
242 ( hostApi->infocxx . . $ PaUtilHostApiRepresentation#info..defaultInputDevicecxx . . $ PaHostApiInfo#defaultInputDevice. != paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`!
243 || hostApi->infocxx . . $ PaUtilHostApiRepresentation#info..defaultOutputDevicecxx . . $ PaHostApiInfo#defaultOutputDevice. != paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`! ) )
244 {
245 defaultHostApiIndex_cxx . . $ defaultHostApiIndex_. = hostApisCount_cxx . . $ hostApisCount_.;
246 }
247
248 hostApi->privatePaFrontInfocxx . . $ PaUtilHostApiRepresentation#privatePaFrontInfo..baseDeviceIndexcxx . . $ PaUtilPrivatePaFrontHostApiInfo#baseDeviceIndex. = baseDeviceIndex;
249
250 if( hostApi->infocxx . . $ PaUtilHostApiRepresentation#info..defaultInputDevicecxx . . $ PaHostApiInfo#defaultInputDevice. != paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`! )
251 hostApi->infocxx . . $ PaUtilHostApiRepresentation#info..defaultInputDevicecxx . . $ PaHostApiInfo#defaultInputDevice. += baseDeviceIndex;
252
253 if( hostApi->infocxx . . $ PaUtilHostApiRepresentation#info..defaultOutputDevicecxx . . $ PaHostApiInfo#defaultOutputDevice. != paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`! )
254 hostApi->infocxx . . $ PaUtilHostApiRepresentation#info..defaultOutputDevicecxx . . $ PaHostApiInfo#defaultOutputDevice. += baseDeviceIndex;
255
256 baseDeviceIndex += hostApi->infocxx . . $ PaUtilHostApiRepresentation#info..deviceCountcxx . . $ PaHostApiInfo#deviceCount.;
257 deviceCount_cxx . . $ deviceCount_. += hostApi->infocxx . . $ PaUtilHostApiRepresentation#info..deviceCountcxx . . $ PaHostApiInfo#deviceCount.;
258
259 ++hostApisCount_cxx . . $ hostApisCount_.;
260 }
261 }
262
263 /* if no host APIs have devices, the default host API is the first initialized host API */
264 if( defaultHostApiIndex_cxx . . $ defaultHostApiIndex_. == -1 )
265 defaultHostApiIndex_cxx . . $ defaultHostApiIndex_. = 0;
266
267 return result;
268
269 error:
270 TerminateHostApiscxx . . $ TerminateHostApis(49f6e7a06ebc5aa8).();
271 return result;
272 }
273
274
275 /*
276 FindHostApi() finds the index of the host api to which
277 <device> belongs and returns it. if <hostSpecificDeviceIndex> is
278 non-null, the host specific device index is returned in it.
279 returns -1 if <device> is out of range.
280
281 */
282 static int FindHostApicxx . . $ FindHostApi(ac48f4a6ffa9e770).( PaDeviceIndexcxx . . $ PaDeviceIndex# device, int *hostSpecificDeviceIndex )
283 {
284 int i=0;
285
286 if( !PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! )
287 return -1;
288
289 if( device < 0 )
290 return -1;
291
292 while( i < hostApisCount_cxx . . $ hostApisCount_.
293 && device >= hostApis_cxx . . $ hostApis_.[i]->infocxx . . $ PaUtilHostApiRepresentation#info..deviceCountcxx . . $ PaHostApiInfo#deviceCount. )
294 {
295
296 device -= hostApis_cxx . . $ hostApis_.[i]->infocxx . . $ PaUtilHostApiRepresentation#info..deviceCountcxx . . $ PaHostApiInfo#deviceCount.;
297 ++i;
298 }
299
300 if( i >= hostApisCount_cxx . . $ hostApisCount_. )
301 return -1;
302
303 if( hostSpecificDeviceIndex )
304 *hostSpecificDeviceIndex = device;
305
306 return i;
307 }
308
309
310 static void AddOpenStreamcxx . . $ AddOpenStream(5d22bdacc48458e8).( PaStreamcxx . . $ PaStream#* stream )
311 {
312 ((PaUtilStreamRepresentationcxx . . $ PaUtilStreamRepresentation#*)stream)->nextOpenStreamcxx . . $ PaUtilStreamRepresentation#nextOpenStream. = firstOpenStream_cxx . . $ firstOpenStream_.;
313 firstOpenStream_cxx . . $ firstOpenStream_. = (PaUtilStreamRepresentationcxx . . $ PaUtilStreamRepresentation#*)stream;
314 }
315
316
317 static void RemoveOpenStreamcxx . . $ RemoveOpenStream(5d22bdacc48458e8).( PaStreamcxx . . $ PaStream#* stream )
318 {
319 PaUtilStreamRepresentationcxx . . $ PaUtilStreamRepresentation# *previous = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
320 PaUtilStreamRepresentationcxx . . $ PaUtilStreamRepresentation# *current = firstOpenStream_cxx . . $ firstOpenStream_.;
321
322 while( current != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! )
323 {
324 if( ((PaStreamcxx . . $ PaStream#*)current) == stream )
325 {
326 if( previous == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! )
327 {
328 firstOpenStream_cxx . . $ firstOpenStream_. = current->nextOpenStreamcxx . . $ PaUtilStreamRepresentation#nextOpenStream.;
329 }
330 else
331 {
332 previous->nextOpenStreamcxx . . $ PaUtilStreamRepresentation#nextOpenStream. = current->nextOpenStreamcxx . . $ PaUtilStreamRepresentation#nextOpenStream.;
333 }
334 return;
335 }
336 else
337 {
338 previous = current;
339 current = current->nextOpenStreamcxx . . $ PaUtilStreamRepresentation#nextOpenStream.;
340 }
341 }
342 }
343
344
345 static void CloseOpenStreamscxx . . $ CloseOpenStreams(49f6e7a06ebc5aa8).( void )
346 {
347 /* we call Pa_CloseStream() here to ensure that the same destruction
348 logic is used for automatically closed streams */
349
350 while( firstOpenStream_cxx . . $ firstOpenStream_. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! )
351 Pa_CloseStreamcxx . . $ Pa_CloseStream(dedf1e9b1c614a07).( firstOpenStream_cxx . . $ firstOpenStream_. );
352 }
353
354
355 PaErrorcxx . . $ PaError# Pa_Initializecxx . . $ Pa_Initialize(b126dc7c1de90089).( void )
356 {
357 PaErrorcxx . . $ PaError# result;
358
359 PA_LOGAPI_ENTERcxx . . $ `external/portaudio/pa_debugprint.h:128:9`!( "Pa_Initialize" );
360
361 if( PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! )
362 {
363 ++initializationCount_cxx . . $ initializationCount_.;
364 result = paNoErrorcxx . . $ paNoError.;
365 }
366 else
367 {
368 PA_VALIDATE_TYPE_SIZEScxx . . $ `external/portaudio/pa_types.h:98:9`!;
369 PA_VALIDATE_ENDIANNESScxx . . $ `external/portaudio/pa_endianness.h:74:17`!;
370
371 PaUtil_InitializeClockcxx . . $ PaUtil_InitializeClock(49f6e7a06ebc5aa8).();
372 PaUtil_ResetTraceMessagescxx . . $ `external/portaudio/pa_trace.h:100:9`!();
373
374 result = InitializeHostApiscxx . . $ InitializeHostApis(b126dc7c1de90089).();
375 if( result == paNoErrorcxx . . $ paNoError. )
376 ++initializationCount_cxx . . $ initializationCount_.;
377 }
378
379 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_Initialize", result );
380
381 return result;
382 }
383
384
385 PaErrorcxx . . $ PaError# Pa_Terminatecxx . . $ Pa_Terminate(b126dc7c1de90089).( void )
386 {
387 PaErrorcxx . . $ PaError# result;
388
389 PA_LOGAPI_ENTERcxx . . $ `external/portaudio/pa_debugprint.h:128:9`!( "Pa_Terminate" );
390
391 if( PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! )
392 {
393 // leave initializationCount_>0 so that Pa_CloseStream() can execute
394 if( initializationCount_cxx . . $ initializationCount_. == 1 )
395 {
396 CloseOpenStreamscxx . . $ CloseOpenStreams(49f6e7a06ebc5aa8).();
397
398 TerminateHostApiscxx . . $ TerminateHostApis(49f6e7a06ebc5aa8).();
399
400 PaUtil_DumpTraceMessagescxx . . $ `external/portaudio/pa_trace.h:102:9`!();
401 }
402 --initializationCount_cxx . . $ initializationCount_.;
403 result = paNoErrorcxx . . $ paNoError.;
404 }
405 else
406 {
407 result= paNotInitializedcxx . . $ paNotInitialized.;
408 }
409
410 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_Terminate", result );
411
412 return result;
413 }
414
415
416 const PaHostErrorInfocxx . . $ PaHostErrorInfo#* Pa_GetLastHostErrorInfocxx . . $ Pa_GetLastHostErrorInfo(67e4812b0c420481).( void )
417 {
418 return &lastHostErrorInfo_cxx . . $ lastHostErrorInfo_.;
419 }
420
421
422 const char *Pa_GetErrorTextcxx . . $ Pa_GetErrorText(f7ae7e56280f18ae).( PaErrorcxx . . $ PaError# errorCode )
423 {
424 const char *result;
425
426 switch( errorCode )
427 {
428 case paNoErrorcxx . . $ paNoError.: result = "Success"; break;
429 case paNotInitializedcxx . . $ paNotInitialized.: result = "PortAudio not initialized"; break;
430 /** @todo could catenate the last host error text to result in the case of paUnanticipatedHostError. see: http://www.portaudio.com/trac/ticket/114 */
431 case paUnanticipatedHostErrorcxx . . $ paUnanticipatedHostError.: result = "Unanticipated host error"; break;
432 case paInvalidChannelCountcxx . . $ paInvalidChannelCount.: result = "Invalid number of channels"; break;
433 case paInvalidSampleRatecxx . . $ paInvalidSampleRate.: result = "Invalid sample rate"; break;
434 case paInvalidDevicecxx . . $ paInvalidDevice.: result = "Invalid device"; break;
435 case paInvalidFlagcxx . . $ paInvalidFlag.: result = "Invalid flag"; break;
436 case paSampleFormatNotSupportedcxx . . $ paSampleFormatNotSupported.: result = "Sample format not supported"; break;
437 case paBadIODeviceCombinationcxx . . $ paBadIODeviceCombination.: result = "Illegal combination of I/O devices"; break;
438 case paInsufficientMemorycxx . . $ paInsufficientMemory.: result = "Insufficient memory"; break;
439 case paBufferTooBigcxx . . $ paBufferTooBig.: result = "Buffer too big"; break;
440 case paBufferTooSmallcxx . . $ paBufferTooSmall.: result = "Buffer too small"; break;
441 case paNullCallbackcxx . . $ paNullCallback.: result = "No callback routine specified"; break;
442 case paBadStreamPtrcxx . . $ paBadStreamPtr.: result = "Invalid stream pointer"; break;
443 case paTimedOutcxx . . $ paTimedOut.: result = "Wait timed out"; break;
444 case paInternalErrorcxx . . $ paInternalError.: result = "Internal PortAudio error"; break;
445 case paDeviceUnavailablecxx . . $ paDeviceUnavailable.: result = "Device unavailable"; break;
446 case paIncompatibleHostApiSpecificStreamInfocxx . . $ paIncompatibleHostApiSpecificStreamInfo.: result = "Incompatible host API specific stream info"; break;
447 case paStreamIsStoppedcxx . . $ paStreamIsStopped.: result = "Stream is stopped"; break;
448 case paStreamIsNotStoppedcxx . . $ paStreamIsNotStopped.: result = "Stream is not stopped"; break;
449 case paInputOverflowedcxx . . $ paInputOverflowed.: result = "Input overflowed"; break;
450 case paOutputUnderflowedcxx . . $ paOutputUnderflowed.: result = "Output underflowed"; break;
451 case paHostApiNotFoundcxx . . $ paHostApiNotFound.: result = "Host API not found"; break;
452 case paInvalidHostApicxx . . $ paInvalidHostApi.: result = "Invalid host API"; break;
453 case paCanNotReadFromACallbackStreamcxx . . $ paCanNotReadFromACallbackStream.: result = "Can't read from a callback stream"; break;
454 case paCanNotWriteToACallbackStreamcxx . . $ paCanNotWriteToACallbackStream.: result = "Can't write to a callback stream"; break;
455 case paCanNotReadFromAnOutputOnlyStreamcxx . . $ paCanNotReadFromAnOutputOnlyStream.: result = "Can't read from an output only stream"; break;
456 case paCanNotWriteToAnInputOnlyStreamcxx . . $ paCanNotWriteToAnInputOnlyStream.: result = "Can't write to an input only stream"; break;
457 case paIncompatibleStreamHostApicxx . . $ paIncompatibleStreamHostApi.: result = "Incompatible stream host API"; break;
458 case paBadBufferPtrcxx . . $ paBadBufferPtr.: result = "Bad buffer pointer"; break;
459 default:
460 if( errorCode > 0 )
461 result = "Invalid error code (value greater than zero)";
462 else
463 result = "Invalid error code";
464 break;
465 }
466 return result;
467 }
468
469
470 PaHostApiIndexcxx . . $ PaHostApiIndex# Pa_HostApiTypeIdToHostApiIndexcxx . . $ Pa_HostApiTypeIdToHostApiIndex(80a5f4da89f51f21).( PaHostApiTypeIdcxx . . $ PaHostApiTypeId# type )
471 {
472 PaHostApiIndexcxx . . $ PaHostApiIndex# result;
473 int i;
474
475 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_HostApiTypeIdToHostApiIndex" );
476 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaHostApiTypeId type: %d\n", type ));
477
478 if( !PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! )
479 {
480 result = paNotInitializedcxx . . $ paNotInitialized.;
481 }
482 else
483 {
484 result = paHostApiNotFoundcxx . . $ paHostApiNotFound.;
485
486 for( i=0; i < hostApisCount_cxx . . $ hostApisCount_.; ++i )
487 {
488 if( hostApis_cxx . . $ hostApis_.[i]->infocxx . . $ PaUtilHostApiRepresentation#info..typecxx . . $ PaHostApiInfo#type. == type )
489 {
490 result = i;
491 break;
492 }
493 }
494 }
495
496 PA_LOGAPI_EXIT_PAERROR_OR_T_RESULTcxx . . $ `external/portaudio/pa_debugprint.h:133:9`!( "Pa_HostApiTypeIdToHostApiIndex", "PaHostApiIndex: %d", result );
497
498 return result;
499 }
500
501
502 PaErrorcxx . . $ PaError# PaUtil_GetHostApiRepresentationcxx . . $ PaUtil_GetHostApiRepresentation(891f51ff3eddbfa4).( struct PaUtilHostApiRepresentationcxx . . $ PaUtilHostApiRepresentation# **hostApi,
503 PaHostApiTypeIdcxx . . $ PaHostApiTypeId# type )
504 {
505 PaErrorcxx . . $ PaError# result;
506 int i;
507
508 if( !PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! )
509 {
510 result = paNotInitializedcxx . . $ paNotInitialized.;
511 }
512 else
513 {
514 result = paHostApiNotFoundcxx . . $ paHostApiNotFound.;
515
516 for( i=0; i < hostApisCount_cxx . . $ hostApisCount_.; ++i )
517 {
518 if( hostApis_cxx . . $ hostApis_.[i]->infocxx . . $ PaUtilHostApiRepresentation#info..typecxx . . $ PaHostApiInfo#type. == type )
519 {
520 *hostApi = hostApis_cxx . . $ hostApis_.[i];
521 result = paNoErrorcxx . . $ paNoError.;
522 break;
523 }
524 }
525 }
526
527 return result;
528 }
529
530
531 PaErrorcxx . . $ PaError# PaUtil_DeviceIndexToHostApiDeviceIndexcxx . . $ PaUtil_DeviceIndexToHostApiDeviceIndex(3a812ccb7891580c).(
532 PaDeviceIndexcxx . . $ PaDeviceIndex# *hostApiDevice, PaDeviceIndexcxx . . $ PaDeviceIndex# device, struct PaUtilHostApiRepresentationcxx . . $ PaUtilHostApiRepresentation# *hostApi )
533 {
534 PaErrorcxx . . $ PaError# result;
535 PaDeviceIndexcxx . . $ PaDeviceIndex# x;
536
537 x = device - hostApi->privatePaFrontInfocxx . . $ PaUtilHostApiRepresentation#privatePaFrontInfo..baseDeviceIndexcxx . . $ PaUtilPrivatePaFrontHostApiInfo#baseDeviceIndex.;
538
539 if( x < 0 || x >= hostApi->infocxx . . $ PaUtilHostApiRepresentation#info..deviceCountcxx . . $ PaHostApiInfo#deviceCount. )
540 {
541 result = paInvalidDevicecxx . . $ paInvalidDevice.;
542 }
543 else
544 {
545 *hostApiDevice = x;
546 result = paNoErrorcxx . . $ paNoError.;
547 }
548
549 return result;
550 }
551
552
553 PaHostApiIndexcxx . . $ PaHostApiIndex# Pa_GetHostApiCountcxx . . $ Pa_GetHostApiCount(b126dc7c1de90089).( void )
554 {
555 int result;
556
557 PA_LOGAPI_ENTERcxx . . $ `external/portaudio/pa_debugprint.h:128:9`!( "Pa_GetHostApiCount" );
558
559 if( !PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! )
560 {
561 result = paNotInitializedcxx . . $ paNotInitialized.;
562 }
563 else
564 {
565 result = hostApisCount_cxx . . $ hostApisCount_.;
566 }
567
568 PA_LOGAPI_EXIT_PAERROR_OR_T_RESULTcxx . . $ `external/portaudio/pa_debugprint.h:133:9`!( "Pa_GetHostApiCount", "PaHostApiIndex: %d", result );
569
570 return result;
571 }
572
573
574 PaHostApiIndexcxx . . $ PaHostApiIndex# Pa_GetDefaultHostApicxx . . $ Pa_GetDefaultHostApi(b126dc7c1de90089).( void )
575 {
576 int result;
577
578 PA_LOGAPI_ENTERcxx . . $ `external/portaudio/pa_debugprint.h:128:9`!( "Pa_GetDefaultHostApi" );
579
580 if( !PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! )
581 {
582 result = paNotInitializedcxx . . $ paNotInitialized.;
583 }
584 else
585 {
586 result = defaultHostApiIndex_cxx . . $ defaultHostApiIndex_.;
587
588 /* internal consistency check: make sure that the default host api
589 index is within range */
590
591 if( result < 0 || result >= hostApisCount_cxx . . $ hostApisCount_. )
592 {
593 result = paInternalErrorcxx . . $ paInternalError.;
594 }
595 }
596
597 PA_LOGAPI_EXIT_PAERROR_OR_T_RESULTcxx . . $ `external/portaudio/pa_debugprint.h:133:9`!( "Pa_GetDefaultHostApi", "PaHostApiIndex: %d", result );
598
599 return result;
600 }
601
602
603 const PaHostApiInfocxx . . $ PaHostApiInfo#* Pa_GetHostApiInfocxx . . $ Pa_GetHostApiInfo(1034a51c680a6413).( PaHostApiIndexcxx . . $ PaHostApiIndex# hostApi )
604 {
605 PaHostApiInfocxx . . $ PaHostApiInfo# *info;
606
607 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_GetHostApiInfo" );
608 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaHostApiIndex hostApi: %d\n", hostApi ));
609
610 if( !PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! )
611 {
612 info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
613
614 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetHostApiInfo returned:\n" ));
615 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaHostApiInfo*: NULL [ PortAudio not initialized ]\n" ));
616
617 }
618 else if( hostApi < 0 || hostApi >= hostApisCount_cxx . . $ hostApisCount_. )
619 {
620 info = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
621
622 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetHostApiInfo returned:\n" ));
623 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaHostApiInfo*: NULL [ hostApi out of range ]\n" ));
624
625 }
626 else
627 {
628 info = &hostApis_cxx . . $ hostApis_.[hostApi]->infocxx . . $ PaUtilHostApiRepresentation#info.;
629
630 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetHostApiInfo returned:\n" ));
631 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaHostApiInfo*: 0x%p\n", info ));
632 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t{\n" ));
633 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t\tint structVersion: %d\n", info->structVersion ));
634 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t\tPaHostApiTypeId type: %d\n", info->type ));
635 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t\tconst char *name: %s\n", info->name ));
636 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t}\n" ));
637
638 }
639
640 return info;
641 }
642
643
644 PaDeviceIndexcxx . . $ PaDeviceIndex# Pa_HostApiDeviceIndexToDeviceIndexcxx . . $ Pa_HostApiDeviceIndexToDeviceIndex(9b79fb6aee4c0440).( PaHostApiIndexcxx . . $ PaHostApiIndex# hostApi, int hostApiDeviceIndex )
645 {
646 PaDeviceIndexcxx . . $ PaDeviceIndex# result;
647
648 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_HostApiDeviceIndexToPaDeviceIndex" );
649 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaHostApiIndex hostApi: %d\n", hostApi ));
650 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tint hostApiDeviceIndex: %d\n", hostApiDeviceIndex ));
651
652 if( !PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! )
653 {
654 result = paNotInitializedcxx . . $ paNotInitialized.;
655 }
656 else
657 {
658 if( hostApi < 0 || hostApi >= hostApisCount_cxx . . $ hostApisCount_. )
659 {
660 result = paInvalidHostApicxx . . $ paInvalidHostApi.;
661 }
662 else
663 {
664 if( hostApiDeviceIndex < 0 ||
665 hostApiDeviceIndex >= hostApis_cxx . . $ hostApis_.[hostApi]->infocxx . . $ PaUtilHostApiRepresentation#info..deviceCountcxx . . $ PaHostApiInfo#deviceCount. )
666 {
667 result = paInvalidDevicecxx . . $ paInvalidDevice.;
668 }
669 else
670 {
671 result = hostApis_cxx . . $ hostApis_.[hostApi]->privatePaFrontInfocxx . . $ PaUtilHostApiRepresentation#privatePaFrontInfo..baseDeviceIndexcxx . . $ PaUtilPrivatePaFrontHostApiInfo#baseDeviceIndex. + hostApiDeviceIndex;
672 }
673 }
674 }
675
676 PA_LOGAPI_EXIT_PAERROR_OR_T_RESULTcxx . . $ `external/portaudio/pa_debugprint.h:133:9`!( "Pa_HostApiDeviceIndexToPaDeviceIndex", "PaDeviceIndex: %d", result );
677
678 return result;
679 }
680
681
682 PaDeviceIndexcxx . . $ PaDeviceIndex# Pa_GetDeviceCountcxx . . $ Pa_GetDeviceCount(b126dc7c1de90089).( void )
683 {
684 PaDeviceIndexcxx . . $ PaDeviceIndex# result;
685
686 PA_LOGAPI_ENTERcxx . . $ `external/portaudio/pa_debugprint.h:128:9`!( "Pa_GetDeviceCount" );
687
688 if( !PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! )
689 {
690 result = paNotInitializedcxx . . $ paNotInitialized.;
691 }
692 else
693 {
694 result = deviceCount_cxx . . $ deviceCount_.;
695 }
696
697 PA_LOGAPI_EXIT_PAERROR_OR_T_RESULTcxx . . $ `external/portaudio/pa_debugprint.h:133:9`!( "Pa_GetDeviceCount", "PaDeviceIndex: %d", result );
698
699 return result;
700 }
701
702
703 PaDeviceIndexcxx . . $ PaDeviceIndex# Pa_GetDefaultInputDevicecxx . . $ Pa_GetDefaultInputDevice(b126dc7c1de90089).( void )
704 {
705 PaHostApiIndexcxx . . $ PaHostApiIndex# hostApi;
706 PaDeviceIndexcxx . . $ PaDeviceIndex# result;
707
708 PA_LOGAPI_ENTERcxx . . $ `external/portaudio/pa_debugprint.h:128:9`!( "Pa_GetDefaultInputDevice" );
709
710 hostApi = Pa_GetDefaultHostApicxx . . $ Pa_GetDefaultHostApi(b126dc7c1de90089).();
711 if( hostApi < 0 )
712 {
713 result = paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`!;
714 }
715 else
716 {
717 result = hostApis_cxx . . $ hostApis_.[hostApi]->infocxx . . $ PaUtilHostApiRepresentation#info..defaultInputDevicecxx . . $ PaHostApiInfo#defaultInputDevice.;
718 }
719
720 PA_LOGAPI_EXIT_Tcxx . . $ `external/portaudio/pa_debugprint.h:132:9`!( "Pa_GetDefaultInputDevice", "PaDeviceIndex: %d", result );
721
722 return result;
723 }
724
725
726 PaDeviceIndexcxx . . $ PaDeviceIndex# Pa_GetDefaultOutputDevicecxx . . $ Pa_GetDefaultOutputDevice(b126dc7c1de90089).( void )
727 {
728 PaHostApiIndexcxx . . $ PaHostApiIndex# hostApi;
729 PaDeviceIndexcxx . . $ PaDeviceIndex# result;
730
731 PA_LOGAPI_ENTERcxx . . $ `external/portaudio/pa_debugprint.h:128:9`!( "Pa_GetDefaultOutputDevice" );
732
733 hostApi = Pa_GetDefaultHostApicxx . . $ Pa_GetDefaultHostApi(b126dc7c1de90089).();
734 if( hostApi < 0 )
735 {
736 result = paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`!;
737 }
738 else
739 {
740 result = hostApis_cxx . . $ hostApis_.[hostApi]->infocxx . . $ PaUtilHostApiRepresentation#info..defaultOutputDevicecxx . . $ PaHostApiInfo#defaultOutputDevice.;
741 }
742
743 PA_LOGAPI_EXIT_Tcxx . . $ `external/portaudio/pa_debugprint.h:132:9`!( "Pa_GetDefaultOutputDevice", "PaDeviceIndex: %d", result );
744
745 return result;
746 }
747
748
749 const PaDeviceInfocxx . . $ PaDeviceInfo#* Pa_GetDeviceInfocxx . . $ Pa_GetDeviceInfo(28aab36fd6bfe1f2).( PaDeviceIndexcxx . . $ PaDeviceIndex# device )
750 {
751 int hostSpecificDeviceIndex;
752 int hostApiIndex = FindHostApicxx . . $ FindHostApi(ac48f4a6ffa9e770).( device, &hostSpecificDeviceIndex );
753 PaDeviceInfocxx . . $ PaDeviceInfo# *result;
754
755
756 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_GetDeviceInfo" );
757 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaDeviceIndex device: %d\n", device ));
758
759 if( hostApiIndex < 0 )
760 {
761 result = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
762
763 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetDeviceInfo returned:\n" ));
764 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaDeviceInfo* NULL [ invalid device index ]\n" ));
765
766 }
767 else
768 {
769 result = hostApis_cxx . . $ hostApis_.[hostApiIndex]->deviceInfoscxx . . $ PaUtilHostApiRepresentation#deviceInfos.[ hostSpecificDeviceIndex ];
770
771 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetDeviceInfo returned:\n" ));
772 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaDeviceInfo*: 0x%p:\n", result ));
773 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t{\n" ));
774
775 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t\tint structVersion: %d\n", result->structVersion ));
776 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t\tconst char *name: %s\n", result->name ));
777 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t\tPaHostApiIndex hostApi: %d\n", result->hostApi ));
778 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t\tint maxInputChannels: %d\n", result->maxInputChannels ));
779 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t\tint maxOutputChannels: %d\n", result->maxOutputChannels ));
780 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t}\n" ));
781
782 }
783
784 return result;
785 }
786
787
788 /*
789 SampleFormatIsValid() returns 1 if sampleFormat is a sample format
790 defined in portaudio.h, or 0 otherwise.
791 */
792 static int SampleFormatIsValidcxx . . $ SampleFormatIsValid(15f694ef3c96d230).( PaSampleFormatcxx . . $ PaSampleFormat# format )
793 {
794 switch( format & ~paNonInterleavedcxx . . $ `external/portaudio/portaudio.h:495:9`! )
795 {
796 case paFloat32cxx . . $ `external/portaudio/portaudio.h:487:9`!: return 1;
797 case paInt16cxx . . $ `external/portaudio/portaudio.h:490:9`!: return 1;
798 case paInt32cxx . . $ `external/portaudio/portaudio.h:488:9`!: return 1;
799 case paInt24cxx . . $ `external/portaudio/portaudio.h:489:9`!: return 1;
800 case paInt8cxx . . $ `external/portaudio/portaudio.h:491:9`!: return 1;
801 case paUInt8cxx . . $ `external/portaudio/portaudio.h:492:9`!: return 1;
802 case paCustomFormatcxx . . $ `external/portaudio/portaudio.h:493:9`!: return 1;
803 default: return 0;
804 }
805 }
806
807 /*
808 NOTE: make sure this validation list is kept synchronised with the one in
809 pa_hostapi.h
810
811 ValidateOpenStreamParameters() checks that parameters to Pa_OpenStream()
812 conform to the expected values as described below. This function is
813 also designed to be used with the proposed Pa_IsFormatSupported() function.
814
815 There are basically two types of validation that could be performed:
816 Generic conformance validation, and device capability mismatch
817 validation. This function performs only generic conformance validation.
818 Validation that would require knowledge of device capabilities is
819 not performed because of potentially complex relationships between
820 combinations of parameters - for example, even if the sampleRate
821 seems ok, it might not be for a duplex stream - we have no way of
822 checking this in an API-neutral way, so we don't try.
823
824 On success the function returns PaNoError and fills in hostApi,
825 hostApiInputDeviceID, and hostApiOutputDeviceID fields. On failure
826 the function returns an error code indicating the first encountered
827 parameter error.
828
829
830 If ValidateOpenStreamParameters() returns paNoError, the following
831 assertions are guaranteed to be true.
832
833 - at least one of inputParameters & outputParmeters is valid (not NULL)
834
835 - if inputParameters & outputParameters are both valid, that
836 inputParameters->device & outputParameters->device both use the same host api
837
838 PaDeviceIndex inputParameters->device
839 - is within range (0 to Pa_GetDeviceCount-1) Or:
840 - is paUseHostApiSpecificDeviceSpecification and
841 inputParameters->hostApiSpecificStreamInfo is non-NULL and refers
842 to a valid host api
843
844 int inputParameters->channelCount
845 - if inputParameters->device is not paUseHostApiSpecificDeviceSpecification, channelCount is > 0
846 - upper bound is NOT validated against device capabilities
847
848 PaSampleFormat inputParameters->sampleFormat
849 - is one of the sample formats defined in portaudio.h
850
851 void *inputParameters->hostApiSpecificStreamInfo
852 - if supplied its hostApi field matches the input device's host Api
853
854 PaDeviceIndex outputParmeters->device
855 - is within range (0 to Pa_GetDeviceCount-1)
856
857 int outputParmeters->channelCount
858 - if inputDevice is valid, channelCount is > 0
859 - upper bound is NOT validated against device capabilities
860
861 PaSampleFormat outputParmeters->sampleFormat
862 - is one of the sample formats defined in portaudio.h
863
864 void *outputParmeters->hostApiSpecificStreamInfo
865 - if supplied its hostApi field matches the output device's host Api
866
867 double sampleRate
868 - is not an 'absurd' rate (less than 1000. or greater than 384000.)
869 - sampleRate is NOT validated against device capabilities
870
871 PaStreamFlags streamFlags
872 - unused platform neutral flags are zero
873 - paNeverDropInput is only used for full-duplex callback streams with
874 variable buffer size (paFramesPerBufferUnspecified)
875 */
876 static PaErrorcxx . . $ PaError# ValidateOpenStreamParameterscxx . . $ ValidateOpenStreamParameters(3462a2af572bacde).(
877 const PaStreamParameterscxx . . $ PaStreamParameters# *inputParameters,
878 const PaStreamParameterscxx . . $ PaStreamParameters# *outputParameters,
879 double sampleRate,
880 unsigned long framesPerBuffer,
881 PaStreamFlagscxx . . $ PaStreamFlags# streamFlags,
882 PaStreamCallbackcxx . . $ PaStreamCallback# *streamCallback,
883 PaUtilHostApiRepresentationcxx . . $ PaUtilHostApiRepresentation# **hostApi,
884 PaDeviceIndexcxx . . $ PaDeviceIndex# *hostApiInputDevice,
885 PaDeviceIndexcxx . . $ PaDeviceIndex# *hostApiOutputDevice )
886 {
887 int inputHostApiIndex = -1; /* Suppress uninitialised var warnings: compiler does */
888 int outputHostApiIndex = -1; /* not see that if inputParameters and outputParameters */
889 /* are both nonzero, these indices are set. */
890
891 if( (inputParameters == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (outputParameters == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) )
892 {
893 return paInvalidDevicecxx . . $ paInvalidDevice.; /** @todo should be a new error code "invalid device parameters" or something */
894 }
895 else
896 {
897 if( inputParameters == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! )
898 {
899 *hostApiInputDevice = paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`!;
900 }
901 else if( inputParameters->devicecxx . . $ PaStreamParameters#device. == paUseHostApiSpecificDeviceSpecificationcxx . . $ `external/portaudio/portaudio.h:228:9`! )
902 {
903 if( inputParameters->hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo. )
904 {
905 inputHostApiIndex = Pa_HostApiTypeIdToHostApiIndexcxx . . $ Pa_HostApiTypeIdToHostApiIndex(80a5f4da89f51f21).(
906 ((PaUtilHostApiSpecificStreamInfoHeadercxx . . $ PaUtilHostApiSpecificStreamInfoHeader#*)inputParameters->hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo.)->hostApiTypecxx . . $ PaUtilHostApiSpecificStreamInfoHeader#hostApiType. );
907
908 if( inputHostApiIndex != -1 )
909 {
910 *hostApiInputDevice = paUseHostApiSpecificDeviceSpecificationcxx . . $ `external/portaudio/portaudio.h:228:9`!;
911 *hostApi = hostApis_cxx . . $ hostApis_.[inputHostApiIndex];
912 }
913 else
914 {
915 return paInvalidDevicecxx . . $ paInvalidDevice.;
916 }
917 }
918 else
919 {
920 return paInvalidDevicecxx . . $ paInvalidDevice.;
921 }
922 }
923 else
924 {
925 if( inputParameters->devicecxx . . $ PaStreamParameters#device. < 0 || inputParameters->devicecxx . . $ PaStreamParameters#device. >= deviceCount_cxx . . $ deviceCount_. )
926 return paInvalidDevicecxx . . $ paInvalidDevice.;
927
928 inputHostApiIndex = FindHostApicxx . . $ FindHostApi(ac48f4a6ffa9e770).( inputParameters->devicecxx . . $ PaStreamParameters#device., hostApiInputDevice );
929 if( inputHostApiIndex < 0 )
930 return paInternalErrorcxx . . $ paInternalError.;
931
932 *hostApi = hostApis_cxx . . $ hostApis_.[inputHostApiIndex];
933
934 if( inputParameters->channelCountcxx . . $ PaStreamParameters#channelCount. <= 0 )
935 return paInvalidChannelCountcxx . . $ paInvalidChannelCount.;
936
937 if( !SampleFormatIsValidcxx . . $ SampleFormatIsValid(15f694ef3c96d230).( inputParameters->sampleFormatcxx . . $ PaStreamParameters#sampleFormat. ) )
938 return paSampleFormatNotSupportedcxx . . $ paSampleFormatNotSupported.;
939
940 if( inputParameters->hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! )
941 {
942 if( ((PaUtilHostApiSpecificStreamInfoHeadercxx . . $ PaUtilHostApiSpecificStreamInfoHeader#*)inputParameters->hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo.)->hostApiTypecxx . . $ PaUtilHostApiSpecificStreamInfoHeader#hostApiType.
943 != (*hostApi)->infocxx . . $ PaUtilHostApiRepresentation#info..typecxx . . $ PaHostApiInfo#type. )
944 return paIncompatibleHostApiSpecificStreamInfocxx . . $ paIncompatibleHostApiSpecificStreamInfo.;
945 }
946 }
947
948 if( outputParameters == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! )
949 {
950 *hostApiOutputDevice = paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`!;
951 }
952 else if( outputParameters->devicecxx . . $ PaStreamParameters#device. == paUseHostApiSpecificDeviceSpecificationcxx . . $ `external/portaudio/portaudio.h:228:9`! )
953 {
954 if( outputParameters->hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo. )
955 {
956 outputHostApiIndex = Pa_HostApiTypeIdToHostApiIndexcxx . . $ Pa_HostApiTypeIdToHostApiIndex(80a5f4da89f51f21).(
957 ((PaUtilHostApiSpecificStreamInfoHeadercxx . . $ PaUtilHostApiSpecificStreamInfoHeader#*)outputParameters->hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo.)->hostApiTypecxx . . $ PaUtilHostApiSpecificStreamInfoHeader#hostApiType. );
958
959 if( outputHostApiIndex != -1 )
960 {
961 *hostApiOutputDevice = paUseHostApiSpecificDeviceSpecificationcxx . . $ `external/portaudio/portaudio.h:228:9`!;
962 *hostApi = hostApis_cxx . . $ hostApis_.[outputHostApiIndex];
963 }
964 else
965 {
966 return paInvalidDevicecxx . . $ paInvalidDevice.;
967 }
968 }
969 else
970 {
971 return paInvalidDevicecxx . . $ paInvalidDevice.;
972 }
973 }
974 else
975 {
976 if( outputParameters->devicecxx . . $ PaStreamParameters#device. < 0 || outputParameters->devicecxx . . $ PaStreamParameters#device. >= deviceCount_cxx . . $ deviceCount_. )
977 return paInvalidDevicecxx . . $ paInvalidDevice.;
978
979 outputHostApiIndex = FindHostApicxx . . $ FindHostApi(ac48f4a6ffa9e770).( outputParameters->devicecxx . . $ PaStreamParameters#device., hostApiOutputDevice );
980 if( outputHostApiIndex < 0 )
981 return paInternalErrorcxx . . $ paInternalError.;
982
983 *hostApi = hostApis_cxx . . $ hostApis_.[outputHostApiIndex];
984
985 if( outputParameters->channelCountcxx . . $ PaStreamParameters#channelCount. <= 0 )
986 return paInvalidChannelCountcxx . . $ paInvalidChannelCount.;
987
988 if( !SampleFormatIsValidcxx . . $ SampleFormatIsValid(15f694ef3c96d230).( outputParameters->sampleFormatcxx . . $ PaStreamParameters#sampleFormat. ) )
989 return paSampleFormatNotSupportedcxx . . $ paSampleFormatNotSupported.;
990
991 if( outputParameters->hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! )
992 {
993 if( ((PaUtilHostApiSpecificStreamInfoHeadercxx . . $ PaUtilHostApiSpecificStreamInfoHeader#*)outputParameters->hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo.)->hostApiTypecxx . . $ PaUtilHostApiSpecificStreamInfoHeader#hostApiType.
994 != (*hostApi)->infocxx . . $ PaUtilHostApiRepresentation#info..typecxx . . $ PaHostApiInfo#type. )
995 return paIncompatibleHostApiSpecificStreamInfocxx . . $ paIncompatibleHostApiSpecificStreamInfo.;
996 }
997 }
998
999 if( (inputParameters != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && (outputParameters != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) )
1000 {
1001 /* ensure that both devices use the same API */
1002 if( inputHostApiIndex != outputHostApiIndex )
1003 return paBadIODeviceCombinationcxx . . $ paBadIODeviceCombination.;
1004 }
1005 }
1006
1007
1008 /* Check for absurd sample rates. */
1009 if( (sampleRate < 1000.0) || (sampleRate > 384000.0) )
1010 return paInvalidSampleRatecxx . . $ paInvalidSampleRate.;
1011
1012 if( ((streamFlags & ~paPlatformSpecificFlagscxx . . $ `external/portaudio/portaudio.h:690:11`!) & ~(paClipOffcxx . . $ `external/portaudio/portaudio.h:661:11`! | paDitherOffcxx . . $ `external/portaudio/portaudio.h:666:11`! | paNeverDropInputcxx . . $ `external/portaudio/portaudio.h:677:11`! | paPrimeOutputBuffersUsingStreamCallbackcxx . . $ `external/portaudio/portaudio.h:685:11`! ) ) != 0 )
1013 return paInvalidFlagcxx . . $ paInvalidFlag.;
1014
1015 if( streamFlags & paNeverDropInputcxx . . $ `external/portaudio/portaudio.h:677:11`! )
1016 {
1017 /* must be a callback stream */
1018 if( !streamCallback )
1019 return paInvalidFlagcxx . . $ paInvalidFlag.;
1020
1021 /* must be a full duplex stream */
1022 if( (inputParameters == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) || (outputParameters == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) )
1023 return paInvalidFlagcxx . . $ paInvalidFlag.;
1024
1025 /* must use paFramesPerBufferUnspecified */
1026 if( framesPerBuffer != paFramesPerBufferUnspecifiedcxx . . $ `external/portaudio/portaudio.h:642:9`! )
1027 return paInvalidFlagcxx . . $ paInvalidFlag.;
1028 }
1029
1030 return paNoErrorcxx . . $ paNoError.;
1031 }
1032
1033
1034 PaErrorcxx . . $ PaError# Pa_IsFormatSupportedcxx . . $ Pa_IsFormatSupported(627f4d77c88accb2).( const PaStreamParameterscxx . . $ PaStreamParameters# *inputParameters,
1035 const PaStreamParameterscxx . . $ PaStreamParameters# *outputParameters,
1036 double sampleRate )
1037 {
1038 PaErrorcxx . . $ PaError# result;
1039 PaUtilHostApiRepresentationcxx . . $ PaUtilHostApiRepresentation# *hostApi = 0;
1040 PaDeviceIndexcxx . . $ PaDeviceIndex# hostApiInputDevice = paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`!, hostApiOutputDevice = paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`!;
1041 PaStreamParameterscxx . . $ PaStreamParameters# hostApiInputParameters, hostApiOutputParameters;
1042 PaStreamParameterscxx . . $ PaStreamParameters# *hostApiInputParametersPtr, *hostApiOutputParametersPtr;
1043
1044
1045 #ifdef PA_LOG_API_CALLS
1046 PA_LOGAPI_ENTER_PARAMS( "Pa_IsFormatSupported" );
1047
1048 if( inputParameters == NULL ){
1049 PA_LOGAPI(("\tPaStreamParameters *inputParameters: NULL\n" ));
1050 }else{
1051 PA_LOGAPI(("\tPaStreamParameters *inputParameters: 0x%p\n", inputParameters ));
1052 PA_LOGAPI(("\tPaDeviceIndex inputParameters->device: %d\n", inputParameters->device ));
1053 PA_LOGAPI(("\tint inputParameters->channelCount: %d\n", inputParameters->channelCount ));
1054 PA_LOGAPI(("\tPaSampleFormat inputParameters->sampleFormat: %d\n", inputParameters->sampleFormat ));
1055 PA_LOGAPI(("\tPaTime inputParameters->suggestedLatency: %f\n", inputParameters->suggestedLatency ));
1056 PA_LOGAPI(("\tvoid *inputParameters->hostApiSpecificStreamInfo: 0x%p\n", inputParameters->hostApiSpecificStreamInfo ));
1057 }
1058
1059 if( outputParameters == NULL ){
1060 PA_LOGAPI(("\tPaStreamParameters *outputParameters: NULL\n" ));
1061 }else{
1062 PA_LOGAPI(("\tPaStreamParameters *outputParameters: 0x%p\n", outputParameters ));
1063 PA_LOGAPI(("\tPaDeviceIndex outputParameters->device: %d\n", outputParameters->device ));
1064 PA_LOGAPI(("\tint outputParameters->channelCount: %d\n", outputParameters->channelCount ));
1065 PA_LOGAPI(("\tPaSampleFormat outputParameters->sampleFormat: %d\n", outputParameters->sampleFormat ));
1066 PA_LOGAPI(("\tPaTime outputParameters->suggestedLatency: %f\n", outputParameters->suggestedLatency ));
1067 PA_LOGAPI(("\tvoid *outputParameters->hostApiSpecificStreamInfo: 0x%p\n", outputParameters->hostApiSpecificStreamInfo ));
1068 }
1069
1070 PA_LOGAPI(("\tdouble sampleRate: %g\n", sampleRate ));
1071 #endif
1072
1073 if( !PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! )
1074 {
1075 result = paNotInitializedcxx . . $ paNotInitialized.;
1076
1077 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_IsFormatSupported", result );
1078 return result;
1079 }
1080
1081 result = ValidateOpenStreamParameterscxx . . $ ValidateOpenStreamParameters(3462a2af572bacde).( inputParameters,
1082 outputParameters,
1083 sampleRate, 0, paNoFlagcxx . . $ `external/portaudio/portaudio.h:656:11`!, 0,
1084 &hostApi,
1085 &hostApiInputDevice,
1086 &hostApiOutputDevice );
1087 if( result != paNoErrorcxx . . $ paNoError. )
1088 {
1089 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_IsFormatSupported", result );
1090 return result;
1091 }
1092
1093
1094 if( inputParameters )
1095 {
1096 hostApiInputParameters.devicecxx . . $ PaStreamParameters#device. = hostApiInputDevice;
1097 hostApiInputParameters.channelCountcxx . . $ PaStreamParameters#channelCount. = inputParameters->channelCountcxx . . $ PaStreamParameters#channelCount.;
1098 hostApiInputParameters.sampleFormatcxx . . $ PaStreamParameters#sampleFormat. = inputParameters->sampleFormatcxx . . $ PaStreamParameters#sampleFormat.;
1099 hostApiInputParameters.suggestedLatencycxx . . $ PaStreamParameters#suggestedLatency. = inputParameters->suggestedLatencycxx . . $ PaStreamParameters#suggestedLatency.;
1100 hostApiInputParameters.hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo. = inputParameters->hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo.;
1101 hostApiInputParametersPtr = &hostApiInputParameters;
1102 }
1103 else
1104 {
1105 hostApiInputParametersPtr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1106 }
1107
1108 if( outputParameters )
1109 {
1110 hostApiOutputParameters.devicecxx . . $ PaStreamParameters#device. = hostApiOutputDevice;
1111 hostApiOutputParameters.channelCountcxx . . $ PaStreamParameters#channelCount. = outputParameters->channelCountcxx . . $ PaStreamParameters#channelCount.;
1112 hostApiOutputParameters.sampleFormatcxx . . $ PaStreamParameters#sampleFormat. = outputParameters->sampleFormatcxx . . $ PaStreamParameters#sampleFormat.;
1113 hostApiOutputParameters.suggestedLatencycxx . . $ PaStreamParameters#suggestedLatency. = outputParameters->suggestedLatencycxx . . $ PaStreamParameters#suggestedLatency.;
1114 hostApiOutputParameters.hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo. = outputParameters->hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo.;
1115 hostApiOutputParametersPtr = &hostApiOutputParameters;
1116 }
1117 else
1118 {
1119 hostApiOutputParametersPtr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1120 }
1121
1122 result = hostApi->IsFormatSupportedcxx . . $ PaUtilHostApiRepresentation#IsFormatSupported.( hostApi,
1123 hostApiInputParametersPtr, hostApiOutputParametersPtr,
1124 sampleRate );
1125
1126 #ifdef PA_LOG_API_CALLS
1127 PA_LOGAPI(("Pa_OpenStream returned:\n" ));
1128 if( result == paFormatIsSupported )
1129 PA_LOGAPI(("\tPaError: 0 [ paFormatIsSupported ]\n" ));
1130 else
1131 PA_LOGAPI(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
1132 #endif
1133
1134 return result;
1135 }
1136
1137
1138 PaErrorcxx . . $ PaError# Pa_OpenStreamcxx . . $ Pa_OpenStream(5ffaac200393836e).( PaStreamcxx . . $ PaStream#** stream,
1139 const PaStreamParameterscxx . . $ PaStreamParameters# *inputParameters,
1140 const PaStreamParameterscxx . . $ PaStreamParameters# *outputParameters,
1141 double sampleRate,
1142 unsigned long framesPerBuffer,
1143 PaStreamFlagscxx . . $ PaStreamFlags# streamFlags,
1144 PaStreamCallbackcxx . . $ PaStreamCallback# *streamCallback,
1145 void *userData )
1146 {
1147 PaErrorcxx . . $ PaError# result;
1148 PaUtilHostApiRepresentationcxx . . $ PaUtilHostApiRepresentation# *hostApi = 0;
1149 PaDeviceIndexcxx . . $ PaDeviceIndex# hostApiInputDevice = paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`!, hostApiOutputDevice = paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`!;
1150 PaStreamParameterscxx . . $ PaStreamParameters# hostApiInputParameters, hostApiOutputParameters;
1151 PaStreamParameterscxx . . $ PaStreamParameters# *hostApiInputParametersPtr, *hostApiOutputParametersPtr;
1152
1153
1154 #ifdef PA_LOG_API_CALLS
1155 PA_LOGAPI_ENTER_PARAMS( "Pa_OpenStream" );
1156 PA_LOGAPI(("\tPaStream** stream: 0x%p\n", stream ));
1157
1158 if( inputParameters == NULL ){
1159 PA_LOGAPI(("\tPaStreamParameters *inputParameters: NULL\n" ));
1160 }else{
1161 PA_LOGAPI(("\tPaStreamParameters *inputParameters: 0x%p\n", inputParameters ));
1162 PA_LOGAPI(("\tPaDeviceIndex inputParameters->device: %d\n", inputParameters->device ));
1163 PA_LOGAPI(("\tint inputParameters->channelCount: %d\n", inputParameters->channelCount ));
1164 PA_LOGAPI(("\tPaSampleFormat inputParameters->sampleFormat: %d\n", inputParameters->sampleFormat ));
1165 PA_LOGAPI(("\tPaTime inputParameters->suggestedLatency: %f\n", inputParameters->suggestedLatency ));
1166 PA_LOGAPI(("\tvoid *inputParameters->hostApiSpecificStreamInfo: 0x%p\n", inputParameters->hostApiSpecificStreamInfo ));
1167 }
1168
1169 if( outputParameters == NULL ){
1170 PA_LOGAPI(("\tPaStreamParameters *outputParameters: NULL\n" ));
1171 }else{
1172 PA_LOGAPI(("\tPaStreamParameters *outputParameters: 0x%p\n", outputParameters ));
1173 PA_LOGAPI(("\tPaDeviceIndex outputParameters->device: %d\n", outputParameters->device ));
1174 PA_LOGAPI(("\tint outputParameters->channelCount: %d\n", outputParameters->channelCount ));
1175 PA_LOGAPI(("\tPaSampleFormat outputParameters->sampleFormat: %d\n", outputParameters->sampleFormat ));
1176 PA_LOGAPI(("\tPaTime outputParameters->suggestedLatency: %f\n", outputParameters->suggestedLatency ));
1177 PA_LOGAPI(("\tvoid *outputParameters->hostApiSpecificStreamInfo: 0x%p\n", outputParameters->hostApiSpecificStreamInfo ));
1178 }
1179
1180 PA_LOGAPI(("\tdouble sampleRate: %g\n", sampleRate ));
1181 PA_LOGAPI(("\tunsigned long framesPerBuffer: %d\n", framesPerBuffer ));
1182 PA_LOGAPI(("\tPaStreamFlags streamFlags: 0x%x\n", streamFlags ));
1183 PA_LOGAPI(("\tPaStreamCallback *streamCallback: 0x%p\n", streamCallback ));
1184 PA_LOGAPI(("\tvoid *userData: 0x%p\n", userData ));
1185 #endif
1186
1187 if( !PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! )
1188 {
1189 result = paNotInitializedcxx . . $ paNotInitialized.;
1190
1191 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_OpenStream returned:\n" ));
1192 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t*(PaStream** stream): undefined\n" ));
1193 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
1194 return result;
1195 }
1196
1197 /* Check for parameter errors.
1198 NOTE: make sure this validation list is kept synchronised with the one
1199 in pa_hostapi.h
1200 */
1201
1202 if( stream == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! )
1203 {
1204 result = paBadStreamPtrcxx . . $ paBadStreamPtr.;
1205
1206 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_OpenStream returned:\n" ));
1207 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t*(PaStream** stream): undefined\n" ));
1208 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
1209 return result;
1210 }
1211
1212 result = ValidateOpenStreamParameterscxx . . $ ValidateOpenStreamParameters(3462a2af572bacde).( inputParameters,
1213 outputParameters,
1214 sampleRate, framesPerBuffer,
1215 streamFlags, streamCallback,
1216 &hostApi,
1217 &hostApiInputDevice,
1218 &hostApiOutputDevice );
1219 if( result != paNoErrorcxx . . $ paNoError. )
1220 {
1221 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_OpenStream returned:\n" ));
1222 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t*(PaStream** stream): undefined\n" ));
1223 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
1224 return result;
1225 }
1226
1227
1228 if( inputParameters )
1229 {
1230 hostApiInputParameters.devicecxx . . $ PaStreamParameters#device. = hostApiInputDevice;
1231 hostApiInputParameters.channelCountcxx . . $ PaStreamParameters#channelCount. = inputParameters->channelCountcxx . . $ PaStreamParameters#channelCount.;
1232 hostApiInputParameters.sampleFormatcxx . . $ PaStreamParameters#sampleFormat. = inputParameters->sampleFormatcxx . . $ PaStreamParameters#sampleFormat.;
1233 hostApiInputParameters.suggestedLatencycxx . . $ PaStreamParameters#suggestedLatency. = inputParameters->suggestedLatencycxx . . $ PaStreamParameters#suggestedLatency.;
1234 hostApiInputParameters.hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo. = inputParameters->hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo.;
1235 hostApiInputParametersPtr = &hostApiInputParameters;
1236 }
1237 else
1238 {
1239 hostApiInputParametersPtr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1240 }
1241
1242 if( outputParameters )
1243 {
1244 hostApiOutputParameters.devicecxx . . $ PaStreamParameters#device. = hostApiOutputDevice;
1245 hostApiOutputParameters.channelCountcxx . . $ PaStreamParameters#channelCount. = outputParameters->channelCountcxx . . $ PaStreamParameters#channelCount.;
1246 hostApiOutputParameters.sampleFormatcxx . . $ PaStreamParameters#sampleFormat. = outputParameters->sampleFormatcxx . . $ PaStreamParameters#sampleFormat.;
1247 hostApiOutputParameters.suggestedLatencycxx . . $ PaStreamParameters#suggestedLatency. = outputParameters->suggestedLatencycxx . . $ PaStreamParameters#suggestedLatency.;
1248 hostApiOutputParameters.hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo. = outputParameters->hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo.;
1249 hostApiOutputParametersPtr = &hostApiOutputParameters;
1250 }
1251 else
1252 {
1253 hostApiOutputParametersPtr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1254 }
1255
1256 result = hostApi->OpenStreamcxx . . $ PaUtilHostApiRepresentation#OpenStream.( hostApi, stream,
1257 hostApiInputParametersPtr, hostApiOutputParametersPtr,
1258 sampleRate, framesPerBuffer, streamFlags, streamCallback, userData );
1259
1260 if( result == paNoErrorcxx . . $ paNoError. )
1261 AddOpenStreamcxx . . $ AddOpenStream(5d22bdacc48458e8).( *stream );
1262
1263
1264 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_OpenStream returned:\n" ));
1265 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t*(PaStream** stream): 0x%p\n", *stream ));
1266 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
1267
1268 return result;
1269 }
1270
1271
1272 PaErrorcxx . . $ PaError# Pa_OpenDefaultStreamcxx . . $ Pa_OpenDefaultStream(5abc408afe17243a).( PaStreamcxx . . $ PaStream#** stream,
1273 int inputChannelCount,
1274 int outputChannelCount,
1275 PaSampleFormatcxx . . $ PaSampleFormat# sampleFormat,
1276 double sampleRate,
1277 unsigned long framesPerBuffer,
1278 PaStreamCallbackcxx . . $ PaStreamCallback# *streamCallback,
1279 void *userData )
1280 {
1281 PaErrorcxx . . $ PaError# result;
1282 PaStreamParameterscxx . . $ PaStreamParameters# hostApiInputParameters, hostApiOutputParameters;
1283 PaStreamParameterscxx . . $ PaStreamParameters# *hostApiInputParametersPtr, *hostApiOutputParametersPtr;
1284
1285 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_OpenDefaultStream" );
1286 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream** stream: 0x%p\n", stream ));
1287 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tint inputChannelCount: %d\n", inputChannelCount ));
1288 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tint outputChannelCount: %d\n", outputChannelCount ));
1289 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaSampleFormat sampleFormat: %d\n", sampleFormat ));
1290 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tdouble sampleRate: %g\n", sampleRate ));
1291 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tunsigned long framesPerBuffer: %d\n", framesPerBuffer ));
1292 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStreamCallback *streamCallback: 0x%p\n", streamCallback ));
1293 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tvoid *userData: 0x%p\n", userData ));
1294
1295
1296 if( inputChannelCount > 0 )
1297 {
1298 hostApiInputParameters.devicecxx . . $ PaStreamParameters#device. = Pa_GetDefaultInputDevicecxx . . $ Pa_GetDefaultInputDevice(b126dc7c1de90089).();
1299 if( hostApiInputParameters.devicecxx . . $ PaStreamParameters#device. == paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`! )
1300 return paDeviceUnavailablecxx . . $ paDeviceUnavailable.;
1301
1302 hostApiInputParameters.channelCountcxx . . $ PaStreamParameters#channelCount. = inputChannelCount;
1303 hostApiInputParameters.sampleFormatcxx . . $ PaStreamParameters#sampleFormat. = sampleFormat;
1304 /* defaultHighInputLatency is used below instead of
1305 defaultLowInputLatency because it is more important for the default
1306 stream to work reliably than it is for it to work with the lowest
1307 latency.
1308 */
1309 hostApiInputParameters.suggestedLatencycxx . . $ PaStreamParameters#suggestedLatency. =
1310 Pa_GetDeviceInfocxx . . $ Pa_GetDeviceInfo(28aab36fd6bfe1f2).( hostApiInputParameters.devicecxx . . $ PaStreamParameters#device. )->defaultHighInputLatencycxx . . $ PaDeviceInfo#defaultHighInputLatency.;
1311 hostApiInputParameters.hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1312 hostApiInputParametersPtr = &hostApiInputParameters;
1313 }
1314 else
1315 {
1316 hostApiInputParametersPtr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1317 }
1318
1319 if( outputChannelCount > 0 )
1320 {
1321 hostApiOutputParameters.devicecxx . . $ PaStreamParameters#device. = Pa_GetDefaultOutputDevicecxx . . $ Pa_GetDefaultOutputDevice(b126dc7c1de90089).();
1322 if( hostApiOutputParameters.devicecxx . . $ PaStreamParameters#device. == paNoDevicecxx . . $ `external/portaudio/portaudio.h:220:9`! )
1323 return paDeviceUnavailablecxx . . $ paDeviceUnavailable.;
1324
1325 hostApiOutputParameters.channelCountcxx . . $ PaStreamParameters#channelCount. = outputChannelCount;
1326 hostApiOutputParameters.sampleFormatcxx . . $ PaStreamParameters#sampleFormat. = sampleFormat;
1327 /* defaultHighOutputLatency is used below instead of
1328 defaultLowOutputLatency because it is more important for the default
1329 stream to work reliably than it is for it to work with the lowest
1330 latency.
1331 */
1332 hostApiOutputParameters.suggestedLatencycxx . . $ PaStreamParameters#suggestedLatency. =
1333 Pa_GetDeviceInfocxx . . $ Pa_GetDeviceInfo(28aab36fd6bfe1f2).( hostApiOutputParameters.devicecxx . . $ PaStreamParameters#device. )->defaultHighOutputLatencycxx . . $ PaDeviceInfo#defaultHighOutputLatency.;
1334 hostApiOutputParameters.hostApiSpecificStreamInfocxx . . $ PaStreamParameters#hostApiSpecificStreamInfo. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1335 hostApiOutputParametersPtr = &hostApiOutputParameters;
1336 }
1337 else
1338 {
1339 hostApiOutputParametersPtr = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1340 }
1341
1342
1343 result = Pa_OpenStreamcxx . . $ Pa_OpenStream(5ffaac200393836e).(
1344 stream, hostApiInputParametersPtr, hostApiOutputParametersPtr,
1345 sampleRate, framesPerBuffer, paNoFlagcxx . . $ `external/portaudio/portaudio.h:656:11`!, streamCallback, userData );
1346
1347 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_OpenDefaultStream returned:\n" ));
1348 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t*(PaStream** stream): 0x%p", *stream ));
1349 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
1350
1351 return result;
1352 }
1353
1354
1355 PaErrorcxx . . $ PaError# PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( PaStreamcxx . . $ PaStream#* stream )
1356 {
1357 if( !PA_IS_INITIALISED_cxx . . $ `external/portaudio/pa_front.c:165:9`! ) return paNotInitializedcxx . . $ paNotInitialized.;
1358
1359 if( stream == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ) return paBadStreamPtrcxx . . $ paBadStreamPtr.;
1360
1361 if( ((PaUtilStreamRepresentationcxx . . $ PaUtilStreamRepresentation#*)stream)->magiccxx . . $ PaUtilStreamRepresentation#magic. != PA_STREAM_MAGICcxx . . $ `external/portaudio/pa_stream.h:58:9`! )
1362 return paBadStreamPtrcxx . . $ paBadStreamPtr.;
1363
1364 return paNoErrorcxx . . $ paNoError.;
1365 }
1366
1367
1368 PaErrorcxx . . $ PaError# Pa_CloseStreamcxx . . $ Pa_CloseStream(dedf1e9b1c614a07).( PaStreamcxx . . $ PaStream#* stream )
1369 {
1370 PaUtilStreamInterfacecxx . . $ PaUtilStreamInterface# *interface;
1371 PaErrorcxx . . $ PaError# result = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1372
1373 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_CloseStream" );
1374 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1375
1376 /* always remove the open stream from our list, even if this function
1377 eventually returns an error. Otherwise CloseOpenStreams() will
1378 get stuck in an infinite loop */
1379 RemoveOpenStreamcxx . . $ RemoveOpenStream(5d22bdacc48458e8).( stream ); /* be sure to call this _before_ closing the stream */
1380
1381 if( result == paNoErrorcxx . . $ paNoError. )
1382 {
1383 interface = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream);
1384
1385 /* abort the stream if it isn't stopped */
1386 result = interface->IsStoppedcxx . . $ $anonymous_type_f57c9f8091ab1748_0#IsStopped.( stream );
1387 if( result == 1 )
1388 result = paNoErrorcxx . . $ paNoError.;
1389 else if( result == 0 )
1390 result = interface->Abortcxx . . $ $anonymous_type_f57c9f8091ab1748_0#Abort.( stream );
1391
1392 if( result == paNoErrorcxx . . $ paNoError. ) /** @todo REVIEW: shouldn't we close anyway? see: http://www.portaudio.com/trac/ticket/115 */
1393 result = interface->Closecxx . . $ $anonymous_type_f57c9f8091ab1748_0#Close.( stream );
1394 }
1395
1396 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_CloseStream", result );
1397
1398 return result;
1399 }
1400
1401
1402 PaErrorcxx . . $ PaError# Pa_SetStreamFinishedCallbackcxx . . $ Pa_SetStreamFinishedCallback(3c5856143c6ec501).( PaStreamcxx . . $ PaStream# *stream, PaStreamFinishedCallbackcxx . . $ PaStreamFinishedCallback#* streamFinishedCallback )
1403 {
1404 PaErrorcxx . . $ PaError# result = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1405
1406 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_SetStreamFinishedCallback" );
1407 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1408 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStreamFinishedCallback* streamFinishedCallback: 0x%p\n", streamFinishedCallback ));
1409
1410 if( result == paNoErrorcxx . . $ paNoError. )
1411 {
1412 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->IsStoppedcxx . . $ $anonymous_type_f57c9f8091ab1748_0#IsStopped.( stream );
1413 if( result == 0 )
1414 {
1415 result = paStreamIsNotStoppedcxx . . $ paStreamIsNotStopped. ;
1416 }
1417 if( result == 1 )
1418 {
1419 PA_STREAM_REPcxx . . $ `external/portaudio/pa_stream.h:189:9`!( stream )->streamFinishedCallbackcxx . . $ PaUtilStreamRepresentation#streamFinishedCallback. = streamFinishedCallback;
1420 result = paNoErrorcxx . . $ paNoError.;
1421 }
1422 }
1423
1424 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_SetStreamFinishedCallback", result );
1425
1426 return result;
1427
1428 }
1429
1430
1431 PaErrorcxx . . $ PaError# Pa_StartStreamcxx . . $ Pa_StartStream(dedf1e9b1c614a07).( PaStreamcxx . . $ PaStream# *stream )
1432 {
1433 PaErrorcxx . . $ PaError# result = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1434
1435 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_StartStream" );
1436 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1437
1438 if( result == paNoErrorcxx . . $ paNoError. )
1439 {
1440 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->IsStoppedcxx . . $ $anonymous_type_f57c9f8091ab1748_0#IsStopped.( stream );
1441 if( result == 0 )
1442 {
1443 result = paStreamIsNotStoppedcxx . . $ paStreamIsNotStopped. ;
1444 }
1445 else if( result == 1 )
1446 {
1447 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->Startcxx . . $ $anonymous_type_f57c9f8091ab1748_0#Start.( stream );
1448 }
1449 }
1450
1451 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_StartStream", result );
1452
1453 return result;
1454 }
1455
1456
1457 PaErrorcxx . . $ PaError# Pa_StopStreamcxx . . $ Pa_StopStream(dedf1e9b1c614a07).( PaStreamcxx . . $ PaStream# *stream )
1458 {
1459 PaErrorcxx . . $ PaError# result = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1460
1461 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_StopStream" );
1462 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1463
1464 if( result == paNoErrorcxx . . $ paNoError. )
1465 {
1466 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->IsStoppedcxx . . $ $anonymous_type_f57c9f8091ab1748_0#IsStopped.( stream );
1467 if( result == 0 )
1468 {
1469 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->Stopcxx . . $ $anonymous_type_f57c9f8091ab1748_0#Stop.( stream );
1470 }
1471 else if( result == 1 )
1472 {
1473 result = paStreamIsStoppedcxx . . $ paStreamIsStopped.;
1474 }
1475 }
1476
1477 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_StopStream", result );
1478
1479 return result;
1480 }
1481
1482
1483 PaErrorcxx . . $ PaError# Pa_AbortStreamcxx . . $ Pa_AbortStream(dedf1e9b1c614a07).( PaStreamcxx . . $ PaStream# *stream )
1484 {
1485 PaErrorcxx . . $ PaError# result = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1486
1487 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_AbortStream" );
1488 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1489
1490 if( result == paNoErrorcxx . . $ paNoError. )
1491 {
1492 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->IsStoppedcxx . . $ $anonymous_type_f57c9f8091ab1748_0#IsStopped.( stream );
1493 if( result == 0 )
1494 {
1495 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->Abortcxx . . $ $anonymous_type_f57c9f8091ab1748_0#Abort.( stream );
1496 }
1497 else if( result == 1 )
1498 {
1499 result = paStreamIsStoppedcxx . . $ paStreamIsStopped.;
1500 }
1501 }
1502
1503 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_AbortStream", result );
1504
1505 return result;
1506 }
1507
1508
1509 PaErrorcxx . . $ PaError# Pa_IsStreamStoppedcxx . . $ Pa_IsStreamStopped(dedf1e9b1c614a07).( PaStreamcxx . . $ PaStream# *stream )
1510 {
1511 PaErrorcxx . . $ PaError# result = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1512
1513 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_IsStreamStopped" );
1514 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1515
1516 if( result == paNoErrorcxx . . $ paNoError. )
1517 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->IsStoppedcxx . . $ $anonymous_type_f57c9f8091ab1748_0#IsStopped.( stream );
1518
1519 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_IsStreamStopped", result );
1520
1521 return result;
1522 }
1523
1524
1525 PaErrorcxx . . $ PaError# Pa_IsStreamActivecxx . . $ Pa_IsStreamActive(dedf1e9b1c614a07).( PaStreamcxx . . $ PaStream# *stream )
1526 {
1527 PaErrorcxx . . $ PaError# result = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1528
1529 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_IsStreamActive" );
1530 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1531
1532 if( result == paNoErrorcxx . . $ paNoError. )
1533 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->IsActivecxx . . $ $anonymous_type_f57c9f8091ab1748_0#IsActive.( stream );
1534
1535
1536 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_IsStreamActive", result );
1537
1538 return result;
1539 }
1540
1541
1542 const PaStreamInfocxx . . $ PaStreamInfo#* Pa_GetStreamInfocxx . . $ Pa_GetStreamInfo(e2d836d57d6f04f8).( PaStreamcxx . . $ PaStream# *stream )
1543 {
1544 PaErrorcxx . . $ PaError# error = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1545 const PaStreamInfocxx . . $ PaStreamInfo# *result;
1546
1547 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_GetStreamInfo" );
1548 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1549
1550 if( error != paNoErrorcxx . . $ paNoError. )
1551 {
1552 result = 0;
1553
1554 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetStreamInfo returned:\n" ));
1555 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tconst PaStreamInfo*: 0 [PaError error:%d ( %s )]\n", error, Pa_GetErrorText( error ) ));
1556
1557 }
1558 else
1559 {
1560 result = &PA_STREAM_REPcxx . . $ `external/portaudio/pa_stream.h:189:9`!( stream )->streamInfocxx . . $ PaUtilStreamRepresentation#streamInfo.;
1561
1562 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetStreamInfo returned:\n" ));
1563 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tconst PaStreamInfo*: 0x%p:\n", result ));
1564 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t{" ));
1565
1566 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t\tint structVersion: %d\n", result->structVersion ));
1567 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t\tPaTime inputLatency: %f\n", result->inputLatency ));
1568 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t\tPaTime outputLatency: %f\n", result->outputLatency ));
1569 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t\tdouble sampleRate: %f\n", result->sampleRate ));
1570 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\t}\n" ));
1571
1572 }
1573
1574 return result;
1575 }
1576
1577
1578 PaTimecxx . . $ PaTime# Pa_GetStreamTimecxx . . $ Pa_GetStreamTime(a405b17f82753acc).( PaStreamcxx . . $ PaStream# *stream )
1579 {
1580 PaErrorcxx . . $ PaError# error = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1581 PaTimecxx . . $ PaTime# result;
1582
1583 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_GetStreamTime" );
1584 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1585
1586 if( error != paNoErrorcxx . . $ paNoError. )
1587 {
1588 result = 0;
1589
1590 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetStreamTime returned:\n" ));
1591 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaTime: 0 [PaError error:%d ( %s )]\n", result, error, Pa_GetErrorText( error ) ));
1592
1593 }
1594 else
1595 {
1596 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->GetTimecxx . . $ $anonymous_type_f57c9f8091ab1748_0#GetTime.( stream );
1597
1598 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetStreamTime returned:\n" ));
1599 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaTime: %g\n", result ));
1600
1601 }
1602
1603 return result;
1604 }
1605
1606
1607 double Pa_GetStreamCpuLoadcxx . . $ Pa_GetStreamCpuLoad(a405b17f82753acc).( PaStreamcxx . . $ PaStream#* stream )
1608 {
1609 PaErrorcxx . . $ PaError# error = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1610 double result;
1611
1612 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_GetStreamCpuLoad" );
1613 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1614
1615 if( error != paNoErrorcxx . . $ paNoError. )
1616 {
1617
1618 result = 0.0;
1619
1620 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetStreamCpuLoad returned:\n" ));
1621 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tdouble: 0.0 [PaError error: %d ( %s )]\n", error, Pa_GetErrorText( error ) ));
1622
1623 }
1624 else
1625 {
1626 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->GetCpuLoadcxx . . $ $anonymous_type_f57c9f8091ab1748_0#GetCpuLoad.( stream );
1627
1628 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetStreamCpuLoad returned:\n" ));
1629 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tdouble: %g\n", result ));
1630
1631 }
1632
1633 return result;
1634 }
1635
1636
1637 PaErrorcxx . . $ PaError# Pa_ReadStreamcxx . . $ Pa_ReadStream(c5040b39c98d43dd).( PaStreamcxx . . $ PaStream#* stream,
1638 void *buffer,
1639 unsigned long frames )
1640 {
1641 PaErrorcxx . . $ PaError# result = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1642
1643 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_ReadStream" );
1644 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1645
1646 if( result == paNoErrorcxx . . $ paNoError. )
1647 {
1648 if( frames == 0 )
1649 {
1650 /* @todo Should we not allow the implementation to signal any overflow condition? see: http://www.portaudio.com/trac/ticket/116*/
1651 result = paNoErrorcxx . . $ paNoError.;
1652 }
1653 else if( buffer == 0 )
1654 {
1655 result = paBadBufferPtrcxx . . $ paBadBufferPtr.;
1656 }
1657 else
1658 {
1659 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->IsStoppedcxx . . $ $anonymous_type_f57c9f8091ab1748_0#IsStopped.( stream );
1660 if( result == 0 )
1661 {
1662 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->Readcxx . . $ $anonymous_type_f57c9f8091ab1748_0#Read.( stream, buffer, frames );
1663 }
1664 else if( result == 1 )
1665 {
1666 result = paStreamIsStoppedcxx . . $ paStreamIsStopped.;
1667 }
1668 }
1669 }
1670
1671 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_ReadStream", result );
1672
1673 return result;
1674 }
1675
1676
1677 PaErrorcxx . . $ PaError# Pa_WriteStreamcxx . . $ Pa_WriteStream(72e086fd9bc8337a).( PaStreamcxx . . $ PaStream#* stream,
1678 const void *buffer,
1679 unsigned long frames )
1680 {
1681 PaErrorcxx . . $ PaError# result = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1682
1683 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_WriteStream" );
1684 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1685
1686 if( result == paNoErrorcxx . . $ paNoError. )
1687 {
1688 if( frames == 0 )
1689 {
1690 /* @todo Should we not allow the implementation to signal any underflow condition? see: http://www.portaudio.com/trac/ticket/116*/
1691 result = paNoErrorcxx . . $ paNoError.;
1692 }
1693 else if( buffer == 0 )
1694 {
1695 result = paBadBufferPtrcxx . . $ paBadBufferPtr.;
1696 }
1697 else
1698 {
1699 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->IsStoppedcxx . . $ $anonymous_type_f57c9f8091ab1748_0#IsStopped.( stream );
1700 if( result == 0 )
1701 {
1702 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->Writecxx . . $ $anonymous_type_f57c9f8091ab1748_0#Write.( stream, buffer, frames );
1703 }
1704 else if( result == 1 )
1705 {
1706 result = paStreamIsStoppedcxx . . $ paStreamIsStopped.;
1707 }
1708 }
1709 }
1710
1711 PA_LOGAPI_EXIT_PAERRORcxx . . $ `external/portaudio/pa_debugprint.h:131:9`!( "Pa_WriteStream", result );
1712
1713 return result;
1714 }
1715
1716 signed long Pa_GetStreamReadAvailablecxx . . $ Pa_GetStreamReadAvailable(72c1818a5177f981).( PaStreamcxx . . $ PaStream#* stream )
1717 {
1718 PaErrorcxx . . $ PaError# error = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1719 signed long result;
1720
1721 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_GetStreamReadAvailable" );
1722 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1723
1724 if( error != paNoErrorcxx . . $ paNoError. )
1725 {
1726 result = 0;
1727
1728 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetStreamReadAvailable returned:\n" ));
1729 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tunsigned long: 0 [ PaError error: %d ( %s ) ]\n", error, Pa_GetErrorText( error ) ));
1730
1731 }
1732 else
1733 {
1734 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->GetReadAvailablecxx . . $ $anonymous_type_f57c9f8091ab1748_0#GetReadAvailable.( stream );
1735
1736 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetStreamReadAvailable returned:\n" ));
1737 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
1738
1739 }
1740
1741 return result;
1742 }
1743
1744
1745 signed long Pa_GetStreamWriteAvailablecxx . . $ Pa_GetStreamWriteAvailable(72c1818a5177f981).( PaStreamcxx . . $ PaStream#* stream )
1746 {
1747 PaErrorcxx . . $ PaError# error = PaUtil_ValidateStreamPointercxx . . $ PaUtil_ValidateStreamPointer(dedf1e9b1c614a07).( stream );
1748 signed long result;
1749
1750 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_GetStreamWriteAvailable" );
1751 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaStream* stream: 0x%p\n", stream ));
1752
1753 if( error != paNoErrorcxx . . $ paNoError. )
1754 {
1755 result = 0;
1756
1757 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetStreamWriteAvailable returned:\n" ));
1758 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tunsigned long: 0 [ PaError error: %d ( %s ) ]\n", error, Pa_GetErrorText( error ) ));
1759
1760 }
1761 else
1762 {
1763 result = PA_STREAM_INTERFACEcxx . . $ `external/portaudio/pa_stream.h:197:9`!(stream)->GetWriteAvailablecxx . . $ $anonymous_type_f57c9f8091ab1748_0#GetWriteAvailable.( stream );
1764
1765 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("Pa_GetStreamWriteAvailable returned:\n" ));
1766 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaError: %d ( %s )\n", result, Pa_GetErrorText( result ) ));
1767
1768 }
1769
1770 return result;
1771 }
1772
1773
1774 PaErrorcxx . . $ PaError# Pa_GetSampleSizecxx . . $ Pa_GetSampleSize(15f694ef3c96d230).( PaSampleFormatcxx . . $ PaSampleFormat# format )
1775 {
1776 int result;
1777
1778 PA_LOGAPI_ENTER_PARAMScxx . . $ `external/portaudio/pa_debugprint.h:129:9`!( "Pa_GetSampleSize" );
1779 PA_LOGAPIcxx . . $ `external/portaudio/pa_debugprint.h:127:9`!(("\tPaSampleFormat format: %d\n", format ));
1780
1781 switch( format & ~paNonInterleavedcxx . . $ `external/portaudio/portaudio.h:495:9`! )
1782 {
1783
1784 case paUInt8cxx . . $ `external/portaudio/portaudio.h:492:9`!:
1785 case paInt8cxx . . $ `external/portaudio/portaudio.h:491:9`!:
1786 result = 1;
1787 break;
1788
1789 case paInt16cxx . . $ `external/portaudio/portaudio.h:490:9`!:
1790 result = 2;
1791 break;
1792
1793 case paInt24cxx . . $ `external/portaudio/portaudio.h:489:9`!:
1794 result = 3;
1795 break;
1796
1797 case paFloat32cxx . . $ `external/portaudio/portaudio.h:487:9`!:
1798 case paInt32cxx . . $ `external/portaudio/portaudio.h:488:9`!:
1799 result = 4;
1800 break;
1801
1802 default:
1803 result = paSampleFormatNotSupportedcxx . . $ paSampleFormatNotSupported.;
1804 break;
1805 }
1806
1807 PA_LOGAPI_EXIT_PAERROR_OR_T_RESULTcxx . . $ `external/portaudio/pa_debugprint.h:133:9`!( "Pa_GetSampleSize", "int: %d", result );
1808
1809 return (PaErrorcxx . . $ PaError#) result;
1810 }