-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
161 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,35 @@ | ||
extends RichTextLabel | ||
|
||
func _ready(): | ||
## Completed text from transcription | ||
var completed_text := "" | ||
|
||
## Partial text from transcription | ||
var partial_text := "" | ||
|
||
|
||
## Ready function to initialize the label | ||
func _ready() -> void: | ||
custom_minimum_size.x = 400 | ||
bbcode_enabled = true | ||
fit_content = true | ||
|
||
func update_text(): | ||
|
||
## Update the text displayed on the label | ||
func update_text() -> void: | ||
text = completed_text + "[color=green]" + partial_text + "[/color]" | ||
|
||
func _process(_delta): | ||
|
||
## Process function to update text every frame | ||
func _process(_delta: float) -> void: | ||
update_text() | ||
|
||
var completed_text := "" | ||
var partial_text := "" | ||
|
||
func _on_speech_to_text_transcribed_msg(is_partial, new_text): | ||
if is_partial == true: | ||
## Handle the speech-to-text transcribed message | ||
func _on_speech_to_text_transcribed_msg(is_partial: bool, new_text: String) -> void: | ||
# Handle partial and complete transcriptions | ||
if is_partial: | ||
completed_text += new_text | ||
partial_text = "" | ||
else: | ||
if new_text!="": | ||
if new_text != "": | ||
partial_text = new_text |
Oops, something went wrong.