toSampleFrame

fun Duration.toSampleFrame(sampleRate: Int): Long

Converts a playback position to a sample-frame index at sampleRate.

Negative positions clamp to 0. The result is not clamped to a buffer length; callers should coerce against their total frame count.