Skip to content

Commit

Permalink
Audio spectrum optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
bakana808 committed Jul 3, 2024
1 parent 2d29cbe commit c598c10
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions project/audio_spectrum.gd
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ func _ready():
last_peaks.fill(0.0)
spectrum_analyzer = AudioServer.get_bus_effect_instance(1, 0)

func _physics_process(delta):
queue_redraw()
func _process(_delta):
if visible:
print("drawing spectrum")
queue_redraw()

func _draw():
var bar_width := spectrum_width / spectrum_res
Expand Down
1 change: 1 addition & 0 deletions project/scenes/floating_scene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ extends M8Scene
@export var enable_audio_spectrum := false:
set(value):
%SpriteAudioSpectrum.visible = value
%AudioSpectrum.visible = value
enable_audio_spectrum = value

@export var audio_spectrum_color := Color.WHITE:
Expand Down
4 changes: 2 additions & 2 deletions project/scenes/floating_scene.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ shader_parameter/distort_offset = Vector2(0, 0)
shader_parameter/brightness = 0.001
shader_parameter/tex = SubResource("ViewportTexture_t2dqp")

[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_fn2xv"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6xm2m"]
resource_local_to_scene = true
albedo_color = Color(0.1, 0.1, 0.1, 1)
metallic = 0.6
Expand Down Expand Up @@ -189,7 +189,7 @@ spot_angle = 36.8368
unique_name_in_owner = true
transform = Transform3D(38.83, 0, 0, 0, 6.74276, -38.24, 0, 38.2401, 6.74275, 0, 0, 0)
screen_material = SubResource("ShaderMaterial_w3y4l")
keycap_material = SubResource("StandardMaterial3D_fn2xv")
keycap_material = SubResource("StandardMaterial3D_6xm2m")

[node name="CameraArm" type="Node3D" parent="."]
unique_name_in_owner = true
Expand Down

0 comments on commit c598c10

Please sign in to comment.