Changeset 1368 for portaudio/branches

Show
Ignore:
Timestamp:
02/29/08 19:38:27 (9 months ago)
Author:
rossb
Message:

patch from magnus jonsson to print error instead of crash in tests when there is no default input (or output) device. changes to paqa_errs are related to ticket #61

Location:
portaudio/branches/v19-devel/test
Files:
31 modified

Legend:

Unmodified
Added
Removed
  • portaudio/branches/v19-devel/test/pa_fuzz.c

    r1097 r1368  
    132132    if( err != paNoError ) goto error; 
    133133 
    134  
    135134    inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */ 
     135    if (inputParameters.device == paNoDevice) { 
     136      fprintf(stderr,"Error: No default input device.\n"); 
     137      goto error; 
     138    } 
    136139    inputParameters.channelCount = 2;       /* stereo input */ 
    137140    inputParameters.sampleFormat = PA_SAMPLE_TYPE; 
     
    140143 
    141144    outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */ 
     145    if (outputParameters.device == paNoDevice) { 
     146      fprintf(stderr,"Error: No default output device.\n"); 
     147      goto error; 
     148    } 
    142149    outputParameters.channelCount = 2;       /* stereo output */ 
    143150    outputParameters.sampleFormat = PA_SAMPLE_TYPE; 
  • portaudio/branches/v19-devel/test/paqa_errs.c

    r1097 r1368  
    173173    PaQaData            myData; 
    174174    PaStreamParameters  ipp, opp; 
     175    const PaDeviceInfo* info = NULL; 
     176 
    175177     
    176178    /* Setup data for synthesis thread. */ 
     
    185187    ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
    186188    /* Take the low latency of the default device for all subsequent tests. */ 
    187     ipp.suggestedLatency          = Pa_GetDeviceInfo(Pa_GetDefaultInputDevice())->defaultLowInputLatency; 
    188     opp.suggestedLatency          = Pa_GetDeviceInfo(Pa_GetDefaultOutputDevice())->defaultLowOutputLatency; 
     189    info = Pa_GetDeviceInfo(Pa_GetDefaultInputDevice()); 
     190    ipp.suggestedLatency          = info ? info->defaultLowInputLatency : 0.100; 
     191    info = Pa_GetDeviceInfo(Pa_GetDefaultOutputDevice()); 
     192    opp.suggestedLatency          = info ? info->defaultLowOutputLatency : 0.100; 
    189193    HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, &opp, 
    190194                                     SAMPLE_RATE, FRAMES_PER_BUFFER, 
     
    214218                                     paClipOff, QaCallback, &myData )) == paInvalidDevice)); 
    215219 
    216     /*----------------------------- Zero input channels: */ 
    217     ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
    218     ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
    219     ipp.channelCount = 0;           ipp.device = Pa_GetDefaultInputDevice(); 
    220     opp.channelCount = 0;           opp.device = paNoDevice;    /* And no output device, and no output channels. */    
    221     HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, NULL, 
    222                                      SAMPLE_RATE, FRAMES_PER_BUFFER, 
    223                                      paClipOff, QaCallback, &myData )) == paInvalidChannelCount)); 
    224  
    225     /*----------------------------- Zero output channels: */ 
    226     ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
    227     ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
    228     ipp.channelCount = 0;           ipp.device = paNoDevice; /* And no input device, and no input channels. */ 
    229     opp.channelCount = 0;           opp.device = Pa_GetDefaultOutputDevice(); 
    230     HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp, 
    231                                      SAMPLE_RATE, FRAMES_PER_BUFFER, 
    232                                      paClipOff, QaCallback, &myData )) == paInvalidChannelCount)); 
    233  
     220    if (Pa_GetDefaultInputDevice() != paNoDevice) { 
     221        /*----------------------------- Zero input channels: */ 
     222        ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
     223        ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
     224        ipp.channelCount = 0;           ipp.device = Pa_GetDefaultInputDevice(); 
     225        opp.channelCount = 0;           opp.device = paNoDevice;    /* And no output device, and no output channels. */    
     226        HOPEFOR(((result = Pa_OpenStream(&stream, &ipp, NULL, 
     227                                         SAMPLE_RATE, FRAMES_PER_BUFFER, 
     228                                         paClipOff, QaCallback, &myData )) == paInvalidChannelCount)); 
     229    } 
     230 
     231    if (Pa_GetDefaultOutputDevice() != paNoDevice) { 
     232        /*----------------------------- Zero output channels: */ 
     233        ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
     234        ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
     235        ipp.channelCount = 0;           ipp.device = paNoDevice; /* And no input device, and no input channels. */ 
     236        opp.channelCount = 0;           opp.device = Pa_GetDefaultOutputDevice(); 
     237        HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp, 
     238                                         SAMPLE_RATE, FRAMES_PER_BUFFER, 
     239                                         paClipOff, QaCallback, &myData )) == paInvalidChannelCount)); 
     240    } 
    234241    /*----------------------------- Nonzero input and output channels but no output device: */ 
    235242    ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
     
    250257                                     paClipOff, QaCallback, &myData )) == paInvalidDevice)); 
    251258 
    252     /*----------------------------- NULL stream pointer: */ 
    253     ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
    254     ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
    255     ipp.channelCount = 0;           ipp.device = paNoDevice;           /* Output is more likely than input. */ 
    256     opp.channelCount = 2;           opp.device = Pa_GetDefaultOutputDevice();    /* Only 2 output channels. */ 
    257     HOPEFOR(((result = Pa_OpenStream(NULL, &ipp, &opp, 
    258                                      SAMPLE_RATE, FRAMES_PER_BUFFER, 
    259                                      paClipOff, QaCallback, &myData )) == paBadStreamPtr)); 
    260  
    261     /*----------------------------- Low sample rate: */ 
    262     ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
    263     ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
    264     ipp.channelCount = 0;           ipp.device = paNoDevice; 
    265     opp.channelCount = 2;           opp.device = Pa_GetDefaultOutputDevice(); 
    266     HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp, 
    267                                      1.0, FRAMES_PER_BUFFER, /* 1 cycle per second (1 Hz) is too low. */ 
    268                                      paClipOff, QaCallback, &myData )) == paInvalidSampleRate)); 
    269  
    270     /*----------------------------- High sample rate: */ 
    271     ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
    272     ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
    273     ipp.channelCount = 0;           ipp.device = paNoDevice; 
    274     opp.channelCount = 2;           opp.device = Pa_GetDefaultOutputDevice(); 
    275     HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp, 
    276                                      10000000.0, FRAMES_PER_BUFFER, /* 10^6 cycles per second (10 MHz) is too high. */ 
    277                                      paClipOff, QaCallback, &myData )) == paInvalidSampleRate)); 
    278  
    279     /*----------------------------- NULL callback: */ 
    280     /* NULL callback is valid in V19 -- it means use blocking read/write stream 
     259    if (Pa_GetDefaultOutputDevice() != paNoDevice) { 
     260        /*----------------------------- NULL stream pointer: */ 
     261        ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
     262        ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
     263        ipp.channelCount = 0;           ipp.device = paNoDevice;           /* Output is more likely than input. */ 
     264        opp.channelCount = 2;           opp.device = Pa_GetDefaultOutputDevice();    /* Only 2 output channels. */ 
     265        HOPEFOR(((result = Pa_OpenStream(NULL, &ipp, &opp, 
     266                                         SAMPLE_RATE, FRAMES_PER_BUFFER, 
     267                                         paClipOff, QaCallback, &myData )) == paBadStreamPtr)); 
     268 
     269        /*----------------------------- Low sample rate: */ 
     270        ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
     271        ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
     272        ipp.channelCount = 0;           ipp.device = paNoDevice; 
     273        opp.channelCount = 2;           opp.device = Pa_GetDefaultOutputDevice(); 
     274        HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp, 
     275                                         1.0, FRAMES_PER_BUFFER, /* 1 cycle per second (1 Hz) is too low. */ 
     276                                         paClipOff, QaCallback, &myData )) == paInvalidSampleRate)); 
     277         
     278        /*----------------------------- High sample rate: */ 
     279        ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
     280        ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
     281        ipp.channelCount = 0;           ipp.device = paNoDevice; 
     282        opp.channelCount = 2;           opp.device = Pa_GetDefaultOutputDevice(); 
     283        HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp, 
     284                                         10000000.0, FRAMES_PER_BUFFER, /* 10^6 cycles per second (10 MHz) is too high. */ 
     285                                         paClipOff, QaCallback, &myData )) == paInvalidSampleRate)); 
     286 
     287        /*----------------------------- NULL callback: */ 
     288        /* NULL callback is valid in V19 -- it means use blocking read/write stream 
    281289     
    282     ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
    283     ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
    284     ipp.channelCount = 0;           ipp.device = paNoDevice; 
    285     opp.channelCount = 2;           opp.device = Pa_GetDefaultOutputDevice(); 
    286     HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp, 
    287                                      SAMPLE_RATE, FRAMES_PER_BUFFER, 
    288                                      paClipOff, 
    289                                      NULL, 
    290                                      &myData )) == paNullCallback)); 
    291     */ 
    292  
    293     /*----------------------------- Bad flag: */ 
    294     ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
    295     ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
    296     ipp.channelCount = 0;           ipp.device = paNoDevice; 
    297     opp.channelCount = 2;           opp.device = Pa_GetDefaultOutputDevice(); 
    298     HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp, 
    299                                      SAMPLE_RATE, FRAMES_PER_BUFFER, 
    300                                      255,                      /* Is 8 maybe legal V19 API? */ 
    301                                      QaCallback, &myData )) == paInvalidFlag)); 
     290        ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
     291        ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
     292        ipp.channelCount = 0;           ipp.device = paNoDevice; 
     293        opp.channelCount = 2;           opp.device = Pa_GetDefaultOutputDevice(); 
     294        HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp, 
     295                                         SAMPLE_RATE, FRAMES_PER_BUFFER, 
     296                                         paClipOff, 
     297                                         NULL, 
     298                                         &myData )) == paNullCallback)); 
     299        */ 
     300 
     301        /*----------------------------- Bad flag: */ 
     302        ipp.hostApiSpecificStreamInfo = opp.hostApiSpecificStreamInfo = NULL; 
     303        ipp.sampleFormat              = opp.sampleFormat              = paFloat32; 
     304        ipp.channelCount = 0;           ipp.device = paNoDevice; 
     305        opp.channelCount = 2;           opp.device = Pa_GetDefaultOutputDevice(); 
     306        HOPEFOR(((result = Pa_OpenStream(&stream, NULL, &opp, 
     307                                         SAMPLE_RATE, FRAMES_PER_BUFFER, 
     308                                         255,                      /* Is 8 maybe legal V19 API? */ 
     309                                         QaCallback, &myData )) == paInvalidFlag)); 
     310    } 
    302311 
    303312    /*----------------------------- using input device as output device: */ 
     
    337346    PaQaData            myData; 
    338347    PaStreamParameters  opp; 
     348    const PaDeviceInfo* info = NULL; 
    339349 
    340350    /* Setup data for synthesis thread. */ 
     
    347357    opp.hostApiSpecificStreamInfo = NULL; 
    348358    opp.sampleFormat              = paFloat32; 
    349     opp.suggestedLatency          = Pa_GetDeviceInfo(opp.device)->defaultLowOutputLatency; 
    350  
    351     HOPEFOR(((result = Pa_OpenStream(&stream, NULL, /* Take NULL as input parame-     */ 
    352                                      &opp,          /* ters, meaning try only output. */ 
    353                                      SAMPLE_RATE, FRAMES_PER_BUFFER, 
    354                                      paClipOff, QaCallback, &myData )) == paNoError)); 
     359    info = Pa_GetDeviceInfo(opp.device); 
     360    opp.suggestedLatency          = info ? info->defaultLowOutputLatency : 0.100; 
     361 
     362    if (opp.device != paNoDevice) { 
     363        HOPEFOR(((result = Pa_OpenStream(&stream, NULL, /* Take NULL as input parame-     */ 
     364                                         &opp,          /* ters, meaning try only output. */ 
     365                                         SAMPLE_RATE, FRAMES_PER_BUFFER, 
     366                                         paClipOff, QaCallback, &myData )) == paNoError)); 
     367    } 
    355368 
    356369    HOPEFOR(((result = Pa_StartStream(NULL))    == paBadStreamPtr)); 
  • portaudio/branches/v19-devel/test/patest1.c

    r1097 r1368  
    126126 
    127127    inputParameters.device = Pa_GetDefaultInputDevice();    /* default input device */ 
     128    if (inputParameters.device == paNoDevice) { 
     129      fprintf(stderr,"Error: No input default device.\n"); 
     130      goto done; 
     131    } 
    128132    inputParameters.channelCount = 2;                       /* stereo input */ 
    129133    inputParameters.sampleFormat = paFloat32;               /* 32 bit floating point input */ 
     
    132136 
    133137    outputParameters.device = Pa_GetDefaultOutputDevice();  /* default output device */ 
     138    if (outputParameters.device == paNoDevice) { 
     139      fprintf(stderr,"Error: No default output device.\n"); 
     140      goto done; 
     141    } 
    134142    outputParameters.channelCount = 2;                      /* stereo output */ 
    135143    outputParameters.sampleFormat = paFloat32;              /* 32 bit floating point output */ 
  • portaudio/branches/v19-devel/test/patest_buffer.c

    r1097 r1368  
    168168    else 
    169169        outputParameters.device = device ; 
     170 
     171    if (outputParameters.device == paNoDevice) { 
     172      fprintf(stderr,"Error: No default output device.\n"); 
     173      goto error; 
     174    } 
     175 
    170176    outputParameters.channelCount = 2;                      /* stereo output */ 
    171177    outputParameters.sampleFormat = paInt16;                /* 32 bit floating point output */ 
  • portaudio/branches/v19-devel/test/patest_callbackstop.c

    r1294 r1368  
    149149 
    150150    outputParameters.device                    = Pa_GetDefaultOutputDevice(); 
     151    if (outputParameters.device == paNoDevice) { 
     152      fprintf(stderr,"Error: No default output device.\n"); 
     153      goto error; 
     154    } 
    151155    outputParameters.channelCount              = 2;               /* stereo output */ 
    152156    outputParameters.sampleFormat              = paFloat32;       /* 32 bit floating point output */ 
  • portaudio/branches/v19-devel/test/patest_clip.c

    r1097 r1368  
    155155 
    156156    outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */ 
     157    if (outputParameters.device == paNoDevice) { 
     158      fprintf(stderr,"Error: No default output device.\n"); 
     159      goto error; 
     160    } 
    157161    outputParameters.channelCount = 2;       /* stereo output */ 
    158162    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */ 
  • portaudio/branches/v19-devel/test/patest_dither.c

    r1097 r1368  
    113113 
    114114    outputParameters.device = Pa_GetDefaultOutputDevice();  /* default output device */ 
     115    if (outputParameters.device == paNoDevice) { 
     116      fprintf(stderr,"Error: No default output device.\n"); 
     117      goto done; 
     118    } 
    115119    outputParameters.channelCount = 2;                      /* stereo output */ 
    116120    outputParameters.hostApiSpecificStreamInfo = NULL; 
  • portaudio/branches/v19-devel/test/patest_hang.c

    r1097 r1368  
    115115 
    116116    outputParameters.device = Pa_GetDefaultOutputDevice(); /* Default output device. */ 
     117    if (outputParameters.device == paNoDevice) { 
     118      fprintf(stderr,"Error: No default output device.\n"); 
     119      goto error; 
     120    } 
    117121    outputParameters.channelCount = 1;                     /* Mono output. */ 
    118122    outputParameters.sampleFormat = paFloat32;             /* 32 bit floating point. */ 
  • portaudio/branches/v19-devel/test/patest_in_overflow.c

    r1097 r1368  
    141141 
    142142    inputParameters.device = Pa_GetDefaultInputDevice();  /* default input device */ 
     143    if (inputParameters.device == paNoDevice) { 
     144      fprintf(stderr,"Error: No default input device.\n"); 
     145      goto error; 
     146    } 
    143147    inputParameters.channelCount = 1;                      /* mono output */ 
    144148    inputParameters.sampleFormat = paFloat32;              /* 32 bit floating point output */ 
  • portaudio/branches/v19-devel/test/patest_latency.c

    r1097 r1368  
    136136 
    137137    outputParameters.device = OUTPUT_DEVICE; 
     138    if (outputParameters.device == paNoDevice) { 
     139      fprintf(stderr,"Error: No default output device.\n"); 
     140      goto error; 
     141    } 
    138142    outputParameters.channelCount = 2;         /* stereo output */ 
    139143    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */ 
  • portaudio/branches/v19-devel/test/patest_leftright.c

    r1097 r1368  
    140140 
    141141    outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */ 
     142    if (outputParameters.device == paNoDevice) { 
     143      fprintf(stderr,"Error: No default output device.\n"); 
     144      goto error; 
     145    } 
    142146    outputParameters.channelCount = 2;       /* stereo output */ 
    143147    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */ 
  • portaudio/branches/v19-devel/test/patest_longsine.c

    r1097 r1368  
    111111 
    112112    outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */ 
     113    if (outputParameters.device == paNoDevice) { 
     114      fprintf(stderr,"Error: No default output device.\n"); 
     115      goto error; 
     116    } 
    113117    outputParameters.channelCount = 2;                     /* stereo output */ 
    114118    outputParameters.sampleFormat = paFloat32;             /* 32 bit floating point output */ 
  • portaudio/branches/v19-devel/test/patest_many.c

    r1097 r1368  
    175175 
    176176    outputParameters.device = Pa_GetDefaultOutputDevice();  /* default output device */ 
     177    if (outputParameters.device == paNoDevice) { 
     178      fprintf(stderr,"Error: No default output device.\n"); 
     179      goto error; 
     180    } 
    177181    outputParameters.channelCount = 2;                      /* stereo output */ 
    178182    outputParameters.sampleFormat = paInt16; 
  • portaudio/branches/v19-devel/test/patest_maxsines.c

    r1097 r1368  
    162162        goto error; 
    163163    outputParameters.device                    = Pa_GetDefaultOutputDevice(); /* Default output device. */ 
     164    if (outputParameters.device == paNoDevice) { 
     165      fprintf(stderr,"Error: No default output device.\n"); 
     166      goto error; 
     167    } 
    164168    outputParameters.channelCount              = 2;                           /* Stereo output. */ 
    165169    outputParameters.sampleFormat              = paFloat32;                   /* 32 bit floating point output. */ 
  • portaudio/branches/v19-devel/test/patest_multi_sine.c

    r1097 r1368  
    125125 
    126126    outputParameters.device = Pa_GetDefaultOutputDevice();  /* Default output device, max channels. */ 
     127    if (outputParameters.device == paNoDevice) { 
     128      fprintf(stderr,"Error: No default output device.\n"); 
     129      return paInvalidDevice; 
     130    } 
    127131    pdi = Pa_GetDeviceInfo(outputParameters.device); 
    128132    outputParameters.channelCount = pdi->maxOutputChannels; 
  • portaudio/branches/v19-devel/test/patest_out_underflow.c

    r1097 r1368  
    134134     
    135135    outputParameters.device = Pa_GetDefaultOutputDevice();  /* default output device */ 
     136    if (outputParameters.device == paNoDevice) { 
     137      fprintf(stderr,"Error: No default output device.\n"); 
     138      goto error; 
     139    } 
    136140    outputParameters.channelCount = 1;                      /* mono output */ 
    137141    outputParameters.sampleFormat = paFloat32;              /* 32 bit floating point output */ 
  • portaudio/branches/v19-devel/test/patest_pink.c

    r1097 r1368  
    237237    /* Open a stereo PortAudio stream so we can hear the result. */ 
    238238    outputParameters.device = Pa_GetDefaultOutputDevice(); /* Take the default output device. */ 
     239    if (outputParameters.device == paNoDevice) { 
     240      fprintf(stderr,"Error: No default output device.\n"); 
     241      goto error; 
     242    } 
    239243    outputParameters.channelCount = 2;                     /* Stereo output, most likely supported. */ 
    240244    outputParameters.hostApiSpecificStreamInfo = NULL; 
  • portaudio/branches/v19-devel/test/patest_prime.c

    r1097 r1368  
    149149 
    150150    outputParameters.device = Pa_GetDefaultOutputDevice(); 
     151    if (outputParameters.device == paNoDevice) { 
     152      fprintf(stderr,"Error: No default output device.\n"); 
     153      goto error; 
     154    } 
    151155    outputParameters.channelCount = 2; 
    152156    outputParameters.hostApiSpecificStreamInfo = NULL; 
  • portaudio/branches/v19-devel/test/patest_read_record.c

    r1097 r1368  
    113113 
    114114    inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */ 
     115    if (inputParameters.device == paNoDevice) { 
     116      fprintf(stderr,"Error: No default input device.\n"); 
     117      goto error; 
     118    } 
    115119    inputParameters.channelCount = NUM_CHANNELS; 
    116120    inputParameters.sampleFormat = PA_SAMPLE_TYPE; 
     
    192196     
    193197    outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */ 
     198    if (outputParameters.device == paNoDevice) { 
     199      fprintf(stderr,"Error: No default output device.\n"); 
     200      goto error; 
     201    } 
    194202    outputParameters.channelCount = NUM_CHANNELS; 
    195203    outputParameters.sampleFormat =  PA_SAMPLE_TYPE; 
  • portaudio/branches/v19-devel/test/patest_record.c

    r1281 r1368  
    224224 
    225225    inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */ 
     226    if (inputParameters.device == paNoDevice) { 
     227        fprintf(stderr,"Error: No default input device.\n"); 
     228        goto done; 
     229    } 
    226230    inputParameters.channelCount = 2;                    /* stereo input */ 
    227231    inputParameters.sampleFormat = PA_SAMPLE_TYPE; 
     
    296300 
    297301    outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */ 
     302    if (outputParameters.device == paNoDevice) { 
     303        fprintf(stderr,"Error: No default output device.\n"); 
     304        goto done; 
     305    } 
    298306    outputParameters.channelCount = 2;                     /* stereo output */ 
    299307    outputParameters.sampleFormat =  PA_SAMPLE_TYPE; 
  • portaudio/branches/v19-devel/test/patest_sine.c

    r1294 r1368  
    128128 
    129129    outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */ 
     130    if (outputParameters.device == paNoDevice) { 
     131      fprintf(stderr,"Error: No default output device.\n"); 
     132      goto error; 
     133    } 
    130134    outputParameters.channelCount = 2;       /* stereo output */ 
    131135    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */ 
  • portaudio/branches/v19-devel/test/patest_sine8.c

    r1162 r1368  
    159159 
    160160    outputParameters.device = Pa_GetDefaultOutputDevice(); /* Default output device. */ 
     161    if (outputParameters.device == paNoDevice) { 
     162      fprintf(stderr,"Error: No default output device.\n"); 
     163      goto error; 
     164<