mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-21 06:24:32 -04:00
Get rid of transformed values and use the header of the voice for that; saves _CX completely for the opcode.
This commit is contained in:
@ -78,7 +78,7 @@ EXPORT MANGLE_FUNC(su_op_loadnote,0)
|
||||
call su_op_loadnote_mono
|
||||
su_op_loadnote_mono:
|
||||
%endif
|
||||
fild dword [_CX+su_unit.size-su_voice.workspace+su_voice.note]
|
||||
fild dword [INP-su_voice.inputs+su_voice.note]
|
||||
apply fmul dword, c_i128
|
||||
ret
|
||||
|
||||
|
@ -370,7 +370,7 @@ su_op_delay_loop:
|
||||
%ifdef INCLUDE_DELAY_NOTETRACKING
|
||||
test ah, 1 ; note syncing is the least significant bit of ah, 0 = ON, 1 = OFF
|
||||
jne su_op_delay_skipnotesync
|
||||
fild dword [_CX+su_unit.size-su_voice.workspace+su_voice.note]
|
||||
fild dword [INP-su_voice.inputs+su_voice.note]
|
||||
apply fmul dword, c_i12
|
||||
call MANGLE_FUNC(su_power,0)
|
||||
fdivp st1, st0 ; use 10787 for delaytime to have neutral transpose
|
||||
|
@ -35,6 +35,7 @@ SECT_TEXT(susend)
|
||||
|
||||
EXPORT MANGLE_FUNC(su_op_send,0)
|
||||
lodsw
|
||||
mov _CX, [_SP + su_stack.wrk]
|
||||
%ifdef INCLUDE_STEREO_SEND
|
||||
jnc su_op_send_mono
|
||||
mov _DI, _AX
|
||||
@ -50,7 +51,7 @@ su_op_send_mono:
|
||||
%ifdef INCLUDE_GLOBAL_SEND
|
||||
test _AX, SEND_GLOBAL
|
||||
jz su_op_send_skipglobal
|
||||
mov _CX, PTRWORD su_synth_obj - su_unit.size
|
||||
mov _CX, PTRWORD su_synth_obj
|
||||
su_op_send_skipglobal:
|
||||
%endif
|
||||
test _AX, SEND_POP ; if the SEND_POP bit is not set
|
||||
@ -62,8 +63,8 @@ su_op_send_skippush: ; there is signal s, but maybe also another: s (
|
||||
fadd st0 ; g=2*a-1 l (l)
|
||||
and _AX, 0x0000ffff - SEND_POP - SEND_GLOBAL ; eax = send address
|
||||
fmulp st1, st0 ; g*l (l)
|
||||
fadd dword [_CX+su_unit.size+_AX*4] ; g*l+L (l),where L is the current value
|
||||
fstp dword [_CX+su_unit.size+_AX*4] ; (l)
|
||||
fadd dword [_CX + _AX*4] ; g*l+L (l),where L is the current value
|
||||
fstp dword [_CX + _AX*4] ; (l)
|
||||
ret
|
||||
|
||||
%endif ; SU_USE_SEND > -1
|
||||
|
@ -54,7 +54,7 @@ endstruc
|
||||
%endmacro
|
||||
|
||||
%define AMOUNT(val) val
|
||||
%define PORT(unit,unittype,port) (unit*su_unit.size + su_ %+ unittype %+ _ports. %+ port + su_unit.ports)/4
|
||||
%define PORT(unit,unittype,port) ((unit+1)*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
|
||||
|
@ -17,7 +17,7 @@ EXPORT MANGLE_FUNC(su_op_envelope,0)
|
||||
su_op_envelope_mono:
|
||||
%endif
|
||||
kmENV_func_do:
|
||||
mov eax, dword [_CX+su_unit.size-su_voice.workspace+su_voice.release] ; eax = su_instrument.release
|
||||
mov eax, dword [INP-su_voice.inputs+su_voice.release] ; eax = su_instrument.release
|
||||
test eax, eax ; if (eax == 0)
|
||||
je kmENV_func_process ; goto process
|
||||
mov dword [WRK+su_env_work.state], ENV_STATE_RELEASE ; [state]=RELEASE
|
||||
@ -145,7 +145,7 @@ su_op_oscillat_single:
|
||||
faddp st1
|
||||
test al, byte LFO
|
||||
jnz su_op_oscillat_skipnote
|
||||
fiadd dword [_CX+su_unit.size-su_voice.workspace+su_voice.note] ; // st0 is note, st1 is t+d offset
|
||||
fiadd dword [INP-su_voice.inputs+su_voice.note] ; // st0 is note, st1 is t+d offset
|
||||
su_op_oscillat_skipnote:
|
||||
apply fmul dword,c_i12
|
||||
call MANGLE_FUNC(su_power,0)
|
||||
|
@ -118,7 +118,6 @@ endstruc
|
||||
SECT_BSS(susynth)
|
||||
|
||||
su_synth_obj resb su_synth.size
|
||||
su_transformed_values resd 16
|
||||
|
||||
;===============================================================================
|
||||
; The opcode table jump table. This is constructed to only include the opcodes
|
||||
@ -176,8 +175,7 @@ EXPORT MANGLE_FUNC(su_run_vm,0)
|
||||
%endif
|
||||
mov COM, PTRWORD MANGLE_DATA(su_commands) ; COM points to vm code
|
||||
mov VAL, PTRWORD MANGLE_DATA(su_params) ; VAL points to unit params
|
||||
; su_unit.size will be added back before WRK is used
|
||||
mov WRK, PTRWORD su_synth_obj + su_synth.voices + su_voice.workspace - su_unit.size
|
||||
mov WRK, PTRWORD su_synth_obj + su_synth.voices ; WRK points to the first voice
|
||||
push COM ; Stack: COM
|
||||
push VAL ; Stack: VAL COM
|
||||
push WRK ; Stack: WRK VAL COM
|
||||
@ -192,7 +190,6 @@ su_run_vm_loop: ; loop until all voices done
|
||||
apply {mov al,byte},su_opcode_numparams,_AX,{}
|
||||
push _AX
|
||||
call su_transform_values
|
||||
mov _CX, PTRWORD [_SP+su_stack.wrk]
|
||||
pop _AX
|
||||
shr eax,1
|
||||
apply call,su_synth_commands,_AX*PTRSIZE,{} ; call the function corresponding to the instruction
|
||||
@ -230,13 +227,13 @@ EXPORT MANGLE_FUNC(FloatRandomNumber,0)
|
||||
SECT_TEXT(sutransf)
|
||||
|
||||
su_transform_values:
|
||||
push _CX
|
||||
xor ecx, ecx
|
||||
xor eax, eax
|
||||
mov INP, PTRWORD su_transformed_values
|
||||
mov INP, [_SP+su_stack.wrk+2*PTRSIZE]
|
||||
add INP, su_voice.inputs
|
||||
su_transform_values_loop:
|
||||
cmp ecx, dword [_SP+2*PTRSIZE]
|
||||
jge su_transform_values_out
|
||||
cmp ecx, dword [_SP+PTRSIZE]
|
||||
jnb su_transform_values_out
|
||||
lodsb
|
||||
push _AX
|
||||
fild dword [_SP]
|
||||
@ -248,7 +245,6 @@ su_transform_values_loop:
|
||||
inc ecx
|
||||
jmp su_transform_values_loop
|
||||
su_transform_values_out:
|
||||
pop _CX
|
||||
ret PTRSIZE
|
||||
|
||||
;-------------------------------------------------------------------------------
|
||||
|
@ -236,7 +236,8 @@ endstruc
|
||||
struc su_voice
|
||||
.note resd 1
|
||||
.release resd 1
|
||||
.reserved resb (su_unit.size - 8) ; this is done to so the whole voice is 2^n long, see polyphonic player
|
||||
.inputs resd 8
|
||||
.reserved resd 6 ; this is done to so the whole voice is 2^n long, see polyphonic player
|
||||
.workspace resb MAX_UNITS * su_unit.size
|
||||
.size
|
||||
endstruc
|
||||
@ -245,8 +246,10 @@ endstruc
|
||||
; synth struct
|
||||
;-------------------------------------------------------------------------------
|
||||
struc su_synth
|
||||
.reserved resd 8 ; this is so that left/right/aux ports are aligned to the input ports of units
|
||||
.left resd 1
|
||||
.right resd 1
|
||||
.aux resd 6 ; 3 auxiliary signals
|
||||
.voices resb ABSOLUTE_MAX_VOICES * su_voice.size
|
||||
.size
|
||||
endstruc
|
||||
|
Reference in New Issue
Block a user