On 15/10/14 20:17, Paul Davis wrote:


On Wed, Oct 15, 2014 at 2:24 PM, Phil CM <philcm@gnu.org> wrote:
Hello LADs

I'm trying to make a GUI for a LV2 synth based on so-404. In fact, I'm trying to learn C / C++.

I got everything to build OK, but I'm stuck on a hard to read execution error ; when I load the plugin in jalv, it loads it OK, but fails to load the UI and says :

suil error: Unable to open UI library /usr/local/lib/lv2/kis.lv2/kis_gui.so (/usr/local/lib/lv2/kis.lv2/kis_gui.so: undefined symbol: _Z17instantiateSO_404PK15_LV2_DescriptordPKcPKPK12_LV2_Feature)


% echo _Z17instantiateSO_404PK15_LV2_DescriptordPKcPKPK12_LV2_Feature | c++filt
Wow, now that is a nice tool, thanks (a lot) for the tip!
instantiateSO_404(_LV2_Descriptor const*, double, char const*, _LV2_Feature const* const*)
%

your plugin is missing a symbol (instantiateSO_404(...)), apparently.
In my kis.h file, required in my kis.c file, I have this

LV2_Handle instantiateSO_404(const LV2_Descriptor *descriptor,double s_rate, const char *path,const LV2_Feature * const* features);

static LV2_Descriptor kis_Descriptor= {
    .URI="https://bitbucket.org/xaccrocheur/kis",
    .instantiate=instantiateSO_404,
    .connect_port=connectPortSO_404,
    .activate=NULL,
    .run=runSO_404,
    .deactivate=NULL,
    .cleanup=cleanupSO_404,
    .extension_data=NULL,
};

And in the kis.c file is a

LV2_Handle instantiateSO_404(const LV2_Descriptor* descriptor,double s_rate, const char *path,const LV2_Feature * const* features) {
  so_404* so=malloc(sizeof(so_404));
  LV2_URI_Map_Feature *map_feature;
  const LV2_Feature * const *  ft;
  for (ft = features; *ft; ft++) {
    if (!strcmp((*ft)->URI, "http://lv2plug.in/ns/ext/uri-map")) {
      map_feature = (*ft)->data;
      so->midi_event_id = map_feature->uri_to_id(
                                                 map_feature->callback_data,
                                                 "http://lv2plug.in/ns/ext/event",
                                                 "http://lv2plug.in/ns/ext/midi#MidiEvent");
    } else if (!strcmp((*ft)->URI, "http://lv2plug.in/ns/ext/event")) {
      so->event_ref = (*ft)->data;
    }
  }

  puts( "SO-404 v.1.2 by 50m30n3 2009-2011" );

  so->phase = 0.0;
  so->freq = 440.0;
  so->tfreq = 440.0;
  so->amp = 0.0;
  so->env=0.0;
  so->vel=0;
  so->fcutoff = 0.0;
  so->fspeed = 0.0;
  so->fpos = 0.0;
  so->lastsample = 0.0;
  so->noteson = 0;
  so->cdelay = s_rate/100;
  so->samplerate=s_rate;

  so->release = 100;
  so->cutoff = 50;
  so->envmod = 80;
  so->resonance = 100;
  so->volume = 100;
  so->portamento = 64;

  return so;
}

And in the gui file, indeed :

static LV2UI_Descriptor descriptors[] = {
    {KIS_UI_URI, instantiate, cleanup, port_event, extension_data}
};

const LV2UI_Descriptor * lv2ui_descriptor(uint32_t index) {
    printf("lv2ui_descriptor(%u) called\n", (unsigned int)index);
    if (index >= sizeof(descriptors) / sizeof(descriptors[0])) {
        return NULL;
    }
    return descriptors + index;
    // return NULL;
}

How does that work?

Thanks a lot,

--Phil




_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev