mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-04 03:40:07 +00:00
| .. | ||
| AdpfWrapper.cpp | ||
| AdpfWrapper.h | ||
| AudioClock.h | ||
| AudioSourceCaller.cpp | ||
| AudioSourceCaller.h | ||
| AudioStream.cpp | ||
| AudioStreamBuilder.cpp | ||
| DataConversionFlowGraph.cpp | ||
| DataConversionFlowGraph.h | ||
| FilterAudioStream.cpp | ||
| FilterAudioStream.h | ||
| FixedBlockAdapter.cpp | ||
| FixedBlockAdapter.h | ||
| FixedBlockReader.cpp | ||
| FixedBlockReader.h | ||
| FixedBlockWriter.cpp | ||
| FixedBlockWriter.h | ||
| LatencyTuner.cpp | ||
| MonotonicCounter.h | ||
| OboeDebug.h | ||
| OboeExtensions.cpp | ||
| QuirksManager.cpp | ||
| QuirksManager.h | ||
| README.md | ||
| SourceFloatCaller.cpp | ||
| SourceFloatCaller.h | ||
| SourceI16Caller.cpp | ||
| SourceI16Caller.h | ||
| SourceI24Caller.cpp | ||
| SourceI24Caller.h | ||
| SourceI32Caller.cpp | ||
| SourceI32Caller.h | ||
| StabilizedCallback.cpp | ||
| Trace.cpp | ||
| Trace.h | ||
| Utilities.cpp | ||
| Version.cpp | ||
Notes on Implementation
Latency from Resampling
There are two components of the latency. The resampler itself, and a buffer that is used to adapt the block sizes.
-
The resampler is an FIR running at the target sample rate. So its latency is the number of taps. From MultiChannelResampler.cpp, numTaps is
Fastest: 2 Low: 4 Medium: 8 High: 16 Best: 32
For output, the device sampling rate is used, which is typically 48000.For input, the app sampling rate is used.
- There is a block size adapter that collects odd sized blocks into larger blocks of the correct size.
The adapter contains one burst of frames, from getFramesPerBurst(). But if the app specifies a particular size using setFramesPerCallback() then that size will be used. Here is some pseudo-code to calculate the latency.
latencyMillis = 0
targetRate = isOutput ? deviceRate : applicationRate
// Add latency from FIR
latencyMillis += numTaps * 1000.0 / targetRate
// Add latency from block size adaptation
adapterSize = (callbackSize > 0) ? callbackSize : burstSize
if (isOutput && isCallbackUsed) latencyMillis += adapterSize * 1000.0 / deviceRate
else if (isInput && isCallbackUsed) latencyMillis += adapterSize * 1000.0 / applicationRate
else if (isInput && !isCallbackUsed) latencyMillis += adapterSize * 1000.0 / deviceRate