feat: add parallel MIDI grid with separate clip storage and view toggle

Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-03 18:49:21 +00:00
parent 5e4d4e4d44
commit 61ab2f0b19
6 changed files with 216 additions and 25 deletions

View File

@@ -46,6 +46,22 @@ typedef enum {
CLOCK_SOURCE_MIDI
} ClockSource;
typedef struct {
uint8_t note;
uint8_t velocity;
uint32_t timestamp; // sample offset within the clip
} MidiEvent;
#define MAX_MIDI_EVENTS 44100 // ~1 second of dense MIDI data
typedef struct {
ClipState state;
MidiEvent events[MAX_MIDI_EVENTS];
int event_count;
int read_index;
char channel_name[64]; // per-channel name for MIDI grid
} MidiClip;
typedef struct {
ClipState state;
float *buffer;
@@ -73,6 +89,11 @@ typedef struct {
// Clips
Clip clips[MAX_CLIPS];
// MIDI clips (separate grid)
MidiClip midi_clips[MAX_CLIPS];
bool show_midi_grid; // View toggle: true = MIDI grid, false = Audio grid
char channel_names[MAX_CHANNELS][64]; // Channel names for audio grid
// Undo history
struct {
int undo_index;
@@ -126,7 +147,11 @@ typedef enum {
ACTION_SAVE_PROJECT,
ACTION_LOAD_PROJECT,
ACTION_PROCESS_AUDIO,
ACTION_QUIT
ACTION_QUIT,
ACTION_SET_SHOW_MIDI_GRID,
ACTION_MIDI_CLIP_TRIGGER,
ACTION_MIDI_CLIP_RESET,
ACTION_SET_CHANNEL_NAME
} ActionType;
typedef struct {
@@ -151,6 +176,10 @@ typedef struct {
struct { char filename[512]; } save_project;
struct { char filename[512]; } load_project;
struct { jack_nframes_t nframes; } process_audio;
struct { bool show; } set_show_midi_grid;
struct { int clip_index; } midi_clip_trigger;
struct { int clip_index; } midi_clip_reset;
struct { int channel; char name[64]; } set_channel_name;
} data;
} Action;