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
|
|
@ -758,6 +758,13 @@ int main(int argc, char **argv)
|
|||
CHECK(window.undo()==XTC_OK && window.undo(true)==XTC_OK);unlink("/tmp/xtc-sampler-gui.xtc");
|
||||
size_t added=SIZE_MAX;CHECK(window.add_plugin(XTC_BUILTIN_PATH,effect,&added)==XTC_OK);
|
||||
CHECK(added!=id);CHECK(window.undo()==XTC_OK);
|
||||
unsigned int stereo=instrument+5;
|
||||
CHECK(window.add_plugin(XTC_BUILTIN_PATH,stereo,&added)==XTC_OK);
|
||||
CHECK(window.set_plugin_control(added,stereo==5 ? 3U : 4U,1)==XTC_OK);
|
||||
CHECK(window.save_project("/tmp/xtc-stereo-gui.xtc")==XTC_OK);
|
||||
CHECK(window.new_project()==XTC_OK && window.open_project("/tmp/xtc-stereo-gui.xtc")==XTC_OK);
|
||||
CHECK(xtc_graph_get_plugin(xtc_project_graph(sequence->project()),added,&spec)==XTC_OK && spec.index==stereo);
|
||||
unlink("/tmp/xtc-stereo-gui.xtc");
|
||||
const xtc_project *before=sequence->project();reserve_result=XTC_ERR_OUT_OF_MEMORY;
|
||||
CHECK(window.add_plugin(XTC_BUILTIN_PATH,effect)==XTC_ERR_OUT_OF_MEMORY && sequence->project()==before);
|
||||
reserve_result=XTC_OK;unlink("/tmp/xtc-internal-gui.xtc");window.do_callback();
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ static void history_reservations(void)
|
|||
static void builtin_failures(void)
|
||||
{
|
||||
unsigned int id;
|
||||
for(id=0;id<5;++id) {
|
||||
for(id=0;id<7;++id) {
|
||||
int failure, succeeded=0; xtc_plugin_spec spec;
|
||||
assert(xtc_plugin_probe(XTC_BUILTIN_PATH,id,48000,&spec)==XTC_OK);
|
||||
if(id==4) {assert(getcwd(spec.sample_path,sizeof(spec.sample_path)));strcat(spec.sample_path,"/examples/projects/original-pluck.wav");}
|
||||
|
|
@ -168,7 +168,8 @@ static void builtin_failures(void)
|
|||
processing=1;
|
||||
if(spec.instrument) {xtc_midi_event event={0,XTC_MIDI_NOTE_ON,0,60,100};
|
||||
assert(xtc_plugin_process_midi(plugin,&event,1,out,256)==XTC_OK);
|
||||
} else assert(xtc_plugin_process(plugin,in,out,256)==XTC_OK);
|
||||
} else if(id>=5) {float right[256];assert(xtc_plugin_process_stereo_at(plugin,in,in,out,right,256,0)==XTC_OK);}
|
||||
else assert(xtc_plugin_process(plugin,in,out,256)==XTC_OK);
|
||||
processing=0;xtc_plugin_destroy(plugin);succeeded=1;break;
|
||||
}
|
||||
assert(succeeded);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
#include "xtc/xtc_plugin.h"
|
||||
#include "xtc/xtc_dsp.h"
|
||||
#include "../../src/audio/wave_internal.h"
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -221,7 +222,51 @@ static void sampler(void)
|
|||
for(i=0;i<256;++i)assert(x[i]==0);
|
||||
xtc_plugin_destroy(a);unlink(preset);
|
||||
}
|
||||
static void stereo_effect(unsigned int id)
|
||||
{
|
||||
xtc_plugin_spec s;xtc_plugin *a=NULL,*b=NULL;float in[256]={0},zero[256]={0},l[256],r[256],x[256],y[256];
|
||||
size_t i,k;double left_energy=0,right_energy=0;
|
||||
assert(xtc_plugin_probe(XTC_BUILTIN_PATH,id,48000,&s)==XTC_OK);
|
||||
s.values[2]=1;
|
||||
s.point_count=2;s.points[0]=(xtc_plugin_point){0,0,1,id==5 ? 10 : .5f};
|
||||
s.points[1]=(xtc_plugin_point){960,0,1,id==5 ? 40 : .95f};
|
||||
if(id==5)s.values[1]=.9f;else {s.values[3]=1;s.values[4]=1;}
|
||||
assert(xtc_plugin_create(&s,48000,256,&a)==XTC_OK && xtc_plugin_create(&s,48000,256,&b)==XTC_OK);
|
||||
for(k=0;k<1200;++k) {
|
||||
in[0]=k==0 ? 1 : 0;
|
||||
assert(xtc_plugin_process_stereo_at(a,in,zero,l,r,256,k*256)==XTC_OK);
|
||||
assert(xtc_plugin_process_stereo_at(b,in,zero,x,y,128,k*256)==XTC_OK);
|
||||
assert(xtc_plugin_process_stereo_at(b,in+128,zero+128,x+128,y+128,128,k*256+128)==XTC_OK);
|
||||
assert(!memcmp(l,x,sizeof(l)) && !memcmp(r,y,sizeof(r)));
|
||||
for(i=0;i<256;++i){assert(isfinite(l[i]) && isfinite(r[i]) && fabsf(l[i])<=1 && fabsf(r[i])<=1);left_energy+=fabs(l[i]);right_energy+=fabs(r[i]);}
|
||||
}
|
||||
assert(left_energy>0 && right_energy>0);xtc_plugin_destroy(a);xtc_plugin_destroy(b);
|
||||
{
|
||||
xtc_graph *graph=NULL;xtc_plan *plan=NULL;size_t source,node,output;
|
||||
assert(xtc_graph_create(3,&graph)==XTC_OK);
|
||||
assert(xtc_graph_add_audio(graph,&source)==XTC_OK && xtc_graph_add_plugin(graph,&s,&node)==XTC_OK && xtc_graph_add_output(graph,&output)==XTC_OK);
|
||||
assert(xtc_graph_connect(graph,source,node)==XTC_OK && xtc_graph_connect(graph,node,output)==XTC_OK);
|
||||
assert(xtc_graph_compile(graph,48000,256,&plan)==XTC_OK);
|
||||
assert(xtc_plugin_create(&s,48000,256,&a)==XTC_OK);
|
||||
for(k=0;k<200;++k) {
|
||||
in[0]=k==0 ? 1 : 0;
|
||||
assert(xtc_plan_process_stereo(plan,NULL,in,zero,NULL,NULL,l,r,256)==XTC_OK);
|
||||
assert(xtc_plugin_process_stereo_at(a,in,zero,x,y,256,k*256)==XTC_OK);
|
||||
for(i=0;i<256;++i)assert(l[i]==xtc_dsp_finite(x[i]) && r[i]==xtc_dsp_finite(y[i]));
|
||||
}
|
||||
xtc_plugin_destroy(a);xtc_plan_destroy(plan);xtc_graph_destroy(graph);
|
||||
}
|
||||
if(id==5) {
|
||||
s.point_count=0;s.values[3]=1;s.values[1]=0;s.tempo=120000;
|
||||
assert(xtc_plugin_create(&s,48000,256,&a)==XTC_OK);
|
||||
for(k=0;k<100;++k) {
|
||||
in[0]=k==0 ? 1 : 0;
|
||||
assert(xtc_plugin_process_stereo_at(a,in,zero,l,r,256,k*256)==XTC_OK);
|
||||
for(i=0;i<256;++i)assert(l[i]==(k*256+i==24000 ? 1 : 0));
|
||||
}xtc_plugin_destroy(a);
|
||||
}
|
||||
}
|
||||
int main(void) {
|
||||
sampler();editable();transport(0);transport(1);automation();roundtrip(0,2);roundtrip(1,3);effects(2);effects(3);synth(0);synth(1);
|
||||
stereo_effect(5);stereo_effect(6);sampler();editable();transport(0);transport(1);automation();roundtrip(0,2);roundtrip(1,3);effects(2);effects(3);synth(0);synth(1);
|
||||
synth_partition(0);synth_partition(1);puts("Built-in devices passed.");return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue