feat(plugins): qualify host VST3 chains and refresh the DAW gallery (phase 89)
This commit is contained in:
parent
a3858b1c82
commit
26ace28bb5
73 changed files with 344 additions and 18 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include "xtc/xtc_plugin.h"
|
||||
#include "xtc/xtc_editing.h"
|
||||
#include "xtc/xtc_audio.h"
|
||||
#include "xtc/xtc_sample.h"
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -47,9 +48,36 @@ static void rendering(void)
|
|||
for(size_t j=0;j<32;++j)assert(fabsf(out[j]-(j<8 ? 0.f : .05f*sinf(6.28318530718f*440.f*(float)(j-8)/8000.f)))<.00001f);
|
||||
xtc_midi_plan_destroy(midi);xtc_project_destroy(p);unlink(wave);
|
||||
}
|
||||
static void host_vst3(void)
|
||||
{
|
||||
xtc_project *p=NULL;xtc_track_chain c={0};xtc_midi_plan *plan=NULL;uint64_t t,clip,note;float out[256];double energy=0;
|
||||
if(!getenv("XTC_TEST_HOST_VST3"))return;
|
||||
assert(xtc_project_create(&p)==XTC_OK && xtc_project_add_track(p,"Host VST3",&t)==XTC_OK && xtc_project_add_midi_clip(p,t,0,960,&clip)==XTC_OK && xtc_project_add_note(p,clip,0,960,69,100,0,¬e)==XTC_OK);
|
||||
const char *names[]={"ZamEQ2","ZamAutoSat","ZamDelay"};c.count=3;c.output_gain=1;
|
||||
for(size_t i=0;i<3;++i) {
|
||||
char binary[512];snprintf(binary,sizeof(binary),"/usr/lib/vst3/%s.vst3/Contents/x86_64-linux/%s.so",names[i],names[i]);
|
||||
assert(xtc_plugin_probe_format(XTC_PLUGIN_VST3,binary,0,48000,&c.slots[i].plugin)==XTC_OK);
|
||||
c.slots[i].enabled=1;c.slots[i].wet=1;printf("Host VST3 loaded: %s (%s)\n",c.slots[i].plugin.label,c.slots[i].plugin.identifier);
|
||||
}
|
||||
assert(xtc_project_set_chain(p,t,&c)==XTC_OK && xtc_midi_plan_create(p,48000,&plan)==XTC_OK);
|
||||
for(size_t block=0;block<32;++block) {
|
||||
assert(xtc_midi_plan_render(plan,block*256,NULL,0,out,256)==XTC_OK);
|
||||
for(size_t i=0;i<256;++i){assert(isfinite(out[i]));energy+=out[i]*out[i];}
|
||||
}
|
||||
assert(energy>0);xtc_midi_plan_destroy(plan);
|
||||
{char wave[]="/tmp/xtc-vst3-export-XXXXXX";int fd=mkstemp(wave),done=0;xtc_export *job=NULL;xtc_sample *sample=NULL;xtc_sample_stats stats;size_t frames;unsigned int rate;
|
||||
assert(fd>=0);close(fd);unlink(wave);
|
||||
assert(xtc_export_create(p,wave,48000,100,&job)==XTC_OK);
|
||||
while(!done)assert(xtc_export_step(job,&done)==XTC_OK);
|
||||
xtc_export_destroy(job);
|
||||
assert(xtc_sample_load(wave,&sample)==XTC_OK && xtc_sample_info(sample,&rate,&frames)==XTC_OK && rate==48000 && frames>0);
|
||||
assert(xtc_sample_analyze(sample,0,frames,&stats)==XTC_OK && stats.rms>0);
|
||||
xtc_sample_destroy(sample);unlink(wave);}
|
||||
xtc_project_destroy(p);
|
||||
}
|
||||
int main(void)
|
||||
{
|
||||
rendering();
|
||||
rendering();host_vst3();
|
||||
xtc_project *p=NULL,*q=NULL;uint64_t a,b,duplicate;xtc_track_chain c={0},got={0};
|
||||
char file[]="/tmp/xtc-chain-XXXXXX";int fd=mkstemp(file);assert(fd>=0);close(fd);
|
||||
assert(xtc_project_create(&p)==XTC_OK && xtc_project_add_track(p,"Audio",&a)==XTC_OK && xtc_project_add_track(p,"Other",&b)==XTC_OK);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue