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
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:
@@ -282,16 +282,28 @@ We will not dig down all the variables here but feel free to read either:
|
||||
* [sample/forge_project.cfg](./sample/forge_project.cfg) (beginner oriented)
|
||||
* [default/forge_project.cfg](./default/forge_project.cfg) (more complete)
|
||||
|
||||
#### Midi groups
|
||||
#### Input codes
|
||||
|
||||
FORGE allows you to send the midi data in the form of groups.
|
||||
Each input code can be either 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)
|
||||
|
||||
#### Input groups
|
||||
|
||||
FORGE allows you to send the midi/keyboard data in the form of groups.
|
||||
|
||||
Each group has the following properties:
|
||||
|
||||
* A number of layers with `MIDI_X_ACTIVE_COUNT` (default: `1`)
|
||||
* Each midi code controlling how to change the active layer with `MIDI_X_ACTIVE_Y`
|
||||
* A number of codes with `MIDI_X_COUNT`
|
||||
* Each midi code controlling the active layer with `MIDI_X_Y` (as a `vec3`: `_X` / `_Y` / `_Z`)
|
||||
* A number of layers with `GROUP_X_ACTIVE_COUNT` (default: `1`)
|
||||
* Each midi/keyboard code controlling how to change the active layer with `GROUP_X_ACTIVE_Y`
|
||||
* A number of codes with `GROUP_X_COUNT`
|
||||
* Each midi/keyboard code controlling the active layer with `GROUP_X_Y` (as a `vec3`: `_X` / `_Y` / `_Z`)
|
||||
|
||||
#### States
|
||||
|
||||
@@ -299,9 +311,9 @@ FORGE allows to define a "state" to a fragment shader.
|
||||
|
||||
This combines several parameters:
|
||||
|
||||
* `SELECT_PAGE_COUNT` (default: `1`) + `SELECT_PAGE_X`: define midi codes for pages of item.
|
||||
* `SELECT_ITEM_COUNT` + `SELECT_ITEM_X`: define midi codes for items per page.
|
||||
* `SELECT_FRAG_X`: define midi codes to "select" a fragment shader.
|
||||
* `SELECT_PAGE_COUNT` (default: `1`) + `SELECT_PAGE_X`: define midi/keyboard codes for pages of item.
|
||||
* `SELECT_ITEM_COUNT` + `SELECT_ITEM_X`: define midi/keyboard codes for items per page.
|
||||
* `SELECT_FRAG_X`: define midi/keyboard codes to "select" a fragment shader.
|
||||
|
||||
The selected fragment shader will have its state updated with either:
|
||||
|
||||
@@ -342,8 +354,8 @@ uniform float iTime; // the current time
|
||||
uniform sampler2D iTex0; // texture 1 (0-based)
|
||||
uniform sampler2D iTex9; // texture 10
|
||||
uniform int iSeed1;
|
||||
uniform vec3 iMidi2_3[7]; // midi group 2, layer 3, size 7
|
||||
uniform vec3 iMidi3_1[2];
|
||||
uniform vec3 iGroup2_3[7]; // midi group 2, layer 3, size 7
|
||||
uniform vec3 iGroup3_1[2];
|
||||
```
|
||||
|
||||
#### Working with `#include`
|
||||
|
||||
+102
-99
@@ -66,8 +66,8 @@ UNIFORM_IN_RESOLUTION_PREFIX=iInputResolution
|
||||
# --- 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 ---
|
||||
|
||||
@@ -134,10 +134,17 @@ FRAG_OUTPUT=9
|
||||
FRAG_MONITOR=10
|
||||
|
||||
|
||||
# ========
|
||||
# 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
|
||||
MIDI_HW=hw:CARD=nanoKONTROL2
|
||||
@@ -193,8 +200,8 @@ SELECT_ITEM_3=42
|
||||
SELECT_ITEM_4=41
|
||||
SELECT_ITEM_5=45
|
||||
|
||||
# === 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
|
||||
@@ -202,72 +209,72 @@ SELECT_ITEM_5=45
|
||||
# with the same codes for nice display
|
||||
|
||||
# Total number of groups
|
||||
MIDI_COUNT=3
|
||||
GROUP_COUNT=3
|
||||
|
||||
# Total number of layers of group 1
|
||||
MIDI_1_ACTIVE_COUNT=2
|
||||
GROUP_1_ACTIVE_COUNT=2
|
||||
# Midi codes to change layer of group 1
|
||||
MIDI_1_ACTIVE_1=32
|
||||
MIDI_1_ACTIVE_2=64
|
||||
GROUP_1_ACTIVE_1=32
|
||||
GROUP_1_ACTIVE_2=64
|
||||
|
||||
# Size of group 1
|
||||
MIDI_1_COUNT=6
|
||||
GROUP_1_COUNT=6
|
||||
# Every code of active layer manipulation of group 1
|
||||
MIDI_1_1_X=33
|
||||
MIDI_1_1_Y=49
|
||||
MIDI_1_1_Z=65
|
||||
MIDI_1_2_X=1
|
||||
MIDI_1_2_Y=17
|
||||
MIDI_1_2_Z=
|
||||
MIDI_1_3_X=34
|
||||
MIDI_1_3_Y=50
|
||||
MIDI_1_3_Z=66
|
||||
MIDI_1_4_X=2
|
||||
MIDI_1_4_Y=18
|
||||
MIDI_1_4_Z=
|
||||
MIDI_1_5_X=35
|
||||
MIDI_1_5_Y=51
|
||||
MIDI_1_5_Z=67
|
||||
MIDI_1_6_X=3
|
||||
MIDI_1_6_Y=19
|
||||
MIDI_1_6_Z=
|
||||
GROUP_1_1_X=33
|
||||
GROUP_1_1_Y=49
|
||||
GROUP_1_1_Z=65
|
||||
GROUP_1_2_X=1
|
||||
GROUP_1_2_Y=17
|
||||
GROUP_1_2_Z=
|
||||
GROUP_1_3_X=34
|
||||
GROUP_1_3_Y=50
|
||||
GROUP_1_3_Z=66
|
||||
GROUP_1_4_X=2
|
||||
GROUP_1_4_Y=18
|
||||
GROUP_1_4_Z=
|
||||
GROUP_1_5_X=35
|
||||
GROUP_1_5_Y=51
|
||||
GROUP_1_5_Z=67
|
||||
GROUP_1_6_X=3
|
||||
GROUP_1_6_Y=19
|
||||
GROUP_1_6_Z=
|
||||
|
||||
# Same for group 2
|
||||
MIDI_2_ACTIVE_COUNT=3
|
||||
MIDI_2_ACTIVE_1=36
|
||||
MIDI_2_ACTIVE_2=68
|
||||
MIDI_2_ACTIVE_3=52
|
||||
MIDI_2_COUNT=7
|
||||
MIDI_2_1_X=37
|
||||
MIDI_2_1_Y=53
|
||||
MIDI_2_1_Z=69
|
||||
MIDI_2_2_X=5
|
||||
MIDI_2_2_Y=21
|
||||
MIDI_2_2_Z=
|
||||
MIDI_2_3_X=38
|
||||
MIDI_2_3_Y=54
|
||||
MIDI_2_3_Z=70
|
||||
MIDI_2_4_X=6
|
||||
MIDI_2_4_Y=22
|
||||
MIDI_2_4_Z=
|
||||
MIDI_2_5_X=39
|
||||
MIDI_2_5_Y=55
|
||||
MIDI_2_5_Z=71
|
||||
MIDI_2_6_X=7
|
||||
MIDI_2_6_Y=23
|
||||
MIDI_2_6_Z=
|
||||
MIDI_2_7_X=4
|
||||
MIDI_2_7_Y=20
|
||||
MIDI_2_7_Z=59
|
||||
GROUP_2_ACTIVE_COUNT=3
|
||||
GROUP_2_ACTIVE_1=36
|
||||
GROUP_2_ACTIVE_2=68
|
||||
GROUP_2_ACTIVE_3=52
|
||||
GROUP_2_COUNT=7
|
||||
GROUP_2_1_X=37
|
||||
GROUP_2_1_Y=53
|
||||
GROUP_2_1_Z=69
|
||||
GROUP_2_2_X=5
|
||||
GROUP_2_2_Y=21
|
||||
GROUP_2_2_Z=
|
||||
GROUP_2_3_X=38
|
||||
GROUP_2_3_Y=54
|
||||
GROUP_2_3_Z=70
|
||||
GROUP_2_4_X=6
|
||||
GROUP_2_4_Y=22
|
||||
GROUP_2_4_Z=
|
||||
GROUP_2_5_X=39
|
||||
GROUP_2_5_Y=55
|
||||
GROUP_2_5_Z=71
|
||||
GROUP_2_6_X=7
|
||||
GROUP_2_6_Y=23
|
||||
GROUP_2_6_Z=
|
||||
GROUP_2_7_X=4
|
||||
GROUP_2_7_Y=20
|
||||
GROUP_2_7_Z=59
|
||||
|
||||
# Same for group 3
|
||||
MIDI_3_COUNT=2
|
||||
MIDI_3_1_X=48
|
||||
MIDI_3_1_Y=58
|
||||
MIDI_3_1_Z=
|
||||
MIDI_3_2_X=0
|
||||
MIDI_3_2_Y=16
|
||||
MIDI_3_2_Z=
|
||||
GROUP_3_COUNT=2
|
||||
GROUP_3_1_X=48
|
||||
GROUP_3_1_Y=58
|
||||
GROUP_3_1_Z=
|
||||
GROUP_3_2_X=0
|
||||
GROUP_3_2_Y=16
|
||||
GROUP_3_2_Z=
|
||||
|
||||
# =====
|
||||
# OTHER
|
||||
@@ -279,55 +286,51 @@ SAVE_FILE_PREFIX=forge_default_save
|
||||
|
||||
# === HOTKEYS
|
||||
# You can change the default keycodes used on runtime
|
||||
# Modifiers are encoded like this:
|
||||
# 1000 -> shift
|
||||
# 10000 -> control
|
||||
# 100000 -> alt
|
||||
# This means 110082 is control+alt+R
|
||||
|
||||
|
||||
# R on (qwerty)
|
||||
HOTKEY_RANDOMIZE=82
|
||||
KEY_RANDOMIZE=1082
|
||||
# SHIFT+R (qwerty)
|
||||
HOTKEY_RESET=1082
|
||||
KEY_RESET=11082
|
||||
# D (qwerty)
|
||||
HOTKEY_DEMO=68
|
||||
KEY_DEMO=1068
|
||||
# A (qwerty)
|
||||
HOTKEY_AUTORAND=65
|
||||
KEY_AUTORAND=1065
|
||||
# Left arrow
|
||||
HOTKEY_AUTORAND_DOWN=263
|
||||
KEY_AUTORAND_DOWN=1263
|
||||
# Right arrow
|
||||
HOTKEY_AUTORAND_UP=262
|
||||
KEY_AUTORAND_UP=1262
|
||||
# Down arrow
|
||||
HOTKEY_TEMPO_DOWN=264
|
||||
KEY_TEMPO_DOWN=1264
|
||||
# Up arrow
|
||||
HOTKEY_TEMPO_UP=265
|
||||
KEY_TEMPO_UP=1265
|
||||
|
||||
# Number of load states keys
|
||||
HOTKEY_LOAD_COUNT=10
|
||||
KEY_LOAD_COUNT=10
|
||||
|
||||
# 1 to 9 then 0 keys
|
||||
HOTKEY_LOAD_1=49
|
||||
HOTKEY_LOAD_2=50
|
||||
HOTKEY_LOAD_3=51
|
||||
HOTKEY_LOAD_4=52
|
||||
HOTKEY_LOAD_5=53
|
||||
HOTKEY_LOAD_6=54
|
||||
HOTKEY_LOAD_7=55
|
||||
HOTKEY_LOAD_8=56
|
||||
HOTKEY_LOAD_9=57
|
||||
HOTKEY_LOAD_10=48
|
||||
KEY_LOAD_1=1049
|
||||
KEY_LOAD_2=1050
|
||||
KEY_LOAD_3=1051
|
||||
KEY_LOAD_4=1052
|
||||
KEY_LOAD_5=1053
|
||||
KEY_LOAD_6=1054
|
||||
KEY_LOAD_7=1055
|
||||
KEY_LOAD_8=1056
|
||||
KEY_LOAD_9=1057
|
||||
KEY_LOAD_10=1048
|
||||
|
||||
# Number of save states keys
|
||||
HOTKEY_SAVE_COUNT=10
|
||||
KEY_SAVE_COUNT=10
|
||||
|
||||
# 1 to 9 then 0 keys with shift
|
||||
HOTKEY_SAVE_1=1049
|
||||
HOTKEY_SAVE_2=1050
|
||||
HOTKEY_SAVE_3=1051
|
||||
HOTKEY_SAVE_4=1052
|
||||
HOTKEY_SAVE_5=1053
|
||||
HOTKEY_SAVE_6=1054
|
||||
HOTKEY_SAVE_7=1055
|
||||
HOTKEY_SAVE_8=1056
|
||||
HOTKEY_SAVE_9=1057
|
||||
HOTKEY_SAVE_10=1048
|
||||
KEY_SAVE_1=11049
|
||||
KEY_SAVE_2=11050
|
||||
KEY_SAVE_3=11051
|
||||
KEY_SAVE_4=11052
|
||||
KEY_SAVE_5=11053
|
||||
KEY_SAVE_6=11054
|
||||
KEY_SAVE_7=11055
|
||||
KEY_SAVE_8=11056
|
||||
KEY_SAVE_9=11057
|
||||
KEY_SAVE_10=11048
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ out vec4 fragColor;
|
||||
subroutine uniform src_stage_sub src_stage;
|
||||
|
||||
uniform int iSeed3;
|
||||
uniform vec3 iMidi1_1[6];
|
||||
uniform vec3 iGroup1_1[6];
|
||||
|
||||
void main() {
|
||||
fragColor = src_stage(vUV, iSeed3, iMidi1_1[0], iMidi1_1[1].xy, iMidi1_1[2], iMidi1_1[3].xy, iMidi1_1[4], iMidi1_1[5].xy);
|
||||
fragColor = src_stage(vUV, iSeed3, iGroup1_1[0], iGroup1_1[1].xy, iGroup1_1[2], iGroup1_1[3].xy, iGroup1_1[4], iGroup1_1[5].xy);
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@ out vec4 fragColor;
|
||||
subroutine uniform src_stage_sub src_stage;
|
||||
|
||||
uniform int iSeed4;
|
||||
uniform vec3 iMidi1_2[6];
|
||||
uniform vec3 iGroup1_2[6];
|
||||
|
||||
void main() {
|
||||
fragColor = src_stage(vUV, iSeed4, iMidi1_2[0], iMidi1_2[1].xy, iMidi1_2[2], iMidi1_2[3].xy, iMidi1_2[4], iMidi1_2[5].xy);
|
||||
fragColor = src_stage(vUV, iSeed4, iGroup1_2[0], iGroup1_2[1].xy, iGroup1_2[2], iGroup1_2[3].xy, iGroup1_2[4], iGroup1_2[5].xy);
|
||||
}
|
||||
|
||||
+2
-2
@@ -14,8 +14,8 @@ out vec4 fragColor;
|
||||
uniform sampler2D iTex7;
|
||||
uniform sampler2D iTex9;
|
||||
uniform int iSeed5;
|
||||
uniform vec3 iMidi2_1[7];
|
||||
uniform vec3 iGroup2_1[7];
|
||||
|
||||
void main() {
|
||||
fragColor = fx_stage(vUV, iTex7, iTex9, iSeed5, iMidi2_1[0], iMidi2_1[1].xy, iMidi2_1[2], iMidi2_1[3].xy, iMidi2_1[4], iMidi2_1[5].xy, iMidi2_1[6]);
|
||||
fragColor = fx_stage(vUV, iTex7, iTex9, iSeed5, iGroup2_1[0], iGroup2_1[1].xy, iGroup2_1[2], iGroup2_1[3].xy, iGroup2_1[4], iGroup2_1[5].xy, iGroup2_1[6]);
|
||||
}
|
||||
|
||||
+2
-2
@@ -14,8 +14,8 @@ out vec4 fragColor;
|
||||
uniform sampler2D iTex8;
|
||||
uniform sampler2D iTex10;
|
||||
uniform int iSeed6;
|
||||
uniform vec3 iMidi2_2[7];
|
||||
uniform vec3 iGroup2_2[7];
|
||||
|
||||
void main() {
|
||||
fragColor = fx_stage(vUV, iTex8, iTex10, iSeed6, iMidi2_2[0], iMidi2_2[1].xy, iMidi2_2[2], iMidi2_2[3].xy, iMidi2_2[4], iMidi2_2[5].xy, iMidi2_2[6]);
|
||||
fragColor = fx_stage(vUV, iTex8, iTex10, iSeed6, iGroup2_2[0], iGroup2_2[1].xy, iGroup2_2[2], iGroup2_2[3].xy, iGroup2_2[4], iGroup2_2[5].xy, iGroup2_2[6]);
|
||||
}
|
||||
|
||||
+3
-3
@@ -16,11 +16,11 @@ uniform int iDemo;
|
||||
uniform sampler2D iTex9;
|
||||
uniform sampler2D iTex10;
|
||||
uniform int iSeed7;
|
||||
uniform vec3 iMidi3_1[2];
|
||||
uniform vec3 iGroup3_1[2];
|
||||
|
||||
void main() {
|
||||
float mix_value = magic(iMidi3_1[1].xy, vec3(1, 0, 0), iSeed7);
|
||||
bool mix_type = magic_trigger(vec3(iMidi3_1[0].x, 0, 0), iSeed7 + 10);
|
||||
float mix_value = magic(iGroup3_1[1].xy, vec3(1, 0, 0), iSeed7);
|
||||
bool mix_type = magic_trigger(vec3(iGroup3_1[0].x, 0, 0), iSeed7 + 10);
|
||||
|
||||
vec4 color_a = texture(iTex9, vUV);
|
||||
vec4 color_b = texture(iTex10, vUV);
|
||||
|
||||
+4
-4
@@ -14,16 +14,16 @@ out vec4 fragColor;
|
||||
uniform sampler2D iTex11;
|
||||
uniform sampler2D iTex0;
|
||||
uniform int iSeed8;
|
||||
uniform vec3 iMidi2_3[7];
|
||||
uniform vec3 iMidi3_1[2];
|
||||
uniform vec3 iGroup2_3[7];
|
||||
uniform vec3 iGroup3_1[2];
|
||||
uniform int iDemo;
|
||||
uniform int iAutoRand;
|
||||
|
||||
void main() {
|
||||
vec4 color = fx_stage(vUV, iTex11, iTex0, iSeed8, iMidi2_3[0], iMidi2_3[1].xy, iMidi2_3[2], iMidi2_3[3].xy, iMidi2_3[4], iMidi2_3[5].xy, iMidi2_3[6]);
|
||||
vec4 color = fx_stage(vUV, iTex11, iTex0, iSeed8, iGroup2_3[0], iGroup2_3[1].xy, iGroup2_3[2], iGroup2_3[3].xy, iGroup2_3[4], iGroup2_3[5].xy, iGroup2_3[6]);
|
||||
|
||||
if (iDemo < 1 && iAutoRand < 1) {
|
||||
color = mix(color, vec4(0), iMidi3_1[0].y);
|
||||
color = mix(color, vec4(0), iGroup3_1[0].y);
|
||||
}
|
||||
|
||||
fragColor = color;
|
||||
|
||||
+108
-50
@@ -35,17 +35,16 @@ uniform int iState8;
|
||||
uniform int iActive1;
|
||||
uniform int iActive2;
|
||||
|
||||
uniform vec3 iMidi2_1[7];
|
||||
uniform vec3 iMidi2_2[7];
|
||||
uniform vec3 iMidi2_3[7];
|
||||
uniform vec3 iMidi3_1[2];
|
||||
|
||||
uniform vec3 iGroup2_1[7];
|
||||
uniform vec3 iGroup2_2[7];
|
||||
uniform vec3 iGroup2_3[7];
|
||||
uniform vec3 iGroup3_1[2];
|
||||
|
||||
vec4 debug(vec2 vUV)
|
||||
{
|
||||
// start
|
||||
|
||||
vec2 uv0 = vUV.st;
|
||||
vec2 uv0 = vUV.st;
|
||||
float ratio = iResolution.x / iResolution.y;
|
||||
vec2 uv1 = (uv0 - .5) * vec2(ratio, 1);
|
||||
|
||||
@@ -92,30 +91,90 @@ vec4 debug(vec2 vUV)
|
||||
if (random_mfx) {
|
||||
selected_mfx = int(randTime(iSeed8 + 100) * 14);
|
||||
}
|
||||
float fxa_value = magic(iMidi2_1[6].xy, vec3(1, 0, 0), iSeed5);
|
||||
bool fxa_invert = magic_trigger(vec3(iMidi2_1[6].z, 0, 0), iSeed5);
|
||||
float fxb_value = magic(iMidi2_2[6].xy, vec3(1, 0, 0), iSeed6);
|
||||
bool fxb_invert = magic_trigger(vec3(iMidi2_2[6].z, 0, 0), iSeed6);
|
||||
float mfx_value = magic(iMidi2_3[6].xy, vec3(1, 0, 0), iSeed8);
|
||||
bool mfx_invert = magic_trigger(vec3(iMidi2_3[6].z, 0, 0), iSeed8);
|
||||
float mix_value = magic(iMidi3_1[1].xy, vec3(1, 0, 0), iSeed7);
|
||||
float fxa_value = magic(iGroup2_1[6].xy, vec3(1, 0, 0), iSeed5);
|
||||
bool fxa_invert = magic_trigger(vec3(iGroup2_1[6].z, 0, 0), iSeed5);
|
||||
float fxb_value = magic(iGroup2_2[6].xy, vec3(1, 0, 0), iSeed6);
|
||||
bool fxb_invert = magic_trigger(vec3(iGroup2_2[6].z, 0, 0), iSeed6);
|
||||
float mfx_value = magic(iGroup2_3[6].xy, vec3(1, 0, 0), iSeed8);
|
||||
bool mfx_invert = magic_trigger(vec3(iGroup2_3[6].z, 0, 0), iSeed8);
|
||||
float mix_value = magic(iGroup3_1[1].xy, vec3(1, 0, 0), iSeed7);
|
||||
mix_value = mix(mix_value, mix_value * 0.9 + 0.05, iDemo);
|
||||
bool mix_type = magic_trigger(vec3(iMidi3_1[0].x, 0, 0), iSeed7 + 10);
|
||||
bool mix_type = magic_trigger(vec3(iGroup3_1[0].x, 0, 0), iSeed7 + 10);
|
||||
|
||||
// logic
|
||||
|
||||
const int texts[10][5] = {
|
||||
{0x46, 0x50, 0x53, 0x00, 0x00}, // FPS
|
||||
{0x54, 0x45, 0x4D, 0x50, 0x4F}, // TEMPO
|
||||
{0x54, 0x49, 0x4D, 0x45, 0x00}, // TIME
|
||||
{0x44, 0x45, 0x4D, 0x4F, 0x00}, // DEMO
|
||||
{0x4C, 0x49, 0x56, 0x45, 0x00}, // LIVE
|
||||
{0x52, 0x41, 0x4E, 0x44, 0x00}, // RAND
|
||||
{0x53, 0x52, 0x43, 0x00, 0x00}, // SRC
|
||||
{0x46, 0x58, 0x00, 0x00, 0x00}, // FX
|
||||
{0x49, 0x4E, 0x00, 0x00, 0x00}, // IN
|
||||
{0x4D, 0x46, 0x58, 0x00, 0x00}, // MFX
|
||||
};
|
||||
{
|
||||
0x46,
|
||||
0x50,
|
||||
0x53,
|
||||
0x00,
|
||||
0x00
|
||||
}, // FPS
|
||||
{
|
||||
0x54,
|
||||
0x45,
|
||||
0x4D,
|
||||
0x50,
|
||||
0x4F
|
||||
}, // TEMPO
|
||||
{
|
||||
0x54,
|
||||
0x49,
|
||||
0x4D,
|
||||
0x45,
|
||||
0x00
|
||||
}, // TIME
|
||||
{
|
||||
0x44,
|
||||
0x45,
|
||||
0x4D,
|
||||
0x4F,
|
||||
0x00
|
||||
}, // DEMO
|
||||
{
|
||||
0x4C,
|
||||
0x49,
|
||||
0x56,
|
||||
0x45,
|
||||
0x00
|
||||
}, // LIVE
|
||||
{
|
||||
0x52,
|
||||
0x41,
|
||||
0x4E,
|
||||
0x44,
|
||||
0x00
|
||||
}, // RAND
|
||||
{
|
||||
0x53,
|
||||
0x52,
|
||||
0x43,
|
||||
0x00,
|
||||
0x00
|
||||
}, // SRC
|
||||
{
|
||||
0x46,
|
||||
0x58,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
}, // FX
|
||||
{
|
||||
0x49,
|
||||
0x4E,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
}, // IN
|
||||
{
|
||||
0x4D,
|
||||
0x46,
|
||||
0x58,
|
||||
0x00,
|
||||
0x00
|
||||
}, // MFX
|
||||
};
|
||||
|
||||
vec2 uv2 = uv1;
|
||||
|
||||
@@ -128,21 +187,20 @@ vec4 debug(vec2 vUV)
|
||||
// base frame
|
||||
float f =
|
||||
h_rect(uv2, vec2(-5, -2), vec2(1), 0.1) +
|
||||
h_rect(uv2, vec2(-2, -2), vec2(1), 0.1) +
|
||||
rect(uv2, vec2(-3.5, -2), vec2(0.5, 0.1)) +
|
||||
h_rect(uv2, vec2(-5, 2), vec2(1), 0.1) +
|
||||
h_rect(uv2, vec2(-2, 2), vec2(1), 0.1) +
|
||||
rect(uv2, vec2(-3.5, 2), vec2(0.5, 0.1)) +
|
||||
h_rect(uv2, vec2(2, 0), vec2(1), 0.1) +
|
||||
h_rect(uv2, vec2(5, 0), vec2(1), 0.1) +
|
||||
rect(uv2, vec2(3.5, 0), vec2(0.5, 0.1)) +
|
||||
rect(uv2, vec2(0.55, -2), vec2(1.5, 0.1)) +
|
||||
rect(uv2, vec2(2, -1.55), vec2(0.1, 0.55)) +
|
||||
rect(uv2, vec2(0.55, 2), vec2(1.5, 0.1)) +
|
||||
rect(uv2, vec2(2, 1.55), vec2(0.1, 0.55)) +
|
||||
rect(uv2, vec2(6.8, 0), vec2(0.75, 0.1)) +
|
||||
h_circle(uv2, vec2(7.8, 0), 0.3, 0.1)
|
||||
;
|
||||
h_rect(uv2, vec2(-2, -2), vec2(1), 0.1) +
|
||||
rect(uv2, vec2(-3.5, -2), vec2(0.5, 0.1)) +
|
||||
h_rect(uv2, vec2(-5, 2), vec2(1), 0.1) +
|
||||
h_rect(uv2, vec2(-2, 2), vec2(1), 0.1) +
|
||||
rect(uv2, vec2(-3.5, 2), vec2(0.5, 0.1)) +
|
||||
h_rect(uv2, vec2(2, 0), vec2(1), 0.1) +
|
||||
h_rect(uv2, vec2(5, 0), vec2(1), 0.1) +
|
||||
rect(uv2, vec2(3.5, 0), vec2(0.5, 0.1)) +
|
||||
rect(uv2, vec2(0.55, -2), vec2(1.5, 0.1)) +
|
||||
rect(uv2, vec2(2, -1.55), vec2(0.1, 0.55)) +
|
||||
rect(uv2, vec2(0.55, 2), vec2(1.5, 0.1)) +
|
||||
rect(uv2, vec2(2, 1.55), vec2(0.1, 0.55)) +
|
||||
rect(uv2, vec2(6.8, 0), vec2(0.75, 0.1)) +
|
||||
h_circle(uv2, vec2(7.8, 0), 0.3, 0.1);
|
||||
|
||||
if (iDemo < 1 && iInputFormat1 == YUYV_FOURCC) {
|
||||
f += circle(uv2, vec2(-9, 2), 0.3);
|
||||
@@ -183,14 +241,14 @@ vec4 debug(vec2 vUV)
|
||||
|
||||
// show src/fx
|
||||
|
||||
f += write_5(uv3 * 0.75, vec2(-11.6,-1.8), texts[6]);
|
||||
f += write_5(uv3 * 0.75, vec2(-4.2,-1.8), texts[7]);
|
||||
f += write_5(uv3 * 0.75, vec2(-11.6, -1.8), texts[6]);
|
||||
f += write_5(uv3 * 0.75, vec2(-4.2, -1.8), texts[7]);
|
||||
f += char_at(uv3 * 0.5, vec2(-11.5, 3.5), 0x41);
|
||||
f += char_at(uv3 * 0.5, vec2(-11.5, -6), 0x42);
|
||||
if (iDemo < 1 && (iInputFormat1 == YUYV_FOURCC || iInputFormat2 == YUYV_FOURCC)) {
|
||||
f += write_5(uv3 * 0.75, vec2(-19.7,-1.8), texts[8]);
|
||||
f += write_5(uv3 * 0.75, vec2(-19.7, -1.8), texts[8]);
|
||||
}
|
||||
f += write_5(uv3 * 0.75, vec2(10.9,2), texts[9]);
|
||||
f += write_5(uv3 * 0.75, vec2(10.9, 2), texts[9]);
|
||||
|
||||
// show inputs / feedback
|
||||
float line_a_a = rect(uv2, vec2(-7.5, 2), vec2(1.5, 0.1));
|
||||
@@ -236,21 +294,21 @@ vec4 debug(vec2 vUV)
|
||||
float x = 0;
|
||||
|
||||
x = -15;
|
||||
f += write_5(uv3, vec2(x - 4.5,13), texts[1]);
|
||||
f += write_int(uv3, vec2(x + 1.5,13), int(iTempo), 3);
|
||||
f += write_5(uv3, vec2(x - 4.5, 13), texts[1]);
|
||||
f += write_int(uv3, vec2(x + 1.5, 13), int(iTempo), 3);
|
||||
v = fract(iBeats);
|
||||
f += h_rect(uv3, vec2(x, 12), vec2(4, 0.5), 0.2);
|
||||
f += rect(uv3, vec2(x + 4 * v - 4, 12), vec2(4 * v, 0.4));
|
||||
|
||||
x = 15;
|
||||
if (iAutoRand > 0) {
|
||||
f += write_5(uv3, vec2(x - 4.5,13), texts[5]);
|
||||
f += write_int(uv3, vec2(x - 0.5,13), int(iAutoRandCycle), 5);
|
||||
f += write_5(uv3, vec2(x - 4.5, 13), texts[5]);
|
||||
f += write_int(uv3, vec2(x - 0.5, 13), int(iAutoRandCycle), 5);
|
||||
v = fract(iBeats / iAutoRandCycle);
|
||||
} else {
|
||||
f += write_int(uv3, vec2(x - 0.5,13), int(iTime), 5);
|
||||
f += write_int(uv3, vec2(x - 0.5, 13), int(iTime), 5);
|
||||
v = fract(iTime);
|
||||
f += write_5(uv3, vec2(x - 4.5,13), texts[2]);
|
||||
f += write_5(uv3, vec2(x - 4.5, 13), texts[2]);
|
||||
}
|
||||
f += h_rect(uv3, vec2(x, 12), vec2(4, 0.5), 0.2);
|
||||
f += rect(uv3, vec2(x + 4 * v - 4, 12), vec2(4 * v, 0.4));
|
||||
|
||||
+77
-69
@@ -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=17
|
||||
MIDI_1_4_Z=
|
||||
MIDI_1_5_X=34
|
||||
MIDI_1_5_Y=50
|
||||
MIDI_1_5_Z=66
|
||||
MIDI_1_6_X=2
|
||||
MIDI_1_6_Y=18
|
||||
MIDI_1_6_Z=
|
||||
MIDI_1_7_X=35
|
||||
MIDI_1_7_Y=51
|
||||
MIDI_1_7_Z=67
|
||||
MIDI_1_8_X=3
|
||||
MIDI_1_8_Y=19
|
||||
MIDI_1_8_Z=
|
||||
MIDI_1_9_X=36
|
||||
MIDI_1_9_Y=52
|
||||
MIDI_1_9_Z=68
|
||||
MIDI_1_10_X=4
|
||||
MIDI_1_10_Y=20
|
||||
MIDI_1_10_Z=
|
||||
MIDI_1_11_X=37
|
||||
MIDI_1_11_Y=53
|
||||
MIDI_1_11_Z=69
|
||||
MIDI_1_12_X=5
|
||||
MIDI_1_12_Y=21
|
||||
MIDI_1_12_Z=
|
||||
MIDI_1_13_X=38
|
||||
MIDI_1_13_Y=54
|
||||
MIDI_1_13_Z=70
|
||||
MIDI_1_14_X=6
|
||||
MIDI_1_14_Y=22
|
||||
MIDI_1_14_Z=
|
||||
MIDI_1_15_X=39
|
||||
MIDI_1_15_Y=55
|
||||
MIDI_1_15_Z=71
|
||||
MIDI_1_16_X=7
|
||||
MIDI_1_16_Y=23
|
||||
MIDI_1_16_Z=
|
||||
MIDI_1_17_X=58
|
||||
MIDI_1_17_Y=59
|
||||
MIDI_1_17_Z=
|
||||
MIDI_1_18_X=60
|
||||
MIDI_1_18_Y=61
|
||||
MIDI_1_18_Z=62
|
||||
MIDI_1_19_X=43
|
||||
MIDI_1_19_Y=44
|
||||
MIDI_1_19_Z=42
|
||||
MIDI_1_20_X=41
|
||||
MIDI_1_20_Y=45
|
||||
MIDI_1_20_Z=
|
||||
GROUP_1_1_X=32
|
||||
GROUP_1_1_Y=48
|
||||
GROUP_1_1_Z=64
|
||||
GROUP_1_2_X=0
|
||||
GROUP_1_2_Y=16
|
||||
GROUP_1_2_Z=
|
||||
GROUP_1_3_X=33
|
||||
GROUP_1_3_Y=49
|
||||
GROUP_1_3_Z=65
|
||||
GROUP_1_4_X=1
|
||||
GROUP_1_4_Y=17
|
||||
GROUP_1_4_Z=
|
||||
GROUP_1_5_X=34
|
||||
GROUP_1_5_Y=50
|
||||
GROUP_1_5_Z=66
|
||||
GROUP_1_6_X=2
|
||||
GROUP_1_6_Y=18
|
||||
GROUP_1_6_Z=
|
||||
GROUP_1_7_X=35
|
||||
GROUP_1_7_Y=51
|
||||
GROUP_1_7_Z=67
|
||||
GROUP_1_8_X=3
|
||||
GROUP_1_8_Y=19
|
||||
GROUP_1_8_Z=
|
||||
GROUP_1_9_X=36
|
||||
GROUP_1_9_Y=52
|
||||
GROUP_1_9_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
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-9
@@ -565,23 +565,24 @@ static bool init_single_program(ShaderProgram *program, unsigned int i,
|
||||
|
||||
if (program->midi_lengths.length == 0) {
|
||||
index1 = 0;
|
||||
for (unsigned int j = 0; j < state_config->midi_active_counts.length; j++) {
|
||||
for (unsigned int k = 0; k < state_config->midi_active_counts.values[j];
|
||||
for (unsigned int j = 0; j < state_config->group_active_counts.length;
|
||||
j++) {
|
||||
for (unsigned int k = 0; k < state_config->group_active_counts.values[j];
|
||||
k++) {
|
||||
program->midi_lengths.values[index1++] =
|
||||
state_config->midi_counts.values[j];
|
||||
state_config->group_counts.values[j];
|
||||
}
|
||||
}
|
||||
program->midi_lengths.length = index1;
|
||||
}
|
||||
|
||||
prefix = config_file_get_str(config, "UNIFORM_MIDI_PREFIX", "iMidi");
|
||||
prefix = config_file_get_str(config, "UNIFORM_GROUP_PREFIX", "iGroup");
|
||||
index2 = 0;
|
||||
for (unsigned int j = 0; j < state_config->midi_active_counts.length; j++) {
|
||||
for (unsigned int k = 0; k < state_config->midi_active_counts.values[j];
|
||||
for (unsigned int j = 0; j < state_config->group_active_counts.length; j++) {
|
||||
for (unsigned int k = 0; k < state_config->group_active_counts.values[j];
|
||||
k++) {
|
||||
snprintf(name, STR_LEN, "%s%d_%d", prefix, j + 1, k + 1);
|
||||
program->imidi_locations[i * program->midi_lengths.length + index2++] =
|
||||
program->igroup_locations[i * program->midi_lengths.length + index2++] =
|
||||
glGetUniformLocation(program->programs[i], name);
|
||||
}
|
||||
}
|
||||
@@ -755,7 +756,7 @@ static void use_program(const ShaderProgram *program, int i, bool output,
|
||||
offset = 0;
|
||||
for (unsigned int j = 0; j < program->midi_lengths.length; j++) {
|
||||
write_uniform_multi_3f(
|
||||
program->imidi_locations[i * program->midi_lengths.length + j],
|
||||
program->igroup_locations[i * program->midi_lengths.length + j],
|
||||
program->midi_lengths.values[j], context->values + offset);
|
||||
offset += program->midi_lengths.values[j];
|
||||
}
|
||||
@@ -780,6 +781,7 @@ static void use_program(const ShaderProgram *program, int i, bool output,
|
||||
}
|
||||
|
||||
// set GL_TEXTURE(X) to uniform sampler2D texX
|
||||
// TODO perform input swap here
|
||||
for (unsigned int j = 0; j < program->tex_count; j++) {
|
||||
write_uniform_1i(program->textures_locations[i * program->tex_count + j],
|
||||
j);
|
||||
@@ -805,7 +807,7 @@ void shaders_init(ShaderProgram *program, const Project *project,
|
||||
config_file_get_int(&project->config, "SUB_TYPE_COUNT", 0);
|
||||
program->in_count = config_file_get_int(&project->config, "IN_COUNT", 0);
|
||||
program->sub_variant_count = project->state_config.state_max;
|
||||
program->active_count = project->state_config.midi_active_counts.length;
|
||||
program->active_count = project->state_config.group_active_counts.length;
|
||||
program->midi_lengths.length = 0;
|
||||
|
||||
#ifdef VIDEO_IN
|
||||
|
||||
+111
-115
@@ -15,7 +15,7 @@
|
||||
|
||||
static void safe_midi_write(MidiDevice midi, unsigned int code,
|
||||
unsigned char value) {
|
||||
if (code != UNSET_MIDI_CODE) {
|
||||
if (code != UNSET_MIDI_CODE && code < 1000) {
|
||||
midi_write(midi, code, value);
|
||||
}
|
||||
}
|
||||
@@ -54,11 +54,11 @@ static void update_active(const Context *context, StateConfig state_config,
|
||||
MidiDevice midi, bool beat_active) {
|
||||
unsigned int k;
|
||||
|
||||
for (unsigned int i = 0; i < state_config.midi_active_counts.length; i++) {
|
||||
for (unsigned int j = 0; j < state_config.midi_active_counts.values[i];
|
||||
for (unsigned int i = 0; i < state_config.group_active_counts.length; i++) {
|
||||
for (unsigned int j = 0; j < state_config.group_active_counts.values[i];
|
||||
j++) {
|
||||
k = state_config.midi_active_offsets.values[i] + j;
|
||||
safe_midi_write(midi, state_config.midi_active_codes.values[k],
|
||||
k = state_config.group_active_offsets.values[i] + j;
|
||||
safe_midi_write(midi, state_config.group_active_codes.values[k],
|
||||
context->active[i] == j && beat_active ? MIDI_MAX : 0);
|
||||
}
|
||||
}
|
||||
@@ -70,12 +70,12 @@ static void update_values(const Context *context, StateConfig state_config,
|
||||
unsigned int k;
|
||||
unsigned int part;
|
||||
|
||||
for (unsigned int i = 0; i < state_config.midi_codes.length; i++) {
|
||||
for (unsigned int i = 0; i < state_config.codes.length; i++) {
|
||||
j = i / 3;
|
||||
part = arr_uint_remap_index(state_config.midi_offsets, &j);
|
||||
part = arr_uint_remap_index(state_config.group_offsets, &j);
|
||||
k = state_config.values_offsets.values[part] +
|
||||
context->active[part] * state_config.midi_counts.values[part] + j;
|
||||
safe_midi_write(midi, state_config.midi_codes.values[i],
|
||||
context->active[part] * state_config.group_counts.values[part] + j;
|
||||
safe_midi_write(midi, state_config.codes.values[i],
|
||||
context->values[k][i % 3] * MIDI_MAX);
|
||||
}
|
||||
}
|
||||
@@ -90,17 +90,16 @@ static void randomize(Context *context, StateConfig state_config) {
|
||||
unsigned int l;
|
||||
unsigned int part;
|
||||
|
||||
for (unsigned int i = 0; i < state_config.midi_codes.length; i++) {
|
||||
for (unsigned int i = 0; i < state_config.codes.length; i++) {
|
||||
j = i / 3;
|
||||
part = arr_uint_remap_index(state_config.midi_offsets, &j);
|
||||
for (unsigned int k = 0; k < state_config.midi_active_counts.values[part];
|
||||
part = arr_uint_remap_index(state_config.group_offsets, &j);
|
||||
for (unsigned int k = 0; k < state_config.group_active_counts.values[part];
|
||||
k++) {
|
||||
l = state_config.values_offsets.values[part] +
|
||||
k * state_config.midi_counts.values[part] + j;
|
||||
k * state_config.group_counts.values[part] + j;
|
||||
|
||||
if (arr_uint_index_of(state_config.fader_codes,
|
||||
state_config.midi_codes.values[i]) !=
|
||||
ARRAY_NOT_FOUND) {
|
||||
state_config.codes.values[i]) != ARRAY_NOT_FOUND) {
|
||||
context->values[l][i % 3] = (float)rand_uint(MIDI_MAX + 1) / MIDI_MAX;
|
||||
} else {
|
||||
context->values[l][i % 3] = rand_uint(2) == 1 ? 1 : 0;
|
||||
@@ -137,7 +136,7 @@ static void load_from_file(Context *context, StateConfig state_config,
|
||||
context->state.values[i] = config_file_get_int(&saved_state, key, 0);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < state_config.midi_active_counts.length; i++) {
|
||||
for (unsigned int i = 0; i < state_config.group_active_counts.length; i++) {
|
||||
snprintf(key, STR_LEN, "active_%d", i);
|
||||
context->active[i] = config_file_get_int(&saved_state, key, 0);
|
||||
}
|
||||
@@ -196,7 +195,7 @@ static void save_to_file(const Context *context, StateConfig state_config,
|
||||
context->state.values[i]);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < state_config.midi_active_counts.length; i++) {
|
||||
for (unsigned int i = 0; i < state_config.group_active_counts.length; i++) {
|
||||
snprintf(lines.values[lines.length++], STR_LEN, "active_%d=%d", i,
|
||||
context->active[i]);
|
||||
}
|
||||
@@ -267,62 +266,62 @@ void state_parse_config(StateConfig *state_config, const ConfigFile *config) {
|
||||
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
||||
}
|
||||
|
||||
state_config->midi_active_counts.length = state_config->midi_counts.length =
|
||||
state_config->midi_active_offsets.length =
|
||||
state_config->midi_offsets.length =
|
||||
state_config->group_active_counts.length = state_config->group_counts.length =
|
||||
state_config->group_active_offsets.length =
|
||||
state_config->group_offsets.length =
|
||||
state_config->values_offsets.length =
|
||||
config_file_get_int(config, "MIDI_COUNT", 0);
|
||||
config_file_get_int(config, "GROUP_COUNT", 0);
|
||||
|
||||
count = 0;
|
||||
for (unsigned int i = 0; i < state_config->midi_active_counts.length; i++) {
|
||||
snprintf(name, STR_LEN, "MIDI_%d_ACTIVE_COUNT", i + 1);
|
||||
state_config->midi_active_counts.values[i] =
|
||||
for (unsigned int i = 0; i < state_config->group_active_counts.length; i++) {
|
||||
snprintf(name, STR_LEN, "GROUP_%d_ACTIVE_COUNT", i + 1);
|
||||
state_config->group_active_counts.values[i] =
|
||||
config_file_get_int(config, name, 1);
|
||||
state_config->midi_active_offsets.values[i] = count;
|
||||
count += state_config->midi_active_counts.values[i];
|
||||
state_config->group_active_offsets.values[i] = count;
|
||||
count += state_config->group_active_counts.values[i];
|
||||
}
|
||||
|
||||
state_config->midi_active_codes.length = count;
|
||||
state_config->group_active_codes.length = count;
|
||||
|
||||
for (unsigned int i = 0; i < state_config->midi_active_counts.length; i++) {
|
||||
for (unsigned int j = 0; j < state_config->midi_active_counts.values[i];
|
||||
for (unsigned int i = 0; i < state_config->group_active_counts.length; i++) {
|
||||
for (unsigned int j = 0; j < state_config->group_active_counts.values[i];
|
||||
j++) {
|
||||
snprintf(name, STR_LEN, "MIDI_%d_ACTIVE_%d", i + 1, j + 1);
|
||||
state_config->midi_active_codes
|
||||
.values[state_config->midi_active_offsets.values[i] + j] =
|
||||
snprintf(name, STR_LEN, "GROUP_%d_ACTIVE_%d", i + 1, j + 1);
|
||||
state_config->group_active_codes
|
||||
.values[state_config->group_active_offsets.values[i] + j] =
|
||||
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
||||
}
|
||||
}
|
||||
|
||||
count = 0;
|
||||
offset = 0;
|
||||
for (unsigned int i = 0; i < state_config->midi_counts.length; i++) {
|
||||
snprintf(name, STR_LEN, "MIDI_%d_COUNT", i + 1);
|
||||
state_config->midi_counts.values[i] = config_file_get_int(config, name, 0);
|
||||
state_config->midi_offsets.values[i] = count;
|
||||
for (unsigned int i = 0; i < state_config->group_counts.length; i++) {
|
||||
snprintf(name, STR_LEN, "GROUP_%d_COUNT", i + 1);
|
||||
state_config->group_counts.values[i] = config_file_get_int(config, name, 0);
|
||||
state_config->group_offsets.values[i] = count;
|
||||
state_config->values_offsets.values[i] = offset;
|
||||
offset += state_config->midi_counts.values[i] *
|
||||
state_config->midi_active_counts.values[i];
|
||||
count += state_config->midi_counts.values[i];
|
||||
offset += state_config->group_counts.values[i] *
|
||||
state_config->group_active_counts.values[i];
|
||||
count += state_config->group_counts.values[i];
|
||||
}
|
||||
|
||||
state_config->value_count = offset;
|
||||
|
||||
state_config->midi_codes.length = count * 3;
|
||||
state_config->codes.length = count * 3;
|
||||
|
||||
for (unsigned int i = 0; i < state_config->midi_counts.length; i++) {
|
||||
offset = state_config->midi_offsets.values[i];
|
||||
for (unsigned int j = 0; j < state_config->midi_counts.values[i]; j++) {
|
||||
snprintf(name, STR_LEN, "MIDI_%d_%d_X", i + 1, j + 1);
|
||||
state_config->midi_codes.values[(offset + j) * 3] =
|
||||
for (unsigned int i = 0; i < state_config->group_counts.length; i++) {
|
||||
offset = state_config->group_offsets.values[i];
|
||||
for (unsigned int j = 0; j < state_config->group_counts.values[i]; j++) {
|
||||
snprintf(name, STR_LEN, "GROUP_%d_%d_X", i + 1, j + 1);
|
||||
state_config->codes.values[(offset + j) * 3] =
|
||||
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
||||
|
||||
snprintf(name, STR_LEN, "MIDI_%d_%d_Y", i + 1, j + 1);
|
||||
state_config->midi_codes.values[(offset + j) * 3 + 1] =
|
||||
snprintf(name, STR_LEN, "GROUP_%d_%d_Y", i + 1, j + 1);
|
||||
state_config->codes.values[(offset + j) * 3 + 1] =
|
||||
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
||||
|
||||
snprintf(name, STR_LEN, "MIDI_%d_%d_Z", i + 1, j + 1);
|
||||
state_config->midi_codes.values[(offset + j) * 3 + 2] =
|
||||
snprintf(name, STR_LEN, "GROUP_%d_%d_Z", i + 1, j + 1);
|
||||
state_config->codes.values[(offset + j) * 3 + 2] =
|
||||
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
||||
}
|
||||
}
|
||||
@@ -343,66 +342,63 @@ void state_parse_config(StateConfig *state_config, const ConfigFile *config) {
|
||||
config_file_get_str(config, "SAVE_FILE_PREFIX", "forge_save"),
|
||||
STR_LEN);
|
||||
|
||||
state_config->hotkey_randomize =
|
||||
config_file_get_int(config, "HOTKEY_RANDOMIZE", 82);
|
||||
state_config->hotkey_reset =
|
||||
config_file_get_int(config, "HOTKEY_RESET", 1082);
|
||||
state_config->hotkey_demo = config_file_get_int(config, "HOTKEY_DEMO", 68);
|
||||
state_config->hotkey_autorand =
|
||||
config_file_get_int(config, "HOTKEY_AUTORAND", 65);
|
||||
state_config->hotkey_autorand_down =
|
||||
config_file_get_int(config, "HOTKEY_AUTORAND_DOWN", 263);
|
||||
state_config->hotkey_autorand_up =
|
||||
config_file_get_int(config, "HOTKEY_AUTORAND_UP", 262);
|
||||
state_config->hotkey_tempo_down =
|
||||
config_file_get_int(config, "HOTKEY_TEMPO_DOWN", 264);
|
||||
state_config->hotkey_tempo_up =
|
||||
config_file_get_int(config, "HOTKEY_TEMPO_UP", 265);
|
||||
state_config->key_randomize =
|
||||
config_file_get_int(config, "KEY_RANDOMIZE", 1082);
|
||||
state_config->key_reset = config_file_get_int(config, "KEY_RESET", 11082);
|
||||
state_config->key_demo = config_file_get_int(config, "KEY_DEMO", 1068);
|
||||
state_config->key_autorand =
|
||||
config_file_get_int(config, "KEY_AUTORAND", 1065);
|
||||
state_config->key_autorand_down =
|
||||
config_file_get_int(config, "KEY_AUTORAND_DOWN", 1263);
|
||||
state_config->key_autorand_up =
|
||||
config_file_get_int(config, "KEY_AUTORAND_UP", 1262);
|
||||
state_config->key_tempo_down =
|
||||
config_file_get_int(config, "KEY_TEMPO_DOWN", 1264);
|
||||
state_config->key_tempo_up =
|
||||
config_file_get_int(config, "KEY_TEMPO_UP", 1265);
|
||||
|
||||
if (config_file_has(config, "HOTKEY_LOAD_COUNT")) {
|
||||
state_config->hotkey_load.length =
|
||||
config_file_get_int(config, "HOTKEY_LOAD_COUNT", 0);
|
||||
if (config_file_has(config, "KEY_LOAD_COUNT")) {
|
||||
state_config->key_load.length =
|
||||
config_file_get_int(config, "KEY_LOAD_COUNT", 0);
|
||||
|
||||
for (unsigned int i = 0; i < state_config->hotkey_load.length; i++) {
|
||||
snprintf(name, STR_LEN, "HOTKEY_LOAD_%d", i + 1);
|
||||
state_config->hotkey_load.values[i] =
|
||||
config_file_get_int(config, name, 0);
|
||||
for (unsigned int i = 0; i < state_config->key_load.length; i++) {
|
||||
snprintf(name, STR_LEN, "KEY_LOAD_%d", i + 1);
|
||||
state_config->key_load.values[i] = config_file_get_int(config, name, 0);
|
||||
}
|
||||
} else {
|
||||
state_config->hotkey_load.length = 10;
|
||||
state_config->hotkey_load.values[0] = 49;
|
||||
state_config->hotkey_load.values[1] = 50;
|
||||
state_config->hotkey_load.values[2] = 51;
|
||||
state_config->hotkey_load.values[3] = 52;
|
||||
state_config->hotkey_load.values[4] = 53;
|
||||
state_config->hotkey_load.values[5] = 54;
|
||||
state_config->hotkey_load.values[6] = 55;
|
||||
state_config->hotkey_load.values[7] = 56;
|
||||
state_config->hotkey_load.values[8] = 57;
|
||||
state_config->hotkey_load.values[9] = 48;
|
||||
state_config->key_load.length = 10;
|
||||
state_config->key_load.values[0] = 1049;
|
||||
state_config->key_load.values[1] = 1050;
|
||||
state_config->key_load.values[2] = 1051;
|
||||
state_config->key_load.values[3] = 1052;
|
||||
state_config->key_load.values[4] = 1053;
|
||||
state_config->key_load.values[5] = 1054;
|
||||
state_config->key_load.values[6] = 1055;
|
||||
state_config->key_load.values[7] = 1056;
|
||||
state_config->key_load.values[8] = 1057;
|
||||
state_config->key_load.values[9] = 1048;
|
||||
}
|
||||
|
||||
if (config_file_has(config, "HOTKEY_SAVE_COUNT")) {
|
||||
state_config->hotkey_save.length =
|
||||
config_file_get_int(config, "HOTKEY_SAVE_COUNT", 0);
|
||||
if (config_file_has(config, "KEY_SAVE_COUNT")) {
|
||||
state_config->key_save.length =
|
||||
config_file_get_int(config, "KEY_SAVE_COUNT", 0);
|
||||
|
||||
for (unsigned int i = 0; i < state_config->hotkey_save.length; i++) {
|
||||
snprintf(name, STR_LEN, "HOTKEY_SAVE_%d", i + 1);
|
||||
state_config->hotkey_save.values[i] =
|
||||
config_file_get_int(config, name, 0);
|
||||
for (unsigned int i = 0; i < state_config->key_save.length; i++) {
|
||||
snprintf(name, STR_LEN, "KEY_SAVE_%d", i + 1);
|
||||
state_config->key_save.values[i] = config_file_get_int(config, name, 0);
|
||||
}
|
||||
} else {
|
||||
state_config->hotkey_save.length = 10;
|
||||
state_config->hotkey_save.values[0] = 1049;
|
||||
state_config->hotkey_save.values[1] = 1050;
|
||||
state_config->hotkey_save.values[2] = 1051;
|
||||
state_config->hotkey_save.values[3] = 1052;
|
||||
state_config->hotkey_save.values[4] = 1053;
|
||||
state_config->hotkey_save.values[5] = 1054;
|
||||
state_config->hotkey_save.values[6] = 1055;
|
||||
state_config->hotkey_save.values[7] = 1056;
|
||||
state_config->hotkey_save.values[8] = 1057;
|
||||
state_config->hotkey_save.values[9] = 1048;
|
||||
state_config->key_save.length = 10;
|
||||
state_config->key_save.values[0] = 11049;
|
||||
state_config->key_save.values[1] = 11050;
|
||||
state_config->key_save.values[2] = 11051;
|
||||
state_config->key_save.values[3] = 11052;
|
||||
state_config->key_save.values[4] = 11053;
|
||||
state_config->key_save.values[5] = 11054;
|
||||
state_config->key_save.values[6] = 11055;
|
||||
state_config->key_save.values[7] = 11056;
|
||||
state_config->key_save.values[8] = 11057;
|
||||
state_config->key_save.values[9] = 11048;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,11 +445,11 @@ void state_midi_event(Context *context, StateConfig state_config,
|
||||
}
|
||||
|
||||
// ACTIVE CHANGE
|
||||
i = arr_uint_index_of(state_config.midi_active_codes, code);
|
||||
i = arr_uint_index_of(state_config.group_active_codes, code);
|
||||
if (i != ARRAY_NOT_FOUND) {
|
||||
found = true;
|
||||
if (value > 0) {
|
||||
part = arr_uint_remap_index(state_config.midi_active_offsets, &i);
|
||||
part = arr_uint_remap_index(state_config.group_active_offsets, &i);
|
||||
context->active[part] = i;
|
||||
update_active(context, state_config, midi, true);
|
||||
update_values(context, state_config, midi);
|
||||
@@ -461,13 +457,13 @@ void state_midi_event(Context *context, StateConfig state_config,
|
||||
}
|
||||
|
||||
// VALUE CHANGE
|
||||
i = arr_uint_index_of(state_config.midi_codes, code);
|
||||
i = arr_uint_index_of(state_config.codes, code);
|
||||
if (i != ARRAY_NOT_FOUND) {
|
||||
found = true;
|
||||
j = i / 3;
|
||||
part = arr_uint_remap_index(state_config.midi_offsets, &j);
|
||||
part = arr_uint_remap_index(state_config.group_offsets, &j);
|
||||
k = state_config.values_offsets.values[part] +
|
||||
context->active[part] * state_config.midi_counts.values[part] + j;
|
||||
context->active[part] * state_config.group_counts.values[part] + j;
|
||||
|
||||
if (arr_uint_index_of(state_config.fader_codes, code) != ARRAY_NOT_FOUND) {
|
||||
context->values[k][i % 3] = (float)value / MIDI_MAX;
|
||||
@@ -504,40 +500,40 @@ void state_key_event(Context *context, StateConfig state_config,
|
||||
unsigned int code, MidiDevice midi) {
|
||||
unsigned int index;
|
||||
|
||||
if (code == state_config.hotkey_randomize) {
|
||||
if (code == state_config.key_randomize) {
|
||||
log_info("[%d] Randomized", code);
|
||||
randomize(context, state_config);
|
||||
update_values(context, state_config, midi);
|
||||
} else if (code == state_config.hotkey_reset) {
|
||||
} else if (code == state_config.key_reset) {
|
||||
log_info("[%d] Reset", code);
|
||||
reset(context);
|
||||
update_values(context, state_config, midi);
|
||||
} else if (code == state_config.hotkey_demo) {
|
||||
} else if (code == state_config.key_demo) {
|
||||
log_info((context->demo ? "[%d] Demo OFF" : "[%d] Demo ON"), code);
|
||||
context->demo = !context->demo;
|
||||
} else if (code == state_config.hotkey_autorand) {
|
||||
} else if (code == state_config.key_autorand) {
|
||||
log_info(
|
||||
(context->auto_random ? "[%d] Auto Random OFF" : "[%d] Auto Random ON"),
|
||||
code);
|
||||
context->auto_random = !context->auto_random;
|
||||
} else if (code == state_config.hotkey_autorand_down) {
|
||||
} else if (code == state_config.key_autorand_down) {
|
||||
if (context->auto_random_cycle > 1) {
|
||||
context->auto_random_cycle -= 1;
|
||||
}
|
||||
log_info("[%d] Auto Random Cycle: %d", code, context->auto_random_cycle);
|
||||
} else if (code == state_config.hotkey_autorand_up) {
|
||||
} else if (code == state_config.key_autorand_up) {
|
||||
context->auto_random_cycle += 1;
|
||||
log_info("[%d] Auto Random Cycle: %d", code, context->auto_random_cycle);
|
||||
} else if (code == state_config.hotkey_tempo_up) {
|
||||
} else if (code == state_config.key_tempo_up) {
|
||||
tempo_set(&context->tempo, context->tempo.tempo + 1);
|
||||
log_info("[%d] Tempo: %f", code, context->tempo);
|
||||
} else if (code == state_config.hotkey_tempo_down) {
|
||||
} else if (code == state_config.key_tempo_down) {
|
||||
if (context->tempo.tempo > 0) {
|
||||
tempo_set(&context->tempo, context->tempo.tempo - 1);
|
||||
}
|
||||
log_info("[%d] Tempo: %f", code, context->tempo);
|
||||
} else {
|
||||
index = arr_uint_index_of(state_config.hotkey_load, code);
|
||||
index = arr_uint_index_of(state_config.key_load, code);
|
||||
|
||||
if (index != ARRAY_NOT_FOUND) {
|
||||
log_info("[%d] Loading state %d", code, index + 1);
|
||||
@@ -545,7 +541,7 @@ void state_key_event(Context *context, StateConfig state_config,
|
||||
return;
|
||||
}
|
||||
|
||||
index = arr_uint_index_of(state_config.hotkey_save, code);
|
||||
index = arr_uint_index_of(state_config.key_save, code);
|
||||
|
||||
if (index != ARRAY_NOT_FOUND) {
|
||||
log_info("[%d] Saving state %d", code, index + 1);
|
||||
|
||||
+17
-17
@@ -116,7 +116,7 @@ typedef struct ShaderProgram {
|
||||
GLuint iactive_locations[ARRAY_SIZE];
|
||||
|
||||
UintArray midi_lengths;
|
||||
GLuint imidi_locations[ARRAY_SIZE];
|
||||
GLuint igroup_locations[ARRAY_SIZE];
|
||||
|
||||
GLuint vpos_locations[ARRAY_SIZE];
|
||||
|
||||
@@ -240,12 +240,12 @@ typedef struct StateConfig {
|
||||
UintArray select_page_codes;
|
||||
UintArray select_item_codes;
|
||||
UintArray select_frag_codes;
|
||||
UintArray midi_active_counts;
|
||||
UintArray midi_active_offsets;
|
||||
UintArray midi_active_codes;
|
||||
UintArray midi_counts;
|
||||
UintArray midi_offsets;
|
||||
UintArray midi_codes;
|
||||
UintArray group_active_counts;
|
||||
UintArray group_active_offsets;
|
||||
UintArray group_active_codes;
|
||||
UintArray group_counts;
|
||||
UintArray group_offsets;
|
||||
UintArray codes;
|
||||
UintArray fader_codes;
|
||||
UintArray values_offsets;
|
||||
|
||||
@@ -255,17 +255,17 @@ typedef struct StateConfig {
|
||||
|
||||
char save_file_prefix[STR_LEN];
|
||||
|
||||
unsigned int hotkey_randomize;
|
||||
unsigned int hotkey_reset;
|
||||
unsigned int hotkey_demo;
|
||||
unsigned int hotkey_autorand;
|
||||
unsigned int hotkey_autorand_up;
|
||||
unsigned int hotkey_autorand_down;
|
||||
unsigned int hotkey_tempo_up;
|
||||
unsigned int hotkey_tempo_down;
|
||||
unsigned int key_randomize;
|
||||
unsigned int key_reset;
|
||||
unsigned int key_demo;
|
||||
unsigned int key_autorand;
|
||||
unsigned int key_autorand_up;
|
||||
unsigned int key_autorand_down;
|
||||
unsigned int key_tempo_up;
|
||||
unsigned int key_tempo_down;
|
||||
|
||||
UintArray hotkey_load;
|
||||
UintArray hotkey_save;
|
||||
UintArray key_load;
|
||||
UintArray key_save;
|
||||
} StateConfig;
|
||||
|
||||
typedef struct StateBackgroundWriteArgs {
|
||||
|
||||
+1
-1
@@ -199,7 +199,7 @@ static bool request_buffers(VideoCapture *video_capture) {
|
||||
|
||||
reqbuf.type = buf_type;
|
||||
reqbuf.memory = V4L2_MEMORY_MMAP;
|
||||
reqbuf.count = 2;
|
||||
reqbuf.count = 2; // TODO buffer array with count from parameters
|
||||
|
||||
if (ioctl(video_capture->fd, VIDIOC_REQBUFS, &reqbuf) == -1) {
|
||||
ioctl_error(video_capture, "VIDIOC_REQBUFS",
|
||||
|
||||
+5
-5
@@ -157,15 +157,15 @@ unsigned int window_read_key(int key, int action, int mods) {
|
||||
key == GLFW_KEY_RIGHT_ALT) {
|
||||
return 0;
|
||||
}
|
||||
result = key;
|
||||
result = 1000 + key;
|
||||
if ((mods & GLFW_MOD_SHIFT) > 0) {
|
||||
result += 1000;
|
||||
}
|
||||
if ((mods & GLFW_MOD_CONTROL) > 0) {
|
||||
result += 10000;
|
||||
}
|
||||
if ((mods & GLFW_MOD_ALT) > 0) {
|
||||
if ((mods & GLFW_MOD_CONTROL) > 0) {
|
||||
result += 100000;
|
||||
}
|
||||
if ((mods & GLFW_MOD_ALT) > 0) {
|
||||
result += 1000000;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user