Re: [Vala] LADSPA bindings
- From: Victor Aurélio Santos <victoraur santos gmail com>
- To: Aaron Andersen <aaron fosslib net>
- Cc: vala-list gnome org
- Subject: Re: [Vala] LADSPA bindings
- Date: Thu, 15 Sep 2016 11:06:41 -0300
Thank you very much, Aaron
There's only a thing to change, in the connect_port delegate
DataLocation is a pointer to a float not a float, but changing to
"Data?" solved.
2016-09-13 14:19 GMT-03:00 Aaron Andersen <aaron fosslib net>:
Hello Victor,
You have chosen one of the more difficult C libraries to bind to Vala. The
way this library is setup so contrary to the GObject way of doing things it
is certainly an edge case.
Unfortunately this library requires a small C header "helper" file to
accompany your vapi. The main reason for this is that Vala doesn't deal with
unnamed function pointers.
I've gone ahead and created ladspa.vapi, ladspa-vala.h (a C header "helper"
file to make Vala work with the ladspa library), and main.vala (a test
program I used to ensure the vapi was correct).
main.vala - http://pastebin.com/VF9AXrLY
ladspa.vapi - http://pastebin.com/WeaKPHnc
ladspa-vala.h - http://pastebin.com/GB4kPzw1
I placed all of these 3 files into a single directory and then ran this
command to compile:
valac --pkg ladspa --vapidir . main.vala --save-temps -X -L/usr/lib/ladspa/
-X -l:amp.so -X -I.
and this command to run the program:
LD_LIBRARY_PATH=/usr/lib/ladspa/ ./main
From reading the documentation I understand that the ladspa framework
intends for the user to dynamically load plugins via dlopen but I hope you
get the idea from the example.
Please don't hesitate to ask any questions about this code.
Thank you,
Aaron
Quoting Al Thomas <astavale yahoo co uk>:
----- Original Message -----
From: Victor Aurélio Santos <victoraur santos gmail com>
Sent: Tuesday, 13 September 2016, 15:55
Subject: Re: [Vala] LADSPA bindings
Now...
[CCode (cname = "connect_port", has_target = false)]
public delegate void DescriptorConnectPort(Handle? instance, ulong
port, ref double dataLocation);
results in:
src/CompressorBackend.c: In function ‘ajami_compressor_backend_connect’:
src/CompressorBackend.c:674:2: error: unknown type name ‘connect_port’
connect_port _tmp2_ = NULL;
I presume there's no typedef for it then. Instead try:
[CCode (lower_case_cprefix = "", has_target = false)]
public delegate void ConnectPort(Handle? instance, ulong
port, ref double dataLocation);
The lower_case_cprefix should remove the default namespace prefix
and then ConnectPort will be converted to connect_port in C.
That's my interpretation of the last paragraph of:
https://wiki.gnome.org/Projects/Vala/LegacyBindings#Delegates
If that doesn't work, I'm not sure what else to suggest. The paragraph
could
mean include an empty cname, e.g.
[CCode (cname = "", has_target = false)]
public delegate void DescriptorConnectPort(Handle? instance, ulong
port, ref double dataLocation);
Use the --ccode switch with valac to get the C code produced. Look at the
code and tweak it until it works then work back to the VAPI. You can use
valac to compile C. Just use valac --pkg xyz my_c_file.c
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list
--
Victor Aurélio Santos
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]