Phase 26: add common parameter targets, step automation and MIDI control mapping
This commit is contained in:
parent
7bff7b535d
commit
901a536f10
38 changed files with 740 additions and 67 deletions
|
|
@ -403,7 +403,7 @@ static xtc_result read_project(reader *input, xtc_project *project, const char *
|
|||
project->automation_count = (size_t)value;
|
||||
for (i = 0; i < project->automation_count; ++i) {
|
||||
xtc_automation_point *a = project->automation + i;
|
||||
READ("POINT", 5U);
|
||||
READ("POINT", format_version >= 10U ? 6U : 5U);
|
||||
NUM(1U, a->track_id);
|
||||
NUM(2U, value);
|
||||
if (value > 1)
|
||||
|
|
@ -412,6 +412,22 @@ static xtc_result read_project(reader *input, xtc_project *project, const char *
|
|||
NUM(3U, a->tick);
|
||||
if (!decode_float(input->tokens[4], &a->value))
|
||||
return XTC_ERR_FORMAT;
|
||||
if (format_version >= 10U) {
|
||||
NUM(5U,value); if (value > 1) return XTC_ERR_FORMAT;
|
||||
a->step = (unsigned int)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (format_version >= 10U) {
|
||||
READ("CONTROL_MAPS",2U); NUM(1U,value);
|
||||
if (value != 16) return XTC_ERR_FORMAT;
|
||||
for (i = 0; i < 16; ++i) {
|
||||
READ("MAP",5U); NUM(1U,value);
|
||||
if (value != i) return XTC_ERR_FORMAT;
|
||||
for (j = 0; j < 3; ++j) {
|
||||
NUM(j+2,value); if (value > 128) return XTC_ERR_FORMAT;
|
||||
project->control_map[i][j] = (unsigned char)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
READ("END", 1U);
|
||||
|
|
@ -549,10 +565,14 @@ static xtc_result write_project(FILE *file, const xtc_project *project, const ch
|
|||
uint32_t bits;
|
||||
const xtc_automation_point *a = project->automation + i;
|
||||
memcpy(&bits, &a->value, sizeof(bits));
|
||||
if (fprintf(file, "POINT %" PRIu64 " %u %" PRIu64 " %08" PRIx32 "\n", a->track_id, (unsigned int)a->parameter,
|
||||
a->tick, bits) < 0)
|
||||
if (fprintf(file, "POINT %" PRIu64 " %u %" PRIu64 " %08" PRIx32 " %u\n", a->track_id, (unsigned int)a->parameter,
|
||||
a->tick, bits, a->step) < 0)
|
||||
return XTC_ERR_IO;
|
||||
}
|
||||
if (fputs("CONTROL_MAPS 16\n",file) == EOF) return XTC_ERR_IO;
|
||||
for (i = 0; i < 16; ++i)
|
||||
if (fprintf(file,"MAP %zu %u %u %u\n",i,(unsigned int)project->control_map[i][0],
|
||||
(unsigned int)project->control_map[i][1],(unsigned int)project->control_map[i][2]) < 0) return XTC_ERR_IO;
|
||||
return fputs("END\n", file) == EOF ? XTC_ERR_IO : XTC_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue