feat(plugins): qualify host VST3 chains and refresh the DAW gallery (phase 89)

This commit is contained in:
Johannes Findeisen 2026-11-06 01:50:25 +01:00
commit 26ace28bb5
73 changed files with 344 additions and 18 deletions

View file

@ -29,7 +29,7 @@ const char *node_name(xtc_node_type type)
case XTC_NODE_METER:
return "Meter";
case XTC_NODE_PLUGIN:
return "LADSPA plugin";
return "Effect plugin";
case XTC_NODE_NATIVE:
return "Native processor";
case XTC_NODE_INSTRUMENT:
@ -394,7 +394,10 @@ void GraphWidget::draw()
fl_color(FL_WHITE);
fl_font(FL_HELVETICA_BOLD, 12);
char text[96];
std::snprintf(text, sizeof(text), "%s #%zu", node_name(node.type), node.id);
xtc_plugin_spec title_plugin{};
if(node.type==XTC_NODE_PLUGIN && xtc_graph_get_plugin(graph_,node.id,&title_plugin)==XTC_OK)
std::snprintf(text,sizeof(text),"%s effect #%zu",xtc_plugin_format_name(title_plugin.format),node.id);
else std::snprintf(text, sizeof(text), "%s #%zu", node_name(node.type), node.id);
fl_push_clip(left+6, top+2, node_width-12, 40);
fl_draw(text, left + 10, top + 20);
fl_font(FL_HELVETICA, 12);

View file

@ -10,6 +10,7 @@
#include <FL/Fl_Hold_Browser.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Value_Input.H>
#include <FL/Fl_Scroll.H>
#include <cstring>
#include <algorithm>
#include <cmath>
@ -20,10 +21,12 @@ class TrackInsertsPanel : public Fl_Group {
Fl_Box *message_;
Fl_Value_Input *wet_,*gain_;
GraphWidget *graph_;
Fl_Scroll *scroll_;
xtc_graph *model_=nullptr;
uint64_t track_=UINT64_MAX;
xtc_track_chain cached_{};
std::vector<uint64_t> ids_;
std::vector<std::string> names_;
void result(xtc_result r) { if(r!=XTC_OK)owner_->report_error("Track inserts",r);refresh(true); }
public:
TrackInsertsPanel(int x,int y,int w,int h,MainWindow *owner):Fl_Group(x,y,w,h,"Track inserts"),owner_(owner) {
@ -48,8 +51,9 @@ class TrackInsertsPanel : public Fl_Group {
for(auto *input:{wet_,gain_})input->callback([](Fl_Widget *,void *c){auto *p=static_cast<TrackInsertsPanel *>(c);p->result(p->set_mix(p->wet_->value(),p->gain_->value()));},this);
message_=new Fl_Box(x+16,y+84,w-32,30,"Track input > inserts > output gain > track fader > bus/master");message_->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
slots_=new Fl_Hold_Browser(x+16,y+126,230,h-142);slots_->format_char(0);slots_->callback([](Fl_Widget *,void *c){static_cast<TrackInsertsPanel *>(c)->update_mix();},this);
graph_=new GraphWidget(x+260,y+126,w-276,h-142,nullptr,[](void *,const xtc_graph_edit &,size_t *){return XTC_ERR_UNSUPPORTED;},nullptr,message_);
resizable(graph_);end();
scroll_=new Fl_Scroll(x+260,y+126,w-276,h-142);
graph_=new GraphWidget(x+260,y+126,2000,4000,nullptr,[](void *,const xtc_graph_edit &,size_t *){return XTC_ERR_UNSUPPORTED;},nullptr,message_);
scroll_->end();resizable(scroll_);end();
}
~TrackInsertsPanel() override { graph_->set_graph(nullptr);xtc_graph_destroy(model_); }
uint64_t selected_track() const {return track_;}
@ -112,8 +116,8 @@ class TrackInsertsPanel : public Fl_Group {
const xtc_project *project=owner_->project_.get();size_t count=0,clips=0;xtc_project_get_counts(project,&count,&clips);
std::vector<uint64_t> ids;std::vector<std::string> names;
for(size_t i=0;i<count;++i){xtc_track_info t{};xtc_project_get_track(project,i,&t);if(!t.is_bus){ids.push_back(t.id);names.emplace_back(t.name);}}
bool rebuild=ids!=ids_ || force;
if(rebuild){ids_=ids;tracks_->clear();for(const auto &name:names) {tracks_->add("track");tracks_->replace(tracks_->size()-2,name.c_str());}}
bool rebuild=ids!=ids_ || names!=names_ || force;
if(rebuild){ids_=ids;names_=names;tracks_->clear();for(const auto &name:names) {tracks_->add("track");tracks_->replace(tracks_->size()-2,name.c_str());}}
if(std::find(ids_.begin(),ids_.end(),track_)==ids_.end())track_=ids_.empty() ? UINT64_MAX : ids_[0];
for(size_t i=0;i<ids_.size();++i)if(ids_[i]==track_)tracks_->value(static_cast<int>(i));
xtc_track_chain chain{};chain.output_gain=1;
@ -123,7 +127,14 @@ class TrackInsertsPanel : public Fl_Group {
for(size_t i=0;i<chain.count;++i){std::string label=std::to_string(i+1)+" "+chain.slots[i].plugin.label+(chain.slots[i].enabled ? "" : " [bypass]");slots_->add(label.c_str());}
if(chain.count)slots_->select(selected>0 && static_cast<size_t>(selected)<=chain.count ? selected : 1);
xtc_graph *next=nullptr;auto r=xtc_track_chain_graph(&chain,&next);
if(r==XTC_OK){graph_->set_graph(next);xtc_graph_destroy(model_);model_=next;graph_->auto_layout();}
if(r==XTC_OK){graph_->set_graph(next);xtc_graph_destroy(model_);model_=next;graph_->auto_layout();
size_t nodes=0,edges=0,max_level=0,max_row=0;std::array<size_t,256> rows{};
xtc_graph_get_counts(model_,&nodes,&edges);
for(size_t i=0;i<nodes;++i){xtc_node_info node{};xtc_routing_info route{};xtc_graph_get_node(model_,i,&node);if(graph_->routing(node.id,route))max_level=std::max(max_level,route.level);}
graph_->size(std::max(scroll_->w()-20,static_cast<int>(max_level+1)*174+40),4000);
for(size_t i=0;i<nodes;++i){xtc_node_info node{};xtc_routing_info route{};xtc_graph_get_node(model_,i,&node);if(graph_->routing(node.id,route) && route.level<rows.size()) {size_t row=rows[route.level]++;max_row=std::max(max_row,row);graph_->move_node(node.id,20+static_cast<int>(route.level)*174,24+static_cast<int>(row)*104);}}
graph_->size(graph_->w(),std::max(scroll_->h()-20,static_cast<int>(max_row+1)*104+48));scroll_->scroll_to(0,0);
message_->copy_label("Track input > inserts > output gain > track fader > bus/master. Scroll to inspect long chains.");}
update_mix();redraw();
}
};

View file

@ -78,6 +78,19 @@ static int inspect(const xtc_project *project, uint64_t version)
}
}
}
for(i=0;i<tracks;++i) {
xtc_track_info track;xtc_track_chain chain;size_t slot;
xtc_project_get_track(project,i,&track);xtc_project_get_chain(project,track.id,&chain);
if(!chain.count)continue;
printf("Track %" PRIu64 " insert chain: %zu slots, output gain %.6g\n",track.id,chain.count,(double)chain.output_gain);
for(slot=0;slot<chain.count;++slot) {
const xtc_track_insert *insert=chain.slots+slot;const xtc_plugin_spec *spec=&insert->plugin;
int available=spec->format==XTC_PLUGIN_BUILTIN || readable_file(spec->path);
printf("%s insert track %" PRIu64 " slot %zu %s wet %.6g ",xtc_plugin_format_name(spec->format),track.id,slot+1,insert->enabled ? "enabled" : "bypassed",(double)insert->wet);
quoted(spec->label);printf(" %s: ",available ? "available" : "MISSING");quoted(spec->path);putchar('\n');
if(!available)++missing;
}
}
printf("Dependency references missing/unreadable: %zu.\n",missing);
puts("File availability only: WAV contents, plugin identity/initialization, JACK and hardware not checked; no plugin code executed.");
return missing ? 2 : EXIT_SUCCESS;

View file

@ -26,6 +26,17 @@ typedef struct module {
static module *modules;
typedef union { clap_event_header_t header; clap_event_note_t note; clap_event_midi_t midi; } clap_note;
typedef struct { Steinberg_Vst_IEventList api; struct xtc_modern *owner; } vst_events;
/* Bounded output-notification sink. Keep the final point per parameter/block;
* this host has no parameter automation recorder or native editor consumer. */
#define VST_OUTPUT_PARAMETERS 64U
typedef struct {
Steinberg_Vst_IParamValueQueue api;Steinberg_Vst_ParamID id;
Steinberg_int32 offset;Steinberg_Vst_ParamValue value;int present;
} vst_parameter_queue;
typedef struct {
Steinberg_Vst_IParameterChanges api;size_t count;
vst_parameter_queue queues[VST_OUTPUT_PARAMETERS];
} vst_parameter_changes;
struct xtc_modern {
module *module;
xtc_plugin_format format;
@ -48,6 +59,7 @@ struct xtc_modern {
size_t vst_count;
unsigned char keys[16][128];
vst_events event_list;
vst_parameter_changes parameters;
unsigned int callback, restart;
struct xtc_modern *next;
};
@ -208,6 +220,51 @@ static Steinberg_tresult host_query(void *self, const Steinberg_TUID iid, void *
return Steinberg_kNoInterface;
}
static Steinberg_uint32 host_ref(void *self) { (void)self; return 1; }
static Steinberg_tresult parameter_query(void *self,const Steinberg_TUID iid,void **out)
{
if(!iid || !out)return Steinberg_kInvalidArgument;
*out=NULL;
if(!memcmp(iid,Steinberg_Vst_IParameterChanges_iid,16) || !memcmp(iid,Steinberg_FUnknown_iid,16)){*out=self;return 0;}
return Steinberg_kNoInterface;
}
static Steinberg_tresult queue_query(void *self,const Steinberg_TUID iid,void **out)
{
if(!iid || !out)return Steinberg_kInvalidArgument;
*out=NULL;
if(!memcmp(iid,Steinberg_Vst_IParamValueQueue_iid,16) || !memcmp(iid,Steinberg_FUnknown_iid,16)){*out=self;return 0;}
return Steinberg_kNoInterface;
}
static Steinberg_Vst_ParamID queue_id(void *self){return ((vst_parameter_queue *)self)->id;}
static Steinberg_int32 queue_count(void *self){return ((vst_parameter_queue *)self)->present;}
static Steinberg_tresult queue_get(void *self,Steinberg_int32 index,Steinberg_int32 *offset,Steinberg_Vst_ParamValue *value)
{
vst_parameter_queue *q=self;
if(index || !q->present || !offset || !value)return Steinberg_kInvalidArgument;
*offset=q->offset;*value=q->value;return 0;
}
static Steinberg_tresult queue_add(void *self,Steinberg_int32 offset,Steinberg_Vst_ParamValue value,Steinberg_int32 *index)
{
vst_parameter_queue *q=self;
if(!index || offset<0 || !isfinite(value) || value<0 || value>1)return Steinberg_kInvalidArgument;
q->offset=offset;q->value=value;q->present=1;*index=0;return 0;
}
static Steinberg_Vst_IParamValueQueueVtbl parameter_queue_vtable={queue_query,host_ref,host_ref,queue_id,queue_count,queue_get,queue_add};
static Steinberg_int32 parameter_count(void *self){return (Steinberg_int32)((vst_parameter_changes *)self)->count;}
static Steinberg_Vst_IParamValueQueue *parameter_get(void *self,Steinberg_int32 index)
{
vst_parameter_changes *c=self;
return index<0 || (size_t)index>=c->count ? NULL : &c->queues[index].api;
}
static Steinberg_Vst_IParamValueQueue *parameter_add(void *self,const Steinberg_Vst_ParamID *id,Steinberg_int32 *index)
{
vst_parameter_changes *c=self;size_t i;
if(!id || !index)return NULL;
for(i=0;i<c->count;++i)if(c->queues[i].id==*id)break;
if(i==VST_OUTPUT_PARAMETERS)return NULL;
if(i==c->count){++c->count;c->queues[i].api.lpVtbl=&parameter_queue_vtable;c->queues[i].id=*id;c->queues[i].present=0;}
*index=(Steinberg_int32)i;return &c->queues[i].api;
}
static Steinberg_Vst_IParameterChangesVtbl parameter_changes_vtable={parameter_query,host_ref,host_ref,parameter_count,parameter_get,parameter_add};
static Steinberg_tresult host_name(void *self, Steinberg_Vst_String128 name)
{ (void)self; if (!name) return Steinberg_kInvalidArgument; memset(name,0,sizeof(Steinberg_Vst_String128)); name[0] = 'x'; name[1] = 't'; name[2] = 'c'; return 0; }
static Steinberg_tresult host_create(void *self, Steinberg_TUID cid, Steinberg_TUID iid, void **out)
@ -343,6 +400,8 @@ xtc_result xtc_modern_process(xtc_modern *p, const float *input, float *output,
in.Steinberg_Vst_AudioBusBuffers_channelBuffers32 = &p->input;
out.Steinberg_Vst_AudioBusBuffers_channelBuffers32 = &p->output;
data.numSamples = (Steinberg_int32)frames; data.numInputs = p->instrument ? 0 : 1; data.numOutputs = 1; data.inputs = p->instrument ? NULL : &in; data.outputs = &out;
p->parameters.api.lpVtbl=&parameter_changes_vtable;p->parameters.count=0;
data.outputParameterChanges=&p->parameters.api;
if (p->instrument) data.inputEvents = &p->event_list.api;
ok = p->processor->lpVtbl->process(p->processor,&data) == 0;
}