Skip to content

Commit

Permalink
Fix: Each time a new track gets created. play starts from where the c…
Browse files Browse the repository at this point in the history
…ursor was (#53)

Fixed a few problems encountered while making a song in SongScript
  • Loading branch information
IsotoxalDev authored May 24, 2022
1 parent ab405cf commit f4674be
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Editor/Scenes/Dialogues/TrackEditor/TrackEditor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ onready var script_editor = $HBoxContainer/TextEdit

const BASE_SONG_SCRIPT = """extends SongScript
func entry():
func song():
track("%s", [
# Place your notes here
])
Expand Down
1 change: 1 addition & 0 deletions SongScriptMain/SongScriptMain.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ size_flags_horizontal = 0
layer = 5

[connection signal="play" from="TrackEditor/ControlPanel" to="." method="_on_ControlPanel_play"]
[connection signal="playback_finished" from="Sequencer" to="TrackEditor/ControlPanel" method="_on_finished"]
7 changes: 6 additions & 1 deletion addons/godaw_toolkit/API/SongScript.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,10 @@ func note(note_start_delta: float, duration: float, data) -> Note:
note.instrument_data = data
return note

func entry():
# The function where notes go
func song():
pass

func entry():
sequence.tracks.clear()
song()
5 changes: 3 additions & 2 deletions util/Sequencer/Sequencer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ onready var player = $AnimationPlayer

# Data
var data: SongSequence
var playing: bool
var paused: bool
var playing: bool = false
var paused: bool = false

# Functions
func sequence(sequence: SongSequence):
Expand Down Expand Up @@ -58,6 +58,7 @@ func play():
paused = false
player.play()
return
player.seek(0)
player.play("song")

func stop():
Expand Down

0 comments on commit f4674be

Please sign in to comment.