feat: --auto-random-cycle
This commit is contained in:
+7
-3
@@ -117,11 +117,15 @@ make -f Makefile.dev release-arch
|
|||||||
- [x] Printable PDF of default scr/fx
|
- [x] Printable PDF of default scr/fx
|
||||||
- [x] Add NanoKontrol setup file
|
- [x] Add NanoKontrol setup file
|
||||||
- [x] Find and fix opengl errors 0500 ?
|
- [x] Find and fix opengl errors 0500 ?
|
||||||
- [ ] Improvements
|
- [ ] Extra features
|
||||||
- [ ] Record show as text files
|
- [ ] `--auto-random-cycle=4`
|
||||||
- [ ] Play from record text file
|
- [ ] Arrows (up-down: bpm / left-right: cycle)
|
||||||
|
- [ ] Save states (numkey: load / shift + numkey: save)
|
||||||
|
- [ ] Configurable key codes
|
||||||
- [ ] Key codes as inputs
|
- [ ] Key codes as inputs
|
||||||
- [ ] Mouse position and scroll as inputs
|
- [ ] Mouse position and scroll as inputs
|
||||||
|
- [ ] Record show as text files
|
||||||
|
- [ ] Play from record text file
|
||||||
- [ ] Fixes
|
- [ ] Fixes
|
||||||
- [ ] Try to write NanoKontrol config
|
- [ ] Try to write NanoKontrol config
|
||||||
- [ ] Investigate video device fps loss (bad unregister ?)
|
- [ ] Investigate video device fps loss (bad unregister ?)
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ When running, the following hotkeys are available:
|
|||||||
### CLI arguments
|
### CLI arguments
|
||||||
|
|
||||||
```txt
|
```txt
|
||||||
usage: forge [-h] [-v] [-p=PROJECT_PATH] [-c=CFG_FILE] [-hr] [-s=SCREEN] [-m=SCREEN] [-mo] [-w] [-t=TEMPO] [-d] [-ar / -nar] [-v=FILE] [-vs=SIZE] [-is=SIZE] [-sf=STATE_PATH] [-ls / -nls] [-ss / -nss] [-tm] [-tf]
|
usage: forge [-h] [-v] [-p=PROJECT_PATH] [-c=CFG_FILE] [-hr] [-s=SCREEN] [-m=SCREEN] [-mo] [-w] [-t=TEMPO] [-d] [-ar / -nar] [-arc=CYCLES] [-v=FILE] [-vs=SIZE] [-is=SIZE] [-sf=STATE_PATH] [-ls / -nls] [-ss / -nss] [-tm] [-tf]
|
||||||
|
|
||||||
Fusion Of Real-time Generative Effects.
|
Fusion Of Real-time Generative Effects.
|
||||||
|
|
||||||
@@ -182,8 +182,9 @@ options:
|
|||||||
-w, --windowed not fullscreen
|
-w, --windowed not fullscreen
|
||||||
-t, --tempo base tempo (default: 60)
|
-t, --tempo base tempo (default: 60)
|
||||||
-d, --demo demonstration mode (assume --no-save-state, --no-load-state, --auto-random)
|
-d, --demo demonstration mode (assume --no-save-state, --no-load-state, --auto-random)
|
||||||
-ar, --auto-random randomize state every 4 beats
|
-ar, --auto-random randomize state every cycle (4 beats)
|
||||||
-nar, --no-auto-random do not randomize state (default)
|
-nar, --no-auto-random do not randomize state (default)
|
||||||
|
-arc, --auto-random-cycle auto random cycle length (default: 4)
|
||||||
-v, --video-in path to video capture device (multiple allowed)
|
-v, --video-in path to video capture device (multiple allowed)
|
||||||
-vs, --video-size video capture desired height (default: internal texture height)
|
-vs, --video-size video capture desired height (default: internal texture height)
|
||||||
-is, --internal-size internal texture height (default: 720)
|
-is, --internal-size internal texture height (default: 720)
|
||||||
|
|||||||
+11
-2
@@ -13,7 +13,8 @@
|
|||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
static void print_help(int status_code) {
|
static void print_help(int status_code) {
|
||||||
puts(PACKAGE
|
puts(
|
||||||
|
PACKAGE
|
||||||
" " VERSION "\n\n"
|
" " VERSION "\n\n"
|
||||||
"usage: " PACKAGE " "
|
"usage: " PACKAGE " "
|
||||||
"[-h] "
|
"[-h] "
|
||||||
@@ -28,6 +29,7 @@ static void print_help(int status_code) {
|
|||||||
"[-t=TEMPO] "
|
"[-t=TEMPO] "
|
||||||
"[-d] "
|
"[-d] "
|
||||||
"[-ar / -nar] "
|
"[-ar / -nar] "
|
||||||
|
"[-arc=CYCLES] "
|
||||||
"[-v=FILE] "
|
"[-v=FILE] "
|
||||||
"[-vs=SIZE] "
|
"[-vs=SIZE] "
|
||||||
"[-is=SIZE] "
|
"[-is=SIZE] "
|
||||||
@@ -53,8 +55,9 @@ static void print_help(int status_code) {
|
|||||||
" -t, --tempo base tempo (default: 60)\n"
|
" -t, --tempo base tempo (default: 60)\n"
|
||||||
" -d, --demo demonstration mode (assume "
|
" -d, --demo demonstration mode (assume "
|
||||||
"--no-save-state, --no-load-state, --auto-random)\n"
|
"--no-save-state, --no-load-state, --auto-random)\n"
|
||||||
" -ar, --auto-random randomize state every 4 beats\n"
|
" -ar, --auto-random randomize state every cycle (4 beats)\n"
|
||||||
" -nar, --no-auto-random do not randomize state (default)\n"
|
" -nar, --no-auto-random do not randomize state (default)\n"
|
||||||
|
" -arc, --auto-random-cycle auto random cycle length (default: 4)\n"
|
||||||
" -v, --video-in path to video capture device (multiple "
|
" -v, --video-in path to video capture device (multiple "
|
||||||
"allowed)\n"
|
"allowed)\n"
|
||||||
" -vs, --video-size video capture desired height (default: "
|
" -vs, --video-size video capture desired height (default: "
|
||||||
@@ -124,6 +127,7 @@ void args_parse(Parameters *params, int argc, char **argv) {
|
|||||||
params->base_tempo = 60.0f;
|
params->base_tempo = 60.0f;
|
||||||
params->demo = false;
|
params->demo = false;
|
||||||
params->auto_random = false;
|
params->auto_random = false;
|
||||||
|
params->auto_random_cycles = 4;
|
||||||
params->video_in.length = 0;
|
params->video_in.length = 0;
|
||||||
params->video_size = 0;
|
params->video_size = 0;
|
||||||
params->internal_size = 720;
|
params->internal_size = 720;
|
||||||
@@ -168,6 +172,11 @@ void args_parse(Parameters *params, int argc, char **argv) {
|
|||||||
params->auto_random = true;
|
params->auto_random = true;
|
||||||
} else if (is_arg(arg, "-nar") || is_arg(arg, "--no-auto-random")) {
|
} else if (is_arg(arg, "-nar") || is_arg(arg, "--no-auto-random")) {
|
||||||
params->auto_random = false;
|
params->auto_random = false;
|
||||||
|
} else if (is_arg(arg, "-arc") || is_arg(arg, "--auto-random-cycle")) {
|
||||||
|
params->auto_random_cycles = parse_uint(arg, value);
|
||||||
|
if (params->auto_random_cycles == 0) {
|
||||||
|
invalid_value(arg, value);
|
||||||
|
}
|
||||||
} else if (is_arg(arg, "-v") || is_arg(arg, "--video-in")) {
|
} else if (is_arg(arg, "-v") || is_arg(arg, "--video-in")) {
|
||||||
if (params->video_in.length == MAX_VIDEO) {
|
if (params->video_in.length == MAX_VIDEO) {
|
||||||
log_error("maximum video input reached");
|
log_error("maximum video input reached");
|
||||||
|
|||||||
+2
-1
@@ -59,7 +59,8 @@ static void compute_fps(bool trace_fps) {
|
|||||||
|
|
||||||
static void init_context(const Parameters *params, unsigned int in_count) {
|
static void init_context(const Parameters *params, unsigned int in_count) {
|
||||||
state_init(context, &project.state_config, params->demo, params->auto_random,
|
state_init(context, &project.state_config, params->demo, params->auto_random,
|
||||||
params->base_tempo, params->state_file, params->load_state);
|
params->auto_random_cycles, params->base_tempo, params->state_file,
|
||||||
|
params->load_state);
|
||||||
|
|
||||||
context->monitor = params->monitor;
|
context->monitor = params->monitor;
|
||||||
|
|
||||||
|
|||||||
+7
-4
@@ -314,7 +314,7 @@ bool state_background_write(SharedContext *context,
|
|||||||
last_change = false;
|
last_change = false;
|
||||||
|
|
||||||
while (!context->stop) {
|
while (!context->stop) {
|
||||||
beat_active = tempo_progress(&context->tempo, 1.0) < 0.25;
|
beat_active = tempo_progress(&context->tempo, 1.0) < 0.5;
|
||||||
|
|
||||||
if (!midi->error && beat_active != last_active) {
|
if (!midi->error && beat_active != last_active) {
|
||||||
safe_midi_write(midi, state_config->tap_tempo_code,
|
safe_midi_write(midi, state_config->tap_tempo_code,
|
||||||
@@ -327,7 +327,8 @@ bool state_background_write(SharedContext *context,
|
|||||||
|
|
||||||
last_active = beat_active;
|
last_active = beat_active;
|
||||||
|
|
||||||
change = tempo_progress(&context->tempo, 4.0) < 0.25;
|
change = tempo_progress(&context->tempo,
|
||||||
|
(double)context->auto_random_cycles) < 0.5;
|
||||||
|
|
||||||
if (context->auto_random && change && !last_change) {
|
if (context->auto_random && change && !last_change) {
|
||||||
state_randomize(context, state_config);
|
state_randomize(context, state_config);
|
||||||
@@ -383,12 +384,14 @@ static void state_load(SharedContext *context, const StateConfig *state_config,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void state_init(SharedContext *context, const StateConfig *state_config,
|
void state_init(SharedContext *context, const StateConfig *state_config,
|
||||||
bool demo, bool auto_random, unsigned int base_tempo,
|
bool demo, bool auto_random, unsigned int auto_random_cycles,
|
||||||
const char *state_file, bool load_state) {
|
unsigned int base_tempo, const char *state_file,
|
||||||
|
bool load_state) {
|
||||||
tempo_init(&context->tempo);
|
tempo_init(&context->tempo);
|
||||||
tempo_set(&context->tempo, base_tempo);
|
tempo_set(&context->tempo, base_tempo);
|
||||||
context->demo = demo;
|
context->demo = demo;
|
||||||
context->auto_random = auto_random;
|
context->auto_random = auto_random;
|
||||||
|
context->auto_random_cycles = auto_random_cycles;
|
||||||
|
|
||||||
context->state.length = state_config->select_frag_codes.length;
|
context->state.length = state_config->select_frag_codes.length;
|
||||||
memset(context->state.values, 0, sizeof(context->state.values));
|
memset(context->state.values, 0, sizeof(context->state.values));
|
||||||
|
|||||||
+3
-2
@@ -14,8 +14,9 @@ bool state_background_write(SharedContext *context,
|
|||||||
const MidiDevice *midi);
|
const MidiDevice *midi);
|
||||||
|
|
||||||
void state_init(SharedContext *context, const StateConfig *state_config,
|
void state_init(SharedContext *context, const StateConfig *state_config,
|
||||||
bool demo, bool auto_random, unsigned int base_tempo,
|
bool demo, bool auto_random, unsigned int auto_random_cycles,
|
||||||
const char *state_file, bool load_state);
|
unsigned int base_tempo, const char *state_file,
|
||||||
|
bool load_state);
|
||||||
|
|
||||||
void state_reset(SharedContext *context);
|
void state_reset(SharedContext *context);
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ typedef struct Parameters {
|
|||||||
float base_tempo;
|
float base_tempo;
|
||||||
bool demo;
|
bool demo;
|
||||||
bool auto_random;
|
bool auto_random;
|
||||||
|
unsigned int auto_random_cycles;
|
||||||
StringArray video_in;
|
StringArray video_in;
|
||||||
unsigned int video_size;
|
unsigned int video_size;
|
||||||
unsigned int internal_size;
|
unsigned int internal_size;
|
||||||
@@ -182,6 +183,7 @@ typedef struct SharedContext {
|
|||||||
vec3 values[ARRAY_SIZE];
|
vec3 values[ARRAY_SIZE];
|
||||||
bool demo;
|
bool demo;
|
||||||
bool auto_random;
|
bool auto_random;
|
||||||
|
unsigned int auto_random_cycles;
|
||||||
unsigned int seeds[MAX_FRAG];
|
unsigned int seeds[MAX_FRAG];
|
||||||
bool monitor;
|
bool monitor;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user