Files
jack-looper/carla.h
Loic Coenen 8341261d7a fix: add missing carla.h header and implementation files
Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
2026-05-02 21:35:46 +00:00

84 lines
2.3 KiB
C

#ifndef CARLA_H
#define CARLA_H
#include <stdint.h>
#include <stdbool.h>
#include <jack/jack.h>
// Carla plugin types we support
typedef enum {
PLUGIN_TYPE_NONE,
PLUGIN_TYPE_LV2,
PLUGIN_TYPE_VST2,
PLUGIN_TYPE_VST3,
PLUGIN_TYPE_CLAP,
PLUGIN_TYPE_INTERNAL // Our built-in plugins (gain, etc.)
} PluginType;
// Plugin descriptor
typedef struct {
char name[256];
char uri[512];
PluginType type;
int carla_plugin_id; // Carla's internal plugin ID
int num_parameters;
float *parameters; // Current parameter values
char **parameter_names;
} PluginInfo;
// Rack for a single channel
typedef struct {
int num_plugins;
PluginInfo plugins[16]; // Max 16 plugins per channel
float volume; // Channel volume (0.0 - 2.0)
bool bypassed;
} ChannelRack;
// Carla host state
typedef struct {
bool initialized;
ChannelRack channel_racks[8]; // One rack per channel (MAX_CHANNELS)
jack_client_t *client;
// For plugin scanning
char **available_plugins;
int num_available_plugins;
} CarlaHost;
// Initialize Carla host
int carla_init(CarlaHost *host, jack_client_t *client);
// Cleanup Carla host
void carla_cleanup(CarlaHost *host);
// Add a plugin to a channel's rack
int carla_add_plugin(CarlaHost *host, int channel, const char *uri, PluginType type);
// Remove a plugin from a channel's rack
int carla_remove_plugin(CarlaHost *host, int channel, int plugin_index);
// Set plugin parameter
int carla_set_parameter(CarlaHost *host, int channel, int plugin_index, int param_index, float value);
// Get plugin parameter
float carla_get_parameter(CarlaHost *host, int channel, int plugin_index, int param_index);
// Set channel volume
void carla_set_channel_volume(CarlaHost *host, int channel, float volume);
// Get channel volume
float carla_get_channel_volume(CarlaHost *host, int channel);
// Process audio through the rack (called from audio thread)
void carla_process(CarlaHost *host, int channel, float *in_buffer, float *out_buffer, jack_nframes_t nframes);
// Scan for available plugins
int carla_scan_plugins(CarlaHost *host);
// Get available plugin names for fuzzy search
const char** carla_get_available_plugins(CarlaHost *host, int *count);
// Get plugin display name
const char* carla_get_plugin_name(CarlaHost *host, int channel, int plugin_index);
#endif // CARLA_H