Repository navigation
How to get miniaudio device latency #1057
Unanswered
SomeGuyWhoLovesCoding
asked this question in
Q&A
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have a rhythm game with miniaudio and I need the rough approximate of latency in-game. I already have 100ms web-audio preschedule and 10ms buffer latency added onto my latency function, by the way.
All reactions
Replies: 2 comments · 5 replies
Uh oh!
There was an error while loading. Please reload this page.
The period size is the latency. Your best option would be to inspect
pDevice->playback.internalPeriodSizeInFrames.When you initialize your device you can specify the period size you'd like to use in the device config:
periodSizeInFramesorperiodSizeInMilliseconds. It's technically just a hint. The backend will look at the value you requested and will try to get as close as possible, but sometimes the backend won't be able to match it exactly.All reactions
Uh oh!
There was an error while loading. Please reload this page.
What's
pDevice? Is it anma_device?All reactions
Uh oh!
There was an error while loading. Please reload this page.
Okay so
internalPeriodSizeis just 10ms.All reactions
Uh oh!
There was an error while loading. Please reload this page.
But in reality it's like 100ms.
All reactions
Uh oh!
There was an error while loading. Please reload this page.
I have Bluetooth speakers.
All reactions
Uh oh!
There was an error while loading. Please reload this page.
miniaudio doesn't care about the nature of output devices. It just uses the backend like normal regardless of the type of the device. Inherent bluetooth latency is not something miniaudio takes into consideration. It only cares about what the backend reports.
All reactions
Uh oh!
There was an error while loading. Please reload this page.
Considering that, I'll now use the
internalPeriodSizeInFramesAll reactions