mirror of
https://github.com/vsariola/sointu.git
synced 2025-06-04 01:28:45 -04:00
Add inverse gain to compressor. The inverse gain is applied to the signal before any compressor calculations.
This commit is contained in:
parent
c5b6e6e28c
commit
7e3dc19c83
@ -431,13 +431,16 @@ su_op_delay_loop:
|
|||||||
SECT_TEXT(sucompr)
|
SECT_TEXT(sucompr)
|
||||||
|
|
||||||
EXPORT MANGLE_FUNC(su_op_compressor,0)
|
EXPORT MANGLE_FUNC(su_op_compressor,0)
|
||||||
|
fdiv dword [INP+su_compres_ports.invgain]; l/g, we'll call this pre inverse gained signal x from now on
|
||||||
fld st0 ; x x
|
fld st0 ; x x
|
||||||
fmul st0, st0 ; x^2 x
|
fmul st0, st0 ; x^2 x
|
||||||
%ifdef INCLUDE_STEREO_COMPRES
|
%ifdef INCLUDE_STEREO_COMPRES
|
||||||
jnc su_op_compressor_mono
|
jnc su_op_compressor_mono
|
||||||
fld st2 ; r l^2 l r
|
fld st2 ; r x^2 l/g r
|
||||||
fmul st0, st0 ; r^2 l^2 l r
|
fdiv dword [INP+su_compres_ports.invgain]; r/g, we'll call this pre inverse gained signal y from now on
|
||||||
faddp st1, st0 ; r^2+l^2 l r
|
fst st3 ; y x^2 l/g r/g
|
||||||
|
fmul st0, st0 ; y^2 x^2 l/g r/g
|
||||||
|
faddp st1, st0 ; y^2+x^2 l/g r/g
|
||||||
call su_op_compressor_mono ; So, for stereo, we square both left & right and add them up
|
call su_op_compressor_mono ; So, for stereo, we square both left & right and add them up
|
||||||
fld st0 ; and return the computed gain two times, ready for MULP STEREO
|
fld st0 ; and return the computed gain two times, ready for MULP STEREO
|
||||||
ret
|
ret
|
||||||
|
@ -347,15 +347,16 @@ endstruc
|
|||||||
%assign COMPRES_ID CUR_ID
|
%assign COMPRES_ID CUR_ID
|
||||||
%assign CUR_ID CUR_ID + 2
|
%assign CUR_ID CUR_ID + 2
|
||||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_compressor,0),
|
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_compressor,0),
|
||||||
%xdefine NUMPARAMS NUMPARAMS 4,
|
%xdefine NUMPARAMS NUMPARAMS 5,
|
||||||
%endif
|
%endif
|
||||||
%endmacro
|
%endmacro
|
||||||
|
|
||||||
%macro SU_COMPRES 5
|
%macro SU_COMPRES 6
|
||||||
db %2
|
db %2
|
||||||
db %3
|
db %3
|
||||||
db %4
|
db %4
|
||||||
db %5
|
db %5
|
||||||
|
db %6
|
||||||
USE_COMPRES
|
USE_COMPRES
|
||||||
%xdefine CMDS CMDS COMPRES_ID + %1,
|
%xdefine CMDS CMDS COMPRES_ID + %1,
|
||||||
%if %1 == STEREO
|
%if %1 == STEREO
|
||||||
@ -365,12 +366,14 @@ endstruc
|
|||||||
|
|
||||||
%define ATTAC(val) val
|
%define ATTAC(val) val
|
||||||
%define RELEASE(val) val
|
%define RELEASE(val) val
|
||||||
|
%define INVGAIN(val) val
|
||||||
%define THRESHOLD(val) val
|
%define THRESHOLD(val) val
|
||||||
%define RATIO(val) val
|
%define RATIO(val) val
|
||||||
|
|
||||||
struc su_compres_ports
|
struc su_compres_ports
|
||||||
.attack resd 1
|
.attack resd 1
|
||||||
.release resd 1
|
.release resd 1
|
||||||
|
.invgain resd 1
|
||||||
.threshold resd 1
|
.threshold resd 1
|
||||||
.ratio resd 1
|
.ratio resd 1
|
||||||
endstruc
|
endstruc
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -33,7 +33,7 @@ BEGIN_PATCH
|
|||||||
END_INSTRUMENT
|
END_INSTRUMENT
|
||||||
BEGIN_INSTRUMENT VOICES(1) ; Global compressor effect
|
BEGIN_INSTRUMENT VOICES(1) ; Global compressor effect
|
||||||
SU_RECEIVE STEREO
|
SU_RECEIVE STEREO
|
||||||
SU_COMPRES MONO,ATTAC(32),RELEASE(80),THRESHOLD(32),RATIO(64)
|
SU_COMPRES MONO,ATTAC(32),RELEASE(64),INVGAIN(32),THRESHOLD(64),RATIO(96)
|
||||||
SU_MULP MONO
|
SU_MULP MONO
|
||||||
SU_OUT STEREO, GAIN(128)
|
SU_OUT STEREO, GAIN(128)
|
||||||
END_INSTRUMENT
|
END_INSTRUMENT
|
||||||
|
@ -33,7 +33,7 @@ BEGIN_PATCH
|
|||||||
END_INSTRUMENT
|
END_INSTRUMENT
|
||||||
BEGIN_INSTRUMENT VOICES(1) ; Global compressor effect
|
BEGIN_INSTRUMENT VOICES(1) ; Global compressor effect
|
||||||
SU_RECEIVE STEREO
|
SU_RECEIVE STEREO
|
||||||
SU_COMPRES STEREO,ATTAC(32),RELEASE(80),THRESHOLD(32),RATIO(64)
|
SU_COMPRES STEREO,ATTAC(32),RELEASE(64),INVGAIN(32),THRESHOLD(64),RATIO(96)
|
||||||
SU_MULP STEREO
|
SU_MULP STEREO
|
||||||
SU_OUT STEREO, GAIN(128)
|
SU_OUT STEREO, GAIN(128)
|
||||||
END_INSTRUMENT
|
END_INSTRUMENT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user