# Controlling the send level



## kaned (Mar 24, 2012)

Hi,

I have a convolution reverb as an instrument send effect.

I want to control the send level to the reverb with a ui_slider...

When the ui_control is moved the send level should correspond. 

The send level is located in slot 7 of the instrument insertfx

Here's the code I have -

declare ui_slider $rev (0,127)
set_control_par_str(get_ui_id( $rev),$CONTROL_PAR_PICTURE,"knob")
set_control_par(get_ui_id( $rev), $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)
set_control_par (get_ui_id( $rev),$CONTROL_PAR_WIDTH,55)
set_control_par (get_ui_id( $rev),$CONTROL_PAR_HEIGHT,55)
move_control_px($rev,355,41)
make_persistent($rev)
read_persistent_var($rev)
set_control_par(get_ui_id($rev),$CONTROL_PAR_DEFAULT_VALUE,0)


on ui_control ($rev)
set_engine_par($ENGINE_PAR_SENDLEVEL_7,127,-1,0,1)
end on

I can't figure out why this isn't working. Please help. Thanks.


----------



## Raptor4 (Mar 24, 2012)

Try this:

```
on ui_control($rev)
  set_engine_par($ENGINE_PAR_SENDLEVEL_0,$rev,-1,6,0)
end on
```

Regards


----------



## mk282 (Mar 25, 2012)

That will be valid only if the Convolution effect is in the FIRST Send FX slot. Depending on the slot in which the effect is, you should use $ENGINE_PAR_SENDLEVEL_0 thru $ENGINE_PAR_SENDLEVEL_7.


----------



## Raptor4 (Mar 25, 2012)

> That will be valid only if the Convolution effect is in the FIRST Send FX slot.


That's right. Last night I did not have time for detail explanations. I just made a snapshot diagram (see below) which explains the # rules. 
OP - just to say. You have to set the UI slider range to this below to make it work: 
*declare ui_slider $rev(0, 1000000)*







Regards


----------



## kaned (Mar 25, 2012)

Thanks for the help.

I've got it working now!

I was thinking the $ENGINE_PAR_SENDLEVEL_0 applied to the slot the send level was located in not the slot the receiving effect was located in.

You really are most helpful.
Cheers!


----------

