Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following up on #522. Thanks for the encouragement there, here's the extension as we actually use it.
Some background: I work on OpenMixer, a Linux mixing console. It hosts CLAP and LV2 plugins, but it never opens their GUIs. It draws its own knobs and meters, and it saves and recalls everything by name. That's where we kept running into the same gap.
value_to_text()is perfect when a person reads the value. It isn't enough when the host has to work with the value itself: drawing a frequency scale, building OSC addresses, a script, or a mapping saved to a file. Parsing "2.3 kHz" back into a unit is fragile, and aclap_idcan change when a plugin is rebuilt, so there's nothing stable to store.So this adds
clap.param-units/1. For a parameter id, the plugin returns two things:[A-Za-z_][A-Za-z0-9_]*, at most 63 bytes, unique in the plugin, and kept the same across versions.The host gets a
changed()callback to read the units again.Using LV2's list on purpose means a plugin ported from LV2, or an LV2 plugin wrapped as CLAP, keeps its
units:unitand port symbol without any translation.We already ship the same data in omx-clap-core, under our own vendor id:
I left a few things out. Our own version also carries a display scale, a step size, and a fingerprint of the parameter list. Range is already in
clap_param_info, and the rest is about how our console vets plugins, so it didn't seem to belong here.The compile tests (
src/main.c,src/main.cc) pass as C11, C17 and C++11 to C++20 with-Wall -Wextra -pedantic -Werror.A few things I'm unsure about and would love your view on:
get()return false when there's neither a unit nor a symbol, or always succeed withCLAP_PARAM_UNIT_NONEand an empty symbol?param-unitsright when it also carries the symbol?