Add a fade in to stream playback on start #107557
Open
+15
−11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a simple attempt to fix #107551
I used the same behaviour used for the fade out mechanism to add a fade in mechanism. This just takes advantage of the cubic interpolation to smooth the start, just like it does for the stop.
Without interpolation on start:
audioloopclick.mp4
With interpolation on start:
audioloopnoclick.mp4
Problems
This doesn't work well with sounds with a punchy start, and should only be an option you set for streams. A comment below shows why.
Potential enhancements
Because of the problem above, this could be used only for looping streams, or added as a stream parameter (the playback state would just need to be set to
PLAYING
instead ofFADE_IN
if it's not a looping stream). I'm just not really sure how to do it properly in this case.