refactor: use struct pointers everywhere and bump max sizes

This commit is contained in:
2025-11-08 19:29:04 +01:00
parent 3b7a550b6a
commit b4b79cea12
8 changed files with 33 additions and 33 deletions
+11 -11
View File
@@ -270,8 +270,8 @@ void state_apply_event(SharedContext *context, StateConfig *state_config,
}
}
bool state_background_write(SharedContext *context, StateConfig state_config,
MidiDevice midi) {
bool state_background_write(SharedContext *context, StateConfig *state_config,
MidiDevice *midi) {
pid_t pid;
bool beat_active, last_active, change, last_change;
@@ -285,10 +285,10 @@ bool state_background_write(SharedContext *context, StateConfig state_config,
}
log_info("(state) background writing started (pid: %d)", pid);
if (!midi.error) {
update_page(context, &state_config, &midi);
update_active(context, &state_config, &midi);
update_values(context, &state_config, &midi);
if (!midi->error) {
update_page(context, state_config, midi);
update_active(context, state_config, midi);
update_values(context, state_config, midi);
}
last_active = false;
@@ -297,12 +297,12 @@ bool state_background_write(SharedContext *context, StateConfig state_config,
while (!context->stop) {
beat_active = tempo_progress(&context->tempo, 1.0) < 0.25;
if (!midi.error && beat_active != last_active) {
safe_midi_write(&midi, state_config.tap_tempo_code,
if (!midi->error && beat_active != last_active) {
safe_midi_write(midi, state_config->tap_tempo_code,
beat_active ? MIDI_MAX : 0);
safe_midi_write(&midi,
state_config.select_frag_codes.values[context->selected],
safe_midi_write(midi,
state_config->select_frag_codes.values[context->selected],
beat_active ? MIDI_MAX : 0);
}
@@ -311,7 +311,7 @@ bool state_background_write(SharedContext *context, StateConfig state_config,
change = tempo_progress(&context->tempo, 4.0) < 0.25;
if (context->auto_random && change && !last_change) {
state_randomize(context, &state_config);
state_randomize(context, state_config);
}
last_change = change;