Phase 7: Add MIDI clips, instrument and piano roll

This commit is contained in:
Johannes Findeisen 2026-10-27 00:53:41 +01:00
commit cacc086805
38 changed files with 1373 additions and 74 deletions

View file

@ -109,7 +109,7 @@ xtc_result xtc_plan_meter_peak(const xtc_plan *plan, size_t node_id, float *out_
return XTC_OK;
}
xtc_result xtc_plan_process_audio(xtc_plan *plan, const float *input, const float *timeline, float *output,
xtc_result xtc_plan_process_sources(xtc_plan *plan, const float *input, const float *timeline, const float *instrument, float *output,
size_t frame_count)
{
size_t index, frame, edge;
@ -126,7 +126,9 @@ xtc_result xtc_plan_process_audio(xtc_plan *plan, const float *input, const floa
double phase = plan->phases[node];
for (frame = 0U; frame < frame_count; ++frame) {
float sample = 0.0f;
if (spec.type == XTC_NODE_AUDIO) {
if (spec.type == XTC_NODE_INSTRUMENT) {
sample = instrument ? instrument[frame] : 0.0f;
} else if (spec.type == XTC_NODE_AUDIO) {
sample = timeline ? timeline[frame] : 0.0f;
} else if (spec.type == XTC_NODE_OSCILLATOR) {
sample = (float)sin(XTC_TAU * phase);
@ -172,3 +174,6 @@ xtc_result xtc_graph_process_offline(xtc_graph *graph, const float *input,
xtc_result xtc_plan_process(xtc_plan *plan, const float *input, float *output, size_t frames)
{ return xtc_plan_process_audio(plan, input, NULL, output, frames); }
xtc_result xtc_plan_process_audio(xtc_plan *plan, const float *input, const float *timeline, float *output, size_t frames)
{ return xtc_plan_process_sources(plan, input, timeline, NULL, output, frames); }

View file

@ -80,7 +80,7 @@ xtc_result xtc_realtime_get_status(const xtc_realtime *engine,
return XTC_OK;
}
xtc_result xtc_realtime_process_audio(xtc_realtime *engine, const float *input, const float *timeline,
xtc_result xtc_realtime_process_sources(xtc_realtime *engine, const float *input, const float *timeline, const float *instrument,
float *output, size_t frame_count)
{
xtc_result result = XTC_OK;
@ -107,7 +107,7 @@ xtc_result xtc_realtime_process_audio(xtc_realtime *engine, const float *input,
}
}
if (engine->active != NULL)
result = xtc_plan_process_audio(engine->active, input, timeline, output, frame_count);
result = xtc_plan_process_sources(engine->active, input, timeline, instrument, output, frame_count);
else
memset(output, 0, frame_count * sizeof(*output));
}
@ -120,3 +120,6 @@ xtc_result xtc_realtime_process_audio(xtc_realtime *engine, const float *input,
xtc_result xtc_realtime_process(xtc_realtime *engine, const float *input, float *output, size_t frames)
{ return xtc_realtime_process_audio(engine, input, NULL, output, frames); }
xtc_result xtc_realtime_process_audio(xtc_realtime *engine, const float *input, const float *timeline, float *output, size_t frames)
{ return xtc_realtime_process_sources(engine, input, timeline, NULL, output, frames); }