Initial project sync

This commit is contained in:
wxm
2026-07-06 22:55:14 -07:00
commit 8cca00d0da
1066 changed files with 58585 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
extends Node
@export var sample_limit := 20
var _samples := 0
func _ready() -> void:
set_process_input(true)
var rhythm := _rhythm_manager()
if rhythm != null and rhythm.has_method("start"):
rhythm.call("start")
func _input(event: InputEvent) -> void:
var key := event as InputEventKey
if key == null or not key.pressed or key.echo:
return
_print_clock_sample(Time.get_ticks_msec())
func _print_clock_sample(timestamp_ms: float) -> void:
var rhythm := _rhythm_manager()
if rhythm == null:
push_warning("ClockDebug requires the RhythmManager autoload.")
return
var song_time := float(rhythm.call("input_to_song_time", timestamp_ms))
var rating: Dictionary = rhythm.call("get_rating_for_time", song_time)
var nearest_beat := int(rating.get("nearest_beat", -1))
var diff_ms := float(rating.get("diff", 0.0)) * 1000.0
_samples += 1
print("clock_debug sample=%d song_time=%.3f beat=%d diff_ms=%.2f" % [_samples, song_time, nearest_beat, diff_ms])
if sample_limit > 0 and _samples >= sample_limit:
print("clock_debug sample limit reached")
func _rhythm_manager() -> Node:
return get_node_or_null("/root/RhythmManager")