summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/portaudio/examples
diff options
context:
space:
mode:
author arbee <rb6502@users.noreply.github.com>2023-04-01 19:03:31 -0400
committer arbee <rb6502@users.noreply.github.com>2023-04-01 19:03:31 -0400
commit645bbe989ba5a93397c737d3107570fd0f42d5ed (patch)
tree956b374177cccda02ebe66b81847a92ba696d732 /3rdparty/portaudio/examples
parent4acca56e7ea49639da0ab8736e7b5fbad09310e9 (diff)
PortAudio: sync to upstream GitHub revision 0e9b386a1053261340bc8bb32335484ef77b258b [R. Belmont, PortAudio team]
* Tested and works on Windows, macOS, and Linux. * Fixes compatibility with macOS Ventura and bugfixes WASAPI and WDM-KS on Windows.
Diffstat (limited to '3rdparty/portaudio/examples')
-rw-r--r--3rdparty/portaudio/examples/CMakeLists.txt79
-rw-r--r--3rdparty/portaudio/examples/pa_devs.c26
-rw-r--r--3rdparty/portaudio/examples/pa_fuzz.c38
-rw-r--r--3rdparty/portaudio/examples/paex_mono_asio_channel_select.c26
-rw-r--r--3rdparty/portaudio/examples/paex_ocean_shore.c58
-rw-r--r--3rdparty/portaudio/examples/paex_pink.c44
-rw-r--r--3rdparty/portaudio/examples/paex_read_write_wire.c25
-rw-r--r--3rdparty/portaudio/examples/paex_record.c27
-rw-r--r--3rdparty/portaudio/examples/paex_record_file.c21
-rw-r--r--3rdparty/portaudio/examples/paex_saw.c18
-rw-r--r--3rdparty/portaudio/examples/paex_sine.c30
-rw-r--r--3rdparty/portaudio/examples/paex_sine_c++.cpp18
-rw-r--r--3rdparty/portaudio/examples/paex_wmme_ac3.c55
-rw-r--r--3rdparty/portaudio/examples/paex_wmme_surround.c97
-rw-r--r--3rdparty/portaudio/examples/paex_write_sine.c44
-rw-r--r--3rdparty/portaudio/examples/paex_write_sine_nonint.c44
16 files changed, 327 insertions, 323 deletions
diff --git a/3rdparty/portaudio/examples/CMakeLists.txt b/3rdparty/portaudio/examples/CMakeLists.txt
index f96b6ec2daf..eca4beb33ae 100644
--- a/3rdparty/portaudio/examples/CMakeLists.txt
+++ b/3rdparty/portaudio/examples/CMakeLists.txt
@@ -1,41 +1,46 @@
# Example projects
-MACRO(ADD_EXAMPLE appl_name)
- ADD_EXECUTABLE(${appl_name} "${appl_name}.c")
- TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
- SET_TARGET_PROPERTIES(${appl_name} PROPERTIES FOLDER "Examples C")
- IF(WIN32)
- SET_PROPERTY(TARGET ${appl_name} APPEND_STRING PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
- ENDIF()
-ENDMACRO(ADD_EXAMPLE)
+macro(add_example appl_name)
+ add_executable(${appl_name} "${appl_name}.c")
+ target_link_libraries(${appl_name} PortAudio)
+ if(UNIX)
+ target_link_libraries(${appl_name} m)
+ endif()
+ set_target_properties(${appl_name} PROPERTIES FOLDER "Examples C")
+ if(WIN32)
+ set_property(TARGET ${appl_name} APPEND_STRING PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
+ endif()
+endmacro()
-MACRO(ADD_EXAMPLE_CPP appl_name)
- ADD_EXECUTABLE(${appl_name} "${appl_name}.cpp")
- TARGET_LINK_LIBRARIES(${appl_name} portaudio_static)
- SET_TARGET_PROPERTIES(${appl_name} PROPERTIES FOLDER "Examples C++")
- IF(WIN32)
- SET_PROPERTY(TARGET ${appl_name} APPEND_STRING PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
- ENDIF()
-ENDMACRO(ADD_EXAMPLE_CPP)
+macro(add_example_cpp appl_name)
+ add_executable(${appl_name} "${appl_name}.cpp")
+ target_link_libraries(${appl_name} PortAudio)
+ set_target_properties(${appl_name} PROPERTIES FOLDER "Examples C++")
+ if(WIN32)
+ set_property(TARGET ${appl_name} APPEND_STRING PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
+ endif()
+endmacro()
-ADD_EXAMPLE(pa_devs)
-ADD_EXAMPLE(pa_fuzz)
-IF(PA_USE_ASIO AND WIN32)
- ADD_EXAMPLE(paex_mono_asio_channel_select)
-ENDIF()
-ADD_EXAMPLE(paex_ocean_shore)
-TARGET_INCLUDE_DIRECTORIES(paex_ocean_shore PRIVATE ../src/common)
-ADD_EXAMPLE(paex_pink)
-ADD_EXAMPLE(paex_read_write_wire)
-ADD_EXAMPLE(paex_record)
-ADD_EXAMPLE(paex_record_file)
-TARGET_INCLUDE_DIRECTORIES(paex_record_file PRIVATE ../src/common)
-ADD_EXAMPLE(paex_saw)
-ADD_EXAMPLE(paex_sine)
-ADD_EXAMPLE_CPP(paex_sine_c++)
-IF(PA_USE_WMME AND WIN32)
- ADD_EXAMPLE(paex_wmme_ac3)
- ADD_EXAMPLE(paex_wmme_surround)
-ENDIF()
-ADD_EXAMPLE(paex_write_sine)
-ADD_EXAMPLE(paex_write_sine_nonint)
+add_example(pa_devs)
+add_example(pa_fuzz)
+if(PA_USE_ASIO AND WIN32)
+ add_example(paex_mono_asio_channel_select)
+endif()
+if(LINK_PRIVATE_SYMBOLS)
+ add_example(paex_ocean_shore)
+endif()
+add_example(paex_pink)
+add_example(paex_read_write_wire)
+add_example(paex_record)
+if(LINK_PRIVATE_SYMBOLS)
+ add_example(paex_record_file)
+endif()
+add_example(paex_saw)
+add_example(paex_sine)
+add_example_cpp(paex_sine_c++)
+if(PA_USE_WMME AND WIN32)
+ add_example(paex_wmme_ac3)
+ add_example(paex_wmme_surround)
+endif()
+add_example(paex_write_sine)
+add_example(paex_write_sine_nonint)
diff --git a/3rdparty/portaudio/examples/pa_devs.c b/3rdparty/portaudio/examples/pa_devs.c
index 595a05dbe7a..27acfd53b24 100644
--- a/3rdparty/portaudio/examples/pa_devs.c
+++ b/3rdparty/portaudio/examples/pa_devs.c
@@ -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.
@@ -34,13 +34,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.
*/
@@ -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;
diff --git a/3rdparty/portaudio/examples/pa_fuzz.c b/3rdparty/portaudio/examples/pa_fuzz.c
index d5f99eca269..130ea32e9fa 100644
--- a/3rdparty/portaudio/examples/pa_fuzz.c
+++ b/3rdparty/portaudio/examples/pa_fuzz.c
@@ -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$
@@ -31,13 +31,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.
*/
@@ -45,9 +45,12 @@
#include <math.h>
#include "portaudio.h"
/*
-** Note that many of the older ISA sound cards on PCs do NOT support
-** full duplex audio (simultaneous record and playback).
-** And some only support full duplex at lower sample rates.
+ * Simulate a guitar distortion pedal.
+ * Record mono input and output clean and processed stereo output.
+ *
+ * Note that many of the older ISA sound cards on PCs do NOT support
+ * full duplex audio (simultaneous record and playback).
+ * And some only support full duplex at lower sample rates.
*/
#define SAMPLE_RATE (44100)
#define PA_SAMPLE_TYPE paFloat32
@@ -112,11 +115,12 @@ static int fuzzCallback( const void *inputBuffer, void *outputBuffer,
{
for( i=0; i<framesPerBuffer; i++ )
{
- *out++ = FUZZ(*in++); /* left - distorted */
- *out++ = *in++; /* right - clean */
+ SAMPLE sample = *in++; /* MONO input */
+ *out++ = FUZZ(sample); /* left - distorted */
+ *out++ = sample; /* right - clean */
}
}
-
+
return paContinue;
}
@@ -133,18 +137,18 @@ 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.channelCount = 1; /* mono input */
inputParameters.sampleFormat = PA_SAMPLE_TYPE;
inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultLowInputLatency;
inputParameters.hostApiSpecificStreamInfo = NULL;
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;
@@ -176,7 +180,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 -1;
diff --git a/3rdparty/portaudio/examples/paex_mono_asio_channel_select.c b/3rdparty/portaudio/examples/paex_mono_asio_channel_select.c
index a141ac02cf0..4b55d318578 100644
--- a/3rdparty/portaudio/examples/paex_mono_asio_channel_select.c
+++ b/3rdparty/portaudio/examples/paex_mono_asio_channel_select.c
@@ -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$
@@ -36,13 +36,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.
*/
@@ -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,22 +145,22 @@ 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;
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 err;
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;
diff --git a/3rdparty/portaudio/examples/paex_pink.c b/3rdparty/portaudio/examples/paex_pink.c
index 3714ba7603a..519f9797bf5 100644
--- a/3rdparty/portaudio/examples/paex_pink.c
+++ b/3rdparty/portaudio/examples/paex_pink.c
@@ -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$
@@ -44,13 +44,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.
*/
@@ -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;
@@ -272,7 +272,7 @@ int main(void)
return 0;
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;
diff --git a/3rdparty/portaudio/examples/paex_read_write_wire.c b/3rdparty/portaudio/examples/paex_read_write_wire.c
index 4208a019efb..46fc8bc40bc 100644
--- a/3rdparty/portaudio/examples/paex_read_write_wire.c
+++ b/3rdparty/portaudio/examples/paex_read_write_wire.c
@@ -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
*/
@@ -98,8 +98,8 @@ int main(void)
int numChannels;
printf("patest_read_write_wire.c\n"); fflush(stdout);
- printf("sizeof(int) = %lu\n", sizeof(int)); fflush(stdout);
- printf("sizeof(long) = %lu\n", sizeof(long)); fflush(stdout);
+ printf("sizeof(int) = %lu\n", (unsigned long) sizeof(int)); fflush(stdout);
+ printf("sizeof(long) = %lu\n", (unsigned long) sizeof(long)); fflush(stdout);
err = Pa_Initialize();
if( err != paNoError ) goto error2;
@@ -179,27 +179,26 @@ 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 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 -1;
}
-
diff --git a/3rdparty/portaudio/examples/paex_record.c b/3rdparty/portaudio/examples/paex_record.c
index 99226fca84e..02724d89fd1 100644
--- a/3rdparty/portaudio/examples/paex_record.c
+++ b/3rdparty/portaudio/examples/paex_record.c
@@ -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$
@@ -31,13 +31,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.
*/
@@ -49,7 +49,7 @@
#define SAMPLE_RATE (44100)
#define FRAMES_PER_BUFFER (512)
#define NUM_SECONDS (5)
-#define NUM_CHANNELS (2)
+#define NUM_CHANNELS (1)
/* #define DITHER_FLAG (paDitherOff) */
#define DITHER_FLAG (0) /**/
/** Set to 1 if you want to capture the recording to a file. */
@@ -229,7 +229,7 @@ int main(void)
fprintf(stderr,"Error: No default input device.\n");
goto done;
}
- inputParameters.channelCount = 2; /* stereo input */
+ inputParameters.channelCount = NUM_CHANNELS;
inputParameters.sampleFormat = PA_SAMPLE_TYPE;
inputParameters.suggestedLatency = Pa_GetDeviceInfo( inputParameters.device )->defaultLowInputLatency;
inputParameters.hostApiSpecificStreamInfo = NULL;
@@ -305,7 +305,7 @@ int main(void)
fprintf(stderr,"Error: No default output device.\n");
goto done;
}
- outputParameters.channelCount = 2; /* stereo output */
+ outputParameters.channelCount = NUM_CHANNELS;
outputParameters.sampleFormat = PA_SAMPLE_TYPE;
outputParameters.suggestedLatency = Pa_GetDeviceInfo( outputParameters.device )->defaultLowOutputLatency;
outputParameters.hostApiSpecificStreamInfo = NULL;
@@ -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);
}
@@ -344,11 +344,10 @@ done:
free( data.recordedSamples );
if( err != paNoError )
{
- 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 ) );
err = 1; /* Always return 0 or 1, but no other return codes. */
}
return err;
}
-
diff --git a/3rdparty/portaudio/examples/paex_record_file.c b/3rdparty/portaudio/examples/paex_record_file.c
index 1f1211fce98..f1276ecbed4 100644
--- a/3rdparty/portaudio/examples/paex_record_file.c
+++ b/3rdparty/portaudio/examples/paex_record_file.c
@@ -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 $
@@ -31,13 +31,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.
*/
@@ -315,7 +315,7 @@ int main(void)
/* We set the ring buffer size to about 500 ms */
numSamples = NextPowerOf2((unsigned)(SAMPLE_RATE * 0.5 * NUM_CHANNELS));
numBytes = numSamples * sizeof(SAMPLE);
- data.ringBufferData = (SAMPLE *) PaUtil_AllocateMemory( numBytes );
+ data.ringBufferData = (SAMPLE *) PaUtil_AllocateZeroInitializedMemory( numBytes );
if( data.ringBufferData == NULL )
{
printf("Could not allocate ring buffer data.\n");
@@ -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);
}
@@ -448,11 +448,10 @@ done:
PaUtil_FreeMemory( data.ringBufferData );
if( err != paNoError )
{
- 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 ) );
err = 1; /* Always return 0 or 1, but no other return codes. */
}
return err;
}
-
diff --git a/3rdparty/portaudio/examples/paex_saw.c b/3rdparty/portaudio/examples/paex_saw.c
index 235f247e92b..caec0b02d7e 100644
--- a/3rdparty/portaudio/examples/paex_saw.c
+++ b/3rdparty/portaudio/examples/paex_saw.c
@@ -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$
@@ -31,13 +31,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.
*/
@@ -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 */
@@ -126,7 +126,7 @@ int main(void)
return err;
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 err;
diff --git a/3rdparty/portaudio/examples/paex_sine.c b/3rdparty/portaudio/examples/paex_sine.c
index bda290b8ead..50ef205c9b1 100644
--- a/3rdparty/portaudio/examples/paex_sine.c
+++ b/3rdparty/portaudio/examples/paex_sine.c
@@ -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>
*/
/*
@@ -32,13 +32,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.
*/
#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,11 +164,11 @@ int main(void)
Pa_Terminate();
printf("Test finished.\n");
-
+
return err;
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 err;
diff --git a/3rdparty/portaudio/examples/paex_sine_c++.cpp b/3rdparty/portaudio/examples/paex_sine_c++.cpp
index 2859a57867c..5d965222b11 100644
--- a/3rdparty/portaudio/examples/paex_sine_c++.cpp
+++ b/3rdparty/portaudio/examples/paex_sine_c++.cpp
@@ -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>
*/
/*
@@ -32,13 +32,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.
*/
#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;
@@ -268,7 +268,7 @@ int main(void)
return paNoError;
error:
- 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", paInit.result() );
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( paInit.result() ) );
return 1;
diff --git a/3rdparty/portaudio/examples/paex_wmme_ac3.c b/3rdparty/portaudio/examples/paex_wmme_ac3.c
index e59c571f420..74daa96fd84 100644
--- a/3rdparty/portaudio/examples/paex_wmme_ac3.c
+++ b/3rdparty/portaudio/examples/paex_wmme_ac3.c
@@ -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: $
@@ -31,13 +31,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.
*/
@@ -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,15 +207,14 @@ int main(int argc, char* argv[])
Pa_Terminate();
free( data.buffer );
printf("Test finished.\n");
-
+
return err;
error:
Pa_Terminate();
free( data.buffer );
- 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 err;
}
-
diff --git a/3rdparty/portaudio/examples/paex_wmme_surround.c b/3rdparty/portaudio/examples/paex_wmme_surround.c
index ddab73da0d1..55fc2551316 100644
--- a/3rdparty/portaudio/examples/paex_wmme_surround.c
+++ b/3rdparty/portaudio/examples/paex_wmme_surround.c
@@ -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: $
@@ -31,13 +31,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.
*/
@@ -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,13 +199,12 @@ int main(int argc, char* argv[])
Pa_Terminate();
printf("Test finished.\n");
-
+
return err;
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 err;
}
-
diff --git a/3rdparty/portaudio/examples/paex_write_sine.c b/3rdparty/portaudio/examples/paex_write_sine.c
index f5ead3fb956..3035b42ba92 100644
--- a/3rdparty/portaudio/examples/paex_write_sine.c
+++ b/3rdparty/portaudio/examples/paex_write_sine.c
@@ -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>
*/
/*
@@ -32,13 +32,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.
*/
@@ -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 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 ) );
- // 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;
}
diff --git a/3rdparty/portaudio/examples/paex_write_sine_nonint.c b/3rdparty/portaudio/examples/paex_write_sine_nonint.c
index 3a038e18588..db78ed74d35 100644
--- a/3rdparty/portaudio/examples/paex_write_sine_nonint.c
+++ b/3rdparty/portaudio/examples/paex_write_sine_nonint.c
@@ -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>
*/
/*
@@ -32,13 +32,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.
*/
@@ -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,11 +156,11 @@ int main(void)
Pa_Terminate();
printf("Test finished.\n");
-
+
return err;
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 err;