summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gpu/gpu.cc14
-rw-r--r--src/main.cc10
2 files changed, 17 insertions, 7 deletions
diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc
index 43aef7c..1f2c7f8 100644
--- a/src/gpu/gpu.cc
+++ b/src/gpu/gpu.cc
@@ -129,10 +129,11 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> @builtin(position) vec4<
@fragment
fn fs_main() -> @location(0) vec4<f32> {
- let hue = uniforms.audio_peak * 0.5;
- let r = sin(hue + 0.0) * 0.5 + 0.5;
- let g = sin(hue + 2.0) * 0.5 + 0.5;
- let b = sin(hue + 4.0) * 0.5 + 0.5;
+ // More vibrant hue: shift through colors based on peak
+ let h = uniforms.audio_peak * 2.0;
+ let r = sin(h + 0.0) * 0.5 + 0.5;
+ let g = sin(h + 2.0) * 0.5 + 0.5;
+ let b = sin(h + 4.0) * 0.5 + 0.5;
return vec4<f32>(r, g, b, 1.0);
}
)";
@@ -289,7 +290,10 @@ void gpu_draw(float audio_peak, float aspect_ratio) {
color_attachment.resolveTarget = nullptr;
color_attachment.loadOp = WGPULoadOp_Clear;
color_attachment.storeOp = WGPUStoreOp_Store;
- color_attachment.clearValue = {0.1, 0.2, 0.3, 1.0};
+
+ // Background flash based on peak
+ float flash = uniforms.audio_peak * 0.4f;
+ color_attachment.clearValue = {0.05 + flash, 0.1 + flash, 0.2 + flash, 1.0};
color_attachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED;
WGPURenderPassDescriptor render_pass_desc = {};
diff --git a/src/main.cc b/src/main.cc
index f612868..d564de0 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -133,8 +133,14 @@ int main(int argc, char **argv) {
glfwGetFramebufferSize(platform_get_window(), &width, &height);
float aspect_ratio = (float)width / (float)height;
- float visual_peak = fminf(synth_get_output_peak() * 80.0f, 1.0f);
- gpu_draw(visual_peak, aspect_ratio);
+ // Stronger amplification for visuals
+ float raw_peak = synth_get_output_peak();
+ float visual_peak = raw_peak * 150.0f;
+
+ // Add a non-linear boost for loud peaks to make flashes pop
+ if (visual_peak > 0.5f) visual_peak += (visual_peak - 0.5f) * 0.5f;
+
+ gpu_draw(fminf(visual_peak, 1.0f), aspect_ratio);
audio_update();
}