Fix bug that su_env_map was not compiled when using only compressor, and rename it to su_nonlinear_map.

This commit is contained in:
Veikko Sariola 2020-05-25 20:45:36 +03:00
parent 1f92373a63
commit 17c6afceb4
3 changed files with 9 additions and 9 deletions

View File

@ -462,7 +462,7 @@ su_op_compressor_mono:
fucomi st0, st1
setnb al ; if (st0 >= st1) al = 1; else al = 0;
fsubp st1, st0 ; x^2-l x
call su_env_map ; c x^2-l x, c is either attack or release parameter mapped in a nonlinear way
call su_nonlinear_map ; c x^2-l x, c is either attack or release parameter mapped in a nonlinear way
fmulp st1, st0 ; c*(x^2-l) x
fadd dword [WRK+su_compres_wrk.level] ; l+c*(x^2-l) x // we could've kept level in the stack and save a few bytes, but su_env_map uses 3 stack (c + 2 temp), so the stack was getting quite big.
fst dword [WRK+su_compres_wrk.level] ; l'=l+c*(x^2-l), l' x

View File

@ -29,7 +29,7 @@ kmENV_func_process:
kmENV_func_attac:
cmp al, ENV_STATE_ATTAC ; if (al!=ATTAC)
jne short kmENV_func_decay ; goto decay
call su_env_map ; a x, where a=attack
call su_nonlinear_map ; a x, where a=attack
faddp st1, st0 ; a+x
fld1 ; 1 a+x
fucomi st1 ; if (a+x<=1) // is attack complete?
@ -38,7 +38,7 @@ kmENV_func_attac:
kmENV_func_decay:
cmp al, ENV_STATE_DECAY ; if (al!=DECAY)
jne short kmENV_func_release ; goto release
call su_env_map ; d x, where d=decay
call su_nonlinear_map ; d x, where d=decay
fsubp st1, st0 ; x-d
fld dword [INP+su_env_ports.sustain] ; s x-d, where s=sustain
fucomi st1 ; if (x-d>s) // is decay complete?
@ -47,7 +47,7 @@ kmENV_func_decay:
kmENV_func_release:
cmp al, ENV_STATE_RELEASE ; if (al!=RELEASE)
jne short kmENV_func_leave ; goto leave
call su_env_map ; r x, where r=release
call su_nonlinear_map ; r x, where r=release
fsubp st1, st0 ; x-r
fldz ; 0 x-r
fucomi st1 ; if (x-r>0) // is release complete?

View File

@ -219,16 +219,16 @@ su_transform_values_out:
ret
;-------------------------------------------------------------------------------
; su_env_map function: computes 2^(-24*x) of the envelope parameter
; su_nonlinear_map function: returns 2^(-24*x) of parameter number _AX
;-------------------------------------------------------------------------------
; Input: eax : envelope parameter (0 = attac, 1 = decay...)
; edx : pointer to su_transformed_values
; Input: _AX : parameter number (e.g. for envelope: 0 = attac, 1 = decay...)
; INP : pointer to transformed values
; Output: st0 : 2^(-24*x), where x is the parameter in the range 0-1
;-------------------------------------------------------------------------------
SECT_TEXT(supower)
%if ENVELOPE_ID > -1 ; TODO: compressor also uses this, so should be compiled if either
su_env_map:
%if ENVELOPE_ID > -1 || COMPRES_ID > -1
su_nonlinear_map:
fld dword [INP+_AX*4] ; x, where x is the parameter in the range 0-1
do fimul dword [,c_24,] ; 24*x
fchs ; -24*x