diff options
author | David Robillard <d@drobilla.net> | 2024-11-21 14:08:02 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-11-24 19:11:44 -0500 |
commit | 2a5bc1ca7aee36cd763ac10c894b84eef347fe25 (patch) | |
tree | b145b86c8f98fb6d7adab34f69c1bcb0114e34fa /src/features.c | |
parent | 724aab7a868ed0200afbeecf056e53b5ea16b23d (diff) | |
download | jalv-2a5bc1ca7aee36cd763ac10c894b84eef347fe25.tar.gz jalv-2a5bc1ca7aee36cd763ac10c894b84eef347fe25.tar.bz2 jalv-2a5bc1ca7aee36cd763ac10c894b84eef347fe25.zip |
Factor out "settings" that affect the execution process
Diffstat (limited to 'src/features.c')
-rw-r--r-- | src/features.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/features.c b/src/features.c new file mode 100644 index 0000000..82d8c27 --- /dev/null +++ b/src/features.c @@ -0,0 +1,62 @@ +// Copyright 2018-2024 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC + +#include "features.h" + +#include "macros.h" +#include "settings.h" +#include "urids.h" + +#include <lv2/options/options.h> + +#include <stdint.h> +#include <string.h> + +void +jalv_init_lv2_options(JalvFeatures* const features, + const JalvURIDs* const urids, + const JalvSettings* const settings) +{ + const LV2_Options_Option options[ARRAY_SIZE(features->options)] = { + {LV2_OPTIONS_INSTANCE, + 0, + urids->param_sampleRate, + sizeof(float), + urids->atom_Float, + &settings->sample_rate}, + {LV2_OPTIONS_INSTANCE, + 0, + urids->bufsz_minBlockLength, + sizeof(int32_t), + urids->atom_Int, + &settings->block_length}, + {LV2_OPTIONS_INSTANCE, + 0, + urids->bufsz_maxBlockLength, + sizeof(int32_t), + urids->atom_Int, + &settings->block_length}, + {LV2_OPTIONS_INSTANCE, + 0, + urids->bufsz_sequenceSize, + sizeof(int32_t), + urids->atom_Int, + &settings->midi_buf_size}, + {LV2_OPTIONS_INSTANCE, + 0, + urids->ui_updateRate, + sizeof(float), + urids->atom_Float, + &settings->ui_update_hz}, + {LV2_OPTIONS_INSTANCE, + 0, + urids->ui_scaleFactor, + sizeof(float), + urids->atom_Float, + &settings->ui_scale_factor}, + {LV2_OPTIONS_INSTANCE, 0, 0, 0, 0, NULL}}; + + memcpy(features->options, options, sizeof(features->options)); + features->options_feature.URI = LV2_OPTIONS__options; + features->options_feature.data = (void*)features->options; +} |