diff options
Diffstat (limited to '3rdparty/portaudio/examples/paex_ocean_shore.c')
-rw-r--r-- | 3rdparty/portaudio/examples/paex_ocean_shore.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/3rdparty/portaudio/examples/paex_ocean_shore.c b/3rdparty/portaudio/examples/paex_ocean_shore.c index 7eb7f207bb6..364e7920a95 100644 --- a/3rdparty/portaudio/examples/paex_ocean_shore.c +++ b/3rdparty/portaudio/examples/paex_ocean_shore.c @@ -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 */ /* @@ -46,13 +46,13 @@ */ /* - * 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; @@ -367,7 +367,7 @@ OceanWave* InitializeWave(double SR, float attackInSeconds, float maxLevel, floa static unsigned lastNoOfRows = 12; unsigned newNoOfRows; - wave = (OceanWave*)PaUtil_AllocateMemory(sizeof(OceanWave)); + wave = (OceanWave*)PaUtil_AllocateZeroInitializedMemory(sizeof(OceanWave)); if (wave != NULL) { InitializePinkNoise(&wave->wave_left, lastNoOfRows); @@ -407,14 +407,14 @@ int main(void) static const int FPB = 128; /* Frames per buffer: 2.9 ms buffers. */ /* Initialize communication buffers (queues) */ - data.rBufToRTData = PaUtil_AllocateMemory(sizeof(OceanWave*) * 256); + data.rBufToRTData = PaUtil_AllocateZeroInitializedMemory(sizeof(OceanWave*) * 256); if (data.rBufToRTData == NULL) { return 1; } PaUtil_InitializeRingBuffer(&data.rBufToRT, sizeof(OceanWave*), 256, data.rBufToRTData); - data.rBufFromRTData = PaUtil_AllocateMemory(sizeof(OceanWave*) * 256); + data.rBufFromRTData = PaUtil_AllocateZeroInitializedMemory(sizeof(OceanWave*) * 256); if (data.rBufFromRTData == NULL) { return 1; @@ -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(); @@ -526,7 +526,7 @@ int main(void) error: Pa_Terminate(); - fprintf( stderr, "An error occured while using the portaudio stream\n" ); + 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 ) ); return 0; |