annotate src/portaudio/qa/paqa_errs.c @ 31:642a72ce5e62

Add Vamp SDK, move serd/sord to more obvious locations
author Chris Cannam
date Fri, 04 Jul 2014 08:16:02 +0100
parents e13257ea84a4
children
rev   line source
Chris@4 1 /** @file paqa_errs.c
Chris@4 2 @ingroup qa_src
Chris@4 3 @brief Self Testing Quality Assurance app for PortAudio
Chris@4 4 Do lots of bad things to test error reporting.
Chris@4 5 @author Phil Burk http://www.softsynth.com
Chris@4 6 Pieter Suurmond adapted to V19 API.
Chris@4 7 */
Chris@4 8 /*
Chris@4 9 * $Id: paqa_errs.c 1756 2011-09-08 06:09:29Z philburk $
Chris@4 10 *
Chris@4 11 * This program uses the PortAudio Portable Audio Library.
Chris@4 12 * For more information see: http://www.portaudio.com
Chris@4 13 * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
Chris@4 14 *
Chris@4 15 * Permission is hereby granted, free of charge, to any person obtaining
Chris@4 16 * a copy of this software and associated documentation files
Chris@4 17 * (the "Software"), to deal in the Software without restriction,
Chris@4 18 * including without limitation the rights to use, copy, modify, merge,
Chris@4 19 * publish, distribute, sublicense, and/or sell copies of the Software,
Chris@4 20 * and to permit persons to whom the Software is furnished to do so,
Chris@4 21 * subject to the following conditions:
Chris@4 22 *
Chris@4 23 * The above copyright notice and this permission notice shall be
Chris@4 24 * included in all copies or substantial portions of the Software.
Chris@4 25 *
Chris@4 26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Chris@4 27 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Chris@4 28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Chris@4 29 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
Chris@4 30 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
Chris@4 31 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
Chris@4 32 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Chris@4 33 */
Chris@4 34
Chris@4 35 /*
Chris@4 36 * The text above constitutes the entire PortAudio license; however,
Chris@4 37 * the PortAudio community also makes the following non-binding requests:
Chris@4 38 *
Chris@4 39 * Any person wishing to distribute modifications to the Software is
Chris@4 40 * requested to send the modifications to the original developer so that
Chris@4 41 * they can be incorporated into the canonical version. It is also
Chris@4 42 * requested that these non-binding requests be included along with the
Chris@4 43 * license above.
Chris@4 44 */
Chris@4 45
Chris@4 46 #include <stdio.h>
Chris@4 47 #include <math.h>
Chris@4 48
Chris@4 49 #include "portaudio.h"
Chris@4 50
Chris@4 51 /*--------- Definitions ---------*/
Chris@4 52 #define MODE_INPUT (0)
Chris@4 53 #define MODE_OUTPUT (1)
Chris@4 54 #define FRAMES_PER_BUFFER (64)
Chris@4 55 #define SAMPLE_RATE (44100.0)
Chris@4 56
Chris@4 57 typedef struct PaQaData
Chris@4 58 {
Chris@4 59 unsigned long framesLeft;
Chris@4 60 int numChannels;
Chris@4 61 int bytesPerSample;
Chris@4 62 int mode;
Chris@4 63 }
Chris@4 64 PaQaData;
Chris@4 65
Chris@4 66 static int gNumPassed = 0; /* Two globals */
Chris@4 67 static int gNumFailed = 0;
Chris@4 68
Chris@4 69 /*------------------- Macros ------------------------------*/
Chris@4 70 /* Print ERROR if it fails. Tally success or failure. Odd */
Chris@4 71 /* do-while wrapper seems to be needed for some compilers. */
Chris@4 72
Chris@4 73 #define EXPECT(_exp) \
Chris@4 74 do \
Chris@4 75 { \
Chris@4 76 if ((_exp)) {\
Chris@4 77 gNumPassed++; \
Chris@4 78 } \
Chris@4 79 else { \
Chris@4 80 printf("\nERROR - 0x%x - %s for %s\n", result, Pa_GetErrorText(result), #_exp ); \
Chris@4 81 gNumFailed++; \
Chris@4 82 goto error; \
Chris@4 83 } \
Chris@4 84 } while(0)
Chris@4 85
Chris@4 86 #define HOPEFOR(_exp) \
Chris@4 87 do \
Chris@4 88 { \
Chris@4 89 if ((_exp)) {\
Chris@4 90 gNumPassed++; \
Chris@4 91 } \
Chris@4 92 else { \
Chris@4 93 printf("\nERROR - 0x%x - %s for %s\n", result, Pa_GetErrorText(result), #_exp ); \
Chris@4 94 gNumFailed++; \
Chris@4 95 } \
Chris@4 96 } while(0)
Chris@4 97
Chris@4 98 /*-------------------------------------------------------------------------*/
Chris@4 99 /* This routine will be called by the PortAudio engine when audio is needed.
Chris@4 100 It may be called at interrupt level on some machines so don't do anything
Chris@4 101 that could mess up the system like calling malloc() or free().
Chris@4 102 */
Chris@4 103 static int QaCallback( const void* inputBuffer,
Chris@4 104 void* outputBuffer,
Chris@4 105 unsigned long framesPerBuffer,
Chris@4 106 const PaStreamCallbackTimeInfo* timeInfo,
Chris@4 107 PaStreamCallbackFlags statusFlags,
Chris@4 108 void* userData )
Chris@4 109 {
Chris@4 110 unsigned long i;
Chris@4 111 unsigned char* out = (unsigned char *) outputBuffer;
Chris@4 112 PaQaData* data = (PaQaData *) userData;
Chris@4 113
Chris@4 114 (void)inputBuffer; /* Prevent "unused variable" warnings. */
Chris@4 115
Chris@4 116 /* Zero out buffer so we don't hear terrible noise. */
Chris@4 117 if( data->mode == MODE_OUTPUT )
Chris@4 118 {
Chris@4 119 unsigned long numBytes = framesPerBuffer * data->numChannels * data->bytesPerSample;
Chris@4 120 for( i=0; i<numBytes; i++ )
Chris@4 121 {
Chris@4 122 *out++ = 0;
Chris@4 123 }
Chris@4 124 }
Chris@4 125 /* Are we through yet? */
Chris@4 126 if( data->framesLeft > framesPerBuffer )
Chris@4 127 {
Chris@4 128 data->framesLeft -= framesPerBuffer;
Chris@4 129 return 0;
Chris@4 130 }
Chris@4 131 else
Chris@4 132 {
Chris@4 133 data->framesLeft = 0;
Chris@4 134 return 1;
Chris@4 135 }
Chris@4 136 }
Chris@4 137
Chris@4 138 static PaDeviceIndex FindInputOnlyDevice(void)
Chris@4 139 {
Chris@4 140 PaDeviceIndex result = Pa_GetDefaultInputDevice();
Chris@4 141 if( result != paNoDevice && Pa_GetDeviceInfo(result)->maxOutputChannels == 0 )
Chris@4 142 return result;
Chris@4 143
Chris@4 144 for( result = 0; result < Pa_GetDeviceCount(); ++result )
Chris@4 145 {
Chris@4 146 if( Pa_GetDeviceInfo(result)->maxOutputChannels == 0 )
Chris@4 147 return result;
Chris@4 148 }
Chris@4 149
Chris@4 150 return paNoDevice;
Chris@4 151 }
Chris@4 152
Chris@4 153 static PaDeviceIndex FindOutputOnlyDevice(void)
Chris@4 154 {
Chris@4 155 PaDeviceIndex result = Pa_GetDefaultOutputDevice();
Chris@4 156 if( result != paNoDevice && Pa_GetDeviceInfo(result)->maxInputChannels == 0 )
Chris@4 157 return result;
Chris@4 158
Chris@4 159 for( result = 0; result < Pa_GetDeviceCount(); ++result )
Chris@4 160 {
Chris@4 161 if( Pa_GetDeviceInfo(result)->maxInputChannels == 0 )
Chris@4 162 return result;
Chris@4 163 }
Chris@4 164
Chris@4 165 return paNoDevice;
Chris@4 166 }
Chris@4 167
Chris@4 168 /*-------------------------------------------------------------------------------------------------*/
Chris@4 169 static int TestBadOpens( void )
Chris@4 170 {
Chris@4 171 PaStream* stream = NULL;
Chris@4 172 PaError result;
Chris@4 173 PaQaData myData;
Chris@4 174 PaStreamParameters ipp, opp;
Chris@4 175 const PaDeviceInfo* info = NULL;
Chris@4 176
Chris@4 177
Chris@4 178 /* Setup data for synthesis thread. */
Chris@4 179 myData.framesLeft = (unsigned long) (SAMPLE_RATE * 100); /* 100 seconds */
Chris@4 180 myData.numChannels = 1;
Chris@4 181 myData.mode = MODE_OUTPUT;
Chris@4 182
Chris@4 183 /*----------------------------- No devices specified: */
Chris@4 184 ipp.device = opp.device = paNoDevice;
Chris@4 185 ipp.channelCount = opp.channelCount = 0; /* Also no channels. */
Chris@4 186 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 187 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 188 /* Take the low latency of the default device for all subsequent tests. */
Chris@4 189 info = Pa_GetDeviceInfo(Pa_GetDefaultInputDevice());
Chris@4 190 ipp.suggestedLatency = info ? info->defaultLowInputLatency : 0.100;
Chris@4 191 info = Pa_GetDeviceInfo(Pa_GetDefaultOutputDevice());
Chris@4 192 opp.suggestedLatency = info ? info->defaultLowOutputLatency : 0.100;
Chris@4 193 HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, &opp,
Chris@4 194 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 195 paClipOff, QaCallback, &myData )) == paInvalidDevice));
Chris@4 196
Chris@4 197 /*----------------------------- No devices specified #2: */
Chris@4 198 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, NULL,
Chris@4 199 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 200 paClipOff, QaCallback, &myData )) == paInvalidDevice));
Chris@4 201
Chris@4 202 /*----------------------------- Out of range input device specified: */
Chris@4 203 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 204 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 205 ipp.channelCount = 0; ipp.device = Pa_GetDeviceCount(); /* And no output device, and no channels. */
Chris@4 206 opp.channelCount = 0; opp.device = paNoDevice;
Chris@4 207 HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, NULL,
Chris@4 208 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 209 paClipOff, QaCallback, &myData )) == paInvalidDevice));
Chris@4 210
Chris@4 211 /*----------------------------- Out of range output device specified: */
Chris@4 212 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 213 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 214 ipp.channelCount = 0; ipp.device = paNoDevice; /* And no input device, and no channels. */
Chris@4 215 opp.channelCount = 0; opp.device = Pa_GetDeviceCount();
Chris@4 216 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@4 217 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 218 paClipOff, QaCallback, &myData )) == paInvalidDevice));
Chris@4 219
Chris@4 220 if (Pa_GetDefaultInputDevice() != paNoDevice) {
Chris@4 221 /*----------------------------- Zero input channels: */
Chris@4 222 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 223 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 224 ipp.channelCount = 0; ipp.device = Pa_GetDefaultInputDevice();
Chris@4 225 opp.channelCount = 0; opp.device = paNoDevice; /* And no output device, and no output channels. */
Chris@4 226 HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, NULL,
Chris@4 227 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 228 paClipOff, QaCallback, &myData )) == paInvalidChannelCount));
Chris@4 229 }
Chris@4 230
Chris@4 231 if (Pa_GetDefaultOutputDevice() != paNoDevice) {
Chris@4 232 /*----------------------------- Zero output channels: */
Chris@4 233 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 234 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 235 ipp.channelCount = 0; ipp.device = paNoDevice; /* And no input device, and no input channels. */
Chris@4 236 opp.channelCount = 0; opp.device = Pa_GetDefaultOutputDevice();
Chris@4 237 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@4 238 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 239 paClipOff, QaCallback, &myData )) == paInvalidChannelCount));
Chris@4 240 }
Chris@4 241 /*----------------------------- Nonzero input and output channels but no output device: */
Chris@4 242 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 243 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 244 ipp.channelCount = 2; ipp.device = Pa_GetDefaultInputDevice(); /* Both stereo. */
Chris@4 245 opp.channelCount = 2; opp.device = paNoDevice;
Chris@4 246 HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, &opp,
Chris@4 247 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 248 paClipOff, QaCallback, &myData )) == paInvalidDevice));
Chris@4 249
Chris@4 250 /*----------------------------- Nonzero input and output channels but no input device: */
Chris@4 251 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 252 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 253 ipp.channelCount = 2; ipp.device = paNoDevice;
Chris@4 254 opp.channelCount = 2; opp.device = Pa_GetDefaultOutputDevice();
Chris@4 255 HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, &opp,
Chris@4 256 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 257 paClipOff, QaCallback, &myData )) == paInvalidDevice));
Chris@4 258
Chris@4 259 if (Pa_GetDefaultOutputDevice() != paNoDevice) {
Chris@4 260 /*----------------------------- NULL stream pointer: */
Chris@4 261 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 262 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 263 ipp.channelCount = 0; ipp.device = paNoDevice; /* Output is more likely than input. */
Chris@4 264 opp.channelCount = 2; opp.device = Pa_GetDefaultOutputDevice(); /* Only 2 output channels. */
Chris@4 265 HOPEFOR(((result = Pa_OpenStream(NULL, &ipp, &opp,
Chris@4 266 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 267 paClipOff, QaCallback, &myData )) == paBadStreamPtr));
Chris@4 268
Chris@4 269 /*----------------------------- Low sample rate: */
Chris@4 270 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 271 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 272 ipp.channelCount = 0; ipp.device = paNoDevice;
Chris@4 273 opp.channelCount = 2; opp.device = Pa_GetDefaultOutputDevice();
Chris@4 274 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@4 275 1.0, FRAMES_PER_BUFFER, /* 1 cycle per second (1 Hz) is too low. */
Chris@4 276 paClipOff, QaCallback, &myData )) == paInvalidSampleRate));
Chris@4 277
Chris@4 278 /*----------------------------- High sample rate: */
Chris@4 279 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 280 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 281 ipp.channelCount = 0; ipp.device = paNoDevice;
Chris@4 282 opp.channelCount = 2; opp.device = Pa_GetDefaultOutputDevice();
Chris@4 283 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@4 284 10000000.0, FRAMES_PER_BUFFER, /* 10^6 cycles per second (10 MHz) is too high. */
Chris@4 285 paClipOff, QaCallback, &myData )) == paInvalidSampleRate));
Chris@4 286
Chris@4 287 /*----------------------------- NULL callback: */
Chris@4 288 /* NULL callback is valid in V19 -- it means use blocking read/write stream
Chris@4 289
Chris@4 290 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 291 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 292 ipp.channelCount = 0; ipp.device = paNoDevice;
Chris@4 293 opp.channelCount = 2; opp.device = Pa_GetDefaultOutputDevice();
Chris@4 294 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@4 295 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 296 paClipOff,
Chris@4 297 NULL,
Chris@4 298 &myData )) == paNullCallback));
Chris@4 299 */
Chris@4 300
Chris@4 301 /*----------------------------- Bad flag: */
Chris@4 302 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 303 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 304 ipp.channelCount = 0; ipp.device = paNoDevice;
Chris@4 305 opp.channelCount = 2; opp.device = Pa_GetDefaultOutputDevice();
Chris@4 306 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@4 307 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 308 255, /* Is 8 maybe legal V19 API? */
Chris@4 309 QaCallback, &myData )) == paInvalidFlag));
Chris@4 310 }
Chris@4 311
Chris@4 312 /*----------------------------- using input device as output device: */
Chris@4 313 if( FindInputOnlyDevice() != paNoDevice )
Chris@4 314 {
Chris@4 315 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 316 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 317 ipp.channelCount = 0; ipp.device = paNoDevice; /* And no input device, and no channels. */
Chris@4 318 opp.channelCount = 2; opp.device = FindInputOnlyDevice();
Chris@4 319 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp,
Chris@4 320 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 321 paClipOff, QaCallback, &myData )) == paInvalidChannelCount));
Chris@4 322 }
Chris@4 323
Chris@4 324 /*----------------------------- using output device as input device: */
Chris@4 325 if( FindOutputOnlyDevice() != paNoDevice )
Chris@4 326 {
Chris@4 327 ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL;
Chris@4 328 ipp.sampleFormat = opp.sampleFormat = paFloat32;
Chris@4 329 ipp.channelCount = 2; ipp.device = FindOutputOnlyDevice();
Chris@4 330 opp.channelCount = 0; opp.device = paNoDevice; /* And no output device, and no channels. */
Chris@4 331 HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, NULL,
Chris@4 332 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 333 paClipOff, QaCallback, &myData )) == paInvalidChannelCount));
Chris@4 334
Chris@4 335 }
Chris@4 336
Chris@4 337 if( stream != NULL ) Pa_CloseStream( stream );
Chris@4 338 return result;
Chris@4 339 }
Chris@4 340
Chris@4 341 /*-----------------------------------------------------------------------------------------*/
Chris@4 342 static int TestBadActions( void )
Chris@4 343 {
Chris@4 344 PaStream* stream = NULL;
Chris@4 345 const PaDeviceInfo* deviceInfo = NULL;
Chris@4 346 PaError result = 0;
Chris@4 347 PaQaData myData;
Chris@4 348 PaStreamParameters opp;
Chris@4 349 const PaDeviceInfo* info = NULL;
Chris@4 350
Chris@4 351 /* Setup data for synthesis thread. */
Chris@4 352 myData.framesLeft = (unsigned long)(SAMPLE_RATE * 100); /* 100 seconds */
Chris@4 353 myData.numChannels = 1;
Chris@4 354 myData.mode = MODE_OUTPUT;
Chris@4 355
Chris@4 356 opp.device = Pa_GetDefaultOutputDevice(); /* Default output. */
Chris@4 357 opp.channelCount = 2; /* Stereo output. */
Chris@4 358 opp.hostApiSpecificStreamInfo = NULL;
Chris@4 359 opp.sampleFormat = paFloat32;
Chris@4 360 info = Pa_GetDeviceInfo(opp.device);
Chris@4 361 opp.suggestedLatency = info ? info->defaultLowOutputLatency : 0.100;
Chris@4 362
Chris@4 363 if (opp.device != paNoDevice) {
Chris@4 364 HOPEFOR(((result = Pa_OpenStream(&stream, NULL, /* Take NULL as input parame- */
Chris@4 365 &opp, /* ters, meaning try only output. */
Chris@4 366 SAMPLE_RATE, FRAMES_PER_BUFFER,
Chris@4 367 paClipOff, QaCallback, &myData )) == paNoError));
Chris@4 368 }
Chris@4 369
Chris@4 370 HOPEFOR(((deviceInfo = Pa_GetDeviceInfo(paNoDevice)) == NULL));
Chris@4 371 HOPEFOR(((deviceInfo = Pa_GetDeviceInfo(87654)) == NULL));
Chris@4 372 HOPEFOR(((result = Pa_StartStream(NULL)) == paBadStreamPtr));
Chris@4 373 HOPEFOR(((result = Pa_StopStream(NULL)) == paBadStreamPtr));
Chris@4 374 HOPEFOR(((result = Pa_IsStreamStopped(NULL)) == paBadStreamPtr));
Chris@4 375 HOPEFOR(((result = Pa_IsStreamActive(NULL)) == paBadStreamPtr));
Chris@4 376 HOPEFOR(((result = Pa_CloseStream(NULL)) == paBadStreamPtr));
Chris@4 377 HOPEFOR(((result = Pa_SetStreamFinishedCallback(NULL, NULL)) == paBadStreamPtr));
Chris@4 378 HOPEFOR(((result = !Pa_GetStreamInfo(NULL))));
Chris@4 379 HOPEFOR(((result = Pa_GetStreamTime(NULL)) == 0.0));
Chris@4 380 HOPEFOR(((result = Pa_GetStreamCpuLoad(NULL)) == 0.0));
Chris@4 381 HOPEFOR(((result = Pa_ReadStream(NULL, NULL, 0)) == paBadStreamPtr));
Chris@4 382 HOPEFOR(((result = Pa_WriteStream(NULL, NULL, 0)) == paBadStreamPtr));
Chris@4 383
Chris@4 384 /** @todo test Pa_GetStreamReadAvailable and Pa_GetStreamWriteAvailable */
Chris@4 385
Chris@4 386 if (stream != NULL) Pa_CloseStream(stream);
Chris@4 387 return result;
Chris@4 388 }
Chris@4 389
Chris@4 390 /*---------------------------------------------------------------------*/
Chris@4 391 int main(void);
Chris@4 392 int main(void)
Chris@4 393 {
Chris@4 394 PaError result;
Chris@4 395
Chris@4 396 EXPECT(((result = Pa_Initialize()) == paNoError));
Chris@4 397 TestBadOpens();
Chris@4 398 TestBadActions();
Chris@4 399 error:
Chris@4 400 Pa_Terminate();
Chris@4 401 printf("QA Report: %d passed, %d failed.\n", gNumPassed, gNumFailed);
Chris@4 402 return 0;
Chris@4 403 }