From bfea8e167a75a9894c23424537a6f002236fb56e Mon Sep 17 00:00:00 2001 From: Jarcode Date: Sat, 9 Mar 2019 21:13:27 -0800 Subject: [PATCH] Load system config for 'smooth_parameters.glsl' --- shaders/smooth_parameters.glsl | 4 ++-- shaders/util/smooth.glsl | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/shaders/smooth_parameters.glsl b/shaders/smooth_parameters.glsl index bfea307..0e70513 100644 --- a/shaders/smooth_parameters.glsl +++ b/shaders/smooth_parameters.glsl @@ -27,10 +27,10 @@ output is jagged and sporadic. - hybrid uses the results from both `average` and `maximum` with the weight provided in `SAMPLE_HYBRID_WEIGHT` */ -#define SAMPLE_MODE average +//#define SAMPLE_MODE average /* Weight should be provided in the range (0, 1). Higher values favour averaged results. `hybrid` mode only. */ -#define SAMPLE_HYBRID_WEIGHT 0.65 +//#define SAMPLE_HYBRID_WEIGHT 0.65 /* Factor used to scale frequencies. Lower values allows lower frequencies to occupy more space. */ diff --git a/shaders/util/smooth.glsl b/shaders/util/smooth.glsl index 8b18ce2..5b8a3b4 100644 --- a/shaders/util/smooth.glsl +++ b/shaders/util/smooth.glsl @@ -10,6 +10,7 @@ #define PI 3.14159265359 #endif +#include "@smooth_parameters.glsl" #include ":smooth_parameters.glsl" /* window value t that resides in range [0, sz)*/ @@ -43,6 +44,7 @@ float smooth_audio(in sampler1D tex, int tex_sz, highp float idx) { smax = scale_audio(clamp(idx + SMOOTH_FACTOR, 0, 1)) * tex_sz; float m = ((smax - smin) / 2.0F), s, w; float rm = smin + m; /* middle */ + #if SAMPLE_MODE == average float avg = 0, weight = 0; for (s = smin; s <= smax; s += 1.0F) {