1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Some code improvements and documentation

This commit is contained in:
Emmanouil Papadeas 2024-12-10 23:36:33 +02:00
parent ef9a3e47a2
commit fa3642f99c
4 changed files with 13 additions and 7 deletions

View file

@ -2251,6 +2251,9 @@ msgstr ""
msgid "Tilemap"
msgstr ""
msgid "Audio"
msgstr ""
msgid "Layers"
msgstr ""

View file

@ -1193,6 +1193,6 @@ func _save_to_override_file() -> void:
file.store_line("[display]\n")
file.store_line("window/subwindows/embed_subwindows=%s" % single_window_mode)
file.store_line("window/per_pixel_transparency/allowed=%s" % window_transparency)
file.store_line("[audio]\n")
if dummy_audio_driver:
file.store_line("[audio]\n")
file.store_line('driver/driver="Dummy"')

View file

@ -1,18 +1,21 @@
class_name AudioLayer
extends BaseLayer
## A unique type of layer which acts as an audio track for the timeline.
## Each audio layer has one audio stream, and its starting position can be
## in any point during the animation.
signal audio_changed
signal playback_frame_changed
var audio: AudioStream:
var audio: AudioStream: ## The audio stream of the layer.
set(value):
audio = value
audio_changed.emit()
var playback_position := 0.0: ## Measured in seconds.
var playback_position := 0.0: ## The time in seconds where the audio stream starts playing.
get():
var frame := project.frames[playback_frame]
return frame.position_in_seconds(project)
var playback_frame := 0:
var playback_frame := 0: ## The frame where the audio stream starts playing.
set(value):
playback_frame = value
playback_frame_changed.emit()
@ -23,6 +26,7 @@ func _init(_project: Project, _name := "") -> void:
name = _name
## Returns the length of the audio stream.
func get_audio_length() -> float:
if is_instance_valid(audio):
return audio.get_length()
@ -30,6 +34,7 @@ func get_audio_length() -> float:
return -1.0
## Returns the class name of the audio stream. E.g. "AudioStreamMP3".
func get_audio_type() -> String:
if not is_instance_valid(audio):
return ""
@ -61,4 +66,4 @@ func new_empty_cel() -> AudioCel:
func set_name_to_default(number: int) -> void:
name = tr("Audio track") + " %s" % number
name = tr("Audio") + " %s" % number

View file

@ -1156,13 +1156,11 @@ text = "On"
[node name="DummyAudioDriverLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer" groups=["DesktopOnly"]]
layout_mode = 2
tooltip_text = "If enabled, the application window can become transparent. This affects performance, so keep it off if you don't need it."
mouse_filter = 0
text = "Use dummy audio driver"
[node name="DummyAudioDriver" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer" groups=["DesktopOnly"]]
layout_mode = 2
tooltip_text = "If enabled, the application window can become transparent. This affects performance, so keep it off if you don't need it."
mouse_default_cursor_shape = 2
text = "On"