Clean up whitespace in pa_asio.cpp in preparation for .editorconfig. Convert tabs to 4 spaces. Indent by 4 spaces. Strip trailing whitespace. Ensure EOL at EOF. (#411)
This commit is contained in:
parent
80c5f27120
commit
f476839ab8
1 changed files with 173 additions and 173 deletions
|
|
@ -942,7 +942,7 @@ PaError PaAsio_GetAvailableBufferSizes( PaDeviceIndex device,
|
|||
*/
|
||||
static void UnloadAsioDriver( void )
|
||||
{
|
||||
ASIOExit();
|
||||
ASIOExit();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1005,9 +1005,9 @@ static PaError LoadAsioDriver( PaAsioHostApiRepresentation *asioHostApi, const c
|
|||
|
||||
error:
|
||||
if( asioIsInitialized )
|
||||
{
|
||||
ASIOExit();
|
||||
}
|
||||
{
|
||||
ASIOExit();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1332,8 +1332,8 @@ PaError PaAsio_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex
|
|||
(*hostApi)->deviceInfos[ (*hostApi)->info.deviceCount ] = deviceInfo;
|
||||
++(*hostApi)->info.deviceCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
PA_DEBUG(("Skipping ASIO device:%s\n",names[i]));
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1683,13 +1683,13 @@ static unsigned long NextPowerOfTwo( unsigned long x )
|
|||
static unsigned long SelectHostBufferSizeForUnspecifiedUserFramesPerBuffer(
|
||||
unsigned long targetBufferingLatencyFrames, PaAsioDriverInfo *driverInfo )
|
||||
{
|
||||
/* Choose a host buffer size based only on targetBufferingLatencyFrames and the
|
||||
device's supported buffer sizes. Always returns a valid value.
|
||||
*/
|
||||
/* Choose a host buffer size based only on targetBufferingLatencyFrames and the
|
||||
device's supported buffer sizes. Always returns a valid value.
|
||||
*/
|
||||
|
||||
unsigned long result;
|
||||
unsigned long result;
|
||||
|
||||
if( targetBufferingLatencyFrames <= (unsigned long)driverInfo->bufferMinSize )
|
||||
if( targetBufferingLatencyFrames <= (unsigned long)driverInfo->bufferMinSize )
|
||||
{
|
||||
result = driverInfo->bufferMinSize;
|
||||
}
|
||||
|
|
@ -1699,7 +1699,7 @@ static unsigned long SelectHostBufferSizeForUnspecifiedUserFramesPerBuffer(
|
|||
}
|
||||
else
|
||||
{
|
||||
if( driverInfo->bufferGranularity == 0 ) /* single fixed host buffer size */
|
||||
if( driverInfo->bufferGranularity == 0 ) /* single fixed host buffer size */
|
||||
{
|
||||
/* The documentation states that bufferGranularity should be zero
|
||||
when bufferMinSize, bufferMaxSize and bufferPreferredSize are the
|
||||
|
|
@ -1708,9 +1708,9 @@ static unsigned long SelectHostBufferSizeForUnspecifiedUserFramesPerBuffer(
|
|||
|
||||
result = driverInfo->bufferPreferredSize;
|
||||
}
|
||||
else if( driverInfo->bufferGranularity == -1 ) /* power-of-two */
|
||||
else if( driverInfo->bufferGranularity == -1 ) /* power-of-two */
|
||||
{
|
||||
/* We assume bufferMinSize and bufferMaxSize are powers of two. */
|
||||
/* We assume bufferMinSize and bufferMaxSize are powers of two. */
|
||||
|
||||
result = NextPowerOfTwo( targetBufferingLatencyFrames );
|
||||
|
||||
|
|
@ -1736,7 +1736,7 @@ static unsigned long SelectHostBufferSizeForUnspecifiedUserFramesPerBuffer(
|
|||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1744,31 +1744,31 @@ static unsigned long SelectHostBufferSizeForSpecifiedUserFramesPerBuffer(
|
|||
unsigned long targetBufferingLatencyFrames, unsigned long userFramesPerBuffer,
|
||||
PaAsioDriverInfo *driverInfo )
|
||||
{
|
||||
/* Select a host buffer size conforming to targetBufferingLatencyFrames
|
||||
and the device's supported buffer sizes.
|
||||
The return value will always be a multiple of userFramesPerBuffer.
|
||||
If a valid buffer size can not be found the function returns 0.
|
||||
/* Select a host buffer size conforming to targetBufferingLatencyFrames
|
||||
and the device's supported buffer sizes.
|
||||
The return value will always be a multiple of userFramesPerBuffer.
|
||||
If a valid buffer size can not be found the function returns 0.
|
||||
|
||||
The current implementation uses a simple iterative search for clarity.
|
||||
Feel free to suggest a closed form solution.
|
||||
*/
|
||||
unsigned long result = 0;
|
||||
The current implementation uses a simple iterative search for clarity.
|
||||
Feel free to suggest a closed form solution.
|
||||
*/
|
||||
unsigned long result = 0;
|
||||
|
||||
assert( userFramesPerBuffer != 0 );
|
||||
assert( userFramesPerBuffer != 0 );
|
||||
|
||||
if( driverInfo->bufferGranularity == 0 ) /* single fixed host buffer size */
|
||||
if( driverInfo->bufferGranularity == 0 ) /* single fixed host buffer size */
|
||||
{
|
||||
/* The documentation states that bufferGranularity should be zero
|
||||
when bufferMinSize, bufferMaxSize and bufferPreferredSize are the
|
||||
same. We assume that is the case.
|
||||
*/
|
||||
|
||||
if( (driverInfo->bufferPreferredSize % userFramesPerBuffer) == 0 )
|
||||
result = driverInfo->bufferPreferredSize;
|
||||
if( (driverInfo->bufferPreferredSize % userFramesPerBuffer) == 0 )
|
||||
result = driverInfo->bufferPreferredSize;
|
||||
}
|
||||
else if( driverInfo->bufferGranularity == -1 ) /* power-of-two */
|
||||
else if( driverInfo->bufferGranularity == -1 ) /* power-of-two */
|
||||
{
|
||||
/* We assume bufferMinSize and bufferMaxSize are powers of two. */
|
||||
/* We assume bufferMinSize and bufferMaxSize are powers of two. */
|
||||
|
||||
/* Search all powers of two in the range [bufferMinSize,bufferMaxSize]
|
||||
for multiples of userFramesPerBuffer. We prefer the first multiple
|
||||
|
|
@ -1777,21 +1777,21 @@ static unsigned long SelectHostBufferSizeForSpecifiedUserFramesPerBuffer(
|
|||
targetBufferingLatencyFrames.
|
||||
*/
|
||||
unsigned long x = (unsigned long)driverInfo->bufferMinSize;
|
||||
do {
|
||||
if( (x % userFramesPerBuffer) == 0 )
|
||||
{
|
||||
do {
|
||||
if( (x % userFramesPerBuffer) == 0 )
|
||||
{
|
||||
/* any multiple of userFramesPerBuffer is acceptable */
|
||||
result = x;
|
||||
if( result >= targetBufferingLatencyFrames )
|
||||
break; /* stop. a value >= to targetBufferingLatencyFrames is ideal. */
|
||||
}
|
||||
result = x;
|
||||
if( result >= targetBufferingLatencyFrames )
|
||||
break; /* stop. a value >= to targetBufferingLatencyFrames is ideal. */
|
||||
}
|
||||
|
||||
x *= 2;
|
||||
} while( x <= (unsigned long)driverInfo->bufferMaxSize );
|
||||
x *= 2;
|
||||
} while( x <= (unsigned long)driverInfo->bufferMaxSize );
|
||||
}
|
||||
else /* modulo granularity */
|
||||
{
|
||||
/* We assume bufferMinSize is a multiple of bufferGranularity. */
|
||||
/* We assume bufferMinSize is a multiple of bufferGranularity. */
|
||||
|
||||
/* Search all multiples of bufferGranularity in the range
|
||||
[bufferMinSize,bufferMaxSize] for multiples of userFramesPerBuffer.
|
||||
|
|
@ -1799,21 +1799,21 @@ static unsigned long SelectHostBufferSizeForSpecifiedUserFramesPerBuffer(
|
|||
targetBufferingLatencyFrames, or failing that, the largest multiple
|
||||
less than targetBufferingLatencyFrames.
|
||||
*/
|
||||
unsigned long x = (unsigned long)driverInfo->bufferMinSize;
|
||||
do {
|
||||
if( (x % userFramesPerBuffer) == 0 )
|
||||
{
|
||||
unsigned long x = (unsigned long)driverInfo->bufferMinSize;
|
||||
do {
|
||||
if( (x % userFramesPerBuffer) == 0 )
|
||||
{
|
||||
/* any multiple of userFramesPerBuffer is acceptable */
|
||||
result = x;
|
||||
if( result >= targetBufferingLatencyFrames )
|
||||
break; /* stop. a value >= to targetBufferingLatencyFrames is ideal. */
|
||||
}
|
||||
result = x;
|
||||
if( result >= targetBufferingLatencyFrames )
|
||||
break; /* stop. a value >= to targetBufferingLatencyFrames is ideal. */
|
||||
}
|
||||
|
||||
x += driverInfo->bufferGranularity;
|
||||
} while( x <= (unsigned long)driverInfo->bufferMaxSize );
|
||||
x += driverInfo->bufferGranularity;
|
||||
} while( x <= (unsigned long)driverInfo->bufferMaxSize );
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1847,26 +1847,26 @@ static unsigned long SelectHostBufferSize(
|
|||
(1) and (2) should be chosen.
|
||||
*/
|
||||
|
||||
if( userFramesPerBuffer != 0 )
|
||||
{
|
||||
/* userFramesPerBuffer is specified, try to find a buffer size that's
|
||||
if( userFramesPerBuffer != 0 )
|
||||
{
|
||||
/* userFramesPerBuffer is specified, try to find a buffer size that's
|
||||
a multiple of it */
|
||||
result = SelectHostBufferSizeForSpecifiedUserFramesPerBuffer(
|
||||
result = SelectHostBufferSizeForSpecifiedUserFramesPerBuffer(
|
||||
targetBufferingLatencyFrames, userFramesPerBuffer, driverInfo );
|
||||
}
|
||||
}
|
||||
|
||||
if( result == 0 )
|
||||
{
|
||||
/* either userFramesPerBuffer was not specified, or we couldn't find a
|
||||
if( result == 0 )
|
||||
{
|
||||
/* either userFramesPerBuffer was not specified, or we couldn't find a
|
||||
host buffer size that is a multiple of it. Select a host buffer size
|
||||
according to targetBufferingLatencyFrames and the ASIO driverInfo
|
||||
buffer size constraints.
|
||||
*/
|
||||
result = SelectHostBufferSizeForUnspecifiedUserFramesPerBuffer(
|
||||
*/
|
||||
result = SelectHostBufferSizeForUnspecifiedUserFramesPerBuffer(
|
||||
targetBufferingLatencyFrames, driverInfo );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1893,10 +1893,10 @@ static PaError ValidateAsioSpecificStreamInfo(
|
|||
return paIncompatibleHostApiSpecificStreamInfo;
|
||||
|
||||
for( int i=0; i < streamParameters->channelCount; ++i ){
|
||||
if( (*channelSelectors)[i] < 0
|
||||
if( (*channelSelectors)[i] < 0
|
||||
|| (*channelSelectors)[i] >= deviceChannelCount ){
|
||||
return paInvalidChannelCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2806,9 +2806,9 @@ error:
|
|||
ASIODisposeBuffers();
|
||||
|
||||
if( asioIsInitialized )
|
||||
{
|
||||
UnloadAsioDriver();
|
||||
}
|
||||
{
|
||||
UnloadAsioDriver();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -4124,9 +4124,9 @@ PA_DEBUG(("PaAsio_ShowControlPanel: ASIOExit(): %s\n", PaAsio_GetAsioErrorText(a
|
|||
|
||||
error:
|
||||
if( asioIsInitialized )
|
||||
{
|
||||
ASIOExit();
|
||||
}
|
||||
{
|
||||
ASIOExit();
|
||||
}
|
||||
|
||||
PaWinUtil_CoUninitialize( paASIO, &comInitializationResult );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue