mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Fix audio not playing at the appropriate position
This commit is contained in:
parent
a7efc3eb03
commit
5242b96f64
|
@ -86,9 +86,11 @@ func _play_audio() -> void:
|
||||||
if not is_instance_valid(audio_player):
|
if not is_instance_valid(audio_player):
|
||||||
return
|
return
|
||||||
var audio_length := audio_player.stream.get_length()
|
var audio_length := audio_player.stream.get_length()
|
||||||
var normalized_pos := Global.current_project.current_frame / Global.current_project.fps
|
var final_frame := audio_length * Global.current_project.fps
|
||||||
if normalized_pos < 1:
|
if Global.current_project.current_frame < final_frame:
|
||||||
audio_player.play(normalized_pos * audio_length)
|
var inverse_fps := 1.0 / Global.current_project.fps
|
||||||
|
var playback_position := Global.current_project.current_frame * inverse_fps
|
||||||
|
audio_player.play(playback_position)
|
||||||
else:
|
else:
|
||||||
audio_player.stop()
|
audio_player.stop()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue