Compute the time delta (in seconds) for an audio buffer. Each buffer of pcmSize samples at sampleRate Hz represents exactly pcmSize/sampleRate seconds of audio, regardless of when the CPU reads it.
| 99 | /// Each buffer of pcmSize samples at sampleRate Hz represents exactly |
| 100 | /// pcmSize/sampleRate seconds of audio, regardless of when the CPU reads it. |
| 101 | inline float computeAudioDt(fl::size pcmSize, int sampleRate) FL_NOEXCEPT { |
| 102 | if (sampleRate <= 0 || pcmSize == 0) return 0.0f; |
| 103 | return static_cast<float>(pcmSize) / static_cast<float>(sampleRate); |
| 104 | } |
| 105 | |
| 106 | } // namespace audio |
| 107 | } // namespace fl |