From: aknudsen Date: Wed, 3 Jun 2009 18:57:56 +0000 (+0000) Subject: Fix latency calculation in PA ALSA X-Git-Tag: svn/1415^0 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=a9238346fef6dca2ffdf3d9eca3a88ac5f43abd8;p=portaudio Fix latency calculation in PA ALSA --- diff --git a/src/hostapi/alsa/pa_linux_alsa.c b/src/hostapi/alsa/pa_linux_alsa.c index 18e246e..cb80702 100644 --- a/src/hostapi/alsa/pa_linux_alsa.c +++ b/src/hostapi/alsa/pa_linux_alsa.c @@ -2003,11 +2003,11 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, /* Ok, buffer processor is initialized, now we can deduce it's latency */ if( numInputChannels > 0 ) - stream->streamRepresentation.streamInfo.inputLatency = inputLatency + PaUtil_GetBufferProcessorInputLatency( - &stream->bufferProcessor ); + stream->streamRepresentation.streamInfo.inputLatency = inputLatency + (PaTime)( + PaUtil_GetBufferProcessorInputLatency( &stream->bufferProcessor ) / sampleRate); if( numOutputChannels > 0 ) - stream->streamRepresentation.streamInfo.outputLatency = outputLatency + PaUtil_GetBufferProcessorOutputLatency( - &stream->bufferProcessor ); + stream->streamRepresentation.streamInfo.outputLatency = outputLatency + (PaTime)( + PaUtil_GetBufferProcessorOutputLatency( &stream->bufferProcessor ) / sampleRate); *s = (PaStream*)stream;