Re: [Vala] LADSPA bindings



What I've done:

[Compact, CCode (cname = "void")]
    public class Handle {
      // ...
    }

    [CCode (has_target = false)]
    public delegate void DescriptorConnectPort(Handle? instance, ulong
port, ref double dataLocation);

    [CCode (copy_function="", destroy_function="")]
    public struct Descriptor
    {
        [CCode (cname = "UniqueID")]
        public ulong unique_id;
        [CCode (cname = "Label")]
        public unowned string label;
        [CCode (cname = "Properties")]
        public Properties properties;
        [CCode (cname = "Name")]
        public unowned string name;
        [CCode (cname = "Maker")]
        public unowned string maker;
        [CCode (cname = "Copyright")]
        public unowned string copyright;
        [CCode (cname = "PortCount")]
        public ulong port_count;
        [CCode (cname = "PortDescriptors")]
        public const PortDescriptor[] port_descriptors;
        [CCode (cname = "PortNames")]
        public unowned string[] port_names;
        [CCode (cname = "PortRangeHints")]
        public const PortRangeHint[] port_range_hints;
        [CCode (cname = "ImplementationData")]
        public void[] implementation_data;

        public Handle? instantiate(Handle? descriptor, ulong sampleRate);

        public DescriptorConnectPort? connect_port;

        public void activate(Handle? instance);

        public void run(Handle? instance, ulong sampleCount);

        public void run_adding(Handle? instance, ulong sampleCount);

        public void set_run_adding_gain(Handle? instance, Data gain);

        public void deactivate(Handle? instance);

        public void cleanup(Handle? instance);
    }

but...

src/CompressorBackend.c: In function ‘ajami_compressor_backend_connect’:
src/CompressorBackend.c:674:2: error: unknown type name
‘LADSPA_DescriptorConnectPort’
  LADSPA_DescriptorConnectPort _tmp2_ = NULL;
src/CompressorBackend.c:745:2: error: called object ‘_tmp2_’ is not a
function or function pointer
  _tmp2_ (_tmp4_, (gulong) AJAMI_COMPRESSOR_FLAGS_RMS_PEAK, &(*s).rms_peak);

2016-09-11 14:27 GMT-03:00 Al Thomas <astavale yahoo co uk>:




----- Original Message -----
From: Victor Aurélio Santos <victoraur santos gmail com>
Sent: Sunday, 11 September 2016, 17:08
Subject: Re: [Vala] LADSPA bindings

The valac complaints:

LADSPA.vapi:52.9-52.41: error: unexpected declaration
       public delegate void connect_port(Descriptor* instance, ulong
port, double* dataLocation);


A delegate is a type, it identifies the function signature of the callback.
So the delegate should be defined outside of the struct. Then in the struct
you identify the callback with its type (the delegate name you've used) and
the identifier for the callback. I hope that gets you a step further forward.
Handling APIs in structs is something that I don't fully understand yet.



-- 
Victor Aurélio Santos


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]