aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jalv.c102
-rw-r--r--src/jalv_console.c1
-rw-r--r--src/jalv_gtk2.c29
-rw-r--r--src/jalv_internal.h94
-rw-r--r--src/jalv_qt4.cpp4
-rw-r--r--src/state.c8
-rw-r--r--src/symap.c5
7 files changed, 124 insertions, 119 deletions
diff --git a/src/jalv.c b/src/jalv.c
index fb344e6..b4bd530 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -59,10 +59,7 @@ LV2_URID
map_uri(LV2_URID_Map_Handle handle,
const char* uri)
{
- //return symap_map(((Jalv*)handle)->symap, uri);
- const LV2_URID id = symap_map(((Jalv*)handle)->symap, uri);
- //printf("MAP %s => %u\n", uri, id);
- return id;
+ return symap_map(((Jalv*)handle)->symap, uri);
}
const char*
@@ -80,20 +77,18 @@ uri_to_id(LV2_URI_Map_Callback_Data callback_data,
const char* map,
const char* uri)
{
- //return symap_map(((Jalv*)callback_data)->symap, uri);
- const LV2_URID id = symap_map(((Jalv*)callback_data)->symap, uri);
- //printf("MAP %s => %u\n", uri, id);
- return id;
+ return symap_map(((Jalv*)callback_data)->symap, uri);
}
#define NS_EXT "http://lv2plug.in/ns/ext/"
-static LV2_URI_Map_Feature uri_map = { NULL, &uri_to_id };
-static LV2_Feature uri_map_feature = { NS_EXT "uri-map", &uri_map };
-static LV2_Feature map_feature = { NS_EXT "urid#map", NULL };
-static LV2_Feature unmap_feature = { NS_EXT "urid#unmap", NULL };
-static LV2_Feature instance_feature = { NS_EXT "instance-access", NULL };
-static LV2_Feature make_path_feature = { LV2_STATE_MAKE_PATH_URI, NULL };
+static LV2_URI_Map_Feature uri_map = { NULL, &uri_to_id };
+
+static LV2_Feature uri_map_feature = { NS_EXT "uri-map", &uri_map };
+static LV2_Feature map_feature = { NS_EXT "urid#map", NULL };
+static LV2_Feature unmap_feature = { NS_EXT "urid#unmap", NULL };
+static LV2_Feature instance_feature = { NS_EXT "instance-access", NULL };
+static LV2_Feature make_path_feature = { LV2_STATE_MAKE_PATH_URI, NULL };
#ifdef HAVE_LV2_UI_RESIZE
static int
@@ -106,7 +101,8 @@ lv2_ui_resize(LV2_UI_Resize_Feature_Data data, int width, int height)
}
LV2_UI_Resize_Feature ui_resize = { NULL, &lv2_ui_resize };
-static const LV2_Feature ui_resize_feature = { NS_EXT "ui-resize#UIResize", &ui_resize };
+static const LV2_Feature ui_resize_feature = { NS_EXT "ui-resize#UIResize",
+ &ui_resize };
const LV2_Feature* features[8] = {
&uri_map_feature, &map_feature, &unmap_feature,
@@ -152,8 +148,8 @@ create_port(Jalv* host,
port->flow = FLOW_UNKNOWN;
/* Get the port symbol for console printing */
- const LilvNode* symbol = lilv_port_get_symbol(host->plugin, port->lilv_port);
- const char* symbol_str = lilv_node_as_string(symbol);
+ const LilvNode* symbol = lilv_port_get_symbol(host->plugin,
+ port->lilv_port);
const bool optional = lilv_port_has_property(host->plugin,
port->lilv_port,
@@ -162,7 +158,8 @@ create_port(Jalv* host,
/* Set the port flow (input or output) */
if (lilv_port_is_a(host->plugin, port->lilv_port, host->input_class)) {
port->flow = FLOW_INPUT;
- } else if (lilv_port_is_a(host->plugin, port->lilv_port, host->output_class)) {
+ } else if (lilv_port_is_a(host->plugin, port->lilv_port,
+ host->output_class)) {
port->flow = FLOW_OUTPUT;
} else if (!optional) {
die("Mandatory port has unknown type (neither input nor output)");
@@ -172,20 +169,25 @@ create_port(Jalv* host,
if (lilv_port_is_a(host->plugin, port->lilv_port, host->control_class)) {
port->type = TYPE_CONTROL;
port->control = isnan(default_value) ? 0.0 : default_value;
- } else if (lilv_port_is_a(host->plugin, port->lilv_port, host->audio_class)) {
+ } else if (lilv_port_is_a(host->plugin, port->lilv_port,
+ host->audio_class)) {
port->type = TYPE_AUDIO;
- } else if (lilv_port_is_a(host->plugin, port->lilv_port, host->event_class)) {
+ } else if (lilv_port_is_a(host->plugin, port->lilv_port,
+ host->event_class)) {
port->type = TYPE_EVENT;
port->old_api = true;
- } else if (lilv_port_is_a(host->plugin, port->lilv_port, host->aevent_class)) {
+ } else if (lilv_port_is_a(host->plugin, port->lilv_port,
+ host->aevent_class)) {
port->type = TYPE_EVENT;
port->old_api = false;
} else if (!optional) {
- die("Mandatory port has unknown type (neither control nor audio nor event)");
+ die("Mandatory port has unknown data type");
}
- const size_t sym_len = strlen(symbol_str);
- host->longest_sym = (sym_len > host->longest_sym) ? sym_len : host->longest_sym;
+ const size_t sym_len = strlen(lilv_node_as_string(symbol));
+ if (sym_len > host->longest_sym) {
+ host->longest_sym = sym_len;
+ }
}
/**
@@ -260,8 +262,9 @@ activate_port(Jalv* host,
struct Port* const port = &host->ports[port_index];
/* Get the port symbol for console printing */
- const LilvNode* symbol = lilv_port_get_symbol(host->plugin, port->lilv_port);
- const char* symbol_str = lilv_node_as_string(symbol);
+ const LilvNode* symbol = lilv_port_get_symbol(host->plugin,
+ port->lilv_port);
+ const char* symbol_str = lilv_node_as_string(symbol);
/* Connect unsupported ports to NULL (known to be optional by this point) */
if (port->flow == FLOW_UNKNOWN || port->type == TYPE_UNKNOWN) {
@@ -283,11 +286,13 @@ activate_port(Jalv* host,
break;
case TYPE_AUDIO:
port->jack_port = jack_port_register(
- host->jack_client, symbol_str, JACK_DEFAULT_AUDIO_TYPE, jack_flags, 0);
+ host->jack_client, symbol_str,
+ JACK_DEFAULT_AUDIO_TYPE, jack_flags, 0);
break;
case TYPE_EVENT:
port->jack_port = jack_port_register(
- host->jack_client, symbol_str, JACK_DEFAULT_MIDI_TYPE, jack_flags, 0);
+ host->jack_client, symbol_str,
+ JACK_DEFAULT_MIDI_TYPE, jack_flags, 0);
break;
default:
break;
@@ -371,23 +376,25 @@ jack_process_cb(jack_nframes_t nframes, void* data)
/* Read and apply control change events from UI */
if (host->ui) {
ControlChange ev;
- size_t ev_read_size = jack_ringbuffer_read_space(host->ui_events);
- for (size_t i = 0; i < ev_read_size; i += sizeof(ev) + ev.size) {
+ const size_t space = jack_ringbuffer_read_space(host->ui_events);
+ for (size_t i = 0; i < space; i += sizeof(ev) + ev.size) {
jack_ringbuffer_read(host->ui_events, (char*)&ev, sizeof(ev));
char body[ev.size];
jack_ringbuffer_read(host->ui_events, body, ev.size);
+ struct Port* const port = &host->ports[ev.index];
if (ev.protocol == 0) {
assert(ev.size == sizeof(float));
- host->ports[ev.index].control = *(float*)body;
+ port->control = *(float*)body;
} else if (ev.protocol == host->atom_prot_id) {
printf("ATOM UI READ\n");
for (uint32_t i = 0; i < ev.size; ++i) {
printf("%c", body[i]);
}
printf("\n");
- LV2_Evbuf_Iterator i = lv2_evbuf_end(host->ports[ev.index].evbuf);
+ LV2_Evbuf_Iterator i = lv2_evbuf_end(port->evbuf);
const LV2_Atom* const atom = (const LV2_Atom*)body;
- lv2_evbuf_write(&i, nframes, 0, atom->type, atom->size, atom->body);
+ lv2_evbuf_write(&i, nframes, 0,
+ atom->type, atom->size, atom->body);
} else {
fprintf(stderr, "error: Unknown control change protocol %d\n",
ev.protocol);
@@ -400,8 +407,9 @@ jack_process_cb(jack_nframes_t nframes, void* data)
/* Check if it's time to send updates to the UI */
host->event_delta_t += nframes;
- bool send_ui_updates = false;
- if (host->ui && (host->event_delta_t > host->sample_rate / JALV_UI_UPDATE_HZ)) {
+ bool send_ui_updates = false;
+ jack_nframes_t update_frames = host->sample_rate / JALV_UI_UPDATE_HZ;
+ if (host->ui && (host->event_delta_t > update_frames)) {
send_ui_updates = true;
host->event_delta_t = 0;
}
@@ -409,18 +417,14 @@ jack_process_cb(jack_nframes_t nframes, void* data)
/* Deliver MIDI output and UI events */
for (uint32_t p = 0; p < host->num_ports; ++p) {
struct Port* const port = &host->ports[p];
- if (port->jack_port
- && !port->flow == FLOW_INPUT
+ if (port->jack_port && port->flow == FLOW_OUTPUT
&& port->type == TYPE_EVENT) {
-
- void* buf = jack_port_get_buffer(port->jack_port,
- nframes);
-
+ void* buf = jack_port_get_buffer(port->jack_port, nframes);
jack_midi_clear_buffer(buf);
- LV2_Evbuf_Iterator iter = lv2_evbuf_begin(port->evbuf);
- const uint32_t event_count = lv2_evbuf_get_event_count(iter.evbuf);
- for (uint32_t i = 0; i < event_count; ++i) {
+ LV2_Evbuf_Iterator iter = lv2_evbuf_begin(port->evbuf);
+ const uint32_t count = lv2_evbuf_get_event_count(iter.evbuf);
+ for (uint32_t i = 0; i < count; ++i) {
uint32_t frames, subframes, type, size;
uint8_t* data;
lv2_evbuf_get(iter, &frames, &subframes,
@@ -496,8 +500,6 @@ jalv_ui_write(SuilController controller,
printf("\n");
}
- //const ControlChange ev = { port_index, *(float*)buffer };
- //jack_ringbuffer_write(host->ui_events, (const char*)&ev, sizeof(ev));
char buf[sizeof(ControlChange) + buffer_size];
ControlChange* ev = (ControlChange*)buf;
ev->index = port_index;
@@ -518,8 +520,8 @@ bool
jalv_emit_ui_events(Jalv* host)
{
ControlChange ev;
- size_t ev_read_size = jack_ringbuffer_read_space(host->plugin_events);
- for (size_t i = 0; i < ev_read_size; i += sizeof(ev) + ev.size) {
+ const size_t space = jack_ringbuffer_read_space(host->plugin_events);
+ for (size_t i = 0; i < space; i += sizeof(ev) + ev.size) {
jack_ringbuffer_read(host->plugin_events, (char*)&ev, sizeof(ev));
char buf[ev.size];
jack_ringbuffer_read(host->plugin_events, buf, ev.size);
@@ -650,7 +652,7 @@ main(int argc, char** argv)
const LilvNode* ui_type = NULL;
host.ui = NULL;
if (native_ui_type) {
- LilvUIs* uis = lilv_plugin_get_uis(host.plugin); // FIXME: leak
+ LilvUIs* uis = lilv_plugin_get_uis(host.plugin); // FIXME: leak
LILV_FOREACH(uis, u, uis) {
const LilvUI* this_ui = lilv_uis_get(uis, u);
if (lilv_ui_is_supported(this_ui,
@@ -683,7 +685,7 @@ main(int argc, char** argv)
/* Truncate plugin name to suit JACK (if necessary) */
char* jack_name = NULL;
if (strlen(name_str) >= (unsigned)jack_client_name_size() - 1) {
- jack_name = calloc(jack_client_name_size(), sizeof(char));
+ jack_name = calloc(jack_client_name_size(), 1);
strncpy(jack_name, name_str, jack_client_name_size() - 1);
} else {
jack_name = jalv_strdup(name_str);
diff --git a/src/jalv_console.c b/src/jalv_console.c
index 94881ab..a70e955 100644
--- a/src/jalv_console.c
+++ b/src/jalv_console.c
@@ -80,7 +80,6 @@ jalv_open_ui(Jalv* jalv,
#ifdef JALV_JACK_SESSION
printf("\nPress Ctrl-C to quit: ");
fflush(stdout);
- //g_cond_wait(exit_cond, exit_mutex);
#else
printf("\nPress enter to quit: ");
fflush(stdout);
diff --git a/src/jalv_gtk2.c b/src/jalv_gtk2.c
index 3307211..a75076e 100644
--- a/src/jalv_gtk2.c
+++ b/src/jalv_gtk2.c
@@ -36,7 +36,7 @@ jalv_init(int* argc, char*** argv, JalvOptions* opts)
"UUID for Jack session restoration", "UUID" },
{ "load", 'l', 0, G_OPTION_ARG_STRING, &opts->load,
"Load state from save directory", "DIR" },
- { 0,0,0,0,0,0,0 } };
+ { 0, 0, 0, 0, 0, 0, 0 } };
GError* error = NULL;
const int err = gtk_init_with_args(
argc, argv,
@@ -70,10 +70,10 @@ on_save_activate(GtkWidget* widget, void* ptr)
NULL);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
- char* filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
- char* base = g_build_filename(filename, "/", NULL);
+ char* path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+ char* base = g_build_filename(path, "/", NULL);
jalv_save(jalv, base);
- g_free(filename);
+ g_free(path);
g_free(base);
}
@@ -164,7 +164,7 @@ int
jalv_ui_resize(Jalv* jalv, int width, int height)
{
if (jalv->ui_instance) {
- GtkWidget* widget = (GtkWidget*)suil_instance_get_widget(jalv->ui_instance);
+ GtkWidget* widget = suil_instance_get_widget(jalv->ui_instance);
if (widget) {
gtk_widget_set_size_request(GTK_WIDGET(widget), width, height);
}
@@ -182,18 +182,20 @@ jalv_open_ui(Jalv* jalv,
g_signal_connect(window, "destroy",
G_CALLBACK(on_window_destroy), jalv);
- gtk_window_set_title(GTK_WINDOW(window),
- lilv_node_as_string(lilv_plugin_get_name(jalv->plugin)));
-
- GtkAccelGroup* accels = gtk_accel_group_new();
- gtk_window_add_accel_group(GTK_WINDOW(window), accels);
+ gtk_window_set_title(
+ GTK_WINDOW(window),
+ lilv_node_as_string(lilv_plugin_get_name(jalv->plugin)));
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
GtkWidget* menu_bar = gtk_menu_bar_new();
GtkWidget* file = gtk_menu_item_new_with_mnemonic("_File");
GtkWidget* file_menu = gtk_menu_new();
- GtkWidget* save = gtk_image_menu_item_new_from_stock(GTK_STOCK_SAVE, accels);
- GtkWidget* quit = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, accels);
+
+ GtkAccelGroup* ag = gtk_accel_group_new();
+ gtk_window_add_accel_group(GTK_WINDOW(window), ag);
+
+ GtkWidget* save = gtk_image_menu_item_new_from_stock(GTK_STOCK_SAVE, ag);
+ GtkWidget* quit = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, ag);
gtk_menu_item_set_submenu(GTK_MENU_ITEM(file), file_menu);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), save);
@@ -202,7 +204,8 @@ jalv_open_ui(Jalv* jalv,
GtkWidget* presets = gtk_menu_item_new_with_mnemonic("_Presets");
GtkWidget* presets_menu = gtk_menu_new();
- GtkWidget* save_preset = gtk_menu_item_new_with_mnemonic("_Save Preset...");
+ GtkWidget* save_preset = gtk_menu_item_new_with_mnemonic(
+ "_Save Preset...");
gtk_menu_item_set_submenu(GTK_MENU_ITEM(presets), presets_menu);
gtk_menu_shell_append(GTK_MENU_SHELL(presets_menu), save_preset);
gtk_menu_shell_append(GTK_MENU_SHELL(presets_menu),
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index fd625d4..68757d8 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -57,11 +57,11 @@ struct Port {
const LilvPort* lilv_port;
enum PortType type;
enum PortFlow flow;
- jack_port_t* jack_port; /**< For audio/MIDI ports, otherwise NULL */
- LV2_Evbuf* evbuf; /**< For MIDI ports, otherwise NULL */
- uint32_t index; /**< Port index */
- float control; /**< For control ports, otherwise 0.0f */
- bool old_api; /**< True for event, false for atom */
+ jack_port_t* jack_port; ///< For audio/MIDI ports, otherwise NULL
+ LV2_Evbuf* evbuf; ///< For MIDI ports, otherwise NULL
+ uint32_t index; ///< Port index
+ float control; ///< For control ports, otherwise 0.0f
+ bool old_api; ///< True for event, false for atom
};
/**
@@ -86,46 +86,46 @@ typedef enum {
} JalvPlayState;
typedef struct {
- JalvOptions opts; /**< Command-line options */
- const char* prog_name; /**< Program name (argv[0]) */
- LilvWorld* world; /**< Lilv World */
- int ui_width; /**< Requested UI width */
- int ui_height; /**< Requested UI height */
- LV2_URID_Map map; /**< URI => Int map */
- LV2_URID_Unmap unmap; /**< Int => URI map */
- Symap* symap; /**< Symbol (URI) map */
- jack_client_t* jack_client; /**< Jack client */
- jack_ringbuffer_t* ui_events; /**< Port events from UI */
- jack_ringbuffer_t* plugin_events; /**< Port events from plugin */
- sem_t* done; /**< Exit semaphore */
- sem_t paused; /**< Paused signal from process thread */
- JalvPlayState play_state; /**< Current play state */
- char* temp_dir; /**< Temporary plugin state directory */
- char* save_dir; /**< Plugin save directory */
- const LilvPlugin* plugin; /**< Plugin class (RDF data) */
- const LilvUI* ui; /**< Plugin UI (RDF data) */
- LilvInstance* instance; /**< Plugin instance (shared library) */
- SuilInstance* ui_instance; /**< Plugin UI instance (shared library) */
- void* window; /**< Window (if applicable) */
- struct Port* ports; /**< Port array of size num_ports */
- size_t midi_buf_size; /**< Size of MIDI port buffers */
- uint32_t num_ports; /**< Size of the two following arrays: */
- uint32_t longest_sym; /**< Longest port symbol */
- jack_nframes_t sample_rate; /**< Sample rate */
- jack_nframes_t event_delta_t; /**< Frames since last update sent to UI */
- LilvNode* input_class; /**< Input port class (URI) */
- LilvNode* output_class; /**< Output port class (URI) */
- LilvNode* control_class; /**< Control port class (URI) */
- LilvNode* audio_class; /**< Audio port class (URI) */
- LilvNode* event_class; /**< Event port class (URI) */
- LilvNode* aevent_class; /**< Atom event port class (URI) */
- LilvNode* midi_class; /**< MIDI event class (URI) */
- LilvNode* preset_class; /**< Preset class (URI) */
- LilvNode* label_pred; /**< rdfs:label */
- LilvNode* optional; /**< lv2:connectionOptional port property */
- uint32_t midi_event_id; /**< MIDI event class ID */
- uint32_t atom_prot_id; /**< Atom protocol ID */
- bool buf_size_set; /**< True iff Jack buf size callback fired */
+ JalvOptions opts; ///< Command-line options
+ const char* prog_name; ///< Program name (argv[0])
+ LilvWorld* world; ///< Lilv World
+ int ui_width; ///< Requested UI width
+ int ui_height; ///< Requested UI height
+ LV2_URID_Map map; ///< URI => Int map
+ LV2_URID_Unmap unmap; ///< Int => URI map
+ Symap* symap; ///< Symbol (URI) map
+ jack_client_t* jack_client; ///< Jack client
+ jack_ringbuffer_t* ui_events; ///< Port events from UI
+ jack_ringbuffer_t* plugin_events; ///< Port events from plugin
+ sem_t* done; ///< Exit semaphore
+ sem_t paused; ///< Paused signal from process thread
+ JalvPlayState play_state; ///< Current play state
+ char* temp_dir; ///< Temporary plugin state directory
+ char* save_dir; ///< Plugin save directory
+ const LilvPlugin* plugin; ///< Plugin class (RDF data)
+ const LilvUI* ui; ///< Plugin UI (RDF data)
+ LilvInstance* instance; ///< Plugin instance (shared library)
+ SuilInstance* ui_instance; ///< Plugin UI instance (shared library)
+ void* window; ///< Window (if applicable)
+ struct Port* ports; ///< Port array of size num_ports
+ size_t midi_buf_size; ///< Size of MIDI port buffers
+ uint32_t num_ports; ///< Size of the two following arrays:
+ uint32_t longest_sym; ///< Longest port symbol
+ jack_nframes_t sample_rate; ///< Sample rate
+ jack_nframes_t event_delta_t; ///< Frames since last update sent to UI
+ LilvNode* input_class; ///< Input port class (URI)
+ LilvNode* output_class; ///< Output port class (URI)
+ LilvNode* control_class; ///< Control port class (URI)
+ LilvNode* audio_class; ///< Audio port class (URI)
+ LilvNode* event_class; ///< Event port class (URI)
+ LilvNode* aevent_class; ///< Atom event port class (URI)
+ LilvNode* midi_class; ///< MIDI event class (URI)
+ LilvNode* preset_class; ///< Preset class (URI)
+ LilvNode* label_pred; ///< rdfs:label
+ LilvNode* optional; ///< lv2:connectionOptional port property
+ uint32_t midi_event_id; ///< MIDI event class ID
+ uint32_t atom_prot_id; ///< Atom protocol ID
+ bool buf_size_set; ///< True iff buffer size callback fired
} Jalv;
int
@@ -209,7 +209,7 @@ jalv_strjoin(const char* a, const char* b)
}
#ifdef __cplusplus
-} // extern "C"
+} // extern "C"
#endif
-#endif // JALV_INTERNAL_H
+#endif // JALV_INTERNAL_H
diff --git a/src/jalv_qt4.cpp b/src/jalv_qt4.cpp
index a765770..abe100a 100644
--- a/src/jalv_qt4.cpp
+++ b/src/jalv_qt4.cpp
@@ -53,7 +53,7 @@ jalv_ui_resize(Jalv* jalv, int width, int height)
class Timer : public QTimer {
public:
- Timer(Jalv* j) : jalv(j) {}
+ explicit Timer(Jalv* j) : jalv(j) {}
void timerEvent(QTimerEvent* e) {
jalv_emit_ui_events(jalv);
@@ -86,4 +86,4 @@ jalv_open_ui(Jalv* jalv,
return ret;
}
-} // extern "C"
+} // extern "C"
diff --git a/src/state.c b/src/state.c
index e5c6933..03362fb 100644
--- a/src/state.c
+++ b/src/state.c
@@ -77,7 +77,7 @@ void
jalv_save(Jalv* jalv, const char* dir)
{
jalv->save_dir = jalv_strjoin(dir, "/");
-
+
LilvState* const state = lilv_state_new_from_instance(
jalv->plugin, jalv->instance, &jalv->map, jalv->temp_dir,
get_port_value, jalv,
@@ -137,14 +137,14 @@ set_port_value(const char* port_symbol,
const float fvalue = lilv_node_as_float(value);
// Send value to plugin
- jalv_ui_write(jalv, port->index, sizeof(float), 0, &fvalue);
+ jalv_ui_write(jalv, port->index, sizeof(fvalue), 0, &fvalue);
// Update UI
- char buf[sizeof(ControlChange) + sizeof(float)];
+ char buf[sizeof(ControlChange) + sizeof(fvalue)];
ControlChange* ev = (ControlChange*)buf;
ev->index = port->index;
ev->protocol = 0;
- ev->size = sizeof(float);
+ ev->size = sizeof(fvalue);
*(float*)ev->body = fvalue;
jack_ringbuffer_write(jalv->plugin_events, buf, sizeof(buf));
}
diff --git a/src/symap.c b/src/symap.c
index 16fb733..ee9320d 100644
--- a/src/symap.c
+++ b/src/symap.c
@@ -153,7 +153,7 @@ symap_map(Symap* map, const char* sym)
char* const str = symap_strdup(sym);
/* Append new symbol to symbols array */
- map->symbols = realloc(map->symbols, map->size * sizeof(char*));
+ map->symbols = realloc(map->symbols, map->size * sizeof(str));
map->symbols[id - 1] = str;
/* Insert new index element into sorted index */
@@ -187,7 +187,8 @@ symap_dump(Symap* map)
{
fprintf(stderr, "{\n");
for (uint32_t i = 0; i < map->size; ++i) {
- fprintf(stderr, "\t%u = %s\n", map->index[i], map->symbols[map->index[i] - 1]);
+ fprintf(stderr, "\t%u = %s\n",
+ map->index[i], map->symbols[map->index[i] - 1]);
}
fprintf(stderr, "}\n");
}