fix: allocate MIDI events and update engine to use new dispatcher API

Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-03 19:17:27 +00:00
parent 7c9a70ea03
commit fb5b53828a
2 changed files with 17 additions and 8 deletions

12
main.c
View File

@@ -104,6 +104,18 @@ int main(int argc, char *argv[]) {
initial_state->midi_clips[i].state = CLIP_EMPTY;
initial_state->midi_clips[i].event_count = 0;
initial_state->midi_clips[i].read_index = 0;
initial_state->midi_clips[i].events = (MidiEvent *)calloc(MAX_MIDI_EVENTS, sizeof(MidiEvent));
if (!initial_state->midi_clips[i].events) {
fprintf(stderr, "Failed to allocate MIDI events for clip %d\n", i);
// Cleanup previously allocated buffers and events
for (int j = 0; j < i; j++) {
free(initial_state->clips[j].buffer);
free(initial_state->midi_clips[j].events);
}
free(initial_state);
return 1;
}
initial_state->midi_clips[i].max_events = MAX_MIDI_EVENTS;
}
// Initialize channel names