audio sync working
This commit is contained in:
parent
cc0da859d8
commit
65ac1d73f3
5 changed files with 42 additions and 2 deletions
|
@ -43,6 +43,7 @@ offset_left = 244.0
|
|||
offset_top = 4.0
|
||||
offset_right = 260.0
|
||||
offset_bottom = 20.0
|
||||
tooltip_text = "Clear this row"
|
||||
icon = ExtResource("2_e7anl")
|
||||
|
||||
[node name="MovementsBG" type="Panel" parent="."]
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
[gd_scene load_steps=27 format=3 uid="uid://oiehbor0dlqx"]
|
||||
[gd_scene load_steps=28 format=3 uid="uid://oiehbor0dlqx"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dfiwoln8mdwm8" path="res://Scripts/EditorScreen.gd" id="1_sd512"]
|
||||
[ext_resource type="Theme" uid="uid://dbgs4id7y5d1c" path="res://UI/Themes/Dark.tres" id="1_v0ton"]
|
||||
[ext_resource type="PackedScene" uid="uid://btre5j66mpchy" path="res://Scenes/Stages/Helen House/HelenHouse.tscn" id="2_p1t5g"]
|
||||
[ext_resource type="AudioStream" uid="uid://c1hjkaatw2koh" path="res://UI/placeholder_delete_this_file_later_please_its_so_large.wav" id="3_20noo"]
|
||||
[ext_resource type="Texture2D" uid="uid://xllpr3qc064c" path="res://UI/Play.png" id="3_g6u4d"]
|
||||
[ext_resource type="Texture2D" uid="uid://dgacnkv2dc65s" path="res://UI/PlayBackwards.png" id="3_mr8sb"]
|
||||
[ext_resource type="Texture2D" uid="uid://dts4eh6hyt8p3" path="res://UI/SkipBackwards.png" id="3_r4ytj"]
|
||||
|
@ -50,6 +51,9 @@ grow_vertical = 2
|
|||
theme = ExtResource("1_v0ton")
|
||||
script = ExtResource("1_sd512")
|
||||
|
||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_20noo")
|
||||
|
||||
[node name="SubViewport" type="SubViewport" parent="."]
|
||||
size = Vector2i(1280, 720)
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ func _input(event: InputEvent) -> void:
|
|||
_on_stop_button_pressed()
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
if (playing || recording):
|
||||
if (playing):
|
||||
step.emit(playback_rate)
|
||||
index += playback_rate
|
||||
if (index <= 0): _on_stop_button_pressed()
|
||||
|
@ -84,23 +84,29 @@ func _on_v_scroll_bar_value_changed(value: float) -> void:
|
|||
|
||||
func _on_play_button_pressed() -> void:
|
||||
playback_rate = 1
|
||||
$AudioStreamPlayer.pitch_scale = 1
|
||||
$AudioStreamPlayer.play(float(index)/60.0)
|
||||
playing = true
|
||||
|
||||
func _on_pause_button_pressed() -> void:
|
||||
$AudioStreamPlayer.stop()
|
||||
playing = false
|
||||
|
||||
func _on_play_backwards_button_pressed() -> void:
|
||||
playback_rate = -1
|
||||
$AudioStreamPlayer.stop() # cant play backwards :(
|
||||
playing = true
|
||||
$SequencerPanel/TransportControls/RecordButton.button_pressed = false
|
||||
|
||||
func _on_fast_backwards_button_pressed() -> void:
|
||||
playback_rate = -2
|
||||
$AudioStreamPlayer.stop() # cant play backwards :(
|
||||
playing = true
|
||||
$SequencerPanel/TransportControls/RecordButton.button_pressed = false
|
||||
|
||||
func _on_step_backwards_button_pressed() -> void:
|
||||
playing = false
|
||||
$AudioStreamPlayer.stop()
|
||||
$SequencerPanel/TransportControls/RecordButton.button_pressed = false
|
||||
if (index != 0):
|
||||
step.emit(-1)
|
||||
|
@ -109,11 +115,14 @@ func _on_step_backwards_button_pressed() -> void:
|
|||
|
||||
func _on_fast_forward_button_pressed() -> void:
|
||||
playback_rate = 2
|
||||
$AudioStreamPlayer.pitch_scale = 2
|
||||
$AudioStreamPlayer.play(float(index)/60.0)
|
||||
playing = true
|
||||
$SequencerPanel/TransportControls/RecordButton.button_pressed = false
|
||||
|
||||
func _on_step_forward_button_pressed() -> void:
|
||||
playing = false
|
||||
$AudioStreamPlayer.stop()
|
||||
$SequencerPanel/TransportControls/RecordButton.button_pressed = false
|
||||
step.emit(1)
|
||||
index += 1
|
||||
|
@ -126,6 +135,8 @@ func _on_record_button_toggled(toggled_on: bool) -> void:
|
|||
|
||||
func _on_stop_button_pressed() -> void:
|
||||
playing = false
|
||||
$AudioStreamPlayer.stop()
|
||||
$AudioStreamPlayer.seek(0)
|
||||
$SequencerPanel/TransportControls/RecordButton.button_pressed = false
|
||||
index = 0
|
||||
return_to_zero.emit()
|
||||
|
|
BIN
UI/placeholder_delete_this_file_later_please_its_so_large.wav
Normal file
BIN
UI/placeholder_delete_this_file_later_please_its_so_large.wav
Normal file
Binary file not shown.
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://c1hjkaatw2koh"
|
||||
path="res://.godot/imported/placeholder_delete_this_file_later_please_its_so_large.wav-b6f8898825898b7c991e2e55bff2c0ab.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://UI/placeholder_delete_this_file_later_please_its_so_large.wav"
|
||||
dest_files=["res://.godot/imported/placeholder_delete_this_file_later_please_its_so_large.wav-b6f8898825898b7c991e2e55bff2c0ab.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=2
|
Loading…
Add table
Add a link
Reference in a new issue