Skip to content

Integer parameters can send fractional values to mod-host #254

Description

@sastraxi

Problem

pi-Stomp can send a fractional value for an LV2 parameter marked integer.

This occurs for integer parameters that also have logarithmic scaling. ParameterSteps builds logarithmic values from the full integer range. For a range of 100..48000, example values include:

100.01288973692641
2190.8902300206646
47993.813723670064

Parameter.format_value() rounds these values for the LCD only. It does not change the value sent to mod-ui.

The direct send path is:

Parameter.commit()
_publish_plugin_param()
WebSocketBridge.send_parameter()

send_parameter() writes the value into the WebSocket command without integer conversion.

Blend mode has the same risk. It interpolates snapshot values and sends the result directly through ParameterSetter.

Risk

MOD-UI forwards the value as a float. The current mod-host code also writes the value to the plugin control buffer without rounding in its direct param_set path. MIDI and CV paths round integer ports, so behavior depends on the input source.

The browser widget rounds integer values. This does not protect pi-Stomp because pi-Stomp is an external WebSocket client.

A plugin can therefore receive a fractional value for an integer control port. The LCD can show a rounded value while the plugin and mod-ui state use the fractional value.

Expected behavior

Pi-Stomp should not send fractional values for parameters marked integer.

Local state, rollback state, WebSocket values, and blend values should use the same integer value.

Possible fix

Use one value-normalization rule for integer parameters. Apply it to:

  • Parameter.commit() and Parameter.reconcile().
  • Blend interpolation before ParameterSetter sends a value.
  • Any other direct WebSocket parameter send path.

A matching fix in mod-host would still be useful. It would protect all clients, but it is outside this repository.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions