* 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;
}
#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;
}
else
{
- deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
+ deviceInfo->defaultSampleRate = caps.dwMaxSecondarySampleRate;
}
}
else if( (caps.dwMinSecondarySampleRate < 1000.0) && (caps.dwMaxSecondarySampleRate > 50000.0) )
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 )
{
return paIncompatibleHostApiSpecificStreamInfo;
}
- }
+ }
- return paNoError;
+ return paNoError;
}
/***********************************************************************************/
/* 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
{
/* 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
{
/* 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;
else
{
inputChannelCount = 0;
- inputSampleFormat = 0;
+ inputSampleFormat = 0;
suggestedInputLatencyFrames = 0;
}
/* 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;
else
{
outputChannelCount = 0;
- outputSampleFormat = 0;
+ outputSampleFormat = 0;
suggestedOutputLatencyFrames = 0;
}
hostInputSampleFormat =
PaUtil_SelectClosestAvailableFormat( nativeInputFormats, inputParameters->sampleFormat );
}
- else
- {
- hostInputSampleFormat = 0;
- }
+ else
+ {
+ hostInputSampleFormat = 0;
+ }
if( outputParameters )
{
PaUtil_SelectClosestAvailableFormat( nativeOutputFormats, outputParameters->sampleFormat );
}
else
- {
- hostOutputSampleFormat = 0;
- }
+ {
+ hostOutputSampleFormat = 0;
+ }
result = PaUtil_InitializeBufferProcessor( &stream->bufferProcessor,
inputChannelCount, inputSampleFormat, hostInputSampleFormat,
#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;
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;
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;
#endif
#ifndef PA_WIN_DS_USE_WMME_TIMER
- CloseHandle( stream->processingThreadCompleted );
+ CloseHandle( stream->processingThreadCompleted );
#endif
// Cleanup the sound buffers
ResetEvent( stream->processingCompleted );
#ifndef PA_WIN_DS_USE_WMME_TIMER
- ResetEvent( stream->processingThreadCompleted );
+ ResetEvent( stream->processingThreadCompleted );
#endif
if( stream->bufferProcessor.inputChannelCount > 0 )
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;
#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. */