From cbd24dc45c8afab666da19c0a8b28f8e7f3f3151 Mon Sep 17 00:00:00 2001 From: rossb Date: Mon, 2 May 2011 17:07:11 +0000 Subject: [PATCH] renamed PaUtil_GetBufferProcessorInputLatency to PaUtil_GetBufferProcessorInputLatencyFrames and PaUtil_GetBufferProcessorOutputLatency to PaUtil_GetBufferProcessorOutputLatencyFrames. see ticket #161 --- src/common/pa_process.c | 4 +-- src/common/pa_process.h | 12 ++++---- src/hostapi/alsa/pa_linux_alsa.c | 4 +-- src/hostapi/asihpi/pa_linux_asihpi.c | 4 +-- src/hostapi/asio/pa_asio.cpp | 36 +++++++++++----------- src/hostapi/coreaudio/pa_mac_core.c | 4 +-- src/hostapi/dsound/pa_win_ds.c | 4 +-- src/hostapi/jack/pa_jack.c | 4 +-- src/hostapi/oss/pa_unix_oss.c | 4 +-- src/hostapi/skeleton/pa_hostapi_skeleton.c | 4 +-- src/hostapi/wasapi/pa_win_wasapi.c | 4 +-- src/hostapi/wmme/pa_win_wmme.c | 4 +-- 12 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/common/pa_process.c b/src/common/pa_process.c index 8d0500d..1f3984d 100644 --- a/src/common/pa_process.c +++ b/src/common/pa_process.c @@ -428,13 +428,13 @@ void PaUtil_ResetBufferProcessor( PaUtilBufferProcessor* bp ) } -unsigned long PaUtil_GetBufferProcessorInputLatency( PaUtilBufferProcessor* bp ) +unsigned long PaUtil_GetBufferProcessorInputLatencyFrames( PaUtilBufferProcessor* bp ) { return bp->initialFramesInTempInputBuffer; } -unsigned long PaUtil_GetBufferProcessorOutputLatency( PaUtilBufferProcessor* bp ) +unsigned long PaUtil_GetBufferProcessorOutputLatencyFrames( PaUtilBufferProcessor* bp ) { return bp->initialFramesInTempOutputBuffer; } diff --git a/src/common/pa_process.h b/src/common/pa_process.h index eb44749..37b91d7 100644 --- a/src/common/pa_process.h +++ b/src/common/pa_process.h @@ -406,25 +406,25 @@ void PaUtil_TerminateBufferProcessor( PaUtilBufferProcessor* bufferProcessor ); void PaUtil_ResetBufferProcessor( PaUtilBufferProcessor* bufferProcessor ); -/** Retrieve the input latency of a buffer processor. +/** Retrieve the input latency of a buffer processor, in frames. @param bufferProcessor The buffer processor examine. @return The input latency introduced by the buffer processor, in frames. - @see PaUtil_GetBufferProcessorOutputLatency + @see PaUtil_GetBufferProcessorOutputLatencyFrames */ -unsigned long PaUtil_GetBufferProcessorInputLatency( PaUtilBufferProcessor* bufferProcessor ); +unsigned long PaUtil_GetBufferProcessorInputLatencyFrames( PaUtilBufferProcessor* bufferProcessor ); -/** Retrieve the output latency of a buffer processor. +/** Retrieve the output latency of a buffer processor, in frames. @param bufferProcessor The buffer processor examine. @return The output latency introduced by the buffer processor, in frames. - @see PaUtil_GetBufferProcessorInputLatency + @see PaUtil_GetBufferProcessorInputLatencyFrames */ -unsigned long PaUtil_GetBufferProcessorOutputLatency( PaUtilBufferProcessor* bufferProcessor ); +unsigned long PaUtil_GetBufferProcessorOutputLatencyFrames( PaUtilBufferProcessor* bufferProcessor ); /*@}*/ diff --git a/src/hostapi/alsa/pa_linux_alsa.c b/src/hostapi/alsa/pa_linux_alsa.c index edbbc80..4b7bf4e 100644 --- a/src/hostapi/alsa/pa_linux_alsa.c +++ b/src/hostapi/alsa/pa_linux_alsa.c @@ -2768,10 +2768,10 @@ 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 + (PaTime)( - PaUtil_GetBufferProcessorInputLatency( &stream->bufferProcessor ) / sampleRate); + PaUtil_GetBufferProcessorInputLatencyFrames( &stream->bufferProcessor ) / sampleRate); if( numOutputChannels > 0 ) stream->streamRepresentation.streamInfo.outputLatency = outputLatency + (PaTime)( - PaUtil_GetBufferProcessorOutputLatency( &stream->bufferProcessor ) / sampleRate); + PaUtil_GetBufferProcessorOutputLatencyFrames( &stream->bufferProcessor ) / sampleRate); PA_DEBUG(( "%s: Stream: framesPerBuffer = %lu, maxFramesPerHostBuffer = %lu, latency = i(%f)/o(%f), \n", __FUNCTION__, framesPerBuffer, stream->maxFramesPerHostBuffer, stream->streamRepresentation.streamInfo.inputLatency, stream->streamRepresentation.streamInfo.outputLatency)); diff --git a/src/hostapi/asihpi/pa_linux_asihpi.c b/src/hostapi/asihpi/pa_linux_asihpi.c index c06526d..e9627ec 100644 --- a/src/hostapi/asihpi/pa_linux_asihpi.c +++ b/src/hostapi/asihpi/pa_linux_asihpi.c @@ -1827,7 +1827,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, / sampleRate / stream->input->bytesPerFrame; stream->baseStreamRep.streamInfo.inputLatency = bufferDuration + - ((PaTime)PaUtil_GetBufferProcessorInputLatency( &stream->bufferProcessor ) - + ((PaTime)PaUtil_GetBufferProcessorInputLatencyFrames( &stream->bufferProcessor ) - stream->maxFramesPerHostBuffer) / sampleRate; assert( stream->baseStreamRep.streamInfo.inputLatency > 0.0 ); } @@ -1844,7 +1844,7 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, } stream->baseStreamRep.streamInfo.outputLatency = bufferDuration + - ((PaTime)PaUtil_GetBufferProcessorOutputLatency( &stream->bufferProcessor ) - + ((PaTime)PaUtil_GetBufferProcessorOutputLatencyFrames( &stream->bufferProcessor ) - stream->maxFramesPerHostBuffer) / sampleRate; assert( stream->baseStreamRep.streamInfo.outputLatency > 0.0 ); } diff --git a/src/hostapi/asio/pa_asio.cpp b/src/hostapi/asio/pa_asio.cpp index a641093..19f7a21 100644 --- a/src/hostapi/asio/pa_asio.cpp +++ b/src/hostapi/asio/pa_asio.cpp @@ -2369,8 +2369,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, /* Compute total intput latency in seconds */ stream->streamRepresentation.streamInfo.inputLatency = - (double)( PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor ) - + PaUtil_GetBufferProcessorInputLatency(&stream->blockingState->bufferProcessor) + (double)( PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor ) + + PaUtil_GetBufferProcessorInputLatencyFrames(&stream->blockingState->bufferProcessor) + (lBlockingBufferSize / framesPerBuffer - 1) * framesPerBuffer + stream->asioInputLatencyFrames ) / sampleRate; @@ -2382,10 +2382,10 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, PA_DEBUG(("PaAsio : ASIO InputLatency = %ld (%ld ms),\n added buffProc:%ld (%ld ms),\n added blocking:%ld (%ld ms)\n", stream->asioInputLatencyFrames, (long)( stream->asioInputLatencyFrames * (1000.0 / sampleRate) ), - PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor), - (long)( PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor) * (1000.0 / sampleRate) ), - PaUtil_GetBufferProcessorInputLatency(&stream->blockingState->bufferProcessor) + (lBlockingBufferSize / framesPerBuffer - 1) * framesPerBuffer, - (long)( (PaUtil_GetBufferProcessorInputLatency(&stream->blockingState->bufferProcessor) + (lBlockingBufferSize / framesPerBuffer - 1) * framesPerBuffer) * (1000.0 / sampleRate) ) + PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor), + (long)( PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor) * (1000.0 / sampleRate) ), + PaUtil_GetBufferProcessorInputLatencyFrames(&stream->blockingState->bufferProcessor) + (lBlockingBufferSize / framesPerBuffer - 1) * framesPerBuffer, + (long)( (PaUtil_GetBufferProcessorInputLatencyFrames(&stream->blockingState->bufferProcessor) + (lBlockingBufferSize / framesPerBuffer - 1) * framesPerBuffer) * (1000.0 / sampleRate) ) )); /* Determine the size of ring buffer in bytes. */ @@ -2460,8 +2460,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, /* Compute total output latency in seconds */ stream->streamRepresentation.streamInfo.outputLatency = - (double)( PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor ) - + PaUtil_GetBufferProcessorOutputLatency(&stream->blockingState->bufferProcessor) + (double)( PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor) + + PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->blockingState->bufferProcessor) + (lBlockingBufferSize / framesPerBuffer - 1) * framesPerBuffer + stream->asioOutputLatencyFrames ) / sampleRate; @@ -2473,10 +2473,10 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, PA_DEBUG(("PaAsio : ASIO OutputLatency = %ld (%ld ms),\n added buffProc:%ld (%ld ms),\n added blocking:%ld (%ld ms)\n", stream->asioOutputLatencyFrames, (long)( stream->asioOutputLatencyFrames * (1000.0 / sampleRate) ), - PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor), - (long)( PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor) * (1000.0 / sampleRate) ), - PaUtil_GetBufferProcessorOutputLatency(&stream->blockingState->bufferProcessor) + (lBlockingBufferSize / framesPerBuffer - 1) * framesPerBuffer, - (long)( (PaUtil_GetBufferProcessorOutputLatency(&stream->blockingState->bufferProcessor) + (lBlockingBufferSize / framesPerBuffer - 1) * framesPerBuffer) * (1000.0 / sampleRate) ) + PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor), + (long)( PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor) * (1000.0 / sampleRate) ), + PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->blockingState->bufferProcessor) + (lBlockingBufferSize / framesPerBuffer - 1) * framesPerBuffer, + (long)( (PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->blockingState->bufferProcessor) + (lBlockingBufferSize / framesPerBuffer - 1) * framesPerBuffer) * (1000.0 / sampleRate) ) )); /* Determine the size of ring buffer in bytes. */ @@ -2517,10 +2517,10 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, callbackBufferProcessorInited = TRUE; stream->streamRepresentation.streamInfo.inputLatency = - (double)( PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor) + (double)( PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor) + stream->asioInputLatencyFrames) / sampleRate; // seconds stream->streamRepresentation.streamInfo.outputLatency = - (double)( PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor) + (double)( PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor) + stream->asioOutputLatencyFrames) / sampleRate; // seconds stream->streamRepresentation.streamInfo.sampleRate = sampleRate; @@ -2529,15 +2529,15 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, PA_DEBUG(("PaAsio : ASIO InputLatency = %ld (%ld ms), added buffProc:%ld (%ld ms)\n", stream->asioInputLatencyFrames, (long)((stream->asioInputLatencyFrames*1000)/ sampleRate), - PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor), - (long)((PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor)*1000)/ sampleRate) + PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor), + (long)((PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor)*1000)/ sampleRate) )); PA_DEBUG(("PaAsio : ASIO OuputLatency = %ld (%ld ms), added buffProc:%ld (%ld ms)\n", stream->asioOutputLatencyFrames, (long)((stream->asioOutputLatencyFrames*1000)/ sampleRate), - PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor), - (long)((PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor)*1000)/ sampleRate) + PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor), + (long)((PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor)*1000)/ sampleRate) )); } diff --git a/src/hostapi/coreaudio/pa_mac_core.c b/src/hostapi/coreaudio/pa_mac_core.c index d1decc9..1935dbd 100644 --- a/src/hostapi/coreaudio/pa_mac_core.c +++ b/src/hostapi/coreaudio/pa_mac_core.c @@ -1693,9 +1693,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, maybe need to change input latency estimate if IO devs differ */ stream->streamRepresentation.streamInfo.inputLatency = - PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor)/sampleRate; + PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor)/sampleRate; stream->streamRepresentation.streamInfo.outputLatency = - PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor)/sampleRate; + PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor)/sampleRate; stream->streamRepresentation.streamInfo.sampleRate = sampleRate; stream->sampleRate = sampleRate; diff --git a/src/hostapi/dsound/pa_win_ds.c b/src/hostapi/dsound/pa_win_ds.c index 759b8a1..e99aca5 100644 --- a/src/hostapi/dsound/pa_win_ds.c +++ b/src/hostapi/dsound/pa_win_ds.c @@ -1843,9 +1843,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, bufferProcessorIsInitialized = 1; stream->streamRepresentation.streamInfo.inputLatency = - (PaTime)PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor) / sampleRate; /* FIXME: only includes buffer processor latency */ + (PaTime)PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor) / sampleRate; /* FIXME: only includes buffer processor latency */ stream->streamRepresentation.streamInfo.outputLatency = - (PaTime)PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor) / sampleRate; /* FIXME: only includes buffer processor latency */ + (PaTime)PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor) / sampleRate; /* FIXME: only includes buffer processor latency */ stream->streamRepresentation.streamInfo.sampleRate = sampleRate; diff --git a/src/hostapi/jack/pa_jack.c b/src/hostapi/jack/pa_jack.c index 24a56d9..524f0ae 100644 --- a/src/hostapi/jack/pa_jack.c +++ b/src/hostapi/jack/pa_jack.c @@ -1296,11 +1296,11 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, if( stream->num_incoming_connections > 0 ) stream->streamRepresentation.streamInfo.inputLatency = (jack_port_get_latency( stream->remote_output_ports[0] ) - jack_get_buffer_size( jackHostApi->jack_client ) /* One buffer is not counted as latency */ - + PaUtil_GetBufferProcessorInputLatency( &stream->bufferProcessor )) / sampleRate; + + PaUtil_GetBufferProcessorInputLatencyFrames( &stream->bufferProcessor )) / sampleRate; if( stream->num_outgoing_connections > 0 ) stream->streamRepresentation.streamInfo.outputLatency = (jack_port_get_latency( stream->remote_input_ports[0] ) - jack_get_buffer_size( jackHostApi->jack_client ) /* One buffer is not counted as latency */ - + PaUtil_GetBufferProcessorOutputLatency( &stream->bufferProcessor )) / sampleRate; + + PaUtil_GetBufferProcessorOutputLatencyFrames( &stream->bufferProcessor )) / sampleRate; stream->streamRepresentation.streamInfo.sampleRate = jackSr; stream->t0 = jack_frame_time( jackHostApi->jack_client ); /* A: Time should run from Pa_OpenStream */ diff --git a/src/hostapi/oss/pa_unix_oss.c b/src/hostapi/oss/pa_unix_oss.c index b523746..a9244b4 100644 --- a/src/hostapi/oss/pa_unix_oss.c +++ b/src/hostapi/oss/pa_unix_oss.c @@ -1241,13 +1241,13 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, { inputHostFormat = stream->capture->hostFormat; stream->streamRepresentation.streamInfo.inputLatency = inLatency + - PaUtil_GetBufferProcessorInputLatency( &stream->bufferProcessor ) / sampleRate; + PaUtil_GetBufferProcessorInputLatencyFrames( &stream->bufferProcessor ) / sampleRate; } if( outputParameters ) { outputHostFormat = stream->playback->hostFormat; stream->streamRepresentation.streamInfo.outputLatency = outLatency + - PaUtil_GetBufferProcessorOutputLatency( &stream->bufferProcessor ) / sampleRate; + PaUtil_GetBufferProcessorOutputLatencyFrames( &stream->bufferProcessor ) / sampleRate; } /* Initialize buffer processor with fixed host buffer size. diff --git a/src/hostapi/skeleton/pa_hostapi_skeleton.c b/src/hostapi/skeleton/pa_hostapi_skeleton.c index 84f73c7..6edc22c 100644 --- a/src/hostapi/skeleton/pa_hostapi_skeleton.c +++ b/src/hostapi/skeleton/pa_hostapi_skeleton.c @@ -518,9 +518,9 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, values. */ stream->streamRepresentation.streamInfo.inputLatency = - (PaTime)PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor) / sampleRate; /* inputLatency is specified in _seconds_ */ + (PaTime)PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor) / sampleRate; /* inputLatency is specified in _seconds_ */ stream->streamRepresentation.streamInfo.outputLatency = - (PaTime)PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor) / sampleRate; /* outputLatency is specified in _seconds_ */ + (PaTime)PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor) / sampleRate; /* outputLatency is specified in _seconds_ */ stream->streamRepresentation.streamInfo.sampleRate = sampleRate; diff --git a/src/hostapi/wasapi/pa_win_wasapi.c b/src/hostapi/wasapi/pa_win_wasapi.c index b8fda8f..4d05207 100644 --- a/src/hostapi/wasapi/pa_win_wasapi.c +++ b/src/hostapi/wasapi/pa_win_wasapi.c @@ -3004,12 +3004,12 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, // Set Input latency stream->streamRepresentation.streamInfo.inputLatency = - ((double)PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor) / sampleRate) + ((double)PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor) / sampleRate) + ((inputParameters)?stream->in.latencySeconds : 0); // Set Output latency stream->streamRepresentation.streamInfo.outputLatency = - ((double)PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor) / sampleRate) + ((double)PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor) / sampleRate) + ((outputParameters)?stream->out.latencySeconds : 0); // Set SR diff --git a/src/hostapi/wmme/pa_win_wmme.c b/src/hostapi/wmme/pa_win_wmme.c index 2979940..b98aa7a 100644 --- a/src/hostapi/wmme/pa_win_wmme.c +++ b/src/hostapi/wmme/pa_win_wmme.c @@ -2477,10 +2477,10 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi, bufferProcessorIsInitialized = 1; stream->streamRepresentation.streamInfo.inputLatency = - (double)(PaUtil_GetBufferProcessorInputLatency(&stream->bufferProcessor) + (double)(PaUtil_GetBufferProcessorInputLatencyFrames(&stream->bufferProcessor) +(framesPerHostInputBuffer * (hostInputBufferCount-1))) / sampleRate; stream->streamRepresentation.streamInfo.outputLatency = - (double)(PaUtil_GetBufferProcessorOutputLatency(&stream->bufferProcessor) + (double)(PaUtil_GetBufferProcessorOutputLatencyFrames(&stream->bufferProcessor) +(framesPerHostOutputBuffer * (hostOutputBufferCount-1))) / sampleRate; stream->streamRepresentation.streamInfo.sampleRate = sampleRate; -- 2.43.0