Page 1 of 2
Carla API Guide?
Posted: Fri Jul 04, 2014 9:12 am
by noedig
Has anyone used the Carla (the plugin host by falkTX) source as an API to include plugin host capability in their own app?
I'm looking for a quick basic guide to get started. It doesn't make sense spending a lot of time figuring this out from the source when someone has already done it

.
For instance, fluidsynth has a nice guide at
http://fluidsynth.sourceforge.net/api/index.html to get started. A similar one for Carla would be useful (or even just some pointers to get started quickly).
Re: Carla API Guide?
Posted: Fri Jul 04, 2014 7:11 pm
by noedig
Awesome, thanks for the help!
Please bare with me though; we might have to start quite basic.
Is there a Carla source package I need to install, or do I extract the source code and use it from there?
Re: Carla API Guide?
Posted: Sat Jul 05, 2014 7:56 am
by noedig
Building and installing Carla (stable) doesn't produce any .pc files for pkg-config, so
pkg-config --cflags carla-standalone
and
pkg-config --libs carla-standalone
doesn't work.
Re: Carla API Guide?
Posted: Sat Jul 05, 2014 9:23 am
by noedig
Nevermind - I added the KXStudio repositories and installed Carla from there. pkg-config now works.
Re: Carla API Guide?
Posted: Sat Jul 05, 2014 10:49 am
by noedig
Roundup thus far:
The includes are
Code: Select all
#include <carla/CarlaBackend.h>
#include <carla/CarlaEngine.hpp>
#include <carla/CarlaHost.h>
#include <carla/includes/CarlaDefines.h>
#include <carla/CarlaPlugin.hpp>
#include <carla/CarlaNative.h>
I use
to be in the right namespace.
Funny thing: when building, I get a "cannot find rpath=/usr/lib/carla: No such file or directory" error. If I edit the makefile line from
Code: Select all
LIBS = ... -WL,rpath=/usr/lib/carla ...
to
Code: Select all
LIBS = ... -WL,-rpath=/usr/lib/carla ...
(added the dash before rpath)
it stops complaining. Any idea why this is? I use qmake (QtCreator) to build.
Anyway. After a successfull build, should I be hearing the audio file being played back? (Yes I replaced the filename with an existing one on my system and connected the new client to System in QJackCtl.)
Secondly, can you briefly explain the arguments of the carla_add_plugin function? For instance, if I were to load the Hexter DSSI plugin, the arguments would be:
btype: BINARY_NATIVE
ptype: PLUGIN_DSSI
filename: /usr/lib/dssi/hexter.so
name: any string
label: ?
uniqueID: Does this matter?
extraPtr: ?
Re: Carla API Guide?
Posted: Sun Jul 06, 2014 7:32 am
by noedig
I have trouble getting the app to produce sound. It builds ok and runs; jack clients appear and I can assign it to the system audio output and assign midi to its input. However, no audio. Both for the audio file example you provided, as well as for loading other plugins. I can even show the plugin's gui with carla_show_custom_ui. But just no sound.
Is there something else I should initialise in the code?
Re: Carla API Guide?
Posted: Sun Jul 06, 2014 7:55 am
by noedig
Ok I can now produce sound from plugins, by activating them:
(0 being the id of the plugin.)
The internal audio file player still doesn't work though.
Re: Carla API Guide?
Posted: Sun Jul 06, 2014 9:09 am
by noedig
Is there some trick to loading a plugin state? I can save a state using carla_save_plugin_state, but using carla_load_plugin_state on the same file returns false.
Does the api provide a way to have for instance one midi input port and one audio output port, and then route the midi and audio internally between the plugins? i.e. Every plugin does not appear as a client to Jack, only the main application does.
Re: Carla API Guide?
Posted: Sat Aug 09, 2014 8:36 am
by noedig
Big sfz sample packs take a while to load. Is there any way one can get the loading progress from the carla host api when using the native sfz plugin?
How do I set the backend mode (i.e. Rack mode / single client mode / multi client mode)?
The patchbay port connect function takes groupID and portID. What are these? Also, is there a way to get port names for a given plugin?
Re: Carla API Guide?
Posted: Wed Aug 13, 2014 7:52 pm
by noedig
Does the way the Carla backend uses Fluidsynth prevent one from implementing it elsewhere in the same program?
I use the Fluidsynth library in an app. However, when building with the appropriate libraries in order to also use Carla, I get the message
Code: Select all
fluidsynth: error: Couldn't find the requested audio driver jack. Valid drivers are: .
on standard output when running, and no Fluidsynth clients are registered in Jack. When removing the Carla libraries from my build, Fluidsynth works fine again.
Any thoughts?
Re: Carla API Guide?
Posted: Thu Oct 30, 2014 6:13 pm
by noedig
falkTX,
What exactly does the carla_engine_idle() function do and how important is it to call it often? I just realized that I kind of forgot to ever call it, and everything seems to be working fine.