so close rn
This commit is contained in:
+2
-2
@@ -94,8 +94,8 @@ SRC_1_6_Z=
|
|||||||
|
|
||||||
SRC_2_ACTIVE_COUNT=3
|
SRC_2_ACTIVE_COUNT=3
|
||||||
SRC_2_ACTIVE_1=36
|
SRC_2_ACTIVE_1=36
|
||||||
SRC_2_ACTIVE_2=52
|
SRC_2_ACTIVE_2=68
|
||||||
SRC_2_ACTIVE_3=68
|
SRC_2_ACTIVE_3=52
|
||||||
SRC_2_COUNT=7
|
SRC_2_COUNT=7
|
||||||
SRC_2_1_X=37
|
SRC_2_1_X=37
|
||||||
SRC_2_1_Y=53
|
SRC_2_1_Y=53
|
||||||
|
|||||||
+8
-8
@@ -1299,22 +1299,22 @@ subroutine(src_stage_sub) vec4 src_16(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
|
|||||||
f += char_at(uv2, vec2(-5.4, 1.45), hex_chars[selected_srca]);
|
f += char_at(uv2, vec2(-5.4, 1.45), hex_chars[selected_srca]);
|
||||||
f += char_at(uv2, vec2(-5.4, -2.55), hex_chars[selected_srcb]);
|
f += char_at(uv2, vec2(-5.4, -2.55), hex_chars[selected_srcb]);
|
||||||
f += char_at(uv2, vec2(-2.4, 1.45), hex_chars[selected_fxa]);
|
f += char_at(uv2, vec2(-2.4, 1.45), hex_chars[selected_fxa]);
|
||||||
f += char_at(uv2, vec2(4.6, -0.55), hex_chars[selected_fxb]);
|
f += char_at(uv2, vec2(-2.4, -2.55), hex_chars[selected_fxb]);
|
||||||
f += char_at(uv2, vec2(-2.4, -2.55), hex_chars[selected_mfx]);
|
f += char_at(uv2, vec2(4.6, -0.55), hex_chars[selected_mfx]);
|
||||||
|
|
||||||
// show current selected
|
// show current selected
|
||||||
f += iSelected == 3 ? h_rect(uv2, vec2(-5, 2), vec2(1.2), 0.1) : 0;
|
f += iSelected == 3 ? h_rect(uv2, vec2(-5, 2), vec2(1.2), 0.1) : 0;
|
||||||
f += iSelected == 4 ? h_rect(uv2, vec2(-5, -2), vec2(1.2), 0.1) : 0;
|
f += iSelected == 4 ? h_rect(uv2, vec2(-5, -2), vec2(1.2), 0.1) : 0;
|
||||||
f += iSelected == 5 ? h_rect(uv2, vec2(-2, 2), vec2(1.2), 0.1) : 0;
|
f += iSelected == 5 ? h_rect(uv2, vec2(-2, 2), vec2(1.2), 0.1) : 0;
|
||||||
f += iSelected == 6 ? h_rect(uv2, vec2(5, 0), vec2(1.2), 0.1) : 0;
|
f += iSelected == 6 ? h_rect(uv2, vec2(-2, -2), vec2(1.2), 0.1) : 0;
|
||||||
f += iSelected == 8 ? h_rect(uv2, vec2(-2, -2), vec2(1.2), 0.1) : 0;
|
f += iSelected == 8 ? h_rect(uv2, vec2(5, 0), vec2(1.2), 0.1) : 0;
|
||||||
|
|
||||||
// show selected src/fx
|
// show selected src/fx
|
||||||
f += active1 == 1 ? h_rect(uv2, vec2(-5, 0.8), vec2(1, 0), 0.1) : 0;
|
f += active1 == 1 ? h_rect(uv2, vec2(-5, 0.8), vec2(1, 0), 0.1) : 0;
|
||||||
f += active1 == 2 ? h_rect(uv2, vec2(-5, -3.2), vec2(1, 0), 0.1) : 0;
|
f += active1 == 2 ? h_rect(uv2, vec2(-5, -3.2), vec2(1, 0), 0.1) : 0;
|
||||||
f += active2 == 1 ? h_rect(uv2, vec2(-2, 0.8), vec2(1.2, 0), 0.1) : 0;
|
f += active2 == 1 ? h_rect(uv2, vec2(-2, 0.8), vec2(1.2, 0), 0.1) : 0;
|
||||||
f += active2 == 2 ? h_rect(uv2, vec2(5, -1.2), vec2(1, 0), 0.1) : 0;
|
f += active2 == 2 ? h_rect(uv2, vec2(-2, -3.2), vec2(1, 0), 0.1) : 0;
|
||||||
f += active2 == 3 ? h_rect(uv2, vec2(-2, -3.2), vec2(1, 0), 0.1) : 0;
|
f += active2 == 3 ? h_rect(uv2, vec2(5, -1.2), vec2(1, 0), 0.1) : 0;
|
||||||
|
|
||||||
// show inputs / feedback
|
// show inputs / feedback
|
||||||
float line_a_a = rect(uv2, vec2(-8, 2), vec2(2, 0.1));
|
float line_a_a = rect(uv2, vec2(-8, 2), vec2(2, 0.1));
|
||||||
@@ -1343,8 +1343,8 @@ subroutine(src_stage_sub) vec4 src_16(vec2 vUV, int seed, vec3 b1, vec2 f1, vec3
|
|||||||
|
|
||||||
// show fx values
|
// show fx values
|
||||||
f = mix(f, 1 - f, rect(uv2, vec2(-2, 1.1 + 0.9 * fxa_value), vec2(0.9, 0.9 * fxa_value)));
|
f = mix(f, 1 - f, rect(uv2, vec2(-2, 1.1 + 0.9 * fxa_value), vec2(0.9, 0.9 * fxa_value)));
|
||||||
f = mix(f, 1 - f, rect(uv2, vec2(5, -0.9 + 0.9 * fxb_value), vec2(0.9, 0.9 * fxb_value)));
|
f = mix(f, 1 - f, rect(uv2, vec2(-2, -2.9 + 0.9 * fxb_value), vec2(0.9, 0.9 * fxb_value)));
|
||||||
f = mix(f, 1 - f, rect(uv2, vec2(-2, -2.9 + 0.9 * mfx_value), vec2(0.9, 0.9 * mfx_value)));
|
f = mix(f, 1 - f, rect(uv2, vec2(5, -0.9 + 0.9 * mfx_value), vec2(0.9, 0.9 * mfx_value)));
|
||||||
|
|
||||||
// show mix
|
// show mix
|
||||||
f += char_at(uv2, vec2(1.55, -0.6), mix_type ? 0x4B : 0x4D);
|
f += char_at(uv2, vec2(1.55, -0.6), mix_type ? 0x4B : 0x4D);
|
||||||
|
|||||||
+7
-1
@@ -8,5 +8,11 @@ in vec2 vUV;
|
|||||||
out vec4 fragColor;
|
out vec4 fragColor;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
fragColor = fx_stage(vUV, tex9, tex0, seed8, src2_3[0], src2_3[1].xy, src2_3[2], src2_3[3].xy, src2_3[4], src2_3[5].xy, src2_3[6].xy);
|
vec4 color = fx_stage(vUV, tex9, tex0, seed8, src2_3[0], src2_3[1].xy, src2_3[2], src2_3[3].xy, src2_3[4], src2_3[5].xy, src2_3[6].xy);
|
||||||
|
|
||||||
|
color = mix(color, vec4(0), src3_1[0].y);
|
||||||
|
|
||||||
|
color = mix(color, 1 - color, src3_1[0].z);
|
||||||
|
|
||||||
|
fragColor = color;
|
||||||
}
|
}
|
||||||
+19
-9
@@ -326,17 +326,26 @@ static void init_single_program(ShaderProgram *program, unsigned int i,
|
|||||||
glGetUniformLocation(program->programs[i], name);
|
glGetUniformLocation(program->programs[i], name);
|
||||||
}
|
}
|
||||||
|
|
||||||
prefix = config_file_get_str(config, "UNIFORM_SRC_PREFIX", "src");
|
if (program->src_lengths.length == 0) {
|
||||||
index1 = index2 = 0;
|
index1 = 0;
|
||||||
for (j = 0; j < state_config.src_active_counts.length; j++) {
|
for (j = 0; j < state_config.src_active_counts.length; j++) {
|
||||||
for (k = 0; k < state_config.src_active_counts.values[j]; k++) {
|
for (k = 0; k < state_config.src_active_counts.values[j]; k++) {
|
||||||
program->src_lengths.values[index1++] = state_config.src_counts.values[j];
|
program->src_lengths.values[index1++] =
|
||||||
sprintf(name, "%s%d_%d", prefix, j + 1, k + 1);
|
state_config.src_counts.values[j];
|
||||||
program->isrc_locations[index2++] =
|
|
||||||
glGetUniformLocation(program->programs[i], name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
program->src_lengths.length = index1;
|
program->src_lengths.length = index1;
|
||||||
|
}
|
||||||
|
|
||||||
|
prefix = config_file_get_str(config, "UNIFORM_SRC_PREFIX", "src");
|
||||||
|
index2 = 0;
|
||||||
|
for (j = 0; j < state_config.src_active_counts.length; j++) {
|
||||||
|
for (k = 0; k < state_config.src_active_counts.values[j]; k++) {
|
||||||
|
sprintf(name, "%s%d_%d", prefix, j + 1, k + 1);
|
||||||
|
program->isrc_locations[i * program->src_lengths.length + index2++] =
|
||||||
|
glGetUniformLocation(program->programs[i], name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// create texX uniforms pointer
|
// create texX uniforms pointer
|
||||||
prefix = config_file_get_str(config, "UNIFORM_TEX_PREFIX", "tex");
|
prefix = config_file_get_str(config, "UNIFORM_TEX_PREFIX", "tex");
|
||||||
@@ -381,6 +390,7 @@ ShaderProgram shaders_init(FileArray fragment_shaders, ConfigFile config,
|
|||||||
program.in_count = config_file_get_int(config, "IN_COUNT", 0);
|
program.in_count = config_file_get_int(config, "IN_COUNT", 0);
|
||||||
program.sub_variant_count = state_config.state_max;
|
program.sub_variant_count = state_config.state_max;
|
||||||
program.active_count = state_config.src_active_counts.length;
|
program.active_count = state_config.src_active_counts.length;
|
||||||
|
program.src_lengths.length = 0;
|
||||||
|
|
||||||
if (program.frag_count > MAX_FRAG) {
|
if (program.frag_count > MAX_FRAG) {
|
||||||
log_error("FRAG_COUNT over %d", MAX_FRAG);
|
log_error("FRAG_COUNT over %d", MAX_FRAG);
|
||||||
@@ -542,9 +552,9 @@ static void use_program(ShaderProgram program, int i, bool output,
|
|||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
for (j = 0; j < program.src_lengths.length; j++) {
|
for (j = 0; j < program.src_lengths.length; j++) {
|
||||||
write_uniform_multi_3f(program.isrc_locations[j],
|
write_uniform_multi_3f(
|
||||||
program.src_lengths.values[j],
|
program.isrc_locations[i * program.src_lengths.length + j],
|
||||||
context->values + offset);
|
program.src_lengths.values[j], context->values + offset);
|
||||||
offset += program.src_lengths.values[j];
|
offset += program.src_lengths.values[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+50
-35
@@ -150,91 +150,106 @@ static void update_page(SharedContext *context, StateConfig state_config,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_selected(SharedContext *context, StateConfig state_config,
|
static void update_active(SharedContext *context, StateConfig state_config,
|
||||||
MidiDevice midi) {
|
MidiDevice midi) {
|
||||||
unsigned int i;
|
unsigned int i, j, k;
|
||||||
|
|
||||||
for (i = 0; i < state_config.select_frag_codes.length; i++) {
|
for (i = 0; i < state_config.src_active_counts.length; i++) {
|
||||||
safe_midi_write(midi, state_config.select_frag_codes.values[i],
|
for (j = 0; j < state_config.src_active_counts.values[i]; j++) {
|
||||||
i == context->selected ? MIDI_MAX : 0);
|
k = state_config.src_active_offsets.values[i] + j;
|
||||||
|
safe_midi_write(midi, state_config.src_active_codes.values[k],
|
||||||
|
context->active[i] == j ? MIDI_MAX : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void update_values(SharedContext *context, StateConfig state_config,
|
||||||
|
MidiDevice midi) {
|
||||||
|
unsigned int i, j, k, part;
|
||||||
|
|
||||||
|
for (i = 0; i < state_config.src_codes.length; i++) {
|
||||||
|
j = i / 3;
|
||||||
|
part = arr_uint_remap_index(state_config.src_offsets, &j);
|
||||||
|
k = state_config.values_offsets.values[part] +
|
||||||
|
context->active[part] * state_config.src_counts.values[part] + j;
|
||||||
|
safe_midi_write(midi, state_config.src_codes.values[i],
|
||||||
|
context->values[k][i % 3] * MIDI_MAX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void state_apply_event(SharedContext *context, StateConfig state_config,
|
void state_apply_event(SharedContext *context, StateConfig state_config,
|
||||||
MidiDevice midi, unsigned char code,
|
MidiDevice midi, unsigned char code,
|
||||||
unsigned char value) {
|
unsigned char value) {
|
||||||
unsigned int index, sub_index, src_index, part;
|
unsigned int i, j, k, part;
|
||||||
bool found;
|
bool found;
|
||||||
|
|
||||||
found = false;
|
found = false;
|
||||||
|
|
||||||
// PAGE CHANGE
|
// PAGE CHANGE
|
||||||
index = arr_uint_index_of(state_config.select_page_codes, code);
|
i = arr_uint_index_of(state_config.select_page_codes, code);
|
||||||
if (index != ARRAY_NOT_FOUND) {
|
if (i != ARRAY_NOT_FOUND) {
|
||||||
found = true;
|
found = true;
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
context->page = index;
|
context->page = i;
|
||||||
update_page(context, state_config, midi);
|
update_page(context, state_config, midi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TARGET CHANGE
|
// TARGET CHANGE
|
||||||
index = arr_uint_index_of(state_config.select_frag_codes, code);
|
i = arr_uint_index_of(state_config.select_frag_codes, code);
|
||||||
if (index != ARRAY_NOT_FOUND) {
|
if (i != ARRAY_NOT_FOUND) {
|
||||||
found = true;
|
found = true;
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
context->selected = index;
|
context->selected = i;
|
||||||
update_page(context, state_config, midi);
|
update_page(context, state_config, midi);
|
||||||
update_selected(context, state_config, midi);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ITEM CHANGE
|
// ITEM CHANGE
|
||||||
index = arr_uint_index_of(state_config.select_item_codes, code);
|
i = arr_uint_index_of(state_config.select_item_codes, code);
|
||||||
if (index != ARRAY_NOT_FOUND) {
|
if (i != ARRAY_NOT_FOUND) {
|
||||||
found = true;
|
found = true;
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
context->state[context->selected] =
|
context->state[context->selected] =
|
||||||
context->page * state_config.select_item_codes.length + index;
|
context->page * state_config.select_item_codes.length + i;
|
||||||
update_page(context, state_config, midi);
|
update_page(context, state_config, midi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACTIVE CHANGE
|
// ACTIVE CHANGE
|
||||||
index = arr_uint_index_of(state_config.src_active_codes, code);
|
i = arr_uint_index_of(state_config.src_active_codes, code);
|
||||||
if (index != ARRAY_NOT_FOUND) {
|
if (i != ARRAY_NOT_FOUND) {
|
||||||
found = true;
|
found = true;
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
part = arr_uint_remap_index(state_config.src_active_offsets, &index);
|
part = arr_uint_remap_index(state_config.src_active_offsets, &i);
|
||||||
context->active[part] = index;
|
context->active[part] = i;
|
||||||
// TODO update values
|
update_active(context, state_config, midi);
|
||||||
|
update_values(context, state_config, midi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// VALUE CHANGE
|
// VALUE CHANGE
|
||||||
index = arr_uint_index_of(state_config.src_codes, code);
|
i = arr_uint_index_of(state_config.src_codes, code);
|
||||||
if (index != ARRAY_NOT_FOUND) {
|
if (i != ARRAY_NOT_FOUND) {
|
||||||
found = true;
|
found = true;
|
||||||
sub_index = index / 3;
|
j = i / 3;
|
||||||
part = arr_uint_remap_index(state_config.src_offsets, &sub_index);
|
part = arr_uint_remap_index(state_config.src_offsets, &j);
|
||||||
src_index = state_config.values_offsets.values[part] +
|
k = state_config.values_offsets.values[part] +
|
||||||
context->active[part] * state_config.src_counts.values[part] +
|
context->active[part] * state_config.src_counts.values[part] + j;
|
||||||
sub_index;
|
|
||||||
|
|
||||||
if (arr_uint_index_of(state_config.fader_codes, code) != ARRAY_NOT_FOUND) {
|
if (arr_uint_index_of(state_config.fader_codes, code) != ARRAY_NOT_FOUND) {
|
||||||
context->values[src_index][index % 3] = (float)value / MIDI_MAX;
|
context->values[k][i % 3] = (float)value / MIDI_MAX;
|
||||||
} else if (value > 0) {
|
} else if (value > 0) {
|
||||||
if (context->values[src_index][index % 3] > 0.5) {
|
if (context->values[k][i % 3] > 0.5) {
|
||||||
context->values[src_index][index % 3] = 0;
|
context->values[k][i % 3] = 0;
|
||||||
midi_write(midi, code, 0);
|
midi_write(midi, code, 0);
|
||||||
} else {
|
} else {
|
||||||
context->values[src_index][index % 3] = 1;
|
context->values[k][i % 3] = 1;
|
||||||
midi_write(midi, code, MIDI_MAX);
|
midi_write(midi, code, MIDI_MAX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO values
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
log_trace("unknown midi: %d %d", code, value);
|
log_trace("unknown midi: %d %d", code, value);
|
||||||
midi_write(midi, code, value);
|
midi_write(midi, code, value);
|
||||||
@@ -258,8 +273,8 @@ bool state_background_midi_write(SharedContext *context,
|
|||||||
log_info("(state) background writing started (pid: %d)", pid);
|
log_info("(state) background writing started (pid: %d)", pid);
|
||||||
|
|
||||||
update_page(context, state_config, midi);
|
update_page(context, state_config, midi);
|
||||||
update_selected(context, state_config, midi);
|
update_active(context, state_config, midi);
|
||||||
// TODO init values
|
update_values(context, state_config, midi);
|
||||||
|
|
||||||
while (!context->stop) {
|
while (!context->stop) {
|
||||||
// TODO tap tempo and more
|
// TODO tap tempo and more
|
||||||
|
|||||||
Reference in New Issue
Block a user