diff options
author | David Robillard <d@drobilla.net> | 2024-11-15 18:45:48 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-11-24 19:00:31 -0500 |
commit | a3e3e489942697217ef08a73c1064e84df3d5e09 (patch) | |
tree | b2401d472d6c4debfcf6bac682c3f0eb0167b2c3 /src | |
parent | 63f013dd2492f6c01792198aceb6874ccf227086 (diff) | |
download | jalv-a3e3e489942697217ef08a73c1064e84df3d5e09.tar.gz jalv-a3e3e489942697217ef08a73c1064e84df3d5e09.tar.bz2 jalv-a3e3e489942697217ef08a73c1064e84df3d5e09.zip |
Rename ambiguous "buffer_size" field to "ring_size"
There's already a lot of "buffer" sizes, and there's about to be even more, so
rename this to "ring" size to be obviously about the communication rings.
Diffstat (limited to 'src')
-rw-r--r-- | src/jalv.c | 22 | ||||
-rw-r--r-- | src/jalv_console.c | 2 | ||||
-rw-r--r-- | src/jalv_gtk.c | 2 | ||||
-rw-r--r-- | src/options.h | 2 |
4 files changed, 13 insertions, 15 deletions
@@ -237,8 +237,8 @@ create_port(Jalv* jalv, uint32_t port_index, float default_value) lilv_port_get(jalv->plugin, port->lilv_port, jalv->nodes.rsz_minimumSize); if (min_size && lilv_node_is_int(min_size)) { port->buf_size = lilv_node_as_int(min_size); - jalv->opts.buffer_size = - MAX(jalv->opts.buffer_size, port->buf_size * N_BUFFER_CYCLES); + jalv->opts.ring_size = + MAX(jalv->opts.ring_size, port->buf_size * N_BUFFER_CYCLES); } lilv_node_free(min_size); @@ -1069,9 +1069,9 @@ jalv_init_display(Jalv* const jalv) } // The UI can only go so fast, clamp to reasonable limits - jalv->ui_update_hz = MIN(60, jalv->ui_update_hz); - jalv->opts.buffer_size = MAX(4096, jalv->opts.buffer_size); - jalv_log(JALV_LOG_INFO, "Comm buffers: %u bytes\n", jalv->opts.buffer_size); + jalv->ui_update_hz = MIN(60, jalv->ui_update_hz); + jalv->opts.ring_size = MAX(4096, jalv->opts.ring_size); + jalv_log(JALV_LOG_INFO, "Comm buffers: %u bytes\n", jalv->opts.ring_size); jalv_log(JALV_LOG_INFO, "Update rate: %.01f Hz\n", jalv->ui_update_hz); jalv_log(JALV_LOG_INFO, "Scale factor: %.01f\n", jalv->ui_scale_factor); } @@ -1252,21 +1252,19 @@ jalv_open(Jalv* const jalv, int* argc, char*** argv) jalv_log(JALV_LOG_INFO, "Block length: %u frames\n", jalv->block_length); jalv_log(JALV_LOG_INFO, "MIDI buffers: %zu bytes\n", jalv->midi_buf_size); - if (jalv->opts.buffer_size == 0) { + if (!jalv->opts.ring_size) { /* The UI ring is fed by plugin output ports (usually one), and the UI updates roughly once per cycle. The ring size is a few times the size - of the MIDI output to give the UI a chance to keep up. The UI should be - able to keep up with 4 cycles, and tests show this works for me, but - this value might need increasing to avoid overflows. */ - jalv->opts.buffer_size = jalv->midi_buf_size * N_BUFFER_CYCLES; + of the MIDI output to give the UI a chance to keep up. */ + jalv->opts.ring_size = jalv->midi_buf_size * N_BUFFER_CYCLES; } jalv_init_display(jalv); jalv_init_options(jalv); // Create Plugin <=> UI communication buffers - jalv->ui_to_plugin = zix_ring_new(NULL, jalv->opts.buffer_size); - jalv->plugin_to_ui = zix_ring_new(NULL, jalv->opts.buffer_size); + jalv->ui_to_plugin = zix_ring_new(NULL, jalv->opts.ring_size); + jalv->plugin_to_ui = zix_ring_new(NULL, jalv->opts.ring_size); zix_ring_mlock(jalv->ui_to_plugin); zix_ring_mlock(jalv->plugin_to_ui); diff --git a/src/jalv_console.c b/src/jalv_console.c index a3029fa..a95be3b 100644 --- a/src/jalv_console.c +++ b/src/jalv_console.c @@ -132,7 +132,7 @@ jalv_frontend_init(JalvFrontendArgs* const args, JalvOptions* const opts) if (++a == argc) { return print_arg_error(cmd, "option requires an argument -- 'b'"); } - opts->buffer_size = atoi(argv[a]); + opts->ring_size = atoi(argv[a]); } else if (argv[a][1] == 'c') { if (++a == argc) { return print_arg_error(cmd, "option requires an argument -- 'c'"); diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c index ed718be..7678e88 100644 --- a/src/jalv_gtk.c +++ b/src/jalv_gtk.c @@ -99,7 +99,7 @@ jalv_frontend_init(JalvFrontendArgs* const args, JalvOptions* const opts) 'b', 0, G_OPTION_ARG_INT, - &opts->buffer_size, + &opts->ring_size, "Buffer size for plugin <=> UI communication", "SIZE"}, {"control", diff --git a/src/options.h b/src/options.h index 91fbb77..3060eb3 100644 --- a/src/options.h +++ b/src/options.h @@ -16,7 +16,7 @@ typedef struct { char* load; ///< Path for state to load char* preset; ///< URI of preset to load char** controls; ///< Control values - uint32_t buffer_size; ///< Plugin <=> UI communication buffer size + uint32_t ring_size; ///< Plugin <=> UI communication buffer size double update_rate; ///< UI update rate in Hz double scale_factor; ///< UI scale factor int dump; ///< Dump communication iff true |