pa_win_ds.c converted tabs to spaces (only a small amount of code was incorrectly using tabs).

This commit is contained in:
rbencina 2014-04-11 05:46:40 +00:00
commit 4c720adbfa

View file

@ -323,24 +323,24 @@ static double PaWinDS_GetMinSystemLatencySeconds( void )
* NT has higher latency. * NT has higher latency.
*/ */
OSVERSIONINFO osvi; OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof( osvi ); osvi.dwOSVersionInfoSize = sizeof( osvi );
GetVersionEx( &osvi ); GetVersionEx( &osvi );
DBUG(("PA - PlatformId = 0x%x\n", osvi.dwPlatformId )); DBUG(("PA - PlatformId = 0x%x\n", osvi.dwPlatformId ));
DBUG(("PA - MajorVersion = 0x%x\n", osvi.dwMajorVersion )); DBUG(("PA - MajorVersion = 0x%x\n", osvi.dwMajorVersion ));
DBUG(("PA - MinorVersion = 0x%x\n", osvi.dwMinorVersion )); DBUG(("PA - MinorVersion = 0x%x\n", osvi.dwMinorVersion ));
/* Check for NT */ /* Check for NT */
if( (osvi.dwMajorVersion == 4) && (osvi.dwPlatformId == 2) ) if( (osvi.dwMajorVersion == 4) && (osvi.dwPlatformId == 2) )
{ {
minLatencySeconds = PA_DS_WIN_NT_DEFAULT_LATENCY_; minLatencySeconds = PA_DS_WIN_NT_DEFAULT_LATENCY_;
} }
else if(osvi.dwMajorVersion >= 5) else if(osvi.dwMajorVersion >= 5)
{ {
minLatencySeconds = PA_DS_WIN_WDM_DEFAULT_LATENCY_; minLatencySeconds = PA_DS_WIN_WDM_DEFAULT_LATENCY_;
} }
else else
{ {
minLatencySeconds = PA_DS_WIN_9X_DEFAULT_LATENCY_; minLatencySeconds = PA_DS_WIN_9X_DEFAULT_LATENCY_;
} }
return minLatencySeconds; return minLatencySeconds;
} }
@ -398,7 +398,7 @@ static char *DuplicateDeviceNameString( PaUtilAllocationGroup *allocations, cons
#if !defined(_UNICODE) && !defined(UNICODE) #if !defined(_UNICODE) && !defined(UNICODE)
size_t len = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL); size_t len = WideCharToMultiByte(CP_ACP, 0, src, -1, NULL, 0, NULL, NULL);
result = (char*)PaUtil_GroupAllocateMemory( allocations, (long)(len + 1) ); result = (char*)PaUtil_GroupAllocateMemory( allocations, (long)(len + 1) );
if( result ) { if( result ) {
if (WideCharToMultiByte(CP_ACP, 0, src, -1, result, (int)len, NULL, NULL) == 0) { if (WideCharToMultiByte(CP_ACP, 0, src, -1, result, (int)len, NULL, NULL) == 0) {
result = 0; result = 0;
@ -953,7 +953,7 @@ static PaError AddOutputDeviceInfoFromDirectSound(
} }
else else
{ {
deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate; deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
} }
} }
else if( (caps.dwMinSecondarySampleRate < 1000.0) && (caps.dwMaxSecondarySampleRate > 50000.0) ) else if( (caps.dwMinSecondarySampleRate < 1000.0) && (caps.dwMaxSecondarySampleRate > 50000.0) )
@ -1362,13 +1362,13 @@ static PaError ValidateWinDirectSoundSpecificStreamInfo(
const PaStreamParameters *streamParameters, const PaStreamParameters *streamParameters,
const PaWinDirectSoundStreamInfo *streamInfo ) const PaWinDirectSoundStreamInfo *streamInfo )
{ {
if( streamInfo ) if( streamInfo )
{ {
if( streamInfo->size != sizeof( PaWinDirectSoundStreamInfo ) if( streamInfo->size != sizeof( PaWinDirectSoundStreamInfo )
|| streamInfo->version != 2 ) || streamInfo->version != 2 )
{ {
return paIncompatibleHostApiSpecificStreamInfo; return paIncompatibleHostApiSpecificStreamInfo;
} }
if( streamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters ) if( streamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
{ {
@ -1376,9 +1376,9 @@ static PaError ValidateWinDirectSoundSpecificStreamInfo(
return paIncompatibleHostApiSpecificStreamInfo; return paIncompatibleHostApiSpecificStreamInfo;
} }
} }
return paNoError; return paNoError;
} }
/***********************************************************************************/ /***********************************************************************************/
@ -1415,8 +1415,8 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
/* validate inputStreamInfo */ /* validate inputStreamInfo */
inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo; inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo;
result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo ); result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
if( result != paNoError ) return result; if( result != paNoError ) return result;
} }
else else
{ {
@ -1444,8 +1444,8 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
/* validate outputStreamInfo */ /* validate outputStreamInfo */
outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo; outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo;
result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo ); result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
if( result != paNoError ) return result; if( result != paNoError ) return result;
} }
else else
{ {
@ -1902,8 +1902,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
/* validate hostApiSpecificStreamInfo */ /* validate hostApiSpecificStreamInfo */
inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo; inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo;
result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo ); result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
if( result != paNoError ) return result; if( result != paNoError ) return result;
if( inputStreamInfo && inputStreamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters ) if( inputStreamInfo && inputStreamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
userRequestedHostInputBufferSizeFrames = inputStreamInfo->framesPerBuffer; userRequestedHostInputBufferSizeFrames = inputStreamInfo->framesPerBuffer;
@ -1916,7 +1916,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
else else
{ {
inputChannelCount = 0; inputChannelCount = 0;
inputSampleFormat = 0; inputSampleFormat = 0;
suggestedInputLatencyFrames = 0; suggestedInputLatencyFrames = 0;
} }
@ -1942,8 +1942,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
/* validate hostApiSpecificStreamInfo */ /* validate hostApiSpecificStreamInfo */
outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo; outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo;
result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo ); result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
if( result != paNoError ) return result; if( result != paNoError ) return result;
if( outputStreamInfo && outputStreamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters ) if( outputStreamInfo && outputStreamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
userRequestedHostOutputBufferSizeFrames = outputStreamInfo->framesPerBuffer; userRequestedHostOutputBufferSizeFrames = outputStreamInfo->framesPerBuffer;
@ -1956,7 +1956,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
else else
{ {
outputChannelCount = 0; outputChannelCount = 0;
outputSampleFormat = 0; outputSampleFormat = 0;
suggestedOutputLatencyFrames = 0; suggestedOutputLatencyFrames = 0;
} }
@ -2037,10 +2037,10 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
hostInputSampleFormat = hostInputSampleFormat =
PaUtil_SelectClosestAvailableFormat( nativeInputFormats, inputParameters->sampleFormat ); PaUtil_SelectClosestAvailableFormat( nativeInputFormats, inputParameters->sampleFormat );
} }
else else
{ {
hostInputSampleFormat = 0; hostInputSampleFormat = 0;
} }
if( outputParameters ) if( outputParameters )
{ {
@ -2052,9 +2052,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
PaUtil_SelectClosestAvailableFormat( nativeOutputFormats, outputParameters->sampleFormat ); PaUtil_SelectClosestAvailableFormat( nativeOutputFormats, outputParameters->sampleFormat );
} }
else else
{ {
hostOutputSampleFormat = 0; hostOutputSampleFormat = 0;
} }
result = PaUtil_InitializeBufferProcessor( &stream->bufferProcessor, result = PaUtil_InitializeBufferProcessor( &stream->bufferProcessor,
inputChannelCount, inputSampleFormat, hostInputSampleFormat, inputChannelCount, inputSampleFormat, hostInputSampleFormat,
@ -2097,7 +2097,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
#endif #endif
#ifndef PA_WIN_DS_USE_WMME_TIMER #ifndef PA_WIN_DS_USE_WMME_TIMER
stream->processingThreadCompleted = CreateEvent( NULL, /* bManualReset = */ TRUE, /* bInitialState = */ FALSE, NULL ); stream->processingThreadCompleted = CreateEvent( NULL, /* bManualReset = */ TRUE, /* bInitialState = */ FALSE, NULL );
if( stream->processingThreadCompleted == NULL ) if( stream->processingThreadCompleted == NULL )
{ {
result = paUnanticipatedHostError; result = paUnanticipatedHostError;
@ -2497,8 +2497,8 @@ static int TimeSlice( PaWinDsStream *stream )
framesToXfer = numOutFramesReady = bytesEmpty / stream->outputFrameSizeBytes; framesToXfer = numOutFramesReady = bytesEmpty / stream->outputFrameSizeBytes;
/* Check for underflow */ /* Check for underflow */
/* FIXME QueryOutputSpace should not adjust underflow count as a side effect. /* FIXME QueryOutputSpace should not adjust underflow count as a side effect.
A query function should be a const operator on the stream and return a flag on underflow. */ A query function should be a const operator on the stream and return a flag on underflow. */
if( stream->outputUnderflowCount != previousUnderflowCount ) if( stream->outputUnderflowCount != previousUnderflowCount )
stream->callbackFlags |= paOutputUnderflow; stream->callbackFlags |= paOutputUnderflow;
@ -2563,8 +2563,8 @@ static int TimeSlice( PaWinDsStream *stream )
if( stream->bufferProcessor.outputChannelCount > 0 ) if( stream->bufferProcessor.outputChannelCount > 0 )
{ {
/* /*
We don't currently add outputLatency here because it appears to produce worse We don't currently add outputLatency here because it appears to produce worse
results than not adding it. Need to do more testing to verify this. results than not adding it. Need to do more testing to verify this.
*/ */
/* timeInfo.outputBufferDacTime = timeInfo.currentTime + outputLatency; */ /* timeInfo.outputBufferDacTime = timeInfo.currentTime + outputLatency; */
timeInfo.outputBufferDacTime = timeInfo.currentTime; timeInfo.outputBufferDacTime = timeInfo.currentTime;
@ -2813,7 +2813,7 @@ static PaError CloseStream( PaStream* s )
#endif #endif
#ifndef PA_WIN_DS_USE_WMME_TIMER #ifndef PA_WIN_DS_USE_WMME_TIMER
CloseHandle( stream->processingThreadCompleted ); CloseHandle( stream->processingThreadCompleted );
#endif #endif
// Cleanup the sound buffers // Cleanup the sound buffers
@ -2911,7 +2911,7 @@ static PaError StartStream( PaStream *s )
ResetEvent( stream->processingCompleted ); ResetEvent( stream->processingCompleted );
#ifndef PA_WIN_DS_USE_WMME_TIMER #ifndef PA_WIN_DS_USE_WMME_TIMER
ResetEvent( stream->processingThreadCompleted ); ResetEvent( stream->processingThreadCompleted );
#endif #endif
if( stream->bufferProcessor.inputChannelCount > 0 ) if( stream->bufferProcessor.inputChannelCount > 0 )
@ -3021,9 +3021,9 @@ static PaError StartStream( PaStream *s )
goto error; goto error;
} }
#else #else
/* Create processing thread which calls TimerCallback */ /* Create processing thread which calls TimerCallback */
stream->processingThread = CREATE_THREAD( 0, 0, ProcessingThreadProc, stream, 0, &stream->processingThreadId ); stream->processingThread = CREATE_THREAD( 0, 0, ProcessingThreadProc, stream, 0, &stream->processingThreadId );
if( !stream->processingThread ) if( !stream->processingThread )
{ {
result = paUnanticipatedHostError; result = paUnanticipatedHostError;
@ -3093,8 +3093,8 @@ static PaError StopStream( PaStream *s )
#else #else
if( stream->processingThread ) if( stream->processingThread )
{ {
if( WaitForSingleObject( stream->processingThreadCompleted, 30*100 ) == WAIT_TIMEOUT ) if( WaitForSingleObject( stream->processingThreadCompleted, 30*100 ) == WAIT_TIMEOUT )
return paUnanticipatedHostError; return paUnanticipatedHostError;
#ifdef CLOSE_THREAD_HANDLE #ifdef CLOSE_THREAD_HANDLE
CloseHandle( stream->processingThread ); /* Delete thread. */ CloseHandle( stream->processingThread ); /* Delete thread. */