Phase 16: persist sample-timed effect automation and add expressive MIDI controls
This commit is contained in:
parent
f72314b5a3
commit
7fac0a4f6a
23 changed files with 374 additions and 39 deletions
|
|
@ -191,7 +191,7 @@ static xtc_result read_project(reader *input, xtc_project *project)
|
|||
xtc_graph *graph = project->graph;
|
||||
READ("XTC_PROJECT", 2U);
|
||||
NUM(1U, version);
|
||||
if (version < 1U || version > 5U)
|
||||
if (version < 1U || version > 6U)
|
||||
return XTC_ERR_UNSUPPORTED;
|
||||
format_version = version;
|
||||
READ("APP", 4U);
|
||||
|
|
@ -255,6 +255,20 @@ static xtc_result read_project(reader *input, xtc_project *project)
|
|||
if (value >= 64 || !decode_float(input->tokens[2],p->values+k)) return XTC_ERR_FORMAT;
|
||||
p->ports[k] = (unsigned int)value;
|
||||
}
|
||||
p->tempo = project->tempo;
|
||||
if (format_version >= 6) {
|
||||
READ("PLUGIN_AUTOMATION",2U); NUM(1U,value);
|
||||
if (value > XTC_PLUGIN_POINTS) return XTC_ERR_FORMAT;
|
||||
p->point_count = (unsigned int)value;
|
||||
for (k = 0; k < p->point_count; ++k) {
|
||||
xtc_plugin_point *a = p->points+k;
|
||||
READ("PARAM",5U); NUM(1U,a->tick); NUM(2U,value);
|
||||
if (value >= 64) return XTC_ERR_FORMAT;
|
||||
a->port = (unsigned int)value;
|
||||
NUM(3U,value); if (value > 1) return XTC_ERR_FORMAT; a->step = (unsigned int)value;
|
||||
if (!decode_float(input->tokens[4],&a->value)) return XTC_ERR_FORMAT;
|
||||
}
|
||||
}
|
||||
if (xtc_plugin_spec_validate(p) != XTC_OK) return XTC_ERR_FORMAT;
|
||||
}
|
||||
for (j = 0U; j < i; ++j)
|
||||
|
|
@ -423,7 +437,7 @@ static xtc_result write_project(FILE *file, const xtc_project *project)
|
|||
return XTC_ERR_UNSUPPORTED;
|
||||
if (sizeof(float) != sizeof(uint32_t) || FLT_RADIX != 2 || FLT_MANT_DIG != 24 || FLT_MAX_EXP != 128)
|
||||
return XTC_ERR_UNSUPPORTED;
|
||||
if (fprintf(file, "XTC_PROJECT 5\nAPP %d %d %d\nTEMPO %u\nIDS %" PRIu64 " %" PRIu64 "\nGRAPH %d %zu %zu %zu\n",
|
||||
if (fprintf(file, "XTC_PROJECT 6\nAPP %d %d %d\nTEMPO %u\nIDS %" PRIu64 " %" PRIu64 "\nGRAPH %d %zu %zu %zu\n",
|
||||
XTC_VERSION_MAJOR, XTC_VERSION_MINOR, XTC_VERSION_PATCH, project->tempo, project->next_track_id,
|
||||
project->next_clip_id, graph->require_output_nodes, graph->next_id, graph->node_count,
|
||||
graph->edge_count) < 0)
|
||||
|
|
@ -444,6 +458,12 @@ static xtc_result write_project(FILE *file, const xtc_project *project)
|
|||
uint32_t value; memcpy(&value,p->values+k,4);
|
||||
if (fprintf(file,"CONTROL %u %08" PRIx32 "\n",p->ports[k],value) < 0) return XTC_ERR_IO;
|
||||
}
|
||||
if (fprintf(file,"PLUGIN_AUTOMATION %u\n",p->point_count) < 0) return XTC_ERR_IO;
|
||||
for (k = 0; k < p->point_count; ++k) {
|
||||
uint32_t value; memcpy(&value,&p->points[k].value,4);
|
||||
if (fprintf(file,"PARAM %" PRIu64 " %u %u %08" PRIx32 "\n",p->points[k].tick,p->points[k].port,
|
||||
p->points[k].step,value) < 0) return XTC_ERR_IO;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0U; i < graph->edge_count; ++i)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue