This contains the source code documentation of the class subsystem_Voice
.
subsystem_Voice
Inherits: DialogicSubsystem
Subsystem that manages setting voice lines for text events.
Description
It's recommended to use the DialogicVoiceEvent to set the voice lines for text events and not start playing them directly.
Properties
Name | Type | Default |
---|---|---|
current_audio_file | String | |
voice_player | AudioStreamPlayer | new() |
Methods
Returns | Method |
---|---|
void | pause ( ) |
void | resume ( ) |
bool | is_voiced ( index : int ) |
void | play_voice ( ) |
void | set_file ( path : String ) |
void | set_volume ( value : float ) |
void | set_bus ( bus_name : String ) |
void | stop_audio ( ) |
float | get_remaining_time ( ) |
bool | is_running ( ) |
Signals
signal voiceline_started ( info
: Dictionary )
Emitted whenever a new voice line starts playing. The info
contains the following keys and values:
Key | Value Type | Value
-------- | ------------- | -----
file
| String | The path to file played.
signal voiceline_finished ( info
: Dictionary )
Emitted whenever a voice line finished playing. The info
contains the following keys and values:
Key | Value Type | Value
---------------- | ------------- | -----
file
| String | The path to file played.
remaining_time
| float | The remaining time of the voiceline.
signal voiceline_stopped ( info
: Dictionary )
Emitted whenever a voice line gets interrupted and does not finish playing. The info
contains the following keys and values:
Key | Value Type | Value
---------------- | ------------- | -----
file
| String | The path to file played.
remaining_time
| float | The remaining time of the voiceline.
Property Descriptions
The current audio file being played.
The audio player for the voiceline.
Method Descriptions
Stops the current voice from playing.
Resumes a paused voice.
func is_voiced ( index
: int ) ⇒ bool
Whether the current event is a text event and has a voice event before it.
Plays the voice line. This will be invoked by Dialogic. Requires set_file to be called before or nothing plays.
func set_file ( path
: String ) ⇒ void
Set a voice file path
to be played, then invoke play_voice. This method does not check if path
is a valid file.
func set_volume ( value
: float ) ⇒ void
Set the volume to a value
in decibels.
func set_bus ( bus_name
: String ) ⇒ void
Set the voice player's bus to a bus_name
.
Stops the current voice line from playing.
func get_remaining_time ( ) ⇒ float
Returns the remaining time of the current voice line in seconds. If there is no voice line playing, returns 0
.
Whether there is still positive time remaining for the current voiceline.