Skip to content

Combine Music/Sound event into single Audio event #2488

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

Merged
merged 7 commits into from
Feb 10, 2025

Conversation

salianifo
Copy link
Contributor

Only test on backup timelines, not backwards compatible!

Closes: #2082
Closes: #1306

This PR combines the Music and Sound events into a new Audio event. It will automatically read the old sound/music event formats and convert them into the new audio event format.

Features

  • Named audio channels
    • Channel names do not need to already exist, they are created dynamically
    • Channel names may contain a-z A-Z 0-9 _ -, but they may not be only -
    • Default settings for fade, volume, audio bus, and loop can be configured for named channels in the Audio section of the Dialogic Settings page, or updated/added by clicking the favorite icon next to the channel name in the event itself
    • Selecting/typing a channel name with default settings will override the current settings when the channel dropdown loses focus
    • Playing audio on a channel that is already playing audio will cross-fade from the previous audio to the new audio
  • One-Shot SFX channel
    • This channel is used for short sounds that don't need to be tracked
    • Can play as many audio files as needed simultaneously
  • Sync with channel
    • Allows you to start an audio file at the same position as the currently playing audio on a different channel
    • Can be used for layered audio tracks
    • Cannot be used with WAV files imported using Ima-ADPCM compression due to a Godot bug
  • Looping implemented for WAV files

Text Format

# Plays "file_path" on channel_name with settings in shortcodes,
# defaults for anything not in shortcodes
audio channel_name "file_path" [shortcodes]

# Plays "file_path" as a One-Shot SFX with the default settings
audio "file_path"

# Stops audio playing on channel_name
audio channel_name -

# Stops all One-Shot SFX
audio -

Missing Features

  • Syntax highlighting for the text timeline editor
  • Code completion for the text timeline editor

Additional Changes Made

  • Dynamic options field now has a new ANY_VALID_STRING mode that accepts a validation_func in the extra_info paramter of the event editor build functions
    • Expected return for the validation function is a Dictionary with valid_text and error_tooltip as keys, which are both optional if the text is already valid
    • If valid_text exists in the return from the validation_func, the current_value will be updated

@Jowan-Spooner Jowan-Spooner marked this pull request as ready for review February 10, 2025 20:01
@Jowan-Spooner
Copy link
Member

Notes on my changes for completeness:

  • Removed the ability to change a channels defaults from the event. Instead just have a button to go to the audio settings
  • Volume, Fade, Bus, Loop and Sync are now considered override settings. This makes the workflow with the channel defaults feel more logical.
  • Added syntax highlighting and code completion
  • Various stuff I did while working on this 🙈

@Jowan-Spooner Jowan-Spooner merged commit 6e03858 into dialogic-godot:main Feb 10, 2025
3 checks passed
@Jowan-Spooner Jowan-Spooner added the Compatibility Breaking ⚠️ This PR breaks compatibility in some way label Feb 10, 2025
@salianifo salianifo deleted the unified-audio-event branch February 10, 2025 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compatibility Breaking ⚠️ This PR breaks compatibility in some way
Development

Successfully merging this pull request may close these issues.

Improve sound event to allow for long sounds Proposal: Unify Sound and Music event
2 participants