# UI Knobs question??



## Tod (Aug 8, 2012)

Hi my freinds,

I have an instrument with 2 groups set up for panning left & rignt. I have a link button that when on, it pans the one group left while it pans the other group right or vice versa. In other words if the first pan is at 40% Left the other pans 60% right or the first pan is at 30% Left, then the other pans 70% right ect..

I've got it all working properly except for the UI Knob itself. The actual pan on the Amplifier is working properly as well at the text update on all the knobs but I can't get the opposing UI knobs to turn and update properly.

I know there's something very simple I'm missing here but haven't found it yet. :oops: 

Any suggestions?


----------



## mk282 (Aug 9, 2012)

Did you set the actual knob values along with engine parameter values?

Short example:



```
on init
    declare ui_knob $Pan1 (0,1000000,1)
    declare ui_knob $Pan2 (0,1000000,1)
end on

on ui_control ($Pan1)
    $Pan2 := 1000000 - $Pan1
    set_engine_par($ENGINE_PAR_PAN,$Pan1,0,-1,-1)
    set_engine_par($ENGINE_PAR_PAN,$Pan2,1,-1,-1)
end on

on ui_control ($Pan2)
    $Pan1 := 1000000 - $Pan2
    set_engine_par($ENGINE_PAR_PAN,$Pan1,0,-1,-1)
    set_engine_par($ENGINE_PAR_PAN,$Pan2,1,-1,-1)
end on
```


----------



## Tod (Aug 9, 2012)

Thanks mk282, here's what I've got.


```
on ui_control ($Pan_1)
     _set_engine_par($ENGINE_PAR_PAN,$Pan_1,0,-1,-1)
     set_knob_label($Pan_1,_get_engine_par_disp($ENGINE_PAR_PAN,0 ,0 ,-1))
   if ($Link_Pan = 1)
      $cnt2 := 1000000 - $Pan_1
      _set_engine_par($ENGINE_PAR_PAN,$cnt2,1,-1,-1)
      set_knob_label($Pan_2,_get_engine_par_disp($ENGINE_PAR_PAN,1 ,0 ,-1))
   end if  
end on

on ui_control ($Pan_2)
     _set_engine_par($ENGINE_PAR_PAN,$Pan_2,1,-1,-1)
     set_knob_label($Pan_2,_get_engine_par_disp($ENGINE_PAR_PAN,1 ,0 ,-1))
   if ($Link_Pan = 1)
     $cnt2 := 1000000 - $Pan_2
     _set_engine_par($ENGINE_PAR_PAN,$cnt2,0,-1,-1)
     set_knob_label($Pan_1,_get_engine_par_disp($ENGINE_PAR_PAN,0 ,0 ,-1))
   end if  
end on
```

Everything works except for the opposing UI knob.

Edit: I forgot to mention, I have a link on / off button sol they can either be set together or separately.


----------



## Raptor4 (Aug 9, 2012)

Hi Tod
You use same variable cnt2 and I guess this is the issue. You do not need additional "helper" like cnt2. Try this:

```
on init
  declare ui_knob $Pan_1(0, 1000000, 1) 
  declare ui_knob $Pan_2(0, 1000000, 1) 
  declare ui_switch $Link_Pan
end on

on ui_control($Pan_1)
  _set_engine_par($ENGINE_PAR_PAN,$Pan_1,0,-1,-1)
  set_knob_label($Pan_1,_get_engine_par_disp($ENGINE_PAR_PAN,0,0,-1))
  if ($Link_Pan=1)
    $Pan_2 := 1000000-$Pan_1
    _set_engine_par($ENGINE_PAR_PAN,$Pan_2,1,-1,-1)
    set_knob_label($Pan_2,_get_engine_par_disp($ENGINE_PAR_PAN,1,0,-1))
  end if
end on

on ui_control($Pan_2)
  _set_engine_par($ENGINE_PAR_PAN,$Pan_2,1,-1,-1)
  set_knob_label($Pan_2,_get_engine_par_disp($ENGINE_PAR_PAN,1,0,-1))
  if ($Link_Pan=1)
    $Pan_1 := 1000000-$Pan_2
    _set_engine_par($ENGINE_PAR_PAN,$Pan_1,0,-1,-1)
    set_knob_label($Pan_1,_get_engine_par_disp($ENGINE_PAR_PAN,0,0,-1))
  end if
end on
```
regards,
R4


----------



## Tod (Aug 9, 2012)

Raptor4 @ Thu Aug 09 said:


> Hi Tod
> You use same variable cnt2 and I guess this is the issue. You do not need additional "helper" like cnt2. Try this:



Aha, [face palm] :oops: . Thanks much Raptor4, I can't believe I did that. :roll:


----------



## Raptor4 (Aug 9, 2012)

> I can't believe I did that.


No wonder, sometimes most of us stack on very simple things which is a result of overworking usually.
Take care!
R4 :wink:


----------

