Phase 26: add common parameter targets, step automation and MIDI control mapping

This commit is contained in:
Johannes Findeisen 2026-10-27 16:37:59 +01:00
commit 901a536f10
38 changed files with 740 additions and 67 deletions

View file

@ -119,6 +119,13 @@ xtc_result xtc_project_create(xtc_project **out_project)
}
project->graph->require_output_nodes = 1;
project->tempo = 120000U;
{ size_t channel;
for (channel = 0; channel < 16; ++channel) {
project->control_map[channel][0] = 7;
project->control_map[channel][1] = 10;
project->control_map[channel][2] = 64;
}
}
*out_project = project;
return XTC_OK;
}
@ -516,6 +523,13 @@ xtc_result xtc_project_validate(const xtc_project *project)
if (project->tempo < 20000U || project->tempo > 300000U || project->track_count > XTC_PROJECT_MAX_TRACKS ||
project->clip_count > XTC_PROJECT_MAX_CLIPS || project->note_count > XTC_PROJECT_MAX_NOTES)
return XTC_ERR_FORMAT;
for (i = 0; i < 16; ++i) for (j = 0; j < 3; ++j) {
unsigned int cc = project->control_map[i][j];
size_t k;
if (cc > 128 || cc == 120 || cc == 123) return XTC_ERR_FORMAT;
for (k = 0; k < j; ++k)
if (cc != 128 && cc == project->control_map[i][k]) return XTC_ERR_FORMAT;
}
for (i = 0U; i < project->track_count; ++i) {
if (project->tracks[i].id >= project->next_track_id || !xtc_project_valid_name(project->tracks[i].name))
return XTC_ERR_FORMAT;
@ -577,7 +591,7 @@ xtc_result xtc_project_validate(const xtc_project *project)
}
for (i = 0; i < project->automation_count; ++i) {
const xtc_automation_point *a = project->automation + i;
if (track_index(project, a->track_id) == SIZE_MAX || a->tick > XTC_PROJECT_MAX_TICK || !isfinite(a->value) ||
if (track_index(project, a->track_id) == SIZE_MAX || a->tick > XTC_PROJECT_MAX_TICK || a->step > 1 || !isfinite(a->value) ||
(a->parameter != XTC_AUTOMATION_GAIN && a->parameter != XTC_AUTOMATION_PAN) ||
a->value < (a->parameter == XTC_AUTOMATION_GAIN ? 0 : -1) ||
a->value > (a->parameter == XTC_AUTOMATION_GAIN ? 4 : 1))

View file

@ -9,6 +9,7 @@ struct xtc_project {
xtc_graph *graph;
uint64_t next_track_id, next_clip_id;
unsigned int tempo;
unsigned char control_map[16][3];
size_t track_count, clip_count;
uint64_t next_note_id;
size_t note_count;