Fixes kalulu speeches when missing audiostream

This commit is contained in:
Dylan Sarrazyn
2024-02-20 16:57:08 +01:00
parent 38a175bb9d
commit b16aa63490
6 changed files with 37 additions and 10 deletions
+9 -4
View File
@@ -10,6 +10,10 @@ var isSpeaking : bool = false :
set(value):
isSpeaking = value
elapsedTime = 0
if isSpeaking:
sprite.play("Tc_Talk1")
else:
sprite.play("Tc_Idle1")
var elapsedTime : float = 0.0
@@ -30,16 +34,17 @@ func _process(delta):
start_speech()
func _play_speech(speech : AudioStream):
if not speech:
push_warning("Speech not found")
isSpeaking = false
return
isSpeaking = true
sprite.play("Tc_Talk1")
speech_player.stream = speech
speech_player.play()
await speech_player.finished
sprite.play("Tc_Idle1")
isSpeaking = false
+7 -5
View File
@@ -23,11 +23,13 @@ func play_kalulu_speech(speech: AudioStream) -> void:
kalulu_sprite.play("Show")
await kalulu_sprite.animation_finished
kalulu_sprite.play("Talk1")
audio_player.stream = speech
audio_player.play()
await audio_player.finished
if speech:
kalulu_sprite.play("Talk1")
audio_player.stream = speech
audio_player.play()
await audio_player.finished
else:
push_warning("Speech not found")
audio_player.stream = hide_sound
audio_player.play()
+4 -1
View File
@@ -163,7 +163,10 @@ func get_distractors_for_grapheme(grapheme: String, lesson_nb: int) -> Array:
return db.query_result
func get_audio_stream_for_path(path: String) -> AudioStream:
return load(base_path + language + "/" + path)
var full_path : String = base_path.path_join(language).path_join(path)
if not FileAccess.file_exists(full_path):
return null
return load(full_path)
func get_min_lesson_for_gp_id(gp_id: int) -> int:
db.query_with_bindings("SELECT Lessons.LessonNb as i FROM Lessons