Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefill ALLEGRO_AUDIO_STREAMs with data in docstrings/examples/acodec. #1535

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

SiegeLord
Copy link
Member

The audio system will attempt to grab data from a stream before it has sent any events that it needs fragments. This causes a bit of lag, and also log spam as the system complains about having no data.

This change adjusts most places to prefill the streams with data to avoid this issue. It should be safe, and in fact beneficial as we should get a few less sample-worths of lag when using
al_play/load_audio_stream.

The audio system will attempt to grab data from a stream *before* it has
sent any events that it needs fragments. This causes a bit of lag, and
also log spam as the system complains about having no data.

This change adjusts most places to prefill the streams with data to
avoid this issue. It should be safe, and in fact beneficial as we should
get a few less sample-worths of lag when using
`al_play/load_audio_stream`.
@pedro-w
Copy link
Contributor

pedro-w commented Feb 21, 2024

Is there a case where you wouldn't want to pre-fill, i.e can this be the default?

@SiegeLord
Copy link
Member Author

The data needs to come from somewhere, it's not appropriate for it to always be silence. So, there's no case where you don't want to prefill, but there's also no way to have a default prefilling code.

An alternative to this would be to somehow have stream start out as paused, have it send the event, have it unpause when it gets the first fragment. It's not obvious that that's a better solution, since it introduces some additional lag, in principle.

@SiegeLord SiegeLord merged commit 00b7f8c into liballeg:master Mar 6, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants