|
Line 0
Link Here
|
|
|
1 |
diff -ruN src/output/portAudio.orig/PortAudio/common/pa_converters.h src/output/portAudio/PortAudio/common/pa_converters.h |
| 2 |
--- src/output/portAudio.orig/PortAudio/common/pa_converters.h 2007-12-05 20:39:28.000000000 +0800 |
| 3 |
+++ src/output/portAudio/PortAudio/common/pa_converters.h 2008-06-01 06:43:49.000000000 +0800 |
| 4 |
@@ -46,7 +46,7 @@ |
| 5 |
*/ |
| 6 |
|
| 7 |
|
| 8 |
-#include "portaudio.h" /* for PaSampleFormat */ |
| 9 |
+#include "pa_audio.h" /* for PaSampleFormat */ |
| 10 |
|
| 11 |
#ifdef __cplusplus |
| 12 |
extern "C" |
| 13 |
diff -ruN src/output/portAudio.orig/PortAudio/common/pa_endianness.h src/output/portAudio/PortAudio/common/pa_endianness.h |
| 14 |
--- src/output/portAudio.orig/PortAudio/common/pa_endianness.h 2007-12-05 20:39:28.000000000 +0800 |
| 15 |
+++ src/output/portAudio/PortAudio/common/pa_endianness.h 2008-06-01 06:43:49.000000000 +0800 |
| 16 |
@@ -85,6 +85,14 @@ |
| 17 |
/* this is not an apple, so first check the existing defines, and, failing that, |
| 18 |
detect well-known architechtures. */ |
| 19 |
|
| 20 |
+#include <sys/endian.h> |
| 21 |
+ |
| 22 |
+ #if _BYTE_ORDER == _LITTLE_ENDIAN |
| 23 |
+ #define PA_LITTLE_ENDIAN |
| 24 |
+ #else |
| 25 |
+ #define PA_BIG_ENDIAN |
| 26 |
+ #endif |
| 27 |
+ |
| 28 |
#if defined(PA_LITTLE_ENDIAN) || defined(PA_BIG_ENDIAN) |
| 29 |
/* endianness define has been set externally, such as by autoconf */ |
| 30 |
|
| 31 |
diff -ruN src/output/portAudio.orig/PortAudio/common/pa_front.c src/output/portAudio/PortAudio/common/pa_front.c |
| 32 |
--- src/output/portAudio.orig/PortAudio/common/pa_front.c 2007-12-05 20:39:28.000000000 +0800 |
| 33 |
+++ src/output/portAudio/PortAudio/common/pa_front.c 2008-06-01 06:43:49.000000000 +0800 |
| 34 |
@@ -77,7 +77,7 @@ |
| 35 |
#include <string.h> |
| 36 |
#include <assert.h> /* needed by PA_VALIDATE_ENDIANNESS */ |
| 37 |
|
| 38 |
-#include "portaudio.h" |
| 39 |
+#include "pa_audio.h" |
| 40 |
#include "pa_util.h" |
| 41 |
#include "pa_endianness.h" |
| 42 |
#include "pa_types.h" |
| 43 |
diff -ruN src/output/portAudio.orig/PortAudio/common/pa_hostapi.h src/output/portAudio/PortAudio/common/pa_hostapi.h |
| 44 |
--- src/output/portAudio.orig/PortAudio/common/pa_hostapi.h 2007-12-05 20:39:28.000000000 +0800 |
| 45 |
+++ src/output/portAudio/PortAudio/common/pa_hostapi.h 2008-06-01 06:43:49.000000000 +0800 |
| 46 |
@@ -47,7 +47,7 @@ |
| 47 |
*/ |
| 48 |
|
| 49 |
|
| 50 |
-#include "portaudio.h" |
| 51 |
+#include "pa_audio.h" |
| 52 |
|
| 53 |
#ifdef __cplusplus |
| 54 |
extern "C" |
| 55 |
diff -ruN src/output/portAudio.orig/PortAudio/common/pa_process.h src/output/portAudio/PortAudio/common/pa_process.h |
| 56 |
--- src/output/portAudio.orig/PortAudio/common/pa_process.h 2007-12-05 20:39:28.000000000 +0800 |
| 57 |
+++ src/output/portAudio/PortAudio/common/pa_process.h 2008-06-01 06:43:49.000000000 +0800 |
| 58 |
@@ -200,7 +200,7 @@ |
| 59 |
*/ |
| 60 |
|
| 61 |
|
| 62 |
-#include "portaudio.h" |
| 63 |
+#include "pa_audio.h" |
| 64 |
#include "pa_converters.h" |
| 65 |
#include "pa_dither.h" |
| 66 |
|
| 67 |
diff -ruN src/output/portAudio.orig/PortAudio/common/pa_stream.h src/output/portAudio/PortAudio/common/pa_stream.h |
| 68 |
--- src/output/portAudio.orig/PortAudio/common/pa_stream.h 2007-12-05 20:39:28.000000000 +0800 |
| 69 |
+++ src/output/portAudio/PortAudio/common/pa_stream.h 2008-06-01 06:43:49.000000000 +0800 |
| 70 |
@@ -47,7 +47,7 @@ |
| 71 |
*/ |
| 72 |
|
| 73 |
|
| 74 |
-#include "portaudio.h" |
| 75 |
+#include "pa_audio.h" |
| 76 |
|
| 77 |
#ifdef __cplusplus |
| 78 |
extern "C" |
| 79 |
diff -ruN src/output/portAudio.orig/PortAudio/common/pa_util.h src/output/portAudio/PortAudio/common/pa_util.h |
| 80 |
--- src/output/portAudio.orig/PortAudio/common/pa_util.h 2007-12-05 20:39:28.000000000 +0800 |
| 81 |
+++ src/output/portAudio/PortAudio/common/pa_util.h 2008-06-01 06:43:49.000000000 +0800 |
| 82 |
@@ -49,7 +49,7 @@ |
| 83 |
*/ |
| 84 |
|
| 85 |
|
| 86 |
-#include "portaudio.h" |
| 87 |
+#include "pa_audio.h" |
| 88 |
|
| 89 |
#ifdef __cplusplus |
| 90 |
extern "C" |
| 91 |
diff -ruN src/output/portAudio.orig/PortAudio/hostapi/oss/pa_unix_oss.c src/output/portAudio/PortAudio/hostapi/oss/pa_unix_oss.c |
| 92 |
--- src/output/portAudio.orig/PortAudio/hostapi/oss/pa_unix_oss.c 2007-12-05 20:39:28.000000000 +0800 |
| 93 |
+++ src/output/portAudio/PortAudio/hostapi/oss/pa_unix_oss.c 2008-06-01 06:43:49.000000000 +0800 |
| 94 |
@@ -74,7 +74,7 @@ |
| 95 |
# define DEVICE_NAME_BASE "/dev/audio" |
| 96 |
#endif |
| 97 |
|
| 98 |
-#include "portaudio.h" |
| 99 |
+#include "pa_audio.h" |
| 100 |
#include "pa_util.h" |
| 101 |
#include "pa_allocation.h" |
| 102 |
#include "pa_hostapi.h" |
| 103 |
diff -ruN src/output/portAudio.orig/PortAudio/include/pa_audio.h src/output/portAudio/PortAudio/include/pa_audio.h |
| 104 |
--- src/output/portAudio.orig/PortAudio/include/pa_audio.h 1970-01-01 08:00:00.000000000 +0800 |
| 105 |
+++ src/output/portAudio/PortAudio/include/pa_audio.h 2008-06-01 06:43:49.000000000 +0800 |
| 106 |
@@ -0,0 +1,1133 @@ |
| 107 |
+ |
| 108 |
+#ifndef PORTAUDIO_H |
| 109 |
+#define PORTAUDIO_H |
| 110 |
+/* |
| 111 |
+ * $Id: portaudio.h 1083 2006-08-23 07:30:49Z rossb $ |
| 112 |
+ * PortAudio Portable Real-Time Audio Library |
| 113 |
+ * PortAudio API Header File |
| 114 |
+ * Latest version available at: http://www.portaudio.com/ |
| 115 |
+ * |
| 116 |
+ * Copyright (c) 1999-2002 Ross Bencina and Phil Burk |
| 117 |
+ * |
| 118 |
+ * Permission is hereby granted, free of charge, to any person obtaining |
| 119 |
+ * a copy of this software and associated documentation files |
| 120 |
+ * (the "Software"), to deal in the Software without restriction, |
| 121 |
+ * including without limitation the rights to use, copy, modify, merge, |
| 122 |
+ * publish, distribute, sublicense, and/or sell copies of the Software, |
| 123 |
+ * and to permit persons to whom the Software is furnished to do so, |
| 124 |
+ * subject to the following conditions: |
| 125 |
+ * |
| 126 |
+ * The above copyright notice and this permission notice shall be |
| 127 |
+ * included in all copies or substantial portions of the Software. |
| 128 |
+ * |
| 129 |
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 130 |
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 131 |
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 132 |
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR |
| 133 |
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
| 134 |
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 135 |
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 136 |
+ */ |
| 137 |
+ |
| 138 |
+/* |
| 139 |
+ * The text above constitutes the entire PortAudio license; however, |
| 140 |
+ * the PortAudio community also makes the following non-binding requests: |
| 141 |
+ * |
| 142 |
+ * Any person wishing to distribute modifications to the Software is |
| 143 |
+ * requested to send the modifications to the original developer so that |
| 144 |
+ * they can be incorporated into the canonical version. It is also |
| 145 |
+ * requested that these non-binding requests be included along with the |
| 146 |
+ * license above. |
| 147 |
+ */ |
| 148 |
+ |
| 149 |
+/** @file |
| 150 |
+ @brief The PortAudio API. |
| 151 |
+*/ |
| 152 |
+ |
| 153 |
+ |
| 154 |
+#ifdef __cplusplus |
| 155 |
+extern "C" |
| 156 |
+{ |
| 157 |
+#endif /* __cplusplus */ |
| 158 |
+ |
| 159 |
+ |
| 160 |
+/** Retrieve the release number of the currently running PortAudio build, |
| 161 |
+ eg 1900. |
| 162 |
+*/ |
| 163 |
+int Pa_GetVersion( void ); |
| 164 |
+ |
| 165 |
+ |
| 166 |
+/** Retrieve a textual description of the current PortAudio build, |
| 167 |
+ eg "PortAudio V19-devel 13 October 2002". |
| 168 |
+*/ |
| 169 |
+const char* Pa_GetVersionText( void ); |
| 170 |
+ |
| 171 |
+ |
| 172 |
+/** Error codes returned by PortAudio functions. |
| 173 |
+ Note that with the exception of paNoError, all PaErrorCodes are negative. |
| 174 |
+*/ |
| 175 |
+ |
| 176 |
+typedef int PaError; |
| 177 |
+typedef enum PaErrorCode |
| 178 |
+{ |
| 179 |
+ paNoError = 0, |
| 180 |
+ |
| 181 |
+ paNotInitialized = -10000, |
| 182 |
+ paUnanticipatedHostError, |
| 183 |
+ paInvalidChannelCount, |
| 184 |
+ paInvalidSampleRate, |
| 185 |
+ paInvalidDevice, |
| 186 |
+ paInvalidFlag, |
| 187 |
+ paSampleFormatNotSupported, |
| 188 |
+ paBadIODeviceCombination, |
| 189 |
+ paInsufficientMemory, |
| 190 |
+ paBufferTooBig, |
| 191 |
+ paBufferTooSmall, |
| 192 |
+ paNullCallback, |
| 193 |
+ paBadStreamPtr, |
| 194 |
+ paTimedOut, |
| 195 |
+ paInternalError, |
| 196 |
+ paDeviceUnavailable, |
| 197 |
+ paIncompatibleHostApiSpecificStreamInfo, |
| 198 |
+ paStreamIsStopped, |
| 199 |
+ paStreamIsNotStopped, |
| 200 |
+ paInputOverflowed, |
| 201 |
+ paOutputUnderflowed, |
| 202 |
+ paHostApiNotFound, |
| 203 |
+ paInvalidHostApi, |
| 204 |
+ paCanNotReadFromACallbackStream, /**< @todo review error code name */ |
| 205 |
+ paCanNotWriteToACallbackStream, /**< @todo review error code name */ |
| 206 |
+ paCanNotReadFromAnOutputOnlyStream, /**< @todo review error code name */ |
| 207 |
+ paCanNotWriteToAnInputOnlyStream, /**< @todo review error code name */ |
| 208 |
+ paIncompatibleStreamHostApi, |
| 209 |
+ paBadBufferPtr |
| 210 |
+} PaErrorCode; |
| 211 |
+ |
| 212 |
+ |
| 213 |
+/** Translate the supplied PortAudio error code into a human readable |
| 214 |
+ message. |
| 215 |
+*/ |
| 216 |
+const char *Pa_GetErrorText( PaError errorCode ); |
| 217 |
+ |
| 218 |
+ |
| 219 |
+/** Library initialization function - call this before using PortAudio. |
| 220 |
+ This function initialises internal data structures and prepares underlying |
| 221 |
+ host APIs for use. This function MUST be called before using any other |
| 222 |
+ PortAudio API functions. |
| 223 |
+ |
| 224 |
+ If Pa_Initialize() is called multiple times, each successful |
| 225 |
+ call must be matched with a corresponding call to Pa_Terminate(). |
| 226 |
+ Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not |
| 227 |
+ required to be fully nested. |
| 228 |
+ |
| 229 |
+ Note that if Pa_Initialize() returns an error code, Pa_Terminate() should |
| 230 |
+ NOT be called. |
| 231 |
+ |
| 232 |
+ @return paNoError if successful, otherwise an error code indicating the cause |
| 233 |
+ of failure. |
| 234 |
+ |
| 235 |
+ @see Pa_Terminate |
| 236 |
+*/ |
| 237 |
+PaError Pa_Initialize( void ); |
| 238 |
+ |
| 239 |
+ |
| 240 |
+/** Library termination function - call this when finished using PortAudio. |
| 241 |
+ This function deallocates all resources allocated by PortAudio since it was |
| 242 |
+ initializied by a call to Pa_Initialize(). In cases where Pa_Initialise() has |
| 243 |
+ been called multiple times, each call must be matched with a corresponding call |
| 244 |
+ to Pa_Terminate(). The final matching call to Pa_Terminate() will automatically |
| 245 |
+ close any PortAudio streams that are still open. |
| 246 |
+ |
| 247 |
+ Pa_Terminate() MUST be called before exiting a program which uses PortAudio. |
| 248 |
+ Failure to do so may result in serious resource leaks, such as audio devices |
| 249 |
+ not being available until the next reboot. |
| 250 |
+ |
| 251 |
+ @return paNoError if successful, otherwise an error code indicating the cause |
| 252 |
+ of failure. |
| 253 |
+ |
| 254 |
+ @see Pa_Initialize |
| 255 |
+*/ |
| 256 |
+PaError Pa_Terminate( void ); |
| 257 |
+ |
| 258 |
+ |
| 259 |
+ |
| 260 |
+/** The type used to refer to audio devices. Values of this type usually |
| 261 |
+ range from 0 to (Pa_DeviceCount-1), and may also take on the PaNoDevice |
| 262 |
+ and paUseHostApiSpecificDeviceSpecification values. |
| 263 |
+ |
| 264 |
+ @see Pa_DeviceCount, paNoDevice, paUseHostApiSpecificDeviceSpecification |
| 265 |
+*/ |
| 266 |
+typedef int PaDeviceIndex; |
| 267 |
+ |
| 268 |
+ |
| 269 |
+/** A special PaDeviceIndex value indicating that no device is available, |
| 270 |
+ or should be used. |
| 271 |
+ |
| 272 |
+ @see PaDeviceIndex |
| 273 |
+*/ |
| 274 |
+#define paNoDevice ((PaDeviceIndex)-1) |
| 275 |
+ |
| 276 |
+ |
| 277 |
+/** A special PaDeviceIndex value indicating that the device(s) to be used |
| 278 |
+ are specified in the host api specific stream info structure. |
| 279 |
+ |
| 280 |
+ @see PaDeviceIndex |
| 281 |
+*/ |
| 282 |
+#define paUseHostApiSpecificDeviceSpecification ((PaDeviceIndex)-2) |
| 283 |
+ |
| 284 |
+ |
| 285 |
+/* Host API enumeration mechanism */ |
| 286 |
+ |
| 287 |
+/** The type used to enumerate to host APIs at runtime. Values of this type |
| 288 |
+ range from 0 to (Pa_GetHostApiCount()-1). |
| 289 |
+ |
| 290 |
+ @see Pa_GetHostApiCount |
| 291 |
+*/ |
| 292 |
+typedef int PaHostApiIndex; |
| 293 |
+ |
| 294 |
+ |
| 295 |
+/** Retrieve the number of available host APIs. Even if a host API is |
| 296 |
+ available it may have no devices available. |
| 297 |
+ |
| 298 |
+ @return A non-negative value indicating the number of available host APIs |
| 299 |
+ or, a PaErrorCode (which are always negative) if PortAudio is not initialized |
| 300 |
+ or an error is encountered. |
| 301 |
+ |
| 302 |
+ @see PaHostApiIndex |
| 303 |
+*/ |
| 304 |
+PaHostApiIndex Pa_GetHostApiCount( void ); |
| 305 |
+ |
| 306 |
+ |
| 307 |
+/** Retrieve the index of the default host API. The default host API will be |
| 308 |
+ the lowest common denominator host API on the current platform and is |
| 309 |
+ unlikely to provide the best performance. |
| 310 |
+ |
| 311 |
+ @return A non-negative value ranging from 0 to (Pa_GetHostApiCount()-1) |
| 312 |
+ indicating the default host API index or, a PaErrorCode (which are always |
| 313 |
+ negative) if PortAudio is not initialized or an error is encountered. |
| 314 |
+*/ |
| 315 |
+PaHostApiIndex Pa_GetDefaultHostApi( void ); |
| 316 |
+ |
| 317 |
+ |
| 318 |
+/** Unchanging unique identifiers for each supported host API. This type |
| 319 |
+ is used in the PaHostApiInfo structure. The values are guaranteed to be |
| 320 |
+ unique and to never change, thus allowing code to be written that |
| 321 |
+ conditionally uses host API specific extensions. |
| 322 |
+ |
| 323 |
+ New type ids will be allocated when support for a host API reaches |
| 324 |
+ "public alpha" status, prior to that developers should use the |
| 325 |
+ paInDevelopment type id. |
| 326 |
+ |
| 327 |
+ @see PaHostApiInfo |
| 328 |
+*/ |
| 329 |
+typedef enum PaHostApiTypeId |
| 330 |
+{ |
| 331 |
+ paInDevelopment=0, /* use while developing support for a new host API */ |
| 332 |
+ paDirectSound=1, |
| 333 |
+ paMME=2, |
| 334 |
+ paASIO=3, |
| 335 |
+ paSoundManager=4, |
| 336 |
+ paCoreAudio=5, |
| 337 |
+ paOSS=7, |
| 338 |
+ paALSA=8, |
| 339 |
+ paAL=9, |
| 340 |
+ paBeOS=10, |
| 341 |
+ paWDMKS=11, |
| 342 |
+ paJACK=12, |
| 343 |
+ paWASAPI=13, |
| 344 |
+ paAudioScienceHPI=14 |
| 345 |
+} PaHostApiTypeId; |
| 346 |
+ |
| 347 |
+ |
| 348 |
+/** A structure containing information about a particular host API. */ |
| 349 |
+ |
| 350 |
+typedef struct PaHostApiInfo |
| 351 |
+{ |
| 352 |
+ /** this is struct version 1 */ |
| 353 |
+ int structVersion; |
| 354 |
+ /** The well known unique identifier of this host API @see PaHostApiTypeId */ |
| 355 |
+ PaHostApiTypeId type; |
| 356 |
+ /** A textual description of the host API for display on user interfaces. */ |
| 357 |
+ const char *name; |
| 358 |
+ |
| 359 |
+ /** The number of devices belonging to this host API. This field may be |
| 360 |
+ used in conjunction with Pa_HostApiDeviceIndexToDeviceIndex() to enumerate |
| 361 |
+ all devices for this host API. |
| 362 |
+ @see Pa_HostApiDeviceIndexToDeviceIndex |
| 363 |
+ */ |
| 364 |
+ int deviceCount; |
| 365 |
+ |
| 366 |
+ /** The default input device for this host API. The value will be a |
| 367 |
+ device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice |
| 368 |
+ if no default input device is available. |
| 369 |
+ */ |
| 370 |
+ PaDeviceIndex defaultInputDevice; |
| 371 |
+ |
| 372 |
+ /** The default output device for this host API. The value will be a |
| 373 |
+ device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice |
| 374 |
+ if no default output device is available. |
| 375 |
+ */ |
| 376 |
+ PaDeviceIndex defaultOutputDevice; |
| 377 |
+ |
| 378 |
+} PaHostApiInfo; |
| 379 |
+ |
| 380 |
+ |
| 381 |
+/** Retrieve a pointer to a structure containing information about a specific |
| 382 |
+ host Api. |
| 383 |
+ |
| 384 |
+ @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) |
| 385 |
+ |
| 386 |
+ @return A pointer to an immutable PaHostApiInfo structure describing |
| 387 |
+ a specific host API. If the hostApi parameter is out of range or an error |
| 388 |
+ is encountered, the function returns NULL. |
| 389 |
+ |
| 390 |
+ The returned structure is owned by the PortAudio implementation and must not |
| 391 |
+ be manipulated or freed. The pointer is only guaranteed to be valid between |
| 392 |
+ calls to Pa_Initialize() and Pa_Terminate(). |
| 393 |
+*/ |
| 394 |
+const PaHostApiInfo * Pa_GetHostApiInfo( PaHostApiIndex hostApi ); |
| 395 |
+ |
| 396 |
+ |
| 397 |
+/** Convert a static host API unique identifier, into a runtime |
| 398 |
+ host API index. |
| 399 |
+ |
| 400 |
+ @param type A unique host API identifier belonging to the PaHostApiTypeId |
| 401 |
+ enumeration. |
| 402 |
+ |
| 403 |
+ @return A valid PaHostApiIndex ranging from 0 to (Pa_GetHostApiCount()-1) or, |
| 404 |
+ a PaErrorCode (which are always negative) if PortAudio is not initialized |
| 405 |
+ or an error is encountered. |
| 406 |
+ |
| 407 |
+ The paHostApiNotFound error code indicates that the host API specified by the |
| 408 |
+ type parameter is not available. |
| 409 |
+ |
| 410 |
+ @see PaHostApiTypeId |
| 411 |
+*/ |
| 412 |
+PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type ); |
| 413 |
+ |
| 414 |
+ |
| 415 |
+/** Convert a host-API-specific device index to standard PortAudio device index. |
| 416 |
+ This function may be used in conjunction with the deviceCount field of |
| 417 |
+ PaHostApiInfo to enumerate all devices for the specified host API. |
| 418 |
+ |
| 419 |
+ @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) |
| 420 |
+ |
| 421 |
+ @param hostApiDeviceIndex A valid per-host device index in the range |
| 422 |
+ 0 to (Pa_GetHostApiInfo(hostApi)->deviceCount-1) |
| 423 |
+ |
| 424 |
+ @return A non-negative PaDeviceIndex ranging from 0 to (Pa_GetDeviceCount()-1) |
| 425 |
+ or, a PaErrorCode (which are always negative) if PortAudio is not initialized |
| 426 |
+ or an error is encountered. |
| 427 |
+ |
| 428 |
+ A paInvalidHostApi error code indicates that the host API index specified by |
| 429 |
+ the hostApi parameter is out of range. |
| 430 |
+ |
| 431 |
+ A paInvalidDevice error code indicates that the hostApiDeviceIndex parameter |
| 432 |
+ is out of range. |
| 433 |
+ |
| 434 |
+ @see PaHostApiInfo |
| 435 |
+*/ |
| 436 |
+PaDeviceIndex Pa_HostApiDeviceIndexToDeviceIndex( PaHostApiIndex hostApi, |
| 437 |
+ int hostApiDeviceIndex ); |
| 438 |
+ |
| 439 |
+ |
| 440 |
+ |
| 441 |
+/** Structure used to return information about a host error condition. |
| 442 |
+*/ |
| 443 |
+typedef struct PaHostErrorInfo{ |
| 444 |
+ PaHostApiTypeId hostApiType; /**< the host API which returned the error code */ |
| 445 |
+ long errorCode; /**< the error code returned */ |
| 446 |
+ const char *errorText; /**< a textual description of the error if available, otherwise a zero-length string */ |
| 447 |
+}PaHostErrorInfo; |
| 448 |
+ |
| 449 |
+ |
| 450 |
+/** Return information about the last host error encountered. The error |
| 451 |
+ information returned by Pa_GetLastHostErrorInfo() will never be modified |
| 452 |
+ asyncronously by errors occurring in other PortAudio owned threads |
| 453 |
+ (such as the thread that manages the stream callback.) |
| 454 |
+ |
| 455 |
+ This function is provided as a last resort, primarily to enhance debugging |
| 456 |
+ by providing clients with access to all available error information. |
| 457 |
+ |
| 458 |
+ @return A pointer to an immutable structure constaining information about |
| 459 |
+ the host error. The values in this structure will only be valid if a |
| 460 |
+ PortAudio function has previously returned the paUnanticipatedHostError |
| 461 |
+ error code. |
| 462 |
+*/ |
| 463 |
+const PaHostErrorInfo* Pa_GetLastHostErrorInfo( void ); |
| 464 |
+ |
| 465 |
+ |
| 466 |
+ |
| 467 |
+/* Device enumeration and capabilities */ |
| 468 |
+ |
| 469 |
+/** Retrieve the number of available devices. The number of available devices |
| 470 |
+ may be zero. |
| 471 |
+ |
| 472 |
+ @return A non-negative value indicating the number of available devices or, |
| 473 |
+ a PaErrorCode (which are always negative) if PortAudio is not initialized |
| 474 |
+ or an error is encountered. |
| 475 |
+*/ |
| 476 |
+PaDeviceIndex Pa_GetDeviceCount( void ); |
| 477 |
+ |
| 478 |
+ |
| 479 |
+/** Retrieve the index of the default input device. The result can be |
| 480 |
+ used in the inputDevice parameter to Pa_OpenStream(). |
| 481 |
+ |
| 482 |
+ @return The default input device index for the default host API, or paNoDevice |
| 483 |
+ if no default input device is available or an error was encountered. |
| 484 |
+*/ |
| 485 |
+PaDeviceIndex Pa_GetDefaultInputDevice( void ); |
| 486 |
+ |
| 487 |
+ |
| 488 |
+/** Retrieve the index of the default output device. The result can be |
| 489 |
+ used in the outputDevice parameter to Pa_OpenStream(). |
| 490 |
+ |
| 491 |
+ @return The default output device index for the defualt host API, or paNoDevice |
| 492 |
+ if no default output device is available or an error was encountered. |
| 493 |
+ |
| 494 |
+ @note |
| 495 |
+ On the PC, the user can specify a default device by |
| 496 |
+ setting an environment variable. For example, to use device #1. |
| 497 |
+<pre> |
| 498 |
+ set PA_RECOMMENDED_OUTPUT_DEVICE=1 |
| 499 |
+</pre> |
| 500 |
+ The user should first determine the available device ids by using |
| 501 |
+ the supplied application "pa_devs". |
| 502 |
+*/ |
| 503 |
+PaDeviceIndex Pa_GetDefaultOutputDevice( void ); |
| 504 |
+ |
| 505 |
+ |
| 506 |
+/** The type used to represent monotonic time in seconds that can be used |
| 507 |
+ for syncronisation. The type is used for the outTime argument to the |
| 508 |
+ PaStreamCallback and as the result of Pa_GetStreamTime(). |
| 509 |
+ |
| 510 |
+ @see PaStreamCallback, Pa_GetStreamTime |
| 511 |
+*/ |
| 512 |
+typedef double PaTime; |
| 513 |
+ |
| 514 |
+ |
| 515 |
+/** A type used to specify one or more sample formats. Each value indicates |
| 516 |
+ a possible format for sound data passed to and from the stream callback, |
| 517 |
+ Pa_ReadStream and Pa_WriteStream. |
| 518 |
+ |
| 519 |
+ The standard formats paFloat32, paInt16, paInt32, paInt24, paInt8 |
| 520 |
+ and aUInt8 are usually implemented by all implementations. |
| 521 |
+ |
| 522 |
+ The floating point representation (paFloat32) uses +1.0 and -1.0 as the |
| 523 |
+ maximum and minimum respectively. |
| 524 |
+ |
| 525 |
+ paUInt8 is an unsigned 8 bit format where 128 is considered "ground" |
| 526 |
+ |
| 527 |
+ The paNonInterleaved flag indicates that a multichannel buffer is passed |
| 528 |
+ as a set of non-interleaved pointers. |
| 529 |
+ |
| 530 |
+ @see Pa_OpenStream, Pa_OpenDefaultStream, PaDeviceInfo |
| 531 |
+ @see paFloat32, paInt16, paInt32, paInt24, paInt8 |
| 532 |
+ @see paUInt8, paCustomFormat, paNonInterleaved |
| 533 |
+*/ |
| 534 |
+typedef unsigned long PaSampleFormat; |
| 535 |
+ |
| 536 |
+ |
| 537 |
+#define paFloat32 ((PaSampleFormat) 0x00000001) /**< @see PaSampleFormat */ |
| 538 |
+#define paInt32 ((PaSampleFormat) 0x00000002) /**< @see PaSampleFormat */ |
| 539 |
+#define paInt24 ((PaSampleFormat) 0x00000004) /**< Packed 24 bit format. @see PaSampleFormat */ |
| 540 |
+#define paInt16 ((PaSampleFormat) 0x00000008) /**< @see PaSampleFormat */ |
| 541 |
+#define paInt8 ((PaSampleFormat) 0x00000010) /**< @see PaSampleFormat */ |
| 542 |
+#define paUInt8 ((PaSampleFormat) 0x00000020) /**< @see PaSampleFormat */ |
| 543 |
+#define paCustomFormat ((PaSampleFormat) 0x00010000)/**< @see PaSampleFormat */ |
| 544 |
+ |
| 545 |
+#define paNonInterleaved ((PaSampleFormat) 0x80000000) |
| 546 |
+ |
| 547 |
+/** A structure providing information and capabilities of PortAudio devices. |
| 548 |
+ Devices may support input, output or both input and output. |
| 549 |
+*/ |
| 550 |
+typedef struct PaDeviceInfo |
| 551 |
+{ |
| 552 |
+ int structVersion; /* this is struct version 2 */ |
| 553 |
+ const char *name; |
| 554 |
+ PaHostApiIndex hostApi; /* note this is a host API index, not a type id*/ |
| 555 |
+ |
| 556 |
+ int maxInputChannels; |
| 557 |
+ int maxOutputChannels; |
| 558 |
+ |
| 559 |
+ /* Default latency values for interactive performance. */ |
| 560 |
+ PaTime defaultLowInputLatency; |
| 561 |
+ PaTime defaultLowOutputLatency; |
| 562 |
+ /* Default latency values for robust non-interactive applications (eg. playing sound files). */ |
| 563 |
+ PaTime defaultHighInputLatency; |
| 564 |
+ PaTime defaultHighOutputLatency; |
| 565 |
+ |
| 566 |
+ double defaultSampleRate; |
| 567 |
+} PaDeviceInfo; |
| 568 |
+ |
| 569 |
+ |
| 570 |
+/** Retrieve a pointer to a PaDeviceInfo structure containing information |
| 571 |
+ about the specified device. |
| 572 |
+ @return A pointer to an immutable PaDeviceInfo structure. If the device |
| 573 |
+ parameter is out of range the function returns NULL. |
| 574 |
+ |
| 575 |
+ @param device A valid device index in the range 0 to (Pa_GetDeviceCount()-1) |
| 576 |
+ |
| 577 |
+ @note PortAudio manages the memory referenced by the returned pointer, |
| 578 |
+ the client must not manipulate or free the memory. The pointer is only |
| 579 |
+ guaranteed to be valid between calls to Pa_Initialize() and Pa_Terminate(). |
| 580 |
+ |
| 581 |
+ @see PaDeviceInfo, PaDeviceIndex |
| 582 |
+*/ |
| 583 |
+const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceIndex device ); |
| 584 |
+ |
| 585 |
+ |
| 586 |
+/** Parameters for one direction (input or output) of a stream. |
| 587 |
+*/ |
| 588 |
+typedef struct PaStreamParameters |
| 589 |
+{ |
| 590 |
+ /** A valid device index in the range 0 to (Pa_GetDeviceCount()-1) |
| 591 |
+ specifying the device to be used or the special constant |
| 592 |
+ paUseHostApiSpecificDeviceSpecification which indicates that the actual |
| 593 |
+ device(s) to use are specified in hostApiSpecificStreamInfo. |
| 594 |
+ This field must not be set to paNoDevice. |
| 595 |
+ */ |
| 596 |
+ PaDeviceIndex device; |
| 597 |
+ |
| 598 |
+ /** The number of channels of sound to be delivered to the |
| 599 |
+ stream callback or accessed by Pa_ReadStream() or Pa_WriteStream(). |
| 600 |
+ It can range from 1 to the value of maxInputChannels in the |
| 601 |
+ PaDeviceInfo record for the device specified by the device parameter. |
| 602 |
+ */ |
| 603 |
+ int channelCount; |
| 604 |
+ |
| 605 |
+ /** The sample format of the buffer provided to the stream callback, |
| 606 |
+ a_ReadStream() or Pa_WriteStream(). It may be any of the formats described |
| 607 |
+ by the PaSampleFormat enumeration. |
| 608 |
+ */ |
| 609 |
+ PaSampleFormat sampleFormat; |
| 610 |
+ |
| 611 |
+ /** The desired latency in seconds. Where practical, implementations should |
| 612 |
+ configure their latency based on these parameters, otherwise they may |
| 613 |
+ choose the closest viable latency instead. Unless the suggested latency |
| 614 |
+ is greater than the absolute upper limit for the device implementations |
| 615 |
+ should round the suggestedLatency up to the next practial value - ie to |
| 616 |
+ provide an equal or higher latency than suggestedLatency wherever possibe. |
| 617 |
+ Actual latency values for an open stream may be retrieved using the |
| 618 |
+ inputLatency and outputLatency fields of the PaStreamInfo structure |
| 619 |
+ returned by Pa_GetStreamInfo(). |
| 620 |
+ @see default*Latency in PaDeviceInfo, *Latency in PaStreamInfo |
| 621 |
+ */ |
| 622 |
+ PaTime suggestedLatency; |
| 623 |
+ |
| 624 |
+ /** An optional pointer to a host api specific data structure |
| 625 |
+ containing additional information for device setup and/or stream processing. |
| 626 |
+ hostApiSpecificStreamInfo is never required for correct operation, |
| 627 |
+ if not used it should be set to NULL. |
| 628 |
+ */ |
| 629 |
+ void *hostApiSpecificStreamInfo; |
| 630 |
+ |
| 631 |
+} PaStreamParameters; |
| 632 |
+ |
| 633 |
+ |
| 634 |
+/** Return code for Pa_IsFormatSupported indicating success. */ |
| 635 |
+#define paFormatIsSupported (0) |
| 636 |
+ |
| 637 |
+/** Determine whether it would be possible to open a stream with the specified |
| 638 |
+ parameters. |
| 639 |
+ |
| 640 |
+ @param inputParameters A structure that describes the input parameters used to |
| 641 |
+ open a stream. The suggestedLatency field is ignored. See PaStreamParameters |
| 642 |
+ for a description of these parameters. inputParameters must be NULL for |
| 643 |
+ output-only streams. |
| 644 |
+ |
| 645 |
+ @param outputParameters A structure that describes the output parameters used |
| 646 |
+ to open a stream. The suggestedLatency field is ignored. See PaStreamParameters |
| 647 |
+ for a description of these parameters. outputParameters must be NULL for |
| 648 |
+ input-only streams. |
| 649 |
+ |
| 650 |
+ @param sampleRate The required sampleRate. For full-duplex streams it is the |
| 651 |
+ sample rate for both input and output |
| 652 |
+ |
| 653 |
+ @return Returns 0 if the format is supported, and an error code indicating why |
| 654 |
+ the format is not supported otherwise. The constant paFormatIsSupported is |
| 655 |
+ provided to compare with the return value for success. |
| 656 |
+ |
| 657 |
+ @see paFormatIsSupported, PaStreamParameters |
| 658 |
+*/ |
| 659 |
+PaError Pa_IsFormatSupported( const PaStreamParameters *inputParameters, |
| 660 |
+ const PaStreamParameters *outputParameters, |
| 661 |
+ double sampleRate ); |
| 662 |
+ |
| 663 |
+ |
| 664 |
+ |
| 665 |
+/* Streaming types and functions */ |
| 666 |
+ |
| 667 |
+ |
| 668 |
+/** |
| 669 |
+ A single PaStream can provide multiple channels of real-time |
| 670 |
+ streaming audio input and output to a client application. A stream |
| 671 |
+ provides access to audio hardware represented by one or more |
| 672 |
+ PaDevices. Depending on the underlying Host API, it may be possible |
| 673 |
+ to open multiple streams using the same device, however this behavior |
| 674 |
+ is implementation defined. Portable applications should assume that |
| 675 |
+ a PaDevice may be simultaneously used by at most one PaStream. |
| 676 |
+ |
| 677 |
+ Pointers to PaStream objects are passed between PortAudio functions that |
| 678 |
+ operate on streams. |
| 679 |
+ |
| 680 |
+ @see Pa_OpenStream, Pa_OpenDefaultStream, Pa_OpenDefaultStream, Pa_CloseStream, |
| 681 |
+ Pa_StartStream, Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive, |
| 682 |
+ Pa_GetStreamTime, Pa_GetStreamCpuLoad |
| 683 |
+ |
| 684 |
+*/ |
| 685 |
+typedef void PaStream; |
| 686 |
+ |
| 687 |
+ |
| 688 |
+/** Can be passed as the framesPerBuffer parameter to Pa_OpenStream() |
| 689 |
+ or Pa_OpenDefaultStream() to indicate that the stream callback will |
| 690 |
+ accept buffers of any size. |
| 691 |
+*/ |
| 692 |
+#define paFramesPerBufferUnspecified (0) |
| 693 |
+ |
| 694 |
+ |
| 695 |
+/** Flags used to control the behavior of a stream. They are passed as |
| 696 |
+ parameters to Pa_OpenStream or Pa_OpenDefaultStream. Multiple flags may be |
| 697 |
+ ORed together. |
| 698 |
+ |
| 699 |
+ @see Pa_OpenStream, Pa_OpenDefaultStream |
| 700 |
+ @see paNoFlag, paClipOff, paDitherOff, paNeverDropInput, |
| 701 |
+ paPrimeOutputBuffersUsingStreamCallback, paPlatformSpecificFlags |
| 702 |
+*/ |
| 703 |
+typedef unsigned long PaStreamFlags; |
| 704 |
+ |
| 705 |
+/** @see PaStreamFlags */ |
| 706 |
+#define paNoFlag ((PaStreamFlags) 0) |
| 707 |
+ |
| 708 |
+/** Disable default clipping of out of range samples. |
| 709 |
+ @see PaStreamFlags |
| 710 |
+*/ |
| 711 |
+#define paClipOff ((PaStreamFlags) 0x00000001) |
| 712 |
+ |
| 713 |
+/** Disable default dithering. |
| 714 |
+ @see PaStreamFlags |
| 715 |
+*/ |
| 716 |
+#define paDitherOff ((PaStreamFlags) 0x00000002) |
| 717 |
+ |
| 718 |
+/** Flag requests that where possible a full duplex stream will not discard |
| 719 |
+ overflowed input samples without calling the stream callback. This flag is |
| 720 |
+ only valid for full duplex callback streams and only when used in combination |
| 721 |
+ with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using |
| 722 |
+ this flag incorrectly results in a paInvalidFlag error being returned from |
| 723 |
+ Pa_OpenStream and Pa_OpenDefaultStream. |
| 724 |
+ |
| 725 |
+ @see PaStreamFlags, paFramesPerBufferUnspecified |
| 726 |
+*/ |
| 727 |
+#define paNeverDropInput ((PaStreamFlags) 0x00000004) |
| 728 |
+ |
| 729 |
+/** Call the stream callback to fill initial output buffers, rather than the |
| 730 |
+ default behavior of priming the buffers with zeros (silence). This flag has |
| 731 |
+ no effect for input-only and blocking read/write streams. |
| 732 |
+ |
| 733 |
+ @see PaStreamFlags |
| 734 |
+*/ |
| 735 |
+#define paPrimeOutputBuffersUsingStreamCallback ((PaStreamFlags) 0x00000008) |
| 736 |
+ |
| 737 |
+/** A mask specifying the platform specific bits. |
| 738 |
+ @see PaStreamFlags |
| 739 |
+*/ |
| 740 |
+#define paPlatformSpecificFlags ((PaStreamFlags)0xFFFF0000) |
| 741 |
+ |
| 742 |
+/** |
| 743 |
+ Timing information for the buffers passed to the stream callback. |
| 744 |
+*/ |
| 745 |
+typedef struct PaStreamCallbackTimeInfo{ |
| 746 |
+ PaTime inputBufferAdcTime; |
| 747 |
+ PaTime currentTime; |
| 748 |
+ PaTime outputBufferDacTime; |
| 749 |
+} PaStreamCallbackTimeInfo; |
| 750 |
+ |
| 751 |
+ |
| 752 |
+/** |
| 753 |
+ Flag bit constants for the statusFlags to PaStreamCallback. |
| 754 |
+ |
| 755 |
+ @see paInputUnderflow, paInputOverflow, paOutputUnderflow, paOutputOverflow, |
| 756 |
+ paPrimingOutput |
| 757 |
+*/ |
| 758 |
+typedef unsigned long PaStreamCallbackFlags; |
| 759 |
+ |
| 760 |
+/** In a stream opened with paFramesPerBufferUnspecified, indicates that |
| 761 |
+ input data is all silence (zeros) because no real data is available. In a |
| 762 |
+ stream opened without paFramesPerBufferUnspecified, it indicates that one or |
| 763 |
+ more zero samples have been inserted into the input buffer to compensate |
| 764 |
+ for an input underflow. |
| 765 |
+ @see PaStreamCallbackFlags |
| 766 |
+*/ |
| 767 |
+#define paInputUnderflow ((PaStreamCallbackFlags) 0x00000001) |
| 768 |
+ |
| 769 |
+/** In a stream opened with paFramesPerBufferUnspecified, indicates that data |
| 770 |
+ prior to the first sample of the input buffer was discarded due to an |
| 771 |
+ overflow, possibly because the stream callback is using too much CPU time. |
| 772 |
+ Otherwise indicates that data prior to one or more samples in the |
| 773 |
+ input buffer was discarded. |
| 774 |
+ @see PaStreamCallbackFlags |
| 775 |
+*/ |
| 776 |
+#define paInputOverflow ((PaStreamCallbackFlags) 0x00000002) |
| 777 |
+ |
| 778 |
+/** Indicates that output data (or a gap) was inserted, possibly because the |
| 779 |
+ stream callback is using too much CPU time. |
| 780 |
+ @see PaStreamCallbackFlags |
| 781 |
+*/ |
| 782 |
+#define paOutputUnderflow ((PaStreamCallbackFlags) 0x00000004) |
| 783 |
+ |
| 784 |
+/** Indicates that output data will be discarded because no room is available. |
| 785 |
+ @see PaStreamCallbackFlags |
| 786 |
+*/ |
| 787 |
+#define paOutputOverflow ((PaStreamCallbackFlags) 0x00000008) |
| 788 |
+ |
| 789 |
+/** Some of all of the output data will be used to prime the stream, input |
| 790 |
+ data may be zero. |
| 791 |
+ @see PaStreamCallbackFlags |
| 792 |
+*/ |
| 793 |
+#define paPrimingOutput ((PaStreamCallbackFlags) 0x00000010) |
| 794 |
+ |
| 795 |
+/** |
| 796 |
+ Allowable return values for the PaStreamCallback. |
| 797 |
+ @see PaStreamCallback |
| 798 |
+*/ |
| 799 |
+typedef enum PaStreamCallbackResult |
| 800 |
+{ |
| 801 |
+ paContinue=0, |
| 802 |
+ paComplete=1, |
| 803 |
+ paAbort=2 |
| 804 |
+} PaStreamCallbackResult; |
| 805 |
+ |
| 806 |
+ |
| 807 |
+/** |
| 808 |
+ Functions of type PaStreamCallback are implemented by PortAudio clients. |
| 809 |
+ They consume, process or generate audio in response to requests from an |
| 810 |
+ active PortAudio stream. |
| 811 |
+ |
| 812 |
+ @param input and @param output are arrays of interleaved samples, |
| 813 |
+ the format, packing and number of channels used by the buffers are |
| 814 |
+ determined by parameters to Pa_OpenStream(). |
| 815 |
+ |
| 816 |
+ @param frameCount The number of sample frames to be processed by |
| 817 |
+ the stream callback. |
| 818 |
+ |
| 819 |
+ @param timeInfo The time in seconds when the first sample of the input |
| 820 |
+ buffer was received at the audio input, the time in seconds when the first |
| 821 |
+ sample of the output buffer will begin being played at the audio output, and |
| 822 |
+ the time in seconds when the stream callback was called. |
| 823 |
+ See also Pa_GetStreamTime() |
| 824 |
+ |
| 825 |
+ @param statusFlags Flags indicating whether input and/or output buffers |
| 826 |
+ have been inserted or will be dropped to overcome underflow or overflow |
| 827 |
+ conditions. |
| 828 |
+ |
| 829 |
+ @param userData The value of a user supplied pointer passed to |
| 830 |
+ Pa_OpenStream() intended for storing synthesis data etc. |
| 831 |
+ |
| 832 |
+ @return |
| 833 |
+ The stream callback should return one of the values in the |
| 834 |
+ PaStreamCallbackResult enumeration. To ensure that the callback continues |
| 835 |
+ to be called, it should return paContinue (0). Either paComplete or paAbort |
| 836 |
+ can be returned to finish stream processing, after either of these values is |
| 837 |
+ returned the callback will not be called again. If paAbort is returned the |
| 838 |
+ stream will finish as soon as possible. If paComplete is returned, the stream |
| 839 |
+ will continue until all buffers generated by the callback have been played. |
| 840 |
+ This may be useful in applications such as soundfile players where a specific |
| 841 |
+ duration of output is required. However, it is not necessary to utilise this |
| 842 |
+ mechanism as Pa_StopStream(), Pa_AbortStream() or Pa_CloseStream() can also |
| 843 |
+ be used to stop the stream. The callback must always fill the entire output |
| 844 |
+ buffer irrespective of its return value. |
| 845 |
+ |
| 846 |
+ @see Pa_OpenStream, Pa_OpenDefaultStream |
| 847 |
+ |
| 848 |
+ @note With the exception of Pa_GetStreamCpuLoad() it is not permissable to call |
| 849 |
+ PortAudio API functions from within the stream callback. |
| 850 |
+*/ |
| 851 |
+typedef int PaStreamCallback( |
| 852 |
+ const void *input, void *output, |
| 853 |
+ unsigned long frameCount, |
| 854 |
+ const PaStreamCallbackTimeInfo* timeInfo, |
| 855 |
+ PaStreamCallbackFlags statusFlags, |
| 856 |
+ void *userData ); |
| 857 |
+ |
| 858 |
+ |
| 859 |
+/** Opens a stream for either input, output or both. |
| 860 |
+ |
| 861 |
+ @param stream The address of a PaStream pointer which will receive |
| 862 |
+ a pointer to the newly opened stream. |
| 863 |
+ |
| 864 |
+ @param inputParameters A structure that describes the input parameters used by |
| 865 |
+ the opened stream. See PaStreamParameters for a description of these parameters. |
| 866 |
+ inputParameters must be NULL for output-only streams. |
| 867 |
+ |
| 868 |
+ @param outputParameters A structure that describes the output parameters used by |
| 869 |
+ the opened stream. See PaStreamParameters for a description of these parameters. |
| 870 |
+ outputParameters must be NULL for input-only streams. |
| 871 |
+ |
| 872 |
+ @param sampleRate The desired sampleRate. For full-duplex streams it is the |
| 873 |
+ sample rate for both input and output |
| 874 |
+ |
| 875 |
+ @param framesPerBuffer The number of frames passed to the stream callback |
| 876 |
+ function, or the preferred block granularity for a blocking read/write stream. |
| 877 |
+ The special value paFramesPerBufferUnspecified (0) may be used to request that |
| 878 |
+ the stream callback will recieve an optimal (and possibly varying) number of |
| 879 |
+ frames based on host requirements and the requested latency settings. |
| 880 |
+ Note: With some host APIs, the use of non-zero framesPerBuffer for a callback |
| 881 |
+ stream may introduce an additional layer of buffering which could introduce |
| 882 |
+ additional latency. PortAudio guarantees that the additional latency |
| 883 |
+ will be kept to the theoretical minimum however, it is strongly recommended |
| 884 |
+ that a non-zero framesPerBuffer value only be used when your algorithm |
| 885 |
+ requires a fixed number of frames per stream callback. |
| 886 |
+ |
| 887 |
+ @param streamFlags Flags which modify the behaviour of the streaming process. |
| 888 |
+ This parameter may contain a combination of flags ORed together. Some flags may |
| 889 |
+ only be relevant to certain buffer formats. |
| 890 |
+ |
| 891 |
+ @param streamCallback A pointer to a client supplied function that is responsible |
| 892 |
+ for processing and filling input and output buffers. If this parameter is NULL |
| 893 |
+ the stream will be opened in 'blocking read/write' mode. In blocking mode, |
| 894 |
+ the client can receive sample data using Pa_ReadStream and write sample data |
| 895 |
+ using Pa_WriteStream, the number of samples that may be read or written |
| 896 |
+ without blocking is returned by Pa_GetStreamReadAvailable and |
| 897 |
+ Pa_GetStreamWriteAvailable respectively. |
| 898 |
+ |
| 899 |
+ @param userData A client supplied pointer which is passed to the stream callback |
| 900 |
+ function. It could for example, contain a pointer to instance data necessary |
| 901 |
+ for processing the audio buffers. This parameter is ignored if streamCallback |
| 902 |
+ is NULL. |
| 903 |
+ |
| 904 |
+ @return |
| 905 |
+ Upon success Pa_OpenStream() returns paNoError and places a pointer to a |
| 906 |
+ valid PaStream in the stream argument. The stream is inactive (stopped). |
| 907 |
+ If a call to Pa_OpenStream() fails, a non-zero error code is returned (see |
| 908 |
+ PaError for possible error codes) and the value of stream is invalid. |
| 909 |
+ |
| 910 |
+ @see PaStreamParameters, PaStreamCallback, Pa_ReadStream, Pa_WriteStream, |
| 911 |
+ Pa_GetStreamReadAvailable, Pa_GetStreamWriteAvailable |
| 912 |
+*/ |
| 913 |
+PaError Pa_OpenStream( PaStream** stream, |
| 914 |
+ const PaStreamParameters *inputParameters, |
| 915 |
+ const PaStreamParameters *outputParameters, |
| 916 |
+ double sampleRate, |
| 917 |
+ unsigned long framesPerBuffer, |
| 918 |
+ PaStreamFlags streamFlags, |
| 919 |
+ PaStreamCallback *streamCallback, |
| 920 |
+ void *userData ); |
| 921 |
+ |
| 922 |
+ |
| 923 |
+/** A simplified version of Pa_OpenStream() that opens the default input |
| 924 |
+ and/or output devices. |
| 925 |
+ |
| 926 |
+ @param stream The address of a PaStream pointer which will receive |
| 927 |
+ a pointer to the newly opened stream. |
| 928 |
+ |
| 929 |
+ @param numInputChannels The number of channels of sound that will be supplied |
| 930 |
+ to the stream callback or returned by Pa_ReadStream. It can range from 1 to |
| 931 |
+ the value of maxInputChannels in the PaDeviceInfo record for the default input |
| 932 |
+ device. If 0 the stream is opened as an output-only stream. |
| 933 |
+ |
| 934 |
+ @param numOutputChannels The number of channels of sound to be delivered to the |
| 935 |
+ stream callback or passed to Pa_WriteStream. It can range from 1 to the value |
| 936 |
+ of maxOutputChannels in the PaDeviceInfo record for the default output dvice. |
| 937 |
+ If 0 the stream is opened as an output-only stream. |
| 938 |
+ |
| 939 |
+ @param sampleFormat The sample format of both the input and output buffers |
| 940 |
+ provided to the callback or passed to and from Pa_ReadStream and Pa_WriteStream. |
| 941 |
+ sampleFormat may be any of the formats described by the PaSampleFormat |
| 942 |
+ enumeration. |
| 943 |
+ |
| 944 |
+ @param sampleRate Same as Pa_OpenStream parameter of the same name. |
| 945 |
+ @param framesPerBuffer Same as Pa_OpenStream parameter of the same name. |
| 946 |
+ @param streamCallback Same as Pa_OpenStream parameter of the same name. |
| 947 |
+ @param userData Same as Pa_OpenStream parameter of the same name. |
| 948 |
+ |
| 949 |
+ @return As for Pa_OpenStream |
| 950 |
+ |
| 951 |
+ @see Pa_OpenStream, PaStreamCallback |
| 952 |
+*/ |
| 953 |
+PaError Pa_OpenDefaultStream( PaStream** stream, |
| 954 |
+ int numInputChannels, |
| 955 |
+ int numOutputChannels, |
| 956 |
+ PaSampleFormat sampleFormat, |
| 957 |
+ double sampleRate, |
| 958 |
+ unsigned long framesPerBuffer, |
| 959 |
+ PaStreamCallback *streamCallback, |
| 960 |
+ void *userData ); |
| 961 |
+ |
| 962 |
+ |
| 963 |
+/** Closes an audio stream. If the audio stream is active it |
| 964 |
+ discards any pending buffers as if Pa_AbortStream() had been called. |
| 965 |
+*/ |
| 966 |
+PaError Pa_CloseStream( PaStream *stream ); |
| 967 |
+ |
| 968 |
+ |
| 969 |
+/** Functions of type PaStreamFinishedCallback are implemented by PortAudio |
| 970 |
+ clients. They can be registered with a stream using the Pa_SetStreamFinishedCallback |
| 971 |
+ function. Once registered they are called when the stream becomes inactive |
| 972 |
+ (ie once a call to Pa_StopStream() will not block). |
| 973 |
+ A stream will become inactive after the stream callback returns non-zero, |
| 974 |
+ or when Pa_StopStream or Pa_AbortStream is called. For a stream providing audio |
| 975 |
+ output, if the stream callback returns paComplete, or Pa_StopStream is called, |
| 976 |
+ the stream finished callback will not be called until all generated sample data |
| 977 |
+ has been played. |
| 978 |
+ |
| 979 |
+ @param userData The userData parameter supplied to Pa_OpenStream() |
| 980 |
+ |
| 981 |
+ @see Pa_SetStreamFinishedCallback |
| 982 |
+*/ |
| 983 |
+typedef void PaStreamFinishedCallback( void *userData ); |
| 984 |
+ |
| 985 |
+ |
| 986 |
+/** Register a stream finished callback function which will be called when the |
| 987 |
+ stream becomes inactive. See the description of PaStreamFinishedCallback for |
| 988 |
+ further details about when the callback will be called. |
| 989 |
+ |
| 990 |
+ @param stream a pointer to a PaStream that is in the stopped state - if the |
| 991 |
+ stream is not stopped, the stream's finished callback will remain unchanged |
| 992 |
+ and an error code will be returned. |
| 993 |
+ |
| 994 |
+ @param streamFinishedCallback a pointer to a function with the same signature |
| 995 |
+ as PaStreamFinishedCallback, that will be called when the stream becomes |
| 996 |
+ inactive. Passing NULL for this parameter will un-register a previously |
| 997 |
+ registered stream finished callback function. |
| 998 |
+ |
| 999 |
+ @return on success returns paNoError, otherwise an error code indicating the cause |
| 1000 |
+ of the error. |
| 1001 |
+ |
| 1002 |
+ @see PaStreamFinishedCallback |
| 1003 |
+*/ |
| 1004 |
+PaError Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback ); |
| 1005 |
+ |
| 1006 |
+ |
| 1007 |
+/** Commences audio processing. |
| 1008 |
+*/ |
| 1009 |
+PaError Pa_StartStream( PaStream *stream ); |
| 1010 |
+ |
| 1011 |
+ |
| 1012 |
+/** Terminates audio processing. It waits until all pending |
| 1013 |
+ audio buffers have been played before it returns. |
| 1014 |
+*/ |
| 1015 |
+PaError Pa_StopStream( PaStream *stream ); |
| 1016 |
+ |
| 1017 |
+ |
| 1018 |
+/** Terminates audio processing immediately without waiting for pending |
| 1019 |
+ buffers to complete. |
| 1020 |
+*/ |
| 1021 |
+PaError Pa_AbortStream( PaStream *stream ); |
| 1022 |
+ |
| 1023 |
+ |
| 1024 |
+/** Determine whether the stream is stopped. |
| 1025 |
+ A stream is considered to be stopped prior to a successful call to |
| 1026 |
+ Pa_StartStream and after a successful call to Pa_StopStream or Pa_AbortStream. |
| 1027 |
+ If a stream callback returns a value other than paContinue the stream is NOT |
| 1028 |
+ considered to be stopped. |
| 1029 |
+ |
| 1030 |
+ @return Returns one (1) when the stream is stopped, zero (0) when |
| 1031 |
+ the stream is running or, a PaErrorCode (which are always negative) if |
| 1032 |
+ PortAudio is not initialized or an error is encountered. |
| 1033 |
+ |
| 1034 |
+ @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive |
| 1035 |
+*/ |
| 1036 |
+PaError Pa_IsStreamStopped( PaStream *stream ); |
| 1037 |
+ |
| 1038 |
+ |
| 1039 |
+/** Determine whether the stream is active. |
| 1040 |
+ A stream is active after a successful call to Pa_StartStream(), until it |
| 1041 |
+ becomes inactive either as a result of a call to Pa_StopStream() or |
| 1042 |
+ Pa_AbortStream(), or as a result of a return value other than paContinue from |
| 1043 |
+ the stream callback. In the latter case, the stream is considered inactive |
| 1044 |
+ after the last buffer has finished playing. |
| 1045 |
+ |
| 1046 |
+ @return Returns one (1) when the stream is active (ie playing or recording |
| 1047 |
+ audio), zero (0) when not playing or, a PaErrorCode (which are always negative) |
| 1048 |
+ if PortAudio is not initialized or an error is encountered. |
| 1049 |
+ |
| 1050 |
+ @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamStopped |
| 1051 |
+*/ |
| 1052 |
+PaError Pa_IsStreamActive( PaStream *stream ); |
| 1053 |
+ |
| 1054 |
+ |
| 1055 |
+ |
| 1056 |
+/** A structure containing unchanging information about an open stream. |
| 1057 |
+ @see Pa_GetStreamInfo |
| 1058 |
+*/ |
| 1059 |
+ |
| 1060 |
+typedef struct PaStreamInfo |
| 1061 |
+{ |
| 1062 |
+ /** this is struct version 1 */ |
| 1063 |
+ int structVersion; |
| 1064 |
+ |
| 1065 |
+ /** The input latency of the stream in seconds. This value provides the most |
| 1066 |
+ accurate estimate of input latency available to the implementation. It may |
| 1067 |
+ differ significantly from the suggestedLatency value passed to Pa_OpenStream(). |
| 1068 |
+ The value of this field will be zero (0.) for output-only streams. |
| 1069 |
+ @see PaTime |
| 1070 |
+ */ |
| 1071 |
+ PaTime inputLatency; |
| 1072 |
+ |
| 1073 |
+ /** The output latency of the stream in seconds. This value provides the most |
| 1074 |
+ accurate estimate of output latency available to the implementation. It may |
| 1075 |
+ differ significantly from the suggestedLatency value passed to Pa_OpenStream(). |
| 1076 |
+ The value of this field will be zero (0.) for input-only streams. |
| 1077 |
+ @see PaTime |
| 1078 |
+ */ |
| 1079 |
+ PaTime outputLatency; |
| 1080 |
+ |
| 1081 |
+ /** The sample rate of the stream in Hertz (samples per second). In cases |
| 1082 |
+ where the hardware sample rate is inaccurate and PortAudio is aware of it, |
| 1083 |
+ the value of this field may be different from the sampleRate parameter |
| 1084 |
+ passed to Pa_OpenStream(). If information about the actual hardware sample |
| 1085 |
+ rate is not available, this field will have the same value as the sampleRate |
| 1086 |
+ parameter passed to Pa_OpenStream(). |
| 1087 |
+ */ |
| 1088 |
+ double sampleRate; |
| 1089 |
+ |
| 1090 |
+} PaStreamInfo; |
| 1091 |
+ |
| 1092 |
+ |
| 1093 |
+/** Retrieve a pointer to a PaStreamInfo structure containing information |
| 1094 |
+ about the specified stream. |
| 1095 |
+ @return A pointer to an immutable PaStreamInfo structure. If the stream |
| 1096 |
+ parameter invalid, or an error is encountered, the function returns NULL. |
| 1097 |
+ |
| 1098 |
+ @param stream A pointer to an open stream previously created with Pa_OpenStream. |
| 1099 |
+ |
| 1100 |
+ @note PortAudio manages the memory referenced by the returned pointer, |
| 1101 |
+ the client must not manipulate or free the memory. The pointer is only |
| 1102 |
+ guaranteed to be valid until the specified stream is closed. |
| 1103 |
+ |
| 1104 |
+ @see PaStreamInfo |
| 1105 |
+*/ |
| 1106 |
+const PaStreamInfo* Pa_GetStreamInfo( PaStream *stream ); |
| 1107 |
+ |
| 1108 |
+ |
| 1109 |
+/** Determine the current time for the stream according to the same clock used |
| 1110 |
+ to generate buffer timestamps. This time may be used for syncronising other |
| 1111 |
+ events to the audio stream, for example synchronizing audio to MIDI. |
| 1112 |
+ |
| 1113 |
+ @return The stream's current time in seconds, or 0 if an error occurred. |
| 1114 |
+ |
| 1115 |
+ @see PaTime, PaStreamCallback |
| 1116 |
+*/ |
| 1117 |
+PaTime Pa_GetStreamTime( PaStream *stream ); |
| 1118 |
+ |
| 1119 |
+ |
| 1120 |
+/** Retrieve CPU usage information for the specified stream. |
| 1121 |
+ The "CPU Load" is a fraction of total CPU time consumed by a callback stream's |
| 1122 |
+ audio processing routines including, but not limited to the client supplied |
| 1123 |
+ stream callback. This function does not work with blocking read/write streams. |
| 1124 |
+ |
| 1125 |
+ This function may be called from the stream callback function or the |
| 1126 |
+ application. |
| 1127 |
+ |
| 1128 |
+ @return |
| 1129 |
+ A floating point value, typically between 0.0 and 1.0, where 1.0 indicates |
| 1130 |
+ that the stream callback is consuming the maximum number of CPU cycles possible |
| 1131 |
+ to maintain real-time operation. A value of 0.5 would imply that PortAudio and |
| 1132 |
+ the stream callback was consuming roughly 50% of the available CPU time. The |
| 1133 |
+ return value may exceed 1.0. A value of 0.0 will always be returned for a |
| 1134 |
+ blocking read/write stream, or if an error occurrs. |
| 1135 |
+*/ |
| 1136 |
+double Pa_GetStreamCpuLoad( PaStream* stream ); |
| 1137 |
+ |
| 1138 |
+ |
| 1139 |
+/** Read samples from an input stream. The function doesn't return until |
| 1140 |
+ the entire buffer has been filled - this may involve waiting for the operating |
| 1141 |
+ system to supply the data. |
| 1142 |
+ |
| 1143 |
+ @param stream A pointer to an open stream previously created with Pa_OpenStream. |
| 1144 |
+ |
| 1145 |
+ @param buffer A pointer to a buffer of sample frames. The buffer contains |
| 1146 |
+ samples in the format specified by the inputParameters->sampleFormat field |
| 1147 |
+ used to open the stream, and the number of channels specified by |
| 1148 |
+ inputParameters->numChannels. If non-interleaved samples were requested, |
| 1149 |
+ buffer is a pointer to the first element of an array of non-interleaved |
| 1150 |
+ buffer pointers, one for each channel. |
| 1151 |
+ |
| 1152 |
+ @param frames The number of frames to be read into buffer. This parameter |
| 1153 |
+ is not constrained to a specific range, however high performance applications |
| 1154 |
+ will want to match this parameter to the framesPerBuffer parameter used |
| 1155 |
+ when opening the stream. |
| 1156 |
+ |
| 1157 |
+ @return On success PaNoError will be returned, or PaInputOverflowed if input |
| 1158 |
+ data was discarded by PortAudio after the previous call and before this call. |
| 1159 |
+*/ |
| 1160 |
+PaError Pa_ReadStream( PaStream* stream, |
| 1161 |
+ void *buffer, |
| 1162 |
+ unsigned long frames ); |
| 1163 |
+ |
| 1164 |
+ |
| 1165 |
+/** Write samples to an output stream. This function doesn't return until the |
| 1166 |
+ entire buffer has been consumed - this may involve waiting for the operating |
| 1167 |
+ system to consume the data. |
| 1168 |
+ |
| 1169 |
+ @param stream A pointer to an open stream previously created with Pa_OpenStream. |
| 1170 |
+ |
| 1171 |
+ @param buffer A pointer to a buffer of sample frames. The buffer contains |
| 1172 |
+ samples in the format specified by the outputParameters->sampleFormat field |
| 1173 |
+ used to open the stream, and the number of channels specified by |
| 1174 |
+ outputParameters->numChannels. If non-interleaved samples were requested, |
| 1175 |
+ buffer is a pointer to the first element of an array of non-interleaved |
| 1176 |
+ buffer pointers, one for each channel. |
| 1177 |
+ |
| 1178 |
+ @param frames The number of frames to be written from buffer. This parameter |
| 1179 |
+ is not constrained to a specific range, however high performance applications |
| 1180 |
+ will want to match this parameter to the framesPerBuffer parameter used |
| 1181 |
+ when opening the stream. |
| 1182 |
+ |
| 1183 |
+ @return On success PaNoError will be returned, or paOutputUnderflowed if |
| 1184 |
+ additional output data was inserted after the previous call and before this |
| 1185 |
+ call. |
| 1186 |
+*/ |
| 1187 |
+PaError Pa_WriteStream( PaStream* stream, |
| 1188 |
+ const void *buffer, |
| 1189 |
+ unsigned long frames ); |
| 1190 |
+ |
| 1191 |
+ |
| 1192 |
+/** Retrieve the number of frames that can be read from the stream without |
| 1193 |
+ waiting. |
| 1194 |
+ |
| 1195 |
+ @return Returns a non-negative value representing the maximum number of frames |
| 1196 |
+ that can be read from the stream without blocking or busy waiting or, a |
| 1197 |
+ PaErrorCode (which are always negative) if PortAudio is not initialized or an |
| 1198 |
+ error is encountered. |
| 1199 |
+*/ |
| 1200 |
+signed long Pa_GetStreamReadAvailable( PaStream* stream ); |
| 1201 |
+ |
| 1202 |
+ |
| 1203 |
+/** Retrieve the number of frames that can be written to the stream without |
| 1204 |
+ waiting. |
| 1205 |
+ |
| 1206 |
+ @return Returns a non-negative value representing the maximum number of frames |
| 1207 |
+ that can be written to the stream without blocking or busy waiting or, a |
| 1208 |
+ PaErrorCode (which are always negative) if PortAudio is not initialized or an |
| 1209 |
+ error is encountered. |
| 1210 |
+*/ |
| 1211 |
+signed long Pa_GetStreamWriteAvailable( PaStream* stream ); |
| 1212 |
+ |
| 1213 |
+ |
| 1214 |
+/* Miscellaneous utilities */ |
| 1215 |
+ |
| 1216 |
+ |
| 1217 |
+/** Retrieve the size of a given sample format in bytes. |
| 1218 |
+ |
| 1219 |
+ @return The size in bytes of a single sample in the specified format, |
| 1220 |
+ or paSampleFormatNotSupported if the format is not supported. |
| 1221 |
+*/ |
| 1222 |
+PaError Pa_GetSampleSize( PaSampleFormat format ); |
| 1223 |
+ |
| 1224 |
+ |
| 1225 |
+/** Put the caller to sleep for at least 'msec' milliseconds. This function is |
| 1226 |
+ provided only as a convenience for authors of portable code (such as the tests |
| 1227 |
+ and examples in the PortAudio distribution.) |
| 1228 |
+ |
| 1229 |
+ The function may sleep longer than requested so don't rely on this for accurate |
| 1230 |
+ musical timing. |
| 1231 |
+*/ |
| 1232 |
+void Pa_Sleep( long msec ); |
| 1233 |
+ |
| 1234 |
+ |
| 1235 |
+ |
| 1236 |
+#ifdef __cplusplus |
| 1237 |
+} |
| 1238 |
+#endif /* __cplusplus */ |
| 1239 |
+#endif /* PORTAUDIO_H */ |
| 1240 |
diff -ruN src/output/portAudio.orig/PortAudio/include/portaudio.h src/output/portAudio/PortAudio/include/portaudio.h |
| 1241 |
--- src/output/portAudio.orig/PortAudio/include/portaudio.h 2007-12-05 20:39:28.000000000 +0800 |
| 1242 |
+++ src/output/portAudio/PortAudio/include/portaudio.h 1970-01-01 08:00:00.000000000 +0800 |
| 1243 |
@@ -1,1133 +0,0 @@ |
| 1244 |
- |
| 1245 |
-#ifndef PORTAUDIO_H |
| 1246 |
-#define PORTAUDIO_H |
| 1247 |
-/* |
| 1248 |
- * $Id: portaudio.h 1083 2006-08-23 07:30:49Z rossb $ |
| 1249 |
- * PortAudio Portable Real-Time Audio Library |
| 1250 |
- * PortAudio API Header File |
| 1251 |
- * Latest version available at: http://www.portaudio.com/ |
| 1252 |
- * |
| 1253 |
- * Copyright (c) 1999-2002 Ross Bencina and Phil Burk |
| 1254 |
- * |
| 1255 |
- * Permission is hereby granted, free of charge, to any person obtaining |
| 1256 |
- * a copy of this software and associated documentation files |
| 1257 |
- * (the "Software"), to deal in the Software without restriction, |
| 1258 |
- * including without limitation the rights to use, copy, modify, merge, |
| 1259 |
- * publish, distribute, sublicense, and/or sell copies of the Software, |
| 1260 |
- * and to permit persons to whom the Software is furnished to do so, |
| 1261 |
- * subject to the following conditions: |
| 1262 |
- * |
| 1263 |
- * The above copyright notice and this permission notice shall be |
| 1264 |
- * included in all copies or substantial portions of the Software. |
| 1265 |
- * |
| 1266 |
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 1267 |
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 1268 |
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 1269 |
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR |
| 1270 |
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
| 1271 |
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 1272 |
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 1273 |
- */ |
| 1274 |
- |
| 1275 |
-/* |
| 1276 |
- * The text above constitutes the entire PortAudio license; however, |
| 1277 |
- * the PortAudio community also makes the following non-binding requests: |
| 1278 |
- * |
| 1279 |
- * Any person wishing to distribute modifications to the Software is |
| 1280 |
- * requested to send the modifications to the original developer so that |
| 1281 |
- * they can be incorporated into the canonical version. It is also |
| 1282 |
- * requested that these non-binding requests be included along with the |
| 1283 |
- * license above. |
| 1284 |
- */ |
| 1285 |
- |
| 1286 |
-/** @file |
| 1287 |
- @brief The PortAudio API. |
| 1288 |
-*/ |
| 1289 |
- |
| 1290 |
- |
| 1291 |
-#ifdef __cplusplus |
| 1292 |
-extern "C" |
| 1293 |
-{ |
| 1294 |
-#endif /* __cplusplus */ |
| 1295 |
- |
| 1296 |
- |
| 1297 |
-/** Retrieve the release number of the currently running PortAudio build, |
| 1298 |
- eg 1900. |
| 1299 |
-*/ |
| 1300 |
-int Pa_GetVersion( void ); |
| 1301 |
- |
| 1302 |
- |
| 1303 |
-/** Retrieve a textual description of the current PortAudio build, |
| 1304 |
- eg "PortAudio V19-devel 13 October 2002". |
| 1305 |
-*/ |
| 1306 |
-const char* Pa_GetVersionText( void ); |
| 1307 |
- |
| 1308 |
- |
| 1309 |
-/** Error codes returned by PortAudio functions. |
| 1310 |
- Note that with the exception of paNoError, all PaErrorCodes are negative. |
| 1311 |
-*/ |
| 1312 |
- |
| 1313 |
-typedef int PaError; |
| 1314 |
-typedef enum PaErrorCode |
| 1315 |
-{ |
| 1316 |
- paNoError = 0, |
| 1317 |
- |
| 1318 |
- paNotInitialized = -10000, |
| 1319 |
- paUnanticipatedHostError, |
| 1320 |
- paInvalidChannelCount, |
| 1321 |
- paInvalidSampleRate, |
| 1322 |
- paInvalidDevice, |
| 1323 |
- paInvalidFlag, |
| 1324 |
- paSampleFormatNotSupported, |
| 1325 |
- paBadIODeviceCombination, |
| 1326 |
- paInsufficientMemory, |
| 1327 |
- paBufferTooBig, |
| 1328 |
- paBufferTooSmall, |
| 1329 |
- paNullCallback, |
| 1330 |
- paBadStreamPtr, |
| 1331 |
- paTimedOut, |
| 1332 |
- paInternalError, |
| 1333 |
- paDeviceUnavailable, |
| 1334 |
- paIncompatibleHostApiSpecificStreamInfo, |
| 1335 |
- paStreamIsStopped, |
| 1336 |
- paStreamIsNotStopped, |
| 1337 |
- paInputOverflowed, |
| 1338 |
- paOutputUnderflowed, |
| 1339 |
- paHostApiNotFound, |
| 1340 |
- paInvalidHostApi, |
| 1341 |
- paCanNotReadFromACallbackStream, /**< @todo review error code name */ |
| 1342 |
- paCanNotWriteToACallbackStream, /**< @todo review error code name */ |
| 1343 |
- paCanNotReadFromAnOutputOnlyStream, /**< @todo review error code name */ |
| 1344 |
- paCanNotWriteToAnInputOnlyStream, /**< @todo review error code name */ |
| 1345 |
- paIncompatibleStreamHostApi, |
| 1346 |
- paBadBufferPtr |
| 1347 |
-} PaErrorCode; |
| 1348 |
- |
| 1349 |
- |
| 1350 |
-/** Translate the supplied PortAudio error code into a human readable |
| 1351 |
- message. |
| 1352 |
-*/ |
| 1353 |
-const char *Pa_GetErrorText( PaError errorCode ); |
| 1354 |
- |
| 1355 |
- |
| 1356 |
-/** Library initialization function - call this before using PortAudio. |
| 1357 |
- This function initialises internal data structures and prepares underlying |
| 1358 |
- host APIs for use. This function MUST be called before using any other |
| 1359 |
- PortAudio API functions. |
| 1360 |
- |
| 1361 |
- If Pa_Initialize() is called multiple times, each successful |
| 1362 |
- call must be matched with a corresponding call to Pa_Terminate(). |
| 1363 |
- Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not |
| 1364 |
- required to be fully nested. |
| 1365 |
- |
| 1366 |
- Note that if Pa_Initialize() returns an error code, Pa_Terminate() should |
| 1367 |
- NOT be called. |
| 1368 |
- |
| 1369 |
- @return paNoError if successful, otherwise an error code indicating the cause |
| 1370 |
- of failure. |
| 1371 |
- |
| 1372 |
- @see Pa_Terminate |
| 1373 |
-*/ |
| 1374 |
-PaError Pa_Initialize( void ); |
| 1375 |
- |
| 1376 |
- |
| 1377 |
-/** Library termination function - call this when finished using PortAudio. |
| 1378 |
- This function deallocates all resources allocated by PortAudio since it was |
| 1379 |
- initializied by a call to Pa_Initialize(). In cases where Pa_Initialise() has |
| 1380 |
- been called multiple times, each call must be matched with a corresponding call |
| 1381 |
- to Pa_Terminate(). The final matching call to Pa_Terminate() will automatically |
| 1382 |
- close any PortAudio streams that are still open. |
| 1383 |
- |
| 1384 |
- Pa_Terminate() MUST be called before exiting a program which uses PortAudio. |
| 1385 |
- Failure to do so may result in serious resource leaks, such as audio devices |
| 1386 |
- not being available until the next reboot. |
| 1387 |
- |
| 1388 |
- @return paNoError if successful, otherwise an error code indicating the cause |
| 1389 |
- of failure. |
| 1390 |
- |
| 1391 |
- @see Pa_Initialize |
| 1392 |
-*/ |
| 1393 |
-PaError Pa_Terminate( void ); |
| 1394 |
- |
| 1395 |
- |
| 1396 |
- |
| 1397 |
-/** The type used to refer to audio devices. Values of this type usually |
| 1398 |
- range from 0 to (Pa_DeviceCount-1), and may also take on the PaNoDevice |
| 1399 |
- and paUseHostApiSpecificDeviceSpecification values. |
| 1400 |
- |
| 1401 |
- @see Pa_DeviceCount, paNoDevice, paUseHostApiSpecificDeviceSpecification |
| 1402 |
-*/ |
| 1403 |
-typedef int PaDeviceIndex; |
| 1404 |
- |
| 1405 |
- |
| 1406 |
-/** A special PaDeviceIndex value indicating that no device is available, |
| 1407 |
- or should be used. |
| 1408 |
- |
| 1409 |
- @see PaDeviceIndex |
| 1410 |
-*/ |
| 1411 |
-#define paNoDevice ((PaDeviceIndex)-1) |
| 1412 |
- |
| 1413 |
- |
| 1414 |
-/** A special PaDeviceIndex value indicating that the device(s) to be used |
| 1415 |
- are specified in the host api specific stream info structure. |
| 1416 |
- |
| 1417 |
- @see PaDeviceIndex |
| 1418 |
-*/ |
| 1419 |
-#define paUseHostApiSpecificDeviceSpecification ((PaDeviceIndex)-2) |
| 1420 |
- |
| 1421 |
- |
| 1422 |
-/* Host API enumeration mechanism */ |
| 1423 |
- |
| 1424 |
-/** The type used to enumerate to host APIs at runtime. Values of this type |
| 1425 |
- range from 0 to (Pa_GetHostApiCount()-1). |
| 1426 |
- |
| 1427 |
- @see Pa_GetHostApiCount |
| 1428 |
-*/ |
| 1429 |
-typedef int PaHostApiIndex; |
| 1430 |
- |
| 1431 |
- |
| 1432 |
-/** Retrieve the number of available host APIs. Even if a host API is |
| 1433 |
- available it may have no devices available. |
| 1434 |
- |
| 1435 |
- @return A non-negative value indicating the number of available host APIs |
| 1436 |
- or, a PaErrorCode (which are always negative) if PortAudio is not initialized |
| 1437 |
- or an error is encountered. |
| 1438 |
- |
| 1439 |
- @see PaHostApiIndex |
| 1440 |
-*/ |
| 1441 |
-PaHostApiIndex Pa_GetHostApiCount( void ); |
| 1442 |
- |
| 1443 |
- |
| 1444 |
-/** Retrieve the index of the default host API. The default host API will be |
| 1445 |
- the lowest common denominator host API on the current platform and is |
| 1446 |
- unlikely to provide the best performance. |
| 1447 |
- |
| 1448 |
- @return A non-negative value ranging from 0 to (Pa_GetHostApiCount()-1) |
| 1449 |
- indicating the default host API index or, a PaErrorCode (which are always |
| 1450 |
- negative) if PortAudio is not initialized or an error is encountered. |
| 1451 |
-*/ |
| 1452 |
-PaHostApiIndex Pa_GetDefaultHostApi( void ); |
| 1453 |
- |
| 1454 |
- |
| 1455 |
-/** Unchanging unique identifiers for each supported host API. This type |
| 1456 |
- is used in the PaHostApiInfo structure. The values are guaranteed to be |
| 1457 |
- unique and to never change, thus allowing code to be written that |
| 1458 |
- conditionally uses host API specific extensions. |
| 1459 |
- |
| 1460 |
- New type ids will be allocated when support for a host API reaches |
| 1461 |
- "public alpha" status, prior to that developers should use the |
| 1462 |
- paInDevelopment type id. |
| 1463 |
- |
| 1464 |
- @see PaHostApiInfo |
| 1465 |
-*/ |
| 1466 |
-typedef enum PaHostApiTypeId |
| 1467 |
-{ |
| 1468 |
- paInDevelopment=0, /* use while developing support for a new host API */ |
| 1469 |
- paDirectSound=1, |
| 1470 |
- paMME=2, |
| 1471 |
- paASIO=3, |
| 1472 |
- paSoundManager=4, |
| 1473 |
- paCoreAudio=5, |
| 1474 |
- paOSS=7, |
| 1475 |
- paALSA=8, |
| 1476 |
- paAL=9, |
| 1477 |
- paBeOS=10, |
| 1478 |
- paWDMKS=11, |
| 1479 |
- paJACK=12, |
| 1480 |
- paWASAPI=13, |
| 1481 |
- paAudioScienceHPI=14 |
| 1482 |
-} PaHostApiTypeId; |
| 1483 |
- |
| 1484 |
- |
| 1485 |
-/** A structure containing information about a particular host API. */ |
| 1486 |
- |
| 1487 |
-typedef struct PaHostApiInfo |
| 1488 |
-{ |
| 1489 |
- /** this is struct version 1 */ |
| 1490 |
- int structVersion; |
| 1491 |
- /** The well known unique identifier of this host API @see PaHostApiTypeId */ |
| 1492 |
- PaHostApiTypeId type; |
| 1493 |
- /** A textual description of the host API for display on user interfaces. */ |
| 1494 |
- const char *name; |
| 1495 |
- |
| 1496 |
- /** The number of devices belonging to this host API. This field may be |
| 1497 |
- used in conjunction with Pa_HostApiDeviceIndexToDeviceIndex() to enumerate |
| 1498 |
- all devices for this host API. |
| 1499 |
- @see Pa_HostApiDeviceIndexToDeviceIndex |
| 1500 |
- */ |
| 1501 |
- int deviceCount; |
| 1502 |
- |
| 1503 |
- /** The default input device for this host API. The value will be a |
| 1504 |
- device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice |
| 1505 |
- if no default input device is available. |
| 1506 |
- */ |
| 1507 |
- PaDeviceIndex defaultInputDevice; |
| 1508 |
- |
| 1509 |
- /** The default output device for this host API. The value will be a |
| 1510 |
- device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice |
| 1511 |
- if no default output device is available. |
| 1512 |
- */ |
| 1513 |
- PaDeviceIndex defaultOutputDevice; |
| 1514 |
- |
| 1515 |
-} PaHostApiInfo; |
| 1516 |
- |
| 1517 |
- |
| 1518 |
-/** Retrieve a pointer to a structure containing information about a specific |
| 1519 |
- host Api. |
| 1520 |
- |
| 1521 |
- @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) |
| 1522 |
- |
| 1523 |
- @return A pointer to an immutable PaHostApiInfo structure describing |
| 1524 |
- a specific host API. If the hostApi parameter is out of range or an error |
| 1525 |
- is encountered, the function returns NULL. |
| 1526 |
- |
| 1527 |
- The returned structure is owned by the PortAudio implementation and must not |
| 1528 |
- be manipulated or freed. The pointer is only guaranteed to be valid between |
| 1529 |
- calls to Pa_Initialize() and Pa_Terminate(). |
| 1530 |
-*/ |
| 1531 |
-const PaHostApiInfo * Pa_GetHostApiInfo( PaHostApiIndex hostApi ); |
| 1532 |
- |
| 1533 |
- |
| 1534 |
-/** Convert a static host API unique identifier, into a runtime |
| 1535 |
- host API index. |
| 1536 |
- |
| 1537 |
- @param type A unique host API identifier belonging to the PaHostApiTypeId |
| 1538 |
- enumeration. |
| 1539 |
- |
| 1540 |
- @return A valid PaHostApiIndex ranging from 0 to (Pa_GetHostApiCount()-1) or, |
| 1541 |
- a PaErrorCode (which are always negative) if PortAudio is not initialized |
| 1542 |
- or an error is encountered. |
| 1543 |
- |
| 1544 |
- The paHostApiNotFound error code indicates that the host API specified by the |
| 1545 |
- type parameter is not available. |
| 1546 |
- |
| 1547 |
- @see PaHostApiTypeId |
| 1548 |
-*/ |
| 1549 |
-PaHostApiIndex Pa_HostApiTypeIdToHostApiIndex( PaHostApiTypeId type ); |
| 1550 |
- |
| 1551 |
- |
| 1552 |
-/** Convert a host-API-specific device index to standard PortAudio device index. |
| 1553 |
- This function may be used in conjunction with the deviceCount field of |
| 1554 |
- PaHostApiInfo to enumerate all devices for the specified host API. |
| 1555 |
- |
| 1556 |
- @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) |
| 1557 |
- |
| 1558 |
- @param hostApiDeviceIndex A valid per-host device index in the range |
| 1559 |
- 0 to (Pa_GetHostApiInfo(hostApi)->deviceCount-1) |
| 1560 |
- |
| 1561 |
- @return A non-negative PaDeviceIndex ranging from 0 to (Pa_GetDeviceCount()-1) |
| 1562 |
- or, a PaErrorCode (which are always negative) if PortAudio is not initialized |
| 1563 |
- or an error is encountered. |
| 1564 |
- |
| 1565 |
- A paInvalidHostApi error code indicates that the host API index specified by |
| 1566 |
- the hostApi parameter is out of range. |
| 1567 |
- |
| 1568 |
- A paInvalidDevice error code indicates that the hostApiDeviceIndex parameter |
| 1569 |
- is out of range. |
| 1570 |
- |
| 1571 |
- @see PaHostApiInfo |
| 1572 |
-*/ |
| 1573 |
-PaDeviceIndex Pa_HostApiDeviceIndexToDeviceIndex( PaHostApiIndex hostApi, |
| 1574 |
- int hostApiDeviceIndex ); |
| 1575 |
- |
| 1576 |
- |
| 1577 |
- |
| 1578 |
-/** Structure used to return information about a host error condition. |
| 1579 |
-*/ |
| 1580 |
-typedef struct PaHostErrorInfo{ |
| 1581 |
- PaHostApiTypeId hostApiType; /**< the host API which returned the error code */ |
| 1582 |
- long errorCode; /**< the error code returned */ |
| 1583 |
- const char *errorText; /**< a textual description of the error if available, otherwise a zero-length string */ |
| 1584 |
-}PaHostErrorInfo; |
| 1585 |
- |
| 1586 |
- |
| 1587 |
-/** Return information about the last host error encountered. The error |
| 1588 |
- information returned by Pa_GetLastHostErrorInfo() will never be modified |
| 1589 |
- asyncronously by errors occurring in other PortAudio owned threads |
| 1590 |
- (such as the thread that manages the stream callback.) |
| 1591 |
- |
| 1592 |
- This function is provided as a last resort, primarily to enhance debugging |
| 1593 |
- by providing clients with access to all available error information. |
| 1594 |
- |
| 1595 |
- @return A pointer to an immutable structure constaining information about |
| 1596 |
- the host error. The values in this structure will only be valid if a |
| 1597 |
- PortAudio function has previously returned the paUnanticipatedHostError |
| 1598 |
- error code. |
| 1599 |
-*/ |
| 1600 |
-const PaHostErrorInfo* Pa_GetLastHostErrorInfo( void ); |
| 1601 |
- |
| 1602 |
- |
| 1603 |
- |
| 1604 |
-/* Device enumeration and capabilities */ |
| 1605 |
- |
| 1606 |
-/** Retrieve the number of available devices. The number of available devices |
| 1607 |
- may be zero. |
| 1608 |
- |
| 1609 |
- @return A non-negative value indicating the number of available devices or, |
| 1610 |
- a PaErrorCode (which are always negative) if PortAudio is not initialized |
| 1611 |
- or an error is encountered. |
| 1612 |
-*/ |
| 1613 |
-PaDeviceIndex Pa_GetDeviceCount( void ); |
| 1614 |
- |
| 1615 |
- |
| 1616 |
-/** Retrieve the index of the default input device. The result can be |
| 1617 |
- used in the inputDevice parameter to Pa_OpenStream(). |
| 1618 |
- |
| 1619 |
- @return The default input device index for the default host API, or paNoDevice |
| 1620 |
- if no default input device is available or an error was encountered. |
| 1621 |
-*/ |
| 1622 |
-PaDeviceIndex Pa_GetDefaultInputDevice( void ); |
| 1623 |
- |
| 1624 |
- |
| 1625 |
-/** Retrieve the index of the default output device. The result can be |
| 1626 |
- used in the outputDevice parameter to Pa_OpenStream(). |
| 1627 |
- |
| 1628 |
- @return The default output device index for the defualt host API, or paNoDevice |
| 1629 |
- if no default output device is available or an error was encountered. |
| 1630 |
- |
| 1631 |
- @note |
| 1632 |
- On the PC, the user can specify a default device by |
| 1633 |
- setting an environment variable. For example, to use device #1. |
| 1634 |
-<pre> |
| 1635 |
- set PA_RECOMMENDED_OUTPUT_DEVICE=1 |
| 1636 |
-</pre> |
| 1637 |
- The user should first determine the available device ids by using |
| 1638 |
- the supplied application "pa_devs". |
| 1639 |
-*/ |
| 1640 |
-PaDeviceIndex Pa_GetDefaultOutputDevice( void ); |
| 1641 |
- |
| 1642 |
- |
| 1643 |
-/** The type used to represent monotonic time in seconds that can be used |
| 1644 |
- for syncronisation. The type is used for the outTime argument to the |
| 1645 |
- PaStreamCallback and as the result of Pa_GetStreamTime(). |
| 1646 |
- |
| 1647 |
- @see PaStreamCallback, Pa_GetStreamTime |
| 1648 |
-*/ |
| 1649 |
-typedef double PaTime; |
| 1650 |
- |
| 1651 |
- |
| 1652 |
-/** A type used to specify one or more sample formats. Each value indicates |
| 1653 |
- a possible format for sound data passed to and from the stream callback, |
| 1654 |
- Pa_ReadStream and Pa_WriteStream. |
| 1655 |
- |
| 1656 |
- The standard formats paFloat32, paInt16, paInt32, paInt24, paInt8 |
| 1657 |
- and aUInt8 are usually implemented by all implementations. |
| 1658 |
- |
| 1659 |
- The floating point representation (paFloat32) uses +1.0 and -1.0 as the |
| 1660 |
- maximum and minimum respectively. |
| 1661 |
- |
| 1662 |
- paUInt8 is an unsigned 8 bit format where 128 is considered "ground" |
| 1663 |
- |
| 1664 |
- The paNonInterleaved flag indicates that a multichannel buffer is passed |
| 1665 |
- as a set of non-interleaved pointers. |
| 1666 |
- |
| 1667 |
- @see Pa_OpenStream, Pa_OpenDefaultStream, PaDeviceInfo |
| 1668 |
- @see paFloat32, paInt16, paInt32, paInt24, paInt8 |
| 1669 |
- @see paUInt8, paCustomFormat, paNonInterleaved |
| 1670 |
-*/ |
| 1671 |
-typedef unsigned long PaSampleFormat; |
| 1672 |
- |
| 1673 |
- |
| 1674 |
-#define paFloat32 ((PaSampleFormat) 0x00000001) /**< @see PaSampleFormat */ |
| 1675 |
-#define paInt32 ((PaSampleFormat) 0x00000002) /**< @see PaSampleFormat */ |
| 1676 |
-#define paInt24 ((PaSampleFormat) 0x00000004) /**< Packed 24 bit format. @see PaSampleFormat */ |
| 1677 |
-#define paInt16 ((PaSampleFormat) 0x00000008) /**< @see PaSampleFormat */ |
| 1678 |
-#define paInt8 ((PaSampleFormat) 0x00000010) /**< @see PaSampleFormat */ |
| 1679 |
-#define paUInt8 ((PaSampleFormat) 0x00000020) /**< @see PaSampleFormat */ |
| 1680 |
-#define paCustomFormat ((PaSampleFormat) 0x00010000)/**< @see PaSampleFormat */ |
| 1681 |
- |
| 1682 |
-#define paNonInterleaved ((PaSampleFormat) 0x80000000) |
| 1683 |
- |
| 1684 |
-/** A structure providing information and capabilities of PortAudio devices. |
| 1685 |
- Devices may support input, output or both input and output. |
| 1686 |
-*/ |
| 1687 |
-typedef struct PaDeviceInfo |
| 1688 |
-{ |
| 1689 |
- int structVersion; /* this is struct version 2 */ |
| 1690 |
- const char *name; |
| 1691 |
- PaHostApiIndex hostApi; /* note this is a host API index, not a type id*/ |
| 1692 |
- |
| 1693 |
- int maxInputChannels; |
| 1694 |
- int maxOutputChannels; |
| 1695 |
- |
| 1696 |
- /* Default latency values for interactive performance. */ |
| 1697 |
- PaTime defaultLowInputLatency; |
| 1698 |
- PaTime defaultLowOutputLatency; |
| 1699 |
- /* Default latency values for robust non-interactive applications (eg. playing sound files). */ |
| 1700 |
- PaTime defaultHighInputLatency; |
| 1701 |
- PaTime defaultHighOutputLatency; |
| 1702 |
- |
| 1703 |
- double defaultSampleRate; |
| 1704 |
-} PaDeviceInfo; |
| 1705 |
- |
| 1706 |
- |
| 1707 |
-/** Retrieve a pointer to a PaDeviceInfo structure containing information |
| 1708 |
- about the specified device. |
| 1709 |
- @return A pointer to an immutable PaDeviceInfo structure. If the device |
| 1710 |
- parameter is out of range the function returns NULL. |
| 1711 |
- |
| 1712 |
- @param device A valid device index in the range 0 to (Pa_GetDeviceCount()-1) |
| 1713 |
- |
| 1714 |
- @note PortAudio manages the memory referenced by the returned pointer, |
| 1715 |
- the client must not manipulate or free the memory. The pointer is only |
| 1716 |
- guaranteed to be valid between calls to Pa_Initialize() and Pa_Terminate(). |
| 1717 |
- |
| 1718 |
- @see PaDeviceInfo, PaDeviceIndex |
| 1719 |
-*/ |
| 1720 |
-const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceIndex device ); |
| 1721 |
- |
| 1722 |
- |
| 1723 |
-/** Parameters for one direction (input or output) of a stream. |
| 1724 |
-*/ |
| 1725 |
-typedef struct PaStreamParameters |
| 1726 |
-{ |
| 1727 |
- /** A valid device index in the range 0 to (Pa_GetDeviceCount()-1) |
| 1728 |
- specifying the device to be used or the special constant |
| 1729 |
- paUseHostApiSpecificDeviceSpecification which indicates that the actual |
| 1730 |
- device(s) to use are specified in hostApiSpecificStreamInfo. |
| 1731 |
- This field must not be set to paNoDevice. |
| 1732 |
- */ |
| 1733 |
- PaDeviceIndex device; |
| 1734 |
- |
| 1735 |
- /** The number of channels of sound to be delivered to the |
| 1736 |
- stream callback or accessed by Pa_ReadStream() or Pa_WriteStream(). |
| 1737 |
- It can range from 1 to the value of maxInputChannels in the |
| 1738 |
- PaDeviceInfo record for the device specified by the device parameter. |
| 1739 |
- */ |
| 1740 |
- int channelCount; |
| 1741 |
- |
| 1742 |
- /** The sample format of the buffer provided to the stream callback, |
| 1743 |
- a_ReadStream() or Pa_WriteStream(). It may be any of the formats described |
| 1744 |
- by the PaSampleFormat enumeration. |
| 1745 |
- */ |
| 1746 |
- PaSampleFormat sampleFormat; |
| 1747 |
- |
| 1748 |
- /** The desired latency in seconds. Where practical, implementations should |
| 1749 |
- configure their latency based on these parameters, otherwise they may |
| 1750 |
- choose the closest viable latency instead. Unless the suggested latency |
| 1751 |
- is greater than the absolute upper limit for the device implementations |
| 1752 |
- should round the suggestedLatency up to the next practial value - ie to |
| 1753 |
- provide an equal or higher latency than suggestedLatency wherever possibe. |
| 1754 |
- Actual latency values for an open stream may be retrieved using the |
| 1755 |
- inputLatency and outputLatency fields of the PaStreamInfo structure |
| 1756 |
- returned by Pa_GetStreamInfo(). |
| 1757 |
- @see default*Latency in PaDeviceInfo, *Latency in PaStreamInfo |
| 1758 |
- */ |
| 1759 |
- PaTime suggestedLatency; |
| 1760 |
- |
| 1761 |
- /** An optional pointer to a host api specific data structure |
| 1762 |
- containing additional information for device setup and/or stream processing. |
| 1763 |
- hostApiSpecificStreamInfo is never required for correct operation, |
| 1764 |
- if not used it should be set to NULL. |
| 1765 |
- */ |
| 1766 |
- void *hostApiSpecificStreamInfo; |
| 1767 |
- |
| 1768 |
-} PaStreamParameters; |
| 1769 |
- |
| 1770 |
- |
| 1771 |
-/** Return code for Pa_IsFormatSupported indicating success. */ |
| 1772 |
-#define paFormatIsSupported (0) |
| 1773 |
- |
| 1774 |
-/** Determine whether it would be possible to open a stream with the specified |
| 1775 |
- parameters. |
| 1776 |
- |
| 1777 |
- @param inputParameters A structure that describes the input parameters used to |
| 1778 |
- open a stream. The suggestedLatency field is ignored. See PaStreamParameters |
| 1779 |
- for a description of these parameters. inputParameters must be NULL for |
| 1780 |
- output-only streams. |
| 1781 |
- |
| 1782 |
- @param outputParameters A structure that describes the output parameters used |
| 1783 |
- to open a stream. The suggestedLatency field is ignored. See PaStreamParameters |
| 1784 |
- for a description of these parameters. outputParameters must be NULL for |
| 1785 |
- input-only streams. |
| 1786 |
- |
| 1787 |
- @param sampleRate The required sampleRate. For full-duplex streams it is the |
| 1788 |
- sample rate for both input and output |
| 1789 |
- |
| 1790 |
- @return Returns 0 if the format is supported, and an error code indicating why |
| 1791 |
- the format is not supported otherwise. The constant paFormatIsSupported is |
| 1792 |
- provided to compare with the return value for success. |
| 1793 |
- |
| 1794 |
- @see paFormatIsSupported, PaStreamParameters |
| 1795 |
-*/ |
| 1796 |
-PaError Pa_IsFormatSupported( const PaStreamParameters *inputParameters, |
| 1797 |
- const PaStreamParameters *outputParameters, |
| 1798 |
- double sampleRate ); |
| 1799 |
- |
| 1800 |
- |
| 1801 |
- |
| 1802 |
-/* Streaming types and functions */ |
| 1803 |
- |
| 1804 |
- |
| 1805 |
-/** |
| 1806 |
- A single PaStream can provide multiple channels of real-time |
| 1807 |
- streaming audio input and output to a client application. A stream |
| 1808 |
- provides access to audio hardware represented by one or more |
| 1809 |
- PaDevices. Depending on the underlying Host API, it may be possible |
| 1810 |
- to open multiple streams using the same device, however this behavior |
| 1811 |
- is implementation defined. Portable applications should assume that |
| 1812 |
- a PaDevice may be simultaneously used by at most one PaStream. |
| 1813 |
- |
| 1814 |
- Pointers to PaStream objects are passed between PortAudio functions that |
| 1815 |
- operate on streams. |
| 1816 |
- |
| 1817 |
- @see Pa_OpenStream, Pa_OpenDefaultStream, Pa_OpenDefaultStream, Pa_CloseStream, |
| 1818 |
- Pa_StartStream, Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive, |
| 1819 |
- Pa_GetStreamTime, Pa_GetStreamCpuLoad |
| 1820 |
- |
| 1821 |
-*/ |
| 1822 |
-typedef void PaStream; |
| 1823 |
- |
| 1824 |
- |
| 1825 |
-/** Can be passed as the framesPerBuffer parameter to Pa_OpenStream() |
| 1826 |
- or Pa_OpenDefaultStream() to indicate that the stream callback will |
| 1827 |
- accept buffers of any size. |
| 1828 |
-*/ |
| 1829 |
-#define paFramesPerBufferUnspecified (0) |
| 1830 |
- |
| 1831 |
- |
| 1832 |
-/** Flags used to control the behavior of a stream. They are passed as |
| 1833 |
- parameters to Pa_OpenStream or Pa_OpenDefaultStream. Multiple flags may be |
| 1834 |
- ORed together. |
| 1835 |
- |
| 1836 |
- @see Pa_OpenStream, Pa_OpenDefaultStream |
| 1837 |
- @see paNoFlag, paClipOff, paDitherOff, paNeverDropInput, |
| 1838 |
- paPrimeOutputBuffersUsingStreamCallback, paPlatformSpecificFlags |
| 1839 |
-*/ |
| 1840 |
-typedef unsigned long PaStreamFlags; |
| 1841 |
- |
| 1842 |
-/** @see PaStreamFlags */ |
| 1843 |
-#define paNoFlag ((PaStreamFlags) 0) |
| 1844 |
- |
| 1845 |
-/** Disable default clipping of out of range samples. |
| 1846 |
- @see PaStreamFlags |
| 1847 |
-*/ |
| 1848 |
-#define paClipOff ((PaStreamFlags) 0x00000001) |
| 1849 |
- |
| 1850 |
-/** Disable default dithering. |
| 1851 |
- @see PaStreamFlags |
| 1852 |
-*/ |
| 1853 |
-#define paDitherOff ((PaStreamFlags) 0x00000002) |
| 1854 |
- |
| 1855 |
-/** Flag requests that where possible a full duplex stream will not discard |
| 1856 |
- overflowed input samples without calling the stream callback. This flag is |
| 1857 |
- only valid for full duplex callback streams and only when used in combination |
| 1858 |
- with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using |
| 1859 |
- this flag incorrectly results in a paInvalidFlag error being returned from |
| 1860 |
- Pa_OpenStream and Pa_OpenDefaultStream. |
| 1861 |
- |
| 1862 |
- @see PaStreamFlags, paFramesPerBufferUnspecified |
| 1863 |
-*/ |
| 1864 |
-#define paNeverDropInput ((PaStreamFlags) 0x00000004) |
| 1865 |
- |
| 1866 |
-/** Call the stream callback to fill initial output buffers, rather than the |
| 1867 |
- default behavior of priming the buffers with zeros (silence). This flag has |
| 1868 |
- no effect for input-only and blocking read/write streams. |
| 1869 |
- |
| 1870 |
- @see PaStreamFlags |
| 1871 |
-*/ |
| 1872 |
-#define paPrimeOutputBuffersUsingStreamCallback ((PaStreamFlags) 0x00000008) |
| 1873 |
- |
| 1874 |
-/** A mask specifying the platform specific bits. |
| 1875 |
- @see PaStreamFlags |
| 1876 |
-*/ |
| 1877 |
-#define paPlatformSpecificFlags ((PaStreamFlags)0xFFFF0000) |
| 1878 |
- |
| 1879 |
-/** |
| 1880 |
- Timing information for the buffers passed to the stream callback. |
| 1881 |
-*/ |
| 1882 |
-typedef struct PaStreamCallbackTimeInfo{ |
| 1883 |
- PaTime inputBufferAdcTime; |
| 1884 |
- PaTime currentTime; |
| 1885 |
- PaTime outputBufferDacTime; |
| 1886 |
-} PaStreamCallbackTimeInfo; |
| 1887 |
- |
| 1888 |
- |
| 1889 |
-/** |
| 1890 |
- Flag bit constants for the statusFlags to PaStreamCallback. |
| 1891 |
- |
| 1892 |
- @see paInputUnderflow, paInputOverflow, paOutputUnderflow, paOutputOverflow, |
| 1893 |
- paPrimingOutput |
| 1894 |
-*/ |
| 1895 |
-typedef unsigned long PaStreamCallbackFlags; |
| 1896 |
- |
| 1897 |
-/** In a stream opened with paFramesPerBufferUnspecified, indicates that |
| 1898 |
- input data is all silence (zeros) because no real data is available. In a |
| 1899 |
- stream opened without paFramesPerBufferUnspecified, it indicates that one or |
| 1900 |
- more zero samples have been inserted into the input buffer to compensate |
| 1901 |
- for an input underflow. |
| 1902 |
- @see PaStreamCallbackFlags |
| 1903 |
-*/ |
| 1904 |
-#define paInputUnderflow ((PaStreamCallbackFlags) 0x00000001) |
| 1905 |
- |
| 1906 |
-/** In a stream opened with paFramesPerBufferUnspecified, indicates that data |
| 1907 |
- prior to the first sample of the input buffer was discarded due to an |
| 1908 |
- overflow, possibly because the stream callback is using too much CPU time. |
| 1909 |
- Otherwise indicates that data prior to one or more samples in the |
| 1910 |
- input buffer was discarded. |
| 1911 |
- @see PaStreamCallbackFlags |
| 1912 |
-*/ |
| 1913 |
-#define paInputOverflow ((PaStreamCallbackFlags) 0x00000002) |
| 1914 |
- |
| 1915 |
-/** Indicates that output data (or a gap) was inserted, possibly because the |
| 1916 |
- stream callback is using too much CPU time. |
| 1917 |
- @see PaStreamCallbackFlags |
| 1918 |
-*/ |
| 1919 |
-#define paOutputUnderflow ((PaStreamCallbackFlags) 0x00000004) |
| 1920 |
- |
| 1921 |
-/** Indicates that output data will be discarded because no room is available. |
| 1922 |
- @see PaStreamCallbackFlags |
| 1923 |
-*/ |
| 1924 |
-#define paOutputOverflow ((PaStreamCallbackFlags) 0x00000008) |
| 1925 |
- |
| 1926 |
-/** Some of all of the output data will be used to prime the stream, input |
| 1927 |
- data may be zero. |
| 1928 |
- @see PaStreamCallbackFlags |
| 1929 |
-*/ |
| 1930 |
-#define paPrimingOutput ((PaStreamCallbackFlags) 0x00000010) |
| 1931 |
- |
| 1932 |
-/** |
| 1933 |
- Allowable return values for the PaStreamCallback. |
| 1934 |
- @see PaStreamCallback |
| 1935 |
-*/ |
| 1936 |
-typedef enum PaStreamCallbackResult |
| 1937 |
-{ |
| 1938 |
- paContinue=0, |
| 1939 |
- paComplete=1, |
| 1940 |
- paAbort=2 |
| 1941 |
-} PaStreamCallbackResult; |
| 1942 |
- |
| 1943 |
- |
| 1944 |
-/** |
| 1945 |
- Functions of type PaStreamCallback are implemented by PortAudio clients. |
| 1946 |
- They consume, process or generate audio in response to requests from an |
| 1947 |
- active PortAudio stream. |
| 1948 |
- |
| 1949 |
- @param input and @param output are arrays of interleaved samples, |
| 1950 |
- the format, packing and number of channels used by the buffers are |
| 1951 |
- determined by parameters to Pa_OpenStream(). |
| 1952 |
- |
| 1953 |
- @param frameCount The number of sample frames to be processed by |
| 1954 |
- the stream callback. |
| 1955 |
- |
| 1956 |
- @param timeInfo The time in seconds when the first sample of the input |
| 1957 |
- buffer was received at the audio input, the time in seconds when the first |
| 1958 |
- sample of the output buffer will begin being played at the audio output, and |
| 1959 |
- the time in seconds when the stream callback was called. |
| 1960 |
- See also Pa_GetStreamTime() |
| 1961 |
- |
| 1962 |
- @param statusFlags Flags indicating whether input and/or output buffers |
| 1963 |
- have been inserted or will be dropped to overcome underflow or overflow |
| 1964 |
- conditions. |
| 1965 |
- |
| 1966 |
- @param userData The value of a user supplied pointer passed to |
| 1967 |
- Pa_OpenStream() intended for storing synthesis data etc. |
| 1968 |
- |
| 1969 |
- @return |
| 1970 |
- The stream callback should return one of the values in the |
| 1971 |
- PaStreamCallbackResult enumeration. To ensure that the callback continues |
| 1972 |
- to be called, it should return paContinue (0). Either paComplete or paAbort |
| 1973 |
- can be returned to finish stream processing, after either of these values is |
| 1974 |
- returned the callback will not be called again. If paAbort is returned the |
| 1975 |
- stream will finish as soon as possible. If paComplete is returned, the stream |
| 1976 |
- will continue until all buffers generated by the callback have been played. |
| 1977 |
- This may be useful in applications such as soundfile players where a specific |
| 1978 |
- duration of output is required. However, it is not necessary to utilise this |
| 1979 |
- mechanism as Pa_StopStream(), Pa_AbortStream() or Pa_CloseStream() can also |
| 1980 |
- be used to stop the stream. The callback must always fill the entire output |
| 1981 |
- buffer irrespective of its return value. |
| 1982 |
- |
| 1983 |
- @see Pa_OpenStream, Pa_OpenDefaultStream |
| 1984 |
- |
| 1985 |
- @note With the exception of Pa_GetStreamCpuLoad() it is not permissable to call |
| 1986 |
- PortAudio API functions from within the stream callback. |
| 1987 |
-*/ |
| 1988 |
-typedef int PaStreamCallback( |
| 1989 |
- const void *input, void *output, |
| 1990 |
- unsigned long frameCount, |
| 1991 |
- const PaStreamCallbackTimeInfo* timeInfo, |
| 1992 |
- PaStreamCallbackFlags statusFlags, |
| 1993 |
- void *userData ); |
| 1994 |
- |
| 1995 |
- |
| 1996 |
-/** Opens a stream for either input, output or both. |
| 1997 |
- |
| 1998 |
- @param stream The address of a PaStream pointer which will receive |
| 1999 |
- a pointer to the newly opened stream. |
| 2000 |
- |
| 2001 |
- @param inputParameters A structure that describes the input parameters used by |
| 2002 |
- the opened stream. See PaStreamParameters for a description of these parameters. |
| 2003 |
- inputParameters must be NULL for output-only streams. |
| 2004 |
- |
| 2005 |
- @param outputParameters A structure that describes the output parameters used by |
| 2006 |
- the opened stream. See PaStreamParameters for a description of these parameters. |
| 2007 |
- outputParameters must be NULL for input-only streams. |
| 2008 |
- |
| 2009 |
- @param sampleRate The desired sampleRate. For full-duplex streams it is the |
| 2010 |
- sample rate for both input and output |
| 2011 |
- |
| 2012 |
- @param framesPerBuffer The number of frames passed to the stream callback |
| 2013 |
- function, or the preferred block granularity for a blocking read/write stream. |
| 2014 |
- The special value paFramesPerBufferUnspecified (0) may be used to request that |
| 2015 |
- the stream callback will recieve an optimal (and possibly varying) number of |
| 2016 |
- frames based on host requirements and the requested latency settings. |
| 2017 |
- Note: With some host APIs, the use of non-zero framesPerBuffer for a callback |
| 2018 |
- stream may introduce an additional layer of buffering which could introduce |
| 2019 |
- additional latency. PortAudio guarantees that the additional latency |
| 2020 |
- will be kept to the theoretical minimum however, it is strongly recommended |
| 2021 |
- that a non-zero framesPerBuffer value only be used when your algorithm |
| 2022 |
- requires a fixed number of frames per stream callback. |
| 2023 |
- |
| 2024 |
- @param streamFlags Flags which modify the behaviour of the streaming process. |
| 2025 |
- This parameter may contain a combination of flags ORed together. Some flags may |
| 2026 |
- only be relevant to certain buffer formats. |
| 2027 |
- |
| 2028 |
- @param streamCallback A pointer to a client supplied function that is responsible |
| 2029 |
- for processing and filling input and output buffers. If this parameter is NULL |
| 2030 |
- the stream will be opened in 'blocking read/write' mode. In blocking mode, |
| 2031 |
- the client can receive sample data using Pa_ReadStream and write sample data |
| 2032 |
- using Pa_WriteStream, the number of samples that may be read or written |
| 2033 |
- without blocking is returned by Pa_GetStreamReadAvailable and |
| 2034 |
- Pa_GetStreamWriteAvailable respectively. |
| 2035 |
- |
| 2036 |
- @param userData A client supplied pointer which is passed to the stream callback |
| 2037 |
- function. It could for example, contain a pointer to instance data necessary |
| 2038 |
- for processing the audio buffers. This parameter is ignored if streamCallback |
| 2039 |
- is NULL. |
| 2040 |
- |
| 2041 |
- @return |
| 2042 |
- Upon success Pa_OpenStream() returns paNoError and places a pointer to a |
| 2043 |
- valid PaStream in the stream argument. The stream is inactive (stopped). |
| 2044 |
- If a call to Pa_OpenStream() fails, a non-zero error code is returned (see |
| 2045 |
- PaError for possible error codes) and the value of stream is invalid. |
| 2046 |
- |
| 2047 |
- @see PaStreamParameters, PaStreamCallback, Pa_ReadStream, Pa_WriteStream, |
| 2048 |
- Pa_GetStreamReadAvailable, Pa_GetStreamWriteAvailable |
| 2049 |
-*/ |
| 2050 |
-PaError Pa_OpenStream( PaStream** stream, |
| 2051 |
- const PaStreamParameters *inputParameters, |
| 2052 |
- const PaStreamParameters *outputParameters, |
| 2053 |
- double sampleRate, |
| 2054 |
- unsigned long framesPerBuffer, |
| 2055 |
- PaStreamFlags streamFlags, |
| 2056 |
- PaStreamCallback *streamCallback, |
| 2057 |
- void *userData ); |
| 2058 |
- |
| 2059 |
- |
| 2060 |
-/** A simplified version of Pa_OpenStream() that opens the default input |
| 2061 |
- and/or output devices. |
| 2062 |
- |
| 2063 |
- @param stream The address of a PaStream pointer which will receive |
| 2064 |
- a pointer to the newly opened stream. |
| 2065 |
- |
| 2066 |
- @param numInputChannels The number of channels of sound that will be supplied |
| 2067 |
- to the stream callback or returned by Pa_ReadStream. It can range from 1 to |
| 2068 |
- the value of maxInputChannels in the PaDeviceInfo record for the default input |
| 2069 |
- device. If 0 the stream is opened as an output-only stream. |
| 2070 |
- |
| 2071 |
- @param numOutputChannels The number of channels of sound to be delivered to the |
| 2072 |
- stream callback or passed to Pa_WriteStream. It can range from 1 to the value |
| 2073 |
- of maxOutputChannels in the PaDeviceInfo record for the default output dvice. |
| 2074 |
- If 0 the stream is opened as an output-only stream. |
| 2075 |
- |
| 2076 |
- @param sampleFormat The sample format of both the input and output buffers |
| 2077 |
- provided to the callback or passed to and from Pa_ReadStream and Pa_WriteStream. |
| 2078 |
- sampleFormat may be any of the formats described by the PaSampleFormat |
| 2079 |
- enumeration. |
| 2080 |
- |
| 2081 |
- @param sampleRate Same as Pa_OpenStream parameter of the same name. |
| 2082 |
- @param framesPerBuffer Same as Pa_OpenStream parameter of the same name. |
| 2083 |
- @param streamCallback Same as Pa_OpenStream parameter of the same name. |
| 2084 |
- @param userData Same as Pa_OpenStream parameter of the same name. |
| 2085 |
- |
| 2086 |
- @return As for Pa_OpenStream |
| 2087 |
- |
| 2088 |
- @see Pa_OpenStream, PaStreamCallback |
| 2089 |
-*/ |
| 2090 |
-PaError Pa_OpenDefaultStream( PaStream** stream, |
| 2091 |
- int numInputChannels, |
| 2092 |
- int numOutputChannels, |
| 2093 |
- PaSampleFormat sampleFormat, |
| 2094 |
- double sampleRate, |
| 2095 |
- unsigned long framesPerBuffer, |
| 2096 |
- PaStreamCallback *streamCallback, |
| 2097 |
- void *userData ); |
| 2098 |
- |
| 2099 |
- |
| 2100 |
-/** Closes an audio stream. If the audio stream is active it |
| 2101 |
- discards any pending buffers as if Pa_AbortStream() had been called. |
| 2102 |
-*/ |
| 2103 |
-PaError Pa_CloseStream( PaStream *stream ); |
| 2104 |
- |
| 2105 |
- |
| 2106 |
-/** Functions of type PaStreamFinishedCallback are implemented by PortAudio |
| 2107 |
- clients. They can be registered with a stream using the Pa_SetStreamFinishedCallback |
| 2108 |
- function. Once registered they are called when the stream becomes inactive |
| 2109 |
- (ie once a call to Pa_StopStream() will not block). |
| 2110 |
- A stream will become inactive after the stream callback returns non-zero, |
| 2111 |
- or when Pa_StopStream or Pa_AbortStream is called. For a stream providing audio |
| 2112 |
- output, if the stream callback returns paComplete, or Pa_StopStream is called, |
| 2113 |
- the stream finished callback will not be called until all generated sample data |
| 2114 |
- has been played. |
| 2115 |
- |
| 2116 |
- @param userData The userData parameter supplied to Pa_OpenStream() |
| 2117 |
- |
| 2118 |
- @see Pa_SetStreamFinishedCallback |
| 2119 |
-*/ |
| 2120 |
-typedef void PaStreamFinishedCallback( void *userData ); |
| 2121 |
- |
| 2122 |
- |
| 2123 |
-/** Register a stream finished callback function which will be called when the |
| 2124 |
- stream becomes inactive. See the description of PaStreamFinishedCallback for |
| 2125 |
- further details about when the callback will be called. |
| 2126 |
- |
| 2127 |
- @param stream a pointer to a PaStream that is in the stopped state - if the |
| 2128 |
- stream is not stopped, the stream's finished callback will remain unchanged |
| 2129 |
- and an error code will be returned. |
| 2130 |
- |
| 2131 |
- @param streamFinishedCallback a pointer to a function with the same signature |
| 2132 |
- as PaStreamFinishedCallback, that will be called when the stream becomes |
| 2133 |
- inactive. Passing NULL for this parameter will un-register a previously |
| 2134 |
- registered stream finished callback function. |
| 2135 |
- |
| 2136 |
- @return on success returns paNoError, otherwise an error code indicating the cause |
| 2137 |
- of the error. |
| 2138 |
- |
| 2139 |
- @see PaStreamFinishedCallback |
| 2140 |
-*/ |
| 2141 |
-PaError Pa_SetStreamFinishedCallback( PaStream *stream, PaStreamFinishedCallback* streamFinishedCallback ); |
| 2142 |
- |
| 2143 |
- |
| 2144 |
-/** Commences audio processing. |
| 2145 |
-*/ |
| 2146 |
-PaError Pa_StartStream( PaStream *stream ); |
| 2147 |
- |
| 2148 |
- |
| 2149 |
-/** Terminates audio processing. It waits until all pending |
| 2150 |
- audio buffers have been played before it returns. |
| 2151 |
-*/ |
| 2152 |
-PaError Pa_StopStream( PaStream *stream ); |
| 2153 |
- |
| 2154 |
- |
| 2155 |
-/** Terminates audio processing immediately without waiting for pending |
| 2156 |
- buffers to complete. |
| 2157 |
-*/ |
| 2158 |
-PaError Pa_AbortStream( PaStream *stream ); |
| 2159 |
- |
| 2160 |
- |
| 2161 |
-/** Determine whether the stream is stopped. |
| 2162 |
- A stream is considered to be stopped prior to a successful call to |
| 2163 |
- Pa_StartStream and after a successful call to Pa_StopStream or Pa_AbortStream. |
| 2164 |
- If a stream callback returns a value other than paContinue the stream is NOT |
| 2165 |
- considered to be stopped. |
| 2166 |
- |
| 2167 |
- @return Returns one (1) when the stream is stopped, zero (0) when |
| 2168 |
- the stream is running or, a PaErrorCode (which are always negative) if |
| 2169 |
- PortAudio is not initialized or an error is encountered. |
| 2170 |
- |
| 2171 |
- @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive |
| 2172 |
-*/ |
| 2173 |
-PaError Pa_IsStreamStopped( PaStream *stream ); |
| 2174 |
- |
| 2175 |
- |
| 2176 |
-/** Determine whether the stream is active. |
| 2177 |
- A stream is active after a successful call to Pa_StartStream(), until it |
| 2178 |
- becomes inactive either as a result of a call to Pa_StopStream() or |
| 2179 |
- Pa_AbortStream(), or as a result of a return value other than paContinue from |
| 2180 |
- the stream callback. In the latter case, the stream is considered inactive |
| 2181 |
- after the last buffer has finished playing. |
| 2182 |
- |
| 2183 |
- @return Returns one (1) when the stream is active (ie playing or recording |
| 2184 |
- audio), zero (0) when not playing or, a PaErrorCode (which are always negative) |
| 2185 |
- if PortAudio is not initialized or an error is encountered. |
| 2186 |
- |
| 2187 |
- @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamStopped |
| 2188 |
-*/ |
| 2189 |
-PaError Pa_IsStreamActive( PaStream *stream ); |
| 2190 |
- |
| 2191 |
- |
| 2192 |
- |
| 2193 |
-/** A structure containing unchanging information about an open stream. |
| 2194 |
- @see Pa_GetStreamInfo |
| 2195 |
-*/ |
| 2196 |
- |
| 2197 |
-typedef struct PaStreamInfo |
| 2198 |
-{ |
| 2199 |
- /** this is struct version 1 */ |
| 2200 |
- int structVersion; |
| 2201 |
- |
| 2202 |
- /** The input latency of the stream in seconds. This value provides the most |
| 2203 |
- accurate estimate of input latency available to the implementation. It may |
| 2204 |
- differ significantly from the suggestedLatency value passed to Pa_OpenStream(). |
| 2205 |
- The value of this field will be zero (0.) for output-only streams. |
| 2206 |
- @see PaTime |
| 2207 |
- */ |
| 2208 |
- PaTime inputLatency; |
| 2209 |
- |
| 2210 |
- /** The output latency of the stream in seconds. This value provides the most |
| 2211 |
- accurate estimate of output latency available to the implementation. It may |
| 2212 |
- differ significantly from the suggestedLatency value passed to Pa_OpenStream(). |
| 2213 |
- The value of this field will be zero (0.) for input-only streams. |
| 2214 |
- @see PaTime |
| 2215 |
- */ |
| 2216 |
- PaTime outputLatency; |
| 2217 |
- |
| 2218 |
- /** The sample rate of the stream in Hertz (samples per second). In cases |
| 2219 |
- where the hardware sample rate is inaccurate and PortAudio is aware of it, |
| 2220 |
- the value of this field may be different from the sampleRate parameter |
| 2221 |
- passed to Pa_OpenStream(). If information about the actual hardware sample |
| 2222 |
- rate is not available, this field will have the same value as the sampleRate |
| 2223 |
- parameter passed to Pa_OpenStream(). |
| 2224 |
- */ |
| 2225 |
- double sampleRate; |
| 2226 |
- |
| 2227 |
-} PaStreamInfo; |
| 2228 |
- |
| 2229 |
- |
| 2230 |
-/** Retrieve a pointer to a PaStreamInfo structure containing information |
| 2231 |
- about the specified stream. |
| 2232 |
- @return A pointer to an immutable PaStreamInfo structure. If the stream |
| 2233 |
- parameter invalid, or an error is encountered, the function returns NULL. |
| 2234 |
- |
| 2235 |
- @param stream A pointer to an open stream previously created with Pa_OpenStream. |
| 2236 |
- |
| 2237 |
- @note PortAudio manages the memory referenced by the returned pointer, |
| 2238 |
- the client must not manipulate or free the memory. The pointer is only |
| 2239 |
- guaranteed to be valid until the specified stream is closed. |
| 2240 |
- |
| 2241 |
- @see PaStreamInfo |
| 2242 |
-*/ |
| 2243 |
-const PaStreamInfo* Pa_GetStreamInfo( PaStream *stream ); |
| 2244 |
- |
| 2245 |
- |
| 2246 |
-/** Determine the current time for the stream according to the same clock used |
| 2247 |
- to generate buffer timestamps. This time may be used for syncronising other |
| 2248 |
- events to the audio stream, for example synchronizing audio to MIDI. |
| 2249 |
- |
| 2250 |
- @return The stream's current time in seconds, or 0 if an error occurred. |
| 2251 |
- |
| 2252 |
- @see PaTime, PaStreamCallback |
| 2253 |
-*/ |
| 2254 |
-PaTime Pa_GetStreamTime( PaStream *stream ); |
| 2255 |
- |
| 2256 |
- |
| 2257 |
-/** Retrieve CPU usage information for the specified stream. |
| 2258 |
- The "CPU Load" is a fraction of total CPU time consumed by a callback stream's |
| 2259 |
- audio processing routines including, but not limited to the client supplied |
| 2260 |
- stream callback. This function does not work with blocking read/write streams. |
| 2261 |
- |
| 2262 |
- This function may be called from the stream callback function or the |
| 2263 |
- application. |
| 2264 |
- |
| 2265 |
- @return |
| 2266 |
- A floating point value, typically between 0.0 and 1.0, where 1.0 indicates |
| 2267 |
- that the stream callback is consuming the maximum number of CPU cycles possible |
| 2268 |
- to maintain real-time operation. A value of 0.5 would imply that PortAudio and |
| 2269 |
- the stream callback was consuming roughly 50% of the available CPU time. The |
| 2270 |
- return value may exceed 1.0. A value of 0.0 will always be returned for a |
| 2271 |
- blocking read/write stream, or if an error occurrs. |
| 2272 |
-*/ |
| 2273 |
-double Pa_GetStreamCpuLoad( PaStream* stream ); |
| 2274 |
- |
| 2275 |
- |
| 2276 |
-/** Read samples from an input stream. The function doesn't return until |
| 2277 |
- the entire buffer has been filled - this may involve waiting for the operating |
| 2278 |
- system to supply the data. |
| 2279 |
- |
| 2280 |
- @param stream A pointer to an open stream previously created with Pa_OpenStream. |
| 2281 |
- |
| 2282 |
- @param buffer A pointer to a buffer of sample frames. The buffer contains |
| 2283 |
- samples in the format specified by the inputParameters->sampleFormat field |
| 2284 |
- used to open the stream, and the number of channels specified by |
| 2285 |
- inputParameters->numChannels. If non-interleaved samples were requested, |
| 2286 |
- buffer is a pointer to the first element of an array of non-interleaved |
| 2287 |
- buffer pointers, one for each channel. |
| 2288 |
- |
| 2289 |
- @param frames The number of frames to be read into buffer. This parameter |
| 2290 |
- is not constrained to a specific range, however high performance applications |
| 2291 |
- will want to match this parameter to the framesPerBuffer parameter used |
| 2292 |
- when opening the stream. |
| 2293 |
- |
| 2294 |
- @return On success PaNoError will be returned, or PaInputOverflowed if input |
| 2295 |
- data was discarded by PortAudio after the previous call and before this call. |
| 2296 |
-*/ |
| 2297 |
-PaError Pa_ReadStream( PaStream* stream, |
| 2298 |
- void *buffer, |
| 2299 |
- unsigned long frames ); |
| 2300 |
- |
| 2301 |
- |
| 2302 |
-/** Write samples to an output stream. This function doesn't return until the |
| 2303 |
- entire buffer has been consumed - this may involve waiting for the operating |
| 2304 |
- system to consume the data. |
| 2305 |
- |
| 2306 |
- @param stream A pointer to an open stream previously created with Pa_OpenStream. |
| 2307 |
- |
| 2308 |
- @param buffer A pointer to a buffer of sample frames. The buffer contains |
| 2309 |
- samples in the format specified by the outputParameters->sampleFormat field |
| 2310 |
- used to open the stream, and the number of channels specified by |
| 2311 |
- outputParameters->numChannels. If non-interleaved samples were requested, |
| 2312 |
- buffer is a pointer to the first element of an array of non-interleaved |
| 2313 |
- buffer pointers, one for each channel. |
| 2314 |
- |
| 2315 |
- @param frames The number of frames to be written from buffer. This parameter |
| 2316 |
- is not constrained to a specific range, however high performance applications |
| 2317 |
- will want to match this parameter to the framesPerBuffer parameter used |
| 2318 |
- when opening the stream. |
| 2319 |
- |
| 2320 |
- @return On success PaNoError will be returned, or paOutputUnderflowed if |
| 2321 |
- additional output data was inserted after the previous call and before this |
| 2322 |
- call. |
| 2323 |
-*/ |
| 2324 |
-PaError Pa_WriteStream( PaStream* stream, |
| 2325 |
- const void *buffer, |
| 2326 |
- unsigned long frames ); |
| 2327 |
- |
| 2328 |
- |
| 2329 |
-/** Retrieve the number of frames that can be read from the stream without |
| 2330 |
- waiting. |
| 2331 |
- |
| 2332 |
- @return Returns a non-negative value representing the maximum number of frames |
| 2333 |
- that can be read from the stream without blocking or busy waiting or, a |
| 2334 |
- PaErrorCode (which are always negative) if PortAudio is not initialized or an |
| 2335 |
- error is encountered. |
| 2336 |
-*/ |
| 2337 |
-signed long Pa_GetStreamReadAvailable( PaStream* stream ); |
| 2338 |
- |
| 2339 |
- |
| 2340 |
-/** Retrieve the number of frames that can be written to the stream without |
| 2341 |
- waiting. |
| 2342 |
- |
| 2343 |
- @return Returns a non-negative value representing the maximum number of frames |
| 2344 |
- that can be written to the stream without blocking or busy waiting or, a |
| 2345 |
- PaErrorCode (which are always negative) if PortAudio is not initialized or an |
| 2346 |
- error is encountered. |
| 2347 |
-*/ |
| 2348 |
-signed long Pa_GetStreamWriteAvailable( PaStream* stream ); |
| 2349 |
- |
| 2350 |
- |
| 2351 |
-/* Miscellaneous utilities */ |
| 2352 |
- |
| 2353 |
- |
| 2354 |
-/** Retrieve the size of a given sample format in bytes. |
| 2355 |
- |
| 2356 |
- @return The size in bytes of a single sample in the specified format, |
| 2357 |
- or paSampleFormatNotSupported if the format is not supported. |
| 2358 |
-*/ |
| 2359 |
-PaError Pa_GetSampleSize( PaSampleFormat format ); |
| 2360 |
- |
| 2361 |
- |
| 2362 |
-/** Put the caller to sleep for at least 'msec' milliseconds. This function is |
| 2363 |
- provided only as a convenience for authors of portable code (such as the tests |
| 2364 |
- and examples in the PortAudio distribution.) |
| 2365 |
- |
| 2366 |
- The function may sleep longer than requested so don't rely on this for accurate |
| 2367 |
- musical timing. |
| 2368 |
-*/ |
| 2369 |
-void Pa_Sleep( long msec ); |
| 2370 |
- |
| 2371 |
- |
| 2372 |
- |
| 2373 |
-#ifdef __cplusplus |
| 2374 |
-} |
| 2375 |
-#endif /* __cplusplus */ |
| 2376 |
-#endif /* PORTAUDIO_H */ |
| 2377 |
diff -ruN src/output/portAudio.orig/portAudio.pro src/output/portAudio/portAudio.pro |
| 2378 |
--- src/output/portAudio.orig/portAudio.pro 2007-12-05 20:39:28.000000000 +0800 |
| 2379 |
+++ src/output/portAudio/portAudio.pro 2008-06-01 06:43:49.000000000 +0800 |
| 2380 |
@@ -26,20 +26,17 @@ |
| 2381 |
HEADERS = portAudioOutput.h |
| 2382 |
|
| 2383 |
|
| 2384 |
-unix:linux-g++ { |
| 2385 |
+unix:freebsd-g++ { |
| 2386 |
INCLUDEPATH += PortAudio/os/unix |
| 2387 |
|
| 2388 |
- DEFINES += PA_USE_ALSA \ |
| 2389 |
- PA_USEOSS |
| 2390 |
+ DEFINES += PA_USE_OSS |
| 2391 |
|
| 2392 |
- SOURCES += PortAudio/hostapi/alsa/pa_linux_alsa.c \ |
| 2393 |
- PortAudio/hostapi/oss/recplay.c \ |
| 2394 |
+ SOURCES += PortAudio/hostapi/oss/recplay.c \ |
| 2395 |
PortAudio/hostapi/oss/pa_unix_oss.c \ |
| 2396 |
PortAudio/os/unix/pa_unix_util.c \ |
| 2397 |
PortAudio/os/unix/pa_unix_hostapis.c |
| 2398 |
|
| 2399 |
- LIBS += -lasound \ |
| 2400 |
- -lrt \ |
| 2401 |
+ LIBS += -lrt \ |
| 2402 |
-lm |
| 2403 |
} |
| 2404 |
|
| 2405 |
diff -ruN src/output/portAudio.orig/portAudioOutput.cpp src/output/portAudio/portAudioOutput.cpp |
| 2406 |
--- src/output/portAudio.orig/portAudioOutput.cpp 2007-12-05 20:39:28.000000000 +0800 |
| 2407 |
+++ src/output/portAudio/portAudioOutput.cpp 2008-06-01 06:53:10.000000000 +0800 |
| 2408 |
@@ -143,7 +143,7 @@ |
| 2409 |
p.device = Pa_HostApiDeviceIndexToDeviceIndex( Pa_HostApiTypeIdToHostApiIndex( paCoreAudio ), deviceID++ ); |
| 2410 |
#endif |
| 2411 |
#ifdef Q_WS_X11 |
| 2412 |
- p.device = Pa_HostApiDeviceIndexToDeviceIndex( Pa_HostApiTypeIdToHostApiIndex( paALSA ), deviceID++ ); |
| 2413 |
+ p.device = Pa_HostApiDeviceIndexToDeviceIndex( Pa_HostApiTypeIdToHostApiIndex( paOSS ), deviceID++ ); |
| 2414 |
#endif |
| 2415 |
|
| 2416 |
p.suggestedLatency = Pa_GetDeviceInfo( p.device )->defaultHighOutputLatency; |
| 2417 |
@@ -176,7 +176,7 @@ |
| 2418 |
#endif |
| 2419 |
|
| 2420 |
#ifdef Q_WS_X11 |
| 2421 |
- << "Alsa" |
| 2422 |
+ << "OSS" |
| 2423 |
#endif |
| 2424 |
|
| 2425 |
#ifdef Q_WS_MAC |
| 2426 |
diff -ruN src/output/portAudio.orig/portAudioOutput.h src/output/portAudio/portAudioOutput.h |
| 2427 |
--- src/output/portAudio.orig/portAudioOutput.h 2007-12-05 20:39:28.000000000 +0800 |
| 2428 |
+++ src/output/portAudio/portAudioOutput.h 2008-06-01 06:43:49.000000000 +0800 |
| 2429 |
@@ -27,7 +27,7 @@ |
| 2430 |
#define PORT_AUDIO_OUTPUT_H |
| 2431 |
|
| 2432 |
#include "interfaces/OutputInterface.h" |
| 2433 |
-#include "portaudio.h" |
| 2434 |
+#include "pa_audio.h" |
| 2435 |
#include <QObject> |
| 2436 |
#include <QMutex> |
| 2437 |
|