summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/portaudio/examples/paex_wmme_ac3.c
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/portaudio/examples/paex_wmme_ac3.c')
-rw-r--r--3rdparty/portaudio/examples/paex_wmme_ac3.c55
1 files changed, 27 insertions, 28 deletions
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;
}
-