Skip to content

Commit

Permalink
BROKEN VERSION: Working hours every day to bring cool content to 1.2,…
Browse files Browse the repository at this point in the history
… including the fantastic new Beat Tunnel mode.

For anyone curious, it's been a "BROKEN VERSION" for so long because I've been putting off refactoring the web app slider code for the new browser communication strategy employed in 1.2. Once sliders/toggles are fixed, I wont consider these nightly builds "broken" anymore.
  • Loading branch information
connornishijima committed Jun 14, 2024
1 parent ceee4db commit 26fd2e3
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 97 deletions.
87 changes: 0 additions & 87 deletions src/EMOTISCOPE_FIRMWARE.ino.cpp

This file was deleted.

8 changes: 5 additions & 3 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void load_config(){
strcpy(configuration.softness.ui_type_string, "s");
configuration.softness.type = f32;
configuration.softness.ui_type = ui_type_slider;
configuration.softness.value.f32 = 0.33;
configuration.softness.value.f32 = 0.25;
//configuration.softness.value.f32 = preferences.getFloat(configuration.softness.name, 0.25);

// Color
Expand Down Expand Up @@ -158,7 +158,8 @@ void load_config(){
strcpy(configuration.auto_color_cycle.ui_type_string, "t");
configuration.auto_color_cycle.type = u32;
configuration.auto_color_cycle.ui_type = ui_type_toggle;
configuration.auto_color_cycle.value.u32 = (uint32_t)preferences.getInt(configuration.auto_color_cycle.name, 0);
configuration.auto_color_cycle.value.u32 = true;
//configuration.auto_color_cycle.value.u32 = (uint32_t)preferences.getInt(configuration.auto_color_cycle.name, 0);

// Blur
strcpy(configuration.blur.name, "blur");
Expand All @@ -167,7 +168,8 @@ void load_config(){
strcpy(configuration.blur.ui_type_string, "s");
configuration.blur.type = f32;
configuration.blur.ui_type = ui_type_slider;
configuration.blur.value.f32 = preferences.getFloat(configuration.blur.name, 0.00);
configuration.blur.value.f32 = 0.00;
//configuration.blur.value.f32 = preferences.getFloat(configuration.blur.name, 0.00);

// Show Interface
strcpy(configuration.show_ui.name, "show_ui");
Expand Down
2 changes: 1 addition & 1 deletion src/global_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define NUM_TEMPI (128)

// BPM range
#define TEMPO_LOW (40)
#define TEMPO_LOW (60)
#define TEMPO_HIGH (TEMPO_LOW + NUM_TEMPI)

// How far forward or back in time the beat phase is shifted
Expand Down
3 changes: 3 additions & 0 deletions src/gpu_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ void run_gpu() {
// Update auto color cycling
update_auto_color(); // (leds.h)

// Clamp configuration items to their min/max values
clamp_configuration(); // (leds.h)

run_indicator_light();

// RUN THE CURRENT MODE
Expand Down
4 changes: 4 additions & 0 deletions src/leds.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ void draw_sprite(float dest[], float sprite[], uint32_t dest_length, uint32_t sp
}
}

void clamp_configuration(){
configuration.color.value.f32 = fmodf(configuration.color.value.f32, 1.0);
}

void save_leds_to_temp() {
// uint16_t profiler_index = start_function_timing(__func__);
memcpy(leds_temp, leds, sizeof(CRGBF) * NUM_LEDS);
Expand Down
14 changes: 10 additions & 4 deletions src/light_modes/active/beat_tunnel.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
CRGBF tunnel_image[NUM_LEDS] = { 0.0 };
CRGBF tunnel_image_prev[NUM_LEDS] = { 0.0 };
CRGBF tunnel_image[NUM_LEDS];
CRGBF tunnel_image_prev[NUM_LEDS];
float angle = 0.0;

void draw_beat_tunnel(){
//draw_spectrum();
//scale_CRGBF_array_by_constant(leds, (1.0 - sqrt(sqrt(tempo_confidence)))*0.85 + 0.15, NUM_LEDS);
//memcpy(leds_temp, leds, sizeof(CRGBF)*NUM_LEDS);

memset(tunnel_image, 0, sizeof(CRGBF)*NUM_LEDS);

angle += 0.001;

float spread_speed = (0.125 + 0.875*configuration.speed.value.f32)*(sin(angle))*0.5;
draw_sprite(tunnel_image, tunnel_image_prev, NUM_LEDS, NUM_LEDS, spread_speed, 0.965);
float position = (0.125 + 0.875*configuration.speed.value.f32)*(sin(angle)) * 0.5;
draw_sprite(tunnel_image, tunnel_image_prev, NUM_LEDS, NUM_LEDS, position, 0.965);

for(uint16_t i = 0; i < NUM_TEMPI; i++){
float phase = 1.0 - ((tempi[i].phase + PI) / (2.0*PI));
Expand Down Expand Up @@ -40,4 +44,6 @@ void draw_beat_tunnel(){
}

memcpy(tunnel_image_prev, tunnel_image, sizeof(CRGBF)*NUM_LEDS);

//add_CRGBF_arrays(leds, leds_temp, NUM_LEDS);
}
2 changes: 1 addition & 1 deletion src/light_modes/active/fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void draw_fft(){
}
}

float auto_scale = 1.0 / fmaxf(fft_max_mag, 0.001f);
float auto_scale = 1.0 / fmaxf(fft_max_mag, 0.0001f);
auto_scale_smooth = auto_scale_smooth * 0.99 + auto_scale * 0.01;

dsps_mulc_f32(fft_mags, fft_mags, NUM_LEDS, auto_scale_smooth, 1, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/tempo.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ float calculate_magnitude_of_tempo(uint16_t tempo_bin) {
float sample_vu = vu_curve[((NOVELTY_HISTORY_LENGTH - 1) - block_size) + i];
float sample = (sample_novelty + sample_vu) / 2.0;

float q0 = tempi[tempo_bin].coeff * q1 - q2 + (sample_novelty * window_lookup[uint32_t(window_pos)]);
float q0 = tempi[tempo_bin].coeff * q1 - q2 + (sample_novelty);// * window_lookup[uint32_t(window_pos)]);
q2 = q1;
q1 = q0;

Expand Down

0 comments on commit 26fd2e3

Please sign in to comment.