2 class_name DialogicVoiceEvent
5 ## Event that allows to set the sound file to use for the next text event.
10 ## The path to the sound file.
13 if file_path != value:
15 ui_update_needed.emit()
16 ## The volume the sound will be played at.
18 ## The audio bus to play the sound on.
19 var audio_bus := "Master"
22 ################################################################################
24 ################################################################################
26 func _execute() -> void:
27 # If Auto-Skip is enabled, we may not want to play voice audio.
28 # Instant Auto-Skip will always skip voice audio.
29 if (dialogic.Inputs.auto_skip.enabled
30 and dialogic.Inputs.auto_skip.skip_voice):
34 dialogic.Voice.set_file(file_path)
35 dialogic.Voice.set_volume(volume)
36 dialogic.Voice.set_bus(audio_bus)
38 # the rest is executed by a text event
41 ################################################################################
43 ################################################################################
47 set_default_color('Color7')
48 event_category = "Audio"
49 event_sorting_index = 5
52 ################################################################################
54 ################################################################################
56 func get_shortcode() -> String:
60 func get_shortcode_parameters() -> Dictionary:
62 #param_name : property_info
63 "path" : {"property": "file_path", "default": ""},
64 "volume" : {"property": "volume", "default": 0},
65 "bus" : {"property": "audio_bus", "default": "Master"}
69 ################################################################################
70 ## EDITOR REPRESENTATION
71 ################################################################################
73 func build_event_editor() -> void:
74 add_header_edit('file_path', ValueType.FILE, {
76 'right_text' : 'as the next voice audio',
77 'file_filter' : "*.mp3, *.ogg, *.wav",
78 'placeholder' : "Select file",
79 'editor_icon' : ["AudioStreamPlayer", "EditorIcons"]})
80 add_header_edit('file_path', ValueType.AUDIO_PREVIEW)
81 add_body_edit('volume', ValueType.NUMBER, {'left_text':'Volume:', 'mode':2}, '!file_path.is_empty()')
82 add_body_edit('audio_bus', ValueType.SINGLELINE_TEXT, {'left_text':'Audio Bus:'}, '!file_path.is_empty()')