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
instantiateSO_404(_LV2_Descriptor const*, double, char const*, _LV2_Feature const* const*)
%

your plugin is missing a symbol (instantiateSO_404(...)), apparently.
The problem seems to be different implementations of instantiate().

In Harry's example, the methods that (AFAIU) LV2 expects :
Are declared explicitely, using static.

Like this :

static LV2_Handle
instantiate(const LV2_Descriptor*     descriptor,
            double                    rate,
            const char*               bundle_path,
            const LV2_Feature* const* features)
{
  SinSynth* self = (SinSynth*)malloc(sizeof(SinSynth));

  // store the sample rate in "self" so we can retrieve it in run()
  self->sample_rate = rate;

  // initialize the phase so we start at the beginning of the wave
  self->phase = 0.f;

  return self;
}

void
connect_port(LV2_Handle instance,
             uint32_t   port,
             void*      data)
{
  SinSynth* self=(SinSynth*)instance;

  switch (port) {
  case AMP_FREQ:
    self->freq = (float*)data;
    break;
  case AMP_MIDI:
    self->MidiIn = data;
    break;
  case AMP_OUTPUT:
    self->output = (float*)data;
    break;
  }
}

static void
activate(LV2_Handle instance)
{
}

(...)

Whereas in so-404, they are somehow "surcharged", like this :

void runSO_404( LV2_Handle arg, uint32_t nframes );
LV2_Handle instantiateSO_404(const LV2_Descriptor *descriptor,double s_rate, const char *path,const LV2_Feature * const* features);
void cleanupSO_404(LV2_Handle instance);
void connectPortSO_404(LV2_Handle instance, uint32_t port, void *data_location);

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,
};

So apparently instead of being declared thusly:

LV2_Handle
instantiateSO_404(const LV2_Descriptor* descriptor,
                  double s_rate,
                  const char *path,
                  const LV2_Feature * const* features)
{...}

Either my instantiate method return value should be static, or my "mandatory" methods should be declared explicitely. I tried to adapt them, but failed so far.
Please excuse my sub-newbie mistakes.


--Phil






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