AudioStreamSynchronized ensure loop continuity when setting new stream [EDIT] #10870
Febz
started this conversation in
Engine Core
Replies: 1 comment
-
I found a way around the problem that seems good enough: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the project you are working on
Procedural musical game: proof of concept
Describe the problem or limitation you are having in your project
Currently when I set a different stream for a specific index at runtime on an
AudioStreamSynchronized
the player stops playing all the streams and if I forceplay()
it restarts all streams from the beginning (with the new stream instead of the old one, as expected).Since I have a "sample loop" type beat going on, substitution of 1 stream will make all streams potentially skip some audio. I couldn't find a
"stream_loop_end"
kind of signal to hook up to, but still, even if that existed, I fear that there would still be some fairly audible tempo weirdness.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Would it be possible to add a specific method (or even just a boolean param to
set_sync_stream()
) so it will substitute the single stream only when the previous stream loop with the same index has ended? without stopping all streams from playing, to ensure that realtime substitution of a stream doesn't cause weird tempo changes.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
AudioStreamSynchronized.set_sync_stream(0, audioStream, true)
. The third method parameter is a boolean to determine whether to stop all streams from playing or just substitute the single stream once it ended being reproduced.If this enhancement will not be used often, can it be worked around with a few lines of script?
Yes, the current behavior could be the default one by setting the third parameter as having the corresponding default boolean value. Already existing code shouldn't need any edit on engine update.
Is there a reason why this should be core and not an add-on in the asset library?
I think it would complete the functionalities of the
AudioStreamSynchronized
class, by allowing, if needed, to ensure continuous synchronization also when calling it'sset_sync_stream()
method in real time.Many thanks in advance for considering the proposal or even just taking the time to help me understand what I might be missing! <3
Beta Was this translation helpful? Give feedback.
All reactions