I'm building a frontend for a LAME encoder in order to do a proof-of-concept in Gtk/Vala.
I've installed libmp3lame-dev and would like to simply encode a WAV file using a few given encoding parameters and graphically display the progress using a Gtk progress bar.
I can definitely figure out how to do that, but I'm not sure how to import libmp3lame into my Vala files and interface with the library.
Yes, but you need to use a VAPI to explain how to bind the C library to Vala. The easy way to do this is using GObject Introspection to generate the bindings automatically, but since LAME doesn't use GObject the only option is to write them by hand. There is some documentation of the process, and it tends to be much easier than writing wrappers for dealing with C in other languages, but it can still be somewhat intimidating for beginners—you should consider dropping by the #vala channel on GIMPnet to get help as you're developing the bindings.
That said, Vala includes bindings for GStreamer, which does include an element for using LAME. Were I in your shoes I would carefully consider using it before creating bindings for libmp3lame.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With