mirror of
https://github.com/vsariola/sointu.git
synced 2025-09-10 07:15:56 -04:00
Remove trailing spaces and convert tabs to spaces.
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
; Various compile time definitions exported
|
||||
; Various compile time definitions exported
|
||||
SECT_DATA(introscn)
|
||||
|
||||
%ifdef SU_USE_16BIT_OUTPUT
|
||||
EXPORT MANGLE_DATA(su_use_16bit_output) dd 1
|
||||
EXPORT MANGLE_DATA(su_use_16bit_output) dd 1
|
||||
%else
|
||||
EXPORT MANGLE_DATA(su_use_16bit_output) dd 0
|
||||
EXPORT MANGLE_DATA(su_use_16bit_output) dd 0
|
||||
%endif
|
||||
|
||||
%ifdef MAX_SAMPLES
|
||||
EXPORT MANGLE_DATA(su_max_samples) dd MAX_SAMPLES
|
||||
%endif
|
||||
EXPORT MANGLE_DATA(su_max_samples) dd MAX_SAMPLES
|
||||
%endif
|
||||
|
@ -152,4 +152,4 @@ su_op_xch_mono:
|
||||
fxch st0, st1
|
||||
ret
|
||||
|
||||
%endif
|
||||
%endif
|
||||
|
@ -3,18 +3,18 @@
|
||||
;-------------------------------------------------------------------------------
|
||||
%assign ADDP_ID -1
|
||||
%macro USE_ADDP 0
|
||||
%if ADDP_ID == -1
|
||||
%assign ADDP_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_addp,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%if ADDP_ID == -1
|
||||
%assign ADDP_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_addp,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_ADDP 1
|
||||
USE_ADDP
|
||||
%xdefine CMDS CMDS ADDP_ID + %1,
|
||||
%if %1 == STEREO
|
||||
USE_ADDP
|
||||
%xdefine CMDS CMDS ADDP_ID + %1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_ADDP
|
||||
%endif
|
||||
%endmacro
|
||||
@ -24,19 +24,19 @@
|
||||
;-------------------------------------------------------------------------------
|
||||
%assign ADD_ID -1
|
||||
%macro USE_ADD 0
|
||||
%if ADD_ID == -1
|
||||
%assign ADD_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_add,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%if ADD_ID == -1
|
||||
%assign ADD_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_add,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%assign ADD_ID -1
|
||||
%macro SU_ADD 1
|
||||
USE_ADD
|
||||
%xdefine CMDS CMDS ADD_ID + %1,
|
||||
%if %1 == STEREO
|
||||
USE_ADD
|
||||
%xdefine CMDS CMDS ADD_ID + %1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_ADD
|
||||
%endif
|
||||
%endmacro
|
||||
@ -46,18 +46,18 @@
|
||||
;-------------------------------------------------------------------------------
|
||||
%assign POP_ID -1
|
||||
%macro USE_POP 0
|
||||
%if POP_ID == -1
|
||||
%assign POP_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_pop,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%if POP_ID == -1
|
||||
%assign POP_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_pop,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_POP 1
|
||||
USE_POP
|
||||
%xdefine CMDS CMDS POP_ID + %1,
|
||||
%if %1 == STEREO
|
||||
USE_POP
|
||||
%xdefine CMDS CMDS POP_ID + %1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_POP
|
||||
%endif
|
||||
%endmacro
|
||||
@ -67,18 +67,18 @@
|
||||
;-------------------------------------------------------------------------------
|
||||
%assign LOADNOTE_ID -1
|
||||
%macro USE_LOADNOTE 0
|
||||
%if LOADNOTE_ID == -1
|
||||
%assign LOADNOTE_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_loadnote,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%if LOADNOTE_ID == -1
|
||||
%assign LOADNOTE_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_loadnote,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_LOADNOTE 1
|
||||
USE_LOADNOTE
|
||||
%xdefine CMDS CMDS LOADNOTE_ID + %1,
|
||||
%if %1 == STEREO
|
||||
USE_LOADNOTE
|
||||
%xdefine CMDS CMDS LOADNOTE_ID + %1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_LOADNOTE
|
||||
%endif
|
||||
%endmacro
|
||||
@ -88,18 +88,18 @@
|
||||
;-------------------------------------------------------------------------------
|
||||
%assign MUL_ID -1
|
||||
%macro USE_MUL 0
|
||||
%if MUL_ID == -1
|
||||
%assign MUL_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_mul,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%if MUL_ID == -1
|
||||
%assign MUL_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_mul,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_MUL 1
|
||||
USE_MUL
|
||||
%xdefine CMDS CMDS MUL_ID + %1,
|
||||
%if %1 == STEREO
|
||||
USE_MUL
|
||||
%xdefine CMDS CMDS MUL_ID + %1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_MUL
|
||||
%endif
|
||||
%endmacro
|
||||
@ -109,18 +109,18 @@
|
||||
;-------------------------------------------------------------------------------
|
||||
%assign MULP_ID -1
|
||||
%macro USE_MULP 0
|
||||
%if MULP_ID == -1
|
||||
%assign MULP_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_mulp,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%if MULP_ID == -1
|
||||
%assign MULP_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_mulp,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_MULP 1
|
||||
USE_MULP
|
||||
%xdefine CMDS CMDS MULP_ID + %1,
|
||||
%if %1 == STEREO
|
||||
USE_MULP
|
||||
%xdefine CMDS CMDS MULP_ID + %1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_MULP
|
||||
%endif
|
||||
%endmacro
|
||||
@ -130,18 +130,18 @@
|
||||
;-------------------------------------------------------------------------------
|
||||
%assign PUSH_ID -1
|
||||
%macro USE_PUSH 0
|
||||
%if PUSH_ID == -1
|
||||
%assign PUSH_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_push,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%if PUSH_ID == -1
|
||||
%assign PUSH_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_push,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_PUSH 1
|
||||
USE_PUSH
|
||||
%xdefine CMDS CMDS PUSH_ID + %1,
|
||||
%if %1 == STEREO
|
||||
USE_PUSH
|
||||
%xdefine CMDS CMDS PUSH_ID + %1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_PUSH
|
||||
%endif
|
||||
%endmacro
|
||||
@ -151,18 +151,18 @@
|
||||
;-------------------------------------------------------------------------------
|
||||
%assign XCH_ID -1
|
||||
%macro USE_XCH 0
|
||||
%if XCH_ID == -1
|
||||
%assign XCH_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_xch,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%if XCH_ID == -1
|
||||
%assign XCH_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_xch,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 0,
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_XCH 1
|
||||
USE_XCH
|
||||
%xdefine CMDS CMDS XCH_ID + %1,
|
||||
%if %1 == STEREO
|
||||
USE_XCH
|
||||
%xdefine CMDS CMDS XCH_ID + %1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_XCH
|
||||
%endif
|
||||
%endmacro
|
||||
|
@ -57,24 +57,24 @@ EXPORT MANGLE_FUNC(su_op_hold,0)
|
||||
%define INCLUDE_STEREO_FILTERHELPER
|
||||
su_op_hold_mono:
|
||||
%endif
|
||||
fld dword [edx+su_hold_ports.freq] ; f x
|
||||
fmul st0, st0 ; f^2 x
|
||||
fld dword [edx+su_hold_ports.freq] ; f x
|
||||
fmul st0, st0 ; f^2 x
|
||||
fchs ; -f^2 x
|
||||
fadd dword [WRK+su_hold_wrk.phase] ; p-f^2 x
|
||||
fst dword [WRK+su_hold_wrk.phase] ; p <- p-f^2
|
||||
fldz ; 0 p x
|
||||
fucomip st1 ; p x
|
||||
fstp dword [esp-4] ; t=p, x
|
||||
jc short su_op_hold_holding ; if (0 < p) goto holding
|
||||
fld1 ; 1 x
|
||||
fadd dword [esp-4] ; 1+t x
|
||||
fstp dword [WRK+su_hold_wrk.phase] ; x
|
||||
fst dword [WRK+su_hold_wrk.holdval] ; save holded value
|
||||
ret ; x
|
||||
fadd dword [WRK+su_hold_wrk.phase] ; p-f^2 x
|
||||
fst dword [WRK+su_hold_wrk.phase] ; p <- p-f^2
|
||||
fldz ; 0 p x
|
||||
fucomip st1 ; p x
|
||||
fstp dword [esp-4] ; t=p, x
|
||||
jc short su_op_hold_holding ; if (0 < p) goto holding
|
||||
fld1 ; 1 x
|
||||
fadd dword [esp-4] ; 1+t x
|
||||
fstp dword [WRK+su_hold_wrk.phase] ; x
|
||||
fst dword [WRK+su_hold_wrk.holdval] ; save holded value
|
||||
ret ; x
|
||||
su_op_hold_holding:
|
||||
fstp st0 ;
|
||||
fld dword [WRK+su_hold_wrk.holdval] ; x
|
||||
ret
|
||||
fstp st0 ;
|
||||
fld dword [WRK+su_hold_wrk.holdval] ; x
|
||||
ret
|
||||
|
||||
%endif ; HOLD_ID > -1
|
||||
|
||||
@ -117,31 +117,31 @@ su_op_filter_mono:
|
||||
%ifdef INCLUDE_LOWPASS
|
||||
test al, byte LOWPASS
|
||||
jz short su_op_filter_skiplowpass
|
||||
fadd dword [WRK+su_filter_wrk.low]
|
||||
fadd dword [WRK+su_filter_wrk.low]
|
||||
su_op_filter_skiplowpass:
|
||||
%endif
|
||||
%ifdef INCLUDE_BANDPASS
|
||||
test al, byte BANDPASS
|
||||
jz short su_op_filter_skipbandpass
|
||||
fadd dword [WRK+su_filter_wrk.band]
|
||||
fadd dword [WRK+su_filter_wrk.band]
|
||||
su_op_filter_skipbandpass:
|
||||
%endif
|
||||
%ifdef INCLUDE_HIGHPASS
|
||||
test al, byte HIGHPASS
|
||||
jz short su_op_filter_skiphighpass
|
||||
fadd dword [WRK+su_filter_wrk.high]
|
||||
fadd dword [WRK+su_filter_wrk.high]
|
||||
su_op_filter_skiphighpass:
|
||||
%endif
|
||||
%ifdef INCLUDE_NEGBANDPASS
|
||||
test al, byte NEGBANDPASS
|
||||
jz short su_op_filter_skipnegbandpass
|
||||
fsub dword [WRK+su_filter_wrk.band]
|
||||
fsub dword [WRK+su_filter_wrk.band]
|
||||
su_op_filter_skipnegbandpass:
|
||||
%endif
|
||||
%ifdef INCLUDE_NEGHIGHPASS
|
||||
test al, byte NEGHIGHPASS
|
||||
jz short su_op_filter_skipneghighpass
|
||||
fsub dword [WRK+su_filter_wrk.high]
|
||||
fsub dword [WRK+su_filter_wrk.high]
|
||||
su_op_filter_skipneghighpass:
|
||||
%endif
|
||||
ret
|
||||
@ -250,8 +250,8 @@ su_stereo_filterhelper:
|
||||
|
||||
SECT_TEXT(sudelay)
|
||||
|
||||
EXPORT MANGLE_FUNC(su_op_delay,0)
|
||||
lodsb ; eax = delay index
|
||||
EXPORT MANGLE_FUNC(su_op_delay,0)
|
||||
lodsb ; eax = delay index
|
||||
mov edi, eax
|
||||
lodsb ; eax = delay count
|
||||
%ifdef INCLUDE_STEREO_DELAY
|
||||
@ -262,7 +262,7 @@ EXPORT MANGLE_FUNC(su_op_delay,0)
|
||||
add edi, eax ; the second delay is done with the delay time index added by count
|
||||
su_op_delay_mono:
|
||||
%endif
|
||||
pushad
|
||||
pushad
|
||||
mov ebx, edi; ugly register juggling, refactor
|
||||
%ifdef DELAY_NOTE_SYNC
|
||||
test ebx, ebx ; note s
|
||||
@ -276,8 +276,8 @@ su_op_delay_mono:
|
||||
fistp word [MANGLE_DATA(su_delay_times)] ; store current comb size
|
||||
su_op_delay_skipnotesync:
|
||||
%endif
|
||||
kmDLL_func_process:
|
||||
mov ecx, eax ;// ecx is the number of parallel delays
|
||||
kmDLL_func_process:
|
||||
mov ecx, eax ;// ecx is the number of parallel delays
|
||||
mov WRK, dword [MANGLE_DATA(su_delay_buffer_ofs)] ;// ebp is current delay
|
||||
fld st0 ; x x
|
||||
fmul dword [edx+su_delay_ports.dry] ; dr*x x
|
||||
@ -304,7 +304,7 @@ kmDLL_func_loop:
|
||||
fmul dword [WRK+su_delayline_wrk.filtstate] ; o*da s*(1-da) p^2*x dr*x+s, where o is stored
|
||||
faddp st1, st0 ; o*da+s*(1-da) p^2*x dr*x+s
|
||||
fst dword [WRK+su_delayline_wrk.filtstate] ; o'=o*da+s*(1-da), o' p^2*x dr*x+s
|
||||
fmul dword [edx+su_delay_ports.feedback] ; f*o' p^2*x dr*x+s
|
||||
fmul dword [edx+su_delay_ports.feedback] ; f*o' p^2*x dr*x+s
|
||||
fadd st0, st1 ; f*o'+p^2*x p^2*x dr*x+s
|
||||
fstp dword [WRK+edi*4+su_delayline_wrk.buffer]; save f*o'+p^2*x to delay buffer
|
||||
inc ebx ;// go to next delay lenkmh index
|
||||
@ -313,15 +313,15 @@ kmDLL_func_loop:
|
||||
loopne kmDLL_func_loop
|
||||
fstp st0 ; dr*x+s1+s2+s3+...
|
||||
; DC-filtering
|
||||
sub WRK, su_delayline_wrk.size ; the reason to use the last su_delayline_wrk instead of su_delay_wrk is that su_delay_wrk is wiped by retriggering
|
||||
sub WRK, su_delayline_wrk.size ; the reason to use the last su_delayline_wrk instead of su_delay_wrk is that su_delay_wrk is wiped by retriggering
|
||||
fld dword [WRK+su_delayline_wrk.dcout] ; o s
|
||||
fmul dword [c_dc_const] ; c*o s
|
||||
fsub dword [WRK+su_delayline_wrk.dcin] ; c*o-i s
|
||||
fxch ; s c*o-i
|
||||
fst dword [WRK+su_delayline_wrk.dcin] ; i'=s, s c*o-i
|
||||
faddp st1 ; s+c*o-i
|
||||
fadd dword [c_0_5] ;// add and sub small offset to prevent denormalization
|
||||
fsub dword [c_0_5]
|
||||
faddp st1 ; s+c*o-i
|
||||
fadd dword [c_0_5] ;// add and sub small offset to prevent denormalization
|
||||
fsub dword [c_0_5]
|
||||
fst dword [WRK+su_delayline_wrk.dcout] ; o'=s+c*o-i
|
||||
popad
|
||||
ret
|
||||
@ -344,8 +344,8 @@ SECT_DATA(suconst)
|
||||
%endif
|
||||
|
||||
%ifndef C_FREQ_NORMALIZE
|
||||
c_freq_normalize dd 0.000092696138 ; // 220.0/(2^(69/12)) / 44100.0
|
||||
c_freq_normalize dd 0.000092696138 ; // 220.0/(2^(69/12)) / 44100.0
|
||||
%define C_FREQ_NORMALIZE
|
||||
%endif
|
||||
|
||||
%endif ; DELAY_ID > -1
|
||||
%endif ; DELAY_ID > -1
|
||||
|
@ -12,15 +12,15 @@
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%define LOWPASS 0x40
|
||||
%define BANDPASS 0x20
|
||||
%define HIGHPASS 0x10
|
||||
%define NEGBANDPASS 0x08
|
||||
%define NEGHIGHPASS 0x04
|
||||
%define LOWPASS 0x40
|
||||
%define BANDPASS 0x20
|
||||
%define HIGHPASS 0x10
|
||||
%define NEGBANDPASS 0x08
|
||||
%define NEGHIGHPASS 0x04
|
||||
|
||||
%macro SU_FILTER 4
|
||||
db %2
|
||||
db %3
|
||||
%macro SU_FILTER 4
|
||||
db %2
|
||||
db %3
|
||||
db %4
|
||||
USE_FILTER
|
||||
%xdefine CMDS CMDS FILTER_ID + %1,
|
||||
@ -44,20 +44,20 @@
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%define FREQUENCY(val) val
|
||||
%define RESONANCE(val) val
|
||||
%define FLAGS(val) val
|
||||
%define FREQUENCY(val) val
|
||||
%define RESONANCE(val) val
|
||||
%define FLAGS(val) val
|
||||
|
||||
struc su_filter_ports
|
||||
.freq resd 1
|
||||
.res resd 1
|
||||
.params
|
||||
struc su_filter_ports
|
||||
.freq resd 1
|
||||
.res resd 1
|
||||
.params
|
||||
endstruc
|
||||
|
||||
struc su_filter_wrk
|
||||
.low resd 1
|
||||
.high resd 1
|
||||
.band resd 1
|
||||
struc su_filter_wrk
|
||||
.low resd 1
|
||||
.high resd 1
|
||||
.band resd 1
|
||||
.size
|
||||
endstruc
|
||||
|
||||
@ -75,8 +75,8 @@ endstruc
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_PAN 2
|
||||
db %2
|
||||
%macro SU_PAN 2
|
||||
db %2
|
||||
USE_PAN
|
||||
%xdefine CMDS CMDS PAN_ID + %1,
|
||||
%if %1 == STEREO
|
||||
@ -84,10 +84,10 @@ endstruc
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%define PANNING(val) val
|
||||
%define PANNING(val) val
|
||||
|
||||
struc su_pan_ports
|
||||
.panning resd 1
|
||||
struc su_pan_ports
|
||||
.panning resd 1
|
||||
.params
|
||||
endstruc
|
||||
|
||||
@ -106,7 +106,7 @@ endstruc
|
||||
%endmacro
|
||||
|
||||
%macro SU_DISTORT 2
|
||||
db %2
|
||||
db %2
|
||||
USE_DISTORT
|
||||
%xdefine CMDS CMDS DISTORT_ID + %1,
|
||||
%if %1 == STEREO
|
||||
@ -114,10 +114,10 @@ endstruc
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%define DRIVE(val) val
|
||||
%define DRIVE(val) val
|
||||
|
||||
struc su_distort_ports
|
||||
.drive resd 1
|
||||
struc su_distort_ports
|
||||
.drive resd 1
|
||||
.params
|
||||
endstruc
|
||||
|
||||
@ -136,7 +136,7 @@ endstruc
|
||||
%endmacro
|
||||
|
||||
%macro SU_HOLD 2
|
||||
db %2
|
||||
db %2
|
||||
USE_HOLD
|
||||
%xdefine CMDS CMDS HOLD_ID + %1,
|
||||
%if %1 == STEREO
|
||||
@ -144,15 +144,15 @@ endstruc
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%define HOLDFREQ(val) val
|
||||
%define HOLDFREQ(val) val
|
||||
|
||||
struc su_hold_ports
|
||||
.freq resd 1
|
||||
.freq resd 1
|
||||
.params
|
||||
endstruc
|
||||
|
||||
struc su_hold_wrk
|
||||
.phase resd 1
|
||||
.phase resd 1
|
||||
.holdval resd 1
|
||||
endstruc
|
||||
|
||||
@ -194,13 +194,13 @@ endstruc
|
||||
%define MAX_DELAY 65536
|
||||
%assign NUM_DELAY_LINES 0
|
||||
|
||||
%macro SU_DELAY 7
|
||||
db %2
|
||||
db %3
|
||||
db %4
|
||||
db %5
|
||||
db %6
|
||||
db %7
|
||||
%macro SU_DELAY 7
|
||||
db %2
|
||||
db %3
|
||||
db %4
|
||||
db %5
|
||||
db %6
|
||||
db %7
|
||||
USE_DELAY
|
||||
%xdefine CMDS CMDS DELAY_ID + %1,
|
||||
%assign NUM_DELAY_LINES NUM_DELAY_LINES + %7 * (1+%1)
|
||||
@ -214,9 +214,9 @@ endstruc
|
||||
|
||||
%macro SU_BEGIN_DELTIMES 0
|
||||
SECT_DATA(sudeltim)
|
||||
|
||||
|
||||
EXPORT MANGLE_DATA(su_delay_times)
|
||||
dw 0
|
||||
dw 0
|
||||
%endmacro
|
||||
|
||||
%define SU_END_DELTIMES
|
||||
@ -224,33 +224,33 @@ endstruc
|
||||
%macro DELTIME 1-*
|
||||
%rep %0
|
||||
dw %1
|
||||
%rotate 1
|
||||
%rotate 1
|
||||
%endrep
|
||||
%endmacro
|
||||
|
||||
|
||||
%define PREGAIN(val) val
|
||||
%define DRY(val) val
|
||||
%define FEEDBACK(val) val
|
||||
%define DEPTH(val) val
|
||||
%define DAMP(val) val
|
||||
%define DELAY(val) val
|
||||
%define COUNT(val) val
|
||||
|
||||
struc su_delay_ports
|
||||
.pregain resd 1
|
||||
.dry resd 1
|
||||
.feedback resd 1
|
||||
.damp resd 1
|
||||
.freq resd 1
|
||||
.ports
|
||||
%define PREGAIN(val) val
|
||||
%define DRY(val) val
|
||||
%define FEEDBACK(val) val
|
||||
%define DEPTH(val) val
|
||||
%define DAMP(val) val
|
||||
%define DELAY(val) val
|
||||
%define COUNT(val) val
|
||||
|
||||
struc su_delay_ports
|
||||
.pregain resd 1
|
||||
.dry resd 1
|
||||
.feedback resd 1
|
||||
.damp resd 1
|
||||
.freq resd 1
|
||||
.ports
|
||||
endstruc
|
||||
|
||||
struc su_delayline_wrk
|
||||
struc su_delayline_wrk
|
||||
.time resd 1
|
||||
.filtstate resd 1
|
||||
.filtstate resd 1
|
||||
.dcin resd 1
|
||||
.dcout resd 1
|
||||
.buffer resd MAX_DELAY
|
||||
.buffer resd MAX_DELAY
|
||||
.size
|
||||
endstruc
|
||||
|
@ -7,7 +7,7 @@
|
||||
; valptr : pointer to the first unit's value of current voice
|
||||
; comptr : pointer to the first command of current voice
|
||||
; COM : pointer to the command after current command
|
||||
; Output: WRK : pointer to the next unit to be processed
|
||||
; Output: WRK : pointer to the next unit to be processed
|
||||
; VAL : pointer to the values of the next to be processed
|
||||
; COM : pointer to the next command to be executed
|
||||
;
|
||||
@ -20,7 +20,7 @@ SECT_TEXT(suopadvn)
|
||||
|
||||
%ifdef INCLUDE_POLYPHONY
|
||||
|
||||
EXPORT MANGLE_FUNC(su_op_advance,0) ; Stack: addr voice wrkptr valptr comptr
|
||||
EXPORT MANGLE_FUNC(su_op_advance,0) ; Stack: addr voice wrkptr valptr comptr
|
||||
mov WRK, dword [esp+8] ; WRK = wrkptr
|
||||
add WRK, su_voice.size ; move to next voice
|
||||
mov dword [esp+8], WRK ; update stack
|
||||
@ -40,7 +40,7 @@ su_op_advance_finish:
|
||||
|
||||
%else
|
||||
|
||||
EXPORT MANGLE_FUNC(su_op_advance,0) ; Stack: addr voice wrkptr valptr comptr
|
||||
EXPORT MANGLE_FUNC(su_op_advance,0) ; Stack: addr voice wrkptr valptr comptr
|
||||
mov WRK, dword [esp+8] ; WRK = wrkptr
|
||||
add WRK, su_voice.size ; move to next voice
|
||||
mov dword [esp+8], WRK ; update stack
|
||||
@ -60,4 +60,4 @@ c_dc_const dd 0.99609375 ; R = 1 - (pi*2 * frequency /sam
|
||||
%define C_DC_CONST
|
||||
%endif
|
||||
|
||||
%endif
|
||||
%endif
|
||||
|
@ -12,7 +12,7 @@ EXPORT MANGLE_FUNC(su_op_out,0) ; l r
|
||||
call su_op_out_mono
|
||||
add eax, 4
|
||||
su_op_out_mono:
|
||||
%endif
|
||||
%endif
|
||||
fmul dword [edx+su_out_ports.gain] ; g*l
|
||||
fadd dword [eax] ; g*l+o
|
||||
fstp dword [eax] ; o'=g*l+o
|
||||
@ -47,7 +47,7 @@ EXPORT MANGLE_FUNC(su_op_send,0)
|
||||
jnz su_op_send_mono
|
||||
fxch ; swap them back: l r
|
||||
su_op_send_mono:
|
||||
%endif
|
||||
%endif
|
||||
%ifdef INCLUDE_GLOBAL_SEND
|
||||
test eax, SEND_GLOBAL
|
||||
jz su_op_send_skipglobal
|
||||
@ -55,7 +55,7 @@ su_op_send_mono:
|
||||
su_op_send_skipglobal:
|
||||
%endif
|
||||
test eax, SEND_POP ; if the SEND_POP bit is not set
|
||||
jnz su_op_send_skippush
|
||||
jnz su_op_send_skippush
|
||||
fld st0 ; duplicate the signal on stack: s s
|
||||
su_op_send_skippush: ; there is signal s, but maybe also another: s (s)
|
||||
fld dword [edx+su_send_ports.amount] ; a l (l)
|
||||
@ -67,4 +67,4 @@ su_op_send_skippush: ; there is signal s, but maybe also another: s (
|
||||
fstp dword [ecx+su_unit.size+eax*4] ; (l)
|
||||
ret
|
||||
|
||||
%endif ; SU_USE_SEND > -1
|
||||
%endif ; SU_USE_SEND > -1
|
||||
|
@ -4,26 +4,26 @@
|
||||
%assign OUT_ID -1
|
||||
%macro USE_OUT 0
|
||||
%if OUT_ID == -1
|
||||
%assign OUT_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_out,0),
|
||||
%assign OUT_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_out,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 1,
|
||||
%endif
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_OUT 2
|
||||
db %2
|
||||
%macro SU_OUT 2
|
||||
db %2
|
||||
USE_OUT
|
||||
%xdefine CMDS CMDS OUT_ID+%1,
|
||||
%xdefine CMDS CMDS OUT_ID+%1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_OUT
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%define GAIN(val) val
|
||||
%define GAIN(val) val
|
||||
|
||||
struc su_out_ports
|
||||
.gain resd 1
|
||||
struc su_out_ports
|
||||
.gain resd 1
|
||||
.params
|
||||
endstruc
|
||||
|
||||
@ -33,34 +33,34 @@ endstruc
|
||||
%assign SEND_ID -1
|
||||
%macro USE_SEND 0
|
||||
%if SEND_ID == -1
|
||||
%assign SEND_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_send,0),
|
||||
%assign SEND_ID CUR_ID
|
||||
%assign CUR_ID CUR_ID + 2
|
||||
%xdefine OPCODES OPCODES MANGLE_FUNC(su_op_send,0),
|
||||
%xdefine NUMPARAMS NUMPARAMS 1,
|
||||
%endif
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_SEND 3
|
||||
db %2
|
||||
dw %3
|
||||
%macro SU_SEND 3
|
||||
db %2
|
||||
dw %3
|
||||
USE_SEND
|
||||
%xdefine CMDS CMDS SEND_ID + %1,
|
||||
%xdefine CMDS CMDS SEND_ID + %1,
|
||||
%if %1 == STEREO
|
||||
%define INCLUDE_STEREO_SEND
|
||||
%endif
|
||||
%if (%3) & SEND_GLOBAL == SEND_GLOBAL
|
||||
%define INCLUDE_GLOBAL_SEND
|
||||
%endif
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%define AMOUNT(val) val
|
||||
%define PORT(unit,unittype,port) (unit*su_unit.size + su_ %+ unittype %+ _ports. %+ port + su_unit.ports)/4
|
||||
%define GLOBALPORT(voice,unit,unittype,port) SEND_GLOBAL + (su_synth.voices+voice*su_voice.size+su_voice.workspace+unit*su_unit.size + su_ %+ unittype %+ _ports. %+ port + su_unit.ports)/4
|
||||
%define OUTPORT 0
|
||||
%define SEND_POP 0x8000
|
||||
%define SEND_GLOBAL 0x4000
|
||||
%define AMOUNT(val) val
|
||||
%define PORT(unit,unittype,port) (unit*su_unit.size + su_ %+ unittype %+ _ports. %+ port + su_unit.ports)/4
|
||||
%define GLOBALPORT(voice,unit,unittype,port) SEND_GLOBAL + (su_synth.voices+voice*su_voice.size+su_voice.workspace+unit*su_unit.size + su_ %+ unittype %+ _ports. %+ port + su_unit.ports)/4
|
||||
%define OUTPORT 0
|
||||
%define SEND_POP 0x8000
|
||||
%define SEND_GLOBAL 0x4000
|
||||
|
||||
struc su_send_ports
|
||||
.amount resd 1
|
||||
struc su_send_ports
|
||||
.amount resd 1
|
||||
.params
|
||||
endstruc
|
||||
|
@ -21,7 +21,7 @@ EXPORT MANGLE_FUNC(su_op_envelope,0)
|
||||
ret
|
||||
su_op_envelope_mono:
|
||||
%endif
|
||||
kmENV_func_do:
|
||||
kmENV_func_do:
|
||||
mov eax, dword [ecx+su_unit.size-su_voice.workspace+su_voice.release] ; eax = su_instrument.release
|
||||
test eax, eax ; if (eax == 0)
|
||||
je kmENV_func_process ; goto process
|
||||
@ -83,7 +83,7 @@ EXPORT MANGLE_FUNC(su_op_noise,0)
|
||||
call dword [esp]
|
||||
su_op_noise_mono:
|
||||
%endif
|
||||
call MANGLE_FUNC(FloatRandomNumber,0)
|
||||
call MANGLE_FUNC(FloatRandomNumber,0)
|
||||
fld dword [edx+su_noise_ports.shape]
|
||||
call su_waveshaper
|
||||
fld dword [edx+su_noise_ports.gain]
|
||||
@ -136,12 +136,12 @@ su_op_oscillat_normalize_note:
|
||||
su_op_oscillat_normalized:
|
||||
fadd dword [WRK+su_osc_wrk.phase]
|
||||
fst dword [WRK+su_osc_wrk.phase]
|
||||
fadd dword [edx+su_osc_ports.phaseofs]
|
||||
fld1
|
||||
fadd st1, st0
|
||||
fxch
|
||||
fprem
|
||||
fstp st1
|
||||
fadd dword [edx+su_osc_ports.phaseofs]
|
||||
fld1
|
||||
fadd st1, st0
|
||||
fxch
|
||||
fprem
|
||||
fstp st1
|
||||
fld dword [edx+su_osc_ports.color] ; // c p
|
||||
; every oscillator test included if needed
|
||||
%ifdef INCLUDE_SINE
|
||||
@ -181,7 +181,7 @@ su_op_oscillat_gain:
|
||||
SECT_DATA(suconst)
|
||||
|
||||
%ifndef C_FREQ_NORMALIZE
|
||||
c_freq_normalize dd 0.000092696138 ; // 220.0/(2^(69/12)) / 44100.0
|
||||
c_freq_normalize dd 0.000092696138 ; // 220.0/(2^(69/12)) / 44100.0
|
||||
%define C_FREQ_NORMALIZE
|
||||
%endif
|
||||
c_lfo_normalize dd 0.000038
|
||||
@ -268,7 +268,7 @@ go4kVCO_gate_bit: ; stack: 0/1, let's call it x
|
||||
fmul dword [c_dc_const] ; c(g-x) x
|
||||
faddp st1, st0 ; x+c(g-x)
|
||||
fst dword [WRK+su_osc_wrk.gatestate] ; g'=x+c(g-x)
|
||||
pop eax ; Another way to see this (c~0.996)
|
||||
pop eax ; Another way to see this (c~0.996)
|
||||
ret ; g'=cg+(1-c)x
|
||||
; This is a low-pass to smooth the gate transitions
|
||||
|
||||
@ -284,7 +284,7 @@ SECT_DATA(suconst)
|
||||
%define C_DC_CONST
|
||||
%endif
|
||||
|
||||
%endif
|
||||
%endif
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; LOAD_VAL opcode
|
||||
@ -300,8 +300,8 @@ SECT_TEXT(suloadvl)
|
||||
|
||||
EXPORT MANGLE_FUNC(su_op_load_val,0)
|
||||
%ifdef INCLUDE_STEREO_LOAD_VAL
|
||||
jnc su_op_load_val_mono
|
||||
call su_load_val_mono
|
||||
jnc su_op_load_val_mono
|
||||
call su_load_val_mono
|
||||
su_load_val_mono:
|
||||
%endif
|
||||
fld dword [edx+su_load_val_ports.value] ; v
|
||||
@ -309,4 +309,4 @@ su_load_val_mono:
|
||||
fadd st0 ; 2*v-1
|
||||
ret
|
||||
|
||||
%endif ; SU_USE_LOAD_VAL
|
||||
%endif ; SU_USE_LOAD_VAL
|
||||
|
@ -12,11 +12,11 @@
|
||||
%endmacro
|
||||
|
||||
%macro SU_ENVELOPE 6
|
||||
db %2
|
||||
db %3
|
||||
db %4
|
||||
db %5
|
||||
db %6
|
||||
db %2
|
||||
db %3
|
||||
db %4
|
||||
db %5
|
||||
db %6
|
||||
USE_ENVELOPE
|
||||
%xdefine CMDS CMDS ENVELOPE_ID+%1,
|
||||
%if %1 == STEREO
|
||||
@ -24,32 +24,32 @@
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%define ATTAC(val) val
|
||||
%define DECAY(val) val
|
||||
%define SUSTAIN(val) val
|
||||
%define RELEASE(val) val
|
||||
%define GAIN(val) val
|
||||
%define ATTAC(val) val
|
||||
%define DECAY(val) val
|
||||
%define SUSTAIN(val) val
|
||||
%define RELEASE(val) val
|
||||
%define GAIN(val) val
|
||||
|
||||
struc su_env_ports
|
||||
.attac resd 1
|
||||
.decay resd 1
|
||||
.sustain resd 1
|
||||
.release resd 1
|
||||
.gain resd 1
|
||||
struc su_env_ports
|
||||
.attac resd 1
|
||||
.decay resd 1
|
||||
.sustain resd 1
|
||||
.release resd 1
|
||||
.gain resd 1
|
||||
.params
|
||||
endstruc
|
||||
|
||||
struc su_env_work
|
||||
.state resd 1
|
||||
.level resd 1
|
||||
struc su_env_work
|
||||
.state resd 1
|
||||
.level resd 1
|
||||
.size
|
||||
endstruc
|
||||
|
||||
%define ENV_STATE_ATTAC 0
|
||||
%define ENV_STATE_DECAY 1
|
||||
%define ENV_STATE_SUSTAIN 2
|
||||
%define ENV_STATE_RELEASE 3
|
||||
%define ENV_STATE_OFF 4
|
||||
%define ENV_STATE_ATTAC 0
|
||||
%define ENV_STATE_DECAY 1
|
||||
%define ENV_STATE_SUSTAIN 2
|
||||
%define ENV_STATE_RELEASE 3
|
||||
%define ENV_STATE_OFF 4
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
; OSCILLAT structs
|
||||
@ -64,18 +64,18 @@ endstruc
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%define SINE 0x40
|
||||
%define TRISAW 0x20
|
||||
%define PULSE 0x10
|
||||
%define LFO 0x08
|
||||
%define GATE 0x04
|
||||
%define SINE 0x40
|
||||
%define TRISAW 0x20
|
||||
%define PULSE 0x10
|
||||
%define LFO 0x08
|
||||
%define GATE 0x04
|
||||
|
||||
%macro SU_OSCILLAT 8
|
||||
db %2
|
||||
db %3
|
||||
db %4
|
||||
db %5
|
||||
db %6
|
||||
%macro SU_OSCILLAT 8
|
||||
db %2
|
||||
db %3
|
||||
db %4
|
||||
db %5
|
||||
db %6
|
||||
db %7
|
||||
db %8
|
||||
USE_OSCILLAT
|
||||
@ -97,29 +97,29 @@ endstruc
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
struc su_osc_ports
|
||||
.transpose resd 1
|
||||
.detune resd 1
|
||||
.phaseofs resd 1
|
||||
.color resd 1
|
||||
.shape resd 1
|
||||
.gain resd 1
|
||||
struc su_osc_ports
|
||||
.transpose resd 1
|
||||
.detune resd 1
|
||||
.phaseofs resd 1
|
||||
.color resd 1
|
||||
.shape resd 1
|
||||
.gain resd 1
|
||||
.params
|
||||
endstruc
|
||||
|
||||
struc su_osc_wrk
|
||||
.phase resd 1
|
||||
struc su_osc_wrk
|
||||
.phase resd 1
|
||||
.gatestate resd 1
|
||||
.size
|
||||
endstruc
|
||||
|
||||
%define TRANSPOSE(val) val
|
||||
%define DETUNE(val) val
|
||||
%define PHASE(val) val
|
||||
%define GATESLOW(val) val
|
||||
%define GATESHIGH(val) val
|
||||
%define COLOR(val) val
|
||||
%define SHAPE(val) val
|
||||
%define TRANSPOSE(val) val
|
||||
%define DETUNE(val) val
|
||||
%define PHASE(val) val
|
||||
%define GATESLOW(val) val
|
||||
%define GATESHIGH(val) val
|
||||
%define COLOR(val) val
|
||||
%define SHAPE(val) val
|
||||
%define FLAGS(val) val
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
@ -135,9 +135,9 @@ endstruc
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_NOISE 3
|
||||
db %2
|
||||
db %3
|
||||
%macro SU_NOISE 3
|
||||
db %2
|
||||
db %3
|
||||
USE_NOISE
|
||||
%xdefine CMDS CMDS NOISE_ID + %1,
|
||||
%if %1 == STEREO
|
||||
@ -145,9 +145,9 @@ endstruc
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
struc su_noise_ports
|
||||
.shape resd 1
|
||||
.gain resd 1
|
||||
struc su_noise_ports
|
||||
.shape resd 1
|
||||
.gain resd 1
|
||||
.params
|
||||
endstruc
|
||||
|
||||
@ -164,8 +164,8 @@ endstruc
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%macro SU_LOAD_VAL 2
|
||||
db %2
|
||||
%macro SU_LOAD_VAL 2
|
||||
db %2
|
||||
USE_LOAD_VAL
|
||||
%xdefine CMDS CMDS LOAD_VAL_ID+%1,
|
||||
%if %1 == STEREO
|
||||
@ -173,13 +173,13 @@ endstruc
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%define VALUE(val) val
|
||||
%define VALUE(val) val
|
||||
|
||||
struc su_load_val_ports
|
||||
.value resd 1
|
||||
struc su_load_val_ports
|
||||
.value resd 1
|
||||
.params
|
||||
endstruc
|
||||
|
||||
struc su_load_val_wrk
|
||||
struc su_load_val_wrk
|
||||
.size
|
||||
endstruc
|
||||
endstruc
|
||||
|
@ -32,18 +32,18 @@ c_32767 dd 32767.0
|
||||
%macro output_sound 0
|
||||
%ifndef SU_USE_16BIT_OUTPUT
|
||||
%ifndef SU_CLIP_OUTPUT ; The modern way. No need to clip; OS can do it.
|
||||
mov edi, dword [esp+44] ; edi containts ptr
|
||||
mov edi, dword [esp+44] ; edi containts ptr
|
||||
mov esi, su_synth_obj+su_synth.left
|
||||
movsd ; copy left channel to output buffer
|
||||
movsd ; copy right channel to output buffer
|
||||
mov dword [esp+44], edi ; save back the updated ptr
|
||||
lea edi, [esi-8]
|
||||
lea edi, [esi-8]
|
||||
xor eax,eax
|
||||
stosd ; clear left channel so the VM is ready to write them again
|
||||
stosd ; clear right channel so the VM is ready to write them again
|
||||
stosd ; clear right channel so the VM is ready to write them again
|
||||
%else
|
||||
mov esi, dword [esp+44] ; esi points to the output buffer
|
||||
xor ecx,ecx
|
||||
xor ecx,ecx
|
||||
xor eax,eax
|
||||
%%loop: ; loop over two channels, left & right
|
||||
fld dword [su_synth_obj+su_synth.left+ecx*4]
|
||||
@ -63,7 +63,7 @@ c_32767 dd 32767.0
|
||||
fld dword [edi]
|
||||
call MANGLE_FUNC(su_clip_op,0)
|
||||
fmul dword [c_32767]
|
||||
push eax
|
||||
push eax
|
||||
fistp dword [esp]
|
||||
pop eax
|
||||
mov word [esi],ax ; // store integer converted right sample
|
||||
@ -87,7 +87,7 @@ SECT_TEXT(surender)
|
||||
EXPORT MANGLE_FUNC(su_render,4) ; Stack: ptr
|
||||
pushad ; Stack: pushad ptr
|
||||
xor eax, eax ; ecx is the current row
|
||||
su_render_rowloop: ; loop through every row in the song
|
||||
su_render_rowloop: ; loop through every row in the song
|
||||
push eax ; Stack: row pushad ptr
|
||||
call su_update_voices ; update instruments for the new row
|
||||
xor eax, eax ; ecx is the current sample within row
|
||||
@ -97,11 +97,11 @@ su_render_sampleloop: ; loop through every sample in the row
|
||||
output_sound ; *ptr++ = left, *ptr++ = right
|
||||
pop eax ; Stack: row pushad ptr
|
||||
inc eax
|
||||
cmp eax, SAMPLES_PER_ROW
|
||||
cmp eax, SAMPLES_PER_ROW
|
||||
jl su_render_sampleloop
|
||||
pop eax ; Stack: pushad ptr
|
||||
inc eax
|
||||
cmp eax, TOTAL_ROWS
|
||||
cmp eax, TOTAL_ROWS
|
||||
jl su_render_rowloop
|
||||
popad ; Stack: ptr
|
||||
ret 4 ; Stack emptied by ret
|
||||
@ -116,19 +116,19 @@ SECT_TEXT(suupdvce)
|
||||
|
||||
%ifdef INCLUDE_MULTIVOICE_TRACKS
|
||||
|
||||
su_update_voices: ; Stack: retaddr row
|
||||
xor edx, edx
|
||||
mov ebx, PATTERN_SIZE
|
||||
su_update_voices: ; Stack: retaddr row
|
||||
xor edx, edx
|
||||
mov ebx, PATTERN_SIZE
|
||||
div ebx ; eax = current pattern, edx = current row in pattern
|
||||
lea esi, [MANGLE_DATA(su_tracks)+eax] ; esi points to the pattern data for current track
|
||||
lea esi, [MANGLE_DATA(su_tracks)+eax] ; esi points to the pattern data for current track
|
||||
xor eax, eax ; eax is the first voice of next track
|
||||
xor ebx, ebx ; ebx is the first voice of current track
|
||||
xor ebp, ebp ; ebp is the current track being processed
|
||||
su_update_voices_trackloop:
|
||||
movzx eax, byte [esi] ; eax = current pattern
|
||||
xor ebp, ebp ; ebp is the current track being processed
|
||||
su_update_voices_trackloop:
|
||||
movzx eax, byte [esi] ; eax = current pattern
|
||||
imul eax, PATTERN_SIZE ; eax = offset to current pattern data
|
||||
movzx eax, byte [MANGLE_DATA(su_patterns)+eax+edx] ; eax = note
|
||||
push edx ; Stack: ptrnrow
|
||||
movzx eax, byte [MANGLE_DATA(su_patterns)+eax+edx] ; eax = note
|
||||
push edx ; Stack: ptrnrow
|
||||
xor edx, edx ; edx=0
|
||||
mov ecx, ebx ; ecx=first voice of the track to be done
|
||||
su_calculate_voices_loop: ; do {
|
||||
@ -136,66 +136,66 @@ su_calculate_voices_loop: ; do {
|
||||
inc edx ; edx++ // edx=numvoices
|
||||
inc ecx ; ecx++ // ecx=the first voice of next track
|
||||
jc su_calculate_voices_loop ; } while bit ecx-1 of bitmask is on
|
||||
push ecx ; Stack: next_instr ptrnrow
|
||||
push ecx ; Stack: next_instr ptrnrow
|
||||
cmp al, HLD ; anything but hold causes action
|
||||
je short su_update_voices_nexttrack
|
||||
je short su_update_voices_nexttrack
|
||||
mov ecx, dword [su_current_voiceno+ebp*4]
|
||||
mov edi, ecx
|
||||
add edi, ebx
|
||||
imul edi, edi, su_voice.size
|
||||
mov dword [su_synth_obj+su_synth.voices+edi+su_voice.release],1 ; set the voice currently active to release
|
||||
imul edi, edi, su_voice.size
|
||||
mov dword [su_synth_obj+su_synth.voices+edi+su_voice.release],1 ; set the voice currently active to release
|
||||
cmp al, HLD ; if cl < HLD (no new note triggered)
|
||||
jl su_update_voices_nexttrack ; goto nexttrack
|
||||
jl su_update_voices_nexttrack ; goto nexttrack
|
||||
inc ecx ; curvoice++
|
||||
cmp ecx, edx ; if (curvoice >= num_voices)
|
||||
jl su_update_voices_skipreset
|
||||
xor ecx,ecx ; curvoice = 0
|
||||
su_update_voices_skipreset:
|
||||
mov dword [su_current_voiceno+ebp*4],ecx
|
||||
mov dword [su_current_voiceno+ebp*4],ecx
|
||||
add ecx, ebx
|
||||
imul ecx, ecx, su_voice.size
|
||||
imul ecx, ecx, su_voice.size
|
||||
lea edi, [su_synth_obj+su_synth.voices+ecx]
|
||||
stosd ; save note
|
||||
mov ecx, (su_voice.size - su_voice.release)/4
|
||||
xor eax, eax
|
||||
rep stosd ; clear the workspace of the new voice, retriggering oscillators
|
||||
su_update_voices_nexttrack:
|
||||
pop ebx ; ebx=first voice of next instrument, Stack: ptrnrow
|
||||
pop edx ; edx=patrnrow
|
||||
add esi, MAX_PATTERNS
|
||||
inc ebp
|
||||
rep stosd ; clear the workspace of the new voice, retriggering oscillators
|
||||
su_update_voices_nexttrack:
|
||||
pop ebx ; ebx=first voice of next instrument, Stack: ptrnrow
|
||||
pop edx ; edx=patrnrow
|
||||
add esi, MAX_PATTERNS
|
||||
inc ebp
|
||||
cmp ebp, MAX_TRACKS
|
||||
jl short su_update_voices_trackloop
|
||||
ret
|
||||
|
||||
%else ; INCLUDE_MULTIVOICE_TRACKS not defined -> one voice per track version
|
||||
|
||||
su_update_voices: ; Stack: retaddr row
|
||||
xor edx, edx
|
||||
mov ebx, PATTERN_SIZE
|
||||
su_update_voices: ; Stack: retaddr row
|
||||
xor edx, edx
|
||||
mov ebx, PATTERN_SIZE
|
||||
div ebx ; eax = current pattern, edx = current row in pattern
|
||||
lea esi, [MANGLE_DATA(su_tracks)+eax] ; esi points to the pattern data for current track
|
||||
lea esi, [MANGLE_DATA(su_tracks)+eax] ; esi points to the pattern data for current track
|
||||
lea edi, [su_synth_obj+su_synth.voices]
|
||||
mov ebp, MAX_TRACKS
|
||||
su_update_voices_trackloop:
|
||||
movzx eax, byte [esi] ; eax = current pattern
|
||||
su_update_voices_trackloop:
|
||||
movzx eax, byte [esi] ; eax = current pattern
|
||||
imul eax, PATTERN_SIZE ; eax = offset to current pattern data
|
||||
movzx eax, byte [MANGLE_DATA(su_patterns)+eax+edx] ; ecx = note
|
||||
movzx eax, byte [MANGLE_DATA(su_patterns)+eax+edx] ; ecx = note
|
||||
cmp al, HLD ; anything but hold causes action
|
||||
je short su_update_voices_nexttrack
|
||||
mov dword [edi+su_voice.release],1 ; set the voice currently active to release
|
||||
je short su_update_voices_nexttrack
|
||||
mov dword [edi+su_voice.release],1 ; set the voice currently active to release
|
||||
jl su_update_voices_nexttrack ; if cl < HLD (no new note triggered) goto nexttrack
|
||||
su_update_voices_retrigger:
|
||||
su_update_voices_retrigger:
|
||||
stosd ; save note
|
||||
mov ecx, (su_voice.size - su_voice.release)/4
|
||||
xor eax, eax
|
||||
rep stosd ; clear the workspace of the new voice, retriggering oscillators
|
||||
rep stosd ; clear the workspace of the new voice, retriggering oscillators
|
||||
jmp short su_update_voices_skipadd
|
||||
su_update_voices_nexttrack:
|
||||
su_update_voices_nexttrack:
|
||||
add edi, su_voice.size
|
||||
su_update_voices_skipadd:
|
||||
su_update_voices_skipadd:
|
||||
add esi, MAX_PATTERNS
|
||||
dec ebp
|
||||
dec ebp
|
||||
jnz short su_update_voices_trackloop
|
||||
ret
|
||||
|
||||
|
@ -42,7 +42,7 @@ c_i12 dd 0x3DAAAAAA
|
||||
EXPORT MANGLE_DATA(LFO_NORMALIZE)
|
||||
dd DEF_LFO_NORMALIZE
|
||||
|
||||
%ifdef INCLUDE_POLYPHONY
|
||||
%ifdef INCLUDE_POLYPHONY
|
||||
su_polyphony_bitmask dd POLYPHONY_BITMASK ; does the next voice reuse the current opcodes?
|
||||
%endif
|
||||
|
||||
@ -58,7 +58,7 @@ su_polyphony_bitmask dd POLYPHONY_BITMASK ; does the next voice reuse th
|
||||
SECT_TEXT(surunvm)
|
||||
|
||||
EXPORT MANGLE_FUNC(su_run_vm,0)
|
||||
mov COM, MANGLE_DATA(su_commands) ; COM points to vm code
|
||||
mov COM, MANGLE_DATA(su_commands) ; COM points to vm code
|
||||
mov VAL, MANGLE_DATA(su_params) ; VAL points to unit params
|
||||
; su_unit.size will be added back before WRK is used
|
||||
mov WRK, su_synth_obj + su_synth.voices + su_voice.workspace - su_unit.size
|
||||
@ -74,16 +74,16 @@ EXPORT MANGLE_FUNC(su_run_vm,0)
|
||||
su_run_vm_loop: ; loop until all voices done
|
||||
movzx eax, byte [COM] ; eax = command byte
|
||||
inc COM ; move to next instruction
|
||||
add WRK, su_unit.size ; move WRK to next unit
|
||||
push eax
|
||||
add WRK, su_unit.size ; move WRK to next unit
|
||||
push eax
|
||||
shr eax,1
|
||||
mov al,byte [eax+su_opcode_numparams]
|
||||
push eax
|
||||
call su_transform_values
|
||||
call su_transform_values
|
||||
mov ecx, dword [esp+8]
|
||||
pop eax
|
||||
pop eax
|
||||
shr eax,1
|
||||
call dword [eax*4+su_synth_commands] ; call the function corresponding to the instruction
|
||||
call dword [eax*4+su_synth_commands] ; call the function corresponding to the instruction
|
||||
cmp dword [esp],MAX_VOICES ; if (voice < MAX_VOICES)
|
||||
jl su_run_vm_loop ; goto vm_loop
|
||||
add esp, 16 ; Stack cleared
|
||||
@ -186,9 +186,9 @@ EXPORT MANGLE_FUNC(su_power,0)
|
||||
%include "opcodes/flowcontrol.asm"
|
||||
%include "opcodes/sources.asm"
|
||||
%include "opcodes/sinks.asm"
|
||||
; warning: at the moment effects has to be assembled after
|
||||
; warning: at the moment effects has to be assembled after
|
||||
; sources, as sources.asm defines SU_USE_WAVESHAPER
|
||||
; if needed.
|
||||
%include "opcodes/effects.asm"
|
||||
%include "opcodes/effects.asm"
|
||||
%include "player.asm"
|
||||
%include "introspection.asm"
|
||||
%include "introspection.asm"
|
||||
|
124
src/sointu.inc
124
src/sointu.inc
@ -12,25 +12,25 @@
|
||||
|
||||
%macro EXPORT 1
|
||||
global %1
|
||||
%1
|
||||
%endmacro
|
||||
%1
|
||||
%endmacro
|
||||
|
||||
%ifidn __OUTPUT_FORMAT__,win32
|
||||
; on win32, function f with n parameters is mangled as "_f@n"
|
||||
%define MANGLE_FUNC(f,n) _ %+ f %+ @ %+ n
|
||||
%define WIN_OR_MAC
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%ifidn __OUTPUT_FORMAT__,elf32
|
||||
%ifidn __OUTPUT_FORMAT__,elf32
|
||||
; on linux, function f with n parameters is mangled as "f"
|
||||
%define MANGLE_FUNC(f,n) f
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%ifidn __OUTPUT_FORMAT__,macho32
|
||||
; on mac, function f with x parameters is mangled as "_f"
|
||||
%define MANGLE_FUNC(f,n) _f
|
||||
%define WIN_OR_MAC
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%ifdef WIN_OR_MAC
|
||||
; Windows has crinkler so one may USE_SECTIONS to put everything in custom sections to aid crinkler.
|
||||
@ -76,35 +76,35 @@
|
||||
;%define SU_CLIP_OUTPUT ; // removing this skips clipping code for the final output
|
||||
|
||||
%define SU_USE_DST ; // removing this will skip DST unit
|
||||
%define SU_USE_DLL ; // removing this will skip DLL unit
|
||||
%define SU_USE_PAN ; // removing this will skip PAN unit
|
||||
%define SU_USE_GLOBAL_DLL ; // removing this will skip global dll processing
|
||||
%define SU_USE_FSTG ; // removing this will skip global store unit
|
||||
%define SU_USE_FLD ; // removing this will skip float load unit
|
||||
%define SU_USE_GLITCH ; // removing this will skip GLITCH unit
|
||||
%define SU_USE_ENV_CHECK ; // removing this skips checks if processing is needed
|
||||
%define SU_USE_VCO_CHECK ; // removing this skips checks if processing is needed
|
||||
%define SU_USE_VCO_PHASE_OFFSET ; // removing this will skip initial phase offset code
|
||||
%define SU_USE_VCO_SHAPE ; // removing this skips waveshaping code
|
||||
%define SU_USE_VCO_GATE ; // removing this skips gate code
|
||||
%define SU_USE_VCO_MOD_FM ; // removing this skips frequency modulation code
|
||||
%define SU_USE_VCO_MOD_DM ; // removing this skips detune modulation code
|
||||
%define SU_USE_VCO_STEREO ; // removing this skips stereo code
|
||||
%define SU_USE_VCF_CHECK ; // removing this skips checks if processing is needed
|
||||
%define SU_USE_VCF_HIGH ; // removing this skips code for high output
|
||||
%define SU_USE_VCF_BAND ; // removing this skips code for band output
|
||||
%define SU_USE_VCF_PEAK ; // removing this skips code for peak output
|
||||
%define SU_USE_VCF_STEREO ; // removing this skips code for stereo filter output
|
||||
%define SU_USE_DST_CHECK ; // removing this skips checks if processing is needed
|
||||
%define SU_USE_DST_SH ; // removing this skips sample and hold code
|
||||
%define SU_USE_DLL ; // removing this will skip DLL unit
|
||||
%define SU_USE_PAN ; // removing this will skip PAN unit
|
||||
%define SU_USE_GLOBAL_DLL ; // removing this will skip global dll processing
|
||||
%define SU_USE_FSTG ; // removing this will skip global store unit
|
||||
%define SU_USE_FLD ; // removing this will skip float load unit
|
||||
%define SU_USE_GLITCH ; // removing this will skip GLITCH unit
|
||||
%define SU_USE_ENV_CHECK ; // removing this skips checks if processing is needed
|
||||
%define SU_USE_VCO_CHECK ; // removing this skips checks if processing is needed
|
||||
%define SU_USE_VCO_PHASE_OFFSET ; // removing this will skip initial phase offset code
|
||||
%define SU_USE_VCO_SHAPE ; // removing this skips waveshaping code
|
||||
%define SU_USE_VCO_GATE ; // removing this skips gate code
|
||||
%define SU_USE_VCO_MOD_FM ; // removing this skips frequency modulation code
|
||||
%define SU_USE_VCO_MOD_DM ; // removing this skips detune modulation code
|
||||
%define SU_USE_VCO_STEREO ; // removing this skips stereo code
|
||||
%define SU_USE_VCF_CHECK ; // removing this skips checks if processing is needed
|
||||
%define SU_USE_VCF_HIGH ; // removing this skips code for high output
|
||||
%define SU_USE_VCF_BAND ; // removing this skips code for band output
|
||||
%define SU_USE_VCF_PEAK ; // removing this skips code for peak output
|
||||
%define SU_USE_VCF_STEREO ; // removing this skips code for stereo filter output
|
||||
%define SU_USE_DST_CHECK ; // removing this skips checks if processing is needed
|
||||
%define SU_USE_DST_SH ; // removing this skips sample and hold code
|
||||
%define SU_USE_DST_STEREO ; // removing this skips stereo processing
|
||||
%define SU_USE_DLL_NOTE_SYNC ; // removing this will skip delay length adjusting code (karplus strong)
|
||||
%define SU_USE_DLL_CHORUS ; // removing this will skip delay chorus/flanger code
|
||||
%define SU_USE_DLL_NOTE_SYNC ; // removing this will skip delay length adjusting code (karplus strong)
|
||||
%define SU_USE_DLL_CHORUS ; // removing this will skip delay chorus/flanger code
|
||||
%define SU_USE_DLL_CHORUS_CLAMP ; // removing this will skip chorus lfo phase clamping
|
||||
%define SU_USE_DLL_DAMP ; // removing this will skip dll damping code
|
||||
%define SU_USE_DLL_DC_FILTER ; // removing this will skip dll dc offset removal code
|
||||
%define SU_USE_FSTG_CHECK ; // removing this skips checks if processing is needed
|
||||
%define SU_USE_WAVESHAPER_CLIP ; // removing this will skip clipping code
|
||||
%define SU_USE_DLL_DAMP ; // removing this will skip dll damping code
|
||||
%define SU_USE_DLL_DC_FILTER ; // removing this will skip dll dc offset removal code
|
||||
%define SU_USE_FSTG_CHECK ; // removing this skips checks if processing is needed
|
||||
%define SU_USE_WAVESHAPER_CLIP ; // removing this will skip clipping code
|
||||
%endif
|
||||
|
||||
%ifdef SU_USE_VCO_SHAPE
|
||||
@ -136,22 +136,22 @@
|
||||
; // synth defines
|
||||
; //----------------------------------------------------------------------------------------
|
||||
|
||||
%define MAX_DELAY 65536
|
||||
%define MAX_UNITS 64
|
||||
%define MAX_DELAY 65536
|
||||
%define MAX_UNITS 64
|
||||
%define ABSOLUTE_MAX_VOICES 32
|
||||
|
||||
%ifndef SAMPLE_RATE
|
||||
%define SAMPLE_RATE 44100
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%ifndef HLD
|
||||
%define HLD 1
|
||||
%endif
|
||||
%define HLD 1
|
||||
%endif
|
||||
|
||||
%define TOTAL_ROWS (MAX_PATTERNS*PATTERN_SIZE)
|
||||
%define SAMPLES_PER_ROW (SAMPLE_RATE*4*60/(BPM*16))
|
||||
%define DEF_LFO_NORMALIZE 0.000038
|
||||
%define MAX_SAMPLES (SAMPLES_PER_ROW*TOTAL_ROWS)
|
||||
%define TOTAL_ROWS (MAX_PATTERNS*PATTERN_SIZE)
|
||||
%define SAMPLES_PER_ROW (SAMPLE_RATE*4*60/(BPM*16))
|
||||
%define DEF_LFO_NORMALIZE 0.000038
|
||||
%define MAX_SAMPLES (SAMPLES_PER_ROW*TOTAL_ROWS)
|
||||
|
||||
%macro SU_BEGIN_PATCH 0
|
||||
SECT_DATA(params)
|
||||
@ -163,34 +163,34 @@
|
||||
SECT_DATA(sucomnds)
|
||||
|
||||
EXPORT MANGLE_DATA(su_commands)
|
||||
db CMDS
|
||||
db CMDS
|
||||
%endmacro
|
||||
|
||||
%define CONCATENATE(x,y) x %+ y
|
||||
%define POLYPHONY_BITMASK 0
|
||||
%assign MAX_VOICES 0
|
||||
%assign MAX_TRACKS 0
|
||||
%macro SU_BEGIN_INSTRUMENT 1
|
||||
; increment MAX_VOICES equal to %1 and construct the POLYPHONY_BITMASK so that
|
||||
%macro SU_BEGIN_INSTRUMENT 1
|
||||
; increment MAX_VOICES equal to %1 and construct the POLYPHONY_BITMASK so that
|
||||
; for every except the last, the bit is on
|
||||
%rep %1-1
|
||||
%rep %1-1
|
||||
%assign POLYPHONY_BITMASK POLYPHONY_BITMASK + (1 << MAX_VOICES)
|
||||
%assign MAX_VOICES MAX_VOICES + 1
|
||||
%endrep
|
||||
%endrep
|
||||
%assign MAX_VOICES MAX_VOICES + 1 ; the last voice increment, without adding bit mask
|
||||
%if MAX_VOICES > 32
|
||||
%error Error: cannot have more than 32 voices!
|
||||
%endif
|
||||
%if %1 > 1
|
||||
%define INCLUDE_POLYPHONY
|
||||
%endif
|
||||
%endif
|
||||
%endmacro
|
||||
|
||||
%define VOICES(val) val
|
||||
%define VOICES(val) val
|
||||
%define TRACKS(val) val
|
||||
|
||||
%macro SU_END_INSTRUMENT 0
|
||||
%xdefine CMDS CMDS SU_ADVANCE_ID,
|
||||
%xdefine CMDS CMDS SU_ADVANCE_ID,
|
||||
%endmacro
|
||||
|
||||
%assign PATTERN_LENGTH -1
|
||||
@ -245,18 +245,18 @@
|
||||
%assign MAX_TRACKS MAX_TRACKS + 1
|
||||
%if MAX_TRACKS > 32
|
||||
%error Error: cannot have more than 32 tracks!
|
||||
%endif
|
||||
%endif
|
||||
|
||||
; increment MAX_TRACKS equal to %2 and construct the CHORD_BITMASK so that
|
||||
; for every track except the last track of an instrument, the bit is on
|
||||
%rep %1-1
|
||||
; for every track except the last track of an instrument, the bit is on
|
||||
%rep %1-1
|
||||
%assign VOICETRACK_BITMASK VOICETRACK_BITMASK + (1 << VOICETRACK_COUNT)
|
||||
%assign VOICETRACK_COUNT VOICETRACK_COUNT + 1
|
||||
%endrep
|
||||
%assign VOICETRACK_COUNT VOICETRACK_COUNT + 1 ; the last voice increment, without adding bit mask
|
||||
%assign VOICETRACK_COUNT VOICETRACK_COUNT + 1 ; the last voice increment, without adding bit mask
|
||||
%if VOICETRACK_COUNT > 32
|
||||
%error Error: cannot have more than a total of 32 voices assigned to tracks.
|
||||
%endif
|
||||
%endif
|
||||
%if %1 > 1
|
||||
%define INCLUDE_MULTIVOICE_TRACKS
|
||||
%endif
|
||||
@ -276,21 +276,21 @@ endstruc
|
||||
; //----------------------------------------------------------------------------------------
|
||||
; // Voice struct
|
||||
; //----------------------------------------------------------------------------------------
|
||||
struc su_voice
|
||||
.note resd 1
|
||||
.release resd 1
|
||||
struc su_voice
|
||||
.note resd 1
|
||||
.release resd 1
|
||||
.track resd 1
|
||||
.workspace resb MAX_UNITS * su_unit.size
|
||||
.workspace resb MAX_UNITS * su_unit.size
|
||||
.size
|
||||
endstruc
|
||||
; //----------------------------------------------------------------------------------------
|
||||
; // Synth struct
|
||||
; //----------------------------------------------------------------------------------------
|
||||
struc su_synth
|
||||
struc su_synth
|
||||
.left resd 1
|
||||
.right resd 1
|
||||
.right resd 1
|
||||
.voices resb ABSOLUTE_MAX_VOICES * su_voice.size
|
||||
.size
|
||||
endstruc
|
||||
|
||||
%endif ; SOINTU_INC
|
||||
%endif ; SOINTU_INC
|
||||
|
Reference in New Issue
Block a user