title: Port Audio:How to solve the error of finding default devices in PortAudio(Windows)?
body: <p>I want to run a PortAudio test program of generating and playing a Sine Wave. For that I have included all required header files. Infact the program compiles well but when I run it shows that "No Default Device found" in console.
  So, anybody can give me its solution.</p>
  
  <p>OS:Windows 8.1</p>
  
  <p>Coding Language:C</p>
  
  <p>Below is the program:-</p>
  
  <pre><code>typedef struct
  {
      float sine[TABLE_SIZE];
      int left_phase;
      int right_phase;
      char message[20];
  }
  paTestData;
  
  static int patestCallback(...)//Callback Function
  {....
  }
  
  static void StreamFinished( void* userData )
  {
      paTestData *data = (paTestData *) userData;
      printf( "Stream Completed: %s\n", data-&gt;message );
  }
  
  
  int main(void)//main function
  {
      PaStreamParameters outputParameters;
      PaStream *stream;
      PaError err;
      paTestData data;
  
      int i;
  
      printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n",       SAMPLE_RATE, FRAMES_PER_BUFFER);
  
      /* initialise sinusoidal wavetable */
  
      for( i=0; i&lt;TABLE_SIZE; i++ )
      {
          data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
      }
  
      data.left_phase = data.right_phase = 0;
  
      err = Pa_Initialize();
  
      if( err != paNoError )
      {
          printf("Error in Initialize:-",err);
          goto error;
      }
  
      outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output     device */
  
      if (outputParameters.device == paNoDevice)
      {
          fprintf(stderr,"Error: No default output device.\n");
          goto error;
      }
  
      outputParameters.channelCount = 2;       /* stereo output */
      outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
      outputParameters.suggestedLatency = Pa_GetDeviceInfo(      outputParameters.device )-&gt;defaultLowOutputLatency;
      outputParameters.hostApiSpecificStreamInfo = NULL;
  
      err = Pa_OpenStream
      (
         &amp;stream,
         NULL, /* no input */
         &amp;outputParameters,
         SAMPLE_RATE,
         FRAMES_PER_BUFFER,
         paClipOff,      /* we won't output out of range samples so don't bother clipping them */
         patestCallback,
         &amp;data
      );
  
      if( err != paNoError )
          goto error;
  
      sprintf( data.message, "No Message" );
      err = Pa_SetStreamFinishedCallback( stream, &amp;StreamFinished );
  
      if( err != paNoError )
          goto error;
  
      err = Pa_StartStream( stream );
  
      if( err != paNoError )
          goto error;
  
      printf("Play for %d seconds.\n", NUM_SECONDS );
      Pa_Sleep( NUM_SECONDS * 1000 );
  
      err = Pa_StopStream( stream );
  
      if( err != paNoError )
          goto error;
  
      err = Pa_CloseStream( stream );
  
      if( err != paNoError )
          goto error;
  
      Pa_Terminate();
      printf("Test finished.\n");
  
      return err;
  
      error:
          Pa_Terminate();
  
      fprintf( stderr, "An error occured while using the portaudio stream\n" );
      fprintf( stderr, "Error number: %d\n", err );
      fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
  
      return err;
  }
  </code></pre>
  
  <p>And after compiling and Running I get the following output in the console:-</p>
  
  <pre><code>PortAudio Test: output sine wave. SR = 44100, BufSize = 64
  Error: No default output device.
  An error occured while using the portaudio stream
  Error number: 0
  Error message: Success
  
  Process returned 0 (0x0)   execution time : 0.016 s
  Press any key to continue.
  </code></pre>
  
  <p>Can anybody figure out the problem.</p>