refactor: not overlaping keyboard and midi
Clang Lint CI / lint-no-video (push) Successful in 1m0s
Clang Build CI / run-no-video (push) Successful in 1m0s
Clang Build CI / run-video (push) Successful in 1m1s
Clang Build CI / build-release (push) Successful in 1m56s
Clang Lint CI / lint-video (push) Successful in 1m59s

This commit is contained in:
2026-05-14 22:27:39 +02:00
parent 28b87d316a
commit 6abf050bcc
16 changed files with 499 additions and 420 deletions
+77 -69
View File
@@ -44,8 +44,8 @@ UNIFORM_RESOLUTION=iResolution
# --- uniform vec3 ---
# Midi group X layer Y (beware of group size)
# Injected as "iMidiX_Y[Z]"
UNIFORM_MIDI_PREFIX=iMidi
# Injected as "iGroupX_Y[Z]"
UNIFORM_GROUP_PREFIX=iGroup
# --- uniform sampler2D ---
@@ -79,9 +79,17 @@ FRAG_OUTPUT=2
FRAG_MONITOR=2
# ========
# MIDI I/O
# ========
# ==========
# I/O Inputs
# ==========
# Each code either maps to a midi event or a key code
# 1 - 999 -> midi event
# 1001 - 1999 -> key code
# Keyboard modifiers are encoded like this:
# 10000 -> shift
# 100000 -> control
# 1000000 -> alt
# This means 111082 is control+alt+R
# The recognized ALSA name of the midi device
@@ -114,8 +122,8 @@ FADER_16=23
# Midi code for tap tempo
TAP_TEMPO=46
# === MIDI INPUT STATES
# Midi inputs will control FORGE's state as follows
# === GROUP INPUT STATES
# Inputs will control FORGE's state as follows
# X groups of Y layers sized Z
# You can manipulate only 1 layer at a time
# Every layer of every groups will be send as uniforms
@@ -123,68 +131,68 @@ TAP_TEMPO=46
# with the same codes for nice display
# Total number of groups
MIDI_COUNT=1
GROUP_COUNT=1
# Size of group 1
MIDI_1_COUNT=20
GROUP_1_COUNT=20
# Every code of active layer manipulation of group 1
MIDI_1_1_X=32
MIDI_1_1_Y=48
MIDI_1_1_Z=64
MIDI_1_2_X=0
MIDI_1_2_Y=16
MIDI_1_2_Z=
MIDI_1_3_X=33
MIDI_1_3_Y=49
MIDI_1_3_Z=65
MIDI_1_4_X=1
MIDI_1_4_Y=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z=68
GROUP_1_10_X=4
GROUP_1_10_Y=20
GROUP_1_10_Z=
GROUP_1_11_X=37
GROUP_1_11_Y=53
GROUP_1_11_Z=69
GROUP_1_12_X=5
GROUP_1_12_Y=21
GROUP_1_12_Z=
GROUP_1_13_X=38
GROUP_1_13_Y=54
GROUP_1_13_Z=70
GROUP_1_14_X=6
GROUP_1_14_Y=22
GROUP_1_14_Z=
GROUP_1_15_X=39
GROUP_1_15_Y=55
GROUP_1_15_Z=71
GROUP_1_16_X=7
GROUP_1_16_Y=23
GROUP_1_16_Z=
GROUP_1_17_X=58
GROUP_1_17_Y=59
GROUP_1_17_Z=
GROUP_1_18_X=60
GROUP_1_18_Y=61
GROUP_1_18_Z=62
GROUP_1_19_X=43
GROUP_1_19_Y=44
GROUP_1_19_Z=42
GROUP_1_20_X=41
GROUP_1_20_Y=45
GROUP_1_20_Z=
+29 -29
View File
@@ -12,31 +12,31 @@ uniform int iFPS; // output window frames per seconds
uniform int iDemo; // 0/1 if demo mode
uniform int iSeed1; // a random seed assigned at start
uniform vec2 iResolution; // output window resolution in pixels
uniform vec3 iMidi1_1[20]; // all midi inputs defined
uniform vec3 iGroup1_1[20]; // all midi inputs defined
uniform sampler2D iTex0; // available texture (this code output, so feedback)
void main() {
// all available buttons and faders
vec3 b1 = iMidi1_1[0];
vec2 f1 = iMidi1_1[1].xy;
vec3 b2 = iMidi1_1[2];
vec2 f2 = iMidi1_1[3].xy;
vec3 b3 = iMidi1_1[4];
vec2 f3 = iMidi1_1[5].xy;
vec3 b4 = iMidi1_1[6];
vec2 f4 = iMidi1_1[7].xy;
vec3 b5 = iMidi1_1[8];
vec2 f5 = iMidi1_1[9].xy;
vec3 b6 = iMidi1_1[10];
vec2 f6 = iMidi1_1[11].xy;
vec3 b7 = iMidi1_1[12];
vec2 f7 = iMidi1_1[13].xy;
vec3 b8 = iMidi1_1[14];
vec2 f8 = iMidi1_1[15].xy;
vec3 b9 = iMidi1_1[16];
vec3 b10 = iMidi1_1[17];
vec3 b11 = iMidi1_1[18];
vec3 b12 = iMidi1_1[19];
vec3 b1 = iGroup1_1[0];
vec2 f1 = iGroup1_1[1].xy;
vec3 b2 = iGroup1_1[2];
vec2 f2 = iGroup1_1[3].xy;
vec3 b3 = iGroup1_1[4];
vec2 f3 = iGroup1_1[5].xy;
vec3 b4 = iGroup1_1[6];
vec2 f4 = iGroup1_1[7].xy;
vec3 b5 = iGroup1_1[8];
vec2 f5 = iGroup1_1[9].xy;
vec3 b6 = iGroup1_1[10];
vec2 f6 = iGroup1_1[11].xy;
vec3 b7 = iGroup1_1[12];
vec2 f7 = iGroup1_1[13].xy;
vec3 b8 = iGroup1_1[14];
vec2 f8 = iGroup1_1[15].xy;
vec3 b9 = iGroup1_1[16];
vec3 b10 = iGroup1_1[17];
vec3 b11 = iGroup1_1[18];
vec3 b12 = iGroup1_1[19];
// center UV and scale it to ratio
vec2 uv0 = vUV.st;
@@ -47,19 +47,19 @@ void main() {
float circle_dist = 0.1 + 0.9 * f1.x;
float circle_size = 0.1 + 0.9 * f2.x;
vec2 circle_pos = circle_dist * vec2(
sin(iBeats * 2 * PI),
cos(iBeats * 2 * PI)
);
sin(iBeats * 2 * PI),
cos(iBeats * 2 * PI)
);
float circle = 1 - step(circle_size, length(uv1 - circle_pos));
// fader 3, 4 and 5 controls the color
vec3 color = vec3(
f3.x,
f4.x,
f5.x
);
f3.x,
f4.x,
f5.x
);
vec3 out_color = mix(color, 1 - color, circle);
// fader 8 controls the feedback value
fragColor = mix(vec4(out_color, 1), texture(iTex0, vUV.st), f8.x);
}
}