Hi Ollie,
the generic formula for a one-pole filter coefficient a is
a = exp[-1/(t*Fs)]
where t is the attack or release time (in seconds) and Fs is the sample rate (in cycles per second). You want to have separate control of attack and release, so you would have two time constants denoted by tA and tR, say, and two filter coefficents given by
aA = exp[-1/(tA*Fs)]
aR = exp[-1/(tR*Fs)]
You set the values of tA and tR using sliders (as opposed to your code example, where you set t = 1 - 1/e). In the simplest case, you can configure the attack slider range to go from tAmin to tAmax (and accordingly for the release) and use its output directly.
That, however, may not be the best choice, refer to
http://flowstone.guru/blog/mapping-of-c ... arameters/