renamed PaUtil_GetBufferProcessorInputLatency to PaUtil_GetBufferProcessorInputLatencyFrames and PaUtil_GetBufferProcessorOutputLatency to PaUtil_GetBufferProcessorOutputLatencyFrames. see ticket #161
This commit is contained in:
parent
1938ce6628
commit
cbd24dc45c
12 changed files with 44 additions and 44 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
||||
/*@}*/
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue