feat: add tempo-synced stereo delay and coupled room reverb
This commit is contained in:
parent
35bf6a00a1
commit
7a01e2d2f3
12 changed files with 241 additions and 63 deletions
|
|
@ -126,6 +126,7 @@ xtc_result xtc_graph_compile(const xtc_graph *graph, double sample_rate, size_t
|
|||
if (plan->nodes[node].type == XTC_NODE_PLUGIN) {
|
||||
size_t side;
|
||||
for (side = 0; side < 2; ++side) {
|
||||
if(side && plan->nodes[node].plugin.format==XTC_PLUGIN_BUILTIN && plan->nodes[node].plugin.index>=5)continue;
|
||||
result = xtc_plugin_create(&plan->nodes[node].plugin,sample_rate,max_frames,
|
||||
&plan->plugins[side * plan->node_count + node]);
|
||||
if (result != XTC_OK) { xtc_plan_destroy(plan); return result; }
|
||||
|
|
@ -221,11 +222,11 @@ xtc_result xtc_plan_process_stereo(xtc_plan *plan, const float *input, const flo
|
|||
return XTC_OK;
|
||||
/* All external input reads finish before output is written, allowing aliasing.
|
||||
* Nonfinite input/arithmetic becomes silence per sample, never persistent DSP state. */
|
||||
for (channel = 0; channel < (right ? 2U : 1U); ++channel) {
|
||||
const float *audio_source = channel ? timeline_right : timeline;
|
||||
const float *midi_source = channel ? instrument_right : instrument;
|
||||
for (index = 0U; index < plan->node_count; ++index) {
|
||||
size_t node = plan->order[index];
|
||||
for (index = 0U; index < plan->node_count; ++index) {
|
||||
size_t node = plan->order[index];
|
||||
for (channel = 0; channel < (right ? 2U : 1U); ++channel) {
|
||||
const float *audio_source = channel ? timeline_right : timeline;
|
||||
const float *midi_source = channel ? instrument_right : instrument;
|
||||
const xtc_node *spec = &plan->nodes[node];
|
||||
float *buffer = plan->buffers + (channel * plan->node_count + node) * plan->max_frames;
|
||||
float peak = 0.0f;
|
||||
|
|
@ -270,7 +271,7 @@ xtc_result xtc_plan_process_stereo(xtc_plan *plan, const float *input, const flo
|
|||
return result;
|
||||
}
|
||||
}
|
||||
if (spec->type == XTC_NODE_PLUGIN) {
|
||||
if (spec->type == XTC_NODE_PLUGIN && !(spec->plugin.format==XTC_PLUGIN_BUILTIN && spec->plugin.index>=5)) {
|
||||
xtc_result result = xtc_plugin_process_at(plan->plugins[channel * plan->node_count + node],
|
||||
spec->plugin.inputs ? buffer : NULL,buffer,frame_count,plan->position);
|
||||
if (result != XTC_OK) {
|
||||
|
|
@ -284,6 +285,12 @@ xtc_result xtc_plan_process_stereo(xtc_plan *plan, const float *input, const flo
|
|||
if (spec->type == XTC_NODE_METER)
|
||||
plan->peaks[node] = channel && plan->peaks[node] > peak ? plan->peaks[node] : peak;
|
||||
}
|
||||
if(plan->nodes[node].type==XTC_NODE_PLUGIN && plan->nodes[node].plugin.format==XTC_PLUGIN_BUILTIN && plan->nodes[node].plugin.index>=5) {
|
||||
float *l=plan->buffers+node*plan->max_frames;
|
||||
float *r=right ? plan->buffers+(plan->node_count+node)*plan->max_frames : NULL;
|
||||
xtc_result result=xtc_plugin_process_stereo_at(plan->plugins[node],l,r ? r : l,l,r,frame_count,plan->position);
|
||||
if(result!=XTC_OK) {memset(output,0,frame_count*sizeof(*output));if(right)memset(right,0,frame_count*sizeof(*right));return result;}
|
||||
}
|
||||
}
|
||||
/* Finish both channels before writing either caller buffer. */
|
||||
for (channel = 0; channel < (right ? 2U : 1U); ++channel) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue