]> Repos - portaudio/commitdiff
Clean up whitespace in examples/ in preparation for .editorconfig. Convert tabs to...
authorRoss Bencina <rossb@audiomulch.com>
Thu, 21 Jan 2021 11:23:23 +0000 (22:23 +1100)
committerGitHub <noreply@github.com>
Thu, 21 Jan 2021 11:23:23 +0000 (22:23 +1100)
15 files changed:
examples/pa_devs.c
examples/pa_fuzz.c
examples/paex_mono_asio_channel_select.c
examples/paex_ocean_shore.c
examples/paex_pink.c
examples/paex_read_write_wire.c
examples/paex_record.c
examples/paex_record_file.c
examples/paex_saw.c
examples/paex_sine.c
examples/paex_sine_c++.cpp
examples/paex_wmme_ac3.c
examples/paex_wmme_surround.c
examples/paex_write_sine.c
examples/paex_write_sine_nonint.c

index 595a05dbe7a94dfe0a1c2238e8959c4208fd29d7..27acfd53b24ade7ec95545617f9975db0758a911 100644 (file)
@@ -1,7 +1,7 @@
 /** @file pa_devs.c
-       @ingroup examples_src
+    @ingroup examples_src
     @brief List available devices, including device information.
-       @author Phil Burk http://www.softsynth.com
+    @author Phil Burk http://www.softsynth.com
 
     @note Define PA_USE_ASIO=0 to compile this code on Windows without
         ASIO support.
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -106,14 +106,14 @@ int main(void)
     PaStreamParameters inputParameters, outputParameters;
     PaError err;
 
-    
+
     err = Pa_Initialize();
     if( err != paNoError )
     {
         printf( "ERROR: Pa_Initialize returned 0x%x\n", err );
         goto error;
     }
-    
+
     printf( "PortAudio version: 0x%08X\n", Pa_GetVersion());
     printf( "Version text: '%s'\n", Pa_GetVersionInfo()->versionText );
 
@@ -124,13 +124,13 @@ int main(void)
         err = numDevices;
         goto error;
     }
-    
+
     printf( "Number of devices = %d\n", numDevices );
     for( i=0; i<numDevices; i++ )
     {
         deviceInfo = Pa_GetDeviceInfo( i );
         printf( "--------------------------------------- device #%d\n", i );
-                
+
     /* Mark global and API specific default devices */
         defaultDisplayed = 0;
         if( i == Pa_GetDefaultInputDevice() )
@@ -144,7 +144,7 @@ int main(void)
             printf( "[ Default %s Input", hostInfo->name );
             defaultDisplayed = 1;
         }
-        
+
         if( i == Pa_GetDefaultOutputDevice() )
         {
             printf( (defaultDisplayed ? "," : "[") );
@@ -154,7 +154,7 @@ int main(void)
         else if( i == Pa_GetHostApiInfo( deviceInfo->hostApi )->defaultOutputDevice )
         {
             const PaHostApiInfo *hostInfo = Pa_GetHostApiInfo( deviceInfo->hostApi );
-            printf( (defaultDisplayed ? "," : "[") );                
+            printf( (defaultDisplayed ? "," : "[") );
             printf( " Default %s Output", hostInfo->name );
             defaultDisplayed = 1;
         }
@@ -188,7 +188,7 @@ int main(void)
             long minLatency, maxLatency, preferredLatency, granularity;
 
             err = PaAsio_GetAvailableLatencyValues( i,
-                           &minLatency, &maxLatency, &preferredLatency, &granularity );
+                    &minLatency, &maxLatency, &preferredLatency, &granularity );
 
             printf( "ASIO minimum buffer size    = %ld\n", minLatency  );
             printf( "ASIO maximum buffer size    = %ld\n", maxLatency  );
@@ -210,7 +210,7 @@ int main(void)
         inputParameters.sampleFormat = paInt16;
         inputParameters.suggestedLatency = 0; /* ignored by Pa_IsFormatSupported() */
         inputParameters.hostApiSpecificStreamInfo = NULL;
-        
+
         outputParameters.device = i;
         outputParameters.channelCount = deviceInfo->maxOutputChannels;
         outputParameters.sampleFormat = paInt16;
index 337e06d01d72a9aaeefce47f4141d73934f6146e..0c24d35b7d0e71924617186b40b6313f7f991276 100644 (file)
@@ -1,7 +1,7 @@
 /** @file pa_fuzz.c
-       @ingroup examples_src
+    @ingroup examples_src
     @brief Distort input like a fuzz box.
-       @author Phil Burk  http://www.softsynth.com
+    @author Phil Burk  http://www.softsynth.com
 */
 /*
  * $Id$
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -116,7 +116,7 @@ static int fuzzCallback( const void *inputBuffer, void *outputBuffer,
             *out++ = *in++;          /* right - clean */
         }
     }
-    
+
     return paContinue;
 }
 
@@ -133,8 +133,8 @@ int main(void)
 
     inputParameters.device = Pa_GetDefaultInputDevice(); /* default input device */
     if (inputParameters.device == paNoDevice) {
-      fprintf(stderr,"Error: No default input device.\n");
-      goto error;
+        fprintf(stderr,"Error: No default input device.\n");
+        goto error;
     }
     inputParameters.channelCount = 2;       /* stereo input */
     inputParameters.sampleFormat = PA_SAMPLE_TYPE;
@@ -143,8 +143,8 @@ int main(void)
 
     outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
     if (outputParameters.device == paNoDevice) {
-      fprintf(stderr,"Error: No default output device.\n");
-      goto error;
+        fprintf(stderr,"Error: No default output device.\n");
+        goto error;
     }
     outputParameters.channelCount = 2;       /* stereo output */
     outputParameters.sampleFormat = PA_SAMPLE_TYPE;
index 71b0198d9a249510b9a96ef2b8267fd8d6b0ddcd..4b55d318578a48ca241c4bcc7e2133126d27b28d 100644 (file)
@@ -1,8 +1,8 @@
 /** @file paex_mono_asio_channel_select.c
-       @ingroup examples_src
-       @brief Play a monophonic sine wave on a specific ASIO channel.
-       @author Ross Bencina <rossb@audiomulch.com>
-       @author Phil Burk <philburk@softsynth.com>
+    @ingroup examples_src
+    @brief Play a monophonic sine wave on a specific ASIO channel.
+    @author Ross Bencina <rossb@audiomulch.com>
+    @author Phil Burk <philburk@softsynth.com>
 */
 /*
  * $Id$
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -114,7 +114,7 @@ int main(void)
         data.sine[i] = (float) (AMPLITUDE * sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. ));
     }
     data.phase = 0;
-    
+
     err = Pa_Initialize();
     if( err != paNoError ) goto error;
 
@@ -123,7 +123,7 @@ int main(void)
     outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
     outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
 
-       /* Use an ASIO specific structure. WARNING - this is not portable. */
+    /* Use an ASIO specific structure. WARNING - this is not portable. */
     asioOutputInfo.size = sizeof(PaAsioStreamInfo);
     asioOutputInfo.hostApiType = paASIO;
     asioOutputInfo.version = 1;
@@ -145,16 +145,16 @@ int main(void)
 
     err = Pa_StartStream( stream );
     if( err != paNoError ) goto error;
-    
+
     printf("Play for %d seconds.\n", NUM_SECONDS ); fflush(stdout);
     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;
index ae645d69ece2da5607dd639a4a6aa24b5ce783c1..9424e8b8e026900516572232eadb55966eb46209 100644 (file)
@@ -1,21 +1,21 @@
-/** @file paex_ocean_shore.c 
-       @ingroup examples_src
-       @brief Generate Pink Noise using Gardner method, and make "waves". Provides an example of how to
+/** @file paex_ocean_shore.c
+    @ingroup examples_src
+    @brief Generate Pink Noise using Gardner method, and make "waves". Provides an example of how to
            post stuff to/from the audio callback using lock-free FIFOs implemented by the PA ringbuffer.
 
-       Optimization suggested by James McCartney uses a tree
-       to select which random value to replace.
+    Optimization suggested by James McCartney uses a tree
+    to select which random value to replace.
 <pre>
-       x x x x x x x x x x x x x x x x 
-       x   x   x   x   x   x   x   x   
-       x       x       x       x       
-        x               x               
-          x   
-</pre>                            
-       Tree is generated by counting trailing zeros in an increasing index.
-       When the index is zero, no random number is selected.
-
-       @author Phil Burk  http://www.softsynth.com
+    x x x x x x x x x x x x x x x x
+    x   x   x   x   x   x   x   x
+    x       x       x       x
+     x               x
+       x
+</pre>
+    Tree is generated by counting trailing zeros in an increasing index.
+    When the index is zero, no random number is selected.
+
+    @author Phil Burk  http://www.softsynth.com
             Robert Bielik
 */
 /*
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -80,7 +80,7 @@ typedef struct
 }
 PinkNoise;
 
-typedef struct 
+typedef struct
 {
     float       bq_b0;
     float       bq_b1;
@@ -213,7 +213,7 @@ unsigned GenerateWave( OceanWave* wave, float* output, unsigned noOfFrames )
             targetLevel = wave->wave_envelope_max_level;
         }
         /* Calculate lowpass biquad coeffs
-        
+
             alpha = sin(w0)/(2*Q)
 
                 b0 =  (1 - cos(w0))/2
@@ -324,8 +324,8 @@ paTestData;
 static int patestCallback(const void*                     inputBuffer,
                           void*                           outputBuffer,
                           unsigned long                   framesPerBuffer,
-                                     const PaStreamCallbackTimeInfo* timeInfo,
-                                     PaStreamCallbackFlags           statusFlags,
+                          const PaStreamCallbackTimeInfo* timeInfo,
+                          PaStreamCallbackFlags           statusFlags,
                           void*                           userData)
 {
     int i;
@@ -427,8 +427,8 @@ int main(void)
     /* Open a stereo PortAudio stream so we can hear the result. */
     outputParameters.device = Pa_GetDefaultOutputDevice(); /* Take the default output device. */
     if (outputParameters.device == paNoDevice) {
-      fprintf(stderr,"Error: No default output device.\n");
-      goto error;
+        fprintf(stderr,"Error: No default output device.\n");
+        goto error;
     }
     outputParameters.channelCount = 2;                     /* Stereo output, most likely supported. */
     outputParameters.hostApiSpecificStreamInfo = NULL;
@@ -518,7 +518,7 @@ int main(void)
     {
         PaUtil_FreeMemory(data.rBufFromRTData);
     }
-    
+
     Pa_Sleep(1000);
 
     Pa_Terminate();
index cd8432411a3acccc7080b0a1a76886e5dfbc6c8e..519f9797bf5ceafe370aeb1d028f6edd75468f97 100644 (file)
@@ -1,20 +1,20 @@
 /** @file paex_pink.c
-       @ingroup examples_src
-       @brief Generate Pink Noise using Gardner method.
+    @ingroup examples_src
+    @brief Generate Pink Noise using Gardner method.
 
-       Optimization suggested by James McCartney uses a tree
-       to select which random value to replace.
+    Optimization suggested by James McCartney uses a tree
+    to select which random value to replace.
 <pre>
-       x x x x x x x x x x x x x x x x 
-       x   x   x   x   x   x   x   x   
-       x       x       x       x       
-        x               x               
-          x   
-</pre>                            
-       Tree is generated by counting trailing zeros in an increasing index.
-       When the index is zero, no random number is selected.
+    x x x x x x x x x x x x x x x x
+    x   x   x   x   x   x   x   x
+    x       x       x       x
+     x               x
+       x
+</pre>
+    Tree is generated by counting trailing zeros in an increasing index.
+    When the index is zero, no random number is selected.
 
-       @author Phil Burk  http://www.softsynth.com
+    @author Phil Burk  http://www.softsynth.com
 */
 /*
  * $Id$
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -172,8 +172,8 @@ paTestData;
 static int patestCallback(const void*                     inputBuffer,
                           void*                           outputBuffer,
                           unsigned long                   framesPerBuffer,
-                                     const PaStreamCallbackTimeInfo* timeInfo,
-                                     PaStreamCallbackFlags           statusFlags,
+                          const PaStreamCallbackTimeInfo* timeInfo,
+                          PaStreamCallbackFlags           statusFlags,
                           void*                           userData)
 {
     int finished;
@@ -214,7 +214,7 @@ int main(void)
     int                 totalSamps;
     static const double SR  = 44100.0;
     static const int    FPB = 2048; /* Frames per buffer: 46 ms buffers. */
-    
+
     /* Initialize two pink noise signals with different numbers of rows. */
     InitializePinkNoise( &data.leftPink,  12 );
     InitializePinkNoise( &data.rightPink, 16 );
@@ -237,8 +237,8 @@ int main(void)
     /* Open a stereo PortAudio stream so we can hear the result. */
     outputParameters.device = Pa_GetDefaultOutputDevice(); /* Take the default output device. */
     if (outputParameters.device == paNoDevice) {
-      fprintf(stderr,"Error: No default output device.\n");
-      goto error;
+        fprintf(stderr,"Error: No default output device.\n");
+        goto error;
     }
     outputParameters.channelCount = 2;                     /* Stereo output, most likely supported. */
     outputParameters.hostApiSpecificStreamInfo = NULL;
index 813c74d9fa59d380f9847b672e90840901cecc47..69f15ff94c7ad6bffa81b6e3cbeac35d28686b78 100644 (file)
@@ -1,7 +1,7 @@
 /** @file paex_read_write_wire.c
-       @ingroup examples_src
-       @brief Tests full duplex blocking I/O by passing input straight to output.
-       @author Bjorn Roche. XO Audio LLC for Z-Systems Engineering.
+    @ingroup examples_src
+    @brief Tests full duplex blocking I/O by passing input straight to output.
+    @author Bjorn Roche. XO Audio LLC for Z-Systems Engineering.
     @author based on code by: Phil Burk  http://www.softsynth.com
     @author based on code by: Ross Bencina rossb@audiomulch.com
 */
@@ -179,22 +179,22 @@ int main(void)
 xrun:
     printf("err = %d\n", err); fflush(stdout);
     if( stream ) {
-       Pa_AbortStream( stream );
-       Pa_CloseStream( stream );
+        Pa_AbortStream( stream );
+        Pa_CloseStream( stream );
     }
     free( sampleBlock );
     Pa_Terminate();
     if( err & paInputOverflow )
-       fprintf( stderr, "Input Overflow.\n" );
+        fprintf( stderr, "Input Overflow.\n" );
     if( err & paOutputUnderflow )
-       fprintf( stderr, "Output Underflow.\n" );
+        fprintf( stderr, "Output Underflow.\n" );
     return -2;
 error1:
     free( sampleBlock );
 error2:
     if( stream ) {
-       Pa_AbortStream( stream );
-       Pa_CloseStream( stream );
+        Pa_AbortStream( stream );
+        Pa_CloseStream( stream );
     }
     Pa_Terminate();
     fprintf( stderr, "An error occurred while using the portaudio stream\n" );
index 4c9105c352eac4e66fe2d8d0dab20a9fac079afd..4407787889b3878746979b3a160e8a7ce089af54 100644 (file)
@@ -1,7 +1,7 @@
 /** @file paex_record.c
-       @ingroup examples_src
-       @brief Record input into an array; Save array to a file; Playback recorded data.
-       @author Phil Burk  http://www.softsynth.com
+    @ingroup examples_src
+    @brief Record input into an array; Save array to a file; Playback recorded data.
+    @author Phil Burk  http://www.softsynth.com
 */
 /*
  * $Id$
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -326,15 +326,15 @@ int main(void)
     {
         err = Pa_StartStream( stream );
         if( err != paNoError ) goto done;
-        
+
         printf("Waiting for playback to finish.\n"); fflush(stdout);
 
         while( ( err = Pa_IsStreamActive( stream ) ) == 1 ) Pa_Sleep(100);
         if( err < 0 ) goto done;
-        
+
         err = Pa_CloseStream( stream );
         if( err != paNoError ) goto done;
-        
+
         printf("Done.\n"); fflush(stdout);
     }
 
index 1e1f47371d18c0d28538057f35097b0e31d28b69..c4e5b448251cf9aec1528b15a2bf2ab95a843956 100644 (file)
@@ -1,7 +1,7 @@
 /** @file paex_record_file.c
-       @ingroup examples_src
-       @brief Record input into a file, then playback recorded data from file (Windows only at the moment) 
-       @author Robert Bielik
+    @ingroup examples_src
+    @brief Record input into a file, then playback recorded data from file (Windows only at the moment)
+    @author Robert Bielik
 */
 /*
  * $Id: paex_record_file.c 1752 2011-09-08 03:21:55Z philburk $
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -433,12 +433,12 @@ int main(void)
             }
             if( err < 0 ) goto done;
         }
-        
+
         err = Pa_CloseStream( stream );
         if( err != paNoError ) goto done;
 
         fclose(data.file);
-        
+
         printf("Done.\n"); fflush(stdout);
     }
 
index 6f477b878973962465fb7f0d46e9efc31dd3e5a6..caec0b02d7e02410bef484d06ca4733a06747bab 100644 (file)
@@ -1,7 +1,7 @@
 /** @file paex_saw.c
-       @ingroup examples_src
-       @brief Play a simple (aliasing) sawtooth wave.
-       @author Phil Burk  http://www.softsynth.com
+    @ingroup examples_src
+    @brief Play a simple (aliasing) sawtooth wave.
+    @author Phil Burk  http://www.softsynth.com
 */
 /*
  * $Id$
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -92,14 +92,14 @@ int main(void)
 {
     PaStream *stream;
     PaError err;
-    
+
     printf("PortAudio Test: output sawtooth wave.\n");
     /* Initialize our data for use by callback. */
     data.left_phase = data.right_phase = 0.0;
     /* Initialize library before making any other calls. */
     err = Pa_Initialize();
     if( err != paNoError ) goto error;
-    
+
     /* Open an audio I/O stream. */
     err = Pa_OpenDefaultStream( &stream,
                                 0,          /* no input channels */
index 99fecf711d029fe934ca09446e8ffed68058cc4c..50ef205c9b18728bb74a1f9b108d9b23a72d3e30 100644 (file)
@@ -1,7 +1,7 @@
 /** @file paex_sine.c
-       @ingroup examples_src
-       @brief Play a sine wave for several seconds.
-       @author Ross Bencina <rossb@audiomulch.com>
+    @ingroup examples_src
+    @brief Play a sine wave for several seconds.
+    @author Ross Bencina <rossb@audiomulch.com>
     @author Phil Burk <philburk@softsynth.com>
 */
 /*
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 #include <stdio.h>
@@ -80,7 +80,7 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
     (void) timeInfo; /* Prevent unused variable warnings. */
     (void) statusFlags;
     (void) inputBuffer;
-    
+
     for( i=0; i<framesPerBuffer; i++ )
     {
         *out++ = data->sine[data->left_phase];  /* left */
@@ -90,7 +90,7 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
         data->right_phase += 3; /* higher pitch so we can distinguish left and right. */
         if( data->right_phase >= TABLE_SIZE ) data->right_phase -= TABLE_SIZE;
     }
-    
+
     return paContinue;
 }
 
@@ -99,8 +99,8 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
  */
 static void StreamFinished( void* userData )
 {
-   paTestData *data = (paTestData *) userData;
-   printf( "Stream Completed: %s\n", data->message );
+    paTestData *data = (paTestData *) userData;
+    printf( "Stream Completed: %s\n", data->message );
 }
 
 /*******************************************************************/
@@ -121,14 +121,14 @@ int main(void)
         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 ) goto error;
 
     outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
     if (outputParameters.device == paNoDevice) {
-      fprintf(stderr,"Error: No default output device.\n");
-      goto error;
+        fprintf(stderr,"Error: No default output device.\n");
+        goto error;
     }
     outputParameters.channelCount = 2;       /* stereo output */
     outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
@@ -164,7 +164,7 @@ int main(void)
 
     Pa_Terminate();
     printf("Test finished.\n");
-    
+
     return err;
 error:
     Pa_Terminate();
index 64d78294fd5194b2413af88acbc5070f35706509..5d965222b119c9c4ec822773b76a6cb873986aed 100644 (file)
@@ -1,7 +1,7 @@
 /** @file paex_sine.c
-       @ingroup examples_src
-       @brief Play a sine wave for several seconds.
-       @author Ross Bencina <rossb@audiomulch.com>
+    @ingroup examples_src
+    @brief Play a sine wave for several seconds.
+    @author Ross Bencina <rossb@audiomulch.com>
     @author Phil Burk <philburk@softsynth.com>
 */
 /*
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 #include <stdio.h>
@@ -189,7 +189,7 @@ private:
         PaStreamCallbackFlags statusFlags,
         void *userData )
     {
-        /* Here we cast userData to Sine* type so we can call the instance method paCallbackMethod, we can do that since 
+        /* Here we cast userData to Sine* type so we can call the instance method paCallbackMethod, we can do that since
            we called Pa_OpenStream with 'this' for userData */
         return ((Sine*)userData)->paCallbackMethod(inputBuffer, outputBuffer,
             framesPerBuffer,
@@ -247,7 +247,7 @@ int main(void)
     Sine sine;
 
     printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER);
-    
+
     ScopedPaHandler paInit;
     if( paInit.result() != paNoError ) goto error;
 
index ac9212a0a933d0d1ab73750e1e02fd5ff64fbc16..67c2786d03e1f3802d8f5505ed5020558d6526c3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file paex_wmme_ac3.c
-       @ingroup examples_src
-       @brief Use WMME-specific interface to send raw AC3 data to a S/PDIF output.
-       @author Ross Bencina <rossb@audiomulch.com>
+    @ingroup examples_src
+    @brief Use WMME-specific interface to send raw AC3 data to a S/PDIF output.
+    @author Ross Bencina <rossb@audiomulch.com>
 */
 /*
  * $Id: $
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -91,17 +91,17 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
     (void) inputBuffer;
 
     /* stream out contents of data->buffer looping at end */
-    
+
     for( i=0; i<framesPerBuffer; i++ )
     {
-               for( j = 0; j < CHANNEL_COUNT; ++j ){
+        for( j = 0; j < CHANNEL_COUNT; ++j ){
             *out++ = data->buffer[ data->playbackIndex++ ];
 
             if( data->playbackIndex >= data->bufferSampleCount )
                 data->playbackIndex = 0; /* loop at end of buffer */
-               }
-       }
-    
+        }
+    }
+
     return paContinue;
 }
 
@@ -120,10 +120,10 @@ int main(int argc, char* argv[])
 
     printf("usage: patest_wmme_ac3 fileName [paDeviceIndex]\n");
     printf("**IMPORTANT*** The provided file must include the spdif preamble at the start of every AC-3 frame. Using a normal ac3 file won't work.\n");
-    printf("PortAudio Test: output a raw spdif ac3 stream. SR = %d, BufSize = %d, Chans = %d\n", 
+    printf("PortAudio Test: output a raw spdif ac3 stream. SR = %d, BufSize = %d, Chans = %d\n",
             SAMPLE_RATE, FRAMES_PER_BUFFER, CHANNEL_COUNT);
 
-        
+
     if( argc >= 2 )
         fileName = argv[1];
 
@@ -154,14 +154,14 @@ int main(int argc, char* argv[])
     err = Pa_Initialize();
     if( err != paNoError ) goto error;
 
-       deviceIndex = Pa_GetHostApiInfo( Pa_HostApiTypeIdToHostApiIndex( paMME ) )->defaultOutputDevice;
-       if( argc >= 3 ){
-               sscanf( argv[1], "%d", &deviceIndex );
-       }
+    deviceIndex = Pa_GetHostApiInfo( Pa_HostApiTypeIdToHostApiIndex( paMME ) )->defaultOutputDevice;
+    if( argc >= 3 ){
+        sscanf( argv[1], "%d", &deviceIndex );
+    }
+
+    printf( "using device id %d (%s)\n", deviceIndex, Pa_GetDeviceInfo(deviceIndex)->name );
 
-       printf( "using device id %d (%s)\n", deviceIndex, Pa_GetDeviceInfo(deviceIndex)->name );
 
-    
     outputParameters.device = deviceIndex;
     outputParameters.channelCount = CHANNEL_COUNT;
     outputParameters.sampleFormat = paInt16; /* IMPORTANT must use paInt16 for WMME AC3 */
@@ -169,17 +169,17 @@ int main(int argc, char* argv[])
     outputParameters.hostApiSpecificStreamInfo = NULL;
 
     wmmeStreamInfo.size = sizeof(PaWinMmeStreamInfo);
-    wmmeStreamInfo.hostApiType = paMME; 
+    wmmeStreamInfo.hostApiType = paMME;
     wmmeStreamInfo.version = 1;
     wmmeStreamInfo.flags = paWinMmeWaveFormatDolbyAc3Spdif;
     outputParameters.hostApiSpecificStreamInfo = &wmmeStreamInfo;
 
 
-       if( Pa_IsFormatSupported( 0, &outputParameters, SAMPLE_RATE ) == paFormatIsSupported  ){
-               printf( "Pa_IsFormatSupported reports device will support %d channels.\n", CHANNEL_COUNT );
-       }else{
-               printf( "Pa_IsFormatSupported reports device will not support %d channels.\n", CHANNEL_COUNT );
-       }
+    if( Pa_IsFormatSupported( 0, &outputParameters, SAMPLE_RATE ) == paFormatIsSupported  ){
+        printf( "Pa_IsFormatSupported reports device will support %d channels.\n", CHANNEL_COUNT );
+    }else{
+        printf( "Pa_IsFormatSupported reports device will not support %d channels.\n", CHANNEL_COUNT );
+    }
 
     err = Pa_OpenStream(
               &stream,
@@ -207,7 +207,7 @@ int main(int argc, char* argv[])
     Pa_Terminate();
     free( data.buffer );
     printf("Test finished.\n");
-    
+
     return err;
 error:
     Pa_Terminate();
index dfccc99e47b039bc17b44f20355053960604b0ca..86a7e371d98e075efcc80b8309adc8f19c83e402 100644 (file)
@@ -1,7 +1,7 @@
 /** @file paex_wmme_surround.c
-       @ingroup examples_src
-       @brief Use WMME-specific channelMask to request 5.1 surround sound output.
-       @author Ross Bencina <rossb@audiomulch.com>
+    @ingroup examples_src
+    @brief Use WMME-specific channelMask to request 5.1 surround sound output.
+    @author Ross Bencina <rossb@audiomulch.com>
 */
 /*
  * $Id: $
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -67,9 +67,9 @@
 typedef struct
 {
     float sine[TABLE_SIZE];
-       int phase;
-       int currentChannel;
-       int cycleCount;
+    int phase;
+    int currentChannel;
+    int cycleCount;
 }
 paTestData;
 
@@ -90,31 +90,31 @@ static int patestCallback( const void *inputBuffer, void *outputBuffer,
     (void) timeInfo; /* Prevent unused variable warnings. */
     (void) statusFlags;
     (void) inputBuffer;
-    
+
     for( i=0; i<framesPerBuffer; i++ )
     {
-               for( j = 0; j < CHANNEL_COUNT; ++j ){
-                       if( j == data->currentChannel && data->cycleCount < 4410 ){
-                               *out++ = data->sine[data->phase];
-                               data->phase += 1 + j;   // play each channel at a different pitch so they can be distinguished
-                               if( data->phase >= TABLE_SIZE ){
-                                       data->phase -= TABLE_SIZE;
-                               }
-                       }else{
-                               *out++ = 0;
-                       }
-               }
-    
-               data->cycleCount++;
-               if( data->cycleCount > 44100 ){
-                       data->cycleCount = 0;
-
-                       ++data->currentChannel;
-                       if( data->currentChannel >= CHANNEL_COUNT )
-                               data->currentChannel -= CHANNEL_COUNT;
-               }
-       }
-    
+        for( j = 0; j < CHANNEL_COUNT; ++j ){
+            if( j == data->currentChannel && data->cycleCount < 4410 ){
+                *out++ = data->sine[data->phase];
+                data->phase += 1 + j;    // play each channel at a different pitch so they can be distinguished
+                if( data->phase >= TABLE_SIZE ){
+                    data->phase -= TABLE_SIZE;
+                }
+            }else{
+                *out++ = 0;
+            }
+        }
+
+        data->cycleCount++;
+        if( data->cycleCount > 44100 ){
+            data->cycleCount = 0;
+
+            ++data->currentChannel;
+            if( data->currentChannel >= CHANNEL_COUNT )
+                data->currentChannel -= CHANNEL_COUNT;
+        }
+    }
+
     return paContinue;
 }
 
@@ -134,12 +134,12 @@ int main(int argc, char* argv[])
     err = Pa_Initialize();
     if( err != paNoError ) goto error;
 
-       deviceIndex = Pa_GetHostApiInfo( Pa_HostApiTypeIdToHostApiIndex( paMME ) )->defaultOutputDevice;
-       if( argc == 2 ){
-               sscanf( argv[1], "%d", &deviceIndex );
-       }
+    deviceIndex = Pa_GetHostApiInfo( Pa_HostApiTypeIdToHostApiIndex( paMME ) )->defaultOutputDevice;
+    if( argc == 2 ){
+        sscanf( argv[1], "%d", &deviceIndex );
+    }
 
-       printf( "using device id %d (%s)\n", deviceIndex, Pa_GetDeviceInfo(deviceIndex)->name );
+    printf( "using device id %d (%s)\n", deviceIndex, Pa_GetDeviceInfo(deviceIndex)->name );
 
     /* initialise sinusoidal wavetable */
     for( i=0; i<TABLE_SIZE; i++ )
@@ -147,9 +147,9 @@ int main(int argc, char* argv[])
         data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
     }
 
-       data.phase = 0;
-       data.currentChannel = 0;
-       data.cycleCount = 0;
+    data.phase = 0;
+    data.currentChannel = 0;
+    data.cycleCount = 0;
 
     outputParameters.device = deviceIndex;
     outputParameters.channelCount = CHANNEL_COUNT;
@@ -161,18 +161,18 @@ int main(int argc, char* argv[])
        output. But if you want to be sure which channel mask PortAudio will use
        then you should supply one */
     wmmeStreamInfo.size = sizeof(PaWinMmeStreamInfo);
-    wmmeStreamInfo.hostApiType = paMME; 
+    wmmeStreamInfo.hostApiType = paMME;
     wmmeStreamInfo.version = 1;
     wmmeStreamInfo.flags = paWinMmeUseChannelMask;
     wmmeStreamInfo.channelMask = PAWIN_SPEAKER_5POINT1; /* request 5.1 output format */
     outputParameters.hostApiSpecificStreamInfo = &wmmeStreamInfo;
 
 
-       if( Pa_IsFormatSupported( 0, &outputParameters, SAMPLE_RATE ) == paFormatIsSupported  ){
-               printf( "Pa_IsFormatSupported reports device will support %d channels.\n", CHANNEL_COUNT );
-       }else{
-               printf( "Pa_IsFormatSupported reports device will not support %d channels.\n", CHANNEL_COUNT );
-       }
+    if( Pa_IsFormatSupported( 0, &outputParameters, SAMPLE_RATE ) == paFormatIsSupported  ){
+        printf( "Pa_IsFormatSupported reports device will support %d channels.\n", CHANNEL_COUNT );
+    }else{
+        printf( "Pa_IsFormatSupported reports device will not support %d channels.\n", CHANNEL_COUNT );
+    }
 
     err = Pa_OpenStream(
               &stream,
@@ -199,7 +199,7 @@ int main(int argc, char* argv[])
 
     Pa_Terminate();
     printf("Test finished.\n");
-    
+
     return err;
 error:
     Pa_Terminate();
index 9021b94524a35f77dcf0b3c2cc5ff144a4c785d5..3035b42ba92e2430ee320051f5cd914c1fcdde91 100644 (file)
@@ -1,7 +1,7 @@
 /** @file paex_write_sine.c
-       @ingroup examples_src
-       @brief Play a sine wave for several seconds using the blocking API (Pa_WriteStream())
-       @author Ross Bencina <rossb@audiomulch.com>
+    @ingroup examples_src
+    @brief Play a sine wave for several seconds using the blocking API (Pa_WriteStream())
+    @author Ross Bencina <rossb@audiomulch.com>
     @author Phil Burk <philburk@softsynth.com>
 */
 /*
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -71,23 +71,23 @@ int main(void)
     int right_inc = 3; /* higher pitch so we can distinguish left and right. */
     int i, j, k;
     int bufferCount;
-    
+
     printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER);
-    
+
     /* initialise sinusoidal wavetable */
     for( i=0; i<TABLE_SIZE; i++ )
     {
         sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
     }
 
-    
+
     err = Pa_Initialize();
     if( err != paNoError ) goto error;
 
     outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
     if (outputParameters.device == paNoDevice) {
-      fprintf(stderr,"Error: No default output device.\n");
-      goto error;
+        fprintf(stderr,"Error: No default output device.\n");
+        goto error;
     }
     outputParameters.channelCount = 2;       /* stereo output */
     outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output */
@@ -107,7 +107,7 @@ int main(void)
 
 
     printf( "Play 3 times, higher each time.\n" );
-    
+
     for( k=0; k < 3; ++k )
     {
         err = Pa_StartStream( stream );
@@ -131,7 +131,7 @@ int main(void)
 
             err = Pa_WriteStream( stream, buffer, FRAMES_PER_BUFFER );
             if( err != paNoError ) goto error;
-        }   
+        }
 
         err = Pa_StopStream( stream );
         if( err != paNoError ) goto error;
@@ -147,20 +147,20 @@ int main(void)
 
     Pa_Terminate();
     printf("Test finished.\n");
-    
+
     return err;
 
 error:
     fprintf( stderr, "An error occurred while using the portaudio stream\n" );
     fprintf( stderr, "Error number: %d\n", err );
     fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
-       // Print more information about the error.
-       if( err == paUnanticipatedHostError )
-       {
-               const PaHostErrorInfo *hostErrorInfo = Pa_GetLastHostErrorInfo();
-               fprintf( stderr, "Host API error = #%ld, hostApiType = %d\n", hostErrorInfo->errorCode, hostErrorInfo->hostApiType );
-               fprintf( stderr, "Host API error = %s\n", hostErrorInfo->errorText );
-       }
+    // Print more information about the error.
+    if( err == paUnanticipatedHostError )
+    {
+        const PaHostErrorInfo *hostErrorInfo = Pa_GetLastHostErrorInfo();
+        fprintf( stderr, "Host API error = #%ld, hostApiType = %d\n", hostErrorInfo->errorCode, hostErrorInfo->hostApiType );
+        fprintf( stderr, "Host API error = %s\n", hostErrorInfo->errorText );
+    }
     Pa_Terminate();
     return err;
 }
index bc266c04626697b1f4457179be9cd9bd1241c5d2..db78ed74d35f2a36fa592a60a0051126780ebc28 100644 (file)
@@ -1,7 +1,7 @@
 /** @file paex_write_sine_nonint.c
-       @ingroup examples_src
-       @brief Play a non-interleaved sine wave using the blocking API (Pa_WriteStream())
-       @author Ross Bencina <rossb@audiomulch.com>
+    @ingroup examples_src
+    @brief Play a non-interleaved sine wave using the blocking API (Pa_WriteStream())
+    @author Ross Bencina <rossb@audiomulch.com>
     @author Phil Burk <philburk@softsynth.com>
 */
 /*
  */
 
 /*
- * The text above constitutes the entire PortAudio license; however, 
+ * The text above constitutes the entire PortAudio license; however,
  * the PortAudio community also makes the following non-binding requests:
  *
  * Any person wishing to distribute modifications to the Software is
  * requested to send the modifications to the original developer so that
- * they can be incorporated into the canonical version. It is also 
- * requested that these non-binding requests be included along with the 
+ * they can be incorporated into the canonical version. It is also
+ * requested that these non-binding requests be included along with the
  * license above.
  */
 
@@ -63,11 +63,11 @@ int main(void)
     PaStreamParameters outputParameters;
     PaStream *stream;
     PaError err;
-    
-       float leftBuffer[FRAMES_PER_BUFFER];
+
+    float leftBuffer[FRAMES_PER_BUFFER];
     float rightBuffer[FRAMES_PER_BUFFER];
     void *buffers[2]; /* points to both non-interleaved buffers. */
-       
+
     float sine[TABLE_SIZE]; /* sine wavetable */
     int left_phase = 0;
     int right_phase = 0;
@@ -76,23 +76,23 @@ int main(void)
     int i, j, k;
     int bufferCount;
 
-    
+
     printf("PortAudio Test: output sine wave NON-INTERLEAVED. SR = %d, BufSize = %d\n", SAMPLE_RATE, FRAMES_PER_BUFFER);
-    
+
     /* initialise sinusoidal wavetable */
     for( i=0; i<TABLE_SIZE; i++ )
     {
         sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. );
     }
 
-    
+
     err = Pa_Initialize();
     if( err != paNoError ) goto error;
 
     outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output device */
     if (outputParameters.device == paNoDevice) {
-      fprintf(stderr,"Error: No default output device.\n");
-      goto error;
+        fprintf(stderr,"Error: No default output device.\n");
+        goto error;
     }
     outputParameters.channelCount = 2;       /* stereo output */
     outputParameters.sampleFormat = paFloat32 | paNonInterleaved; /* 32 bit floating point output NON-INTERLEAVED */
@@ -112,11 +112,11 @@ int main(void)
 
 
     printf( "Play 3 times, higher each time.\n" );
-    
-       /* Set up array of buffer pointers for Pa_WriteStream */
-       buffers[0] = leftBuffer;
-       buffers[1] = rightBuffer;
-       
+
+    /* Set up array of buffer pointers for Pa_WriteStream */
+    buffers[0] = leftBuffer;
+    buffers[1] = rightBuffer;
+
     for( k=0; k < 3; ++k )
     {
         err = Pa_StartStream( stream );
@@ -140,7 +140,7 @@ int main(void)
 
             err = Pa_WriteStream( stream, buffers, FRAMES_PER_BUFFER );
             if( err != paNoError ) goto error;
-        }   
+        }
 
         err = Pa_StopStream( stream );
         if( err != paNoError ) goto error;
@@ -156,7 +156,7 @@ int main(void)
 
     Pa_Terminate();
     printf("Test finished.\n");
-    
+
     return err;
 error:
     Pa_Terminate();