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

@ -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. */