nih-plug icon indicating copy to clipboard operation
nih-plug copied to clipboard

Vizia ParamButton Initialization issue

Open vsandstrom opened this issue 5 months ago • 0 comments

When trying to style the ParamButton, I try to switch color depending on the state of the button and underlying value. In what I deduce from reading the examples, the false state should also be the unchecked state.

github.com/vsandstrom/Havregryn/releases/tag/0.1.0

Behavior:

  • When starting a new instance of the plugin I am working on, it always starts with the color scheme of checked.
  • When pressing the button, it leaves a checked truthy state, although only the GUI responds like this. The event that would have been triggered by a true state does not trigger on the audio thread.

It seems that it could be an issue with how the ParamButton struct is initialized or how it interfaces with the Vizia API.

/* lib.rs */
impl Default for HavregrynParams {
  fn default() -> Self {
    Self {
      // (...)
      resample: BoolParam::new(
        "sample", 
        false
      )
      // (...)
    }
  }
}
/* styles.css */
.sample:checked {
  background-color: #fafafa;
  color: #0a0a0a;
}

.sample:hover {
  background-color: #ff255c;
  color: #fafafa;
  opacity: 0.6;
}

.sample {
  background-color: #ff255c;
  opacity: 0.8;
  color: #fafafa;
}

vsandstrom avatar Sep 23 '24 16:09 vsandstrom