[LAD] Cli sound file player requirements

Filipe Coelho falktx at falktx.com
Mon May 10 18:04:41 CEST 2021


On 10/05/21 16:42, John Murphy wrote:
> I'm convinced Jack transport, using 'carla-bridge-native' and
> controlled by jack_transport CLI tool, is the easiest way to go.
> I'll use Qprocesses initially and work on using the API later.
>
> QJackCtl sources led me to jack_transport_query and QtCreator
> makes it easy to follow the code, so I hope to use that for
> transport time display.
>
> I did get ecasound to play Ok just once. Then tried the same line
> with a '-c' and got over a thousand Xruns before I could hit ^c.
> Tried the line which worked, again, and got similar results to the
> try with '-c'.
>
> Python just doesn't work for me. It used to, but it seems a
> bit of a mess these days, for users at my level, while the
> two versions are in situ. Thanks for the suggestion though.
>
> Qt Creator is probably the most helpful software I've ever used,
> in any field, and I've been using for a long time...


If you are going to write some code for it, maybe best to control the 
whole thing with the JACK API.

Or maybe even better, calling into carla API.
I did a quick test for this just now, this snippet is all you need.

```
#include "CarlaHost.h"
#include <unistd.h>
#ifdef __cplusplus
using namespace CarlaBackend;
#endif
int main()
{
     CarlaHostHandle host = carla_standalone_host_init();
     carla_engine_init(host, "JACK", "AudioPlayback");
     carla_add_plugin(host, BINARY_NATIVE, PLUGIN_INTERNAL, NULL, 
"nyan", "audiofile", 0, NULL, PLUGIN_OPTIONS_NULL);
     carla_set_custom_data(host, 0, CUSTOM_DATA_TYPE_STRING, "file", 
"./nyan.wav");
     for (;;) { carla_engine_idle(host); sleep(1); }
     carla_engine_close(host);
}
```

Build with:

$ gcc playaudio.c $(pkg-config --cflags --libs carla-standalone) -o 
playaudio


API Documentation at 
https://kx.studio/ns/dev-docs/CarlaBackend/group__CarlaHostAPI.html


More information about the Linux-audio-dev mailing list