else
{
newItems[i].lpGUID = &newItems[i].guid;
- memcpy( &newItems[i].guid, guidVector->items[i].lpGUID, sizeof(GUID) );;
+ memcpy( &newItems[i].guid, guidVector->items[i].lpGUID, sizeof(GUID) );
}
newItems[i].pnpInterface = guidVector->items[i].pnpInterface;
}
goto error;
}
+ memset( winDsHostApi, 0, sizeof(PaWinDsHostApiRepresentation) ); /* ensure all fields are zeroed. especially winDsHostApi->allocations */
+
result = PaWinUtil_CoInitialize( paDirectSound, &winDsHostApi->comInitializationResult );
if( result != paNoError )
{
TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.inputNamesAndGUIDs );
TerminateDSDeviceNameAndGUIDVector( &deviceNamesAndGUIDs.outputNamesAndGUIDs );
- Terminate( winDsHostApi );
+ Terminate( (struct PaUtilHostApiRepresentation *)winDsHostApi );
return result;
}
unsigned long suggestedOutputLatencyFrames,
double sampleRate, unsigned long userFramesPerBuffer )
{
- unsigned long minimumPollingPeriodFrames = sampleRate * PA_DS_MINIMUM_POLLING_PERIOD_SECONDS;
- unsigned long maximumPollingPeriodFrames = sampleRate * PA_DS_MAXIMUM_POLLING_PERIOD_SECONDS;
- unsigned long pollingJitterFrames = sampleRate * PA_DS_POLLING_JITTER_SECONDS;
+ unsigned long minimumPollingPeriodFrames = (unsigned long)(sampleRate * PA_DS_MINIMUM_POLLING_PERIOD_SECONDS);
+ unsigned long maximumPollingPeriodFrames = (unsigned long)(sampleRate * PA_DS_MAXIMUM_POLLING_PERIOD_SECONDS);
+ unsigned long pollingJitterFrames = (unsigned long)(sampleRate * PA_DS_POLLING_JITTER_SECONDS);
if( userFramesPerBuffer == paFramesPerBufferUnspecified )
{
unsigned long *pollingPeriodFrames,
double sampleRate, unsigned long userFramesPerBuffer )
{
- unsigned long minimumPollingPeriodFrames = sampleRate * PA_DS_MINIMUM_POLLING_PERIOD_SECONDS;
- unsigned long maximumPollingPeriodFrames = sampleRate * PA_DS_MAXIMUM_POLLING_PERIOD_SECONDS;
- unsigned long pollingJitterFrames = sampleRate * PA_DS_POLLING_JITTER_SECONDS;
+ unsigned long minimumPollingPeriodFrames = (unsigned long)(sampleRate * PA_DS_MINIMUM_POLLING_PERIOD_SECONDS);
+ unsigned long maximumPollingPeriodFrames = (unsigned long)(sampleRate * PA_DS_MAXIMUM_POLLING_PERIOD_SECONDS);
+ unsigned long pollingJitterFrames = (unsigned long)(sampleRate * PA_DS_POLLING_JITTER_SECONDS);
*pollingPeriodFrames = max( max(1, userFramesPerBuffer / 4), hostBufferSizeFrames / 16 );
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. */
if( stream->outputUnderflowCount != previousUnderflowCount )
stream->callbackFlags |= paOutputUnderflow;
{
/*
We don't currently add outputLatency here because it appears to produce worse
- results than non 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;
LARGE_INTEGER dueTime;
int timerPeriodMs;
- timerPeriodMs = stream->pollingPeriodSeconds * MSECS_PER_SECOND;
+ timerPeriodMs = (int)(stream->pollingPeriodSeconds * MSECS_PER_SECOND);
if( timerPeriodMs < 1 )
timerPeriodMs = 1;
if( stream->streamRepresentation.streamCallback )
{
TIMECAPS timecaps;
- int timerPeriodMs = stream->pollingPeriodSeconds * MSECS_PER_SECOND;
+ int timerPeriodMs = (int)(stream->pollingPeriodSeconds * MSECS_PER_SECOND);
if( timerPeriodMs < 1 )
timerPeriodMs = 1;
if( timeGetDevCaps( &timecaps, sizeof(TIMECAPS) == MMSYSERR_NOERROR && timecaps.wPeriodMin > 0 ) )
{
/* aim for resolution 4 times higher than polling rate */
- stream->systemTimerResolutionPeriodMs = (stream->pollingPeriodSeconds * MSECS_PER_SECOND) / 4;
+ stream->systemTimerResolutionPeriodMs = (UINT)((stream->pollingPeriodSeconds * MSECS_PER_SECOND) * .25);
if( stream->systemTimerResolutionPeriodMs < timecaps.wPeriodMin )
stream->systemTimerResolutionPeriodMs = timecaps.wPeriodMin;
if( stream->systemTimerResolutionPeriodMs > timecaps.wPeriodMax )