Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osc: Send /select/plugin plugin_id feedback #897

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Commits on Jun 30, 2024

  1. osc: Update sur->plugins whenever strip changes

    Previously, this happend in _sel_plugin when the selected plugin
    changed (which was called at the end of _strip_select2 too). By moving
    this code:
     1. The list of plugins is only updated when the strip changes, and not
        when just the selected plugin changes (in which the case the
        selected strip and list of plugins remains the same, so this saves
        unneeded work).
     2. The list of plugins is updated earlier, which allows it to be used
        by OSCSelectObserver (in the next commit).
     3. The list of plugins is cleared when no strip is selected.
    matthijskooijman committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    f375e81 View commit details
    Browse the repository at this point in the history
  2. osc: Pass user-visible piid to OSCSelectObserver

    There are two ways to identify a plugin:
    
     1. The user-visible number, usually named "piid". This is a 1-based
        index into the list of visible, non-channelstrip plugins only.
     2. The plugin id. This is a 1-based index into the list of all plugins as passed to nth_plugin
    
    The sur->plugins vector is used to translate the former into the latter.
    
    Previously, the latter, already translated, index was passed to
    OSCSelectObserver to indicate the currently selected plugin. To prepare
    for sending the piid of the selected plugin in a feedback message (in
    the next commit), this commit moves the translation of piid to plugin id
    into OSCSelectObserver.
    
    To emphasize the new meaning of the plug_id variable, it is renamed to
    selected_piid. Also, since the piid is 1-based, change it to a uint32_t
    and use 0 to mean "no plugin selected" instead of -1.
    
    This commit is expected to subtly change behaviour: When selecting
    a different strip, OSCSelectObserver would (via OSC::_strip_select2 and
    refresh_strip) send feedback for the plugin with the same plugin id as
    the previously selected plugin. Then OSC::_strip_select2 would do the
    piid to plugin id translation for the new strip and call set_plugin,
    causing a second round of feedback for the plugin with the same piid as
    the previously selected plugin.
    
    If the new strip has hidden plugins (i.e. piid and plugin id do not
    match), this could mean that you get feedback for two different plugins.
    
    With this commit applied, the translation happens in both cases and the
    feedback returned should be for the same plugin twice.
    matthijskooijman committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    8a2a22d View commit details
    Browse the repository at this point in the history
  3. osc: Send /select/plugin plugin_id feedback

    Whenever the active plugin changes (because the plugin changes or the
    selected strip changes), the name, some other properties and parameter
    values for the newly selected plugin is sent as feedback.  However,
    there was no clear indication of which plugin was selected exactly.
    
    Applications or surfaces that need to know the active plugin could track
    the currently selected plugin by remembering the most recently selected
    index, but unexpected plugin changes (e.g. when switching to a strip
    with fewer plugins) and the asynchronous nature of OSC messages make
    this more complicated than it should be.
    
    By sending the active plugin id as feedback, clients do not have to
    guess.
    
    When no plugin is selected (e.g. on startup or when no strip is
    selected) or the currently selected index is not a plugin (but a some
    other kind of processor), a value of 0 is sent.
    
    This uses the `/select/plugin` message, which is also used to change the
    selected plugin. There is a slight discrepancy: the control messages
    accepts a delta on the selected plugin, while the feedback sends an
    absolute value.
    matthijskooijman committed Jun 30, 2024
    Configuration menu
    Copy the full SHA
    b786aa7 View commit details
    Browse the repository at this point in the history