sokol_gl based rendering

This commit is contained in:
veclavtalica
2024-06-29 18:15:06 +03:00
parent 3c188efa60
commit 12189efe88
13 changed files with 25800 additions and 5167 deletions

View File

@ -1,9 +1,9 @@
#if defined(STFU_MAIN) && !defined(STFU_TROJKA)
#define STFU_TROJKA
#include "../../phaser.c"
#include "../../envelope.c"
#include "../../config.h"
#include "../../envelope.c"
#include "../../phaser.c"
#define STFU_TROJKA_OP_COUNT 3
@ -23,19 +23,25 @@ struct stfu_trojka {
float left_feedback, right_feedback;
};
static struct stfu_trojka stfu_sample_trojka(struct stfu_trojka synth, float buffer[static 2]) {
static struct stfu_trojka stfu_sample_trojka(struct stfu_trojka synth,
float buffer[static 2]) {
for (int i = 0; i < STFU_TROJKA_OP_COUNT; ++i) {
synth.phasers[i] = stfu_pump_phaser(synth.phasers[i]);
synth.envelopes[i] = stfu_pump_envelope(synth.envelopes[i]);
}
float left_modulator_stack = synth.envelopes[1].v * synth.indices[1] * sinf(synth.phasers[1].v + synth.envelopes[0].v * synth.indices[0] * sinf(synth.phasers[0].v)) + synth.left_feedback * synth.feedback_gain;
float left_modulator_stack =
synth.envelopes[1].v * synth.indices[1] *
sinf(synth.phasers[1].v + synth.envelopes[0].v * synth.indices[0] *
sinf(synth.phasers[0].v)) +
synth.left_feedback * synth.feedback_gain;
float right_modulator_stack = left_modulator_stack;
synth.left_feedback = left_modulator_stack;
synth.right_feedback = right_modulator_stack;
float left = synth.envelopes[2].v * sinf(synth.phasers[2].v + left_modulator_stack);
float left =
synth.envelopes[2].v * sinf(synth.phasers[2].v + left_modulator_stack);
float right =
synth.envelopes[2].v * sinf(synth.phasers[2].v + right_modulator_stack);
@ -45,13 +51,15 @@ static struct stfu_trojka stfu_sample_trojka(struct stfu_trojka synth, float buf
return synth;
}
static struct stfu_trojka stfu_press_trojka(struct stfu_trojka synth, float key_frequency) {
static struct stfu_trojka stfu_press_trojka(struct stfu_trojka synth,
float key_frequency) {
for (int i = 0; i < STFU_TROJKA_OP_COUNT; ++i) {
synth.phasers[i] = stfu_set_phaser_frequency(synth.phasers[i], key_frequency * synth.freq_scales[i]);
synth.phasers[i] = stfu_set_phaser_frequency(
synth.phasers[i], key_frequency * synth.freq_scales[i]);
synth.envelopes[i] = stfu_trigger_envelope(synth.envelopes[i]);
}
return synth;
return synth;
}
#endif