Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a440535953 | ||
|
|
cec3d54685 | ||
|
|
7355d0937c | ||
|
|
1c44239a8d | ||
|
|
73dd4b75d3 | ||
|
|
50f5d6f6cb | ||
|
|
9b7fbfbeeb | ||
|
|
192cf571b1 | ||
|
|
519a9b88f4 | ||
|
|
f124cfacfb | ||
|
|
4e14404726 | ||
|
|
db77846f1b | ||
|
|
57fa627bed | ||
|
|
9dbfd34566 | ||
|
|
3dc2a77529 | ||
|
|
7dbce62182 | ||
|
|
bb84350591 | ||
|
|
7db7f4b89e |
+1
-1
@@ -124,7 +124,7 @@ make -f Makefile.dev release-arch
|
|||||||
- [x] (clean) static functions at top of files
|
- [x] (clean) static functions at top of files
|
||||||
- [x] Configurable key codes
|
- [x] Configurable key codes
|
||||||
- [x] Monitor improvements
|
- [x] Monitor improvements
|
||||||
- [ ] Ignore some values in auto random
|
- [x] Ignore some values in auto random
|
||||||
- [x] build without video in
|
- [x] build without video in
|
||||||
- [ ] Update README monitor/keymap
|
- [ ] Update README monitor/keymap
|
||||||
- [x] Auto reconnect midi input
|
- [x] Auto reconnect midi input
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ build-no-video:
|
|||||||
-lm -lGL -lglfw -lasound \
|
-lm -lGL -lglfw -lasound \
|
||||||
-Wall -Wextra \
|
-Wall -Wextra \
|
||||||
-Wno-format-truncation \
|
-Wno-format-truncation \
|
||||||
-Wno-unused-parameter \
|
|
||||||
-DGLFW_INCLUDE_NONE \
|
-DGLFW_INCLUDE_NONE \
|
||||||
-DGLFW_NATIVE_INCLUDE_NONE \
|
-DGLFW_NATIVE_INCLUDE_NONE \
|
||||||
-DLOG_USE_COLOR \
|
-DLOG_USE_COLOR \
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
pkgname=forge-steel
|
pkgname=forge-steel
|
||||||
pkgver=1.1.3
|
pkgver=1.2.4
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Fusion Of Real Time Generative Effects"
|
pkgdesc="Fusion Of Real Time Generative Effects"
|
||||||
arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64' 'riscv64')
|
arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64' 'riscv64')
|
||||||
depends=('glfw>=1:3', 'v4l-utils>=1.32', 'alsa-lib>=1.2', 'libglvnd>=1.7')
|
depends=('glfw>=1:3', 'v4l-utils>=1.32', 'alsa-lib>=1.2', 'libglvnd>=1.7')
|
||||||
url="https://git.klemek.fr/klemek/forge-steel"
|
url="https://git.klemek.fr/klemek/forge-steel"
|
||||||
source=("${pkgname}-steel-${pkgver}.tar.gz::https://git.klemek.fr/klemek/forge-steel/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
|
source=("${pkgname}-steel-${pkgver}.tar.gz::https://git.klemek.fr/klemek/forge-steel/releases/download/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
|
||||||
sha256sums=('536370c14aaac35729b29270cecca01a6c966bcae306fa2ec20f8a514a3ed8bd')
|
sha256sums=('a34c7f8101d8d947e26bee1fa5ab8d87f4292014e5ef17d03eb34fefb387db9e')
|
||||||
srcdir=build
|
srcdir=build
|
||||||
backup=("usr/share/${pkgname}")
|
backup=("usr/share/${pkgname}")
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[](https://git.klemek.fr/klemek/forge-steel/actions?workflow=lint.yml) [](https://git.klemek.fr/klemek/forge-steel/actions?workflow=build.yml) 
|
[](https://git.klemek.fr/klemek/forge-steel/actions?workflow=lint.yml) [](https://git.klemek.fr/klemek/forge-steel/actions?workflow=build.yml) 
|
||||||
|
|
||||||
<!-- omit from toc -->
|
<!-- omit from toc -->
|
||||||
# F.O.R.G.E. (Steel)
|
# F.O.R.G.E. (Steel)
|
||||||
@@ -263,6 +263,28 @@ Working with pages and items, you can use the following predefined sources and e
|
|||||||
|
|
||||||
See the [printable version](./docs/forge_default_mapping.pdf).
|
See the [printable version](./docs/forge_default_mapping.pdf).
|
||||||
|
|
||||||
|
### Available hotkeys
|
||||||
|
|
||||||
|
| Hotkey | Function |
|
||||||
|
| ------ | -------- |
|
||||||
|
| <kbd>Shift</kbd> + <kbd>F</kbd> | Switch between shader-decoded or hardware decoded YUYV |
|
||||||
|
| <kbd>M</kbd> | Projection mapping 1 |
|
||||||
|
| <kbd>Shift</kbd> + <kbd>M</kbd> | Projection mapping 2 |
|
||||||
|
| <kbd>Ctrl</kbd> + <kbd>M</kbd> | Projection mapping 3 |
|
||||||
|
| <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>M</kbd> | Projection mapping 4 |
|
||||||
|
|
||||||
|
### Projection Mappings
|
||||||
|
|
||||||
|
In any of the projection mapping mode, use the nanoKONTROL2 last 4 columns to control 4 on-screen points:
|
||||||
|
|
||||||
|
| Midi Control | Function |
|
||||||
|
| ------ | -------- |
|
||||||
|
| Fader N | point N - X position |
|
||||||
|
| Knob N | point N - Y position |
|
||||||
|
| Last column top button | activate projection mapping |
|
||||||
|
| Last column middle button | invert projection mapping |
|
||||||
|
| Last column bottom button | show projection borders |
|
||||||
|
|
||||||
## Making your own FORGE project
|
## Making your own FORGE project
|
||||||
|
|
||||||
You want to embrace the "user" in "user-defined"? It's time to make your own project.
|
You want to embrace the "user" in "user-defined"? It's time to make your own project.
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
AC_INIT([forge], [steel-1.1.3], [klemek.dev@proton.me])
|
AC_INIT([forge], [steel-1.2.4], [klemek.dev@proton.me])
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
|
||||||
|
|||||||
@@ -235,10 +235,14 @@ GROUP_1_6_Y=19
|
|||||||
GROUP_1_6_Z=
|
GROUP_1_6_Z=
|
||||||
|
|
||||||
# Same for group 2
|
# Same for group 2
|
||||||
GROUP_2_ACTIVE_COUNT=3
|
GROUP_2_ACTIVE_COUNT=7
|
||||||
GROUP_2_ACTIVE_1=36
|
GROUP_2_ACTIVE_1=36
|
||||||
GROUP_2_ACTIVE_2=68
|
GROUP_2_ACTIVE_2=68
|
||||||
GROUP_2_ACTIVE_3=52
|
GROUP_2_ACTIVE_3=52
|
||||||
|
GROUP_2_ACTIVE_4=1077
|
||||||
|
GROUP_2_ACTIVE_5=11077
|
||||||
|
GROUP_2_ACTIVE_6=101077
|
||||||
|
GROUP_2_ACTIVE_7=111077
|
||||||
GROUP_2_COUNT=7
|
GROUP_2_COUNT=7
|
||||||
GROUP_2_1_X=37
|
GROUP_2_1_X=37
|
||||||
GROUP_2_1_Y=53
|
GROUP_2_1_Y=53
|
||||||
@@ -271,6 +275,71 @@ GROUP_3_2_X=0
|
|||||||
GROUP_3_2_Y=16
|
GROUP_3_2_Y=16
|
||||||
GROUP_3_2_Z=11089
|
GROUP_3_2_Z=11089
|
||||||
|
|
||||||
|
# Auto-Random Ignore (ARI) prefixes
|
||||||
|
ARI_COUNT=62
|
||||||
|
ARI_1=GROUP_3_1_Y
|
||||||
|
ARI_2=GROUP_3_2_Z
|
||||||
|
ARI_3=GROUP_2_5_X_4
|
||||||
|
ARI_4=GROUP_2_5_Y_4
|
||||||
|
ARI_5=GROUP_2_5_Z_4
|
||||||
|
ARI_6=GROUP_2_2_X_4
|
||||||
|
ARI_7=GROUP_2_2_Y_4
|
||||||
|
ARI_8=GROUP_2_2_Z_4
|
||||||
|
ARI_9=GROUP_2_4_X_4
|
||||||
|
ARI_10=GROUP_2_4_Y_4
|
||||||
|
ARI_11=GROUP_2_4_Z_4
|
||||||
|
ARI_12=GROUP_2_6_X_4
|
||||||
|
ARI_13=GROUP_2_6_Y_4
|
||||||
|
ARI_14=GROUP_2_6_Z_4
|
||||||
|
ARI_15=GROUP_2_7_X_4
|
||||||
|
ARI_16=GROUP_2_7_Y_4
|
||||||
|
ARI_17=GROUP_2_7_Z_4
|
||||||
|
ARI_18=GROUP_2_5_X_5
|
||||||
|
ARI_19=GROUP_2_5_Y_5
|
||||||
|
ARI_20=GROUP_2_5_Z_5
|
||||||
|
ARI_21=GROUP_2_2_X_5
|
||||||
|
ARI_22=GROUP_2_2_Y_5
|
||||||
|
ARI_23=GROUP_2_2_Z_5
|
||||||
|
ARI_24=GROUP_2_4_X_5
|
||||||
|
ARI_25=GROUP_2_4_Y_5
|
||||||
|
ARI_26=GROUP_2_4_Z_5
|
||||||
|
ARI_27=GROUP_2_6_X_5
|
||||||
|
ARI_28=GROUP_2_6_Y_5
|
||||||
|
ARI_29=GROUP_2_6_Z_5
|
||||||
|
ARI_30=GROUP_2_7_X_5
|
||||||
|
ARI_31=GROUP_2_7_Y_5
|
||||||
|
ARI_32=GROUP_2_7_Z_5
|
||||||
|
ARI_33=GROUP_2_5_X_6
|
||||||
|
ARI_34=GROUP_2_5_Y_6
|
||||||
|
ARI_35=GROUP_2_5_Z_6
|
||||||
|
ARI_36=GROUP_2_2_X_6
|
||||||
|
ARI_37=GROUP_2_2_Y_6
|
||||||
|
ARI_38=GROUP_2_2_Z_6
|
||||||
|
ARI_39=GROUP_2_4_X_6
|
||||||
|
ARI_40=GROUP_2_4_Y_6
|
||||||
|
ARI_41=GROUP_2_4_Z_6
|
||||||
|
ARI_42=GROUP_2_6_X_6
|
||||||
|
ARI_43=GROUP_2_6_Y_6
|
||||||
|
ARI_44=GROUP_2_6_Z_6
|
||||||
|
ARI_45=GROUP_2_7_X_6
|
||||||
|
ARI_46=GROUP_2_7_Y_6
|
||||||
|
ARI_47=GROUP_2_7_Z_6
|
||||||
|
ARI_48=GROUP_2_5_X_7
|
||||||
|
ARI_49=GROUP_2_5_Y_7
|
||||||
|
ARI_50=GROUP_2_5_Z_7
|
||||||
|
ARI_51=GROUP_2_2_X_7
|
||||||
|
ARI_52=GROUP_2_2_Y_7
|
||||||
|
ARI_53=GROUP_2_2_Z_7
|
||||||
|
ARI_54=GROUP_2_4_X_7
|
||||||
|
ARI_55=GROUP_2_4_Y_7
|
||||||
|
ARI_56=GROUP_2_4_Z_7
|
||||||
|
ARI_57=GROUP_2_6_X_7
|
||||||
|
ARI_58=GROUP_2_6_Y_7
|
||||||
|
ARI_59=GROUP_2_6_Z_7
|
||||||
|
ARI_60=GROUP_2_7_X_7
|
||||||
|
ARI_61=GROUP_2_7_Y_7
|
||||||
|
ARI_62=GROUP_2_7_Z_7
|
||||||
|
|
||||||
# =====
|
# =====
|
||||||
# OTHER
|
# OTHER
|
||||||
# =====
|
# =====
|
||||||
|
|||||||
@@ -16,15 +16,11 @@ uniform sampler2D iTex0;
|
|||||||
uniform int iSeed8;
|
uniform int iSeed8;
|
||||||
uniform vec3 iGroup2_3[7];
|
uniform vec3 iGroup2_3[7];
|
||||||
uniform vec3 iGroup3_1[2];
|
uniform vec3 iGroup3_1[2];
|
||||||
uniform int iDemo;
|
|
||||||
uniform int iAutoRand;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec4 color = fx_stage(vUV, iTex9, 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]);
|
vec4 color = fx_stage(vUV, iTex9, 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), iGroup3_1[0].y);
|
color = mix(color, vec4(0), iGroup3_1[0].y);
|
||||||
}
|
|
||||||
|
|
||||||
fragColor = color;
|
fragColor = color;
|
||||||
}
|
}
|
||||||
|
|||||||
+102
-1
@@ -6,8 +6,109 @@
|
|||||||
in vec2 vUV;
|
in vec2 vUV;
|
||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
#include inc_map.glsl
|
||||||
|
|
||||||
uniform sampler2D iTex0;
|
uniform sampler2D iTex0;
|
||||||
|
uniform vec3 iGroup2_4[7];
|
||||||
|
uniform vec3 iGroup2_5[7];
|
||||||
|
uniform vec3 iGroup2_6[7];
|
||||||
|
uniform vec3 iGroup2_7[7];
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = texture(iTex0, vUV);
|
bool visible = (iGroup2_4[4].x + iGroup2_5[4].x + iGroup2_6[4].x + iGroup2_7[4].x) > 0;
|
||||||
|
bool invert = (iGroup2_4[4].y + iGroup2_5[4].y + iGroup2_6[4].y + iGroup2_7[4].y) > 0;
|
||||||
|
float rect = clamp(iGroup2_4[4].z + iGroup2_5[4].z + iGroup2_6[4].z + iGroup2_7[4].z, 0, 1);
|
||||||
|
bool modified = false;
|
||||||
|
|
||||||
|
vec2 uv = mix(vec2(0), vUV, base_mask(vUV));
|
||||||
|
|
||||||
|
if (iGroup2_4[4].x > 0) {
|
||||||
|
vec2 p11 = vec2(iGroup2_4[6].xy);
|
||||||
|
vec2 p12 = vec2(iGroup2_4[1].xy);
|
||||||
|
vec2 p13 = vec2(iGroup2_4[3].xy);
|
||||||
|
vec2 p14 = vec2(iGroup2_4[5].xy);
|
||||||
|
|
||||||
|
p12.x = 1 - p12.x;
|
||||||
|
p13.y = 1 - p13.y;
|
||||||
|
p14.x = 1 - p14.x;
|
||||||
|
p14.y = 1 - p14.y;
|
||||||
|
|
||||||
|
vec2 uv1 = project_4p(vUV, p11, p12, p13, p14);
|
||||||
|
uv1 = mix(vec2(0), uv1, base_mask(uv1));
|
||||||
|
uv = uv1;
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iGroup2_5[4].x > 0) {
|
||||||
|
vec2 p21 = vec2(iGroup2_5[6].xy);
|
||||||
|
vec2 p22 = vec2(iGroup2_5[1].xy);
|
||||||
|
vec2 p23 = vec2(iGroup2_5[3].xy);
|
||||||
|
vec2 p24 = vec2(iGroup2_5[5].xy);
|
||||||
|
|
||||||
|
p22.x = 1 - p22.x;
|
||||||
|
p23.y = 1 - p23.y;
|
||||||
|
p24.x = 1 - p24.x;
|
||||||
|
p24.y = 1 - p24.y;
|
||||||
|
|
||||||
|
vec2 uv2 = project_4p(vUV, p21, p22, p23, p24);
|
||||||
|
uv2 = mix(vec2(0), uv2, base_mask(uv2));
|
||||||
|
if (modified) {
|
||||||
|
uv = mix(uv, uv2, step(0.0001, length(uv2)));
|
||||||
|
} else {
|
||||||
|
uv = uv2;
|
||||||
|
}
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iGroup2_6[4].x > 0) {
|
||||||
|
vec2 p31 = vec2(iGroup2_6[6].xy);
|
||||||
|
vec2 p32 = vec2(iGroup2_6[1].xy);
|
||||||
|
vec2 p33 = vec2(iGroup2_6[3].xy);
|
||||||
|
vec2 p34 = vec2(iGroup2_6[5].xy);
|
||||||
|
|
||||||
|
p32.x = 1 - p32.x;
|
||||||
|
p33.y = 1 - p33.y;
|
||||||
|
p34.x = 1 - p34.x;
|
||||||
|
p34.y = 1 - p34.y;
|
||||||
|
|
||||||
|
vec2 uv3 = project_4p(vUV, p31, p32, p33, p34);
|
||||||
|
uv3 = mix(vec2(0), uv3, base_mask(uv3));
|
||||||
|
if (modified) {
|
||||||
|
uv = mix(uv, uv3, step(0.0001, length(uv3)));
|
||||||
|
} else {
|
||||||
|
uv = uv3;
|
||||||
|
}
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iGroup2_7[4].x > 0) {
|
||||||
|
vec2 p41 = vec2(iGroup2_7[6].xy);
|
||||||
|
vec2 p42 = vec2(iGroup2_7[1].xy);
|
||||||
|
vec2 p43 = vec2(iGroup2_7[3].xy);
|
||||||
|
vec2 p44 = vec2(iGroup2_7[5].xy);
|
||||||
|
|
||||||
|
p42.x = 1 - p42.x;
|
||||||
|
p43.y = 1 - p43.y;
|
||||||
|
p44.x = 1 - p44.x;
|
||||||
|
p44.y = 1 - p44.y;
|
||||||
|
|
||||||
|
vec2 uv4 = project_4p(vUV, p41, p42, p43, p44);
|
||||||
|
uv4 = mix(vec2(0), uv4, base_mask(uv4));
|
||||||
|
if (modified) {
|
||||||
|
uv = mix(uv, uv4, step(0.0001, length(uv4)));
|
||||||
|
} else {
|
||||||
|
uv = uv4;
|
||||||
|
}
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec4 color = texture(iTex0, invert ? vUV : uv);
|
||||||
|
|
||||||
|
if (visible) {
|
||||||
|
float mask = step(0.0001, length(uv));
|
||||||
|
color *= mix(mask, 1 - mask, invert ? 1 : 0);
|
||||||
|
color = mix(color, color + mask * vec4(1), rect * (step(uv.x, 0.01) + step(uv.y, 0.01) + step(1 - uv.y, 0.01) + step(1 - uv.x, 0.01)));
|
||||||
|
}
|
||||||
|
|
||||||
|
fragColor = color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#ifndef INC_MAP
|
||||||
|
#define INC_MAP
|
||||||
|
|
||||||
|
vec2 project_4p(vec2 uv, vec2 p1, vec2 p2, vec2 p3, vec2 p4) {
|
||||||
|
float k1 = (p4.y - p3.y) / (p2.y - p3.y);
|
||||||
|
float k2 = (p3.y - p1.y) / (p2.y - p3.y);
|
||||||
|
float a = (p4.x - p3.x + k1 * p3.x - k1 * p2.x) / (p1.x - p3.x - k2 * p3.x + k2 * p2.x);
|
||||||
|
float b = k1 + a * k2;
|
||||||
|
float c = 1 - a - b;
|
||||||
|
// https://math.stackexchange.com/questions/296794/finding-the-transform-matrix-from-4-projected-points-with-javascript/339033#339033
|
||||||
|
mat3 projection_a = mat3(
|
||||||
|
a * p1.x, a * p1.y, a,
|
||||||
|
b * p2.x, b * p2.y, b,
|
||||||
|
c * p3.x, c * p3.y, c
|
||||||
|
);
|
||||||
|
mat3 projection_a_prime = inverse(projection_a);
|
||||||
|
mat3 projection_b = mat3(
|
||||||
|
0, 0, -1,
|
||||||
|
1, 0, 1,
|
||||||
|
0, 1, 1
|
||||||
|
);
|
||||||
|
vec3 tmp = projection_b * projection_a_prime * vec3(uv, 1);
|
||||||
|
return tmp.xy / tmp.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
float base_mask(vec2 uv) {
|
||||||
|
return step(0, uv.x) * step(-1, -uv.x) * step(0, uv.y) * step(-1, -uv.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
+41
-1
@@ -11,6 +11,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
|
#define STR_IMPL_(x) #x // stringify argument
|
||||||
|
#define STR(x) STR_IMPL_(x) // indirection to expand argument macros
|
||||||
|
|
||||||
static void print_help(int status_code) {
|
static void print_help(int status_code) {
|
||||||
puts(
|
puts(
|
||||||
PACKAGE
|
PACKAGE
|
||||||
@@ -42,6 +45,12 @@ static void print_help(int status_code) {
|
|||||||
"[-mr / -nmr] "
|
"[-mr / -nmr] "
|
||||||
"[-tm] "
|
"[-tm] "
|
||||||
"[-tf] "
|
"[-tf] "
|
||||||
|
"[--x11] "
|
||||||
|
"[--wayland] "
|
||||||
|
"[--cocoa] "
|
||||||
|
"[--win32] "
|
||||||
|
"[-oma=MAJOR] "
|
||||||
|
"[-omi=MINOR] "
|
||||||
"\n\n"
|
"\n\n"
|
||||||
"Fusion Of Real-time Generative Effects.\n\n"
|
"Fusion Of Real-time Generative Effects.\n\n"
|
||||||
"options:\n"
|
"options:\n"
|
||||||
@@ -81,7 +90,17 @@ static void print_help(int status_code) {
|
|||||||
" -mr, --midi-reconnect auto-reconnect midi (default)\n"
|
" -mr, --midi-reconnect auto-reconnect midi (default)\n"
|
||||||
" -nmr, --no-midi-reconnect do not auto-reconnect midi\n"
|
" -nmr, --no-midi-reconnect do not auto-reconnect midi\n"
|
||||||
" -tm, --trace-midi print midi code and values\n"
|
" -tm, --trace-midi print midi code and values\n"
|
||||||
" -tf, --trace-fps print fps status of subsystems\n");
|
" -tf, --trace-fps print fps status of subsystems\n"
|
||||||
|
" --x11 force X11 GLFW backend\n"
|
||||||
|
" --wayland force Wayland GLFW backend\n"
|
||||||
|
" --cocoa force Cocoa GLFW backend\n"
|
||||||
|
" --win32 force Win32 GLFW backend\n"
|
||||||
|
" -oma, --opengl-major-version OpenGL major version "
|
||||||
|
"(default: " STR(
|
||||||
|
OPENGL_MAJOR_VERSION) ")\n"
|
||||||
|
" -omi, --opengl-minor-version OpenGL "
|
||||||
|
"minor version (default: " STR(
|
||||||
|
OPENGL_MINOR_VERSION) ")\n");
|
||||||
exit(status_code);
|
exit(status_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,6 +171,9 @@ void args_parse(Parameters *params, int argc, char **argv) {
|
|||||||
params->midi_reconnect = true;
|
params->midi_reconnect = true;
|
||||||
params->trace_midi = false;
|
params->trace_midi = false;
|
||||||
params->trace_fps = false;
|
params->trace_fps = false;
|
||||||
|
params->glfw_backend = GLFW_BACKEND_ANY;
|
||||||
|
params->opengl_major = OPENGL_MAJOR_VERSION;
|
||||||
|
params->opengl_minor = OPENGL_MINOR_VERSION;
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
arg = argv[i];
|
arg = argv[i];
|
||||||
@@ -220,6 +242,24 @@ void args_parse(Parameters *params, int argc, char **argv) {
|
|||||||
params->trace_midi = true;
|
params->trace_midi = true;
|
||||||
} else if (is_arg(arg, "-tf") || is_arg(arg, "--trace-fps")) {
|
} else if (is_arg(arg, "-tf") || is_arg(arg, "--trace-fps")) {
|
||||||
params->trace_fps = true;
|
params->trace_fps = true;
|
||||||
|
} else if (is_arg(arg, "--x11")) {
|
||||||
|
params->glfw_backend = GLFW_BACKEND_X11;
|
||||||
|
} else if (is_arg(arg, "--wayland")) {
|
||||||
|
params->glfw_backend = GLFW_BACKEND_WAYLAND;
|
||||||
|
} else if (is_arg(arg, "--cocoa")) {
|
||||||
|
params->glfw_backend = GLFW_BACKEND_COCOA;
|
||||||
|
} else if (is_arg(arg, "--win32")) {
|
||||||
|
params->glfw_backend = GLFW_BACKEND_WIN32;
|
||||||
|
} else if (is_arg(arg, "-oma") || is_arg(arg, "--opengl-major-version")) {
|
||||||
|
params->opengl_major = parse_uint(arg, value);
|
||||||
|
if (params->opengl_major == 0) {
|
||||||
|
invalid_value(arg, value);
|
||||||
|
}
|
||||||
|
} else if (is_arg(arg, "-omi") || is_arg(arg, "--opengl-minor-version")) {
|
||||||
|
params->opengl_minor = parse_uint(arg, value);
|
||||||
|
if (params->opengl_major == 0) {
|
||||||
|
invalid_value(arg, value);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
#ifdef VIDEO_IN
|
#ifdef VIDEO_IN
|
||||||
if (is_arg(arg, "-vi") || is_arg(arg, "--video-in")) {
|
if (is_arg(arg, "-vi") || is_arg(arg, "--video-in")) {
|
||||||
|
|||||||
@@ -12,6 +12,16 @@ unsigned int arr_uint_index_of(UintArray array, unsigned int value) {
|
|||||||
return ARRAY_NOT_FOUND;
|
return ARRAY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool arr_string_match(StringArray array, const char *needle) {
|
||||||
|
for (unsigned int i = 0; i < array.length; i++) {
|
||||||
|
if (strncmp(array.values[i], needle, strlen(array.values[i])) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int arr_uint_remap_index(UintArray offsets, unsigned int *index) {
|
unsigned int arr_uint_remap_index(UintArray offsets, unsigned int *index) {
|
||||||
if (offsets.length == 0) {
|
if (offsets.length == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -7,4 +7,6 @@ unsigned int arr_uint_index_of(UintArray array, unsigned int value);
|
|||||||
|
|
||||||
unsigned int arr_uint_remap_index(UintArray offsets, unsigned int *index);
|
unsigned int arr_uint_remap_index(UintArray offsets, unsigned int *index);
|
||||||
|
|
||||||
|
bool arr_string_match(StringArray array, const char *needle);
|
||||||
|
|
||||||
#endif /* ARR_H */
|
#endif /* ARR_H */
|
||||||
|
|||||||
@@ -87,4 +87,23 @@
|
|||||||
#define MAX_TAP_VALUES 10
|
#define MAX_TAP_VALUES 10
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* OPENGL */
|
||||||
|
|
||||||
|
#ifndef OPENGL_MAJOR_VERSION
|
||||||
|
#define OPENGL_MAJOR_VERSION 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef OPENGL_MINOR_VERSION
|
||||||
|
#define OPENGL_MINOR_VERSION 6
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* GLFW CONSTANTS */
|
||||||
|
#ifndef GLFW_BACKENDS
|
||||||
|
#define GLFW_BACKEND_ANY 0
|
||||||
|
#define GLFW_BACKEND_X11 1
|
||||||
|
#define GLFW_BACKEND_WAYLAND 2
|
||||||
|
#define GLFW_BACKEND_COCOA 3
|
||||||
|
#define GLFW_BACKEND_WIN32 4
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* CONFIG_H */
|
#endif /* CONFIG_H */
|
||||||
|
|||||||
+5
-3
@@ -286,14 +286,15 @@ static bool init(const Parameters *params) {
|
|||||||
|
|
||||||
start_state_background_write();
|
start_state_background_write();
|
||||||
|
|
||||||
window_startup(error_callback);
|
window_startup(error_callback, params->glfw_backend);
|
||||||
|
|
||||||
context.tex_resolution[0] = params->internal_size;
|
context.tex_resolution[0] = params->internal_size;
|
||||||
context.tex_resolution[1] = params->internal_size;
|
context.tex_resolution[1] = params->internal_size;
|
||||||
|
|
||||||
if (params->output) {
|
if (params->output) {
|
||||||
window_output = window_init(PACKAGE " " VERSION, params->output_screen,
|
window_output = window_init(PACKAGE " " VERSION, params->output_screen,
|
||||||
params->windowed, NULL, key_callback);
|
params->windowed, params->opengl_major,
|
||||||
|
params->opengl_minor, NULL, key_callback);
|
||||||
|
|
||||||
window_use(window_output, &context);
|
window_use(window_output, &context);
|
||||||
|
|
||||||
@@ -305,7 +306,8 @@ static bool init(const Parameters *params) {
|
|||||||
if (params->monitor) {
|
if (params->monitor) {
|
||||||
window_monitor =
|
window_monitor =
|
||||||
window_init(PACKAGE " " VERSION " (monitor)", params->monitor_screen,
|
window_init(PACKAGE " " VERSION " (monitor)", params->monitor_screen,
|
||||||
params->windowed, window_output, key_callback);
|
params->windowed, params->opengl_major,
|
||||||
|
params->opengl_minor, window_output, key_callback);
|
||||||
|
|
||||||
window_use(window_monitor, &context);
|
window_use(window_monitor, &context);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ static void gl_debug_callback(GLenum source, GLenum type, GLuint id,
|
|||||||
|
|
||||||
#endif /* GL_DEBUG */
|
#endif /* GL_DEBUG */
|
||||||
|
|
||||||
static bool check_eglerror_ro(const char *context) {
|
static bool check_eglerror_ro(__attribute__((unused)) const char *context) {
|
||||||
#ifdef VIDEO_IN
|
#ifdef VIDEO_IN
|
||||||
unsigned int code;
|
unsigned int code;
|
||||||
|
|
||||||
|
|||||||
+73
-18
@@ -98,14 +98,18 @@ static void randomize(Context *context, StateConfig state_config) {
|
|||||||
l = state_config.values_offsets.values[part] +
|
l = state_config.values_offsets.values[part] +
|
||||||
k * state_config.group_counts.values[part] + j;
|
k * state_config.group_counts.values[part] + j;
|
||||||
|
|
||||||
|
if (arr_uint_index_of(state_config.random_ignored, (l * 3) + (i % 3)) ==
|
||||||
|
ARRAY_NOT_FOUND) {
|
||||||
if (arr_uint_index_of(state_config.fader_codes,
|
if (arr_uint_index_of(state_config.fader_codes,
|
||||||
state_config.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;
|
context->values[l][i % 3] = (float)rand_uint(MIDI_MAX + 1) / MIDI_MAX;
|
||||||
} else {
|
} else {
|
||||||
context->values[l][i % 3] = rand_uint(2) == 1 ? 1 : 0;
|
context->values[l][i % 3] = rand_uint(2) == 1 ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < context->state.length; i++) {
|
for (unsigned int i = 0; i < context->state.length; i++) {
|
||||||
context->state.values[i] = rand_uint(state_config.state_max);
|
context->state.values[i] = rand_uint(state_config.state_max);
|
||||||
@@ -271,6 +275,8 @@ void state_parse_config(StateConfig *state_config, const ConfigFile *config) {
|
|||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
|
unsigned int value_offset;
|
||||||
|
StringArray ignored_codes;
|
||||||
char name[STR_LEN];
|
char name[STR_LEN];
|
||||||
|
|
||||||
length = config_file_get_int(config, "SELECT_PAGE_COUNT", 0);
|
length = config_file_get_int(config, "SELECT_PAGE_COUNT", 0);
|
||||||
@@ -312,6 +318,18 @@ void state_parse_config(StateConfig *state_config, const ConfigFile *config) {
|
|||||||
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
length = config_file_get_int(config, "ARI_COUNT", 0);
|
||||||
|
if (length > ARRAY_SIZE) {
|
||||||
|
length = ARRAY_SIZE;
|
||||||
|
}
|
||||||
|
ignored_codes.length = length;
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < ignored_codes.length; i++) {
|
||||||
|
snprintf(name, STR_LEN, "ARI_%d", i + 1);
|
||||||
|
strlcpy(ignored_codes.values[i],
|
||||||
|
config_file_get_str(config, name, "unkown"), STR_LEN);
|
||||||
|
}
|
||||||
|
|
||||||
length = config_file_get_int(config, "GROUP_COUNT", 0);
|
length = config_file_get_int(config, "GROUP_COUNT", 0);
|
||||||
if (length > ARRAY_SIZE) {
|
if (length > ARRAY_SIZE) {
|
||||||
length = ARRAY_SIZE;
|
length = ARRAY_SIZE;
|
||||||
@@ -361,26 +379,60 @@ void state_parse_config(StateConfig *state_config, const ConfigFile *config) {
|
|||||||
length = ARRAY_SIZE;
|
length = ARRAY_SIZE;
|
||||||
}
|
}
|
||||||
state_config->codes.length = count * 3;
|
state_config->codes.length = count * 3;
|
||||||
|
state_config->random_ignored.length = 0;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < state_config->group_counts.length; i++) {
|
for (unsigned int i = 0; i < state_config->group_counts.length; i++) {
|
||||||
offset = state_config->group_offsets.values[i];
|
offset = state_config->group_offsets.values[i];
|
||||||
|
value_offset = state_config->values_offsets.values[i];
|
||||||
for (unsigned int j = 0; j < state_config->group_counts.values[i]; j++) {
|
for (unsigned int j = 0; j < state_config->group_counts.values[i]; j++) {
|
||||||
if ((offset + j) * 3 < ARRAY_SIZE) {
|
if ((offset + j) * 3 < ARRAY_SIZE) {
|
||||||
snprintf(name, STR_LEN, "GROUP_%d_%d_X", i + 1, j + 1);
|
snprintf(name, STR_LEN, "GROUP_%d_%d_X", i + 1, j + 1);
|
||||||
state_config->codes.values[(offset + j) * 3] =
|
state_config->codes.values[(offset + j) * 3] =
|
||||||
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
||||||
|
for (unsigned int k = 0;
|
||||||
|
k < state_config->group_active_counts.values[i]; k++) {
|
||||||
|
snprintf(name, STR_LEN, "GROUP_%d_%d_X_%d", i + 1, j + 1, k + 1);
|
||||||
|
if (arr_string_match(ignored_codes, name)) {
|
||||||
|
state_config->random_ignored
|
||||||
|
.values[state_config->random_ignored.length++] =
|
||||||
|
(value_offset + k * state_config->group_counts.values[i] + j) *
|
||||||
|
3;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((offset + j) * 3 + 1 < ARRAY_SIZE) {
|
if ((offset + j) * 3 + 1 < ARRAY_SIZE) {
|
||||||
snprintf(name, STR_LEN, "GROUP_%d_%d_Y", i + 1, j + 1);
|
snprintf(name, STR_LEN, "GROUP_%d_%d_Y", i + 1, j + 1);
|
||||||
state_config->codes.values[(offset + j) * 3 + 1] =
|
state_config->codes.values[(offset + j) * 3 + 1] =
|
||||||
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
||||||
|
for (unsigned int k = 0;
|
||||||
|
k < state_config->group_active_counts.values[i]; k++) {
|
||||||
|
snprintf(name, STR_LEN, "GROUP_%d_%d_Y_%d", i + 1, j + 1, k + 1);
|
||||||
|
if (arr_string_match(ignored_codes, name)) {
|
||||||
|
state_config->random_ignored
|
||||||
|
.values[state_config->random_ignored.length++] =
|
||||||
|
(value_offset + k * state_config->group_counts.values[i] + j) *
|
||||||
|
3 +
|
||||||
|
1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((offset + j) * 3 + 2 < ARRAY_SIZE) {
|
if ((offset + j) * 3 + 2 < ARRAY_SIZE) {
|
||||||
snprintf(name, STR_LEN, "GROUP_%d_%d_Z", i + 1, j + 1);
|
snprintf(name, STR_LEN, "GROUP_%d_%d_Z", i + 1, j + 1);
|
||||||
state_config->codes.values[(offset + j) * 3 + 2] =
|
state_config->codes.values[(offset + j) * 3 + 2] =
|
||||||
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
config_file_get_int(config, name, UNSET_MIDI_CODE);
|
||||||
|
for (unsigned int k = 0;
|
||||||
|
k < state_config->group_active_counts.values[i]; k++) {
|
||||||
|
snprintf(name, STR_LEN, "GROUP_%d_%d_Z_%d", i + 1, j + 1, k + 1);
|
||||||
|
if (arr_string_match(ignored_codes, name)) {
|
||||||
|
state_config->random_ignored
|
||||||
|
.values[state_config->random_ignored.length++] =
|
||||||
|
(value_offset + k * state_config->group_counts.values[i] + j) *
|
||||||
|
3 +
|
||||||
|
2;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -477,6 +529,9 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
unsigned int j;
|
unsigned int j;
|
||||||
unsigned int k;
|
unsigned int k;
|
||||||
unsigned int part;
|
unsigned int part;
|
||||||
|
bool found;
|
||||||
|
|
||||||
|
found = false;
|
||||||
|
|
||||||
// PAGE CHANGE
|
// PAGE CHANGE
|
||||||
i = arr_uint_index_of(state_config.select_page_codes, code);
|
i = arr_uint_index_of(state_config.select_page_codes, code);
|
||||||
@@ -485,7 +540,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
context->page = i;
|
context->page = i;
|
||||||
update_page(context, state_config, midi);
|
update_page(context, state_config, midi);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TARGET CHANGE
|
// TARGET CHANGE
|
||||||
@@ -495,7 +550,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
context->selected = i;
|
context->selected = i;
|
||||||
update_page(context, state_config, midi);
|
update_page(context, state_config, midi);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ITEM CHANGE
|
// ITEM CHANGE
|
||||||
@@ -506,7 +561,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
context->page * state_config.select_item_codes.length + i;
|
context->page * state_config.select_item_codes.length + i;
|
||||||
update_page(context, state_config, midi);
|
update_page(context, state_config, midi);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACTIVE CHANGE
|
// ACTIVE CHANGE
|
||||||
@@ -518,7 +573,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
update_active(context, state_config, midi, true);
|
update_active(context, state_config, midi, true);
|
||||||
update_values(context, state_config, midi);
|
update_values(context, state_config, midi);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// VALUE CHANGE
|
// VALUE CHANGE
|
||||||
@@ -540,7 +595,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
safe_midi_write(midi, code, MIDI_MAX);
|
safe_midi_write(midi, code, MIDI_MAX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TAP TEMPO
|
// TAP TEMPO
|
||||||
@@ -549,7 +604,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
tempo_tap(&context->tempo);
|
tempo_tap(&context->tempo);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// OTHER KEYS
|
// OTHER KEYS
|
||||||
@@ -559,7 +614,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
randomize(context, state_config);
|
randomize(context, state_config);
|
||||||
update_values(context, state_config, midi);
|
update_values(context, state_config, midi);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code == state_config.key_reset) {
|
if (code == state_config.key_reset) {
|
||||||
@@ -568,7 +623,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
reset(context);
|
reset(context);
|
||||||
update_values(context, state_config, midi);
|
update_values(context, state_config, midi);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code == state_config.key_demo) {
|
if (code == state_config.key_demo) {
|
||||||
@@ -576,7 +631,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
log_info((context->demo ? "[%d] Demo OFF" : "[%d] Demo ON"), code);
|
log_info((context->demo ? "[%d] Demo OFF" : "[%d] Demo ON"), code);
|
||||||
context->demo = !context->demo;
|
context->demo = !context->demo;
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code == state_config.key_autorand) {
|
if (code == state_config.key_autorand) {
|
||||||
@@ -585,7 +640,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
log_info("[%d] Auto Random %s", code,
|
log_info("[%d] Auto Random %s", code,
|
||||||
context->auto_random ? "ON" : "OFF");
|
context->auto_random ? "ON" : "OFF");
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code == state_config.key_autorand_down) {
|
if (code == state_config.key_autorand_down) {
|
||||||
@@ -595,7 +650,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
}
|
}
|
||||||
log_info("[%d] Auto Random Cycle: %d", code, context->auto_random_cycle);
|
log_info("[%d] Auto Random Cycle: %d", code, context->auto_random_cycle);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code == state_config.key_autorand_up) {
|
if (code == state_config.key_autorand_up) {
|
||||||
@@ -603,7 +658,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
context->auto_random_cycle += 1;
|
context->auto_random_cycle += 1;
|
||||||
log_info("[%d] Auto Random Cycle: %d", code, context->auto_random_cycle);
|
log_info("[%d] Auto Random Cycle: %d", code, context->auto_random_cycle);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code == state_config.key_tempo_up) {
|
if (code == state_config.key_tempo_up) {
|
||||||
@@ -611,7 +666,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
tempo_set(&context->tempo, context->tempo.tempo + 1);
|
tempo_set(&context->tempo, context->tempo.tempo + 1);
|
||||||
log_info("[%d] Tempo: %f", code, context->tempo);
|
log_info("[%d] Tempo: %f", code, context->tempo);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code == state_config.key_tempo_down) {
|
if (code == state_config.key_tempo_down) {
|
||||||
@@ -621,7 +676,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
}
|
}
|
||||||
log_info("[%d] Tempo: %f", code, context->tempo.tempo);
|
log_info("[%d] Tempo: %f", code, context->tempo.tempo);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOAD STATE
|
// LOAD STATE
|
||||||
@@ -632,7 +687,7 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
log_info("[%d] Loading state %d", code, i + 1);
|
log_info("[%d] Loading state %d", code, i + 1);
|
||||||
load_from_index_file(context, state_config, i + 1);
|
load_from_index_file(context, state_config, i + 1);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SAVE STATE
|
// SAVE STATE
|
||||||
@@ -643,10 +698,10 @@ static bool compute_event(Context *context, StateConfig state_config,
|
|||||||
log_info("[%d] Saving state %d", code, i + 1);
|
log_info("[%d] Saving state %d", code, i + 1);
|
||||||
save_to_index_file(context, state_config, i + 1);
|
save_to_index_file(context, state_config, i + 1);
|
||||||
}
|
}
|
||||||
return true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
void state_midi_event(Context *context, StateConfig state_config,
|
void state_midi_event(Context *context, StateConfig state_config,
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ typedef struct Parameters {
|
|||||||
bool midi_reconnect;
|
bool midi_reconnect;
|
||||||
bool trace_midi;
|
bool trace_midi;
|
||||||
bool trace_fps;
|
bool trace_fps;
|
||||||
|
unsigned int glfw_backend;
|
||||||
|
unsigned int opengl_major;
|
||||||
|
unsigned int opengl_minor;
|
||||||
} Parameters;
|
} Parameters;
|
||||||
|
|
||||||
// file.c
|
// file.c
|
||||||
@@ -251,6 +254,7 @@ typedef struct StateConfig {
|
|||||||
UintArray codes;
|
UintArray codes;
|
||||||
UintArray fader_codes;
|
UintArray fader_codes;
|
||||||
UintArray values_offsets;
|
UintArray values_offsets;
|
||||||
|
UintArray random_ignored;
|
||||||
|
|
||||||
unsigned int value_count;
|
unsigned int value_count;
|
||||||
|
|
||||||
|
|||||||
+40
-8
@@ -7,7 +7,8 @@
|
|||||||
|
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
static void init_glfw(void (*error_callback)(int, const char *)) {
|
static void init_glfw(void (*error_callback)(int, const char *),
|
||||||
|
const unsigned int backend) {
|
||||||
log_info("[GLFW] Initializing...");
|
log_info("[GLFW] Initializing...");
|
||||||
|
|
||||||
// set errors handler
|
// set errors handler
|
||||||
@@ -16,6 +17,30 @@ static void init_glfw(void (*error_callback)(int, const char *)) {
|
|||||||
// print current GLFW version
|
// print current GLFW version
|
||||||
log_info("[GLFW] %s", glfwGetVersionString());
|
log_info("[GLFW] %s", glfwGetVersionString());
|
||||||
|
|
||||||
|
switch (backend) {
|
||||||
|
#ifdef GLFW_PLATFORM
|
||||||
|
case GLFW_BACKEND_X11:
|
||||||
|
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_X11);
|
||||||
|
log_info("[GLFW] platform: X11");
|
||||||
|
break;
|
||||||
|
case GLFW_BACKEND_WAYLAND:
|
||||||
|
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_WAYLAND);
|
||||||
|
log_info("[GLFW] platform: Wayland");
|
||||||
|
break;
|
||||||
|
case GLFW_BACKEND_COCOA:
|
||||||
|
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_COCOA);
|
||||||
|
log_info("[GLFW] platform: Cocoa");
|
||||||
|
break;
|
||||||
|
case GLFW_BACKEND_WIN32:
|
||||||
|
glfwInitHint(GLFW_PLATFORM, GLFW_BACKEND_WIN32);
|
||||||
|
log_info("[GLFW] platform: Win32");
|
||||||
|
break;
|
||||||
|
#endif /* GLFW_PLATFORM */
|
||||||
|
default:
|
||||||
|
log_info("[GLFW] platform: Any");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// init GLFW
|
// init GLFW
|
||||||
if (!glfwInit()) {
|
if (!glfwInit()) {
|
||||||
log_error("[GLFW] Initialization failed");
|
log_error("[GLFW] Initialization failed");
|
||||||
@@ -44,7 +69,9 @@ static GLFWmonitor *get_monitor(unsigned char monitor_index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GLFWwindow *
|
static GLFWwindow *
|
||||||
create_window(GLFWmonitor *monitor, const char *title, Window *shared_context,
|
create_window(GLFWmonitor *monitor, const char *title,
|
||||||
|
const unsigned int opengl_major, const unsigned int opengl_minor,
|
||||||
|
Window *shared_context,
|
||||||
void (*key_callback)(Window *, int, int, int, int)) {
|
void (*key_callback)(Window *, int, int, int, int)) {
|
||||||
GLFWwindow *window;
|
GLFWwindow *window;
|
||||||
|
|
||||||
@@ -57,8 +84,8 @@ create_window(GLFWmonitor *monitor, const char *title, Window *shared_context,
|
|||||||
glfwWindowHint(GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
|
glfwWindowHint(GLFW_FOCUS_ON_SHOW, GLFW_FALSE);
|
||||||
|
|
||||||
// Context related hints
|
// Context related hints
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, opengl_major);
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
|
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, opengl_minor);
|
||||||
#ifdef GL_DEBUG
|
#ifdef GL_DEBUG
|
||||||
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);
|
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GLFW_TRUE);
|
||||||
#endif
|
#endif
|
||||||
@@ -86,8 +113,9 @@ create_window(GLFWmonitor *monitor, const char *title, Window *shared_context,
|
|||||||
|
|
||||||
static void use_window(GLFWwindow *window) { glfwMakeContextCurrent(window); }
|
static void use_window(GLFWwindow *window) { glfwMakeContextCurrent(window); }
|
||||||
|
|
||||||
void window_startup(void (*error_callback)(int, const char *)) {
|
void window_startup(void (*error_callback)(int, const char *),
|
||||||
init_glfw(error_callback);
|
const unsigned int backend) {
|
||||||
|
init_glfw(error_callback, backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_terminate() {
|
void window_terminate() {
|
||||||
@@ -96,17 +124,21 @@ void window_terminate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Window *window_init(const char *title, unsigned char monitor_index,
|
Window *window_init(const char *title, unsigned char monitor_index,
|
||||||
bool windowed, Window *shared_context,
|
bool windowed, const unsigned int opengl_major,
|
||||||
|
const unsigned int opengl_minor, Window *shared_context,
|
||||||
void (*key_callback)(Window *, int, int, int, int)) {
|
void (*key_callback)(Window *, int, int, int, int)) {
|
||||||
GLFWwindow *window;
|
GLFWwindow *window;
|
||||||
GLFWmonitor *monitor;
|
GLFWmonitor *monitor;
|
||||||
|
|
||||||
monitor = windowed ? NULL : get_monitor(monitor_index);
|
monitor = windowed ? NULL : get_monitor(monitor_index);
|
||||||
|
|
||||||
window = create_window(monitor, title, shared_context, key_callback);
|
window = create_window(monitor, title, opengl_major, opengl_minor,
|
||||||
|
shared_context, key_callback);
|
||||||
|
|
||||||
use_window(window);
|
use_window(window);
|
||||||
|
|
||||||
|
glfwSwapInterval(0);
|
||||||
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -3,12 +3,13 @@
|
|||||||
#ifndef WINDOW_H
|
#ifndef WINDOW_H
|
||||||
#define WINDOW_H
|
#define WINDOW_H
|
||||||
|
|
||||||
void window_startup(void (*error_callback)(int, const char *));
|
void window_startup(void (*error_callback)(int, const char *), const unsigned int backend);
|
||||||
|
|
||||||
void window_terminate();
|
void window_terminate();
|
||||||
|
|
||||||
Window *window_init(const char *title, unsigned char monitor_index,
|
Window *window_init(const char *title, unsigned char monitor_index,
|
||||||
bool windowed, Window *shared_context,
|
bool windowed, const unsigned int opengl_major,
|
||||||
|
const unsigned int opengl_minor, Window *shared_context,
|
||||||
void (*key_callback)(Window *, int, int, int, int));
|
void (*key_callback)(Window *, int, int, int, int));
|
||||||
|
|
||||||
void window_update_title(Window *window, const char *title);
|
void window_update_title(Window *window, const char *title);
|
||||||
|
|||||||
Reference in New Issue
Block a user