pa_win_ds.c converted tabs to spaces (only a small amount of code was incorrectly using tabs).
This commit is contained in:
parent
666f30ea67
commit
4c720adbfa
1 changed files with 53 additions and 53 deletions
|
|
@ -323,24 +323,24 @@ static double PaWinDS_GetMinSystemLatencySeconds( void )
|
|||
* NT has higher latency.
|
||||
*/
|
||||
OSVERSIONINFO osvi;
|
||||
osvi.dwOSVersionInfoSize = sizeof( osvi );
|
||||
GetVersionEx( &osvi );
|
||||
osvi.dwOSVersionInfoSize = sizeof( osvi );
|
||||
GetVersionEx( &osvi );
|
||||
DBUG(("PA - PlatformId = 0x%x\n", osvi.dwPlatformId ));
|
||||
DBUG(("PA - MajorVersion = 0x%x\n", osvi.dwMajorVersion ));
|
||||
DBUG(("PA - MinorVersion = 0x%x\n", osvi.dwMinorVersion ));
|
||||
/* Check for NT */
|
||||
if( (osvi.dwMajorVersion == 4) && (osvi.dwPlatformId == 2) )
|
||||
{
|
||||
minLatencySeconds = PA_DS_WIN_NT_DEFAULT_LATENCY_;
|
||||
}
|
||||
else if(osvi.dwMajorVersion >= 5)
|
||||
{
|
||||
minLatencySeconds = PA_DS_WIN_WDM_DEFAULT_LATENCY_;
|
||||
}
|
||||
else
|
||||
{
|
||||
minLatencySeconds = PA_DS_WIN_9X_DEFAULT_LATENCY_;
|
||||
}
|
||||
if( (osvi.dwMajorVersion == 4) && (osvi.dwPlatformId == 2) )
|
||||
{
|
||||
minLatencySeconds = PA_DS_WIN_NT_DEFAULT_LATENCY_;
|
||||
}
|
||||
else if(osvi.dwMajorVersion >= 5)
|
||||
{
|
||||
minLatencySeconds = PA_DS_WIN_WDM_DEFAULT_LATENCY_;
|
||||
}
|
||||
else
|
||||
{
|
||||
minLatencySeconds = PA_DS_WIN_9X_DEFAULT_LATENCY_;
|
||||
}
|
||||
return minLatencySeconds;
|
||||
}
|
||||
|
||||
|
|
@ -398,7 +398,7 @@ static char *DuplicateDeviceNameString( PaUtilAllocationGroup *allocations, cons
|
|||
#if !defined(_UNICODE) && !defined(UNICODE)
|
||||
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 (WideCharToMultiByte(CP_ACP, 0, src, -1, result, (int)len, NULL, NULL) == 0) {
|
||||
result = 0;
|
||||
|
|
@ -953,7 +953,7 @@ static PaError AddOutputDeviceInfoFromDirectSound(
|
|||
}
|
||||
else
|
||||
{
|
||||
deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
|
||||
deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
|
||||
}
|
||||
}
|
||||
else if( (caps.dwMinSecondarySampleRate < 1000.0) && (caps.dwMaxSecondarySampleRate > 50000.0) )
|
||||
|
|
@ -1362,13 +1362,13 @@ static PaError ValidateWinDirectSoundSpecificStreamInfo(
|
|||
const PaStreamParameters *streamParameters,
|
||||
const PaWinDirectSoundStreamInfo *streamInfo )
|
||||
{
|
||||
if( streamInfo )
|
||||
{
|
||||
if( streamInfo->size != sizeof( PaWinDirectSoundStreamInfo )
|
||||
|| streamInfo->version != 2 )
|
||||
{
|
||||
return paIncompatibleHostApiSpecificStreamInfo;
|
||||
}
|
||||
if( streamInfo )
|
||||
{
|
||||
if( streamInfo->size != sizeof( PaWinDirectSoundStreamInfo )
|
||||
|| streamInfo->version != 2 )
|
||||
{
|
||||
return paIncompatibleHostApiSpecificStreamInfo;
|
||||
}
|
||||
|
||||
if( streamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
|
||||
{
|
||||
|
|
@ -1376,9 +1376,9 @@ static PaError ValidateWinDirectSoundSpecificStreamInfo(
|
|||
return paIncompatibleHostApiSpecificStreamInfo;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return paNoError;
|
||||
return paNoError;
|
||||
}
|
||||
|
||||
/***********************************************************************************/
|
||||
|
|
@ -1415,8 +1415,8 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
|
|||
|
||||
/* validate inputStreamInfo */
|
||||
inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo;
|
||||
result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
|
||||
if( result != paNoError ) return result;
|
||||
result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
|
||||
if( result != paNoError ) return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1444,8 +1444,8 @@ static PaError IsFormatSupported( struct PaUtilHostApiRepresentation *hostApi,
|
|||
|
||||
/* validate outputStreamInfo */
|
||||
outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo;
|
||||
result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
|
||||
if( result != paNoError ) return result;
|
||||
result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
|
||||
if( result != paNoError ) return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1902,8 +1902,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
|
|||
|
||||
/* validate hostApiSpecificStreamInfo */
|
||||
inputStreamInfo = (PaWinDirectSoundStreamInfo*)inputParameters->hostApiSpecificStreamInfo;
|
||||
result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
|
||||
if( result != paNoError ) return result;
|
||||
result = ValidateWinDirectSoundSpecificStreamInfo( inputParameters, inputStreamInfo );
|
||||
if( result != paNoError ) return result;
|
||||
|
||||
if( inputStreamInfo && inputStreamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
|
||||
userRequestedHostInputBufferSizeFrames = inputStreamInfo->framesPerBuffer;
|
||||
|
|
@ -1916,7 +1916,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
|
|||
else
|
||||
{
|
||||
inputChannelCount = 0;
|
||||
inputSampleFormat = 0;
|
||||
inputSampleFormat = 0;
|
||||
suggestedInputLatencyFrames = 0;
|
||||
}
|
||||
|
||||
|
|
@ -1942,8 +1942,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
|
|||
|
||||
/* validate hostApiSpecificStreamInfo */
|
||||
outputStreamInfo = (PaWinDirectSoundStreamInfo*)outputParameters->hostApiSpecificStreamInfo;
|
||||
result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
|
||||
if( result != paNoError ) return result;
|
||||
result = ValidateWinDirectSoundSpecificStreamInfo( outputParameters, outputStreamInfo );
|
||||
if( result != paNoError ) return result;
|
||||
|
||||
if( outputStreamInfo && outputStreamInfo->flags & paWinDirectSoundUseLowLevelLatencyParameters )
|
||||
userRequestedHostOutputBufferSizeFrames = outputStreamInfo->framesPerBuffer;
|
||||
|
|
@ -1956,7 +1956,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
|
|||
else
|
||||
{
|
||||
outputChannelCount = 0;
|
||||
outputSampleFormat = 0;
|
||||
outputSampleFormat = 0;
|
||||
suggestedOutputLatencyFrames = 0;
|
||||
}
|
||||
|
||||
|
|
@ -2037,10 +2037,10 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
|
|||
hostInputSampleFormat =
|
||||
PaUtil_SelectClosestAvailableFormat( nativeInputFormats, inputParameters->sampleFormat );
|
||||
}
|
||||
else
|
||||
{
|
||||
hostInputSampleFormat = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
hostInputSampleFormat = 0;
|
||||
}
|
||||
|
||||
if( outputParameters )
|
||||
{
|
||||
|
|
@ -2052,9 +2052,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
|
|||
PaUtil_SelectClosestAvailableFormat( nativeOutputFormats, outputParameters->sampleFormat );
|
||||
}
|
||||
else
|
||||
{
|
||||
hostOutputSampleFormat = 0;
|
||||
}
|
||||
{
|
||||
hostOutputSampleFormat = 0;
|
||||
}
|
||||
|
||||
result = PaUtil_InitializeBufferProcessor( &stream->bufferProcessor,
|
||||
inputChannelCount, inputSampleFormat, hostInputSampleFormat,
|
||||
|
|
@ -2097,7 +2097,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
|
|||
#endif
|
||||
|
||||
#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 )
|
||||
{
|
||||
result = paUnanticipatedHostError;
|
||||
|
|
@ -2497,8 +2497,8 @@ static int TimeSlice( PaWinDsStream *stream )
|
|||
framesToXfer = numOutFramesReady = bytesEmpty / stream->outputFrameSizeBytes;
|
||||
|
||||
/* Check for underflow */
|
||||
/* 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. */
|
||||
/* 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. */
|
||||
if( stream->outputUnderflowCount != previousUnderflowCount )
|
||||
stream->callbackFlags |= paOutputUnderflow;
|
||||
|
||||
|
|
@ -2563,8 +2563,8 @@ static int TimeSlice( PaWinDsStream *stream )
|
|||
if( stream->bufferProcessor.outputChannelCount > 0 )
|
||||
{
|
||||
/*
|
||||
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.
|
||||
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.
|
||||
*/
|
||||
/* timeInfo.outputBufferDacTime = timeInfo.currentTime + outputLatency; */
|
||||
timeInfo.outputBufferDacTime = timeInfo.currentTime;
|
||||
|
|
@ -2813,7 +2813,7 @@ static PaError CloseStream( PaStream* s )
|
|||
#endif
|
||||
|
||||
#ifndef PA_WIN_DS_USE_WMME_TIMER
|
||||
CloseHandle( stream->processingThreadCompleted );
|
||||
CloseHandle( stream->processingThreadCompleted );
|
||||
#endif
|
||||
|
||||
// Cleanup the sound buffers
|
||||
|
|
@ -2911,7 +2911,7 @@ static PaError StartStream( PaStream *s )
|
|||
ResetEvent( stream->processingCompleted );
|
||||
|
||||
#ifndef PA_WIN_DS_USE_WMME_TIMER
|
||||
ResetEvent( stream->processingThreadCompleted );
|
||||
ResetEvent( stream->processingThreadCompleted );
|
||||
#endif
|
||||
|
||||
if( stream->bufferProcessor.inputChannelCount > 0 )
|
||||
|
|
@ -3021,9 +3021,9 @@ static PaError StartStream( PaStream *s )
|
|||
goto error;
|
||||
}
|
||||
#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 )
|
||||
{
|
||||
result = paUnanticipatedHostError;
|
||||
|
|
@ -3093,8 +3093,8 @@ static PaError StopStream( PaStream *s )
|
|||
#else
|
||||
if( stream->processingThread )
|
||||
{
|
||||
if( WaitForSingleObject( stream->processingThreadCompleted, 30*100 ) == WAIT_TIMEOUT )
|
||||
return paUnanticipatedHostError;
|
||||
if( WaitForSingleObject( stream->processingThreadCompleted, 30*100 ) == WAIT_TIMEOUT )
|
||||
return paUnanticipatedHostError;
|
||||
|
||||
#ifdef CLOSE_THREAD_HANDLE
|
||||
CloseHandle( stream->processingThread ); /* Delete thread. */
|
||||
|
|
|
|||
Loading…
Reference in a new issue