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

Implement blending audio feature to AnimationTree #72233

Merged
merged 1 commit into from
Jan 28, 2023

Conversation

TokageItLab
Copy link
Member

@TokageItLab TokageItLab commented Jan 28, 2023

Fixed #65750.

Follow up #71855. Allows AnimationTree to blend audio using AudioStreamPolyphonic.

This PR adds the following options to the audio track:

  • UseBlend
    • Sets whether the track will be blended with other animations. If true, the audio playback volume changes depending on the blend value.
  • AutoClear
    • Sets whether the stream cache should be deleted when the blend amount is 0 in blending. If you want to fade in the audio or continue playback after blending, this value must be false. Note: Even if this value is false, the stream will be removed from the cache when the audio is played to the end. Removed, we will send an optimized PR to eliminate the need for this AutoClear in the future.

image

Known issue / Todo:

Preview (Turn on the volume):

Godot.2023.01.28.-.15.17.34.15.mp4

audio_blend_test.zip

@TokageItLab
Copy link
Member Author

TokageItLab commented Jan 28, 2023

After discussions with the @reduz, it was decided to remove the AutoClear option because it is hard to use and will likely not be used.

The AutoClear option was implemented to prevent audio with 0 amount blend from playing in the background, saving memory and saving audio polyphony counts. (For example, if a large number of animations are synced, there may be a large amount of audio playing in the background with a volume of zero.)

However, we have concluded that improvements to the AudioStreamPolyphonic API should prevent increasing the audio polyphony count in the background when the blend amount is 0 by properly pausing and playing back the audio.

This optimization will be implemented in the future as Follow up PR. Until then, we can have the workaround that increase the number of audio_max_polyphony property in AnimationTree to handle that.

Copy link
Member

@SaracenOne SaracenOne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this seems good to me!

@akien-mga akien-mga merged commit e5752fd into godotengine:master Jan 28, 2023
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BlendTree implicitly forces overwriting of AudioStream volume when AudioTrack is used
4 participants