address all problems picked up by cmakelint except for line-length related comments. don't use min() in paex_record_file as it is a macro specific to windows.

This commit is contained in:
Nick Appleton 2016-09-15 22:52:44 +10:00
commit 0c10cb6c0c
3 changed files with 48 additions and 39 deletions

View file

@ -20,7 +20,9 @@ ENDMACRO(ADD_EXAMPLE_CPP)
ADD_EXAMPLE(pa_devs)
ADD_EXAMPLE(pa_fuzz)
ADD_EXAMPLE(paex_mono_asio_channel_select)
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)
@ -31,7 +33,9 @@ TARGET_INCLUDE_DIRECTORIES(paex_record_file PRIVATE ../src/common)
ADD_EXAMPLE(paex_saw)
ADD_EXAMPLE(paex_sine)
ADD_EXAMPLE_CPP(paex_sine_c++)
ADD_EXAMPLE(paex_wmme_ac3)
ADD_EXAMPLE(paex_wmme_surround)
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)

View file

@ -52,6 +52,11 @@
#include <process.h>
#endif
static ring_buffer_size_t rbs_min(ring_buffer_size_t a, ring_buffer_size_t b)
{
return (a < b) ? a : b;
}
/* #define SAMPLE_RATE (17932) // Test failure to open with this value. */
#define FILE_NAME "audio_data.raw"
#define SAMPLE_RATE (44100)
@ -243,7 +248,7 @@ static int recordCallback( const void *inputBuffer, void *outputBuffer,
{
paTestData *data = (paTestData*)userData;
ring_buffer_size_t elementsWriteable = PaUtil_GetRingBufferWriteAvailable(&data->ringBuffer);
ring_buffer_size_t elementsToWrite = min(elementsWriteable, (ring_buffer_size_t)(framesPerBuffer * NUM_CHANNELS));
ring_buffer_size_t elementsToWrite = rbs_min(elementsWriteable, (ring_buffer_size_t)(framesPerBuffer * NUM_CHANNELS));
const SAMPLE *rptr = (const SAMPLE*)inputBuffer;
(void) outputBuffer; /* Prevent unused variable warnings. */
@ -268,7 +273,7 @@ static int playCallback( const void *inputBuffer, void *outputBuffer,
{
paTestData *data = (paTestData*)userData;
ring_buffer_size_t elementsToPlay = PaUtil_GetRingBufferReadAvailable(&data->ringBuffer);
ring_buffer_size_t elementsToRead = min(elementsToPlay, (ring_buffer_size_t)(framesPerBuffer * NUM_CHANNELS));
ring_buffer_size_t elementsToRead = rbs_min(elementsToPlay, (ring_buffer_size_t)(framesPerBuffer * NUM_CHANNELS));
SAMPLE* wptr = (SAMPLE*)outputBuffer;
(void) inputBuffer; /* Prevent unused variable warnings. */