aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jalv.c34
-rw-r--r--src/jalv_gtk.c2
-rw-r--r--src/jalv_internal.h5
-rw-r--r--wscript2
4 files changed, 24 insertions, 19 deletions
diff --git a/src/jalv.c b/src/jalv.c
index 0e77239..6f8d07c 100644
--- a/src/jalv.c
+++ b/src/jalv.c
@@ -833,6 +833,7 @@ main(int argc, char** argv)
jalv.urids.time_beatsPerMinute = symap_map(jalv.symap, LV2_TIME__beatsPerMinute);
jalv.urids.time_frame = symap_map(jalv.symap, LV2_TIME__frame);
jalv.urids.time_speed = symap_map(jalv.symap, LV2_TIME__speed);
+ jalv.urids.ui_updateRate = symap_map(jalv.symap, LV2_UI__updateRate);
#ifdef _WIN32
jalv.temp_dir = jalv_strdup("jalvXXXXXX");
@@ -1026,6 +1027,22 @@ main(int argc, char** argv)
jalv.opts.buffer_size = jalv.midi_buf_size * 4;
}
+ if (jalv.opts.update_rate == 0.0) {
+ /* Calculate a reasonable UI update frequency. */
+ jalv.ui_update_hz = (float)jalv.sample_rate / jalv.midi_buf_size * 2.0f;
+ jalv.ui_update_hz = MAX(25.0f, jalv.ui_update_hz);
+ } else {
+ /* Use user-specified UI update rate. */
+ jalv.ui_update_hz = jalv.opts.update_rate;
+ jalv.ui_update_hz = MAX(1.0f, jalv.ui_update_hz);
+ }
+
+ /* 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);
+ fprintf(stderr, "Comm buffers: %d bytes\n", jalv.opts.buffer_size);
+ fprintf(stderr, "Update rate: %.01f Hz\n", jalv.ui_update_hz);
+
/* Build options array to pass to plugin */
const LV2_Options_Option options[] = {
{ LV2_OPTIONS_INSTANCE, 0, jalv.urids.param_sampleRate,
@@ -1036,26 +1053,13 @@ main(int argc, char** argv)
sizeof(int32_t), jalv.urids.atom_Int, &jalv.block_length },
{ LV2_OPTIONS_INSTANCE, 0, jalv.urids.bufsz_sequenceSize,
sizeof(int32_t), jalv.urids.atom_Int, &jalv.midi_buf_size },
+ { LV2_OPTIONS_INSTANCE, 0, jalv.urids.ui_updateRate,
+ sizeof(float), jalv.urids.atom_Float, &jalv.ui_update_hz },
{ LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, NULL }
};
options_feature.data = &options;
- if (!jalv.opts.update_rate) {
- /* Calculate theoretical UI update frequency. */
- jalv.ui_update_hz = (double)jalv.sample_rate / jalv.midi_buf_size * 2.0;
- jalv.ui_update_hz = MAX(25, jalv.ui_update_hz);
- } else {
- jalv.ui_update_hz = jalv.opts.update_rate;
- jalv.ui_update_hz = MAX(1, jalv.ui_update_hz);
- }
-
- /* 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);
- fprintf(stderr, "Comm buffers: %d bytes\n", jalv.opts.buffer_size);
- fprintf(stderr, "Update rate: %d Hz\n", jalv.ui_update_hz);
-
/* Create Plugin <=> UI communication buffers */
jalv.ui_events = jack_ringbuffer_create(jalv.opts.buffer_size);
jalv.plugin_events = jack_ringbuffer_create(jalv.opts.buffer_size);
diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c
index e371a6c..45d1080 100644
--- a/src/jalv_gtk.c
+++ b/src/jalv_gtk.c
@@ -91,7 +91,7 @@ jalv_init(int* argc, char*** argv, JalvOptions* opts)
"Use Jalv generic UI and not the plugin UI", NULL},
{ "buffer-size", 'b', 0, G_OPTION_ARG_INT, &opts->buffer_size,
"Buffer size for plugin <=> UI communication", "SIZE"},
- { "update-frequency", 'r', 0, G_OPTION_ARG_INT, &opts->update_rate,
+ { "update-frequency", 'r', 0, G_OPTION_ARG_DOUBLE, &opts->update_rate,
"UI update frequency", NULL},
{ 0, 0, 0, 0, 0, 0, 0 } };
GError* error = NULL;
diff --git a/src/jalv_internal.h b/src/jalv_internal.h
index 2fccbc5..1eb6899 100644
--- a/src/jalv_internal.h
+++ b/src/jalv_internal.h
@@ -86,7 +86,7 @@ typedef struct {
char* uuid;
char* load;
uint32_t buffer_size;
- uint32_t update_rate;
+ double update_rate;
bool dump;
bool generic_ui;
} JalvOptions;
@@ -112,6 +112,7 @@ typedef struct {
LV2_URID time_beatsPerMinute;
LV2_URID time_frame;
LV2_URID time_speed;
+ LV2_URID ui_updateRate;
} JalvURIDs;
typedef struct {
@@ -186,7 +187,7 @@ typedef struct {
uint32_t control_in; ///< Index of control input port
uint32_t num_ports; ///< Size of the two following arrays:
uint32_t longest_sym; ///< Longest port symbol
- uint32_t ui_update_hz; ///< Frequency of UI updates
+ float ui_update_hz; ///< Frequency of UI updates
jack_nframes_t sample_rate; ///< Sample rate
jack_nframes_t event_delta_t; ///< Frames since last update sent to UI
uint32_t midi_event_id; ///< MIDI event class ID in event context
diff --git a/wscript b/wscript
index 4aa0dc9..7813452 100644
--- a/wscript
+++ b/wscript
@@ -30,7 +30,7 @@ def configure(conf):
autowaf.set_c99_mode(conf)
autowaf.display_header('Jalv Configuration')
- autowaf.check_pkg(conf, 'lv2', atleast_version='1.3.0', uselib_store='LV2')
+ autowaf.check_pkg(conf, 'lv2', atleast_version='1.4.3', uselib_store='LV2')
autowaf.check_pkg(conf, 'lilv-0', uselib_store='LILV',
atleast_version='0.15.1', mandatory=True)
autowaf.check_pkg(conf, 'serd-0', uselib_store='SERD',